Skip to content

Conversation

@kylemclaren
Copy link
Collaborator

Summary

  • Adds TypeScript scripts to auto-generate CLI documentation at build time
  • Runs actual CLI commands with test credentials to validate they work (catches regressions)
  • Parses --help output to generate commands.mdx
  • Posts test results as PR comment

Tests Run (12 total)

Basic tests:

  • sprite org list, sprite list, sprite exec echo test
  • sprite checkpoint list, sprite url, sprite api /v1/sprites
  • sprite upgrade --check

Dependent tests (require outputs from previous commands):

  • sprite checkpoint create → captures checkpoint ID
  • sprite checkpoint info <id>
  • sprite url update --auth public--auth default
  • sprite restore <id>

Usage

# Run with tests (needs SPRITES_TEST_TOKEN)
pnpm generate:cli-docs

# Skip tests (for local dev)
SKIP_CLI_TESTS=true pnpm generate:cli-docs

CI Integration

  • Runs as prebuild hook before astro build
  • Posts test report as PR comment
  • Requires SPRITES_TEST_TOKEN secret (already added)

Test plan

  • CI workflow runs and posts PR comment with test results
  • Generated commands.mdx builds correctly
  • Preview deployment works

🤖 Generated with Claude Code

- Add TypeScript scripts to generate CLI docs at build time
- Run actual CLI commands with test credentials to validate they work
- Parse --help output to generate commands.mdx
- Run 12 tests: basic commands + dependent tests (checkpoint info, url update, restore)
- Post test results as PR comment in CI
- Add prebuild hook to run generator before astro build
- Skip tests in Dockerfile (no API access during Docker build)

Requires SPRITES_TEST_TOKEN secret in GitHub repo settings.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Jan 12, 2026

CLI Documentation Generator

Metric Value
CLI Version 0.0.1
Commands Generated 24
Tests ✅ 12/12 passed
📚 Commands documented
  • sprite login
  • sprite logout
  • sprite org auth
  • sprite org list
  • sprite org logout
  • sprite org keyring disable
  • sprite org keyring enable
  • sprite auth setup
  • sprite create
  • sprite use
  • sprite list
  • sprite destroy
  • sprite exec
  • sprite console
  • sprite checkpoint create
  • sprite checkpoint list
  • sprite checkpoint info
  • sprite checkpoint delete
  • sprite restore
  • sprite proxy
  • sprite url
  • sprite url update
  • sprite api
  • sprite upgrade

The Sprites install script uses bash-specific features (set -o pipefail)
which aren't supported by dash (Ubuntu's default sh).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add verification step to test CLI auth before build
- Use SPRITE_TOKEN env var (CLI recognizes it directly)
- Remove duplicate generate:cli-docs call (prebuild already runs it)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The SPRITE_TOKEN env var alone doesn't work for fresh installs.
Use `sprite auth setup --token` to properly configure authentication.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace misleading SPRITE_TOKEN env var section with sprite auth setup --token
- Add GitHub Actions example
- Update security best practices

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The Sprites install script requires bash (uses set -o pipefail).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The node:22-slim image doesn't include CA certificates,
causing curl to fail when downloading the install script.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

Preview Deployment

Name URL
Preview https://pr-67-superfly-sprites-docs.fly.dev

Commit: d003810

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

E2E Test Results

❌ Tests failure

Ran against: https://pr-67-superfly-sprites-docs.fly.dev

- Generate CLI docs in CI, commit result (not generated on every build)
- Simplify Dockerfile: remove CLI installation
- Remove prebuild hook from package.json
- Keep generate:api for API docs (still generated on build)
- Add Callout margin fix
- Update checkpoints.mdx to use Callout component

This approach:
- Makes Docker builds simpler and faster
- Makes deploys more reliable (no external API dependency)
- Makes doc changes visible in PRs for review

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Publish the CLI installation and authentication pages by removing
draft: true, and add a CLI Reference section to the sidebar with
Installation, Authentication, and Commands pages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The CI workflow now commits updated CLI documentation back to the PR
branch when changes are detected. This ensures the generated docs
stay in sync with the CLI.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
github-actions bot and others added 3 commits January 14, 2026 10:30
Change preview workflow to trigger on workflow_run after CI completes
instead of running in parallel. This ensures the generated CLI docs
are committed before the preview build runs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move preview deployment job into CI workflow to run after build completes.
This ensures generated CLI docs are available before the Docker build.

Simplify fly-preview.yml to only handle cleanup when PRs are closed.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Both jobs run after preview deployment completes:
- E2E tests run Cypress against the preview URL
- Lighthouse CI audits changed pages for performance

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kylemclaren kylemclaren merged commit 85d3ad8 into main Jan 14, 2026
3 of 5 checks passed
@kylemclaren kylemclaren deleted the cli-docs-generator branch January 14, 2026 11:14
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.

2 participants