@howaboua/pi-better-skills-tool 0.0.8 → 0.0.10
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 +8 -0
- package/README.md +1 -3
- package/biome.json +1 -1
- package/index.ts +28 -2
- package/package.json +8 -8
- package/src/catalog.ts +2 -1
- package/src/tool.ts +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @howaboua/pi-better-skills-tool
|
|
2
2
|
|
|
3
|
+
## 0.0.10
|
|
4
|
+
|
|
5
|
+
- Use consistent skill discovery across native, Code and Notebook modes, with compact help in PCC GPT prompt mode.
|
|
6
|
+
|
|
7
|
+
## 0.0.9
|
|
8
|
+
|
|
9
|
+
- Skills discovery and invalid-input errors now show the JavaScript string-call syntax.
|
|
10
|
+
|
|
3
11
|
## 0.0.8
|
|
4
12
|
|
|
5
13
|
- ### Improvements
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Progressive skill discovery for Pi, Code Mode and Notebook Mode. The `skills` to
|
|
|
8
8
|
pi install npm:@howaboua/pi-better-skills-tool
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Requires Pi 1.0.0 or newer. Install `@howaboua/pi-codex-conversion` 3.0.
|
|
11
|
+
Requires Pi 1.0.0 or newer. Install `@howaboua/pi-codex-conversion` 3.0.52 or newer too for Code Mode and Notebook Mode. The extension remains a normal Pi tool when Codex conversion is absent.
|
|
12
12
|
|
|
13
13
|
## Start Pi normally
|
|
14
14
|
|
|
@@ -38,5 +38,3 @@ Separate independent `read` or `list` commands with `;`. Each group resolves ref
|
|
|
38
38
|
Results stay within 48 KiB of UTF-8 text. Larger results include an `Incomplete` marker and an exact continuation command ending in `--offset <byte>`. Run that command to retrieve the next part. Continuations are stateless and re-read the catalog, so restart the original command if skill files change between calls. Normalized commands, excluding the offset suffix, are limited to 4 KiB to keep continuation instructions within the result budget.
|
|
39
39
|
|
|
40
40
|
Remove or disable any legacy `codex-conversion-custom-tools/skills.toml` after installing this extension. Keeping both definitions gives Code Mode two tools named `skills`, which it rejects.
|
|
41
|
-
|
|
42
|
-
The Code Mode surface is freeform because its input is already a compact routed command. It does not add a provider grammar. Code Mode's outer `exec` grammar remains the only constrained grammar involved.
|
package/biome.json
CHANGED
package/index.ts
CHANGED
|
@@ -35,8 +35,34 @@ export default async function skillsExtension(pi: ExtensionAPI): Promise<void> {
|
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
|
|
38
|
+
let gpt = false;
|
|
39
|
+
const tool = createSkillsTool({
|
|
40
|
+
getLoadedSkills: () => loadedSkills,
|
|
41
|
+
isGpt: () => gpt,
|
|
42
|
+
});
|
|
39
43
|
pi.registerTool(tool);
|
|
44
|
+
try {
|
|
45
|
+
const { registerGptPromptMode } = await import(
|
|
46
|
+
"@howaboua/pi-codex-conversion/prompt-mode"
|
|
47
|
+
);
|
|
48
|
+
registerGptPromptMode(pi, (active) => {
|
|
49
|
+
gpt = active;
|
|
50
|
+
return [tool];
|
|
51
|
+
});
|
|
52
|
+
} catch (error) {
|
|
53
|
+
if (
|
|
54
|
+
!(error instanceof Error) ||
|
|
55
|
+
!("code" in error) ||
|
|
56
|
+
![
|
|
57
|
+
"ERR_MODULE_NOT_FOUND",
|
|
58
|
+
"MODULE_NOT_FOUND",
|
|
59
|
+
"ERR_PACKAGE_PATH_NOT_EXPORTED",
|
|
60
|
+
].includes(String(error.code)) ||
|
|
61
|
+
!error.message.includes(CODE_MODE_PACKAGE)
|
|
62
|
+
)
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
|
|
40
66
|
const registration = await registerSkillsInCodeMode(pi, tool);
|
|
41
67
|
pi.on("session_shutdown", () => {
|
|
42
68
|
registration?.unregister();
|
|
@@ -56,7 +82,7 @@ async function registerSkillsInCodeMode(
|
|
|
56
82
|
adaptToolForCodeMode(tool, {
|
|
57
83
|
kind: "freeform",
|
|
58
84
|
prepareInput: prepareSkillsCodeModeInput,
|
|
59
|
-
|
|
85
|
+
discovery: "help",
|
|
60
86
|
}),
|
|
61
87
|
]);
|
|
62
88
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@howaboua/pi-better-skills-tool",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Progressive skill discovery for Pi, Code Mode and Notebook Mode.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"pack:dry": "npm pack --dry-run"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@howaboua/pi-codex-conversion": ">=
|
|
42
|
+
"@howaboua/pi-codex-conversion": ">=4.0.2",
|
|
43
43
|
"@earendil-works/pi-coding-agent": ">=1.0.0",
|
|
44
44
|
"@earendil-works/pi-tui": ">=1.0.0",
|
|
45
45
|
"typebox": "*"
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@howaboua/pi-codex-conversion": "
|
|
54
|
-
"@biomejs/biome": "^2.5.
|
|
55
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
56
|
-
"@earendil-works/pi-tui": "1.
|
|
57
|
-
"@types/node": "^26.
|
|
58
|
-
"typebox": "1.3.
|
|
53
|
+
"@howaboua/pi-codex-conversion": "4.0.2",
|
|
54
|
+
"@biomejs/biome": "^2.5.15",
|
|
55
|
+
"@earendil-works/pi-coding-agent": "1.3.0",
|
|
56
|
+
"@earendil-works/pi-tui": "1.3.0",
|
|
57
|
+
"@types/node": "^26.6.5",
|
|
58
|
+
"typebox": "1.3.37",
|
|
59
59
|
"typescript": "^7.0.2"
|
|
60
60
|
},
|
|
61
61
|
"pi": {
|
package/src/catalog.ts
CHANGED
|
@@ -159,6 +159,7 @@ export function runSkills(
|
|
|
159
159
|
? defaultSessionSkillsDir()
|
|
160
160
|
: undefined,
|
|
161
161
|
loadedSkills: readonly LoadedSkill[] = [],
|
|
162
|
+
gpt = false,
|
|
162
163
|
): string {
|
|
163
164
|
const request = parseRequest(input);
|
|
164
165
|
const skills = discoverVisibleSkills(globalRoot, sessionRoot, loadedSkills);
|
|
@@ -166,7 +167,7 @@ export function runSkills(
|
|
|
166
167
|
request.commands
|
|
167
168
|
.map((command) =>
|
|
168
169
|
command.action === "help"
|
|
169
|
-
?
|
|
170
|
+
? `${gpt ? 'list [category...] | read <skill> [skill-or-reference...] | help; separator ;\nJS: tools.skills("read <skill>")' : 'Commands: list [category...] | read <skill> [skill-or-reference...] | help. Join commands with ;\nJS: tools.skills("read <skill>")'}\n\n${formatSkillList(skills)}`
|
|
170
171
|
: command.action === "list"
|
|
171
172
|
? formatSkillList(skills, command.categories)
|
|
172
173
|
: readSkillPackage(skills, command.name, command.selectors),
|
package/src/tool.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
const SkillsParameters = Type.Object(
|
|
12
12
|
{
|
|
13
|
-
command: Type.Optional(Type.String({ description: "
|
|
13
|
+
command: Type.Optional(Type.String({ description: "help, list or read" })),
|
|
14
14
|
},
|
|
15
15
|
{ additionalProperties: false },
|
|
16
16
|
);
|
|
@@ -18,6 +18,7 @@ const SkillsParameters = Type.Object(
|
|
|
18
18
|
type SkillsParameters = Static<typeof SkillsParameters>;
|
|
19
19
|
|
|
20
20
|
export interface SkillsToolOptions {
|
|
21
|
+
isGpt?(): boolean;
|
|
21
22
|
globalRoot?: string;
|
|
22
23
|
getLoadedSkills?(): readonly LoadedSkill[];
|
|
23
24
|
}
|
|
@@ -25,7 +26,7 @@ export interface SkillsToolOptions {
|
|
|
25
26
|
export function prepareSkillsCodeModeInput(input: unknown): SkillsParameters {
|
|
26
27
|
if (input === undefined) return {};
|
|
27
28
|
if (typeof input !== "string")
|
|
28
|
-
throw new Error(
|
|
29
|
+
throw new Error('Expected string: tools.skills("read <skill>")');
|
|
29
30
|
return { command: input };
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -44,6 +45,7 @@ export function createSkillsTool(options: SkillsToolOptions = {}) {
|
|
|
44
45
|
options.globalRoot ?? defaultSkillsDir(),
|
|
45
46
|
defaultSessionSkillsDir(ctx.cwd),
|
|
46
47
|
options.getLoadedSkills?.() ?? [],
|
|
48
|
+
options.isGpt?.() ?? false,
|
|
47
49
|
);
|
|
48
50
|
return {
|
|
49
51
|
content: [{ type: "text", text: output }],
|