Skip to content

Add OpenCode support to install/uninstall command - #36

Closed
zeval wants to merge 1 commit into
DeusData:mainfrom
zeval:add-opencode-install-support
Closed

zeval wants to merge 1 commit into
DeusData:mainfrom
zeval:add-opencode-install-support

Conversation

@zeval

@zeval zeval commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Register MCP server in OpenCode's global config (~/.config/opencode/opencode.json) during install
  • Remove MCP server entry during uninstall
  • Uses OpenCode's native config format: "mcp" key with "type": "local" and command array

Changes

  • install.go: Add opencodeConfigPath(), installOpenCodeMCP(), removeOpenCodeMCP() following the Zed/VS Code custom handler pattern
  • install_test.go: Add 4 tests — config path, install, settings preservation, uninstall

Test plan

  • TestOpenCodeConfigPath — verifies path generation
  • TestOpenCodeMCPInstall — creates config from scratch, verifies mcp key, type=local, command=[path]
  • TestOpenCodeMCPPreservesSettings — pre-existing settings survive install
  • TestOpenCodeMCPUninstall — entry removed cleanly after install
  • All existing tests pass (go test ./cmd/codebase-memory-mcp/ -count=1)
  • go vet clean

Register the MCP server in OpenCode's global config
(~/.config/opencode/opencode.json) using its native format:
"mcp" key with type "local" and command array.
@zeval
zeval marked this pull request as ready for review March 10, 2026 15:49
@zeval

zeval commented Mar 10, 2026

Copy link
Copy Markdown
Contributor Author

Hey @DeusData! Nice tool, in order to expand this to OpenCode users I went ahead and added support based on your existing patterns, let me know if there's something you'd like to see changed.

@DeusData

Copy link
Copy Markdown
Owner

Superseded by 159378a — OpenCode support is now implemented natively in the C codebase.

The implementation covers:

  • Agent detection (binary on PATH)
  • MCP config upsert at ~/.config/opencode/opencode.json with "mcp" key
  • AGENTS.md instruction file at ~/.config/opencode/AGENTS.md
  • Full uninstall support

Thanks for the PR @zeval — your approach informed the config path and format decisions. You're credited as a co-author on commit 442cb95.

Note: This repo moved from Go to C since your PR was opened, so Go-based PRs can no longer be merged directly.

@DeusData DeusData closed this Mar 19, 2026
@zeval

zeval commented Mar 19, 2026

Copy link
Copy Markdown
Contributor Author

Glad to have helped :) thank you!

ngallodev added a commit to ngallodev/codebase-memory-cli that referenced this pull request Oct 1, 2026
The codeql-gate job failed every run on 32 open alerts. Only one was a
CodeQL finding in this repository's own code; the rest were CodeQL
findings in vendored third-party grammars and OpenSSF Scorecard
repository-hygiene checks.

Gate (.github/workflows/_security.yml):
- Count only CodeQL alerts outside vendored/ and internal/cbm/vendored/.
  Scorecard keeps reporting in its own workflow; vendored grammar code is
  upstream code this repo does not patch.
- On pull requests, query the PR's own analysis
  (ref=refs/pull/N/merge). Without a ref the API answers for the default
  branch, so a fix inside a PR could never clear the gate before merging.
- Paginate (per_page=100, --paginate). The unpaginated call returned at
  most 30 alerts, so the count silently capped at 30.
- Fail-closed behavior is unchanged: an unreadable alert list or a
  non-numeric count still blocks. tests/test_security_gate_fail_closed.sh
  passes.

Findings fixed:
- src/simhash/minhash.c (CodeQL cpp/overflowing-snprintf, alert #13):
  cbm_minhash_to_hex advanced its offset by snprintf's return value
  without checking it. Stop and terminate on a negative or truncated
  write.
- .github/workflows/claude.yml, claude-code-review.yml (Scorecard
  TokenPermissions DeusData#36, DeusData#37): add a deny-all top-level `permissions: {}`;
  each job already grants what it needs.

Diagnostics:
- .github/workflows/_test.yml: upload build/c/test-logs/*.log from a
  failed Windows test shard. The harness prints only the last 15 lines of
  each failing suite, which cut off the ASan report for index_resilience
  on Windows.

Validation: security-audit.sh and the gate fail-closed contract pass;
make lint-ci lint-tidy-diff passes; scripts/test.sh --suites simhash 25
passed. The new filter evaluated against the live alert API counts only
alert #13 on the default branch and 0 for refs/pull/12/merge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants