Skip to content

Commit 5fefd2f

Browse files
committed
feat(cli): improve help information for set/get/add commands
- Add VALID FIELDS section to work get/set/add/remove commands - Add VALID FIELDS section to adr get/set/add/remove commands - Add VALID FIELDS section to rfc get/set commands - Add VALID FIELDS section to clause get/set commands - Add EXAMPLES section for each command This enables agents to understand available operations without consulting external documentation. Closes: WI-2026-02-22-004
1 parent cb8bd50 commit 5fefd2f

File tree

4 files changed

+246
-7
lines changed

4 files changed

+246
-7
lines changed

gov/adr/ADR-0027-extend-alternative-structure-with-pros-cons-and-rejection-reason.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
schema = 1
33
id = "ADR-0027"
44
title = "Extend Alternative structure with pros, cons, and rejection_reason"
5-
status = "proposed"
5+
status = "accepted"
66
date = "2026-02-22"
77
refs = ["RFC-0000:C-ADR-DEF"]
88

@@ -27,7 +27,6 @@ The current `Alternative` structure in ADRs only has two fields: `text` and `sta
2727
- WorkItem has structured `acceptance_criteria` with status and category
2828
- RFC has structured `changelog` with categorized entries
2929
- ADR alternatives should have similar structure for decision tracking."""
30-
3130
decision = """
3231
Extend the `Alternative` structure with three new optional fields:
3332
@@ -46,7 +45,6 @@ Extend the `Alternative` structure with three new optional fields:
4645
4746
**Backward compatibility:**
4847
All new fields use `#[serde(default)]` and `skip_serializing_if_empty`, so existing ADRs remain valid without migration."""
49-
5048
consequences = """
5149
**What becomes easier:**
5250

gov/releases.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ refs = [
77
"WI-2026-02-22-001",
88
"WI-2026-02-22-002",
99
"WI-2026-02-22-003",
10+
"WI-2026-02-22-004",
1011
]
1112

1213
[[releases]]
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[govctl]
2+
schema = 1
3+
id = "WI-2026-02-22-004"
4+
title = "Improve CLI help information for agent usability"
5+
status = "done"
6+
created = "2026-02-22"
7+
started = "2026-02-22"
8+
completed = "2026-02-22"
9+
10+
[content]
11+
description = "Improve CLI help information to display valid field names for set/get/add commands, enabling agents to understand available operations without consulting external documentation."
12+
13+
[[content.acceptance_criteria]]
14+
text = "adr set/get/add/remove commands with valid field list"
15+
status = "done"
16+
category = "changed"
17+
18+
[[content.acceptance_criteria]]
19+
text = "govctl check passes"
20+
status = "done"
21+
category = "chore"
22+
23+
[[content.acceptance_criteria]]
24+
text = "rfc set/get commands with valid field list"
25+
status = "done"
26+
category = "changed"
27+
28+
[[content.acceptance_criteria]]
29+
text = "clause set/get commands with valid field list"
30+
status = "done"
31+
category = "changed"
32+
33+
[[content.acceptance_criteria]]
34+
text = "work set/get/add/remove commands with valid field list"
35+
status = "done"
36+
category = "changed"
37+
38+
[[content.acceptance_criteria]]
39+
text = "All tests pass"
40+
status = "done"
41+
category = "chore"

src/main.rs

Lines changed: 203 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,47 @@ EXAMPLES:
273273
output: OutputFormat,
274274
},
275275
/// Get RFC field value
276+
#[command(after_help = "\
277+
VALID FIELDS:
278+
String fields:
279+
- title: RFC title
280+
- version: RFC version (semver)
281+
- status: RFC status (draft|normative|deprecated)
282+
- phase: RFC phase (spec|impl|test|stable)
283+
284+
Array fields (returns JSON array):
285+
- owners: RFC owners
286+
- refs: Cross-references to other artifacts
287+
- sections: RFC sections
288+
289+
EXAMPLES:
290+
govctl rfc get RFC-0001 # Show all fields
291+
govctl rfc get RFC-0001 title # Get specific field
292+
govctl rfc get RFC-0001 refs # Get array field
293+
")]
276294
Get {
277295
/// RFC ID
278296
id: String,
279297
/// Field name (omit to show all)
280298
field: Option<String>,
281299
},
282300
/// Set RFC field value
301+
#[command(after_help = "\
302+
VALID FIELDS:
303+
String fields (use 'set'):
304+
- title: RFC title
305+
- version: RFC version (semver)
306+
- status: RFC status (draft|normative|deprecated)
307+
- phase: RFC phase (spec|impl|test|stable)
308+
309+
Array fields (modify via rfc.json directly):
310+
- owners, refs, sections
311+
312+
EXAMPLES:
313+
govctl rfc set RFC-0001 title \"New Title\"
314+
govctl rfc set RFC-0001 version 0.2.0
315+
govctl rfc set RFC-0001 phase impl
316+
")]
283317
Set {
284318
/// RFC ID
285319
id: String,
@@ -403,6 +437,22 @@ EXAMPLES:
403437
output: OutputFormat,
404438
},
405439
/// Get clause field value
440+
#[command(after_help = "\
441+
VALID FIELDS:
442+
String fields:
443+
- title: Clause title
444+
- kind: Clause kind (normative|informative)
445+
- status: Clause status (active|deprecated|superseded)
446+
- text: Clause text content
447+
- since: Version when clause was added
448+
449+
Array fields (returns JSON array):
450+
- anchors: Cross-reference anchors
451+
452+
EXAMPLES:
453+
govctl clause get RFC-0001:C-SUMMARY # Show all fields
454+
govctl clause get RFC-0001:C-SUMMARY text # Get clause text
455+
")]
406456
Get {
407457
/// Clause ID (e.g., RFC-0001:C-PHASE-ORDER)
408458
id: String,
@@ -424,6 +474,23 @@ EXAMPLES:
424474
stdin: bool,
425475
},
426476
/// Set clause field value
477+
#[command(after_help = "\
478+
VALID FIELDS:
479+
String fields (use 'set'):
480+
- title: Clause title
481+
- kind: Clause kind (normative|informative)
482+
- status: Clause status (active|deprecated|superseded)
483+
- text: Clause text content (use 'edit' for multi-line)
484+
485+
Array fields (modify via clause.json directly):
486+
- anchors
487+
488+
EXAMPLES:
489+
govctl clause set RFC-0001:C-SUMMARY title \"New Title\"
490+
govctl clause set RFC-0001:C-SUMMARY kind informative
491+
492+
For editing clause text, prefer 'govctl clause edit' command.
493+
")]
427494
Set {
428495
/// Clause ID
429496
id: String,
@@ -503,13 +570,46 @@ EXAMPLES:
503570
output: OutputFormat,
504571
},
505572
/// Get ADR field value
573+
#[command(after_help = "\
574+
VALID FIELDS:
575+
String fields:
576+
- context: Background and problem description
577+
- decision: The decision made and rationale
578+
- consequences: Impact of this decision
579+
- status: ADR status (proposed|accepted|rejected|superseded)
580+
581+
Array fields (returns JSON array):
582+
- refs: Cross-references to RFCs/ADRs
583+
- alternatives: Options that were considered
584+
585+
EXAMPLES:
586+
govctl adr get ADR-0001 # Show all fields
587+
govctl adr get ADR-0001 context # Get specific field
588+
govctl adr get ADR-0001 alternatives # Get array field
589+
")]
506590
Get {
507591
/// ADR ID
508592
id: String,
509593
/// Field name (omit to show all)
510594
field: Option<String>,
511595
},
512596
/// Set ADR field value
597+
#[command(after_help = "\
598+
VALID FIELDS:
599+
String fields (use 'set'):
600+
- context: Background and problem description
601+
- decision: The decision made and rationale
602+
- consequences: Impact of this decision
603+
604+
Array fields (use 'add'/'remove' instead):
605+
- refs, alternatives
606+
607+
EXAMPLES:
608+
govctl adr set ADR-0001 context \"New context\"
609+
govctl adr set ADR-0001 decision --stdin <<'EOF'
610+
Multi-line decision here
611+
EOF
612+
")]
513613
Set {
514614
/// ADR ID
515615
id: String,
@@ -523,10 +623,24 @@ EXAMPLES:
523623
stdin: bool,
524624
},
525625
/// Add value to ADR array field
626+
#[command(after_help = "\
627+
VALID ARRAY FIELDS:
628+
- refs: Cross-references to RFCs/ADRs (e.g., \"RFC-0001\", \"ADR-0002\")
629+
- alternatives: Options that were considered
630+
631+
ALTERNATIVES FORMAT:
632+
Each alternative can have:
633+
- text: Description of the option
634+
- status: considered|accepted|rejected
635+
636+
EXAMPLES:
637+
govctl adr add ADR-0001 refs RFC-0001
638+
govctl adr add ADR-0001 alternatives \"Option A: Description\"
639+
")]
526640
Add {
527641
/// ADR ID
528642
id: String,
529-
/// Array field name
643+
/// Array field name (refs, alternatives)
530644
field: String,
531645
/// Value to add (optional if --stdin)
532646
value: Option<String>,
@@ -535,10 +649,25 @@ EXAMPLES:
535649
stdin: bool,
536650
},
537651
/// Remove value from ADR array field
652+
#[command(after_help = "\
653+
VALID ARRAY FIELDS:
654+
- refs, alternatives
655+
656+
MATCHING OPTIONS:
657+
- pattern: Substring match (default)
658+
- --at N: Remove by index (1-based, negative = from end)
659+
- --exact: Exact string match
660+
- --regex: Regex pattern match
661+
- --all: Remove all matches
662+
663+
EXAMPLES:
664+
govctl adr remove ADR-0001 refs RFC-0001 # Remove first match
665+
govctl adr remove ADR-0001 refs --at 1 # Remove by index
666+
")]
538667
Remove {
539668
/// ADR ID
540669
id: String,
541-
/// Array field name
670+
/// Array field name (refs, alternatives)
542671
field: String,
543672
/// Pattern to match
544673
#[arg(required_unless_present = "at")]
@@ -657,13 +786,46 @@ EXAMPLES:
657786
output: OutputFormat,
658787
},
659788
/// Get work item field value
789+
#[command(after_help = "\
790+
VALID FIELDS:
791+
String fields:
792+
- description: Task scope declaration
793+
- status: Work item status (queue|active|done|cancelled)
794+
795+
Array fields (returns JSON array):
796+
- refs: Cross-references to RFCs/ADRs
797+
- journal: Execution tracking entries
798+
- notes: Ad-hoc key points
799+
- acceptance_criteria: Completion criteria
800+
801+
EXAMPLES:
802+
govctl work get WI-001 # Show all fields
803+
govctl work get WI-001 description # Get specific field
804+
govctl work get WI-001 refs # Get array field
805+
")]
660806
Get {
661807
/// Work item ID
662808
id: String,
663809
/// Field name (omit to show all)
664810
field: Option<String>,
665811
},
666812
/// Set work item field value
813+
#[command(after_help = "\
814+
VALID FIELDS:
815+
String fields (use 'set'):
816+
- description: Task scope declaration
817+
- status: Work item status (queue|active|done|cancelled)
818+
819+
Array fields (use 'add'/'remove' instead):
820+
- refs, journal, notes, acceptance_criteria
821+
822+
EXAMPLES:
823+
govctl work set WI-001 description \"New description\"
824+
govctl work set WI-001 status active
825+
govctl work set WI-001 description --stdin <<'EOF'
826+
Multi-line description here
827+
EOF
828+
")]
667829
Set {
668830
/// Work item ID
669831
id: String,
@@ -677,10 +839,31 @@ EXAMPLES:
677839
stdin: bool,
678840
},
679841
/// Add value to work item array field
842+
#[command(after_help = "\
843+
VALID ARRAY FIELDS:
844+
- refs: Cross-references to RFCs/ADRs (e.g., \"RFC-0001\", \"ADR-0002\")
845+
- journal: Execution tracking entries (multi-line via --stdin)
846+
- notes: Ad-hoc key points (short strings)
847+
- acceptance_criteria: Completion criteria with category prefix
848+
849+
ACCEPTANCE CRITERIA FORMAT:
850+
Use category prefix for changelog generation:
851+
- \"add: New feature\" → Added section
852+
- \"fix: Bug fixed\" → Fixed section
853+
- \"changed: Behavior\" → Changed section
854+
- \"chore: Tests pass\" → Excluded from changelog
855+
856+
EXAMPLES:
857+
govctl work add WI-001 refs RFC-0001
858+
govctl work add WI-001 acceptance_criteria \"add: Implement feature\"
859+
govctl work add WI-001 journal --stdin <<'EOF'
860+
Progress update for today...
861+
EOF
862+
")]
680863
Add {
681864
/// Work item ID
682865
id: String,
683-
/// Array field name (e.g., refs, acceptance_criteria)
866+
/// Array field name (refs, journal, notes, acceptance_criteria)
684867
field: String,
685868
/// Value to add (optional if --stdin)
686869
value: Option<String>,
@@ -692,10 +875,26 @@ EXAMPLES:
692875
category: Option<model::ChangelogCategory>,
693876
},
694877
/// Remove value from work item array field
878+
#[command(after_help = "\
879+
VALID ARRAY FIELDS:
880+
- refs, journal, notes, acceptance_criteria
881+
882+
MATCHING OPTIONS:
883+
- pattern: Substring match (default)
884+
- --at N: Remove by index (1-based, negative = from end)
885+
- --exact: Exact string match
886+
- --regex: Regex pattern match
887+
- --all: Remove all matches
888+
889+
EXAMPLES:
890+
govctl work remove WI-001 refs RFC-0001 # Remove first match
891+
govctl work remove WI-001 refs --at 1 # Remove by index
892+
govctl work remove WI-001 notes --all # Remove all
893+
")]
695894
Remove {
696895
/// Work item ID
697896
id: String,
698-
/// Array field name
897+
/// Array field name (refs, journal, notes, acceptance_criteria)
699898
field: String,
700899
/// Pattern to match
701900
#[arg(required_unless_present = "at")]

0 commit comments

Comments
 (0)