@inkeep/agents-cli 0.39.5 → 0.41.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/_virtual/rolldown_runtime.js +7 -0
- package/dist/api.js +185 -0
- package/dist/commands/add.js +139 -0
- package/dist/commands/config.js +86 -0
- package/dist/commands/dev.js +259 -0
- package/dist/commands/init.js +360 -0
- package/dist/commands/list-agents.js +56 -0
- package/dist/commands/login.js +179 -0
- package/dist/commands/logout.js +56 -0
- package/dist/commands/profile.js +276 -0
- package/dist/{component-parser2.js → commands/pull-v3/component-parser.js} +16 -3
- package/dist/commands/pull-v3/component-updater.js +710 -0
- package/dist/commands/pull-v3/components/agent-generator.js +241 -0
- package/dist/commands/pull-v3/components/artifact-component-generator.js +143 -0
- package/dist/commands/pull-v3/components/context-config-generator.js +190 -0
- package/dist/commands/pull-v3/components/credential-generator.js +89 -0
- package/dist/commands/pull-v3/components/data-component-generator.js +102 -0
- package/dist/commands/pull-v3/components/environment-generator.js +170 -0
- package/dist/commands/pull-v3/components/external-agent-generator.js +75 -0
- package/dist/commands/pull-v3/components/function-tool-generator.js +94 -0
- package/dist/commands/pull-v3/components/mcp-tool-generator.js +86 -0
- package/dist/commands/pull-v3/components/project-generator.js +145 -0
- package/dist/commands/pull-v3/components/status-component-generator.js +92 -0
- package/dist/commands/pull-v3/components/sub-agent-generator.js +285 -0
- package/dist/commands/pull-v3/index.js +510 -0
- package/dist/commands/pull-v3/introspect-generator.js +278 -0
- package/dist/commands/pull-v3/llm-content-merger.js +192 -0
- package/dist/{new-component-generator.js → commands/pull-v3/new-component-generator.js} +14 -3
- package/dist/commands/pull-v3/project-comparator.js +914 -0
- package/dist/{project-index-generator.js → commands/pull-v3/project-index-generator.js} +1 -2
- package/dist/{project-validator.js → commands/pull-v3/project-validator.js} +4 -4
- package/dist/commands/pull-v3/targeted-typescript-placeholders.js +173 -0
- package/dist/commands/pull-v3/utils/component-registry.js +369 -0
- package/dist/commands/pull-v3/utils/component-tracker.js +165 -0
- package/dist/commands/pull-v3/utils/generator-utils.js +146 -0
- package/dist/commands/pull-v3/utils/model-provider-detector.js +44 -0
- package/dist/commands/push.js +326 -0
- package/dist/commands/status.js +89 -0
- package/dist/commands/update.js +97 -0
- package/dist/commands/whoami.js +38 -0
- package/dist/config.js +0 -1
- package/dist/env.js +30 -0
- package/dist/exports.js +3 -0
- package/dist/index.js +28 -196514
- package/dist/instrumentation.js +47 -0
- package/dist/types/agent.js +1 -0
- package/dist/types/tsx.d.d.ts +1 -0
- package/dist/utils/background-version-check.js +19 -0
- package/dist/utils/ci-environment.js +87 -0
- package/dist/utils/cli-pipeline.js +158 -0
- package/dist/utils/config.js +290 -0
- package/dist/utils/credentials.js +132 -0
- package/dist/utils/environment-loader.js +28 -0
- package/dist/utils/file-finder.js +62 -0
- package/dist/utils/json-comparator.js +185 -0
- package/dist/utils/json-comparison.js +232 -0
- package/dist/utils/mcp-runner.js +120 -0
- package/dist/utils/model-config.js +182 -0
- package/dist/utils/package-manager.js +58 -0
- package/dist/utils/profile-config.js +85 -0
- package/dist/utils/profiles/index.js +4 -0
- package/dist/utils/profiles/profile-manager.js +219 -0
- package/dist/utils/profiles/types.js +62 -0
- package/dist/utils/project-directory.js +33 -0
- package/dist/utils/project-loader.js +29 -0
- package/dist/utils/schema-introspection.js +44 -0
- package/dist/utils/templates.js +198 -0
- package/dist/utils/tsx-loader.js +27 -0
- package/dist/utils/url.js +26 -0
- package/dist/utils/version-check.js +79 -0
- package/package.json +9 -24
- package/dist/component-parser.js +0 -4
- package/dist/component-updater.js +0 -4
- package/dist/config2.js +0 -4
- package/dist/credential-stores.js +0 -4
- package/dist/environment-generator.js +0 -4
- package/dist/nodefs.js +0 -27
- package/dist/opfs-ahp.js +0 -368
- package/dist/project-loader.js +0 -4
- package/dist/tsx-loader.js +0 -4
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { ProfileError, ProfileManager } from "../utils/profiles/profile-manager.js";
|
|
2
|
+
import "../utils/profiles/index.js";
|
|
3
|
+
import * as p from "@clack/prompts";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
|
|
6
|
+
//#region src/commands/profile.ts
|
|
7
|
+
const profileManager = new ProfileManager();
|
|
8
|
+
/**
|
|
9
|
+
* List all profiles and show which one is active
|
|
10
|
+
*/
|
|
11
|
+
async function profileListCommand() {
|
|
12
|
+
try {
|
|
13
|
+
const { profiles, activeProfile } = profileManager.listProfiles();
|
|
14
|
+
if (profiles.length === 0) {
|
|
15
|
+
console.log(chalk.yellow("No profiles configured."));
|
|
16
|
+
console.log(chalk.gray("Run \"inkeep profile add <name>\" to create one."));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
console.log(chalk.bold("Profiles:\n"));
|
|
20
|
+
for (const profile of profiles) {
|
|
21
|
+
const isActive = profile.name === activeProfile;
|
|
22
|
+
const marker = isActive ? chalk.green("* ") : " ";
|
|
23
|
+
const name = isActive ? chalk.green.bold(profile.name) : profile.name;
|
|
24
|
+
console.log(`${marker}${name}`);
|
|
25
|
+
console.log(chalk.gray(` Remote: ${profile.remote.manageApi}`));
|
|
26
|
+
console.log(chalk.gray(` Environment: ${profile.environment}`));
|
|
27
|
+
console.log(chalk.gray(` Credential: ${profile.credential}`));
|
|
28
|
+
console.log();
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
handleProfileError(error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Add a new profile interactively
|
|
36
|
+
*/
|
|
37
|
+
async function profileAddCommand(name) {
|
|
38
|
+
try {
|
|
39
|
+
let profileName = name;
|
|
40
|
+
if (!profileName) {
|
|
41
|
+
const result = await p.text({
|
|
42
|
+
message: "Profile name:",
|
|
43
|
+
placeholder: "my-profile",
|
|
44
|
+
validate: (value) => {
|
|
45
|
+
if (!value) return "Profile name is required";
|
|
46
|
+
if (!/^[a-z0-9-]+$/.test(value)) return "Profile name must be lowercase alphanumeric with hyphens only";
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
if (p.isCancel(result)) {
|
|
50
|
+
p.cancel("Profile creation cancelled");
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
profileName = result;
|
|
54
|
+
}
|
|
55
|
+
if (profileManager.getProfile(profileName)) {
|
|
56
|
+
console.error(chalk.red(`Profile '${profileName}' already exists.`));
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
const remoteType = await p.select({
|
|
60
|
+
message: "Remote type:",
|
|
61
|
+
options: [{
|
|
62
|
+
value: "cloud",
|
|
63
|
+
label: "Inkeep Cloud",
|
|
64
|
+
hint: "Default cloud deployment"
|
|
65
|
+
}, {
|
|
66
|
+
value: "custom",
|
|
67
|
+
label: "Custom",
|
|
68
|
+
hint: "Local or self-hosted deployment"
|
|
69
|
+
}]
|
|
70
|
+
});
|
|
71
|
+
if (p.isCancel(remoteType)) {
|
|
72
|
+
p.cancel("Profile creation cancelled");
|
|
73
|
+
process.exit(0);
|
|
74
|
+
}
|
|
75
|
+
let remote;
|
|
76
|
+
if (remoteType === "cloud") remote = "cloud";
|
|
77
|
+
else {
|
|
78
|
+
const manageApi = await p.text({
|
|
79
|
+
message: "Manage API URL:",
|
|
80
|
+
placeholder: "http://localhost:3002",
|
|
81
|
+
initialValue: "http://localhost:3002",
|
|
82
|
+
validate: (value) => {
|
|
83
|
+
try {
|
|
84
|
+
new URL(value);
|
|
85
|
+
return;
|
|
86
|
+
} catch {
|
|
87
|
+
return "Invalid URL format";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
if (p.isCancel(manageApi)) {
|
|
92
|
+
p.cancel("Profile creation cancelled");
|
|
93
|
+
process.exit(0);
|
|
94
|
+
}
|
|
95
|
+
const manageUi = await p.text({
|
|
96
|
+
message: "Manage UI URL:",
|
|
97
|
+
placeholder: "http://localhost:3000",
|
|
98
|
+
initialValue: "http://localhost:3000",
|
|
99
|
+
validate: (value) => {
|
|
100
|
+
try {
|
|
101
|
+
new URL(value);
|
|
102
|
+
return;
|
|
103
|
+
} catch {
|
|
104
|
+
return "Invalid URL format";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
if (p.isCancel(manageUi)) {
|
|
109
|
+
p.cancel("Profile creation cancelled");
|
|
110
|
+
process.exit(0);
|
|
111
|
+
}
|
|
112
|
+
const runApi = await p.text({
|
|
113
|
+
message: "Run API URL:",
|
|
114
|
+
placeholder: "http://localhost:3003",
|
|
115
|
+
initialValue: "http://localhost:3003",
|
|
116
|
+
validate: (value) => {
|
|
117
|
+
try {
|
|
118
|
+
new URL(value);
|
|
119
|
+
return;
|
|
120
|
+
} catch {
|
|
121
|
+
return "Invalid URL format";
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
if (p.isCancel(runApi)) {
|
|
126
|
+
p.cancel("Profile creation cancelled");
|
|
127
|
+
process.exit(0);
|
|
128
|
+
}
|
|
129
|
+
remote = {
|
|
130
|
+
manageApi,
|
|
131
|
+
manageUi,
|
|
132
|
+
runApi
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
const environment = await p.text({
|
|
136
|
+
message: "Environment name:",
|
|
137
|
+
placeholder: remoteType === "cloud" ? "production" : "development",
|
|
138
|
+
initialValue: remoteType === "cloud" ? "production" : "development",
|
|
139
|
+
validate: (value) => {
|
|
140
|
+
if (!value) return "Environment is required";
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
if (p.isCancel(environment)) {
|
|
144
|
+
p.cancel("Profile creation cancelled");
|
|
145
|
+
process.exit(0);
|
|
146
|
+
}
|
|
147
|
+
const credentialDefault = `inkeep-${profileName}`;
|
|
148
|
+
const credential = await p.text({
|
|
149
|
+
message: "Credential reference:",
|
|
150
|
+
placeholder: credentialDefault,
|
|
151
|
+
initialValue: credentialDefault,
|
|
152
|
+
validate: (value) => {
|
|
153
|
+
if (!value) return "Credential reference is required";
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
if (p.isCancel(credential)) {
|
|
157
|
+
p.cancel("Profile creation cancelled");
|
|
158
|
+
process.exit(0);
|
|
159
|
+
}
|
|
160
|
+
const profile = {
|
|
161
|
+
remote,
|
|
162
|
+
credential,
|
|
163
|
+
environment
|
|
164
|
+
};
|
|
165
|
+
profileManager.addProfile(profileName, profile);
|
|
166
|
+
console.log();
|
|
167
|
+
console.log(chalk.green("✓"), `Profile '${chalk.cyan(profileName)}' created successfully.`);
|
|
168
|
+
if (!await profileManager.checkCredentialExists(credential)) {
|
|
169
|
+
console.log();
|
|
170
|
+
console.log(chalk.yellow("⚠"), `Credential '${credential}' not found in keychain.`);
|
|
171
|
+
console.log(chalk.gray(" Run \"inkeep login\" to authenticate and store credentials."));
|
|
172
|
+
}
|
|
173
|
+
const switchProfile = await p.confirm({
|
|
174
|
+
message: `Switch to profile '${profileName}'?`,
|
|
175
|
+
initialValue: false
|
|
176
|
+
});
|
|
177
|
+
if (!p.isCancel(switchProfile) && switchProfile) {
|
|
178
|
+
profileManager.setActiveProfile(profileName);
|
|
179
|
+
console.log(chalk.green("✓"), `Switched to profile '${chalk.cyan(profileName)}'.`);
|
|
180
|
+
}
|
|
181
|
+
} catch (error) {
|
|
182
|
+
handleProfileError(error);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Set the active profile
|
|
187
|
+
*/
|
|
188
|
+
async function profileUseCommand(name) {
|
|
189
|
+
try {
|
|
190
|
+
if (!name) {
|
|
191
|
+
console.error(chalk.red("Profile name is required."));
|
|
192
|
+
console.log(chalk.gray("Usage: inkeep profile use <name>"));
|
|
193
|
+
process.exit(1);
|
|
194
|
+
}
|
|
195
|
+
profileManager.setActiveProfile(name);
|
|
196
|
+
console.log(chalk.green("✓"), `Switched to profile '${chalk.cyan(name)}'.`);
|
|
197
|
+
} catch (error) {
|
|
198
|
+
handleProfileError(error);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Display the current active profile details
|
|
203
|
+
*/
|
|
204
|
+
async function profileCurrentCommand() {
|
|
205
|
+
try {
|
|
206
|
+
const profile = profileManager.getActiveProfile();
|
|
207
|
+
console.log(chalk.bold("Active Profile:\n"));
|
|
208
|
+
console.log(chalk.cyan(` Name: ${profile.name}`));
|
|
209
|
+
console.log();
|
|
210
|
+
console.log(chalk.gray(" Remote URLs:"));
|
|
211
|
+
console.log(` Manage API: ${profile.remote.manageApi}`);
|
|
212
|
+
console.log(` Manage UI: ${profile.remote.manageUi}`);
|
|
213
|
+
console.log(` Run API: ${profile.remote.runApi}`);
|
|
214
|
+
console.log();
|
|
215
|
+
console.log(` Environment: ${profile.environment}`);
|
|
216
|
+
console.log(` Credential: ${profile.credential}`);
|
|
217
|
+
if (!await profileManager.checkCredentialExists(profile.credential)) {
|
|
218
|
+
console.log();
|
|
219
|
+
console.log(chalk.yellow("⚠"), `Credential '${profile.credential}' not found in keychain.`);
|
|
220
|
+
console.log(chalk.gray(" Run \"inkeep login\" to authenticate."));
|
|
221
|
+
}
|
|
222
|
+
} catch (error) {
|
|
223
|
+
handleProfileError(error);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Remove a profile
|
|
228
|
+
*/
|
|
229
|
+
async function profileRemoveCommand(name) {
|
|
230
|
+
try {
|
|
231
|
+
if (!name) {
|
|
232
|
+
console.error(chalk.red("Profile name is required."));
|
|
233
|
+
console.log(chalk.gray("Usage: inkeep profile remove <name>"));
|
|
234
|
+
process.exit(1);
|
|
235
|
+
}
|
|
236
|
+
const confirm = await p.confirm({
|
|
237
|
+
message: `Remove profile '${name}'?`,
|
|
238
|
+
initialValue: false
|
|
239
|
+
});
|
|
240
|
+
if (p.isCancel(confirm) || !confirm) {
|
|
241
|
+
console.log(chalk.gray("Profile removal cancelled."));
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
profileManager.removeProfile(name);
|
|
245
|
+
console.log(chalk.green("✓"), `Profile '${chalk.cyan(name)}' removed.`);
|
|
246
|
+
} catch (error) {
|
|
247
|
+
handleProfileError(error);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Handle profile errors with user-friendly messages
|
|
252
|
+
*/
|
|
253
|
+
function handleProfileError(error) {
|
|
254
|
+
if (error instanceof ProfileError) {
|
|
255
|
+
console.error(chalk.red("Error:"), error.message);
|
|
256
|
+
switch (error.code) {
|
|
257
|
+
case "PROFILE_NOT_FOUND":
|
|
258
|
+
console.log(chalk.gray("\nRun \"inkeep profile list\" to see available profiles."));
|
|
259
|
+
break;
|
|
260
|
+
case "PROFILE_EXISTS":
|
|
261
|
+
console.log(chalk.gray("\nUse a different name or remove the existing profile first."));
|
|
262
|
+
break;
|
|
263
|
+
case "ACTIVE_PROFILE_DELETE":
|
|
264
|
+
console.log(chalk.gray("\nRun \"inkeep profile use <other-profile>\" first."));
|
|
265
|
+
break;
|
|
266
|
+
case "VALIDATION_ERROR":
|
|
267
|
+
console.log(chalk.gray("\nCheck your profiles.yaml file for syntax errors."));
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
process.exit(1);
|
|
271
|
+
}
|
|
272
|
+
throw error;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
//#endregion
|
|
276
|
+
export { profileAddCommand, profileCurrentCommand, profileListCommand, profileRemoveCommand, profileUseCommand };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { s as ComponentRegistry } from "./index.js";
|
|
1
|
+
import { ComponentRegistry } from "./utils/component-registry.js";
|
|
3
2
|
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
4
3
|
import { extname, join, relative } from "node:path";
|
|
4
|
+
import chalk from "chalk";
|
|
5
5
|
import { Node, Project } from "ts-morph";
|
|
6
6
|
|
|
7
7
|
//#region src/commands/pull-v3/component-parser.ts
|
|
@@ -288,6 +288,19 @@ function buildComponentRegistryFromParsing(projectRoot, debug = false) {
|
|
|
288
288
|
stats.exported + stats.inline;
|
|
289
289
|
return registry;
|
|
290
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* Get component location info for a specific component ID
|
|
293
|
+
*/
|
|
294
|
+
function findComponentById(componentId, projectRoot) {
|
|
295
|
+
return scanProjectForComponents(projectRoot, false).find((comp) => comp.id === componentId) || null;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Get all local component IDs
|
|
299
|
+
*/
|
|
300
|
+
function getAllLocalComponentIds(projectRoot) {
|
|
301
|
+
const allComponents = scanProjectForComponents(projectRoot, false);
|
|
302
|
+
return new Set(allComponents.map((comp) => comp.id));
|
|
303
|
+
}
|
|
291
304
|
|
|
292
305
|
//#endregion
|
|
293
|
-
export { buildComponentRegistryFromParsing
|
|
306
|
+
export { buildComponentRegistryFromParsing, findComponentById, getAllLocalComponentIds };
|