refactor: rename depth setting to granularity (closes #879)

The "depth" setting with values quick/standard/comprehensive implied
investigation thoroughness, but it only controls phase count. Renamed to
"granularity" with values coarse/standard/fine to accurately reflect what
it controls: how finely scope is sliced into phases.

Includes backward-compatible migration in loadConfig and config-ensure
that auto-renames depth→granularity with value mapping in both
.planning/config.json and ~/.gsd/defaults.json.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson
2026-03-03 10:53:34 -06:00
parent e2b6179ba7
commit c298a1a4dc
10 changed files with 58 additions and 43 deletions

View File

@@ -37,6 +37,13 @@ function cmdConfigEnsureSection(cwd, raw) {
try {
if (fs.existsSync(globalDefaultsPath)) {
userDefaults = JSON.parse(fs.readFileSync(globalDefaultsPath, 'utf-8'));
// Migrate deprecated "depth" key to "granularity"
if ('depth' in userDefaults && !('granularity' in userDefaults)) {
const depthToGranularity = { quick: 'coarse', standard: 'standard', comprehensive: 'fine' };
userDefaults.granularity = depthToGranularity[userDefaults.depth] || userDefaults.depth;
delete userDefaults.depth;
try { fs.writeFileSync(globalDefaultsPath, JSON.stringify(userDefaults, null, 2), 'utf-8'); } catch {}
}
}
} catch (err) {
// Ignore malformed global defaults, fall back to hardcoded

View File

@@ -85,6 +85,14 @@ function loadConfig(cwd) {
const raw = fs.readFileSync(configPath, 'utf-8');
const parsed = JSON.parse(raw);
// Migrate deprecated "depth" key to "granularity" with value mapping
if ('depth' in parsed && !('granularity' in parsed)) {
const depthToGranularity = { quick: 'coarse', standard: 'standard', comprehensive: 'fine' };
parsed.granularity = depthToGranularity[parsed.depth] || parsed.depth;
delete parsed.depth;
try { fs.writeFileSync(configPath, JSON.stringify(parsed, null, 2), 'utf-8'); } catch {}
}
const get = (key, nested) => {
if (parsed[key] !== undefined) return parsed[key];
if (nested && parsed[nested.section] && parsed[nested.section][nested.field] !== undefined) {

View File

@@ -1,6 +1,6 @@
{
"mode": "interactive",
"depth": "standard",
"granularity": "standard",
"workflow": {
"research": true,
"plan_check": true,

View File

@@ -105,7 +105,7 @@ Phases execute in numeric order: 2 → 2.1 → 2.2 → 3 → 3.1 → 4
<guidelines>
**Initial planning (v1.0):**
- Phase count depends on depth setting (quick: 3-5, standard: 5-8, comprehensive: 8-12)
- Phase count depends on granularity setting (coarse: 3-5, standard: 5-8, fine: 8-12)
- Each phase delivers something coherent
- Phases can have 1+ plans (split if >3 tasks or multiple subsystems)
- Plans use naming: {phase}-{plan}-PLAN.md (e.g., 01-02-PLAN.md)

View File

@@ -14,7 +14,7 @@ Check if `--auto` flag is present in $ARGUMENTS.
**If auto mode:**
- Skip brownfield mapping offer (assume greenfield)
- Skip deep questioning (extract context from provided document)
- Config: YOLO mode is implicit (skip that question), but ask depth/git/agents FIRST (Step 2a)
- Config: YOLO mode is implicit (skip that question), but ask granularity/git/agents FIRST (Step 2a)
- After config: run Steps 6-9 automatically with smart defaults:
- Research: Always yes
- Requirements: Include all table stakes + features from provided document
@@ -90,13 +90,13 @@ YOLO mode is implicit (auto = YOLO). Ask remaining config questions:
```
AskUserQuestion([
{
header: "Depth",
question: "How thorough should planning be?",
header: "Granularity",
question: "How finely should scope be sliced into phases?",
multiSelect: false,
options: [
{ label: "Quick (Recommended)", description: "Ship fast (3-5 phases, 1-3 plans each)" },
{ label: "Standard", description: "Balanced scope and speed (5-8 phases, 3-5 plans each)" },
{ label: "Comprehensive", description: "Thorough coverage (8-12 phases, 5-10 plans each)" }
{ label: "Coarse (Recommended)", description: "Fewer, broader phases (3-5 phases, 1-3 plans each)" },
{ label: "Standard", description: "Balanced phase size (5-8 phases, 3-5 plans each)" },
{ label: "Fine", description: "Many focused phases (8-12 phases, 5-10 plans each)" }
]
},
{
@@ -169,7 +169,7 @@ Create `.planning/config.json` with mode set to "yolo":
```json
{
"mode": "yolo",
"depth": "[selected]",
"granularity": "[selected]",
"parallelization": true|false,
"commit_docs": true|false,
"model_profile": "quality|balanced|budget",
@@ -379,13 +379,13 @@ questions: [
]
},
{
header: "Depth",
question: "How thorough should planning be?",
header: "Granularity",
question: "How finely should scope be sliced into phases?",
multiSelect: false,
options: [
{ label: "Quick", description: "Ship fast (3-5 phases, 1-3 plans each)" },
{ label: "Standard", description: "Balanced scope and speed (5-8 phases, 3-5 plans each)" },
{ label: "Comprehensive", description: "Thorough coverage (8-12 phases, 5-10 plans each)" }
{ label: "Coarse", description: "Fewer, broader phases (3-5 phases, 1-3 plans each)" },
{ label: "Standard", description: "Balanced phase size (5-8 phases, 3-5 plans each)" },
{ label: "Fine", description: "Many focused phases (8-12 phases, 5-10 plans each)" }
]
},
{
@@ -468,7 +468,7 @@ Create `.planning/config.json` with all settings:
```json
{
"mode": "yolo|interactive",
"depth": "quick|standard|comprehensive",
"granularity": "coarse|standard|fine",
"parallelization": true|false,
"commit_docs": true|false,
"model_profile": "quality|balanced|budget",
@@ -903,7 +903,7 @@ Task(prompt="
- .planning/PROJECT.md (Project context)
- .planning/REQUIREMENTS.md (v1 Requirements)
- .planning/research/SUMMARY.md (Research findings - if exists)
- .planning/config.json (Depth and mode settings)
- .planning/config.json (Granularity and mode settings)
</files_to_read>
</planning_context>
@@ -1090,7 +1090,7 @@ Exit skill and invoke SlashCommand("/gsd:discuss-phase 1 --auto")
- [ ] Brownfield detection completed
- [ ] Deep questioning completed (threads followed, not rushed)
- [ ] PROJECT.md captures full context → **committed**
- [ ] config.json has workflow mode, depth, parallelization → **committed**
- [ ] config.json has workflow mode, granularity, parallelization → **committed**
- [ ] Research completed (if selected) — 4 parallel agents spawned → **committed**
- [ ] Requirements gathered (from research or conversation)
- [ ] User scoped each category (v1/v2/out of scope)

View File

@@ -157,7 +157,7 @@ Write `~/.gsd/defaults.json` with:
```json
{
"mode": <current>,
"depth": <current>,
"granularity": <current>,
"model_profile": <current>,
"commit_docs": <current>,
"parallelization": <current>,