@inkeep/agents-cli 0.39.4 → 0.40.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 +127 -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 +4 -19
- 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,89 @@
|
|
|
1
|
+
import { checkKeychainAvailability, getCredentialExpiryInfo, loadCredentials } from "../utils/credentials.js";
|
|
2
|
+
import { ProfileManager } from "../utils/profiles/profile-manager.js";
|
|
3
|
+
import "../utils/profiles/index.js";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
|
|
6
|
+
//#region src/commands/status.ts
|
|
7
|
+
async function statusCommand(options = {}) {
|
|
8
|
+
const profileManager = new ProfileManager();
|
|
9
|
+
let profileName;
|
|
10
|
+
let credentialKey;
|
|
11
|
+
let manageApiUrl;
|
|
12
|
+
let manageUiUrl;
|
|
13
|
+
let runApiUrl;
|
|
14
|
+
let environment;
|
|
15
|
+
try {
|
|
16
|
+
if (options.profile) {
|
|
17
|
+
const profile = profileManager.getProfile(options.profile);
|
|
18
|
+
if (!profile) {
|
|
19
|
+
console.error(chalk.red(`Profile '${options.profile}' not found.`));
|
|
20
|
+
console.log(chalk.gray("Run \"inkeep profile list\" to see available profiles."));
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
profileName = options.profile;
|
|
24
|
+
credentialKey = profile.credential;
|
|
25
|
+
manageApiUrl = profile.remote.manageApi;
|
|
26
|
+
manageUiUrl = profile.remote.manageUi;
|
|
27
|
+
runApiUrl = profile.remote.runApi;
|
|
28
|
+
environment = profile.environment;
|
|
29
|
+
} else {
|
|
30
|
+
const activeProfile = profileManager.getActiveProfile();
|
|
31
|
+
profileName = activeProfile.name;
|
|
32
|
+
credentialKey = activeProfile.credential;
|
|
33
|
+
manageApiUrl = activeProfile.remote.manageApi;
|
|
34
|
+
manageUiUrl = activeProfile.remote.manageUi;
|
|
35
|
+
runApiUrl = activeProfile.remote.runApi;
|
|
36
|
+
environment = activeProfile.environment;
|
|
37
|
+
}
|
|
38
|
+
} catch {
|
|
39
|
+
console.log(chalk.yellow("No profile configured."));
|
|
40
|
+
console.log(chalk.gray("Run \"inkeep profile add\" to create a profile."));
|
|
41
|
+
console.log(chalk.gray("Or run \"inkeep login\" to authenticate with default settings."));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
console.log();
|
|
45
|
+
console.log(chalk.bold("Current Profile:"), chalk.cyan(profileName));
|
|
46
|
+
console.log();
|
|
47
|
+
const { available: keychainAvailable, reason } = await checkKeychainAvailability();
|
|
48
|
+
if (!keychainAvailable) {
|
|
49
|
+
console.log(chalk.bold("Auth:"), chalk.yellow("keychain unavailable"));
|
|
50
|
+
console.log(chalk.gray(` Reason: ${reason || "unknown"}`));
|
|
51
|
+
console.log(chalk.gray(" For CI/CD environments, use INKEEP_API_KEY instead."));
|
|
52
|
+
console.log();
|
|
53
|
+
} else {
|
|
54
|
+
const credentials = await loadCredentials(credentialKey);
|
|
55
|
+
if (!credentials) {
|
|
56
|
+
console.log(chalk.bold("Auth:"), chalk.red("not authenticated"));
|
|
57
|
+
console.log(chalk.gray(` Credential: ${credentialKey} (not found)`));
|
|
58
|
+
console.log(chalk.gray(" Run \"inkeep login\" to authenticate."));
|
|
59
|
+
console.log();
|
|
60
|
+
} else {
|
|
61
|
+
const expiryInfo = getCredentialExpiryInfo(credentials);
|
|
62
|
+
if (expiryInfo.isExpired) {
|
|
63
|
+
console.log(chalk.bold("Auth:"), chalk.red("expired"));
|
|
64
|
+
console.log(chalk.gray(` User: ${credentials.userEmail}`));
|
|
65
|
+
if (credentials.organizationName) console.log(chalk.gray(` Organization: ${credentials.organizationName}`));
|
|
66
|
+
console.log(chalk.gray(` Credential: ${credentialKey}`));
|
|
67
|
+
console.log(chalk.red(" Session expired. Run \"inkeep login\" to re-authenticate."));
|
|
68
|
+
console.log();
|
|
69
|
+
} else {
|
|
70
|
+
const expiresText = expiryInfo.expiresIn ? chalk.gray(` (expires in ${expiryInfo.expiresIn})`) : "";
|
|
71
|
+
console.log(chalk.bold("Auth:"), chalk.green("authenticated") + expiresText);
|
|
72
|
+
console.log(chalk.gray(` User: ${credentials.userEmail}`));
|
|
73
|
+
if (credentials.organizationName) console.log(chalk.gray(` Organization: ${credentials.organizationName}`));
|
|
74
|
+
console.log(chalk.gray(` Credential: ${credentialKey}`));
|
|
75
|
+
console.log();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
console.log(chalk.bold("Remote:"));
|
|
80
|
+
console.log(chalk.gray(` Manage API: ${manageApiUrl}`));
|
|
81
|
+
console.log(chalk.gray(` Manage UI: ${manageUiUrl}`));
|
|
82
|
+
console.log(chalk.gray(` Run API: ${runApiUrl}`));
|
|
83
|
+
console.log();
|
|
84
|
+
console.log(chalk.bold("Environment:"), environment);
|
|
85
|
+
console.log();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
export { statusCommand };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { checkForUpdate, getChangelogUrl } from "../utils/version-check.js";
|
|
2
|
+
import { detectPackageManager, executeUpdate } from "../utils/package-manager.js";
|
|
3
|
+
import * as p from "@clack/prompts";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
|
|
6
|
+
//#region src/commands/update.ts
|
|
7
|
+
/**
|
|
8
|
+
* Update command - updates the CLI to the latest version
|
|
9
|
+
*/
|
|
10
|
+
async function updateCommand(options = {}) {
|
|
11
|
+
const s = p.spinner();
|
|
12
|
+
s.start("Checking for updates...");
|
|
13
|
+
try {
|
|
14
|
+
const versionInfo = await checkForUpdate();
|
|
15
|
+
s.stop();
|
|
16
|
+
console.log(chalk.cyan("\n📦 Version Information:"));
|
|
17
|
+
console.log(chalk.gray(` • Current version: ${versionInfo.current}`));
|
|
18
|
+
console.log(chalk.gray(` • Latest version: ${versionInfo.latest}`));
|
|
19
|
+
if (options.check) {
|
|
20
|
+
if (versionInfo.needsUpdate) {
|
|
21
|
+
console.log(chalk.yellow("\n⚠️ An update is available!"));
|
|
22
|
+
console.log(chalk.gray(` • Run ${chalk.cyan("inkeep update")} to update`));
|
|
23
|
+
} else console.log(chalk.green("\n✅ You are on the latest version"));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!versionInfo.needsUpdate && !options.force) {
|
|
27
|
+
console.log(chalk.green("\n✅ You are already on the latest version"));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!versionInfo.needsUpdate && options.force) console.log(chalk.yellow("\n⚠️ Forcing reinstall of current version..."));
|
|
31
|
+
console.log(chalk.cyan("\n📖 Changelog:"));
|
|
32
|
+
console.log(chalk.gray(` • ${getChangelogUrl()}`));
|
|
33
|
+
s.start("Detecting package manager...");
|
|
34
|
+
const detectedManager = await detectPackageManager();
|
|
35
|
+
s.stop();
|
|
36
|
+
let packageManager;
|
|
37
|
+
if (!detectedManager) {
|
|
38
|
+
console.log(chalk.yellow("\n⚠️ Could not auto-detect package manager"));
|
|
39
|
+
const manager = await p.select({
|
|
40
|
+
message: "Which package manager did you use to install the CLI?",
|
|
41
|
+
options: [
|
|
42
|
+
{
|
|
43
|
+
label: "npm",
|
|
44
|
+
value: "npm"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "pnpm",
|
|
48
|
+
value: "pnpm"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "bun",
|
|
52
|
+
value: "bun"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: "yarn",
|
|
56
|
+
value: "yarn"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
if (p.isCancel(manager)) {
|
|
61
|
+
p.cancel("Update cancelled");
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
packageManager = manager;
|
|
65
|
+
} else {
|
|
66
|
+
packageManager = detectedManager;
|
|
67
|
+
console.log(chalk.gray(`\n🔍 Detected package manager: ${chalk.cyan(packageManager)}`));
|
|
68
|
+
}
|
|
69
|
+
if (!options.force) {
|
|
70
|
+
const confirm = await p.confirm({
|
|
71
|
+
message: `Update @inkeep/agents-cli from ${versionInfo.current} to ${versionInfo.latest}?`,
|
|
72
|
+
initialValue: true
|
|
73
|
+
});
|
|
74
|
+
if (p.isCancel(confirm) || !confirm) {
|
|
75
|
+
p.cancel("Update cancelled");
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
s.start(`Updating @inkeep/agents-cli to ${versionInfo.latest}...`);
|
|
80
|
+
await executeUpdate(packageManager);
|
|
81
|
+
s.stop(`Updated to version ${versionInfo.latest}`);
|
|
82
|
+
console.log(chalk.green("\n✨ Update completed successfully!"));
|
|
83
|
+
console.log(chalk.gray(` • New version: ${versionInfo.latest}`));
|
|
84
|
+
console.log(chalk.gray(` • Package manager: ${packageManager}`));
|
|
85
|
+
} catch (error) {
|
|
86
|
+
s.stop("Update failed");
|
|
87
|
+
console.error(chalk.red("\n❌ Error:"), error.message);
|
|
88
|
+
if (error.message.includes("EACCES") || error.message.includes("permission")) {
|
|
89
|
+
console.log(chalk.yellow("\n💡 Tip: Try running the command with elevated permissions:"));
|
|
90
|
+
console.log(chalk.gray(" • sudo inkeep update"));
|
|
91
|
+
}
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
export { updateCommand };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { loadCredentials } from "../utils/credentials.js";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
|
|
4
|
+
//#region src/commands/whoami.ts
|
|
5
|
+
async function whoamiCommand() {
|
|
6
|
+
const credentials = await loadCredentials();
|
|
7
|
+
if (!credentials) {
|
|
8
|
+
console.log(chalk.yellow("Not logged in"));
|
|
9
|
+
console.log(chalk.gray("Run `inkeep login` to authenticate"));
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
let isExpired = false;
|
|
13
|
+
if (credentials.expiresAt) isExpired = new Date(credentials.expiresAt) < /* @__PURE__ */ new Date();
|
|
14
|
+
console.log();
|
|
15
|
+
console.log(chalk.bold("Current User:"));
|
|
16
|
+
console.log(` Email: ${chalk.cyan(credentials.userEmail)}`);
|
|
17
|
+
if (credentials.organizationName) console.log(` Organization: ${chalk.cyan(credentials.organizationName)}`);
|
|
18
|
+
else if (credentials.organizationId) console.log(` Organization ID: ${chalk.cyan(credentials.organizationId)}`);
|
|
19
|
+
if (isExpired) {
|
|
20
|
+
console.log(` Status: ${chalk.red("Expired")}`);
|
|
21
|
+
console.log();
|
|
22
|
+
console.log(chalk.yellow("Your session has expired. Run `inkeep login` to re-authenticate."));
|
|
23
|
+
} else {
|
|
24
|
+
console.log(` Status: ${chalk.green("Active")}`);
|
|
25
|
+
if (credentials.expiresAt) {
|
|
26
|
+
const expiresAt = new Date(credentials.expiresAt);
|
|
27
|
+
console.log(` Expires: ${chalk.gray(expiresAt.toLocaleDateString())}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (credentials.createdAt) {
|
|
31
|
+
const createdAt = new Date(credentials.createdAt);
|
|
32
|
+
console.log(` Logged in: ${chalk.gray(createdAt.toLocaleDateString())}`);
|
|
33
|
+
}
|
|
34
|
+
console.log();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { whoamiCommand };
|
package/dist/config.js
CHANGED
package/dist/env.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { loadEnvironmentFiles } from "@inkeep/agents-core";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/env.ts
|
|
5
|
+
loadEnvironmentFiles();
|
|
6
|
+
const envSchema = z.object({
|
|
7
|
+
DEBUG: z.string().optional(),
|
|
8
|
+
ANTHROPIC_API_KEY: z.string().optional(),
|
|
9
|
+
OPENAI_API_KEY: z.string().optional(),
|
|
10
|
+
GOOGLE_GENERATIVE_AI_API_KEY: z.string().optional(),
|
|
11
|
+
LANGFUSE_SECRET_KEY: z.string().optional(),
|
|
12
|
+
LANGFUSE_PUBLIC_KEY: z.string().optional(),
|
|
13
|
+
LANGFUSE_BASEURL: z.string().optional().default("https://cloud.langfuse.com"),
|
|
14
|
+
LANGFUSE_ENABLED: z.string().optional().transform((val) => val === "true")
|
|
15
|
+
});
|
|
16
|
+
const parseEnv = () => {
|
|
17
|
+
try {
|
|
18
|
+
return envSchema.parse(process.env);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
if (error instanceof z.ZodError) {
|
|
21
|
+
const missingVars = error.issues.map((issue) => issue.path.join("."));
|
|
22
|
+
throw new Error(`❌ Invalid environment variables: ${missingVars.join(", ")}\n${error.message}`);
|
|
23
|
+
}
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const env = parseEnv();
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { env };
|
package/dist/exports.js
ADDED