pi-diffwarden 0.26.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/CHANGELOG.md +755 -0
- package/LICENSE +21 -0
- package/README.md +846 -0
- package/extensions/diffwarden/index.ts +84 -0
- package/package.json +31 -0
- package/skills/diffwarden/SKILL.md +2428 -0
- package/skills/diffwarden/commands/diffwarden.md +22 -0
- package/skills/diffwarden/commands/dw.md +22 -0
- package/skills/diffwarden/prompts/diffwarden.md +3 -0
- package/skills/diffwarden/prompts/dw.md +3 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { dirname, join, resolve } from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
4
|
+
|
|
5
|
+
const extensionDir = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const repoRoot = resolve(extensionDir, "..", "..");
|
|
7
|
+
const skillPath = join(repoRoot, "skills", "diffwarden", "SKILL.md");
|
|
8
|
+
|
|
9
|
+
const completionCandidates = [
|
|
10
|
+
"review",
|
|
11
|
+
"loop",
|
|
12
|
+
"status",
|
|
13
|
+
"comment",
|
|
14
|
+
"help",
|
|
15
|
+
"workspace",
|
|
16
|
+
"local",
|
|
17
|
+
"staged",
|
|
18
|
+
"worktree",
|
|
19
|
+
"current",
|
|
20
|
+
"--mvp",
|
|
21
|
+
"--security",
|
|
22
|
+
"--orchestrate",
|
|
23
|
+
"--verbose",
|
|
24
|
+
"--commit",
|
|
25
|
+
"--push",
|
|
26
|
+
"--as-code",
|
|
27
|
+
"--as-plan",
|
|
28
|
+
"--web",
|
|
29
|
+
"--research",
|
|
30
|
+
"--reply",
|
|
31
|
+
"--resolve",
|
|
32
|
+
"--delegate",
|
|
33
|
+
"--dry-run",
|
|
34
|
+
"--max",
|
|
35
|
+
"--review-model",
|
|
36
|
+
"--fix-code-model",
|
|
37
|
+
"--fix-text-model",
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
function completeArgs(prefix: string) {
|
|
41
|
+
const leading = prefix.match(/^\s*/)?.[0] ?? "";
|
|
42
|
+
const body = prefix.slice(leading.length);
|
|
43
|
+
const tokens = body.length > 0 ? body.split(/\s+/) : [];
|
|
44
|
+
const current = body.endsWith(" ") ? "" : (tokens.pop() ?? "");
|
|
45
|
+
const base = leading + (body.endsWith(" ") ? body : tokens.length > 0 ? `${tokens.join(" ")} ` : "");
|
|
46
|
+
const matches = completionCandidates.filter((candidate) => candidate.startsWith(current));
|
|
47
|
+
|
|
48
|
+
return matches.length > 0
|
|
49
|
+
? matches.slice(0, 20).map((candidate) => ({ value: `${base}${candidate}`, label: candidate }))
|
|
50
|
+
: null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function commandDescription(name: string) {
|
|
54
|
+
return `${name} <subcommand> [target] [flags] — run Diffwarden via /skill:diffwarden`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default function diffwardenExtension(pi: ExtensionAPI) {
|
|
58
|
+
pi.on("resources_discover", () => ({
|
|
59
|
+
skillPaths: [skillPath],
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
const invoke = (args: string, ctx: ExtensionCommandContext) => {
|
|
63
|
+
const normalizedArgs = args.trim() || "help";
|
|
64
|
+
const prompt = `/skill:diffwarden ${normalizedArgs}`;
|
|
65
|
+
|
|
66
|
+
if (ctx.hasUI) {
|
|
67
|
+
ctx.ui.notify(`Diffwarden: ${normalizedArgs}`, "info");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (ctx.isIdle()) {
|
|
71
|
+
pi.sendUserMessage(prompt);
|
|
72
|
+
} else {
|
|
73
|
+
pi.sendUserMessage(prompt, { deliverAs: "followUp" });
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
for (const name of ["dw", "diffwarden"]) {
|
|
78
|
+
pi.registerCommand(name, {
|
|
79
|
+
description: commandDescription(name),
|
|
80
|
+
getArgumentCompletions: completeArgs,
|
|
81
|
+
handler: async (args, ctx) => invoke(args, ctx),
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-diffwarden",
|
|
3
|
+
"version": "0.26.1",
|
|
4
|
+
"description": "Diffwarden Pi package: native /dw commands plus bundled skill discovery.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": ["pi-package", "diffwarden", "agent-skill", "code-review", "pull-request"],
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/jperocho/diffwarden.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/jperocho/diffwarden",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/jperocho/diffwarden/issues"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"extensions/",
|
|
17
|
+
"skills/",
|
|
18
|
+
"README.md",
|
|
19
|
+
"CHANGELOG.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@earendil-works/pi-coding-agent": "*"
|
|
27
|
+
},
|
|
28
|
+
"pi": {
|
|
29
|
+
"extensions": ["./extensions/diffwarden/index.ts"]
|
|
30
|
+
}
|
|
31
|
+
}
|