fix(workstream): require name arg for set, add --clear flag (#1527)

workstream set with no argument silently cleared the active workstream,
a footgun for users who forgot the name. Now requires a name arg and
errors with usage hint. Explicit clearing via --clear flag, which also
reports the previous workstream in its output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tibsfox
2026-04-01 14:35:00 -07:00
parent 5eed6973b8
commit 89f82d5483
2 changed files with 24 additions and 2 deletions

View File

@@ -339,9 +339,13 @@ function cmdWorkstreamComplete(cwd, name, options, raw) {
// ─── Active Workstream Commands ──────────────────────────────────────────────
function cmdWorkstreamSet(cwd, name, raw) {
if (!name) {
if (!name || name === '--clear') {
if (name !== '--clear') {
error('Workstream name required. Usage: workstream set <name> (or workstream set --clear to unset)');
}
const previous = getActiveWorkstream(cwd);
setActiveWorkstream(cwd, null);
output({ active: null, cleared: true }, raw);
output({ active: null, cleared: true, previous: previous || null }, raw);
return;
}