@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
@@ -0,0 +1,219 @@
1
+ ---
2
+ name: asdlc-impl-review
3
+ description: "Independent AI Implementation Review (Stage 6.5): evaluate an Impl PR for spec conformance, code quality, test fidelity, and production readiness before human lead approval. Accepts a GitHub PR URL or local CHANGE_ID."
4
+ aliases:
5
+ - impl-review
6
+ - code-review-asdlc
7
+ ---
8
+
9
+ # /asdlc:impl-review — CI-Triggered Independent Implementation Reviewer
10
+
11
+ This skill executes **independent AI implementation review**, triggered by CI when a PR carries the `asdlc:impl-review` label.
12
+ It posts its findings as a **markdown PR comment** via the GitHub API so the human lead sees them inline on the PR.
13
+
14
+ It applies the **Player ≠ Referee** principle: the reviewing agent MUST NOT be the agent that authored the implementation.
15
+
16
+ > [!IMPORTANT]
17
+ > **Scope**: Reviews *implementation conformance and code quality* — spec adherence, test rigor, architecture, and production safety.
18
+ > Requires `asdlc verify <CHANGE_ID>` to have passed (12 gates) before this review is meaningful.
19
+ > Does NOT re-run `asdlc verify`. Does NOT review spec intent — that is `asdlc-spec-review`.
20
+ > Output is a **PR comment**, not a local file.
21
+
22
+ ---
23
+
24
+ ## Trigger
25
+
26
+ This skill is invoked by CI when a PR is labeled `asdlc:impl-review`. The typical invocation in a GitHub Actions workflow or Jenkinsfile:
27
+
28
+ ```yaml
29
+ # GitHub Actions example
30
+ - name: AI Implementation Review
31
+ if: contains(github.event.pull_request.labels.*.name, 'asdlc:impl-review')
32
+ env:
33
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34
+ PR_NUMBER: ${{ github.event.pull_request.number }}
35
+ REPO: ${{ github.repository }}
36
+ run: |
37
+ # Agent CLI / SDK invokes this skill with: /asdlc:impl-review $PR_NUMBER $REPO
38
+ ```
39
+
40
+ ```groovy
41
+ // Jenkinsfile example
42
+ stage('Implementation AI Review') {
43
+ when { expression { env.IS_IMPL == 'true' } }
44
+ steps {
45
+ withCredentials([string(credentialsId: 'github-token', variable: 'GH_TOKEN')]) {
46
+ sh "${env.ASDLC} impl-review --pr ${env.PR_NUMBER} --repo ${env.REPO}"
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Workflow Sequence
55
+
56
+ ### Step 1: Acquire PR Context
57
+
58
+ Run the following commands to collect everything needed for review:
59
+
60
+ ```bash
61
+ # List changed files and metadata
62
+ gh pr view $PR_NUMBER --repo $REPO --json title,body,baseRefName,headRefName,files
63
+
64
+ # Read the full implementation diff
65
+ gh pr diff $PR_NUMBER --repo $REPO
66
+ ```
67
+
68
+ Extract from the PR body or branch:
69
+ - `CHANGE_ID` from the `**Change ID**:` field or branch name
70
+ - `specSha` from `.openspec.yaml` (read from the base branch or PR file list)
71
+
72
+ Then read the approved spec to use as ground truth:
73
+
74
+ ```bash
75
+ # Read the approved spec from the base branch
76
+ git show origin/<baseRefName>:openspec/changes/<CHANGE_ID>/specs/<capability>/spec.md
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
81
+ ```
82
+
83
+ > [!NOTE]
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`.
86
+
87
+ ---
88
+
89
+ ### Step 2: Apply the Five Review Dimensions
90
+
91
+ Evaluate the full diff against all five dimensions. Mark each `PASS`, `CONCERN`, or `FAIL`.
92
+
93
+ #### D1 — Spec Conformance (AC-by-AC)
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)?
100
+
101
+ Flag scope creep as Major: it bypasses the governance gate and introduces untested surface area.
102
+
103
+ #### D2 — Code Quality & Architecture
104
+ - **Deep modules**: Does each new module expose a simple interface hiding a complex interior? Flag shallow wrappers that leak implementation detail.
105
+ - **Single Responsibility**: Does each function / class do one thing? Flag functions mixing IO and business logic in the same body.
106
+ - **Error propagation**: Are errors surfaced explicitly (typed error objects or Result types), not swallowed silently?
107
+ - **Dead code**: Flag any commented-out or unreachable production code.
108
+ - **Naming**: Are names precise and consistent with the spec's domain language (enum values, field names, error codes defined in the spec)?
109
+
110
+ #### D3 — Test Fidelity & TDD Evidence
111
+ - Are tests **behavior-driven**, not implementation-driven? (Assert observable outputs for given inputs, not call order or internal state)
112
+ - Are mocks **minimal and scoped**? A mock replacing an entire subsystem and always returning a happy-path fixture is a vacuous test.
113
+ - Does each test exercise the **failure path** as well as the happy path?
114
+ - Does `tasks.md` contain real test runner output for every `[x]` task (not just "✅ done")?
115
+ - Are edge cases from the spec (e.g. rainy-day ranking, high-temp advisory, upstream-API-unavailable fallback) each exercised by a distinct test case?
116
+
117
+ #### D4 — Production Readiness & Performance
118
+ - **NFRs met**: If the spec declares a latency SLA, is there a test or benchmark that fails when the SLA is violated?
119
+ - **Resource leaks**: Are HTTP connections, file handles, and streams properly closed?
120
+ - **Retry / timeout**: Are upstream HTTP calls wrapped with timeouts to prevent hanging?
121
+ - **Observability**: Are structured log statements present at entry and exit of key operations? Are PII fields excluded from logs?
122
+
123
+ #### D5 — Security & Secret Hygiene
124
+ - Are there any hard-coded credentials, API keys, or tokens in the diff?
125
+ - Is user-supplied input sanitized before being passed to external API query parameters or shell commands?
126
+ - Are error messages free of internal stack traces or system paths that would leak to end users?
127
+ - Is any new HTTP endpoint protected from excessively large or malformed payloads?
128
+
129
+ ---
130
+
131
+ ### Step 3: Build the AC Conformance Matrix
132
+
133
+ For each `ACn:` in the approved spec, produce one row:
134
+
135
+ | AC | Spec Assertion | Implemented In | Test File | Status |
136
+ | :--- | :--- | :--- | :--- | :--- |
137
+ | AC1 | <assertion text> | src/<module>.ts | test/<feature>.test.ts | ✅ PASS / ❌ MISSING |
138
+
139
+ Mark `❌ MISSING` for any AC whose implementation or test cannot be located in the diff.
140
+
141
+ ---
142
+
143
+ ### Step 4: Formulate Findings
144
+
145
+ Classify each finding:
146
+
147
+ - **🔴 Blocker** — AC not implemented, test always passes regardless of code, hard-coded secret, resource leak, spec-forbidden behavior present. Blocks merge.
148
+ - **🟡 Major** — Scope creep (code not covered by any AC), vacuous mock, missing timeout on upstream HTTP call, PII in logs.
149
+ - **🟢 Advisory** — Naming clarity, minor refactor opportunity, optional performance improvement.
150
+
151
+ ---
152
+
153
+ ### Step 5: Post PR Comment
154
+
155
+ Compose the review as markdown and post it as a PR comment using the GitHub API:
156
+
157
+ ```bash
158
+ gh pr comment $PR_NUMBER --repo $REPO --body "$(cat <<'EOF'
159
+ <review-markdown>
160
+ EOF
161
+ )"
162
+ ```
163
+
164
+ Format the comment body strictly as:
165
+
166
+ ~~~markdown
167
+ ## 🤖 AI Implementation Review — `<CHANGE_ID>`
168
+
169
+ > **Reviewer**: AI Independent Implementation Reviewer (`asdlc-impl-review`)
170
+ > **Base spec SHA**: `<specSha>`
171
+ > **Verdict**: ✅ APPROVE | 🔴 REQUEST_CHANGES
172
+
173
+ ### Dimension Scores
174
+
175
+ | Dimension | Rating | Key Finding |
176
+ | :--- | :---: | :--- |
177
+ | D1 Spec Conformance | ✅ PASS / ⚠️ CONCERN / ❌ FAIL | <one-line summary> |
178
+ | D2 Code Quality & Architecture | ✅ / ⚠️ / ❌ | <one-line summary> |
179
+ | D3 Test Fidelity & TDD Evidence | ✅ / ⚠️ / ❌ | <one-line summary> |
180
+ | D4 Production Readiness | ✅ / ⚠️ / ❌ | <one-line summary> |
181
+ | D5 Security & Secret Hygiene | ✅ / ⚠️ / ❌ | <one-line summary> |
182
+
183
+ ### AC Conformance Matrix
184
+
185
+ | AC | Spec Assertion | Implemented In | Test File | Status |
186
+ | :--- | :--- | :--- | :--- | :--- |
187
+ | AC1 | <assertion text> | src/<module>.ts | test/<feature>.test.ts | ✅ PASS |
188
+
189
+ ### 🔴 Blocking Findings
190
+ <!-- Omit section if none -->
191
+ 1. **[Blocker]** `<file>:<line-range>` — AC<n>: <description of gap or violation>
192
+
193
+ ### 🟡 Major Findings
194
+ <!-- Omit section if none -->
195
+ 1. **[Major]** <description>
196
+
197
+ ### 🟢 Advisory Notes
198
+ <!-- Omit section if none -->
199
+
200
+ ---
201
+ *Human lead: review the findings above, then merge when satisfied. After merge, run `asdlc archive <CHANGE_ID>`.*
202
+ ~~~
203
+
204
+ ---
205
+
206
+ ### Step 6: Set CI Status
207
+
208
+ After posting the comment:
209
+
210
+ - **If APPROVE**: set CI check status to `success` (green). The PR is unblocked for lead approval and merge.
211
+ - **If REQUEST_CHANGES**: set CI check status to `failure` (red). The PR is blocked until blockers are resolved.
212
+
213
+ ```bash
214
+ gh api repos/$REPO/statuses/$SHA \
215
+ -f state="success|failure" \
216
+ -f context="asdlc/impl-ai-review" \
217
+ -f description="AI Impl Review: APPROVE|REQUEST_CHANGES" \
218
+ -f target_url="$PR_URL"
219
+ ```
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: asdlc-init
3
+ description: "Initialize an enterprise repository for Agentic SDLC: setup OpenSpec, Graphify code AST graph, governance policies, CI pipelines, and bundled skills."
4
+ ---
5
+
6
+ # /asdlc:init - Repository Initialization & Tooling Setup
7
+
8
+ This skill executes **Stage 1 (Init)** of the Agentic SDLC. It transitions an unmanaged or standard codebase into an enterprise-governed agentic repository.
9
+
10
+ ---
11
+
12
+ ## What this skill does
13
+
14
+ 1. **Detects Environment**: Inspects the repository type (Node, Python, Go, Java) and active agent toolchains (`.agents`, `.claude`, `.opencode`, Cursor, etc.).
15
+ 2. **Confirms CI Strategy**: Prompts the developer whether to generate a CI gate pipeline (`--ci jenkins`).
16
+ 3. **Executes `asdlc init`**: Runs the CLI initialization command to install:
17
+ - The pinned OpenSpec engine (as devDependency)
18
+ - Graphify code knowledge graph engine
19
+ - Enterprise managed schema (`agentic-repo-change`)
20
+ - Platform governance policy (`.sdlc/policy.yaml`)
21
+ - Git hook guards (`.githooks/` for pre-push and post-merge)
22
+ - Bundled IDE skills (`grilling`, `asdlc-apply`, and `/asdlc:*` suite)
23
+ - Context routing layer (`AGENTS.md`)
24
+ 4. **Validates Health**: Automatically runs `asdlc doctor` to ensure zero configuration drifts.
25
+
26
+ ---
27
+
28
+ ## Workflow Sequence
29
+
30
+ ### Step 1: Inquire CI & Setup Preferences
31
+ Ask the user if they want automated Jenkins CI gate pipeline generation:
32
+ - Standard: `asdlc init`
33
+ - With Jenkins CI: `asdlc init --ci jenkins`
34
+
35
+ ### Step 2: Execute Initialization
36
+ Run in the repository root:
37
+
38
+ ```powershell
39
+ asdlc init --ci jenkins
40
+ ```
41
+
42
+ Parse output and verify:
43
+ - `installed openspec` (pinned engine)
44
+ - `installed managed schema v1`
45
+ - `wrote governance config (openspec/config.yaml)`
46
+ - `installed .githooks`
47
+ - `installed bundled skills -> .agents/skills/`
48
+ - `built graphify code graph -> graphify-out/`
49
+ - `refreshed AGENTS.md`
50
+
51
+ ### Step 3: Run Environment Health Check
52
+ Execute:
53
+
54
+ ```powershell
55
+ asdlc doctor
56
+ ```
57
+
58
+ Verify that all checks are `[PASS]`:
59
+ - Node version >= 20.19
60
+ - OpenSpec CLI present
61
+ - Managed schema installed centrally
62
+ - `.sdlc/policy.yaml` present
63
+ - `AGENTS.md` routing valid
64
+
65
+ ### Step 4: Next Steps Orientation
66
+ Inform the developer:
67
+ > "Repository successfully initialized with Agentic SDLC governance! To start your first feature, run:
68
+ > `/asdlc:new \"<your feature requirement>\"`"
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: asdlc-lint
3
+ description: "Verify spec quality against deterministic BDD, Acceptance Criteria, and review rules (R0-R8). Iteratively diagnose and fix blocking findings before opening the spec PR."
4
+ ---
5
+
6
+ # /asdlc:lint - Deterministic Spec Quality Gate
7
+
8
+ This skill executes **Stage 3 (Lint)** of the Agentic SDLC. It ensures that the change artifacts (`proposal.md`, `specs/**/*.md`, `review.md`) meet enterprise BDD, traceability, and review standards before creating a Pull Request.
9
+
10
+ ---
11
+
12
+ ## What this skill checks
13
+
14
+ The linter evaluates spec text with pure deterministic rules (no LLM jitter):
15
+ - **`R0-no-requirements`**: Must contain at least one `### Requirement:`.
16
+ - **`R1-purpose`**: Capability `## Purpose` must be at least 50 characters.
17
+ - **`R2-normative`**: Every requirement must contain a normative statement using `SHALL` or `MUST`.
18
+ - **`R3-scenario`**: Every requirement must have at least one `#### Scenario:`.
19
+ - **`R4-when / R4-then / R4-given`**: Every scenario must follow BDD structure with **WHEN**, **THEN**, and **GIVEN**.
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.
22
+ - **`R6-ac-test`**: Every acceptance criterion must map to an explicit test file path (`(test: <path>)`).
23
+ - **`R7-test-strategy`**: Must contain a non-empty `## Test Strategy` section.
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>)`).
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`).
28
+
29
+ ---
30
+
31
+ ## Workflow Sequence
32
+
33
+ ### Step 1: Execute `asdlc lint` with JSON Output
34
+ Run:
35
+
36
+ ```powershell
37
+ asdlc lint <CHANGE_ID> --json
38
+ ```
39
+
40
+ Parse the JSON output:
41
+ - `pass`: Boolean indicating overall pass or failure.
42
+ - `results`: Detailed breakdown per rule and artifact file.
43
+
44
+ ### Step 2: Handle Blocking Findings (If Failed)
45
+ If `pass` is false:
46
+ 1. Group findings by file (`specs/<capability>/spec.md` or `review.md`).
47
+ 2. For each blocking finding:
48
+ - Identify the exact section and requirement name.
49
+ - Explain the rule violation in plain language.
50
+ - Propose the exact markdown fix (e.g. adding `**WHEN** / **THEN**`, converting prose to normative `SHALL`, or adding `(test: path/to/test)`).
51
+ 3. Apply the edits directly to the spec files.
52
+ 4. Re-run `asdlc lint <CHANGE_ID> --json` to verify that blockers reach zero.
53
+
54
+ ### Step 3: Lint Complete (Self-Review Passed)
55
+ When `pass` is true (`0 blockers`):
56
+ Report to the author that the spec is structurally valid, fully traceable, and passes all BDD/acceptance criteria checks:
57
+
58
+ > "Spec lint passed with 0 blocking issues. The spec is ready for PR. When you are ready to submit it for review, use `asdlc pr <CHANGE_ID> <targetBranch>`."
59
+
@@ -0,0 +1,107 @@
1
+ ---
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, technical design (design.md), and spec deltas."
4
+ ---
5
+
6
+ # /asdlc:new - Start Feature & Batch-Grill Author
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/**`, and `design.md`).
9
+
10
+ ---
11
+
12
+ ## Workflow Sequence
13
+
14
+ ### Step 1: Scaffold Change & Refresh Graph
15
+ When the user invokes `/asdlc:new "<requirement>"`:
16
+
17
+ ```powershell
18
+ asdlc new "<requirement>"
19
+ ```
20
+
21
+ The CLI:
22
+ 1. Derives a clean canonical slug (e.g. `jwt-authentication-payment-api` or content-hashed `change-<id>`).
23
+ 2. Creates `openspec/changes/<SLUG>/`.
24
+ 3. Runs Graphify queries using the extracted requirement terms to discover real codebase AST nodes and call chains.
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.
27
+
28
+ > [!IMPORTANT]
29
+ > **NO PAUSE / CONTINUOUS EXECUTION**: Do NOT stop after `asdlc new` to ask the author "Should I start grilling?".
30
+ > You MUST proceed immediately to Step 2 and Step 3 (**batch-grill-me** interview) in the same turn!
31
+ > Only after `clarifications.md` has all questions settled may you draft `proposal.md`, `design.md`, and `specs/**`.
32
+
33
+ ### Step 2: Ground Yourself in Codebase & External Context (Strict Order)
34
+ Follow this strict discovery sequence:
35
+ 1. **Local Graph & Workspace First (Primary)**:
36
+ - Read `openspec/changes/<SLUG>/explore.md`.
37
+ - Note the **Architectural Hubs (god nodes)** that this change touches.
38
+ - Review existing functions, types, and exported symbols. Never guess: ground internal assumptions in real paths from `explore.md`.
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.
54
+
55
+ ### Step 3: Run the `batch-grill-me` Interview
56
+ Before authoring any spec markdown, run the **`batch-grill-me`** protocol:
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).
60
+ 2. Present all architectural forks and boundary questions in **one structured batch**:
61
+ - Number each question (`Q1`, `Q2`, `Q3`...).
62
+ - Provide concrete options (A / B / C).
63
+ - Supply a fact-backed **Recommended Default** grounded in codebase evidence.
64
+ 3. Invite the author to batch-approve (`"Approve all recommendations"`) or provide selective overrides.
65
+ 4. Record every agreed answer in `openspec/changes/<SLUG>/clarifications.md` under `## Settled decisions`.
66
+ 5. If overrides unblock child questions, run Batch Round 2; otherwise close the interview.
67
+
68
+ ### Step 4: Author Approved Intent Artifacts
69
+ Once `## Open questions` in `clarifications.md` is empty, author the change documents:
70
+
71
+ 1. **`proposal.md`**:
72
+ - Sections: `## Why`, `## What Changes`, `## Capabilities`, `## Impact`, `## Out of Scope`, `## Dependencies & Assumptions`.
73
+ - 1-2 pages maximum. Focus on **WHY**, not code implementation details.
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`**:
89
+ - `## Purpose`: Clear capability statement (50+ chars).
90
+ - `## ADDED Requirements`:
91
+ - Every requirement: `### Requirement: <name>` using **SHALL** or **MUST**.
92
+ - Every requirement has `#### Scenario: <name>` with **GIVEN / WHEN / THEN**.
93
+ - Every requirement has an `**Acceptance criteria**` block:
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).
96
+ - `## Constraints & NFRs`: Verifiable performance/security statements.
97
+ - `## Out of Scope` and `## Test Strategy`.
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>`.
104
+
105
+ ### Step 5: Transition to Lint
106
+ Once artifacts are written, guide the developer:
107
+ > "Artifacts drafted! Now run `/asdlc:lint <SLUG>` to verify BDD scenarios, technical design, and acceptance criteria before opening the spec PR."
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: asdlc-pr
3
+ description: "Open a Spec or Implementation PR: pre-flight checks (lint vs verify), git pushing, auto-extract title/body, and attach labels (asdlc:spec-review vs asdlc:impl-review) for CI AI review."
4
+ ---
5
+
6
+ # /asdlc:pr - Automated Pull Request Engine (Spec & Implementation)
7
+
8
+ This skill opens a **Spec PR** (Stage 3) or an **Implementation PR** (Stage 6.5) with deterministic pre-flight quality gates and distinct labels for CI AI review triggers.
9
+
10
+ ---
11
+
12
+ ## Command
13
+
14
+ ```powershell
15
+ asdlc pr <CHANGE_ID> <targetBranch>
16
+ ```
17
+
18
+ - `<targetBranch>`: Target branch to merge into (e.g. `main`, `develop`, `release/*`). Required.
19
+ - Zero manual flags: `asdlc pr` automatically detects whether to open a Spec PR or an Implementation PR.
20
+
21
+ ---
22
+
23
+ ## Dual-PR Lifecycle & Pre-flight Gates
24
+
25
+ | PR Type | Phase & Moment | Pre-Flight Guard | Auto Labels | CI Automation Trigger |
26
+ | :--- | :--- | :--- | :--- | :--- |
27
+ | **Spec PR** | Stage 3 (After drafting proposal & specs) | **`asdlc lint <ID>`**<br>(0 blocking BDD/AC issues) | `asdlc:spec-review`<br>`spec` | Runs `asdlc lint` + triggers **Spec AI Review** |
28
+ | **Impl PR** | Stage 6.5 (After TDD apply & tasks complete) | **`asdlc verify <ID>`**<br>(12 deterministic gates pass) | `asdlc:impl-review`<br>`impl` | Runs `asdlc verify` + triggers **Code AI Review** |
29
+
30
+ ---
31
+
32
+ ## Execution Pipeline
33
+
34
+ 1. **Auto-Detection (Spec PR vs Implementation PR)**:
35
+ `asdlc pr` inspects the state machine deterministically without requiring manual flags:
36
+ - **Detected as Implementation PR (`impl`) if ANY of these conditions match**:
37
+ - `.openspec.yaml` has `status: ready_for_impl` or a locked `specSha`.
38
+ - Spec intent commit is already merged on `<targetBranch>`.
39
+ - Branch name starts with `impl/`.
40
+ - Source code changes exist outside `openspec/changes/<slug>/` and tasks in `tasks.md` are marked complete.
41
+ - **Detected as Spec PR (`spec`) otherwise**:
42
+ - Spec artifacts (`proposal.md`, `specs/**`) are in drafting/review stage before approval.
43
+
44
+ 2. **Pre-flight Quality Gate**:
45
+ - **Spec PR**: runs `asdlc lint <ID>`. Fails fast if any blocking BDD or acceptance criteria findings exist.
46
+ - **Impl PR**: runs `asdlc verify <ID>`. Fails fast if any of the 12 verification checks fail.
47
+
48
+ 3. **Title & Body Extraction**:
49
+ - **Spec PR**: derives clean title (`spec(<slug>): <title>`) and embeds proposal intent.
50
+ - **Impl PR**: derives title (`impl(<slug>): <title>`) and embeds completed tasks, TDD evidence, and spec intent.
51
+
52
+ 4. **Commit & Push**: Stages changes, commits with standard prefix, and pushes branch to origin.
53
+
54
+ 5. **Creation Strategy & Self-Healing Label Guarantee**:
55
+ - **JIT Label Provisioning**: Before creating or editing the PR, `asdlc pr` provisions required governance labels on remote (`asdlc:spec-review` + `spec` or `asdlc:impl-review` + `impl`). This prevents GitHub from dropping labels or failing PR creation.
56
+ - **Tier 1 (CLI)**: Executes `gh pr create` with both labels (`--label asdlc:spec-review,spec`). If a PR for the branch already exists, detects it and runs `gh pr edit --add-label` to ensure labels are attached.
57
+ - **Tier 2 (Direct REST API)**: Pre-creates labels via GitHub API and attaches them to the PR issue.
58
+ - **Tier 3 (Browser Fallback)**: Generates a 1-click comparison URL pre-filled with branch and label query parameters.
59
+
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: asdlc-review
3
+ description: "[DORMANT / CI-MANAGED] Spec review is executed automatically by CI on PRs (leaving comments and summary directly on GitHub/GitLab). Local review.md generation is dormant."
4
+ ---
5
+
6
+ # /asdlc:review - Independent Spec Review (Dormant / CI-Managed)
7
+
8
+ > [!NOTE]
9
+ > **Workflow Update**: Local generation of `review.md` is **dormant**.
10
+ > Spec quality and 6-dimension reviews are executed automatically by the **CI AI Reviewer Action** on Spec PRs.
11
+ > Feedback and ratings are posted directly as PR comments/summaries to facilitate Human TL Review.
12
+
13
+ This skill is retained for reference or manual pre-PR dry runs if requested. When invoked, it switches into the **Independent Reviewer** role (Player ≠ Referee). The reviewer MUST NOT be the authoring agent.
14
+
15
+ ---
16
+
17
+ ## Review Dimensions
18
+
19
+ Every change is evaluated along six dimensions:
20
+
21
+ 1. **Completeness**: Are all user journeys covered? Are edge cases, error conditions, and nil/empty inputs handled?
22
+ 2. **Ambiguity**: Are requirements clear and unambiguous? Does each use strict normative language (`SHALL` / `MUST`) rather than passive voice?
23
+ 3. **Cross-repo consistency**: Does this change break or impact cross-repo API/event contracts? If so, is a System Design Amendment required?
24
+ 4. **Contract impact**: Are breaking changes flagged with `**BREAKING**` in `proposal.md`? Are backwards compatibility guarantees documented?
25
+ 5. **Testability**: Does every requirement have verifiable Acceptance Criteria (`AC<n>`) with concrete test paths?
26
+ 6. **Security**: Are authentication, authorization, input validation, secret hygiene, and data privacy respected?
27
+
28
+ ---
29
+
30
+ ## Workflow Sequence
31
+
32
+ ### Step 1: Read Change Context (Read-Only)
33
+ Inspect all intent files under `openspec/changes/<CHANGE_ID>/`:
34
+ - `proposal.md`
35
+ - `specs/**/*.md`
36
+ - `explore.md`
37
+
38
+ ### Step 2: Formulate Findings
39
+ Categorize findings by severity:
40
+ - **Blocker**: Spec violation, missing acceptance criteria, untestable assertion, or security risk.
41
+ - **Major**: Ambiguous scenario, missing `**GIVEN**`, or unaddressed edge cases.
42
+ - **Minor / Advisory**: Documentation clarity, style suggestions.
43
+
44
+ ### Step 3: Author `review.md`
45
+ Write `openspec/changes/<CHANGE_ID>/review.md` with the following structure:
46
+
47
+ ```markdown
48
+ # Review: <CHANGE_ID>
49
+
50
+ ## Summary
51
+ <2-3 sentences summarizing the change and the evaluation outcome>
52
+
53
+ ## Dimensions Evaluation
54
+ - Completeness: PASS | CONCERN | FAIL
55
+ - Ambiguity: PASS | CONCERN | FAIL
56
+ - Cross-repo consistency: PASS | CONCERN | FAIL
57
+ - Contract impact: PASS | CONCERN | FAIL
58
+ - Testability: PASS | CONCERN | FAIL
59
+ - Security: PASS | CONCERN | FAIL
60
+
61
+ ## Requirement -> Implementation -> Test Traceability
62
+ | Requirement | Acceptance Criteria | Target Test | Status |
63
+ |---|---|---|---|
64
+ | Req 1 | AC1: ... | test/foo.test.js | VERIFIED |
65
+
66
+ ## Blocking Findings
67
+ (none)
68
+ <!-- Or list: 1. [Blocker] <description> -->
69
+
70
+ ## Advisory Notes
71
+ <Optional recommendations>
72
+
73
+ ## Verdict
74
+ APPROVE
75
+ <!-- Or: NEEDS_REVISION -->
76
+ ```
77
+
78
+ ### Step 4: Next Steps
79
+ - If verdict is `APPROVE`: Guide the author to run `/asdlc:lint <CHANGE_ID>` and submit the Spec PR.
80
+ - If verdict is `NEEDS_REVISION`: List blocking items that the spec author must address.