@difflab/pi 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +8 -10
  2. package/agents/diffpi-orchestrator.md +1 -1
  3. package/agents/diffpi-planner.md +2 -2
  4. package/agents/diffpi-reviewer.md +2 -2
  5. package/agents/diffpi-worker.md +6 -6
  6. package/dist/environment.d.ts +0 -1
  7. package/dist/environment.d.ts.map +1 -1
  8. package/dist/extensions/index.js +319 -1495
  9. package/dist/index.d.ts +5 -9
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +140 -759
  12. package/dist/log.d.ts +6 -11
  13. package/dist/log.d.ts.map +1 -1
  14. package/dist/plan/verify.d.ts.map +1 -1
  15. package/dist/review/index.d.ts +2 -3
  16. package/dist/review/index.d.ts.map +1 -1
  17. package/dist/review/review-backend.d.ts +2 -3
  18. package/dist/review/review-backend.d.ts.map +1 -1
  19. package/dist/setup.d.ts +0 -2
  20. package/dist/setup.d.ts.map +1 -1
  21. package/dist/tools/index.js +319 -1495
  22. package/dist/tools/log.d.ts.map +1 -1
  23. package/dist/tools/review.d.ts +1 -7
  24. package/dist/tools/review.d.ts.map +1 -1
  25. package/dist/tools/setup.d.ts.map +1 -1
  26. package/package.json +1 -5
  27. package/skills/diffpi-setup/SKILL.md +3 -3
  28. package/skills/plan/SKILL.md +3 -4
  29. package/skills/plan/references/design-quality.md +1 -1
  30. package/skills/plan/references/workflows/finalize.md +2 -2
  31. package/skills/plan/references/workflows/go.md +7 -5
  32. package/skills/plan/references/workflows/help.md +1 -2
  33. package/skills/plan/references/workflows/init.md +2 -2
  34. package/skills/plan/references/workflows/inline-fallback.md +3 -3
  35. package/skills/plan/references/workflows/new.md +3 -3
  36. package/skills/plan/references/workflows/update.md +6 -4
  37. package/skills/plan/references/workflows/validate.md +5 -5
  38. package/skills/review/SKILL.md +5 -5
  39. package/skills/review/references/review-standards.md +9 -1
  40. package/skills/review/references/workflows/address.md +9 -15
  41. package/skills/review/references/workflows/auto.md +9 -17
  42. package/skills/review/references/workflows/complete.md +2 -2
  43. package/skills/review/references/workflows/edit.md +7 -5
  44. package/skills/review/references/workflows/help.md +12 -20
  45. package/skills/review/references/workflows/new.md +14 -13
  46. package/skills/review/references/workflows/publish.md +2 -2
  47. package/skills/review/references/workflows/status.md +1 -1
  48. package/skills/review/templates/REVIEW.md +39 -0
  49. package/templates/plan/PLAN.md +9 -1
  50. package/templates/review/draft-pr.md +3 -9
  51. package/dist/cli/plan.d.ts +0 -17
  52. package/dist/cli/plan.d.ts.map +0 -1
  53. package/dist/cli.d.ts +0 -4
  54. package/dist/cli.d.ts.map +0 -1
  55. package/dist/cli.js +0 -2258
  56. package/dist/extensions/tuicrx.d.ts +0 -66
  57. package/dist/extensions/tuicrx.d.ts.map +0 -1
  58. package/dist/extensions/zedx.d.ts +0 -18
  59. package/dist/extensions/zedx.d.ts.map +0 -1
  60. package/dist/review/local-review-backend.d.ts +0 -3
  61. package/dist/review/local-review-backend.d.ts.map +0 -1
  62. package/dist/review/local-reviews.d.ts +0 -31
  63. package/dist/review/local-reviews.d.ts.map +0 -1
  64. package/dist/review/review-markdown.d.ts +0 -6
  65. package/dist/review/review-markdown.d.ts.map +0 -1
  66. package/skills/plan/references/workflows/annotate.md +0 -13
  67. package/skills/review/references/workflows/open.md +0 -11
@@ -2,20 +2,21 @@
2
2
 
3
3
  ## Parse arguments
4
4
 
5
- Accept `new [title] [--intent text] [--base branch] [--local]` and a target named in the request. Fuzzy-match draft intent. Prefer explicit arguments/flags, then safe natural-language or repository title/intent/target/base/backend, then available defaults. Select local for an explicit working-tree request. Call `ask_user_question` only for material ambiguity before launch; return a precise blocker if a new decision arises later.
5
+ Accept `new [title] [--intent text] [--base branch] [--local]`. Resolve explicit target, plan/ticket, title, and backend first. For local work, ask `ask_user_question` when multiple plans or tickets match; do not guess.
6
6
 
7
- ## Steps
7
+ ## Local steps
8
8
 
9
- 1. Resolve the concrete target/backend/local and base with `review_context`. Substitute actual values for every placeholder, including the exact request and issue URL if applicable; never send raw `{placeholders}`. When native subagents are available, launch a lightweight/low `diffpi-worker` background subagent for this bounded draft-creation task. Pass the following self-contained prompt with ambient capabilities:
9
+ Use a background `diffpi-worker` when native subagents are available; otherwise follow the foreground fallback after confirmation. The worker performs only direct-file creation.
10
10
 
11
- ```text
12
- Create a review draft.
13
- - Repository: {absolute repo cwd}; exact request: {exact request}.
14
- - Resolved target: {target}; backend: {backend}; local: {local}; title: {title}; intent: {intent}; base: {base}; issue URL: {issue URL or none}; approved policy: {policy}.
15
- - This explicitly assigned review-draft creation is the only review lifecycle mutation authorized here. Call review_context first. Reuse its target/backend/local/cwd for all subsequent calls; never switch backend silently.
16
- - Reject unsupported forge, dirty remote branch or unavailable local base/default with exact evidence.
17
- - Call review_new to create the local tuicr review or remote draft PR/MR. Call review_launch_ui only if needed; report a returned launch command if automatic launch fails.
18
- - Verify and report the actual created target and draft state or exact failure. Do not stage findings, publish, complete or merge.
19
- ```
11
+ 1. Inspect `.diffpi/review/` and the matching plan/ticket directory before choosing a number. Derive `YYMMDD-{slug}` from the unique matching plan after stripping its date prefix, otherwise the ticket ID, otherwise a descriptive slug.
12
+ 2. Create `.diffpi/review/YYMMDD-{slug}/REVIEW-{n}.md` by reading `templates/REVIEW.md` and writing a copy. Numbering is best effort, not atomic; preserve existing files.
13
+ 3. Fill every known title, intent, target, base, and status field. If review text was pasted in the request, record it directly in the file and assign stable `F-001`-style IDs. Preserve replies and checkbox state on later edits.
14
+ 4. Report the exact path. Do not call `review_new`, create a backend, or claim atomic allocation.
20
15
 
21
- 2. If no native subagents are available, follow [foreground fallback](foreground-fallback.md) before creation. Only after explicit confirmation, perform the draft-creation steps above inline and verify with `review_status`; do not claim a Worker result. Otherwise require the completed child result and verify the created target/draft with `review_status`. Stop on failure; report the actual result, not merely a queued ID or claim. Do not assign the Worker publication, merge, findings judgment or substantive inspection.
16
+ ## Remote steps
17
+
18
+ Call `review_context`, then launch a `diffpi-worker` only for draft creation. Give the worker the resolved repository, branch, base, issue URL (if any), and exact request. The worker must:
19
+
20
+ 1. Read the packaged PR template at `../../templates/review/draft-pr.md` relative to the review skill directory. Inspect the actual branch changes against the selected base and any completed checks; do not invent validation results.
21
+ 2. Fill **every** template section: distinct intent and concrete changes, checks actually run (or `Not run (draft)`), the issue URL (or `No linked issue`), and known further work (or `Not yet assessed`). Remove all `{{...}}` markers and HTML comments. Pass the fully rendered Markdown as `body` to the existing `review_new` tool, with the resolved title/base/issue URL. The tool rejects missing or incomplete bodies before calling the forge.
22
+ 3. Report the actual PR/MR URL and draft state or the precise failure. Do not publish, complete, merge, or stage findings.
@@ -2,11 +2,11 @@
2
2
 
3
3
  ## Parse arguments
4
4
 
5
- Accept `publish [target] [--local] [--comment|--approve|--request-changes|--close]`. Fuzzy-match target/backend/status from the request and repository. Prefer explicit arguments/flags, then safe inference, then current-review target and comment status. Call `ask_user_question` only for material ambiguity before launch; return a precise blocker if a new decision arises later.
5
+ Accept `publish [target] [--comment|--approve|--request-changes|--close]`. Local publish is unsupported; reject stale `--local` or working-tree selectors. Fuzzy-match target/backend/status from the request and repository. Prefer explicit arguments/flags, then safe inference, then current-review target and comment status. Call `ask_user_question` only for material ambiguity before launch; return a precise blocker if a new decision arises later.
6
6
 
7
7
  ## Steps
8
8
 
9
- 1. Call `review_context` first with the selected target/backend/local. For a short, explicitly approved publication with no substantive inspection, call `review_publish` directly using its resolved values and selected status (`COMMENT` by default, `APPROVE`, `REQUEST_CHANGES`, or `CLOSE`). Remote findings and replies stay pending until this call. Promote only drafts matching the remote PR/MR; preserve `local:true` for a working-tree session. Report unmatched promotion, GitLab request-changes rejection, and exact failures; verify the final status. Do not merge or resolve threads.
9
+ 1. Call `review_context` first with the selected remote target/backend and `local:false`. For a short, explicitly approved publication with no substantive inspection, call `review_publish` directly using its resolved values and selected status (`COMMENT` by default, `APPROVE`, `REQUEST_CHANGES`, or `CLOSE`). Remote findings and replies stay pending until this call. Reject stale local or working-tree selectors; never promote local drafts. Report unmatched promotion, GitLab request-changes rejection, and exact failures; verify the final status. Do not merge or resolve threads.
10
10
  2. If the request instead needs substantive inspection or judgment before publication, when native subagents are available, delegate only that analysis to medium `diffpi-orchestrator` in the background with ambient capabilities. Fill every field in this self-contained prompt with actual values (or `none`), including the exact request; never send raw placeholders:
11
11
 
12
12
  ```text
@@ -7,4 +7,4 @@ Accept `status [target] [--local]`. Fuzzy-match the status target/backend from t
7
7
  ## Steps
8
8
 
9
9
  1. Call `review_context` first with the selected target/backend/local; reuse its target/backend/local/cwd. Reject unsupported selections without switching backend.
10
- 2. Call `review_status` with those same values. Report branch, worktree, local or remote review, URLs, tuicr session, pending/draft state and exact errors. Do not create a review or mutate source, comments or lifecycle state.
10
+ 2. Call `review_status` with those same values. Report branch, worktree, local or remote review, URLs, pending/draft state and exact errors. Do not create a review or mutate source, comments or lifecycle state.
@@ -0,0 +1,39 @@
1
+ # Local Review
2
+
3
+ - **Review:** <!-- descriptive title or plan/ticket slug -->
4
+ - **Status:** OPEN
5
+ - **Source:** <!-- pasted review text, local diff, or request -->
6
+ - **Created:** <!-- YYYY-MM-DD -->
7
+ - **Updated:** <!-- YYYY-MM-DD -->
8
+
9
+ ## Intent
10
+
11
+ <!-- State what this review is checking. -->
12
+
13
+ ## Findings
14
+
15
+ <!-- Keep findings in stable ID order. Preserve IDs, replies, and checkbox state when editing. -->
16
+
17
+ ### F-001 [ ] <!-- short finding title -->
18
+
19
+ - **Severity:** BLOCKING | CONSIDER | NOTE
20
+ - **Location:** `path/to/file.ts:1`
21
+ - **Finding:** <!-- Explain the problem and its impact. -->
22
+ - **Evidence:** <!-- Quote the relevant source or review text. -->
23
+ - **Resolution:** <!-- Leave blank while open; record the verified fix here. -->
24
+
25
+ <!-- Copy the finding shape above for F-002, F-003, and so on. -->
26
+
27
+ ## Replies
28
+
29
+ <!-- Preserve human replies verbatim. Add dated replies below without deleting prior context. -->
30
+
31
+ ## Verification
32
+
33
+ - [ ] Focused check run for each addressed finding
34
+ - [ ] Remaining open findings reviewed
35
+ - [ ] Overall status updated only after verification
36
+
37
+ ## Status Notes
38
+
39
+ <!-- Record blockers, partial work, and decisions. Do not close a finding without evidence. -->
@@ -3,8 +3,12 @@
3
3
  - **Plan ID:** {{id}}
4
4
  - **Branch:** {{branch}}
5
5
  - **Status:** draft
6
+ - **Execution state:** inactive
7
+ - **Execution worktree:** None
8
+ - **Execution reason:** None
6
9
  - **Issue:** {{issue_id}}
7
10
  - **Issue URL:** {{issue_url}}
11
+ - **Revision:** 0
8
12
 
9
13
  ## Intent
10
14
 
@@ -44,4 +48,8 @@
44
48
 
45
49
  ## References
46
50
 
47
- <!-- Add repository or external references. Record one completed Plan Reviewer round per authoring cycle: reviewed file hashes, Git state, verdict and findings; each finding's disposition; post-fix structural verification and current snapshot. A repaired BLOCKING verdict is not a reviewer PASS. Keep DRAFT until explicit finalize/go. -->
51
+ <!-- Add repository or external references before Feedback. -->
52
+
53
+ ### Feedback
54
+
55
+ <!-- Capture pending user feedback before an update. Archive the complete plan and numbered briefs before substantive edits, then increment Revision exactly once and address or disposition the feedback. -->
@@ -4,22 +4,16 @@
4
4
 
5
5
  ## Changes
6
6
 
7
- <!-- List the user-visible or architectural changes. -->
7
+ {{changes}}
8
8
 
9
9
  ## Validation
10
10
 
11
- <!-- List the checks that were run. -->
12
-
13
- - [ ] Existing tests pass
11
+ {{validation}}
14
12
 
15
13
  ## References
16
14
 
17
- <!-- Link the issue that defines this task. Add related project, epic, and public documentation links when available. -->
18
-
19
15
  - Issue: {{issue_url}}
20
16
 
21
17
  ## Further Work
22
18
 
23
- <!-- Optional: list intentionally deferred follow-up work as bullets, or remove this section. -->
24
-
25
- -
19
+ {{further_work}}
@@ -1,17 +0,0 @@
1
- import { Command } from 'commander';
2
- export interface PlanCliIO {
3
- stdout: Pick<NodeJS.WriteStream, 'write'>;
4
- stderr: Pick<NodeJS.WriteStream, 'write'>;
5
- }
6
- interface PlanCliRuntime {
7
- execute: (command: string, args: string[], cwd: string, interactive: boolean) => Promise<{
8
- code: number;
9
- stdout: string;
10
- stderr: string;
11
- }>;
12
- }
13
- export declare function createPlanCliCommand(io?: PlanCliIO, planRuntime?: PlanCliRuntime): Command;
14
- export declare function runPlanCli(args: string[], io?: PlanCliIO): Promise<number>;
15
- export declare function planCliHelp(): string;
16
- export {};
17
- //# sourceMappingURL=plan.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/cli/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AAKpD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC1C,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,CACP,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,OAAO,KACjB,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChE;AAMD,wBAAgB,oBAAoB,CAAC,EAAE,GAAE,SAAmB,EAAE,WAAW,GAAE,cAAwB,GAAG,OAAO,CA0B5G;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,SAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CASzF;AAED,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}
package/dist/cli.d.ts DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { type PlanCliIO } from './cli/plan';
3
- export declare function main(argv?: string[], io?: PlanCliIO): Promise<number>;
4
- //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAGA,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAElE,wBAAsB,IAAI,CAAC,IAAI,WAAwB,EAAE,EAAE,GAAE,SAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBjG"}