-
Notifications
You must be signed in to change notification settings - Fork 0
Document completed console migration: prompt-toolkit/Rich REPL as sole interactive console #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,33 @@ | ||
| # Built-in module authoring | ||
|
|
||
| A module declares a `ModuleDescriptor` and a `cmd2.CommandSet` in the explicit | ||
| registry. Its console adapter delegates to a service; it must not open storage, | ||
| read secrets, call providers, or implement business rules directly. Add the same | ||
| argument parser action to the one-shot dispatcher and command set so behavior and | ||
| errors remain identical. The user-facing command inventory belongs in | ||
| [the CLI reference](CLI.md), rather than module-specific documentation. | ||
|
|
||
| Modules are built-in only in v1. Add tests proving disabled modules are not | ||
| imported, commands are unavailable, service DTOs serialize, secrets stay out of | ||
| history, and offline defaults make no network calls. | ||
| A built-in module is registered through the explicit module registry with a | ||
| `ModuleDescriptor` and transport-neutral `CommandSpec`. The descriptor records | ||
| the module identity, summary, implementation path, and supported action names. | ||
| The command specification records action metadata and typed arguments used by | ||
| both one-shot CLI execution and the prompt-toolkit/Rich REPL. | ||
|
|
||
| Module authors should add or update the command specification first, then wire | ||
| the action to a thin dispatcher that delegates to an application service. The | ||
| dispatch layer must not open storage directly, read secrets, call providers, or | ||
| implement business rules. Services return serializable DTOs, progress events, | ||
| or stable `AncestryError` instances so terminal, JSON, and future adapters can | ||
| present the same result contract. | ||
|
|
||
| Interactive behavior is derived from the shared metadata: | ||
|
|
||
| - one-shot `ancestry MODULE ACTION ...` parsing and validation; | ||
| - root-level direct module commands in the REPL; | ||
| - active-module `run ACTION ...` routing; | ||
| - help text, action listings, and option validation; and | ||
| - privacy-filtered completion. | ||
|
|
||
| Do not author terminal-specific command classes for new modules. A module | ||
| should not depend on prompt-toolkit, Rich, or any console input framework. Rich | ||
| rendering belongs in presentation adapters only, and JSON output must remain a | ||
| serialization of the same service result. | ||
|
|
||
| The user-facing command inventory belongs in [the CLI reference](CLI.md), | ||
| rather than module-specific documentation. Modules are built-in only in v1. Add | ||
| tests proving disabled modules are not imported, commands are unavailable, | ||
| service DTOs serialize, secrets stay out of history, and offline defaults make | ||
| no network calls. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In environments where operators still need the cmd2 fallback, this statement is inaccurate:
src/ancestryllm/cli.py:349-352still special-casesancestry --legacy-consoleand launchesAncestryConsole, and the regression testtest_main_uses_default_shell_legacy_console_and_preserves_one_shot_dispatchstill asserts that path works. Removing the documented compatibility path makes the console guide and migration status misleading until the reachable flag and shipped cmd2 console are actually removed.Useful? React with 👍 / 👎.