Merge branch 'open-gsd:next' into kimi-runtime-support

This commit is contained in:
Viktorplus
2026-06-07 00:53:20 +02:00
committed by GitHub
15 changed files with 245 additions and 51 deletions

View File

@@ -21,6 +21,7 @@
*/
const { execNpm } = require('./lib/shell-command-projection.cjs');
const { runMain } = require('./lib/cli-exit.cjs');
// Sourced from the single Package Identity seam (#498), not re-typed. The seam
// bakes the value from package.json at build time, so it is a code constant —
@@ -98,9 +99,9 @@ function main() {
} else {
process.stderr.write(`check-latest-version: ${r.reason}: ${r.detail}\n`);
}
process.exit(r.ok ? 0 : 1);
return r.ok ? 0 : 1;
}
if (require.main === module) main();
if (require.main === module) runMain(main);
module.exports = { checkLatestVersion, CHECK_REASON, PACKAGE_NAME };

View File

@@ -170,6 +170,7 @@
const fs = require('fs');
const path = require('path');
const { ExitError, runMain } = require('./lib/cli-exit.cjs');
const core = require('./lib/core.cjs');
const { error, ERROR_REASON } = core;
// Resolve findProjectRoot lazily at call time rather than binding it at module
@@ -1527,33 +1528,26 @@ async function runCommand(command, args, cwd, raw, defaultValue, originalCommand
// ── Validate required args ─────────────────────────────────────────
if (!budgetStr) {
process.stderr.write('Error: --budget <N> is required\n');
process.exit(1);
throw new ExitError(1, 'Error: --budget <N> is required');
}
const budget = parseInt(budgetStr, 10);
if (!Number.isFinite(budget) || budget <= 0) {
process.stderr.write('Error: --budget must be a positive integer\n');
process.exit(1);
throw new ExitError(1, 'Error: --budget must be a positive integer');
}
if (!instructionsFile) {
process.stderr.write('Error: --instructions-file <path> is required\n');
process.exit(1);
throw new ExitError(1, 'Error: --instructions-file <path> is required');
}
if (!roadmapFile) {
process.stderr.write('Error: --roadmap-file <path> is required\n');
process.exit(1);
throw new ExitError(1, 'Error: --roadmap-file <path> is required');
}
if (planFiles.length === 0) {
process.stderr.write('Error: at least one --plan-file <path> is required\n');
process.exit(1);
throw new ExitError(1, 'Error: at least one --plan-file <path> is required');
}
if (!outputPromptFile) {
process.stderr.write('Error: --output-prompt <path> is required\n');
process.exit(1);
throw new ExitError(1, 'Error: --output-prompt <path> is required');
}
if (!outputMetadataFile) {
process.stderr.write('Error: --output-metadata <path> is required\n');
process.exit(1);
throw new ExitError(1, 'Error: --output-metadata <path> is required');
}
// ── Validate and read required files ──────────────────────────────
@@ -1563,11 +1557,9 @@ async function runCommand(command, args, cwd, raw, defaultValue, originalCommand
return await fs.promises.readFile(resolved, 'utf8');
} catch (err) {
if (err && err.code === 'ENOENT') {
process.stderr.write(`Error: file not found for ${flagName}: ${resolved}\n`);
process.exit(1);
throw new ExitError(1, `Error: file not found for ${flagName}: ${resolved}`);
}
process.stderr.write(`Error: cannot read file for ${flagName}: ${resolved}\n`);
process.exit(1);
throw new ExitError(1, `Error: cannot read file for ${flagName}: ${resolved}`);
}
}
@@ -1578,8 +1570,7 @@ async function runCommand(command, args, cwd, raw, defaultValue, originalCommand
return await fs.promises.readFile(resolved, 'utf8');
} catch (err) {
if (err && err.code === 'ENOENT') return null;
process.stderr.write(`Error: cannot read optional file: ${resolved}\n`);
process.exit(1);
throw new ExitError(1, `Error: cannot read optional file: ${resolved}`);
}
}
@@ -1592,11 +1583,9 @@ async function runCommand(command, args, cwd, raw, defaultValue, originalCommand
return { file: path.basename(p), content };
} catch (err) {
if (err && err.code === 'ENOENT') {
process.stderr.write(`Error: plan file not found: ${resolved}\n`);
process.exit(1);
throw new ExitError(1, `Error: plan file not found: ${resolved}`);
}
process.stderr.write(`Error: cannot read plan file: ${resolved}\n`);
process.exit(1);
throw new ExitError(1, `Error: cannot read plan file: ${resolved}`);
}
}));
@@ -1625,7 +1614,7 @@ async function runCommand(command, args, cwd, raw, defaultValue, originalCommand
await fs.promises.writeFile(path.resolve(outputPromptFile), prompt);
if (metadata.hardFailed) {
process.exit(2);
throw new ExitError(2);
}
break;
}
@@ -1895,4 +1884,4 @@ async function runCommand(command, args, cwd, raw, defaultValue, originalCommand
}
}
main();
runMain(main);

View File

@@ -32,6 +32,7 @@
const fs = require('node:fs');
const path = require('node:path');
const crypto = require('node:crypto');
const { ExitError, runMain } = require('./lib/cli-exit.cjs');
const SIGNIFICANT_MIN_CHARS = 12;
const GSD_HOOK_VERSION_LINE_RE = /^(?:\/\/|#)\s*gsd-hook-version:\s*\S+\s*$/i;
@@ -48,10 +49,9 @@ function parseArgs(argv) {
process.stdout.write(
'usage: verify-reapply-patches.cjs --patches-dir <path> --config-dir <path> [--pristine-dir <path>] [--json]\n',
);
process.exit(0);
throw new ExitError(0);
} else {
process.stderr.write(`unknown argument: ${arg}\n`);
process.exit(2);
throw new ExitError(2, `unknown argument: ${arg}`);
}
}
return opts;
@@ -281,16 +281,13 @@ function verifyFile({ relPath, patchesDir, configDir, pristineDir, pristineHashe
function main() {
const opts = parseArgs(process.argv.slice(2));
if (!opts.patchesDir || !opts.configDir) {
process.stderr.write('--patches-dir and --config-dir are required\n');
process.exit(2);
throw new ExitError(2, '--patches-dir and --config-dir are required');
}
if (!fs.existsSync(opts.patchesDir)) {
process.stderr.write(`patches dir not found: ${opts.patchesDir}\n`);
process.exit(2);
throw new ExitError(2, `patches dir not found: ${opts.patchesDir}`);
}
if (!fs.existsSync(opts.configDir)) {
process.stderr.write(`config dir not found: ${opts.configDir}\n`);
process.exit(2);
throw new ExitError(2, `config dir not found: ${opts.configDir}`);
}
const files = walk(opts.patchesDir).filter((f) => !f.endsWith('backup-meta.json'));
@@ -342,11 +339,11 @@ function main() {
}
}
process.exit(failures.length > 0 ? 1 : 0);
return failures.length > 0 ? 1 : 0;
}
if (require.main === module) {
main();
runMain(main);
}
module.exports = { computeUserAddedLines, isSignificantLine, verifyFile, walk, REASON, readPristineHashes, sha256 };

View File

@@ -188,7 +188,7 @@ if [ "$MVP_MODE" = "true" ] && [ "$TDD_MODE" = "true" ]; then
fi
fi
```
Pure doc-only / config-only / test-only tasks return `is_behavior_adding=false` and are exempt. See `execute-mvp-tdd.md` for the halt report format.
Pure doc-only / config-only / test-only tasks return `is_behavior_adding=false` and are exempt. When the gate trips, Read `~/.claude/gsd-core/references/execute-mvp-tdd.md` for the exact halt report format.
</step>
<step name="check_blocking_antipatterns" priority="first">

View File

@@ -143,7 +143,7 @@ fi
```
When `WALKING_SKELETON=true`:
- Planner is instructed to produce `SKELETON.md` in the phase directory alongside `PLAN.md`. The template lives at `@~/.claude/gsd-core/references/skeleton-template.md`.
- Planner is instructed to produce `SKELETON.md` in the phase directory alongside `PLAN.md`. The template lives at `~/.claude/gsd-core/references/skeleton-template.md` — the planner reads it when producing SKELETON.md (lazy; not loaded on non-skeleton runs).
- The plan must scaffold project + routing + one real DB read/write + one real UI interaction + dev deployment — the thinnest possible end-to-end working slice.
**Interaction with `--prd <filepath>`.** `--mvp` and `--prd` compose. The PRD express path (Step 3.5) creates `CONTEXT.md` from the PRD file and continues to research; the Walking Skeleton gate fires independently from the conditions above. When both are active on Phase 1 of a new project, the planner receives `WALKING_SKELETON=true` and PRD-derived context simultaneously — the PRD informs *what the skeleton should prove*. No precedence is needed; the two signals are orthogonal. See [`references/mvp-concepts.md`](../references/mvp-concepts.md) for the broader interaction map.
@@ -933,12 +933,12 @@ Each TDD plan gets one feature with RED/GREEN/REFACTOR gate sequence.
</tdd_mode_active>
` : ''}
**MVP_MODE:** ${MVP_MODE} (when true, follow vertical-slice rules from `@~/.claude/gsd-core/references/planner-mvp-mode.md`; when false, ignore MVP guidance entirely.)
**WALKING_SKELETON:** ${WALKING_SKELETON} (when true, the first deliverable must be a Walking Skeleton — produce SKELETON.md alongside PLAN.md.)
**MVP_MODE:** ${MVP_MODE} (when true, follow vertical-slice rules from `~/.claude/gsd-core/references/planner-mvp-mode.md`; when false, ignore MVP guidance entirely.)
**WALKING_SKELETON:** ${WALKING_SKELETON} (when true, the first deliverable must be a Walking Skeleton — Read the template at `~/.claude/gsd-core/references/skeleton-template.md` and produce SKELETON.md alongside PLAN.md.)
${MVP_MODE === 'true' ? `
<mvp_mode_active>
**MVP Mode is ENABLED.** Follow vertical-slice planning rules from @~/.claude/gsd-core/references/planner-mvp-mode.md. Each plan must deliver a complete vertical slice — thin end-to-end functionality rather than horizontal layers.
**MVP Mode is ENABLED.** Read `~/.claude/gsd-core/references/planner-mvp-mode.md` now and follow its vertical-slice planning rules. Each plan must deliver a complete vertical slice — thin end-to-end functionality rather than horizontal layers.
</mvp_mode_active>
` : ''}
</planning_context>