openkitt 0.2.9 → 0.3.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.
Files changed (2) hide show
  1. package/dist/cli.js +58 -47
  2. 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 existsSync19, mkdirSync as mkdirSync11, readFileSync as readFileSync13, writeFileSync as writeFileSync15, realpathSync } from "node:fs";
255599
- import { homedir as homedir4 } from "node:os";
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
 
@@ -257195,8 +257195,8 @@ function registerCleanupHandlers() {
257195
257195
  }
257196
257196
 
257197
257197
  // 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";
257198
+ import { chmodSync as chmodSync4, existsSync as existsSync10, mkdirSync as mkdirSync7, readdirSync as readdirSync2, readFileSync as readFileSync7, writeFileSync as writeFileSync8 } from "node:fs";
257199
+ import { homedir as homedir3, platform as platform5 } from "node:os";
257200
257200
  import { basename, join as join11, resolve as resolve2 } from "node:path";
257201
257201
  var import_picocolors5 = __toESM(require_picocolors(), 1);
257202
257202
  init_config();
@@ -258801,18 +258801,29 @@ function writeWorkspacePackageManagerFiles(workspaceDir, packageManager) {
258801
258801
  }
258802
258802
  }
258803
258803
  function extractRailwayProjectId(operationsResult) {
258804
+ const railwayConfig = join11(homedir3(), ".railway", "config.json");
258805
+ if (existsSync10(railwayConfig)) {
258806
+ try {
258807
+ const raw = readFileSync7(railwayConfig, "utf-8");
258808
+ const cfg = JSON.parse(raw);
258809
+ const cwd = resolve2(".");
258810
+ const linked = cfg.projects?.[cwd];
258811
+ if (linked?.project)
258812
+ return linked.project;
258813
+ } catch {}
258814
+ }
258804
258815
  const jsonProjectId = /"projectId"\s*:\s*"([^"]+)"/i.exec(operationsResult);
258805
- if (jsonProjectId?.[1]) {
258816
+ if (jsonProjectId?.[1])
258806
258817
  return jsonProjectId[1].trim();
258807
- }
258808
258818
  const prefixedProjectId = /\bproj_[A-Za-z0-9_-]+\b/.exec(operationsResult);
258809
- if (prefixedProjectId?.[0]) {
258819
+ if (prefixedProjectId?.[0])
258810
258820
  return prefixedProjectId[0];
258811
- }
258821
+ 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);
258822
+ if (uuidPattern?.[0])
258823
+ return uuidPattern[0];
258812
258824
  const labeledProjectId = /project\s*id\s*[:=]\s*[`"']?([A-Za-z0-9_-]+)[`"']?/i.exec(operationsResult);
258813
- if (labeledProjectId?.[1]) {
258825
+ if (labeledProjectId?.[1])
258814
258826
  return labeledProjectId[1];
258815
- }
258816
258827
  return null;
258817
258828
  }
258818
258829
  async function initCommand(context, _args) {
@@ -258951,7 +258962,7 @@ async function initCommand(context, _args) {
258951
258962
  }
258952
258963
 
258953
258964
  // src/commands/create.ts
258954
- import { existsSync as existsSync15, mkdirSync as mkdirSync10 } from "node:fs";
258965
+ import { existsSync as existsSync16, mkdirSync as mkdirSync10 } from "node:fs";
258955
258966
  import { join as join18 } from "node:path";
258956
258967
  init_config();
258957
258968
 
@@ -259346,7 +259357,7 @@ function recordAppInManifest(options) {
259346
259357
  }
259347
259358
 
259348
259359
  // src/commands/create-scaffolding.ts
259349
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync9 } from "node:fs";
259360
+ import { readFileSync as readFileSync8, writeFileSync as writeFileSync9 } from "node:fs";
259350
259361
  import { join as join12 } from "node:path";
259351
259362
 
259352
259363
  // src/prompts/scaffolding.ts
@@ -262176,7 +262187,7 @@ async function runPreflightAndAutoHeal(versions, neededKeys, workspaceDir) {
262176
262187
  }
262177
262188
  if (healedEntries.length > 0) {
262178
262189
  const versionsPath = join12(workspaceDir, "versions.md");
262179
- const { entries: existingEntries } = parseVersionsTable(readFileSync7(versionsPath, "utf8"));
262190
+ const { entries: existingEntries } = parseVersionsTable(readFileSync8(versionsPath, "utf8"));
262180
262191
  const healMap = new Map(healedEntries.map((e2) => [e2.integration, e2.version]));
262181
262192
  const updatedEntries = existingEntries.map((e2) => ({
262182
262193
  integration: e2.integration,
@@ -262190,7 +262201,7 @@ async function runPreflightAndAutoHeal(versions, neededKeys, workspaceDir) {
262190
262201
  async function executeCreateScaffolding(options) {
262191
262202
  const neededKeys = resolveNeededVersionKeys(options.selections, options.resolvedIntegrations);
262192
262203
  const versionsPath = join12(options.workspaceDir, "versions.md");
262193
- const versionsContent = readFileSync7(versionsPath, "utf8");
262204
+ const versionsContent = readFileSync8(versionsPath, "utf8");
262194
262205
  const primaryVersions = toVersionsRecord(versionsContent);
262195
262206
  const [secondaryVersions, healedPrimary] = await Promise.all([
262196
262207
  fetchSecondaryVersions(),
@@ -262235,7 +262246,7 @@ async function executeCreateScaffolding(options) {
262235
262246
  }
262236
262247
 
262237
262248
  // src/sandbox/scanner.ts
262238
- import { existsSync as existsSync10, lstatSync, readFileSync as readFileSync8 } from "node:fs";
262249
+ import { existsSync as existsSync11, lstatSync, readFileSync as readFileSync9 } from "node:fs";
262239
262250
  import { extname, isAbsolute, join as join13, normalize, resolve as resolve3 } from "node:path";
262240
262251
  var ALLOWED_EXTENSIONS = new Set([
262241
262252
  ".ts",
@@ -262311,7 +262322,7 @@ function validateFilePath(filePath) {
262311
262322
  detail: "Path contains '..' segments and may escape the workspace"
262312
262323
  });
262313
262324
  }
262314
- if (existsSync10(filePath)) {
262325
+ if (existsSync11(filePath)) {
262315
262326
  const stats = lstatSync(filePath);
262316
262327
  if (stats.isSymbolicLink()) {
262317
262328
  warnings.push({
@@ -262353,7 +262364,7 @@ function scanStagedFiles(workspaceDir) {
262353
262364
  continue;
262354
262365
  }
262355
262366
  const stagedAbsolutePath = resolve3(stagingRoot, normalize(stagedFile.relativePath));
262356
- const stagedContent = readFileSync8(stagedAbsolutePath, "utf-8");
262367
+ const stagedContent = readFileSync9(stagedAbsolutePath, "utf-8");
262357
262368
  warnings.push(...scanFileContent(stagedFile.relativePath, stagedContent));
262358
262369
  }
262359
262370
  for (const warning of warnings) {
@@ -262420,7 +262431,7 @@ async function confirmAndApply(options) {
262420
262431
  // src/ast/engine.ts
262421
262432
  var import_ts_morph = __toESM(require_ts_morph(), 1);
262422
262433
  import { createHash as createHash3 } from "node:crypto";
262423
- import { existsSync as existsSync11, mkdirSync as mkdirSync8, writeFileSync as writeFileSync10 } from "node:fs";
262434
+ import { existsSync as existsSync12, mkdirSync as mkdirSync8, writeFileSync as writeFileSync10 } from "node:fs";
262424
262435
  import { dirname as dirname4, isAbsolute as isAbsolute2, join as join14, normalize as normalize2, relative as relative2, resolve as resolve4 } from "node:path";
262425
262436
  var KITT_DIR2 = ".kitt";
262426
262437
  var STAGING_DIR2 = "staging";
@@ -262465,7 +262476,7 @@ function createAstEngine(workspaceDir) {
262465
262476
  if (!isRelativePathInside(workspaceDir, fullPath)) {
262466
262477
  throw new Error(`Path is outside workspace: ${relativePath}`);
262467
262478
  }
262468
- if (!existsSync11(fullPath)) {
262479
+ if (!existsSync12(fullPath)) {
262469
262480
  throw new Error(`File does not exist: ${relativePath}`);
262470
262481
  }
262471
262482
  const existing = project.getSourceFile(fullPath);
@@ -262853,7 +262864,7 @@ function applyOperation(sourceFile, operation) {
262853
262864
 
262854
262865
  // src/ast/validator.ts
262855
262866
  var import_ts_morph3 = __toESM(require_ts_morph(), 1);
262856
- import { existsSync as existsSync12 } from "node:fs";
262867
+ import { existsSync as existsSync13 } from "node:fs";
262857
262868
  import { extname as extname2, isAbsolute as isAbsolute3, normalize as normalize3, relative as relative3, resolve as resolve5 } from "node:path";
262858
262869
  var VALID_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx"]);
262859
262870
  var TARGET_FILE_OPERATION = { op: "targetFile" };
@@ -263040,7 +263051,7 @@ function validateTargetFile(workspaceDir, filePath) {
263040
263051
  message: `Path is outside workspace: ${filePath}`
263041
263052
  });
263042
263053
  }
263043
- if (!existsSync12(absoluteTargetPath)) {
263054
+ if (!existsSync13(absoluteTargetPath)) {
263044
263055
  errors.push({
263045
263056
  filePath,
263046
263057
  operation: TARGET_FILE_OPERATION,
@@ -263421,17 +263432,17 @@ async function provisionInfrastructure(options) {
263421
263432
 
263422
263433
  // src/commands/run.ts
263423
263434
  import { spawn as spawn2 } from "node:child_process";
263424
- import { existsSync as existsSync14, readFileSync as readFileSync10 } from "node:fs";
263435
+ import { existsSync as existsSync15, readFileSync as readFileSync11 } from "node:fs";
263425
263436
  import { join as join17 } from "node:path";
263426
263437
  var import_picocolors6 = __toESM(require_picocolors(), 1);
263427
263438
 
263428
263439
  // src/commands/settings.ts
263429
263440
  import { execSync as execSync6 } from "node:child_process";
263430
- import { chmodSync as chmodSync5, existsSync as existsSync13, mkdirSync as mkdirSync9, readFileSync as readFileSync9, renameSync as renameSync5, rmSync as rmSync3, unlinkSync as unlinkSync4, writeFileSync as writeFileSync11 } from "node:fs";
263431
- import { homedir as homedir3, platform as platform6 } from "node:os";
263441
+ 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";
263442
+ import { homedir as homedir4, platform as platform6 } from "node:os";
263432
263443
  import { join as join16 } from "node:path";
263433
263444
  var SUPPORTED_PACKAGE_MANAGERS = ["bun", "npm", "pnpm", "yarn"];
263434
- var CONFIG_DIR2 = join16(homedir3(), ".kitt");
263445
+ var CONFIG_DIR2 = join16(homedir4(), ".kitt");
263435
263446
  var CONFIG_FILE2 = join16(CONFIG_DIR2, "config.json");
263436
263447
  var DIR_MODE3 = 448;
263437
263448
  var FILE_MODE4 = 384;
@@ -263445,7 +263456,7 @@ function isWindows4() {
263445
263456
  return platform6() === "win32";
263446
263457
  }
263447
263458
  function ensureConfigDir2() {
263448
- if (!existsSync13(CONFIG_DIR2)) {
263459
+ if (!existsSync14(CONFIG_DIR2)) {
263449
263460
  mkdirSync9(CONFIG_DIR2, { recursive: true, mode: DIR_MODE3 });
263450
263461
  }
263451
263462
  if (!isWindows4()) {
@@ -263457,10 +263468,10 @@ function isPackageManager(value) {
263457
263468
  }
263458
263469
  function readGlobalConfig2() {
263459
263470
  ensureConfigDir2();
263460
- if (!existsSync13(CONFIG_FILE2)) {
263471
+ if (!existsSync14(CONFIG_FILE2)) {
263461
263472
  return {};
263462
263473
  }
263463
- const raw = readFileSync9(CONFIG_FILE2, "utf-8").trim();
263474
+ const raw = readFileSync10(CONFIG_FILE2, "utf-8").trim();
263464
263475
  if (raw.length === 0) {
263465
263476
  return {};
263466
263477
  }
@@ -263489,7 +263500,7 @@ function writeGlobalConfig2(config) {
263489
263500
  chmodSync5(CONFIG_FILE2, FILE_MODE4);
263490
263501
  }
263491
263502
  } catch (writeError) {
263492
- if (existsSync13(tempFile)) {
263503
+ if (existsSync14(tempFile)) {
263493
263504
  unlinkSync4(tempFile);
263494
263505
  }
263495
263506
  throw writeError;
@@ -263534,7 +263545,7 @@ function removePackageManagerArtifacts(workspaceDir, packageManager) {
263534
263545
  }
263535
263546
  function ensureWorkspaceFieldInRootPackageJson(workspaceDir) {
263536
263547
  const packageJsonPath = join16(workspaceDir, "package.json");
263537
- const raw = readFileSync9(packageJsonPath, "utf-8");
263548
+ const raw = readFileSync10(packageJsonPath, "utf-8");
263538
263549
  const parsed = JSON.parse(raw);
263539
263550
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
263540
263551
  throw new Error("Root package.json must contain a JSON object.");
@@ -263698,12 +263709,12 @@ async function settingsCommand(context, args) {
263698
263709
  var DEV_SCRIPT_CANDIDATES = ["dev", "start", "serve", "preview"];
263699
263710
  function resolveDevScript(appDir) {
263700
263711
  const pkgPath = join17(appDir, "package.json");
263701
- if (!existsSync14(pkgPath)) {
263712
+ if (!existsSync15(pkgPath)) {
263702
263713
  return { found: false, reason: "no-package-json", available: [] };
263703
263714
  }
263704
263715
  let pkg;
263705
263716
  try {
263706
- pkg = JSON.parse(readFileSync10(pkgPath, "utf-8"));
263717
+ pkg = JSON.parse(readFileSync11(pkgPath, "utf-8"));
263707
263718
  } catch {
263708
263719
  return { found: false, reason: "no-package-json", available: [] };
263709
263720
  }
@@ -263985,7 +263996,7 @@ async function createCommand2(context, _args) {
263985
263996
  });
263986
263997
  logger.cmd("/create", "SUCCESS");
263987
263998
  success(`App ${selections.appName} created.`);
263988
- if (existsSync15(appDir)) {
263999
+ if (existsSync16(appDir)) {
263989
264000
  const runCmd = getCommand(manifest.workspace.packageManager, "run");
263990
264001
  const scriptResolution = resolveDevScript(appDir);
263991
264002
  if (scriptResolution.found) {
@@ -264084,7 +264095,7 @@ async function deleteCommand(context, args) {
264084
264095
  }
264085
264096
 
264086
264097
  // src/commands/deploy.ts
264087
- import { existsSync as existsSync16, readdirSync as readdirSync3, readFileSync as readFileSync11, writeFileSync as writeFileSync13 } from "node:fs";
264098
+ import { existsSync as existsSync17, readdirSync as readdirSync3, readFileSync as readFileSync12, writeFileSync as writeFileSync13 } from "node:fs";
264088
264099
  import { basename as basename2, join as join20 } from "node:path";
264089
264100
  init_config();
264090
264101
 
@@ -264148,10 +264159,10 @@ function matchesGitignorePattern(filePath, pattern) {
264148
264159
  }
264149
264160
  function loadGitignorePatterns(workspaceDir) {
264150
264161
  const gitignorePath = join20(workspaceDir, ".gitignore");
264151
- if (!existsSync16(gitignorePath)) {
264162
+ if (!existsSync17(gitignorePath)) {
264152
264163
  return [];
264153
264164
  }
264154
- return readFileSync11(gitignorePath, "utf-8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
264165
+ return readFileSync12(gitignorePath, "utf-8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
264155
264166
  }
264156
264167
  function isIgnoredByGitignore(filePath, patterns) {
264157
264168
  let ignored = false;
@@ -264218,7 +264229,7 @@ function scanEnvFilesForSecrets(workspaceDir) {
264218
264229
  continue;
264219
264230
  }
264220
264231
  const fullPath = join20(workspaceDir, envFile);
264221
- const content = readFileSync11(fullPath, "utf-8");
264232
+ const content = readFileSync12(fullPath, "utf-8");
264222
264233
  if (hasSecretPattern(content)) {
264223
264234
  blockedFiles.push(envFile);
264224
264235
  }
@@ -264287,7 +264298,7 @@ restartPolicyMaxRetries = 3${deployEnv}`;
264287
264298
  }
264288
264299
  function ensureRailwayToml(appName, framework, packageManager) {
264289
264300
  const railwayTomlPath = join20("apps", appName, "railway.toml");
264290
- if (existsSync16(railwayTomlPath)) {
264301
+ if (existsSync17(railwayTomlPath)) {
264291
264302
  return false;
264292
264303
  }
264293
264304
  writeFileSync13(railwayTomlPath, generateRailwayToml(framework, packageManager), "utf-8");
@@ -264776,10 +264787,10 @@ var import_picocolors7 = __toESM(require_picocolors(), 1);
264776
264787
  init_config();
264777
264788
 
264778
264789
  // src/manifest/drift.ts
264779
- import { existsSync as existsSync17, readdirSync as readdirSync4 } from "node:fs";
264790
+ import { existsSync as existsSync18, readdirSync as readdirSync4 } from "node:fs";
264780
264791
  import { join as join21 } from "node:path";
264781
264792
  function listDirectories(parentDir) {
264782
- if (!existsSync17(parentDir)) {
264793
+ if (!existsSync18(parentDir)) {
264783
264794
  return [];
264784
264795
  }
264785
264796
  return readdirSync4(parentDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort((left, right) => left.localeCompare(right));
@@ -265114,7 +265125,7 @@ async function loginCommand(context, args, commandKey = "login") {
265114
265125
  }
265115
265126
 
265116
265127
  // src/commands/versions.ts
265117
- import { existsSync as existsSync18, readFileSync as readFileSync12, writeFileSync as writeFileSync14 } from "node:fs";
265128
+ import { existsSync as existsSync19, readFileSync as readFileSync13, writeFileSync as writeFileSync14 } from "node:fs";
265118
265129
  import { join as join22 } from "node:path";
265119
265130
  var import_picocolors9 = __toESM(require_picocolors(), 1);
265120
265131
  var TABLE_HEADER_INTEGRATION = "Integration";
@@ -265159,12 +265170,12 @@ function loadVersionsContext(logger) {
265159
265170
  return null;
265160
265171
  }
265161
265172
  const versionsPath = join22(workspaceDir, "versions.md");
265162
- if (!existsSync18(versionsPath)) {
265173
+ if (!existsSync19(versionsPath)) {
265163
265174
  error("versions.md not found in workspace root.");
265164
265175
  logger.cmd("/versions", "FAILED", "versions.md missing");
265165
265176
  return null;
265166
265177
  }
265167
- const versionsMarkdown = readFileSync12(versionsPath, "utf-8");
265178
+ const versionsMarkdown = readFileSync13(versionsPath, "utf-8");
265168
265179
  const result = parseVersionsTable(versionsMarkdown);
265169
265180
  for (const parseError of result.errors) {
265170
265181
  warn(parseError);
@@ -265592,7 +265603,7 @@ async function helpCommand(_context, _args) {
265592
265603
  // package.json
265593
265604
  var package_default = {
265594
265605
  name: "openkitt",
265595
- version: "0.2.9",
265606
+ version: "0.3.0",
265596
265607
  description: "AI-powered monorepo scaffolding CLI",
265597
265608
  keywords: [
265598
265609
  "cli",
@@ -265664,7 +265675,7 @@ var STATE_CHANGING_COMMANDS = new Set([
265664
265675
  "domain",
265665
265676
  "publish"
265666
265677
  ]);
265667
- var KITT_DIR3 = join23(homedir4(), ".kitt");
265678
+ var KITT_DIR3 = join23(homedir5(), ".kitt");
265668
265679
  var UPDATE_CHECK_FILE = join23(KITT_DIR3, "update-check.json");
265669
265680
  var commandRegistry = {
265670
265681
  init: { handler: initCommand },
@@ -265745,11 +265756,11 @@ function isVersionNewer(latest, current) {
265745
265756
  return false;
265746
265757
  }
265747
265758
  function hasFreshUpdateCache(now) {
265748
- if (!existsSync19(UPDATE_CHECK_FILE)) {
265759
+ if (!existsSync20(UPDATE_CHECK_FILE)) {
265749
265760
  return false;
265750
265761
  }
265751
265762
  try {
265752
- const rawCache = readFileSync13(UPDATE_CHECK_FILE, "utf-8").trim();
265763
+ const rawCache = readFileSync14(UPDATE_CHECK_FILE, "utf-8").trim();
265753
265764
  if (rawCache.length === 0) {
265754
265765
  return false;
265755
265766
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openkitt",
3
- "version": "0.2.9",
3
+ "version": "0.3.0",
4
4
  "description": "AI-powered monorepo scaffolding CLI",
5
5
  "keywords": [
6
6
  "cli",