@inkeep/agents-cli 0.0.0-dev-20251016142453 → 0.0.0-dev-20251016161232
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/index.js +238 -90
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -233998,6 +233998,41 @@ var init_src = __esm({
|
|
|
233998
233998
|
}
|
|
233999
233999
|
});
|
|
234000
234000
|
|
|
234001
|
+
// src/env.ts
|
|
234002
|
+
import { z as z12 } from "zod";
|
|
234003
|
+
var envSchema2, parseEnv2, env2;
|
|
234004
|
+
var init_env2 = __esm({
|
|
234005
|
+
"src/env.ts"() {
|
|
234006
|
+
"use strict";
|
|
234007
|
+
init_esm_shims();
|
|
234008
|
+
init_src();
|
|
234009
|
+
loadEnvironmentFiles();
|
|
234010
|
+
envSchema2 = z12.object({
|
|
234011
|
+
DEBUG: z12.string().optional(),
|
|
234012
|
+
// Secrets loaded from .env files (relative to where CLI is executed)
|
|
234013
|
+
ANTHROPIC_API_KEY: z12.string().optional(),
|
|
234014
|
+
OPENAI_API_KEY: z12.string().optional(),
|
|
234015
|
+
GOOGLE_API_KEY: z12.string().optional()
|
|
234016
|
+
});
|
|
234017
|
+
parseEnv2 = () => {
|
|
234018
|
+
try {
|
|
234019
|
+
const parsedEnv = envSchema2.parse(process.env);
|
|
234020
|
+
return parsedEnv;
|
|
234021
|
+
} catch (error) {
|
|
234022
|
+
if (error instanceof z12.ZodError) {
|
|
234023
|
+
const missingVars = error.issues.map((issue) => issue.path.join("."));
|
|
234024
|
+
throw new Error(
|
|
234025
|
+
`\u274C Invalid environment variables: ${missingVars.join(", ")}
|
|
234026
|
+
${error.message}`
|
|
234027
|
+
);
|
|
234028
|
+
}
|
|
234029
|
+
throw error;
|
|
234030
|
+
}
|
|
234031
|
+
};
|
|
234032
|
+
env2 = parseEnv2();
|
|
234033
|
+
}
|
|
234034
|
+
});
|
|
234035
|
+
|
|
234001
234036
|
// src/utils/tsx-loader.ts
|
|
234002
234037
|
import { extname } from "path";
|
|
234003
234038
|
import { pathToFileURL } from "url";
|
|
@@ -234401,6 +234436,7 @@ __export(pull_llm_generate_exports, {
|
|
|
234401
234436
|
NAMING_CONVENTION_RULES: () => NAMING_CONVENTION_RULES,
|
|
234402
234437
|
cleanGeneratedCode: () => cleanGeneratedCode,
|
|
234403
234438
|
createModel: () => createModel,
|
|
234439
|
+
detectAvailableProvider: () => detectAvailableProvider,
|
|
234404
234440
|
generateAgentFile: () => generateAgentFile,
|
|
234405
234441
|
generateArtifactComponentFile: () => generateArtifactComponentFile,
|
|
234406
234442
|
generateDataComponentFile: () => generateDataComponentFile,
|
|
@@ -234410,12 +234446,15 @@ __export(pull_llm_generate_exports, {
|
|
|
234410
234446
|
generateTextWithPlaceholders: () => generateTextWithPlaceholders,
|
|
234411
234447
|
generateToolFile: () => generateToolFile,
|
|
234412
234448
|
generateTypeScriptFileWithLLM: () => generateTypeScriptFileWithLLM,
|
|
234449
|
+
getDefaultModelForProvider: () => getDefaultModelForProvider,
|
|
234450
|
+
getModelConfigWithReasoning: () => getModelConfigWithReasoning,
|
|
234413
234451
|
getTypeDefinitions: () => getTypeDefinitions
|
|
234414
234452
|
});
|
|
234415
234453
|
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
234416
234454
|
import { createRequire as createRequire2 } from "module";
|
|
234417
234455
|
import { join as join7 } from "path";
|
|
234418
234456
|
import { anthropic, createAnthropic } from "@ai-sdk/anthropic";
|
|
234457
|
+
import { google } from "@ai-sdk/google";
|
|
234419
234458
|
import { createOpenAI, openai } from "@ai-sdk/openai";
|
|
234420
234459
|
import { generateText } from "ai";
|
|
234421
234460
|
function getTypeDefinitions() {
|
|
@@ -234440,6 +234479,54 @@ ${dtsContent}
|
|
|
234440
234479
|
`;
|
|
234441
234480
|
}
|
|
234442
234481
|
}
|
|
234482
|
+
function detectAvailableProvider() {
|
|
234483
|
+
const anthropicKey = env2.ANTHROPIC_API_KEY?.trim();
|
|
234484
|
+
const openaiKey = env2.OPENAI_API_KEY?.trim();
|
|
234485
|
+
const googleKey = env2.GOOGLE_API_KEY?.trim();
|
|
234486
|
+
if (anthropicKey) {
|
|
234487
|
+
return "anthropic";
|
|
234488
|
+
}
|
|
234489
|
+
if (openaiKey) {
|
|
234490
|
+
return "openai";
|
|
234491
|
+
}
|
|
234492
|
+
if (googleKey) {
|
|
234493
|
+
return "google";
|
|
234494
|
+
}
|
|
234495
|
+
throw new Error("No LLM provider API key found. Please set ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY");
|
|
234496
|
+
}
|
|
234497
|
+
function getDefaultModelForProvider(provider) {
|
|
234498
|
+
switch (provider) {
|
|
234499
|
+
case "anthropic":
|
|
234500
|
+
return ANTHROPIC_MODELS.CLAUDE_SONNET_4_5;
|
|
234501
|
+
case "openai":
|
|
234502
|
+
return OPENAI_MODELS.GPT_4_1;
|
|
234503
|
+
case "google":
|
|
234504
|
+
return GOOGLE_MODELS.GEMINI_2_5_PRO;
|
|
234505
|
+
default:
|
|
234506
|
+
throw new Error(`Unknown provider: ${provider}`);
|
|
234507
|
+
}
|
|
234508
|
+
}
|
|
234509
|
+
function getModelConfigWithReasoning(provider) {
|
|
234510
|
+
switch (provider) {
|
|
234511
|
+
case "anthropic":
|
|
234512
|
+
return {
|
|
234513
|
+
thinking: {
|
|
234514
|
+
type: "enabled",
|
|
234515
|
+
budget: {}
|
|
234516
|
+
}
|
|
234517
|
+
};
|
|
234518
|
+
case "google":
|
|
234519
|
+
return {
|
|
234520
|
+
thinkingConfig: {
|
|
234521
|
+
mode: "thinking"
|
|
234522
|
+
}
|
|
234523
|
+
};
|
|
234524
|
+
case "openai":
|
|
234525
|
+
return {};
|
|
234526
|
+
default:
|
|
234527
|
+
return {};
|
|
234528
|
+
}
|
|
234529
|
+
}
|
|
234443
234530
|
function createModel(config) {
|
|
234444
234531
|
if (!config.model) {
|
|
234445
234532
|
throw new Error("Model configuration is required for pull command");
|
|
@@ -234460,6 +234547,8 @@ function createModel(config) {
|
|
|
234460
234547
|
return provider2(modelName);
|
|
234461
234548
|
}
|
|
234462
234549
|
return openai(modelName);
|
|
234550
|
+
case "google":
|
|
234551
|
+
return google(modelName);
|
|
234463
234552
|
default:
|
|
234464
234553
|
throw new Error(`Unsupported provider: ${provider}`);
|
|
234465
234554
|
}
|
|
@@ -234467,7 +234556,7 @@ function createModel(config) {
|
|
|
234467
234556
|
function cleanGeneratedCode(text2) {
|
|
234468
234557
|
return text2.replace(/^```(?:typescript|ts)?\n?/, "").replace(/\n?```$/, "").trim();
|
|
234469
234558
|
}
|
|
234470
|
-
async function generateTextWithPlaceholders(model, data, promptTemplate, options, debug = false, context) {
|
|
234559
|
+
async function generateTextWithPlaceholders(model, data, promptTemplate, options, debug = false, context, reasoningConfig) {
|
|
234471
234560
|
const { processedData, replacements } = context ? createPlaceholders(data, context) : createPlaceholders(data);
|
|
234472
234561
|
if (debug && Object.keys(replacements).length > 0) {
|
|
234473
234562
|
const savings = calculateTokenSavings(data, processedData);
|
|
@@ -234486,7 +234575,9 @@ async function generateTextWithPlaceholders(model, data, promptTemplate, options
|
|
|
234486
234575
|
const { text: text2 } = await generateText({
|
|
234487
234576
|
model,
|
|
234488
234577
|
prompt,
|
|
234489
|
-
...options
|
|
234578
|
+
...options,
|
|
234579
|
+
...reasoningConfig
|
|
234580
|
+
// Merge in reasoning/thinking config if provided
|
|
234490
234581
|
});
|
|
234491
234582
|
const restoredText = restorePlaceholders(text2, replacements);
|
|
234492
234583
|
if (debug && Object.keys(replacements).length > 0) {
|
|
@@ -234507,7 +234598,7 @@ function parseModelString(modelString) {
|
|
|
234507
234598
|
modelName: modelString
|
|
234508
234599
|
};
|
|
234509
234600
|
}
|
|
234510
|
-
async function generateIndexFile(projectData, outputPath, modelSettings) {
|
|
234601
|
+
async function generateIndexFile(projectData, outputPath, modelSettings, reasoningConfig) {
|
|
234511
234602
|
const model = createModel(modelSettings);
|
|
234512
234603
|
const promptTemplate = `Generate a TypeScript index.ts file for an Inkeep project with the following data:
|
|
234513
234604
|
|
|
@@ -234543,12 +234634,23 @@ export const myProject = project({
|
|
|
234543
234634
|
});
|
|
234544
234635
|
|
|
234545
234636
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
234546
|
-
const text2 = await generateTextWithPlaceholders(
|
|
234547
|
-
|
|
234548
|
-
|
|
234549
|
-
|
|
234550
|
-
|
|
234551
|
-
|
|
234637
|
+
const text2 = await generateTextWithPlaceholders(
|
|
234638
|
+
model,
|
|
234639
|
+
projectData,
|
|
234640
|
+
promptTemplate,
|
|
234641
|
+
{
|
|
234642
|
+
temperature: 0.1,
|
|
234643
|
+
maxOutputTokens: 4e3,
|
|
234644
|
+
abortSignal: AbortSignal.timeout(9e4)
|
|
234645
|
+
// 90 second timeout (increased for reasoning)
|
|
234646
|
+
},
|
|
234647
|
+
false,
|
|
234648
|
+
// debug
|
|
234649
|
+
void 0,
|
|
234650
|
+
// context
|
|
234651
|
+
reasoningConfig
|
|
234652
|
+
// reasoning config
|
|
234653
|
+
);
|
|
234552
234654
|
writeFileSync3(outputPath, cleanGeneratedCode(text2));
|
|
234553
234655
|
}
|
|
234554
234656
|
function generateImportMappings(toolFilenames, componentFilenames) {
|
|
@@ -234578,7 +234680,7 @@ function generateImportMappings(toolFilenames, componentFilenames) {
|
|
|
234578
234680
|
}
|
|
234579
234681
|
return result;
|
|
234580
234682
|
}
|
|
234581
|
-
async function generateAgentFile(agentData, agentId, outputPath, modelSettings, toolFilenames, componentFilenames, debug = false) {
|
|
234683
|
+
async function generateAgentFile(agentData, agentId, outputPath, modelSettings, toolFilenames, componentFilenames, debug = false, reasoningConfig) {
|
|
234582
234684
|
const model = createModel(modelSettings);
|
|
234583
234685
|
const promptTemplate = `Generate a TypeScript file for an Inkeep agent.
|
|
234584
234686
|
|
|
@@ -234795,11 +234897,15 @@ Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
|
234795
234897
|
{
|
|
234796
234898
|
temperature: 0.1,
|
|
234797
234899
|
maxOutputTokens: 16e3,
|
|
234798
|
-
abortSignal: AbortSignal.timeout(
|
|
234799
|
-
//
|
|
234900
|
+
abortSignal: AbortSignal.timeout(3e5)
|
|
234901
|
+
// 300 second timeout for complex agent (5 min, increased for reasoning)
|
|
234800
234902
|
},
|
|
234801
|
-
debug
|
|
234903
|
+
debug,
|
|
234802
234904
|
// Pass debug flag to show placeholder optimization info
|
|
234905
|
+
void 0,
|
|
234906
|
+
// context
|
|
234907
|
+
reasoningConfig
|
|
234908
|
+
// reasoning config
|
|
234803
234909
|
);
|
|
234804
234910
|
const duration = Date.now() - startTime;
|
|
234805
234911
|
if (debug) {
|
|
@@ -234832,7 +234938,7 @@ Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
|
234832
234938
|
throw error;
|
|
234833
234939
|
}
|
|
234834
234940
|
}
|
|
234835
|
-
async function generateToolFile(toolData, toolId, outputPath, modelSettings) {
|
|
234941
|
+
async function generateToolFile(toolData, toolId, outputPath, modelSettings, reasoningConfig) {
|
|
234836
234942
|
const model = createModel(modelSettings);
|
|
234837
234943
|
const promptTemplate = `Generate a TypeScript file for an Inkeep tool.
|
|
234838
234944
|
|
|
@@ -234881,15 +234987,26 @@ export const transportTool = mcpTool({
|
|
|
234881
234987
|
});
|
|
234882
234988
|
|
|
234883
234989
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
234884
|
-
const text2 = await generateTextWithPlaceholders(
|
|
234885
|
-
|
|
234886
|
-
|
|
234887
|
-
|
|
234888
|
-
|
|
234889
|
-
|
|
234990
|
+
const text2 = await generateTextWithPlaceholders(
|
|
234991
|
+
model,
|
|
234992
|
+
toolData,
|
|
234993
|
+
promptTemplate,
|
|
234994
|
+
{
|
|
234995
|
+
temperature: 0.1,
|
|
234996
|
+
maxOutputTokens: 4e3,
|
|
234997
|
+
abortSignal: AbortSignal.timeout(9e4)
|
|
234998
|
+
// 90 second timeout (increased for reasoning)
|
|
234999
|
+
},
|
|
235000
|
+
false,
|
|
235001
|
+
// debug
|
|
235002
|
+
void 0,
|
|
235003
|
+
// context
|
|
235004
|
+
reasoningConfig
|
|
235005
|
+
// reasoning config
|
|
235006
|
+
);
|
|
234890
235007
|
writeFileSync3(outputPath, cleanGeneratedCode(text2));
|
|
234891
235008
|
}
|
|
234892
|
-
async function generateDataComponentFile(componentData, componentId, outputPath, modelSettings) {
|
|
235009
|
+
async function generateDataComponentFile(componentData, componentId, outputPath, modelSettings, reasoningConfig) {
|
|
234893
235010
|
const model = createModel(modelSettings);
|
|
234894
235011
|
const promptTemplate = `Generate a TypeScript file for an Inkeep data component.
|
|
234895
235012
|
|
|
@@ -234948,15 +235065,26 @@ export const userProfile = dataComponent({
|
|
|
234948
235065
|
});
|
|
234949
235066
|
|
|
234950
235067
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
234951
|
-
const text2 = await generateTextWithPlaceholders(
|
|
234952
|
-
|
|
234953
|
-
|
|
234954
|
-
|
|
234955
|
-
|
|
234956
|
-
|
|
235068
|
+
const text2 = await generateTextWithPlaceholders(
|
|
235069
|
+
model,
|
|
235070
|
+
componentData,
|
|
235071
|
+
promptTemplate,
|
|
235072
|
+
{
|
|
235073
|
+
temperature: 0.1,
|
|
235074
|
+
maxOutputTokens: 4e3,
|
|
235075
|
+
abortSignal: AbortSignal.timeout(9e4)
|
|
235076
|
+
// 90 second timeout (increased for reasoning)
|
|
235077
|
+
},
|
|
235078
|
+
false,
|
|
235079
|
+
// debug
|
|
235080
|
+
void 0,
|
|
235081
|
+
// context
|
|
235082
|
+
reasoningConfig
|
|
235083
|
+
// reasoning config
|
|
235084
|
+
);
|
|
234957
235085
|
writeFileSync3(outputPath, cleanGeneratedCode(text2));
|
|
234958
235086
|
}
|
|
234959
|
-
async function generateArtifactComponentFile(componentData, componentId, outputPath, modelSettings) {
|
|
235087
|
+
async function generateArtifactComponentFile(componentData, componentId, outputPath, modelSettings, reasoningConfig) {
|
|
234960
235088
|
const model = createModel(modelSettings);
|
|
234961
235089
|
const promptTemplate = `Generate a TypeScript file for an Inkeep artifact component.
|
|
234962
235090
|
|
|
@@ -235020,15 +235148,26 @@ export const orderSummary = artifactComponent({
|
|
|
235020
235148
|
});
|
|
235021
235149
|
|
|
235022
235150
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
235023
|
-
const text2 = await generateTextWithPlaceholders(
|
|
235024
|
-
|
|
235025
|
-
|
|
235026
|
-
|
|
235027
|
-
|
|
235028
|
-
|
|
235151
|
+
const text2 = await generateTextWithPlaceholders(
|
|
235152
|
+
model,
|
|
235153
|
+
componentData,
|
|
235154
|
+
promptTemplate,
|
|
235155
|
+
{
|
|
235156
|
+
temperature: 0.1,
|
|
235157
|
+
maxOutputTokens: 4e3,
|
|
235158
|
+
abortSignal: AbortSignal.timeout(9e4)
|
|
235159
|
+
// 90 second timeout (increased for reasoning)
|
|
235160
|
+
},
|
|
235161
|
+
false,
|
|
235162
|
+
// debug
|
|
235163
|
+
void 0,
|
|
235164
|
+
// context
|
|
235165
|
+
reasoningConfig
|
|
235166
|
+
// reasoning config
|
|
235167
|
+
);
|
|
235029
235168
|
writeFileSync3(outputPath, cleanGeneratedCode(text2));
|
|
235030
235169
|
}
|
|
235031
|
-
async function generateStatusComponentFile(componentData, componentId, outputPath, modelSettings) {
|
|
235170
|
+
async function generateStatusComponentFile(componentData, componentId, outputPath, modelSettings, reasoningConfig) {
|
|
235032
235171
|
const model = createModel(modelSettings);
|
|
235033
235172
|
const promptTemplate = `Generate a TypeScript file for an Inkeep status component.
|
|
235034
235173
|
|
|
@@ -235090,11 +235229,23 @@ export const simpleStatus = statusComponent({
|
|
|
235090
235229
|
});
|
|
235091
235230
|
|
|
235092
235231
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
235093
|
-
const text2 = await generateTextWithPlaceholders(
|
|
235094
|
-
|
|
235095
|
-
|
|
235096
|
-
|
|
235097
|
-
|
|
235232
|
+
const text2 = await generateTextWithPlaceholders(
|
|
235233
|
+
model,
|
|
235234
|
+
componentData,
|
|
235235
|
+
promptTemplate,
|
|
235236
|
+
{
|
|
235237
|
+
temperature: 0.1,
|
|
235238
|
+
maxOutputTokens: 4e3,
|
|
235239
|
+
abortSignal: AbortSignal.timeout(9e4)
|
|
235240
|
+
// 90 second timeout (increased for reasoning)
|
|
235241
|
+
},
|
|
235242
|
+
false,
|
|
235243
|
+
// debug
|
|
235244
|
+
void 0,
|
|
235245
|
+
// context
|
|
235246
|
+
reasoningConfig
|
|
235247
|
+
// reasoning config
|
|
235248
|
+
);
|
|
235098
235249
|
writeFileSync3(outputPath, cleanGeneratedCode(text2));
|
|
235099
235250
|
}
|
|
235100
235251
|
async function generateEnvironmentFiles(environmentsDir, credentials, environment = "development") {
|
|
@@ -235315,6 +235466,7 @@ var init_pull_llm_generate = __esm({
|
|
|
235315
235466
|
"use strict";
|
|
235316
235467
|
init_esm_shims();
|
|
235317
235468
|
init_src();
|
|
235469
|
+
init_env2();
|
|
235318
235470
|
init_pull_placeholder_system();
|
|
235319
235471
|
require3 = createRequire2(import.meta.url);
|
|
235320
235472
|
PROJECT_JSON_EXAMPLE = `
|
|
@@ -236759,13 +236911,13 @@ __export(unified_generator_exports, {
|
|
|
236759
236911
|
generateFilesFromPlan: () => generateFilesFromPlan
|
|
236760
236912
|
});
|
|
236761
236913
|
import { writeFileSync as writeFileSync4 } from "fs";
|
|
236762
|
-
async function generateFilesFromPlan(plan, projectData, dirs, modelSettings, debug = false) {
|
|
236914
|
+
async function generateFilesFromPlan(plan, projectData, dirs, modelSettings, debug = false, reasoningConfig) {
|
|
236763
236915
|
const startTime = Date.now();
|
|
236764
236916
|
if (debug) {
|
|
236765
236917
|
console.log(`[DEBUG] Starting parallel generation of ${plan.files.length} files...`);
|
|
236766
236918
|
}
|
|
236767
236919
|
const tasks2 = plan.files.map(
|
|
236768
|
-
(fileInfo, index2) => generateFile(fileInfo, projectData, plan, dirs, modelSettings, debug).then(() => {
|
|
236920
|
+
(fileInfo, index2) => generateFile(fileInfo, projectData, plan, dirs, modelSettings, debug, reasoningConfig).then(() => {
|
|
236769
236921
|
if (debug) {
|
|
236770
236922
|
const elapsed = ((Date.now() - startTime) / 1e3).toFixed(1);
|
|
236771
236923
|
console.log(
|
|
@@ -236782,7 +236934,7 @@ async function generateFilesFromPlan(plan, projectData, dirs, modelSettings, deb
|
|
|
236782
236934
|
);
|
|
236783
236935
|
}
|
|
236784
236936
|
}
|
|
236785
|
-
async function generateFile(fileInfo, projectData, plan, dirs, modelSettings, debug) {
|
|
236937
|
+
async function generateFile(fileInfo, projectData, plan, dirs, modelSettings, debug, reasoningConfig) {
|
|
236786
236938
|
const fileStartTime = Date.now();
|
|
236787
236939
|
const model = createModel(modelSettings);
|
|
236788
236940
|
const outputPath = `${dirs.projectRoot}/${fileInfo.path}`;
|
|
@@ -236808,10 +236960,13 @@ async function generateFile(fileInfo, projectData, plan, dirs, modelSettings, de
|
|
|
236808
236960
|
{
|
|
236809
236961
|
temperature: 0.1,
|
|
236810
236962
|
maxOutputTokens: fileInfo.type === "agent" ? 16e3 : 4e3,
|
|
236811
|
-
abortSignal: AbortSignal.timeout(fileInfo.type === "agent" ?
|
|
236963
|
+
abortSignal: AbortSignal.timeout(fileInfo.type === "agent" ? 3e5 : 9e4)
|
|
236964
|
+
// Increased for reasoning (5 min for agents, 90s for others)
|
|
236812
236965
|
},
|
|
236813
236966
|
debug,
|
|
236814
|
-
{ fileType: fileInfo.type }
|
|
236967
|
+
{ fileType: fileInfo.type },
|
|
236968
|
+
reasoningConfig
|
|
236969
|
+
// Pass reasoning config
|
|
236815
236970
|
);
|
|
236816
236971
|
const llmDuration = ((Date.now() - llmStartTime) / 1e3).toFixed(1);
|
|
236817
236972
|
const cleanedCode = cleanGeneratedCode(text2);
|
|
@@ -237771,35 +237926,7 @@ var init_plan_storage = __esm({
|
|
|
237771
237926
|
|
|
237772
237927
|
// src/index.ts
|
|
237773
237928
|
init_esm_shims();
|
|
237774
|
-
|
|
237775
|
-
// src/env.ts
|
|
237776
|
-
init_esm_shims();
|
|
237777
|
-
init_src();
|
|
237778
|
-
import { z as z12 } from "zod";
|
|
237779
|
-
loadEnvironmentFiles();
|
|
237780
|
-
var envSchema2 = z12.object({
|
|
237781
|
-
DEBUG: z12.string().optional(),
|
|
237782
|
-
// Secrets loaded from .env files (relative to where CLI is executed)
|
|
237783
|
-
ANTHROPIC_API_KEY: z12.string().optional()
|
|
237784
|
-
});
|
|
237785
|
-
var parseEnv2 = () => {
|
|
237786
|
-
try {
|
|
237787
|
-
const parsedEnv = envSchema2.parse(process.env);
|
|
237788
|
-
return parsedEnv;
|
|
237789
|
-
} catch (error) {
|
|
237790
|
-
if (error instanceof z12.ZodError) {
|
|
237791
|
-
const missingVars = error.issues.map((issue) => issue.path.join("."));
|
|
237792
|
-
throw new Error(
|
|
237793
|
-
`\u274C Invalid environment variables: ${missingVars.join(", ")}
|
|
237794
|
-
${error.message}`
|
|
237795
|
-
);
|
|
237796
|
-
}
|
|
237797
|
-
throw error;
|
|
237798
|
-
}
|
|
237799
|
-
};
|
|
237800
|
-
var env2 = parseEnv2();
|
|
237801
|
-
|
|
237802
|
-
// src/index.ts
|
|
237929
|
+
init_env2();
|
|
237803
237930
|
import { readFileSync as readFileSync7 } from "fs";
|
|
237804
237931
|
import { dirname as dirname6, join as join13 } from "path";
|
|
237805
237932
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
@@ -238837,7 +238964,6 @@ ${table.toString()}`);
|
|
|
238837
238964
|
|
|
238838
238965
|
// src/commands/pull.ts
|
|
238839
238966
|
init_esm_shims();
|
|
238840
|
-
init_src();
|
|
238841
238967
|
import { existsSync as existsSync9, mkdirSync as mkdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync6 } from "fs";
|
|
238842
238968
|
import { dirname as dirname5, join as join10, resolve as resolve4 } from "path";
|
|
238843
238969
|
import chalk9 from "chalk";
|
|
@@ -239208,24 +239334,30 @@ function createProjectStructure(projectDir, projectId, useCurrentDirectory = fal
|
|
|
239208
239334
|
}
|
|
239209
239335
|
async function pullProjectCommand(options) {
|
|
239210
239336
|
performBackgroundVersionCheck();
|
|
239211
|
-
|
|
239212
|
-
|
|
239337
|
+
let provider;
|
|
239338
|
+
try {
|
|
239339
|
+
const { detectAvailableProvider: detectAvailableProvider2 } = await Promise.resolve().then(() => (init_pull_llm_generate(), pull_llm_generate_exports));
|
|
239340
|
+
provider = detectAvailableProvider2();
|
|
239341
|
+
console.log(chalk9.gray(`
|
|
239342
|
+
\u{1F916} Using ${provider.charAt(0).toUpperCase() + provider.slice(1)} for code generation`));
|
|
239343
|
+
} catch (error) {
|
|
239213
239344
|
console.error(
|
|
239214
|
-
chalk9.red("\n\u274C Error:
|
|
239345
|
+
chalk9.red("\n\u274C Error: No LLM provider API key found")
|
|
239215
239346
|
);
|
|
239216
239347
|
console.error(
|
|
239217
239348
|
chalk9.yellow(
|
|
239218
|
-
"\nThe pull command
|
|
239349
|
+
"\nThe pull command requires AI to generate TypeScript files from your project configuration."
|
|
239219
239350
|
)
|
|
239220
239351
|
);
|
|
239221
|
-
console.error(chalk9.yellow("
|
|
239222
|
-
console.error(chalk9.cyan("
|
|
239223
|
-
console.error(chalk9.gray("
|
|
239224
|
-
console.error(chalk9.gray("
|
|
239225
|
-
console.error(chalk9.gray("
|
|
239226
|
-
console.error(chalk9.gray("
|
|
239227
|
-
console.error(chalk9.gray("
|
|
239228
|
-
console.error(chalk9.
|
|
239352
|
+
console.error(chalk9.yellow("You must provide an API key for one of these providers:\n"));
|
|
239353
|
+
console.error(chalk9.cyan("Options:"));
|
|
239354
|
+
console.error(chalk9.gray(" \u2022 Anthropic: https://console.anthropic.com/"));
|
|
239355
|
+
console.error(chalk9.gray(" Set: ANTHROPIC_API_KEY=your_api_key_here\n"));
|
|
239356
|
+
console.error(chalk9.gray(" \u2022 OpenAI: https://platform.openai.com/"));
|
|
239357
|
+
console.error(chalk9.gray(" Set: OPENAI_API_KEY=your_api_key_here\n"));
|
|
239358
|
+
console.error(chalk9.gray(" \u2022 Google: https://ai.google.dev/"));
|
|
239359
|
+
console.error(chalk9.gray(" Set: GOOGLE_API_KEY=your_api_key_here\n"));
|
|
239360
|
+
console.error(chalk9.yellow("\u{1F4A1} Note: Set the key in your environment or .env file"));
|
|
239229
239361
|
process.exit(1);
|
|
239230
239362
|
}
|
|
239231
239363
|
const spinner = ora5("Loading configuration...").start();
|
|
@@ -239486,10 +239618,17 @@ async function pullProjectCommand(options) {
|
|
|
239486
239618
|
}
|
|
239487
239619
|
spinner.start("Generating file structure plan...");
|
|
239488
239620
|
const { generatePlan: generatePlan2 } = await Promise.resolve().then(() => (init_plan_builder(), plan_builder_exports));
|
|
239489
|
-
const { createModel: createModel2 } = await Promise.resolve().then(() => (init_pull_llm_generate(), pull_llm_generate_exports));
|
|
239621
|
+
const { createModel: createModel2, getDefaultModelForProvider: getDefaultModelForProvider2, getModelConfigWithReasoning: getModelConfigWithReasoning2 } = await Promise.resolve().then(() => (init_pull_llm_generate(), pull_llm_generate_exports));
|
|
239622
|
+
const selectedModel = getDefaultModelForProvider2(provider);
|
|
239623
|
+
const reasoningConfig = getModelConfigWithReasoning2(provider);
|
|
239490
239624
|
const modelSettings = {
|
|
239491
|
-
model:
|
|
239625
|
+
model: selectedModel
|
|
239492
239626
|
};
|
|
239627
|
+
if (options.debug) {
|
|
239628
|
+
console.log(chalk9.gray(`
|
|
239629
|
+
\u{1F4CD} Debug: Model selected: ${selectedModel}`));
|
|
239630
|
+
console.log(chalk9.gray(`\u{1F4CD} Debug: Reasoning enabled: ${Object.keys(reasoningConfig).length > 0 ? "Yes" : "No"}`));
|
|
239631
|
+
}
|
|
239493
239632
|
const targetEnvironment = options.env || "development";
|
|
239494
239633
|
const plan = await generatePlan2(projectData, patterns, modelSettings, createModel2, targetEnvironment);
|
|
239495
239634
|
spinner.succeed("Generation plan created");
|
|
@@ -239499,7 +239638,15 @@ async function pullProjectCommand(options) {
|
|
|
239499
239638
|
spinner.start("Generating project files with LLM...");
|
|
239500
239639
|
const { generateFilesFromPlan: generateFilesFromPlan2 } = await Promise.resolve().then(() => (init_unified_generator(), unified_generator_exports));
|
|
239501
239640
|
const generationStart = Date.now();
|
|
239502
|
-
await generateFilesFromPlan2(
|
|
239641
|
+
await generateFilesFromPlan2(
|
|
239642
|
+
plan,
|
|
239643
|
+
projectData,
|
|
239644
|
+
dirs,
|
|
239645
|
+
modelSettings,
|
|
239646
|
+
options.debug || false,
|
|
239647
|
+
reasoningConfig
|
|
239648
|
+
// Pass reasoning config for enhanced code generation
|
|
239649
|
+
);
|
|
239503
239650
|
const generationDuration = Date.now() - generationStart;
|
|
239504
239651
|
spinner.succeed("Project files generated");
|
|
239505
239652
|
const { displayGenerationComplete: displayGenerationComplete2 } = await Promise.resolve().then(() => (init_display_utils(), display_utils_exports));
|
|
@@ -239599,6 +239746,7 @@ async function pullProjectCommand(options) {
|
|
|
239599
239746
|
|
|
239600
239747
|
// src/commands/push.ts
|
|
239601
239748
|
init_esm_shims();
|
|
239749
|
+
init_env2();
|
|
239602
239750
|
import { existsSync as existsSync11 } from "fs";
|
|
239603
239751
|
import { join as join12, resolve as resolve5 } from "path";
|
|
239604
239752
|
import chalk10 from "chalk";
|
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-20251016161232",
|
|
4
4
|
"description": "Inkeep CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@ai-sdk/anthropic": "2.0.2",
|
|
24
|
+
"@ai-sdk/google": "^2.0.0",
|
|
24
25
|
"@ai-sdk/openai": "2.0.11",
|
|
25
26
|
"@babel/parser": "^7.23.0",
|
|
26
27
|
"@babel/types": "^7.23.0",
|
|
@@ -46,8 +47,8 @@
|
|
|
46
47
|
"recast": "^0.23.0",
|
|
47
48
|
"ts-morph": "^26.0.0",
|
|
48
49
|
"tsx": "^4.20.5",
|
|
49
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
50
|
-
"@inkeep/agents-sdk": "^0.0.0-dev-
|
|
50
|
+
"@inkeep/agents-core": "^0.0.0-dev-20251016161232",
|
|
51
|
+
"@inkeep/agents-sdk": "^0.0.0-dev-20251016161232"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@types/degit": "^2.8.6",
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
"vitest": "^3.2.4"
|
|
63
64
|
},
|
|
64
65
|
"peerDependencies": {
|
|
65
|
-
"@inkeep/agents-manage-ui": "0.0.0-dev-
|
|
66
|
+
"@inkeep/agents-manage-ui": "0.0.0-dev-20251016161232",
|
|
66
67
|
"zod": "^4.1.11"
|
|
67
68
|
},
|
|
68
69
|
"engines": {
|