feat(#703): add --granularity override flag to /gsd:plan-phase (#750)

* feat(#703): add --granularity override flag to /gsd:plan-phase

Add a `--granularity <coarse|standard|fine>` flag to /gsd:plan-phase that
overrides the configured planning granularity for a single invocation.

The override is a new highest-priority tier above the existing precedence
chain (granularities[phaseType] -> granularity -> planning.granularity ->
'standard') in resolveGranularityInternal; when the flag is absent, resolution
is byte-for-byte unchanged. cmdInitPlanPhase now resolves with phaseType
'planning' so granularities.planning participates, and emits the resolved
value in the init JSON, which the plan-phase workflow forwards to the planner
prompt. Invalid values are rejected at the CLI boundary via a shared
assertValidGranularityOverride helper.

Closes #703

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore(#703): set changeset pr to 750

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-06-06 23:56:53 -04:00
committed by GitHub
parent cf8bd3cd5e
commit 7e76f1a736
11 changed files with 255 additions and 10 deletions

View File

@@ -547,7 +547,22 @@ async function runCommand(command, args, cwd, raw, defaultValue, originalCommand
}
case 'resolve-granularity': {
commands.cmdResolveGranularity(cwd, args[1], raw);
// Parse optional --granularity <val> flag (space form only); positional is phase-type.
// The =form (--granularity=<val>) is intentionally not supported: parseNamedArgs and
// the /gsd:plan-phase + init plan-phase paths accept only the space form, so supporting
// = here alone would create an inconsistency (#703).
const granArgs = args.slice(1);
let granOverride;
const granPositionals = [];
for (let i = 0; i < granArgs.length; i++) {
const a = granArgs[i];
if (a === '--granularity' && granArgs[i + 1] !== undefined && !granArgs[i + 1].startsWith('--')) {
if (granOverride === undefined) { granOverride = granArgs[++i]; } else { ++i; }
} else {
granPositionals.push(a);
}
}
commands.cmdResolveGranularity(cwd, granPositionals[0], raw, granOverride);
break;
}