Skip to content

feat(docs): emit Mintlify lifecycle metadata and snippet notices for beta/deprecated commands#963

Merged
dangrondahl merged 6 commits into
mainfrom
cli-lifecycle-notices
Jun 19, 2026
Merged

feat(docs): emit Mintlify lifecycle metadata and snippet notices for beta/deprecated commands#963
dangrondahl merged 6 commits into
mainfrom
cli-lifecycle-notices

Conversation

@dangrondahl

Copy link
Copy Markdown
Contributor

Teaches the CLI doc generator to emit Mintlify lifecycle front matter (tag: "BETA" / tag: "DEPRECATED", hidden: true) and to render beta/deprecated notices via reusable docs snippets (<CliBetaNotice />, <CliDeprecatedNotice />) instead of inline prose.

Adds a docHidden annotation so hidden-but-documented commands still get a generated page. Wires the evaluate tree (beta) and attest decision (beta + docHidden) to the real annotations and removes the [BETA] text prefixes. Dedupes the generic deprecation string into one constant and suppresses that boilerplate from generated pages (the snippet conveys it), while preserving real per-command migration hints.

The explanatory wording now lives in the docs repo snippets, not in Go.

Draft until kosli-dev/docs#280 lands — the generated MDX imports /snippets/cli-*-notice.mdx, which only exist after that PR merges. Mark ready for review once #280 is on docs main.

@claude

claude Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Claude finished @dangrondahl's task in 2m 22s —— View job


Claude PR Review

  • Gather context (read changed files)
  • Static analysis (go build, go vet, go mod tidy)
  • Code review (quality, bugs, edge cases, tests)
  • Post review feedback

Summary

Clean, well-tested change. The doc generator now emits Mintlify lifecycle front matter (tag: "BETA"/tag: "DEPRECATED", hidden: true), renders notices via reusable snippets, and the docHidden annotation lets hidden-but-documented commands (attest decision) still produce a page. The generic deprecation string is deduped into deprecatedCommandMsg and suppressed from generated prose while custom migration hints are preserved.

Static analysis ✅

  • go build ./... — clean
  • go vet ./... — clean
  • go mod tidy + git diff --exit-code go.mod go.sum — clean (MOD_CLEAN)

⚠️ I could not run the test suites (go test requires approval in this environment, and cmd/kosli tests need the local Kosli server). Build/vet confirm compilation; the new tests read as correct but were not executed here.

Both earlier review comments are resolved 👍

  1. MDX-escaping the migration hintDeprecatedWarning now routes message through escapeMintlifyProse (internal/docgen/mintlify.go:54), with a comment explaining why.
  2. Body/tag precedence consistencygenMarkdownCustom now emits the beta notice only if meta.Beta && !meta.Deprecated (internal/docgen/generate.go:66), matching lifecycleTag's deprecated-wins rule. TestMintlifyFrontMatterDeprecatedWinsOverBeta covers the front-matter side.

Strengths

  • Good single-source-of-truth refactor: deprecatedCommandMsg + betaCLIAnnotation constants replace scattered string literals; deprecationHint cleanly separates generic boilerplate (suppressed, snippet conveys it) from real per-command hints.
  • Thorough, focused unit tests in mintlify_test.go, generate_test.go, and the new lifecycle_test.go — including the doc-hidden, deprecated-included, and "no [BETA] prefix" cases. Golden files (artifact.md, snyk.md) updated to match.
  • The DocHiddenAnnotation abstraction is well-placed in docgen with a clear doc comment, and the tree walker correctly extends the skip condition (generate.go:19-20).

Minor observations (non-blocking)

  • Untested body branch. The meta.Beta && !meta.Deprecated precedence in the body (generate.go:66) has no direct test — only the front-matter equivalent does. Since no command is currently both, this is low priority, but a small genMarkdownCustom-level test asserting a both-flags command renders only the deprecated snippet (and a single import) would lock the invariant in. Fix this →
  • Exact-match suppression. deprecationHint suppresses the generic text via exact string equality with deprecatedCommandMsg (root.go:605). That's the right mechanism now that all generic uses share the constant, but it's worth keeping in mind that any future divergent wording (extra whitespace/punctuation) would silently leak the boilerplate into the page. The dedup makes this safe today.

Note on draft status

As the description says, this stays draft until kosli-dev/docs#280 lands — the generated MDX imports /snippets/cli-*-notice.mdx, which don't exist until that PR merges. Worth confirming #280 is on docs main before marking ready.

Overall this is a solid, reviewable slice that follows the repo's conventions well. ✅

Comment thread internal/docgen/mintlify.go
Comment thread internal/docgen/mintlify.go
- Update snyk.md/artifact.md goldens for the new tag/hidden front matter
  and snippet-based deprecation notice (fixes TestDocsCommandTestSuite).
- Escape the deprecation migration message via escapeMintlifyProse so a
  future hint containing <, {, or > cannot break the MDX build.
- Skip the beta notice when a command is also deprecated, keeping the body
  consistent with lifecycleTag's deprecated-over-beta precedence.
@dangrondahl dangrondahl marked this pull request as ready for review June 19, 2026 16:27
@dangrondahl dangrondahl enabled auto-merge (squash) June 19, 2026 18:49
@dangrondahl dangrondahl merged commit 246109f into main Jun 19, 2026
20 checks passed
@dangrondahl dangrondahl deleted the cli-lifecycle-notices branch June 19, 2026 18:53
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