gsdd-cli 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,21 +15,49 @@ export const DEFAULT_GIT_PROTOCOL = {
15
15
  pr: 'Follow the existing repo or team review workflow. Do not assume PR creation, timing, or naming unless explicitly requested.',
16
16
  };
17
17
 
18
+ // The rigor knob: one setting that decides how much the assistant does on its own
19
+ // versus how much it shows you and asks. low = autopilot; max = most hands-on.
20
+ // showCode + askBeforeDecide are read by the workflow markdown (=== true means on,
21
+ // a missing key means off), so existing projects whose config predates these flags
22
+ // are unaffected.
18
23
  export const RIGOR_PROFILES = {
19
- quick: { researchDepth: 'fast', workflow: { research: false, discuss: false, planCheck: false, verifier: true } },
20
- balanced: { researchDepth: 'balanced', workflow: { research: true, discuss: false, planCheck: true, verifier: true } },
21
- thorough: { researchDepth: 'deep', workflow: { research: true, discuss: true, planCheck: true, verifier: true } },
24
+ low: { researchDepth: 'fast', workflow: { research: false, discuss: false, planCheck: false, verifier: true, showCode: false, askBeforeDecide: false } },
25
+ medium: { researchDepth: 'balanced', workflow: { research: true, discuss: false, planCheck: true, verifier: true, showCode: false, askBeforeDecide: false } },
26
+ high: { researchDepth: 'deep', workflow: { research: true, discuss: true, planCheck: true, verifier: true, showCode: true, askBeforeDecide: false } },
27
+ max: { researchDepth: 'deep', workflow: { research: true, discuss: true, planCheck: true, verifier: true, showCode: true, askBeforeDecide: true } },
22
28
  };
23
29
 
30
+ // Legacy rigor names map silently to the new levels so old configs and callers keep
31
+ // working. medium is behaviorally identical to the old balanced default.
32
+ export const RIGOR_ALIASES = { quick: 'low', balanced: 'medium', thorough: 'high' };
33
+
34
+ export const RIGOR_LEVELS = ['low', 'medium', 'high', 'max'];
35
+ export const RIGOR_STEPS = ['plan', 'execute', 'verify'];
36
+
24
37
  export const COST_PROFILES = {
25
38
  budget: { modelProfile: 'budget', parallelization: false },
26
39
  balanced: { modelProfile: 'balanced', parallelization: true },
27
40
  quality: { modelProfile: 'quality', parallelization: true },
28
41
  };
29
42
 
30
- export function resolveRigor(id) { return RIGOR_PROFILES[id] ?? RIGOR_PROFILES.balanced; }
43
+ export function resolveRigor(id) {
44
+ const key = RIGOR_ALIASES[id] ?? id;
45
+ return RIGOR_PROFILES[key] ?? RIGOR_PROFILES.medium;
46
+ }
31
47
  export function resolveCost(id) { return COST_PROFILES[id] ?? COST_PROFILES.balanced; }
32
48
 
49
+ // Per-step rigor: an explicit rigorOverrides[step] wins, else the project rigorProfile,
50
+ // else medium. A missing override is not "off" — it just means "follow the main knob".
51
+ export function resolveStepRigor(config, step) {
52
+ const overrideName = config?.rigorOverrides?.[step];
53
+ const baseName = config?.rigorProfile;
54
+ return resolveRigor(overrideName ?? baseName ?? 'medium');
55
+ }
56
+
57
+ export function effectiveRigorLevel(config, step) {
58
+ return config?.rigorOverrides?.[step] ?? config?.rigorProfile ?? 'medium';
59
+ }
60
+
33
61
  export const VALID_MODEL_PROFILES = ['quality', 'balanced', 'budget'];
34
62
  export const PORTABLE_AGENT_IDS = ['plan-checker', 'approach-explorer'];
35
63
  export const MODEL_RUNTIME_IDS = ['claude', 'opencode', 'codex'];
@@ -40,9 +68,10 @@ export function normalizeModelProfile(value) {
40
68
  }
41
69
 
42
70
  export function buildDefaultConfig({ autoAdvance = false } = {}) {
43
- const rigor = resolveRigor('balanced');
71
+ const rigor = resolveRigor('medium');
44
72
  const cost = resolveCost('balanced');
45
73
  const config = {
74
+ rigorProfile: 'medium',
46
75
  ...rigor,
47
76
  ...cost,
48
77
  commitDocs: true,
@@ -409,3 +438,105 @@ function cmdModelsClearRuntimeOverride(args) {
409
438
  console.log(` - cleared ${runtime} runtime override for ${agent}`);
410
439
  console.log(' Run gsdd update to regenerate adapter files.');
411
440
  }
441
+
442
+ // --- The rigor knob ---------------------------------------------------------
443
+ // gsdd rigor -> show the current level + per-step overrides
444
+ // gsdd rigor <low|medium|high|max>-> set the project-wide level
445
+ // gsdd rigor <plan|execute|verify> <level> -> override a single step
446
+
447
+ function describeRigorFlags(config) {
448
+ const w = config.workflow ?? {};
449
+ return {
450
+ researchDepth: config.researchDepth,
451
+ research: w.research,
452
+ discuss: w.discuss,
453
+ planCheck: w.planCheck,
454
+ verifier: w.verifier,
455
+ showCode: w.showCode,
456
+ askBeforeDecide: w.askBeforeDecide,
457
+ };
458
+ }
459
+
460
+ function printChangedFlags(before, after) {
461
+ for (const key of Object.keys(after)) {
462
+ if (before[key] !== after[key]) {
463
+ console.log(` ${key}: ${before[key]} -> ${after[key]}`);
464
+ }
465
+ }
466
+ }
467
+
468
+ export function cmdRigor(...rigorArgs) {
469
+ const [first, second] = rigorArgs;
470
+ if (!first || first === 'show') return cmdRigorShow();
471
+ if (RIGOR_STEPS.includes(first)) return cmdRigorSetStep(first, second);
472
+ if (RIGOR_LEVELS.includes(first)) return cmdRigorSetProfile(first);
473
+ console.error(
474
+ `ERROR: Invalid rigor argument "${first}". Usage: gsdd rigor [show | ${RIGOR_LEVELS.join('|')} | <${RIGOR_STEPS.join('|')}> <level>]`,
475
+ );
476
+ process.exitCode = 1;
477
+ }
478
+
479
+ function cmdRigorShow() {
480
+ const config = loadProjectModelConfig(process.cwd());
481
+ const base = config.rigorProfile ?? 'medium';
482
+ output({
483
+ rigorProfile: base,
484
+ rigorOverrides: config.rigorOverrides ?? {},
485
+ effective: {
486
+ plan: effectiveRigorLevel(config, 'plan'),
487
+ execute: effectiveRigorLevel(config, 'execute'),
488
+ verify: effectiveRigorLevel(config, 'verify'),
489
+ },
490
+ workflow: config.workflow ?? resolveRigor(base).workflow,
491
+ });
492
+ }
493
+
494
+ function cmdRigorSetProfile(level) {
495
+ if (!isProjectInitialized()) {
496
+ console.error('ERROR: Project not initialized. Run gsdd init first.');
497
+ process.exitCode = 1;
498
+ return;
499
+ }
500
+ const result = loadConfigForMutation();
501
+ if (!result.ok) {
502
+ console.error(`ERROR: .planning/config.json is malformed (${result.error}). Fix the file manually before running rigor mutations.`);
503
+ process.exitCode = 1;
504
+ return;
505
+ }
506
+
507
+ const before = describeRigorFlags(result.config);
508
+ const resolved = resolveRigor(level);
509
+ result.config.rigorProfile = level;
510
+ result.config.researchDepth = resolved.researchDepth;
511
+ result.config.workflow = { ...resolved.workflow };
512
+ const after = describeRigorFlags(result.config);
513
+ writeProjectConfig(result.config);
514
+
515
+ console.log(` - set rigor to ${level}`);
516
+ printChangedFlags(before, after);
517
+ }
518
+
519
+ function cmdRigorSetStep(step, level) {
520
+ if (!RIGOR_LEVELS.includes(level)) {
521
+ console.error(`ERROR: Invalid rigor level "${level}". Valid levels: ${RIGOR_LEVELS.join(', ')}`);
522
+ process.exitCode = 1;
523
+ return;
524
+ }
525
+ if (!isProjectInitialized()) {
526
+ console.error('ERROR: Project not initialized. Run gsdd init first.');
527
+ process.exitCode = 1;
528
+ return;
529
+ }
530
+ const result = loadConfigForMutation();
531
+ if (!result.ok) {
532
+ console.error(`ERROR: .planning/config.json is malformed (${result.error}). Fix the file manually before running rigor mutations.`);
533
+ process.exitCode = 1;
534
+ return;
535
+ }
536
+
537
+ result.config.rigorOverrides = result.config.rigorOverrides || {};
538
+ const previous = result.config.rigorOverrides[step] ?? `(follows ${result.config.rigorProfile ?? 'medium'})`;
539
+ result.config.rigorOverrides[step] = level;
540
+ writeProjectConfig(result.config);
541
+ console.log(` - set ${step} rigor override: ${previous} -> ${level}`);
542
+ }