jwalsh / jwalsh/cprr

feat: add `cprr repair` command for malformed stores

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
cprr enhancement
Dominant language
Go
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Summary

Add `cprr repair` to auto-fix common corruption in `conjectures.json`.

## Motivation

qwen3-steering has a corrupted `.cprr/conjectures.json` with an extra `{` after the array close and a duplicated conjecture #25 outside the array. The tool currently fails silently or errors on load with no recovery path.

## Proposed Behavior

```bash
cprr repair # fix current store, preview changes
cprr repair --write # apply fixes
cprr repair --backup # save .cprr/conjectures.json.bak first
```

Fixes:
- [ ] Trailing garbage after valid JSON
- [ ] Duplicate conjecture IDs (keep latest `updated_at`)
- [ ] Normalize timestamps to RFC3339
- [ ] Remove entries with missing required fields (with warning)

## Depends On

- `cprr doctor` (#TBD) for validation logic

Contributor guide

Open the contributing guide

Research direction

Start with the .cprr/conjectures.json store and the existing cprr command path, then review how loading currently handles malformed JSON. Define completion against the proposed cprr repair, --write, and --backup behavior: trailing garbage, duplicate IDs, timestamps, and missing fields should be handled with the stated warnings and preview or write semantics. Check how this should depend on cprr doctor (#TBD) for validation logic.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.