@inkeep/agents-cli 0.0.0-dev-20260212005842 ā 0.0.0-dev-20260212021905
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/commands/pull-v3/components/project-generator.js +16 -4
- package/dist/commands/pull-v3/components/skill-generator.js +23 -0
- package/dist/commands/pull-v3/components/sub-agent-generator.js +10 -0
- package/dist/commands/pull-v3/index.js +6 -1
- package/dist/commands/pull-v3/new-component-generator.js +2 -1
- package/dist/commands/pull-v3/utils/component-registry.js +1 -0
- package/package.json +4 -4
|
@@ -20,6 +20,7 @@ function generateProjectDefinition(projectId, projectData, style = DEFAULT_STYLE
|
|
|
20
20
|
lines.push(`${indentation}name: ${formatString(projectData.name, q)},`);
|
|
21
21
|
if (shouldInclude(projectData.description)) lines.push(`${indentation}description: ${formatString(projectData.description, q, true)},`);
|
|
22
22
|
if (shouldInclude(projectData.models)) lines.push(`${indentation}models: ${formatObject(projectData.models, style, 2)},`);
|
|
23
|
+
if (shouldInclude(projectData.skills)) lines.push(`${indentation}skills: () => loadSkills(path.join(${formatString(projectId, q)}, 'skills')),`);
|
|
23
24
|
if (shouldInclude(projectData.stopWhen)) {
|
|
24
25
|
lines.push(`${indentation}stopWhen: {`);
|
|
25
26
|
if (projectData.stopWhen.transferCountIs !== void 0) lines.push(`${indentation}${indentation}transferCountIs: ${projectData.stopWhen.transferCountIs}, // Max transfers for agents`);
|
|
@@ -64,7 +65,14 @@ function generateProjectDefinition(projectId, projectData, style = DEFAULT_STYLE
|
|
|
64
65
|
*/
|
|
65
66
|
function generateProjectImports(projectData, style = DEFAULT_STYLE, registry) {
|
|
66
67
|
const imports = [];
|
|
67
|
-
|
|
68
|
+
const sdkImports = ["project"];
|
|
69
|
+
if (shouldInclude(projectData.skills)) sdkImports.push("loadSkills");
|
|
70
|
+
imports.push(generateImport(sdkImports, "@inkeep/agents-sdk", style));
|
|
71
|
+
if (shouldInclude(projectData.skills)) {
|
|
72
|
+
const q = style.quotes === "single" ? "'" : "\"";
|
|
73
|
+
const semi = style.semicolons ? ";" : "";
|
|
74
|
+
imports.push(`import path from ${q}node:path${q}${semi}`);
|
|
75
|
+
}
|
|
68
76
|
if (registry) {
|
|
69
77
|
const currentFilePath = "index.ts";
|
|
70
78
|
const referencedComponents = [];
|
|
@@ -83,8 +91,8 @@ function generateProjectImports(projectData, style = DEFAULT_STYLE, registry) {
|
|
|
83
91
|
else if (typeof projectData.tools === "object") toolIds = Object.keys(projectData.tools);
|
|
84
92
|
for (const toolId of toolIds) {
|
|
85
93
|
let componentType = "tools";
|
|
86
|
-
if (registry
|
|
87
|
-
else if (registry
|
|
94
|
+
if (registry.get(toolId, "functionTools")) componentType = "functionTools";
|
|
95
|
+
else if (registry.get(toolId, "tools")) componentType = "tools";
|
|
88
96
|
referencedComponents.push({
|
|
89
97
|
id: toolId,
|
|
90
98
|
type: componentType
|
|
@@ -138,7 +146,11 @@ function generateProjectImports(projectData, style = DEFAULT_STYLE, registry) {
|
|
|
138
146
|
* Generate complete project file (imports + definition)
|
|
139
147
|
*/
|
|
140
148
|
function generateProjectFile(projectId, projectData, style = DEFAULT_STYLE, registry) {
|
|
141
|
-
|
|
149
|
+
const imports = generateProjectImports(projectData, style, registry);
|
|
150
|
+
const definition = generateProjectDefinition(projectId, projectData, style, registry);
|
|
151
|
+
const definitions = [];
|
|
152
|
+
definitions.push(definition);
|
|
153
|
+
return generateFileContent(imports, definitions);
|
|
142
154
|
}
|
|
143
155
|
|
|
144
156
|
//#endregion
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { stringify } from "yaml";
|
|
3
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
4
|
+
|
|
5
|
+
//#region src/commands/pull-v3/components/skill-generator.ts
|
|
6
|
+
function formatMetadata(metadata) {
|
|
7
|
+
return `metadata:\n${stringify(metadata).split("\n").filter((line) => line.trim() !== "").map((line) => ` ${line}`).join("\n")}`;
|
|
8
|
+
}
|
|
9
|
+
async function generateSkills(skills, skillsDir) {
|
|
10
|
+
await mkdir(skillsDir, { recursive: true });
|
|
11
|
+
for (const [skillId, skill] of Object.entries(skills)) {
|
|
12
|
+
const parts = ["---", `name: ${JSON.stringify(skill.name)}`];
|
|
13
|
+
parts.push(`description: ${JSON.stringify(skill.description ?? "")}`);
|
|
14
|
+
if (skill.metadata && Object.keys(skill.metadata).length > 0) parts.push(formatMetadata(skill.metadata));
|
|
15
|
+
parts.push("---", "", skill.content || "");
|
|
16
|
+
const skillDir = join(skillsDir, skillId);
|
|
17
|
+
await mkdir(skillDir, { recursive: true });
|
|
18
|
+
await writeFile(join(skillDir, "SKILL.md"), parts.join("\n"), "utf8");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { generateSkills };
|
|
@@ -94,6 +94,16 @@ function generateSubAgentDefinition(agentId, agentData, style = DEFAULT_STYLE, r
|
|
|
94
94
|
removeTrailingComma(lines);
|
|
95
95
|
lines.push(`${indentation}},`);
|
|
96
96
|
}
|
|
97
|
+
if (Array.isArray(agentData.skills) && agentData.skills.length) {
|
|
98
|
+
lines.push(`${indentation}skills: () => [`);
|
|
99
|
+
for (const skill of agentData.skills) {
|
|
100
|
+
const parts = [`id: ${formatString(skill.id, q)}`];
|
|
101
|
+
parts.push(`index: ${skill.index}`);
|
|
102
|
+
if (skill.alwaysLoaded) parts.push(`alwaysLoaded: ${skill.alwaysLoaded}`);
|
|
103
|
+
lines.push(`${indentation}${indentation}{ ${parts.join(", ")} },`);
|
|
104
|
+
}
|
|
105
|
+
lines.push(`${indentation}],`);
|
|
106
|
+
}
|
|
97
107
|
if (agentData.canUse && Array.isArray(agentData.canUse) && agentData.canUse.length > 0) {
|
|
98
108
|
const toolReferences = [];
|
|
99
109
|
if (!registry) throw new Error("Registry is required for canUse generation");
|
|
@@ -48,7 +48,8 @@ function createProjectStructure(projectDir) {
|
|
|
48
48
|
environmentsDir: join(projectRoot, "environments"),
|
|
49
49
|
credentialsDir: join(projectRoot, "credentials"),
|
|
50
50
|
contextConfigsDir: join(projectRoot, "context-configs"),
|
|
51
|
-
externalAgentsDir: join(projectRoot, "external-agents")
|
|
51
|
+
externalAgentsDir: join(projectRoot, "external-agents"),
|
|
52
|
+
skillsDir: join(projectRoot, "skills")
|
|
52
53
|
};
|
|
53
54
|
Object.values(paths).forEach((dir) => {
|
|
54
55
|
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
@@ -229,6 +230,10 @@ async function pullV3Command(options) {
|
|
|
229
230
|
return;
|
|
230
231
|
}
|
|
231
232
|
const paths = createProjectStructure(projectDir);
|
|
233
|
+
if (remoteProject.skills && Object.keys(remoteProject.skills).length) {
|
|
234
|
+
const { generateSkills } = await import("./components/skill-generator.js");
|
|
235
|
+
await generateSkills(remoteProject.skills, paths.skillsDir);
|
|
236
|
+
}
|
|
232
237
|
if (options.introspect) {
|
|
233
238
|
console.log(chalk.yellow("\nš Introspect mode: Regenerating all files from scratch"));
|
|
234
239
|
s.start("Generating all files deterministically...");
|
|
@@ -98,7 +98,8 @@ async function createNewComponents(comparison, remoteProject, localRegistry, pat
|
|
|
98
98
|
environmentsDir: join(paths.projectRoot, tempDirName, "environments"),
|
|
99
99
|
credentialsDir: join(paths.projectRoot, tempDirName, "credentials"),
|
|
100
100
|
contextConfigsDir: join(paths.projectRoot, tempDirName, "context-configs"),
|
|
101
|
-
externalAgentsDir: join(paths.projectRoot, tempDirName, "external-agents")
|
|
101
|
+
externalAgentsDir: join(paths.projectRoot, tempDirName, "external-agents"),
|
|
102
|
+
skillsDir: join(paths.projectRoot, tempDirName, "skills")
|
|
102
103
|
} : paths;
|
|
103
104
|
const actionText = tempDirName ? "Creating component files in temp directory..." : "Creating new component files...";
|
|
104
105
|
console.log(chalk.cyan(`\nš ${actionText}`));
|
|
@@ -293,6 +293,7 @@ function registerAllComponents(project, registry) {
|
|
|
293
293
|
if (project.dataComponents) for (const componentId of Object.keys(project.dataComponents)) registry.register(componentId, "dataComponents", `data-components/${componentId}.ts`);
|
|
294
294
|
if (project.artifactComponents) for (const componentId of Object.keys(project.artifactComponents)) registry.register(componentId, "artifactComponents", `artifact-components/${componentId}.ts`);
|
|
295
295
|
if (project.externalAgents) for (const extAgentId of Object.keys(project.externalAgents)) registry.register(extAgentId, "externalAgents", `external-agents/${extAgentId}.ts`);
|
|
296
|
+
if (project.skills) for (const skillId of Object.keys(project.skills)) registry.register(skillId, "skills", `skills/${skillId}.md`);
|
|
296
297
|
const statusComponents = extractStatusComponents(project);
|
|
297
298
|
for (const statusId of Object.keys(statusComponents)) registry.register(statusId, "statusComponents", `status-components/${statusId}.ts`);
|
|
298
299
|
if (project.agents) for (const agentId of Object.keys(project.agents)) registry.register(agentId, "agents", `agents/${agentId}.ts`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-cli",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260212021905",
|
|
4
4
|
"description": "Inkeep CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"tsx": "^4.20.5",
|
|
41
41
|
"yaml": "^2.7.0",
|
|
42
42
|
"zod": "^4.3.6",
|
|
43
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
44
|
-
"@inkeep/agents-sdk": "^0.0.0-dev-
|
|
43
|
+
"@inkeep/agents-core": "^0.0.0-dev-20260212021905",
|
|
44
|
+
"@inkeep/agents-sdk": "^0.0.0-dev-20260212021905"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/degit": "^2.8.6",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"vitest": "^3.2.4"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@inkeep/agents-manage-ui": "0.0.0-dev-
|
|
55
|
+
"@inkeep/agents-manage-ui": "0.0.0-dev-20260212021905"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public",
|