Simplify the Dispatcher usage
Metadata
Current evaluation
Refactor request to simplify craft-cli Dispatcher usage by adding a simple_run helper or implicit pre_parse_args/load_command calls before run. Triaged by maintainer, synced to internal ticket CRAFT-4790, but no code change implemented yet.
Suggested action: keep open
Reason: The issue is labelled Status: Triaged and Type: Refactor, and a maintainer (facundobatista) authored it with a concrete design proposal. The only recent activity is the 2025-09-17 bot comment creating internal ticket CRAFT-4790, indicating it is still tracked. The three-step flow (pre_parse_args, load_command, run) still exists in craft_cli/dispatcher.py, so the request remains applicable.
Impact:
35
Quick Win:
15.75
Staleness:
55
Complexity:
55
Confidence:
70
Support Request:
5
Issue body
Currently, before instantiaton, the following steps are needed:
- `pre_parse_args`: will parse all arguments and return all global args, *very* useful for the app to react on custom global arguments
- `load_command`: useful to pass the loaded app config
- `run`: finally run the command
We could have a more simple usage. Two models are described below:
**The explicit one:**
Let's provide a `simple_run` method (name to be determined) that will be the equivalent to:
```
dispatcher.pre_parse_args(sys.argv[1:]) # sys.argv usage by default, and no use of returned global args
dispatcher.load_command(None) # no app config passed
dispatcher.run()
```
**The implicit one:**
We can assume no special needs in the previous step, and run it implicitly in case it was not run explicitly before:
- if the developer called `load_command` without calling `pre_parse_args` before, just call `pre_parse_args(sys.argv[1:])`.
- if the developer called `run` without calling `load_command`, just call `load_command(None)` (which may trigger previous item too)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.8-27b |
Impact:
35
Quick Win:
15.75
Staleness:
55
Complexity:
55
Confidence:
70
Support Request:
5
|
keep open | Refactor request to simplify craft-cli Dispatcher usage by adding a simple_run helper or implicit pre_parse_args/load_command calls before run. Triaged by maintainer, synced to internal ticket CRAFT-4790, but no code change implemented yet. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
80
Complexity:
55
Confidence:
75
Support Request:
10
|
keep open | Proposal to simplify the Dispatcher API by adding a simple_run method or implicit chaining of existing steps. Labeled as triaged refactor, but inactive for ~10 months with no maintainer discussion or decision. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
92
Complexity:
45
Confidence:
85
Support Request:
5
|
close stale | Proposal to simplify Dispatcher usage by adding a simple_run method or making initialization steps implicit. Triaged as a refactor but inactive for over 9 months with no maintainer discussion or progress. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
75
Complexity:
45
Confidence:
70
Support Request:
5
|
keep open | Simplifies the Dispatcher workflow by replacing the mandatory pre_parse_args, load_command, and run sequence with a direct shortcut or implicit auto-calling of missing steps. Currently triaged and awaiting implementation. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #563 Improved the Dispatcher to work with default global args and support extra ones in the future (CRAFT-565). | charmcraft | merged | Merged Dispatcher improvements for default global arguments and future extras. Refactored naming, relocated help functions, and prepared code for craft-cli extraction. Approved and merged. | |
| #106 refactor: drop _Dispatcher | craft-application | merged | Merged a refactoring that drops the internal _Dispatcher class. Updates craft-cli minimum version to 2.3.0 to leverage its standard Dispatcher.parsed_args() method. Approved by two reviewers, passed CI, and merged successfully. |