@juicesharp/rpiv-pi 0.11.0 → 0.11.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juicesharp/rpiv-pi",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Skill-based development workflow for Pi Agent — discover, research, design, plan, implement, validate",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -41,75 +41,26 @@ You are tasked with reviewing changes across three parallel lenses — **Quality
41
41
  3. **Bail-out**: if `ChangedFiles` is empty, print `No changes in scope [scope]. Exiting.` and STOP. Do not write an artifact.
42
42
 
43
43
  4. **Derive flags** (orchestrator-side, used in later steps):
44
- - `ManifestChanged` = ChangedFiles contains any path matching dependency manifests across common ecosystems:
45
- `package.json`, `package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`,
46
- `pyproject.toml`, `poetry.lock`, `uv.lock`, `Pipfile`, `Pipfile.lock`, `requirements*.txt`,
47
- `*.csproj`, `Directory.Packages.props`, `packages.lock.json`, `global.json`,
48
- `go.mod`, `go.sum`,
49
- `Cargo.toml`, `Cargo.lock`,
50
- `Gemfile`, `Gemfile.lock`, `*.gemspec`,
51
- `pom.xml`, `build.gradle`, `build.gradle.kts`, `gradle/libs.versions.toml`,
52
- `composer.json`, `composer.lock`,
53
- `Package.swift`, `Package.resolved`, `Podfile.lock`,
54
- `mix.exs`, `mix.lock`, `pubspec.yaml`, `pubspec.lock`,
55
- `.terraform.lock.hcl`, `Dockerfile*`,
56
- OR a `peerDependencies`/`dependencyManagement`/central-versions block was touched.
44
+ - `ManifestChanged` = ChangedFiles intersects {`package.json`, `package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`} OR a `peerDependencies` field was touched.
57
45
  - `LockstepSelfReview` = repository root contains `scripts/sync-versions.js` AND every `packages/*/package.json` shares the same `version:` AND the diff touches `packages/*/package.json`.
58
46
  - `ReviewType` = one of `commit | pr | staged | working`.
59
- - `WorkflowRiskSignals` — run each of the five commands below. For each, set its signal to `yes` if the command produces any output, else `no`. Treat empty output as `no` — `grep`'s non-zero no-match exit is not an error. Record all five plus the `workflow_risk_gate` aggregate on the Discovery Map. The Step 4 gate reads these booleans.
60
47
 
61
- Group 1 External I/O and persistence writes:
62
- ```
63
- git diff -U0 [scope] | grep -nE '(fetch\(|axios\.|http\.(Get|Post|Put|Delete|Patch)|requests\.(get|post|put|delete|patch)|HttpClient\b|URLSession\b|reqwest::|net/http|fs\.(readFile|writeFile)|File\.(Open|Read|Write)|Process\.Start|subprocess\.|exec\.Command|child_process|\.save\(|\.update\(|\.delete\(|INSERT\s+INTO|UPDATE\s+\w+\s+SET|DELETE\s+FROM)' | head -20
64
- ```
65
- → `external_io_or_write = yes` if any match, else `no`.
48
+ ## Step 2: Phase-1 Discovery Map (parallel agents)
66
49
 
67
- Group 2 Retry/schedule/concurrency primitives:
68
- ```
69
- git diff -U0 [scope] | grep -nE '(\bretry\b|\bbackoff\b|\bBackOff\b|maxAttempts|\battempt(s)?\s*[<>=]=?\s*\d|\bschedule\(|\bcron\b|\bdebounce\(|\bthrottle\(|setTimeout\(|setInterval\(|\bMutex\b|\bRwLock\b|\bSemaphore\b|atomic\.|Atomic(Int|Long|Ref|Bool)\b|Interlocked\.|\bsynchronized\s*\(|\bvolatile\b)' | head -20
70
- ```
71
- → `retry_schedule_concurrency = yes` if any match, else `no`.
50
+ Spawn ONE agent in parallel with orchestrator-side work:
72
51
 
73
- Group 3 Exported/public surface:
74
- ```
75
- git diff -U0 [scope] | grep -nE '(^[\+\-].*(export\s+(default\s+)?(function|class|const|interface|type)\s|\bpublic\s+(class|interface|struct|record|static)\s|pub\s+(fn|struct|trait|enum)\s)|@(Get|Post|Put|Delete|Patch)Mapping|app\.(get|post|put|delete|patch)\(|@app\.route|@api_view)' | head -20
76
- ```
77
- → `exported_public_surface = yes` if any match, else `no`.
52
+ **AgentIntegration map:**
53
+ - subagent_type: `integration-scanner`
54
+ - Prompt: "Map inbound references, outbound dependencies, and infrastructure wiring for the following changed files: [ChangedFiles, one per line]. Flag any auth-boundary crossings (middleware, guards, interceptors, authorize-style decorators) and config/DI/event registration touching these paths. Do NOT analyse code quality — connections only, in your standard output format."
78
55
 
79
- Group 4 Schema/contract file paths:
80
- ```
81
- git diff --name-only [scope] | grep -E '(^|/)(migrations/|alembic/|db/migrate/)|\.(sql|proto|graphql[s]?|avsc)$|(^|/)(openapi|swagger).*\.ya?ml$|(^|/)prisma/schema\.prisma$'
82
- ```
83
- → `schema_contract_path = yes` if any match, else `no`.
56
+ While the agent runs, the orchestrator produces the rest of the Discovery Map inline from Step 1's data:
57
+ - `ChangedFiles`, `ManifestChanged`, `LockstepSelfReview`, `ReviewType`
58
+ - Hunk ranges per file (from `git diff -U0`)
59
+ - Commit-message context (if applicable)
84
60
 
85
- Group 5 Auth-boundary (two-stage, finalized in Step 2):
86
- ```
87
- git diff -U0 [scope] | grep -nE '(middleware\b|interceptor\b|\bguard\b|@?[Aa]uthoriz|requires_auth|before_action\s+:authenticate|@PreAuthorize|@login_required|permission_classes)' | head -20
88
- ```
89
- → In Step 1, set a preliminary `auth_boundary_body` from this command's output only. In Step 2 (Discovery Map synthesis), OR that preliminary value with any auth-boundary crossings reported by the integration-scanner, and record the final `auth_boundary_body` on the Discovery Map.
61
+ **Wait for ALL agents to complete** before proceeding.
90
62
 
91
- Set `workflow_risk_gate = yes` if ANY of the five group booleans is `yes`, else `no`.
92
-
93
- Do NOT extend these commands with: bare `dispatch(`, `emit(`, `publish(`, `enqueue(`, `produce(`, `async`, `await`, `go func`, bare `Lock`, `channel`, `select {`, or generic `export` without symbol-kind. Those patterns may appear in the Step 4 sweep prompt's prose but MUST NOT drive the gate.
94
-
95
- ## Step 2: Phase-1 Discovery Map
96
-
97
- 1. **Spawn Phase-1 agents in parallel** using the Agent tool:
98
-
99
- - Use **integration-scanner** to map inbound references, outbound dependencies, infrastructure wiring, and auth-boundary crossings for `ChangedFiles`.
100
-
101
- Agent prompt:
102
- > Map inbound references, outbound dependencies, and infrastructure wiring for the following changed files: [ChangedFiles, one per line]. Flag any auth-boundary crossings (middleware, guards, interceptors, authorize-style decorators) and config/DI/event registration touching these paths. Do NOT analyse code quality — connections only, in your standard output format.
103
-
104
- 2. **While the agent runs, the orchestrator produces Discovery Map facts inline** from Step 1's data:
105
- - `ChangedFiles`, `ManifestChanged`, `LockstepSelfReview`, `ReviewType`
106
- - Hunk ranges per file (from `git diff -U0`)
107
- - Commit-message context (if applicable)
108
- - Run the five `WorkflowRiskSignals` commands (Step 1) and record yes/no per group plus the `workflow_risk_gate` aggregate
109
-
110
- 3. **Wait for ALL agents to complete** before proceeding.
111
-
112
- 4. **Synthesize the Discovery Map** — a compact text block that Phase-2 agents receive verbatim as `Known Context`. Finalize `auth_boundary_body` by OR-ing the preliminary Step 1 body-match result with any auth-boundary crossings reported by the integration-scanner, then recompute `workflow_risk_gate`.
63
+ **Synthesize the Discovery Map** a compact text block that Phase-2 agents receive verbatim as `Known Context`:
113
64
 
114
65
  ```
115
66
  ## Discovery Map
@@ -125,22 +76,15 @@ Hunks:
125
76
  path/b.ts: L5-8
126
77
  Manifest changed: [yes|no]
127
78
  Lockstep self-review: [yes|no]
128
- Workflow risk signals:
129
- external_io_or_write: [yes|no]
130
- retry_schedule_concurrency: [yes|no]
131
- exported_public_surface: [yes|no]
132
- schema_contract_path: [yes|no]
133
- auth_boundary_body: [yes|no]
134
- workflow_risk_gate: [yes|no]
135
79
  Auth-boundary crossings: [from integration-scanner output, file:line]
136
80
  Inbound refs: [from integration-scanner output]
137
81
  Outbound deps: [from integration-scanner output]
138
82
  Wiring/config: [from integration-scanner output]
139
83
  ```
140
84
 
141
- ## Step 3: Phase-2 Three-Lens Review
85
+ ## Step 3: Phase-2 Three-Lens Review (parallel agents)
142
86
 
143
- 1. **Spawn Phase-2 agents in parallel** using the Agent tool. Each receives the `## Discovery Map` block inline as `Known Context` above its task.
87
+ Spawn these agents in parallel using the Agent tool. Each receives the `## Discovery Map` block inline as `Known Context` above its task.
144
88
 
145
89
  **Always spawn:**
146
90
 
@@ -156,7 +100,6 @@ Wiring/config: [from integration-scanner output]
156
100
  2. Pattern divergence: where the hunk deviates from the surrounding file's existing style/structure (cite the nearby line the hunk broke from).
157
101
  3. Blast radius: any inbound reference in the Discovery Map that the hunk's behavior change could affect (`consumer.ext:line` + what changes for it).
158
102
  4. Test coverage gaps: any risk-bearing behavior the hunk introduces that has no adjacent test reference.
159
- 5. Cross-component consistency (1-hop only): when a hunk touches external I/O, state mutation outside local scope, retry/schedule/concurrency primitives, an exported/public symbol, a schema/contract file, or an auth boundary, compare its behavioral shape against the nearest established analogue reachable within ONE hop via the Discovery Map's inbound/outbound lists. "Behavioral shape" = what the code does, not what it is named (retry policy, I/O ordering and failure handling, input validation depth, concurrency protection, public-API signature and error channel, auth-check placement, observability symmetry, external-contract conformance). Prefer analogues already surfaced by the Discovery Map (inbound/outbound refs, wiring/config entries) or located in the same feature area (same or adjacent directory). Do NOT search broadly across the codebase. Each finding MUST cite both `hunk_file:line` AND `analogue_file:line`. If no 1-hop analogue is evident from the Discovery Map or the same feature area, omit this bucket for that hunk — do not speculate. Evidence only — no fix proposals.
160
103
 
161
104
  Return evidence only. No recommendations.
162
105
  ```
@@ -201,18 +144,14 @@ Wiring/config: [from integration-scanner output]
201
144
  [paste Discovery Map verbatim]
202
145
  Lockstep self-review: [LockstepSelfReview yes|no]
203
146
 
204
- Task: For each dependency-manifest file in the diff, infer its ecosystem primarily from the canonical manifest filename and nearby syntax in the diff (npm/yarn/pnpm, pip/poetry/uv, NuGet/MSBuild, Go modules, Cargo, Gem/Bundler, Maven/Gradle, Composer, SwiftPM/CocoaPods, Mix, Pub, Terraform lock, Docker base-image pins). If the ecosystem is ambiguous (e.g., `pyproject.toml` that could be Poetry, PEP-621, Hatch, or uv; `global.json` that may be SDK-only vs. tool-manifest; `Dockerfile` with multi-stage base-image pins), STATE the ambiguity explicitly rather than guessing — list the file with a "`ecosystem: ambiguous (<candidates>)`" marker and proceed conservatively.
205
-
206
- Then list:
207
- 1. Added dependencies: `ecosystem:name@version` with `file:line`.
208
- 2. Bumped dependencies: `ecosystem:name: old -> new` with `file:line`.
147
+ Task: Parse the diff of `package.json` / `package-lock.json` / `pnpm-lock.yaml` / `yarn.lock`. List:
148
+ 1. Added dependencies: `name@version` with `file:line`.
149
+ 2. Bumped dependencies: `name: old -> new` with `file:line`.
209
150
  3. Removed dependencies.
210
- 4. Pin-strength changes (exact ↔ range, floating ↔ pinned).
211
- 5. Peer/centrally-managed version changes (`peerDependencies`, `dependencyManagement`, `Directory.Packages.props`, Gradle version catalogs).
212
- 6. Transitive-only drift (lockfile-only moves).
213
- 7. Runtime/SDK/toolchain pin changes (`engines`, `global.json` SDK, `go.mod` toolchain, `rust-toolchain.toml`, `.nvmrc`, `.python-version`) list as architectural notes.
214
- 8. When Lockstep self-review is `yes`: flag only intra-monorepo version drift where a sibling pin diverges from the lockstep `version:` governed by `scripts/sync-versions.js`. Treat `"*"` peer pins as intentional.
215
- 9. When Lockstep self-review is `no`: flag version-conflicts between a direct dep and its lockfile resolution.
151
+ 4. `peerDependencies` changes.
152
+ 5. License field changes or additions in the lockfile.
153
+ 6. When Lockstep self-review is `yes`: flag only intra-monorepo version drift where a sibling pin diverges from the lockstep `version:` in `packages/*/package.json`. Treat `"*"` peer pins as intentional.
154
+ 7. When Lockstep self-review is `no`: flag any version-conflict between direct dep and lockfile resolution.
216
155
 
217
156
  Return evidence only. No CVE lookups — that is a separate agent.
218
157
  ```
@@ -231,29 +170,23 @@ Wiring/config: [from integration-scanner output]
231
170
  - subagent_type: `web-search-researcher`
232
171
  - Prompt:
233
172
  ```
234
- For each of the following dependency changes, look up known CVEs / GitHub Advisories / OSS Index entries in the target version. If a vulnerability exists, summarize severity (Critical / High / Moderate / Low), affected version range, and whether the bumped-to version is fixed.
235
-
236
- Dependencies to check (format each as `ecosystem:name@version` so the advisory lookup hits the right database; common ecosystems: npm, pypi, nuget, go, crates, rubygems, maven, composer, swift, hex, pub, terraform, oci-image):
237
- [name@version or ecosystem:name@version, one per line — extracted by orchestrator from the diff]
173
+ For each of the following dependency changes, look up known CVEs / GitHub Advisories / OSS Index entries in the target version. Return LINKS alongside findings. If a vulnerability exists, summarize severity (Critical / High / Moderate / Low), affected version range, and whether the bumped-to version is fixed.
238
174
 
239
- Query GHSA / OSV.dev / ecosystem-specific databases (RustSec, Trivy for images) as appropriate. Return LINKS alongside findings.
175
+ Dependencies to check:
176
+ [name@version, one per line — extracted by orchestrator from the diff]
240
177
  ```
241
178
 
242
- 2. **Wait for ALL agents to complete** before proceeding.
179
+ **Wait for ALL agents to complete** before proceeding.
243
180
 
244
181
  ## Step 4: Cross-Finding Interaction Sweep
245
182
 
246
- 1. **Evaluate the gate**. SKIP this step (go directly to Step 5) only when ALL of the following are true:
247
- - `len(ChangedFiles) < 2`, AND
248
- - Quality lens returned fewer than 4 total observations across all hunks, AND
249
- - `workflow_risk_gate` on the Discovery Map is `no`, AND
250
- - `precedent-locator` did not return any follow-up fix within 30 days for files in `ChangedFiles`.
183
+ **Gate**: SKIP this step (go directly to Step 5) when EITHER `len(ChangedFiles) < 2` OR the Quality lens returned fewer than 4 total observations across all hunks. Emergent interactions need surface area; tiny diffs cannot structurally produce them.
251
184
 
252
- 2. **Spawn the interaction-sweep agent** using the Agent tool:
185
+ Otherwise, spawn ONE additional agent after all Phase-2 agents complete:
253
186
 
254
- - Use **codebase-analyzer** to perform a cross-finding interaction sweep over Phase-2 evidence.
255
-
256
- Agent prompt:
187
+ **Interaction sweep:**
188
+ - subagent_type: `codebase-analyzer`
189
+ - Prompt:
257
190
  ```
258
191
  Known Context:
259
192
  [paste Discovery Map verbatim]
@@ -269,25 +202,18 @@ Wiring/config: [from integration-scanner output]
269
202
 
270
203
  Task: Perform a cross-finding interaction sweep. Group the evidence by shared entity, state machine, workflow, data flow path, API boundary, background process, or producer-consumer contract.
271
204
 
272
- For each group, check whether multiple local observations combine into an emergent defect. The sweep checks two tiers of defect classes — abstract cross-stack classes first, then the original local-composition checks:
273
-
274
- Abstract cross-stack defect classes (check these first):
275
- A1. Dual-write divergence: two sinks that must stay consistent were updated asymmetrically, or one was updated and the other was not. Covers write/read models, cache/source-of-truth, replica/primary, index/source, client-optimistic/server-authoritative, migration/ORM model.
276
- A2. Invariant-enforcement gap: a check enforced on one call path is bypassed on a sibling path. Covers auth scoping, tenant/account/workspace scoping, input validation, rate limiting, ACL, quota, feature flag.
277
- A3. Coupled-lifecycle mismatch: two artifacts that must evolve together and only one did. Covers API schema ↔ client, protobuf ↔ codegen ↔ consumer, migration ↔ model, IaC ↔ app config, event schema ↔ consumer.
278
-
279
- Original local-composition checks:
280
- L1. Contradictory assumptions between components or layers.
281
- L2. Unreachable, stuck, or non-terminal states.
282
- L3. Retry/reprocess mechanisms made inert by another behavior.
283
- L4. Duplicate-processing or idempotency gaps from ordering or missing guards.
284
- L5. Guards in one layer invalidating transitions in another.
285
- L6. One finding masking, amplifying, or permanently triggering another.
205
+ For each group, check whether multiple local observations combine into an emergent defect, including:
206
+ 1. contradictory assumptions between components or layers,
207
+ 2. unreachable, stuck, or non-terminal states,
208
+ 3. retry/reprocess mechanisms made inert by another behavior,
209
+ 4. duplicate-processing or idempotency gaps created by ordering or missing guards,
210
+ 5. guards in one layer invalidating transitions in another,
211
+ 6. one finding masking, amplifying, or permanently triggering another.
286
212
 
287
213
  Return only interaction findings backed by explicit evidence from at least two concrete file:line locations from different files or different components. No recommendations. Do not repeat single-location findings.
288
214
  ```
289
215
 
290
- 3. **Wait for the interaction-sweep agent to complete** before proceeding.
216
+ **Wait for the interaction-sweep agent to complete** before proceeding.
291
217
 
292
218
  ## Step 5: Reconcile Findings
293
219
 
@@ -297,7 +223,6 @@ Wiring/config: [from integration-scanner output]
297
223
  - 🟡 Important: blast-radius × complexity-delta (hot path + new allocation, visible ABI change without migration).
298
224
  - 🔵 Suggestion: pattern divergence with a concrete nearby template.
299
225
  - 💭 Discussion: composite-lesson architecture concerns.
300
- - Bucket-5 (cross-component consistency) findings default to 🔵 when the divergence is structural only. Promote to 🟡 when the hunk touches I/O, an exported/public surface, a schema/contract, or an auth boundary, OR when the Discovery Map lists a concrete inbound consumer whose behavior changes. 🔴 promotion must come through the interaction sweep's defect classes, not the Quality lens alone.
301
226
  - Security evidence → classify:
302
227
  - 🔴 sink hit with a CONCRETE user-reachable source→sink path traced through Discovery Map auth-boundary crossings. Reject any hit lacking an explicit trace.
303
228
  - 🟡 crypto-only concrete issues: weak hash in an auth/integrity role (MD5/SHA1), non-constant-time compare on secrets, hardcoded key material in diff. Do NOT use 🟡 for "missing hardening".
@@ -383,10 +308,6 @@ status: [approved|needs_changes|requesting_changes]
383
308
  tags: [code-review, relevant-components]
384
309
  last_updated: [YYYY-MM-DD]
385
310
  last_updated_by: [User]
386
- files_changed: [N]
387
- advisor_used: [true|false]
388
- interaction_sweep: [run|skipped-by-gate]
389
- workflow_risk_gate: [yes|no]
390
311
  ---
391
312
 
392
313
  # Code Review: [Scope Description]
@@ -523,9 +444,4 @@ Ask follow-ups, or run `/skill:revise` to address the findings.
523
444
  - `precedent-locator` (Phase-2, always): git history + thoughts/ for lessons.
524
445
  - `web-search-researcher` (Phase-2, conditional on `ManifestChanged`): CVE / GitHub Advisory / OSS Index lookups with LINKS.
525
446
  - **File reading**: read the diff FULLY (no limit/offset) via `git` commands before spawning agents. Let agents read their scoped targets; the orchestrator does not need to read source files for non-risk findings.
526
- - **Framework-agnostic defaults**:
527
- - The Quality-lens bucket-5, the Step 4 gate, and the interaction-sweep defect classes are phrased in universal behavioral terms (I/O, state mutation, concurrency, public surface, schema/contract, auth) rather than framework names. Do NOT add framework-specific vocabulary to these prompts. If a stack needs more specificity, open a separate RFC.
528
- - Bucket-5 scope cap: capped at 1 hop via Discovery Map inbound/outbound lists AND limited to same-feature-area analogues. Agents must NOT traverse beyond directly connected files or search broadly across the codebase. Preserves evidence-only discipline at `packages/rpiv-pi/agents/codebase-analyzer.md:113-119`.
529
- - Dependencies lens is ecosystem-neutral: the lens prompt infers ecosystem from filename and nearby syntax; ambiguous cases (e.g., `pyproject.toml`, `global.json`, `Dockerfile`) must be stated explicitly, not guessed. Adding a new ecosystem means extending `ManifestChanged` (Step 1) and optionally the ecosystem hint in the CVE lens prompt.
530
- - **Workflow risk signals**: ALWAYS run the five `WorkflowRiskSignals` commands (Step 1) and record their yes/no results on the Discovery Map. NEVER approximate the patterns by eye — the Step 4 gate reads the recorded booleans.
531
447
  - CC auto-loads CLAUDE.md files when agents read files in a directory — no need to scan for them explicitly.