Skip to content

feat(docs,rules): ship default content as editable markdown templates#9

Merged
rgdevme merged 1 commit into
mainfrom
claude/elegant-ellis-22d60e
May 19, 2026
Merged

feat(docs,rules): ship default content as editable markdown templates#9
rgdevme merged 1 commit into
mainfrom
claude/elegant-ellis-22d60e

Conversation

@rgdevme
Copy link
Copy Markdown
Owner

@rgdevme rgdevme commented May 19, 2026

Summary

  • doc-rules.md is no longer fully rewritten on every agnos docs generate. It's now a user-editable file whose only managed region is a ```frontmatter fenced code block, re-injected from agnos.json#docs.metadata. Everything around the block is preserved.
  • Default content for doc-rules.md, index.md, and content.md moves out of in-code template strings into real .md asset files under packages/domain-docs/templates/, so they can be edited as markdown.
  • The rules domain follows the same pattern: the starter AGENTS.md content moves to packages/domain-rules/templates/agents.md, exposed via a new @luxia/domain-rules/template subpath export. core/init.ts now reads from it instead of an inline STARTER_RULES const — single source of truth.

How doc-rules.md regeneration works now

State Behavior
File missing Seed from templates/doc-rules.md, then inject current metadata into its ```frontmatter block
Block present Only the block contents change when metadata differs; surrounding text untouched
Block deleted by user Prepended back on next generate
Metadata unchanged writeIfChanged no-ops

Metadata serialization runs through js-yaml so descriptions containing colons or quotes round-trip safely.

Architecture notes

  • core now has a direct workspace dep on @luxia/domain-rules. To avoid a runtime cycle (the plugin's index.ts imports @luxia/core), the template loader lives in a separate src/template.ts module with no @luxia/core import, exported under the ./template subpath. pnpm reports the workspace cycle as a warning; it's inert at runtime.
  • Build order matters once: @luxia/core must build before @luxia/domain-rules for DTS resolution. pnpm -r build handles this in topological order; in a clean clone, build core first if running packages in isolation.

Move the autogenerated doc-rules.md from a full-rewrite template to a
user-editable file whose only managed region is a ```frontmatter fenced
block injected from agnos.json#docs.metadata. The default content (and
the index/content templates) now ship as real .md asset files under each
domain's templates/ directory.

The rules domain follows the same pattern: AGENTS.md starter content
moves to packages/domain-rules/templates/agents.md, exposed via a new
@luxia/domain-rules/template subpath export so core can load it without
pulling the plugin's @luxia/core import path (avoids a runtime cycle).
@rgdevme rgdevme merged commit 7f741a6 into main May 19, 2026
1 check failed
@rgdevme rgdevme deleted the claude/elegant-ellis-22d60e branch June 5, 2026 12:17
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