@difflab/pi 0.7.1 → 0.7.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 (56) hide show
  1. package/README.md +22 -40
  2. package/agents/diffpi-copilot.md +2 -2
  3. package/agents/diffpi-orchestrator.md +9 -14
  4. package/agents/diffpi-plan-reviewer.md +4 -12
  5. package/agents/diffpi-planner.md +6 -12
  6. package/agents/diffpi-reviewer.md +6 -10
  7. package/agents/diffpi-tutor.md +2 -2
  8. package/agents/diffpi-worker.md +3 -6
  9. package/dist/commands/dispatch.d.ts +4 -0
  10. package/dist/commands/dispatch.d.ts.map +1 -0
  11. package/dist/commands/index.d.ts +1 -3
  12. package/dist/commands/index.d.ts.map +1 -1
  13. package/dist/commands/plan.d.ts +1 -1
  14. package/dist/commands/plan.d.ts.map +1 -1
  15. package/dist/commands/review.d.ts +1 -1
  16. package/dist/commands/review.d.ts.map +1 -1
  17. package/dist/extensions/index.js +365 -881
  18. package/dist/index.d.ts +0 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +40 -403
  21. package/dist/tools/index.d.ts +1 -3
  22. package/dist/tools/index.d.ts.map +1 -1
  23. package/dist/tools/index.js +95 -212
  24. package/package.json +2 -2
  25. package/skills/diffpi-setup/SKILL.md +1 -1
  26. package/skills/plan/SKILL.md +12 -22
  27. package/skills/plan/references/design-quality.md +3 -3
  28. package/skills/plan/references/workflows/annotate.md +9 -3
  29. package/skills/plan/references/workflows/finalize.md +10 -6
  30. package/skills/plan/references/workflows/go.md +25 -7
  31. package/skills/plan/references/workflows/help.md +20 -3
  32. package/skills/plan/references/workflows/init.md +23 -6
  33. package/skills/plan/references/workflows/inline-fallback.md +9 -0
  34. package/skills/plan/references/workflows/new.md +22 -7
  35. package/skills/plan/references/workflows/update.md +22 -6
  36. package/skills/plan/references/workflows/validate.md +31 -0
  37. package/skills/review/SKILL.md +14 -6
  38. package/skills/review/references/workflows/address.md +19 -6
  39. package/skills/review/references/workflows/auto.md +21 -5
  40. package/skills/review/references/workflows/complete.md +17 -4
  41. package/skills/review/references/workflows/edit.md +8 -2
  42. package/skills/review/references/workflows/foreground-fallback.md +7 -0
  43. package/skills/review/references/workflows/help.md +22 -13
  44. package/skills/review/references/workflows/merge.md +17 -2
  45. package/skills/review/references/workflows/new.md +17 -5
  46. package/skills/review/references/workflows/open.md +8 -2
  47. package/skills/review/references/workflows/publish.md +17 -4
  48. package/skills/review/references/workflows/status.md +7 -2
  49. package/templates/plan/PLAN.md +1 -1
  50. package/dist/commands/mode.d.ts +0 -5
  51. package/dist/commands/mode.d.ts.map +0 -1
  52. package/dist/modes.d.ts +0 -75
  53. package/dist/modes.d.ts.map +0 -1
  54. package/dist/tools/modes.d.ts +0 -4
  55. package/dist/tools/modes.d.ts.map +0 -1
  56. package/skills/mode/SKILL.md +0 -38
@@ -1,5 +1,11 @@
1
1
  # open
2
2
 
3
- **Owner/tier:** lifecycle coordinator, read-only.
3
+ ## Parse arguments
4
4
 
5
- Call `review_context` first with the exact target/backend/local, then call `review_open`. It opens an existing remote PR/MR; it never creates one. With `--local`, preserve the local behavior selected by context. Report unsupported or missing targets and browser/launch failures; do not mutate review state.
5
+ Accept `open [target] [--local]`. Fuzzy-match the existing PR/MR or tuicr session from the request and repository. Prefer explicit arguments/flags, then safe inference, then the current-review target. Select local for an explicit working-tree request. Call `ask_user_question` only for material ambiguity.
6
+
7
+ ## Steps
8
+
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_open` for an existing remote PR/MR in the browser. For `--local`, call `review_edit` to open only the matching existing tuicr session.
11
+ 3. Report the opened target or exact missing-session/browser/launch failure. Do not create a review, generate findings or mutate review state.
@@ -1,7 +1,20 @@
1
1
  # publish
2
2
 
3
- **Owner/tier:** lifecycle coordinator; no Reviewer or Worker.
3
+ ## Parse arguments
4
4
 
5
- 1. Parse target, `--local`, and one status: comment (default), approve, request-changes, or close. Call `review_context` first and preserve the selected backend. A local promotion may be used only when context identifies the matching local session; never silently switch.
6
- 2. Call `review_publish` with the same target/backend/local. It promotes/stages pending local work where applicable and publishes the selected status; remote comments remain pending until this call. Comment/approve/request-changes mark remote drafts ready; close publishes comment then closes. GitLab may reject request-changes.
7
- 3. Report promoted bodies/comments/replies, status, and final state. Publish never merges. Unsupported target, unmatched response, or forge failure is explicit.
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.
6
+
7
+ ## Steps
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.
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
+
12
+ ```text
13
+ Inspect publication readiness without publishing.
14
+ - Repository: {absolute repo cwd}; exact request: {exact request}.
15
+ - Resolved target: {target}; backend: {backend}; local: {local}; selected status: {status}; issue URL: {issue URL or none}; approved policy: {policy}.
16
+ - Call review_context first; reuse its target/backend/local/cwd. Inspect the matching session and pending findings/replies; identify unmatched drafts, failed checks and material decisions. Do not silently switch backends.
17
+ - Return actual completed evidence and a go/no-go recommendation or precise blocker. Do not publish, complete, merge or resolve threads.
18
+ ```
19
+
20
+ 3. If no native subagents are available for step 2, follow [foreground fallback](foreground-fallback.md) before inspection; only after explicit confirmation inspect inline and report actual evidence without claiming an Orchestrator result. Otherwise require the completed inspection result, not a queued job or claim. Resolve material decisions with the user, then call `review_publish` in the initiating thread only if approval still applies. Report the actual published or blocked outcome.
@@ -1,5 +1,10 @@
1
1
  # status
2
2
 
3
- **Owner/tier:** lifecycle coordinator, read-only.
3
+ ## Parse arguments
4
4
 
5
- Call `review_context` first with the exact target/backend/local, then `review_status` with the same values. Report branch, worktree, forge/local review, URLs, and tuicr state. Missing or unsupported targets are errors; status never creates, publishes, completes, merges, or changes comments.
5
+ Accept `status [target] [--local]`. Fuzzy-match the status target/backend from the request and repository. Prefer explicit arguments/flags, then safe inference, then the current-review target. Select local for an explicit working-tree request. Call `ask_user_question` only for material ambiguity.
6
+
7
+ ## Steps
8
+
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.
@@ -44,4 +44,4 @@
44
44
 
45
45
  ## References
46
46
 
47
- <!-- Add repository or external references. -->
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. -->
@@ -1,5 +0,0 @@
1
- import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
2
- import type { ModeController } from '../modes';
3
- /** Register the inline agent mode command. */
4
- export declare function registerModeCommand(pi: ExtensionAPI, modes: ModeController): void;
5
- //# sourceMappingURL=mode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../../src/commands/mode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,iCAAiC,CAAC;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK/C,8CAA8C;AAC9C,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,CAKjF"}
package/dist/modes.d.ts DELETED
@@ -1,75 +0,0 @@
1
- import { type ExtensionAPI, type ExtensionContext } from '@earendil-works/pi-coding-agent';
2
- export type ModePromptStrategy = 'append' | 'replace';
3
- export type ModeThinkingLevel = 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
4
- export interface AgentMode {
5
- id: string;
6
- label: string;
7
- description: string;
8
- systemPrompt: string;
9
- promptStrategy: ModePromptStrategy;
10
- modelPreferences: string[];
11
- thinkingLevel?: ModeThinkingLevel;
12
- requiredTools: string[];
13
- forbiddenTools: string[];
14
- requireModel: boolean;
15
- requireThinking: boolean;
16
- tools: string[];
17
- source: string;
18
- sourcePath: string;
19
- }
20
- export interface ModeCatalog {
21
- modes: AgentMode[];
22
- diagnostics: string[];
23
- }
24
- export interface ModeListOptions {
25
- includeSkills?: boolean;
26
- }
27
- export interface ModeController {
28
- list(ctx: ExtensionContext, options?: ModeListOptions): Promise<ModeCatalog>;
29
- set(agent: string, ctx: ExtensionContext): Promise<ModeSelectionResult>;
30
- unset(ctx: ExtensionContext): Promise<ModeSelectionResult>;
31
- restore(ctx: ExtensionContext): Promise<void>;
32
- refresh(ctx: ExtensionContext): void;
33
- apply(systemPrompt: string): string;
34
- getActive(): AgentMode | undefined;
35
- getStatus(ctx: ExtensionContext): ModeRuntimeStatus;
36
- }
37
- export interface ModeRuntimeStatus {
38
- active?: string;
39
- model?: {
40
- provider: string;
41
- id: string;
42
- };
43
- thinkingLevel: ModeThinkingLevel;
44
- activeTools: string[];
45
- capabilityError?: string;
46
- }
47
- export type ModeSelectionResult = {
48
- ok: true;
49
- active?: AgentMode;
50
- message: string;
51
- } | {
52
- ok: false;
53
- message: string;
54
- };
55
- export interface ModeDiscoveryOptions extends ModeListOptions {
56
- cwd: string;
57
- agentDir?: string;
58
- bundledAgentsDir?: string;
59
- homeDir?: string;
60
- projectTrusted: boolean;
61
- }
62
- export interface ModeControllerOptions {
63
- agentDir?: string;
64
- bundledAgentsDir?: string;
65
- homeDir?: string;
66
- }
67
- type ModeRuntime = Pick<ExtensionAPI, 'appendEntry' | 'getActiveTools' | 'getAllTools' | 'getThinkingLevel' | 'setActiveTools' | 'setModel' | 'setThinkingLevel'>;
68
- /** Discover standard agents and, when requested, qualified skill agents. */
69
- export declare function discoverAgentModes(options: ModeDiscoveryOptions): Promise<ModeCatalog>;
70
- /** Resolve an agent id without guessing an unqualified skill-agent name. */
71
- export declare function resolveAgentMode(modes: readonly AgentMode[], requested: string): ModeSelectionResult;
72
- /** Create the session-scoped controller that applies and restores complete mode profiles. */
73
- export declare function createModeController(pi: ModeRuntime, options?: ModeControllerOptions): ModeController;
74
- export {};
75
- //# sourceMappingURL=modes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modes.d.ts","sourceRoot":"","sources":["../src/modes.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,iCAAiC,CAAC;AAUzC,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,CAAC;AACtD,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAEhG,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,kBAAkB,CAAC;IACnC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,E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,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAErH,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,WAAW,GAAG,IAAI,CACrB,YAAY,EACV,aAAa,GACb,gBAAgB,GAChB,aAAa,GACb,kBAAkB,GAClB,gBAAgB,GAChB,UAAU,GACV,kBAAkB,CACrB,CAAC;AAiCF,4EAA4E;AAC5E,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,CAiC5F;AAED,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,mBAAmB,CAqBpG;AAED,6FAA6F;AAC7F,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,WAAW,EAAE,OAAO,GAAE,qBAA0B,GAAG,cAAc,CAgIzG"}
@@ -1,4 +0,0 @@
1
- import { type ToolDefinition } from '@earendil-works/pi-coding-agent';
2
- import type { ModeController } from '../modes';
3
- export declare function createModeTools(controller: ModeController): readonly ToolDefinition[];
4
- //# sourceMappingURL=modes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modes.d.ts","sourceRoot":"","sources":["../../src/tools/modes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGlF,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,UAAU,CAAC;AAiB5D,wBAAgB,eAAe,CAAC,UAAU,EAAE,cAAc,GAAG,SAAS,cAAc,EAAE,CAiFrF"}
@@ -1,38 +0,0 @@
1
- ---
2
- name: mode
3
- description: List, select, or clear an inline agent profile. Use when the user invokes /skill:mode or asks to change the current Diffpi mode.
4
- allowed-tools: ask_user_question diffpi_modes_list diffpi_modes_set diffpi_modes_unset diffpi_modes_status
5
- ---
6
-
7
- # Mode
8
-
9
- Pi appends `/skill:mode` arguments as `User: <arguments>`. Route those arguments without manual command parsing in the extension.
10
-
11
- ## Direct requests
12
-
13
- - If the argument is `help`, `-h`, or `--help`, print the usage and examples below. Do not call a tool.
14
- - If the argument is `clear`, call `diffpi_modes_unset` and stop.
15
- - If the argument is one agent id, call `diffpi_modes_set` with that exact id. On the next model turn, call `diffpi_modes_status` to verify the selected model, thinking level, and active tools; if preflight or verification fails, report the exact capability error and do not claim an active mode.
16
- - A qualified id such as `spec:planner` is one agent id. The tool enables skill-agent discovery for it.
17
- - If the request contains multiple agent ids or an unsupported flag, print the usage and stop.
18
-
19
- ```text
20
- /skill:mode [--include-skills] [agent|clear]
21
- /skill:mode
22
- /skill:mode --include-skills
23
- /skill:mode worker
24
- /skill:mode spec:planner
25
- /skill:mode clear
26
- ```
27
-
28
- ## Picker
29
-
30
- Use the picker when there are no arguments or when the only argument is `--include-skills`.
31
-
32
- 1. Call `diffpi_modes_list`. Set `includeSkills` to true only for `--include-skills`.
33
- 2. Call `ask_user_question` with one single-select question. Do not ask as plain chat text.
34
- 3. Put the complete list of valid ids in the question text. Offer Default plus at most three relevant agents as structured options. The custom-answer row lets the user enter any other valid id.
35
- 4. If the user selects Default or enters `clear`, call `diffpi_modes_unset`.
36
- 5. Otherwise, call `diffpi_modes_set` with the selected or entered id. On the next model turn, call `diffpi_modes_status` and verify the selected model, thinking level, and active tools. If selection or post-turn verification fails, report the exact capability error and ensure no ghost active mode is claimed.
37
-
38
- Do not perform unrelated work. Explain that the selected prompt, preferred available model, thinking level, and tool set start on the next turn. Mode selection is not a security boundary.