chore(guardrails): add instructions and formatter config (8/8)#120
chore(guardrails): add instructions and formatter config (8/8)#120
Conversation
There was a problem hiding this comment.
Pull request overview
Completes the last two Guardrails profile configuration items in packages/guardrails/profile/opencode.json, intending to (1) direct sessions to the profile’s rules and (2) enable automatic formatting.
Changes:
- Add an
instructionsentry to the Guardrails profile config. - Add a
formatterentry intended to run Prettier.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,5 +1,6 @@ | |||
| { | |||
| "$schema": "https://opencode.ai/config.json", | |||
| "instructions": "Read and follow the rules in AGENTS.md at the profile root.", | |||
There was a problem hiding this comment.
instructions is defined in the config schema as an array of strings (instruction file paths / glob patterns / URLs), but this change sets it to a single string. With the current Zod schema (instructions: z.array(z.string())), this will cause config validation to fail and prevent the profile from loading. Change this to an array (e.g., include the profile’s AGENTS.md path/pattern such as "AGENTS.md").
| "instructions": "Read and follow the rules in AGENTS.md at the profile root.", | |
| "instructions": [ | |
| "AGENTS.md" | |
| ], |
| "enabled": true, | ||
| "command": "npx prettier --write" |
There was a problem hiding this comment.
formatter config shape here doesn’t match what OpenCode expects. The schema defines formatter as either false or a record keyed by formatter name, where each entry can set disabled, command (string array), environment, and extensions. The proposed { enabled: true, command: "npx prettier --write" } will fail validation (unknown keys, and command must be an array). Update to the record form (e.g., configure the prettier formatter entry with a string[] command, including $FILE substitution if needed).
| "enabled": true, | |
| "command": "npx prettier --write" | |
| "prettier": { | |
| "command": ["npx", "prettier", "--write", "$FILE"] | |
| } |
Add the final 2 of 8 guardrails profile configuration items: - instructions: references AGENTS.md for session-level agent rules - formatter: enables prettier for auto-formatting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
981c3ed to
da8ebf7
Compare
Issue for this PR
Closes #116
Type of change
What does this PR do?
Completes the final 2 of 8 guardrails profile configuration items in
opencode.json:instructions:"Read and follow the rules in AGENTS.md at the profile root."— directs every session to load the co-located AGENTS.md rules.formatter:{ "enabled": true, "command": "npx prettier --write" }— enables Prettier auto-formatting.Config completion: 8/8 ✅
How did you verify your code works?
bun turbo typecheck— 13/13 passChecklist