Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Invoke them by name (e.g., `/office-hours`).
```bash
bun install # install dependencies
bun test # run free tests (no API spend)
bun run test:build-skill # focused verification for /build skill changes
bun run test:windows # curated Windows-safe subset (runs on windows-latest)
bun run build # generate docs + compile binaries
bun run gen:skill-docs # regenerate SKILL.md files from templates
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## [1.26.5.0] - 2026-05-05

### Added

- `/build` changes now have a dedicated `test:build-skill` verification path
covering build skill contract tests, role routing defaults, CLI parser and
gate tests, dry-run orchestrator flows, and generated skill freshness checks.
- Build orchestrator dry-run coverage now includes legacy two-checkbox plans,
dual-implementation tournament mode, parallel phase planning, failed
dependency planning, Codex-dominant role defaults, and disabled secondary
review gates.
- `/build` skill handoff now has a periodic live E2E test that verifies the
skill invokes the resolved `gstack-build` CLI with the plan path and
`--project-root`, plus touchfile metadata so targeted E2E runs pick it up when
build-related files change.

## [1.26.4.0] - 2026-05-05

### Changed
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.26.4.0
1.26.5.0
48 changes: 48 additions & 0 deletions build/orchestrator/__tests__/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,52 @@ test("dry-run TDD plan announces Test Specification and Verify Red for each phas
expect(result.status).toBe(0);
});

test("dry-run legacy two-checkbox plan skips TDD red/green steps but completes", () => {
const legacyPlanFile = path.join(tmpDir, "legacy-plan.md");
fs.writeFileSync(
legacyPlanFile,
`# Legacy Integration Plan

## Feature 1: Legacy

### Phase 1: Legacy parser
- [ ] **Implementation (Gemini Sub-agent)**: Implement parser behavior.
- [ ] **Review & QA (Codex Sub-agent)**: Review parser behavior.
`,
);
const cliPath = path.resolve(import.meta.dir, "../cli.ts");
const result = spawnSync(
"bun",
[
"run",
cliPath,
legacyPlanFile,
"--dry-run",
"--test-cmd",
"bun test",
"--no-gbrain",
"--no-resume",
],
{
env: {
...process.env,
HOME: tmpDir,
GSTACK_HOME: path.join(tmpDir, ".gstack-legacy"),
},
encoding: "utf8",
timeout: 30_000,
},
);

const out = result.stdout + result.stderr;

expect(result.status).toBe(0);
expect(out).toContain("Phase 1");
expect(out).toContain("RUN_GEMINI");
expect(out).toContain("RUN_CODEX_REVIEW");
expect(out).not.toContain("Verify Red");
});

test("dry-run with --dual-impl announces Dual Impl, Judge, and Apply Winner", () => {
const cliPath = path.resolve(import.meta.dir, "../cli.ts");
const result = spawnSync(
Expand All @@ -74,6 +120,8 @@ test("dry-run with --dual-impl announces Dual Impl, Judge, and Apply Winner", ()
planFile,
"--dry-run",
"--dual-impl",
"--judge-provider",
"claude",
"--test-cmd",
"bun test",
"--no-gbrain",
Expand Down
35 changes: 35 additions & 0 deletions build/orchestrator/__tests__/skill-md.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { test, expect } from "bun:test";
import { spawnSync } from "node:child_process";
import * as fs from "node:fs";
import * as path from "node:path";

Expand Down Expand Up @@ -50,3 +51,37 @@ test("build skill and CLI do not hardcode default model names", () => {
expect(fs.readFileSync(files[0], "utf-8")).toContain("configure.cm");
expect(fs.readFileSync(files[1], "utf-8")).toContain("configure.cm");
});

test("build skill docs resolve gstack-build through _GSTACK_BUILD_CLI", () => {
const files = [
path.resolve(import.meta.dir, "../../SKILL.md.tmpl"),
path.resolve(import.meta.dir, "../../SKILL.md"),
path.resolve(import.meta.dir, "../../../.agents/skills/gstack-build/SKILL.md"),
];

for (const file of files) {
const content = fs.readFileSync(file, "utf-8");
expect(content).toContain("_GSTACK_BUILD_CLI");
expect(content).toContain("command -v gstack-build");
expect(content).toContain('"$_GSTACK_BUILD_CLI" "$_PLAN_FILE"');
expect(content).not.toContain('\ngstack-build "$_PLAN_FILE"');
expect(content).not.toContain(
'GSTACK_BUILD_GEMINI_TIMEOUT=1200000 gstack-build "$_PLAN_FILE"',
);
}
});

test("bin/gstack-build wrapper prints CLI help", () => {
const wrapperPath = path.resolve(import.meta.dir, "../../../bin/gstack-build");
const result = spawnSync(wrapperPath, ["--help"], {
cwd: path.resolve(import.meta.dir, "../../.."),
encoding: "utf8",
timeout: 30_000,
});
const out = result.stdout + result.stderr;

expect(result.status).toBe(0);
expect(out).toContain("gstack-build — code-driven phase orchestrator");
expect(out).toContain("Usage:");
expect(out).toContain("--dry-run");
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gstack",
"version": "1.26.4.0",
"version": "1.26.5.0",
"description": "Garry's Stack — Claude Code skills + fast headless browser. One repo, one install, entire AI engineering workflow.",
"license": "MIT",
"type": "module",
Expand All @@ -17,6 +17,7 @@
"dev": "bun run browse/src/cli.ts",
"server": "bun run browse/src/server.ts",
"test": "bun test browse/test/ test/ make-pdf/test/ --ignore 'test/skill-e2e-*.test.ts' --ignore test/skill-llm-eval.test.ts --ignore test/skill-routing-e2e.test.ts --ignore test/codex-e2e.test.ts --ignore test/gemini-e2e.test.ts && (bun run slop:diff 2>/dev/null || true)",
"test:build-skill": "bun test build/orchestrator/__tests__/skill-md.test.ts build/orchestrator/__tests__/integration.test.ts build/orchestrator/__tests__/cli.test.ts build/orchestrator/__tests__/role-config.test.ts test/gen-skill-docs.test.ts",
"test:free": "bun run scripts/test-free-shards.ts",
"test:windows": "bun run scripts/test-free-shards.ts --windows-only",
"test:evals": "EVALS=1 bun test --retry 2 --concurrent --max-concurrency ${EVALS_CONCURRENCY:-15} test/skill-llm-eval.test.ts test/skill-e2e-*.test.ts test/skill-routing-e2e.test.ts test/codex-e2e.test.ts test/gemini-e2e.test.ts",
Expand Down
15 changes: 12 additions & 3 deletions test/gen-skill-docs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ function isRepoRootSymlink(candidateDir: string): boolean {
}
}

function ensureCodexSkillDocs(): void {
const result = Bun.spawnSync(['bun', 'run', 'scripts/gen-skill-docs.ts', '--host', 'codex'], {
cwd: ROOT,
stdout: 'pipe',
stderr: 'pipe',
});
expect(result.exitCode).toBe(0);
}

// Dynamic template discovery — matches the generator's findTemplates() behavior.
// New skills automatically get test coverage without updating a static list.
const ALL_SKILLS = (() => {
Expand Down Expand Up @@ -1193,6 +1202,8 @@ describe('DESIGN_SKETCH resolver', () => {
// --- {{CODEX_SECOND_OPINION}} resolver tests ---

describe('CODEX_SECOND_OPINION resolver', () => {
ensureCodexSkillDocs();

const content = fs.readFileSync(path.join(ROOT, 'office-hours', 'SKILL.md'), 'utf-8');
const codexContent = fs.readFileSync(path.join(ROOT, '.agents', 'skills', 'gstack-office-hours', 'SKILL.md'), 'utf-8');

Expand Down Expand Up @@ -1596,9 +1607,7 @@ describe('Codex generation (--host codex)', () => {
const AGENTS_DIR = path.join(ROOT, '.agents', 'skills');

// .agents/ is gitignored (v0.11.2.0) — generate on demand for tests
Bun.spawnSync(['bun', 'run', 'scripts/gen-skill-docs.ts', '--host', 'codex'], {
cwd: ROOT, stdout: 'pipe', stderr: 'pipe',
});
ensureCodexSkillDocs();

// Dynamic discovery of expected Codex skills: all templates except /codex
// Also excludes skills where .agents/skills/{name} is a symlink back to the repo root
Expand Down
14 changes: 14 additions & 0 deletions test/helpers/touchfiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,17 @@ export const E2E_TOUCHFILES: Record<string, string[]> = {
// Global discover
'global-discover': ['bin/gstack-global-discover.ts', 'test/global-discover.test.ts'],

// Build
'build-skill-cli-handoff': [
'build/**',
'.agents/skills/gstack-build/**',
'bin/gstack-build',
'scripts/gen-skill-docs.ts',
'scripts/resolvers/index.ts',
'build/orchestrator/**',
'test/skill-e2e-build.test.ts',
],

// CSO
'cso-full-audit': ['cso/**'],
'cso-diff-mode': ['cso/**'],
Expand Down Expand Up @@ -496,6 +507,9 @@ export const E2E_TIERS: Record<string, 'gate' | 'periodic'> = {
// Global discover
'global-discover': 'gate',

// Build — live handoff is periodic because it uses an LLM session.
'build-skill-cli-handoff': 'periodic',

// CSO — gate for security guardrails, periodic for quality
'cso-full-audit': 'gate', // Hardcoded secrets detection
'cso-diff-mode': 'gate',
Expand Down
123 changes: 123 additions & 0 deletions test/skill-e2e-build.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import { test, expect, beforeAll, afterAll } from 'bun:test';
import { runSkillTest } from './helpers/session-runner';
import {
ROOT, runId, describeIfSelected, logCost, recordE2E,
createEvalCollector, finalizeEvalCollector,
} from './helpers/e2e-helpers';
import { spawnSync } from 'child_process';
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';

const evalCollector = createEvalCollector('e2e-build');

describeIfSelected('Build skill E2E', ['build-skill-cli-handoff'], () => {
let workDir: string;
let planFile: string;
let shimPath: string;
let handoffLog: string;

beforeAll(() => {
workDir = fs.mkdtempSync(path.join(os.tmpdir(), 'skill-e2e-build-'));
planFile = path.join(workDir, 'implementation-plan.md');
shimPath = path.join(workDir, 'fake-gstack-build');
handoffLog = path.join(workDir, 'handoff.log');

spawnSync('git', ['init', '-b', 'main'], { cwd: workDir, stdio: 'pipe' });
spawnSync('git', ['config', 'user.email', 'test@test.com'], { cwd: workDir, stdio: 'pipe' });
spawnSync('git', ['config', 'user.name', 'Test'], { cwd: workDir, stdio: 'pipe' });

fs.writeFileSync(
path.join(workDir, 'README.md'),
'# Build handoff fixture\n',
);
fs.writeFileSync(
planFile,
`# Build Handoff Plan

## Feature 1: Handoff

### Phase 1.1: Tiny change
- [ ] **Test Specification (Gemini Sub-agent)**: Write a failing test.
- [ ] **Implementation (Gemini Sub-agent)**: Make the test pass.
- [ ] **Review & QA (Codex Sub-agent)**: Review the change.
`,
);
fs.writeFileSync(
shimPath,
`#!/usr/bin/env bash
set -euo pipefail
{
echo "PWD=$PWD"
i=0
for arg in "$@"; do
echo "ARG[$i]=$arg"
i=$((i + 1))
done
} > "$GSTACK_BUILD_HANDOFF_LOG"
exit 0
`,
{ mode: 0o755 },
);

spawnSync('git', ['add', '.'], { cwd: workDir, stdio: 'pipe' });
spawnSync('git', ['commit', '-m', 'initial'], { cwd: workDir, stdio: 'pipe' });
});

afterAll(() => {
try { fs.rmSync(workDir, { recursive: true, force: true }); } catch {}
});

test('build-skill-cli-handoff', async () => {
const result = await runSkillTest({
prompt: `Read ${path.join(ROOT, 'build', 'SKILL.md')} for the /build workflow.

This is an E2E handoff test, not a real build. The implementation plan has already been located at:
${planFile}

Follow only the CLI launch portion of the /build skill:
- Do not synthesize a living plan.
- Do not invoke any model subagents.
- Do not use AskUserQuestion.
- Do not edit source files or the plan.
- Use GSTACK_BUILD_CLI from the environment.
- Invoke it with the plan file and --project-root set to the current git repo root.
- Stop after the CLI command exits and report that the handoff happened.`,
workingDirectory: workDir,
maxTurns: 8,
allowedTools: ['Bash', 'Read', 'Grep', 'Glob'],
timeout: 120_000,
testName: 'build-skill-cli-handoff',
runId,
env: {
GSTACK_BUILD_CLI: shimPath,
GSTACK_BUILD_HANDOFF_LOG: handoffLog,
GSTACK_HOME: path.join(workDir, '.gstack'),
},
});

logCost('/build cli handoff', result);

const log = fs.existsSync(handoffLog)
? fs.readFileSync(handoffLog, 'utf-8')
: '';
const handoffOk = log.includes(`ARG[0]=${planFile}`)
&& log.includes('ARG[1]=--project-root')
&& log.includes(`ARG[2]=${workDir}`)
&& !fs.existsSync(path.join(workDir, 'src'));

recordE2E(evalCollector, '/build cli handoff', 'Build skill E2E', result, {
passed: handoffOk && ['success', 'error_max_turns'].includes(result.exitReason),
});

expect(['success', 'error_max_turns']).toContain(result.exitReason);
expect(log).toContain(`ARG[0]=${planFile}`);
expect(log).toContain('ARG[1]=--project-root');
expect(log).toContain(`ARG[2]=${workDir}`);
expect(fs.existsSync(path.join(workDir, 'src'))).toBe(false);
}, 150_000);
});

afterAll(async () => {
await finalizeEvalCollector(evalCollector);
});