Repository navigation
feat(run): add apm run --list for the scripts in apm.yml - #5806
Open
Daniel Meppiel (danielmeppiel) wants to merge 6 commits into
Open
Daniel Meppiel (danielmeppiel) wants to merge 6 commits into
Daniel Meppiel (danielmeppiel) wants to merge 6 commits into
Conversation
J13 step 1 now runs 'apm run --list' against an O1 golden captured from today's 'apm list' (the 0.39 scripts table), and asserts it runs nothing. Step 4's diagnose advice moves to 'apm run --list'. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
'apm run --list' prints the 'apm list' scripts table or the No scripts found panel byte-for-byte, exits 0 and runs nothing, so bare 'apm list' can switch to the agent-config inventory. The script-not-found hint and the docs now point to 'apm run --list'. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Tests are misclassified as unit tests despite filesystem and CLI use, and documentation incorrectly claims that apm list lists installed packages.
2 open issues
What changed in this PR
Adds apm run --list as the scripts-listing entry point for #5756, preparing for a later inventory-focused apm list. Bare apm list remains unchanged.
Changes:
- Reuses the existing renderer and rejects script names or parameters with
--list. - Updates script-discovery hints and documentation.
- Adds frozen-output tests and lifecycle coverage for listing without execution.
| File | Description |
|---|---|
tests/unit/core/test_runnable_prompts.py |
Updates the expected discovery hint. |
tests/unit/commands/test_run_list.py |
Tests output, argument rejection, and no execution. |
tests/quality/generated_obligations.json |
Registers the J13 golden assertion. |
tests/lifecycle/journeys/index.yaml |
Retargets J13 to run --list. |
tests/lifecycle/journeys/goldens/J13/01.txt |
Captures expected listing output. |
tests/lifecycle/journeys/consumer/J13-run-scripts.yaml |
Checks listing and updated recovery advice. |
src/apm_cli/core/script_runner.py |
Updates the script-not-found hint. |
src/apm_cli/commands/run.py |
Adds the listing flag and delegation. |
packages/apm-guide/.apm/skills/apm-usage/commands.md |
Adds the command to the usage guide. |
docs/src/content/docs/troubleshooting/index.md |
Updates scripts and packages guidance. |
docs/src/content/docs/troubleshooting/common-errors.md |
Updates script-discovery advice. |
docs/src/content/docs/reference/cli/run.md |
Documents the option, examples, and exit codes. |
docs/src/content/docs/reference/cli/preview.md |
Links to the new listing entry point. |
docs/src/content/docs/consumer/install-packages.md |
Distinguishes script and package listings. |
changelog.d/5806.added.md |
Announces the new command option. |
Review effort: Balanced
'apm run --list' no longer imports from list_cmd, whose scripts body goes away when bare 'apm list' switches to the inventory. The renderer lives in run.py (a new module would need an architecture owner); output stays byte-identical. The list_cmd unit cases are ported to test_run_list.py. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Mark test_run_list.py as component (it writes apm.yml and drives Click), and keep the docs truthful while bare 'apm list' still lists scripts. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This was referenced Dec 2, 2026
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Dec 3, 2026
…t (S141) D removed the scripts table from list_cmd (run.py is its single owner, #5806). TestListCmd in tests/integration/test_coverage_phase4.py patched list_cmd._list_available_scripts/_get_console and is deleted. Each of its seven behaviours already has an exact oracle in tests/unit/commands/test_run_list.py: - test_no_scripts_shows_warning_and_example -> test_run_list_prints_the_0_39_list_output_and_runs_nothing[no-scripts-panel] (exact bytes) + test_no_scripts_panel_gets_the_example_block - test_scripts_shown_via_fallback_no_console -> test_plain_fallback_without_console[start-is-default, no-default] (exact output) - test_start_script_marked_as_default -> test_run_list_prints_the_0_39_list_output_and_runs_nothing[scripts-table] (exact "[>] | start" row) + test_plain_fallback_without_console[start-is-default] - test_scripts_shown_via_rich_console -> test_rich_console_prints_table_then_default_note (console.print call count) + [scripts-table] exact table - test_exception_in_list_scripts_exits_1 -> test_read_error_exits_1_with_the_error (exit 1 + "[x] Error listing scripts: disk error") - test_no_scripts_rich_panel_import_error_fallback -> test_no_scripts_panel_fallback_on_import_or_name_error (exact output, ImportError and NameError) - test_rich_console_exception_falls_back_to_simple -> test_rich_failure_falls_back_to_plain_once (one plain listing, every name, default note) Stale text after the bare apm list switch: the canvas page's "not shown by apm list", and a lifecycle test docstring that said apm list never reads the lock. (troubleshooting/index.md is B's hunk; fixed there to avoid a merge conflict.) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The failed `apm run missing` prints the exact stderr line "Run 'apm run --list' to see each script and its command." The test runs that step, checks that it reaches the scripts table, and checks that it changes no durable state. Docs: the troubleshooting entry and the run reference no longer say what bare `apm list` shows. The entry points to `apm run --list` for scripts, so it stays true before and after the inventory switch. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-didactic-disco
branch
from
December 3, 2026 02:37
41d2025 to
5b7bb76
Compare
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Dec 3, 2026
Merges B's signed head (no rebase) so D merges cleanly after B on main. packages/apm-guide/.apm/skills/apm-usage/commands.md, Scripts table, resolved to exactly two rows after `apm preview SCRIPT`: B's `apm run --list` row as B has it, then D's `apm list [NAME]` inventory row. The stale "`apm list` | List available scripts" row is removed (S141); no other "List available scripts" or apm-list-means-scripts text remains in the tree. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Description
apm run --listprints the scripts inapm.ymlexactly asapm listprints them today(the "Available Scripts" table, or the "No scripts found" panel), exits 0 and runs nothing.
This is part 1 of #5756: once scripts have this home, bare
apm listcan switch to theagent-config inventory in 0.40 (part 2, a separate PR).
What changes:
apm run --listhas its own scripts renderer incommands/run.py, producing the samebytes as
apm listtoday (checked on the scripts table, the no-scripts panel, noapm.yml, and a brokenapm.yml, exit 1). It does not import fromlist_cmd.py, whosescripts body goes away in part 2. With a
SCRIPT_NAMEor--paramit refuses with ausage error (exit 2) and runs nothing.
Run 'apm run --list' to see each script and its command.apm run --list:reference/cli/run.md(option, example,exit codes, Related),
reference/cli/preview.md,troubleshooting/index.md,troubleshooting/common-errors.md,consumer/install-packages.md, and the apm-usage guide.apm listis unchanged here. Its row in the guide andreference/cli/list.mdstayuntil part 2 switches it.
Issue and approved scope
Issue: Refs #5756
Human scope-approval comment: #5756 (comment)
Does this PR complete the issue, or what remains? Partial. Remaining for #5756: the switch of
bare
apm listto the inventory, with the one stderr line pointing toapm run --listwhileapm.ymlhas scripts, and its J13 assertion.Type of change
Testing
Red first. The test commit (3e66aa9) lands before the fix (543fe6a); 5e95bcf
moves the renderer into run.py and ports the
tests/unit/test_list_command.pycases.The golden
goldens/J13/01.txtwas recorded withregen_goldens.py J13while step 1 stillran
apm liston main (bb90fc7). Only the$ apm listcommand line was then relabelled$ apm run --list.list_cmd.py,_helpers.pyandutils/console.pyhave no diff sincev0.39.4, so these bytes are the previous release's output.
Lint mirror (ruff 0.15.12 check and format, pylint R0801, auth signals, complexity ratchet,
tm006
--changed) is clean locally. Quality gates run:test_journey_index.py,test_cli_docs_surface.py,test_cli_command_literals.py,test_promise_obligations.py,test_test_taxonomy.py.Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.
Agent assessment
equality is pinned by a golden recorded from the current output, and a run-nothing check
is pinned by the journey write-set oracle.