Skip to content

feat: greenfield wizard and archgate adr sync#302

Merged
rhuanbarreto merged 10 commits into
mainfrom
feat/greenfield-wizard-and-sync
May 11, 2026
Merged

feat: greenfield wizard and archgate adr sync#302
rhuanbarreto merged 10 commits into
mainfrom
feat/greenfield-wizard-and-sync

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • Add greenfield wizard to archgate init: when no existing ADRs are detected, offers interactive pack picker powered by stack detection and registry recommendations
  • Add archgate adr sync command: checks for upstream updates to imported ADRs and offers interactive keep/take/skip per ADR
  • Implements Phase D (greenfield wizard) and Phase E (adr sync) from the ADR registry plan

Greenfield wizard (archgate init)

  • src/helpers/stack-detect.ts — detects languages (TypeScript, JavaScript, Python, Go, Rust), runtimes (Node, Bun, Deno), and frameworks (Next.js, Remix, Vite, Fastify, Express, Hono, React) from project files
  • src/helpers/pack-recommend.ts — matches detected stack against pack tags in the registry, returns sorted recommendations with relevance levels (high for language/runtime/framework, medium for concern tags)
  • Wizard triggers after init when interactive + no pre-existing ADRs, shows checkbox picker with high-relevance packs pre-checked, imports via archgate adr import --yes
  • Telemetry: greenfield_wizard_shown, pack_imported_at_init, wizard_skipped

archgate adr sync [source...]

  • Loads imports.json, re-fetches upstream repos, compares content (stripping remapped IDs)
  • Shows section-level diff summaries (which sections changed)
  • Interactive prompt per changed ADR: keep local / take upstream / skip
  • --check flag for CI (exit 1 if upstream has updates)
  • --yes flag to auto-accept all upstream changes
  • --json flag for machine output
  • Source filtering: archgate adr sync packs/typescript-strict syncs only matching imports

Tests

  • 28 new tests across stack-detect, pack-recommend, and sync (14 + 9 + 5)
  • Full suite: 828 pass, 0 fail, no regressions
  • archgate check: 26/26 rules pass, 0 violations

Test plan

  • Run archgate init in a fresh Next.js project — wizard should detect TypeScript + Node + Next.js and recommend matching packs
  • Run archgate init in an existing project with ADRs — wizard should NOT appear
  • Run archgate init with --editor claude in non-TTY — wizard should NOT appear
  • Import a pack, modify a local ADR, then run archgate adr sync — should show the diff and offer keep/take/skip
  • Run archgate adr sync --check in CI — should exit 1 if upstream has updates, 0 if up to date
  • Run archgate adr sync --json — should output structured JSON
  • Run archgate adr sync with no imports — should print "No imported ADRs found."
  • Run bun test — all tests pass
  • Run archgate check — all rules pass

@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: a68ee7a
Status: ✅  Deploy successful!
Preview URL: https://843a717d.archgate-cli.pages.dev
Branch Preview URL: https://feat-greenfield-wizard-and-s.archgate-cli.pages.dev

View logs

Restore node = "24" in .prototools — the problem was never Node, it
was proto 0.56.4. Pin proto to 0.56.3 in the Windows smoke test
workflow to avoid the starbase_archive 0.13.0 regression that
prevents Node 24 from extracting on Windows Server 2025 runners.

Remove the proto pin once proto 0.57+ ships with the fix.

See: moonrepo/proto#1006
Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Greenfield wizard (Phase D):
- Add stack-detect helper to detect project languages, runtimes, and
  frameworks from project files (tsconfig.json, package.json, go.mod, etc.)
- Add pack-recommend helper to match detected stack against registry
  pack tags and return sorted recommendations
- Extend `archgate init` to show an interactive wizard when no ADRs
  exist, offering to import recommended starter packs
- Add telemetry events for wizard shown, packs imported, and wizard
  skipped

ADR sync command (Phase E):
- Add `archgate adr sync` command to check imported ADRs for upstream
  updates, with --check (CI mode), --yes, and --json flags
- Supports source filtering, per-ADR diff summaries, and interactive
  keep/take/skip prompts
- Register sync command in the adr command group

Tests:
- Add stack-detect tests covering all language/runtime/framework
  detection heuristics
- Add pack-recommend tests covering tag matching, relevance sorting,
  ADR counting, and edge cases
- Add sync command tests covering registration, empty state, JSON
  output, missing project, and source filtering

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
- Flatten else-if chain in sync.ts to fix no-lonely-if
- Add oxlint-disable-line for intentionally sequential awaits in sync.ts
- Collapse JSDoc comments in telemetry.ts to stay within 500-line limit

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@rhuanbarreto rhuanbarreto force-pushed the feat/greenfield-wizard-and-sync branch from 774975a to a4a8afe Compare May 11, 2026 19:13
rhuanbarreto and others added 7 commits May 11, 2026 21:13
trackPackImportedAtInit now only collects pack names for official
registry sources (packs/...). Third-party sources are counted but
their paths are never sent — avoids leaking private repo addresses.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
- Regenerate docs/public/llms-full.txt for new adr sync command
- Fix oxlint disable comments to use block-level directives (formatter
  moves inline comments to new lines)
- Compact telemetry test helpers to stay within 500-line limit

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Import now reads each ADR's domain field and resolves it to the
project's prefix for that domain (e.g. frontend → FE, backend → BE).
Each domain gets its own ID counter, so importing packs with mixed
domains produces correctly prefixed IDs without collisions.

The --prefix flag still works as an explicit override that forces a
single prefix for all imported ADRs (backwards compatible).

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Domain-aware remapping is now the only behavior — each ADR's domain
field determines its prefix automatically. The --prefix override
added unnecessary complexity with no real use case.

Also updates EN and PT-BR docs to reflect the new remapping behavior.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@rhuanbarreto rhuanbarreto merged commit ffa9a80 into main May 11, 2026
11 checks passed
@rhuanbarreto rhuanbarreto deleted the feat/greenfield-wizard-and-sync branch May 11, 2026 20:01
@archgatebot archgatebot Bot mentioned this pull request May 11, 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