Skip to content

feat: support custom ADR directory via config.json paths field#293

Merged
rhuanbarreto merged 5 commits into
mainfrom
feature/custom-adr-directory
May 10, 2026
Merged

feat: support custom ADR directory via config.json paths field#293
rhuanbarreto merged 5 commits into
mainfrom
feature/custom-adr-directory

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • Add a paths field to .archgate/config.json allowing projects to store ADRs and rules in a custom directory (e.g., docs/adrs/) instead of the default .archgate/adrs/
  • All CLI commands (adr list/show/create/update, check, review-context) automatically respect the configured directory
  • Path validation rejects absolute paths and .. traversal segments for security
  • New Configuration reference page in the docs site (EN + PT-BR) with full schema documentation, validation rules, and monorepo examples

Test plan

  • bun run validate passes (lint, typecheck, format, tests, ADR checks, knip, build)
  • Default behavior unchanged: projects without paths config work identically
  • Custom directory: set paths.adrs in config, move ADRs there, verify adr list, adr create, check all use the custom dir
  • Path validation: absolute paths and .. segments are rejected by the schema
  • Rules shim: rules.d.ts is written to both .archgate/ and the custom ADR directory parent
  • findProjectRoot() detects projects via .archgate/adrs/ or .archgate/lint/
  • Docs: configuration reference page renders correctly in both EN and PT-BR

rhuanbarreto and others added 2 commits May 11, 2026 00:56
Allow projects to store ADRs in a directory other than the default
`.archgate/adrs/` by adding a `paths` section to `.archgate/config.json`.
This supports monorepo setups where ADRs live alongside other docs
(e.g., `docs/adrs/`).

- Add `PathsConfigSchema` with relative-path validation (no absolute
  paths, no `..` traversal) to `ProjectConfigSchema`
- Add `resolvedProjectPaths()` in project-config.ts that layers
  config-aware overrides on top of the default paths
- Update engine loader, ADR commands, rules shim, and install-info
  to use resolved paths instead of hardcoded defaults
- Broaden `findProjectRoot()` to detect `.archgate/lint/` as a
  project marker (covers projects that moved ADRs out of
  `.archgate/adrs/`)
- Write `rules.d.ts` to both `.archgate/` and the custom ADR
  directory parent so triple-slash references resolve correctly
- Add Configuration reference page (EN + PT-BR) with full schema
  docs, path validation rules, and monorepo example
- Update 7 existing doc pages (EN + PT-BR) with cross-links to the
  new configuration reference

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 10, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7767003
Status: ✅  Deploy successful!
Preview URL: https://92e1de4b.archgate-cli.pages.dev
Branch Preview URL: https://feature-custom-adr-directory.archgate-cli.pages.dev

View logs

rhuanbarreto and others added 3 commits May 11, 2026 01:00
The custom directory feature covers a special case — no need to
advertise it across every page. Keep it documented only in the
Configuration reference page where users who need it will find it.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Add ARCHGATE_PROJECT_CEILING env var (analogous to git's
GIT_CEILING_DIRECTORIES) to prevent findProjectRoot() from walking
above the test temp directory. Without this, tests that assert "no
project found" fail on machines where ~/.archgate/adrs/ exists.

Applied to the integration test harness (subprocess env), command
tests (Bun.env), and path unit tests.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@rhuanbarreto rhuanbarreto merged commit 1e003ab into main May 10, 2026
11 checks passed
@rhuanbarreto rhuanbarreto deleted the feature/custom-adr-directory branch May 10, 2026 23:26
@archgatebot archgatebot Bot mentioned this pull request May 10, 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