chore: adjust opencode agent permissions#1444
Conversation
There was a problem hiding this comment.
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 newbuild-liteagent). - Extend E2E tests for multiple features to assert
--delete --checkfails when orphan tool files would be removed. - Extend the E2E helper to support
--deleteand--checkflags when invokingrulesync 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. |
| it.each([ | ||
| { target: "cursor", orphanPath: ".cursorignore" }, | ||
| { target: "claudecode", orphanPath: join(".claude", "settings.json") }, | ||
| ])( |
There was a problem hiding this comment.
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.
| 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") }, |
There was a problem hiding this comment.
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.
| 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") }, | ||
| ])( |
There was a problem hiding this comment.
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.
|
@dyoshikawa Thank you! |
Summary
opencode.jsonbuild-liteagent configuration and update variants for the existing agentsTest Plan
pnpm cicheck