pi-aia-asf 0.1.0 → 0.2.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/CHANGELOG.md CHANGED
@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.0] - 2026-08-14
11
+
12
+ ### Added
13
+
14
+ - **Mandatory testing & QA standard** (`references/06b-testing-qa.md`) — 11 rules distilled from real shipped-broken failures: test the packaged artifact (not just source), assert the observable end state, probe for silent failures, read the actual error before editing, clean-room verification against stale caches, a regression test for every bug fixed, test triggers *and* non-triggers, state-machine deadlock tests, mandatory browser testing for web surfaces, a definition-of-done checklist, and honest reporting.
15
+ - **`/asf verify`** — an explicit definition-of-done gate that itemises the 9 required checks, points at the QA standard, and forbids self-certifying unverifiable specs.
16
+
17
+ ### Changed
18
+
19
+ - Phase 6 and Phase 7 of the skill now require the QA standard; Phase 7 additionally requires verifying the packaged artifact and the observable end state, plus honest reporting of skipped or inconclusive checks.
20
+ - Anti-patterns extended: shipping without inspecting the packaged file list, treating "no error" as success, verifying against a stale install, guessing before reading the error, fixing without a regression test, and claiming assumed verification.
21
+
22
+ ### Fixed
23
+
24
+ - **`/asf-approve` rubber-stamped Gate 5.** It marked the plan approved even when no `PLAN.md` existed — approving a plan the user had never seen. It now refuses unless `PLAN.md` is present, and advances the phase to implementation on success.
25
+
26
+
27
+ ## [0.1.1] - 2026-08-14
28
+
29
+ ### Fixed
30
+
31
+ - **The `aia-asf` skill was never loaded.** Its YAML frontmatter description contained an unquoted colon (`The flow is: classify the work...`); a colon followed by a space starts a mapping in YAML, so the frontmatter failed to parse and pi silently skipped the skill. The extension's `/asf` commands worked, but the workflow skill itself was unavailable. The description is now a YAML block scalar with no inline colon.
32
+
33
+
10
34
  ### Added
11
35
 
12
36
  - Initial release of the Ai Applied Agentic Software Factory.
package/index.ts CHANGED
@@ -38,6 +38,19 @@ interface AsfState {
38
38
  updatedAt: string;
39
39
  }
40
40
 
41
+ /** Definition-of-done checks (references/06b-testing-qa.md, Rule 10). */
42
+ const QA_CHECKLIST: Array<{ key: string; label: string }> = [
43
+ { key: "build", label: "Typecheck/build passes" },
44
+ { key: "tests", label: "Full test suite green (not a subset)" },
45
+ { key: "regression", label: "Regression test added for every bug fixed this cycle" },
46
+ { key: "triggers", label: "Triggers AND non-triggers tested for conditional behavior" },
47
+ { key: "artifact", label: "Shipped artifact inspected (npm pack file list) + clean-room install" },
48
+ { key: "observable", label: "Observable end state verified as a user would experience it" },
49
+ { key: "browser", label: "Web surfaces exercised through a real browser (n/a if none)" },
50
+ { key: "specs", label: "Every MUST spec 'met' with concrete evidence" },
51
+ { key: "honest", label: "Skipped/inconclusive checks reported explicitly" },
52
+ ];
53
+
41
54
  interface ProjectStateFile {
42
55
  current: AsfState | null;
43
56
  history: Array<{ workType: string; phase: AsfPhase; startedAt: string; endedAt: string }>;
@@ -203,6 +216,21 @@ export default function register(pi: ExtensionAPI): void {
203
216
  ` history: ${state.history.length} completed session(s)`
204
217
  );
205
218
  }
219
+ case "verify": {
220
+ // Gate 7: force an explicit, itemised QA pass before delivery.
221
+ const project = projectName();
222
+ const state = await loadState(project);
223
+ if (!state.current) return "No active ASF session — nothing to verify.";
224
+ await setPhase(ctx, "verification");
225
+ return (
226
+ `ASF verification gate (${project}) — Definition of Done.\n` +
227
+ `Read references/06b-testing-qa.md. Confirm EACH item with concrete evidence\n` +
228
+ `(command output, file list, screenshot). Do not tick anything you did not run.\n\n` +
229
+ QA_CHECKLIST.map((c, i) => ` ${i + 1}. [ ] ${c.label}`).join("\n") +
230
+ `\n\nThen run get_task_specs and close every spec with update_spec_status.\n` +
231
+ `Unverifiable → 'partial' + ask the user. Never self-certify.`
232
+ );
233
+ }
206
234
  case "abort":
207
235
  return await setPhase(ctx, "none");
208
236
  default:
@@ -213,6 +241,7 @@ export default function register(pi: ExtensionAPI): void {
213
241
  " /asf bugfix — major bugfix\n" +
214
242
  " /asf refactor — architectural refactor\n" +
215
243
  " /asf status — show current phase\n" +
244
+ " /asf verify — run the definition-of-done QA gate\n" +
216
245
  " /asf abort — end the current session\n\n" +
217
246
  dependencySummary()
218
247
  );
@@ -224,9 +253,25 @@ export default function register(pi: ExtensionAPI): void {
224
253
  const project = projectName();
225
254
  const state = await loadState(project);
226
255
  if (!state.current) return "No active ASF session — start one with /asf new|feature|bugfix|refactor.";
256
+
257
+ // Gate 5 must approve something that actually exists: refuse to rubber-stamp
258
+ // when no PLAN.md is present (a plan the user never saw cannot be approved).
259
+ const planPath = join(process.cwd(), "PLAN.md");
260
+ if (!existsSync(planPath)) {
261
+ return (
262
+ `No PLAN.md found in ${process.cwd()}.\n` +
263
+ "Gate 5 approves a written plan — write PLAN.md and present it to the user first."
264
+ );
265
+ }
266
+
227
267
  state.current.planApproved = true;
268
+ state.current.phase = "implementation";
228
269
  state.current.updatedAt = new Date().toISOString();
229
270
  await saveState(project, state);
230
- return "Plan approved ✓ — Gate 5 passed, implementation may begin.";
271
+ return (
272
+ "Plan approved ✓ — Gate 5 passed, implementation may begin.\n" +
273
+ "Test-first, strict codebase isolation, regression test per bug fixed.\n" +
274
+ "Run /asf verify before delivery."
275
+ );
231
276
  });
232
277
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-aia-asf",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Ai Applied Agentic Software Factory — codifies the full software development flow: intake, research, spec capture, adversarial analysis, planning with approval gates, test-first implementation, and release. Requires pi-vigilant, pi-smart-web-search, pi-smart-fetch, and pi-aia-browser.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1,6 +1,18 @@
1
1
  ---
2
2
  name: aia-asf
3
- description: Agentic Software Factory — run a complete, disciplined software development cycle. Use when the user wants to start a NEW software project, add a SIGNIFICANT FEATURE to an existing project, perform a MAJOR BUGFIX, or do an ARCHITECTURAL REFACTOR. The flow is: classify the work, ask questions until the intent is clear, research SOTA and existing packages, capture hard specifications (via capture_spec, shared with pi-vigilant), run adversarial analysis, produce a PLAN.md and get explicit user approval, then implement test-first with strict codebase isolation and mandatory browser testing of any web interfaces (pi-aia-browser). Do NOT activate for simple Q&A, one-line fixes, casual conversation, content writing, or non-software tasks. When in doubt about whether work qualifies as a project/feature/bugfix/refactor, ask the user.
3
+ description: >-
4
+ Agentic Software Factory — run a complete, disciplined software development
5
+ cycle. Use when the user wants to start a NEW software project, add a
6
+ SIGNIFICANT FEATURE to an existing project, perform a MAJOR BUGFIX, or do an
7
+ ARCHITECTURAL REFACTOR. The flow classifies the work, asks questions until the
8
+ intent is clear, researches SOTA and existing packages, captures hard
9
+ specifications (via capture_spec, shared with pi-vigilant), runs adversarial
10
+ analysis, produces a PLAN.md and gets explicit user approval, then implements
11
+ test-first with strict codebase isolation and mandatory browser testing of any
12
+ web interfaces (pi-aia-browser). Do NOT activate for simple Q&A, one-line
13
+ fixes, casual conversation, content writing, or non-software tasks. When in
14
+ doubt about whether work qualifies as a project/feature/bugfix/refactor, ask
15
+ the user.
4
16
  ---
5
17
 
6
18
  # AIA Agentic Software Factory (ASF)
@@ -133,9 +145,19 @@ Keep the plan **implementation-ready**: any competent engineer (or agent) can ex
133
145
 
134
146
  ## Phase 6 — Implementation (test-first, disciplined)
135
147
 
148
+ > **Read `references/06b-testing-qa.md` before writing tests.** It is the mandatory QA
149
+ > standard, distilled from real shipped-broken failures. Non-negotiable highlights:
150
+ > **test the shipped artifact, not just the source** (inspect `npm pack` output);
151
+ > **assert the observable end state**, not intermediate files; **probe for silent
152
+ > failures** (a malformed manifest/frontmatter is skipped without any error);
153
+ > **read the actual error before editing**; **verify clean-room** (caches serve stale
154
+ > builds); **add a regression test for every bug fixed**.
155
+
136
156
  Execute the task list milestone by milestone. Discipline rules:
137
157
 
138
158
  1. **Test-first**: write/update tests before or with implementation; run them; only commit green.
159
+ Every bug fixed gets a **regression test** that fails on the old code. For conditional
160
+ behavior (skills, gates, auto-activation) test **triggers AND non-triggers**.
139
161
  2. **Codebase isolation**: work strictly inside the project's own codebase. Do NOT edit files in other repos, global config, or unrelated directories — **unless the user explicitly instructs otherwise**. If a change would touch another codebase, stop and ask.
140
162
  3. **No scope creep**: if something new is discovered that changes specs, capture it, ask the user, and update the plan before implementing.
141
163
  4. **Descriptive commits**: `git commit -m "type: specific description of what and why"` (e.g. `fix: verify specs before rotation`). No vague messages, no placeholders.
@@ -147,8 +169,17 @@ Execute the task list milestone by milestone. Discipline rules:
147
169
 
148
170
  ## Phase 7 — Verification & delivery (gate)
149
171
 
150
- 1. Run the full test suite; fix failures; re-run until green.
151
- 2. Run `get_task_specs` and verify **every spec** with `update_spec_status` + concrete evidence (test output, build result, code inspection). Unverifiable → `partial` + ask the user. Never self-certify.
172
+ Run the **Definition of Done checklist** in `references/06b-testing-qa.md` (Rule 10). Every box must hold.
173
+
174
+ 1. Run the full test suite (all of it, not a subset); fix failures; re-run until green.
175
+ 2. **Verify the artifact a user would actually get**: inspect the packaged file list
176
+ (`npm pack` → `tar tzf`), install/load it clean-room in a fresh dir with caches
177
+ cleared, confirm the installed version is the one just built, and confirm the
178
+ **observable end state** (the tool/skill/page actually appears and works) — not just
179
+ that files are in place. Any web surface must be exercised through `pi-aia-browser`.
180
+ 3. Run `get_task_specs` and verify **every spec** with `update_spec_status` + concrete evidence (test output, build result, code inspection). Unverifiable → `partial` + ask the user. Never self-certify.
181
+ 4. **Report honestly**: never claim a check you didn't run; state explicitly anything
182
+ skipped or inconclusive, and distinguish "tests pass" from "works for the user".
152
183
  3. If the project is a library/package that the user publishes (npm, GitHub release): **offer** to run the release (see `references/07-release.md`): version bump, CHANGELOG, git tag, push. **Publishing is always the user's decision** — never publish without explicit approval. Optionally offer to set up a CI/CD pipeline for publishing.
153
184
  4. Present a completion summary: what was built, specs met, tests passing, how to use it.
154
185
 
@@ -164,6 +195,12 @@ Execute the task list milestone by milestone. Discipline rules:
164
195
  - ❌ Vague commits or CHANGELOG placeholders
165
196
  - ❌ Declaring done while specs are still `open`
166
197
  - ❌ Publishing anything without the user's explicit go-ahead
198
+ - ❌ Shipping a package without inspecting the packaged file list (`npm pack`)
199
+ - ❌ Treating "no error" as "it worked" — malformed config is skipped **silently**
200
+ - ❌ Verifying against a cached/stale install, or with an old duplicate still present
201
+ - ❌ Guessing at a fix before reading the actual error message
202
+ - ❌ Fixing a bug without adding a regression test
203
+ - ❌ Claiming something was verified when it was assumed
167
204
 
168
205
  ## References
169
206
 
@@ -172,4 +209,5 @@ Execute the task list milestone by milestone. Discipline rules:
172
209
  - `references/04-adversarial.md` — adversarial checklist per area
173
210
  - `references/05-plan.md` — PLAN.md template with examples
174
211
  - `references/06-implementation.md` — coding discipline details
212
+ - `references/06b-testing-qa.md` — **mandatory testing & QA standard** (11 rules + definition of done)
175
213
  - `references/07-release.md` — release workflow (versioning, CHANGELOG, tags, npm, CI/CD)
@@ -0,0 +1,146 @@
1
+ # Testing & QA Standard (MANDATORY)
2
+
3
+ These rules are distilled from real failures in production sessions (pi-vigilant,
4
+ pi-aia-asf, pi-aia-browser, conversense, betamaxx). Each rule exists because
5
+ skipping it **shipped a broken artifact**. They are not optional.
6
+
7
+ ---
8
+
9
+ ## Rule 1 — Test the ARTIFACT you ship, not the source you wrote
10
+
11
+ Source passing ≠ shipped thing working. The packaging layer is a real failure surface.
12
+
13
+ > **Real failure:** `pi-aia-browser` 0.1.0. All source tests passed. But `package.json`
14
+ > declared `"postinstall": "node scripts/install-browser.mjs"` while the `files`
15
+ > allowlist omitted `scripts/`. The published tarball had no such file → every
16
+ > `npm install` aborted with `MODULE_NOT_FOUND`. The package was **100% broken for
17
+ > every user** while every source test was green.
18
+
19
+ Required before declaring a package done:
20
+
21
+ ```bash
22
+ npm pack # or the equivalent build
23
+ tar tzf <pkg>-<ver>.tgz # inspect the ACTUAL file list
24
+ ```
25
+
26
+ - Verify every file the manifest/scripts reference is present in the list.
27
+ - Extract to a clean temp dir and load/run it from there.
28
+ - For anything installable: install it **from the registry/tarball**, not the repo.
29
+
30
+ ## Rule 2 — Assert the OBSERVABLE END STATE, not intermediate artifacts
31
+
32
+ "Files are in the right place" and "config is correct" do not prove the feature works.
33
+
34
+ > **Real failure:** the `aia-asf` skill. Files shipped correctly, `pi.skills` manifest
35
+ > correct, description under the length limit — all intermediate checks passed. But the
36
+ > YAML description contained an unquoted colon (`The flow is: classify...`), so the
37
+ > frontmatter failed to parse and pi **silently skipped the skill**. It was invisible to
38
+ > the agent even with an explicit `--skill` path.
39
+
40
+ Ask: *what would the user observe?* Then assert exactly that.
41
+
42
+ | Weak (intermediate) | Strong (observable) |
43
+ |---|---|
44
+ | SKILL.md exists, manifest lists it | Agent reports the skill as available |
45
+ | Extension file present | Tool appears in the tool list and executes |
46
+ | Server process running | Real request returns correct response |
47
+ | Config contains the key | Behavior driven by the key actually changes |
48
+
49
+ ## Rule 3 — Probe for SILENT failures
50
+
51
+ The worst bugs raise no error. Loaders skip malformed input; caches serve stale data.
52
+
53
+ - After any config/manifest/frontmatter change, **verify it parsed** (parse it yourself).
54
+ - Never treat "no error" as "it worked" — demand positive confirmation.
55
+ - Validate machine-read files with a real parser, not by eyeballing:
56
+
57
+ ```bash
58
+ python3 -c "import yaml,sys; yaml.safe_load(open(sys.argv[1]).read())" file.yaml
59
+ node -e "JSON.parse(require('fs').readFileSync('f.json','utf8'))"
60
+ ```
61
+
62
+ ## Rule 4 — Read the ACTUAL error before changing anything
63
+
64
+ > **Real failure:** on the `MODULE_NOT_FOUND` install error the first fix was a *guess*
65
+ > at the `files` array. It happened to be right, but the reinstall still failed and the
66
+ > real signal — `Cannot find module '.../scripts/install-browser.mjs'` plus a stale npm
67
+ > cache — was sitting in the log the whole time.
68
+
69
+ 1. Find and read the real error (log file, stderr, exit code).
70
+ 2. State the root cause in one sentence.
71
+ 3. Only then edit.
72
+
73
+ Never fix by pattern-matching on symptoms. Never retry unchanged and hope.
74
+
75
+ ## Rule 5 — Clean-room verification (defeat caches and local state)
76
+
77
+ Your machine lies: caches, stale installs, leftover globals, symlinks.
78
+
79
+ ```bash
80
+ npm cache clean --force
81
+ cd $(mktemp -d) && npm install <pkg>@<version> # fresh dir, explicit version
82
+ ```
83
+
84
+ - Verify the **installed version** is the one you just published.
85
+ - Remove/disable old copies first — a stale duplicate can serve your test and fake a pass.
86
+ - Confirm *which* copy answered (distinct log path, version string, marker).
87
+
88
+ > **Real failure:** a stale npm cache kept serving the broken 0.1.0 after 0.1.1 was
89
+ > published; the install kept failing with an error already fixed.
90
+
91
+ ## Rule 6 — Every fixed bug gets a REGRESSION test
92
+
93
+ A bug fixed without a test will return. For each fix, add an assertion that fails on
94
+ the old code and passes on the new one, and keep it in the permanent suite.
95
+
96
+ ## Rule 7 — Test triggers AND non-triggers
97
+
98
+ For anything conditional (skills, auto-activation, gates, hooks), correctness is
99
+ two-sided. Half a test suite hides half the bugs.
100
+
101
+ - **Triggers**: every case that must activate, activates.
102
+ - **Non-triggers**: every case that must NOT activate, stays silent (Q&A, one-liners,
103
+ casual talk, unrelated domains).
104
+ - **Boundaries**: the ambiguous cases — assert it asks rather than guesses.
105
+
106
+ ## Rule 8 — Test state machines for deadlock and bad transitions
107
+
108
+ > **Real failure:** pi-vigilant gated a write on "all specs resolved", but the cooldown
109
+ > suppressed that very write → permanent deadlock. Found only by simulating the full
110
+ > multi-turn sequence.
111
+
112
+ - Drive the real sequence of transitions, not one isolated call.
113
+ - Check terminal states are reachable, and no state can block its own exit.
114
+ - Test repeat/idempotent invocations and out-of-order calls.
115
+
116
+ ## Rule 9 — Browser testing is mandatory for any web surface
117
+
118
+ API/curl checks do not replicate what a human sees. Via `pi-aia-browser`:
119
+
120
+ 1. `browser_init`, `browser_navigate` to the running app
121
+ 2. Walk each key user journey with real clicks/typing
122
+ 3. Assert rendered DOM content (`browser_dom`), not just HTTP 200
123
+ 4. Check console errors via `browser_js`
124
+ 5. `browser_screenshot` for the record; check mobile + desktop viewports
125
+
126
+ A 200 response with a blank or broken page is a **failure**.
127
+
128
+ ## Rule 10 — Definition of done (all must hold)
129
+
130
+ - [ ] Typecheck/build passes
131
+ - [ ] Full test suite green (not a subset)
132
+ - [ ] Regression test added for every bug fixed this cycle
133
+ - [ ] Triggers **and** non-triggers tested for conditional behavior
134
+ - [ ] Shipped artifact inspected (`npm pack` file list) and installed clean-room
135
+ - [ ] Observable end state verified as a user would experience it
136
+ - [ ] Web surfaces exercised through a real browser
137
+ - [ ] Every MUST spec `met` with concrete evidence (`update_spec_status`)
138
+ - [ ] Unverifiable specs → `partial` + asked the user (never self-certified)
139
+
140
+ ## Rule 11 — Report honestly
141
+
142
+ - Never claim a test passed that you did not run.
143
+ - Never say "verified" for something inferred or assumed.
144
+ - If a check was skipped or inconclusive, **say so explicitly** and say why.
145
+ - Distinguish "tests pass" from "feature works for the user" — Rule 2.
146
+ - If you discover you shipped something broken, say it plainly and fix it first.