poe-code 3.0.389 → 3.0.390
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/dist/cli/commands/skill.js +96 -1
- package/dist/cli/commands/skill.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2606 -2455
- package/dist/index.js.map +4 -4
- package/dist/metafile.json +1 -1
- package/dist/skills.d.ts +49 -0
- package/dist/skills.js +59 -0
- package/dist/skills.js.map +1 -0
- package/package.json +5 -1
package/dist/skills.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Stats } from "node:fs";
|
|
2
|
+
import { type InstallSkillResult, type SkillScope } from "../packages/agent-skill-config/dist/index.js";
|
|
3
|
+
export interface InstallSkillFileSystem {
|
|
4
|
+
readFile(path: string, encoding: BufferEncoding): Promise<string>;
|
|
5
|
+
readFile(path: string): Promise<Buffer>;
|
|
6
|
+
symlink(target: string, path: string): Promise<void>;
|
|
7
|
+
readlink(path: string): Promise<string>;
|
|
8
|
+
realpath(path: string): Promise<string>;
|
|
9
|
+
writeFile(path: string, data: string | NodeJS.ArrayBufferView, options?: {
|
|
10
|
+
encoding?: BufferEncoding;
|
|
11
|
+
flag?: string;
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
mkdir(path: string, options?: {
|
|
14
|
+
recursive?: boolean;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
stat(path: string): Promise<Stats>;
|
|
17
|
+
lstat(path: string): Promise<Stats>;
|
|
18
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
19
|
+
rm?(path: string, options?: {
|
|
20
|
+
recursive?: boolean;
|
|
21
|
+
force?: boolean;
|
|
22
|
+
}): Promise<void>;
|
|
23
|
+
unlink(path: string): Promise<void>;
|
|
24
|
+
readdir(path: string): Promise<string[]>;
|
|
25
|
+
copyFile?(src: string, dest: string): Promise<void>;
|
|
26
|
+
chmod?(path: string, mode: number): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export type InstallSkillSource = {
|
|
29
|
+
name: string;
|
|
30
|
+
content: string;
|
|
31
|
+
} | {
|
|
32
|
+
name: string;
|
|
33
|
+
file: string;
|
|
34
|
+
};
|
|
35
|
+
export interface InstallSkillOptions {
|
|
36
|
+
cwd?: string;
|
|
37
|
+
homeDir?: string;
|
|
38
|
+
scope?: SkillScope;
|
|
39
|
+
dryRun?: boolean;
|
|
40
|
+
fs?: InstallSkillFileSystem;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Install arbitrary skill content into an agent's native skill directory.
|
|
44
|
+
*
|
|
45
|
+
* The actual mutation and validation are delegated to poe-code's agent skill
|
|
46
|
+
* configuration machinery, so SDK and CLI installs share the same safety rules.
|
|
47
|
+
*/
|
|
48
|
+
export declare function installSkill(agentId: string, source: InstallSkillSource, options?: InstallSkillOptions): Promise<InstallSkillResult>;
|
|
49
|
+
export type { InstallSkillResult, SkillScope };
|
package/dist/skills.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import * as os from "node:os";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { installSkill as installAgentSkill } from "@poe-code/agent-skill-config";
|
|
5
|
+
function createNodeFileSystem() {
|
|
6
|
+
return {
|
|
7
|
+
readFile: ((filePath, encoding) => {
|
|
8
|
+
if (encoding) {
|
|
9
|
+
return fs.readFile(filePath, encoding);
|
|
10
|
+
}
|
|
11
|
+
return fs.readFile(filePath);
|
|
12
|
+
}),
|
|
13
|
+
symlink: (target, filePath) => fs.symlink(target, filePath),
|
|
14
|
+
readlink: (filePath) => fs.readlink(filePath, { encoding: "utf8" }),
|
|
15
|
+
realpath: (filePath) => fs.realpath(filePath),
|
|
16
|
+
writeFile: (filePath, data, options) => fs.writeFile(filePath, data, options),
|
|
17
|
+
mkdir: (filePath, options) => fs.mkdir(filePath, options).then(() => { }),
|
|
18
|
+
stat: (filePath) => fs.stat(filePath),
|
|
19
|
+
lstat: (filePath) => fs.lstat(filePath),
|
|
20
|
+
rename: (oldPath, newPath) => fs.rename(oldPath, newPath),
|
|
21
|
+
rm: (filePath, options) => fs.rm(filePath, options),
|
|
22
|
+
unlink: (filePath) => fs.unlink(filePath),
|
|
23
|
+
readdir: (filePath) => fs.readdir(filePath),
|
|
24
|
+
copyFile: (src, dest) => fs.copyFile(src, dest),
|
|
25
|
+
chmod: (filePath, mode) => fs.chmod(filePath, mode)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
async function resolveSkillContent(source, options) {
|
|
29
|
+
if ("content" in source) {
|
|
30
|
+
return source.content;
|
|
31
|
+
}
|
|
32
|
+
const sourcePath = path.isAbsolute(source.file)
|
|
33
|
+
? source.file
|
|
34
|
+
: path.resolve(options.cwd, source.file);
|
|
35
|
+
return options.fs.readFile(sourcePath, "utf8");
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Install arbitrary skill content into an agent's native skill directory.
|
|
39
|
+
*
|
|
40
|
+
* The actual mutation and validation are delegated to poe-code's agent skill
|
|
41
|
+
* configuration machinery, so SDK and CLI installs share the same safety rules.
|
|
42
|
+
*/
|
|
43
|
+
export async function installSkill(agentId, source, options = {}) {
|
|
44
|
+
const cwd = options.cwd ?? process.cwd();
|
|
45
|
+
const homeDir = options.homeDir ?? os.homedir();
|
|
46
|
+
const fileSystem = options.fs ?? createNodeFileSystem();
|
|
47
|
+
const content = await resolveSkillContent(source, { cwd, fs: fileSystem });
|
|
48
|
+
return installAgentSkill(agentId, {
|
|
49
|
+
name: source.name,
|
|
50
|
+
content
|
|
51
|
+
}, {
|
|
52
|
+
fs: fileSystem,
|
|
53
|
+
cwd,
|
|
54
|
+
homeDir,
|
|
55
|
+
scope: options.scope ?? "local",
|
|
56
|
+
dryRun: options.dryRun
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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OAAe,EACf,MAA0B,EAC1B,UAA+B,EAAE;IAEjC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACzC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IAChD,MAAM,UAAU,GAAG,OAAO,CAAC,EAAE,IAAI,oBAAoB,EAAE,CAAC;IACxD,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAE3E,OAAO,iBAAiB,CACtB,OAAO,EACP;QACE,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO;KACR,EACD;QACE,EAAE,EAAE,UAAU;QACd,GAAG;QACH,OAAO;QACP,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,OAAO;QAC/B,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poe-code",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.390",
|
|
4
4
|
"description": "CLI tool to configure Poe API for developer workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"./agent": {
|
|
18
18
|
"types": "./dist/agent.d.ts",
|
|
19
19
|
"import": "./dist/agent.js"
|
|
20
|
+
},
|
|
21
|
+
"./skills": {
|
|
22
|
+
"types": "./dist/skills.d.ts",
|
|
23
|
+
"import": "./dist/skills.js"
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
26
|
"workspaces": [
|