aw-spec-cli 0.1.1 → 0.1.2

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 (46) hide show
  1. package/assets/.agents/skills/aw-spec-addcomponent/SKILL.md +18 -5
  2. package/assets/.agents/skills/aw-spec-analyze/SKILL.md +4 -0
  3. package/assets/.agents/skills/aw-spec-clarify/SKILL.md +4 -0
  4. package/assets/.agents/skills/aw-spec-constitution/SKILL.md +4 -0
  5. package/assets/.agents/skills/aw-spec-fast-implement/SKILL.md +268 -0
  6. package/assets/.agents/skills/aw-spec-foundation/SKILL.md +219 -49
  7. package/assets/.agents/skills/aw-spec-implement/SKILL.md +11 -0
  8. package/assets/.agents/skills/aw-spec-minimal-implementation/SKILL.md +209 -0
  9. package/assets/.agents/skills/aw-spec-plan/SKILL.md +4 -0
  10. package/assets/.agents/skills/aw-spec-specify/SKILL.md +4 -0
  11. package/assets/.agents/skills/aw-spec-tasks/SKILL.md +4 -0
  12. package/assets/.claude/skills/aw-spec-addcomponent/SKILL.md +18 -5
  13. package/assets/.claude/skills/aw-spec-analyze/SKILL.md +4 -0
  14. package/assets/.claude/skills/aw-spec-clarify/SKILL.md +4 -0
  15. package/assets/.claude/skills/aw-spec-constitution/SKILL.md +4 -0
  16. package/assets/.claude/skills/aw-spec-fast-implement/SKILL.md +268 -0
  17. package/assets/.claude/skills/aw-spec-foundation/SKILL.md +219 -49
  18. package/assets/.claude/skills/aw-spec-implement/SKILL.md +11 -0
  19. package/assets/.claude/skills/aw-spec-minimal-implementation/SKILL.md +209 -0
  20. package/assets/.claude/skills/aw-spec-plan/SKILL.md +4 -0
  21. package/assets/.claude/skills/aw-spec-specify/SKILL.md +4 -0
  22. package/assets/.claude/skills/aw-spec-tasks/SKILL.md +4 -0
  23. package/assets/.kilocode/rules/specify-rules.md +4 -0
  24. package/assets/.kilocode/workflows/aw-spec-addcomponent.md +129 -0
  25. package/assets/.kilocode/workflows/aw-spec-agent-context.update.md +31 -0
  26. package/assets/.kilocode/workflows/aw-spec-analyze.md +296 -0
  27. package/assets/.kilocode/workflows/aw-spec-checklist.md +374 -0
  28. package/assets/.kilocode/workflows/aw-spec-clarify.md +320 -0
  29. package/assets/.kilocode/workflows/aw-spec-constitution.md +194 -0
  30. package/assets/.kilocode/workflows/aw-spec-fast-implement.md +263 -0
  31. package/assets/.kilocode/workflows/aw-spec-foundation.md +358 -0
  32. package/assets/.kilocode/workflows/aw-spec-implement.md +279 -0
  33. package/assets/.kilocode/workflows/aw-spec-minimal-implementation.md +204 -0
  34. package/assets/.kilocode/workflows/aw-spec-plan.md +221 -0
  35. package/assets/.kilocode/workflows/aw-spec-select-domain.md +73 -0
  36. package/assets/.kilocode/workflows/aw-spec-specify.md +382 -0
  37. package/assets/.kilocode/workflows/aw-spec-tasks.md +259 -0
  38. package/assets/.kilocode/workflows/aw-spec-taskstoissues.md +107 -0
  39. package/dist/commands/init.d.ts.map +1 -1
  40. package/dist/commands/init.js +3 -2
  41. package/dist/commands/init.js.map +1 -1
  42. package/dist/utils/copy-assets.d.ts +8 -1
  43. package/dist/utils/copy-assets.d.ts.map +1 -1
  44. package/dist/utils/copy-assets.js +1 -0
  45. package/dist/utils/copy-assets.js.map +1 -1
  46. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
  name: "aw-spec-foundation"
3
3
  description: "Scaffold a complete, compiling project by unpacking a verified foundation bundle (docs/<FoundationName>/<FoundationName>.pack.txt) and renaming its sentinel app name to your app name."
4
4
  argument-hint: "FoundationName AppName [OutputDirectory] — e.g. VerticalSlice AppWeaver.Health"
5
- compatibility: "Requires docs/<FoundationName>/<FoundationName>.pack.txt and unpack-foundation.ps1 to exist"
5
+ compatibility: "Requires docs/<FoundationName>/<FoundationName>.pack.txt and an unpacker (unpack-foundation.ps1 preferred via pwsh; unpack-foundation.sh fallback when pwsh is absent)"
6
6
  metadata:
7
7
  author: "github-aw-spec"
8
8
  user-invocable: true
@@ -30,20 +30,17 @@ Example: /aw-spec-foundation VerticalSlice AppWeaver.Health
30
30
 
31
31
  ---
32
32
 
33
- ## How this works (read before acting)
33
+ ## How this works
34
34
 
35
- This skill does **not** reconstruct files from prose rule docs anymore — that
36
- caused broken skeletons. Instead it unpacks a **byte-for-byte bundle of a real,
37
- verified solution** and renames the sentinel app name to `APP_NAME`.
35
+ Unpack a **byte-for-byte bundle of a verified solution**
36
+ (`docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.pack.txt`) via its unpack script, which rewrites the
37
+ pack's **sentinel** app name to `APP_NAME` (in dotted / underscored / lower-hyphen / lower-dot
38
+ forms) across file contents and names. The sample domain folder `Projects` and `AppWeaver.*`
39
+ framework packages are **left unchanged**.
38
40
 
39
- - The bundle: `docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.pack.txt`
40
- - The renamer: `docs/<FOUNDATION_NAME>/unpack-foundation.ps1`
41
- - The rules for building/refreshing the bundle: `docs/<FOUNDATION_NAME>/PACKAGING.md`
42
-
43
- The unpack script reads the **sentinel** from the pack header and rewrites it (in
44
- dotted / underscored / lower-hyphen / lower-dot forms) across file contents and
45
- file/folder names. The sample domain folder `Projects` and the `AppWeaver.*`
46
- framework package references are intentionally **left unchanged**.
41
+ > ⚠️ **Never open a `.pack.txt` with Read/`cat`/`head`/`tail`** — it is ~700 KB (≈180K tokens).
42
+ > The script parses and writes everything to disk; the only thing you read from the pack is its
43
+ > `#` header, via a bounded `grep` (Step 1).
47
44
 
48
45
  ---
49
46
 
@@ -72,9 +69,15 @@ Check both exist.
72
69
  ```
73
70
  Then stop.
74
71
 
75
- Read the **header lines** (those starting with `#`) at the top of `PACK_FILE` to obtain
76
- `SENTINEL` and the declared file count. Do not parse the whole bundle yourself — the
77
- script does the unpacking.
72
+ Read **only** the `#` header lines of `PACK_FILE` to obtain `SENTINEL` and the declared
73
+ file count. Use a bounded command — **do not** open the pack with the Read tool, `cat`,
74
+ `head`, or `tail` (it would load ~20K tokens of pack body into context):
75
+
76
+ ```bash
77
+ grep -m 30 '^#' "docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.pack.txt"
78
+ ```
79
+
80
+ This returns just the sentinel, file count, and replacement contract.
78
81
 
79
82
  ---
80
83
 
@@ -103,44 +106,215 @@ Proceed? (yes/no)
103
106
 
104
107
  ## Step 3 — Dry run, then unpack
105
108
 
106
- First do a **dry run** to surface any path collisions without writing anything, using
107
- the PowerShell tool:
109
+ ### Choosing the runner (do this first)
108
110
 
109
- ```powershell
110
- & "docs/<FOUNDATION_NAME>/unpack-foundation.ps1" `
111
- -PackFile "docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.pack.txt" `
112
- -TargetAppName "<APP_NAME>" `
113
- -OutDir "<OUTPUT_DIR>" `
111
+ Each foundation ships two equivalent unpackers. **Prefer PowerShell** (`unpack-foundation.ps1`,
112
+ ~50× faster); fall back to bash (`unpack-foundation.sh`) only when `pwsh` is absent. Detect once
113
+ and reuse the choice for every unpack call (Steps 3 and 4c):
114
+
115
+ ```bash
116
+ command -v pwsh >/dev/null 2>&1 && echo "pwsh" || echo "sh"
117
+ ```
118
+
119
+ The bash port takes the same flags in kebab-case (`--pack-file`, `--target-app-name`,
120
+ `--out-dir`, `--dry-run`, `--force`); positional args also work.
121
+
122
+ ### Dry run
123
+
124
+ First do a **dry run** to surface any path collisions without writing anything.
125
+
126
+ PowerShell (preferred):
127
+ ```bash
128
+ pwsh -NoProfile -File "docs/<FOUNDATION_NAME>/unpack-foundation.ps1" \
129
+ -PackFile "docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.pack.txt" \
130
+ -TargetAppName "<APP_NAME>" \
131
+ -OutDir "<OUTPUT_DIR>" \
114
132
  -DryRun
115
133
  ```
116
134
 
117
- - If it reports files that **already exist** (the script throws on conflict unless `-Force`),
118
- show the conflict list and ask whether to overwrite. Only add `-Force` if the user agrees.
119
- - Otherwise run it for real (drop `-DryRun`; add `-Force` only if the user approved overwrite):
135
+ bash fallback (only if `pwsh` is missing):
136
+ ```bash
137
+ bash "docs/<FOUNDATION_NAME>/unpack-foundation.sh" \
138
+ --pack-file "docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.pack.txt" \
139
+ --target-app-name "<APP_NAME>" \
140
+ --out-dir "<OUTPUT_DIR>" \
141
+ --dry-run
142
+ ```
143
+
144
+ - If it reports files that **already exist** (the script throws on conflict unless `-Force`
145
+ / `--force`), show the conflict list and ask whether to overwrite. Only add the force flag
146
+ if the user agrees.
147
+ - Otherwise run it for real (drop `-DryRun`/`--dry-run`; add the force flag only if the user
148
+ approved overwrite). PowerShell (preferred):
120
149
 
121
- ```powershell
122
- & "docs/<FOUNDATION_NAME>/unpack-foundation.ps1" `
123
- -PackFile "docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.pack.txt" `
124
- -TargetAppName "<APP_NAME>" `
150
+ ```bash
151
+ pwsh -NoProfile -File "docs/<FOUNDATION_NAME>/unpack-foundation.ps1" \
152
+ -PackFile "docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.pack.txt" \
153
+ -TargetAppName "<APP_NAME>" \
125
154
  -OutDir "<OUTPUT_DIR>"
126
155
  ```
127
156
 
157
+ bash fallback:
158
+ ```bash
159
+ bash "docs/<FOUNDATION_NAME>/unpack-foundation.sh" \
160
+ --pack-file "docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.pack.txt" \
161
+ --target-app-name "<APP_NAME>" \
162
+ --out-dir "<OUTPUT_DIR>"
163
+ ```
164
+
128
165
  Capture the script's stdout (it reports the number of files written). Do **not**
129
166
  hand-edit or regenerate any unpacked file.
130
167
 
131
168
  ---
132
169
 
133
- ## Step 4 — Verify
170
+ ## Step 4 — Offer reference project
171
+
172
+ After the foundation unpack succeeds, ask the user whether to also unpack the bundled
173
+ reference sample:
174
+
175
+ ```
176
+ AskUserQuestion — single-select:
177
+ "Would you like to include the reference sample project?"
178
+ • "Yes — include reference sample" (description: "Unpacks sample domain slices — Projects, Users, Reports — and merges them into the scaffolded project")
179
+ • "No — skip reference sample" (description: "Leave the project as a clean, empty foundation")
180
+ ```
181
+
182
+ - If the user chooses **No**, proceed directly to Step 5 (Verify).
183
+ - If the user chooses **Yes**, continue with the steps below **before** verifying.
134
184
 
135
- After unpacking:
185
+ ### Step 4a — Locate the reference pack
136
186
 
137
- 1. **File count** — confirm the written count matches the bundle's declared file count.
187
+ `REFERENCE_PACK_FILE` = `docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.Reference.pack.txt`
188
+ `UNPACK_REF` = `docs/<FOUNDATION_NAME>/unpack-reference-foundation.ps1` (preferred)
189
+ or `…/unpack-reference-foundation.sh` (fallback when `pwsh` is absent)
190
+
191
+ If the pack or the matching unpacker for your chosen runner is missing:
192
+ ```
193
+ Reference pack not found: <REFERENCE_PACK_FILE>
194
+ Run pack-reference-foundation.ps1 first (see docs/<FOUNDATION_NAME>/).
195
+ Skipping reference sample.
196
+ ```
197
+ Then proceed to Step 5 without unpacking reference files.
198
+
199
+ Read the header of `REFERENCE_PACK_FILE` to obtain `REF_SENTINEL` and `REF_FILE_COUNT` —
200
+ again with a bounded `grep -m 30 '^#' "<REFERENCE_PACK_FILE>"`, **never** a full Read/`cat`
201
+ of the reference pack (it is just as large as the foundation pack).
202
+
203
+ ### Step 4b — Save the foundation DbContext before overwrite
204
+
205
+ The reference unpack will conflict with (and overwrite) `ApplicationDbContext.cs` because
206
+ both packs rename their sentinel's project structure to the same output path. Before running
207
+ the reference unpack, **read and save** the full content of the existing foundation DbContext:
208
+
209
+ ```powershell
210
+ # Locate it — do NOT assume a fixed path; search the output tree:
211
+ $dbCtxPath = Get-ChildItem -Path "<OUTPUT_DIR>/src" -Recurse -Filter "ApplicationDbContext.cs" |
212
+ Select-Object -First 1 -ExpandProperty FullName
213
+ $foundationDbCtx = [System.IO.File]::ReadAllText($dbCtxPath)
214
+ ```
215
+
216
+ Store `$foundationDbCtx` in memory; you will need it in Step 4d.
217
+
218
+ ### Step 4c — Unpack the reference pack
219
+
220
+ Run with `-Force` / `--force` (the DbContext and any other overlapping files will be
221
+ overwritten — the DbContext will be restored via merge in Step 4d). Use the **same runner**
222
+ you selected in Step 3 (`pwsh` preferred, `.sh` only if `pwsh` is missing).
223
+
224
+ PowerShell (preferred):
225
+ ```bash
226
+ pwsh -NoProfile -File "docs/<FOUNDATION_NAME>/unpack-reference-foundation.ps1" \
227
+ -PackFile "docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.Reference.pack.txt" \
228
+ -TargetAppName "<APP_NAME>" \
229
+ -OutDir "<OUTPUT_DIR>" \
230
+ -Force
231
+ ```
232
+
233
+ bash fallback:
234
+ ```bash
235
+ bash "docs/<FOUNDATION_NAME>/unpack-reference-foundation.sh" \
236
+ --pack-file "docs/<FOUNDATION_NAME>/<FOUNDATION_NAME>.Reference.pack.txt" \
237
+ --target-app-name "<APP_NAME>" \
238
+ --out-dir "<OUTPUT_DIR>" \
239
+ --force
240
+ ```
241
+
242
+ Capture the count of files written.
243
+
244
+ ### Step 4d — Merge ApplicationDbContext.cs
245
+
246
+ After the reference unpack the DbContext file now contains the **reference version**
247
+ (sample DbSet<> properties only, no `OnModelCreating`). Merge it with the saved
248
+ **foundation version** (full `OnModelCreating`, no DbSet<>) to produce a single
249
+ complete DbContext.
250
+
251
+ **Merge rules — apply in order:**
252
+
253
+ 1. **Base = foundation file.** Start with `$foundationDbCtx` as the text to edit.
254
+
255
+ 2. **Add missing `using` directives.** Read the reference DbContext's `using` lines.
256
+ For each one not already present in the foundation file, insert it at the top of the
257
+ using block (before the namespace declaration or the class declaration).
258
+
259
+ 3. **Add `DbSet<>` properties.** Extract every `public DbSet<…>` property line from the
260
+ reference DbContext. Insert them as a block inside the foundation class body, directly
261
+ after the opening brace `{` of the class and before `OnModelCreating` (or before the
262
+ closing `}` if there is no `OnModelCreating`). Preserve the comment above the DbSets
263
+ (e.g. `// TaskContext`) if present.
264
+
265
+ 4. **Preserve everything else in the foundation file unchanged.** Do not touch the class
266
+ header, constructor, interface list, `OnModelCreating`, or any existing using statements.
267
+
268
+ 5. **Write the merged result** back to `$dbCtxPath` (overwrite the reference version that
269
+ the unpack left there).
270
+
271
+ **Example — VerticalSlice result after merge:**
272
+ ```csharp
273
+ using Microsoft.EntityFrameworkCore;
274
+ using AppWeaver.Repository.EfCore;
275
+ using AppWeaver.Contexts;
276
+ using AppWeaver.DomainAbstraction.Entities;
277
+ // ← reference usings inserted here, e.g.:
278
+ using AppWeaver.Pharma.Service.Projects.Domain;
279
+ using AppWeaver.Pharma.Service.Users.Domain;
280
+ using AppWeaver.Pharma.Service.Reports.Domain;
281
+
282
+ namespace AppWeaver.Pharma.Service.Infrastructure;
283
+
284
+ public class ApplicationDbContext(
285
+ DbContextOptions<ApplicationDbContext> options,
286
+ ICurrentTenant? tenant = null
287
+ ) : ContextAwareDbContext<ApplicationDbContext>(options, tenant)
288
+ {
289
+ // TaskContext ← DbSet block from reference, inserted here
290
+ public DbSet<Project> Projects => Set<Project>();
291
+ public DbSet<ProjectTask> ProjectTasks => Set<ProjectTask>();
292
+ public DbSet<TaskUser> TaskUsers => Set<TaskUser>();
293
+ public DbSet<ReportRequest> ReportRequests => Set<ReportRequest>();
294
+
295
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
296
+ {
297
+ // ... full foundation OnModelCreating preserved unchanged ...
298
+ }
299
+ }
300
+ ```
301
+
302
+ ---
303
+
304
+ ## Step 5 — Verify
305
+
306
+ After unpacking (and merging, if reference was included):
307
+
308
+ 1. **File count** — confirm the written count(s) match the bundle's declared file count(s).
138
309
  2. **Sentinel residue** — search the output tree for any leftover sentinel token
139
310
  (dotted/underscored/lower forms). There should be **none**. If any remain, report the
140
311
  files (it indicates a case form the bundle used that the rename list missed).
141
312
  3. **Framework packages intact** — confirm `AppWeaver.*` package references in the
142
313
  generated `.csproj`/`Directory.Packages.props` are unchanged.
143
- 4. **Build (optional, recommended)** — if the .NET SDK is available, offer to build.
314
+ 4. **DbContext integrity (if reference included)** — confirm the merged `ApplicationDbContext.cs`
315
+ contains both `DbSet<>` properties (from reference) **and** `OnModelCreating` (from foundation).
316
+ If either section is missing, report it as a warning.
317
+ 5. **Build (optional, recommended)** — if the .NET SDK is available, offer to build.
144
318
  The solution file is whatever the bundle shipped (e.g. `api.sln`) and is **not**
145
319
  renamed unless its name contains the sentinel — so discover it rather than assuming
146
320
  `<APP_NAME>.sln`:
@@ -155,18 +329,19 @@ Report check failures as warnings; do not silently continue past a sentinel-resi
155
329
 
156
330
  ---
157
331
 
158
- ## Step 5 — Completion report
332
+ ## Step 6 — Completion report
159
333
 
160
334
  ```
161
335
  ✅ Foundation scaffold complete
162
336
 
163
- Foundation : <FOUNDATION_NAME>
164
- App Name : <APP_NAME>
165
- Output : <OUTPUT_DIR or repo root>
166
- Files : <N> written
337
+ Foundation : <FOUNDATION_NAME>
338
+ App Name : <APP_NAME>
339
+ Output : <OUTPUT_DIR or repo root>
340
+ Files : <N> written [+ <M> reference files] (omit reference line if skipped)
341
+ Reference : included / skipped
167
342
 
168
343
  Next steps:
169
- 1. Rename the sample 'Projects' domain to your bounded context.
344
+ 1. [If reference skipped] Rename the sample 'Projects' domain to your bounded context.
170
345
  2. Ensure your NuGet feed for AppWeaver.* packages is configured.
171
346
  3. Run the AppHost: dotnet run --project <OUTPUT_DIR>/src/<APP_NAME>.AppHost
172
347
  4. Use /aw-spec-specify to create your first feature spec.
@@ -176,13 +351,8 @@ Next steps:
176
351
 
177
352
  ## Notes
178
353
 
179
- - **The bundle is the source of truth.** If scaffolds come out wrong, fix the foundation
180
- solution and re-pack (`docs/<FOUNDATION_NAME>/PACKAGING.md`) — never patch generated
181
- output as a workaround.
182
- - The engineering **standards** the foundation must satisfy live in the project
183
- constitution and the domain-specs rule files (used by `/aw-spec-plan`, `/aw-spec-specify`,
184
- etc.) — not in this foundation folder.
185
- - To add a new foundation (e.g. `ModularMonolith`), create `docs/ModularMonolith/` with its
186
- own `pack-foundation.ps1`, `unpack-foundation.ps1`, `PACKAGING.md`, and built
187
- `ModularMonolith.pack.txt`, then call `/aw-spec-foundation ModularMonolith <AppName>`.
354
+ - **The bundle is the source of truth** — if a scaffold comes out wrong, fix the foundation
355
+ solution and re-pack (`PACKAGING.md`); never patch generated output as a workaround.
356
+ - To add a new foundation, create `docs/<Name>/` with its own `pack-foundation.ps1`,
357
+ `unpack-foundation.ps1`, `PACKAGING.md`, and built `<Name>.pack.txt`.
188
358
  ```
@@ -19,6 +19,17 @@ $ARGUMENTS
19
19
 
20
20
  You **MUST** consider the user input before proceeding (if not empty).
21
21
 
22
+ ## Context Reuse (cross-command dedup)
23
+
24
+ **Skip Read-ing any file already in this conversation.** Before loading a standards/domain/template/spec file this command names, check whether it is already in context (loaded earlier here or by a prior `/aw-spec-*` command). If present and unchanged, reuse it and **skip the Read** — only Read files not yet loaded. A file already in context still counts as loaded; this just avoids the redundant re-read.
25
+
26
+ ## Project Structure Gate (run before loading standards)
27
+
28
+ **Before loading standards or writing code, confirm a scaffolded app exists** — the output of `/aw-spec-foundation`, not just `.aw-spec/`/`docs/`/`specs/` framework files. Check the repo root (Glob/Bash) for a real build entrypoint, ignoring matches only inside `.aw-spec/`/`docs/`/`specs/`: `*.sln` or `*.csproj` under `src/` (.NET/AppWeaver), else `package.json`/`pom.xml`/`build.gradle`/`go.mod`/`Cargo.toml`/`pyproject.toml` etc.
29
+
30
+ - **None found → STOP, no side effects** (don't load standards, run hooks, or write anything): tell the developer *"No scaffolded project found — run `/aw-spec-foundation ModularMonolith <AppName>` (or `VerticalSlice <AppName>`) first, then re-run."*
31
+ - **Found →** use its solution/host-project path as the implementation target and continue.
32
+
22
33
  ## Auto-Loaded Engineering Standards (Required Context)
23
34
 
24
35
  **Before doing anything else in this command, load the project engineering-standards files listed below into context using the Read tool.** These were previously supplied manually as `@docs/...` mentions; they are now loaded automatically so the user does not need to pass them. Rules:
@@ -0,0 +1,209 @@
1
+ ---
2
+ name: "aw-spec-minimal-implementation"
3
+ description: "Single-step implementation tier: takes a requirement DIRECTLY as the argument (an `Aggregate/Feature` token + free-text requirement) and implements it in one load-and-execute pass — no /aw-spec-specify, no spec.md, no plan.md/tasks.md, no analysis report. Loads a curated technical + domain rule set once, builds a structurally complete vertical slice (implementing what the loaded rules support, stubbing only genuinely-external runtime services), emits a final execution note, then offers an opt-in breakdown of unclear areas. For audited/traceable work use /aw-spec-fast-implement or the full plan→tasks→analyze→implement flow instead."
4
+ argument-hint: "<Aggregate>/<Feature> then the requirement text — e.g. MedicinalProduct/RegisterMedicinalProduct Allow an authorized user to register a new medicinal product..."
5
+ compatibility: "Requires a scaffolded application project (output of /aw-spec-foundation) and the .aw-spec/ directory. Does NOT require a spec.md or /aw-spec-specify."
6
+ metadata:
7
+ author: "github-aw-spec"
8
+ source: "templates/commands/minimal-implementation.md"
9
+ user-invocable: true
10
+ disable-model-invocation: false
11
+ ---
12
+
13
+
14
+ ## User Input
15
+
16
+ ```text
17
+ $ARGUMENTS
18
+ ```
19
+
20
+ You **MUST** consider the user input before proceeding (if not empty).
21
+
22
+ **The argument IS the requirement — this is a single-step command.** `$ARGUMENTS` contains an `Aggregate/Feature` token (two PascalCase segments separated by `/`, e.g. `MedicinalProduct/RegisterMedicinalProduct`) followed by the free-text requirement (the feature description + acceptance criteria). There is **no** `/aw-spec-specify` step and **no** `spec.md`: parse the requirement straight from this argument and implement it in one pass. If `$ARGUMENTS` is empty, or carries an `Aggregate/Feature` token but no requirement text, STOP and show usage: `/aw-spec-minimal-implementation <Aggregate>/<Feature> <requirement text>`.
23
+
24
+ ## Context Reuse (cross-command dedup)
25
+
26
+ **Skip Read-ing any file already in this conversation.** Before loading a standards/domain/template/spec file this command names, check whether it is already in context (loaded earlier here or by a prior `/aw-spec-*` command). If present and unchanged, reuse it and **skip the Read** — only Read files not yet loaded. A file already in context still counts as loaded; this just avoids the redundant re-read.
27
+
28
+ ## When to use this command
29
+
30
+ **Single-step tier.** Takes the requirement directly from the argument and implements it in one pass — **no** `/aw-spec-specify`, **no** `spec.md`/`plan.md`/`tasks.md`/research/contracts/analysis — loading a curated rule set (technical standards + the domain's single-step set) once, ending with a final note + an opt-in unclear-areas breakdown. It implements what the loaded rules support; only a **genuinely-external runtime service** (live terminology server, external FHIR endpoint) is left as an injectable fixture port, recorded as a deferral.
31
+
32
+ **Non-negotiable:** scaffolded project present (gate below), requirement supplied, constitution MUST principles honored, architecture patterns (vertical slices, CQRS, folder structure) + the aggregate's in-aggregate invariants (NDC format, ≥1 ingredient, ≥1 packaging, Draft guard) implemented, and an in-memory coverage check before writing code. **Escalate to `/aw-spec-fast-implement`** (or the full flow) if you need the heavy integrations actually built, traceable artifacts, or the work is audited/complex.
33
+
34
+ ## Project Structure Gate (run before loading standards)
35
+
36
+ **Before loading standards or writing code, confirm a scaffolded app exists** — the output of `/aw-spec-foundation`, not just `.aw-spec/`/`docs/`/`specs/` framework files. Check the repo root (Glob/Bash) for a real build entrypoint, ignoring matches only inside `.aw-spec/`/`docs/`/`specs/`: `*.sln` or `*.csproj` under `src/` (.NET/AppWeaver), else `package.json`/`pom.xml`/`build.gradle`/`go.mod`/`Cargo.toml`/`pyproject.toml` etc.
37
+
38
+ - **None found → STOP, no side effects** (don't load standards, run hooks, or write anything): tell the developer *"No scaffolded project found — run `/aw-spec-foundation ModularMonolith <AppName>` (or `VerticalSlice <AppName>`) first, then re-run."*
39
+ - **Found →** use its solution/host-project path as the implementation target and continue.
40
+
41
+ ## Auto-Loaded Engineering Standards (Required Context)
42
+
43
+ **Load these files once with the Read tool, before the Pre-Execution Checks.** Treat them as authoritative (second only to `.aw-spec/memory/constitution.md`); skip any that don't exist. This list is the domain-agnostic **technical knob** (the domain knob is the `## /aw-spec-minimal-implementation` heading in `comandrulemap.md`); edit it to tune richness, or add a file with an `@` mention.
44
+
45
+ Technical standards for `/aw-spec-minimal-implementation`:
46
+ - docs/architecture/folder-structure.md
47
+ - docs/architecture/vertical-slices.md
48
+ - docs/architecture/cqrs.md
49
+ - docs/architecture/persistence.md
50
+ - docs/architecture/eventing.md
51
+ - docs/domain/domain-driven-design.md
52
+ - docs/security/authorization.md
53
+ - docs/security/auditing.md
54
+ - docs/security/data-classification.md
55
+ - docs/governance/coding-standards.md
56
+ - docs/governance/dependency-policy.md
57
+ - docs/glossary/ai-rules.md
58
+
59
+ ## Domain Rule-File Selection (once)
60
+
61
+ After the technical standards are loaded, resolve the active domain and load the domain's curated rule set — once.
62
+
63
+ 1. **Resolve the active domain.** Read `.aw-spec/domain.json`'s `domain`. Load **exactly the files listed** under the **`## /aw-spec-minimal-implementation`** heading in `docs/domainspecs/<domain>/comandrulemap.md` (the per-domain knob; the set varies by domain).
64
+ - **Fallback:** if that heading is absent, load `domain-driven-design.domain.md` + the domain's terms file (`pharma-terms.md`/`clinical-terms.md`) + lifecycle file (`product-lifecycle.domain.md`) if present. A missing heading is **not** an error.
65
+ 2. **Domain gate (missing domain or rules).** If `.aw-spec/domain.json` is absent or its `domain` is empty, **or** `docs/domainspecs/<domain>/comandrulemap.md` does not exist:
66
+ - If no domain is set, do **not** hard-block. Note "no domain set / domain rules unavailable — running technical-only" and continue with just the technical standards (plus any `@`-mentioned files).
67
+ - Exception: if the user explicitly asked to enforce a domain and none is set, tell them to run `/aw-spec-select-domain` and stop.
68
+ 3. **Load the minimal set.** Because the set is already small, default to loading **all** of it (no selection prompt needed). Read each file once; skip missing files silently. In an interactive session you MAY offer a one-line confirm, but the default is "load all of the minimal set".
69
+ 4. **Final context set** = technical standards + the domain's rule set + any `@`-mentioned files (always loaded in addition).
70
+ 5. Proceed to the Pre-Execution Checks only after these are loaded.
71
+
72
+ ## Pre-Execution Checks
73
+
74
+ **Check for collapsed pre-hooks**:
75
+ - Check if `.aw-spec/extensions.yml` exists. If not, skip silently.
76
+ - If it exists, read it and collect enabled hook entries under `hooks.before_implement` (the only pre-point relevant to an implementation-only tier). Treat hooks without `enabled` as enabled; skip `enabled: false`.
77
+ - Do **not** evaluate `condition` expressions: run a hook only if it has no non-empty `condition`; otherwise leave it to the HookExecutor.
78
+ - When building slash commands from hook command names, replace dots with hyphens (`aw-spec.git.commit` → `/aw-spec-git-commit`).
79
+ - For each executable hook, emit:
80
+ - **Optional** (`optional: true`):
81
+ ```
82
+ ## Extension Hooks
83
+
84
+ **Optional Pre-Hook**: {extension}
85
+ Command: `/{command}`
86
+ Description: {description}
87
+
88
+ Prompt: {prompt}
89
+ To execute: `/{command}`
90
+ ```
91
+ - **Mandatory** (`optional: false`):
92
+ ```
93
+ ## Extension Hooks
94
+
95
+ **Automatic Pre-Hook**: {extension}
96
+ Executing: `/{command}`
97
+ EXECUTE_COMMAND: {command}
98
+
99
+ Wait for the result of the hook command before proceeding to the Outline.
100
+ ```
101
+
102
+ ## Outline
103
+
104
+ This is a **single-step** flow: parse the requirement from the argument, derive the design in your
105
+ head, and implement — all in one pass. No scripts seed artifacts; nothing is read from or written to
106
+ `specs/`.
107
+
108
+ ### 1. Parse the requirement (from the argument — no spec.md)
109
+
110
+ - From `$ARGUMENTS`, take the leading **`Aggregate/Feature`** token (two PascalCase segments split by `/`, e.g. `MedicinalProduct/RegisterMedicinalProduct`) and treat the remaining text as the **requirement** (description + acceptance criteria). If no `Aggregate/Feature` token is given, derive `<Feature>` from the requirement and `<Aggregate>` from its primary domain entity.
111
+ - If the argument is empty, or carries an `Aggregate/Feature` token but no requirement text, **STOP** with usage (see the User Input section). Do **not** invent a requirement.
112
+ - The **implementation target** is the scaffolded application source tree located by the Project Structure Gate above (its solution/host project). You will place the slice under that app for `<Aggregate>/<Feature>`.
113
+
114
+ ### 2. Build the internal model (in your head — collapses specify+plan+tasks)
115
+
116
+ Derive, **without writing any files**:
117
+ - **User story + acceptance criteria** from the requirement (what success looks like).
118
+ - **Functional requirements** — give them working `FR-###` keys for the coverage check and the note.
119
+ - **Key entities / aggregate shape**: the aggregate root, its value objects and child entities, and the **in-aggregate invariants** the acceptance criteria imply (e.g. NDC format + uniqueness, ≥1 ingredient, ≥1 packaging, Draft on create).
120
+ - **Constitution**: IF `.aw-spec/memory/constitution.md` exists, load it; its MUST principles are authoritative even here.
121
+ - Track every **ambiguity / missing detail / assumption** as you go — these feed the opt-in part of the Final Execution Note.
122
+ - Do **not** create `spec.md`, `plan.md`, `tasks.md`, `research.md`, `data-model.md`, `contracts/`, or `quickstart.md`.
123
+
124
+ ### 3. Resolve unclear areas without blocking
125
+
126
+ For each ambiguity or missing detail in the requirement, choose a **documented reasonable assumption** and proceed — this is single-step, so do **not** stop to ask mid-way. Keep a running list of (a) assumptions made and (b) genuinely unclear/under-specified items; both surface in the opt-in section of the Final Execution Note.
127
+
128
+ ### 4. Implement directly from the requirement
129
+
130
+ Implement straight into the scaffolded app's source tree (no design files):
131
+ - **Structure**: follow `docs/architecture/folder-structure.md` and `vertical-slices.md` — place the feature as a vertical slice under `<Aggregate>/<Feature>` inside the app located by the Project Structure Gate.
132
+ - **Behavior**: apply CQRS command/query separation per `cqrs.md`; model the entities derived in step 2; implement each Functional Requirement and the primary user-story/acceptance flow.
133
+ - **Conventions**: follow `coding-standards.md` and `ai-rules.md` (loaded in the technical set), the loaded domain rules, and the domain's ubiquitous-language/terms glossary for correct vocabulary in names/labels.
134
+ - **Implement what the loaded rules support; stub only genuinely-external services**: implement the aggregate, value objects, entities, and **in-aggregate invariants** for real, and honor whatever domain rules are in this domain's set (e.g. NDC format/structure, ATC/identifier shape, FHIR mapping shape where those files are loaded). Stub **only** a genuinely-external runtime dependency that can't exist in a self-contained build — e.g. a live terminology server or external FHIR endpoint — behind an **injectable port** with a fixture implementation (e.g. an `INdcValidator` / `ITerminologyValidator`). Never invent real coded values; use a clearly-named sentinel. Record each stub/port as a deferral in the Final Execution Note.
135
+ - **Coverage (in-memory)**: before finishing, confirm every Functional Requirement and the acceptance flow is addressed, the aggregate's structural invariants hold, and nothing violates a constitution MUST. **STOP** and recommend `/aw-spec-fast-implement` only if the *structure itself* can't be expressed simply or a constitution MUST is at stake — not merely because an integration is stubbed.
136
+ - **Tests**: only if the requirement explicitly requests them (this tier defaults to no tests).
137
+ - **Ignore files**: ensure `.gitignore` covers the stack (this is a .NET/C# project by default: `bin/`, `obj/`, `*.user`); append only missing critical patterns.
138
+
139
+ ### 5. Build check
140
+
141
+ Build/compile the affected project. Report the result in the final note. If it fails, fix obvious issues; if the failure indicates the task is more complex than "minimal," say so and recommend escalating to `/aw-spec-fast-implement`.
142
+
143
+ ## Mandatory Post-Execution Hooks
144
+
145
+ **Complete this before the Final Execution Note.**
146
+
147
+ - Check if `.aw-spec/extensions.yml` exists; if not, skip to the Final Execution Note.
148
+ - Read enabled hook entries under `hooks.after_implement` (the only post-point relevant to an implementation-only tier — this tier produces no plan, so plan/agent-context hooks do not apply). Treat missing `enabled` as enabled; skip `enabled: false`; do not evaluate `condition` expressions.
149
+ - Convert command names dots→hyphens. For each executable hook, emit:
150
+ - **Mandatory** (`optional: false`) — **emit `EXECUTE_COMMAND:`**:
151
+ ```
152
+ ## Extension Hooks
153
+
154
+ **Automatic Hook**: {extension}
155
+ Executing: `/{command}`
156
+ EXECUTE_COMMAND: {command}
157
+ ```
158
+ - **Optional** (`optional: true`):
159
+ ```
160
+ ## Extension Hooks
161
+
162
+ **Optional Hook**: {extension}
163
+ Command: `/{command}`
164
+ Description: {description}
165
+
166
+ Prompt: {prompt}
167
+ To execute: `/{command}`
168
+ ```
169
+
170
+ ## Final Execution Note
171
+
172
+ This is the **only** output record for this tier — there are no spec.md/plan.md/tasks.md files. After the build check, emit a concise note in chat:
173
+
174
+ - **Feature**: `<Aggregate>/<Feature>` (parsed from the argument).
175
+ - **Files created/changed**: each path with a one-line purpose.
176
+ - **Requirement coverage**: a short `FR-### → file(s)` map and the user-story/acceptance flow implemented.
177
+ - **Stubbed / deferred integrations (option "B")**: each heavy integration stubbed behind a port (terminology/NDC/ATC validation, FHIR projection, audit/lifecycle depth, etc.) with its fixture/sentinel name — so the reader knows what is NOT production-grade and must be built (e.g. via `/aw-spec-fast-implement`) before release.
178
+ - **Standards applied**: "technical standards + <domain> single-step rule set" (or "technical-only").
179
+ - **Build status**: pass/fail (and what was fixed).
180
+
181
+ ### Then offer the unclear-areas breakdown (opt-in)
182
+
183
+ After the note above, **ask the developer one question** (single-select, e.g. via AskUserQuestion):
184
+
185
+ > *"Want a breakdown of the unclear/ambiguous areas and the assumptions I made, so you can refine them one by one?"* — options **"Yes — list them"** / **"No — leave it"**.
186
+
187
+ - **If the developer says yes** (and in a non-interactive run, default to yes): append an **"⚠️ Unclear Areas & Assumptions to Refine"** section — an **itemized, numbered** list where each entry states: *what was unclear or missing in the requirement*, *the assumption / default chosen*, *where it shows up in the code* (file/symbol), and *how to firm it up*. Order them so the developer can fix them one at a time, and include the stubbed integrations here too (each is a thing to finish).
188
+ - **If the developer says no**: end with just the concise note plus the reminder below.
189
+
190
+ End with: *no design artifacts were persisted — re-run with `/aw-spec-fast-implement` if you need a traceable `plan.md`/`tasks.md` or the heavy integrations fully built.*
191
+
192
+ ## Key rules
193
+
194
+ - **Single step**: the requirement comes from the argument — never call `/aw-spec-specify` and never read or create a `spec.md`.
195
+ - Load each rule file **once**; never re-read context you already hold.
196
+ - **Never** create `spec.md`, `plan.md`, `tasks.md`, or Phase-1 design files in this tier — the whole point is no persisted artifacts, just the final note.
197
+ - The constitution and the loaded standards are authoritative. **STOP** on an unjustified constitution MUST violation or a requirement that cannot be met simply — escalate to `/aw-spec-fast-implement` rather than shipping partial/incorrect code.
198
+ - Do **not** block mid-way to clarify: make documented assumptions, finish, then offer the unclear-areas breakdown at the end.
199
+ - This is the tier for **simple, non-domain-rich** tasks. If the work turns out domain-rich or complex, stop and recommend `/aw-spec-fast-implement`.
200
+
201
+ ## Done When
202
+
203
+ - [ ] Project Structure Gate passed (scaffolded app present); requirement parsed from the argument
204
+ - [ ] Technical standards and the domain rule set loaded **once** (or technical-only); constitution MUST principles honored
205
+ - [ ] Internal model derived in-head (no spec.md/plan.md/tasks.md/design files created)
206
+ - [ ] Feature implemented as a vertical slice (CQRS, correct folder structure, domain vocabulary) into the scaffolded app
207
+ - [ ] In-memory coverage check passed (every FR + the acceptance flow addressed)
208
+ - [ ] Build checked; extension hooks dispatched or skipped per the rules above
209
+ - [ ] **Final Execution Note** emitted, and the developer asked whether to include the itemized unclear-areas / assumptions breakdown
@@ -19,6 +19,10 @@ $ARGUMENTS
19
19
 
20
20
  You **MUST** consider the user input before proceeding (if not empty).
21
21
 
22
+ ## Context Reuse (cross-command dedup)
23
+
24
+ **Skip Read-ing any file already in this conversation.** Before loading a standards/domain/template/spec file this command names, check whether it is already in context (loaded earlier here or by a prior `/aw-spec-*` command). If present and unchanged, reuse it and **skip the Read** — only Read files not yet loaded. A file already in context still counts as loaded; this just avoids the redundant re-read.
25
+
22
26
  ## Auto-Loaded Engineering Standards (Required Context)
23
27
 
24
28
  **Before doing anything else in this command, load the project engineering-standards files listed below into context using the Read tool.** These were previously supplied manually as `@docs/...` mentions; they are now loaded automatically so the user does not need to pass them. Rules:
@@ -19,6 +19,10 @@ $ARGUMENTS
19
19
 
20
20
  You **MUST** consider the user input before proceeding (if not empty).
21
21
 
22
+ ## Context Reuse (cross-command dedup)
23
+
24
+ **Skip Read-ing any file already in this conversation.** Before loading a standards/domain/template/spec file this command names, check whether it is already in context (loaded earlier here or by a prior `/aw-spec-*` command). If present and unchanged, reuse it and **skip the Read** — only Read files not yet loaded. A file already in context still counts as loaded; this just avoids the redundant re-read.
25
+
22
26
  ## Auto-Loaded Engineering Standards (Required Context)
23
27
 
24
28
  **Before doing anything else in this command, load the project engineering-standards files listed below into context using the Read tool.** These were previously supplied manually as `@docs/...` mentions; they are now loaded automatically so the user does not need to pass them. Rules:
@@ -19,6 +19,10 @@ $ARGUMENTS
19
19
 
20
20
  You **MUST** consider the user input before proceeding (if not empty).
21
21
 
22
+ ## Context Reuse (cross-command dedup)
23
+
24
+ **Skip Read-ing any file already in this conversation.** Before loading a standards/domain/template/spec file this command names, check whether it is already in context (loaded earlier here or by a prior `/aw-spec-*` command). If present and unchanged, reuse it and **skip the Read** — only Read files not yet loaded. A file already in context still counts as loaded; this just avoids the redundant re-read.
25
+
22
26
  ## Auto-Loaded Engineering Standards (Required Context)
23
27
 
24
28
  **Before doing anything else in this command, load the project engineering-standards files listed below into context using the Read tool.** These were previously supplied manually as `@docs/...` mentions; they are now loaded automatically so the user does not need to pass them. Rules:
@@ -86,17 +86,30 @@ registration scaffold, and verification steps — do not invent integration step
86
86
 
87
87
  7. **Add the code (one or more selected).** Execute the chosen component's `integration.md` runbook
88
88
  **in order** for the selected implementation(s):
89
- - Locate the target projects the runbook names (typically `…Application`, `…Infrastructure`,
90
- `…Service`; map the roles if the layout differs).
89
+ - Resolve the **host/startup project** the runbook targets — the single project that owns
90
+ `Program.cs` + the ASP.NET Core web SDK (`<App>.Service` for the Vertical Slice foundation,
91
+ `<App>.API` for the Modular Monolith foundation, or another name in a future template). **Find it
92
+ by locating `Program.cs`, not by assuming a fixed name.** These foundations have **no** separate
93
+ `…Application` / `…Infrastructure` project — package references, registration, and
94
+ `appsettings.json` all target this one project.
91
95
  - Apply the runbook's **"Common steps"** once.
92
96
  - Apply each selected implementation's **block** (package version in
93
97
  `Directory.Packages.props`, `PackageReference` without `Version=`, registration line, config).
94
98
  - Set `options.Provider` per the runbook (when multiple implementations are selected, follow the
95
99
  runbook's rule for choosing the default/active provider — ask a single-select follow-up if it
96
100
  requires one).
97
- - Honor the cross-cutting rules in `docs/components/README.md` (R0.1–R0.5): versions only in
98
- `Directory.Packages.props`; register in Infrastructure; inject the abstraction; always set
99
- `options.Provider`; never commit secrets.
101
+ - Honor the cross-cutting rules in `docs/components/README.md` (R0.1–R0.5, incl. R0.2a): versions
102
+ only in `Directory.Packages.props`; register in the host/startup project resolved via `Program.cs`
103
+ (R0.2 — its `Extensions/InfrastructureServiceRegistration.cs`/`AddInfrastructure` if present,
104
+ else `Program.cs`); inject the abstraction; always set `options.Provider`; never commit secrets.
105
+ - **Register in both startup paths when they exist (R0.2a).** If the host project splits
106
+ registration into `AddInfrastructure` (`Extensions/InfrastructureServiceRegistration.cs`) **and**
107
+ `AddAspireInfrastructure` (`Extensions/AspireInfrastructureExtensions.cs`) — the
108
+ `if (isAspire) AddAspireInfrastructure(...) else AddInfrastructure(...)` switch in `Program.cs` —
109
+ add the component's registration to **both** methods, not just `AddInfrastructure`. The block is
110
+ the same in each, differing only in provider-specific calls (connection strings, `UseSqlite` vs
111
+ `UseNpgsql`) that must match that method's existing provider. Registering in only one leaves the
112
+ component missing whenever the app runs in the other mode.
100
113
  - Run any optional usage/feature-slice and schema steps only if the runbook calls for them or the
101
114
  user asks.
102
115