Skip to content

feat(adr): support custom domains via archgate domain commands#212

Merged
rhuanbarreto merged 6 commits into
mainfrom
feat/custom-adr-domains
Apr 15, 2026
Merged

feat(adr): support custom domains via archgate domain commands#212
rhuanbarreto merged 6 commits into
mainfrom
feat/custom-adr-domains

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • Add archgate domain list | add <name> <prefix> | remove <name> for managing custom ADR domain → prefix mappings.
  • Relax ADR frontmatter domain to a kebab-case string (from a rigid enum) so ADRs using custom domains parse cleanly. Built-in validation/prefix resolution happens via the merged config at the command layer.
  • Persist custom domains in .archgate/config.json; built-ins stay hard-coded and can't be overwritten or removed.
  • Emit custom_domain_added / custom_domain_removed telemetry events so we can see which categories repos actually adopt and decide whether to promote any to defaults.

Why

Several repos already use domains outside the built-in five (e.g. security, ml-ops). Today the Zod enum rejects their ADRs at parse time and the CLI can't auto-generate IDs for them. This unblocks those repos without abandoning the opinionated built-ins.

Paired plugin-side PR (agent guidance — "ask first, register only when no built-in fits") is in the plugins repo.

Test plan

  • bun run lint clean
  • bun run typecheck clean
  • bun run format:check clean
  • Unit tests: 621 pass / 0 fail (29 new tests for project-config helpers + domain command)
  • Manual smoke: archgate domain add security SEC && archgate adr create --title "Token storage" --domain security auto-generates SEC-001
  • Verify custom_domain_added event lands in PostHog with domain_name / prefix / total_custom_domains properties

Note: pre-existing Windows integration-test timeouts on main are unrelated — reproduced on clean HEAD.

🤖 Generated with Claude Code

Projects can now register custom ADR domain → prefix mappings beyond the
built-in five (backend/frontend/data/architecture/general). Custom domains
live in `.archgate/config.json` and are merged with defaults at read time,
letting repos capture categories like `security` / `SEC` or `ml-ops` /
`MLOPS` without forking the CLI.

- Add `archgate domain list | add <name> <prefix> | remove <name>`
- Relax ADR frontmatter domain to a kebab-case string (from rigid enum)
  so ADRs with custom domains parse cleanly
- Resolve ID prefixes via merged config in create/update paths
- Capture `custom_domain_added` / `custom_domain_removed` telemetry events
  to inform whether any custom category should be promoted to a default

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 15, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 30fe6dc
Status: ✅  Deploy successful!
Preview URL: https://81d917f6.archgate-cli.pages.dev
Branch Preview URL: https://feat-custom-adr-domains.archgate-cli.pages.dev

View logs

rhuanbarreto and others added 5 commits April 15, 2026 22:16
Use projectPath / projectPaths from helpers/paths.ts instead of joining
`.archgate` segments inline, matching the rest of the codebase.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move `archgate domain ...` to `archgate adr domain ...` so the command
lives next to the other ADR subcommands (create, list, show, update) it
pairs with. No behavior changes — only the invocation path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Updates the CLI reference and concept pages (EN + pt-br) to cover the
new custom-domain workflow introduced in this PR:

- reference/cli/adr: new `## archgate adr domain` section with subcommand
  table, naming rules, and examples; `--domain` option descriptions
  cross-link to the new section
- reference/adr-schema: relax the `domain` field description from a
  rigid enum to a registered kebab-case string; update the validation
  error example to match the new "lowercase kebab-case" message
- concepts/domains: add a "Custom Domains" section covering naming
  rules, when to prefer a built-in, and AI-agent guidance
- guides/writing-adrs + concepts/adrs: note the custom-domain path
  alongside the built-in five
- regenerate docs/public/llms-full.txt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add an Archgate rule that flags CLI commands shipped without a
reference page and reference pages that have no corresponding command.
Discovered by dogfooding: the telemetry command had no docs page.

- .archgate/adrs/ARCH-015: ADR + companion rules.ts that cross-checks
  src/commands/<name>.ts | <name>/index.ts against
  docs/src/content/docs/reference/cli/<name>.mdx (index.mdx exempt)
- docs/.../reference/cli/telemetry.mdx (+pt-br mirror): backfill the
  missing page so the new rule passes on this branch
- tests/commands/adr/domain/{add,list,remove}.test.ts: split the
  previously-combined domain.test.ts so ARCH-005 (test-mirrors-src)
  is happy with the nested adr/domain/*.ts sources
- Strip stale /pt-br/ prefixes from internal MDX links in the earlier
  docs commit (GEN-002 no-locale-prefix-in-links)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rhuanbarreto rhuanbarreto merged commit 2717763 into main Apr 15, 2026
10 checks passed
@rhuanbarreto rhuanbarreto deleted the feat/custom-adr-domains branch April 15, 2026 20:53
@github-actions github-actions Bot mentioned this pull request Apr 15, 2026
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