* test(3): add failing tests for milestone.complete header-dup, bullet-leakage, one-liner-noise Three RED tests for confirmed-bug #3 in sdk/src/query/phase-lifecycle.test.ts: Defect 1 (header-dup): milestoneComplete produces "## v1.0 v1.0 (Shipped: ...)" when no --name is given because `milestoneName = nameOpt || version` is always truthy, so the template `## ${version} ${milestoneName}` duplicates the version. Two sub-cases: no --name, and --name "Foundation Release". Defect 2 (bullet-leakage): getMilestonePhaseFilter falls back to passAll (milestonePhaseNums.size === 0) when the milestone section declares phases via GFM task-list bullets only (https://github.github.com/gfm/#task-list-items-extension-) with no ### Phase N: headings, admitting unrelated phase 99. Defect 3 (one-liner-noise): extractOneLinerFromBody matches the first bold in the entire document body after the heading, regardless of section boundaries. Per GFM § ATX headings (https://github.github.com/gfm/#atx-headings), the scope must be bounded to "first heading until next heading of ANY level". CJS bundle `bin/lib/*.cjs` intentionally NOT updated; bundle sync covered by #4 (first generator-introducing PR) and #26. * fix(3-1): preserve version in milestone header, append name only when provided Bug: `milestoneName = nameOpt || version` was always truthy (falling back to version), so the template `## ${version} ${milestoneName}` rendered as `## v1.0 v1.0 (Shipped: ...)` when no --name was given. Fix: separate `milestoneName = nameOpt ?? undefined` from `version`, then build the title with `milestoneName ? \`${version} ${milestoneName}\` : version`. Canonical template (GFM § ATX headings: https://github.github.com/gfm/#atx-headings): No --name: `## v1.0 (Shipped: 2026-05-23)` With --name "Foo": `## v1.0 Foo (Shipped: 2026-05-23)` Historical evidence: `## v1.8.0 Quick Mode (Shipped: 2026-01-19)` Also applies the same fix to the Requirements Archive header. Files changed: sdk/src/query/phase-lifecycle.ts #3 CJS bundle `bin/lib/*.cjs` intentionally NOT updated; bundle sync covered by #4 (first generator-introducing PR) and #26. * fix(3-2): recognize checkbox-bullet phase declarations in milestone phase filter Bug: getMilestonePhaseFilter in sdk/src/query/state.ts used the regex `/#{2,4}\s*Phase\s+([\w][\w.-]*)\s*:/gi` which only matched heading-style phase declarations (### Phase N: title). When a ROADMAP declares phases via GFM task-list bullets only: - [ ] **Phase 1: Foundation** - [ ] **Phase 2: API** the Set remained empty → passAll fired → all phase directories (including unrelated 99-*) were admitted into the milestone accomplishments. Fix: extend the regex to also match bullet-style declarations: /(?:#{2,4}\s*|-\s*(?:\[[x ]\]\s*)?\*{0,2}\s*)Phase\s+([\w][\w.-]*)\s*:/gi GFM § ATX headings: https://github.github.com/gfm/#atx-headings GFM § Task list items: https://github.github.com/gfm/#task-list-items-extension- Files changed: sdk/src/query/state.ts #3 CJS bundle `bin/lib/*.cjs` intentionally NOT updated; bundle sync covered by #4 (first generator-introducing PR) and #26. * fix(3-3): bound extractOneLinerFromBody to first heading until next heading of any level Bug: extractOneLinerFromBody in sdk/src/query/phase-lifecycle-policy.ts used the regex /^#[^\n]*\n+\*\*([^*]+)\*\*/m which matched the first bold in the entire document body after any heading. This leaked bold text from later sub-sections (e.g. "### Deviation 1 -- bar") into the one-liner. Fix: bound the search scope to the first section only. Implementation follows D3 spec: 1. Find the first heading of any level (GFM ATX headings: https://github.github.com/gfm/#atx-headings). 2. Extract content from after that heading to the next heading of ANY level (not "same or higher") so ### Deviation terminates scope even when title is H1. 3. Match the first **bold** within that bounded scope only. Note: TypeScript 5.x rejects backtick-containing regex patterns in JSDoc comments (TS1443: template literal parse error); comments use plain text instead. Files changed: sdk/src/query/phase-lifecycle-policy.ts #3 CJS bundle `bin/lib/*.cjs` intentionally NOT updated; bundle sync covered by #4 (first generator-introducing PR) and #26. * fix(3-3): apply bounded one-liner extraction to summary.ts duplicate Sibling copy of extractOneLinerFromBody in sdk/src/query/summary.ts had the same pre-fix logic flagged in commit d1eab690. Same bug, same fix — "Fix Everything You Find" applies. DRY-extracting to a shared module is left as a follow-up refactor; out of scope for this bug fix. Refs #3 * chore(3): add changeset fragment for milestone.complete noise fix Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(3): update changeset fragment with PR number 146 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@opengsd/gsd-sdk
TypeScript SDK for Get Shit Done: deterministic query/mutation handlers, plan execution, and event-stream telemetry so agents focus on judgment, not shell plumbing.
Install
npm install @opengsd/gsd-sdk
Quickstart — programmatic
import { GSD, createRegistry } from '@opengsd/gsd-sdk';
const gsd = new GSD({ projectDir: process.cwd(), sessionId: 'my-run' });
const tools = gsd.createTools();
const registry = createRegistry(gsd.eventStream, 'my-run');
const { data } = await registry.dispatch('state.json', [], process.cwd());
Quickstart — CLI
From a project that depends on this package, invoke the CLI with Node (recommended in CI and local dev):
node ./node_modules/@opengsd/gsd-sdk/dist/cli.js query state.json
node ./node_modules/@opengsd/gsd-sdk/dist/cli.js query roadmap.analyze
If no native handler is registered for a command, the CLI can transparently shell out to get-shit-done/bin/gsd-tools.cjs (see stderr warning), unless GSD_QUERY_FALLBACK=off.
What ships
| Area | Entry |
|---|---|
| Query registry | createRegistry() in src/query/index.ts — same handlers as gsd-sdk query |
| Tools bridge | GSDTools — native dispatch with optional CJS subprocess fallback |
| Orchestrators | PhaseRunner, InitRunner, GSD |
| CLI | gsd-sdk — query, run, init, auto |
Guides
- Handler registry & contracts:
src/query/QUERY-HANDLERS.md - Repository docs (when present):
docs/ARCHITECTURE.md,docs/CLI-TOOLS.mdat repo root
Environment
| Variable | Purpose |
|---|---|
GSD_QUERY_FALLBACK |
off / never disables CLI fallback to gsd-tools.cjs for unknown commands |
GSD_AGENTS_DIR |
Override directory scanned for installed GSD agents (~/.claude/agents by default) |