docs: add deny and doctor CLI references#2178
Conversation
Add standalone CLI reference pages, complete the reference index, and guard public command discoverability with a contract test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR closes a documentation gap by adding standalone CLI reference pages for apm deny and apm doctor, updating the CLI reference landing-page table to include all public top-level commands, and adding a unit-test contract that enforces “every public Click command must have a same-named reference page and an index link”.
Changes:
- Add new CLI reference pages:
reference/cli/deny.mdandreference/cli/doctor.md. - Complete
docs/src/content/docs/reference/index.mdso all public top-level commands are linked. - Add
tests/unit/test_cli_docs_contract.pyto assert docs coverage for public (non-hidden) Click commands.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_cli_docs_contract.py | Adds a contract test tying Click’s public command registry to docs pages and index links. |
| docs/src/content/docs/reference/index.md | Extends the CLI reference index table to include previously omitted commands (incl. deny/doctor). |
| docs/src/content/docs/reference/cli/doctor.md | Introduces the apm doctor reference page (checks, options, exit codes, examples). |
| docs/src/content/docs/reference/cli/deny.md | Introduces the apm deny reference page (scope, precedence, storage, examples). |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Low
| | Authentication | APM's credential resolver finds a token for `github.com`. The resolver can use environment variables, the GitHub CLI, or a git credential helper. A missing token means unauthenticated rate limits apply. | No | | ||
| | Marketplace config | The `marketplace:` block in `apm.yml`, or legacy `marketplace.yml`, can be parsed when present. | No | | ||
| | Marketplace authoring | Configured output formats, duplicate package names, and version alignment are reported when marketplace config is present. | No | |
|
|
||
| | Flag | Description | | ||
| |---|---| | ||
| | `-v`, `--verbose` | Show detailed diagnostic logging. | |
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 0 | 2 | Docs-only PR with a well-designed contract test; no architectural concerns. |
| CLI Logging Expert | 0 | 0 | 2 | Docs accurately reflect most CLI output contracts; minor wording and duplicate-example concerns. |
| DevX UX Expert | 0 | 2 | 2 | Discoverability improves, but doctor help/docs drift and cross-reference gaps remain. |
| Supply Chain Security Expert | 0 | 0 | 2 | Security claims match source; no security-model drift. |
| OSS Growth Hacker | 0 | 1 | 2 | Strong discoverability win; the contract test prevents future silent funnel gaps. |
| Doc Writer | 0 | 3 | 0 | Deny needs one canonical reference and complete edge behavior; doctor conflicts with existing help and guide text. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 4 follow-ups
- [Doc Writer] Make
deny.mdthe sole canonical reference forapm denyby removing deny-specific synopsis, options, and examples fromapprove.md. -- Two authoritative pages for one command create silent drift. - [Doc Writer] Reconcile doctor help and guide text with
doctor.mdon the gh CLI check claim. -- The implementation has no standalone gh CLI diagnostic. - [Doc Writer] Complete the deny execution contract: state that
apm.ymlis required even with--user, and document the all-types fallback when executable declarations are absent. -- These edge behaviors are implemented but currently omitted or overstated. - [DevX UX Expert] Link the deny precedence reference to the specific section in
approve.md. -- A precise anchor avoids making readers scan a long page.
Architecture
classDiagram
direction LR
class cli {
+commands dict
}
class Command {
+hidden bool
+name str
}
class DocsContract {
+public_command_names() set
+check_pages()
+check_index_links()
}
cli *-- Command : registers
DocsContract ..> cli : reads canonical registry
flowchart TD
A[Public Click commands] --> B[Docs contract]
B --> C[Same-named reference pages]
B --> D[Exact index links]
C --> E[Complete CLI reference]
D --> E
Recommendation
Fold the three doc-truth corrections in this PR: establish one deny command reference, align doctor help and guides with implementation, and document deny's project/fallback behavior. The contract test is the durable win; duplicate examples and benefit-first wording are optional polish.
Full per-persona findings
Python Architect
- [nit] Contract test assertions could name missing commands at
tests/unit/test_cli_docs_contract.py:18.
Bare set assertions work, but explicit deltas make CI failures faster to act on. - [nit] Procedural contract test is the right shape at this scope.
Click remains the canonical owner of the public command surface.
CLI Logging Expert
- [nit] Marketplace authoring wording could mention actionable hints at
docs/src/content/docs/reference/cli/doctor.md:37. - [nit] The CI pre-flight example duplicates the basic invocation at
docs/src/content/docs/reference/cli/doctor.md:68.
DevX UX Expert
- [recommended] Doctor help lists gh CLI as a separate diagnostic domain while the page says it is only a credential source at
src/apm_cli/commands/doctor.py:20. - [recommended] Link deny's precedence reference to the relevant section at
docs/src/content/docs/reference/cli/deny.md:21. - [nit] The doctor CI example repeats the basic command at
docs/src/content/docs/reference/cli/doctor.md:66. - [nit] Confirm deny's synopsis argument name mirrors Click help at
docs/src/content/docs/reference/cli/deny.md:12.
Supply Chain Security Expert
- [nit] Doctor groups three marketplace authoring sub-checks into one conceptual row at
docs/src/content/docs/reference/cli/doctor.md:35. - [nit] Deny intentionally defers the executable-type list to the approve page at
docs/src/content/docs/reference/cli/deny.md:33.
OSS Growth Hacker
- [recommended] Doctor's CI example duplicates the standard example at
docs/src/content/docs/reference/cli/doctor.md:68. - [nit] Deny frontmatter could lead with user intent at
docs/src/content/docs/reference/cli/deny.md:3. - [nit] Doctor frontmatter could lead with troubleshooting benefit at
docs/src/content/docs/reference/cli/doctor.md:3.
Auth Expert -- inactive
No auth implementation, token management, credential resolution, or authorization behavior changed.
Doc Writer
- [recommended] Make
deny.mdthe sole command-specific reference atdocs/src/content/docs/reference/cli/approve.md:2.
approve.mdstill includes deny in its title, synopsis, options, and examples. - [recommended] Complete the documented deny execution contract at
docs/src/content/docs/reference/cli/deny.md:28.
The command requiresapm.ymleven with--user, and missing executable declarations use the all-types fallback. - [recommended] Reconcile doctor check claims across help and documentation at
docs/src/content/docs/reference/cli/doctor.md:34.
Click help and an operating guide describe gh CLI as a separate check thatrun_doctordoes not implement.
Test Coverage Expert -- inactive
Documentation-only PR; no runtime code paths changed.
Performance Expert -- inactive
Docs and contract-test changes do not affect runtime hot paths.
This panel is advisory. It does not block merge. Re-apply the panel-review label after addressing feedback to re-run.
Make deny.md the canonical command reference, document the implemented edge behavior, and align doctor help and guides with the actual diagnostic checks. Addresses apm-review-panel follow-ups for PR #2178. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 0 | 1 | Dynamic Click-to-docs contract is sound; no architectural concerns. |
| CLI Logging Expert | 0 | 0 | 1 | Doctor help is accurate and regression-tested. |
| DevX UX Expert | 0 | 0 | 2 | Deny and doctor follow package-manager reference conventions. |
| Supply Chain Security Expert | 0 | 0 | 0 | Trust semantics remain accurate; no security weakening. |
| OSS Growth Hacker | 0 | 0 | 0 | Schema failure; no findings accepted. |
| Doc Writer | 0 | 0 | 1 | Docs are accurate; align one auxiliary deny synopsis. |
| Test Coverage Expert | 0 | 0 | 0 | Schema failure; deterministic evidence was checked separately. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 2 follow-ups
- [DevX UX Expert] Replace the duplicate
apm doctorCI example with a distinct exit-code composition. -- The second block should demonstrate its stated CI use rather than repeat the basic invocation. - [Doc Writer] Change the apm-guide synopsis from
apm deny [PACKAGE_REF...]toapm deny [OPTIONS] PACKAGES.... -- Brackets imply an optional argument, while Click requires at least one package.
Architecture
flowchart TD
A[Public Click command registry] --> B[Docs contract tests]
B --> C[Same-named reference pages]
B --> D[Exact index links]
C --> E[Complete CLI reference]
D --> E
Recommendation
Fold the two small documentation corrections in this cycle. No strategic, security, or breaking-change concern remains.
Full per-persona findings
Python Architect
- [nit] A symmetric orphan-page check could complement the missing-page guard at
tests/unit/test_cli_docs_contract.py:21.
Stale pages are lower risk; the requested discoverability contract is already covered.
CLI Logging Expert
- [nit] The operating guide could mirror help-domain wording more literally at
docs/src/content/docs/guides/operating-installed-context.md:59.
The current sentence already names Git, network, authentication, and marketplace config, so this is stylistic.
DevX UX Expert
- [nit] The doctor CI example repeats the basic invocation at
docs/src/content/docs/reference/cli/doctor.md:68. - [nit] The deny Related section repeats the precedence deep-link at
docs/src/content/docs/reference/cli/deny.md:61.
Both links are valid and accurate.
Supply Chain Security Expert
No findings.
OSS Growth Hacker
Schema failure after the retry cap; no findings accepted.
Auth Expert -- inactive
No authentication behavior changed.
Doc Writer
- [nit] Align the apm-guide deny synopsis with Click at
packages/apm-guide/.apm/skills/apm-usage/commands.md:274.
Test Coverage Expert
Schema failure after the retry cap; no findings accepted. The doctor help assertion, both docs contract tests, mutation proof, and CI were verified independently.
Performance Expert -- inactive
No performance-relevant path changed.
This panel is advisory. It does not block merge. Re-apply the panel-review label after addressing feedback to re-run.
Make the doctor CI example demonstrate exit-code composition and align the packaged deny synopsis with Click. Addresses final apm-review-panel follow-ups for PR #2178. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 0 | 1 | Thin help change and sound docs contract; no architecture concern. |
| CLI Logging Expert | 0 | 0 | 0 | Doctor help and docs agree on gh CLI as an auth source. |
| DevX UX Expert | 0 | 0 | 0 | Deny and doctor syntax, examples, index, and guides are aligned. |
| Supply Chain Security Expert | 0 | 0 | 0 | Deny and doctor semantics match source. |
| OSS Growth Hacker | 0 | 0 | 0 | Discoverability surfaces improve with no growth concern. |
| Doc Writer | 0 | 0 | 0 | Pages, index, and cross-references match source. |
| Test Coverage Expert | 0 | 0 | 0 | Mutation trap and dynamic docs tests cover changed behavior. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Architecture
flowchart TD
A[Public Click command registry] --> B[Docs contract tests]
B --> C[Same-named reference pages]
B --> D[Exact index links]
C --> E[Complete CLI reference]
D --> E
Recommendation
Merge at maintainer convenience. No follow-ups remain to track.
Folded in this run
- (panel) Made
deny.mdthe canonical command reference -- resolved in3239d24cb. - (panel) Aligned doctor help and guides with implemented checks -- resolved in
3239d24cb. - (panel) Documented deny's project requirement and all-types fallback -- resolved in
3239d24cb. - (panel) Added precise approve/deny precedence cross-links -- resolved in
3239d24cb. - (panel) Replaced the duplicate doctor example with a CI composition -- resolved in
185d5d993. - (panel) Aligned the packaged deny synopsis with Click -- resolved in
185d5d993.
Regression-trap evidence (mutation-break gate)
tests/unit/commands/test_doctor.py::test_apm_doctor_registered_at_top_level-- restored the old standalonegh CLIhelp claim; test FAILED as expected; corrected help restored.
Lint contract
uv run --extra dev ruff check src/ tests/ and uv run --extra dev ruff format --check src/ tests/ passed. Pylint duplication, YAML I/O, file length, portable-path, auth-signal, and architecture-boundary guards also passed.
CI
All required checks passed on 185d5d9931436323f4ea2092eccaa7dc3c5679a3, including CI run https://github.com/microsoft/apm/actions/runs/29197574325 (after 0 CI fix iterations).
Mergeability status
Captured from gh pr view 2178 --json mergeable,mergeStateStatus,statusCheckRollup after the final push.
| PR | head SHA | CEO stance | iters | folds | defers | Copilot rounds | CI | mergeable | mergeStateStatus | notes |
|---|---|---|---|---|---|---|---|---|---|---|
| #2178 | 185d5d9 |
ship_now | 2 | 6 | 0 | 2 | green | MERGEABLE | BLOCKED | pending required review |
Convergence
2 outer iterations; 2 Copilot rounds. Final panel stance: ship_now.
Ready for maintainer review.
Full per-persona findings
Python Architect
- [nit] The docs contract assertions could name missing commands at
tests/unit/test_cli_docs_contract.py:22.
Bare set assertions already catch drift; explicit delta messages would only improve failure readability.
CLI Logging Expert
No findings.
DevX UX Expert
No findings.
Supply Chain Security Expert
No findings.
OSS Growth Hacker
No findings.
Auth Expert -- inactive
Only doctor help text, documentation, and tests changed; no auth behavior changed.
Doc Writer
No findings.
Test Coverage Expert
No findings.
Performance Expert -- inactive
Only a Click help string, documentation, and tests changed; no performance path is affected.
This panel is advisory. It does not block merge. Re-apply the panel-review label after addressing feedback to re-run.
The merge with main brought in PR microsoft#2178's addition of the apm doctor CLI reference and a link to it from operating-installed-context.md using ../reference/cli/doctor/, one level too shallow for a file under guides/. Match the ../../reference/... pattern already used for every other guides -> reference link in this PR, keeping the new check-links.mjs validator green. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c0b49fe3-78ef-479f-8de0-335cb20de336
* fix(docs): correct relative link depths across docs site * docs: clarify common error link labels Replace raw path-shaped link text with readable labels so the corrected destinations are also scannable. Addresses the DevX UX panel follow-up. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test(docs): validate relative link destinations Correct the 3 remaining live ../troubleshooting/ssl-issues/ links to ../../troubleshooting/ssl-issues/ in registry-proxy.md, security.md, and environment-variables.md (PR #2170 fix/docs-relative-link-depths follow-up). Add a dependency-free Node ESM checker (docs/scripts/check-links.mjs) that walks generated docs/dist/**/*.html, extracts real <a href> anchors (not raw markdown/code-fence text), resolves relative destinations against each page's own generated URL under the /apm/ base, and verifies the target exists in dist as a file, a <path>.html file, or a <path>/index.html directory index. Ignores anchors, root-absolute links, http/https, mailto, tel, data, javascript, and query-only hrefs; strips query/hash before filesystem lookup. TDD: docs/scripts/check-links.test.mjs (node:test, 13 cases) was written first against fixture dist trees and confirmed RED (module not found) before the checker was implemented, then GREEN. Mutation-break verified: reverting the registry-proxy.md fix reproduces a nonzero `npm run build` with diagnostics naming the source page, original href, and resolved missing destination; restoring the fix returns the build to green (883 relative links checked across 155 generated pages, 0 false positives). starlight-links-validator alone did not catch this bug class. Wired docs/package.json: `npm run build` now runs `astro build` then the checker; added a separate `test:links` script for the checker's own test suite. Co-authored-by: Jason Tame <jason.tame@tillo.io> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7955c89b-a997-42aa-9c45-ef4c7fe4b1e7 * test(docs): reject links escaping site base Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7955c89b-a997-42aa-9c45-ef4c7fe4b1e7 * fix(docs): correct relative depth for apm doctor link The merge with main brought in PR #2178's addition of the apm doctor CLI reference and a link to it from operating-installed-context.md using ../reference/cli/doctor/, one level too shallow for a file under guides/. Match the ../../reference/... pattern already used for every other guides -> reference link in this PR, keeping the new check-links.mjs validator green. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c0b49fe3-78ef-479f-8de0-335cb20de336 --------- Co-authored-by: danielmeppiel <danielmeppiel@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
document(cli): add deny and doctor references
TL;DR
This PR adds standalone reference pages for
apm denyandapm doctor, thencompletes the CLI reference index for every public top-level command. A dynamic
contract test prevents future commands from shipping without a page or index
link. Closes #2123.
Note
The already-fixed
apm install --targethelp is intentionally unchanged.Problem (WHY)
"
apm denycommand has no documentation page"."
apm doctorcommand has no documentation page"."Reference index table (
reference/index.md) is incomplete":nine public commands were absent from the landing-page table.
documentation artifacts, so future additions could repeat the drift.
Approach (WHAT)
apm denypage covering scope, precedence, storage, and examples.apm doctorpage grounded in the implemented critical and informational checks.Implementation (HOW)
docs/src/content/docs/reference/cli/deny.mddocs/src/content/docs/reference/cli/doctor.mddocs/src/content/docs/reference/index.mdapprove,deny,doctor,find,lifecycle,lock,plugin,publish, andself-updatewithout changing existing pages.tests/unit/test_cli_docs_contract.pyDiagrams
Legend: the new contract derives required artifacts from the actual public
Click registry rather than a second hard-coded command list.
flowchart LR subgraph Registry[Public CLI] C[cli.commands] end subgraph Contract[Documentation contract] T[test_cli_docs_contract.py] end subgraph Reference[CLI reference] P[command-name.md] I[index.md link] end C --> T T --> P T --> I classDef new stroke-dasharray: 5 5; class T,P,I new;Trade-offs
public command its expected route while leaving the existing combined trust
model page intact.
registered Click group adds a small test startup cost, but avoids maintaining
another command inventory that can drift.
GitHub CLI is a credential source, not a separately required critical check.
Benefits
landing page.
Validation
uv run --extra dev pytest tests/unit/test_cli_docs_contract.py -q:Mutation-break proof
With
doctor.mdtemporarily removed:Documentation build and link validation
npm --prefix docs run build:Lint and boundary checks
uv run --extra dev ruff check src/ tests/anduv run --extra dev ruff format --check src/ tests/:Pylint duplication, auth boundary, architecture boundary, YAML I/O,
file-length, and portable-path guards:
Scenario Evidence
apmcommand has a reference page at the expected route.tests/unit/test_cli_docs_contract.py::test_public_commands_have_reference_pages(regression-trap for #2123)apmcommand is discoverable from the reference landing page.tests/unit/test_cli_docs_contract.py::test_public_commands_are_linked_from_reference_index(regression-trap for #2123)How to test
uv run --extra dev pytest tests/unit/test_cli_docs_contract.py -q;expect two passing tests.
npm --prefix docs run build; expect both new routes to build andinternal link validation to pass.
including
denyanddoctor, to be linked.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com