cli-worker
Implements CLI command changes, module refactoring, and test updates for mlx-stack
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Implements CLI command changes, module refactoring, and test updates for mlx-stack
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | cli-worker |
| description | Implements CLI command changes, module refactoring, and test updates for mlx-stack |
NOTE: Startup and cleanup are handled by worker-base. This skill defines the WORK PROCEDURE.
Use for features that involve:
main.pyNone — all work uses standard file editing and shell commands (pytest, pyright, ruff).
Read the feature description, preconditions, expectedBehavior, and verificationSteps carefully. Read AGENTS.md for conventions and boundaries. Read .factory/library/architecture.md for system structure.
Before writing any code, read ALL files that will be affected:
cli/main.py if command registration changesUnderstand the existing patterns, mock strategies, and test structure.
Write failing tests BEFORE implementing changes:
uv run pytest tests/unit/<test_file> -x -q --tb=short to confirm tests fail (red)Test patterns to follow:
from click.testing import CliRunner
from mlx_stack.cli.main import cli
def test_example(mlx_stack_home):
runner = CliRunner()
with patch("mlx_stack.core.module.function") as mock_fn:
result = runner.invoke(cli, ["command", "--flag", "arg"])
assert result.exit_code == 0
assert "expected output" in result.output
mock_fn.assert_called_once_with(...)
Make the minimum changes needed to make all tests pass:
cli/main.py command registration if neededFollow existing patterns:
console = Console(stderr=True) for errors, out = Console() for outputraise SystemExit(1)from mlx_stack.core.module import Classuv run pytest tests/unit/<test_file> -x -q --tb=shortuv run pytest --cov=src/mlx_stack -x -q --tb=shortuv run python -m pyrightuv run ruff check src/ tests/For each changed command, run a quick manual check:
uv run mlx-stack --help # verify help output
uv run mlx-stack <command> --help # verify command help
If the feature removes a command, verify it's gone:
uv run mlx-stack <removed-command> # should show error
{
"salientSummary": "Ungated pull command to accept HF repo strings. Added slash-based routing (contains '/' = HF repo, no '/' = catalog ID). Wrote 12 new tests in test_cli_pull.py covering HF repo acceptance, error handling, and flag combinations. All 1400+ tests pass, pyright clean, ruff clean.",
"whatWasImplemented": "Modified cli/pull.py to detect HF repo strings (containing '/') and bypass catalog lookup, routing directly to download_model(). Updated core/pull.py pull_model() to accept hf_repo_override parameter. Updated help text to document both input types. Added 12 new test cases and updated 3 existing tests.",
"whatWasLeftUndone": "",
"verification": {
"commandsRun": [
{ "command": "uv run pytest tests/unit/test_cli_pull.py -x -q --tb=short", "exitCode": 0, "observation": "77 passed (12 new + 65 existing)" },
{ "command": "uv run pytest --cov=src/mlx_stack -x -q --tb=short", "exitCode": 0, "observation": "1412 passed, 0 failed" },
{ "command": "uv run python -m pyright", "exitCode": 0, "observation": "0 errors, 0 warnings" },
{ "command": "uv run ruff check src/ tests/", "exitCode": 0, "observation": "All checks passed" },
{ "command": "uv run mlx-stack pull --help", "exitCode": 0, "observation": "Help text mentions HF repo and catalog ID" }
],
"interactiveChecks": [
{ "action": "Ran 'uv run mlx-stack pull --help'", "observed": "Help text now says 'MODEL is a catalog model ID (e.g., qwen3.5-8b) or HuggingFace repo (e.g., mlx-community/Phi-5-Mini-4bit)'" }
]
},
"tests": {
"added": [
{
"file": "tests/unit/test_cli_pull.py",
"cases": [
{ "name": "test_pull_hf_repo_downloads_directly", "verifies": "HF repo string bypasses catalog lookup" },
{ "name": "test_pull_hf_repo_with_quant_stores_metadata", "verifies": "--quant flag stores metadata for HF repo" },
{ "name": "test_pull_hf_repo_nonexistent_shows_error", "verifies": "Invalid HF repo shows user-friendly error" }
]
}
]
},
"discoveredIssues": []
}