Skip to content

refactor(docs): gitignore generated command docs, extract fragments#696

Merged
BYK merged 4 commits intomainfrom
refactor/gitignore-generated-docs
Apr 9, 2026
Merged

refactor(docs): gitignore generated command docs, extract fragments#696
BYK merged 4 commits intomainfrom
refactor/gitignore-generated-docs

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 9, 2026

Summary

  • Gitignore generated command docs (docs/src/content/docs/commands/) — they're rebuilt at build time from CLI metadata + hand-written fragments
  • Extract hand-written examples/guides into docs/src/fragments/commands/ (19 fragment files)
  • Snap PERIOD_BRIEF example dates to 1st of month (~12 changes/year instead of 365)
  • Skill files (plugins/sentry-cli/skills/sentry-cli/) remain committed for external plugin consumers, with slimmed CI auto-commit

Motivation

Generated files with dynamic dates (PERIOD_BRIEF computed from new Date()) caused daily churn in PRs via CI auto-commit. Command docs were a mix of auto-generated flag tables and hand-written content, making them impossible to gitignore without losing the custom parts.

Changes

Fragment extraction

  • Split each command doc into: generated part (gitignored output) + hand-written fragment (committed source)
  • generate-command-docs.ts now reads custom content from docs/src/fragments/commands/{route}.md
  • New check:fragments script validates fragment ↔ route consistency

Build pipeline

  • New generate:docs composite script chains generate:command-docsgenerate:skill
  • All dependent scripts (dev, build, typecheck, test:*) use generate:docs instead of generate:skill
  • CI build-docs and docs-preview jobs run generation before astro build

CI simplification

  • check-skill job → check-generated: validates fragments, auto-commits skill files only (not command docs)
  • Deleted generate-skill.yml workflow (superseded by check-generated)
  • Deleted check:skill and check:command-docs scripts (replaced by check:fragments)

Command docs (docs/src/content/docs/commands/*.md) were a mix of
auto-generated flag tables and hand-written examples. Both halves
changed on every CI run due to dynamic PERIOD_BRIEF dates, creating
daily noise in PRs via auto-commit.

Split hand-written content into fragment files (docs/src/fragments/
commands/) and gitignore the generated output. The docs build and CI
now run generate:docs before astro build.

Skill files (plugins/sentry-cli/skills/sentry-cli/) remain committed
since they are consumed directly by external plugin systems. PERIOD_BRIEF
dates are snapped to the 1st of the month to reduce churn from daily
to ~monthly.

- Add generate:docs composite script (generate:command-docs + generate:skill)
- Replace generate:skill with generate:docs in all dependent scripts
- Extract 19 command doc fragments from below the GENERATED:END marker
- Update generate-command-docs.ts to read from fragments directory
- Add check:fragments validation script, remove check:skill/check:command-docs
- Update CI: generation before docs build, slimmed auto-commit for skill files only
- Delete generate-skill.yml workflow (superseded by CI check-generated job)
- Snap PERIOD_BRIEF example dates to 1st of month
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (commands) Add buildRouteMap wrapper with standard subcommand aliases by BYK in #690

Bug Fixes 🐛

  • (init) Narrow command validation to actual shell injection vectors by betegon in #697
  • (init,feedback) Default to tracing only in feature select and attach user email to feedback by MathurAditya724 in #688

Internal Changes 🔧

  • (docs) Gitignore generated command docs, extract fragments by BYK in #696
  • (eval) Replace OpenAI with Anthropic SDK in init-eval judge by betegon in #683
  • (init) Use markdown pipeline for spinner messages by betegon in #686
  • Regenerate skill files and command docs by github-actions[bot] in 584ec0e0

🤖 This preview updates automatically when you update the PR.

BYK added 2 commits April 9, 2026 10:08
…nerated-docs

# Conflicts:
#	docs/src/content/docs/commands/dashboard.md
#	docs/src/content/docs/commands/event.md
#	docs/src/content/docs/commands/issue.md
#	docs/src/content/docs/commands/span.md
#	docs/src/content/docs/commands/trace.md
#	docs/src/fragments/commands/log.md
#	plugins/sentry-cli/skills/sentry-cli/references/dashboard.md
#	plugins/sentry-cli/skills/sentry-cli/references/event.md
#	plugins/sentry-cli/skills/sentry-cli/references/issue.md
#	plugins/sentry-cli/skills/sentry-cli/references/log.md
#	plugins/sentry-cli/skills/sentry-cli/references/span.md
#	plugins/sentry-cli/skills/sentry-cli/references/trace.md
generate-command-docs.ts imports src/app.js which transitively imports
agent-skills.ts → skill-content.ts. On fresh CI checkouts the file
doesn't exist yet. Use dynamic import() after writing a minimal stub
to break the circular dependency with generate:skill.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/pr-preview/pr-696/

Built to branch gh-pages at 2026-04-09 10:25 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Codecov Results 📊

134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1480 uncovered lines.
✅ Project coverage is 95.45%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    95.43%    95.45%    +0.02%
==========================================
  Files          224       224         —
  Lines        32538     32532        -6
  Branches         0         0         —
==========================================
+ Hits         31052     31052         —
- Misses        1486      1480        -6
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK marked this pull request as ready for review April 9, 2026 10:24
@BYK BYK enabled auto-merge (squash) April 9, 2026 10:24
…nerated-docs

# Conflicts:
#	docs/src/content/docs/commands/dashboard.md
#	docs/src/content/docs/commands/event.md
#	docs/src/content/docs/commands/issue.md
#	docs/src/content/docs/commands/span.md
#	docs/src/content/docs/commands/trace.md
#	docs/src/fragments/commands/log.md
#	plugins/sentry-cli/skills/sentry-cli/references/dashboard.md
#	plugins/sentry-cli/skills/sentry-cli/references/event.md
#	plugins/sentry-cli/skills/sentry-cli/references/issue.md
#	plugins/sentry-cli/skills/sentry-cli/references/log.md
#	plugins/sentry-cli/skills/sentry-cli/references/span.md
#	plugins/sentry-cli/skills/sentry-cli/references/trace.md
@BYK BYK merged commit dd4f76e into main Apr 9, 2026
27 checks passed
@BYK BYK deleted the refactor/gitignore-generated-docs branch April 9, 2026 10:30
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0dca797. Configure here.

// Must run before the dynamic import below (static imports hoist above top-level await).
const SKILL_CONTENT_PATH = "src/generated/skill-content.ts";
const SKILL_CONTENT_STUB =
"export const SKILL_FILES: [string, string][] = [];\n";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Inconsistent stub types for same generated file

Low Severity

The generate-command-docs.ts script creates a stub for src/generated/skill-content.ts that declares SKILL_FILES as an array. This conflicts with the ReadonlyMap type used in the actual file generated by generate-skill.ts. Since generate-command-docs.ts runs first, its stub can persist, leading to a type mismatch that may cause runtime errors when using Map-specific methods.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0dca797. Configure here.

const d = new Date();
d.setDate(1);
return d.toISOString().slice(0, 10);
})();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Date snapping uses local time with UTC output

Low Severity

EXAMPLE_START and EXAMPLE_END use setDate(1) which operates in local time, but toISOString().slice(0, 10) extracts the UTC date. In positive UTC-offset timezones (e.g. UTC+12) during the first hours of a new month, the UTC date is still the last day of the previous month, producing e.g. "2026-03-31" instead of "2026-04-01". This partially defeats the PR's goal of snapping to the 1st of the month for ~12 changes/year. The old EXAMPLE_END code (new Date().toISOString().slice(0, 10)) didn't have this problem since it wasn't targeting a specific day. Using setUTCDate(1) and setUTCMonth() would make the output consistently correct across all timezones.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0dca797. Configure here.

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.

1 participant