Prevent plugin command aliases from becoming prompts

Added focused Python-port regressions for plugin, plugins, marketplace, and reload-plugins command routing, execution, stream, and turn-loop paths; narrowed runtime routing to honor explicit leading commands before fuzzy inventory matches.

Constraint: Task 10 scope limited changes to tests/test_porting_workspace.py plus narrow src parser/runtime fixes only if required.

Rejected: Test-only coverage without alias routing fix | route /plugin previously preferred fuzzy AddMarketplace over exact plugin command.

Confidence: high

Scope-risk: narrow

Directive: Keep --no-plugin-commands excluding plugin source hints; do not reinterpret that intentional filter as fallthrough.

Tested: python3 -m unittest tests.test_porting_workspace; python3 -m compileall src tests/test_porting_workspace.py; CLI route/turn-loop/filter smoke for /plugin, /plugins, /marketplace, /reload-plugins.

Not-tested: Full repository non-Python/Rust suites.
This commit is contained in:
bellman
2026-05-15 09:54:38 +09:00
parent b655d49bd1
commit 5de73ecf12
3 changed files with 108 additions and 2 deletions

View File

@@ -35,6 +35,11 @@ def load_command_snapshot() -> tuple[PortingModule, ...]:
PORTED_COMMANDS = load_command_snapshot()
COMMAND_ALIASES = {
'plugins': 'plugin',
'marketplace': 'plugin',
}
@lru_cache(maxsize=1)
def built_in_command_names() -> frozenset[str]:
@@ -50,7 +55,7 @@ def command_names() -> list[str]:
def get_command(name: str) -> PortingModule | None:
needle = name.lower()
needle = COMMAND_ALIASES.get(name.lower(), name.lower())
for module in PORTED_COMMANDS:
if module.name.lower() == needle:
return module