pi-aia-asf 0.9.0 → 0.9.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.
package/CHANGELOG.md CHANGED
@@ -7,13 +7,41 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ## [0.9.0] - 2026-09-27
10
+ ## [0.9.2] - 2026-10-04
11
11
 
12
12
  ### Added
13
13
 
14
- - (describe changes for 0.9.0)
14
+ - (describe changes for 0.9.2)
15
+
16
+
17
+ ## [0.9.1] - 2026-10-03
18
+
19
+ ### Fixed
20
+
21
+ - **Extension no longer loads on pi >= 1.0** — pi 1.0 changed the command
22
+ contract to `registerCommand(name, { description, handler })`, where
23
+ `handler(args: string, ctx)` returns void and user-visible output goes
24
+ through `ctx.ui.notify()`. `/asf` and `/asf-approve` were registered as bare
25
+ functions taking `(args: string[], ctx)` and returning their text, so pi
26
+ 1.0.1 refused to load the package at all:
27
+ `Command "/asf" registered by extension ".../index.ts" must define handler()`.
28
+ Both commands now use the options-object form; the argument string is split
29
+ into subcommand + flags and every gate report is notified. Subcommand
30
+ behaviour is unchanged.
31
+
32
+ ### Tests
33
+
34
+ - The test harness mock now enforces the real `RegisteredCommand` contract
35
+ (it accepted any shape before, which is how this shipped) and exposes
36
+ `invokeCommand()`, which calls a registered command exactly as pi does and
37
+ captures `ctx.ui.notify()` output.
38
+ - New `test/test-command-contract.mjs` (16 checks): contract enforcement with a
39
+ negative control, arg-as-string parsing, case-insensitive subcommands,
40
+ void return, notify-based output, no bare-function registration left.
15
41
 
16
42
 
43
+ ## [0.9.0] - 2026-09-27
44
+
17
45
  ### Added
18
46
 
19
47
  - **Indexed reference structure (P-index)** — SKILL.md now carries a reference
package/index.ts CHANGED
@@ -271,7 +271,14 @@ export default function register(pi: ExtensionAPI): void {
271
271
  return state.current ? `ASF phase → ${phase}${workType ? ` (${workType})` : ""}` : "ASF session ended.";
272
272
  };
273
273
 
274
- pi.registerCommand("asf", async (args: string[], ctx: ExtensionCommandContext) => {
274
+ // pi >= 1.0 contract: registerCommand(name, { description, handler }) where
275
+ // handler receives the raw argument STRING and returns void — output goes to
276
+ // ctx.ui.notify(). The command body stays a string-returning function so the
277
+ // gate text is testable without a UI.
278
+ const runAsf = async (
279
+ args: string[],
280
+ ctx: ExtensionCommandContext,
281
+ ): Promise<string> => {
275
282
  const sub = (args[0] || "").toLowerCase();
276
283
 
277
284
  switch (sub) {
@@ -420,10 +427,20 @@ export default function register(pi: ExtensionAPI): void {
420
427
  dependencySummary()
421
428
  );
422
429
  }
430
+ };
431
+
432
+ pi.registerCommand("asf", {
433
+ description:
434
+ "Agentic Software Factory — /asf new|feature|bugfix|refactor|small|status|verify|health|abort",
435
+ handler: async (args: string, ctx: ExtensionCommandContext) => {
436
+ const argv = args.trim() ? args.trim().split(/\s+/) : [];
437
+ const out = await runAsf(argv, ctx);
438
+ if (out) ctx.ui.notify(out, "info");
439
+ },
423
440
  });
424
441
 
425
- // Plan-approval helper: /asf approve marks the plan as approved (records Gate 5)
426
- pi.registerCommand("asf-approve", async (_args: string[], ctx: ExtensionCommandContext) => {
442
+ // Plan-approval helper: /asf-approve records Gate 5 approval (requires PLAN.md)
443
+ const runApprove = async (ctx: ExtensionCommandContext): Promise<string> => {
427
444
  const project = projectName();
428
445
  const state = await loadState(project);
429
446
  if (!state.current) return "No active ASF session — start one with /asf new|feature|bugfix|refactor.";
@@ -447,5 +464,12 @@ export default function register(pi: ExtensionAPI): void {
447
464
  "Test-first, strict codebase isolation, regression test per bug fixed.\n" +
448
465
  "Run /asf verify before delivery."
449
466
  );
467
+ };
468
+
469
+ pi.registerCommand("asf-approve", {
470
+ description: "Record Gate 5 plan approval (requires PLAN.md) and begin implementation",
471
+ handler: async (_args: string, ctx: ExtensionCommandContext) => {
472
+ ctx.ui.notify(await runApprove(ctx), "info");
473
+ },
450
474
  });
451
475
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-aia-asf",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
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",
@@ -199,6 +199,13 @@ Keep the plan **implementation-ready**: any competent engineer (or agent) can ex
199
199
  > bloat), split it by topic and keep the parent as an index — never let it grow until
200
200
  > editing breaks.**
201
201
 
202
+ > **Read `references/06i-completeness.md` before implementing, and again before claiming
203
+ > done.** Ship the real thing or say out loud what is not real: no `// TODO` /
204
+ > not-implemented paths on a user-reachable code path, no fake or seed data the user will
205
+ > read as their own, no invented facts presented as checked, no silently deferred scope,
206
+ > no built-but-never-wired module. A stub is legitimate only when the user asked for one
207
+ > — and then it is declared, never silent.
208
+
202
209
  > **Read `references/06d-delegation.md` before delegating.** Work may be delegated two ways:
203
210
  > **intercom** (message another live pi session that owns relevant context — always `list`
204
211
  > first, say what you want back, and treat their findings as evidence, not proof; **optional** —
@@ -228,6 +235,7 @@ Execute the task list milestone by milestone. Discipline rules:
228
235
  8. **CHANGELOG discipline**: every user-visible change gets a CHANGELOG entry describing exactly what changed (no placeholder text).
229
236
  9. **Challenge approved designs (M4)**: if a spec's literal reading creates product tension (e.g. feedback clusters under "Plan" when "Plan = plans"), stop and resolve it with the user before implementing — never implement blindly and call it delivered.
230
237
  10. **Trace before claiming delivered (M5)**: the delivery log is a claim; the code is the evidence. Before marking anything ✅, trace the actual code path, confirm the output is consumed by a surface, and confirm the operator-facing outcome test passes.
238
+ 11. **No stubs, no fake data, no invented facts (`references/06i-completeness.md`)**: the deliverable is the real implementation. Finish it, or state the discrepancy plainly to the user — what is missing, why, what remains. Never let the user discover the gap by using the product.
231
239
 
232
240
  ---
233
241
 
@@ -239,6 +247,8 @@ Also check the **modularity DoD** from `references/06c-code-quality.md` (Phase 7
239
247
 
240
248
  Also check the **stability DoD** (`references/06f-stability.md`): if the deliverable makes external calls, it has timeouts and bounded retries (idempotent only). And the **security DoD** (`references/06h-security.md`): no secrets in the repo, no untrusted input reaches a shell/query/path unvalidated, no unbounded resource use on user-controlled input; for agent-like tool surfaces, every tool is least-privilege with an abuse-case test.
241
249
 
250
+ Also check the **completeness DoD** (`references/06i-completeness.md`): no stub, placeholder, unimplemented path or fabricated data left on a user-reachable path (or declared to the user with the reason); every part of the ask reachable from where the user enters it, with the exercising command/request/action named in the delivery report; nothing asked for quietly moved to "later"; no claim presented as verified when it was not. `pi-vigilant` scans the changed files for these markers at completion — resolve every finding or explain it; a clean scan is not proof of completeness.
251
+
242
252
  **Large work:** run `/asf verify` — it mechanically validates the **spec-to-code traceability matrix** (M1): every `met` spec must carry `trace` (outcome → codePath → testFile + assertion), testFile must exist, assertion must appear in it. FAIL rows block delivery. **Verify ingested specs from external planning docs too** — the doc's ✅ markers are claims, not evidence.
243
253
 
244
254
  **Independent reviewer gate (large work, P19):** before delivery, run the
@@ -259,8 +269,8 @@ conflicts). Record the review + triage in the delivery report.
259
269
  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.
260
270
  4. **Report honestly**: never claim a check you didn't run; state explicitly anything
261
271
  skipped or inconclusive, and distinguish "tests pass" from "works for the user".
262
- 3. If the project is a library/package that the user publishes (npm, GitHub release): **check the release policy** — read `.asf-release.json` at the project root if present (see `references/07-release.md`). It defines **when** (user-stated conditional rules: "when X is true, publish automatically; when Y is true, do this…") and **how** (instructions the ASF drives with judgment — credentials, git sync, publish steps). If the policy authorizes automatic publishing for the current state, drive the release per `how`; otherwise **offer** to run the release and get explicit approval (the default stance: publishing is the user's decision). **Always test on publish / in production, if applicable** — verify the shipped artifact from the registry / smoke-test prod, never assume it works. Optionally offer to set up a CI/CD pipeline for publishing.
263
- 4. Present a completion summary: what was built, specs met, tests passing, how to use it.
272
+ 5. If the project is a library/package that the user publishes (npm, GitHub release): **check the release policy** — read `.asf-release.json` at the project root if present (see `references/07-release.md`). It defines **when** (user-stated conditional rules: "when X is true, publish automatically; when Y is true, do this…") and **how** (instructions the ASF drives with judgment — credentials, git sync, publish steps). If the policy authorizes automatic publishing for the current state, drive the release per `how`; otherwise **offer** to run the release and get explicit approval (the default stance: publishing is the user's decision). **Always test on publish / in production, if applicable** — verify the shipped artifact from the registry / smoke-test prod, never assume it works. Optionally offer to set up a CI/CD pipeline for publishing.
273
+ 6. Present a completion summary: what was built, specs met, tests passing, how to use it.
264
274
 
265
275
  ---
266
276
 
@@ -298,6 +308,12 @@ conflicts). Record the review + triage in the delivery report.
298
308
  - ❌ Breaking existing functionality during a refactor — refactoring preserves behavior
299
309
  - ❌ Marking a spec delivered from the delivery log instead of tracing the code — the log is a claim
300
310
  - ❌ Shipping machinery no surface consumes — delivered = visible in the product (UI or API)
311
+ - ❌ A `// TODO`, `not implemented`, empty handler or `coming soon` on a user-reachable path — that is an absent feature wearing a name
312
+ - ❌ Fake, seed, demo or lorem-ipsum data on a path the user reads as their own
313
+ - ❌ An invented API signature, config key, endpoint, version or limit stated as fact — verify it or mark it unverified
314
+ - ❌ Quietly deferring part of the ask ("v1 does X") instead of finishing it or telling the user
315
+ - ❌ Presenting a stub as complete because the tests written against it pass
316
+ - ❌ Leaving a deliberate stub unexplained — if the user asked for a scaffold, say so in the report
301
317
  - ❌ Trusting unit tests as proof of wiring — assert the operator-facing outcome end-to-end
302
318
  - ❌ Trusting an external plan's ✅ (IMPROVEMENT-PLAN / delivery log) — ingest its items as specs and verify them
303
319
  - ❌ Implementing a spec literally when it creates product tension — challenge it and resolve with the user
@@ -329,6 +345,7 @@ reads at most 06b + 06c; large work reads the ones its phase calls for.
329
345
  | `06f-stability.md` | stability patterns + error handling + observability (P06/P07/P08) | **if the deliverable makes external calls or is a service** |
330
346
  | `06g-test-design.md` | risk-based test derivation + determinism | Phase 6 large (test plan) / non-trivial tests |
331
347
  | `06h-security.md` | threat model, ASVS DoD, supply chain, agent tools | Phase 4/5 large; small = one line |
348
+ | `06i-completeness.md` | **mandatory** no stubs / no fabricated data / no invented facts + completeness DoD | before implementing and before claiming done (always) |
332
349
  | `07-release.md` | release workflow + **configurable release policy** (`.asf-release.json`: when/how) + test-on-publish | before publishing |
333
350
 
334
351
  ## ASF self-modification policy (P22)
@@ -0,0 +1,67 @@
1
+ # Completeness — no stubs, no fabricated data, no invented facts
2
+
3
+ **Read when:** before writing implementation, and again before claiming done — for
4
+ every deliverable with real behaviour. **Skip when:** never. Small work needs only
5
+ the Core rule and the DoD checklist at the bottom.
6
+
7
+ Newer models can produce work that *looks* finished: a function with the right name
8
+ whose body is a placeholder, a screen populated with invented records, a report that
9
+ cites a limit nobody checked. Green tests do not disprove it — the tests were written
10
+ against the stub. This reference is the standing answer.
11
+
12
+ ## Core rule
13
+
14
+ **Ship the real thing, or say out loud what is not real.**
15
+
16
+ Complete means: the user can use what they asked for, through the entry point they
17
+ will actually use. Not: the files exist, the suite is green, the shape looks right.
18
+ There is no third option — an undeclared gap is a defect, however tidy it looks.
19
+
20
+ ## Never ship silently
21
+
22
+ | Pattern | Why it is a lie |
23
+ |---|---|
24
+ | `// TODO`, `FIXME`, `not implemented`, `coming soon`, `pass`, empty handler, `throw new Error("not implemented")` on a user-reachable path | The feature is absent; the name says it is present |
25
+ | Fake / seed / demo data on a user path — hardcoded users, invented prices, lorem ipsum, `example.com`, `+1 555-…`, `dummy`/`fake`/`sample` records | The user reads invention as their own data |
26
+ | Invented facts presented as checked — API signatures, config keys, endpoints, version numbers, limits, quotas | Confidence without verification is the expensive kind of wrong |
27
+ | Silently deferred scope — "v1 covers X" when X+Y was asked | A stub with better marketing |
28
+ | Built-but-never-wired — the module exists and is tested, but nothing calls it, no route reaches it, no surface consumes it | The user cannot get to the feature at all |
29
+ | Mocks or fakes in production code paths | Test seams belong at test seams (06b) |
30
+ | A config/env value the code reads but nothing sets, or a key the code never reads | The switch does nothing |
31
+
32
+ ## Legitimate exceptions — declared, never silent
33
+
34
+ 1. **The user asked for it**: a scaffold, spike, stub, mock or placeholder was the
35
+ requested deliverable. Keep it, and state in the delivery report that it is
36
+ deliberate and what it stands in for.
37
+ 2. **An approved deferral**: a scope conflict, missing credential, or external
38
+ dependency stopped part of the work. Record it as an open item: what is missing,
39
+ why, what remains.
40
+ 3. **A fake at a test seam**: legitimate, and stays out of shipped paths.
41
+
42
+ Anything else: **finish it.** If it cannot be finished in this run, the discrepancy
43
+ goes in the final message in plain words — never discovered by the user through use.
44
+
45
+ ## Prove it is real (Phase 7)
46
+
47
+ - **Exercise each part through the entry point the user will use** — the CLI command,
48
+ the HTTP request, the UI action, the installed package — and name that action in the
49
+ delivery report. "Implemented the export endpoint" is a claim; "`curl -s
50
+ localhost:3000/export.csv` returned 412 rows" is evidence.
51
+ - **Data-shaped output**: show one real record end to end. If data is seeded, label it
52
+ seeded and say where the real source plugs in.
53
+ - **Factual claims**: cite where verified (doc URL, tool output, schema, measured run)
54
+ or mark it unverified. Never launder an assumption into a statement of fact.
55
+ - **The host audits you**: `pi-vigilant` scans the files this session changed for
56
+ stub / fabricated-data / fact-hole markers and puts the findings in front of you at
57
+ completion. Resolve every finding or explain it — and a clean scan is *not* proof of
58
+ completeness: deferral and wiring remain your check, not the scanner's.
59
+
60
+ ## Definition of Done — completeness
61
+
62
+ - [ ] No stub, unimplemented path, placeholder or fabricated data remains on a
63
+ user-reachable path — or it is declared to the user with the reason.
64
+ - [ ] Every part of the ask is reachable from where the user enters it; the delivery
65
+ report names the command / request / action that exercised each part.
66
+ - [ ] Nothing asked for was quietly moved to "later" without the user being told.
67
+ - [ ] No claim in the deliverable or the report is presented as verified when it was not.