Skip to content

feat(setup): add CommandCode CLI as supported agent - #1123

Open
eSagraAI wants to merge 1 commit into
Gentleman-Programming:mainfrom
eSagraAI:feat/setup-commandcode
Open

feat(setup): add CommandCode CLI as supported agent#1123
eSagraAI wants to merge 1 commit into
Gentleman-Programming:mainfrom
eSagraAI:feat/setup-commandcode

Conversation

@eSagraAI

@eSagraAI eSagraAI commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked Issue

Closes #1119


🏷️ PR Type

  • type:bug — Bug fix
  • type:feature — New feature
  • type:docs — Documentation only
  • type:refactor — Code refactoring (no behavior change)
  • type:chore — Maintenance, dependencies, tooling
  • type:breaking-change — Breaking change

📝 Summary

  • Adds commandcode as a declarative agent in agentAdapters() — no custom installer, the generic injectMCP / writeInstruction driver handles both writes.
  • engram setup commandcode registers mcpServers.engram in the user-scope ~/.commandcode/mcp.json (private, available across all projects).
  • Writes the Memory Protocol as a marker block into the user-tier ~/.commandcode/AGENTS.md, preserving user preferences and staying idempotent (CommandCode re-reads memory every request, so no restart needed for AGENTS.md).

📂 Changes

File Change
internal/setup/registry.go New commandCodeObject MCP format ({transport:"stdio", enabled:true, command, args} under mcpServers) + mcpEntry case
internal/setup/agents.go New commandcode registry entry plus commandcodeDir / commandcodeMCPPath / commandcodeAgentsPath helpers
internal/setup/registry_test.go commandcode row in declarativeAgents(), in expected SupportedAgents(), and transport/enabled shape assertions
cmd/engram/main.go commandcode added to the setup [agent] usage line
cmd/engram/main_test.go commandcode in usage list and a printPostInstall case
README.md CommandCode row in supported-agents table
docs/AGENT-SETUP.md CommandCode table row, ## CommandCode section, format note in intro

🧪 Test Plan

  • Unit tests pass locally: go test ./...
  • E2E tests pass locally: go test -tags e2e ./internal/server/...
  • Lint passes locally: make lint
  • Manually tested the affected functionality

go test ./... is NOT green: the only 2 failures (TestInstallPiInstallsPackagesAndWritesConfig in internal/setup, TestDetectProjectFull_ChildScanFindsLaterSecondRepository in internal/project) reproduce identically on a clean tree without this change (verified via git stash -u), so they are pre-existing environment failures, not regressions. Deliberately left unchecked rather than marked PASS.

Manual verification — engram setup commandcode against an isolated HOME:

✓ Installed commandcode plugin (2 files)

.commandcode
├── AGENTS.md
└── mcp.json
{
  "mcpServers": {
    "engram": {
      "command": "<absolute-path-to>/engram",
      "enabled": true,
      "transport": "stdio",
      "args": ["mcp", "--tools=agent"]
    }
  }
}

Re-running is idempotent (1 marker block). The real CLI accepts the generated file: cmd mcp list shows engram / stdio / user / enabled and cmd mcp get engram reports the correct transport, command and args.


🤖 Automated Checks

These run automatically and all must pass before merge:

Check What it verifies Status
Check Issue Reference PR body contains Closes #N / Fixes #N / Resolves #N
Check Issue Has status:approved Linked issue has status:approved label
Check PR Has type:* Label PR has exactly one type:* label
Unit Tests go test ./... passes
E2E Tests go test -tags e2e ./internal/server/... passes
Plugin Tests npm test passes in plugin/pi
Lint golangci-lint reports no new findings

✅ Contributor Checklist

  • I linked an approved issue above (Closes #1119)
  • I added exactly one type:* label to this PR
  • I ran unit tests locally: go test ./...
  • I ran e2e tests locally: go test -tags e2e ./internal/server/...
  • I ran lint locally: make lint
  • Docs updated (if behavior changed)
  • Commits follow conventional commits format
  • No Co-Authored-By trailers in commits

💬 Notes for Reviewers

  1. New mcpFormat instead of reusing mcpServersObject. The issue left the stdio shape as an open verification point; it was verified empirically with the real CLI (cmd mcp add --scope user engram-probe -- …cmd mcp get, probe removed and the user config restored byte-identical afterwards): CommandCode writes {transport:"stdio", enabled:true, command, args}. A bare {command, args} entry would omit the transport discriminator, so a new format value was added following the serversObject / opencodeObject precedent.
  2. markerBlock, not wholeFile. Unlike Cline (dedicated rules dir), ~/.commandcode/AGENTS.md is a shared user-preferences file read cumulatively with project/subdirectory tiers — same reasoning as the qwen/kilocode adapters.
  3. No plugin, no hooks — thin adapter per skills/plugin-thin, exactly as scoped in feat(setup): add CommandCode CLI as supported agent #1119. docs/INSTALLATION.md untouched, mirroring PR feat(setup): add Cline CLI as supported agent #1116 (6-file scope + the new-format hunk).

Summary by CodeRabbit

  • New Features

    • Added CommandCode as a supported agent for setup.
    • CommandCode setup now configures the Engram MCP server and Memory Protocol instructions.
    • Added verification guidance, including required session restart steps and Windows CLI details.
  • Documentation

    • Added CommandCode to the agent setup quick reference and expanded configuration documentation.
  • Tests

    • Added coverage for CommandCode support, configuration, usage output, and post-install instructions.

Register CommandCode as a declarative agent so `engram setup commandcode` wires the MCP server and the Memory Protocol without a manual config edit. Writes mcpServers.engram to the user-scope ~/.commandcode/mcp.json using the {transport:stdio, enabled, command, args} shape verified against real `cmd mcp add --scope user` output, and the protocol as a marker block in the user-tier ~/.commandcode/AGENTS.md. Closes Gentleman-Programming#1119
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 28b17d10-da9c-4d4a-aa03-f45e76bbdb4f

📥 Commits

Reviewing files that changed from the base of the PR and between 5d5bf83 and b075cac.

📒 Files selected for processing (7)
  • README.md
  • cmd/engram/main.go
  • cmd/engram/main_test.go
  • docs/AGENT-SETUP.md
  • internal/setup/agents.go
  • internal/setup/registry.go
  • internal/setup/registry_test.go

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The setup registry now supports CommandCode through ~/.commandcode/mcp.json and ~/.commandcode/AGENTS.md. CLI help, post-install output, tests, README content, and setup documentation include the new agent.

Changes

CommandCode setup support

Layer / File(s) Summary
CommandCode registration and paths
internal/setup/registry.go, internal/setup/agents.go
Adds the CommandCode MCP format, stdio metadata, enabled status, command path, MCP arguments, and user-scope file paths.
CommandCode registry validation
internal/setup/registry_test.go
Registers commandcode as a declarative agent and verifies its MCP entry metadata.
CommandCode CLI and documentation
cmd/engram/main.go, cmd/engram/main_test.go, README.md, docs/AGENT-SETUP.md
Adds CommandCode to setup help, post-install checks, supported-agent lists, and setup documentation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Suggested reviewers: alan-thegentleman

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant EngramSetup
  participant CommandCodeMCP
  participant CommandCodeMemory
  User->>EngramSetup: Run engram setup commandcode
  EngramSetup->>CommandCodeMCP: Write mcpServers.engram
  EngramSetup->>CommandCodeMemory: Write Memory Protocol marker block
  EngramSetup-->>User: Display verification and restart guidance
Loading

Merge Risk: ⚪ Minimal · up to b075c

No actionable merge-blocking risk remains in the CommandCode setup integration.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 5 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the primary change: adding the CommandCode CLI as a supported setup agent.
Linked Issues check ✅ Passed The changes satisfy issue #1119. They add the declarative CommandCode registry entry, use the user-scoped ~/.commandcode/mcp.json path with the CommandCode MCP format, inject the Memory Protocol into …
Out of Scope Changes check ✅ Passed The changes are limited to the CommandCode adapter, registry format, setup help, documentation, and related tests. No unrelated code or feature changes are present.
Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 5 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@dnlrsls dnlrsls added the type:feature New feature label Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(setup): add CommandCode CLI as supported agent

2 participants