GitHub Spec Kit Workflow
TraderX baseline generation now follows a root-canonical GitHub Spec Kit flow.
Canonical Locations
.specify/**for constitution and templatesspecs/001-baseline-uncontainerized-parity/**for baseline requirements, stories, plan, tasks, and contractspipeline/**for generation and validation orchestration
Each state pack under specs/NNN-* must include:
research.mddata-model.mdquickstart.md
Convergence states must also include:
system/convergence-rationale.md
Browse in docs:
/specs/baseline-uncontainerized-parity/specs/baseline-uncontainerized-parity/system/system-requirements/specs/baseline-uncontainerized-parity/system/user-stories/specs/baseline-uncontainerized-parity/system/acceptance-criteria/specs/baseline-uncontainerized-parity/system/requirements-traceability/specs/baseline-uncontainerized-parity/system/end-to-end-flows/specs/baseline-uncontainerized-parity/system/architecture/docs/spec-kit/state-docs/docs/learning- runtime API explorer route:
/api/docs(via running state ingress/edge) /specify
Input Evidence For Requirements
specs/001-baseline-uncontainerized-parity/system/architecture.model.jsonspecs/001-baseline-uncontainerized-parity/system/end-to-end-flows.mdspecs/001-baseline-uncontainerized-parity/system/system-requirements.mddocs/README.mdREADME.md
Baseline Generation Flow
- Validate Spec Kit readiness and requirement coverage.
- Compile component manifests from Spec Kit artifacts.
- Synthesize generated components from manifest + templates.
- Start generated overlays and run smoke tests/parity checks.
Derived-State Generation Flow
For states 002+, generation follows:
- Generate parent state output.
- Apply ordered patch set from
specs/<state>/generation/patches/*.patch. - Regenerate architecture docs and run state smoke checks.
Convergence-State Policy
- Prefer new state proposals from the nearest suitable convergence state (
C0/C1/C2/C3). - Keep
previoussingle-parent for publish lineage. - Use
dottedParentsonly for convergence states. - If convergence-state metadata/content changes, update that state's
system/convergence-rationale.md. - Reference:
/docs/spec-kit/convergence-states
LLM Feature-Add Implementation Contract
When implementing a new state delta with an LLM:
- Generate the parent state (
bash pipeline/generate-state.sh <parent-state-id>). - Make only the intended child-state edits against generated output.
- Capture patch set (
bash pipeline/create-state-patchset.sh <state-id> <parent-state-id> [target-path]). - Keep state hook as parent-generation +
apply-state-patchset.shonly. - Update
specs/<state>/generation/generation-hook.mdwith parent, patch path, and refresh commands. - Do not introduce or keep large file-payload heredoc generators for derived states.
- Keep patch payloads clean: exclude build/restored artifacts (
.gradle,build,target,bin,obj,dist,coverage,node_modules) and template-owned wrapper artifacts; include lockfile deltas only when Node manifests change.
Generation Concurrency
Run generation sequentially by default. pipeline/generate-state.sh writes to shared output roots (generated/code/target-generated, generated/code/components), so parallel invocations can race.
Use isolated TRADERX_GENERATED_ROOT directories only when intentionally running multiple generation sessions in separate workspaces.
Validation Commands
bash pipeline/refresh-state-docs.sh --check
bash pipeline/validate-state-doc-consistency.sh
bash pipeline/validate-state-pack-artifacts.sh
bash pipeline/validate-template-version-consistency.sh
bash pipeline/validate-generated-branch-dependency-consistency.sh
bash pipeline/validate-generated-dependency-targets.sh generated/code/components generated/code/target-generated
bash pipeline/validate-sail-pin-contract.sh
./pipeline/speckit/validate-speckit-readiness.sh
./pipeline/speckit/verify-spec-expressiveness.sh
bash pipeline/speckit/compile-all-component-manifests.sh
./pipeline/validate-regeneration-readiness.sh
./pipeline/verify-spec-coverage.sh
Generated-State CI Preflight
For generated-code branch publish, prepublish CI-parity gating is executed by default by
pipeline/publish-generated-state-branch.sh. Run it manually when you need a standalone check:
bash pipeline/prepublish-generated-state-gate.sh <state-id>
Use --skip-prepublish-gate only as an explicit temporary override.
See: /docs/spec-kit/generated-state-ci
Docusaurus CI Compatibility
When changing Docusaurus, docs plugins, or website build configuration:
- Keep
website/package-lock.jsoncommitted and updated with the dependency change. - Use
npm --prefix website ci --no-audit --no-fund(notnpm install) for CI parity. - Validate docs build with GitHub Pages settings:
DOCUSAURUS_URL=https://traderx.finos.org \
DOCUSAURUS_BASE_URL=/ \
bash pipeline/refresh-state-docs.sh
DOCUSAURUS_URL=https://traderx.finos.org \
DOCUSAURUS_BASE_URL=/ \
npm --prefix website run clear
DOCUSAURUS_URL=https://traderx.finos.org \
DOCUSAURUS_BASE_URL=/ \
npm --prefix website run build
TRADERX_SITE_ROOT controls the docs-route prefix used when regenerating /docs/learning-paths Mermaid click links. Keep it empty for root deployment (/) and set it only when publishing under a subpath.
-
If dependency changes alter transitive Webpack behavior, pin and re-lock before merge.
-
Run AFDocs checks for agent-friendliness:
# local preview (while docusaurus start runs)
npx afdocs check http://localhost:3000 --format scorecard
npx afdocs check http://localhost:3000 --format json --score
# published docs URL
npx afdocs check https://traderx.finos.org/ --format scorecard
Use AFDocs scorecards to prioritize high-impact fixes. Prefer improvements via docs build/pipeline/plugins (for example llms outputs) before broad manual content rewrites.
Learning-path catalog policy:
catalog/state-catalog.jsonis the source for state lineage.- Derived artifacts are regenerated together by:
bash pipeline/refresh-state-docs.sh
- Derived artifacts include:
catalog/learning-paths.yamlcatalog/learning-paths.md/docs/learning-paths/docs/spec-kit/state-docs/docs/learning/index/docs/learning/state-*.md
Generation Commands
Generate any state:
bash pipeline/generate-state.sh <state-id>
These commands also regenerate state architecture docs from specs/*/system/architecture.model.json.
State docs (/docs/spec-kit/state-docs) are generated from catalog/state-catalog.json.
Scaffold a new planned state pack:
bash pipeline/scaffold-state-pack.sh <NNN-state-name> --title "<Title>" --previous <prior-state-id> --track <prelude|baseline|architecture|nonfunctional|functional|devex>
Run the state-change playbook (refresh docs -> gates -> generate -> optional publish/push):
bash pipeline/state-playbook.sh --state <state-id> --publish-neighborhood --push-generated
Dependency maintenance refresh contract:
- Start from the earliest implemented state impacted by the dependency change.
- Run forward through downstream implemented states.
- Require smoke-test pass evidence before publish.
Sail-specific maintenance checks (state 014):
# local pin contract check
bash pipeline/validate-sail-pin-contract.sh
# upstream drift check (fails if tracking ref moved beyond the pinned commit)
bash pipeline/check-sail-pin-drift.sh --fail-on-drift
Sail pin metadata source:
specs/014-fdc3-intent-interoperability/generation/sail-pin.env
Generated outputs:
generated/code/components/*-specfirstgenerated/manifests/*.manifest.jsongenerated/code/target-generated/**(assembled at startup)
Run generated baseline stack:
CORS_ALLOWED_ORIGINS=http://localhost:18093 ./scripts/start-base-uncontainerized-generated.sh --build-only
CORS_ALLOWED_ORIGINS=http://localhost:18093 ./scripts/start-base-uncontainerized-generated.sh
Run generated containerized stack (state 004):
./scripts/start-state-004-containerized-generated.sh
./scripts/start-state-004-containerized-generated.sh --skip-build
./scripts/status-state-004-containerized-generated.sh
./scripts/test-state-004-containerized.sh
./scripts/stop-state-004-containerized-generated.sh
Ingress endpoint: http://localhost:8080
Full Parity Gate
Run end-to-end parity validation (generation + startup + all baseline smoke tests):
bash pipeline/speckit/run-full-parity-validation.sh
API Explorer
API explorer generation is runtime-centric and decoupled from the docs portal.
It is installed during state generation by:
bash pipeline/install-generated-api-explorer.sh <state-id>
Compare Generation Output
To compare a single component generated output between a legacy script revision and current Spec Kit-driven generation:
bash pipeline/speckit/compare-component-generation.sh <component-id> <legacy-ref>
Example:
bash pipeline/speckit/compare-component-generation.sh reference-data HEAD
Iterating Learning-Path States
After baseline parity is green:
- add FR/NFR deltas in the next feature pack under
specs/NNN-* - update contracts if interfaces change
- update and capture state patch set:
bash pipeline/create-state-patchset.sh <state-id> <parent-state-id> [target-path]
- rerun conformance + parity gates
This keeps each learning-path state reproducible from requirements instead of from copied source.