SpecBridge v0.2: offline spec authoring and approval workflow#2
Merged
Conversation
Implement Phase E on top of the v0.1 read-only runtime. Users can now create Kiro-compatible feature and bugfix specs offline, analyze them deterministically, and gate them through recorded stage approvals — no model, no API key, no network. New commands: - spec new: feature (requirements-first / design-first / quick) and bugfix templates with machine-recognizable placeholders; atomic creation staged in .specbridge/tmp and renamed in one step; strict spec-name validation; --description / --from-file / --dry-run / --json - spec analyze: deterministic structural analysis (placeholders, EARS patterns, vague wording, missing sections, task-plan gaps) with error/warning/info levels, --strict, and exit codes 0/1/2 - spec approve: prerequisite-gated approvals recording the SHA-256 of the exact file bytes in versioned sidecar state (schema 1.0.0); --revoke cascades to dependent approvals; reapproval after content changes invalidates dependents honestly; approved Markdown is never rewritten - spec status: per-stage approval health with stale detection Extended: spec list (mode/status/approval health), spec show (--state/--analysis/--status), doctor (sidecar validation, orphan and stale state detection — report-only). Architecture: new @specbridge/workflow package (cli -> workflow -> compat-kiro -> core); core gains sha256 hashing, fsync'd atomic writes, and the versioned SpecWorkflowState zod schema. Stale approvals are computed in memory at read time; read-only commands never write. Existing Kiro workspaces stay fully usable without state (unmanaged); the first successful approval initializes sidecar state. Testing: 245 tests (was 139), 13 new v02-* fixtures, 6 new end-to-end smoke checks against the built CLI. The byte-identical no-op round-trip guarantee and all v0.1 behavior are unchanged. Versions bumped to 0.2.0 with a new CHANGELOG and docs for authoring, analysis, approvals, and the sidecar schema. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements Phase E — the production-quality, offline-first spec authoring and approval workflow — on top of the v0.1 read-only runtime. No model, no API key, no network for any command.
New commands
spec new <name>--title,--description,--from-file,--dry-run,--jsonspec analyze <name>--stage,--strict,--json); errors block approval, warnings never dospec approve <name> --stage <s>--revokecascades to dependent approvalsspec status <name>Extended commands
spec list(MODE/STATUS columns incl.STALE_APPROVAL/unmanaged),spec show(--state,--analysis,--status),doctor(sidecar validation, orphan/stale/invalid state — report-only, never repairs).Why
Kiro-style specs are only useful if the approve-then-build loop works outside Kiro. v0.2 makes the workflow portable while keeping the v0.1 promise intact:
.kirostays the source of truth, generated files are plain Markdown with zero tool metadata, and workflow state lives entirely in.specbridge/(versioned zod schema 1.0.0, SHA-256 approval hashes,origintracking for existing-workspace adoption).Design points for review
@specbridge/workflow(cli → workflow → compat-kiro → core) keeps the compatibility layer read-only-pure.STALE_APPROVALbut never rewrite state; the explicit repair is re-approval, which also invalidates dependent approvals when content changed (they were approved against different bytes)..specbridge/tmp/and renamed into.kiro/specs/<name>in one step; a failed state write rolls the whole creation back (failure-injection tested). No--force, existing specs are never overwritten.<role>, "Add … here.",TBD); detection is deliberately conservative so hand-written specs are never falsely blocked (covered by thev02-manually-editedfixture).unmanagedand fully usable; the first successful approval initializes state, inferring the workflow mode only when unambiguous.Testing
v02-*fixtures; approved-hash fixtures rely on.gitattributesbyte protection.scripts/smoke.mjsextended with a full end-to-end authoring cycle against the built CLI (19/19 checks).pnpm lint,pnpm typecheck,pnpm buildall clean; versions consistently bumped to 0.2.0 with a newCHANGELOG.md.Reviewer notes
SIDECAR_STATE_LEGACYwarning.vitest.config.tssetsNO_COLOR=1because picocolors force-enables ANSI on Windows, which broke exact-output assertions.spec run/sync/verify/exportremain honest "(planned)" stubs (exit 2); runner-assisted generation is documented as a v0.3 candidate only.🤖 Generated with Claude Code