@inkeep/agents-cli 0.51.0 → 0.53.0
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/agents-cli/package.js +6 -0
- package/dist/commands/config.js +1 -1
- package/dist/commands/dev.js +1 -1
- package/dist/commands/init.js +1 -1
- package/dist/commands/{pull-v3 → pull-v4}/component-parser.js +6 -12
- package/dist/commands/{pull-v3/utils → pull-v4}/component-registry.js +1 -1
- package/dist/commands/pull-v4/generators/agent-generator.js +258 -0
- package/dist/commands/pull-v4/generators/artifact-component-generator.js +69 -0
- package/dist/commands/pull-v4/generators/context-config-generator.js +264 -0
- package/dist/commands/pull-v4/generators/credential-generator.js +30 -0
- package/dist/commands/pull-v4/generators/data-component-generator.js +50 -0
- package/dist/commands/pull-v4/generators/environment-generator.js +123 -0
- package/dist/commands/pull-v4/generators/external-agent-generator.js +56 -0
- package/dist/commands/pull-v4/generators/function-tool-generator.js +48 -0
- package/dist/commands/pull-v4/generators/mcp-tool-generator.js +91 -0
- package/dist/commands/pull-v4/generators/project-generator.js +125 -0
- package/dist/commands/{pull-v3/components → pull-v4/generators}/skill-generator.js +1 -1
- package/dist/commands/pull-v4/generators/status-component-generator.js +35 -0
- package/dist/commands/pull-v4/generators/sub-agent-generator.js +269 -0
- package/dist/commands/pull-v4/generators/trigger-generator.js +58 -0
- package/dist/commands/pull-v4/introspect/index.js +365 -0
- package/dist/commands/pull-v4/introspect/test-helpers.js +143 -0
- package/dist/commands/pull-v4/introspect-generator.js +706 -0
- package/dist/commands/pull-v4/module-merge.js +405 -0
- package/dist/commands/pull-v4/utils.js +235 -0
- package/dist/commands/push.js +1 -1
- package/dist/commands/update.js +2 -2
- package/dist/index.js +18 -44
- package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/array.js +18 -0
- package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/base.js +180 -0
- package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/character.js +8 -0
- package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/css.js +12 -0
- package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/json.js +60 -0
- package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/line.js +37 -0
- package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/sentence.js +31 -0
- package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/word.js +118 -0
- package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/index.js +11 -0
- package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/patch/create.js +141 -0
- package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/util/string.js +63 -0
- package/dist/utils/ci-environment.js +1 -1
- package/dist/utils/config.js +1 -1
- package/dist/utils/environment-loader.js +1 -1
- package/dist/utils/file-finder.js +1 -1
- package/dist/utils/mcp-runner.js +1 -1
- package/dist/utils/profile-config.js +1 -1
- package/dist/utils/profiles/profile-manager.js +1 -1
- package/dist/utils/project-directory.js +1 -1
- package/dist/utils/project-loader.js +1 -1
- package/dist/utils/version-check.js +6 -15
- package/package.json +5 -7
- package/dist/commands/pull-v3/component-updater.js +0 -768
- package/dist/commands/pull-v3/components/agent-generator.js +0 -255
- package/dist/commands/pull-v3/components/artifact-component-generator.js +0 -143
- package/dist/commands/pull-v3/components/context-config-generator.js +0 -190
- package/dist/commands/pull-v3/components/credential-generator.js +0 -89
- package/dist/commands/pull-v3/components/data-component-generator.js +0 -102
- package/dist/commands/pull-v3/components/environment-generator.js +0 -173
- package/dist/commands/pull-v3/components/external-agent-generator.js +0 -75
- package/dist/commands/pull-v3/components/function-tool-generator.js +0 -92
- package/dist/commands/pull-v3/components/mcp-tool-generator.js +0 -86
- package/dist/commands/pull-v3/components/project-generator.js +0 -157
- package/dist/commands/pull-v3/components/status-component-generator.js +0 -92
- package/dist/commands/pull-v3/components/sub-agent-generator.js +0 -295
- package/dist/commands/pull-v3/components/trigger-generator.js +0 -185
- package/dist/commands/pull-v3/index.js +0 -510
- package/dist/commands/pull-v3/introspect-generator.js +0 -286
- package/dist/commands/pull-v3/llm-content-merger.js +0 -192
- package/dist/commands/pull-v3/new-component-generator.js +0 -279
- package/dist/commands/pull-v3/project-comparator.js +0 -914
- package/dist/commands/pull-v3/project-index-generator.js +0 -32
- package/dist/commands/pull-v3/project-validator.js +0 -358
- package/dist/commands/pull-v3/targeted-typescript-placeholders.js +0 -173
- package/dist/commands/pull-v3/utils/component-tracker.js +0 -165
- package/dist/commands/pull-v3/utils/generator-utils.js +0 -146
- package/dist/commands/pull-v3/utils/model-provider-detector.js +0 -50
- package/dist/utils/url.js +0 -26
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import { toCamelCase } from "./utils/generator-utils.js";
|
|
2
|
-
import { generateAgentFile } from "./components/agent-generator.js";
|
|
3
|
-
import { generateArtifactComponentFile } from "./components/artifact-component-generator.js";
|
|
4
|
-
import { generateContextConfigFile } from "./components/context-config-generator.js";
|
|
5
|
-
import { generateCredentialFile } from "./components/credential-generator.js";
|
|
6
|
-
import { generateDataComponentFile } from "./components/data-component-generator.js";
|
|
7
|
-
import { generateEnvironmentFile } from "./components/environment-generator.js";
|
|
8
|
-
import { generateExternalAgentFile } from "./components/external-agent-generator.js";
|
|
9
|
-
import { generateFunctionToolFile } from "./components/function-tool-generator.js";
|
|
10
|
-
import { generateMcpToolFile } from "./components/mcp-tool-generator.js";
|
|
11
|
-
import { generateStatusComponentFile } from "./components/status-component-generator.js";
|
|
12
|
-
import { generateSubAgentFile } from "./components/sub-agent-generator.js";
|
|
13
|
-
import { findSubAgentWithParent } from "./utils/component-registry.js";
|
|
14
|
-
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
15
|
-
import { dirname, join } from "node:path";
|
|
16
|
-
import chalk from "chalk";
|
|
17
|
-
|
|
18
|
-
//#region src/commands/pull-v3/new-component-generator.ts
|
|
19
|
-
/**
|
|
20
|
-
* New Component Generator - Create brand new files for components that don't exist
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Convert component ID to kebab-case filename
|
|
24
|
-
*/
|
|
25
|
-
function toKebabCase(id) {
|
|
26
|
-
return id.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase().replace(/[_]/g, "-");
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Determine file path for new component based on type and existing structure
|
|
30
|
-
*/
|
|
31
|
-
function determineNewFilePath(componentType, componentId, paths) {
|
|
32
|
-
const fileName = `${toKebabCase(componentId)}.ts`;
|
|
33
|
-
switch (componentType) {
|
|
34
|
-
case "agents": return join(paths.agentsDir, fileName);
|
|
35
|
-
case "tools": return join(paths.toolsDir, fileName);
|
|
36
|
-
case "dataComponents": return join(paths.dataComponentsDir, fileName);
|
|
37
|
-
case "artifactComponents": return join(paths.artifactComponentsDir, fileName);
|
|
38
|
-
case "statusComponents": return join(paths.statusComponentsDir, fileName);
|
|
39
|
-
case "environments": return join(paths.environmentsDir, `${toKebabCase(componentId)}.env.ts`);
|
|
40
|
-
case "subAgents": return join(paths.agentsDir, "sub-agents", fileName);
|
|
41
|
-
case "externalAgents": return join(paths.externalAgentsDir, fileName);
|
|
42
|
-
case "functions":
|
|
43
|
-
case "functionTools": return join(join(paths.toolsDir, "functions"), fileName);
|
|
44
|
-
case "credentials": return join(paths.credentialsDir, fileName);
|
|
45
|
-
case "contextConfigs": return join(paths.contextConfigsDir, fileName);
|
|
46
|
-
default: throw new Error(`Unknown component type for new file: ${componentType}`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Generate component content using appropriate generator
|
|
51
|
-
*/
|
|
52
|
-
function generateComponentContent(componentType, componentId, componentData, componentRegistry) {
|
|
53
|
-
const defaultStyle = {
|
|
54
|
-
quotes: "single",
|
|
55
|
-
indentation: " ",
|
|
56
|
-
semicolons: true
|
|
57
|
-
};
|
|
58
|
-
switch (componentType) {
|
|
59
|
-
case "agents": return generateAgentFile(componentId, componentData, defaultStyle, componentRegistry);
|
|
60
|
-
case "subAgents": {
|
|
61
|
-
const parentAgentId = componentData._parentAgentId;
|
|
62
|
-
const contextConfigData = componentData._contextConfigData;
|
|
63
|
-
const cleanComponentData = { ...componentData };
|
|
64
|
-
delete cleanComponentData._parentAgentId;
|
|
65
|
-
delete cleanComponentData._contextConfigData;
|
|
66
|
-
return generateSubAgentFile(componentId, cleanComponentData, defaultStyle, componentRegistry, parentAgentId, contextConfigData);
|
|
67
|
-
}
|
|
68
|
-
case "tools": return generateMcpToolFile(componentId, componentData, defaultStyle, componentRegistry);
|
|
69
|
-
case "dataComponents": return generateDataComponentFile(componentId, componentData, defaultStyle);
|
|
70
|
-
case "artifactComponents": return generateArtifactComponentFile(componentId, componentData, defaultStyle);
|
|
71
|
-
case "statusComponents": return generateStatusComponentFile(componentId, componentData, defaultStyle);
|
|
72
|
-
case "environments": return generateEnvironmentFile(componentId, componentData, defaultStyle, componentRegistry);
|
|
73
|
-
case "externalAgents": return generateExternalAgentFile(componentId, componentData, defaultStyle, componentRegistry);
|
|
74
|
-
case "functions":
|
|
75
|
-
case "functionTools": return generateFunctionToolFile(componentId, componentData, defaultStyle);
|
|
76
|
-
case "credentials": return generateCredentialFile(componentId, componentData, defaultStyle);
|
|
77
|
-
case "contextConfigs": {
|
|
78
|
-
const cleanComponentData = { ...componentData };
|
|
79
|
-
delete cleanComponentData._agentId;
|
|
80
|
-
return generateContextConfigFile(componentId, cleanComponentData, defaultStyle, componentRegistry);
|
|
81
|
-
}
|
|
82
|
-
default: throw new Error(`No generator for component type: ${componentType}`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Create new component files for components that don't exist locally
|
|
87
|
-
*/
|
|
88
|
-
async function createNewComponents(comparison, remoteProject, localRegistry, paths, environment, tempDirName) {
|
|
89
|
-
const results = [];
|
|
90
|
-
if (!comparison.hasChanges) return results;
|
|
91
|
-
const targetPaths = tempDirName ? {
|
|
92
|
-
projectRoot: join(paths.projectRoot, tempDirName),
|
|
93
|
-
agentsDir: join(paths.projectRoot, tempDirName, "agents"),
|
|
94
|
-
toolsDir: join(paths.projectRoot, tempDirName, "tools"),
|
|
95
|
-
dataComponentsDir: join(paths.projectRoot, tempDirName, "data-components"),
|
|
96
|
-
artifactComponentsDir: join(paths.projectRoot, tempDirName, "artifact-components"),
|
|
97
|
-
statusComponentsDir: join(paths.projectRoot, tempDirName, "status-components"),
|
|
98
|
-
environmentsDir: join(paths.projectRoot, tempDirName, "environments"),
|
|
99
|
-
credentialsDir: join(paths.projectRoot, tempDirName, "credentials"),
|
|
100
|
-
contextConfigsDir: join(paths.projectRoot, tempDirName, "context-configs"),
|
|
101
|
-
externalAgentsDir: join(paths.projectRoot, tempDirName, "external-agents"),
|
|
102
|
-
skillsDir: join(paths.projectRoot, tempDirName, "skills")
|
|
103
|
-
} : paths;
|
|
104
|
-
const actionText = tempDirName ? "Creating component files in temp directory..." : "Creating new component files...";
|
|
105
|
-
console.log(chalk.cyan(`\n🆕 ${actionText}`));
|
|
106
|
-
if (!comparison.componentChanges.environments?.added.includes(environment)) {
|
|
107
|
-
if (!comparison.componentChanges.environments) comparison.componentChanges.environments = {
|
|
108
|
-
added: [],
|
|
109
|
-
modified: [],
|
|
110
|
-
deleted: []
|
|
111
|
-
};
|
|
112
|
-
comparison.componentChanges.environments.added.push(environment);
|
|
113
|
-
}
|
|
114
|
-
const creationOrder = [
|
|
115
|
-
"credentials",
|
|
116
|
-
"environments",
|
|
117
|
-
"contextConfigs",
|
|
118
|
-
"functionTools",
|
|
119
|
-
"functions",
|
|
120
|
-
"tools",
|
|
121
|
-
"dataComponents",
|
|
122
|
-
"artifactComponents",
|
|
123
|
-
"statusComponents",
|
|
124
|
-
"externalAgents",
|
|
125
|
-
"subAgents",
|
|
126
|
-
"agents"
|
|
127
|
-
];
|
|
128
|
-
console.log(chalk.cyan("📝 Registering all new components in registry..."));
|
|
129
|
-
for (const componentType of creationOrder) {
|
|
130
|
-
const changes = comparison.componentChanges[componentType];
|
|
131
|
-
if (!changes) continue;
|
|
132
|
-
const addedComponents = changes.added || [];
|
|
133
|
-
for (const componentId of addedComponents) {
|
|
134
|
-
if (localRegistry.get(componentId, componentType)) continue;
|
|
135
|
-
const relativePath = determineNewFilePath(componentType, componentId, targetPaths).replace(`${tempDirName ? targetPaths.projectRoot : paths.projectRoot}/`, "");
|
|
136
|
-
let explicitVariableName;
|
|
137
|
-
if (componentType === "contextConfigs") {
|
|
138
|
-
const contextResult = findContextConfigData(remoteProject, componentId);
|
|
139
|
-
if (contextResult) explicitVariableName = `${toCamelCase(contextResult.agentId)}Context`;
|
|
140
|
-
}
|
|
141
|
-
localRegistry.register(componentId, componentType, relativePath, explicitVariableName, false);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
console.log(chalk.cyan("🔨 Generating component files..."));
|
|
145
|
-
for (const componentType of creationOrder) {
|
|
146
|
-
const changes = comparison.componentChanges[componentType];
|
|
147
|
-
if (!changes) continue;
|
|
148
|
-
const addedComponents = changes.added || [];
|
|
149
|
-
if (addedComponents.length === 0) continue;
|
|
150
|
-
const remoteComponents = remoteProject[componentType] || {};
|
|
151
|
-
for (const componentId of addedComponents) try {
|
|
152
|
-
const filePath = determineNewFilePath(componentType, componentId, targetPaths);
|
|
153
|
-
if (existsSync(filePath)) continue;
|
|
154
|
-
let componentData = null;
|
|
155
|
-
if (componentType === "statusComponents") componentData = findStatusComponentData(remoteProject, componentId);
|
|
156
|
-
else if (componentType === "credentials") componentData = remoteProject.credentialReferences?.[componentId];
|
|
157
|
-
else if (componentType === "contextConfigs") {
|
|
158
|
-
const contextResult = findContextConfigData(remoteProject, componentId);
|
|
159
|
-
if (contextResult) {
|
|
160
|
-
componentData = contextResult.contextConfig;
|
|
161
|
-
componentData._agentId = contextResult.agentId;
|
|
162
|
-
}
|
|
163
|
-
} else if (componentType === "functions") componentData = remoteProject.functions?.[componentId];
|
|
164
|
-
else if (componentType === "functionTools") {
|
|
165
|
-
const functionToolData = remoteProject.functionTools?.[componentId] || remoteProject.functions?.[componentId];
|
|
166
|
-
if (functionToolData && "functionId" in functionToolData && functionToolData.functionId && remoteProject.functions?.[functionToolData.functionId]) componentData = {
|
|
167
|
-
...remoteProject.functions[functionToolData.functionId],
|
|
168
|
-
...functionToolData
|
|
169
|
-
};
|
|
170
|
-
else componentData = functionToolData;
|
|
171
|
-
} else if (componentType === "subAgents") {
|
|
172
|
-
const subAgentInfo = findSubAgentWithParent(remoteProject, componentId);
|
|
173
|
-
if (subAgentInfo) {
|
|
174
|
-
componentData = subAgentInfo.subAgentData;
|
|
175
|
-
componentData._parentAgentId = subAgentInfo.parentAgentId;
|
|
176
|
-
componentData._contextConfigData = subAgentInfo.contextConfigData;
|
|
177
|
-
} else componentData = null;
|
|
178
|
-
} else if (componentType === "environments") componentData = {
|
|
179
|
-
name: `${componentId} Environment`,
|
|
180
|
-
description: `Environment configuration for ${componentId}`,
|
|
181
|
-
credentials: remoteProject.credentialReferences ? Object.keys(remoteProject.credentialReferences) : []
|
|
182
|
-
};
|
|
183
|
-
else componentData = remoteComponents[componentId];
|
|
184
|
-
if (!componentData) {
|
|
185
|
-
results.push({
|
|
186
|
-
componentId,
|
|
187
|
-
componentType,
|
|
188
|
-
filePath: "",
|
|
189
|
-
variableName: "",
|
|
190
|
-
success: false,
|
|
191
|
-
error: "No data found in remote project"
|
|
192
|
-
});
|
|
193
|
-
continue;
|
|
194
|
-
}
|
|
195
|
-
mkdirSync(dirname(filePath), { recursive: true });
|
|
196
|
-
writeFileSync(filePath, generateComponentContent(componentType, componentId, componentData, localRegistry), "utf8");
|
|
197
|
-
const registryEntry = localRegistry.get(componentId, componentType);
|
|
198
|
-
if (!registryEntry) throw new Error(`Component ${componentId} (${componentType}) was not registered in the registry`);
|
|
199
|
-
const variableName = registryEntry.name;
|
|
200
|
-
results.push({
|
|
201
|
-
componentId,
|
|
202
|
-
componentType,
|
|
203
|
-
filePath,
|
|
204
|
-
variableName,
|
|
205
|
-
success: true
|
|
206
|
-
});
|
|
207
|
-
} catch (error) {
|
|
208
|
-
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
209
|
-
results.push({
|
|
210
|
-
componentId,
|
|
211
|
-
componentType,
|
|
212
|
-
filePath: "",
|
|
213
|
-
variableName: "",
|
|
214
|
-
success: false,
|
|
215
|
-
error: errorMsg
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
const createdEnvironments = results.filter((r) => r.success && r.componentType === "environments");
|
|
220
|
-
if (createdEnvironments.length > 0) try {
|
|
221
|
-
console.log(chalk.cyan("📝 Generating environments index file..."));
|
|
222
|
-
const { generateEnvironmentIndexFile } = await import("./components/environment-generator.js");
|
|
223
|
-
const indexContent = generateEnvironmentIndexFile(createdEnvironments.map((r) => r.componentId), {
|
|
224
|
-
quotes: "single",
|
|
225
|
-
indentation: " ",
|
|
226
|
-
semicolons: true
|
|
227
|
-
});
|
|
228
|
-
const indexPath = join(targetPaths.environmentsDir, "index.ts");
|
|
229
|
-
mkdirSync(dirname(indexPath), { recursive: true });
|
|
230
|
-
writeFileSync(indexPath, indexContent, "utf8");
|
|
231
|
-
console.log(chalk.green("✅ Environment index file created"));
|
|
232
|
-
} catch (error) {
|
|
233
|
-
console.log(chalk.yellow("⚠️ Failed to create environment index file:", error instanceof Error ? error.message : String(error)));
|
|
234
|
-
}
|
|
235
|
-
const successful = results.filter((r) => r.success);
|
|
236
|
-
const failed = results.filter((r) => !r.success);
|
|
237
|
-
console.log(chalk.green(`\n✅ Created ${successful.length} new component files`));
|
|
238
|
-
if (failed.length > 0) console.log(chalk.red(`❌ ${failed.length} components failed`));
|
|
239
|
-
if (failed.length > 0) {
|
|
240
|
-
console.log(chalk.red("\n❌ Failed to create:"));
|
|
241
|
-
failed.forEach((result) => {
|
|
242
|
-
console.log(chalk.red(` ${result.componentType}:${result.componentId} - ${result.error}`));
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
return results;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Find status component data by ID from project agents
|
|
249
|
-
*/
|
|
250
|
-
function findStatusComponentData(project, statusId) {
|
|
251
|
-
if (project.agents) {
|
|
252
|
-
for (const agentData of Object.values(project.agents)) if (agentData.statusUpdates?.statusComponents) for (const statusComp of agentData.statusUpdates.statusComponents) {
|
|
253
|
-
let compId;
|
|
254
|
-
if (typeof statusComp === "string") compId = statusComp;
|
|
255
|
-
else if (typeof statusComp === "object" && statusComp) compId = statusComp.type;
|
|
256
|
-
if (compId === statusId) return typeof statusComp === "string" ? {
|
|
257
|
-
id: statusId,
|
|
258
|
-
type: statusId,
|
|
259
|
-
description: `Status component for ${statusId}`
|
|
260
|
-
} : statusComp;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Find context config data by ID from project agents
|
|
266
|
-
*/
|
|
267
|
-
function findContextConfigData(project, contextId) {
|
|
268
|
-
if (project.agents) {
|
|
269
|
-
for (const [agentId, agentData] of Object.entries(project.agents)) if (agentData.contextConfig) {
|
|
270
|
-
if (agentData.contextConfig.id === contextId) return {
|
|
271
|
-
contextConfig: agentData.contextConfig,
|
|
272
|
-
agentId
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
//#endregion
|
|
279
|
-
export { createNewComponents };
|