Skip to content

chore: adjust opencode agent permissions#1444

Merged
dyoshikawa merged 4 commits intomainfrom
chore/opencode-agent-tools
Apr 5, 2026
Merged

chore: adjust opencode agent permissions#1444
dyoshikawa merged 4 commits intomainfrom
chore/opencode-agent-tools

Conversation

@dyoshikawa
Copy link
Copy Markdown
Owner

Summary

  • Reorder and refine OpenCode agent permissions in opencode.json
  • Add the build-lite agent configuration and update variants for the existing agents

Test Plan

  • pnpm cicheck

Copilot AI review requested due to automatic review settings April 5, 2026 13:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the OpenCode configuration and extends E2E coverage around rulesync generate --delete --check behavior to ensure check mode fails when generation would delete orphaned tool files.

Changes:

  • Add OpenCode agent entries/variants in opencode.json (including a new build-lite agent).
  • Extend E2E tests for multiple features to assert --delete --check fails when orphan tool files would be removed.
  • Extend the E2E helper to support --delete and --check flags when invoking rulesync generate.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/e2e/e2e-helper.ts Adds deleteFiles/check options to runGenerate to pass --delete / --check.
src/e2e/e2e-commands.spec.ts Adds E2E coverage for orphan command files in --delete --check mode.
src/e2e/e2e-subagents.spec.ts Adds E2E coverage for orphan subagent files in --delete --check mode.
src/e2e/e2e-skills.spec.ts Adds E2E coverage for orphan skill files in --delete --check mode.
src/e2e/e2e-mcp.spec.ts Adds E2E coverage for orphan MCP files in --delete --check mode.
src/e2e/e2e-ignore.spec.ts Adds E2E coverage for orphan ignore files in --delete --check mode.
src/e2e/e2e-hooks.spec.ts Adds E2E coverage for orphan hooks files in --delete --check mode.
opencode.json Reorders/refines agents and adds build-lite with a mini model.

Comment on lines +47 to +50
it.each([
{ target: "cursor", orphanPath: ".cursorignore" },
{ target: "claudecode", orphanPath: join(".claude", "settings.json") },
])(
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

The claudecode ignore output file is .claude/settings.json, but ClaudecodeIgnore.isDeletable() returns false, and IgnoreProcessor.loadToolFiles({ forDeletion: true }) filters out non-deletable files. With --delete --check and no .rulesync/.aiignore, generation should not report a diff for this file (and therefore should not fail). Consider removing the claudecode case from this parametrized test, or splitting into two tests: one that asserts failure for deletable targets (e.g. cursor) and one that asserts success/no deletion for non-deletable targets like claudecode settings.json.

Copilot uses AI. Check for mistakes.
Comment thread src/e2e/e2e-hooks.spec.ts
Comment on lines +64 to +67
it.each([
{ target: "claudecode", orphanPath: join(".claude", "settings.json") },
{ target: "cursor", orphanPath: join(".cursor", "hooks.json") },
{ target: "opencode", orphanPath: join(".opencode", "plugins", "rulesync-hooks.js") },
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

The claudecode hooks file is .claude/settings.json, but ClaudecodeHooks.isDeletable() is false and HooksProcessor.loadToolFiles({ forDeletion: true }) excludes non-deletable files. In --delete --check mode with no Rulesync hooks source, this should not be treated as a pending deletion diff, so the command likely won't fail as the test expects. Remove the claudecode case here, or add a separate assertion that non-deletable config files are preserved even when --delete is used.

Copilot uses AI. Check for mistakes.
Comment thread src/e2e/e2e-mcp.spec.ts
Comment on lines +55 to +60
it.each([
{ target: "claudecode", orphanPath: ".mcp.json" },
{ target: "cursor", orphanPath: join(".cursor", "mcp.json") },
{ target: "geminicli", orphanPath: join(".gemini", "settings.json") },
{ target: "codexcli", orphanPath: join(".codex", "config.toml") },
])(
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

This table includes targets whose MCP output files are explicitly non-deletable: GeminiCliMcp.isDeletable() returns false for .gemini/settings.json, and CodexcliMcp.isDeletable() returns false for .codex/config.toml. McpProcessor.loadToolFiles({ forDeletion: true }) filters those out, so --delete --check with no Rulesync MCP source should not fail due to a pending deletion. Consider limiting this test to deletable outputs (e.g. claudecode .mcp.json, cursor .cursor/mcp.json) and adding a separate test that verifies non-deletable MCP config files are not removed / do not cause diffs in check mode.

Copilot uses AI. Check for mistakes.
@dyoshikawa dyoshikawa merged commit 536d35e into main Apr 5, 2026
10 of 14 checks passed
@dyoshikawa dyoshikawa deleted the chore/opencode-agent-tools branch April 5, 2026 13:41
@dyoshikawa
Copy link
Copy Markdown
Owner Author

@dyoshikawa Thank you!

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.

3 participants