Skip to content

feat(cli): lint ```metadata doc embeds — body + reference liveness (ADR-0051 P1)#1965

Merged
os-zhuang merged 2 commits into
mainfrom
feat/adr-0051-publish-lint
Jun 16, 2026
Merged

feat(cli): lint ```metadata doc embeds — body + reference liveness (ADR-0051 P1)#1965
os-zhuang merged 2 commits into
mainfrom
feat/adr-0051-publish-lint

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Completes the ADR-0051 P1 publish lint — the last P1 item after the ADR (#1940), spec (#1942), renderer (objectui#1774), and showcase doc (#1951), all merged.

collectAndLintDocs (run by os compile / os lint, which already pass the assembled stack) now also validates every ```metadata fence:

  • Body shape: type ∈ {state_machine, flow, permission} (did-you-mean on a typo'd type), name required, object required for state_machine.
  • Reference liveness against the package's own metadata: the object + named state_machine rule, the flow, or the permission set must exist in this stack. A dead same-package reference is a build error (same posture as docs/broken-link), with did-you-mean hints. Cross-package embeds are out of v1 scope.

Notes

  • Scans share stripCode(), which deletes fenced blocks — so the embed scan walks raw lines instead. The body parser mirrors the objectui-side one so build-time and render-time agree.
  • No CLI build fix was needed. The "prerequisite breakage" turned out to be stale/unbuilt local dist: a clean dependency-ordered build — turbo run build --filter=@objectstack/cli — passes 52/52 (incl. cli:build). @objectstack/formula's current source already has the scope/warnings API the validate-expressions.ts errors referenced, and the adr-0048 test resolves once studio/setup/account are built. So this PR is purely the lint.

Verification

  • vitest run collect-docs44 passed (8 new lint cases: valid trio, unknown type, missing name/object, dead object/rule/flow/permission refs, non-metadata fences ignored, locale variants).
  • pnpm --filter @objectstack/cli build → exit 0.
  • Ran the lint against the real app-showcase doc: 0 issues (no false positives); a typo'd-ref negative control correctly flags docs/metadata-embed-ref.

🤖 Generated with Claude Code

…ess (ADR-0051 P1)

Completes the ADR-0051 P1 publish lint. `collectAndLintDocs` (run by
`os compile` / `os lint`, which already pass the assembled stack) now
also validates every ```metadata fence:

- body shape: `type` ∈ {state_machine, flow, permission} (did-you-mean
  on a typo'd type), `name` required, `object` required for
  state_machine.
- reference liveness against the package's OWN metadata: the object +
  named state_machine rule, the flow, or the permission set must exist
  in this stack. A dead same-package reference is a build error (same
  posture as docs/broken-link), with did-you-mean hints. Cross-package
  embeds are out of v1 scope.

Note: scans share `stripCode()` which DELETES fenced blocks, so the
embed scan walks raw lines instead. The body parser mirrors the
objectui-side one so build-time and render-time agree.

Tests: 8 cases (valid trio, unknown type, missing name/object, dead
object/rule/flow/permission refs, non-metadata fences ignored, locale
variants). Verified the real app-showcase doc lints clean (no false
positives) with a typo'd-ref negative control.

No CLI build fix was needed: a clean dependency-ordered build
(`turbo run build --filter=@objectstack/cli`, 52/52) passes; the
previously-seen `validate-expressions.ts` / adr-0048-test errors were
stale/unbuilt local `dist`, not a code defect.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 16, 2026 3:35pm

Request Review

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/cli.

15 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/cloud-artifact-api.mdx (via packages/cli)
  • content/docs/concepts/implementation-status.mdx (via @objectstack/cli)
  • content/docs/concepts/packages.mdx (via @objectstack/cli)
  • content/docs/getting-started/cli.mdx (via @objectstack/cli)
  • content/docs/getting-started/quick-start.mdx (via @objectstack/cli)
  • content/docs/guides/authentication.mdx (via @objectstack/cli)
  • content/docs/guides/client-sdk.mdx (via @objectstack/cli)
  • content/docs/guides/hook-bodies.mdx (via packages/cli)
  • content/docs/guides/packages.mdx (via @objectstack/cli)
  • content/docs/guides/project-scoping.mdx (via @objectstack/cli)
  • content/docs/guides/runtime-services/data-service.mdx (via packages/cli)
  • content/docs/guides/runtime-services/index.mdx (via packages/cli)
  • content/docs/guides/skills.mdx (via packages/cli)
  • content/docs/protocol/objectos/plugin-spec.mdx (via @objectstack/cli)
  • content/docs/protocol/objectos/realtime-protocol.mdx (via @objectstack/cli)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang
os-zhuang merged commit 97ecfdd into main Jun 16, 2026
8 of 9 checks passed
@os-zhuang
os-zhuang deleted the feat/adr-0051-publish-lint branch June 16, 2026 15:26
@github-actions github-actions Bot added documentation Improvements or additions to documentation tooling labels Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant