Skip to content

fix: resolve consistency issues across CLI codebase#101

Merged
rhuanbarreto merged 5 commits into
mainfrom
fix/consistency-review
Mar 20, 2026
Merged

fix: resolve consistency issues across CLI codebase#101
rhuanbarreto merged 5 commits into
mainfrom
fix/consistency-review

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

Full repository consistency review that fixes 14+ issues and adds 3 new ADRs with automated rules to prevent recurrence.

Code fixes (24 files, net -40 lines)

  • Consistent project root resolution: All project-aware commands now use findProjectRoot() instead of process.cwd(), so they work from subdirectories (adr create/list/show/update, plugin install)
  • Command error boundaries: Added try-catch to all 8 async command actions that were missing them (review-context, session-context/, adr/, plugin/url, upgrade)
  • Remove dead code: Deleted duplicate getChangedFiles() from helpers/git.ts (canonical version lives in engine/git-files.ts)
  • Fix login --refresh hint: Was showing --refresh (flag syntax) but it's a subcommand (login refresh)
  • Fix adr list --domain: Added .choices(ADR_DOMAINS) validation (was accepting any string)
  • Fix adr show path check: Was checking adrsDir existence but reporting .archgate/ missing
  • Extract shared EDITOR_LABELS: Was duplicated in init.ts and plugin/install.ts
  • Remove cursor from plugin url --editor: Cursor uses a bundle API, not marketplace URLs
  • Fix .vscode/ dir creation: No longer creates empty directory when no marketplace URL
  • Fix frontmatter regex for Windows: \n -> \r?\n for \r\n line endings
  • Fix homedir() fallback: Was using literal "~" string that doesn't expand
  • Standardize timeout formatting: 15000 -> 15_000 in binary-upgrade.ts
  • Fix docs softwareVersion: Was 0.11.0, now 0.16.0 matching package.json
  • Remove dead template paths: Unused templatesRemoteArchive, templatesZipFile, etc.
  • Document devDependencies design: Added _dependencies_note explaining the shim architecture

New ADRs & automated rules (6 new files)

ADR Rule Prevents
ARCH-011 Consistent Project Root Resolution no-process-cwd-for-project-root Commands using process.cwd() instead of findProjectRoot()
ARCH-012 Command Error Boundaries async-action-error-boundary Async actions missing try-catch (warning severity)
ARCH-013 Version Synchronization docs-version-sync softwareVersion in docs diverging from package.json

Validation

  • bun run validate passes (lint, typecheck, format, 324 tests, 20 rules, build)
  • All 3 new rules are green

Test plan

  • bun run validate passes locally
  • All 20 archgate rules pass (17 existing + 3 new)
  • 324 tests pass, 0 failures
  • Binary compiles successfully
  • CI validates on PR

Address 14+ inconsistencies found during a full repository review:

- Use findProjectRoot() consistently in all project-aware commands
  instead of process.cwd() (adr create/list/show/update, plugin install)
- Add try-catch error boundaries to all async command actions
  (review-context, session-context/*, adr/*, plugin/url, upgrade)
- Remove duplicate getChangedFiles() from helpers/git.ts (dead code)
- Fix login hint: "login --refresh" -> "login refresh" (subcommand)
- Add .choices(ADR_DOMAINS) to adr list --domain option
- Fix adr show checking wrong path (adrsDir vs root)
- Extract shared EDITOR_LABELS to helpers/init-project.ts
- Remove cursor from plugin url --editor (cursor uses bundle API)
- Fix configureVscodeSettings creating empty .vscode/ without reason
- Fix frontmatter regex for Windows \r\n line endings
- Fix homedir fallback using "~" literal instead of os.homedir()
- Standardize AbortSignal.timeout formatting (15000 -> 15_000)
- Fix docs/astro.config.mjs softwareVersion (0.11.0 -> 0.16.0)
- Remove dead template path constants from helpers/paths.ts
- Rename local findProjectRoot in upgrade.ts to findPackageRoot
- Document devDependencies design decision in package.json

Add three new ADRs with companion rules to prevent recurrence:
- ARCH-011: Consistent project root resolution (no-process-cwd rule)
- ARCH-012: Command error boundaries (async-action-error-boundary rule)
- ARCH-013: Version synchronization (docs-version-sync rule)
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 20, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1c0faef
Status: ✅  Deploy successful!
Preview URL: https://f3b4be23.archgate-cli.pages.dev
Branch Preview URL: https://fix-consistency-review.archgate-cli.pages.dev

View logs

- Merge upstream installGit tests into consolidated test file
  (removed duplicate getChangedFiles import from upstream)
- Fix adr list test: create .archgate/adrs/ dir (not just .archgate/)
  to match findProjectRoot() expectations
- Document that .simple-release.js already handles optionalDependencies
  sync during the release bump hook
- Add optional-deps-version-sync rule to catch drift between
  package.json version and platform-specific npm package versions
- Update ADR context to list all three version touch points
Replace non-standard _dependencies_note field in package.json with a
proper "npm Distribution" section in CLAUDE.md explaining that the npm
package is a thin shim and all runtime deps are bundled into the binary.
Add softwareVersion replacement to .simple-release.js bump hook so
docs/astro.config.mjs is updated automatically during release, matching
the existing optionalDependencies sync pattern. The ARCH-013 archgate
rule remains as a CI safety net.
@rhuanbarreto rhuanbarreto merged commit 4e182da into main Mar 20, 2026
8 checks passed
@rhuanbarreto rhuanbarreto deleted the fix/consistency-review branch March 20, 2026 23:42
@github-actions github-actions Bot mentioned this pull request Mar 20, 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