feat(cli)!: emit lean agent-facing JSON payloads by default - #476
Conversation
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_159c2517-f9d7-466c-828b-319998d7d006) |
Deploying archgate-cli with
|
| Latest commit: |
dc415bf
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c3a07c53.archgate-cli.pages.dev |
| Branch Preview URL: | https://feat-lean-agent-payloads.archgate-cli.pages.dev |
📝 WalkthroughWalkthroughThe change adds identity-only JSON projections for 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
`Bun.env.X = undefined` assigns the literal string "undefined" and leaves the
key present — it does not unset. The idiomatic capture-and-restore
const original = Bun.env.HOME; ...; Bun.env.HOME = original;
therefore leaked HOME="undefined" whenever the variable was unset to begin
with, which is the normal case on Windows for HOME and GIT_CONFIG_GLOBAL.
Bun's test runner shares one process across test files, so the bogus value
escaped into every later test file and into every subprocess they spawned.
The observed symptom was a test that passed in isolation and failed in the
full suite: a leaked HOME="undefined" made `review-context` report zero
changed files. Bun.env and process.env are the same store, so both accessors
are affected.
Add `restoreEnv(key, original)` to tests/test-utils.ts, which deletes the key
when the captured original was undefined, and route every env restore under
tests/ through it. This also collapses the correct-but-verbose
`if (orig === undefined) delete ... else ...` guards that several files had
already grown independently.
Three restores were genuinely unguarded rather than merely verbose:
check-action.test.ts (CI), binary-upgrade.test.ts (HOME) and
init-project.test.ts (HOME).
vscode-settings.test.ts already had a local bulk helper implementing the
correct semantics; it is renamed restoreEnvAll and now delegates to the
shared helper rather than duplicating the logic.
Document the rule as a Do/Don't in ARCH-005.
Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
ARCH-005 documents that tests must restore environment variables via restoreEnv(), but the rule was manual-enforcement only — and the preceding commit showed why that is not enough: several files guarded one variable correctly with an explicit undefined check while leaving HOME bare, and vscode-settings.test.ts carried a docstring describing the exact bug that five other files were leaking. The knowledge was present but inconsistently applied, which is what a mechanical check catches and review does not. The invariant is purely syntactic, so it belongs in the linter (the same reasoning recorded in .archgate/lint/oxlint.ts). Follows lint/expect-expect.ts as the model: a custom oxlint JS plugin enabled for tests/**/*.test.ts. The rule flags `Bun.env.NAME = <identifier>` / `process.env.NAME = <identifier>` only when that identifier was itself captured from an env read earlier in the same file. Tracking the capture — rather than matching a naming convention such as `original*` — is what distinguishes a restore from an override: both are spelled `Bun.env.HOME = <identifier>`, so `Bun.env.HOME = tempDir` is correctly left alone. This matters in practice: the real call sites named their variables savedHome, savedXdg, savedDistro, savedInterop, savedAppData and origCI as often as original*. Computed access (`Bun.env[key]`) is also left alone, being the shape of the restoreEnv helper itself. Verified in both directions: dogfooded against the repo (31 sites, 17 files, no false positives on overrides), and fire-tested by reintroducing a bare restore, which the rule flagged at the expected line. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Agent harnesses spill an oversized tool result to a file, at which point the payload stops being readable inline — which defeats the purpose of emitting JSON for an agent. Three commands crossed that threshold on a project with a few dozen ADRs. Measured on a 38-ADR project (and this repo for review-context): adr list --json 6314 B -> 3856 B (-39%) check --json 25158 B -> 919 B (-96%) review-context --run-checks 80755 B -> 8759 B (-90%) More importantly, each payload now scales with the number of findings rather than the number of rules or ADRs, so it stops degrading as a project grows. - adr list: emitted the parsed frontmatter verbatim, including `files` glob arrays that are useless for deciding what to read next. Now projects to the four fields the human table already renders; `adr show <id>` still has the rest. - check --json: emitted an entry for every rule, including cleanly-passing ones whose entry only restates static ADR text (99% of the payload; the `description` field alone was 43%). Now carries only rules with something to report. The documented example in check.mdx already showed this shape, so this aligns the implementation with its own contract. `--verbose` restores the full list, matching reportConsole and the flag's documented meaning. - review-context: each ADR's Decision and Do's/Don'ts prose was 78% of the payload. Now opt-in behind `--verbose`; the default identifies which ADRs apply and the consumer drills down with `adr show <id>`. checkSummary gets the same projection as check --json, via a shared resultsWithFindings() helper so the two cannot drift. The filter predicate is "has nothing to report", not "passed": buildSummary sets status "fail" only for error-severity violations, so a warning-only rule is status "pass" with a non-empty violations[]. Filtering on status alone would silently swallow every warning — a regression test covers this. Record the convention as ARCH-003 key convention 7, with a Don't guarding against that exact misimplementation. Docs updated in all three locales. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
…n lesson - project_test_isolation_gotchas: the existing entry described the env-leak symptom and a consumer-side workaround (resetting git vars in the runCli call) but never identified the cause — the restore itself. Record that `env.X = undefined` assigns the string "undefined", that Bun.env and process.env are one store, and point at restoreEnv. - project_rules_engine_internals: a reviewer sub-agent will misquote the file it is reviewing, not just the ADR it cites — it reported a Norwegian misspelling that was not in the file, where applying the "fix" would have introduced the error. Grep the claimed string before acting on it. - MEMORY.md: index entries updated to match. Also includes an in-flight edit to feedback_prefer_tests_over_adr_rules.md (ADR rules that only assert implementation shape) authored outside this change but present in the working tree. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
03c3665 to
5e8e8ec
Compare
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_02fba72d-bb6f-41cd-b942-7fbd5c669bef) |
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/integration/review-context.test.ts (1)
1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove redundant per-test timeouts.
As per coding guidelines, use overrides only to grant genuinely slow tests more time than the global timeout. Setting this to 60000ms is redundant since it matches the global default.
tests/integration/review-context.test.ts#L187-187: remove the, 60000argument from this test.tests/integration/review-context.test.ts#L220-220: remove the, 60000argument from this test.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/integration/review-context.test.ts` at line 1, Remove the redundant 60000 timeout arguments from the two tests in review-context.test.ts, leaving their existing test bodies and assertions unchanged so they use the global timeout.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/integration/check.test.ts`:
- Around line 213-216: Extend the integration test around runCli with a
companion check that runs the ADR-filtered JSON command without --verbose and
verifies clean rules are omitted, then runs it with --verbose and verifies both
passing rule entries are present. Keep the existing exit-code assertions and use
the parsed JSON output to validate the mode-dependent behavior.
---
Outside diff comments:
In `@tests/integration/review-context.test.ts`:
- Line 1: Remove the redundant 60000 timeout arguments from the two tests in
review-context.test.ts, leaving their existing test bodies and assertions
unchanged so they use the global timeout.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: cc5a1ae6-6b92-4b29-beac-a107b413023c
📒 Files selected for processing (46)
.archgate/adrs/ARCH-003-output-formatting.md.archgate/adrs/ARCH-005-testing-standards.md.claude/agent-memory/archgate-developer/MEMORY.md.claude/agent-memory/archgate-developer/feedback_prefer_tests_over_adr_rules.md.claude/agent-memory/archgate-developer/project_rules_engine_internals.md.claude/agent-memory/archgate-developer/project_test_isolation_gotchas.md.oxlintrc.jsondocs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/nb/reference/cli/review-context.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdxlint/no-bare-env-restore.tssrc/commands/adr/list.tssrc/commands/check.tssrc/commands/review-context.tssrc/engine/context.tssrc/engine/reporter.tstests/commands/adr/list.test.tstests/commands/check-action.test.tstests/commands/clean.test.tstests/commands/review-context.test.tstests/commands/upgrade.test.tstests/engine/context.test.tstests/engine/reporter.test.tstests/helpers/auth.test.tstests/helpers/binary-upgrade.test.tstests/helpers/credential-store.test.tstests/helpers/exit.test.tstests/helpers/init-project.test.tstests/helpers/opencode-settings.test.tstests/helpers/output.test.tstests/helpers/platform.test.tstests/helpers/plugin-install-cleanup.test.tstests/helpers/plugin-install.test.tstests/helpers/sentry.test.tstests/helpers/session-context-copilot.test.tstests/helpers/session-context-opencode.test.tstests/helpers/telemetry-config.test.tstests/helpers/telemetry.test.tstests/helpers/update-check.test.tstests/helpers/vscode-settings.test.tstests/integration/check.test.tstests/integration/review-context.test.tstests/test-utils.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
- GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (20)
**/*.{ts,tsx,js,jsx,mjs,cjs}
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-006-dependency-policy.md)
**/*.{ts,tsx,js,jsx,mjs,cjs}: Use Bun built-ins for file I/O (Bun.file,Bun.write), HTTP, subprocess execution (Bun.spawn), globbing (Bun.Glob), and testing (bun:test).
Do not use Node.js-specific APIs when Bun alternatives exist; for example, useBun.file()instead offs.readFile()for simple reads.
Prefernode:built-in modules such asnode:util,node:path, andnode:fsover npm alternatives.
Do not use utility libraries for single functions, such as importing lodash for one helper likepick.
Do not use path aliases (tsconfig paths); use relative imports with Bun's native module resolution.
Do not install packages globally during development; usebunxfor one-off tools.
Files:
tests/helpers/exit.test.tstests/commands/review-context.test.tssrc/commands/review-context.tstests/helpers/session-context-copilot.test.tstests/helpers/session-context-opencode.test.tstests/helpers/output.test.tstests/commands/check-action.test.tstests/helpers/sentry.test.tstests/test-utils.tstests/helpers/credential-store.test.tstests/helpers/opencode-settings.test.tstests/helpers/plugin-install.test.tstests/helpers/binary-upgrade.test.tstests/helpers/platform.test.tstests/helpers/telemetry.test.tstests/helpers/telemetry-config.test.tstests/integration/check.test.tssrc/commands/adr/list.tstests/helpers/update-check.test.tstests/helpers/vscode-settings.test.tstests/integration/review-context.test.tstests/helpers/plugin-install-cleanup.test.tstests/helpers/init-project.test.tstests/engine/reporter.test.tstests/helpers/auth.test.tstests/commands/adr/list.test.tssrc/engine/reporter.tstests/commands/upgrade.test.tstests/commands/clean.test.tslint/no-bare-env-restore.tstests/engine/context.test.tssrc/commands/check.tssrc/engine/context.ts
tests/**/*.ts
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-009-platform-detection-helper.md)
In test files, use
_resetPlatformCache()to simulate different platforms instead of mocking or mutatingprocess.platformdirectly.
tests/**/*.ts: Use Bun's built-inbun:testrunner for all tests, importing test utilities frombun:testrather thannode:test.
Place tests undertests/, mirroring the correspondingsrc/directory structure; place reusable fixtures undertests/fixtures/.
Use temporary directories created withmkdtempfor filesystem tests and clean them up inafterEachorafterAll.
Restore overridden environment variables withrestoreEnv(key, original); do not use bare assignments that can leave the literal string"undefined".
Close external SDK instances such as servers, clients, and transports in lifecycle hooks using their cleanup methods.
Configure local Gituser.emailanduser.nameimmediately aftergit initbefore creating commits in temporary repositories.
Test public module interfaces rather than private implementation details, and do not depend on network access in unit tests.
Maintain at least 90% total line coverage, enforced in CI.
Tests must be isolated from network access, temporary-file leaks, external-resource leaks, environment leakage, and real user-scope writes.
Files:
tests/helpers/exit.test.tstests/commands/review-context.test.tstests/helpers/session-context-copilot.test.tstests/helpers/session-context-opencode.test.tstests/helpers/output.test.tstests/commands/check-action.test.tstests/helpers/sentry.test.tstests/test-utils.tstests/helpers/credential-store.test.tstests/helpers/opencode-settings.test.tstests/helpers/plugin-install.test.tstests/helpers/binary-upgrade.test.tstests/helpers/platform.test.tstests/helpers/telemetry.test.tstests/helpers/telemetry-config.test.tstests/integration/check.test.tstests/helpers/update-check.test.tstests/helpers/vscode-settings.test.tstests/integration/review-context.test.tstests/helpers/plugin-install-cleanup.test.tstests/helpers/init-project.test.tstests/engine/reporter.test.tstests/helpers/auth.test.tstests/commands/adr/list.test.tstests/commands/upgrade.test.tstests/commands/clean.test.tstests/engine/context.test.ts
{src,tests}/**/*.ts
📄 CodeRabbit inference engine (.archgate/adrs/LEGAL-001-spdx-license-headers.md)
{src,tests}/**/*.ts: Every TypeScript source file insrc/andtests/must begin with// SPDX-License-Identifier: Apache-2.0followed by// Copyright 2026 Archgate.
If a TypeScript file has a shebang line (for example#!/usr/bin/env buninsrc/cli.ts), the SPDX license header must appear immediately after the shebang.
Use single-line//comments for the SPDX header; do not use block comments (/* */) or alternate license identifiers.
Files:
tests/helpers/exit.test.tstests/commands/review-context.test.tssrc/commands/review-context.tstests/helpers/session-context-copilot.test.tstests/helpers/session-context-opencode.test.tstests/helpers/output.test.tstests/commands/check-action.test.tstests/helpers/sentry.test.tstests/test-utils.tstests/helpers/credential-store.test.tstests/helpers/opencode-settings.test.tstests/helpers/plugin-install.test.tstests/helpers/binary-upgrade.test.tstests/helpers/platform.test.tstests/helpers/telemetry.test.tstests/helpers/telemetry-config.test.tstests/integration/check.test.tssrc/commands/adr/list.tstests/helpers/update-check.test.tstests/helpers/vscode-settings.test.tstests/integration/review-context.test.tstests/helpers/plugin-install-cleanup.test.tstests/helpers/init-project.test.tstests/engine/reporter.test.tstests/helpers/auth.test.tstests/commands/adr/list.test.tssrc/engine/reporter.tstests/commands/upgrade.test.tstests/commands/clean.test.tstests/engine/context.test.tssrc/commands/check.tssrc/engine/context.ts
tests/**/*.test.ts
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-005-testing-standards.md)
tests/**/*.test.ts: Name test files with the.test.tssuffix and use descriptive names that explain expected behavior.
Every runnabletest()orit()must contain at least oneexpect()assertion; make implicit no-throw contracts explicit with appropriate assertions.
Usetest.skip,test.todo, or explicit skip APIs for intentionally disabled tests; do not use bare early returns or empty callbacks.
Importexpectfrombun:testwhen adding assertions to an existing test file.
Mock HTTP fetch by assigning directly toglobalThis.fetch, and restore the original implementation after each test.
Wrap inlinespyOnormockImplementationlifecycles intry/finally, or manage them in test hooks, so mocks are always restored.
Inject small configurable thresholds into production code when testing large numeric thresholds instead of creating thousands of fixture files.
Never set a per-test timeout below the globalbun test --timeout 60000; use overrides only to grant genuinely slow tests more time.
Mock first-party modules with namespace imports andspyOn, notmock.module(); do not split production modules solely to work around mock leakage.
When redirecting user-scope paths, mockos.homedir()rather than relying on runtimeHOMEoverrides; restore the spy afterward.
Do not write real user-scope state; spy out writers or redirectos.homedir()to a temporary directory.
Do not usemock.module("node:fetch", ...)to intercept HTTP calls; it does not replace Bun'sglobalThis.fetch.
Do not usemock.module()for first-party modules imported by other test files because it is process-global and retroactive.
Do not skip tests without a tracking issue.
Files:
tests/helpers/exit.test.tstests/commands/review-context.test.tstests/helpers/session-context-copilot.test.tstests/helpers/session-context-opencode.test.tstests/helpers/output.test.tstests/commands/check-action.test.tstests/helpers/sentry.test.tstests/helpers/credential-store.test.tstests/helpers/opencode-settings.test.tstests/helpers/plugin-install.test.tstests/helpers/binary-upgrade.test.tstests/helpers/platform.test.tstests/helpers/telemetry.test.tstests/helpers/telemetry-config.test.tstests/integration/check.test.tstests/helpers/update-check.test.tstests/helpers/vscode-settings.test.tstests/integration/review-context.test.tstests/helpers/plugin-install-cleanup.test.tstests/helpers/init-project.test.tstests/engine/reporter.test.tstests/helpers/auth.test.tstests/commands/adr/list.test.tstests/commands/upgrade.test.tstests/commands/clean.test.tstests/engine/context.test.ts
**
⚙️ CodeRabbit configuration file
**: This project uses Archgate — an AI governance framework based on
Architecture Decision Records (ADRs). The ADRs in.archgate/adrs/
are the authoritative rules for this codebase. Each ADR has a companion
.rules.tsfile with automated checks that run viaarchgate check.When reviewing, you must:
- Treat ADR violations as blocking issues, not suggestions.
- Cite the specific ADR ID when flagging a violation (e.g., "Violates ARCH-006").
- Focus on semantic and contextual violations that automated rules cannot catch —
the.rules.tsfiles already cover syntactic/structural patterns.- If you are unsure whether something violates an ADR, flag it as a question
rather than approving it.
Files:
tests/helpers/exit.test.tstests/commands/review-context.test.tssrc/commands/review-context.tstests/helpers/session-context-copilot.test.tstests/helpers/session-context-opencode.test.tstests/helpers/output.test.tstests/commands/check-action.test.tstests/helpers/sentry.test.tsdocs/src/content/docs/nb/reference/cli/check.mdxtests/test-utils.tstests/helpers/credential-store.test.tstests/helpers/opencode-settings.test.tstests/helpers/plugin-install.test.tsdocs/src/content/docs/pt-br/reference/cli/review-context.mdxtests/helpers/binary-upgrade.test.tstests/helpers/platform.test.tstests/helpers/telemetry.test.tsdocs/src/content/docs/reference/cli/check.mdxtests/helpers/telemetry-config.test.tstests/integration/check.test.tssrc/commands/adr/list.tstests/helpers/update-check.test.tstests/helpers/vscode-settings.test.tstests/integration/review-context.test.tsdocs/src/content/docs/pt-br/reference/cli/check.mdxtests/helpers/plugin-install-cleanup.test.tsdocs/src/content/docs/nb/reference/cli/review-context.mdxtests/helpers/init-project.test.tstests/engine/reporter.test.tstests/helpers/auth.test.tstests/commands/adr/list.test.tssrc/engine/reporter.tstests/commands/upgrade.test.tstests/commands/clean.test.tslint/no-bare-env-restore.tstests/engine/context.test.tsdocs/src/content/docs/reference/cli/review-context.mdxsrc/commands/check.tssrc/engine/context.ts
src/commands/**/*.ts
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-001-command-structure.md)
src/commands/**/*.ts: Each command module undersrc/commands/must export aregister*Command(program)function, with one command per file (or one command group viaindex.ts).
Command files must be thin: they should only parse arguments, call engine/helpers, and format output; business logic must live insrc/engine/,src/helpers/, orsrc/formats/.
Command modules must not useexecutableDir()for command discovery, must not call.parse()themselves, and must not spawn child processes for subcommand execution.
Subcommand groups should live in nested directories with anindex.tsthat composes child commands (for example,src/commands/adr/index.ts).
src/commands/**/*.ts: In command files undersrc/commands/**/*.ts, options that need type narrowing beyond plain strings MUST usenew Option()with.addOption()instead of plain.option().
Insrc/commands/**/*.ts, importOptionfrom@commander-js/extra-typingsalongsideCommandso typed options get full type inference.
Insrc/commands/**/*.ts, enum-like options with a fixed set of allowed values must use.choices()on anOptionto provide runtime validation and compile-time type narrowing.
Insrc/commands/**/*.ts, options that require type conversion must use.argParser()on anOptionobject, not a parser function passed as the third argument to.option().
Insrc/commands/**/*.ts, register typed options with.addOption()rather than.option().
Insrc/commands/**/*.ts, pass both the choices array and default values withas constwhen using.choices()and.default()to preserve literal types.
Insrc/commands/**/*.ts, do not add manual validation for choice options (for exampleif (!VALID.includes(val))), because Commander handles invalid-value rejection automatically.Command modules must export
register*Command(program)and contain I/O only; business logic belongs elsewhere.
src/commands/**/*.ts: Commands that operate on.archgate/project resourc...
Files:
src/commands/review-context.tssrc/commands/adr/list.tssrc/commands/check.ts
src/**/*.ts
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-004-no-barrel-files.md)
src/**/*.ts: Do not re-export symbols from another module in any source file; statements likeexport { X } from "./other"andexport type { X } from "./other"are forbidden.
Import symbols directly from the module that defines them; do not import from a directory path such as../formatsexpecting implicitindex.tsresolution.
src/**/*.ts: In Archgate CLI TypeScript source files, all subprocess execution must useBun.spawnwith array-based arguments;Bun.$shell template literals are forbidden.
Do not import$frombunin Archgate CLI TypeScript source files, because it exposes the forbidden Bun shell API.
When usingBun.spawnin Archgate CLI TypeScript source files, pass command and arguments as an array and do not use shell features such as pipes (|), redirects (>), or globbing (*) in the subprocess arguments.
After reading subprocess stdout or stderr viaBun.spawn, alwaysawait proc.exitedto ensure the process has terminated.
Wrap CLI availability checks intry/catchand return a boolean, since the command may not exist on the system.
src/**/*.ts: Useawait Bun.file(path).json()when reading JSON files in Bun TypeScript source code; do not useJSON.parse(await Bun.file(path).text())orJSON.parse(fs.readFileSync(path, "utf-8"))for file reads.
UseBun.JSONC.parse()when reading files that may contain comments, such astsconfig.json, instead of plainJSON.parse()on file contents.
ReserveJSON.parse()for parsing JSON strings from non-file sources such as API responses or string variables; do not use it as the default for reading JSON files.
src/**/*.ts: In TypeScript source files undersrc/, useBun.envinstead ofprocess.envfor all environment variable reads and writes;process.envmust not be used.
In TypeScript source files undersrc/, use nullish coalescing for environment-variable defaults, e.g.Bun.env.NODE_ENV ?? "production".
In TypeScript source files undersrc/, use `Boolean(Bun.env.C...
Files:
src/commands/review-context.tssrc/commands/adr/list.tssrc/engine/reporter.tssrc/commands/check.tssrc/engine/context.ts
src/**/!(*platform).ts
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-009-platform-detection-helper.md)
src/**/!(*platform).ts: Insrc/TypeScript source files, do not readprocess.platformdirectly; usesrc/helpers/platform.ts(isWindows(),isMacOS(),isLinux(),isWSL(),getPlatformInfo()) for all platform detection.
Use the centralized platform helper instead of duplicating OS/WSL detection logic inline anywhere insrc/TypeScript source.
When behavior differs between Linux and Windows, account for WSL by usingisWSL()rather than assuming `
Files:
src/commands/review-context.tssrc/commands/adr/list.tssrc/engine/reporter.tssrc/commands/check.tssrc/engine/context.ts
src/commands/{*.ts,*/index.ts}
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-015-cli-command-documentation-coverage.md)
Every top-level CLI command registered via
register*Command(program)must live insrc/commands/<name>.tsorsrc/commands/<name>/index.tsso it can be matched to a docs page.
Files:
src/commands/review-context.tssrc/commands/check.ts
{src/commands/{*.ts,*/index.ts},docs/src/content/docs/reference/cli/!(index).mdx}
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-015-cli-command-documentation-coverage.md)
{src/commands/{*.ts,*/index.ts},docs/src/content/docs/reference/cli/!(index).mdx}: When a top-level command is added, its docs page must be added in the same change; when a top-level command is removed, its matching docs page must be deleted in the same change.
Keep command and documentation stems aligned when renaming a top-level command file; renamingsrc/commands/<name>.tsorsrc/commands/<name>/index.tsmust be paired with renamingdocs/src/content/docs/reference/cli/<name>.mdx.
Files:
src/commands/review-context.tsdocs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdxsrc/commands/check.ts
docs/src/content/docs/**/*.mdx
📄 CodeRabbit inference engine (.archgate/adrs/GEN-001-documentation-site.md)
docs/src/content/docs/**/*.mdx: Use MDX (.mdx) for all content pages underdocs/src/content/docs/.
Escape literal curly braces in MDX when showing template syntax; do not use bare{}in prose or code-fence labels.
Files:
docs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdxdocs/src/content/docs/nb/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/review-context.mdx
{docs/src/content/docs/**/*.mdx,docs/astro.config.mjs}
📄 CodeRabbit inference engine (.archgate/adrs/GEN-001-documentation-site.md)
When adding a new documentation page, create the MDX file in
docs/src/content/docs/<category>/<slug>.mdxand add the page todocs/astro.config.mjssidebar configuration.
Files:
docs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdxdocs/src/content/docs/nb/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/review-context.mdx
docs/src/content/docs/**
📄 CodeRabbit inference engine (.archgate/adrs/GEN-001-documentation-site.md)
Do not create documentation content files outside
docs/src/content/docs/; Starlight content must live in that exact directory structure.
Files:
docs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdxdocs/src/content/docs/nb/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/review-context.mdx
docs/src/content/docs/**/*.{mdx,md}
📄 CodeRabbit inference engine (.archgate/adrs/GEN-002-docs-i18n.md)
docs/src/content/docs/**/*.{mdx,md}: For every English docs page underdocs/src/content/docs/, create a translated file in each locale directory with the exact same relative path and filename, and ensure every locale file corresponds to an existing root file (no orphan translations).
When adding or modifying English documentation content, update the corresponding locale files in the same pull request.
Translate all user-facing prose in docs pages, including titles, descriptions, headings, paragraphs, list items, table text, and admonition content.
Translate user-visible text props in Starlight components such as<Card title="...">and<LinkCard description="...">.
Keep code blocks, CLI commands, file paths, TypeScript identifiers, technical terms, import statements, component names, andlink/href/slugattribute values in English.
Keep internal links unchanged and do not add locale prefixes (for example, use/guides/...rather than/pt-br/guides/...).
Preserve MDX curly-brace escaping (\{\}) in translated content.
Preserve Starlight component import statements identically in translated files.
Files:
docs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdxdocs/src/content/docs/nb/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/review-context.mdx
docs/src/content/docs/nb/**/*.{mdx,md}
📄 CodeRabbit inference engine (.archgate/adrs/GEN-002-docs-i18n.md)
Use Norwegian Bokmål (not Nynorsk) for Norwegian translations, with the informal
duform and correct Norwegian characters (æ,ø,å).
Files:
docs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/nb/reference/cli/review-context.mdx
docs/src/content/docs/pt-br/**/*.{mdx,md}
📄 CodeRabbit inference engine (.archgate/adrs/GEN-002-docs-i18n.md)
Use correct Portuguese diacritical marks in Brazilian Portuguese translations; never write unaccented Portuguese.
Files:
docs/src/content/docs/pt-br/reference/cli/review-context.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdx
docs/src/content/docs/reference/cli/!(index).mdx
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-015-cli-command-documentation-coverage.md)
Every top-level CLI command must have a corresponding reference page at
docs/src/content/docs/reference/cli/<name>.mdx, and every non-index.mdxpage in that directory must correspond to exactly one top-level command.
Files:
docs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdx
docs/src/content/docs/reference/cli/*.mdx
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-015-cli-command-documentation-coverage.md)
Do not create separate reference pages for subcommands; subcommand documentation must stay inline within the parent command’s
.mdxpage.Every parent CLI reference page in
docs/src/content/docs/reference/cli/must contain headings for its direct subcommands using the exactarchgate <parent> <sub>format, and must not keep headings for subcommands that no longer exist.
Files:
docs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdx
docs/src/content/docs/reference/**/*.mdx
📄 CodeRabbit inference engine (.archgate/adrs/GEN-001-documentation-site.md)
Keep reference pages accurate to the CLI source code; when CLI APIs change, update the corresponding reference docs in the same PR.
Files:
docs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdx
src/{helpers,engine}/**/*.ts
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-002-error-handling.md)
Do not use
console.log(),console.warn(), orconsole.info()directly in helper or engine files; uselogInfo()orlogWarn()instead.
Files:
src/engine/reporter.tssrc/engine/context.ts
🧠 Learnings (2)
📚 Learning: 2026-06-11T12:50:28.661Z
Learnt from: rhuanbarreto
Repo: archgate/cli PR: 406
File: .claude/agent-memory/archgate-developer/feedback_prefer_tests_over_adr_rules.md:8-18
Timestamp: 2026-06-11T12:50:28.661Z
Learning: In `archgate/cli`, for markdown files under `.claude/agent-memory/`, follow the established convention: use YAML frontmatter (with a `name:` field used as the document title) and do not require a top-level `#` (H1) heading. During code review, do not flag missing first-line/first-top-level H1 headings (e.g., MD041) for these agent-memory files since markdownlint is not part of the repo’s `bun run validate` lint pipeline (oxlint/oxfmt only).
Applied to files:
.claude/agent-memory/archgate-developer/project_rules_engine_internals.md.claude/agent-memory/archgate-developer/project_test_isolation_gotchas.md.claude/agent-memory/archgate-developer/feedback_prefer_tests_over_adr_rules.md.claude/agent-memory/archgate-developer/MEMORY.md
📚 Learning: 2026-07-11T13:03:15.386Z
Learnt from: rhuanbarreto
Repo: archgate/cli PR: 467
File: .archgate/adrs/ARCH-011-consistent-project-root-resolution.md:0-0
Timestamp: 2026-07-11T13:03:15.386Z
Learning: For Markdown files formatted by oxfmt (especially ADRs), avoid inline code spans that contain escaped backticks, e.g. `\`...\`` inside a single `` `...` `` span. oxfmt may mis-parse these and, on re-format, can collapse spaces after later inline code spans on the same line, effectively removing any manually re-added spacing. Instead, rephrase the text so the message stays plain quoted text, and put any embedded command/fragment that needs code formatting (e.g., `archgate init`) in its own separate inline code span; keep surrounding punctuation/spacing outside the code span.
Applied to files:
.archgate/adrs/ARCH-005-testing-standards.md.archgate/adrs/ARCH-003-output-formatting.md
🪛 LanguageTool
.claude/agent-memory/archgate-developer/project_test_isolation_gotchas.md
[style] ~10-~10: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...s NOT unset.** So the idiomatic-looking const orig = Bun.env.X; …; Bun.env.X = orig silently leaks X="undefined" ...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
docs/src/content/docs/pt-br/reference/cli/review-context.mdx
[uncategorized] ~32-~32: Pontuação duplicada
Context: ...isar com archgate adr show <id>. Use --verbose para incorporar na resposta o t...
(DOUBLE_PUNCTUATION_XML)
[uncategorized] ~32-~32: Pontuação duplicada
Context: ...o e busque os detalhes sob demanda; use --verbose apenas quando um único payload ...
(DOUBLE_PUNCTUATION_XML)
[uncategorized] ~34-~34: Pontuação duplicada
Context: ...ntido for realmente necessário. Quando --run-checks é usado, checkSummary segu...
(DOUBLE_PUNCTUATION_XML)
.archgate/adrs/ARCH-005-testing-standards.md
[style] ~67-~67: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...rocess.env.X = originalassignment** —env.X = undefined` assigns the literal string...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
.claude/agent-memory/archgate-developer/feedback_prefer_tests_over_adr_rules.md
[style] ~12-~12: Possibly, ‘actually’ is redundant. Consider using “only”.
Context: ...he rules — _"your proposal for rules is actually only testing the implementation and not the ...
(ADVERB_ONLY)
docs/src/content/docs/pt-br/reference/cli/check.mdx
[uncategorized] ~132-~132: Pontuação duplicada
Context: ...lse. ## Formato da saída JSON Quando --json` é usado, a saída é um único objeto...
(DOUBLE_PUNCTUATION_XML)
[uncategorized] ~134-~134: Pontuação duplicada
Context: ...ecutadas e quantas foram aprovadas. Use --verbose para incluir todas as regras em...
(DOUBLE_PUNCTUATION_XML)
🔇 Additional comments (64)
.claude/agent-memory/archgate-developer/MEMORY.md (2)
24-24: LGTM!
45-45: LGTM!.claude/agent-memory/archgate-developer/feedback_prefer_tests_over_adr_rules.md (3)
3-3: LGTM!
12-12: LGTM!
16-17: LGTM!.claude/agent-memory/archgate-developer/project_rules_engine_internals.md (1)
12-12: LGTM!.claude/agent-memory/archgate-developer/project_test_isolation_gotchas.md (1)
10-10: LGTM!.archgate/adrs/ARCH-005-testing-standards.md (2)
43-43: LGTM!Also applies to: 67-67, 234-234, 252-252
43-43: LGTM!Also applies to: 67-67, 234-234, 252-252
.oxlintrc.json (2)
2-6: LGTM!Also applies to: 26-29
2-6: LGTM!Also applies to: 26-29
lint/no-bare-env-restore.ts (2)
1-183: LGTM!
1-183: LGTM!tests/helpers/binary-upgrade.test.ts (2)
26-26: LGTM!Also applies to: 468-468
26-26: LGTM!Also applies to: 468-468
tests/helpers/telemetry-config.test.ts (2)
8-9: LGTM!Also applies to: 24-28, 237-237
8-9: LGTM!Also applies to: 24-28, 237-237
tests/helpers/telemetry.test.ts (2)
8-9: LGTM!Also applies to: 29-34
8-9: LGTM!Also applies to: 29-34
tests/helpers/update-check.test.ts (2)
12-12: LGTM!Also applies to: 73-73, 297-303
12-12: LGTM!Also applies to: 73-73, 297-303
tests/helpers/vscode-settings.test.ts (2)
21-33: LGTM!Also applies to: 112-112, 174-174, 326-326, 343-343
21-33: LGTM!Also applies to: 112-112, 174-174, 326-326, 343-343
tests/test-utils.ts (1)
30-46: LGTM!tests/commands/check-action.test.ts (1)
24-24: LGTM!Also applies to: 303-303
tests/commands/clean.test.ts (1)
17-17: LGTM!Also applies to: 61-62
tests/commands/upgrade.test.ts (1)
19-19: LGTM!Also applies to: 71-73
tests/helpers/auth.test.ts (1)
8-9: LGTM!Also applies to: 38-47
tests/helpers/exit.test.ts (1)
13-13: LGTM!Also applies to: 25-25
tests/helpers/init-project.test.ts (1)
12-12: LGTM!Also applies to: 216-217
tests/helpers/opencode-settings.test.ts (1)
13-13: LGTM!Also applies to: 61-62, 85-85
tests/helpers/credential-store.test.ts (2)
13-13: LGTM!
35-41: LGTM!tests/helpers/output.test.ts (2)
6-6: LGTM!
16-16: LGTM!tests/helpers/platform.test.ts (2)
14-14: LGTM!
183-184: LGTM!tests/helpers/plugin-install-cleanup.test.ts (2)
31-31: LGTM!
110-111: LGTM!tests/helpers/plugin-install.test.ts (2)
37-37: LGTM!
126-127: LGTM!tests/helpers/sentry.test.ts (2)
8-9: LGTM!
27-32: LGTM!tests/helpers/session-context-copilot.test.ts (2)
12-12: LGTM!
37-37: LGTM!tests/helpers/session-context-opencode.test.ts (2)
13-13: LGTM!
40-40: LGTM!.archgate/adrs/ARCH-003-output-formatting.md (1)
36-36: LGTM!Also applies to: 48-48, 60-61, 155-155, 178-178
src/commands/adr/list.ts (1)
9-25: LGTM!Also applies to: 61-61
src/engine/reporter.ts (1)
47-63: LGTM!Also applies to: 268-294
src/commands/check.ts (1)
142-147: LGTM!tests/commands/adr/list.test.ts (1)
34-46: LGTM!Also applies to: 148-175
tests/engine/reporter.test.ts (1)
138-180: LGTM!docs/src/content/docs/nb/reference/cli/check.mdx (1)
132-134: LGTM!docs/src/content/docs/pt-br/reference/cli/check.mdx (1)
132-134: LGTM!docs/src/content/docs/reference/cli/check.mdx (1)
132-134: LGTM!src/commands/review-context.ts (1)
25-28: LGTM!Also applies to: 44-47
tests/commands/review-context.test.ts (1)
55-62: LGTM!src/engine/context.ts (1)
11-289: LGTM!tests/engine/context.test.ts (1)
84-265: LGTM!docs/src/content/docs/nb/reference/cli/review-context.mdx (1)
20-34: LGTM!docs/src/content/docs/pt-br/reference/cli/review-context.mdx (1)
20-34: LGTM!docs/src/content/docs/reference/cli/review-context.mdx (1)
20-34: LGTM!tests/integration/review-context.test.ts (1)
179-181: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winRemove duplicate property declarations.
There are multiple identical
checkSummaryproperty declarations here, likely due to a copy-paste error.♻️ Proposed fix
const ctx = JSON.parse(stdout) as { checkSummary: { total: number; passed: number; results: unknown[] }; - checkSummary: { total: number; passed: number; results: unknown[] }; - checkSummary: { total: number; passed: number; results: unknown[] }; - checkSummary: { total: number; passed: number; results: unknown[] }; };> Likely an incorrect or invalid review comment.
Code Coverage
Full HTML report available in workflow artifacts. Per-directory breakdown
|
…timeouts reporter.test.ts exercises reportJSON directly, so nothing caught check.ts passing the wrong verbose value through to it. The --adr filter test covers verbose=true (it asserts per-rule entries are present), but a hardcoded true would have shipped undetected. Add an end-to-end test asserting the default omits a cleanly-passing rule while the counts still report it, and that --verbose restores the entry. Fire-tested: hardcoding verbose=true in check.ts fails exactly this test. Also drop the `, 60000` per-test overrides from the two new review-context tests. ARCH-005 permits an override solely to grant a genuinely slow test MORE time than the global `--timeout 60000`; an override equal to the global grants nothing. Both raised in CodeRabbit review of #476. Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_ac4d1846-6701-4f9e-bf8f-7e3a49f4ff29) |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/engine/reporter.ts`:
- Line 294: Replace the direct console.log call in the reporter output path with
process.stdout.write, preserving formatJSON(payload, forcePretty) exactly and
explicitly appending a newline so the emitted output remains pure JSON with
equivalent line termination.
In `@tests/commands/adr/list.test.ts`:
- Around line 151-154: Replace the writeFileSync call in the ADR list test setup
with Bun.write, preserving the existing target path and ADR_CONTENT_WITH_FILES
contents.
In `@tests/commands/clean.test.ts`:
- Around line 61-62: Replace HOME/USERPROFILE environment overrides with an
os.homedir() spy in tests/commands/clean.test.ts (61-62),
tests/commands/upgrade.test.ts (71-73), and tests/helpers/auth.test.ts (38-47);
replace the HOME override/restore with the same spy in
tests/helpers/init-project.test.ts (216-217) and
tests/helpers/opencode-settings.test.ts (61-62). Configure each spy to return
the test home path and restore it after each test, removing the corresponding
environment restoration calls.
In `@tests/commands/review-context.test.ts`:
- Around line 56-62: Extend the test around registerReviewContextCommand to
execute the review-context command or spy on buildReviewContext, verifying that
--verbose forwards briefings: true and invocation without --verbose leaves
briefings unset or false. Retain the existing registration assertion, and use
the command’s established execution and dependency setup.
In `@tests/helpers/telemetry-config.test.ts`:
- Around line 24-28: Replace HOME environment overrides and restorations with
os.homedir() spies, restoring each spy after its test. In
tests/helpers/telemetry-config.test.ts lines 24-28 and
tests/helpers/telemetry.test.ts lines 29-34, remove HOME handling and mock
os.homedir(); in tests/helpers/binary-upgrade.test.ts line 468,
tests/helpers/session-context-copilot.test.ts line 37, and
tests/helpers/update-check.test.ts lines 73 and 297-303, replace HOME
restoration with restoration of the os.homedir mock.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4caa3d24-38ed-4205-9fc7-f1868c5869f5
📒 Files selected for processing (47)
.archgate/adrs/ARCH-003-output-formatting.md.archgate/adrs/ARCH-005-testing-standards.md.claude/agent-memory/archgate-developer/MEMORY.md.claude/agent-memory/archgate-developer/feedback_prefer_tests_over_adr_rules.md.claude/agent-memory/archgate-developer/project_rules_engine_internals.md.claude/agent-memory/archgate-developer/project_test_isolation_gotchas.md.oxlintrc.jsondocs/public/llms-full.txtdocs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/nb/reference/cli/review-context.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdxlint/no-bare-env-restore.tssrc/commands/adr/list.tssrc/commands/check.tssrc/commands/review-context.tssrc/engine/context.tssrc/engine/reporter.tstests/commands/adr/list.test.tstests/commands/check-action.test.tstests/commands/clean.test.tstests/commands/review-context.test.tstests/commands/upgrade.test.tstests/engine/context.test.tstests/engine/reporter.test.tstests/helpers/auth.test.tstests/helpers/binary-upgrade.test.tstests/helpers/credential-store.test.tstests/helpers/exit.test.tstests/helpers/init-project.test.tstests/helpers/opencode-settings.test.tstests/helpers/output.test.tstests/helpers/platform.test.tstests/helpers/plugin-install-cleanup.test.tstests/helpers/plugin-install.test.tstests/helpers/sentry.test.tstests/helpers/session-context-copilot.test.tstests/helpers/session-context-opencode.test.tstests/helpers/telemetry-config.test.tstests/helpers/telemetry.test.tstests/helpers/update-check.test.tstests/helpers/vscode-settings.test.tstests/integration/check.test.tstests/integration/review-context.test.tstests/test-utils.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
- GitHub Check: Smoke Test (Windows) / Windows
- GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (20)
src/commands/**/*.ts
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-001-command-structure.md)
src/commands/**/*.ts: Each command module undersrc/commands/must export aregister*Command(program)function, with one command per file (or one command group viaindex.ts).
Command files must be thin: they should only parse arguments, call engine/helpers, and format output; business logic must live insrc/engine/,src/helpers/, orsrc/formats/.
Command modules must not useexecutableDir()for command discovery, must not call.parse()themselves, and must not spawn child processes for subcommand execution.
Subcommand groups should live in nested directories with anindex.tsthat composes child commands (for example,src/commands/adr/index.ts).
src/commands/**/*.ts: In command files undersrc/commands/**/*.ts, options that need type narrowing beyond plain strings MUST usenew Option()with.addOption()instead of plain.option().
Insrc/commands/**/*.ts, importOptionfrom@commander-js/extra-typingsalongsideCommandso typed options get full type inference.
Insrc/commands/**/*.ts, enum-like options with a fixed set of allowed values must use.choices()on anOptionto provide runtime validation and compile-time type narrowing.
Insrc/commands/**/*.ts, options that require type conversion must use.argParser()on anOptionobject, not a parser function passed as the third argument to.option().
Insrc/commands/**/*.ts, register typed options with.addOption()rather than.option().
Insrc/commands/**/*.ts, pass both the choices array and default values withas constwhen using.choices()and.default()to preserve literal types.
Insrc/commands/**/*.ts, do not add manual validation for choice options (for exampleif (!VALID.includes(val))), because Commander handles invalid-value rejection automatically.Command modules must export
register*Command(program)and contain I/O only; business logic belongs elsewhere.
src/commands/**/*.ts: Commands that operate on.archgate/project resourc...
Files:
src/commands/review-context.tssrc/commands/adr/list.tssrc/commands/check.ts
src/**/*.ts
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-004-no-barrel-files.md)
src/**/*.ts: Do not re-export symbols from another module in any source file; statements likeexport { X } from "./other"andexport type { X } from "./other"are forbidden.
Import symbols directly from the module that defines them; do not import from a directory path such as../formatsexpecting implicitindex.tsresolution.
src/**/*.ts: In Archgate CLI TypeScript source files, all subprocess execution must useBun.spawnwith array-based arguments;Bun.$shell template literals are forbidden.
Do not import$frombunin Archgate CLI TypeScript source files, because it exposes the forbidden Bun shell API.
When usingBun.spawnin Archgate CLI TypeScript source files, pass command and arguments as an array and do not use shell features such as pipes (|), redirects (>), or globbing (*) in the subprocess arguments.
After reading subprocess stdout or stderr viaBun.spawn, alwaysawait proc.exitedto ensure the process has terminated.
Wrap CLI availability checks intry/catchand return a boolean, since the command may not exist on the system.
src/**/*.ts: Useawait Bun.file(path).json()when reading JSON files in Bun TypeScript source code; do not useJSON.parse(await Bun.file(path).text())orJSON.parse(fs.readFileSync(path, "utf-8"))for file reads.
UseBun.JSONC.parse()when reading files that may contain comments, such astsconfig.json, instead of plainJSON.parse()on file contents.
ReserveJSON.parse()for parsing JSON strings from non-file sources such as API responses or string variables; do not use it as the default for reading JSON files.
src/**/*.ts: In TypeScript source files undersrc/, useBun.envinstead ofprocess.envfor all environment variable reads and writes;process.envmust not be used.
In TypeScript source files undersrc/, use nullish coalescing for environment-variable defaults, e.g.Bun.env.NODE_ENV ?? "production".
In TypeScript source files undersrc/, use `Boolean(Bun.env.C...
Files:
src/commands/review-context.tssrc/commands/adr/list.tssrc/commands/check.tssrc/engine/reporter.tssrc/engine/context.ts
**/*.{ts,tsx,js,jsx,mjs,cjs}
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-006-dependency-policy.md)
**/*.{ts,tsx,js,jsx,mjs,cjs}: Use Bun built-ins for file I/O (Bun.file,Bun.write), HTTP, subprocess execution (Bun.spawn), globbing (Bun.Glob), and testing (bun:test).
Do not use Node.js-specific APIs when Bun alternatives exist; for example, useBun.file()instead offs.readFile()for simple reads.
Prefernode:built-in modules such asnode:util,node:path, andnode:fsover npm alternatives.
Do not use utility libraries for single functions, such as importing lodash for one helper likepick.
Do not use path aliases (tsconfig paths); use relative imports with Bun's native module resolution.
Do not install packages globally during development; usebunxfor one-off tools.
Files:
src/commands/review-context.tstests/helpers/session-context-copilot.test.tstests/helpers/credential-store.test.tstests/commands/review-context.test.tstests/helpers/opencode-settings.test.tstests/helpers/init-project.test.tssrc/commands/adr/list.tstests/integration/check.test.tstests/helpers/output.test.tstests/helpers/plugin-install.test.tstests/commands/clean.test.tstests/helpers/session-context-opencode.test.tstests/helpers/binary-upgrade.test.tstests/helpers/plugin-install-cleanup.test.tssrc/commands/check.tstests/test-utils.tstests/helpers/platform.test.tstests/commands/upgrade.test.tstests/commands/adr/list.test.tstests/helpers/telemetry-config.test.tstests/helpers/exit.test.tstests/helpers/sentry.test.tstests/engine/context.test.tstests/commands/check-action.test.tssrc/engine/reporter.tstests/engine/reporter.test.tstests/helpers/telemetry.test.tstests/integration/review-context.test.tstests/helpers/update-check.test.tslint/no-bare-env-restore.tstests/helpers/auth.test.tstests/helpers/vscode-settings.test.tssrc/engine/context.ts
src/**/!(*platform).ts
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-009-platform-detection-helper.md)
src/**/!(*platform).ts: Insrc/TypeScript source files, do not readprocess.platformdirectly; usesrc/helpers/platform.ts(isWindows(),isMacOS(),isLinux(),isWSL(),getPlatformInfo()) for all platform detection.
Use the centralized platform helper instead of duplicating OS/WSL detection logic inline anywhere insrc/TypeScript source.
When behavior differs between Linux and Windows, account for WSL by usingisWSL()rather than assuming `
Files:
src/commands/review-context.tssrc/commands/adr/list.tssrc/commands/check.tssrc/engine/reporter.tssrc/engine/context.ts
src/commands/{*.ts,*/index.ts}
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-015-cli-command-documentation-coverage.md)
Every top-level CLI command registered via
register*Command(program)must live insrc/commands/<name>.tsorsrc/commands/<name>/index.tsso it can be matched to a docs page.
Files:
src/commands/review-context.tssrc/commands/check.ts
{src/commands/{*.ts,*/index.ts},docs/src/content/docs/reference/cli/!(index).mdx}
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-015-cli-command-documentation-coverage.md)
{src/commands/{*.ts,*/index.ts},docs/src/content/docs/reference/cli/!(index).mdx}: When a top-level command is added, its docs page must be added in the same change; when a top-level command is removed, its matching docs page must be deleted in the same change.
Keep command and documentation stems aligned when renaming a top-level command file; renamingsrc/commands/<name>.tsorsrc/commands/<name>/index.tsmust be paired with renamingdocs/src/content/docs/reference/cli/<name>.mdx.
Files:
src/commands/review-context.tssrc/commands/check.tsdocs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdx
{src,tests}/**/*.ts
📄 CodeRabbit inference engine (.archgate/adrs/LEGAL-001-spdx-license-headers.md)
{src,tests}/**/*.ts: Every TypeScript source file insrc/andtests/must begin with// SPDX-License-Identifier: Apache-2.0followed by// Copyright 2026 Archgate.
If a TypeScript file has a shebang line (for example#!/usr/bin/env buninsrc/cli.ts), the SPDX license header must appear immediately after the shebang.
Use single-line//comments for the SPDX header; do not use block comments (/* */) or alternate license identifiers.
Files:
src/commands/review-context.tstests/helpers/session-context-copilot.test.tstests/helpers/credential-store.test.tstests/commands/review-context.test.tstests/helpers/opencode-settings.test.tstests/helpers/init-project.test.tssrc/commands/adr/list.tstests/integration/check.test.tstests/helpers/output.test.tstests/helpers/plugin-install.test.tstests/commands/clean.test.tstests/helpers/session-context-opencode.test.tstests/helpers/binary-upgrade.test.tstests/helpers/plugin-install-cleanup.test.tssrc/commands/check.tstests/test-utils.tstests/helpers/platform.test.tstests/commands/upgrade.test.tstests/commands/adr/list.test.tstests/helpers/telemetry-config.test.tstests/helpers/exit.test.tstests/helpers/sentry.test.tstests/engine/context.test.tstests/commands/check-action.test.tssrc/engine/reporter.tstests/engine/reporter.test.tstests/helpers/telemetry.test.tstests/integration/review-context.test.tstests/helpers/update-check.test.tstests/helpers/auth.test.tstests/helpers/vscode-settings.test.tssrc/engine/context.ts
**
⚙️ CodeRabbit configuration file
**: This project uses Archgate — an AI governance framework based on
Architecture Decision Records (ADRs). The ADRs in.archgate/adrs/
are the authoritative rules for this codebase. Each ADR has a companion
.rules.tsfile with automated checks that run viaarchgate check.When reviewing, you must:
- Treat ADR violations as blocking issues, not suggestions.
- Cite the specific ADR ID when flagging a violation (e.g., "Violates ARCH-006").
- Focus on semantic and contextual violations that automated rules cannot catch —
the.rules.tsfiles already cover syntactic/structural patterns.- If you are unsure whether something violates an ADR, flag it as a question
rather than approving it.
Files:
src/commands/review-context.tstests/helpers/session-context-copilot.test.tstests/helpers/credential-store.test.tstests/commands/review-context.test.tstests/helpers/opencode-settings.test.tstests/helpers/init-project.test.tssrc/commands/adr/list.tstests/integration/check.test.tstests/helpers/output.test.tstests/helpers/plugin-install.test.tstests/commands/clean.test.tstests/helpers/session-context-opencode.test.tstests/helpers/binary-upgrade.test.tstests/helpers/plugin-install-cleanup.test.tssrc/commands/check.tsdocs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdxtests/test-utils.tstests/helpers/platform.test.tsdocs/src/content/docs/nb/reference/cli/review-context.mdxtests/commands/upgrade.test.tstests/commands/adr/list.test.tsdocs/public/llms-full.txttests/helpers/telemetry-config.test.tstests/helpers/exit.test.tstests/helpers/sentry.test.tstests/engine/context.test.tstests/commands/check-action.test.tsdocs/src/content/docs/reference/cli/check.mdxsrc/engine/reporter.tstests/engine/reporter.test.tstests/helpers/telemetry.test.tsdocs/src/content/docs/reference/cli/review-context.mdxtests/integration/review-context.test.tstests/helpers/update-check.test.tsdocs/src/content/docs/pt-br/reference/cli/review-context.mdxlint/no-bare-env-restore.tstests/helpers/auth.test.tstests/helpers/vscode-settings.test.tssrc/engine/context.ts
tests/**/*.ts
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-009-platform-detection-helper.md)
In test files, use
_resetPlatformCache()to simulate different platforms instead of mocking or mutatingprocess.platformdirectly.
tests/**/*.ts: Use Bun's built-inbun:testrunner for all tests, and import test utilities frombun:testrather thannode:test.
Shared test helpers must also restore environment variables withrestoreEnv; do not rely on the test-only lint rule to cover helper files.
Files:
tests/helpers/session-context-copilot.test.tstests/helpers/credential-store.test.tstests/commands/review-context.test.tstests/helpers/opencode-settings.test.tstests/helpers/init-project.test.tstests/integration/check.test.tstests/helpers/output.test.tstests/helpers/plugin-install.test.tstests/commands/clean.test.tstests/helpers/session-context-opencode.test.tstests/helpers/binary-upgrade.test.tstests/helpers/plugin-install-cleanup.test.tstests/test-utils.tstests/helpers/platform.test.tstests/commands/upgrade.test.tstests/commands/adr/list.test.tstests/helpers/telemetry-config.test.tstests/helpers/exit.test.tstests/helpers/sentry.test.tstests/engine/context.test.tstests/commands/check-action.test.tstests/engine/reporter.test.tstests/helpers/telemetry.test.tstests/integration/review-context.test.tstests/helpers/update-check.test.tstests/helpers/auth.test.tstests/helpers/vscode-settings.test.ts
tests/**/*.test.ts
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-005-testing-standards.md)
tests/**/*.test.ts: Place tests undertests/mirroring thesrc/structure, and name test files with the.test.tssuffix.
Use isolated temporary directories created withmkdtempfor filesystem tests and clean them up inafterEachorafterAll.
Close external SDK resources such as servers, clients, and transports in lifecycle hooks using their cleanup methods.
When committing in a temporary Git repository, configure localuser.emailanduser.nameimmediately aftergit init.
Test public module interfaces rather than private implementation details, avoid network access in unit tests, and use descriptive behavior-focused test names.
Every runnabletest()orit()must contain at least oneexpect()assertion; express does-not-throw contracts with explicit assertions, and usetest.skiportest.todofor intentional placeholders.
Restore environment variables withrestoreEnv(key, original)rather than assigning a captured value directly toBun.envorprocess.env.
Mock HTTP requests by assigning directly toglobalThis.fetchand restore the original implementation after each test; do not mocknode:fetch.
Mock first-party modules withimport * as modandspyOn(mod, "fn"), not process-globalmock.module(). Reservemock.module()for suitable third-party modules.
Wrap inlinespyOnormockImplementationusage intry/finallysomockRestore()always executes, or manage spies inbeforeEachandafterEach.
When redirecting user-scope paths, mockos.homedir()rather than relying on runtimeHOMEoverrides; restore the spy after each test.
Make large production thresholds injectable and use small injected values in tests instead of creating thousands of fixture files.
Per-test timeout overrides may exceed the global 60-second timeout, but must never be shorter than it.
Do not write real user-scope state; spy out the writer or redirectos.homedir()to an isolatedmkdtempdirectory.
Do not skip tests without a tracking issue, ...
Files:
tests/helpers/session-context-copilot.test.tstests/helpers/credential-store.test.tstests/commands/review-context.test.tstests/helpers/opencode-settings.test.tstests/helpers/init-project.test.tstests/integration/check.test.tstests/helpers/output.test.tstests/helpers/plugin-install.test.tstests/commands/clean.test.tstests/helpers/session-context-opencode.test.tstests/helpers/binary-upgrade.test.tstests/helpers/plugin-install-cleanup.test.tstests/helpers/platform.test.tstests/commands/upgrade.test.tstests/commands/adr/list.test.tstests/helpers/telemetry-config.test.tstests/helpers/exit.test.tstests/helpers/sentry.test.tstests/engine/context.test.tstests/commands/check-action.test.tstests/engine/reporter.test.tstests/helpers/telemetry.test.tstests/integration/review-context.test.tstests/helpers/update-check.test.tstests/helpers/auth.test.tstests/helpers/vscode-settings.test.ts
docs/src/content/docs/**/*.mdx
📄 CodeRabbit inference engine (.archgate/adrs/GEN-001-documentation-site.md)
docs/src/content/docs/**/*.mdx: Use MDX (.mdx) for all content pages underdocs/src/content/docs/.
Escape literal curly braces in MDX when showing template syntax; do not use bare{}in prose or code-fence labels.
Files:
docs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdxdocs/src/content/docs/nb/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdxdocs/src/content/docs/pt-br/reference/cli/review-context.mdx
{docs/src/content/docs/**/*.mdx,docs/astro.config.mjs}
📄 CodeRabbit inference engine (.archgate/adrs/GEN-001-documentation-site.md)
When adding a new documentation page, create the MDX file in
docs/src/content/docs/<category>/<slug>.mdxand add the page todocs/astro.config.mjssidebar configuration.
Files:
docs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdxdocs/src/content/docs/nb/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdxdocs/src/content/docs/pt-br/reference/cli/review-context.mdx
docs/src/content/docs/**
📄 CodeRabbit inference engine (.archgate/adrs/GEN-001-documentation-site.md)
Do not create documentation content files outside
docs/src/content/docs/; Starlight content must live in that exact directory structure.
Files:
docs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdxdocs/src/content/docs/nb/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdxdocs/src/content/docs/pt-br/reference/cli/review-context.mdx
docs/src/content/docs/**/*.{mdx,md}
📄 CodeRabbit inference engine (.archgate/adrs/GEN-002-docs-i18n.md)
docs/src/content/docs/**/*.{mdx,md}: For every English docs page underdocs/src/content/docs/, create a translated file in each locale directory with the exact same relative path and filename, and ensure every locale file corresponds to an existing root file (no orphan translations).
When adding or modifying English documentation content, update the corresponding locale files in the same pull request.
Translate all user-facing prose in docs pages, including titles, descriptions, headings, paragraphs, list items, table text, and admonition content.
Translate user-visible text props in Starlight components such as<Card title="...">and<LinkCard description="...">.
Keep code blocks, CLI commands, file paths, TypeScript identifiers, technical terms, import statements, component names, andlink/href/slugattribute values in English.
Keep internal links unchanged and do not add locale prefixes (for example, use/guides/...rather than/pt-br/guides/...).
Preserve MDX curly-brace escaping (\{\}) in translated content.
Preserve Starlight component import statements identically in translated files.
Files:
docs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/check.mdxdocs/src/content/docs/nb/reference/cli/review-context.mdxdocs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdxdocs/src/content/docs/pt-br/reference/cli/review-context.mdx
docs/src/content/docs/nb/**/*.{mdx,md}
📄 CodeRabbit inference engine (.archgate/adrs/GEN-002-docs-i18n.md)
Use Norwegian Bokmål (not Nynorsk) for Norwegian translations, with the informal
duform and correct Norwegian characters (æ,ø,å).
Files:
docs/src/content/docs/nb/reference/cli/check.mdxdocs/src/content/docs/nb/reference/cli/review-context.mdx
docs/src/content/docs/pt-br/**/*.{mdx,md}
📄 CodeRabbit inference engine (.archgate/adrs/GEN-002-docs-i18n.md)
Use correct Portuguese diacritical marks in Brazilian Portuguese translations; never write unaccented Portuguese.
Files:
docs/src/content/docs/pt-br/reference/cli/check.mdxdocs/src/content/docs/pt-br/reference/cli/review-context.mdx
docs/src/content/docs/reference/cli/!(index).mdx
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-015-cli-command-documentation-coverage.md)
Every top-level CLI command must have a corresponding reference page at
docs/src/content/docs/reference/cli/<name>.mdx, and every non-index.mdxpage in that directory must correspond to exactly one top-level command.
Files:
docs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdx
docs/src/content/docs/reference/cli/*.mdx
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-015-cli-command-documentation-coverage.md)
Do not create separate reference pages for subcommands; subcommand documentation must stay inline within the parent command’s
.mdxpage.Every parent CLI reference page in
docs/src/content/docs/reference/cli/must contain headings for its direct subcommands using the exactarchgate <parent> <sub>format, and must not keep headings for subcommands that no longer exist.
Files:
docs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdx
docs/src/content/docs/reference/**/*.mdx
📄 CodeRabbit inference engine (.archgate/adrs/GEN-001-documentation-site.md)
Keep reference pages accurate to the CLI source code; when CLI APIs change, update the corresponding reference docs in the same PR.
Files:
docs/src/content/docs/reference/cli/check.mdxdocs/src/content/docs/reference/cli/review-context.mdx
src/{helpers,engine}/**/*.ts
📄 CodeRabbit inference engine (.archgate/adrs/ARCH-002-error-handling.md)
Do not use
console.log(),console.warn(), orconsole.info()directly in helper or engine files; uselogInfo()orlogWarn()instead.
Files:
src/engine/reporter.tssrc/engine/context.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: archgate/cli
Timestamp: 2026-07-15T22:45:33.463Z
Learning: Maintain at least 90% total line coverage, enforced in CI; coverage below the threshold blocks the pull request.
Learnt from: CR
Repo: archgate/cli
Timestamp: 2026-07-15T22:45:33.463Z
Learning: Every source file must have a corresponding test file under the mirrored `tests/` path.
📚 Learning: 2026-06-11T12:50:28.661Z
Learnt from: rhuanbarreto
Repo: archgate/cli PR: 406
File: .claude/agent-memory/archgate-developer/feedback_prefer_tests_over_adr_rules.md:8-18
Timestamp: 2026-06-11T12:50:28.661Z
Learning: In `archgate/cli`, for markdown files under `.claude/agent-memory/`, follow the established convention: use YAML frontmatter (with a `name:` field used as the document title) and do not require a top-level `#` (H1) heading. During code review, do not flag missing first-line/first-top-level H1 headings (e.g., MD041) for these agent-memory files since markdownlint is not part of the repo’s `bun run validate` lint pipeline (oxlint/oxfmt only).
Applied to files:
.claude/agent-memory/archgate-developer/project_test_isolation_gotchas.md.claude/agent-memory/archgate-developer/project_rules_engine_internals.md.claude/agent-memory/archgate-developer/feedback_prefer_tests_over_adr_rules.md.claude/agent-memory/archgate-developer/MEMORY.md
📚 Learning: 2026-07-11T13:03:15.386Z
Learnt from: rhuanbarreto
Repo: archgate/cli PR: 467
File: .archgate/adrs/ARCH-011-consistent-project-root-resolution.md:0-0
Timestamp: 2026-07-11T13:03:15.386Z
Learning: For Markdown files formatted by oxfmt (especially ADRs), avoid inline code spans that contain escaped backticks, e.g. `\`...\`` inside a single `` `...` `` span. oxfmt may mis-parse these and, on re-format, can collapse spaces after later inline code spans on the same line, effectively removing any manually re-added spacing. Instead, rephrase the text so the message stays plain quoted text, and put any embedded command/fragment that needs code formatting (e.g., `archgate init`) in its own separate inline code span; keep surrounding punctuation/spacing outside the code span.
Applied to files:
.archgate/adrs/ARCH-005-testing-standards.md.archgate/adrs/ARCH-003-output-formatting.md
🪛 LanguageTool
.claude/agent-memory/archgate-developer/project_test_isolation_gotchas.md
[style] ~10-~10: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...s NOT unset.** So the idiomatic-looking const orig = Bun.env.X; …; Bun.env.X = orig silently leaks X="undefined" ...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
docs/src/content/docs/pt-br/reference/cli/check.mdx
[uncategorized] ~132-~132: Pontuação duplicada
Context: ...lse. ## Formato da saída JSON Quando --json` é usado, a saída é um único objeto...
(DOUBLE_PUNCTUATION_XML)
[uncategorized] ~134-~134: Pontuação duplicada
Context: ...ecutadas e quantas foram aprovadas. Use --verbose para incluir todas as regras em...
(DOUBLE_PUNCTUATION_XML)
.archgate/adrs/ARCH-005-testing-standards.md
[style] ~67-~67: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...rocess.env.X = originalassignment** —env.X = undefined` assigns the literal string...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
.claude/agent-memory/archgate-developer/feedback_prefer_tests_over_adr_rules.md
[style] ~12-~12: Possibly, ‘actually’ is redundant. Consider using “only”.
Context: ...he rules — _"your proposal for rules is actually only testing the implementation and not the ...
(ADVERB_ONLY)
docs/src/content/docs/pt-br/reference/cli/review-context.mdx
[uncategorized] ~32-~32: Pontuação duplicada
Context: ...isar com archgate adr show <id>. Use --verbose para incorporar na resposta o t...
(DOUBLE_PUNCTUATION_XML)
[uncategorized] ~32-~32: Pontuação duplicada
Context: ...o e busque os detalhes sob demanda; use --verbose apenas quando um único payload ...
(DOUBLE_PUNCTUATION_XML)
[uncategorized] ~34-~34: Pontuação duplicada
Context: ...ntido for realmente necessário. Quando --run-checks é usado, checkSummary segu...
(DOUBLE_PUNCTUATION_XML)
🪛 markdownlint-cli2 (0.23.0)
.claude/agent-memory/archgate-developer/project_rules_engine_internals.md
[warning] 8-8: First line in a file should be a top-level heading
(MD041, first-line-heading, first-line-h1)
🔇 Additional comments (36)
.claude/agent-memory/archgate-developer/MEMORY.md (1)
24-25: LGTM!Also applies to: 45-45
.claude/agent-memory/archgate-developer/feedback_prefer_tests_over_adr_rules.md (1)
3-3: LGTM!Also applies to: 12-17
.claude/agent-memory/archgate-developer/project_rules_engine_internals.md (1)
8-9: LGTM!Also applies to: 14-14
.claude/agent-memory/archgate-developer/project_test_isolation_gotchas.md (1)
10-10: LGTM!.archgate/adrs/ARCH-003-output-formatting.md (1)
36-36: LGTM!Also applies to: 48-48, 60-61, 155-155, 178-178
src/commands/adr/list.ts (1)
9-25: LGTM!Also applies to: 61-61
src/commands/check.ts (1)
142-147: LGTM!tests/engine/reporter.test.ts (1)
138-149: LGTM!Also applies to: 151-158, 159-166, 167-180
docs/public/llms-full.txt (1)
4081-4083: LGTM!Also applies to: 4555-4570
docs/src/content/docs/nb/reference/cli/check.mdx (1)
132-134: LGTM!docs/src/content/docs/pt-br/reference/cli/check.mdx (1)
132-134: LGTM!docs/src/content/docs/reference/cli/check.mdx (1)
132-134: LGTM!src/commands/review-context.ts (1)
25-28: LGTM!Also applies to: 44-47
src/engine/context.ts (1)
11-11: LGTM!Also applies to: 20-23, 83-84, 99-136, 172-172, 185-187, 240-241, 266-269, 281-289
tests/engine/context.test.ts (1)
84-84: LGTM!Also applies to: 93-106, 123-124, 135-135, 145-145, 154-160, 248-265
tests/integration/review-context.test.ts (2)
109-111: LGTM!Also applies to: 149-178, 182-187, 189-220
179-181: 📐 Maintainability & Code Quality | 🟡 Minor | 💤 Low valueRemove duplicated property declarations.
The
checkSummaryproperty declaration has been duplicated multiple times, likely due to a copy-paste error. This should be cleaned up to a single property definition.🧹 Proposed fix
const ctx = JSON.parse(stdout) as { checkSummary: { total: number; passed: number; results: unknown[] }; - checkSummary: { total: number; passed: number; results: unknown[] }; - checkSummary: { total: number; passed: number; results: unknown[] }; - checkSummary: { total: number; passed: number; results: unknown[] }; };> Likely an incorrect or invalid review comment.docs/src/content/docs/nb/reference/cli/review-context.mdx (1)
20-21: LGTM!Also applies to: 22-27, 28-34
docs/src/content/docs/pt-br/reference/cli/review-context.mdx (1)
20-21: LGTM!Also applies to: 22-27, 28-34
docs/src/content/docs/reference/cli/review-context.mdx (1)
20-21: LGTM!Also applies to: 22-27, 28-34
tests/integration/check.test.ts (1)
213-216: 🎯 Functional Correctness | ⚡ Quick winAssert both verbose and non-verbose output modes.
This change updates the existing invocation to use
--verbosebut still does not verify that the default (non-verbose) JSON output actually omits cleanly-passing rules. Please add a companion assertion that runs the command without--verboseand verifies the default output behavior, as previously requested..archgate/adrs/ARCH-005-testing-standards.md (1)
43-43: LGTM!Also applies to: 67-67, 234-234, 252-252
.oxlintrc.json (1)
2-6: LGTM!Also applies to: 26-29
lint/no-bare-env-restore.ts (1)
1-182: LGTM!tests/helpers/exit.test.ts (1)
13-13: LGTM!Also applies to: 25-25
tests/helpers/vscode-settings.test.ts (1)
21-34: LGTM!Also applies to: 112-112, 174-174, 326-326, 343-343
tests/test-utils.ts (1)
30-46: LGTM!tests/commands/check-action.test.ts (1)
24-24: LGTM!Also applies to: 303-303
tests/helpers/opencode-settings.test.ts (1)
85-85: LGTM!tests/helpers/session-context-opencode.test.ts (1)
13-13: LGTM!Also applies to: 40-40
tests/helpers/credential-store.test.ts (1)
13-13: LGTM!Also applies to: 35-41
tests/helpers/output.test.ts (1)
6-6: LGTM!Also applies to: 16-16
tests/helpers/platform.test.ts (1)
14-14: LGTM!Also applies to: 183-184
tests/helpers/plugin-install-cleanup.test.ts (1)
31-31: LGTM!Also applies to: 110-111
tests/helpers/plugin-install.test.ts (1)
37-37: LGTM!Also applies to: 126-127
tests/helpers/sentry.test.ts (1)
8-9: LGTM!Also applies to: 27-32
|
@coderabbitai review The one actionable comment from the previous review is addressed in |
|
✅ Action performedReview finished.
|
|
Re-review triage: all 5 findings verified against the code; none required a change. Reasoning is on each thread, and all are resolved. One note on scope — the re-review states it covered The
|
# archgate ## [0.49.0](v0.48.4...v0.49.0) (2026-07-16) ### ⚠ BREAKING CHANGES * **engine:** block naming runtime globals to close reflective sandbox escapes (#481) * **engine:** close rule-file sandbox escapes via module allowlist (#477) * **cli:** emit lean agent-facing JSON payloads by default (#476) ### Features * **cli:** emit lean agent-facing JSON payloads by default ([#476](#476)) ([04affa3](04affa3)) * **engine:** base-revision + comment access for ctx.ast() (closes [#479](#479)) ([#480](#480)) ([49feb1f](49feb1f)), closes [#477](#477) ### Bug Fixes * **engine:** block naming runtime globals to close reflective sandbox escapes ([#481](#481)) ([6666df2](6666df2)), closes [#477](#477) [#480](#480) * **engine:** close rule-file sandbox escapes via module allowlist ([#477](#477)) ([18db14d](18db14d)) --- This PR was generated with [simple-release](https://github.com/TrigenSoftware/simple-release). <details> <summary>📄 Cheatsheet</summary> <br> You can configure the bot's behavior through a pull request comment using the `!simple-release/set-options` command. ### Command Format ````md !simple-release/set-options ```json { "bump": {}, "publish": {} } ``` ```` ### Useful Parameters #### Bump | Parameter | Type | Description | |-----------|------|-------------| | `version` | `string` | Force set specific version | | `as` | `'major' \| 'minor' \| 'patch' \| 'prerelease'` | Release type | | `prerelease` | `string` | Pre-release identifier (e.g., "alpha", "beta") | | `firstRelease` | `boolean` | Whether this is the first release | | `skip` | `boolean` | Skip version bump | | `byProject` | `Record<string, object>` | Per-project bump options for monorepos | #### Publish | Parameter | Type | Description | |-----------|------|-------------| | `skip` | `boolean` | Skip publishing | | `access` | `'public' \| 'restricted'` | Package access level | | `tag` | `string` | Tag for npm publication | ### Usage Examples #### Force specific version ````md !simple-release/set-options ```json { "bump": { "version": "2.0.0" } } ``` ```` #### Force major bump ````md !simple-release/set-options ```json { "bump": { "as": "major" } } ``` ```` #### Create alpha pre-release ````md !simple-release/set-options ```json { "bump": { "prerelease": "alpha" } } ``` ```` #### Publish with specific access and tag ````md !simple-release/set-options ```json { "bump": { "prerelease": "beta" }, "publish": { "access": "public", "tag": "beta" } } ``` ```` ### Access Restrictions The command can only be used by users with permissions: - repository owner - organization member - collaborator ### Notes - The last comment with `!simple-release/set-options` command takes priority - JSON must be valid, otherwise the command will be ignored - Parameters apply only to the current release execution - The command can be updated by editing the comment or adding a new one </details> <!-- Please do not edit this comment. simple-release-pull-request: true simple-release-branch-from: release simple-release-branch-to: main --> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Warning
Breaking change — default JSON output shape
This changes the default JSON emitted by three commands. A script or CI step that parses them may need
--verbose, or a switch toadr show. Human output,--cioutput, aggregate counts, and exit codes are all unchanged.adr list --jsonfilesandrespectGitignore; onlyid,title,domain,rulesremainarchgate adr show <id>for the full frontmattercheck --jsonresults[]carries only rules with findings (failures, rule errors, warning/info); no entry per passing rule--verboserestores every rule;total/passedcounts are unchangedreview-context [--run-checks]decision/dosAndDontsprose;checkSummary.resultsdrops clean-passing rules--verboserestores the prosePre-1.0, this bumps the minor version (per
.simple-release.js), not major.Why
Agent harnesses spill an oversized tool result to a file, at which point the payload stops being readable inline — which defeats the purpose of emitting JSON for an agent at all. Three commands crossed that threshold on a project with a few dozen ADRs.
ARCH-003already mandated compact JSON for agents and claimed a "30-50% token reduction". Dumping an entire record was therefore fully compliant with the ADR as written — which is how this shipped. Compaction and field selection are different levers: compaction scales a payload by a constant, but field selection is what keeps output inline-readable as N grows.What changed
Measured on a 38-ADR project (and on this repo for
review-context):adr list --jsoncheck --jsonreview-context --run-checksEach payload now scales with the number of findings rather than the number of rules/ADRs, so it stops degrading as a project grows.
adr listreturned the parsed frontmatter verbatim (.map(a => a.frontmatter)), includingfilesglob arrays that are useless for deciding what to read next. Now projects to the four fields the human table already renders;adr show <id>still has the rest.check --jsonemitted an entry per rule, including cleanly-passing ones whose entry only restates static ADR text (99% of the payload;descriptionalone was 43%). The documented example incheck.mdxalready showed the lean shape (total: 4, passed: 3, results: [1 fail]), so this aligns the implementation with its own contract.--verboserestores the full list.review-contextcarried every applicable ADR's Decision + Do's/Don'ts prose — 78% of the payload. Now opt-in behind--verbose; the default says which ADRs apply and the consumer drills down.checkSummarygets the same projection via a sharedresultsWithFindings()so the two paths cannot drift.Recorded as
ARCH-003key convention 7 ("progressive disclosure for agent payloads"). Docs updated in all three locales.Reviewer notes
The filter predicate is "has nothing to report", not "passed".
buildSummarysetsstatus: "fail"only for error-severity violations, so a warning-only rule isstatus: "pass"with a non-emptyviolations[]. The obviousstatus !== "pass"filter silently swallows every warning — caught by a probe test, and a real project had a live warning that would have vanished. ARCH-003 gained a Don't guarding against exactly this, and there's a regression test.--verboseis deliberately the same word on both commands — "give me the full detail". It already existed oncheck(documented as "Show passing rules and timing info") but only gated the console path.A prior hypothesis was wrong and is worth not re-attempting: deduping ADR briefings across domains saves 0 bytes — an ADR has exactly one
domainin its frontmatter, so cross-domain duplication is structurally impossible (measured duplication factor: 1.00x).Known follow-up: the installed reviewer skill (v0.13.2) still expects briefings in
review-context's default output. It degrades gracefully (it's LLM prompt guidance, not a parser — sub-agents read the ADR files themselves), but should start passing--verboseif batched briefings are still wanted.The test-isolation commits
The new
review-contextintegration test passed alone and failed in the full suite. Root cause was pre-existing and unrelated to this feature:env.X = undefinedassigns the literal string"undefined"and leaves the key present — it does not unset. The idiomaticconst orig = Bun.env.HOME; …; Bun.env.HOME = origrestore therefore leakedHOME="undefined"(normally unset on Windows) into Bun's shared test process and every subprocess it spawns, makingreview-contextreport zero changed files.Fixed via
restoreEnv()intests/test-utils.ts+ a custom oxlint ruletest-isolation/no-bare-env-restore.The rule tracks whether the assigned identifier was itself captured from an env read, rather than matching a
original*naming convention — because both are spelledBun.env.HOME = <identifier>, and the real call sites usedsavedHome,savedXdg,savedDistro,savedAppData,origCItoo. It found 3 genuinely unguarded restores that two rounds of manual grepping missed (check-action.test.ts,binary-upgrade.test.ts,init-project.test.ts— two of them leakingHOME). The other 28 sites were correct-but-verbose guards, now collapsed.Most telling:
vscode-settings.test.tsalready had a local helper whose docstring described this exact bug — "would stringifyundefinedinto the literal 'undefined', corrupting the env for subsequent test files" — while five other files leaked it. The knowledge existed but was inconsistently applied, which is what a mechanical check catches and review does not.Verification
bun run validatefully green: 1452 pass / 0 fail, lint clean, 43/43 ADR rules, build check.The last commit also carries an in-flight edit to
feedback_prefer_tests_over_adr_rules.mdauthored outside this change but present in the working tree.BREAKING CHANGE: The default
--jsonoutput ofadr list,check, andreview-contextnow omits fields and entries that were previously always present.adr list --jsonentries dropfilesandrespectGitignore(recover viaarchgate adr show <id>);check --jsonresults[]includes only rules with findings (pass--verbosefor every rule);review-contextomits each ADR'sdecision/dosAndDontsprose and clean-passingcheckSummary.resultsentries (pass--verbose). Aggregate counts, human-readable output,--cioutput, and exit codes are unchanged.