feat(jsonl): add omitempty to reduce JSONL bloat (beads-399)

Add omitempty JSON tags to Issue struct fields (Description, Status,
Priority, IssueType) and SetDefaults method to apply proper defaults
when importing JSONL with omitted fields.

This reduces JSONL file size for minimal issues like notifications
by not exporting empty/default values.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-19 23:18:11 -08:00
parent 2ea6083163
commit 6c060461cb
9 changed files with 97 additions and 7 deletions

View File

@@ -165,6 +165,7 @@ func autoImportIfNewer() {
fmt.Fprintf(os.Stderr, "Auto-import skipped: parse error at line %d: %v\nSnippet: %s\n", lineNo, err, snippet)
return
}
issue.SetDefaults() // Apply defaults for omitted fields (beads-399)
// Fix closed_at invariant: closed issues must have closed_at timestamp
if issue.Status == types.StatusClosed && issue.ClosedAt == nil {
@@ -662,6 +663,7 @@ func flushToJSONLWithState(state flushState) {
}
var issue types.Issue
if err := json.Unmarshal([]byte(line), &issue); err == nil {
issue.SetDefaults() // Apply defaults for omitted fields (beads-399)
issueMap[issue.ID] = &issue
} else {
// Warn about malformed JSONL lines