@akjamie/agentic-sdlc 1.0.0 → 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.
- package/README.md +4 -4
- package/assets/schema/schema.yaml +11 -5
- package/assets/schema/templates/design.md +129 -11
- package/assets/skills/asdlc-archive/SKILL.md +3 -2
- package/assets/skills/asdlc-impl-review/SKILL.md +10 -5
- package/assets/skills/asdlc-lint/SKILL.md +3 -0
- package/assets/skills/asdlc-new/SKILL.md +45 -12
- package/assets/skills/asdlc-spec-review/SKILL.md +14 -2
- package/bin/asdlc.js +0 -0
- package/package.json +2 -2
- package/src/cli.js +3 -0
- package/src/commands/archive.js +34 -6
- package/src/commands/lint.js +31 -7
- package/src/commands/new.js +41 -12
- package/src/commands/test.js +137 -0
- package/src/lib/exec.js +5 -1
- package/src/lib/policy.js +6 -0
- package/src/lib/speclint.js +6 -1
- package/assets/ci/Jenkinsfile +0 -80
package/README.md
CHANGED
|
@@ -131,13 +131,13 @@ flowchart LR
|
|
|
131
131
|
| Stage & Command | Lifecycle Action & Governance Guard |
|
|
132
132
|
| :--- | :--- |
|
|
133
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>"` | Derives
|
|
135
|
-
| **3 · Spec PR**<br>`asdlc pr <ID> <targetBranch>` | Pre-flight BDD/AC linting (`asdlc lint`), attaches `asdlc:spec-review` label, triggers CI Spec AI Review before human approval. |
|
|
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
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. |
|
|
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
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
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/`, refreshes knowledge graph, updates `AGENTS.md` system status. |
|
|
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
141
|
|
|
142
142
|
### Dual-PR Governance & Label Dispatch
|
|
143
143
|
|
|
@@ -86,14 +86,20 @@ artifacts:
|
|
|
86
86
|
|
|
87
87
|
- id: design
|
|
88
88
|
generates: design.md
|
|
89
|
-
description: Repo-internal technical design (HOW) -
|
|
89
|
+
description: Repo-internal technical design (HOW) - required for UI and external APIs
|
|
90
90
|
template: design.md
|
|
91
91
|
instruction: |
|
|
92
|
-
|
|
93
|
-
|
|
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
94
|
|
|
95
|
-
Sections:
|
|
96
|
-
|
|
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.
|
|
97
103
|
|
|
98
104
|
Do NOT restate requirements. Do NOT make cross-repo design decisions here;
|
|
99
105
|
raise a System Design Amendment instead.
|
|
@@ -1,16 +1,134 @@
|
|
|
1
|
-
# Design: <!-- change id -->
|
|
1
|
+
# Technical Design: <!-- change id -->
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
> Requirement: "<!-- requirement summary -->"
|
|
4
|
+
> Purpose: Concrete architecture, interface contracts, external integration models, and UI/UX specifications.
|
|
5
|
+
> NOTE: This document guides implementation (HOW). Do NOT duplicate behavioral BDD requirements from spec.md.
|
|
5
6
|
|
|
6
|
-
##
|
|
7
|
-
<!--
|
|
7
|
+
## 1. Context & Background
|
|
8
|
+
<!-- Current state, existing architectural patterns, dependencies, and constraints needed to ground the approach. -->
|
|
8
9
|
|
|
9
|
-
##
|
|
10
|
-
<!--
|
|
10
|
+
## 2. System Architecture & Component Interaction
|
|
11
|
+
<!--
|
|
12
|
+
Component breakdown, responsibilities, data flow, and lifecycles.
|
|
13
|
+
Include a Mermaid flowchart or sequence diagram where components interact:
|
|
14
|
+
```mermaid
|
|
15
|
+
sequenceDiagram
|
|
16
|
+
autonumber
|
|
17
|
+
actor User
|
|
18
|
+
participant Client as Frontend/UI
|
|
19
|
+
participant Svc as Service/API Layer
|
|
20
|
+
participant Ext as External 3rd-Party API
|
|
21
|
+
User->>Client: Triggers action
|
|
22
|
+
Client->>Svc: Request with validated params
|
|
23
|
+
Svc->>Ext: Upstream call (cached/debounced)
|
|
24
|
+
Ext-->>Svc: Response or error
|
|
25
|
+
Svc-->>Client: Normalized contract
|
|
26
|
+
Client-->>User: Render state (success/empty/error)
|
|
27
|
+
```
|
|
28
|
+
-->
|
|
11
29
|
|
|
12
|
-
##
|
|
13
|
-
<!--
|
|
30
|
+
## 3. Interface Contracts & Data Models
|
|
31
|
+
<!--
|
|
32
|
+
Specify exact TypeScript interfaces, JSON schemas, or DTO structures.
|
|
33
|
+
Define request, response, and domain models to eliminate ambiguity during implementation.
|
|
34
|
+
-->
|
|
14
35
|
|
|
15
|
-
##
|
|
16
|
-
<!--
|
|
36
|
+
## 4. External Services & 3rd-Party API Integration
|
|
37
|
+
<!--
|
|
38
|
+
MANDATORY if this change integrates external vendor APIs or services.
|
|
39
|
+
- Endpoints & Authentication: Exact URLs, parameters, headers, and secret management.
|
|
40
|
+
- Rate Limiting & Quotas: Upstream limit constraints (e.g. 100 req/min, 5,000/day).
|
|
41
|
+
- Client Lifecycle & Caching Strategy:
|
|
42
|
+
- Cache type: in-memory Map / TTL cache / Redis.
|
|
43
|
+
- Cache key formulation, TTL duration, eviction policy.
|
|
44
|
+
- Lifecycle: Reuse client instance (singleton/service pool); NEVER re-instantiate clients per request.
|
|
45
|
+
- Error Taxonomy & Degradation/Fallback:
|
|
46
|
+
- Ambiguous input: Candidate list returned, never wrong guess.
|
|
47
|
+
- Upstream 4xx/5xx / Quota exhaustion: User-friendly error message, fallback cache, retry with exponential backoff.
|
|
48
|
+
- Offline/Network failure: Clear degradation banner without unhandled rejections.
|
|
49
|
+
- Unverified endpoints/limits: Tag with [UNVERIFIED: <reason>] for explicit human review.
|
|
50
|
+
-->
|
|
51
|
+
|
|
52
|
+
## 5. UI/UX Design, Visual Hierarchy & Aesthetics
|
|
53
|
+
<!--
|
|
54
|
+
MANDATORY if this change adds or modifies user interfaces (Web, Mobile, Desktop).
|
|
55
|
+
Zero tolerance for unstyled, raw, or toy HTML!
|
|
56
|
+
-->
|
|
57
|
+
|
|
58
|
+
### 5.1 Design Reference Ground Truth (REQUIRED)
|
|
59
|
+
<!--
|
|
60
|
+
Do NOT invent design tokens or palettes in isolation.
|
|
61
|
+
Specify the concrete human-provided design ground truth:
|
|
62
|
+
- Mockup link / Figma URL: <url or file path>
|
|
63
|
+
- Brand styleguide / design tokens: <reference or existing CSS tokens file>
|
|
64
|
+
- Reference application / URL: <benchmark url>
|
|
65
|
+
- Key visual style notes: <e.g., modern dark card-based dashboard, rounded corners, subtle glassmorphism>
|
|
66
|
+
-->
|
|
67
|
+
- Reference: <!-- insert link, file, or brand token reference -->
|
|
68
|
+
- Style summary: <!-- 1-2 sentences on visual direction -->
|
|
69
|
+
|
|
70
|
+
### 5.2 Visual Theme & Design Tokens
|
|
71
|
+
<!-- Derive concrete variables from the reference above: -->
|
|
72
|
+
- Color Palette:
|
|
73
|
+
- `--color-primary`: <!-- e.g. #2563eb -->
|
|
74
|
+
- `--color-background`: <!-- e.g. #0f172a -->
|
|
75
|
+
- `--color-surface`: <!-- e.g. #1e293b -->
|
|
76
|
+
- `--color-text-primary`: <!-- e.g. #f8fafc -->
|
|
77
|
+
- `--color-text-muted`: <!-- e.g. #94a3b8 -->
|
|
78
|
+
- `--color-border`: <!-- e.g. #334155 -->
|
|
79
|
+
- `--color-accent`: <!-- e.g. #38bdf8 -->
|
|
80
|
+
- Typography:
|
|
81
|
+
- Font family: <!-- e.g. 'Plus Jakarta Sans', system-ui -->
|
|
82
|
+
- Scale: base (16px), heading (24px/32px)
|
|
83
|
+
- Spacing & Radii:
|
|
84
|
+
- `--radius`: <!-- e.g. 12px -->
|
|
85
|
+
- `--spacing-unit`: <!-- e.g. 8px -->
|
|
86
|
+
|
|
87
|
+
### 5.3 Component Hierarchy & Responsive Breakpoints
|
|
88
|
+
- Layout: Topbar/Hero, Search with debounce, Content Cards Grid, Detail Panel.
|
|
89
|
+
- Breakpoints:
|
|
90
|
+
- Mobile (<= 640px): single-column, stacked layout.
|
|
91
|
+
- Tablet (<= 1024px): 2-column grid.
|
|
92
|
+
- Desktop (> 1024px): 3-column / sidebar + main grid.
|
|
93
|
+
|
|
94
|
+
### 5.4 Mandatory Interactive States
|
|
95
|
+
Every UI component must specify all 5 states:
|
|
96
|
+
1. Default: Polished styling adhering to design tokens.
|
|
97
|
+
2. Hover/Active: Micro-transitions (0.2s ease).
|
|
98
|
+
3. Loading State: Skeleton cards or subtle spinners (no blank screens).
|
|
99
|
+
4. Empty State: Friendly icon/illustration, descriptive message, actionable prompt.
|
|
100
|
+
5. Error State: Banner with clear explanation and retry action.
|
|
101
|
+
|
|
102
|
+
## 6. Security Architecture & Operational NFRs (Optional / When Applicable)
|
|
103
|
+
<!--
|
|
104
|
+
Document this section when the change introduces public interfaces, handles sensitive/user data,
|
|
105
|
+
integrates external rate-limited services, or has explicit latency/resource constraints.
|
|
106
|
+
For changes without external dependencies or strict SLAs, omit this section or mark as (N/A).
|
|
107
|
+
Do NOT invent arbitrary default values.
|
|
108
|
+
-->
|
|
109
|
+
|
|
110
|
+
### 6.1 Security & Threat Mitigation (If Applicable)
|
|
111
|
+
<!-- Detail concrete defense mechanisms if the change touches auth, inputs, or secrets: -->
|
|
112
|
+
- Authentication & Authorization: <!-- Caller identity verification, role/scope enforcement, or N/A -->
|
|
113
|
+
- Input Validation & Boundaries: <!-- Schema constraints, bounds, sanitization, or N/A -->
|
|
114
|
+
- Secret & Credential Lifecycle: <!-- Injected via environment variables, never logged, or N/A -->
|
|
115
|
+
- Data Privacy & PII Protection: <!-- Data classification, retention policies, or N/A -->
|
|
116
|
+
|
|
117
|
+
### 6.2 Performance Budgets & Operational NFRs (If Applicable)
|
|
118
|
+
<!-- Document operational constraints only when required by architecture, scale, or SLAs: -->
|
|
119
|
+
- Latency Budgets & SLAs: <!-- Target p95/p99 latency or response time bounds, if applicable -->
|
|
120
|
+
- Resource Bounds & Lifecycles: <!-- Cache size caps, TTL expiration, memory guards, if applicable -->
|
|
121
|
+
- Upstream Quota & Rate Limit Protection: <!-- Singleton client reuse, exponential backoff, if applicable -->
|
|
122
|
+
- Graceful Degradation: <!-- Downstream timeout bounds, stale/offline fallback, if applicable -->
|
|
123
|
+
|
|
124
|
+
## 7. Key Decisions & Alternatives
|
|
125
|
+
<!--
|
|
126
|
+
Document technical decisions made during grilling:
|
|
127
|
+
- Decision 1: [Choice] vs [Alternative] -> Rationale.
|
|
128
|
+
- Decision 2: ...
|
|
129
|
+
-->
|
|
130
|
+
|
|
131
|
+
## 8. Migration, Rollout & Rollback
|
|
132
|
+
<!--
|
|
133
|
+
Database migrations, deployment steps, feature flags, or rollback procedures (if applicable).
|
|
134
|
+
-->
|
|
@@ -37,8 +37,9 @@ asdlc archive <CHANGE_ID>
|
|
|
37
37
|
|
|
38
38
|
The CLI:
|
|
39
39
|
1. Moves `openspec/changes/<SLUG>/` into `openspec/changes/archive/<SLUG>/`.
|
|
40
|
-
2.
|
|
41
|
-
3.
|
|
40
|
+
2. Syncs living specs into `openspec/specs/` and records the capability in `README.md`.
|
|
41
|
+
3. Rebuilds the AST knowledge graph (`graphify-out/`) against the new HEAD commit.
|
|
42
|
+
4. Creates `AGENTS.md` (if missing) and regenerates its `system-status` block with newly calculated architectural hubs and god nodes.
|
|
42
43
|
|
|
43
44
|
### Step 4: Confirm Archive Completion
|
|
44
45
|
Summarize the result to the user:
|
|
@@ -75,10 +75,14 @@ Then read the approved spec to use as ground truth:
|
|
|
75
75
|
# Read the approved spec from the base branch
|
|
76
76
|
git show origin/<baseRefName>:openspec/changes/<CHANGE_ID>/specs/<capability>/spec.md
|
|
77
77
|
git show origin/<baseRefName>:openspec/changes/<CHANGE_ID>/tasks.md
|
|
78
|
+
|
|
79
|
+
# Execute Acceptance Tests in CI (Player != Referee gate)
|
|
80
|
+
asdlc test <CHANGE_ID> --json
|
|
78
81
|
```
|
|
79
82
|
|
|
80
83
|
> [!NOTE]
|
|
81
84
|
> Read the **spec first**, then the implementation diff. The spec is the ground truth; the code is the candidate.
|
|
85
|
+
> Enforce **Player ≠ Referee**: CI executes `asdlc test <CHANGE_ID> --json` independently rather than trusting claims in `tasks.md`.
|
|
82
86
|
|
|
83
87
|
---
|
|
84
88
|
|
|
@@ -87,11 +91,12 @@ git show origin/<baseRefName>:openspec/changes/<CHANGE_ID>/tasks.md
|
|
|
87
91
|
Evaluate the full diff against all five dimensions. Mark each `PASS`, `CONCERN`, or `FAIL`.
|
|
88
92
|
|
|
89
93
|
#### D1 — Spec Conformance (AC-by-AC)
|
|
90
|
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
- Are there any
|
|
94
|
+
- **Acceptance Test Gate**: Did `asdlc test <CHANGE_ID>` pass with exit code 0? If any mapped test failed or is missing, mark as **🔴 Blocker**.
|
|
95
|
+
- For every `ACn:` in `specs/**/*.md`:
|
|
96
|
+
- Does the implementation satisfy the exact acceptance criterion as written?
|
|
97
|
+
- Is the behavior exercised in the mapped `(test: <path>)` test?
|
|
98
|
+
- Are there any requirements in the spec with **no implementation coverage**?
|
|
99
|
+
- Are there any implemented behaviors with **no corresponding AC** (scope creep)?
|
|
95
100
|
|
|
96
101
|
Flag scope creep as Major: it bypasses the governance gate and introduces untested surface area.
|
|
97
102
|
|
|
@@ -18,9 +18,12 @@ The linter evaluates spec text with pure deterministic rules (no LLM jitter):
|
|
|
18
18
|
- **`R3-scenario`**: Every requirement must have at least one `#### Scenario:`.
|
|
19
19
|
- **`R4-when / R4-then / R4-given`**: Every scenario must follow BDD structure with **WHEN**, **THEN**, and **GIVEN**.
|
|
20
20
|
- **`R5-ac`**: Every requirement must have an Acceptance Criteria block (`- [ ] AC1: ...`).
|
|
21
|
+
- **`R5-scenario-coverage`**: Every scenario under a requirement must have corresponding acceptance criteria (`scenarios.length <= acs.length`), preventing happy-path-only AC shortcuts when edge cases / alternative flows are specified in scenarios.
|
|
21
22
|
- **`R6-ac-test`**: Every acceptance criterion must map to an explicit test file path (`(test: <path>)`).
|
|
22
23
|
- **`R7-test-strategy`**: Must contain a non-empty `## Test Strategy` section.
|
|
23
24
|
- **`R8-removed-reason`**: Any requirement under `## REMOVED Requirements` must document a `**Reason**`.
|
|
25
|
+
- **`design.md` Quality & Enforcement**: Mandatory whenever proposal or specs touch UI/frontend or external/3rd-party APIs. Fails if missing when UI or external APIs are present, or if it contains empty template placeholders.
|
|
26
|
+
- **Visual Acceptance Criteria (UI specs)**: UI requirements must include visual ACs covering responsive breakpoints (mobile, desktop) and interaction states (loading, empty, error), mapped to test files (`(test: <path>)`).
|
|
24
27
|
- **Review Status**: If `review.md` is present, it must have `## Verdict: APPROVE` and zero blocking findings. (On pre-merge branches, `review.md` is pending human PR review and is automatically generated upon `asdlc approve`).
|
|
25
28
|
|
|
26
29
|
---
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: asdlc-new
|
|
3
|
-
description: "Start a new spec-driven change: derives change slug from natural language requirement, grounds in knowledge graph (explore.md), runs batch-grill-me interview, and drafts initial proposal and spec deltas."
|
|
3
|
+
description: "Start a new spec-driven change: derives change slug from natural language requirement, grounds in knowledge graph (explore.md), runs batch-grill-me interview, and drafts initial proposal, technical design (design.md), and spec deltas."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# /asdlc:new - Start Feature & Batch-Grill Author
|
|
7
7
|
|
|
8
|
-
This skill executes **Stage 2 (New)** of the Agentic SDLC. It transforms a natural language requirement into an approved intent change package (`proposal.md`, `specs/**`, `
|
|
8
|
+
This skill executes **Stage 2 (New)** of the Agentic SDLC. It transforms a natural language requirement into an approved intent change package (`proposal.md`, `specs/**`, and `design.md`).
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
@@ -23,11 +23,12 @@ The CLI:
|
|
|
23
23
|
2. Creates `openspec/changes/<SLUG>/`.
|
|
24
24
|
3. Runs Graphify queries using the extracted requirement terms to discover real codebase AST nodes and call chains.
|
|
25
25
|
4. Generates `explore.md` and seeds `clarifications.md`.
|
|
26
|
+
5. **Technical Design Auto-Detection**: If the requirement touches UI/UX, frontend, APIs, services, databases, or architecture (or if `--design` is passed), seeds `design.md` with enterprise-grade technical design scaffolding.
|
|
26
27
|
|
|
27
28
|
> [!IMPORTANT]
|
|
28
29
|
> **NO PAUSE / CONTINUOUS EXECUTION**: Do NOT stop after `asdlc new` to ask the author "Should I start grilling?".
|
|
29
30
|
> You MUST proceed immediately to Step 2 and Step 3 (**batch-grill-me** interview) in the same turn!
|
|
30
|
-
> Only after `clarifications.md` has all questions settled may you draft `proposal.md` and `specs/**`.
|
|
31
|
+
> Only after `clarifications.md` has all questions settled may you draft `proposal.md`, `design.md`, and `specs/**`.
|
|
31
32
|
|
|
32
33
|
### Step 2: Ground Yourself in Codebase & External Context (Strict Order)
|
|
33
34
|
Follow this strict discovery sequence:
|
|
@@ -35,14 +36,27 @@ Follow this strict discovery sequence:
|
|
|
35
36
|
- Read `openspec/changes/<SLUG>/explore.md`.
|
|
36
37
|
- Note the **Architectural Hubs (god nodes)** that this change touches.
|
|
37
38
|
- Review existing functions, types, and exported symbols. Never guess: ground internal assumptions in real paths from `explore.md`.
|
|
38
|
-
2. **Targeted External Search (
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
2. **Policy Guard & Targeted External Search (Enabled by Default)**:
|
|
40
|
+
- **Enterprise Egress Policy Guard**: Check `.sdlc/policy.yaml` before executing any external web or API doc search.
|
|
41
|
+
- **Default is ENABLED (`allow`)**: External web search is enabled by default. If `web_search` is omitted, unspecified, or set to `allow` in `.sdlc/policy.yaml`, search is permitted and encouraged for grounding 3rd-party APIs, vendor SDKs, and specs.
|
|
42
|
+
- **Strict Egress Deny**: Search is blocked **ONLY if `.sdlc/policy.yaml` explicitly sets `web_search: deny`** (for air-gapped / offline enterprise environments).
|
|
43
|
+
In that case, emit:
|
|
44
|
+
`[POLICY] External search disabled by .sdlc/policy.yaml (web_search: deny); proceeding with local context only.`
|
|
45
|
+
Tag any external API assumptions in `clarifications.md` and `design.md` with `[UNVERIFIED: policy_denied]`.
|
|
46
|
+
- **Authoritative Fact Lookup** (when search is allowed / default):
|
|
47
|
+
If the requirement references 3rd-party APIs, vendor SDKs, protocols, or external library specs (e.g. Amap, Weather APIs, Maps, Payment Gateways):
|
|
48
|
+
Execute a targeted web/doc search to look up authoritative endpoints, rate limits, request/response formats, error codes, and caching best practices.
|
|
49
|
+
- **Non-blocking failure tolerance**: If external search fails (offline, rate limited, sandbox network restriction, DNS failure, timeout), **DO NOT BLOCK**.
|
|
50
|
+
Output:
|
|
51
|
+
`[WARN] External search failed or offline: <reason>. Continuing with defined steps.`
|
|
52
|
+
Tag any unverified external API assumptions, endpoints, schemas, or rate limits in `clarifications.md` and `design.md` with `[UNVERIFIED: <reason>]`.
|
|
53
|
+
These will be explicitly surfaced on the PR review by CI/D7 for mandatory human confirmation before merge.
|
|
42
54
|
|
|
43
55
|
### Step 3: Run the `batch-grill-me` Interview
|
|
44
56
|
Before authoring any spec markdown, run the **`batch-grill-me`** protocol:
|
|
45
|
-
1. Evaluate the
|
|
57
|
+
1. Evaluate the open decision frontier for this feature:
|
|
58
|
+
- **Functional Seams**: Primary user flows, alternate paths, domain states, and interface contracts.
|
|
59
|
+
- **Security & Operational NFRs (When Applicable)**: For changes introducing public endpoints, handling sensitive data, or integrating external rate-limited APIs, evaluate auth boundaries and operational limits. (Do not invent synthetic numbers for simple changes where SLAs do not apply).
|
|
46
60
|
2. Present all architectural forks and boundary questions in **one structured batch**:
|
|
47
61
|
- Number each question (`Q1`, `Q2`, `Q3`...).
|
|
48
62
|
- Provide concrete options (A / B / C).
|
|
@@ -57,18 +71,37 @@ Once `## Open questions` in `clarifications.md` is empty, author the change docu
|
|
|
57
71
|
1. **`proposal.md`**:
|
|
58
72
|
- Sections: `## Why`, `## What Changes`, `## Capabilities`, `## Impact`, `## Out of Scope`, `## Dependencies & Assumptions`.
|
|
59
73
|
- 1-2 pages maximum. Focus on **WHY**, not code implementation details.
|
|
60
|
-
|
|
74
|
+
|
|
75
|
+
2. **`design.md` (Technical Design Document - Mandatory for UI & Complex Systems)**:
|
|
76
|
+
- When a change touches UI/frontend, external APIs, databases, or services, author `design.md` to define **HOW**:
|
|
77
|
+
- **Architecture & Component Interaction**: Mermaid sequence/flowchart diagrams.
|
|
78
|
+
- **Interface Contracts & Schemas**: TypeScript interfaces or JSON schemas for all requests/responses.
|
|
79
|
+
- **External API Integration**: Endpoints, authentication, rate limits, client-level in-memory/TTL caching (never recreate clients per request), error taxonomy & fallbacks.
|
|
80
|
+
- **Security & Operational NFRs (Optional / When Applicable)**: Document authentication, boundary validation, secret lifecycles, and performance budgets/quotas when the architecture demands them (omit or mark N/A for changes without external dependencies or strict SLAs).
|
|
81
|
+
- **UI/UX Design Reference & Tokens (Zero tolerance for unstyled HTML)**:
|
|
82
|
+
- **Required Ground Truth Reference**: Link to human-provided mockup, Figma URL, brand styleguide, or existing CSS tokens. Do NOT invent palettes or fonts in isolation.
|
|
83
|
+
- Concrete design tokens derived from reference (colors, typography, spacing/radii).
|
|
84
|
+
- Component hierarchy (Hero/Search, Filters, Data Cards, Detail views).
|
|
85
|
+
- Responsive breakpoints: Mobile (<= 640px), Tablet (<= 1024px), Desktop (> 1024px).
|
|
86
|
+
- Mandatory interaction states: Default, Hover/Focus, Loading Skeleton, Empty State with prompt, Error Banner with retry.
|
|
87
|
+
|
|
88
|
+
3. **`specs/<capability>/spec.md`**:
|
|
61
89
|
- `## Purpose`: Clear capability statement (50+ chars).
|
|
62
90
|
- `## ADDED Requirements`:
|
|
63
91
|
- Every requirement: `### Requirement: <name>` using **SHALL** or **MUST**.
|
|
64
92
|
- Every requirement has `#### Scenario: <name>` with **GIVEN / WHEN / THEN**.
|
|
65
93
|
- Every requirement has an `**Acceptance criteria**` block:
|
|
66
94
|
`- [ ] AC1: <concrete testable assertion> (test: <path/to/test>)`
|
|
95
|
+
- **UI Testability**: For any UI capability, include visual Acceptance Criteria for responsive breakpoints and key interaction states (empty, loading, error), mapped to component/E2E test targets (e.g. Playwright / snapshot tests).
|
|
67
96
|
- `## Constraints & NFRs`: Verifiable performance/security statements.
|
|
68
97
|
- `## Out of Scope` and `## Test Strategy`.
|
|
69
|
-
|
|
70
|
-
|
|
98
|
+
|
|
99
|
+
4. **Review Provenance (Player $\ne$ Referee)**:
|
|
100
|
+
- The authoring agent MUST NOT approve its own spec.
|
|
101
|
+
- Do NOT stamp `review.md` with self-approval.
|
|
102
|
+
- Independent AI review (`asdlc:spec-review`) is executed automatically on the Spec PR by CI.
|
|
103
|
+
- Formal approval is given by the human lead via PR merge or `asdlc approve <SLUG>`.
|
|
71
104
|
|
|
72
105
|
### Step 5: Transition to Lint
|
|
73
106
|
Once artifacts are written, guide the developer:
|
|
74
|
-
> "Artifacts drafted! Now run `/asdlc:lint <SLUG>` to verify BDD scenarios and acceptance criteria before opening the spec PR."
|
|
107
|
+
> "Artifacts drafted! Now run `/asdlc:lint <SLUG>` to verify BDD scenarios, technical design, and acceptance criteria before opening the spec PR."
|
|
@@ -106,6 +106,13 @@ Evaluate every requirement in the diff against all six dimensions. Mark each `PA
|
|
|
106
106
|
- Is user-supplied input validated before use?
|
|
107
107
|
- If the change stores user data, is PII lifecycle (retention, deletion) documented?
|
|
108
108
|
|
|
109
|
+
#### D7 — Technical Design & UI/API Soundness
|
|
110
|
+
- **Design Ground Truth**: When UI is involved, does `design.md` cite an authoritative ground truth reference (mockup, Figma URL, design system URL, or existing brand CSS)? Flag as **Major** if tokens appear hallucinated without reference or justification.
|
|
111
|
+
- **Visual Testability**: When UI is involved, does the spec contain Visual Acceptance Criteria covering responsive breakpoints (mobile, tablet, desktop) and interaction states (loading, empty, error, active), mapped to test files (e.g. Playwright / visual snapshot tests)? Flag as **Blocker** if UI specs lack visual ACs or test mappings.
|
|
112
|
+
- **Unverified Assumptions**: Are there any `[UNVERIFIED: <reason>]` tags present in `clarifications.md`, `design.md`, or the specs? D7 MUST extract every `[UNVERIFIED]` tag. If an AC depends on an unverified endpoint, quota, or rate limit without a verified fallback, flag as **Major** and require explicit human TL sign-off.
|
|
113
|
+
- **API & Client Lifecycle**: When 3rd-party/external APIs are integrated, does the technical design enforce client reuse (singleton / connection pooling, never recreate per request), in-memory TTL caching for geocoding/lookup endpoints, rate-limit awareness, and degraded fallbacks? Flag as **Blocker** if clients are instantiated per request or lack caching/retry policies.
|
|
114
|
+
- **Interface & DTO Contracts**: Are request/response schemas, DTOs, and domain models rigorously typed (e.g. TypeScript interfaces) with validation boundaries?
|
|
115
|
+
|
|
109
116
|
---
|
|
110
117
|
|
|
111
118
|
### Step 3: Build the Requirement → AC → Test Traceability Matrix
|
|
@@ -118,8 +125,8 @@ For each `### Requirement:` found in the diff, produce one row covering all its
|
|
|
118
125
|
|
|
119
126
|
Classify each finding:
|
|
120
127
|
|
|
121
|
-
- **🔴 Blocker** — Contradictory ACs, untestable assertion, missing normative language, security risk. Blocks `asdlc approve`.
|
|
122
|
-
- **🟡 Major** — Ambiguous scenario, unhandled edge case, missing
|
|
128
|
+
- **🔴 Blocker** — Contradictory ACs, untestable assertion, missing normative language, missing visual ACs for UI, missing singleton/caching for external APIs, security risk. Blocks `asdlc approve`.
|
|
129
|
+
- **🟡 Major** — Ambiguous scenario, unhandled edge case, unverified assumption on external API (`[UNVERIFIED]`), missing design ground truth reference. Should be resolved or acknowledged before approval.
|
|
123
130
|
- **🟢 Advisory** — Clarity or style improvements. Does not block.
|
|
124
131
|
|
|
125
132
|
---
|
|
@@ -153,6 +160,7 @@ Format the comment body strictly as:
|
|
|
153
160
|
| D4 Contract impact | ✅ / ⚠️ / ❌ | <one-line summary> |
|
|
154
161
|
| D5 Testability | ✅ / ⚠️ / ❌ | <one-line summary> |
|
|
155
162
|
| D6 Security & Privacy | ✅ / ⚠️ / ❌ | <one-line summary> |
|
|
163
|
+
| D7 Technical Design & UI/API Soundness | ✅ / ⚠️ / ❌ | <one-line summary> |
|
|
156
164
|
|
|
157
165
|
### Requirement → AC → Test Traceability
|
|
158
166
|
|
|
@@ -160,6 +168,10 @@ Format the comment body strictly as:
|
|
|
160
168
|
| :--- | :--- | :--- | :--- |
|
|
161
169
|
| <Requirement name> | AC1, AC2 | test/<feature>.test.ts | ✅ VERIFIED |
|
|
162
170
|
|
|
171
|
+
### ⚠️ Unverified Assumptions Requiring TL Acknowledgment
|
|
172
|
+
<!-- List any [UNVERIFIED: ...] tags found across clarifications.md, design.md, and specs. Omit section if none. -->
|
|
173
|
+
- `[UNVERIFIED: <reason>]` — <context / affected requirement>
|
|
174
|
+
|
|
163
175
|
### 🔴 Blocking Findings
|
|
164
176
|
<!-- Omit section if none -->
|
|
165
177
|
1. **[Blocker]** `<Requirement: Name>` — AC<n>: <description of contradiction or missing assertion>
|
package/bin/asdlc.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akjamie/agentic-sdlc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.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": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"README.md"
|
|
28
28
|
],
|
|
29
29
|
"scripts": {
|
|
30
|
-
"test": "node --test
|
|
30
|
+
"test": "node --test",
|
|
31
31
|
"lint": "node --check bin/asdlc.js"
|
|
32
32
|
},
|
|
33
33
|
"keywords": [
|
package/src/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ import { register as registerLint } from './commands/lint.js';
|
|
|
6
6
|
import { register as registerPr } from './commands/pr.js';
|
|
7
7
|
import { register as registerApprove } from './commands/approve.js';
|
|
8
8
|
import { register as registerApply } from './commands/apply.js';
|
|
9
|
+
import { register as registerTest } from './commands/test.js';
|
|
9
10
|
import { register as registerVerify } from './commands/verify.js';
|
|
10
11
|
import { register as registerArchive } from './commands/archive.js';
|
|
11
12
|
import { register as registerStatus } from './commands/status.js';
|
|
@@ -32,6 +33,7 @@ export function buildCli() {
|
|
|
32
33
|
registerPr(program); // 3.5 open the Spec PR automatically
|
|
33
34
|
registerApprove(program); // 4. record approval (after the spec PR merges or in-place)
|
|
34
35
|
registerApply(program); // 5. start implementing
|
|
36
|
+
registerTest(program); // 5.5 run acceptance tests mapped from change specs (TDD & CI gate)
|
|
35
37
|
registerVerify(program); // 6. check the implementation
|
|
36
38
|
registerArchive(program); // 7. finish (sync living specs to openspec/specs/)
|
|
37
39
|
|
|
@@ -50,6 +52,7 @@ The flow:
|
|
|
50
52
|
asdlc pr <ID> <targetBranch> open the Spec PR (pushes branch + auto-creates PR via CLI or API)
|
|
51
53
|
asdlc approve <ID> record approval (on PR / merge / in-place) + mark READY_FOR_IMPL
|
|
52
54
|
asdlc apply <ID> guard, then /opsx-apply (task-level TDD loop)
|
|
55
|
+
asdlc test <ID> run acceptance tests mapped from change specs (TDD & CI gate)
|
|
53
56
|
asdlc verify <ID> check the implementation (artifacts, tasks, tests, AI)
|
|
54
57
|
asdlc archive <ID> finish: archive change + sync living specs to openspec/specs/
|
|
55
58
|
|
package/src/commands/archive.js
CHANGED
|
@@ -4,6 +4,7 @@ import { changeDir } from '../lib/paths.js';
|
|
|
4
4
|
import { requireRepo, toChangeSlug } from '../lib/cliutil.js';
|
|
5
5
|
import { runOpenspec } from '../lib/openspec.js';
|
|
6
6
|
import { refreshAgents } from '../lib/agents.js';
|
|
7
|
+
import { ensureFreshGraph } from '../lib/graphify.js';
|
|
7
8
|
import { git } from '../lib/git.js';
|
|
8
9
|
import { fail } from '../lib/errors.js';
|
|
9
10
|
import { log } from '../lib/log.js';
|
|
@@ -88,12 +89,38 @@ export function archiveChange(changeId, opts = {}) {
|
|
|
88
89
|
|
|
89
90
|
syncReadme(repoRoot, slug, proposalText);
|
|
90
91
|
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
// Refresh AST knowledge graph if Graphify is available
|
|
93
|
+
if (opts.graph !== false) {
|
|
94
|
+
try {
|
|
95
|
+
const g = ensureFreshGraph(repoRoot);
|
|
96
|
+
if (g.status === 'missing' || g.status === 'stale') {
|
|
97
|
+
log.ok(`rebuilt knowledge graph (graphify ${g.status} -> fresh)`);
|
|
98
|
+
}
|
|
99
|
+
} catch (err) {
|
|
100
|
+
log.warn(`knowledge graph refresh skipped: ${err.message}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// AGENTS.md update:
|
|
105
|
+
// - If AGENTS.md does not exist, create and initialize it.
|
|
106
|
+
// - If AGENTS.md exists, refresh the system status (knowledge graph god nodes)
|
|
107
|
+
// and routing block so the agentic IDE stays grounded in current architecture.
|
|
108
|
+
// - If constitutional change or explicit --agents, log governance refresh.
|
|
109
|
+
// - If --no-agents was explicitly passed, skip updating AGENTS.md.
|
|
110
|
+
const agentsPath = path.join(repoRoot, 'AGENTS.md');
|
|
111
|
+
const agentsMissing = !exists(agentsPath);
|
|
112
|
+
const constitutional = isConstitutionalChange(repoRoot, opts);
|
|
113
|
+
const shouldUpdateAgents = opts.agents !== false;
|
|
114
|
+
|
|
94
115
|
if (shouldUpdateAgents) {
|
|
95
|
-
refreshAgents(repoRoot, { systemStatus:
|
|
96
|
-
|
|
116
|
+
refreshAgents(repoRoot, { systemStatus: true });
|
|
117
|
+
if (agentsMissing) {
|
|
118
|
+
log.ok('created AGENTS.md (was missing) and initialized system status');
|
|
119
|
+
} else if (constitutional) {
|
|
120
|
+
log.ok('updated AGENTS.md (constitutional change detected on governance paths)');
|
|
121
|
+
} else {
|
|
122
|
+
log.ok('refreshed AGENTS.md system status (knowledge graph hubs)');
|
|
123
|
+
}
|
|
97
124
|
}
|
|
98
125
|
|
|
99
126
|
log.ok(`archive complete for ${slug}`);
|
|
@@ -103,10 +130,11 @@ export function archiveChange(changeId, opts = {}) {
|
|
|
103
130
|
export function register(program) {
|
|
104
131
|
program
|
|
105
132
|
.command('archive <changeId>')
|
|
106
|
-
.description('finish: archive change + sync living specs to openspec/specs/ + update README
|
|
133
|
+
.description('finish: archive change + sync living specs to openspec/specs/ + update README & AGENTS.md')
|
|
107
134
|
.option('--repo-root <path>')
|
|
108
135
|
.option('--agents', 'force refresh AGENTS.md')
|
|
109
136
|
.option('--no-agents', 'skip updating AGENTS.md')
|
|
137
|
+
.option('--no-graph', 'skip rebuilding knowledge graph')
|
|
110
138
|
.option('--no-openspec', 'skip the openspec archive step')
|
|
111
139
|
.action((changeId, opts) => {
|
|
112
140
|
process.exitCode = archiveChange(changeId, opts);
|
package/src/commands/lint.js
CHANGED
|
@@ -56,8 +56,37 @@ export function runLint(changeId, opts = {}) {
|
|
|
56
56
|
add('change', 'pass', slug);
|
|
57
57
|
add('explore.md (stage 1)', exists(path.join(cdir, 'explore.md')) ? 'pass' : 'fail',
|
|
58
58
|
exists(path.join(cdir, 'explore.md')) ? '' : 'run `asdlc new <ID>` (explore is the first stage)');
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const proposalPath = path.join(cdir, 'proposal.md');
|
|
60
|
+
const proposalText = exists(proposalPath) ? readText(proposalPath) : '';
|
|
61
|
+
add('proposal.md', exists(proposalPath) ? 'pass' : 'fail',
|
|
62
|
+
exists(proposalPath) ? '' : 'proposal.md missing');
|
|
63
|
+
|
|
64
|
+
const specFiles = exists(path.join(cdir, 'specs'))
|
|
65
|
+
? walkFiles(path.join(cdir, 'specs')).filter((f) => f.endsWith('spec.md'))
|
|
66
|
+
: [];
|
|
67
|
+
add('spec delta', specFiles.length > 0 ? 'pass' : 'fail', specFiles.length > 0 ? `${specFiles.length} file(s)` : 'no spec delta present');
|
|
68
|
+
|
|
69
|
+
const combinedSpecText = specFiles.map((f) => readText(path.join(cdir, 'specs', f))).join('\n');
|
|
70
|
+
const fullIntentText = `${proposalText}\n${combinedSpecText}`;
|
|
71
|
+
|
|
72
|
+
// Deterministic detection for UI and 3rd-party/external API scope
|
|
73
|
+
const UI_OR_EXTERNAL_API = /\b(ui|ux|frontend|web|screen|page|view|component|css|style|html|layout|dialog|modal|button|table|card|form|itinerary|3rd-party|third-party|external api|vendor api|geocode|amap|weather api|maps api|payment gateway|stripe|oauth|webhook)\b/i;
|
|
74
|
+
const requiresDesign = UI_OR_EXTERNAL_API.test(fullIntentText);
|
|
75
|
+
|
|
76
|
+
const designPath = path.join(cdir, 'design.md');
|
|
77
|
+
if (!exists(designPath)) {
|
|
78
|
+
if (requiresDesign) {
|
|
79
|
+
add('design.md', 'fail', 'design.md is mandatory for UI and external API changes (run `asdlc new --design` or author design.md)');
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
const text = readText(designPath);
|
|
83
|
+
const nonComment = text.replace(/<!--[\s\S]*?-->/g, '').trim();
|
|
84
|
+
if (nonComment.length < 150) {
|
|
85
|
+
add('design.md', 'fail', 'design.md contains only unedited template placeholders; fill in technical design');
|
|
86
|
+
} else {
|
|
87
|
+
add('design.md', 'pass', 'technical design documented');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
61
90
|
|
|
62
91
|
const reviewPath = path.join(cdir, 'review.md');
|
|
63
92
|
if (!exists(reviewPath)) {
|
|
@@ -71,11 +100,6 @@ export function runLint(changeId, opts = {}) {
|
|
|
71
100
|
add('blocking findings', hasBlockingFindings(text) ? 'fail' : 'pass', hasBlockingFindings(text) ? 'blocking findings present' : '');
|
|
72
101
|
}
|
|
73
102
|
|
|
74
|
-
const specFiles = exists(path.join(cdir, 'specs'))
|
|
75
|
-
? walkFiles(path.join(cdir, 'specs')).filter((f) => f.endsWith('spec.md'))
|
|
76
|
-
: [];
|
|
77
|
-
add('spec delta', specFiles.length > 0 ? 'pass' : 'fail', specFiles.length > 0 ? `${specFiles.length} file(s)` : 'no spec delta present');
|
|
78
|
-
|
|
79
103
|
const { rules } = readLintConfig(repoRoot);
|
|
80
104
|
const findings = [];
|
|
81
105
|
for (const file of specFiles) {
|
package/src/commands/new.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { exists, readText, writeText } from '../lib/fs.js';
|
|
3
|
-
import { changeDir } from '../lib/paths.js';
|
|
2
|
+
import { exists, readText, writeText, ensureDir } from '../lib/fs.js';
|
|
3
|
+
import { changeDir, schemaAssetDir } from '../lib/paths.js';
|
|
4
4
|
import { requireRepo, deriveChangeSlug, extractRequirementTerms } from '../lib/cliutil.js';
|
|
5
5
|
import { ensureGraphify, ensureFreshGraph, graphifyQuery } from '../lib/graphify.js';
|
|
6
6
|
import { runOpenspec } from '../lib/openspec.js';
|
|
@@ -18,10 +18,16 @@ export function newChange(requirement, opts = {}) {
|
|
|
18
18
|
const cdir = changeDir(repoRoot, slug);
|
|
19
19
|
if (exists(cdir)) fail(`change '${slug}' already exists`, { hint: 'use a new requirement/id, or iterate the existing change' });
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
if (opts.openspec !== false) {
|
|
22
|
+
const res = runOpenspec(['new', 'change', slug], repoRoot);
|
|
23
|
+
if (res.missing) fail('OpenSpec CLI not found', { hint: 'run `asdlc init`' });
|
|
24
|
+
if (res.status !== 0) fail(`openspec new change failed: ${(res.stderr || res.stdout || '').slice(0, 300)}`);
|
|
25
|
+
log.ok(`created change '${slug}' (derived from: "${requirement}")`);
|
|
26
|
+
} else {
|
|
27
|
+
ensureDir(cdir);
|
|
28
|
+
writeText(path.join(cdir, '.openspec.yaml'), 'schema: agentic-repo-change\n');
|
|
29
|
+
log.ok(`created change '${slug}' (derived from: "${requirement}")`);
|
|
30
|
+
}
|
|
25
31
|
|
|
26
32
|
// Record requirement in change metadata (.openspec.yaml)
|
|
27
33
|
const metaPath = path.join(cdir, '.openspec.yaml');
|
|
@@ -110,6 +116,10 @@ _(unavailable - graph query error)_
|
|
|
110
116
|
|
|
111
117
|
## Settled decisions
|
|
112
118
|
<!-- one entry per settled decision: decision -> answer, with the reason -->
|
|
119
|
+
<!-- Consider key architectural dimensions: -->
|
|
120
|
+
<!-- 1. Functional Scope & Seams (user journeys, error states, domain models) -->
|
|
121
|
+
<!-- 2. Security & Threat Mitigation (auth, parameter validation, secrets, data privacy) -->
|
|
122
|
+
<!-- 3. Operational NFRs & Performance Budgets (latency SLAs, cache TTL, rate limits) -->
|
|
113
123
|
|
|
114
124
|
## Open questions
|
|
115
125
|
<!-- must be empty before the spec is written -->
|
|
@@ -117,15 +127,32 @@ _(unavailable - graph query error)_
|
|
|
117
127
|
log.ok('seeded clarifications.md (run batch-grill-me interview)');
|
|
118
128
|
}
|
|
119
129
|
|
|
130
|
+
// Technical design (design.md) scaffolding:
|
|
131
|
+
// Auto-seed if requirement implies UI, frontend, API integration, security, NFR, or technical complexity,
|
|
132
|
+
// or if explicitly requested via opts.design === true.
|
|
133
|
+
const UI_OR_TECH_KEYWORDS = /\b(ui|ux|frontend|web|screen|page|view|component|css|style|api|endpoint|service|client|integration|database|db|schema|model|architecture|refactor|migration|auth|payment|cache|gateway|protocol|security|threat|nfr|performance|rate.?limit|sanitize|encryption)\b/i;
|
|
134
|
+
const shouldSeedDesign = opts.design === true || (opts.design !== false && UI_OR_TECH_KEYWORDS.test(requirement));
|
|
135
|
+
const designPath = path.join(cdir, 'design.md');
|
|
136
|
+
if (shouldSeedDesign && !exists(designPath)) {
|
|
137
|
+
const tmplPath = path.join(schemaAssetDir, 'templates', 'design.md');
|
|
138
|
+
let tmpl = exists(tmplPath) ? readText(tmplPath) : `# Technical Design: ${slug}\n\n`;
|
|
139
|
+
tmpl = tmpl.replace('<!-- change id -->', slug);
|
|
140
|
+
tmpl = tmpl.replace('<!-- requirement summary -->', requirement.replace(/"/g, '\\"'));
|
|
141
|
+
writeText(designPath, tmpl);
|
|
142
|
+
log.ok('seeded design.md (technical design for architecture/UI/API/security/NFR)');
|
|
143
|
+
}
|
|
144
|
+
|
|
120
145
|
log.info('');
|
|
121
146
|
log.info('[ASDLC PROTOCOL: IMMEDIATE ACTION REQUIRED FOR AGENT]');
|
|
122
147
|
log.info(' ▶ DO NOT pause or ask the author if you should begin grilling.');
|
|
123
|
-
log.info(' ▶
|
|
124
|
-
log.info('
|
|
125
|
-
log.info('
|
|
126
|
-
log.info('
|
|
127
|
-
log.info('
|
|
128
|
-
log.info(
|
|
148
|
+
log.info(' ▶ Ground yourself in `explore.md` and research codebase facts first.');
|
|
149
|
+
log.info(' ▶ Perform external search for 3rd-party APIs, vendor SDKs, and UI design patterns (enabled by default).');
|
|
150
|
+
log.info(' (If search fails or offline: emit \'[WARN] External search failed or offline: <reason>. Continuing with defined steps.\' and continue without blocking).');
|
|
151
|
+
log.info(' ▶ Formulate decision frontier covering Functional scope, Security threat vectors, and Operational NFRs.');
|
|
152
|
+
log.info(' ▶ Invoke `batch-grill-me` (or `grilling`) to present structured Batch 1 questions with recommended defaults.');
|
|
153
|
+
log.info(' ▶ Record agreed decisions into `clarifications.md`.');
|
|
154
|
+
log.info(' ▶ ONLY AFTER clarifications are settled: author `proposal.md`, `specs/**`, and `design.md` (if seeded/needed).');
|
|
155
|
+
log.info(` ▶ Run \`asdlc lint ${slug}\`.`);
|
|
129
156
|
return slug;
|
|
130
157
|
}
|
|
131
158
|
|
|
@@ -135,6 +162,8 @@ export function register(program) {
|
|
|
135
162
|
.description('start a spec: scaffold + refresh the graph + explore.md + clarifications.md (for grilling)')
|
|
136
163
|
.option('--id <slug>', 'explicit change slug (override auto-derivation)')
|
|
137
164
|
.option('--query <q>', 'graph query terms (default: extracted requirement terms)')
|
|
165
|
+
.option('--design', 'explicitly generate technical design (design.md)')
|
|
166
|
+
.option('--no-design', 'skip generating technical design (design.md)')
|
|
138
167
|
.option('--repo-root <path>')
|
|
139
168
|
.action((requirement, opts) => {
|
|
140
169
|
newChange(requirement, opts);
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { exists, readText, walkFiles } from '../lib/fs.js';
|
|
3
|
+
import { changeDir } from '../lib/paths.js';
|
|
4
|
+
import { requireRepo, toChangeSlug } from '../lib/cliutil.js';
|
|
5
|
+
import { runShell } from '../lib/exec.js';
|
|
6
|
+
import { fail } from '../lib/errors.js';
|
|
7
|
+
import { log } from '../lib/log.js';
|
|
8
|
+
|
|
9
|
+
export function parseSpecAcceptanceCriteria(specText) {
|
|
10
|
+
const acs = [];
|
|
11
|
+
const lines = specText.split('\n');
|
|
12
|
+
let currentReq = '';
|
|
13
|
+
|
|
14
|
+
for (const line of lines) {
|
|
15
|
+
const reqMatch = line.match(/^###\s+Requirement:\s*(.+?)\s*$/);
|
|
16
|
+
if (reqMatch) {
|
|
17
|
+
currentReq = reqMatch[1];
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const acMatch = line.match(/^\s*-\s*\[[ xX]\]\s*(AC\d+)\s*:\s*(.+)$/);
|
|
21
|
+
if (!acMatch) continue;
|
|
22
|
+
const testMatch = line.match(/\(test:\s*([^)]+?)\s*\)/i);
|
|
23
|
+
acs.push({
|
|
24
|
+
id: acMatch[1],
|
|
25
|
+
requirement: currentReq,
|
|
26
|
+
text: acMatch[2].replace(/\(test:.*$/i, '').trim(),
|
|
27
|
+
testPath: testMatch ? testMatch[1].trim() : null,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return acs;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function runTests(changeId, opts = {}) {
|
|
34
|
+
const repoRoot = requireRepo(opts);
|
|
35
|
+
const slug = toChangeSlug(changeId);
|
|
36
|
+
const cdir = changeDir(repoRoot, slug);
|
|
37
|
+
|
|
38
|
+
if (!exists(cdir)) {
|
|
39
|
+
fail(`change '${slug}' not found`, { hint: 'check the change id or run `asdlc status`' });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const specsDir = path.join(cdir, 'specs');
|
|
43
|
+
if (!exists(specsDir)) {
|
|
44
|
+
fail(`no specs directory found for change '${slug}'`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const specFiles = walkFiles(specsDir).filter((f) => f.endsWith('spec.md'));
|
|
48
|
+
if (specFiles.length === 0) {
|
|
49
|
+
fail(`no spec.md files found under specs/ for change '${slug}'`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const allAcs = [];
|
|
53
|
+
for (const relFile of specFiles) {
|
|
54
|
+
const fullPath = path.join(specsDir, relFile);
|
|
55
|
+
const content = readText(fullPath);
|
|
56
|
+
const acs = parseSpecAcceptanceCriteria(content);
|
|
57
|
+
for (const ac of acs) {
|
|
58
|
+
allAcs.push({ ...ac, specFile: relFile });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (allAcs.length === 0) {
|
|
63
|
+
fail(`no acceptance criteria (AC<n>) found in specs for change '${slug}'`, {
|
|
64
|
+
hint: 'add acceptance criteria with test mappings: - [ ] AC1: ... (test: path/to/test)',
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const missingMappings = allAcs.filter((ac) => !ac.testPath);
|
|
69
|
+
if (missingMappings.length > 0) {
|
|
70
|
+
fail(`${missingMappings.length} acceptance criteria lack (test: <path>) mappings:\n` +
|
|
71
|
+
missingMappings.map((ac) => ` - ${ac.id}: ${ac.text}`).join('\n'));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const uniqueTestPaths = [...new Set(allAcs.map((ac) => ac.testPath))];
|
|
75
|
+
const missingFiles = uniqueTestPaths.filter((tp) => !exists(path.resolve(repoRoot, tp)));
|
|
76
|
+
if (missingFiles.length > 0) {
|
|
77
|
+
fail(`mapped test file(s) do not exist:\n` + missingFiles.map((f) => ` - ${f}`).join('\n'), {
|
|
78
|
+
hint: 'create test stubs or update (test: <path>) in specs',
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!opts.json) {
|
|
83
|
+
log.info(`=== Running Acceptance Tests for ${slug} ===`);
|
|
84
|
+
log.info(`Mapped ACs: ${allAcs.length} across ${uniqueTestPaths.length} test file(s):`);
|
|
85
|
+
for (const ac of allAcs) {
|
|
86
|
+
log.info(` • [${ac.id}] ${ac.text} -> ${ac.testPath}`);
|
|
87
|
+
}
|
|
88
|
+
log.info('');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const runnerCmd = opts.runner ?? (process.platform === 'win32'
|
|
92
|
+
? `node --test ${uniqueTestPaths.map((p) => `"${p}"`).join(' ')}`
|
|
93
|
+
: `node --test ${uniqueTestPaths.join(' ')}`);
|
|
94
|
+
|
|
95
|
+
const res = runShell(runnerCmd, repoRoot, {
|
|
96
|
+
env: { NODE_TEST_CONTEXT: undefined },
|
|
97
|
+
stdio: 'pipe',
|
|
98
|
+
});
|
|
99
|
+
const passed = res.status === 0;
|
|
100
|
+
|
|
101
|
+
if (opts.json) {
|
|
102
|
+
const output = {
|
|
103
|
+
changeId: slug,
|
|
104
|
+
pass: passed,
|
|
105
|
+
status: passed ? 'pass' : 'fail',
|
|
106
|
+
acCount: allAcs.length,
|
|
107
|
+
testFiles: uniqueTestPaths,
|
|
108
|
+
acs: allAcs,
|
|
109
|
+
stdout: res.stdout,
|
|
110
|
+
stderr: res.stderr,
|
|
111
|
+
};
|
|
112
|
+
process.stdout.write(JSON.stringify(output, null, 2) + '\n');
|
|
113
|
+
} else {
|
|
114
|
+
if (res.stdout) process.stdout.write(res.stdout);
|
|
115
|
+
if (res.stderr) process.stderr.write(res.stderr);
|
|
116
|
+
|
|
117
|
+
if (passed) {
|
|
118
|
+
log.ok(`✓ all acceptance tests passed (${allAcs.length} ACs, ${uniqueTestPaths.length} files)`);
|
|
119
|
+
} else {
|
|
120
|
+
log.error(`✗ acceptance test run failed (exit code ${res.status})`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return passed ? 0 : 1;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function register(program) {
|
|
128
|
+
program
|
|
129
|
+
.command('test <changeId>')
|
|
130
|
+
.description('run acceptance tests mapped from change specs (TDD & CI gate)')
|
|
131
|
+
.option('--json', 'output structured JSON report for CI consumption')
|
|
132
|
+
.option('--runner <command>', 'custom test runner command')
|
|
133
|
+
.option('--repo-root <path>')
|
|
134
|
+
.action((changeId, opts) => {
|
|
135
|
+
process.exitCode = runTests(changeId, opts);
|
|
136
|
+
});
|
|
137
|
+
}
|
package/src/lib/exec.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
2
|
|
|
3
3
|
export function runShell(command, cwd, { env = {}, timeout = 600000, input } = {}) {
|
|
4
|
+
const mergedEnv = { ...process.env, ...env };
|
|
5
|
+
for (const [k, v] of Object.entries(env)) {
|
|
6
|
+
if (v === undefined) delete mergedEnv[k];
|
|
7
|
+
}
|
|
4
8
|
const res = spawnSync(command, {
|
|
5
9
|
cwd,
|
|
6
10
|
encoding: 'utf8',
|
|
7
11
|
shell: true,
|
|
8
12
|
timeout,
|
|
9
|
-
env:
|
|
13
|
+
env: mergedEnv,
|
|
10
14
|
input, // optional stdin: feeds prompts to a headless verifier agent
|
|
11
15
|
});
|
|
12
16
|
return {
|
package/src/lib/policy.js
CHANGED
|
@@ -12,6 +12,7 @@ export const DEFAULT_POLICY = {
|
|
|
12
12
|
reviewers: { spec: null, design: null },
|
|
13
13
|
ai_review: { trigger: 'on-ready-and-push', debounce_seconds: 120 },
|
|
14
14
|
rollout_mode: {},
|
|
15
|
+
web_search: 'allow',
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
function deepMerge(base, over) {
|
|
@@ -52,3 +53,8 @@ export function matchesAny(p, globs = []) {
|
|
|
52
53
|
export function isAdvisory(policy, checkName) {
|
|
53
54
|
return policy?.rollout_mode?.[checkName] === 'advisory';
|
|
54
55
|
}
|
|
56
|
+
|
|
57
|
+
// Web-search policy egress guard: enabled by default ('allow'), blocked only when explicitly 'deny'.
|
|
58
|
+
export function canWebSearch(policy) {
|
|
59
|
+
return policy?.web_search !== 'deny';
|
|
60
|
+
}
|
package/src/lib/speclint.js
CHANGED
|
@@ -103,6 +103,7 @@ const DEFAULT_SEVERITY = {
|
|
|
103
103
|
'R4-then': 'blocker',
|
|
104
104
|
'R4-given': 'major',
|
|
105
105
|
'R5-ac': 'blocker',
|
|
106
|
+
'R5-scenario-coverage': 'blocker',
|
|
106
107
|
'R6-ac-test': 'blocker',
|
|
107
108
|
'R7-test-strategy': 'blocker',
|
|
108
109
|
'R8-removed-reason': 'major',
|
|
@@ -146,7 +147,11 @@ export function lintSpecText(text, { requireGiven = true, repoRoot = null, rules
|
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
const acs = acceptanceCriteria(r.body);
|
|
149
|
-
if (acs.length === 0)
|
|
150
|
+
if (acs.length === 0) {
|
|
151
|
+
add('R5-ac', 'blocker', `"${r.name}" has no Acceptance criteria (AC<n>)`, r.name);
|
|
152
|
+
} else if (scens.length > acs.length) {
|
|
153
|
+
add('R5-scenario-coverage', 'blocker', `"${r.name}" defines ${scens.length} scenario(s) but only ${acs.length} acceptance criteria (each scenario requires AC coverage)`, r.name);
|
|
154
|
+
}
|
|
150
155
|
for (const ac of acs) {
|
|
151
156
|
if (!ac.test) {
|
|
152
157
|
add('R6-ac-test', 'blocker', `"${ac.id}" has no (test: <path>) mapping`, `${r.name} / ${ac.id}`);
|
package/assets/ci/Jenkinsfile
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// Jenkinsfile — BU Agentic SDLC gate (OpenSpec engine + asdlc governance).
|
|
2
|
-
//
|
|
3
|
-
// IMPORTANT: this job does NOT (and must not need to) install asdlc globally on
|
|
4
|
-
// the Jenkins agent. There is no `npm i -g` here. asdlc is obtained one of two
|
|
5
|
-
// permission-free ways:
|
|
6
|
-
//
|
|
7
|
-
// 1) project devDependency: declare "agentic-sdlc" in devDependencies, run
|
|
8
|
-
// `npm ci` in a stage, then this file uses node_modules/.bin/asdlc; OR
|
|
9
|
-
// 2) extra SCM checkout: add a checkout of the asdlc toolkit to this job
|
|
10
|
-
// and set ASDLC_TOOLKIT=<workspace>/asdlc-toolkit; then it runs
|
|
11
|
-
// `node $ASDLC_TOOLKIT/bin/asdlc.js`.
|
|
12
|
-
//
|
|
13
|
-
// spec PR (branch asdlc/<id>) -> asdlc lint (spec check)
|
|
14
|
-
// impl PR (branch asdlc/impl/<id>) -> asdlc verify (implementation check)
|
|
15
|
-
|
|
16
|
-
pipeline {
|
|
17
|
-
agent { docker { image 'node:20' label 'docker' } }
|
|
18
|
-
|
|
19
|
-
options {
|
|
20
|
-
buildDiscarder(logRotator(numToKeepStr: '30'))
|
|
21
|
-
disableConcurrentBuilds()
|
|
22
|
-
timestamps()
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
environment {
|
|
26
|
-
CHANGE_ID = "${env.CHANGE_BRANCH ?: env.BRANCH_NAME}".tokenize('/').last().toUpperCase()
|
|
27
|
-
REPO = "${env.JOB_BASE_NAME}"
|
|
28
|
-
IS_IMPL = "${(env.CHANGE_BRANCH ?: env.BRANCH_NAME).contains('impl')}"
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
stages {
|
|
32
|
-
// Optional: only if asdlc is a devDependency. Safe to keep; harmless if absent.
|
|
33
|
-
stage('Install project tooling') {
|
|
34
|
-
steps {
|
|
35
|
-
sh 'if [ -f package-lock.json ]; then npm ci --no-audit --no-fund; elif [ -f package.json ]; then npm install --no-audit --no-fund; else echo "no package.json; relying on ASDLC_TOOLKIT checkout"; fi'
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
stage('Resolve asdlc (NO global install)') {
|
|
40
|
-
steps {
|
|
41
|
-
script {
|
|
42
|
-
def asdlc = sh(returnStdout: true, script: '''
|
|
43
|
-
if [ -x node_modules/.bin/asdlc ]; then
|
|
44
|
-
echo node_modules/.bin/asdlc
|
|
45
|
-
elif [ -n "${ASDLC_TOOLKIT:-}" ] && [ -f "$ASDLC_TOOLKIT/bin/asdlc.js" ]; then
|
|
46
|
-
echo "node $ASDLC_TOOLKIT/bin/asdlc.js"
|
|
47
|
-
else
|
|
48
|
-
echo MISSING
|
|
49
|
-
fi
|
|
50
|
-
''').trim()
|
|
51
|
-
if (asdlc == 'MISSING') {
|
|
52
|
-
error('asdlc not found. Declare it in devDependencies (then npm ci) OR add an SCM checkout and set ASDLC_TOOLKIT.')
|
|
53
|
-
}
|
|
54
|
-
env.ASDLC = asdlc
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
stage('Spec lint & AI Review') {
|
|
60
|
-
when { expression { env.IS_IMPL != 'true' } }
|
|
61
|
-
steps { sh "${env.ASDLC} lint ${env.CHANGE_ID}" }
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
stage('Verify & AI Code Review (implementation PR)') {
|
|
65
|
-
when { expression { env.IS_IMPL == 'true' } }
|
|
66
|
-
steps {
|
|
67
|
-
// Player != referee: verify runs every deterministic check PLUS an
|
|
68
|
-
// independent agent/model (ASDLC_VERIFY_COMMAND from Jenkins credentials).
|
|
69
|
-
withCredentials([string(credentialsId: 'asdlc-verify-api-key', variable: 'VERIFY_API_KEY')]) {
|
|
70
|
-
sh "${env.ASDLC} verify ${env.CHANGE_ID} --repo ${env.REPO} --base origin/${env.CHANGE_TARGET} --required"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
post {
|
|
77
|
-
success { echo "asdlc PASSED for ${env.CHANGE_ID}" }
|
|
78
|
-
failure { echo "asdlc FAILED for ${env.CHANGE_ID}" }
|
|
79
|
-
}
|
|
80
|
-
}
|