fix: repair opencode config and project metadata#394
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughRestructures OpenCode configuration paths from hidden Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
2 issues found across 7 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/opencode-config.test.js">
<violation number="1" location="tests/opencode-config.test.js:36">
P2: This check can pass for absolute or out-of-directory plugin paths, so it does not fully enforce config-relative plugin references.</violation>
<violation number="2" location="tests/opencode-config.test.js:72">
P2: This existence check can also pass for absolute or escaped file refs, so the test does not strictly validate config-relative `{file:...}` references.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| for (const ref of refs) { | ||
| assert.ok(!ref.startsWith('.opencode/'), `File ref should not duplicate .opencode/: ${ref}`); | ||
| assert.ok(fs.existsSync(path.resolve(opencodeDir, ref)), `File ref should resolve from .opencode/: ${ref}`); |
There was a problem hiding this comment.
P2: This existence check can also pass for absolute or escaped file refs, so the test does not strictly validate config-relative {file:...} references.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/opencode-config.test.js, line 72:
<comment>This existence check can also pass for absolute or escaped file refs, so the test does not strictly validate config-relative `{file:...}` references.</comment>
<file context>
@@ -0,0 +1,81 @@
+
+ for (const ref of refs) {
+ assert.ok(!ref.startsWith('.opencode/'), `File ref should not duplicate .opencode/: ${ref}`);
+ assert.ok(fs.existsSync(path.resolve(opencodeDir, ref)), `File ref should resolve from .opencode/: ${ref}`);
+ }
+ })
</file context>
| const plugins = config.plugin || []; | ||
| for (const pluginPath of plugins) { | ||
| assert.ok(!pluginPath.includes('.opencode/'), `Plugin path should be config-relative, got: ${pluginPath}`); | ||
| assert.ok(fs.existsSync(path.resolve(opencodeDir, pluginPath)), `Plugin path should resolve from .opencode/: ${pluginPath}`); |
There was a problem hiding this comment.
P2: This check can pass for absolute or out-of-directory plugin paths, so it does not fully enforce config-relative plugin references.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/opencode-config.test.js, line 36:
<comment>This check can pass for absolute or out-of-directory plugin paths, so it does not fully enforce config-relative plugin references.</comment>
<file context>
@@ -0,0 +1,81 @@
+ const plugins = config.plugin || [];
+ for (const pluginPath of plugins) {
+ assert.ok(!pluginPath.includes('.opencode/'), `Plugin path should be config-relative, got: ${pluginPath}`);
+ assert.ok(fs.existsSync(path.resolve(opencodeDir, pluginPath)), `Plugin path should resolve from .opencode/: ${pluginPath}`);
+ }
+ })
</file context>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de1e074b33
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "AGENTS.md", | ||
| "CONTRIBUTING.md", | ||
| ".opencode/instructions/INSTRUCTIONS.md", | ||
| "instructions/INSTRUCTIONS.md", |
There was a problem hiding this comment.
Restore root-relative path for INSTRUCTIONS.md
The instructions array now points to instructions/INSTRUCTIONS.md, but this repository has no top-level instructions/ directory (.opencode/instructions/INSTRUCTIONS.md is the existing file). Because the other entries in this same array are root-scoped paths like AGENTS.md and skills/..., this change makes the core ECC instruction file unresolved in the bundled config, which can cause OpenCode to skip critical baseline instructions or fail config loading depending on runtime behavior.
Useful? React with 👍 / 👎.
Summary
.opencode/opencode.jsonlocal file references so OpenCode resolves prompts/plugins relative to.opencode/project.jsonmetadata alongside atomicprojects.jsonupdates indetect-project.shCloses #390
Closes #391
Test Plan
npm testnode tests/opencode-config.test.jsSummary by cubic
Fixes OpenCode config paths so files resolve relative to
.opencode/, and adds per‑project metadata (project.json) with atomic writes in the continuous-learning flow.Bug Fixes
.opencode/opencode.jsonconfig‑relative; updated examples inMIGRATION.mdandREADME.md.tests/opencode-config.test.jsto assert{file:...}and plugin paths resolve from.opencode/.New Features
skills/continuous-learning-v2/scripts/detect-project.shnow writes a per‑projectproject.json(id, name, root, remote, created_at, last_seen) and updatesprojects.jsonatomically.tests/hooks/hooks.test.jsto verify both metadata files are created and correctly populated.Written for commit de1e074. Summary will update on new commits.
Summary by CodeRabbit
New Features
Chores