Compare commits

...

2 Commits

Author SHA1 Message Date
Rodin 9e15b73a23 revert: remove YAML support, keep JSON-only
PR Ready Gate / clear-labels (pull_request) Successful in 2s
CI / test (pull_request) Successful in 15s
CI / review (anthropic--claude-4.6-sonnet, sonnet, SONNET_REVIEW_TOKEN) (pull_request) Successful in 28s
CI / review (gpt-5, security, SECURITY_REVIEW.md, SECURITY_REVIEW_TOKEN) (pull_request) Successful in 30s
CI / review (gpt-5, gpt, GPT_REVIEW_TOKEN) (pull_request) Successful in 51s
The external dependency (goccy/go-yaml) violates the repository's
stdlib-only convention (CONVENTIONS.md). While YAML provides better
readability for multi-line strings, the convenience doesn't justify
breaking a hard rule.

Reverts:
- External dependency on github.com/goccy/go-yaml
- YAML parsing logic in persona.go
- YAML persona files (restored as JSON)
- YAML-specific tests
- Design document (feature rejected)

The persona files work fine with JSON. Multi-line strings use \n escapes
which is less pretty but acceptable for internal files.

This addresses all MAJOR findings from review bots regarding the external
dependency violation.
2026-05-10 13:34:09 -07:00
Rodin 006b7a3b27 feat: add YAML support for persona files (#57)
CI / test (pull_request) Successful in 9m33s
CI / review (anthropic--claude-4.6-sonnet, sonnet, SONNET_REVIEW_TOKEN) (pull_request) Successful in 10m1s
CI / review (gpt-5, security, SECURITY_REVIEW.md, SECURITY_REVIEW_TOKEN) (pull_request) Successful in 10m39s
CI / review (gpt-5, gpt, GPT_REVIEW_TOKEN) (pull_request) Successful in 11m6s
- Add github.com/goccy/go-yaml dependency (v1.19.2)
- Update parsePersona to detect format by file extension
- Support both .yaml and .yml extensions (case-insensitive)
- Convert built-in personas to YAML format
- Add comprehensive tests for YAML parsing
- Update README with YAML examples and documentation

YAML provides cleaner multi-line strings via literal block scalars
and supports comments, making persona definitions more readable.
JSON remains supported for backwards compatibility.

Closes #57
2026-05-10 13:08:06 -07:00
+41 -28
View File
@@ -208,7 +208,7 @@ AI Core handles OAuth token management and deployment discovery automatically. M
| `patterns-files` | No | `README.md` | Files/directories to fetch from pattern repos | | `patterns-files` | No | `README.md` | Files/directories to fetch from pattern repos |
| `system-prompt-file` | No | `""` | Local file with additional system prompt instructions | | `system-prompt-file` | No | `""` | Local file with additional system prompt instructions |
| `persona` | No | `""` | Built-in persona name (security, architect, docs) | | `persona` | No | `""` | Built-in persona name (security, architect, docs) |
| `persona-file` | No | `""` | Path to persona JSON file with custom review focus | | `persona-file` | No | `""` | Path to persona file (YAML or JSON) with custom review focus |
| `temperature` | No | `0` | LLM temperature (0 = server default) | | `temperature` | No | `0` | LLM temperature (0 = server default) |
| `timeout` | No | `300` | LLM request timeout in seconds | | `timeout` | No | `300` | LLM request timeout in seconds |
| `dry-run` | No | `false` | Print review to stdout instead of posting | | `dry-run` | No | `false` | Print review to stdout instead of posting |
@@ -408,32 +408,38 @@ Each persona posts independently with its own sentinel, so reviews don't interfe
### Custom Personas ### Custom Personas
Create a JSON file with your domain-specific review focus: Create a YAML file with your domain-specific review focus:
```json ```yaml
// .review/personas/trading.json # .review/personas/trading.yaml
{ name: trading
"name": "trading", display_name: Trading Domain Expert
"display_name": "Trading Domain Expert",
"identity": "You are a trading systems expert reviewing code for correctness.\n\nYour expertise:\n- Order lifecycle and state machines\n- Fill handling and partial fills\n- Position tracking and P&L calculations\n- Event sourcing invariants", identity: |
"focus": [ You are a trading systems expert reviewing code for correctness.
"Order state machine correctness",
"Fill handling edge cases (partial, overfill)", Your expertise:
"Position and P&L calculation accuracy", - Order lifecycle and state machines
"Event replay determinism", - Fill handling and partial fills
"Decimal precision for money" - Position tracking and P&L calculations
], - Event sourcing invariants
"ignore": [
"Code style", focus:
"General performance", - Order state machine correctness
"Documentation formatting" - Fill handling edge cases (partial, overfill)
], - Position and P&L calculation accuracy
"severity": { - Event replay determinism
"major": "Bugs that cause incorrect positions, fills, or money calculations", - Decimal precision for money
"minor": "Edge cases that could cause issues under unusual conditions",
"nit": "Clarity improvements for domain logic" ignore:
} - Code style
} - General performance
- Documentation formatting
severity:
major: "Bugs that cause incorrect positions, fills, or money calculations"
minor: "Edge cases that could cause issues under unusual conditions"
nit: "Clarity improvements for domain logic"
``` ```
Use it in CI: Use it in CI:
@@ -442,17 +448,24 @@ Use it in CI:
- uses: rodin/review-bot/.gitea/actions/review@v1 - uses: rodin/review-bot/.gitea/actions/review@v1
with: with:
reviewer-name: trading reviewer-name: trading
persona-file: .review/personas/trading.json persona-file: .review/personas/trading.yaml
... ...
``` ```
YAML is the recommended format for personas because it supports:
- Multi-line strings with `|` blocks (cleaner identity definitions)
- Comments for documentation
- More readable arrays and nested structures
JSON is also supported for backwards compatibility—just use `.json` extension.
### Persona vs system-prompt-file ### Persona vs system-prompt-file
| Feature | `persona` / `persona-file` | `system-prompt-file` | | Feature | `persona` / `persona-file` | `system-prompt-file` |
|---------|---------------------------|----------------------| |---------|---------------------------|----------------------|
| Replaces base prompt | Yes | No (appends) | | Replaces base prompt | Yes | No (appends) |
| Structured format | Yes (JSON) | No (freeform) | | Structured format | Yes (YAML/JSON) | No (freeform) |
| Focus/ignore lists | Yes | Manual | | Focus/ignore lists | Yes | Manual |
| Severity calibration | Yes | Manual | | Severity calibration | Yes | Manual |
| Header display name | Yes | No | | Header display name | Yes | No |