Skip to content

feat(session-context)!: per-editor list/show subcommands; remove --skip and its false premise#446

Merged
rhuanbarreto merged 15 commits into
mainfrom
fix/session-context-skip-help-text
Jul 2, 2026
Merged

feat(session-context)!: per-editor list/show subcommands; remove --skip and its false premise#446
rhuanbarreto merged 15 commits into
mainfrom
fix/session-context-skip-help-text

Conversation

@rhuanbarreto

@rhuanbarreto rhuanbarreto commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Problem

Follow-up to #445. The --skip flag on every session-context subcommand existed for one advertised purpose: "skip the sub-agent's own session to read the parent." Verified false on real data (skills run inline; Agent-tool sub-agents create no project session files; zero isSidechain entries). With that premise dead, positional recency guessing had no remaining role — reading the current conversation needs no knobs, and addressing an earlier session should be explicit.

New API (breaking)

Each editor subcommand is now a command group; the editor is the namespace, so no --editor flag anywhere:

Command Purpose
session-context <editor> [--max-entries] Read the current conversation (default action)
session-context <editor> list That editor's sessions for the project as JSON (id + updatedAt; opencode adds title, lists top-level sessions only)
session-context <editor> show <session-id> [--max-entries] Read a specific session; --root exists only on opencode show (child → top-level ancestor)

Removed: --skip everywhere; --session-id flags; --root from the opencode read. (Intermediate shapes iterated on this unreleased branch — per-editor --list/--session-id flags, then top-level list/show subcommands with --editor — are also gone.)

Notes

  • Sub-subcommands are documented as #### blocks inside each editor's docs section — same pattern as adr domain, matching ARCH-016's one-level rule scope
  • list/show behavior tests spawn the real CLI with HOME/USERPROFILE/XDG redirected (Bun's mock.module state is process-global across test files, so in-process tests would race the sibling tests' helper mocks)
  • bun run validate green (1349 tests, 39/39 ADR checks); live smoke test: claude-code list, claude-code show <real-id> verified against real stores; session-context list and --session-id correctly rejected
  • Docs rewritten in en/nb/pt-br; llms-full.txt regenerated; agent memory updated with the final API

Release sequencing

The distributed lessons-learned skill's escape-hatch text references <editor> list/<editor> showthis CLI must release before the plugin change ships, and the plugin release should follow promptly (already-installed skills referencing --skip 1 will hit their error-fallback path on the new CLI).

https://claude.ai/code/session_01SGjSjrywTnZDcUqgHWGrTj

rhuanbarreto and others added 2 commits July 2, 2026 05:56
…and docs

The --skip help text on claude-code/cursor/copilot claimed the flag is
"useful when running as a sub-agent" — built on the false premise that
skills/sub-agents create their own project session. Verified on real
data for Claude Code: skills run inline (the current conversation IS
the most recent session file, so --skip 1 reads an unrelated previous
conversation), and Agent-tool sub-agents do not write session files
into ~/.claude/projects/ at all. The plain command (skip 0) is correct
in every agent context.

- Reword the --skip option help on claude-code, cursor, and copilot
- Rewrite the shared ReadSessionOptions.skip JSDoc
- Fix the docs option rows and replace the "read the parent session"
  example with an accurate one (en/nb/pt-br), regenerate llms-full.txt
- Update the session-context agent memory: claude-code/cursor/copilot
  guidance resolved; document the concurrent-conversations caveat

Companion: the distributed lessons-learned skill's canonical source
drops --skip 1 in favor of the plain command.

Claude-Session: https://claude.ai/code/session_01SGjSjrywTnZDcUqgHWGrTj
Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 2, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 19d7e0e
Status: ✅  Deploy successful!
Preview URL: https://59c20c7e.archgate-cli.pages.dev
Branch Preview URL: https://fix-session-context-skip-hel.archgate-cli.pages.dev

View logs

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@rhuanbarreto, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 068ce170-5c67-41f1-8294-7922ee3e0184

📥 Commits

Reviewing files that changed from the base of the PR and between 6850853 and 19d7e0e.

📒 Files selected for processing (11)
  • src/commands/session-context/claude-code.ts
  • src/commands/session-context/copilot.ts
  • src/commands/session-context/cursor.ts
  • src/commands/session-context/opencode.ts
  • src/helpers/session-context.ts
  • tests/commands/session-context/claude-code.test.ts
  • tests/commands/session-context/copilot.test.ts
  • tests/commands/session-context/cursor.test.ts
  • tests/commands/session-context/opencode.test.ts
  • tests/helpers/session-context-copilot.test.ts
  • tests/helpers/session-context-cursor.test.ts
📝 Walkthrough

Walkthrough

This PR restructures the archgate session-context CLI from skip-based session selection to explicit list/show subcommands across Claude Code, Cursor, Copilot, and Opencode editors. Shared helpers (session-context.ts, -copilot.ts, -opencode.ts) add listClaudeCodeSessions, listCursorSessions, listCopilotSessions, and listOpencodeSessions APIs; remove the skip field from ReadSessionOptions; and update session readers to select by explicit sessionId (or default to most recent). CLI commands remove --skip/--session-id options and register nested list and show <session-id> subcommands. Tests verify subcommand registration, session listing output, explicit session reads, and Opencode ancestor resolution via --root. Documentation across English, Norwegian, and Portuguese MDX files and the public LLM reference are updated to describe current-session reads by default and list/show flows for earlier sessions. Agent memory notes record the fix timeline, tool-specific guidance, Bun mock subprocess isolation patterns, and repository privacy boundaries.

Changes

Area Change
Helpers (src/helpers/) Add session listing APIs and sessionId-based selection; remove skip-based indexing
Commands (src/commands/) Add list/show subcommands; remove --skip and --session-id options; introduce makeMaxEntriesOption helper
Tests (tests/) Verify subcommand registration; add integration tests seeding real files/databases; replace skip coverage with sessionId and listing tests
Docs (docs/) Update English/Norwegian/Portuguese MDX and llms-full.txt with list/show structure and examples
Agent memory (.claude/) Record fix timeline, tool-specific guidance, subprocess isolation pattern, and privacy boundaries

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant listFunction
  participant readFunction
  participant sessionFile/DB

  CLI->>listFunction: archgate session-context claude-code list
  listFunction->>sessionFile/DB: enumerate project sessions
  listFunction-->>CLI: JSON {sessions: [{id, updatedAt}, ...]}
  
  CLI->>readFunction: archgate session-context claude-code show SESSION_ID
  readFunction->>sessionFile/DB: query for session SESSION_ID
  readFunction-->>CLI: JSON {transcript, ...}
  
  CLI->>readFunction: archgate session-context opencode show CHILD_ID --root
  readFunction->>sessionFile/DB: resolve parent_id chain to root
  readFunction-->>CLI: JSON {rootId, transcript, ...}
Loading

Estimated code review effort: High

Related issues: None referenced

Related PRs: None referenced

Suggested labels: enhancement, documentation

Suggested reviewers: None specified

Poem:

From skip indices to lists so clear,
Session-context refactored here,
List and show now guide the way,
Opencode roots resolved today,
Docs and tests in harmony,
Four editors unified to be. 🎯

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the breaking session-context redesign and removal of --skip.
Description check ✅ Passed The description matches the session-context redesign, docs updates, and release sequencing notes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Metric Value
Lines 90.0% (7173 / 7971)
Threshold 90% minimum — met
Platforms Linux + Windows

Full HTML report available in workflow artifacts.

Per-directory breakdown
Directory Coverage Lines
src/commands/ 88.5% 1984 / 2243
src/engine/ 90.9% 1463 / 1610
src/formats/ 100.0% 142 / 142
src/helpers/ 90.1% 3584 / 3976

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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 `@docs/public/llms-full.txt`:
- Around line 4356-4359: The bundled docs artifact is out of date; regenerate
the checked-in llms-full bundle from the source docs. Re-run bun run
docs/scripts/generate-llms-full.ts and commit the updated output in
docs/public/llms-full.txt so the generated content stays in sync. Use the
llms-full generator script as the source of truth rather than editing the
bundled file manually.
🪄 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: b9bd9708-929b-40ed-9321-b74507854371

📥 Commits

Reviewing files that changed from the base of the PR and between 29b13f4 and 7b87dbc.

📒 Files selected for processing (10)
  • .claude/agent-memory/archgate-developer/MEMORY.md
  • .claude/agent-memory/archgate-developer/project_session_context_skip_root_fix.md
  • docs/public/llms-full.txt
  • docs/src/content/docs/nb/reference/cli/session-context.mdx
  • docs/src/content/docs/pt-br/reference/cli/session-context.mdx
  • docs/src/content/docs/reference/cli/session-context.mdx
  • src/commands/session-context/claude-code.ts
  • src/commands/session-context/copilot.ts
  • src/commands/session-context/cursor.ts
  • src/helpers/session-context.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Cloudflare Pages
⚠️ CI failures not shown inline (12)

GitHub Actions: DCO / 0_DCO Sign-off Check.txt: fix(session-context): correct false sub-agent premise in --skip help and docs

Conclusion: failure

View job details

##[group]Run base="29b13f49fce76a5f7afdc9d6c5264ebe4e3c120c"
 �[36;1mbase="29b13f49fce76a5f7afdc9d6c5264ebe4e3c120c"�[0m
 �[36;1mhead="7b87dbc5ce9856195bb8a56381f3c3f9977de4c7"�[0m
 �[36;1mfailed=0�[0m
 �[36;1m�[0m
 �[36;1mfor sha in $(git rev-list --no-merges "$base".."$head"); do�[0m
 �[36;1m  if ! git log -1 --format='%B' "$sha" | grep -qiE '^Signed-off-by: .+ <.+>'; then�[0m
 �[36;1m    echo "::error::Commit $sha is missing a DCO Signed-off-by line."�[0m

GitHub Actions: DCO / DCO Sign-off Check: fix(session-context): correct false sub-agent premise in --skip help and docs

Conclusion: failure

View job details

##[group]Run base="29b13f49fce76a5f7afdc9d6c5264ebe4e3c120c"
 �[36;1mbase="29b13f49fce76a5f7afdc9d6c5264ebe4e3c120c"�[0m
 �[36;1mhead="7b87dbc5ce9856195bb8a56381f3c3f9977de4c7"�[0m
 �[36;1mfailed=0�[0m
 �[36;1m�[0m
 �[36;1mfor sha in $(git rev-list --no-merges "$base".."$head"); do�[0m
 �[36;1m  if ! git log -1 --format='%B' "$sha" | grep -qiE '^Signed-off-by: .+ <.+>'; then�[0m
 �[36;1m    echo "::error::Commit $sha is missing a DCO Signed-off-by line."�[0m

GitHub Actions: Validate / Coverage Report: fix(session-context): correct false sub-agent premise in --skip help and docs

Conclusion: failure

View job details

##[group]Run COVERAGE="90.0"
 �[36;1mCOVERAGE="90.0"�[0m
 �[36;1mMIN_COVERAGE=90�[0m
 �[36;1mBELOW=$(awk "BEGIN{print ($COVERAGE < $MIN_COVERAGE) ? 1 : 0}")�[0m
 �[36;1mif [ "$BELOW" = "1" ]; then�[0m
 �[36;1m  echo "::error::Code coverage is ${COVERAGE}%, which is below the minimum threshold of ${MIN_COVERAGE}%."�[0m

GitHub Actions: Validate / 0_Validate Code.txt: fix(session-context): correct false sub-agent premise in --skip help and docs

Conclusion: failure

View job details

##[group]Run # shim-tests is skipped when no shim files changed — treat skipped as success.
 �[36;1m# shim-tests is skipped when no shim files changed — treat skipped as success.�[0m
 �[36;1mSHIM_OK="skipped"�[0m
 �[36;1mif [[ "$SHIM_OK" == "skipped" ]]; then SHIM_OK="success"; fi�[0m
 �[36;1m�[0m
 �[36;1mif [[ "success" != "success" ]] || \�[0m
 �[36;1m   [[ "$SHIM_OK" != "success" ]] || \�[0m
 �[36;1m   [[ "success" != "success" ]] || \�[0m
 �[36;1m   [[ "success" != "success" ]] || \�[0m
 �[36;1m   [[ "success" != "success" ]]; then�[0m
 �[36;1m  echo "::error::One or more jobs failed:"�[0m

GitHub Actions: Validate / Lint, Test & Check: fix(session-context): correct false sub-agent premise in --skip help and docs

Conclusion: failure

View job details

##[group]Run bun run docs/scripts/generate-llms-full.ts
 �[36;1mbun run docs/scripts/generate-llms-full.ts�[0m
 �[36;1mgit diff --exit-code docs/public/llms-full.txt || {�[0m
 �[36;1m  echo "::error::docs/public/llms-full.txt is out of date. Run 'bun run docs/scripts/generate-llms-full.ts' and commit the result."�[0m

GitHub Actions: Validate / Smoke Test (Linux) _ Linux: fix(session-context): correct false sub-agent premise in --skip help and docs

Conclusion: failure

View job details

##[group]Run if [ -z "$ARCHGATE_VERSION" ]; then
 �[36;1mif [ -z "$ARCHGATE_VERSION" ]; then�[0m
 �[36;1m  # Find the newest release that already has the Linux asset uploaded.�[0m
 �[36;1m  # On release-commit pushes the Validate and Release workflows start�[0m
 �[36;1m  # concurrently, so the latest tag may exist before its binaries are�[0m
 �[36;1m  # uploaded by release-binaries.yml — hitting a 404.�[0m
 �[36;1m  asset="archgate-linux-x64.tar.gz"�[0m
 �[36;1m  tags="$(gh release list --limit 5 --json tagName --jq '.[].tagName' 2>/dev/null || true)"�[0m
 �[36;1m  if [ -z "$tags" ]; then�[0m
 �[36;1m    echo "::warning::No releases found, skipping install.sh smoke test"�[0m
 �[36;1m    exit 0�[0m
 �[36;1m  fi�[0m
 �[36;1m  found=""�[0m
 �[36;1m  for tag in $tags; do�[0m
 �[36;1m    assets="$(gh release view "$tag" --json assets --jq '.assets[].name' 2>/dev/null || true)"�[0m
 �[36;1m    if echo "$assets" | grep -qF "$asset"; then�[0m
 �[36;1m      ARCHGATE_VERSION="$tag"�[0m
 �[36;1m      found=1�[0m
 �[36;1m      break�[0m
 �[36;1m    fi�[0m
 �[36;1m  done�[0m
 �[36;1m  if [ -z "$found" ]; then�[0m
 �[36;1m    echo "::warning::No release with $asset found, skipping install.sh smoke test"�[0m
 �[36;1m    exit 0�[0m
 �[36;1m  fi�[0m
 �[36;1m  export ARCHGATE_VERSION�[0m
 �[36;1mfi�[0m
 �[36;1mecho "Testing install.sh with version $ARCHGATE_VERSION"�[0m
 �[36;1m�[0m
 �[36;1mexport ARCHGATE_INSTALL_DIR="$(mktemp -d)"�[0m
 �[36;1m�[0m
 �[36;1msh install.sh�[0m
 �[36;1m�[0m
 �[36;1mif [ ! -f "$ARCHGATE_INSTALL_DIR/archgate" ]; then�[0m
 �[36;1m  echo "::error::archgate binary not found at $ARCHGATE_INSTALL_DIR/archgate after install"�[0m

GitHub Actions: Validate / Validate Code: fix(session-context): correct false sub-agent premise in --skip help and docs

Conclusion: failure

View job details

##[group]Run # shim-tests is skipped when no shim files changed — treat skipped as success.
 �[36;1m# shim-tests is skipped when no shim files changed — treat skipped as success.�[0m
 �[36;1mSHIM_OK="skipped"�[0m
 �[36;1mif [[ "$SHIM_OK" == "skipped" ]]; then SHIM_OK="success"; fi�[0m
 �[36;1m�[0m
 �[36;1mif [[ "success" != "success" ]] || \�[0m
 �[36;1m   [[ "$SHIM_OK" != "success" ]] || \�[0m
 �[36;1m   [[ "success" != "success" ]] || \�[0m
 �[36;1m   [[ "success" != "success" ]] || \�[0m
 �[36;1m   [[ "success" != "success" ]]; then�[0m
 �[36;1m  echo "::error::One or more jobs failed:"�[0m

GitHub Actions: Validate / 1_Coverage Report.txt: fix(session-context): correct false sub-agent premise in --skip help and docs

Conclusion: failure

View job details

##[group]Run COVERAGE="90.0"
 �[36;1mCOVERAGE="90.0"�[0m
 �[36;1mMIN_COVERAGE=90�[0m
 �[36;1mBELOW=$(awk "BEGIN{print ($COVERAGE < $MIN_COVERAGE) ? 1 : 0}")�[0m
 �[36;1mif [ "$BELOW" = "1" ]; then�[0m
 �[36;1m  echo "::error::Code coverage is ${COVERAGE}%, which is below the minimum threshold of ${MIN_COVERAGE}%."�[0m

GitHub Actions: Validate / 4_Lint, Test & Check.txt: fix(session-context): correct false sub-agent premise in --skip help and docs

Conclusion: failure

View job details

##[group]Run bun run docs/scripts/generate-llms-full.ts
 �[36;1mbun run docs/scripts/generate-llms-full.ts�[0m
 �[36;1mgit diff --exit-code docs/public/llms-full.txt || {�[0m
 �[36;1m  echo "::error::docs/public/llms-full.txt is out of date. Run 'bun run docs/scripts/generate-llms-full.ts' and commit the result."�[0m

GitHub Actions: Validate / 5_Smoke Test (Linux) _ Linux.txt: fix(session-context): correct false sub-agent premise in --skip help and docs

Conclusion: failure

View job details

##[group]Run if [ -z "$ARCHGATE_VERSION" ]; then
 �[36;1mif [ -z "$ARCHGATE_VERSION" ]; then�[0m
 �[36;1m  # Find the newest release that already has the Linux asset uploaded.�[0m
 �[36;1m  # On release-commit pushes the Validate and Release workflows start�[0m
 �[36;1m  # concurrently, so the latest tag may exist before its binaries are�[0m
 �[36;1m  # uploaded by release-binaries.yml — hitting a 404.�[0m
 �[36;1m  asset="archgate-linux-x64.tar.gz"�[0m
 �[36;1m  tags="$(gh release list --limit 5 --json tagName --jq '.[].tagName' 2>/dev/null || true)"�[0m
 �[36;1m  if [ -z "$tags" ]; then�[0m
 �[36;1m    echo "::warning::No releases found, skipping install.sh smoke test"�[0m
 �[36;1m    exit 0�[0m
 �[36;1m  fi�[0m
 �[36;1m  found=""�[0m
 �[36;1m  for tag in $tags; do�[0m
 �[36;1m    assets="$(gh release view "$tag" --json assets --jq '.assets[].name' 2>/dev/null || true)"�[0m
 �[36;1m    if echo "$assets" | grep -qF "$asset"; then�[0m
 �[36;1m      ARCHGATE_VERSION="$tag"�[0m
 �[36;1m      found=1�[0m
 �[36;1m      break�[0m
 �[36;1m    fi�[0m
 �[36;1m  done�[0m
 �[36;1m  if [ -z "$found" ]; then�[0m
 �[36;1m    echo "::warning::No release with $asset found, skipping install.sh smoke test"�[0m
 �[36;1m    exit 0�[0m
 �[36;1m  fi�[0m
 �[36;1m  export ARCHGATE_VERSION�[0m
 �[36;1mfi�[0m
 �[36;1mecho "Testing install.sh with version $ARCHGATE_VERSION"�[0m
 �[36;1m�[0m
 �[36;1mexport ARCHGATE_INSTALL_DIR="$(mktemp -d)"�[0m
 �[36;1m�[0m
 �[36;1msh install.sh�[0m
 �[36;1m�[0m
 �[36;1mif [ ! -f "$ARCHGATE_INSTALL_DIR/archgate" ]; then�[0m
 �[36;1m  echo "::error::archgate binary not found at $ARCHGATE_INSTALL_DIR/archgate after install"�[0m

GitHub Actions: Code Quality: PR #446 / Analyze (go): Code Quality: PR #446

Conclusion: failure

View job details

,"bundleSupportsIncludeLogs":true,"bundleSupportsOverlay":true,"databaseInterpretResultsSupportsSarifRunProperty":true,"featuresInVersionResult":true,"indirectTracingSupportsStaticBinaries":false,"informsAboutUnsupportedPathFilters":true,"supportsPython312":true,"mrvaPackCreate":true,"threatModelOption":true,"traceCommandUseBuildMode":true,"v2ramSizing":true,"mrvaPackCreateMultipleQueries":true,"setsCodeqlRunnerEnvVar":true,"sarifMergeRunsFromEqualCategory":true,"forceOverwrite":true,"generateSummarySymbolMap":true,"pythonDefaultIsToNotExtractStdlib":true,"queryServerRunQueries":true,"queryServerTrimCacheWithMode":true,"builtinExtractorsSpecifyDefaultQueries":true,"bqrsDiffResultSets":true,"bundleSupportsIncludeOption":true,"suppressesMissingFileBaselineWarning":true}}}
   CODEQL_ACTION_GO_BINARY: /home/runner/work/_temp/codeql-action-go-tracing/bin/go
   CODEQL_RAM: 14575
   CODEQL_THREADS: 4
   CODEQL_PROXY_HOST:
   CODEQL_PROXY_PORT:
   CODEQL_PROXY_CA_CERTIFICATE:
   CODEQL_PROXY_URLS:
 ##[endgroup]
 ##[group]Attempting to automatically build go code
 [command]/opt/hostedtoolcache/CodeQL/2.25.6/x64/codeql/codeql database trace-command --use-build-mode --working-dir /home/runner/work/cli/cli /home/runner/work/_temp/codeql_databases/go
 Picked up JAVA_TOOL_OPTIONS:  -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
 Running command in /home/runner/work/cli/cli: [/opt/hostedtoolcache/CodeQL/2.25.6/x64/codeql/go/tools/autobuild.sh]
 [] [build-stderr] 2026/07/02 08:57:38 Autobuilder was built with go1.26.0, environment has go1.24.13
 [] [build-stderr] 2026/07/02 08:57:38 LGTM_SRC is /home/runner/work/cli/cli
 [] [build-stderr] 2026/07/02 08:57:38 Found no go.work files in the workspace; looking for go.mod files...
 [] [build-stderr] 2026/07/02 08:57:38 Found 1 go.mod files in: shims/go/go.mod.
 [] [build-stderr] 2026/07/02 08:57:38 Found 1 go.mod file(s).
 [] [build-stderr] 2026/07/02 08:57:38 Import path is 'github.com/archgate/cli'
 [] [build-stderr] 2026/07/...

GitHub Actions: Code Quality: PR #446 / 2_Analyze (go).txt: Code Quality: PR #446

Conclusion: failure

View job details

47 Extracting types for package crypto/aes.
 [] [build-stderr] 2026/07/02 08:57:47 Done extracting types for package crypto/aes.
 [] [build-stderr] 2026/07/02 08:57:47 Processing package crypto/des.
 [] [build-stderr] 2026/07/02 08:57:47 Extracting types for package crypto/des.
 [] [build-stderr] 2026/07/02 08:57:47 Done extracting types for package crypto/des.
 [] [build-stderr] 2026/07/02 08:57:47 Processing package crypto/internal/fips140/nistec/fiat.
 [] [build-stderr] 2026/07/02 08:57:47 Extracting types for package crypto/internal/fips140/nistec/fiat.
 [] [build-stderr] 2026/07/02 08:57:47 Done extracting types for package crypto/internal/fips140/nistec/fiat.
 [] [build-stderr] 2026/07/02 08:57:47 Processing package crypto/internal/fips140/nistec.
 [] [build-stderr] 2026/07/02 08:57:47 Extracting types for package crypto/internal/fips140/nistec.
 [] [build-stderr] 2026/07/02 08:57:47 Done extracting types for package crypto/internal/fips140/nistec.
 [] [build-stderr] 2026/07/02 08:57:47 Processing package crypto/internal/fips140/ecdh.
 [] [build-stderr] 2026/07/02 08:57:47 Extracting types for package crypto/internal/fips140/ecdh.
 [] [build-stderr] 2026/07/02 08:57:47 Done extracting types for package crypto/internal/fips140/ecdh.
 [] [build-stderr] 2026/07/02 08:57:47 Processing package crypto/internal/fips140/edwards25519/field.
 [] [build-stderr] 2026/07/02 08:57:47 Extracting types for package crypto/internal/fips140/edwards25519/field.
 [] [build-stderr] 2026/07/02 08:57:47 Done extracting types for package crypto/internal/fips140/edwards25519/field.
 [] [build-stderr] 2026/07/02 08:57:47 Processing package crypto/ecdh.
 [] [build-stderr] 2026/07/02 08:57:47 Extracting types for package crypto/ecdh.
 [] [build-stderr] 2026/07/02 08:57:47 Done extracting types for package crypto/ecdh.
 [] [build-stderr] 2026/07/02 08:57:47 Processing package crypto/elliptic.
 [] [build-stderr] 2026/07/02 08:57:47 Extracting types for package crypto/elliptic.
 [] [build...
🧰 Additional context used
📓 Path-based instructions (19)
src/commands/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

src/commands/**/*.ts: Commands must export register*Command(program) function that handles I/O only, with no business logic
Use styleText() from node:util for output formatting; support --json flag for machine-readable output and auto-compact JSON in non-TTY/non-CI contexts
Exit with code 0 for success, 1 for violations, 2 for internal errors, and 130 for user cancellation (SIGINT)

src/commands/**/*.ts: Each command module under src/commands/ must export a register*Command(program) function, with one command per file (or one command group via index.ts).
Command files must be thin: they should only parse arguments, call engine/helpers, and format output; business logic must live in src/engine/, src/helpers/, or src/formats/.
Command modules must not use executableDir() 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 an index.ts that composes child commands (for example, src/commands/adr/index.ts).

src/commands/**/*.ts: In command files under src/commands/**/*.ts, options that need type narrowing beyond plain strings MUST use new Option() with .addOption() instead of plain .option().
In src/commands/**/*.ts, import Option from @commander-js/extra-typings alongside Command so typed options get full type inference.
In src/commands/**/*.ts, enum-like options with a fixed set of allowed values must use .choices() on an Option to provide runtime validation and compile-time type narrowing.
In src/commands/**/*.ts, options that require type conversion must use .argParser() on an Option object, not a parser function passed as the third argument to .option().
In src/commands/**/*.ts, register typed options with .addOption() rather than .option().
In src/commands/**/*.ts, pass both the choices array and default values with as const when using .choices() and .default() to pr...

Files:

  • src/commands/session-context/copilot.ts
  • src/commands/session-context/claude-code.ts
  • src/commands/session-context/cursor.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Use TypeScript strict mode, ESNext target, and ES modules throughout
Use safeParse() when validating with Zod schemas
Use minimal dependencies; prefer Bun built-ins per ARCH-006

Files:

  • src/commands/session-context/copilot.ts
  • src/helpers/session-context.ts
  • src/commands/session-context/claude-code.ts
  • src/commands/session-context/cursor.ts
**/*.{ts,tsx,json}

📄 CodeRabbit inference engine (CLAUDE.md)

Runtime must use Bun (>=1.2.21), not Node.js compatible

Files:

  • src/commands/session-context/copilot.ts
  • src/helpers/session-context.ts
  • src/commands/session-context/claude-code.ts
  • src/commands/session-context/cursor.ts
src/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

AI features must be delivered as a Claude Code plugin (../plugins/claude-code), not via direct API calls

src/**/*.ts: Use logError() from src/helpers/log.ts for user-facing errors instead of printing errors directly.
Exit with code 1 for expected failures such as missing config, invalid input, or validation violations.
Let unexpected errors crash naturally so they are treated as internal errors with exit code 2.
Include actionable suggestions in user-facing error messages whenever possible.
Write user-facing errors to stderr via logError(); do not send them to stdout.
When findProjectRoot() returns null for commands that do not require .archgate/, fall back to process.cwd() as the path key or working directory.
Catch ExitPromptError from Inquirer in the top-level error boundary and treat it as user cancellation: exit with code 130 without logging an error or sending it to Sentry.
Do not use console.error() directly; use logError() for consistent formatting.
Do not exit with codes other than 0, 1, 2, or 130.
Do not send user-cancellation errors such as Inquirer ExitPromptError to Sentry; filter them in beforeSend.

src/**/*.ts: Use styleText(format, text) from node:util for all terminal colors and formatting in CLI source files; do not use raw ANSI escape codes or third-party color libraries.
Commands that produce structured results and support --json must emit machine-readable JSON to stdout with no colors or decorative formatting.
When a command supports --json, use formatJSON() from src/helpers/output.ts for JSON serialization, and pass forcePretty: true when the user explicitly provided --json.
Use isAgentContext() from src/helpers/output.ts to enable auto-JSON behavior for commands that support both human-readable and JSON output modes.
CLI output must not include emoji; use text symbols and colors instead.
Send normal command output to stdout with console.log(), and send errors, warnings, and de...

Files:

  • src/commands/session-context/copilot.ts
  • src/helpers/session-context.ts
  • src/commands/session-context/claude-code.ts
  • src/commands/session-context/cursor.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, use Bun.file() instead of fs.readFile() for simple reads.
Prefer node: built-in modules such as node:util, node:path, and node:fs over npm alternatives.
Do not use utility libraries for single functions, such as importing lodash for one helper like pick.
Do not use path aliases (tsconfig paths); use relative imports with Bun's native module resolution.
Do not install packages globally during development; use bunx for one-off tools.

Files:

  • src/commands/session-context/copilot.ts
  • src/helpers/session-context.ts
  • src/commands/session-context/claude-code.ts
  • src/commands/session-context/cursor.ts
src/**/!(*platform).ts

📄 CodeRabbit inference engine (.archgate/adrs/ARCH-009-platform-detection-helper.md)

src/**/!(*platform).ts: In src/ TypeScript source files, do not read process.platform directly; use src/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 in src/ TypeScript source.
When behavior differs between Linux and Windows, account for WSL by using isWSL() rather than assuming `

Files:

  • src/commands/session-context/copilot.ts
  • src/helpers/session-context.ts
  • src/commands/session-context/claude-code.ts
  • src/commands/session-context/cursor.ts
{src,tests}/**/*.ts

📄 CodeRabbit inference engine (.archgate/adrs/LEGAL-001-spdx-license-headers.md)

{src,tests}/**/*.ts: Every TypeScript source file in src/ and tests/ must begin with // SPDX-License-Identifier: Apache-2.0 followed by // Copyright 2026 Archgate.
If a TypeScript file has a shebang line (for example #!/usr/bin/env bun in src/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/session-context/copilot.ts
  • src/helpers/session-context.ts
  • src/commands/session-context/claude-code.ts
  • src/commands/session-context/cursor.ts
**

⚙️ CodeRabbit configuration file

**: # CLAUDE.md

Archgate is a CLI tool for AI governance via Architecture Decision Records (ADRs) — combining human-readable docs with machine-checkable rules. The CLI dogfoods itself via ADRs in .archgate/adrs/. AI features are delivered as a Claude Code plugin (../plugins/claude-code), not via direct API calls.

Technology Stack

  • Runtime: Bun (>=1.2.21) — not Node.js compatible
  • Language: TypeScript (strict mode, ESNext, ES modules)
  • CLI framework: Commander.js (@commander-js/extra-typings)
  • Linter: Oxlint | Formatter: Oxfmt | Dead exports: Knip | Commits: Conventional Commits

Commands

bun run src/cli.ts <command>  # run CLI locally
bun run lint                  # oxlint
bun run typecheck             # tsc --build
bun run format                # oxfmt --write
bun run format:check          # oxfmt --check
bun run test                  # all tests (not bare `bun test` — picks up --timeout; see GEN-003)
bun run knip                  # dead export detection
bun run validate              # MANDATORY: lint + typecheck + format + test + ADR check + knip + build check
bun run build:check            # verify build compiles (CI builds binaries via release workflow)
bun run commit                # conventional commit wizard

Validation Gate

bun run validate must pass before any task is considered complete. Fail-fast pipeline: lint → typecheck → format → test → ADR check → knip → build check. Mirrors CI in .github/workflows/code-pull-request.yml.

Git Hooks (Git 2.54+)

Config-based hooks in .githooks run validation locally before commits and pushes:

  • pre-commit: lint + typecheck + format:check (~15s)
  • pre-push: full bun run validate (~60s, mirrors CI)

Activate once per clone:

git config --local include.path ../.githooks

Opt out of a specific hook: git config --local hook.<name>.enabled false. Skip all hooks for a single commit: git commit --no-verify.

GitHub Act...

Files:

  • src/commands/session-context/copilot.ts
  • src/helpers/session-context.ts
  • src/commands/session-context/claude-code.ts
  • src/commands/session-context/cursor.ts
  • docs/src/content/docs/reference/cli/session-context.mdx
  • docs/src/content/docs/nb/reference/cli/session-context.mdx
  • docs/src/content/docs/pt-br/reference/cli/session-context.mdx
  • docs/public/llms-full.txt

⚙️ 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.ts file with automated checks that run via archgate check.

When reviewing, you must:

  1. Treat ADR violations as blocking issues, not suggestions.
  2. Cite the specific ADR ID when flagging a violation (e.g., "Violates ARCH-006").
  3. Focus on semantic and contextual violations that automated rules cannot catch —
    the .rules.ts files already cover syntactic/structural patterns.
  4. If you are unsure whether something violates an ADR, flag it as a question
    rather than approving it.

Files:

  • src/commands/session-context/copilot.ts
  • src/helpers/session-context.ts
  • src/commands/session-context/claude-code.ts
  • src/commands/session-context/cursor.ts
  • docs/src/content/docs/reference/cli/session-context.mdx
  • docs/src/content/docs/nb/reference/cli/session-context.mdx
  • docs/src/content/docs/pt-br/reference/cli/session-context.mdx
  • docs/public/llms-full.txt
src/{helpers,engine}/**/*.ts

📄 CodeRabbit inference engine (.archgate/adrs/ARCH-002-error-handling.md)

Do not use console.log(), console.warn(), or console.info() directly in helper or engine files; use logInfo() or logWarn() instead. Command files are exempt because they are the I/O layer.

Files:

  • src/helpers/session-context.ts
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.mdx page in that directory must correspond to exactly one top-level command.

Files:

  • docs/src/content/docs/reference/cli/session-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 .mdx page.

Every parent CLI reference page in docs/src/content/docs/reference/cli/ must contain headings for its direct subcommands using the exact archgate <parent> <sub> format, and must not keep headings for subcommands that no longer exist.

Files:

  • docs/src/content/docs/reference/cli/session-context.mdx
{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; renaming src/commands/<name>.ts or src/commands/<name>/index.ts must be paired with renaming docs/src/content/docs/reference/cli/<name>.mdx.

Files:

  • docs/src/content/docs/reference/cli/session-context.mdx
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 under docs/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/reference/cli/session-context.mdx
  • docs/src/content/docs/nb/reference/cli/session-context.mdx
  • docs/src/content/docs/pt-br/reference/cli/session-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>.mdx and add the page to docs/astro.config.mjs sidebar configuration.

Files:

  • docs/src/content/docs/reference/cli/session-context.mdx
  • docs/src/content/docs/nb/reference/cli/session-context.mdx
  • docs/src/content/docs/pt-br/reference/cli/session-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/session-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/reference/cli/session-context.mdx
  • docs/src/content/docs/nb/reference/cli/session-context.mdx
  • docs/src/content/docs/pt-br/reference/cli/session-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 under docs/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, and link/href/slug attribute 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/reference/cli/session-context.mdx
  • docs/src/content/docs/nb/reference/cli/session-context.mdx
  • docs/src/content/docs/pt-br/reference/cli/session-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 du form and correct Norwegian characters (æ, ø, å).

Files:

  • docs/src/content/docs/nb/reference/cli/session-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/session-context.mdx
🧠 Learnings (1)
📚 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/MEMORY.md
  • .claude/agent-memory/archgate-developer/project_session_context_skip_root_fix.md
🪛 GitHub Actions: Validate / 4_Lint, Test & Check.txt
docs/public/llms-full.txt

[error] 1-1: CI check failed: docs/public/llms-full.txt is out of date. Run 'bun run docs/scripts/generate-llms-full.ts' and commit the result.

🪛 GitHub Actions: Validate / Lint, Test & Check
docs/public/llms-full.txt

[error] 1-1: docs/public/llms-full.txt is out of date. Run 'bun run docs/scripts/generate-llms-full.ts' and commit the result.

🪛 LanguageTool
docs/src/content/docs/pt-br/reference/cli/session-context.mdx

[style] ~24-~24: Evite abreviações de internet. Considere escrever “não” por extenso. Se quis dizer “n”, coloque entre aspas.
Context: ...----------------------------------- | | --max-entries <n> | Máximo de entradas a retornar (padr...

(INTERNET_ABBREVIATIONS)


[style] ~25-~25: Evite abreviações de internet. Considere escrever “não” por extenso. Se quis dizer “n”, coloque entre aspas.
Context: ...r (padrão: 200) | | --skip <n> | Pular as N sessões mais rece...

(INTERNET_ABBREVIATIONS)


[style] ~37-~37: Evite abreviações de internet. Considere escrever “não” por extenso. Se quis dizer “n”, coloque entre aspas.
Context: ...----------------------------------- | | --max-entries <n> | Máximo de entradas a retornar (padr...

(INTERNET_ABBREVIATIONS)


[style] ~38-~38: Evite abreviações de internet. Considere escrever “não” por extenso. Se quis dizer “n”, coloque entre aspas.
Context: ...r (padrão: 200) | | --skip <n> | Pular as N sessões mais rece...

(INTERNET_ABBREVIATIONS)


[style] ~51-~51: Evite abreviações de internet. Considere escrever “não” por extenso. Se quis dizer “n”, coloque entre aspas.
Context: ...----------------------------------- | | --max-entries <n> | Máximo de entradas a retornar (padr...

(INTERNET_ABBREVIATIONS)


[style] ~52-~52: Evite abreviações de internet. Considere escrever “não” por extenso. Se quis dizer “n”, coloque entre aspas.
Context: ...r (padrão: 200) | | --skip <n> | Pular as N sessões mais rece...

(INTERNET_ABBREVIATIONS)

🔇 Additional comments (9)
src/helpers/session-context.ts (1)

114-121: LGTM!

src/commands/session-context/claude-code.ts (1)

19-19: LGTM!

docs/src/content/docs/nb/reference/cli/session-context.mdx (1)

22-25: LGTM!

Also applies to: 35-39, 49-53, 98-98

docs/src/content/docs/pt-br/reference/cli/session-context.mdx (1)

22-25: LGTM!

Also applies to: 35-39, 49-53, 98-98

.claude/agent-memory/archgate-developer/MEMORY.md (1)

47-47: LGTM!

src/commands/session-context/copilot.ts (1)

17-22: LGTM!

src/commands/session-context/cursor.ts (1)

17-22: LGTM!

docs/src/content/docs/reference/cli/session-context.mdx (1)

22-25: LGTM!

Also applies to: 35-39, 49-53, 98-98

.claude/agent-memory/archgate-developer/project_session_context_skip_root_fix.md (1)

2-3: LGTM!

Also applies to: 14-16

Comment thread docs/public/llms-full.txt Outdated
…erywhere

The session-context command's purpose is reading the current
conversation's context; --skip existed solely for the false "skip the
sub-agent's own session" premise removed in the previous commit, and
recency arithmetic can never reliably address a specific earlier
conversation anyway. Replace positional guessing with explicit
selection:

- Remove --skip from claude-code, cursor, copilot, and opencode
- Add --session-id to claude-code (previously the only subcommand
  without one; ids are the JSONL file basenames)
- Add --list to all four subcommands: prints the project's sessions
  as JSON (id + updatedAt; opencode also includes title and lists
  top-level sessions only). --list conflicts with --session-id.
- opencode: reader is called without await (it is synchronous)
- Docs (en/nb/pt-br) tables and examples updated; llms-full.txt
  regenerated; agent memory updated with the final API decision

BREAKING CHANGE: `archgate session-context <editor> --skip <n>` is no
longer accepted. Use plain invocation for the current conversation,
`--list` to discover earlier sessions, and `--session-id <id>` to read
one.

Claude-Session: https://claude.ai/code/session_01SGjSjrywTnZDcUqgHWGrTj
Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@rhuanbarreto rhuanbarreto changed the title fix(session-context): correct false sub-agent premise in --skip help and docs feat(session-context)!: remove --skip; add --session-id and --list; fix false sub-agent premise Jul 2, 2026
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 2, 2026
rhuanbarreto and others added 2 commits July 2, 2026 07:39
…ow subcommands

Listing and reading-a-specific-session are distinct operations from
reading the current conversation — give each its own verb instead of
mode flags on every editor subcommand:

- `session-context list [--editor <e>]` — sessions as JSON; without
  --editor aggregates all four editors (absent stores fold their error
  into the aggregate instead of failing the command)
- `session-context show <session-id> --editor <e> [--max-entries]
  [--root]` — read a specific session; positional id mirrors
  `adr show <id>`; --editor is required (UUIDs can collide across
  editor stores); --root is opencode-only, validated
- Editor subcommands are now pure current-conversation readers with
  only --max-entries: --list and --session-id removed, and opencode's
  read loses --root (it was a no-op alias without a session id; its
  real semantics live in show)

Tests: list/show behavior tests run the real CLI as a subprocess with
HOME/USERPROFILE/XDG_DATA_HOME redirected — Bun's mock.module state is
process-global across test files, and the sibling command tests' helper
mocks leak into same-process imports (list.ts also no longer captures
helper references in a module-level map, so live bindings are honored).

Docs rewritten in en/nb/pt-br with the new subcommand sections
(ARCH-016 headings) and examples; llms-full.txt regenerated; agent
memory updated with the final API.

BREAKING CHANGE: `--list` and `--session-id` are no longer accepted on
the editor subcommands (both introduced earlier on this unreleased
branch; `--session-id` previously shipped on copilot/cursor/opencode),
and `--root` moved from `opencode` to `show`. Use
`session-context list` and `session-context show <id> --editor <e>`.

Claude-Session: https://claude.ai/code/session_01SGjSjrywTnZDcUqgHWGrTj
Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@rhuanbarreto rhuanbarreto changed the title feat(session-context)!: remove --skip; add --session-id and --list; fix false sub-agent premise feat(session-context)!: verb-based API — current-conversation reads, list, and show Jul 2, 2026
Per review: the editor is already in the command path, so a top-level
--editor flag was redundant. Each editor subcommand is now a command
group:

- `session-context <editor>` — read the current conversation (default
  action; --max-entries only)
- `session-context <editor> list` — list that editor's sessions for
  the project (top-level only for opencode)
- `session-context <editor> show <session-id> [--max-entries]` — read
  a specific session; `--root` exists only on `opencode show`

The standalone `session-context list`/`show` subcommands (added
earlier on this unreleased branch) are removed, along with the
cross-editor aggregate and the --editor flag. Sub-subcommands are
documented as #### blocks inside each editor's docs section (same
pattern as `adr domain`), matching ARCH-016's one-level rule scope.

BREAKING CHANGE: `session-context list --editor <e>` and
`session-context show <id> --editor <e>` (both unreleased) are
replaced by `session-context <editor> list` and
`session-context <editor> show <session-id>`.

Claude-Session: https://claude.ai/code/session_01SGjSjrywTnZDcUqgHWGrTj
Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@rhuanbarreto rhuanbarreto changed the title feat(session-context)!: verb-based API — current-conversation reads, list, and show feat(session-context)!: per-editor list/show subcommands; remove --skip and its false premise Jul 2, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 13

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (6)
src/commands/session-context/copilot.ts (1)

21-90: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicated error-handling/output boilerplate across base, list, and show actions.

The try/catch → result.ok check → logError/exitWith(1)formatJSON pattern is repeated identically three times. Consider extracting a small helper (e.g. runSessionAction(fn)) to reduce duplication and keep future changes (e.g., error formatting tweaks) in one place.

♻️ Proposed refactor sketch
async function emitResult(
  result: { ok: true; data: unknown } | { ok: false; error: string }
) {
  if (!result.ok) {
    logError(result.error);
    await exitWith(1);
    return;
  }
  console.log(formatJSON(result.data));
}

Each action body then reduces to:

-        if (!result.ok) {
-          logError(result.error);
-          await exitWith(1);
-          return;
-        }
-
-        console.log(formatJSON(result.data));
+        await emitResult(result);
🤖 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 `@src/commands/session-context/copilot.ts` around lines 21 - 90, The copilot
session context commands repeat the same try/catch, result.ok check, logging,
exit, and JSON output logic in the base command, list, and show handlers.
Extract that shared flow into a small helper in or near
registerCopilotSessionContextCommand, and have each action call it with the
specific operation (readCopilotSession or listCopilotSessions) so error handling
and output formatting stay centralized and easy to update.
src/helpers/session-context.ts (1)

274-289: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Sort Cursor sessions by transcript mtime, not directory mtime.

Directory mtimes usually change when entries are created/removed, not when the nested JSONL transcript is appended. This can make the default read select an older session and make list report stale updatedAt values. Stat join(transcriptsDir, name, \${name}.jsonl`)` instead.

🤖 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 `@src/helpers/session-context.ts` around lines 274 - 289, The session ordering
in enumerateCursorSessionDirs currently uses the directory mtime, which can be
stale for appended transcript updates. Update the logic to stat the nested
transcript file at join(transcriptsDir, name, `${name}.jsonl`) and use that
mtime for sorting, while keeping the existing directory/file existence handling
and fallback behavior intact.
tests/commands/session-context.test.ts (1)

64-75: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the exact option set.

These tests say "only --max-entries", but they would still pass if a new accidental option were added. Use an exact assertion for the base editor commands.

Proposed fix
-    expect(opts).toContain("--max-entries");
-    expect(opts).not.toContain("--session-id");
-    expect(opts).not.toContain("--list");
-    expect(opts).not.toContain("--skip");
+    expect(opts).toEqual(["--max-entries"]);

Also applies to: 78-89, 92-103, 145-157

🤖 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/commands/session-context.test.ts` around lines 64 - 75, The
session-context command tests are only checking for presence/absence of a few
options, so they would miss accidental extra flags. Update the affected
assertions in registerSessionContextCommand-related tests (including the
claude-code and base editor command cases) to verify the exact option list for
each command rather than using partial contains/not-contains checks. Use the
command objects from Command, parent.commands, and sub.options to compare the
full set of option names against the expected set.
src/helpers/session-context-copilot.ts (1)

71-84: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use events.jsonl for the recency sort.

The current sort key uses the session directory mtime, which does not move when new events are appended. That can leave the active session below an older one; sort by events.jsonl mtime instead.

🤖 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 `@src/helpers/session-context-copilot.ts` around lines 71 - 84, The recency
ordering in session-context-copilot currently sorts by each session directory’s
mtime, which can stay stale when new events arrive. Update the sorting logic in
the session directory scan to use the mtime of each session’s events.jsonl file
instead, adjusting the readdirSync/statSync flow so the newest session is
determined from that file’s timestamp rather than the directory timestamp.

Sources: Coding guidelines, Path instructions

src/commands/session-context/claude-code.ts (1)

21-90: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting the repeated result-handling block.

The if (!result.ok) { logError; exitWith(1); return; } console.log(formatJSON(result.data)); pattern is duplicated across the base command, list, and show actions. A small shared helper would reduce duplication and keep the three actions consistent as they evolve.

async function emitResult(result: { ok: boolean; error?: string; data?: unknown }) {
  if (!result.ok) {
    logError(result.error ?? "Unknown error");
    await exitWith(1);
    return;
  }
  console.log(formatJSON(result.data));
}
🤖 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 `@src/commands/session-context/claude-code.ts` around lines 21 - 90, The
result-handling logic is duplicated in the
`registerClaudeCodeSessionContextCommand` actions for the base `claude-code`,
`list`, and `show` commands. Extract the repeated `if (!result.ok) {
logError(...); await exitWith(1); return; }
console.log(formatJSON(result.data));` pattern into a shared helper near
`registerClaudeCodeSessionContextCommand`, and have each action call it with the
`readClaudeCodeSession` or `listClaudeCodeSessions` result so all three paths
stay consistent.
src/commands/session-context/cursor.ts (1)

21-91: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract shared session-context helpers
makeMaxEntriesOption() and the !result.ok handling are duplicated across claude-code.ts, copilot.ts, cursor.ts, and opencode.ts. Move them into src/commands/session-context/shared.ts so the four commands stay aligned as more editors are added.

🤖 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 `@src/commands/session-context/cursor.ts` around lines 21 - 91, The cursor
session-context command repeats shared option and error-handling logic that
should be centralized with the other editor commands. Move the
`makeMaxEntriesOption()` usage and the `!result.ok` branch pattern from
`registerCursorSessionContextCommand` into
`src/commands/session-context/shared.ts`, then reuse those helpers in
`cursor.ts` alongside `claude-code.ts`, `copilot.ts`, and `opencode.ts` so all
session-context commands stay consistent.
♻️ Duplicate comments (1)
docs/public/llms-full.txt (1)

4343-4494: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Regenerate the bundled llms-full.txt — CI is still failing on it.

The pipeline logs report this file as out of sync with the source docs: docs/public/llms-full.txt is out of date. Run 'bun run docs/scripts/generate-llms-full.ts' and commit the result. This is the same class of issue flagged in a prior review round (reportedly addressed in commits ce4ea47–9e9802d), but the check is failing again for this PR's changes to the session-context docs — meaning the regeneration step wasn't re-run after the list/show subcommand rewrite landed.

Run the generator and commit the output before merge; this blocks the validate/CI gate.

🔧 Fix
bun run docs/scripts/generate-llms-full.ts
git add docs/public/llms-full.txt
🤖 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 `@docs/public/llms-full.txt` around lines 4343 - 4494, The bundled docs file is
stale after the session-context docs rewrite, so regenerate the generated
llms-full output from the source docs and commit the updated result. Use the
docs generator tied to docs/public/llms-full.txt, then verify the changes
include the revised archgate session-context claude-code/copilot/cursor/opencode
sections and their list/show subcommands before merging.

Source: Pipeline failures

🤖 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/commands/session-context/claude-code.ts`:
- Around line 15-19: The max-entries parser in makeMaxEntriesOption currently
turns non-numeric input into NaN, which later bypasses the default in
readClaudeCodeSession and disables trimming. Update the argParser for
"--max-entries <n>" to validate the parsed value and throw an
InvalidArgumentError on invalid input instead of returning NaN, so both the base
command and show fail fast on bad values.

In `@src/commands/session-context/copilot.ts`:
- Around line 15-19: `makeMaxEntriesOption()` is duplicated across the
session-context command files, so extract it into a shared helper and reuse it
everywhere. Move the option factory into a common module such as
`src/helpers/cli-options.ts`, then update `claude-code`, `cursor`, `copilot`,
and `opencode` to import and call the shared `makeMaxEntriesOption()` instead of
defining their own copies. Keep the existing `Option` setup and parser behavior
unchanged while centralizing the logic.
- Around line 15-19: The --max-entries option in makeMaxEntriesOption currently
coerces invalid input to NaN without feedback, so update the argParser to
validate the value before returning it. If the input is not a finite numeric
value or is negative/out of range, throw or surface a user-facing error with an
actionable message instead of passing NaN through to readCopilotSession and
downstream slicing logic. Keep the fix localized to makeMaxEntriesOption and the
session-context copilot command flow so invalid CLI input fails fast with a
clear validation message.

In `@src/commands/session-context/cursor.ts`:
- Around line 15-19: Reject non-numeric values for the max entries option in
makeMaxEntriesOption, since Math.trunc(Number(val)) can produce NaN and bypass
the default. Update the argParser to validate the input and throw
InvalidArgumentError when the provided value cannot be parsed as a number, so
cursor/session-context handling does not continue with an invalid max-entries
value.

In `@src/commands/session-context/opencode.ts`:
- Around line 15-19: The makeMaxEntriesOption() factory is duplicated across
multiple editor command files, so extract the shared option निर्माण into a
common helper module and reuse it from opencode.ts, claude-code.ts, copilot.ts,
and cursor.ts. Move the Option construction and argParser logic into a shared
symbol such as makeMaxEntriesOption in a helper like cli-options.ts, then update
each command to import and use that single implementation.
- Around line 15-19: The --max-entries parser in makeMaxEntriesOption currently
accepts invalid input because Math.trunc(Number(val)) can yield NaN, which then
bypasses truncation logic in readOpencodeSession(). Update the argParser in
makeMaxEntriesOption to validate the value, reject non-numeric or non-positive
inputs by throwing InvalidArgumentError, and only return a valid positive
integer so the session command fails fast on bad arguments.

In `@src/helpers/session-context-opencode.ts`:
- Around line 81-100: Remove the synchronous existsSync pre-check from
listOpencodeSessions and the same pattern in readOpencodeSession, since
Bun.file(dbPath).exists() is async and this helper should not add a Node fs
dependency. Let opencodeDbPath()/normalizePath flow into directly opening the
Database in readonly mode and rely on the existing catch path in
listOpencodeSessions/readOpencodeSession to report missing or unreadable
databases.

In `@src/helpers/session-context.ts`:
- Around line 67-75: `SessionListEntry` is missing the `title` field that
`listOpencodeSessions()` already emits, so update the shared session list
contract in `SessionListEntry` to include it and keep `SessionListResult`
aligned with the runtime payload. Make the change in the shared helper types
where `SessionListEntry` is defined so typed callers can rely on the full list
API shape from `listOpencodeSessions()` and any other list implementations.
- Around line 142-149: The session enumerators in enumerateClaudeSessionFiles
and the other scan helper still rely on node:fs readdirSync/statSync, which
violates ARCH-006. Update both scan paths to use Bun filesystem APIs instead,
keeping the same filtering/sorting behavior and preserving the existing return
shapes so callers of these helpers continue to work unchanged.

In `@tests/commands/session-context/claude-code.test.ts`:
- Around line 32-41: The session-context test is using mock.module() on a
first-party module that is imported unmocked elsewhere, which can leak
process-global mock state across tests. Update the claude-code test setup to use
spyOn against the existing readClaudeCodeSession and listClaudeCodeSessions
exports from session-context instead of mocking the whole module, or otherwise
isolate this as an explicitly accepted exception. Keep the focus on the test
helpers in claude-code.test.ts and the shared session-context module so the mock
behavior remains local to this test file.

In `@tests/commands/session-context/copilot.test.ts`:
- Around line 28-36: Replace the new `mock.module()` override for
`../../../src/helpers/session-context-copilot` with a `spyOn`-based mock so the
first-party module stays directly importable by other tests. Keep the existing
`readCopilotSession` and `listCopilotSessions` behavior in
`tests/commands/session-context/copilot.test.ts`, but apply it through spies
rather than module-level mocking to avoid affecting
`tests/helpers/session-context-copilot.test.ts` and similar files.

In `@tests/commands/session-context/cursor.test.ts`:
- Around line 28-36: Replace the `mock.module()` usage for `session-context`
with a `spyOn`-based mock setup in `cursor.test.ts`, since `readCursorSession`
and `listCursorSessions` come from a shared first-party module that other tests
import directly. Update the test to target the specific exported functions
instead of globally swapping `../../../src/helpers/session-context`, and keep
the mock behavior isolated to the `mockReadCursorSession` and
`mockListCursorSessions` cases used in this file.

In `@tests/helpers/session-context-cursor.test.ts`:
- Around line 207-273: Add a regression test in session-context-cursor.test.ts
to cover the readCursorSession error branch when a requested sessionId does not
exist. Use readCursorSession with an unknown sessionId and assert the result is
not ok, the error mentions the missing id, and the available sessions list is
included. Keep the existing happy-path tests for sessionId and default
selection, but add this negative case near test("sessionId reads an earlier
session; default reads the most recent").

---

Outside diff comments:
In `@src/commands/session-context/claude-code.ts`:
- Around line 21-90: The result-handling logic is duplicated in the
`registerClaudeCodeSessionContextCommand` actions for the base `claude-code`,
`list`, and `show` commands. Extract the repeated `if (!result.ok) {
logError(...); await exitWith(1); return; }
console.log(formatJSON(result.data));` pattern into a shared helper near
`registerClaudeCodeSessionContextCommand`, and have each action call it with the
`readClaudeCodeSession` or `listClaudeCodeSessions` result so all three paths
stay consistent.

In `@src/commands/session-context/copilot.ts`:
- Around line 21-90: The copilot session context commands repeat the same
try/catch, result.ok check, logging, exit, and JSON output logic in the base
command, list, and show handlers. Extract that shared flow into a small helper
in or near registerCopilotSessionContextCommand, and have each action call it
with the specific operation (readCopilotSession or listCopilotSessions) so error
handling and output formatting stay centralized and easy to update.

In `@src/commands/session-context/cursor.ts`:
- Around line 21-91: The cursor session-context command repeats shared option
and error-handling logic that should be centralized with the other editor
commands. Move the `makeMaxEntriesOption()` usage and the `!result.ok` branch
pattern from `registerCursorSessionContextCommand` into
`src/commands/session-context/shared.ts`, then reuse those helpers in
`cursor.ts` alongside `claude-code.ts`, `copilot.ts`, and `opencode.ts` so all
session-context commands stay consistent.

In `@src/helpers/session-context-copilot.ts`:
- Around line 71-84: The recency ordering in session-context-copilot currently
sorts by each session directory’s mtime, which can stay stale when new events
arrive. Update the sorting logic in the session directory scan to use the mtime
of each session’s events.jsonl file instead, adjusting the readdirSync/statSync
flow so the newest session is determined from that file’s timestamp rather than
the directory timestamp.

In `@src/helpers/session-context.ts`:
- Around line 274-289: The session ordering in enumerateCursorSessionDirs
currently uses the directory mtime, which can be stale for appended transcript
updates. Update the logic to stat the nested transcript file at
join(transcriptsDir, name, `${name}.jsonl`) and use that mtime for sorting,
while keeping the existing directory/file existence handling and fallback
behavior intact.

In `@tests/commands/session-context.test.ts`:
- Around line 64-75: The session-context command tests are only checking for
presence/absence of a few options, so they would miss accidental extra flags.
Update the affected assertions in registerSessionContextCommand-related tests
(including the claude-code and base editor command cases) to verify the exact
option list for each command rather than using partial contains/not-contains
checks. Use the command objects from Command, parent.commands, and sub.options
to compare the full set of option names against the expected set.

---

Duplicate comments:
In `@docs/public/llms-full.txt`:
- Around line 4343-4494: The bundled docs file is stale after the
session-context docs rewrite, so regenerate the generated llms-full output from
the source docs and commit the updated result. Use the docs generator tied to
docs/public/llms-full.txt, then verify the changes include the revised archgate
session-context claude-code/copilot/cursor/opencode sections and their list/show
subcommands before merging.
🪄 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: 1277c098-a106-4589-9d33-8a16356ae5df

📥 Commits

Reviewing files that changed from the base of the PR and between 7b87dbc and 6850853.

📒 Files selected for processing (23)
  • .claude/agent-memory/archgate-developer/MEMORY.md
  • .claude/agent-memory/archgate-developer/feedback_public_repo_privacy.md
  • .claude/agent-memory/archgate-developer/project_session_context_skip_root_fix.md
  • docs/public/llms-full.txt
  • docs/src/content/docs/nb/reference/cli/session-context.mdx
  • docs/src/content/docs/pt-br/reference/cli/session-context.mdx
  • docs/src/content/docs/reference/cli/session-context.mdx
  • src/commands/session-context/claude-code.ts
  • src/commands/session-context/copilot.ts
  • src/commands/session-context/cursor.ts
  • src/commands/session-context/opencode.ts
  • src/helpers/session-context-copilot.ts
  • src/helpers/session-context-opencode.ts
  • src/helpers/session-context.ts
  • tests/commands/session-context.test.ts
  • tests/commands/session-context/claude-code.test.ts
  • tests/commands/session-context/copilot.test.ts
  • tests/commands/session-context/cursor.test.ts
  • tests/commands/session-context/opencode.test.ts
  • tests/helpers/session-context-copilot.test.ts
  • tests/helpers/session-context-cursor.test.ts
  • tests/helpers/session-context-opencode.test.ts
  • tests/helpers/session-context.test.ts

Comment thread src/commands/session-context/claude-code.ts Outdated
Comment thread src/commands/session-context/copilot.ts Outdated
Comment thread src/commands/session-context/cursor.ts Outdated
Comment thread src/commands/session-context/opencode.ts Outdated
Comment thread src/helpers/session-context-opencode.ts
Comment thread src/helpers/session-context.ts
Comment thread tests/commands/session-context/claude-code.test.ts Outdated
Comment thread tests/commands/session-context/copilot.test.ts Outdated
Comment thread tests/commands/session-context/cursor.test.ts Outdated
Comment thread tests/helpers/session-context-cursor.test.ts
- --max-entries now validates input: non-numeric or non-positive
  values are rejected with InvalidArgumentError instead of a NaN limit
  silently disabling transcript trimming (CodeRabbit)
- Deduplicate the option factory: exported once from claude-code.ts
  (cross-command sharing convention) and imported by the other three
  editor commands (CodeRabbit)
- SessionListEntry gains optional `title` so the shared list contract
  covers the field opencode actually emits (CodeRabbit)
- Command tests converted from mock.module() to import * + spyOn per
  ARCH-005 — removes the process-global module-mock leakage the
  subprocess tests were working around (CodeRabbit)
- Add sessionId-not-found error-path tests for the cursor and copilot
  helpers (CodeRabbit)

Declined with reasoning on the PR: dropping the sync existsSync
pre-check and replacing readdirSync/statSync enumeration — ARCH-006
prefers Bun APIs only where alternatives exist; Bun.file().exists() is
async (helpers are sync) and Bun has no readdir/stat for directory
enumeration.

Claude-Session: https://claude.ai/code/session_01SGjSjrywTnZDcUqgHWGrTj
Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@rhuanbarreto

Copy link
Copy Markdown
Contributor Author

Review feedback addressed in 9abed1d:

Fixed

  • --max-entries NaN: the shared option factory now rejects non-numeric/non-positive input via InvalidArgumentError (verified: --max-entries abc and --max-entries 0 error; --max-entries 2 trims)
  • Duplicated makeMaxEntriesOption(): single validated factory exported from claude-code.ts (cross-command sharing convention, same as plugin/install.ts), imported by the other three editors
  • SessionListEntry now declares optional title — the shared contract covers what listOpencodeSessions() actually emits
  • mock.module()import * as helpers + spyOn in all four command test files per ARCH-005, with spies created/restored in hooks. This removes the process-global module-mock leakage entirely (the subprocess-based list/show tests remain as end-to-end coverage)
  • Added sessionId-not-found error-path tests for the cursor and copilot helpers (claude-code and opencode already had them)
  • llms-full.txt: regenerated locally with zero diff — already in sync (the auto-update workflow had pushed the regeneration)

Declined (with reasoning)

  • Drop the existsSync pre-check (ARCH-006): Bun.file().exists() is async and these helpers are intentionally synchronous (bun:sqlite is sync), so no Bun alternative exists — ARCH-006 only forbids Node APIs "when Bun alternatives exist" and explicitly prefers node: builtins otherwise. The pre-check also produces the actionable "No opencode database found" error instead of a generic open failure, and the pattern predates this PR.
  • Replace readdirSync/statSync enumeration (ARCH-006): Bun has no readdir/stat API; cursor and copilot enumerate directories (with mtimes), which Bun.Glob cannot cover, and converting only the claude-code file scan would fragment three otherwise-identical enumerators. Same ARCH-006 carve-out applies; code is pre-existing, relocated into shared enumerate functions by this PR. Happy to revisit if Bun grows a stat/readdir API.

bun run validate green (1351 tests, 39/39 ADR checks).

The subprocess-based list/show tests exercise the real wiring but the
child process is not instrumented, so the eight new child actions were
invisible to coverage (CI dropped to 88.5%). Add in-process tests for
every editor's list/show actions using the spyOn pattern (happy path +
error path; opencode also covers --root pass-through). Local coverage
back above threshold.

Claude-Session: https://claude.ai/code/session_01SGjSjrywTnZDcUqgHWGrTj
Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Claude-Session: https://claude.ai/code/session_01SGjSjrywTnZDcUqgHWGrTj
Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@rhuanbarreto rhuanbarreto merged commit dd96230 into main Jul 2, 2026
21 checks passed
@rhuanbarreto rhuanbarreto deleted the fix/session-context-skip-help-text branch July 2, 2026 16:05
@archgatebot archgatebot Bot mentioned this pull request Jul 2, 2026
rhuanbarreto added a commit that referenced this pull request Jul 2, 2026
## Problem

The session-context breaking changes (#446) made simple-release propose
**v1.0.0** (release PR #440). We are not ready to publish 1.0.0 — the
project still ships no support guarantees. Pre-1.0, breaking changes
should produce a **minor** bump (0.46.0).

## Fix

Override `getNextVersion` in `.simple-release.js`: when the current
version is `0.x` and the conventional-commit computation yields a major
bump, return the next minor instead. `bump()` derives its version from
`getNextVersion`, so the manifest writes, changelog, release-PR title,
and tag all stay consistent from the single cap.

Explicit `version`/`as` bump options bypass the cap, so v1.0.0 remains
available as a deliberate, forced decision.

## Verification

Dry-run against the live git history (which contains the `feat!`
commits):

| | computed next version |
|---|---|
| stock `NpmProject` | `1.0.0` |
| capped `ArchgateProject` | `0.46.0` |

Lint, typecheck, format, and `archgate check` (39/39) green.

## After merge

The push to `main` re-triggers the release `pull-request` workflow,
which updates release PR #440 in place from 1.0.0 to 0.46.0 (title,
changelog, version files, shim versions). **Do not merge #440 before
this lands.**

https://claude.ai/code/session_01SGjSjrywTnZDcUqgHWGrTj

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
rhuanbarreto pushed a commit that referenced this pull request Jul 3, 2026
# archgate

## [0.46.0](v0.45.7...v0.46.0)
(2026-07-02)

### ⚠ BREAKING CHANGES

* **session-context:** per-editor list/show subcommands; remove --skip
and its false premise (#446)

### Features

* **session-context:** per-editor list/show subcommands; remove --skip
and its false premise
([#446](#446))
([dd96230](dd96230))

### Bug Fixes

* **ci:** read POSTHOG_PROJECT_ID from secrets, not vars, in release
annotation ([#443](#443))
([a53b305](a53b305))
* detect opencode Desktop app installs, not just the CLI
([#439](#439))
([ed92b2b](ed92b2b))
* **hooks:** force bash shell for WorktreeCreate hook on Windows
([#442](#442))
([9da86cf](9da86cf))
* **release:** cap breaking-change bumps to minor while pre-1.0
([#447](#447))
([3df6c91](3df6c91)),
closes [#446](#446)
[#440](#440)
[#440](#440)
[#440](#440)
* repair broken WorktreeCreate hook and add PR approval policy
([#441](#441))
([de5e97d](de5e97d))
* **session-context:** select top-level opencode sessions, add --root
flag ([#445](#445))
([29b13f4](29b13f4))

---
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>
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