@difflab/pi 0.1.0 → 0.2.0-rc.202609170717.9cb91d1
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/README.md +32 -1
- package/agents/diffpi-autonomous.md +15 -0
- package/agents/diffpi-copilot.md +22 -0
- package/agents/diffpi-orchestrator.md +23 -0
- package/agents/diffpi-planner.md +15 -0
- package/agents/diffpi-reviewer.md +27 -0
- package/agents/diffpi-tutor.md +20 -0
- package/agents/diffpi-worker.md +19 -0
- package/dist/assets.d.ts +2 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/config.d.ts +28 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/environment.d.ts +40 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/extensions/index.js +2054 -182
- package/dist/forge.d.ts +48 -0
- package/dist/forge.d.ts.map +1 -0
- package/dist/fsx.d.ts +6 -0
- package/dist/fsx.d.ts.map +1 -0
- package/dist/gates.d.ts +12 -0
- package/dist/gates.d.ts.map +1 -0
- package/dist/index.d.ts +19 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1528 -149
- package/dist/modes.d.ts +59 -0
- package/dist/modes.d.ts.map +1 -0
- package/dist/pi.d.ts +21 -5
- package/dist/pi.d.ts.map +1 -1
- package/dist/process.d.ts +2 -0
- package/dist/process.d.ts.map +1 -1
- package/dist/review.d.ts +57 -0
- package/dist/review.d.ts.map +1 -0
- package/dist/setup.d.ts +11 -0
- package/dist/setup.d.ts.map +1 -1
- package/dist/store.d.ts +15 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/tools/index.d.ts +5 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1763 -171
- package/dist/tools/modes.d.ts +4 -0
- package/dist/tools/modes.d.ts.map +1 -0
- package/dist/tools/review.d.ts +7 -0
- package/dist/tools/review.d.ts.map +1 -0
- package/dist/tools/setup.d.ts.map +1 -1
- package/dist/tuicr.d.ts +43 -0
- package/dist/tuicr.d.ts.map +1 -0
- package/dist/zed.d.ts +11 -0
- package/dist/zed.d.ts.map +1 -0
- package/package.json +2 -1
- package/skills/diffpi-setup/SKILL.md +15 -1
- package/skills/mode/SKILL.md +38 -0
- package/skills/review/SKILL.md +13 -0
- package/skills/review/references/workflows/address.md +6 -0
- package/skills/review/references/workflows/complete.md +6 -0
- package/skills/review/references/workflows/help.md +12 -0
- package/skills/review/references/workflows/merge.md +6 -0
- package/skills/review/references/workflows/new.md +6 -0
- package/skills/review/references/workflows/open.md +6 -0
- package/skills/review/references/workflows/publish.md +5 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modes.d.ts","sourceRoot":"","sources":["../../src/tools/modes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAElF,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,UAAU,CAAC;AAiB5D,wBAAgB,eAAe,CAAC,UAAU,EAAE,cAAc,GAAG,SAAS,cAAc,EAAE,CAiErF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ToolDefinition } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import { type GateResult } from '../gates';
|
|
3
|
+
export declare function conventionalMergeGuard(subject: string): GateResult;
|
|
4
|
+
export declare function assertGitHubMergeReady(input: string): void;
|
|
5
|
+
export declare function reviewSubmissionBody(body: string): string;
|
|
6
|
+
export declare function createReviewTools(): readonly ToolDefinition[];
|
|
7
|
+
//# sourceMappingURL=review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/tools/review.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAIlF,OAAO,EAAkD,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAiD3F,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAElE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CA0C1D;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,iBAAiB,IAAI,SAAS,cAAc,EAAE,CA+V7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/tools/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/tools/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAqBlF,eAAO,MAAM,eAAe,EAAE,cA6B5B,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,cAyB/B,CAAC"}
|
package/dist/tuicr.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ForgeProvider } from './environment';
|
|
2
|
+
import { type LaunchResult } from './environment';
|
|
3
|
+
import type { ReviewComment } from './forge';
|
|
4
|
+
export interface SessionSummary {
|
|
5
|
+
slug: string;
|
|
6
|
+
kind: string;
|
|
7
|
+
path: string;
|
|
8
|
+
updatedAt: string;
|
|
9
|
+
commentCount: number;
|
|
10
|
+
anchor: string;
|
|
11
|
+
active: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface SessionCommentJson {
|
|
14
|
+
content: string;
|
|
15
|
+
side?: 'old' | 'new' | null;
|
|
16
|
+
}
|
|
17
|
+
interface SessionFileJson {
|
|
18
|
+
file_comments?: SessionCommentJson[];
|
|
19
|
+
line_comments?: Record<string, SessionCommentJson[]>;
|
|
20
|
+
}
|
|
21
|
+
export interface SessionJson {
|
|
22
|
+
branch_name?: string;
|
|
23
|
+
repo_path?: string;
|
|
24
|
+
review_comments?: SessionCommentJson[];
|
|
25
|
+
files?: Record<string, SessionFileJson>;
|
|
26
|
+
}
|
|
27
|
+
export declare function tuicrAvailable(): Promise<boolean>;
|
|
28
|
+
export declare function listSessions(repo?: string): Promise<SessionSummary[]>;
|
|
29
|
+
export declare function resolveSession(cwd: string, branch: string): Promise<SessionSummary | undefined>;
|
|
30
|
+
export declare function findMatchingSession(sessions: readonly SessionSummary[], cwd: string, branch: string): Promise<SessionSummary | undefined>;
|
|
31
|
+
export declare function readSession(path: string): Promise<SessionJson>;
|
|
32
|
+
export declare function addComment(session: string, body: string, opts?: {
|
|
33
|
+
targetFile?: string;
|
|
34
|
+
line?: number;
|
|
35
|
+
username?: string;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
export declare function launch(cwd: string): Promise<LaunchResult>;
|
|
38
|
+
export declare function toFindings(session: SessionJson): {
|
|
39
|
+
comments: ReviewComment[];
|
|
40
|
+
body: string;
|
|
41
|
+
};
|
|
42
|
+
export type { ForgeProvider };
|
|
43
|
+
//# sourceMappingURL=tuicr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tuicr.d.ts","sourceRoot":"","sources":["../src/tuicr.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI7C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,KAAK,GAAG,KAAK,GAA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AAE,QAAQ,EAAE,aAAa,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAkB5F;AAUD,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/zed.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const ZED_REVIEW_TASK_NAME = "diffpi: tuicr review";
|
|
2
|
+
export interface ZedEnsureResult {
|
|
3
|
+
path: string;
|
|
4
|
+
changed: boolean;
|
|
5
|
+
existed: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function zedTasksPath(homeDir?: string): string;
|
|
8
|
+
export declare function zedKeymapPath(homeDir?: string): string;
|
|
9
|
+
export declare function ensureZedReviewTask(homeDir?: string): Promise<ZedEnsureResult>;
|
|
10
|
+
export declare function ensureZedReviewKeybinding(homeDir?: string): Promise<ZedEnsureResult>;
|
|
11
|
+
//# sourceMappingURL=zed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zed.d.ts","sourceRoot":"","sources":["../src/zed.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAmB3D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAWD,wBAAgB,YAAY,CAAC,OAAO,SAAY,GAAG,MAAM,CAExD;AAED,wBAAgB,aAAa,CAAC,OAAO,SAAY,GAAG,MAAM,CAEzD;AAED,wBAAsB,mBAAmB,CAAC,OAAO,SAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAWvF;AAED,wBAAsB,yBAAyB,CAAC,OAAO,SAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAgB7F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difflab/pi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-rc.202609170717.9cb91d1",
|
|
4
4
|
"description": "Tools and skills for the pi coding agent",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
|
+
"agents/",
|
|
31
32
|
"dist/",
|
|
32
33
|
"skills/"
|
|
33
34
|
],
|
|
@@ -23,6 +23,16 @@ ask_user_question({
|
|
|
23
23
|
],
|
|
24
24
|
multiSelect: false,
|
|
25
25
|
},
|
|
26
|
+
{
|
|
27
|
+
question: 'Which forge should diffpi configure for /review?',
|
|
28
|
+
header: 'Forge',
|
|
29
|
+
options: [
|
|
30
|
+
{ label: 'None', description: 'Use local tuicr review without a forge CLI or MCP server.' },
|
|
31
|
+
{ label: 'GitHub', description: 'Install gh and register the GitHub MCP server with OAuth.' },
|
|
32
|
+
{ label: 'GitLab', description: 'Install glab and register the GitLab MCP server with OAuth.' },
|
|
33
|
+
],
|
|
34
|
+
multiSelect: false,
|
|
35
|
+
},
|
|
26
36
|
{
|
|
27
37
|
question:
|
|
28
38
|
'Allow diffpi to install mise, add its activation hook to your shell configuration, and install required development tools if they are missing?',
|
|
@@ -43,4 +53,8 @@ ask_user_question({
|
|
|
43
53
|
});
|
|
44
54
|
```
|
|
45
55
|
|
|
46
|
-
Map `None`, `Linear`, and `Jira` to `none`, `linear`, and `jira`. If the user selects `Skip` or declines the questionnaire, stop without calling `diffpi_setup`. After successful setup, call `diffpi_reload` when the setup result says pi must restart.
|
|
56
|
+
Map `None`, `Linear`, and `Jira` to `none`, `linear`, and `jira`. Map the forge answer `None`, `GitHub`, or `GitLab` to `forge: none`, `github`, or `gitlab`. Keep the forge at `none` unless the user selects one. If the user selects `Skip` or declines the questionnaire, stop without calling `diffpi_setup`. After successful setup, call `diffpi_reload` when the setup result says pi must restart.
|
|
57
|
+
|
|
58
|
+
When the user is using Zed, ask separately whether to bind `cmd-alt-r` to the `diffpi: tuicr review` task. Only pass `bindZedKey: true` when the user opts in; otherwise pass `false`.
|
|
59
|
+
|
|
60
|
+
Setup installs Diffpi's bundled agent Markdown into Pi's standard global agent directory. Explain that each default can run through the subagent plugin or as the current inline prompt. `/skill:mode` opens the structured picker. It also accepts `--include-skills`, one agent id, a qualified `skill:agent` id, or `clear`.
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
|
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 and stop.
|
|
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.
|
|
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.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review
|
|
3
|
+
description: Code review workflows over GitHub, GitLab, or the local tuicr TUI. Use for review open, new, address, publish, complete, merge, or local review requests.
|
|
4
|
+
allowed-tools: ask_user_question review_context review_open review_diff review_gates review_submit review_comments review_respond review_publish review_complete review_merge review_launch
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# review
|
|
8
|
+
|
|
9
|
+
Parse the first non-flag argument as VERB and preserve remaining flags. Normalize `create`/`draft` to `open`, `ready` to `publish`, and `land` to `merge`. An empty or unknown verb uses `references/workflows/help.md`.
|
|
10
|
+
|
|
11
|
+
Read and follow `references/workflows/{VERB}.md`. Call `review_context` first in every workflow. Use `ask_user_question` for choices that cannot be derived from the request; never ask those questions as plain chat text.
|
|
12
|
+
|
|
13
|
+
Workflow index: `open` creates a draft or local session; `new` reviews a diff; `address` handles unresolved comments; `publish` submits pending work; `complete` approves, rejects, closes, or archives; `merge` squash-merges; `help` prints the reference.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# address
|
|
2
|
+
|
|
3
|
+
1. Call `review_context` and `review_comments`.
|
|
4
|
+
2. Read each target file around its referenced line and propose a concrete fix.
|
|
5
|
+
3. In local mode, write proposals for the user. Otherwise apply approved fixes, then use the forge MCP or `review_respond` to reply and resolve each addressed thread.
|
|
6
|
+
4. Report applied, skipped, and failed counts; remind the user to commit with the git workflow.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# complete
|
|
2
|
+
|
|
3
|
+
1. Call `review_context`.
|
|
4
|
+
2. Map `--accept` to `accept`, `--reject` to `reject`, `--close` to `close`, and `--local` to `local`.
|
|
5
|
+
3. Call `review_complete` with the action and optional comment.
|
|
6
|
+
4. Remind the user that accept does not merge; use `/review merge` separately.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# help
|
|
2
|
+
|
|
3
|
+
```text
|
|
4
|
+
/review open [--local] create a draft PR/MR or tuicr session
|
|
5
|
+
/review new [--local] generate an inline review
|
|
6
|
+
/review address [--local] address unresolved review comments
|
|
7
|
+
/review publish [--local] publish pending review work
|
|
8
|
+
/review complete [--accept|--reject|--close|--local]
|
|
9
|
+
/review merge squash-merge an approved PR/MR
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Use `--local` for file-based tuicr review. Local artifacts are stored under `.pi/diffpi/`.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# new
|
|
2
|
+
|
|
3
|
+
1. Call `review_context`, `review_diff`, and `review_gates`.
|
|
4
|
+
2. Review the diff for intent, correctness, slop, and adversarial risk. Build findings `{ file, line, severity, body, reference }` and collect un-anchorable BLOCKING issues separately.
|
|
5
|
+
3. Call `review_submit` with findings, overallIssues, and notVerified; pass `local: true` for the local flow.
|
|
6
|
+
4. Report the artifact path and comment count.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# open
|
|
2
|
+
|
|
3
|
+
1. Call `review_context`.
|
|
4
|
+
2. With `--local` or no forge, call `review_open` with `local: true`; report the record and printed command when no tab opened.
|
|
5
|
+
3. Otherwise call `review_open` and report the draft PR/MR URL.
|
|
6
|
+
4. Tell the user to fill the body, then run `/review new`.
|