openkitt 0.1.8 → 0.2.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 +37 -65
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2800,9 +2800,9 @@ var {
2800
2800
  var import_picocolors4 = __toESM(require_picocolors(), 1);
2801
2801
  import { createInterface, emitKeypressEvents } from "node:readline";
2802
2802
  import { stdin as input, stdout as output } from "node:process";
2803
- import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "node:fs";
2804
- import { homedir as homedir3 } from "node:os";
2805
- import { basename, join as join6 } from "node:path";
2803
+ import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4, realpathSync } from "node:fs";
2804
+ import { homedir as homedir2 } from "node:os";
2805
+ import { join as join5, resolve as resolve2, dirname as dirname3 } from "node:path";
2806
2806
  import { pathToFileURL } from "node:url";
2807
2807
 
2808
2808
  // src/utils/prerequisites.ts
@@ -3284,39 +3284,8 @@ function registerCleanupHandlers() {
3284
3284
  }
3285
3285
 
3286
3286
  // src/manifest/reader.ts
3287
- import { existsSync as existsSync5, readFileSync as readFileSync5 } from "node:fs";
3288
- import { join as join5, dirname as dirname2, resolve } from "node:path";
3289
-
3290
- // src/utils/global-config.ts
3291
- import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "node:fs";
3292
- import { homedir as homedir2 } from "node:os";
3293
- import { join as join4 } from "node:path";
3294
- function getGlobalConfigPath() {
3295
- return join4(homedir2(), ".kitt", "workspace.json");
3296
- }
3297
- function readGlobalConfig() {
3298
- const configPath = getGlobalConfigPath();
3299
- if (!existsSync4(configPath)) {
3300
- return {};
3301
- }
3302
- try {
3303
- const raw = readFileSync4(configPath, "utf-8").trim();
3304
- if (!raw)
3305
- return {};
3306
- const parsed = JSON.parse(raw);
3307
- if (typeof parsed === "object" && parsed !== null) {
3308
- return parsed;
3309
- }
3310
- return {};
3311
- } catch {
3312
- return {};
3313
- }
3314
- }
3315
- function getGlobalWorkspacePath() {
3316
- return readGlobalConfig().workspacePath ?? null;
3317
- }
3318
-
3319
- // src/manifest/reader.ts
3287
+ import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
3288
+ import { join as join4, dirname as dirname2, resolve } from "node:path";
3320
3289
  function isObjectRecord(value) {
3321
3290
  return typeof value === "object" && value !== null;
3322
3291
  }
@@ -3349,33 +3318,18 @@ function isValidWorkspaceManifest(value) {
3349
3318
  return true;
3350
3319
  }
3351
3320
  function getManifestPath(workspaceDir) {
3352
- return join5(workspaceDir, ".kitt", "manifest.json");
3321
+ return join4(workspaceDir, ".kitt", "manifest.json");
3353
3322
  }
3354
3323
  function isKittWorkspace(dir) {
3355
- return existsSync5(getManifestPath(dir));
3356
- }
3357
- function findWorkspaceRoot(startDir) {
3358
- let current = resolve(startDir);
3359
- while (true) {
3360
- if (isKittWorkspace(current))
3361
- return current;
3362
- const parent = dirname2(current);
3363
- if (parent === current)
3364
- break;
3365
- current = parent;
3366
- }
3367
- const globalPath = getGlobalWorkspacePath();
3368
- if (globalPath && isKittWorkspace(globalPath))
3369
- return globalPath;
3370
- return null;
3324
+ return existsSync4(getManifestPath(dir));
3371
3325
  }
3372
3326
  function readManifest(workspaceDir) {
3373
3327
  const manifestPath = getManifestPath(workspaceDir);
3374
- if (!existsSync5(manifestPath)) {
3328
+ if (!existsSync4(manifestPath)) {
3375
3329
  return null;
3376
3330
  }
3377
3331
  try {
3378
- const raw = readFileSync5(manifestPath, "utf-8").trim();
3332
+ const raw = readFileSync4(manifestPath, "utf-8").trim();
3379
3333
  if (raw.length === 0) {
3380
3334
  return null;
3381
3335
  }
@@ -3391,7 +3345,7 @@ function readManifest(workspaceDir) {
3391
3345
  // package.json
3392
3346
  var package_default = {
3393
3347
  name: "openkitt",
3394
- version: "0.1.8",
3348
+ version: "0.2.0",
3395
3349
  description: "AI-powered monorepo scaffolding CLI",
3396
3350
  keywords: [
3397
3351
  "cli",
@@ -3464,8 +3418,8 @@ var STATE_CHANGING_COMMANDS = new Set([
3464
3418
  "domain",
3465
3419
  "publish"
3466
3420
  ]);
3467
- var KITT_DIR2 = join6(homedir3(), ".kitt");
3468
- var UPDATE_CHECK_FILE = join6(KITT_DIR2, "update-check.json");
3421
+ var KITT_DIR2 = join5(homedir2(), ".kitt");
3422
+ var UPDATE_CHECK_FILE = join5(KITT_DIR2, "update-check.json");
3469
3423
  var commandRegistry = {
3470
3424
  init: { modulePath: "./commands/init.js" },
3471
3425
  create: { modulePath: "./commands/create.js" },
@@ -3546,11 +3500,11 @@ function isVersionNewer(latest, current) {
3546
3500
  return false;
3547
3501
  }
3548
3502
  function hasFreshUpdateCache(now) {
3549
- if (!existsSync6(UPDATE_CHECK_FILE)) {
3503
+ if (!existsSync5(UPDATE_CHECK_FILE)) {
3550
3504
  return false;
3551
3505
  }
3552
3506
  try {
3553
- const rawCache = readFileSync6(UPDATE_CHECK_FILE, "utf-8").trim();
3507
+ const rawCache = readFileSync5(UPDATE_CHECK_FILE, "utf-8").trim();
3554
3508
  if (rawCache.length === 0) {
3555
3509
  return false;
3556
3510
  }
@@ -3568,12 +3522,12 @@ function hasFreshUpdateCache(now) {
3568
3522
  }
3569
3523
  }
3570
3524
  function writeUpdateCache(now, latestVersion) {
3571
- mkdirSync5(KITT_DIR2, { recursive: true });
3525
+ mkdirSync4(KITT_DIR2, { recursive: true });
3572
3526
  const payload = {
3573
3527
  checkedAt: now.toISOString(),
3574
3528
  latestVersion
3575
3529
  };
3576
- writeFileSync5(UPDATE_CHECK_FILE, `${JSON.stringify(payload, null, 2)}
3530
+ writeFileSync4(UPDATE_CHECK_FILE, `${JSON.stringify(payload, null, 2)}
3577
3531
  `, "utf-8");
3578
3532
  }
3579
3533
  async function checkForUpdates(context) {
@@ -3692,11 +3646,24 @@ function getBestCompletion(line, registry) {
3692
3646
  return hits.length === 1 ? hits[0].slice(trimmed.length) : "";
3693
3647
  }
3694
3648
  function resolvePrompt() {
3695
- const workspaceRoot = findWorkspaceRoot(process.cwd());
3649
+ let workspaceRoot = null;
3650
+ let current = resolve2(process.cwd());
3651
+ while (true) {
3652
+ if (isKittWorkspace(current)) {
3653
+ workspaceRoot = current;
3654
+ break;
3655
+ }
3656
+ const parent = dirname3(current);
3657
+ if (parent === current)
3658
+ break;
3659
+ current = parent;
3660
+ }
3696
3661
  if (!workspaceRoot)
3697
3662
  return `${BASE_PROMPT} > `;
3698
3663
  const manifest = readManifest(workspaceRoot);
3699
- const name = manifest?.workspace.name ?? basename(workspaceRoot);
3664
+ const name = manifest?.workspace.name;
3665
+ if (!name)
3666
+ return `${BASE_PROMPT} > `;
3700
3667
  return `${BASE_PROMPT} ${import_picocolors4.default.cyan(`[${name}]`)} > `;
3701
3668
  }
3702
3669
  async function startRepl(context) {
@@ -3810,7 +3777,12 @@ function isDirectExecution() {
3810
3777
  if (!entryPoint) {
3811
3778
  return false;
3812
3779
  }
3813
- return import.meta.url === pathToFileURL(entryPoint).href;
3780
+ try {
3781
+ const realEntry = pathToFileURL(realpathSync(entryPoint)).href;
3782
+ return import.meta.url === realEntry;
3783
+ } catch {
3784
+ return import.meta.url === pathToFileURL(entryPoint).href;
3785
+ }
3814
3786
  }
3815
3787
  if (isDirectExecution()) {
3816
3788
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openkitt",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "description": "AI-powered monorepo scaffolding CLI",
5
5
  "keywords": [
6
6
  "cli",