claudekit-cli 4.3.1-dev.14 → 4.3.1-dev.16
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/cli-manifest.json +2 -2
- package/dist/index.js +123 -71
- package/package.json +1 -1
package/cli-manifest.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -63806,7 +63806,7 @@ var package_default;
|
|
|
63806
63806
|
var init_package = __esm(() => {
|
|
63807
63807
|
package_default = {
|
|
63808
63808
|
name: "claudekit-cli",
|
|
63809
|
-
version: "4.3.1-dev.
|
|
63809
|
+
version: "4.3.1-dev.16",
|
|
63810
63810
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
63811
63811
|
type: "module",
|
|
63812
63812
|
repository: {
|
|
@@ -65368,6 +65368,17 @@ async function checkHookFileReferences(projectDir) {
|
|
|
65368
65368
|
}
|
|
65369
65369
|
};
|
|
65370
65370
|
}
|
|
65371
|
+
async function countMissingHookFileReferences(projectDir = process.cwd()) {
|
|
65372
|
+
const settingsFiles = getClaudeSettingsFiles(projectDir);
|
|
65373
|
+
let count = 0;
|
|
65374
|
+
for (const settingsFile of settingsFiles) {
|
|
65375
|
+
const settings = await SettingsMerger.readSettingsFile(settingsFile.path);
|
|
65376
|
+
if (!settings)
|
|
65377
|
+
continue;
|
|
65378
|
+
count += collectMissingHookReferences(settings, settingsFile, projectDir).length;
|
|
65379
|
+
}
|
|
65380
|
+
return count;
|
|
65381
|
+
}
|
|
65371
65382
|
async function repairMissingHookFileReferences(projectDir = process.cwd()) {
|
|
65372
65383
|
const result = await checkHookFileReferences(projectDir);
|
|
65373
65384
|
if (result.status !== "fail" || !result.fix) {
|
|
@@ -67331,7 +67342,7 @@ import { exec as exec2, spawn as spawn2 } from "node:child_process";
|
|
|
67331
67342
|
import { existsSync as existsSync47 } from "node:fs";
|
|
67332
67343
|
import { readdir as readdir19 } from "node:fs/promises";
|
|
67333
67344
|
import { builtinModules } from "node:module";
|
|
67334
|
-
import { join as join68 } from "node:path";
|
|
67345
|
+
import { dirname as dirname29, join as join68 } from "node:path";
|
|
67335
67346
|
import { promisify as promisify9 } from "node:util";
|
|
67336
67347
|
function selectKitForUpdate(params) {
|
|
67337
67348
|
const { hasLocal, hasGlobal, localKits, globalKits } = params;
|
|
@@ -67464,12 +67475,12 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
67464
67475
|
const globalMetadata = hasGlobal ? await readMetadataFile(setup.global.path) : null;
|
|
67465
67476
|
const localKits = localMetadata ? getInstalledKits(localMetadata) : [];
|
|
67466
67477
|
const globalKits = globalMetadata ? getInstalledKits(globalMetadata) : [];
|
|
67467
|
-
|
|
67478
|
+
let selection = selectKitForUpdate({ hasLocal, hasGlobal, localKits, globalKits });
|
|
67468
67479
|
if (!selection) {
|
|
67469
67480
|
logger.verbose("No ClaudeKit installations detected, skipping kit update prompt");
|
|
67470
67481
|
return;
|
|
67471
67482
|
}
|
|
67472
|
-
|
|
67483
|
+
let kitVersion = selection.kit ? selection.isGlobal ? globalMetadata?.kits?.[selection.kit]?.version : localMetadata?.kits?.[selection.kit]?.version : undefined;
|
|
67473
67484
|
const isBetaInstalled = isBetaVersion(kitVersion);
|
|
67474
67485
|
const promptMessage = selection.promptMessage;
|
|
67475
67486
|
if (selection.kit && kitVersion) {
|
|
@@ -67497,6 +67508,27 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
67497
67508
|
logger.verbose(`Hook dependency self-heal check skipped: ${error instanceof Error ? error.message : "unknown"}`);
|
|
67498
67509
|
}
|
|
67499
67510
|
}
|
|
67511
|
+
if (alreadyAtLatest) {
|
|
67512
|
+
try {
|
|
67513
|
+
const countMissingHookRefsFn = deps?.countMissingHookFileReferencesFn ?? countMissingHookFileReferences;
|
|
67514
|
+
const projectDir = setup.project.path ? dirname29(setup.project.path) : process.cwd();
|
|
67515
|
+
const missingHookRefs = await countMissingHookRefsFn(projectDir);
|
|
67516
|
+
if (missingHookRefs > 0) {
|
|
67517
|
+
logger.warning(`Detected ${missingHookRefs} broken hook registration(s); reinstalling kit content`);
|
|
67518
|
+
alreadyAtLatest = false;
|
|
67519
|
+
if (setup.project.path && selection.isGlobal) {
|
|
67520
|
+
selection = {
|
|
67521
|
+
isGlobal: false,
|
|
67522
|
+
kit: localKits[0] || selection.kit,
|
|
67523
|
+
promptMessage: `Update local project ClaudeKit content${localKits[0] || selection.kit ? ` (${localKits[0] || selection.kit})` : ""}?`
|
|
67524
|
+
};
|
|
67525
|
+
kitVersion = selection.kit ? localMetadata?.kits?.[selection.kit]?.version : undefined;
|
|
67526
|
+
}
|
|
67527
|
+
}
|
|
67528
|
+
} catch (error) {
|
|
67529
|
+
logger.verbose(`Hook registration self-heal check skipped: ${error instanceof Error ? error.message : "unknown"}`);
|
|
67530
|
+
}
|
|
67531
|
+
}
|
|
67500
67532
|
let autoInit = false;
|
|
67501
67533
|
try {
|
|
67502
67534
|
const ckConfig = await loadFullConfigFn(null);
|
|
@@ -68560,7 +68592,7 @@ var init_routes = __esm(() => {
|
|
|
68560
68592
|
|
|
68561
68593
|
// src/domains/web-server/static-server.ts
|
|
68562
68594
|
import { existsSync as existsSync49 } from "node:fs";
|
|
68563
|
-
import { basename as basename24, dirname as
|
|
68595
|
+
import { basename as basename24, dirname as dirname30, join as join71, resolve as resolve34 } from "node:path";
|
|
68564
68596
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
68565
68597
|
function addRuntimeUiCandidate(candidates, runtimePath) {
|
|
68566
68598
|
if (!runtimePath) {
|
|
@@ -68570,7 +68602,7 @@ function addRuntimeUiCandidate(candidates, runtimePath) {
|
|
|
68570
68602
|
if (!looksLikePath) {
|
|
68571
68603
|
return;
|
|
68572
68604
|
}
|
|
68573
|
-
const entryDir =
|
|
68605
|
+
const entryDir = dirname30(resolve34(runtimePath));
|
|
68574
68606
|
if (basename24(entryDir) === "dist") {
|
|
68575
68607
|
candidates.add(join71(entryDir, "ui"));
|
|
68576
68608
|
}
|
|
@@ -68631,7 +68663,7 @@ var import_express, __dirname3;
|
|
|
68631
68663
|
var init_static_server = __esm(() => {
|
|
68632
68664
|
init_logger();
|
|
68633
68665
|
import_express = __toESM(require_express2(), 1);
|
|
68634
|
-
__dirname3 =
|
|
68666
|
+
__dirname3 = dirname30(fileURLToPath2(import.meta.url));
|
|
68635
68667
|
});
|
|
68636
68668
|
|
|
68637
68669
|
// node_modules/ws/lib/constants.js
|
|
@@ -74141,7 +74173,7 @@ var init_skills_installer2 = __esm(() => {
|
|
|
74141
74173
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
74142
74174
|
import { existsSync as existsSync62 } from "node:fs";
|
|
74143
74175
|
import { mkdir as mkdir23, readFile as readFile47, writeFile as writeFile23 } from "node:fs/promises";
|
|
74144
|
-
import { dirname as
|
|
74176
|
+
import { dirname as dirname33, join as join92 } from "node:path";
|
|
74145
74177
|
async function readJsonFile(filePath) {
|
|
74146
74178
|
try {
|
|
74147
74179
|
const content = await readFile47(filePath, "utf-8");
|
|
@@ -74181,7 +74213,7 @@ ${geminiPattern}
|
|
|
74181
74213
|
}
|
|
74182
74214
|
}
|
|
74183
74215
|
async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
74184
|
-
const linkDir =
|
|
74216
|
+
const linkDir = dirname33(geminiSettingsPath);
|
|
74185
74217
|
if (!existsSync62(linkDir)) {
|
|
74186
74218
|
await mkdir23(linkDir, { recursive: true });
|
|
74187
74219
|
logger.debug(`Created directory: ${linkDir}`);
|
|
@@ -74300,9 +74332,9 @@ var init_validation = __esm(() => {
|
|
|
74300
74332
|
// src/services/package-installer/gemini-mcp/linker-core.ts
|
|
74301
74333
|
import { existsSync as existsSync64 } from "node:fs";
|
|
74302
74334
|
import { mkdir as mkdir24, symlink as symlink3 } from "node:fs/promises";
|
|
74303
|
-
import { dirname as
|
|
74335
|
+
import { dirname as dirname34, join as join94 } from "node:path";
|
|
74304
74336
|
async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
74305
|
-
const linkDir =
|
|
74337
|
+
const linkDir = dirname34(linkPath);
|
|
74306
74338
|
if (!existsSync64(linkDir)) {
|
|
74307
74339
|
await mkdir24(linkDir, { recursive: true });
|
|
74308
74340
|
logger.debug(`Created directory: ${linkDir}`);
|
|
@@ -77649,7 +77681,7 @@ var init_sqlite_client = () => {};
|
|
|
77649
77681
|
|
|
77650
77682
|
// src/commands/content/phases/db-manager.ts
|
|
77651
77683
|
import { existsSync as existsSync83, mkdirSync as mkdirSync8 } from "node:fs";
|
|
77652
|
-
import { dirname as
|
|
77684
|
+
import { dirname as dirname52 } from "node:path";
|
|
77653
77685
|
function initDatabase(dbPath) {
|
|
77654
77686
|
ensureParentDir(dbPath);
|
|
77655
77687
|
const db = openDatabase(dbPath);
|
|
@@ -77670,7 +77702,7 @@ function runRetentionCleanup(db, retentionDays = 90) {
|
|
|
77670
77702
|
db.prepare("DELETE FROM git_events WHERE processed = 1 AND created_at < ?").run(cutoff);
|
|
77671
77703
|
}
|
|
77672
77704
|
function ensureParentDir(dbPath) {
|
|
77673
|
-
const dir =
|
|
77705
|
+
const dir = dirname52(dbPath);
|
|
77674
77706
|
if (dir && !existsSync83(dir)) {
|
|
77675
77707
|
mkdirSync8(dir, { recursive: true });
|
|
77676
77708
|
}
|
|
@@ -88165,7 +88197,7 @@ init_path_resolver();
|
|
|
88165
88197
|
import { existsSync as existsSync58 } from "node:fs";
|
|
88166
88198
|
import { readFile as readFile42 } from "node:fs/promises";
|
|
88167
88199
|
import { homedir as homedir43 } from "node:os";
|
|
88168
|
-
import { dirname as
|
|
88200
|
+
import { dirname as dirname31, join as join80, normalize as normalize6, resolve as resolve36 } from "node:path";
|
|
88169
88201
|
async function checkPathRefsValid(projectDir) {
|
|
88170
88202
|
const globalClaudeMd = join80(PathResolver.getGlobalKitDir(), "CLAUDE.md");
|
|
88171
88203
|
const projectClaudeMd = join80(projectDir, ".claude", "CLAUDE.md");
|
|
@@ -88196,7 +88228,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
88196
88228
|
autoFixable: false
|
|
88197
88229
|
};
|
|
88198
88230
|
}
|
|
88199
|
-
const baseDir =
|
|
88231
|
+
const baseDir = dirname31(claudeMdPath);
|
|
88200
88232
|
const home5 = homedir43();
|
|
88201
88233
|
const broken = [];
|
|
88202
88234
|
for (const ref of refs) {
|
|
@@ -90028,14 +90060,14 @@ class AutoHealer {
|
|
|
90028
90060
|
import { execSync as execSync4, spawnSync as spawnSync6 } from "node:child_process";
|
|
90029
90061
|
import { readFileSync as readFileSync17, unlinkSync as unlinkSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
90030
90062
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
90031
|
-
import { dirname as
|
|
90063
|
+
import { dirname as dirname32, join as join87 } from "node:path";
|
|
90032
90064
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
90033
90065
|
init_environment();
|
|
90034
90066
|
init_logger();
|
|
90035
90067
|
init_dist2();
|
|
90036
90068
|
function getCliVersion4() {
|
|
90037
90069
|
try {
|
|
90038
|
-
const __dirname4 =
|
|
90070
|
+
const __dirname4 = dirname32(fileURLToPath4(import.meta.url));
|
|
90039
90071
|
const pkgPath = join87(__dirname4, "../../../package.json");
|
|
90040
90072
|
const pkg = JSON.parse(readFileSync17(pkgPath, "utf-8"));
|
|
90041
90073
|
return pkg.version || "unknown";
|
|
@@ -93532,6 +93564,14 @@ init_types3();
|
|
|
93532
93564
|
import { constants as constants4 } from "node:fs";
|
|
93533
93565
|
import { access as access5, readdir as readdir23 } from "node:fs/promises";
|
|
93534
93566
|
import { join as join98 } from "node:path";
|
|
93567
|
+
async function pathExists11(path8) {
|
|
93568
|
+
try {
|
|
93569
|
+
await access5(path8, constants4.F_OK);
|
|
93570
|
+
return true;
|
|
93571
|
+
} catch {
|
|
93572
|
+
return false;
|
|
93573
|
+
}
|
|
93574
|
+
}
|
|
93535
93575
|
async function validateExtraction(extractDir) {
|
|
93536
93576
|
try {
|
|
93537
93577
|
const entries = await readdir23(extractDir, { encoding: "utf8" });
|
|
@@ -93539,17 +93579,29 @@ async function validateExtraction(extractDir) {
|
|
|
93539
93579
|
if (entries.length === 0) {
|
|
93540
93580
|
throw new ExtractionError("Extraction resulted in no files");
|
|
93541
93581
|
}
|
|
93542
|
-
const criticalPaths = [".claude"
|
|
93582
|
+
const criticalPaths = [".claude"];
|
|
93543
93583
|
const missingPaths = [];
|
|
93544
93584
|
for (const path8 of criticalPaths) {
|
|
93545
|
-
|
|
93546
|
-
await access5(join98(extractDir, path8), constants4.F_OK);
|
|
93585
|
+
if (await pathExists11(join98(extractDir, path8))) {
|
|
93547
93586
|
logger.debug(`Found: ${path8}`);
|
|
93548
|
-
|
|
93549
|
-
|
|
93550
|
-
|
|
93587
|
+
continue;
|
|
93588
|
+
}
|
|
93589
|
+
logger.warning(`Expected path not found: ${path8}`);
|
|
93590
|
+
missingPaths.push(path8);
|
|
93591
|
+
}
|
|
93592
|
+
const guidancePaths = ["CLAUDE.md", ".claude/CLAUDE.md", ".claude/rules/CLAUDE.md"];
|
|
93593
|
+
let guidancePath = null;
|
|
93594
|
+
for (const path8 of guidancePaths) {
|
|
93595
|
+
if (await pathExists11(join98(extractDir, path8))) {
|
|
93596
|
+
guidancePath = path8;
|
|
93597
|
+
break;
|
|
93551
93598
|
}
|
|
93552
93599
|
}
|
|
93600
|
+
if (guidancePath) {
|
|
93601
|
+
logger.debug(`Found: ${guidancePath}`);
|
|
93602
|
+
} else {
|
|
93603
|
+
logger.debug("No CLAUDE.md guidance file found in extracted kit");
|
|
93604
|
+
}
|
|
93553
93605
|
if (missingPaths.length > 0) {
|
|
93554
93606
|
logger.warning(`Some expected paths are missing: ${missingPaths.join(", ")}. This may not be a ClaudeKit project.`);
|
|
93555
93607
|
}
|
|
@@ -94618,7 +94670,7 @@ import path10 from "node:path";
|
|
|
94618
94670
|
|
|
94619
94671
|
// node_modules/tar/dist/esm/list.js
|
|
94620
94672
|
import fs10 from "node:fs";
|
|
94621
|
-
import { dirname as
|
|
94673
|
+
import { dirname as dirname35, parse as parse4 } from "path";
|
|
94622
94674
|
|
|
94623
94675
|
// node_modules/tar/dist/esm/options.js
|
|
94624
94676
|
var argmap = new Map([
|
|
@@ -97518,7 +97570,7 @@ var filesFilter = (opt, files) => {
|
|
|
97518
97570
|
if (m2 !== undefined) {
|
|
97519
97571
|
ret = m2;
|
|
97520
97572
|
} else {
|
|
97521
|
-
ret = mapHas(
|
|
97573
|
+
ret = mapHas(dirname35(file), root);
|
|
97522
97574
|
}
|
|
97523
97575
|
}
|
|
97524
97576
|
map.set(file, ret);
|
|
@@ -100577,7 +100629,7 @@ import { promisify as promisify15 } from "node:util";
|
|
|
100577
100629
|
// src/domains/installation/extraction/native-zip-commands.ts
|
|
100578
100630
|
var NATIVE_EXTRACT_TIMEOUT_MS = 120000;
|
|
100579
100631
|
function getNativeZipCommands(archivePath, destDir, platformName = process.platform) {
|
|
100580
|
-
if (platformName === "darwin") {
|
|
100632
|
+
if (platformName === "darwin" || platformName === "linux") {
|
|
100581
100633
|
return [
|
|
100582
100634
|
{
|
|
100583
100635
|
label: "native unzip",
|
|
@@ -101261,7 +101313,7 @@ import { join as join120 } from "node:path";
|
|
|
101261
101313
|
|
|
101262
101314
|
// src/domains/installation/deletion-handler.ts
|
|
101263
101315
|
import { existsSync as existsSync65, lstatSync as lstatSync3, readdirSync as readdirSync9, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
101264
|
-
import { dirname as
|
|
101316
|
+
import { dirname as dirname37, join as join106, relative as relative21, resolve as resolve41, sep as sep12 } from "node:path";
|
|
101265
101317
|
|
|
101266
101318
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
101267
101319
|
init_metadata_migration();
|
|
@@ -101487,7 +101539,7 @@ function expandGlobPatterns(patterns, claudeDir3) {
|
|
|
101487
101539
|
var MAX_CLEANUP_ITERATIONS = 50;
|
|
101488
101540
|
function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
101489
101541
|
const normalizedClaudeDir = resolve41(claudeDir3);
|
|
101490
|
-
let currentDir = resolve41(
|
|
101542
|
+
let currentDir = resolve41(dirname37(filePath));
|
|
101491
101543
|
let iterations = 0;
|
|
101492
101544
|
while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir) && iterations < MAX_CLEANUP_ITERATIONS) {
|
|
101493
101545
|
iterations++;
|
|
@@ -101496,7 +101548,7 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
|
101496
101548
|
if (entries.length === 0) {
|
|
101497
101549
|
rmdirSync(currentDir);
|
|
101498
101550
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
101499
|
-
currentDir = resolve41(
|
|
101551
|
+
currentDir = resolve41(dirname37(currentDir));
|
|
101500
101552
|
} else {
|
|
101501
101553
|
break;
|
|
101502
101554
|
}
|
|
@@ -101619,7 +101671,7 @@ init_logger();
|
|
|
101619
101671
|
init_types3();
|
|
101620
101672
|
var import_fs_extra15 = __toESM(require_lib(), 1);
|
|
101621
101673
|
var import_ignore3 = __toESM(require_ignore(), 1);
|
|
101622
|
-
import { dirname as
|
|
101674
|
+
import { dirname as dirname40, join as join110, relative as relative23 } from "node:path";
|
|
101623
101675
|
|
|
101624
101676
|
// src/domains/installation/selective-merger.ts
|
|
101625
101677
|
import { stat as stat18 } from "node:fs/promises";
|
|
@@ -103290,13 +103342,13 @@ class FileScanner {
|
|
|
103290
103342
|
// src/domains/installation/merger/settings-processor.ts
|
|
103291
103343
|
import { execSync as execSync5 } from "node:child_process";
|
|
103292
103344
|
import { homedir as homedir46 } from "node:os";
|
|
103293
|
-
import { dirname as
|
|
103345
|
+
import { dirname as dirname39, join as join109 } from "node:path";
|
|
103294
103346
|
|
|
103295
103347
|
// src/domains/config/installed-settings-tracker.ts
|
|
103296
103348
|
init_shared();
|
|
103297
103349
|
import { existsSync as existsSync66 } from "node:fs";
|
|
103298
103350
|
import { mkdir as mkdir31, readFile as readFile50, writeFile as writeFile25 } from "node:fs/promises";
|
|
103299
|
-
import { dirname as
|
|
103351
|
+
import { dirname as dirname38, join as join108 } from "node:path";
|
|
103300
103352
|
var CK_JSON_FILE = ".ck.json";
|
|
103301
103353
|
|
|
103302
103354
|
class InstalledSettingsTracker {
|
|
@@ -103347,7 +103399,7 @@ class InstalledSettingsTracker {
|
|
|
103347
103399
|
data.kits[this.kitName] = {};
|
|
103348
103400
|
}
|
|
103349
103401
|
data.kits[this.kitName].installedSettings = settings;
|
|
103350
|
-
await mkdir31(
|
|
103402
|
+
await mkdir31(dirname38(ckJsonPath), { recursive: true });
|
|
103351
103403
|
await writeFile25(ckJsonPath, JSON.stringify(data, null, 2), "utf-8");
|
|
103352
103404
|
logger.debug(`Saved installed settings to ${ckJsonPath}`);
|
|
103353
103405
|
} catch (error) {
|
|
@@ -103809,7 +103861,7 @@ class SettingsProcessor {
|
|
|
103809
103861
|
return true;
|
|
103810
103862
|
}
|
|
103811
103863
|
async repairSiblingSettingsLocal(destFile) {
|
|
103812
|
-
const settingsLocalPath = join109(
|
|
103864
|
+
const settingsLocalPath = join109(dirname39(destFile), "settings.local.json");
|
|
103813
103865
|
if (settingsLocalPath === destFile || !await import_fs_extra14.pathExists(settingsLocalPath)) {
|
|
103814
103866
|
return;
|
|
103815
103867
|
}
|
|
@@ -104072,10 +104124,10 @@ class CopyExecutor {
|
|
|
104072
104124
|
}
|
|
104073
104125
|
trackInstalledFile(relativePath) {
|
|
104074
104126
|
this.installedFiles.add(relativePath);
|
|
104075
|
-
let dir =
|
|
104127
|
+
let dir = dirname40(relativePath);
|
|
104076
104128
|
while (dir && dir !== "." && dir !== "/") {
|
|
104077
104129
|
this.installedDirectories.add(`${dir}/`);
|
|
104078
|
-
dir =
|
|
104130
|
+
dir = dirname40(dir);
|
|
104079
104131
|
}
|
|
104080
104132
|
}
|
|
104081
104133
|
}
|
|
@@ -107229,7 +107281,7 @@ async function runPreflightChecks() {
|
|
|
107229
107281
|
// src/domains/installation/fresh-installer.ts
|
|
107230
107282
|
init_metadata_migration();
|
|
107231
107283
|
import { existsSync as existsSync67, readdirSync as readdirSync10, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
|
|
107232
|
-
import { basename as basename28, dirname as
|
|
107284
|
+
import { basename as basename28, dirname as dirname41, join as join132, resolve as resolve45 } from "node:path";
|
|
107233
107285
|
init_logger();
|
|
107234
107286
|
init_safe_spinner();
|
|
107235
107287
|
var import_fs_extra34 = __toESM(require_lib(), 1);
|
|
@@ -107282,14 +107334,14 @@ async function analyzeFreshInstallation(claudeDir3) {
|
|
|
107282
107334
|
}
|
|
107283
107335
|
function cleanupEmptyDirectories2(filePath, claudeDir3) {
|
|
107284
107336
|
const normalizedClaudeDir = resolve45(claudeDir3);
|
|
107285
|
-
let currentDir = resolve45(
|
|
107337
|
+
let currentDir = resolve45(dirname41(filePath));
|
|
107286
107338
|
while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir)) {
|
|
107287
107339
|
try {
|
|
107288
107340
|
const entries = readdirSync10(currentDir);
|
|
107289
107341
|
if (entries.length === 0) {
|
|
107290
107342
|
rmdirSync2(currentDir);
|
|
107291
107343
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
107292
|
-
currentDir = resolve45(
|
|
107344
|
+
currentDir = resolve45(dirname41(currentDir));
|
|
107293
107345
|
} else {
|
|
107294
107346
|
break;
|
|
107295
107347
|
}
|
|
@@ -107479,7 +107531,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
|
|
|
107479
107531
|
var import_fs_extra35 = __toESM(require_lib(), 1);
|
|
107480
107532
|
import { cp as cp5, mkdir as mkdir35, readdir as readdir42, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
|
|
107481
107533
|
import { homedir as homedir47 } from "node:os";
|
|
107482
|
-
import { dirname as
|
|
107534
|
+
import { dirname as dirname42, join as join133, normalize as normalize11, resolve as resolve46 } from "node:path";
|
|
107483
107535
|
var LEGACY_KIT_MARKERS = [
|
|
107484
107536
|
"metadata.json",
|
|
107485
107537
|
".ck.json",
|
|
@@ -107592,7 +107644,7 @@ async function repairLegacyWindowsGlobalKitDir(options2) {
|
|
|
107592
107644
|
if (targetExists) {
|
|
107593
107645
|
await rm16(targetDir, { recursive: true, force: true });
|
|
107594
107646
|
}
|
|
107595
|
-
await mkdir35(
|
|
107647
|
+
await mkdir35(dirname42(targetDir), { recursive: true });
|
|
107596
107648
|
await moveDirectory(legacyDir, targetDir);
|
|
107597
107649
|
return { status: "repaired", reason: "repaired", legacyDir, candidateDirs };
|
|
107598
107650
|
}
|
|
@@ -107991,7 +108043,7 @@ async function handleSelection(ctx) {
|
|
|
107991
108043
|
}
|
|
107992
108044
|
// src/commands/init/phases/sync-handler.ts
|
|
107993
108045
|
import { copyFile as copyFile8, mkdir as mkdir37, open as open5, readFile as readFile59, rename as rename12, stat as stat23, unlink as unlink13, writeFile as writeFile33 } from "node:fs/promises";
|
|
107994
|
-
import { dirname as
|
|
108046
|
+
import { dirname as dirname43, join as join135, resolve as resolve48 } from "node:path";
|
|
107995
108047
|
init_logger();
|
|
107996
108048
|
init_path_resolver();
|
|
107997
108049
|
var import_fs_extra37 = __toESM(require_lib(), 1);
|
|
@@ -108110,7 +108162,7 @@ async function acquireSyncLock(global3) {
|
|
|
108110
108162
|
const lockPath = join135(cacheDir, ".sync-lock");
|
|
108111
108163
|
const startTime = Date.now();
|
|
108112
108164
|
const lockTimeout = getLockTimeout();
|
|
108113
|
-
await mkdir37(
|
|
108165
|
+
await mkdir37(dirname43(lockPath), { recursive: true });
|
|
108114
108166
|
while (Date.now() - startTime < lockTimeout) {
|
|
108115
108167
|
try {
|
|
108116
108168
|
const handle = await open5(lockPath, "wx");
|
|
@@ -109567,7 +109619,7 @@ init_dist2();
|
|
|
109567
109619
|
init_model_taxonomy();
|
|
109568
109620
|
import { mkdir as mkdir39, readFile as readFile64, writeFile as writeFile37 } from "node:fs/promises";
|
|
109569
109621
|
import { homedir as homedir52 } from "node:os";
|
|
109570
|
-
import { dirname as
|
|
109622
|
+
import { dirname as dirname44, join as join142 } from "node:path";
|
|
109571
109623
|
|
|
109572
109624
|
// src/commands/portable/models-dev-cache.ts
|
|
109573
109625
|
init_logger();
|
|
@@ -109920,7 +109972,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
109920
109972
|
}
|
|
109921
109973
|
const chosenModel2 = response2.action === "custom" ? response2.value : suggestion2.model;
|
|
109922
109974
|
const next2 = { ...existing, model: chosenModel2 };
|
|
109923
|
-
await mkdir39(
|
|
109975
|
+
await mkdir39(dirname44(configPath), { recursive: true });
|
|
109924
109976
|
await writeFile37(configPath, `${JSON.stringify(next2, null, 2)}
|
|
109925
109977
|
`, "utf-8");
|
|
109926
109978
|
return { path: configPath, action: "added", model: chosenModel2, reason: suggestion2.reason };
|
|
@@ -109931,7 +109983,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
109931
109983
|
throw new OpenCodeAuthRequiredError(suggestion.failure);
|
|
109932
109984
|
}
|
|
109933
109985
|
const next2 = { ...existing ?? {}, model: suggestion.model };
|
|
109934
|
-
await mkdir39(
|
|
109986
|
+
await mkdir39(dirname44(configPath), { recursive: true });
|
|
109935
109987
|
await writeFile37(configPath, `${JSON.stringify(next2, null, 2)}
|
|
109936
109988
|
`, "utf-8");
|
|
109937
109989
|
return {
|
|
@@ -109953,7 +110005,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
109953
110005
|
}
|
|
109954
110006
|
const chosenModel = response.action === "custom" ? response.value : suggestion.ok ? suggestion.model : "";
|
|
109955
110007
|
const next = { ...existing ?? {}, model: chosenModel };
|
|
109956
|
-
await mkdir39(
|
|
110008
|
+
await mkdir39(dirname44(configPath), { recursive: true });
|
|
109957
110009
|
await writeFile37(configPath, `${JSON.stringify(next, null, 2)}
|
|
109958
110010
|
`, "utf-8");
|
|
109959
110011
|
return {
|
|
@@ -109966,7 +110018,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
109966
110018
|
|
|
109967
110019
|
// src/commands/portable/plan-display.ts
|
|
109968
110020
|
var import_picocolors28 = __toESM(require_picocolors(), 1);
|
|
109969
|
-
import { basename as basename29, dirname as
|
|
110021
|
+
import { basename as basename29, dirname as dirname45, extname as extname8 } from "node:path";
|
|
109970
110022
|
var DEFAULT_MAX_PLAN_GROUP_ITEMS = 20;
|
|
109971
110023
|
var TYPE_ORDER = [
|
|
109972
110024
|
"agent",
|
|
@@ -110192,21 +110244,21 @@ function collectPlannedWhereLines(plan) {
|
|
|
110192
110244
|
return destinations.map((destination) => `${formatDisplayPath(destination)} -> ${formatCdHint(resolveCdTarget(destination))}`);
|
|
110193
110245
|
}
|
|
110194
110246
|
function resolveCdTarget(destination) {
|
|
110195
|
-
return extname8(destination).length > 0 ?
|
|
110247
|
+
return extname8(destination).length > 0 ? dirname45(destination) : destination;
|
|
110196
110248
|
}
|
|
110197
110249
|
function normalizeWhereDestination(path17, portableType) {
|
|
110198
110250
|
if (portableType === "agent" || portableType === "command" || portableType === "skill") {
|
|
110199
|
-
return
|
|
110251
|
+
return dirname45(path17);
|
|
110200
110252
|
}
|
|
110201
110253
|
if (portableType === "hooks") {
|
|
110202
|
-
return
|
|
110254
|
+
return dirname45(path17);
|
|
110203
110255
|
}
|
|
110204
110256
|
if (portableType === "rules") {
|
|
110205
110257
|
const fileName = basename29(path17).toLowerCase();
|
|
110206
110258
|
if (fileName === "agents.md" || fileName === "gemini.md" || fileName === ".goosehints" || fileName === "custom_modes.yaml" || fileName === "custom_modes.yml") {
|
|
110207
110259
|
return path17;
|
|
110208
110260
|
}
|
|
110209
|
-
return
|
|
110261
|
+
return dirname45(path17);
|
|
110210
110262
|
}
|
|
110211
110263
|
return path17;
|
|
110212
110264
|
}
|
|
@@ -111960,7 +112012,7 @@ Please use only one download method.`);
|
|
|
111960
112012
|
// src/commands/plan/plan-command.ts
|
|
111961
112013
|
init_output_manager();
|
|
111962
112014
|
import { existsSync as existsSync71, statSync as statSync12 } from "node:fs";
|
|
111963
|
-
import { dirname as
|
|
112015
|
+
import { dirname as dirname49, isAbsolute as isAbsolute14, join as join148, parse as parse7, resolve as resolve55 } from "node:path";
|
|
111964
112016
|
|
|
111965
112017
|
// src/commands/plan/plan-read-handlers.ts
|
|
111966
112018
|
init_config();
|
|
@@ -111970,18 +112022,18 @@ init_logger();
|
|
|
111970
112022
|
init_output_manager();
|
|
111971
112023
|
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
111972
112024
|
import { existsSync as existsSync70, statSync as statSync11 } from "node:fs";
|
|
111973
|
-
import { basename as basename31, dirname as
|
|
112025
|
+
import { basename as basename31, dirname as dirname47, join as join147, relative as relative31, resolve as resolve53 } from "node:path";
|
|
111974
112026
|
|
|
111975
112027
|
// src/commands/plan/plan-dependencies.ts
|
|
111976
112028
|
init_config();
|
|
111977
112029
|
init_plan_parser();
|
|
111978
112030
|
init_plans_registry();
|
|
111979
112031
|
import { existsSync as existsSync69 } from "node:fs";
|
|
111980
|
-
import { dirname as
|
|
112032
|
+
import { dirname as dirname46, join as join146 } from "node:path";
|
|
111981
112033
|
async function resolvePlanDependencies(references, currentPlanFile, options2 = {}) {
|
|
111982
112034
|
if (references.length === 0)
|
|
111983
112035
|
return [];
|
|
111984
|
-
const currentPlanDir =
|
|
112036
|
+
const currentPlanDir = dirname46(currentPlanFile);
|
|
111985
112037
|
const projectRoot = findProjectRoot(currentPlanDir);
|
|
111986
112038
|
const config = options2.preloadedConfig ?? (await CkConfigManager.loadFull(projectRoot)).config;
|
|
111987
112039
|
const defaultScope = inferPlanScopeForDir(currentPlanDir, config);
|
|
@@ -112068,7 +112120,7 @@ async function handleParse(target, options2) {
|
|
|
112068
112120
|
console.log(JSON.stringify({ file: relative31(process.cwd(), planFile), frontmatter, phases }, null, 2));
|
|
112069
112121
|
return;
|
|
112070
112122
|
}
|
|
112071
|
-
const title = typeof frontmatter.title === "string" ? frontmatter.title : basename31(
|
|
112123
|
+
const title = typeof frontmatter.title === "string" ? frontmatter.title : basename31(dirname47(planFile));
|
|
112072
112124
|
console.log();
|
|
112073
112125
|
console.log(import_picocolors32.default.bold(` Plan: ${title}`));
|
|
112074
112126
|
console.log(` File: ${planFile}`);
|
|
@@ -112179,7 +112231,7 @@ async function handleStatus(target, options2) {
|
|
|
112179
112231
|
const blockedBy2 = await resolvePlanDependencies(s.blockedBy, pf, { preloadedConfig });
|
|
112180
112232
|
const blocks2 = await resolvePlanDependencies(s.blocks, pf, { preloadedConfig });
|
|
112181
112233
|
const bar = progressBar(s.completed, s.totalPhases);
|
|
112182
|
-
const title2 = s.title ?? basename31(
|
|
112234
|
+
const title2 = s.title ?? basename31(dirname47(pf));
|
|
112183
112235
|
console.log(` ${import_picocolors32.default.bold(title2)}`);
|
|
112184
112236
|
console.log(` ${bar}`);
|
|
112185
112237
|
if (s.inProgress > 0)
|
|
@@ -112198,7 +112250,7 @@ async function handleStatus(target, options2) {
|
|
|
112198
112250
|
}
|
|
112199
112251
|
console.log();
|
|
112200
112252
|
} catch {
|
|
112201
|
-
console.log(` [X] Failed to read: ${basename31(
|
|
112253
|
+
console.log(` [X] Failed to read: ${basename31(dirname47(pf))}`);
|
|
112202
112254
|
console.log();
|
|
112203
112255
|
}
|
|
112204
112256
|
}
|
|
@@ -112225,7 +112277,7 @@ async function handleStatus(target, options2) {
|
|
|
112225
112277
|
console.log(JSON.stringify({ ...summary, dependencyStatus: { blockedBy, blocks } }, null, 2));
|
|
112226
112278
|
return;
|
|
112227
112279
|
}
|
|
112228
|
-
const title = summary.title ?? basename31(
|
|
112280
|
+
const title = summary.title ?? basename31(dirname47(planFile));
|
|
112229
112281
|
console.log();
|
|
112230
112282
|
console.log(import_picocolors32.default.bold(` ${title}`));
|
|
112231
112283
|
if (summary.status)
|
|
@@ -112288,7 +112340,7 @@ async function handleKanban(target, options2) {
|
|
|
112288
112340
|
process.exitCode = 1;
|
|
112289
112341
|
return;
|
|
112290
112342
|
}
|
|
112291
|
-
const route = `/plans?dir=${encodeURIComponent(
|
|
112343
|
+
const route = `/plans?dir=${encodeURIComponent(dirname47(dirname47(planFile)))}&view=kanban`;
|
|
112292
112344
|
const url = `http://localhost:${server.port}${route}`;
|
|
112293
112345
|
console.log();
|
|
112294
112346
|
console.log(import_picocolors32.default.bold(" ClaudeKit Dashboard — Plans"));
|
|
@@ -112323,7 +112375,7 @@ init_plan_parser();
|
|
|
112323
112375
|
init_plans_registry();
|
|
112324
112376
|
init_output_manager();
|
|
112325
112377
|
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
112326
|
-
import { basename as basename32, dirname as
|
|
112378
|
+
import { basename as basename32, dirname as dirname48, relative as relative32, resolve as resolve54 } from "node:path";
|
|
112327
112379
|
function quoteReadTarget(filePath) {
|
|
112328
112380
|
return `"${filePath.replace(/\\/g, "/").replace(/"/g, "\\\"")}"`;
|
|
112329
112381
|
}
|
|
@@ -112437,7 +112489,7 @@ async function handleCheck(target, options2) {
|
|
|
112437
112489
|
process.exitCode = 1;
|
|
112438
112490
|
return;
|
|
112439
112491
|
}
|
|
112440
|
-
const planDir =
|
|
112492
|
+
const planDir = dirname48(planFile);
|
|
112441
112493
|
let planStatus = "pending";
|
|
112442
112494
|
try {
|
|
112443
112495
|
const projectRoot = findProjectRoot(planDir);
|
|
@@ -112486,7 +112538,7 @@ async function handleUncheck(target, options2) {
|
|
|
112486
112538
|
process.exitCode = 1;
|
|
112487
112539
|
return;
|
|
112488
112540
|
}
|
|
112489
|
-
const planDir =
|
|
112541
|
+
const planDir = dirname48(planFile);
|
|
112490
112542
|
try {
|
|
112491
112543
|
const projectRoot = findProjectRoot(planDir);
|
|
112492
112544
|
const summary = buildPlanSummary(planFile);
|
|
@@ -112525,7 +112577,7 @@ async function handleAddPhase(target, options2) {
|
|
|
112525
112577
|
try {
|
|
112526
112578
|
const result = addPhase(planFile, target, options2.after);
|
|
112527
112579
|
try {
|
|
112528
|
-
const planDir =
|
|
112580
|
+
const planDir = dirname48(planFile);
|
|
112529
112581
|
const projectRoot = findProjectRoot(planDir);
|
|
112530
112582
|
updateRegistryAddPhase({
|
|
112531
112583
|
planDir,
|
|
@@ -112579,7 +112631,7 @@ function resolvePlanFile(target, baseDir) {
|
|
|
112579
112631
|
const candidate = join148(dir, "plan.md");
|
|
112580
112632
|
if (existsSync71(candidate))
|
|
112581
112633
|
return candidate;
|
|
112582
|
-
dir =
|
|
112634
|
+
dir = dirname49(dir);
|
|
112583
112635
|
}
|
|
112584
112636
|
}
|
|
112585
112637
|
return null;
|
|
@@ -113863,7 +113915,7 @@ var import_fs_extra42 = __toESM(require_lib(), 1);
|
|
|
113863
113915
|
// src/commands/uninstall/analysis-handler.ts
|
|
113864
113916
|
init_metadata_migration();
|
|
113865
113917
|
import { readdirSync as readdirSync11, rmSync as rmSync4 } from "node:fs";
|
|
113866
|
-
import { dirname as
|
|
113918
|
+
import { dirname as dirname50, join as join151 } from "node:path";
|
|
113867
113919
|
init_logger();
|
|
113868
113920
|
init_safe_prompts();
|
|
113869
113921
|
var import_fs_extra41 = __toESM(require_lib(), 1);
|
|
@@ -113885,7 +113937,7 @@ function classifyFileByOwnership(ownership, forceOverwrite, deleteReason) {
|
|
|
113885
113937
|
}
|
|
113886
113938
|
async function cleanupEmptyDirectories3(filePath, installationRoot) {
|
|
113887
113939
|
let cleaned = 0;
|
|
113888
|
-
let currentDir =
|
|
113940
|
+
let currentDir = dirname50(filePath);
|
|
113889
113941
|
while (currentDir !== installationRoot && currentDir.startsWith(installationRoot)) {
|
|
113890
113942
|
try {
|
|
113891
113943
|
const entries = readdirSync11(currentDir);
|
|
@@ -113893,7 +113945,7 @@ async function cleanupEmptyDirectories3(filePath, installationRoot) {
|
|
|
113893
113945
|
rmSync4(currentDir, { recursive: true });
|
|
113894
113946
|
cleaned++;
|
|
113895
113947
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
113896
|
-
currentDir =
|
|
113948
|
+
currentDir = dirname50(currentDir);
|
|
113897
113949
|
} else {
|
|
113898
113950
|
break;
|
|
113899
113951
|
}
|
|
@@ -115815,7 +115867,7 @@ init_file_io();
|
|
|
115815
115867
|
init_logger();
|
|
115816
115868
|
import { existsSync as existsSync74 } from "node:fs";
|
|
115817
115869
|
import { mkdir as mkdir41, readFile as readFile68 } from "node:fs/promises";
|
|
115818
|
-
import { dirname as
|
|
115870
|
+
import { dirname as dirname51 } from "node:path";
|
|
115819
115871
|
var PROCESSED_ISSUES_CAP = 500;
|
|
115820
115872
|
async function readCkJson(projectDir) {
|
|
115821
115873
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
@@ -115845,7 +115897,7 @@ async function loadWatchState(projectDir) {
|
|
|
115845
115897
|
}
|
|
115846
115898
|
async function saveWatchState(projectDir, state) {
|
|
115847
115899
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
115848
|
-
const configDir =
|
|
115900
|
+
const configDir = dirname51(configPath);
|
|
115849
115901
|
if (!existsSync74(configDir)) {
|
|
115850
115902
|
await mkdir41(configDir, { recursive: true });
|
|
115851
115903
|
}
|