bmad-method 6.8.1-next.8 → 6.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/.claude-plugin/marketplace.json +9 -3
  2. package/package.json +10 -4
  3. package/src/bmm-skills/1-analysis/bmad-prfaq/SKILL.md +2 -2
  4. package/src/bmm-skills/1-analysis/bmad-product-brief/SKILL.md +8 -8
  5. package/src/bmm-skills/2-plan-workflows/bmad-prd/SKILL.md +7 -7
  6. package/src/bmm-skills/2-plan-workflows/bmad-prd/assets/headless-schemas.md +2 -2
  7. package/src/bmm-skills/2-plan-workflows/bmad-prd/customize.toml +1 -1
  8. package/src/bmm-skills/2-plan-workflows/bmad-prd/references/headless.md +1 -1
  9. package/src/bmm-skills/2-plan-workflows/bmad-prd/references/validate.md +1 -1
  10. package/src/bmm-skills/2-plan-workflows/bmad-ux/SKILL.md +8 -8
  11. package/src/bmm-skills/2-plan-workflows/bmad-ux/assets/design-directions.md +1 -1
  12. package/src/bmm-skills/2-plan-workflows/bmad-ux/assets/headless-schemas.md +2 -2
  13. package/src/bmm-skills/2-plan-workflows/bmad-ux/assets/key-screens.md +4 -4
  14. package/src/bmm-skills/2-plan-workflows/bmad-ux/customize.toml +1 -1
  15. package/src/bmm-skills/2-plan-workflows/bmad-ux/references/creative-tools.md +1 -1
  16. package/src/bmm-skills/2-plan-workflows/bmad-ux/references/headless.md +1 -1
  17. package/src/bmm-skills/2-plan-workflows/bmad-ux/references/validate.md +2 -2
  18. package/src/bmm-skills/3-solutioning/bmad-agent-architect/customize.toml +2 -2
  19. package/src/bmm-skills/3-solutioning/bmad-architecture/SKILL.md +85 -0
  20. package/src/bmm-skills/3-solutioning/bmad-architecture/assets/spine-template.md +79 -0
  21. package/src/bmm-skills/3-solutioning/bmad-architecture/customize.toml +100 -0
  22. package/src/bmm-skills/3-solutioning/bmad-architecture/references/headless.md +26 -0
  23. package/src/bmm-skills/3-solutioning/bmad-architecture/references/reviewer-gate.md +13 -0
  24. package/src/bmm-skills/3-solutioning/bmad-architecture/scripts/lint_spine.py +257 -0
  25. package/src/bmm-skills/3-solutioning/bmad-architecture/scripts/tests/test_lint_spine.py +270 -0
  26. package/src/bmm-skills/3-solutioning/bmad-create-architecture/SKILL.md +16 -60
  27. package/src/bmm-skills/4-implementation/bmad-retrospective/SKILL.md +15 -0
  28. package/src/bmm-skills/4-implementation/bmad-sprint-planning/SKILL.md +20 -1
  29. package/src/bmm-skills/4-implementation/bmad-sprint-planning/checklist.md +2 -1
  30. package/src/bmm-skills/4-implementation/bmad-sprint-planning/sprint-status-template.yaml +13 -0
  31. package/src/bmm-skills/4-implementation/bmad-sprint-status/SKILL.md +13 -0
  32. package/src/bmm-skills/module-help.csv +2 -2
  33. package/src/core-skills/bmad-brainstorming/SKILL.md +8 -10
  34. package/src/core-skills/bmad-brainstorming/references/converge.md +1 -1
  35. package/src/core-skills/bmad-brainstorming/references/finalize.md +1 -1
  36. package/src/core-skills/bmad-brainstorming/references/headless.md +4 -4
  37. package/src/core-skills/bmad-brainstorming/references/in-chat-techniques.md +1 -1
  38. package/src/core-skills/bmad-brainstorming/references/mode-autonomous.md +1 -1
  39. package/src/core-skills/bmad-brainstorming/scripts/tests/test_brain.py +2 -2
  40. package/src/core-skills/bmad-customize/scripts/tests/test_list_customizable_skills.py +1 -1
  41. package/src/core-skills/bmad-forge-idea/SKILL.md +79 -0
  42. package/src/core-skills/bmad-forge-idea/customize.toml +42 -0
  43. package/src/core-skills/bmad-forge-idea/scripts/resolve_personas.py +270 -0
  44. package/src/core-skills/bmad-forge-idea/scripts/tests/test_resolve_personas.py +138 -0
  45. package/src/core-skills/bmad-party-mode/SKILL.md +39 -56
  46. package/src/core-skills/bmad-party-mode/customize.toml +175 -0
  47. package/src/core-skills/bmad-party-mode/references/create-party.md +70 -0
  48. package/src/core-skills/bmad-party-mode/references/mode-agent-team.md +11 -0
  49. package/src/core-skills/bmad-party-mode/references/mode-auto.md +13 -0
  50. package/src/core-skills/bmad-party-mode/references/mode-subagent.md +19 -0
  51. package/src/core-skills/bmad-party-mode/references/party-memory.md +51 -0
  52. package/src/core-skills/bmad-party-mode/scripts/resolve_party.py +272 -0
  53. package/src/core-skills/bmad-party-mode/scripts/tests/test-resolve_party.py +146 -0
  54. package/src/core-skills/bmad-spec/SKILL.md +5 -3
  55. package/src/core-skills/bmad-spec/assets/spec-template.md +3 -3
  56. package/src/core-skills/module-help.csv +1 -0
  57. package/src/scripts/resolve_config.py +8 -6
  58. package/src/scripts/resolve_customization.py +8 -6
  59. package/tools/installer/commands/install.js +3 -0
  60. package/tools/installer/core/installer.js +3 -0
  61. package/tools/installer/core/uv-check.js +97 -0
  62. package/tools/installer/core/wsl-node-check.js +109 -0
  63. package/tools/installer/ide/platform-codes.yaml +7 -0
  64. package/tools/installer/install-messages.yaml +4 -0
  65. package/tools/installer/ui.js +11 -0
  66. package/evals/bmm-skills/bmad-product-brief/evals.json +0 -237
  67. package/evals/bmm-skills/bmad-product-brief/files/branfield-memo.md +0 -46
  68. package/evals/bmm-skills/bmad-product-brief/files/forkbird-brief/addendum.md +0 -40
  69. package/evals/bmm-skills/bmad-product-brief/files/forkbird-brief/brief.md +0 -56
  70. package/evals/bmm-skills/bmad-product-brief/files/forkbird-brief/decision-log.md +0 -27
  71. package/evals/bmm-skills/bmad-product-brief/files/meridian-mobility-report.md +0 -116
  72. package/evals/bmm-skills/bmad-product-brief/files/mossridge-brief/addendum.md +0 -41
  73. package/evals/bmm-skills/bmad-product-brief/files/mossridge-brief/brief.md +0 -57
  74. package/evals/bmm-skills/bmad-product-brief/files/mossridge-brief/decision-log.md +0 -29
  75. package/evals/bmm-skills/bmad-product-brief/files/pantry-bridge-interviews.md +0 -90
  76. package/evals/bmm-skills/bmad-product-brief/files/q2-brainstorm.md +0 -101
  77. package/evals/bmm-skills/bmad-product-brief/triggers.json +0 -18
  78. package/src/bmm-skills/3-solutioning/bmad-create-architecture/architecture-decision-template.md +0 -12
  79. package/src/bmm-skills/3-solutioning/bmad-create-architecture/data/domain-complexity.csv +0 -13
  80. package/src/bmm-skills/3-solutioning/bmad-create-architecture/data/project-types.csv +0 -7
  81. package/src/bmm-skills/3-solutioning/bmad-create-architecture/steps/step-01-init.md +0 -153
  82. package/src/bmm-skills/3-solutioning/bmad-create-architecture/steps/step-01b-continue.md +0 -173
  83. package/src/bmm-skills/3-solutioning/bmad-create-architecture/steps/step-02-context.md +0 -224
  84. package/src/bmm-skills/3-solutioning/bmad-create-architecture/steps/step-03-starter.md +0 -329
  85. package/src/bmm-skills/3-solutioning/bmad-create-architecture/steps/step-04-decisions.md +0 -318
  86. package/src/bmm-skills/3-solutioning/bmad-create-architecture/steps/step-05-patterns.md +0 -359
  87. package/src/bmm-skills/3-solutioning/bmad-create-architecture/steps/step-06-structure.md +0 -379
  88. package/src/bmm-skills/3-solutioning/bmad-create-architecture/steps/step-07-validation.md +0 -361
  89. package/src/bmm-skills/3-solutioning/bmad-create-architecture/steps/step-08-complete.md +0 -82
  90. package/src/core-skills/bmad-brainstorming/scripts/memlog.py +0 -202
  91. package/src/core-skills/bmad-brainstorming/scripts/tests/test_memlog.py +0 -265
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: '{name}'
3
+ type: architecture-spine
4
+ purpose: build-substrate # build-substrate (default) · discussion · report · deck
5
+ altitude: feature # initiative (keeps features) · feature (keeps epics) · epic (keeps stories)
6
+ paradigm: '{named design pattern, e.g. hexagonal, layered, pipes-and-filters, actor}'
7
+ scope: '{what this spine governs}'
8
+ status: draft # draft · final
9
+ created: '{date}'
10
+ updated: '{date}'
11
+ binds: [] # capability / unit IDs governed (from the driving spec; at epic altitude, also the inherited parent AD ids)
12
+ sources: []
13
+ companions: []
14
+ ---
15
+
16
+ # Architecture Spine — {name}
17
+
18
+ <!-- TEMPLATE GUIDE — act on these comments, then delete them; never emit a comment in the finished spine. This is a shape, not a script: keep only the sections this spine needs and cut the rest (no empty headers). A small intent may be just paradigm + a few ADs + conventions; a platform earns more. An inherited epic spine is usually mostly Inherited Invariants + a thin Deferred. Decisions, not rationale (rationale lives in the memlog). Carry shape in diagrams; prose only where it must. -->
19
+
20
+ ## Design Paradigm
21
+
22
+ <!-- Name the pattern (a known one loads a whole model for free) and map its layers to namespaces/directories. The smallest, most durable thing here. -->
23
+
24
+ ## Inherited Invariants
25
+
26
+ <!-- Only when this spine inherits a higher-altitude parent. The parent's ADs/conventions/paradigm that bind here, by their ORIGINAL ids — read-only, never renumbered, not re-derived. A local decision that contradicts one is a conflict to surface, not an override. Cut this section otherwise. -->
27
+
28
+ | Inherited | From parent | Binds here |
29
+ | --- | --- | --- |
30
+ | {AD-id / convention} | {parent spine} | {what it constrains in this scope} |
31
+
32
+ ## Invariants & Rules
33
+
34
+ <!-- The durable heart: calls a future builder can't read off compliant code. One block per decision: stable ascending id (never reused/renumbered), Binds, Prevents (the divergence), Rule (enforceable). Tag [ADOPTED] when the user or existing reality settled it. Include a dependency-direction diagram (who may depend on whom) — it IS a rule; author it as valid mermaid, never an empty graph. -->
35
+
36
+ ### AD-1 — {decision}
37
+
38
+ - **Binds:** {capability / unit ids / fr/nfr's, areas, or `all`}
39
+ - **Prevents:** {the divergence this stops}
40
+ - **Rule:** {the constraint downstream must follow}
41
+
42
+ ## Consistency Conventions
43
+
44
+ <!-- Defaults that bind where independent builders would drift. Cut rows that don't apply; add rows the project needs. -->
45
+
46
+ | Concern | Convention |
47
+ | --- | --- |
48
+ | Naming (entities, files, interfaces, events) | |
49
+ | Data & formats (ids, dates, error shapes, envelopes) | |
50
+ | State & cross-cutting (mutation, errors, logging, config, auth) | |
51
+
52
+ ## Stack
53
+
54
+ <!-- SEED — verified current at authoring; the code owns this once it exists. Name + version only; the why lives in the memlog. One row per language, framework, key dependency, platform, or chain that's pinned. -->
55
+
56
+ | Name | Version |
57
+ | --- | --- |
58
+ | {language / framework / key dep / platform / chain} | {pinned version} |
59
+
60
+ ## Structural Seed
61
+
62
+ <!-- The shapes worth fixing at cold-start — not a fixed list. Include only what's non-obvious at this altitude, and use as many diagrams as convey it, each as VALID mermaid (never a placeholder or empty graph). Candidates: system/container/context view; DEPLOYMENT & ENVIRONMENTS and external provider/infra topology (cover the operational envelope here when this altitude owns it — don't let it fall through); core-entity ERD (names + relationships only; an attribute that's itself an invariant is an AD, not a diagram); a minimal source tree. The code owns the detail — this is scaffold, not a mirror to maintain. -->
63
+
64
+ ```text
65
+ {root}/
66
+ {dir}/ # {what lives here}
67
+ ```
68
+
69
+ ## Capability → Architecture Map
70
+
71
+ <!-- Present when a spec drove this run. Bridges the spec's capabilities to where they live + what governs them; the consistency auditor's checklist. Cut otherwise. -->
72
+
73
+ | Capability / Area | Lives in | Governed by |
74
+ | --- | --- | --- |
75
+ | {CAP-id / area} | {component / module} | {AD-id, convention, paradigm} |
76
+
77
+ ## Deferred
78
+
79
+ <!-- Decisions intentionally pushed down, each with the reason it can wait — including whole dimensions this altitude doesn't own yet. The half of the contract that keeps the spine lean. -->
@@ -0,0 +1,100 @@
1
+ # DO NOT EDIT -- overwritten on every update.
2
+ #
3
+ # Workflow customization surface for bmad-architecture.
4
+ #
5
+ # Override files (not edited here):
6
+ # {project-root}/_bmad/custom/bmad-architecture.toml (team)
7
+ # {project-root}/_bmad/custom/bmad-architecture.user.toml (personal)
8
+
9
+ [workflow]
10
+
11
+ # --- Configurable below. Overrides merge per BMad structural rules: ---
12
+ # scalars: override wins • arrays: append
13
+
14
+ # Steps to run before the standard activation (config load, greet).
15
+ # Use for pre-flight loads, approved-stack policy checks, etc.
16
+ activation_steps_prepend = []
17
+
18
+ # Steps to run after greet but before the workflow begins.
19
+ # Use for context-heavy setup that should happen once the user has been acknowledged.
20
+ activation_steps_append = []
21
+
22
+ # Persistent facts the workflow keeps in mind for the whole run
23
+ # (approved stacks, banned dependencies, platform constraints, compliance guardrails).
24
+ # Each entry is either a literal sentence, a skill prefixed with `skill:`, or a `file:`-prefixed
25
+ # path/glob whose contents are loaded as facts.
26
+ #
27
+ # Default loads project-context.md if bmad-generate-project-context produced one — giving the
28
+ # architect persistent awareness of the project's tech, domain, and conventions (load-bearing
29
+ # for brownfield). Common opt-ins (set in team/user override TOML):
30
+ # "Our org is AWS-only -- do not propose GCP or Azure."
31
+ # "file:{project-root}/docs/engineering-standards.md"
32
+ persistent_facts = [
33
+ "file:{project-root}/**/project-context.md",
34
+ ]
35
+
36
+ # Executed when the workflow completes (after the spine is final and the user has been told).
37
+ # String scalar (single instruction) or array of instructions executed in order. Empty for none.
38
+ on_complete = ""
39
+
40
+ # The architecture spine template. Treated as expert prior knowledge, not a checklist — the LLM
41
+ # adapts it to the project, altitude, and domain, and drops sections a project genuinely doesn't
42
+ # need. Override the path in team/user TOML to enforce a different spine shape.
43
+ spine_template = "assets/spine-template.md"
44
+
45
+ # Run folder location. ARCHITECTURE-SPINE.md, its .memlog.md, and any fuller rendering the run
46
+ # produces all land inside `{spine_output_path}/{run_folder_pattern}/`. Resume-check scans
47
+ # `{spine_output_path}` for prior unfinished runs.
48
+ #
49
+ # The default pattern fits the common case (one spine per project, at the altitude above epics).
50
+ # At EPIC altitude, override run_folder_pattern to carry the epic identity so per-epic runs don't
51
+ # collide on the same day — e.g. set it (team/user TOML) to "architecture-epic-{epic_id}", binding
52
+ # {epic_id} from the driving spec / the activating payload. Headless callers may instead pass an
53
+ # explicit doc_workspace and bypass the pattern entirely.
54
+ spine_output_path = "{planning_artifacts}/architecture"
55
+ run_folder_pattern = "architecture-{project_name}-{date}"
56
+
57
+ # Prose-editorial standards applied at finalize ONLY to a fuller prose document the run produces
58
+ # (a discussion report, full architecture doc, or design addendum) — never to the spine or other
59
+ # short, structured outputs, which are terse and carry decisions in AD-n blocks and diagrams by
60
+ # design. Each entry is a `skill:`, `file:`, or plain-text directive applied before the user sees
61
+ # the polished draft. Suggested order: structural passes first, prose mechanics last. Append-only.
62
+ doc_standards = [
63
+ "skill:bmad-editorial-review-structure",
64
+ "skill:bmad-editorial-review-prose",
65
+ ]
66
+
67
+ # External-source registry. Natural-language directives describing knowledge bases, MCP tools, or
68
+ # internal systems the LLM may consult ON DEMAND during the run (not preemptively) — approved-stack
69
+ # catalogs, internal platform docs, version registries. Each entry names the tool, the trigger
70
+ # condition, and any fields it needs. If a named tool is unavailable at runtime, the LLM falls back
71
+ # to standard behavior (e.g. web research) and notes the gap. Empty by default.
72
+ #
73
+ # Examples (set in team/user override TOML):
74
+ # "When choosing a datastore, consult corp:platform_catalog before recommending one."
75
+ # "For current library versions, query corp:artifact_registry before web search."
76
+ external_sources = []
77
+
78
+ # External-handoff routing applied at Finalize to push outputs beyond local files (Confluence,
79
+ # Notion, ticket systems). Each entry names the MCP tool, the destination, and required fields.
80
+ # Runs after polish; returned URLs/IDs are surfaced. Unavailable tools are skipped and flagged;
81
+ # local files always exist. Empty by default.
82
+ external_handoffs = []
83
+
84
+ # --- Finalize reviewers ---
85
+ # Extra review lenses spawned as parallel subagents at the validation gate (Finalize and the
86
+ # Validate intent), on top of the skill's built-in good-spine checklist and the lint_spine.py
87
+ # mechanical floor. The GATE is stakes-gated — a throwaway spine may run it quietly or skip it —
88
+ # but whenever the gate runs, every entry here runs with it (the configured floor, never cherry-
89
+ # picked); only ad-hoc lenses are optional, and headless never skips the gate.
90
+ #
91
+ # Entries follow the standard prefix convention:
92
+ # "skill:NAME" invoke the named review skill as a subagent against ARCHITECTURE-SPINE.md
93
+ # "file:PATH" load the file as a review prompt; spawn an adversarial subagent applying it
94
+ # plain text use the text directly as the subagent's review prompt
95
+ #
96
+ # Resolved on-demand (not at activation). Override TOML may append.
97
+ finalize_reviewers = [
98
+ "Verify every committed decision was web-researched or reality-checked rather than asserted from training data: current library/framework versions, that each named technology still exists and fits, and — greenfield — the live defaults of any starter it leans on. Flag anything that could be out of date and wasn't confirmed against the web, the existing project, or the current starter.",
99
+ "Attack the spine as an adversary: construct two units one level down that each obey every AD to the letter yet still build incompatibly — clashing shared-data shapes, two owners of one entity, conflicting state-mutation paths. Every pair you find is a hole to close with a new or tightened AD.",
100
+ ]
@@ -0,0 +1,26 @@
1
+ # Headless
2
+
3
+ No interactive user: infer everything, ask nothing, but never invent — record inferences as `assumptions[]` and gaps that need a human as `open_questions[]`. Detect headless from a `headless: true` flag, a non-interactive / no-TTY invocation, an activation hook that declares it, or a first message that pre-supplies all inputs and asks for an artifact path back; when ambiguous, default to interactive.
4
+
5
+ Drive the run from the payload in the first message — `intent`, `altitude`, `purpose`, the driving input (spec package / PRD / raw intent / brownfield path), a parent spine path at lower altitude, and `doc_workspace` if a specific folder is required. Infer anything absent from the inputs or workspace; don't invent stack, constraints, or scope to fill a gap. You still verify named tech on the web (you can't ask, but you can check) and still drive every write through the shared `{project-root}/_bmad/scripts/memlog.py`. Run the full Reviewer Gate (`references/reviewer-gate.md`) non-interactively: `scripts/lint_spine.py` plus **every `{workflow.finalize_reviewers}` lens as a parallel subagent** (and any ad-hoc lens the spine's criticality warrants). Headless skips only the human picking from the menu — never the reviewers themselves; apply the clear fixes and record anything unresolved in `open_questions[]`. For a true authority collision, list it in `conflicts_with_prior_decisions[]`. For the Validate intent, always write the report to `{doc_workspace}` and add `"offer_to_update": true`. If intent stays ambiguous after inference, halt blocked.
6
+
7
+ End with JSON only, omitting keys for artifacts not produced — the shape below is the fully-produced (`complete`) case; a `blocked` run produces no spine, so it omits `spine`, `memlog`, and `companions` entirely (see the note under the block):
8
+
9
+ ```json
10
+ {
11
+ "status": "complete | partial | blocked",
12
+ "intent": "create | update | validate",
13
+ "altitude": "initiative | feature | epic",
14
+ "purpose": "build-substrate | discussion",
15
+ "doc_workspace": "<resolved run folder>",
16
+ "spine": "{doc_workspace}/ARCHITECTURE-SPINE.md",
17
+ "memlog": "{doc_workspace}/.memlog.md",
18
+ "companions": [],
19
+ "assumptions": [],
20
+ "open_questions": [],
21
+ "conflicts_with_prior_decisions": [],
22
+ "reason": "<one line, only when blocked>"
23
+ }
24
+ ```
25
+
26
+ `complete` stands alone · `partial` (spine produced, but `open_questions[]` non-empty or critical inputs inferred) means review before downstream use · `blocked` means no spine produced — return only `status`, `intent`, `reason`, and `doc_workspace` (if bound), omitting `spine`, `memlog`, `companions`, and the artifact arrays that don't exist.
@@ -0,0 +1,13 @@
1
+ # Reviewer Gate
2
+
3
+ The spine's pre-handoff review. Runs at Finalize (after distill + reconcile) and *is* the Validate intent. The difference is the ending: at Finalize you apply the clear fixes yourself; under Validate you report and don't change the spine.
4
+
5
+ Cheap deterministic pass first: `uv run {skill-root}/scripts/lint_spine.py --workspace {doc_workspace}` settles the mechanical misses (placeholders, duplicate `AD` IDs, missing Binds/Prevents/Rule, unpinned Stack versions), so reviewers spend judgment on the semantic half.
6
+
7
+ Assemble the menu: a **rubric walker** that judges the spine against the good-spine checklist below, **+ every entry in `{workflow.finalize_reviewers}`**, + ad-hoc lenses you invent or offer as the spine's rigor, altitude, and criticality warrant — a security/compliance lens for regulated stakes, a seam reviewer cross-team, a data-integrity lens for a heavy data model. Scale *whether and how heavily the gate runs* to the stakes: a throwaway prototype may run it quietly or skip the gate entirely; a high-criticality or platform-altitude spine earns more lenses and the explicit all / subset / skip menu. But once the gate runs, the `{workflow.finalize_reviewers}` always run — they are the configured floor, never cherry-picked out; only the ad-hoc lenses are optional. (Headless never skips the gate.)
8
+
9
+ Dispatch every entry as a **parallel subagent against `ARCHITECTURE-SPINE.md`** (prefix convention: `skill:` / `file:` / plain text). Each writes its full review to `{doc_workspace}/reviews/review-{slug}.md` — a subfolder, so the gate's scratch stays out of the deliverable folder — and returns ONLY a compact summary (verdict, top 2–5 findings, file path) — the parent never holds full review text. An inline self-check does not count: the independent context is the point, because a fresh reviewer finds the divergences the author talks past. If subagents are unavailable, run sequentially — write the file first, then flush it from context.
10
+
11
+ **Good-spine checklist** (what the rubric walker judges): it fixes the real divergence points for the level below and misses none; every `AD`'s Rule is enforceable and actually prevents its stated divergence; nothing under Deferred could let two units diverge; named tech is verified-current; it ratifies rather than contradicts a brownfield codebase; if a spec drove it, it covers that spec's capabilities; if a parent spine is inherited, no new `AD` weakens or contradicts an inherited one; and every dimension the altitude owns is decided, deferred, or an open question — a whole dimension left silent is a finding, especially the operational/environmental envelope (deployment & environments, infra/provider strategy, operations) a domain-focused draft skips.
12
+
13
+ Surface findings tiered, never dumped: a one-sentence gate verdict, then critical + high; medium/low roll into a tail ("plus N more in {file}"). Per finding: autofix, discuss, defer to Deferred / open items, or ignore. **At Finalize this is your own gate — apply the clear fixes rather than handing over a list; surface only what genuinely needs the user.** Under the **Validate intent**, fold every reviewer's output into one bespoke HTML + markdown report and open the HTML.
@@ -0,0 +1,257 @@
1
+ #!/usr/bin/env python3
2
+ # /// script
3
+ # requires-python = ">=3.10"
4
+ # ///
5
+ """lint-spine — the mechanical half of spine decision-integrity, done deterministically.
6
+
7
+ LLMs miscount IDs and miss literal placeholders; a grep does not. This linter owns the
8
+ checks a script does better than a prompt, and leaves the semantic half (is each Rule
9
+ actually enforceable? does the boundary make sense?) to the rubric walker.
10
+
11
+ It reads ARCHITECTURE-SPINE.md from a workspace and reports, as compact JSON on stdout:
12
+
13
+ - placeholder literal TBD / TODO / "similar to AD-n" / unfilled {template-token}
14
+ - ad_id duplicate or non-monotonic AD-n identifiers
15
+ - ad_fields an AD-n block missing Binds / Prevents / Rule
16
+ - version_pin a ## Stack table row with no version
17
+
18
+ Fenced code blocks are blanked (replaced with equal-count blank lines) before scanning, so
19
+ mermaid and source trees don't trip false positives AND reported line numbers still line up
20
+ with the real file. Reported lines are absolute file lines (frontmatter offset added). Exit
21
+ code is always 0 — findings travel in the JSON; the caller (Reviewer Gate / rubric walker)
22
+ decides what to do with them.
23
+ """
24
+ from __future__ import annotations
25
+
26
+ import argparse
27
+ import json
28
+ import re
29
+ import sys
30
+ from pathlib import Path
31
+
32
+ SPINE = "ARCHITECTURE-SPINE.md"
33
+
34
+ AD_HEADING = re.compile(r"^#{2,4}\s*AD-(\d+)\b(.*)$", re.MULTILINE)
35
+ HEADING = re.compile(r"^#{1,6}\s", re.MULTILINE)
36
+ FENCE = re.compile(r"```.*?```", re.DOTALL)
37
+ PLACEHOLDER_WORD = re.compile(r"\b(TBD|TODO|FIXME|XXX)\b")
38
+ SIMILAR_TO = re.compile(r"similar to AD-\d+", re.IGNORECASE)
39
+ TEMPLATE_TOKEN = re.compile(r"\{[a-z_][a-z0-9_ /.-]*\}")
40
+
41
+
42
+ def split_frontmatter(text: str) -> tuple[str, str, int]:
43
+ """Return (frontmatter, body, body_line_offset).
44
+
45
+ Frontmatter is the content between the first two lines that are *exactly* `---`
46
+ (line-exact, like memlog.split — a `---` inside a value or a body thematic break never
47
+ truncates it). body_line_offset is the number of file lines before the body begins, so a
48
+ body-relative line number plus the offset gives the absolute file line. Absent frontmatter
49
+ → ('', text, 0)."""
50
+ lines = text.split("\n")
51
+ if lines and lines[0] == "---":
52
+ for i in range(1, len(lines)):
53
+ if lines[i] == "---":
54
+ fm = "\n".join(lines[1:i])
55
+ body = "\n".join(lines[i + 1:])
56
+ return fm, body, i + 1
57
+ return "", text, 0
58
+
59
+
60
+ def blank_fences(text: str) -> str:
61
+ """Replace each fenced block with the same number of newlines, so scanning skips fenced
62
+ content while every line number outside the fence stays put."""
63
+ return FENCE.sub(lambda m: "\n" * m.group(0).count("\n"), text)
64
+
65
+
66
+ def line_of(text: str, idx: int) -> int:
67
+ return text.count("\n", 0, idx) + 1
68
+
69
+
70
+ def find_placeholders(body: str, offset: int) -> list[dict]:
71
+ findings: list[dict] = []
72
+ scan = blank_fences(body)
73
+ # (regex, label, severity) — TBD/TODO and dangling cross-refs are unambiguous; a bare
74
+ # {template-token} can be legitimate brace prose, so it is flagged low ("possible") to keep
75
+ # the mechanical pass near-zero false-positive rather than train reviewers to ignore it.
76
+ for rx, label, severity in (
77
+ (PLACEHOLDER_WORD, "placeholder marker", "high"),
78
+ (SIMILAR_TO, "unresolved cross-reference", "high"),
79
+ (TEMPLATE_TOKEN, "possible unfilled template token (verify)", "low"),
80
+ ):
81
+ for m in rx.finditer(scan):
82
+ findings.append({
83
+ "category": "placeholder",
84
+ "severity": severity,
85
+ "detail": f"{label}: {m.group(0)!r}",
86
+ "location": f"{SPINE} (line {offset + line_of(scan, m.start())})",
87
+ })
88
+ return findings
89
+
90
+
91
+ def find_frontmatter_placeholders(frontmatter: str) -> list[dict]:
92
+ """Catch unfilled tokens left in frontmatter (e.g. paradigm/scope/date) — part of the
93
+ spine contract, but outside the body that find_placeholders scans."""
94
+ findings: list[dict] = []
95
+ for rx, label, severity in (
96
+ (PLACEHOLDER_WORD, "placeholder marker", "high"),
97
+ (TEMPLATE_TOKEN, "possible unfilled template token (verify)", "low"),
98
+ ):
99
+ for m in rx.finditer(frontmatter):
100
+ findings.append({
101
+ "category": "placeholder",
102
+ "severity": severity,
103
+ "detail": f"frontmatter {label}: {m.group(0)!r}",
104
+ "location": f"{SPINE} frontmatter (line {1 + line_of(frontmatter, m.start())})",
105
+ })
106
+ return findings
107
+
108
+
109
+ def find_ad_issues(body: str, offset: int) -> list[dict]:
110
+ findings: list[dict] = []
111
+ scan = blank_fences(body) # AD headings shown inside a code fence are not live ADs
112
+ matches = list(AD_HEADING.finditer(scan))
113
+ seen: dict[int, int] = {}
114
+ prev: int | None = None
115
+ for m in matches:
116
+ num = int(m.group(1))
117
+ file_line = offset + line_of(scan, m.start())
118
+ loc = f"{SPINE} AD-{num} (line {file_line})"
119
+ if num in seen:
120
+ findings.append({
121
+ "category": "ad_id",
122
+ "severity": "high",
123
+ "detail": f"AD-{num} id reused (also at line {seen[num]})",
124
+ "location": loc,
125
+ })
126
+ else:
127
+ seen[num] = file_line
128
+ if prev is not None and num <= prev:
129
+ findings.append({
130
+ "category": "ad_id",
131
+ "severity": "high",
132
+ "detail": f"AD-{num} is non-monotonic (follows AD-{prev}); ids must ascend and never renumber",
133
+ "location": loc,
134
+ })
135
+ prev = num if prev is None else max(prev, num)
136
+
137
+ # block text = from this heading to the next heading of any level
138
+ start = m.end()
139
+ nxt = HEADING.search(scan, start)
140
+ block = scan[start:nxt.start()] if nxt else scan[start:]
141
+ low = block.lower()
142
+ missing = [f for f in ("binds", "prevents", "rule") if f not in low]
143
+ if missing:
144
+ findings.append({
145
+ "category": "ad_fields",
146
+ "severity": "high",
147
+ "detail": f"AD-{num} missing required field(s): {', '.join(missing)}",
148
+ "location": loc,
149
+ })
150
+ return findings
151
+
152
+
153
+ def find_unpinned_stack(body: str, offset: int) -> list[dict]:
154
+ """Flag a `## Stack` table row that names something but leaves its version blank or a
155
+ placeholder. Pinning lives in the body table now, not frontmatter. A row whose name is
156
+ still a `{token}` skeleton is left to the placeholder pass, not double-reported here.
157
+
158
+ Fences are blanked first (like find_placeholders / find_ad_issues), so a pipe-row or
159
+ heading inside a code block is never read as live Stack content. The heading match is
160
+ `## Stack` with a word boundary, so a renamed heading (`## Stack & Versions`) still
161
+ counts. Name and Version columns are located from the header row, so a reordered table
162
+ pairs name to version correctly; both default to the canonical positions (0, 1)."""
163
+ findings: list[dict] = []
164
+ in_stack = False
165
+ header_seen = False
166
+ name_idx, ver_idx = 0, 1
167
+ scan = blank_fences(body)
168
+ for i, raw in enumerate(scan.splitlines()):
169
+ if HEADING.match(raw):
170
+ in_stack = re.match(r"^##\s+Stack\b", raw) is not None
171
+ header_seen = False
172
+ name_idx, ver_idx = 0, 1
173
+ continue
174
+ if not in_stack or not raw.lstrip().startswith("|"):
175
+ continue
176
+ if set(raw.strip()) <= set("|-: "):
177
+ continue # separator row
178
+ cells = _table_cells(raw)
179
+ if not header_seen:
180
+ header_seen = True
181
+ for j, c in enumerate(cells):
182
+ if c.lower() == "name":
183
+ name_idx = j
184
+ elif c.lower() == "version":
185
+ ver_idx = j
186
+ continue
187
+ name = cells[name_idx] if len(cells) > name_idx else ""
188
+ version = cells[ver_idx] if len(cells) > ver_idx else ""
189
+ if not name or TEMPLATE_TOKEN.search(name):
190
+ continue
191
+ if not version or TEMPLATE_TOKEN.search(version):
192
+ findings.append({
193
+ "category": "version_pin",
194
+ "severity": "medium",
195
+ "detail": f"Stack entry {name!r} has no version",
196
+ "location": f"{SPINE} (line {offset + i + 1})",
197
+ })
198
+ return findings
199
+
200
+
201
+ def _table_cells(row: str) -> list[str]:
202
+ """Split a markdown table row into trimmed cells, dropping the leading/trailing pipe."""
203
+ s = row.strip()
204
+ if s.startswith("|"):
205
+ s = s[1:]
206
+ if s.endswith("|"):
207
+ s = s[:-1]
208
+ return [c.strip() for c in s.split("|")]
209
+
210
+
211
+ def lint(text: str) -> dict:
212
+ frontmatter, body, offset = split_frontmatter(text)
213
+ findings: list[dict] = []
214
+ findings += find_frontmatter_placeholders(frontmatter)
215
+ findings += find_placeholders(body, offset)
216
+ findings += find_ad_issues(body, offset)
217
+ findings += find_unpinned_stack(body, offset)
218
+ counts: dict[str, int] = {}
219
+ for f in findings:
220
+ counts[f["severity"]] = counts.get(f["severity"], 0) + 1
221
+ return {
222
+ "ok": len(findings) == 0,
223
+ "spine": SPINE,
224
+ "total_findings": len(findings),
225
+ "by_severity": counts,
226
+ "findings": findings,
227
+ }
228
+
229
+
230
+ def main(argv: list[str] | None = None) -> int:
231
+ ap = argparse.ArgumentParser(description="Lint an architecture spine for mechanical integrity.")
232
+ ap.add_argument("--workspace", required=True, help="run folder containing ARCHITECTURE-SPINE.md")
233
+ ap.add_argument("-o", "--output", help="write JSON here instead of stdout")
234
+ args = ap.parse_args(argv)
235
+
236
+ spine_path = Path(args.workspace) / SPINE
237
+ if not spine_path.exists():
238
+ result = {"ok": False, "error": f"{spine_path} not found", "findings": [], "total_findings": 0}
239
+ else:
240
+ try:
241
+ text = spine_path.read_text(encoding="utf-8")
242
+ except (OSError, UnicodeDecodeError) as e:
243
+ # honor the "exit code is always 0" contract: a read/decode failure travels in JSON
244
+ result = {"ok": False, "error": f"could not read {spine_path}: {e}", "findings": [], "total_findings": 0}
245
+ else:
246
+ result = lint(text)
247
+
248
+ out = json.dumps(result, indent=2)
249
+ if args.output:
250
+ Path(args.output).write_text(out + "\n", encoding="utf-8")
251
+ else:
252
+ print(out)
253
+ return 0
254
+
255
+
256
+ if __name__ == "__main__":
257
+ sys.exit(main())