@aliou/pi-dev-kit 0.6.5 → 0.7.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/README.md +2 -2
- package/package.json +11 -10
- package/src/commands/index.ts +5 -1
- package/src/commands/update.ts +125 -83
- package/src/skills/pi-extension/SKILL.md +108 -137
- package/src/skills/pi-extension/references/additional-apis.md +252 -208
- package/src/skills/pi-extension/references/commands.md +113 -33
- package/src/skills/pi-extension/references/components.md +267 -102
- package/src/skills/pi-extension/references/hooks.md +229 -156
- package/src/skills/pi-extension/references/messages.md +94 -106
- package/src/skills/pi-extension/references/modes.md +80 -90
- package/src/skills/pi-extension/references/providers.md +255 -96
- package/src/skills/pi-extension/references/publish.md +76 -62
- package/src/skills/pi-extension/references/state.md +80 -33
- package/src/skills/pi-extension/references/structure.md +126 -269
- package/src/skills/pi-extension/references/testing.md +1 -1
- package/src/skills/pi-extension/references/tools.md +198 -823
- package/src/tools/changelog-tool.ts +15 -3
- package/src/tools/docs-tool.ts +3 -3
- package/src/tools/index.ts +5 -1
- package/src/tools/package-manager-tool.ts +8 -4
- package/src/tools/utils.ts +33 -23
- package/src/tools/version-tool.ts +8 -4
- package/src/index.ts +0 -8
|
@@ -5,9 +5,9 @@ import type {
|
|
|
5
5
|
AgentToolResult,
|
|
6
6
|
ExtensionAPI,
|
|
7
7
|
Theme,
|
|
8
|
-
} from "@
|
|
9
|
-
import { defineTool, keyHint, VERSION } from "@
|
|
10
|
-
import { Text } from "@
|
|
8
|
+
} from "@earendil-works/pi-coding-agent";
|
|
9
|
+
import { defineTool, keyHint, VERSION } from "@earendil-works/pi-coding-agent";
|
|
10
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
11
11
|
import { type Static, Type } from "typebox";
|
|
12
12
|
import { findPiInstallation } from "./utils";
|
|
13
13
|
|
|
@@ -306,6 +306,10 @@ pi_changelog // Get latest changelog`,
|
|
|
306
306
|
},
|
|
307
307
|
|
|
308
308
|
renderResult(result, options, theme) {
|
|
309
|
+
if (options.isPartial) {
|
|
310
|
+
return new Text(theme.fg("dim", "Pi Changelog: loading..."), 0, 0);
|
|
311
|
+
}
|
|
312
|
+
|
|
309
313
|
const { details } = result;
|
|
310
314
|
|
|
311
315
|
// Check for missing expected fields to detect errors
|
|
@@ -417,6 +421,14 @@ const changelogVersionsTool = defineTool({
|
|
|
417
421
|
},
|
|
418
422
|
|
|
419
423
|
renderResult(result, options, theme) {
|
|
424
|
+
if (options.isPartial) {
|
|
425
|
+
return new Text(
|
|
426
|
+
theme.fg("dim", "Pi Changelog Versions: loading..."),
|
|
427
|
+
0,
|
|
428
|
+
0,
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
|
|
420
432
|
const { details } = result;
|
|
421
433
|
|
|
422
434
|
// Check for missing expected fields to detect errors
|
package/src/tools/docs-tool.ts
CHANGED
|
@@ -5,9 +5,9 @@ import type {
|
|
|
5
5
|
AgentToolResult,
|
|
6
6
|
ExtensionAPI,
|
|
7
7
|
Theme,
|
|
8
|
-
} from "@
|
|
9
|
-
import { defineTool, keyHint } from "@
|
|
10
|
-
import { Text } from "@
|
|
8
|
+
} from "@earendil-works/pi-coding-agent";
|
|
9
|
+
import { defineTool, keyHint } from "@earendil-works/pi-coding-agent";
|
|
10
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
11
11
|
import { type Static, Type } from "typebox";
|
|
12
12
|
import { findPiInstallation } from "./utils";
|
|
13
13
|
|
package/src/tools/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionAPI } from "@
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { setupChangelogTool } from "./changelog-tool";
|
|
3
3
|
import { setupDocsTool } from "./docs-tool";
|
|
4
4
|
import { setupPackageManagerTool } from "./package-manager-tool";
|
|
@@ -10,3 +10,7 @@ export function setupTools(pi: ExtensionAPI) {
|
|
|
10
10
|
setupDocsTool(pi);
|
|
11
11
|
setupChangelogTool(pi);
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
export default function toolsExtension(pi: ExtensionAPI) {
|
|
15
|
+
setupTools(pi);
|
|
16
|
+
}
|
|
@@ -5,9 +5,9 @@ import type {
|
|
|
5
5
|
AgentToolResult,
|
|
6
6
|
ExtensionAPI,
|
|
7
7
|
Theme,
|
|
8
|
-
} from "@
|
|
9
|
-
import { defineTool } from "@
|
|
10
|
-
import { Text } from "@
|
|
8
|
+
} from "@earendil-works/pi-coding-agent";
|
|
9
|
+
import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
10
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
11
11
|
import { type Static, Type } from "typebox";
|
|
12
12
|
|
|
13
13
|
const Params = Type.Object({});
|
|
@@ -158,7 +158,11 @@ const packageManagerTool = defineTool({
|
|
|
158
158
|
return renderPackageManagerCall(args, theme);
|
|
159
159
|
},
|
|
160
160
|
|
|
161
|
-
renderResult(result,
|
|
161
|
+
renderResult(result, options, theme) {
|
|
162
|
+
if (options.isPartial) {
|
|
163
|
+
return new Text(theme.fg("dim", "Package Manager: detecting..."), 0, 0);
|
|
164
|
+
}
|
|
165
|
+
|
|
162
166
|
const { details } = result;
|
|
163
167
|
|
|
164
168
|
// Check for missing expected fields (framework passes {} on error)
|
package/src/tools/utils.ts
CHANGED
|
@@ -1,38 +1,48 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
import * as path from "node:path";
|
|
3
4
|
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
|
|
7
|
+
const PI_PACKAGE_NAMES = [
|
|
8
|
+
"@earendil-works/pi-coding-agent",
|
|
9
|
+
"@mariozechner/pi-coding-agent",
|
|
10
|
+
] as const;
|
|
11
|
+
|
|
4
12
|
/**
|
|
5
13
|
* Find the currently running Pi installation directory by resolving the
|
|
6
14
|
* pi-coding-agent package location.
|
|
7
15
|
*/
|
|
8
16
|
export function findPiInstallation(): string | null {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let currentDir = path.dirname(scriptPath);
|
|
17
|
+
for (const packageName of PI_PACKAGE_NAMES) {
|
|
18
|
+
try {
|
|
19
|
+
const piModulePath = require.resolve(`${packageName}/package.json`);
|
|
20
|
+
return path.dirname(piModulePath);
|
|
21
|
+
} catch {
|
|
22
|
+
// Try the next package namespace.
|
|
23
|
+
}
|
|
24
|
+
}
|
|
18
25
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
const scriptPath = process.argv[1];
|
|
27
|
+
if (scriptPath) {
|
|
28
|
+
let currentDir = path.dirname(scriptPath);
|
|
29
|
+
|
|
30
|
+
while (currentDir !== path.dirname(currentDir)) {
|
|
31
|
+
const packageJsonPath = path.join(currentDir, "package.json");
|
|
32
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
33
|
+
try {
|
|
34
|
+
const packageContent = fs.readFileSync(packageJsonPath, "utf-8");
|
|
35
|
+
const packageJson = JSON.parse(packageContent);
|
|
36
|
+
if (PI_PACKAGE_NAMES.includes(packageJson.name)) {
|
|
37
|
+
return currentDir;
|
|
30
38
|
}
|
|
39
|
+
} catch {
|
|
40
|
+
// Continue searching
|
|
31
41
|
}
|
|
32
|
-
currentDir = path.dirname(currentDir);
|
|
33
42
|
}
|
|
43
|
+
currentDir = path.dirname(currentDir);
|
|
34
44
|
}
|
|
35
|
-
|
|
36
|
-
return null;
|
|
37
45
|
}
|
|
46
|
+
|
|
47
|
+
return null;
|
|
38
48
|
}
|
|
@@ -3,9 +3,9 @@ import type {
|
|
|
3
3
|
AgentToolResult,
|
|
4
4
|
ExtensionAPI,
|
|
5
5
|
Theme,
|
|
6
|
-
} from "@
|
|
7
|
-
import { defineTool, VERSION } from "@
|
|
8
|
-
import { Text } from "@
|
|
6
|
+
} from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { defineTool, VERSION } from "@earendil-works/pi-coding-agent";
|
|
8
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
9
9
|
import { type Static, Type } from "typebox";
|
|
10
10
|
|
|
11
11
|
const VersionParams = Type.Object({});
|
|
@@ -47,7 +47,11 @@ const versionTool = defineTool({
|
|
|
47
47
|
return renderVersionCall(args, theme);
|
|
48
48
|
},
|
|
49
49
|
|
|
50
|
-
renderResult(result,
|
|
50
|
+
renderResult(result, options, theme) {
|
|
51
|
+
if (options.isPartial) {
|
|
52
|
+
return new Text(theme.fg("dim", "Pi Version: loading..."), 0, 0);
|
|
53
|
+
}
|
|
54
|
+
|
|
51
55
|
const { details } = result;
|
|
52
56
|
|
|
53
57
|
if (!details?.version) {
|
package/src/index.ts
DELETED