use clap::Subcommand;
#[derive(Subcommand, Clone, Debug)]
pub(crate) enum LoopCommand {
#[command(after_help = "\
EXAMPLES:
govctl loop list
govctl loop list open
govctl loop list paused -n 5
govctl loop list -o plain
govctl loop list -o json
NOTES:
- Reads local state from `.govctl/loops/<LOOP-ID>/state.toml`.
- Lists loops by canonical loop ID in deterministic order.
- Filter may be a loop lifecycle state, `open`, `resumable`, loop ID, or work item ID.
")]
List {
filter: Option<String>,
#[arg(short = 'n', long)]
limit: Option<usize>,
#[arg(short = 'o', long, value_enum, default_value = "table")]
output: crate::OutputFormat,
},
#[command(after_help = "\
EXAMPLES:
govctl loop start WI-2026-04-06-001
govctl loop start --id LOOP-2026-04-06-001 WI-2026-04-06-001 WI-2026-04-06-002
NOTES:
- Resolves transitive `depends_on` dependencies before writing state.
- Reuses an existing non-terminal loop with the same explicit work set when unambiguous.
")]
Start {
#[arg(long)]
id: Option<String>,
#[arg(required = true, value_name = "WI-ID")]
work_ids: Vec<String>,
},
#[command(after_help = "\
EXAMPLES:
govctl loop show LOOP-2026-04-06-001
")]
Show {
id: String,
},
#[command(after_help = "\
EXAMPLES:
govctl loop resume LOOP-2026-04-06-001
NOTES:
- Resumes by explicit loop ID.
")]
Resume {
id: String,
},
#[command(after_help = "\
EXAMPLES:
govctl loop replan LOOP-2026-04-06-001
NOTES:
- Re-reads current work item files and preserves applicable loop item state.
")]
Replan {
id: String,
},
#[command(after_help = "\
EXAMPLES:
govctl loop add LOOP-2026-04-06-001 work WI-2026-04-06-002
govctl loop add LOOP-2026-04-06-001 wi WI-2026-04-06-002
NOTES:
- `work` is the editable loop work item field.
- `wi` is accepted as a shorthand field alias.
- The resolved dependency closure is recomputed after changing work.
")]
Add {
id: String,
field: String,
#[arg(value_name = "WI-ID")]
value: String,
},
#[command(after_help = "\
EXAMPLES:
govctl loop remove LOOP-2026-04-06-001 work WI-2026-04-06-002
govctl loop remove LOOP-2026-04-06-001 wi WI-2026-04-06-002
NOTES:
- `work` is the editable loop work item field.
- `wi` is accepted as a shorthand field alias.
- The resolved dependency closure is recomputed after changing work.
")]
Remove {
id: String,
field: String,
#[arg(value_name = "WI-ID")]
value: String,
},
#[command(after_help = "\
EXAMPLES:
govctl loop run LOOP-2026-04-06-001
govctl loop run LOOP-2026-04-06-001 --max-rounds 2
govctl loop run LOOP-2026-04-06-001 --work WI-2026-04-06-002
NOTES:
- Opens a loop-level round when no open round exists.
- Validates summary evidence when an open round exists.
- Use --work to select target work items inside the loop when opening a round.
- Does not change Work Item lifecycle state; use `govctl work move` explicitly.
")]
Run {
id: String,
#[arg(long, default_value_t = 1)]
max_rounds: u32,
#[arg(long = "work", value_name = "WI-ID")]
target_work_ids: Vec<String>,
},
}