openkitt 0.2.9 → 0.3.1
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/cli.js +98 -69
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -255595,8 +255595,8 @@ var {
|
|
|
255595
255595
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
255596
255596
|
import { createInterface, emitKeypressEvents } from "node:readline";
|
|
255597
255597
|
import { stdin as input, stdout as output } from "node:process";
|
|
255598
|
-
import { existsSync as
|
|
255599
|
-
import { homedir as
|
|
255598
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync11, readFileSync as readFileSync14, writeFileSync as writeFileSync15, realpathSync } from "node:fs";
|
|
255599
|
+
import { homedir as homedir5 } from "node:os";
|
|
255600
255600
|
import { join as join23, resolve as resolve6, dirname as dirname5 } from "node:path";
|
|
255601
255601
|
import { pathToFileURL } from "node:url";
|
|
255602
255602
|
|
|
@@ -256993,6 +256993,16 @@ var WORKSPACE_REQUIRED = new Set([
|
|
|
256993
256993
|
"status",
|
|
256994
256994
|
"versions"
|
|
256995
256995
|
]);
|
|
256996
|
+
var APPS_REQUIRED = new Set([
|
|
256997
|
+
"delete",
|
|
256998
|
+
"run",
|
|
256999
|
+
"deploy",
|
|
257000
|
+
"deploy:template",
|
|
257001
|
+
"env:create",
|
|
257002
|
+
"env:vars",
|
|
257003
|
+
"domain",
|
|
257004
|
+
"logs"
|
|
257005
|
+
]);
|
|
256996
257006
|
var COMMAND_AUTH = {
|
|
256997
257007
|
login: "none",
|
|
256998
257008
|
logout: "none",
|
|
@@ -257021,6 +257031,16 @@ async function checkAuthGuard(commandKey) {
|
|
|
257021
257031
|
message: "No KITT workspace found. Run /init to initialize one."
|
|
257022
257032
|
};
|
|
257023
257033
|
}
|
|
257034
|
+
if (APPS_REQUIRED.has(commandKey)) {
|
|
257035
|
+
const manifest = readManifest(workspaceRoot);
|
|
257036
|
+
const appCount = manifest ? Object.keys(manifest.apps).length : 0;
|
|
257037
|
+
if (appCount === 0) {
|
|
257038
|
+
return {
|
|
257039
|
+
allowed: false,
|
|
257040
|
+
message: "No apps in this workspace yet. Run /create to add your first app."
|
|
257041
|
+
};
|
|
257042
|
+
}
|
|
257043
|
+
}
|
|
257024
257044
|
}
|
|
257025
257045
|
const requirement = COMMAND_AUTH[commandKey];
|
|
257026
257046
|
if (!requirement || requirement === "none") {
|
|
@@ -257195,8 +257215,8 @@ function registerCleanupHandlers() {
|
|
|
257195
257215
|
}
|
|
257196
257216
|
|
|
257197
257217
|
// src/commands/init.ts
|
|
257198
|
-
import { chmodSync as chmodSync4, mkdirSync as mkdirSync7, readdirSync as readdirSync2, writeFileSync as writeFileSync8 } from "node:fs";
|
|
257199
|
-
import { platform as platform5 } from "node:os";
|
|
257218
|
+
import { chmodSync as chmodSync4, existsSync as existsSync10, mkdirSync as mkdirSync7, readdirSync as readdirSync2, readFileSync as readFileSync7, writeFileSync as writeFileSync8 } from "node:fs";
|
|
257219
|
+
import { homedir as homedir3, platform as platform5 } from "node:os";
|
|
257200
257220
|
import { basename, join as join11, resolve as resolve2 } from "node:path";
|
|
257201
257221
|
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
257202
257222
|
init_config();
|
|
@@ -257583,12 +257603,7 @@ function createOpenAiClient(Provider, apiKey, model, rateLimiter) {
|
|
|
257583
257603
|
model,
|
|
257584
257604
|
messages: [
|
|
257585
257605
|
{ role: "system", content: options.systemPrompt },
|
|
257586
|
-
...options.conversationHistory
|
|
257587
|
-
...options.toolResults.map((result) => ({
|
|
257588
|
-
role: "tool",
|
|
257589
|
-
tool_call_id: result.toolCallId,
|
|
257590
|
-
content: result.content
|
|
257591
|
-
}))
|
|
257606
|
+
...options.conversationHistory
|
|
257592
257607
|
],
|
|
257593
257608
|
max_tokens: ensureMaxTokens(options.maxTokens),
|
|
257594
257609
|
tools: options.tools.map((tool) => ({
|
|
@@ -257718,17 +257733,8 @@ function createGeminiClient(Provider, apiKey, model, rateLimiter) {
|
|
|
257718
257733
|
}
|
|
257719
257734
|
]
|
|
257720
257735
|
});
|
|
257721
|
-
const toolResultSummary = options.toolResults.map((result) => `Tool ${result.toolCallId}: ${result.content}`).join(`
|
|
257722
|
-
`);
|
|
257723
257736
|
const response = await modelClient.generateContent({
|
|
257724
|
-
contents:
|
|
257725
|
-
...options.conversationHistory,
|
|
257726
|
-
{
|
|
257727
|
-
role: "user",
|
|
257728
|
-
parts: [{ text: `Tool results:
|
|
257729
|
-
${toolResultSummary}` }]
|
|
257730
|
-
}
|
|
257731
|
-
],
|
|
257737
|
+
contents: options.conversationHistory,
|
|
257732
257738
|
generationConfig: { maxOutputTokens: ensureMaxTokens(options.maxTokens) }
|
|
257733
257739
|
});
|
|
257734
257740
|
const candidate = response.response.candidates?.[0];
|
|
@@ -258032,6 +258038,7 @@ function buildOperationsContext(command, args, manifest) {
|
|
|
258032
258038
|
}
|
|
258033
258039
|
async function executeOperations(options) {
|
|
258034
258040
|
const { llmClient, mcpClient, context, projectGuard } = options;
|
|
258041
|
+
const provider = llmClient.getProvider();
|
|
258035
258042
|
const tools = toLlmTools(await mcpClient.listTools());
|
|
258036
258043
|
const userMessage = JSON.stringify(context, null, 2);
|
|
258037
258044
|
const conversationHistory = [{ role: "user", content: userMessage }];
|
|
@@ -258049,16 +258056,27 @@ async function executeOperations(options) {
|
|
|
258049
258056
|
if (!hasToolCalls && expectsToolCalls) {
|
|
258050
258057
|
return response.content;
|
|
258051
258058
|
}
|
|
258052
|
-
conversationHistory.push(toAssistantHistoryEntry(response,
|
|
258059
|
+
conversationHistory.push(toAssistantHistoryEntry(response, provider));
|
|
258053
258060
|
const toolResults = [];
|
|
258054
258061
|
for (const toolCall of response.toolCalls) {
|
|
258055
|
-
const result = await executeToolCall({
|
|
258056
|
-
toolCall,
|
|
258057
|
-
mcpClient,
|
|
258058
|
-
projectGuard
|
|
258059
|
-
});
|
|
258062
|
+
const result = await executeToolCall({ toolCall, mcpClient, projectGuard });
|
|
258060
258063
|
toolResults.push(result);
|
|
258061
258064
|
}
|
|
258065
|
+
if (provider === "anthropic") {
|
|
258066
|
+
conversationHistory.push({
|
|
258067
|
+
role: "user",
|
|
258068
|
+
content: toolResults.map((r2) => ({
|
|
258069
|
+
type: "tool_result",
|
|
258070
|
+
tool_use_id: r2.toolCallId,
|
|
258071
|
+
content: r2.content,
|
|
258072
|
+
is_error: r2.isError ?? false
|
|
258073
|
+
}))
|
|
258074
|
+
});
|
|
258075
|
+
} else {
|
|
258076
|
+
for (const r2 of toolResults) {
|
|
258077
|
+
conversationHistory.push({ role: "tool", tool_call_id: r2.toolCallId, content: r2.content });
|
|
258078
|
+
}
|
|
258079
|
+
}
|
|
258062
258080
|
response = await llmClient.sendToolResults({
|
|
258063
258081
|
conversationHistory,
|
|
258064
258082
|
toolResults,
|
|
@@ -258801,18 +258819,29 @@ function writeWorkspacePackageManagerFiles(workspaceDir, packageManager) {
|
|
|
258801
258819
|
}
|
|
258802
258820
|
}
|
|
258803
258821
|
function extractRailwayProjectId(operationsResult) {
|
|
258822
|
+
const railwayConfig = join11(homedir3(), ".railway", "config.json");
|
|
258823
|
+
if (existsSync10(railwayConfig)) {
|
|
258824
|
+
try {
|
|
258825
|
+
const raw = readFileSync7(railwayConfig, "utf-8");
|
|
258826
|
+
const cfg = JSON.parse(raw);
|
|
258827
|
+
const cwd = resolve2(".");
|
|
258828
|
+
const linked = cfg.projects?.[cwd];
|
|
258829
|
+
if (linked?.project)
|
|
258830
|
+
return linked.project;
|
|
258831
|
+
} catch {}
|
|
258832
|
+
}
|
|
258804
258833
|
const jsonProjectId = /"projectId"\s*:\s*"([^"]+)"/i.exec(operationsResult);
|
|
258805
|
-
if (jsonProjectId?.[1])
|
|
258834
|
+
if (jsonProjectId?.[1])
|
|
258806
258835
|
return jsonProjectId[1].trim();
|
|
258807
|
-
}
|
|
258808
258836
|
const prefixedProjectId = /\bproj_[A-Za-z0-9_-]+\b/.exec(operationsResult);
|
|
258809
|
-
if (prefixedProjectId?.[0])
|
|
258837
|
+
if (prefixedProjectId?.[0])
|
|
258810
258838
|
return prefixedProjectId[0];
|
|
258811
|
-
}
|
|
258839
|
+
const uuidPattern = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/i.exec(operationsResult);
|
|
258840
|
+
if (uuidPattern?.[0])
|
|
258841
|
+
return uuidPattern[0];
|
|
258812
258842
|
const labeledProjectId = /project\s*id\s*[:=]\s*[`"']?([A-Za-z0-9_-]+)[`"']?/i.exec(operationsResult);
|
|
258813
|
-
if (labeledProjectId?.[1])
|
|
258843
|
+
if (labeledProjectId?.[1])
|
|
258814
258844
|
return labeledProjectId[1];
|
|
258815
|
-
}
|
|
258816
258845
|
return null;
|
|
258817
258846
|
}
|
|
258818
258847
|
async function initCommand(context, _args) {
|
|
@@ -258951,7 +258980,7 @@ async function initCommand(context, _args) {
|
|
|
258951
258980
|
}
|
|
258952
258981
|
|
|
258953
258982
|
// src/commands/create.ts
|
|
258954
|
-
import { existsSync as
|
|
258983
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync10 } from "node:fs";
|
|
258955
258984
|
import { join as join18 } from "node:path";
|
|
258956
258985
|
init_config();
|
|
258957
258986
|
|
|
@@ -259346,7 +259375,7 @@ function recordAppInManifest(options) {
|
|
|
259346
259375
|
}
|
|
259347
259376
|
|
|
259348
259377
|
// src/commands/create-scaffolding.ts
|
|
259349
|
-
import { readFileSync as
|
|
259378
|
+
import { readFileSync as readFileSync8, writeFileSync as writeFileSync9 } from "node:fs";
|
|
259350
259379
|
import { join as join12 } from "node:path";
|
|
259351
259380
|
|
|
259352
259381
|
// src/prompts/scaffolding.ts
|
|
@@ -262176,7 +262205,7 @@ async function runPreflightAndAutoHeal(versions, neededKeys, workspaceDir) {
|
|
|
262176
262205
|
}
|
|
262177
262206
|
if (healedEntries.length > 0) {
|
|
262178
262207
|
const versionsPath = join12(workspaceDir, "versions.md");
|
|
262179
|
-
const { entries: existingEntries } = parseVersionsTable(
|
|
262208
|
+
const { entries: existingEntries } = parseVersionsTable(readFileSync8(versionsPath, "utf8"));
|
|
262180
262209
|
const healMap = new Map(healedEntries.map((e2) => [e2.integration, e2.version]));
|
|
262181
262210
|
const updatedEntries = existingEntries.map((e2) => ({
|
|
262182
262211
|
integration: e2.integration,
|
|
@@ -262190,7 +262219,7 @@ async function runPreflightAndAutoHeal(versions, neededKeys, workspaceDir) {
|
|
|
262190
262219
|
async function executeCreateScaffolding(options) {
|
|
262191
262220
|
const neededKeys = resolveNeededVersionKeys(options.selections, options.resolvedIntegrations);
|
|
262192
262221
|
const versionsPath = join12(options.workspaceDir, "versions.md");
|
|
262193
|
-
const versionsContent =
|
|
262222
|
+
const versionsContent = readFileSync8(versionsPath, "utf8");
|
|
262194
262223
|
const primaryVersions = toVersionsRecord(versionsContent);
|
|
262195
262224
|
const [secondaryVersions, healedPrimary] = await Promise.all([
|
|
262196
262225
|
fetchSecondaryVersions(),
|
|
@@ -262235,7 +262264,7 @@ async function executeCreateScaffolding(options) {
|
|
|
262235
262264
|
}
|
|
262236
262265
|
|
|
262237
262266
|
// src/sandbox/scanner.ts
|
|
262238
|
-
import { existsSync as
|
|
262267
|
+
import { existsSync as existsSync11, lstatSync, readFileSync as readFileSync9 } from "node:fs";
|
|
262239
262268
|
import { extname, isAbsolute, join as join13, normalize, resolve as resolve3 } from "node:path";
|
|
262240
262269
|
var ALLOWED_EXTENSIONS = new Set([
|
|
262241
262270
|
".ts",
|
|
@@ -262311,7 +262340,7 @@ function validateFilePath(filePath) {
|
|
|
262311
262340
|
detail: "Path contains '..' segments and may escape the workspace"
|
|
262312
262341
|
});
|
|
262313
262342
|
}
|
|
262314
|
-
if (
|
|
262343
|
+
if (existsSync11(filePath)) {
|
|
262315
262344
|
const stats = lstatSync(filePath);
|
|
262316
262345
|
if (stats.isSymbolicLink()) {
|
|
262317
262346
|
warnings.push({
|
|
@@ -262353,7 +262382,7 @@ function scanStagedFiles(workspaceDir) {
|
|
|
262353
262382
|
continue;
|
|
262354
262383
|
}
|
|
262355
262384
|
const stagedAbsolutePath = resolve3(stagingRoot, normalize(stagedFile.relativePath));
|
|
262356
|
-
const stagedContent =
|
|
262385
|
+
const stagedContent = readFileSync9(stagedAbsolutePath, "utf-8");
|
|
262357
262386
|
warnings.push(...scanFileContent(stagedFile.relativePath, stagedContent));
|
|
262358
262387
|
}
|
|
262359
262388
|
for (const warning of warnings) {
|
|
@@ -262420,7 +262449,7 @@ async function confirmAndApply(options) {
|
|
|
262420
262449
|
// src/ast/engine.ts
|
|
262421
262450
|
var import_ts_morph = __toESM(require_ts_morph(), 1);
|
|
262422
262451
|
import { createHash as createHash3 } from "node:crypto";
|
|
262423
|
-
import { existsSync as
|
|
262452
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync8, writeFileSync as writeFileSync10 } from "node:fs";
|
|
262424
262453
|
import { dirname as dirname4, isAbsolute as isAbsolute2, join as join14, normalize as normalize2, relative as relative2, resolve as resolve4 } from "node:path";
|
|
262425
262454
|
var KITT_DIR2 = ".kitt";
|
|
262426
262455
|
var STAGING_DIR2 = "staging";
|
|
@@ -262465,7 +262494,7 @@ function createAstEngine(workspaceDir) {
|
|
|
262465
262494
|
if (!isRelativePathInside(workspaceDir, fullPath)) {
|
|
262466
262495
|
throw new Error(`Path is outside workspace: ${relativePath}`);
|
|
262467
262496
|
}
|
|
262468
|
-
if (!
|
|
262497
|
+
if (!existsSync12(fullPath)) {
|
|
262469
262498
|
throw new Error(`File does not exist: ${relativePath}`);
|
|
262470
262499
|
}
|
|
262471
262500
|
const existing = project.getSourceFile(fullPath);
|
|
@@ -262853,7 +262882,7 @@ function applyOperation(sourceFile, operation) {
|
|
|
262853
262882
|
|
|
262854
262883
|
// src/ast/validator.ts
|
|
262855
262884
|
var import_ts_morph3 = __toESM(require_ts_morph(), 1);
|
|
262856
|
-
import { existsSync as
|
|
262885
|
+
import { existsSync as existsSync13 } from "node:fs";
|
|
262857
262886
|
import { extname as extname2, isAbsolute as isAbsolute3, normalize as normalize3, relative as relative3, resolve as resolve5 } from "node:path";
|
|
262858
262887
|
var VALID_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx"]);
|
|
262859
262888
|
var TARGET_FILE_OPERATION = { op: "targetFile" };
|
|
@@ -263040,7 +263069,7 @@ function validateTargetFile(workspaceDir, filePath) {
|
|
|
263040
263069
|
message: `Path is outside workspace: ${filePath}`
|
|
263041
263070
|
});
|
|
263042
263071
|
}
|
|
263043
|
-
if (!
|
|
263072
|
+
if (!existsSync13(absoluteTargetPath)) {
|
|
263044
263073
|
errors.push({
|
|
263045
263074
|
filePath,
|
|
263046
263075
|
operation: TARGET_FILE_OPERATION,
|
|
@@ -263421,17 +263450,17 @@ async function provisionInfrastructure(options) {
|
|
|
263421
263450
|
|
|
263422
263451
|
// src/commands/run.ts
|
|
263423
263452
|
import { spawn as spawn2 } from "node:child_process";
|
|
263424
|
-
import { existsSync as
|
|
263453
|
+
import { existsSync as existsSync15, readFileSync as readFileSync11 } from "node:fs";
|
|
263425
263454
|
import { join as join17 } from "node:path";
|
|
263426
263455
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
263427
263456
|
|
|
263428
263457
|
// src/commands/settings.ts
|
|
263429
263458
|
import { execSync as execSync6 } from "node:child_process";
|
|
263430
|
-
import { chmodSync as chmodSync5, existsSync as
|
|
263431
|
-
import { homedir as
|
|
263459
|
+
import { chmodSync as chmodSync5, existsSync as existsSync14, mkdirSync as mkdirSync9, readFileSync as readFileSync10, renameSync as renameSync5, rmSync as rmSync3, unlinkSync as unlinkSync4, writeFileSync as writeFileSync11 } from "node:fs";
|
|
263460
|
+
import { homedir as homedir4, platform as platform6 } from "node:os";
|
|
263432
263461
|
import { join as join16 } from "node:path";
|
|
263433
263462
|
var SUPPORTED_PACKAGE_MANAGERS = ["bun", "npm", "pnpm", "yarn"];
|
|
263434
|
-
var CONFIG_DIR2 = join16(
|
|
263463
|
+
var CONFIG_DIR2 = join16(homedir4(), ".kitt");
|
|
263435
263464
|
var CONFIG_FILE2 = join16(CONFIG_DIR2, "config.json");
|
|
263436
263465
|
var DIR_MODE3 = 448;
|
|
263437
263466
|
var FILE_MODE4 = 384;
|
|
@@ -263445,7 +263474,7 @@ function isWindows4() {
|
|
|
263445
263474
|
return platform6() === "win32";
|
|
263446
263475
|
}
|
|
263447
263476
|
function ensureConfigDir2() {
|
|
263448
|
-
if (!
|
|
263477
|
+
if (!existsSync14(CONFIG_DIR2)) {
|
|
263449
263478
|
mkdirSync9(CONFIG_DIR2, { recursive: true, mode: DIR_MODE3 });
|
|
263450
263479
|
}
|
|
263451
263480
|
if (!isWindows4()) {
|
|
@@ -263457,10 +263486,10 @@ function isPackageManager(value) {
|
|
|
263457
263486
|
}
|
|
263458
263487
|
function readGlobalConfig2() {
|
|
263459
263488
|
ensureConfigDir2();
|
|
263460
|
-
if (!
|
|
263489
|
+
if (!existsSync14(CONFIG_FILE2)) {
|
|
263461
263490
|
return {};
|
|
263462
263491
|
}
|
|
263463
|
-
const raw =
|
|
263492
|
+
const raw = readFileSync10(CONFIG_FILE2, "utf-8").trim();
|
|
263464
263493
|
if (raw.length === 0) {
|
|
263465
263494
|
return {};
|
|
263466
263495
|
}
|
|
@@ -263489,7 +263518,7 @@ function writeGlobalConfig2(config) {
|
|
|
263489
263518
|
chmodSync5(CONFIG_FILE2, FILE_MODE4);
|
|
263490
263519
|
}
|
|
263491
263520
|
} catch (writeError) {
|
|
263492
|
-
if (
|
|
263521
|
+
if (existsSync14(tempFile)) {
|
|
263493
263522
|
unlinkSync4(tempFile);
|
|
263494
263523
|
}
|
|
263495
263524
|
throw writeError;
|
|
@@ -263534,7 +263563,7 @@ function removePackageManagerArtifacts(workspaceDir, packageManager) {
|
|
|
263534
263563
|
}
|
|
263535
263564
|
function ensureWorkspaceFieldInRootPackageJson(workspaceDir) {
|
|
263536
263565
|
const packageJsonPath = join16(workspaceDir, "package.json");
|
|
263537
|
-
const raw =
|
|
263566
|
+
const raw = readFileSync10(packageJsonPath, "utf-8");
|
|
263538
263567
|
const parsed = JSON.parse(raw);
|
|
263539
263568
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
263540
263569
|
throw new Error("Root package.json must contain a JSON object.");
|
|
@@ -263698,12 +263727,12 @@ async function settingsCommand(context, args) {
|
|
|
263698
263727
|
var DEV_SCRIPT_CANDIDATES = ["dev", "start", "serve", "preview"];
|
|
263699
263728
|
function resolveDevScript(appDir) {
|
|
263700
263729
|
const pkgPath = join17(appDir, "package.json");
|
|
263701
|
-
if (!
|
|
263730
|
+
if (!existsSync15(pkgPath)) {
|
|
263702
263731
|
return { found: false, reason: "no-package-json", available: [] };
|
|
263703
263732
|
}
|
|
263704
263733
|
let pkg;
|
|
263705
263734
|
try {
|
|
263706
|
-
pkg = JSON.parse(
|
|
263735
|
+
pkg = JSON.parse(readFileSync11(pkgPath, "utf-8"));
|
|
263707
263736
|
} catch {
|
|
263708
263737
|
return { found: false, reason: "no-package-json", available: [] };
|
|
263709
263738
|
}
|
|
@@ -263985,7 +264014,7 @@ async function createCommand2(context, _args) {
|
|
|
263985
264014
|
});
|
|
263986
264015
|
logger.cmd("/create", "SUCCESS");
|
|
263987
264016
|
success(`App ${selections.appName} created.`);
|
|
263988
|
-
if (
|
|
264017
|
+
if (existsSync16(appDir)) {
|
|
263989
264018
|
const runCmd = getCommand(manifest.workspace.packageManager, "run");
|
|
263990
264019
|
const scriptResolution = resolveDevScript(appDir);
|
|
263991
264020
|
if (scriptResolution.found) {
|
|
@@ -264084,7 +264113,7 @@ async function deleteCommand(context, args) {
|
|
|
264084
264113
|
}
|
|
264085
264114
|
|
|
264086
264115
|
// src/commands/deploy.ts
|
|
264087
|
-
import { existsSync as
|
|
264116
|
+
import { existsSync as existsSync17, readdirSync as readdirSync3, readFileSync as readFileSync12, writeFileSync as writeFileSync13 } from "node:fs";
|
|
264088
264117
|
import { basename as basename2, join as join20 } from "node:path";
|
|
264089
264118
|
init_config();
|
|
264090
264119
|
|
|
@@ -264148,10 +264177,10 @@ function matchesGitignorePattern(filePath, pattern) {
|
|
|
264148
264177
|
}
|
|
264149
264178
|
function loadGitignorePatterns(workspaceDir) {
|
|
264150
264179
|
const gitignorePath = join20(workspaceDir, ".gitignore");
|
|
264151
|
-
if (!
|
|
264180
|
+
if (!existsSync17(gitignorePath)) {
|
|
264152
264181
|
return [];
|
|
264153
264182
|
}
|
|
264154
|
-
return
|
|
264183
|
+
return readFileSync12(gitignorePath, "utf-8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
264155
264184
|
}
|
|
264156
264185
|
function isIgnoredByGitignore(filePath, patterns) {
|
|
264157
264186
|
let ignored = false;
|
|
@@ -264218,7 +264247,7 @@ function scanEnvFilesForSecrets(workspaceDir) {
|
|
|
264218
264247
|
continue;
|
|
264219
264248
|
}
|
|
264220
264249
|
const fullPath = join20(workspaceDir, envFile);
|
|
264221
|
-
const content =
|
|
264250
|
+
const content = readFileSync12(fullPath, "utf-8");
|
|
264222
264251
|
if (hasSecretPattern(content)) {
|
|
264223
264252
|
blockedFiles.push(envFile);
|
|
264224
264253
|
}
|
|
@@ -264287,7 +264316,7 @@ restartPolicyMaxRetries = 3${deployEnv}`;
|
|
|
264287
264316
|
}
|
|
264288
264317
|
function ensureRailwayToml(appName, framework, packageManager) {
|
|
264289
264318
|
const railwayTomlPath = join20("apps", appName, "railway.toml");
|
|
264290
|
-
if (
|
|
264319
|
+
if (existsSync17(railwayTomlPath)) {
|
|
264291
264320
|
return false;
|
|
264292
264321
|
}
|
|
264293
264322
|
writeFileSync13(railwayTomlPath, generateRailwayToml(framework, packageManager), "utf-8");
|
|
@@ -264776,10 +264805,10 @@ var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
|
264776
264805
|
init_config();
|
|
264777
264806
|
|
|
264778
264807
|
// src/manifest/drift.ts
|
|
264779
|
-
import { existsSync as
|
|
264808
|
+
import { existsSync as existsSync18, readdirSync as readdirSync4 } from "node:fs";
|
|
264780
264809
|
import { join as join21 } from "node:path";
|
|
264781
264810
|
function listDirectories(parentDir) {
|
|
264782
|
-
if (!
|
|
264811
|
+
if (!existsSync18(parentDir)) {
|
|
264783
264812
|
return [];
|
|
264784
264813
|
}
|
|
264785
264814
|
return readdirSync4(parentDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort((left, right) => left.localeCompare(right));
|
|
@@ -265114,7 +265143,7 @@ async function loginCommand(context, args, commandKey = "login") {
|
|
|
265114
265143
|
}
|
|
265115
265144
|
|
|
265116
265145
|
// src/commands/versions.ts
|
|
265117
|
-
import { existsSync as
|
|
265146
|
+
import { existsSync as existsSync19, readFileSync as readFileSync13, writeFileSync as writeFileSync14 } from "node:fs";
|
|
265118
265147
|
import { join as join22 } from "node:path";
|
|
265119
265148
|
var import_picocolors9 = __toESM(require_picocolors(), 1);
|
|
265120
265149
|
var TABLE_HEADER_INTEGRATION = "Integration";
|
|
@@ -265159,12 +265188,12 @@ function loadVersionsContext(logger) {
|
|
|
265159
265188
|
return null;
|
|
265160
265189
|
}
|
|
265161
265190
|
const versionsPath = join22(workspaceDir, "versions.md");
|
|
265162
|
-
if (!
|
|
265191
|
+
if (!existsSync19(versionsPath)) {
|
|
265163
265192
|
error("versions.md not found in workspace root.");
|
|
265164
265193
|
logger.cmd("/versions", "FAILED", "versions.md missing");
|
|
265165
265194
|
return null;
|
|
265166
265195
|
}
|
|
265167
|
-
const versionsMarkdown =
|
|
265196
|
+
const versionsMarkdown = readFileSync13(versionsPath, "utf-8");
|
|
265168
265197
|
const result = parseVersionsTable(versionsMarkdown);
|
|
265169
265198
|
for (const parseError of result.errors) {
|
|
265170
265199
|
warn(parseError);
|
|
@@ -265592,7 +265621,7 @@ async function helpCommand(_context, _args) {
|
|
|
265592
265621
|
// package.json
|
|
265593
265622
|
var package_default = {
|
|
265594
265623
|
name: "openkitt",
|
|
265595
|
-
version: "0.
|
|
265624
|
+
version: "0.3.1",
|
|
265596
265625
|
description: "AI-powered monorepo scaffolding CLI",
|
|
265597
265626
|
keywords: [
|
|
265598
265627
|
"cli",
|
|
@@ -265664,7 +265693,7 @@ var STATE_CHANGING_COMMANDS = new Set([
|
|
|
265664
265693
|
"domain",
|
|
265665
265694
|
"publish"
|
|
265666
265695
|
]);
|
|
265667
|
-
var KITT_DIR3 = join23(
|
|
265696
|
+
var KITT_DIR3 = join23(homedir5(), ".kitt");
|
|
265668
265697
|
var UPDATE_CHECK_FILE = join23(KITT_DIR3, "update-check.json");
|
|
265669
265698
|
var commandRegistry = {
|
|
265670
265699
|
init: { handler: initCommand },
|
|
@@ -265745,11 +265774,11 @@ function isVersionNewer(latest, current) {
|
|
|
265745
265774
|
return false;
|
|
265746
265775
|
}
|
|
265747
265776
|
function hasFreshUpdateCache(now) {
|
|
265748
|
-
if (!
|
|
265777
|
+
if (!existsSync20(UPDATE_CHECK_FILE)) {
|
|
265749
265778
|
return false;
|
|
265750
265779
|
}
|
|
265751
265780
|
try {
|
|
265752
|
-
const rawCache =
|
|
265781
|
+
const rawCache = readFileSync14(UPDATE_CHECK_FILE, "utf-8").trim();
|
|
265753
265782
|
if (rawCache.length === 0) {
|
|
265754
265783
|
return false;
|
|
265755
265784
|
}
|