Skip to content

test(scripts): cover check-docs-cli-commands - #7296

Open
amengnew wants to merge 1 commit into
heygen-com:mainfrom
amengnew:test/check-docs-cli-commands
Open

amengnew wants to merge 1 commit into
heygen-com:mainfrom
amengnew:test/check-docs-cli-commands

Conversation

@amengnew

@amengnew amengnew commented Nov 6, 2026

Copy link
Copy Markdown

Summary

scripts/check-docs-cli-commands.mjs runs in CI (docs.yml) and enforces that every CLI command is documented, but it has no tests — a refactor of packages/cli/src/cli.ts could make it pass vacuously.

This extracts the comparison into checkDocsCliCommands(cliSource, docsText), keeps the CLI entry behaviour identical (same message, same exit code), and adds scripts/check-docs-cli-commands.test.mjs to test:scripts.

Change

  • scripts/check-docs-cli-commands.mjs
    • new exported checkDocsCliCommands(cliSource, docsText) → { commands, missing }
    • throws the existing "no longer declares const commandLoaders = { ... };" error when the declaration or its closing brace is missing (previously a missing closing brace sliced to the end of the file silently)
    • main() keeps the previous read/console/exit behaviour and runs only when the file is executed directly
  • scripts/check-docs-cli-commands.test.mjs — pass, missing command, missing command-finder section, missing commandLoaders, unclosed commandLoaders block
  • root package.json — added the test file to test:scripts

Verification

  • node --test scripts/check-docs-cli-commands.test.mjs → 5 pass / 0 fail
  • refactored script against the real checkout: node scripts/check-docs-cli-commands.mjs → All 55 CLI commands are listed in the docs. — same command count as the previous implementation (55 commands, 0 missing)
  • I could not run the full bun run test:scripts locally (it needs the full monorepo install); the new file uses the same node --test runner the existing entries use, so CI will cover the whole list.

Fixes #7278

Prepared with AI assistance (implementation and tests); I ran the commands above locally and reviewed the diff.

SanHsien added a commit to SanHsien/hyperframes that referenced this pull request Nov 6, 2026
…, record duplicate rule

Review PR heygen-com#7304-heygen-com#7335: 10 merged already adopted or deferred; 10 open or draft PRs
pinned (heygen-com#7304, heygen-com#7308, heygen-com#7311, heygen-com#7315, heygen-com#7321, heygen-com#7330-heygen-com#7334); open duplicates of
pinned heygen-com#7281/heygen-com#7285/heygen-com#7286/heygen-com#7296 are tracked by those pins. strict exit 0;
monitored 110 -> 120.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 66d747e10b289ff2e0cf617da938c56d6d11ec65.

The existing docs checker is now importable without executing its CLI entry (scripts/check-docs-cli-commands.mjs:24,60). The tested missing/malformed command-loader declarations fail loudly, and the new tests are wired into the root runner. Compared with #7335, this modifies the actual CI script and uses the correct test location.

Validation at this head: node --test scripts/check-docs-cli-commands.test.mjs → 5 passed. Running the real entry prints All 55 CLI commands are listed in the docs. Fresh independent source review found no Important defect; no live browser or native Windows run. No prior substantive reviews or inline comments were present.

Need: yes, requested starter issue · Size: ok · Reuse: existing CLI policy, color and checker helpers · Simpler: already minimal · Structure: fine
Risk: low — bounded CLI output/checker change

— hf-review

Verdict: APPROVE
Reasoning: The requested behavior is covered by focused tests and reuses the existing contract. No Important blocker found.

@amengnew

amengnew commented Nov 9, 2026

Copy link
Copy Markdown
Author

Quick note, not a bump: the workflows for the latest commit (a719987, the oxfmt fix) haven't been triggered — the run list for that SHA is empty, and the earlier runs were action_required pending approval. Whenever it's convenient, approving the run would let the format fix be verified. Happy to wait.

The docs check has no tests, so a refactor of packages/cli/src/cli.ts could
make it pass vacuously. Extract the command/docs comparison into
checkDocsCliCommands(cliSource, docsText) and cover the pass, missing
command, missing command-finder section and missing commandLoaders cases
with node:test.

The CLI entry keeps the previous output and exit code, and the new test
file runs in test:scripts.
@amengnew
amengnew force-pushed the test/check-docs-cli-commands branch from bd4cd1f to 0b834ae Compare November 11, 2026 06:38
@amengnew

Copy link
Copy Markdown
Author

Rebased onto current main to clear the conflict that appeared once the branch went stale — the test:scripts list in package.json had moved on, so the branch is now a single commit on top of main with the same three-file change.

Re-verified on the new base: node --test scripts/check-docs-cli-commands.test.mjs → 5 pass, node scripts/check-docs-cli-commands.mjs → "All 55 CLI commands are listed in the docs.", oxfmt --check clean.

The workflows for the new head will need approval again whenever convenient — no rush.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests for scripts/check-docs-cli-commands.mjs

2 participants