@akjamie/agentic-sdlc 1.2.0 → 1.4.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 (48) hide show
  1. package/LICENSE +201 -21
  2. package/README.md +239 -302
  3. package/assets/commands/asdlc-apply.md +24 -0
  4. package/assets/commands/asdlc-approve.md +21 -0
  5. package/assets/commands/asdlc-archive.md +21 -0
  6. package/assets/commands/asdlc-doctor.md +24 -0
  7. package/assets/commands/asdlc-lint.md +30 -0
  8. package/assets/commands/asdlc-new.md +29 -0
  9. package/assets/commands/asdlc-pr.md +25 -0
  10. package/assets/commands/asdlc-status.md +23 -0
  11. package/assets/commands/asdlc-test.md +20 -0
  12. package/assets/commands/asdlc-verify.md +29 -0
  13. package/assets/schema/risk-assessment.schema.json +225 -0
  14. package/assets/skills/asdlc-apply/SKILL.md +43 -18
  15. package/assets/skills/asdlc-new/SKILL.md +15 -1
  16. package/assets/skills/asdlc-verify/SKILL.md +16 -6
  17. package/package.json +2 -2
  18. package/src/assess/ai_judge.js +163 -0
  19. package/src/assess/decide.js +164 -0
  20. package/src/assess/governance.js +53 -0
  21. package/src/assess/index.js +183 -0
  22. package/src/assess/render.js +71 -0
  23. package/src/assess/rules/builtin.js +195 -0
  24. package/src/assess/schema.js +148 -0
  25. package/src/assess/store.js +138 -0
  26. package/src/assess/vectors/v1_intent.js +80 -0
  27. package/src/assess/vectors/v2_security.js +131 -0
  28. package/src/assess/vectors/v3_topology.js +107 -0
  29. package/src/cli.js +91 -89
  30. package/src/commands/apply.js +103 -36
  31. package/src/commands/assess.js +57 -0
  32. package/src/commands/doctor.js +33 -18
  33. package/src/commands/init.js +5 -64
  34. package/src/commands/lint.js +9 -2
  35. package/src/commands/new.js +19 -2
  36. package/src/commands/pr.js +27 -3
  37. package/src/commands/skills.js +7 -19
  38. package/src/commands/status.js +169 -8
  39. package/src/commands/update.js +4 -3
  40. package/src/commands/upgrade.js +1 -1
  41. package/src/commands/verify.js +109 -15
  42. package/src/lib/fs.js +26 -3
  43. package/src/lib/level.js +118 -0
  44. package/src/lib/paths.js +3 -1
  45. package/src/lib/prtype.js +17 -4
  46. package/src/lib/risk.js +50 -0
  47. package/src/lib/schema.js +4 -0
  48. package/src/lib/tools.js +313 -0
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: asdlc-apply
3
+ description: "Stage 5: Guarded task-level TDD implementation loop"
4
+ ---
5
+
6
+ # /asdlc-apply - Guarded Implementation Launcher
7
+
8
+ Launch task-level Test-Driven Development (TDD) loop from `tasks.md`.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ asdlc apply <CHANGE_ID> [--auto-pr] [--target-branch <branch>]
14
+ ```
15
+
16
+ ## Behavior
17
+
18
+ 1. **Approval Guard**: Enforces that the spec has been approved and `approvedSha` is locked (or L0/L1 single-PR mode).
19
+ 2. **Task-Level TDD Loop**:
20
+ - RED: Author failing unit/integration tests mapped to requirement ACs.
21
+ - GREEN: Implement minimal production code to pass the tests.
22
+ - REFACTOR: Clean code structure without altering behavior.
23
+ - EVIDENCE: Record passing test evidence.
24
+ 3. **Anti-Hallucination & Anti-Drift Guard**: Prevents modifying locked specification paths during code implementation.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: asdlc-approve
3
+ description: "Stage 4: Lock approvedSha and transition change to READY_FOR_IMPL"
4
+ ---
5
+
6
+ # /asdlc-approve - Approve Spec & Cryptographic Lock
7
+
8
+ Lock the approved specification state and unlock implementation for the change.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ asdlc approve <CHANGE_ID>
14
+ ```
15
+
16
+ ## Behavior
17
+
18
+ 1. Evaluates human lead approval (or PR merge commit on target branch).
19
+ 2. Computes and locks cryptographic `approvedSha` for the spec files.
20
+ 3. Stamps `review.md` with `verdict: APPROVE` and `specSha`.
21
+ 4. Transitions change state to `READY_FOR_IMPL`.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: asdlc-archive
3
+ description: "Stage 7: Sync spec deltas to living specs, archive change directory, and refresh codebase graph"
4
+ ---
5
+
6
+ # /asdlc-archive - Sync & Archive Verified Change
7
+
8
+ Archive a verified change after implementation PR merge.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ asdlc archive <CHANGE_ID>
14
+ ```
15
+
16
+ ## Behavior
17
+
18
+ 1. Merges spec deltas into canonical `openspec/specs/` living specifications.
19
+ 2. Moves change directory to `openspec/changes/archive/<slug>/`.
20
+ 3. Rebuilds Graphify AST knowledge graph.
21
+ 4. Refreshes `AGENTS.md` system status.
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: asdlc-doctor
3
+ description: "Diagnose repository health, toolchain integrity, and per-tool skill/command status"
4
+ ---
5
+
6
+ # /asdlc-doctor - Diagnostic Health Check
7
+
8
+ Verify environment, toolchain health, git hooks, managed schema integrity, and IDE agent tool readiness.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ asdlc doctor [--fix] [--global]
14
+ ```
15
+
16
+ ## Checks Performed
17
+
18
+ 1. Node version compatibility (`>= 20.19.0`).
19
+ 2. Pinned OpenSpec version availability.
20
+ 3. Graphify AST toolchain availability.
21
+ 4. Managed schema installation and absence of committed overrides.
22
+ 5. Repository configuration and `.githooks` integration.
23
+ 6. `AGENTS.md` routing table and system status freshness.
24
+ 7. Per-tool skill and slash command parity across detected IDE tools (Claude, OpenCode, Pi, Antigravity, GitHub Copilot, Cursor, etc.).
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: asdlc-lint
3
+ description: "Stage 3: Deterministic spec lint gate (R0-R8 BDD rules, scenario coverage, and test mappings)"
4
+ ---
5
+
6
+ # /asdlc-lint - Deterministic Spec Quality Gate
7
+
8
+ Verify that the active specification meets enterprise BDD, traceability, and review standards before creating a Pull Request.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ asdlc lint <CHANGE_ID> [--json]
14
+ ```
15
+
16
+ ## Checks Performed
17
+
18
+ 1. **Artifact Completeness**: `proposal.md`, `specs/**/*.md`, and `design.md` (for UI/external API changes).
19
+ 2. **Deterministic Rules (R0–R8)**:
20
+ - `R0-no-requirements`: Explicit requirement headers.
21
+ - `R1-purpose`: Capability purpose length >= 50 characters.
22
+ - `R2-normative`: RFC-2119 `SHALL` / `MUST` invariant statements.
23
+ - `R3-scenario`: Concrete observable BDD scenarios.
24
+ - `R4-when / R4-then / R4-given`: Bold Gherkin clauses.
25
+ - `R5-ac & R5-scenario-coverage`: Traceable checkboxes covering all scenarios (`count(ACs) >= count(Scenarios)`).
26
+ - `R6-ac-test`: Every AC maps to a test file (`(test: <path>)`).
27
+ - `R7-test-strategy`: Multi-tiered test pyramid section.
28
+ - `R8-removed-reason`: Explicit rationale for deprecations / removals.
29
+
30
+ See `docs/spec-format.md` for worked pass/fail examples and 1-minute remedies.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: asdlc-new
3
+ description: "Stage 1/2: Start a new spec-driven change: ground in codebase graph, run grill-me, author proposal and specs"
4
+ ---
5
+
6
+ # /asdlc-new - Start a New Spec-Driven Change
7
+
8
+ Start a new spec-driven change in the repository using the Agentic SDLC workflow.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ asdlc new "<requirement>" [--batch-grill] [--no-grill]
14
+ ```
15
+
16
+ ## Workflow Sequence
17
+
18
+ 1. **Scaffold Change & Ground in Graph**:
19
+ - Derives a clean kebab-case change slug from intent or ticket ID.
20
+ - Refreshes the Graphify AST knowledge graph and generates `explore.md`.
21
+ - Seeds `clarifications.md` and `proposal.md`.
22
+ 2. **High-Signal Grilling Interview (Stage 2)**:
23
+ - Settle architectural decisions and trade-offs in `clarifications.md`.
24
+ - Stop questioning as soon as the author reaches consensus or forks hit zero.
25
+ 3. **Specification Delta Authoring**:
26
+ - Author capability spec deltas under `specs/<capability>/spec.md` with RFC-2119 BDD requirements.
27
+ - If UI or external APIs are involved, author `design.md`.
28
+ 4. **Pre-flight Lint**:
29
+ - Run `asdlc lint <CHANGE_ID>` to verify that all BDD rules (R0–R8) pass with 0 blockers.
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: asdlc-pr
3
+ description: "Stage 3.5: Open a Spec or Implementation PR with automated title, body, and governance labels"
4
+ ---
5
+
6
+ # /asdlc-pr - Open Spec or Implementation Pull Request
7
+
8
+ Push your branch and automatically create a Pull Request with governance labels on GitHub or GitLab.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ asdlc pr <CHANGE_ID> <target-branch>
14
+ ```
15
+
16
+ ## Behavior
17
+
18
+ 1. **Pre-flight Gate Audit**:
19
+ - For Spec PRs: runs `asdlc lint` (must pass with 0 blockers).
20
+ - For Implementation PRs: runs `asdlc verify` (must pass all quality gates).
21
+ 2. **Git Push**: Automatically pushes `spec/<CHANGE_ID>` or implementation branch to origin.
22
+ 3. **PR Metadata Extraction**: Automatically populates Title and Description from `proposal.md`.
23
+ 4. **Governance Labels**:
24
+ - Spec PR -> `asdlc:spec-review` (triggers automated CI AI Spec Review).
25
+ - Impl PR -> `asdlc:impl-review` (triggers automated CI AI Impl Review).
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: asdlc-status
3
+ description: "Show lifecycle state, active artifacts, next actionable command, or portfolio overview"
4
+ ---
5
+
6
+ # /asdlc-status - Change & Portfolio Status Overview
7
+
8
+ Inspect the active change state or get an overview of all in-flight changes across the repository.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ # Portfolio overview (lists all active changes in flight)
14
+ asdlc status [--json]
15
+
16
+ # Single change status
17
+ asdlc status <CHANGE_ID> [--json]
18
+ ```
19
+
20
+ ## Output
21
+
22
+ - In portfolio mode: outputs compact single-line table with `CHANGE`, `LEVEL`, `STAGE`, and `NEXT COMMAND` (strictly excludes archived changes).
23
+ - In single-change mode: outputs completed artifacts, stage progression, and next exact command.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: asdlc-test
3
+ description: "Stage 5.5: Execute real test runners mapped to Acceptance Criteria annotations"
4
+ ---
5
+
6
+ # /asdlc-test - Run Mapped Acceptance Criteria Tests
7
+
8
+ Execute project test suites referenced by spec acceptance criteria lines `(test: <path>)`.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ asdlc test <CHANGE_ID> [--json]
14
+ ```
15
+
16
+ ## Behavior
17
+
18
+ 1. Parses all `(test: <path>)` annotations across the change's capability specs.
19
+ 2. Resolves test runners (e.g. Node `--test`, Jest, Pytest, Go test, Cargo test).
20
+ 3. Executes target test files and reports individual test execution status.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: asdlc-verify
3
+ description: "Stage 6: Verify implementation against all 12 enterprise quality gates"
4
+ ---
5
+
6
+ # /asdlc-verify - Enterprise Quality Gates Audit
7
+
8
+ Audit the implementation diff against all 12 deterministic quality gates before merging to main.
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ asdlc verify <CHANGE_ID> [--repo <name>] [--json]
14
+ ```
15
+
16
+ ## The 12 Quality Gates
17
+
18
+ 1. `level-integrity`: Validates declared risk level matches change topology.
19
+ 2. `pr-type`: Classifies PR type (normal vs. spec vs. impl).
20
+ 3. `artifacts`: Ensures proposal, tasks, and spec deltas are present.
21
+ 4. `approved-spec`: Verifies spec PR was approved on protected branch.
22
+ 5. `spec-tamper`: Enforces that locked spec files were not modified during implementation.
23
+ 6. `flow-state`: Validates `READY_FOR_IMPL` transition.
24
+ 7. `risk-escape`: Detects unannounced API/DDL escalations.
25
+ 8. `human-gate`: Validates mandatory Tech Lead approval for L2/L3 changes.
26
+ 9. `tasks-complete`: Verifies all tasks in `tasks.md` are checked off.
27
+ 10. `test-presence`: Enforces that source code changes are paired with test changes.
28
+ 11. `tdd-evidence`: Verifies red-green-refactor execution log.
29
+ 12. `BDD + acceptance criteria`: Deterministic R0–R8 quality lint clean.
@@ -0,0 +1,225 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "RiskAssessmentRecord",
4
+ "description": "ASdlc Change-Level Governance Assessment Record Schema v1",
5
+ "type": "object",
6
+ "required": [
7
+ "schema_version",
8
+ "change_id",
9
+ "seq",
10
+ "prev_hash",
11
+ "hash",
12
+ "timestamp",
13
+ "actor",
14
+ "stage",
15
+ "role",
16
+ "status",
17
+ "verdict",
18
+ "change_type",
19
+ "source",
20
+ "risk",
21
+ "vectors",
22
+ "governance",
23
+ "reason_codes",
24
+ "transition"
25
+ ],
26
+ "additionalProperties": false,
27
+ "properties": {
28
+ "schema_version": {
29
+ "type": "integer",
30
+ "enum": [1]
31
+ },
32
+ "change_id": {
33
+ "type": "string",
34
+ "pattern": "^[a-zA-Z0-9_-]+$"
35
+ },
36
+ "seq": {
37
+ "type": "integer",
38
+ "minimum": 1
39
+ },
40
+ "prev_hash": {
41
+ "type": ["string", "null"],
42
+ "pattern": "^[a-f0-9]{64}$"
43
+ },
44
+ "hash": {
45
+ "type": "string",
46
+ "pattern": "^[a-f0-9]{64}$"
47
+ },
48
+ "timestamp": {
49
+ "type": "string",
50
+ "format": "date-time"
51
+ },
52
+ "actor": {
53
+ "type": "object",
54
+ "required": ["type", "id"],
55
+ "additionalProperties": false,
56
+ "properties": {
57
+ "type": { "type": "string", "enum": ["system", "human", "agent"] },
58
+ "id": { "type": "string" }
59
+ }
60
+ },
61
+ "stage": {
62
+ "type": "string",
63
+ "enum": ["new", "spec", "impl"]
64
+ },
65
+ "role": {
66
+ "type": "string",
67
+ "enum": ["primary", "cross_check"]
68
+ },
69
+ "compared_to": {
70
+ "type": ["string", "null"],
71
+ "pattern": "^[a-f0-9]{64}$"
72
+ },
73
+ "status": {
74
+ "type": "string",
75
+ "enum": ["provisional", "needs_input", "ready", "defaulted"]
76
+ },
77
+ "verdict": {
78
+ "type": "string",
79
+ "enum": ["ok", "escalated", "needs_input", "blocked", "defaulted"]
80
+ },
81
+ "defaulted_cause": {
82
+ "type": ["string", "null"]
83
+ },
84
+ "change_type": {
85
+ "type": "string",
86
+ "enum": ["chore", "fix", "change", "feature"]
87
+ },
88
+ "source": {
89
+ "type": "object",
90
+ "required": ["base_sha", "harness_rules_version", "engine_version"],
91
+ "additionalProperties": false,
92
+ "properties": {
93
+ "base_sha": { "type": "string" },
94
+ "head_sha": { "type": ["string", "null"] },
95
+ "harness_rules_version": { "type": "string" },
96
+ "engine_version": { "type": "string" },
97
+ "task_ref": { "type": ["string", "null"] },
98
+ "models": {
99
+ "type": "array",
100
+ "items": {
101
+ "type": "object",
102
+ "required": ["purpose", "model_id"],
103
+ "additionalProperties": false,
104
+ "properties": {
105
+ "purpose": { "type": "string", "enum": ["classifier", "reviewer", "implementer"] },
106
+ "model_id": { "type": "string" }
107
+ }
108
+ }
109
+ }
110
+ }
111
+ },
112
+ "risk": {
113
+ "type": "object",
114
+ "required": ["level", "confidence"],
115
+ "additionalProperties": false,
116
+ "properties": {
117
+ "level": { "type": "string", "enum": ["L0", "L1", "L2", "L3"] },
118
+ "confidence": { "type": "string", "enum": ["high", "medium", "low"] }
119
+ }
120
+ },
121
+ "vectors": {
122
+ "type": "object",
123
+ "required": ["v1_intent", "v2_security", "v3_topology"],
124
+ "additionalProperties": false,
125
+ "properties": {
126
+ "v1_intent": { "$ref": "#/definitions/VectorResult" },
127
+ "v2_security": { "$ref": "#/definitions/VectorResult" },
128
+ "v3_topology": { "$ref": "#/definitions/VectorResult" }
129
+ }
130
+ },
131
+ "governance": {
132
+ "type": "object",
133
+ "required": ["workflow_mode", "spec_approval", "implementation_review"],
134
+ "additionalProperties": false,
135
+ "properties": {
136
+ "workflow_mode": { "type": "string", "enum": ["single-pr", "spec-first"] },
137
+ "spec_approval": { "type": "string", "enum": ["not-applicable", "automatic", "human"] },
138
+ "implementation_review": { "type": "string", "enum": ["ai", "ai+human"] },
139
+ "auto_approval": { "type": "string", "enum": ["enabled", "disabled"] }
140
+ }
141
+ },
142
+ "reason_codes": {
143
+ "type": "array",
144
+ "items": {
145
+ "type": "string",
146
+ "enum": [
147
+ "HARD_RULE_HIT",
148
+ "SOFT_SIGNAL_ESCALATION",
149
+ "SECURITY_BOUNDARY_POSSIBLE",
150
+ "IMPACT_SCOPE_NOT_FULLY_KNOWN",
151
+ "ESCALATED_IN_IMPL",
152
+ "AI_REVIEW_DISAGREEMENT",
153
+ "SPEC_GAP",
154
+ "SPEC_INTENT_MUTATION",
155
+ "TYPE_MISMATCH",
156
+ "NEEDS_INPUT",
157
+ "EVIDENCE_CONFLICT",
158
+ "GOVERNANCE_PLANE_CHANGE",
159
+ "NO_PRIOR_ASSESSMENT",
160
+ "WAIVER_APPLIED",
161
+ "DEFAULTED",
162
+ "RECORD_MISMATCH",
163
+ "HISTORY_REWRITTEN",
164
+ "RULES_VERSION_MISMATCH",
165
+ "SCHEMA_INVALID"
166
+ ]
167
+ }
168
+ },
169
+ "observations": {
170
+ "type": "array",
171
+ "items": { "type": "string" }
172
+ },
173
+ "transition": {
174
+ "type": "object",
175
+ "required": ["from_level", "to_level", "direction"],
176
+ "additionalProperties": false,
177
+ "properties": {
178
+ "from_level": { "type": ["string", "null"], "enum": ["L0", "L1", "L2", "L3", null] },
179
+ "to_level": { "type": "string", "enum": ["L0", "L1", "L2", "L3"] },
180
+ "direction": { "type": "string", "enum": ["initial", "up", "same", "down"] },
181
+ "triggers": { "type": "array", "items": { "type": "string" } },
182
+ "recovered_from_default": { "type": "boolean" },
183
+ "waiver": {
184
+ "type": ["object", "null"],
185
+ "properties": {
186
+ "approved_by": { "type": "string" },
187
+ "reason": { "type": "string" },
188
+ "expires_at": { "type": "string" }
189
+ }
190
+ }
191
+ }
192
+ }
193
+ },
194
+ "definitions": {
195
+ "VectorResult": {
196
+ "type": "object",
197
+ "required": ["level", "confidence", "evidence", "unresolved", "mandatory_human_review", "no_signal"],
198
+ "additionalProperties": false,
199
+ "properties": {
200
+ "level": { "type": "string", "enum": ["L0", "L1", "L2", "L3"] },
201
+ "confidence": { "type": "string", "enum": ["high", "medium", "low"] },
202
+ "evidence": {
203
+ "type": "array",
204
+ "items": {
205
+ "type": "object",
206
+ "required": ["id", "kind", "signal", "summary"],
207
+ "additionalProperties": false,
208
+ "properties": {
209
+ "id": { "type": "string" },
210
+ "kind": { "type": "string", "enum": ["repository_fact", "task_statement", "scanner_result", "rule_hit", "reviewer_finding"] },
211
+ "signal": { "type": "string", "enum": ["hard", "soft"] },
212
+ "summary": { "type": "string" },
213
+ "source": { "type": "string" },
214
+ "source_commit": { "type": "string" },
215
+ "rule_id": { "type": "string" }
216
+ }
217
+ }
218
+ },
219
+ "unresolved": { "type": "array", "items": { "type": "string" } },
220
+ "mandatory_human_review": { "type": "boolean" },
221
+ "no_signal": { "type": "boolean" }
222
+ }
223
+ }
224
+ }
225
+ }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: asdlc-apply
3
- description: "Execute Stage 5 of Agentic SDLC: guard verification followed by strict task-level TDD loop (Red -> Green -> Refactor -> Evidence -> Converge) from tasks.md."
3
+ description: "Execute Stage 5 of Agentic SDLC: guard verification followed by strict task-level TDD loop (Red -> Green -> Refactor -> Evidence -> Converge) from tasks.md. Defaults to local-only implementation; auto-PR is permitted only with explicit delegation via --auto-pr."
4
4
  ---
5
5
 
6
6
  # /asdlc:apply - Task-Level TDD Implementation Engine
@@ -22,18 +22,24 @@ This skill executes **Stage 5 (Apply)** of the Agentic SDLC. It enforces strict
22
22
  Before editing any implementation or test code, run the apply guard:
23
23
 
24
24
  ```powershell
25
- asdlc apply <CHANGE_ID>
25
+ asdlc apply <CHANGE_ID> [--auto-pr] [--target-branch <ref>]
26
26
  ```
27
27
 
28
- `asdlc apply` deterministically verifies four cryptographic preconditions:
28
+ `asdlc apply` deterministically verifies cryptographic preconditions:
29
29
  1. **Target Branch Approved Commit (`approvedSha`)**: Confirms that a commit touching the locked paths (`proposal.md` and `specs/**`) is physically merged into the target branch (`main` or `origin/main`).
30
30
  2. **Change State Machine (`ready_for_impl`)**: Confirms `.openspec.yaml` has been transitioned to `status: ready_for_impl` (via `asdlc approve <ID>`).
31
31
  3. **Spec Fingerprint Integrity (`specSha`)**: Verifies that the declared `specSha` in `.openspec.yaml` exactly matches the `approvedSha` on the protected branch.
32
32
  4. **Working Tree Tamper Defense**: Ensures that locked spec files (`proposal.md`, `specs/**`) have no uncommitted local modifications.
33
+ 5. **PR Authority Delegation (`--auto-pr`)**: By default, `apply` operates in **local-only mode** (`autoPr: false`). Supplying `--auto-pr` explicitly delegates authority to automatically create an Implementation PR after verification passes (persisted to `.openspec.yaml`).
33
34
 
34
35
  - If `asdlc apply` fails: **STOP immediately**. Follow the provided hint (e.g. merge Spec PR or run `asdlc approve`).
35
36
  - If `asdlc apply` succeeds: Proceed to Step 2.
36
37
 
38
+ > [!NOTE]
39
+ > **Governance Level & Single PR Flow (L0 / L1)**:
40
+ > For changes evaluated as `level: L0` or `level: L1`, prior merging of a Spec PR to the protected branch is waived. `asdlc apply` immediately unblocks local TDD implementation, allowing source code and spec delta to be submitted together in a Single PR.
41
+
42
+
37
43
  ### Step 2: Read `tasks.md` and Ground Context
38
44
  1. Open and read `openspec/changes/<CHANGE_ID>/tasks.md`.
39
45
  2. Inspect the spec requirements in `openspec/changes/<CHANGE_ID>/specs/**/*.md` to understand the acceptance criteria (`AC<n>`) and required test mappings (`(test: <path>)`).
@@ -95,8 +101,8 @@ When a change introduces or modifies user-facing interfaces (web, mobile, or des
95
101
 
96
102
  ---
97
103
 
98
- ### Step 4: Run Verification Gate
99
- Once all tasks in `tasks.md` are checked and evidenced, run `asdlc verify`:
104
+ ### Step 4: Run Local Verification Check
105
+ Once all tasks in `tasks.md` are checked and evidenced, run `asdlc verify <CHANGE_ID>` locally:
100
106
 
101
107
  ```powershell
102
108
  asdlc verify <CHANGE_ID>
@@ -111,18 +117,37 @@ Verify that all checks pass:
111
117
  - `BDD + acceptance criteria`
112
118
  - `openspec-validate`
113
119
 
114
- ---
115
-
116
- ### Step 5: Open Implementation PR
117
- Once `asdlc verify <CHANGE_ID>` passes, execute `asdlc pr` to open the Implementation PR:
120
+ If any check fails, resolve the issue locally within the TDD loop and re-run `asdlc verify <CHANGE_ID>`.
118
121
 
119
- ```powershell
120
- asdlc pr <CHANGE_ID> <targetBranch>
121
- ```
122
-
123
- `asdlc pr` will:
124
- 1. Automatically detect this is an **Implementation PR** (status is `ready_for_impl`, spec is approved, tasks are complete, and source changes exist).
125
- 2. Run `asdlc verify <CHANGE_ID>` as a pre-flight guard (requiring all 12 verification checks to pass).
126
- 3. Commit implementation code and test evidence, then push to origin.
127
- 4. Pre-provision and attach `asdlc:impl-review` and `impl` labels to trigger CI Code AI Review.
122
+ ---
128
123
 
124
+ ### Step 5: Implementation Complete & Submission Protocol (Dual-Mode Authority)
125
+
126
+ Once all tasks in `tasks.md` are marked complete with captured evidence and local `asdlc verify <CHANGE_ID>` passes (all 12 verification gates exit 0), determine the submission path based on explicit authority:
127
+
128
+ #### Path A: Default Local Mode (Safe Default, `autoPr: false` or unspecified)
129
+ > [!CAUTION]
130
+ > **Stage Boundary Guard — No Automatic PR Creation by Default**:
131
+ > `asdlc-apply` is strictly the **local implementation engine** (Stage 5).
132
+ > **NEVER automatically push commits to origin or open a Pull Request during `apply` by default.**
133
+ > Pushing code to a remote repository and opening a PR is a public, collaborative action with team-wide visibility, git ref mutation, and CI compute costs.
134
+ >
135
+ > In default mode, an agent executing `apply` must NEVER run `asdlc pr` or `git push` on its own.
136
+
137
+ 1. Summarize completed tasks and verification results for the developer.
138
+ 2. Inform the developer that the implementation is verified locally and ready:
139
+ > "🎉 Implementation complete! All tasks in `tasks.md` are implemented with TDD evidence, and all local verification checks passed.
140
+ > When you are ready to open the Implementation PR, run:
141
+ > `asdlc pr <CHANGE_ID> <targetBranch>` (or trigger `/asdlc:pr`)."
142
+
143
+ #### Path B: Explicit Delegation Mode (`--auto-pr` or explicit intent)
144
+ > [!TIP]
145
+ > **Authorized Agent Delegation Channel**:
146
+ > When the user has explicitly authorized automatic PR creation (via `asdlc apply <CHANGE_ID> --auto-pr`, `autoPr: true` in `.openspec.yaml`, or explicit user prompt instructions):
147
+ >
148
+ > 1. Confirm that `asdlc verify <CHANGE_ID>` exited 0 with all verification checks passing cleanly.
149
+ > 2. The agent is authorized to automatically open the Implementation PR via:
150
+ > ```powershell
151
+ > asdlc pr <CHANGE_ID> <targetBranch>
152
+ > ```
153
+ > 3. Provide the resulting PR link to the user and announce readiness for AI / Human Implementation Review.
@@ -11,8 +11,22 @@ This skill executes **Stage 2 (New)** of the Agentic SDLC. It transforms a natur
11
11
 
12
12
  ## Workflow Sequence
13
13
 
14
+ ### Step 0: Input Grounding & Ticket Resolution (Anti-Hallucination Guard)
15
+ When the user invokes `/asdlc:new` or provides a task, check if it references a ticket ID or link (e.g. Jira key `PROJ-123`, Jira URL, GitHub Issue `#42`, or internal company tracker link):
16
+
17
+ 1. **Attempt Tool/Skill Resolution**:
18
+ - If you have an applicable skill, MCP tool, or CLI available (e.g. Jira skill, GitHub MCP, `gh issue view`), use it to retrieve the ticket title, description, and acceptance criteria.
19
+ 2. **Handle Inaccessible / Unresolvable Tickets (Mandatory Pause)**:
20
+ - If the ticket link or ID cannot be read or accessed (e.g. no integration tool installed, unauthorized/VPN required, 404 not found, or network error):
21
+ - 🛑 **PAUSE IMMEDIATELY**: Do NOT proceed to scaffold or write specs.
22
+ - ❌ **DO NOT GUESS OR INVENT REQUIREMENTS**: Hallucinating specifications without verified ground truth is strictly prohibited.
23
+ - ❓ **ASK THE USER DIRECTLY**: Halt and prompt the user:
24
+ > *"I see you referenced ticket/link `<ID/URL>`, but I'm unable to access your issue tracker directly. To ensure the specifications are trustworthy and accurate, could you please paste the ticket title, description, and any acceptance criteria here?"*
25
+ 3. **Proceed with Grounded Context**:
26
+ - Once the user supplies the ticket details or confirms the requirement in plain language, proceed to Step 1 using that grounded requirement text. (If ticket acceptance criteria were retrieved or pasted, carry them forward into `clarifications.md` in Step 3).
27
+
14
28
  ### Step 1: Scaffold Change & Refresh Graph
15
- When the user invokes `/asdlc:new "<requirement>"`:
29
+ When the grounded requirement is established:
16
30
 
17
31
  ```powershell
18
32
  asdlc new "<requirement>" [--batch-grill] [--no-grill]
@@ -46,10 +46,20 @@ If any check outputs `[FAIL]`:
46
46
  - **`BDD + AC`**: An acceptance criterion points to a test file that does not exist. Create the missing test file.
47
47
  - **`external` (unit tests)**: Run the failing test command, debug the failure, fix the code, and re-run.
48
48
 
49
- ### Step 3: Transition to Post-Merge Testing & Archive (If Passed)
49
+ ### Step 3: Next Actions (Depending on Lifecycle Stage)
50
50
  When all checks output `[PASS]` and verify succeeds:
51
- Inform the human developer:
52
- > "🎉 Verification passed! All 12 gates satisfied.
53
- > Complete any remaining post-merge integration testing and human stakeholder review.
54
- > Once satisfied, explicitly close and finalize the change by running:
55
- > `/asdlc:archive <CHANGE_ID>`"
51
+
52
+ - **Scenario A: Pre-PR Local Implementation Verification (Stage 6)**
53
+ If running on a feature branch before opening the Implementation PR:
54
+ Inform the developer:
55
+ > "🎉 Local verification passed! All 12 gates satisfied.
56
+ > When you are ready to submit this implementation for CI AI review and team approval, run:
57
+ > `asdlc pr <CHANGE_ID> <targetBranch>` (or trigger `/asdlc:pr`).
58
+ > *(The agent will NOT automatically open a PR without your explicit command).* "
59
+
60
+ - **Scenario B: Post-Merge Trunk Verification (Stage 6 -> Stage 7)**
61
+ If running after the Implementation PR has been approved and merged into the protected target branch (`main`):
62
+ Inform the developer:
63
+ > "🎉 Post-merge verification passed! All 12 gates verified on the target branch.
64
+ > To close out and archive this change into the master specification catalog, run:
65
+ > `asdlc archive <CHANGE_ID>` (or trigger `/asdlc:archive`)."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akjamie/agentic-sdlc",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Enterprise Agentic SDLC governance CLI: a 7-stage spec-driven flow on top of OpenSpec + Graphify, enforced by CI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -37,7 +37,7 @@
37
37
  "agentic",
38
38
  "governance"
39
39
  ],
40
- "license": "MIT",
40
+ "license": "Apache-2.0",
41
41
  "dependencies": {
42
42
  "commander": "^12.1.0",
43
43
  "yaml": "^2.6.1"