feat: add update command for non-interactive field updates#59
feat: add update command for non-interactive field updates#59ipreuss wants to merge 2 commits intowedow:masterfrom
Conversation
Adds `tk update <id> --field=value` for modifying YAML frontmatter fields without opening an editor. Useful for AI agents and scripts. Features: - Update single or multiple fields in one command - JSON array syntax with jq: --tags='["a", "b"]' → tags: [a, b] - Graceful fallback when jq unavailable - Proper error handling for invalid arguments/JSON Also fixes update_yaml_field to work on macOS/BSD by using awk instead of GNU-specific sed syntax for inserting new fields. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code review feedbackDisclosure: review by Claude (Anthropic's coding agent) on behalf of Context: the Findings on 1.
|
- Exit 0 on success (updated=$((updated+1)) instead of ((updated++))) - awk-based value replacement in both branches of update_yaml_field (eliminates sed metacharacter hazards: & / \) - Hybrid field policy via validate_field_update helper: - immutable: id, created - routed: status, deps, links - body-backed (rejected): title, description, design, acceptance - validated: priority (0-4), parent (must exist), type (known values) - freeform: everything else with [A-Za-z][A-Za-z0-9_-]* name - Reject array items with embedded commas (jq + no-jq paths) - Add 24 regression scenarios Ticket: M3R-7iue
|
Thanks for the thorough review — all 6 findings addressed in f4774ea. External architecture review flagged additional issues worth calling out (title/description/design/acceptance being body content, regex-injection via field names, no-jq fallback bypassing validation), all folded into the fix.
For #5 specifically, supporting comma-bearing items would require parser changes in 5+ consumers (ticket-query, ticket-ls, ticket's own array splits). Happy to open a follow-up if you'd like that fleshed out separately. |
Summary
Adds
tk update <id> --field=valuefor modifying YAML frontmatter fields without opening an editor. Useful for AI agents and automation scripts.tk update abc --priority=1 --assignee=alice--tags='["bug", "urgent"]'→tags: [bug, urgent]Also fixes
update_yaml_fieldto work on macOS/BSD by using awk instead of GNU-specific sed syntax for inserting new fields.Test plan
🤖 Generated with Claude Code