Skip to content

chore(guardrails): add instructions and formatter config (8/8)#120

Merged
terisuke merged 1 commit intodevfrom
chore/guardrails-config-completion
Apr 6, 2026
Merged

chore(guardrails): add instructions and formatter config (8/8)#120
terisuke merged 1 commit intodevfrom
chore/guardrails-config-completion

Conversation

@terisuke
Copy link
Copy Markdown

@terisuke terisuke commented Apr 6, 2026

Issue for this PR

Closes #116

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Completes the final 2 of 8 guardrails profile configuration items in opencode.json:

  1. instructions: "Read and follow the rules in AGENTS.md at the profile root." — directs every session to load the co-located AGENTS.md rules.
  2. formatter: { "enabled": true, "command": "npx prettier --write" } — enables Prettier auto-formatting.

Config completion: 8/8

Setting Status
model
small_model
autoupdate
dangerous ops deny
.env protection
git push control
instructions ✅ (this PR)
formatter ✅ (this PR)

How did you verify your code works?

  1. JSON validity verified (parsed with json.load)
  2. $schema field remains first key
  3. Typecheck: bun turbo typecheck — 13/13 pass

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Copilot AI review requested due to automatic review settings April 6, 2026 10:25
Copy link
Copy Markdown

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

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 instructions entry to the Guardrails profile config.
  • Add a formatter entry 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.",
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

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").

Suggested change
"instructions": "Read and follow the rules in AGENTS.md at the profile root.",
"instructions": [
"AGENTS.md"
],

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +18
"enabled": true,
"command": "npx prettier --write"
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

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).

Suggested change
"enabled": true,
"command": "npx prettier --write"
"prettier": {
"command": ["npx", "prettier", "--write", "$FILE"]
}

Copilot uses AI. Check for mistakes.
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>
@terisuke terisuke force-pushed the chore/guardrails-config-completion branch from 981c3ed to da8ebf7 Compare April 6, 2026 10:30
@terisuke terisuke merged commit 4e50329 into dev Apr 6, 2026
4 of 5 checks passed
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.

chore: complete opencode.jsonc config — instructions + formatter (8/8)

2 participants