@akjamie/agentic-sdlc 0.0.0-stage → 1.1.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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +219 -2
  3. package/assets/ci/asdlc-ai-review.yml +65 -0
  4. package/assets/config/config.yaml +76 -0
  5. package/assets/githooks/post-merge +22 -0
  6. package/assets/githooks/pre-push +17 -0
  7. package/assets/policy/policy.yaml +46 -0
  8. package/assets/schema/schema.yaml +168 -0
  9. package/assets/schema/templates/design.md +134 -0
  10. package/assets/schema/templates/proposal.md +25 -0
  11. package/assets/schema/templates/review.md +24 -0
  12. package/assets/schema/templates/spec.md +37 -0
  13. package/assets/schema/templates/tasks.md +10 -0
  14. package/assets/skills/asdlc-apply/SKILL.md +128 -0
  15. package/assets/skills/asdlc-approve/SKILL.md +107 -0
  16. package/assets/skills/asdlc-archive/SKILL.md +49 -0
  17. package/assets/skills/asdlc-doctor/SKILL.md +82 -0
  18. package/assets/skills/asdlc-impl-review/SKILL.md +219 -0
  19. package/assets/skills/asdlc-init/SKILL.md +68 -0
  20. package/assets/skills/asdlc-lint/SKILL.md +59 -0
  21. package/assets/skills/asdlc-new/SKILL.md +107 -0
  22. package/assets/skills/asdlc-pr/SKILL.md +59 -0
  23. package/assets/skills/asdlc-review/SKILL.md +80 -0
  24. package/assets/skills/asdlc-spec-review/SKILL.md +206 -0
  25. package/assets/skills/asdlc-status/SKILL.md +49 -0
  26. package/assets/skills/asdlc-upgrade/SKILL.md +34 -0
  27. package/assets/skills/asdlc-verify/SKILL.md +55 -0
  28. package/assets/skills/batch-grill-me/SKILL.md +136 -0
  29. package/assets/skills/grilling/SKILL.md +136 -0
  30. package/bin/asdlc.js +6 -0
  31. package/package.json +43 -4
  32. package/src/cli.js +89 -0
  33. package/src/commands/apply.js +114 -0
  34. package/src/commands/approve.js +166 -0
  35. package/src/commands/archive.js +143 -0
  36. package/src/commands/doctor.js +163 -0
  37. package/src/commands/init.js +201 -0
  38. package/src/commands/lint.js +127 -0
  39. package/src/commands/new.js +171 -0
  40. package/src/commands/pr.js +495 -0
  41. package/src/commands/skills.js +184 -0
  42. package/src/commands/status.js +65 -0
  43. package/src/commands/test.js +137 -0
  44. package/src/commands/update.js +103 -0
  45. package/src/commands/upgrade.js +175 -0
  46. package/src/commands/verify.js +229 -0
  47. package/src/index.js +3 -0
  48. package/src/lib/agents.js +73 -0
  49. package/src/lib/cliutil.js +99 -0
  50. package/src/lib/errors.js +18 -0
  51. package/src/lib/exec.js +23 -0
  52. package/src/lib/fs.js +83 -0
  53. package/src/lib/git.js +76 -0
  54. package/src/lib/graphify.js +106 -0
  55. package/src/lib/log.js +15 -0
  56. package/src/lib/openspec.js +91 -0
  57. package/src/lib/paths.js +43 -0
  58. package/src/lib/policy.js +60 -0
  59. package/src/lib/prtype.js +41 -0
  60. package/src/lib/schema.js +86 -0
  61. package/src/lib/speclint.js +173 -0
  62. package/src/lib/tdd.js +71 -0
  63. package/src/lib/yaml.js +18 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 akjamie
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,220 @@
1
- # Temporary Holding Version
1
+ # agentic-sdlc
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **BLUF** — Enterprise-grade Agentic Software Development Lifecycle (SDLC) governance.
4
+ > Seven stages take a feature from natural language intent to production, with governance
5
+ > **enforced by deterministic gates**, not by hope. Built on [OpenSpec](https://openspec.dev)
6
+ > and [Graphify](https://github.com/safishamsi/graphify); the governance plane is yours.
7
+
8
+ ---
9
+
10
+ ## Contents
11
+
12
+ - [What problem this solves](#what-problem-this-solves)
13
+ - [Three-Plane Architecture](#three-plane-architecture)
14
+ - [Bundled Out-of-the-Box Skills](#bundled-out-of-the-box-skills)
15
+ - [Install & Setup](#install--setup)
16
+ - [The Seven Stages](#the-seven-stages)
17
+ - [What `asdlc verify` Checks](#what-asdlc-verify-checks)
18
+ - [Governance Principles](#governance-principles)
19
+ - [Documentation Hub](#documentation-hub)
20
+ - [Development & Verification](#development--verification)
21
+
22
+ ---
23
+
24
+ ## What problem this solves
25
+
26
+ Spec-driven development works — until you scale it past one team or turn AI agents loose on production code. OpenSpec manages spec documents, but it **enforces nothing** at runtime. Nothing stops a developer or an autonomous agent from merging code that contradicts the approved spec, shipping without tests, or silently editing the spec after the fact.
27
+
28
+ `asdlc` closes that gap. It adds a deterministic governance plane *on top of* the engines:
29
+
30
+ - **Intent-Driven Start**: Developers start with natural language requirements (`asdlc new "i want to build..."`), not artificial ticket IDs. Canonical slugs are automatically derived, and knowledge graph queries are seeded with real domain terms.
31
+ - **High-Efficiency Batch Grilling**: A bundled interview engine (**`batch-grill-me`**) stress-tests the entire decision frontier in 1-2 structured batches with recommended defaults *before* writing specs. Decisions are recorded in `clarifications.md`.
32
+ - **The Spec is the Authority**: Merged to the protected branch, the spec is immutable. If reality diverges during implementation, the Converge protocol halts affected work (`SPEC_GAP`) — you never silently mutate an approved spec.
33
+ - **Enforced Task-Level TDD**: Unlocking implementation (`asdlc apply`) requires approved spec commits, while `asdlc verify` deterministically checks `test-presence` (rejects code changes without test changes in diff) and `tdd-evidence` (validates recorded test outputs).
34
+ - **Player ≠ Referee**: Independent AI verification uses a different model and a fresh context than the authoring agent.
35
+
36
+ ---
37
+
38
+ ## Three-Plane Architecture
39
+
40
+ ```
41
+ ┌─────────────────────────────────────────────────────────────────────────────┐
42
+ │ PLANE 3: Agentic IDE Skills & Commands (.agents/skills, .claude/skills, ...)│
43
+ │ ● asdlc:new ● asdlc:lint ● asdlc:review ● asdlc:apply ● asdlc:verify │
44
+ │ ● Bundled Engines: grilling (batch-grill-me), asdlc-apply (TDD Red-Green) │
45
+ └──────────────────────────────────────┬──────────────────────────────────────┘
46
+ │ runs CLI with --json
47
+ ┌──────────────────────────────────────▼──────────────────────────────────────┐
48
+ │ PLANE 2: Governance CLI & CI Gate (asdlc init/new/lint/approve/apply/verify)│
49
+ │ ● Path-limited approval evidence ● Deterministic BDD/AC linters │
50
+ │ ● Diff-based test presence gate ● Schema version pin & override guard │
51
+ └──────────────────────────────────────┬──────────────────────────────────────┘
52
+ │ calls pure functions
53
+ ┌──────────────────────────────────────▼──────────────────────────────────────┐
54
+ │ PLANE 1: Core Library (src/lib/ — zero side-effects, fully unit-tested) │
55
+ │ ● speclint ● tdd ● prtype ● policy ● graphify ● schema ● agents │
56
+ └─────────────────────────────────────────────────────────────────────────────┘
57
+ ```
58
+
59
+ For complete technical specifications of each plane, see [docs/architecture.md](docs/architecture.md).
60
+
61
+ ---
62
+
63
+ ## Bundled Out-of-the-Box Skills
64
+
65
+ `asdlc` does not assume or require external user-level skills to be pre-installed. All critical agent harnesses are **packaged inside `asdlc` and installed automatically upon `asdlc init`**:
66
+
67
+ | Stage & Skill | Purpose & Behavior |
68
+ | :--- | :--- |
69
+ | **Stage 1 · Init**<br>[`asdlc-init`](assets/skills/asdlc-init/SKILL.md) | Bootstraps repository: OpenSpec, Graphify AST engine, governance schema, policies, git hooks, and agent skills. |
70
+ | **Stage 2 · New**<br>[`asdlc-new`](assets/skills/asdlc-new/SKILL.md) | Grounds intent in Graphify AST queries, seeds `clarifications.md`, and runs bundled **`batch-grill-me`** interview. |
71
+ | **Stage 3 · Spec PR**<br>[`asdlc-pr`](assets/skills/asdlc-pr/SKILL.md) | Enforces deterministic BDD/AC linting (R0–R8) and opens Spec PR (CLI → REST API → 1-click Web URL) with auto-labels. |
72
+ | **Stage 3 · Spec AI Review**<br>[`asdlc-spec-review`](assets/skills/asdlc-spec-review/SKILL.md) | CI-triggered independent 6-dimension spec evaluation; posts structured markdown findings and traceability matrix as PR comments via `gh`. |
73
+ | **Stage 4 · Approve (Optional)**<br>[`asdlc-approve`](assets/skills/asdlc-approve/SKILL.md) | *(Optional)* Explicit audit stamp after PR merge (`specSha` + `READY_FOR_IMPL`). Auto-recognized by `apply`. |
74
+ | **Stage 5 · Apply**<br>[`asdlc-apply`](assets/skills/asdlc-apply/SKILL.md) | Path-isolated zero-diff guard; executes strict **Red -> Green -> Refactor -> Evidence -> Converge** TDD loop. |
75
+ | **Stage 6 · Verify**<br>[`asdlc-verify`](assets/skills/asdlc-verify/SKILL.md) | 12-gate implementation verification: test presence, task evidence, AC test mapping, and independent AI verifier. |
76
+ | **Stage 6.5 · Impl AI Review**<br>[`asdlc-impl-review`](assets/skills/asdlc-impl-review/SKILL.md) | CI-triggered independent implementation evaluation (AC conformance matrix, code quality, TDD evidence); posts markdown findings as PR comments via `gh`. |
77
+ | **Stage 7 · Archive**<br>[`asdlc-archive`](assets/skills/asdlc-archive/SKILL.md) | Deliberate closeout: syncs specs to master catalog, refreshes code AST graph, and updates system status. |
78
+ | **Diagnostics**<br>[`asdlc-doctor`](assets/skills/asdlc-doctor/SKILL.md) | Evaluates 12 toolchain/governance invariants; provides automated 1-click remediation (`--fix`). |
79
+ | **Orientation**<br>[`asdlc-status`](assets/skills/asdlc-status/SKILL.md) | Shows change stage progress, active artifacts, next command, or full portfolio dashboard. |
80
+
81
+ ---
82
+
83
+ ## Install & Setup
84
+
85
+ `asdlc` supports multiple installation methods depending on your environment:
86
+
87
+ ```bash
88
+ # Option A: From npm registry (Recommended)
89
+ npm install -g @akjamie/agentic-sdlc
90
+
91
+ # Option B: Directly from GitHub repository (npm v12+ requires --allow-git=all)
92
+ npm install -g --allow-git=all git+https://github.com/akjamie/agentic-sdlc.git
93
+
94
+ # Option C: Local development repository
95
+ npm install -g .
96
+
97
+ # Initialize repository (installs OpenSpec engine, Graphify, policy, and bundled skills)
98
+ asdlc init --ci jenkins
99
+ ```
100
+
101
+ Verify setup health at any time:
102
+
103
+ ```bash
104
+ asdlc doctor
105
+ ```
106
+
107
+ ---
108
+
109
+ ## The Seven Stages
110
+
111
+ ```mermaid
112
+ flowchart LR
113
+ S1["1 · init<br/>setup + skills"] --> S2["2 · new<br/>intent + grill"]
114
+ S2 --> S3["3 · spec pr<br/>lint + open Spec PR"]
115
+ S3 --> S4["4 · approve (optional)<br/>audit check"]
116
+ S4 --> S5["5 · apply<br/>TDD loop"]
117
+ S5 --> S6["6 · verify<br/>12 gates (local)"]
118
+ S6 --> PR2["Impl PR<br/>asdlc pr (CI AI Review)"]
119
+ PR2 --> S7["7 · archive<br/>sync + graph"]
120
+
121
+ style S1 fill:#e8f4fd,stroke:#2196f3
122
+ style S2 fill:#e8f4fd,stroke:#2196f3
123
+ style S3 fill:#e8f4fd,stroke:#2196f3
124
+ style S4 fill:#fff3e0,stroke:#ff9800
125
+ style S5 fill:#e8f5e9,stroke:#4caf50
126
+ style S6 fill:#fff3e0,stroke:#ff9800
127
+ style PR2 fill:#e8f5e9,stroke:#4caf50
128
+ style S7 fill:#f3e5f5,stroke:#9c27b0
129
+ ```
130
+
131
+ | Stage & Command | Lifecycle Action & Governance Guard |
132
+ | :--- | :--- |
133
+ | **1 · Init**<br>`asdlc init [--ci jenkins]` | Bootstraps OpenSpec + Graphify, governance schema, policy, and 8+ agent tools. |
134
+ | **2 · New**<br>`asdlc new "<requirement>" [--design]` | Derives slug, auto-seeds `design.md` for UI/API systems, queries code graph, guides 3rd-party research with offline degradation, and interviews author via `batch-grill-me`. |
135
+ | **3 · Spec PR**<br>`asdlc pr <ID> <targetBranch>` | Pre-flight BDD/AC and technical design linting (`asdlc lint`), attaches `asdlc:spec-review` label, triggers CI Spec AI Review before human approval. |
136
+ | **4 · Approve (Optional)**<br>`asdlc approve <ID>` | *(Optional)* Explicit audit stamp after Spec PR merge. `asdlc apply` automatically detects merged PRs if skipped. |
137
+ | **5 · Apply**<br>`asdlc apply <ID>` | Multi-tenant zero-diff guard; launches `/asdlc:apply` task-level TDD Red-Green engine guided by approved specs and `design.md`. |
138
+ | **6 · Verify (Local)**<br>`asdlc verify <ID>` | Local pre-flight self-check across 12 deterministic gates (test-presence, tdd-evidence, AC mappings, external tests). |
139
+ | **6.5 · Impl PR**<br>`asdlc pr <ID> <targetBranch>` | Pre-flight implementation verification, pushes impl branch, attaches `asdlc:impl-review` label, triggers CI Code AI Review before merge. |
140
+ | **7 · Archive**<br>`asdlc archive <ID>` | Syncs delta to `openspec/specs/`, creates `AGENTS.md` if missing, refreshes knowledge graph, and updates `AGENTS.md` system status. |
141
+
142
+ ### Dual-PR Governance & Label Dispatch
143
+
144
+ `asdlc pr` automatically detects whether you are submitting a **Spec PR** (Stage 3) or an **Implementation PR** (Stage 6.5) based on lifecycle state, branch, and approval history — completely autonomous with zero extra flags:
145
+
146
+ | PR Phase | Trigger Moment & Pre-flight | PR Labels | CI Automation Trigger | Human Action |
147
+ | :--- | :--- | :--- | :--- | :--- |
148
+ | **Spec PR** | After spec drafting; runs **`asdlc lint`** (0 blockers) | `asdlc:spec-review`<br>`spec` | Runs `asdlc lint` + triggers **Spec AI Review** (clarity, BDD scenarios, architecture alignment) | TL / Domain Lead approves & merges |
149
+ | **Impl PR** | After TDD implementation; runs **`asdlc verify`** (12 gates) | `asdlc:impl-review`<br>`impl` | Runs `asdlc verify` + triggers **Code AI Review** (diff analysis, style, edge cases) | Lead / Peer reviews code & merges |
150
+
151
+ **Navigation, Diagnostics & Workspace Maintenance:**
152
+ - `asdlc status <ID>`: Instant orientation on current stage and exact next command.
153
+ - `asdlc doctor [--fix]`: Comprehensive toolchain and policy health diagnostics with auto-remediation.
154
+ - `asdlc update`: Synchronizes repository SDLC state in seconds: refreshes repo-level agent skills (`.agents/skills`), rebuilds codebase AST knowledge graph (`graphify-out/` bound to `HEAD`), updates `AGENTS.md` system status & architectural hubs, and verifies git hooks. Fails fast with guidance if run outside an initialized repository.
155
+ - `asdlc upgrade [--global]`: Upgrades the machine toolchain (`asdlc` CLI, OpenSpec engine, Graphify, managed schema) and automatically updates the current repository if inside one, or global user skills (`~/.agents`) with `--global`.
156
+ - `asdlc skills list`: Lists all bundled skills available in agentic-sdlc.
157
+ - `asdlc skills install --global`: One-click setup on CI Linux VMs to inject skills into global agent directories (`~/.agents`, `~/.opencode`, `~/.pi`, `~/.dsh`) without polluting developer workspaces.
158
+
159
+ ---
160
+
161
+ ## What `asdlc verify` Checks
162
+
163
+ `asdlc verify` executes in local developer terminals and on CI (Jenkins) without drift:
164
+
165
+ ```mermaid
166
+ flowchart TB
167
+ V["asdlc verify"] --> C1["pr-type<br/>paths only discrimination"]
168
+ V --> C2["artifacts<br/>proposal + review + tasks + explore + spec"]
169
+ V --> C3["approved-spec<br/>git log verification on target branch"]
170
+ V --> C3b["spec-tamper<br/>locked spec paths unmodified in impl PR"]
171
+ V --> C4["flow-state<br/>READY_FOR_IMPL verification"]
172
+ V --> C5["tasks-complete<br/>all checkboxes resolved"]
173
+ V --> C6["test-presence<br/>code diff mandates test diff"]
174
+ V --> C7["tdd-evidence<br/>verified task output annotations"]
175
+ V --> C8["BDD + AC<br/>GIVEN/WHEN/THEN + AC→test mapping"]
176
+ V --> C9["openspec validate<br/>--all --strict"]
177
+ V --> C10["schema-managed<br/>central install + version pin"]
178
+ V --> C11["external<br/>unit tests · contract · security"]
179
+ V --> C12["AI verification<br/>independent referee model"]
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Governance Principles
185
+
186
+ 1. **Adopt the engines, own the governance plane.** OpenSpec and Graphify are adopted, not forked.
187
+ 2. **Approval is git.** A merged spec PR *is* the human approval; the gate proves it with a path-limited `git log`.
188
+ 3. **Fail-closed.** Any verification without an approved commit fails.
189
+ 4. **Deterministic first.** Linters, diff analyzers, and schema validators are pure functions (no LLM jitter).
190
+ 5. **Enforced TDD.** Implementation diffs touching production code without tests are rejected by `test-presence`.
191
+ 6. **Ground specs in code.** Graphify AST queries ground specifications in real code structure.
192
+ 7. **One front door.** Everything runs through `asdlc` — no raw escape hatches.
193
+
194
+ ---
195
+
196
+ ## Documentation Hub
197
+
198
+ | Document | Purpose |
199
+ |---|---|
200
+ | [docs/usage.md](docs/usage.md) | Practical command-line and developer walkthrough. |
201
+ | [docs/architecture.md](docs/architecture.md) | Complete 3-Plane Architecture & IDE Skill design specification. |
202
+ | [docs/solution-review.md](docs/solution-review.md) | Solution review, gap analysis, and architectural evaluation. |
203
+ | [docs/glossary.md](docs/glossary.md) | Formally locked domain model and SDLC vocabulary. |
204
+ | [docs/blueprint.html](docs/blueprint.html) | Enterprise Agentic SDLC Blueprint (English). |
205
+ | [docs/blueprint.zh.html](docs/blueprint.zh.html) | Enterprise Agentic SDLC Blueprint (Chinese). |
206
+
207
+ ---
208
+
209
+ ## Development & Verification
210
+
211
+ ```bash
212
+ npm install
213
+ npm test # 66 unit and integration tests (100% pass)
214
+ ```
215
+
216
+ ---
217
+
218
+ ## License
219
+
220
+ [MIT](LICENSE)
@@ -0,0 +1,65 @@
1
+ name: ASDLC AI Review
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, reopened, labeled]
6
+
7
+ permissions:
8
+ contents: read
9
+ pull-requests: write
10
+ statuses: write
11
+
12
+ jobs:
13
+ spec-ai-review:
14
+ name: Spec AI Review
15
+ if: contains(github.event.pull_request.labels.*.name, 'asdlc:spec-review')
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v4
20
+ with:
21
+ fetch-depth: 0
22
+
23
+ - name: Set up Node.js
24
+ uses: actions/setup-node@v4
25
+ with:
26
+ node-version: '20'
27
+
28
+ - name: Run Spec AI Review
29
+ env:
30
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31
+ PR_NUMBER: ${{ github.event.pull_request.number }}
32
+ REPO: ${{ github.repository }}
33
+ run: |
34
+ # Dispatch independent AI spec reviewer (Player != Referee)
35
+ # using asdlc-spec-review skill instructions.
36
+ # The agent evaluates the PR diff, posts findings directly as a PR comment,
37
+ # and sets the commit status check (asdlc/spec-ai-review).
38
+ echo "Spec AI Review triggered for PR #${PR_NUMBER} in ${REPO}"
39
+
40
+ impl-ai-review:
41
+ name: Implementation AI Review
42
+ if: contains(github.event.pull_request.labels.*.name, 'asdlc:impl-review')
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - name: Checkout code
46
+ uses: actions/checkout@v4
47
+ with:
48
+ fetch-depth: 0
49
+
50
+ - name: Set up Node.js
51
+ uses: actions/setup-node@v4
52
+ with:
53
+ node-version: '20'
54
+
55
+ - name: Run Implementation AI Review
56
+ env:
57
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58
+ PR_NUMBER: ${{ github.event.pull_request.number }}
59
+ REPO: ${{ github.repository }}
60
+ run: |
61
+ # Dispatch independent AI implementation reviewer (Player != Referee)
62
+ # using asdlc-impl-review skill instructions.
63
+ # The agent evaluates the PR diff against approved specs, posts findings as a PR comment,
64
+ # and sets the commit status check (asdlc/impl-ai-review).
65
+ echo "Implementation AI Review triggered for PR #${PR_NUMBER} in ${REPO}"
@@ -0,0 +1,76 @@
1
+ # asdlc governance overlay (managed by `asdlc init`).
2
+ # The BU-managed schema defines the enterprise change flow:
3
+ # proposal -> specs -> review -> design -> tasks
4
+ # with tasks generated AFTER approval (execution state, not intent).
5
+ schema: agentic-repo-change
6
+
7
+ context: |
8
+ This repo uses the Agentic SDLC flow. Everything runs through `asdlc`:
9
+ asdlc new <ID> start a spec (scaffold + refresh the graph + explore.md)
10
+ asdlc lint <ID> check the spec (artifacts + review + BDD/acceptance criteria)
11
+ asdlc approve <ID> after the spec PR merges: record the approved SHA
12
+ asdlc apply <ID> guard, then /opsx-apply
13
+ asdlc verify <ID> check the implementation
14
+ asdlc archive <ID> finish (refresh the graph + AGENTS.md)
15
+ - The spec PR carries intent: proposal + spec delta + review.md (a change-dir
16
+ convention). tasks.md is execution state, generated AFTER approval.
17
+ - A code knowledge graph runs behind the scenes (graphify-out/); `asdlc new`
18
+ refreshes it and writes explore.md so the spec is grounded in the real code,
19
+ not guesses. The graph is a navigation aid, not the source of truth.
20
+ - After `asdlc new`, GRILL the author using the grilling skill (design-tree
21
+ interview, in rounds) and record settled decisions in clarifications.md
22
+ BEFORE writing proposal.md / specs.
23
+ - `asdlc status <ID>` shows where you are; `asdlc doctor` checks the setup.
24
+ - A bad spec is never edited: close it and run `asdlc new <NEW-ID>` again.
25
+
26
+ rules:
27
+ proposal:
28
+ - "Reference any System Design or cross-repo contract this change touches."
29
+ - "Include Out of Scope and Dependencies & Assumptions sections."
30
+ specs:
31
+ - "Use SHALL/MUST. Each requirement needs a GIVEN/WHEN/THEN scenario (4 '#')."
32
+ - "Each requirement needs an 'Acceptance criteria' block: '- [ ] AC1: concrete assertion (test: path)'."
33
+ - "Add a '## Constraints & NFRs' section: performance, security, compliance as verifiable statements."
34
+ - "Add a '## Out of Scope' section: what this change explicitly does NOT cover."
35
+ - "Add a '## Test Strategy' section."
36
+ tasks:
37
+ - "Every task references the AC it implements: '- [ ] 1.1 desc (AC1) verify: how'."
38
+ - "Every task states how to verify completion in its own description."
39
+
40
+ # Per-operation guidance (read natively by OpenSpec's apply/archive workflows).
41
+ operations:
42
+ apply:
43
+ guidance:
44
+ - "Task-level TDD: failing test -> implement -> paste test output -> fresh-context review."
45
+ - "Never modify locked paths (proposal.md, specs/**). If the spec is wrong, STOP and"
46
+ - "close the change; start a fresh one with `asdlc new` - never edit an approved spec."
47
+ archive:
48
+ guidance:
49
+ - "BEFORE archiving, update AGENTS.md with anything durable this change taught:"
50
+ - "new conventions, commands, gotchas, module map changes (keep the asdlc routing"
51
+ - "block intact). AGENTS.md is the context layer for future agents."
52
+
53
+ # Lint policy (policy-as-code). Severity per rule: blocker | major | off.
54
+ lint:
55
+ version: "1"
56
+ rules:
57
+ R4-given: major
58
+ R6-ac-missing-test: blocker
59
+
60
+ # External checks run by `asdlc verify` (tests / contract / security), in a
61
+ # scrubbed environment (no secrets leak).
62
+ # gates:
63
+ # external:
64
+ # - name: unit-tests
65
+ # command: npm test
66
+ # - name: security
67
+ # command: npm audit --audit-level=high
68
+
69
+ # Independent AI verification (player != referee). The authoring agent (your IDE)
70
+ # writes the change; THIS verifier must be a different agent/model. Preferred:
71
+ # the CI-owned env ASDLC_VERIFY_COMMAND (trusted); the repo value is a fallback.
72
+ # It receives the verification prompt on stdin and prints strict JSON:
73
+ # {"verdict":"PASS|FAIL","summary":"...","requirements":[...]}
74
+ # verify:
75
+ # required: true
76
+ # command: "deepseek-verify --model deepseek-chat" # or: pi -p, codex exec, ...
@@ -0,0 +1,22 @@
1
+ #!/bin/sh
2
+ # asdlc post-merge: a merged spec PR IS the human approval (no store needed).
3
+ # Derive the approved SHA from the merge and stamp READY_FOR_IMPL so that task
4
+ # generation / implementation can start automatically.
5
+ #
6
+ # No global `asdlc` install is assumed: we try a local devDependency, then PATH,
7
+ # then an explicit toolkit checkout (ASDLC_TOOLKIT).
8
+ BRANCH="$(git symbolic-ref --quiet --short HEAD 2>/dev/null)"
9
+ case "$BRANCH" in main|master) ;; *) exit 0 ;; esac
10
+
11
+ run() { "$@" approve || echo "[asdlc] approval stamp skipped"; }
12
+
13
+ if [ -x node_modules/.bin/asdlc ]; then
14
+ run node_modules/.bin/asdlc
15
+ elif command -v asdlc >/dev/null 2>&1; then
16
+ run asdlc
17
+ elif [ -n "${ASDLC_TOOLKIT:-}" ] && [ -f "$ASDLC_TOOLKIT/bin/asdlc.js" ]; then
18
+ run node "$ASDLC_TOOLKIT/bin/asdlc.js"
19
+ else
20
+ echo "[asdlc] asdlc not found (local bin / PATH / ASDLC_TOOLKIT); skipping approval stamp"
21
+ fi
22
+ exit 0
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ # asdlc pre-push: trigger the Jenkins gate for this change. With a real SCM
3
+ # webhook + multibranch pipeline this is optional (demonstration/local use).
4
+ JENKINS_URL="${ASDLC_JENKINS_URL:-http://localhost:8080}"
5
+ BRANCH="$(git symbolic-ref --quiet --short HEAD 2>/dev/null)"
6
+ case "$BRANCH" in main|master) exit 0 ;; esac
7
+
8
+ CHANGE_ID="$(printf '%s' "${BRANCH##*/}" | tr '[:lower:]' '[:upper:]')"
9
+ MODE="lint"
10
+ case "$BRANCH" in *impl*) MODE="gate" ;; esac
11
+
12
+ echo "[asdlc] push: branch=$BRANCH change=$CHANGE_ID mode=$MODE"
13
+ curl -s -o /dev/null -w "[asdlc] jenkins trigger http=%{http_code}\n" -X POST \
14
+ "$JENKINS_URL/job/asdlc-pr/buildWithParameters" \
15
+ --data-urlencode "CHANGE_ID=$CHANGE_ID" \
16
+ --data-urlencode "MODE=$MODE" 2>/dev/null || echo "[asdlc] jenkins unreachable"
17
+ exit 0
@@ -0,0 +1,46 @@
1
+ # Platform-owned SDLC policy (v6 §7.3). Teams must NOT edit this file; protect
2
+ # it with CODEOWNERS. `asdlc init` writes a default; the platform team tunes it.
3
+ #
4
+ # PR type is decided by PATHS ONLY (the `asdlc verify` check `pr-type`).
5
+
6
+ # Paths that carry APPROVED INTENT: any change here needs the spec approver +
7
+ # AI review, and defines the "approved commit" (git log -1 <main> -- these).
8
+ locked_paths:
9
+ - "openspec/changes/*/proposal.md"
10
+ - "openspec/changes/*/specs/**"
11
+
12
+ # Paths under design control (design owner approves).
13
+ controlled:
14
+ - "openspec/changes/*/design.md"
15
+
16
+ # Fast path: no change dir, and every changed path is whitelisted.
17
+ fast_path:
18
+ allow_paths:
19
+ - "docs/**"
20
+ - "**/*.md"
21
+ allow_kinds: [typo, config-value, dependency-patch]
22
+
23
+ # Reviewers (CODEOWNERS-style handles).
24
+ reviewers:
25
+ spec: null
26
+ design: null
27
+
28
+ # AI review trigger policy (cost control).
29
+ ai_review:
30
+ trigger: on-ready-and-push
31
+ debounce_seconds: 120
32
+
33
+ # Rollout: per-check block|advisory (v6 §11 "先参考模式,再阻断").
34
+ # Check names match the `asdlc verify` rows, e.g. schema-managed, spec-quality,
35
+ # pr-type, approved-spec. Missing => block.
36
+ rollout_mode: {}
37
+
38
+ # Web search for agent fact-finding during grilling (Stage 2).
39
+ # allow: agent may search (default); deny: offline/air-gapped mode, agent skips search silently.
40
+ web_search: allow
41
+
42
+ # Issue tracker integration (optional). Set required: true to enforce a ticket link in verify.
43
+ # type: jira | github | linear | none
44
+ issue_tracker:
45
+ type: none
46
+ required: false
@@ -0,0 +1,168 @@
1
+ name: agentic-repo-change
2
+ version: 1
3
+ description: Agentic SDLC change flow - intent (proposal/specs/review) then, after approval, tasks
4
+ artifacts:
5
+ - id: proposal
6
+ generates: proposal.md
7
+ description: WHY this change is needed
8
+ template: proposal.md
9
+ instruction: |
10
+ Create the proposal establishing WHY this change is needed.
11
+
12
+ Sections:
13
+ - **Why**: 1-2 sentences on the problem or opportunity, and why now.
14
+ - **What Changes**: specific changes; mark breaking changes with **BREAKING**.
15
+ - **Capabilities**: which spec deltas will be created/modified. Each needs a
16
+ corresponding specs/**/*.md file.
17
+ - **Impact**: affected code, APIs, dependencies, systems.
18
+ - **Out of Scope**: what this change explicitly does NOT cover.
19
+ - **Dependencies & Assumptions**: what this assumes about other systems/teams.
20
+ - **System Design refs**: reference any System Design / cross-repo contract
21
+ this change touches (e.g. payment-settlement@v2). Leave empty if none.
22
+
23
+ Ground yourself in the codebase first: `asdlc new` refreshed the knowledge
24
+ graph and wrote explore.md (structured queries against the real code, not
25
+ guesses). Read explore.md, then READ the specific files it points to (and
26
+ openspec/specs/**) before writing. If you need more detail, query the
27
+ graph directly: `graphify query "<q>"` / `graphify explain <node>` /
28
+ `graphify path <A> <B>`. The graph is a navigation map, never the truth.
29
+
30
+ Keep it 1-2 pages. Focus on WHY; HOW belongs in design.md.
31
+ requires: []
32
+
33
+ - id: specs
34
+ generates: "specs/**/*.md"
35
+ description: Approved intent - behavior contract for this repo
36
+ template: spec.md
37
+ instruction: |
38
+ Create the spec delta(s). This is the APPROVED INTENT artifact, not an
39
+ implementation plan. Enforced by `asdlc lint`:
40
+
41
+ Ground yourself in the codebase first: `asdlc new` refreshed the knowledge
42
+ graph and wrote explore.md. Read explore.md, then READ the files it points
43
+ to (and openspec/specs/**) before writing. The graph is a map, not the truth.
44
+
45
+ - Each requirement: `### Requirement: <name>` using SHALL/MUST.
46
+ - Each scenario: `#### Scenario: <name>` with GIVEN / WHEN / THEN (4 '#').
47
+ - Each requirement needs an `**Acceptance criteria**` block:
48
+ `- [ ] AC1: <concrete, testable assertion - not prose> (test: <path/to/test>)`
49
+ - Add a `## Constraints & NFRs` section: performance, security, compliance
50
+ as verifiable statements, not adjectives (e.g. "p99 < 200ms for read ops").
51
+ - Add a `## Out of Scope` section: what this change explicitly does NOT cover.
52
+ - Add a `## Test Strategy` section describing how every AC is verified.
53
+ - New capabilities: first section is `## Purpose` (50+ chars).
54
+ - Every requirement must reference its Jira story (the change ID is the key).
55
+
56
+ Exclude internal class/function names and implementation steps - those
57
+ belong in design.md or tasks.md.
58
+
59
+ IMPORTANT: once approved (PR merged) this is IMMUTABLE. Never edit it to
60
+ record execution state - that is what tasks.md is for.
61
+ requires:
62
+ - proposal
63
+
64
+ - id: review
65
+ generates: review.md
66
+ description: Independent fresh-context review output (read-only)
67
+ template: review.md
68
+ instruction: |
69
+ You are an INDEPENDENT reviewer with a FRESH CONTEXT, different from the
70
+ Draft agent. You MUST NOT modify proposal.md, specs/** or tasks.md. Your
71
+ only output is review.md.
72
+
73
+ Give a verdict per dimension (PASS / CONCERN / FAIL):
74
+ Completeness, Ambiguity, Cross-repo consistency, Contract impact,
75
+ Testability, Security.
76
+
77
+ Findings must have severity: blocker / major / minor.
78
+
79
+ Also produce a requirement -> implementation -> test mapping table
80
+ (implementation/test may be TBD pre-code; AC must be listed).
81
+
82
+ End with an overall verdict APPROVE / NEEDS_REVISION and the blocking
83
+ findings. Do not rubber-stamp.
84
+ requires:
85
+ - specs
86
+
87
+ - id: design
88
+ generates: design.md
89
+ description: Repo-internal technical design (HOW) - required for UI and external APIs
90
+ template: design.md
91
+ instruction: |
92
+ Required when the change introduces UI/frontend views, 3rd-party API integrations,
93
+ architectural patterns, new data models, or security/perf complexity. Mandatory in asdlc lint.
94
+
95
+ Sections:
96
+ - **Context & Background**: constraints, current architecture.
97
+ - **System Architecture**: component interaction, Mermaid sequence/flowcharts.
98
+ - **Interface Contracts**: TypeScript interfaces / schemas for requests & responses.
99
+ - **External API Integration**: endpoints, auth, rate-limits, client caching & error taxonomy.
100
+ - **UI/UX Design & Aesthetics**: tokens, typography, component layout, responsive breakpoints (mobile/tablet/desktop), and states (loading/empty/error).
101
+ - **Security & NFRs**: input validation, path traversal defense, resource bounds.
102
+ - **Decisions & Migration**: choices made with rationale and deployment plan.
103
+
104
+ Do NOT restate requirements. Do NOT make cross-repo design decisions here;
105
+ raise a System Design Amendment instead.
106
+ requires:
107
+ - proposal
108
+
109
+ - id: tasks
110
+ generates: tasks.md
111
+ description: Mutable execution checklist - generated AFTER approval
112
+ template: tasks.md
113
+ instruction: |
114
+ Create the implementation checklist from the APPROVED spec. tasks.md is
115
+ MUTABLE EXECUTION STATE and is NOT part of approved intent - never edit
116
+ the spec to record progress.
117
+
118
+ Format:
119
+ - Group related tasks under `## N. <group>` headings
120
+ - Follow task-level TDD structure: pair test creation with implementation
121
+ (`- [ ] N.M [TEST] ... (AC<n>) verify: <command>`) followed by
122
+ (`- [ ] N.M+1 [IMPL] ... (AC<n>) evidence: <pass-evidence>`)
123
+ - Every task references the AC it implements and states its verification method
124
+ - Include test execution output under completed tasks as immutable evidence
125
+ - Order by dependency
126
+ requires:
127
+ - specs
128
+ - review
129
+
130
+ apply:
131
+ requires: [tasks]
132
+ tracks: tasks.md
133
+ instruction: |
134
+ Work through the pending tasks in tasks.md. For EACH task, follow task-level
135
+ TDD (v6 5.2):
136
+ 1. write a FAILING test that expresses the task's verification;
137
+ 2. implement the minimum to make it pass;
138
+ 3. run the tests and PASTE the output under the task before claiming it is done;
139
+ 4. before moving on, a fresh-context reviewer checks the task against the
140
+ approved spec first, code quality second.
141
+ Mark each task complete only after its verification passes and test evidence is recorded.
142
+
143
+ NEVER modify the spec (approved intent: proposal.md, specs/**).
144
+
145
+ CONVERGE = Report First (v6 6). When reality disagrees with the spec, first
146
+ classify the gap and NEVER silently absorb it into code:
147
+ A implementation error -> write a reproducing test, append a fix task, stay in this PR
148
+ B missing test -> add the test, stay in this PR
149
+ C spec gap/conflict -> STOP the affected tasks and report a SPEC_GAP
150
+ (needs the spec approver; see asdlc review/lint)
151
+ D post-merge defect -> new Jira bug; spec said the right thing -> fast fix,
152
+ spec itself wrong -> new change
153
+ Cross-repo contract changes are always C: stop and raise a System Design
154
+ Amendment - never absorb them here.
155
+
156
+ archive:
157
+ description: Sync living specs, update README, and conditionally update AGENTS.md
158
+ instruction: |
159
+ Archive the verified change:
160
+ 1. Living Specs (Knowledge Layer):
161
+ Merge delta specs into `openspec/specs/` and record the capability in `README.md`.
162
+ Do NOT touch `AGENTS.md` for standard business or feature specs (zero prompt pollution).
163
+ 2. Constitutional Changes (Governance Layer):
164
+ Automatically detected when the change modifies governance policies, SDLC rules,
165
+ or workflow contracts (`.sdlc/policy.yaml`, `openspec/config.yaml`, `AGENTS.md`, `governance/**`).
166
+ In these cases, `AGENTS.md` is automatically refreshed so all agent IDE sessions
167
+ immediately adhere to the updated constitution.
168
+