* chore(#3235): hoist the preamble-strip conditional out of the replace operand
CodeQL js/identity-replacement (alert 53, medium, CWE-116) fired on
src/roadmap-parser.cts:637. The #2947 fix (2bc53baa0) made the preamble
phase-detail strip conditional by swapping the REGEX OPERAND rather than the
operation, using `/$/` as a "match nothing" sentinel:
.replace(currentSectionHasPhaseDetails ? /^#{2,4}\s*Phase\s+.../gim : /$/, '')
`str.replace(/$/, '')` substitutes the zero-width end-of-input match with the
empty string, so the branch is inert. Behavior was correct; the hazard is that
both branches shared ONE replacement argument, so a later change of `''` to a
non-empty string would silently give the no-op branch a real effect -- on a seam
whose blast radius is CRITICAL (200+ affected symbols, 45 files, 22 processes).
Hoist the conditional around the .replace() call instead. The do-not-strip
branch now performs no replacement at all. The `Phase Details` heading strip
stays UNCONDITIONAL in both branches, which is what #730 depends on.
Equivalence is not asserted, it is measured: a deterministic-seed differential
probe compared the old and new formulations over 320 generated inputs x both
branch values -- 640 comparisons, 0 mismatches. Corpus covered empty string,
CRLF, heading depths 1-5, the #1729 pre-colon tag form, decimal phase IDs,
`## Phase Details`, fenced blocks and horizontal rules.
Six characterization tests pin both branches, including the one case no existing
#2947 fixture covers: that the unconditional `Phase Details` strip still runs on
the do-not-strip branch. Boundary rows cover the strip regex's #{2,4} bounds at
limit-1 (h1), limit (h2/h4) and limit+1 (h5).
Refs #3235
* test(#3235): add parser property test; kill two weak regression tests
Review findings from the orthogonal passes, all fixed inline.
Standards axis (hard violation, CLAUDE.md -> TEST RULES & CONVENTIONS):
"Parsers, budget limits, and bijective contracts must include at least one
fast-check (fc) property test." roadmap-parser is a parser module and the six
new tests were all example-based. Adds one property test over generated
preambles, asserting four invariants across BOTH branches:
1. no `Phase Details` heading ever survives (the unconditional strip)
2. headings outside the strip regex's #{2,4} bound always survive
3. hasOwnDetails=true -> preamble phase headings are gone
4. hasOwnDetails=false -> preamble phase headings are all retained
Generator is document-shaped -- a fixed alphabet of literal line shapes, NOT
derived from the parser's own regexes (CONTRIBUTING.md #2371 fixture
provenance: a writer-seeded generator can only confirm what the author already
believed). Seed pinned to 20260809, numRuns bounded at 300, verbose replay on
failure, per the determinism rule.
Isolated adversarial review ran mutation testing against the compiled lib and
found two weak tests:
- CRLF test killed no mutant the LF-only sibling did not already kill. Its
fixture now carries a `## Phase Details` heading, which exercises the
`[^\n]*` / `\n?` tail of the Phase Details regex under CRLF -- a region no
LF-only fixture can reach -- and asserts no orphaned CR is left behind.
- "no preamble does not throw" caught none of five targeted mutants.
`.replace()` cannot throw on any string, so no mutation confined to this
change could fail it. Deleted rather than propped up: the empty-preamble case
is now genuinely covered by the property test's minLength:0 generator, which
produces empty preambles on both branches. Strictly subsumed.
Refs #3235
---------
Co-authored-by: sim <sim@local>
GSD Core
Git. Ship. Done.
English · Português · 简体中文 · 日本語 · 한국어
A light-weight meta-prompting, context engineering, and spec-driven development system for Claude Code, OpenCode, Antigravity CLI, Kimi CLI, Kilo, Codex, Copilot, Cursor, Windsurf, and more.
What is GSD Core
GSD Core is a context-engineering and spec-driven development framework that drives AI coding agents (Claude Code, Codex, Antigravity CLI, Kimi CLI, Copilot, Cursor, and more) through a disciplined phase loop. It solves context rot — the quality degradation that accumulates as an AI fills its context window — by running all heavy research, planning, and execution work in fresh-context subagents while keeping your main session lean.
How it works
Each milestone repeats the same five-step loop, one phase at a time:
- Discuss — capture implementation decisions before anything is planned
- Plan — research, decompose, and verify the plan fits a fresh context window
- Execute — run plans in parallel waves; each executor starts with a clean 200k-token context
- Verify — walk through what was built; diagnose and fix before declaring done
- Ship — create the PR, archive the phase, repeat for the next one
Quickstart
npx @opengsd/gsd-core@latest
The installer prompts for your runtime (Claude Code, OpenCode, Antigravity CLI, Kimi CLI, Kilo, Codex, Copilot, Cursor, Windsurf, and more) and whether to install globally or locally. The installer is required for cross-runtime compatibility — do not copy files from agents/ or commands/ directly.
On another runtime or without Node.js? See Install on your runtime.
Once installed, start a new project or onboard an existing repo:
/gsd-new-project # greenfield project
/gsd-onboard # existing codebase
New here? Follow Your first project for a guided walkthrough from install to first shipped phase, or Onboarding an existing codebase for brownfield setup.
Documentation
What's new in 1.7.0 → docs/whats-new-1.7.0.md
Tutorials — learning by doing:
How-to guides — task-focused recipes:
Reference — authoritative facts:
Explanation — concepts and design decisions:
Full index: docs/README.md. Other languages: 日本語 · 한국어 · Português · 简体中文.
Why it works
Most AI-coding setups fail at scale because context bloat silently degrades output quality, there is no shared memory between sessions, and nothing verifies that code actually works. GSD Core solves all three: heavy work runs in fresh subagents, structured artifacts like STATE.md and CONTEXT.md survive session boundaries, and the verify step walks through what was built and generates fix plans before a phase is declared done. See docs/explanation/context-engineering.md for the full reasoning.
Troubleshooting? See docs/how-to/recover-and-troubleshoot.md.
Community
| Project | Platform |
|---|---|
| gsd-opencode | Original OpenCode port |
| Discord | Community support |
Star History
License
MIT License. See LICENSE for details.
Claude Code is powerful. GSD Core makes it reliable.