You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(provider): respect explicit settingSources opt-out and harden rule writes
Address PR #56 review findings on the rules-channel system prompt:
- never force-append "project" to an explicitly configured settingSources
(deliberate hardening opt-out); degrade to inline "message" delivery
with a one-time warning instead
- wrap the rule write in try/catch: a failed write (read-only checkout)
degrades to "message" mode for the turn rather than failing it
- add a generated-by sentinel to opencode.mdc frontmatter; a user-owned
(sentinel-less) file is never overwritten or deleted
- thread one canonical cwd through the provider options and dispose so
write and cleanup can't diverge and orphan the rule file
- make .cursor/rules/.gitignore ignore itself
- skip the rewrite when the rule content is unchanged (no sync fs write
on the stream hot path)
'systemPrompt "rules" needs the "project" settings layer, but settingSources was explicitly configured without it; delivering the system prompt inline ("message" mode) instead. Add "project" to settingSources or set systemPrompt: "message" to silence this.',
145
+
);
146
+
return{mode: "message", settingSources };
147
+
}
148
+
letresult: SystemRuleWrite;
149
+
try{
150
+
result=writeSystemRule(cwd,systemText);
151
+
}catch(error){
152
+
warn(
153
+
`failed to write .cursor/rules/${RULE_FILE} (${errorinstanceofError ? error.message : String(error)}); delivering the system prompt inline ("message" mode) for this turn.`,
154
+
);
155
+
return{mode: "message", settingSources };
156
+
}
157
+
if(result==="blocked"){
158
+
warn(
159
+
`.cursor/rules/${RULE_FILE} exists but was not generated by opencode-cursor; leaving it untouched and delivering the system prompt inline ("message" mode).`,
0 commit comments