claudekit-cli 4.4.0-dev.10 → 4.4.0-dev.11
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 +111 -85
- package/package.json +1 -1
package/cli-manifest.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -63942,7 +63942,7 @@ var package_default;
|
|
|
63942
63942
|
var init_package = __esm(() => {
|
|
63943
63943
|
package_default = {
|
|
63944
63944
|
name: "claudekit-cli",
|
|
63945
|
-
version: "4.4.0-dev.
|
|
63945
|
+
version: "4.4.0-dev.11",
|
|
63946
63946
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
63947
63947
|
type: "module",
|
|
63948
63948
|
repository: {
|
|
@@ -77343,7 +77343,7 @@ async function restoreOriginalBranch(branchName, cwd2, issueNumber) {
|
|
|
77343
77343
|
}
|
|
77344
77344
|
}
|
|
77345
77345
|
function spawnAndCollect(command, args, cwd2) {
|
|
77346
|
-
return new Promise((
|
|
77346
|
+
return new Promise((resolve57, reject) => {
|
|
77347
77347
|
const child = spawn5(command, args, { ...cwd2 && { cwd: cwd2 }, stdio: ["ignore", "pipe", "pipe"] });
|
|
77348
77348
|
const chunks = [];
|
|
77349
77349
|
const stderrChunks = [];
|
|
@@ -77356,7 +77356,7 @@ function spawnAndCollect(command, args, cwd2) {
|
|
|
77356
77356
|
reject(new Error(`${command} ${args[0] ?? ""} exited with code ${code2}: ${stderr}`));
|
|
77357
77357
|
return;
|
|
77358
77358
|
}
|
|
77359
|
-
|
|
77359
|
+
resolve57(Buffer.concat(chunks).toString("utf-8"));
|
|
77360
77360
|
});
|
|
77361
77361
|
});
|
|
77362
77362
|
}
|
|
@@ -80203,8 +80203,8 @@ function shouldRunCleanup(lastAt) {
|
|
|
80203
80203
|
return Date.now() - new Date(lastAt).getTime() >= 86400000;
|
|
80204
80204
|
}
|
|
80205
80205
|
function sleep2(ms) {
|
|
80206
|
-
return new Promise((
|
|
80207
|
-
setTimeout(
|
|
80206
|
+
return new Promise((resolve57) => {
|
|
80207
|
+
setTimeout(resolve57, ms);
|
|
80208
80208
|
});
|
|
80209
80209
|
}
|
|
80210
80210
|
var LOCK_DIR2, LOCK_FILE, MAX_CREATION_RETRIES = 3, MAX_PUBLISH_RETRIES_PER_CYCLE = 3, PUBLISH_RETRY_WINDOW_HOURS = 24;
|
|
@@ -82455,7 +82455,7 @@ function getPagerArgs(pagerCmd) {
|
|
|
82455
82455
|
return [];
|
|
82456
82456
|
}
|
|
82457
82457
|
async function trySystemPager(content) {
|
|
82458
|
-
return new Promise((
|
|
82458
|
+
return new Promise((resolve57) => {
|
|
82459
82459
|
const pagerCmd = process.env.PAGER || "less";
|
|
82460
82460
|
const pagerArgs = getPagerArgs(pagerCmd);
|
|
82461
82461
|
try {
|
|
@@ -82465,20 +82465,20 @@ async function trySystemPager(content) {
|
|
|
82465
82465
|
});
|
|
82466
82466
|
const timeout2 = setTimeout(() => {
|
|
82467
82467
|
pager.kill();
|
|
82468
|
-
|
|
82468
|
+
resolve57(false);
|
|
82469
82469
|
}, 30000);
|
|
82470
82470
|
pager.stdin.write(content);
|
|
82471
82471
|
pager.stdin.end();
|
|
82472
82472
|
pager.on("close", (code2) => {
|
|
82473
82473
|
clearTimeout(timeout2);
|
|
82474
|
-
|
|
82474
|
+
resolve57(code2 === 0);
|
|
82475
82475
|
});
|
|
82476
82476
|
pager.on("error", () => {
|
|
82477
82477
|
clearTimeout(timeout2);
|
|
82478
|
-
|
|
82478
|
+
resolve57(false);
|
|
82479
82479
|
});
|
|
82480
82480
|
} catch {
|
|
82481
|
-
|
|
82481
|
+
resolve57(false);
|
|
82482
82482
|
}
|
|
82483
82483
|
});
|
|
82484
82484
|
}
|
|
@@ -82505,16 +82505,16 @@ async function basicPager(content) {
|
|
|
82505
82505
|
break;
|
|
82506
82506
|
}
|
|
82507
82507
|
const remaining = lines.length - currentLine;
|
|
82508
|
-
await new Promise((
|
|
82508
|
+
await new Promise((resolve57) => {
|
|
82509
82509
|
rl.question(`-- More (${remaining} lines) [Enter/q] --`, (answer) => {
|
|
82510
82510
|
if (answer.toLowerCase() === "q") {
|
|
82511
82511
|
rl.close();
|
|
82512
82512
|
process.exitCode = 0;
|
|
82513
|
-
|
|
82513
|
+
resolve57();
|
|
82514
82514
|
return;
|
|
82515
82515
|
}
|
|
82516
82516
|
process.stdout.write("\x1B[1A\x1B[2K");
|
|
82517
|
-
|
|
82517
|
+
resolve57();
|
|
82518
82518
|
});
|
|
82519
82519
|
});
|
|
82520
82520
|
}
|
|
@@ -87316,7 +87316,7 @@ class CheckRunner {
|
|
|
87316
87316
|
});
|
|
87317
87317
|
}
|
|
87318
87318
|
async executeCheckersInParallel(checkers) {
|
|
87319
|
-
const
|
|
87319
|
+
const runChecker = async (checker) => {
|
|
87320
87320
|
logger.verbose(`Starting checker: ${checker.group}`);
|
|
87321
87321
|
const startTime = Date.now();
|
|
87322
87322
|
const results = await checker.run();
|
|
@@ -87330,8 +87330,19 @@ class CheckRunner {
|
|
|
87330
87330
|
duration: totalDuration
|
|
87331
87331
|
});
|
|
87332
87332
|
return results;
|
|
87333
|
-
}
|
|
87334
|
-
|
|
87333
|
+
};
|
|
87334
|
+
const indexedCheckers = checkers.map((checker, index) => ({ checker, index }));
|
|
87335
|
+
const networkCheckers = indexedCheckers.filter(({ checker }) => checker.group === "network");
|
|
87336
|
+
const otherCheckers = indexedCheckers.filter(({ checker }) => checker.group !== "network");
|
|
87337
|
+
const networkResults = networkCheckers.length ? await Promise.all(networkCheckers.map(async ({ checker, index }) => ({
|
|
87338
|
+
index,
|
|
87339
|
+
results: await runChecker(checker)
|
|
87340
|
+
}))) : [];
|
|
87341
|
+
const otherResults = await Promise.all(otherCheckers.map(async ({ checker, index }) => ({
|
|
87342
|
+
index,
|
|
87343
|
+
results: await runChecker(checker)
|
|
87344
|
+
})));
|
|
87345
|
+
return [...networkResults, ...otherResults].sort((a3, b3) => a3.index - b3.index).flatMap(({ results }) => results);
|
|
87335
87346
|
}
|
|
87336
87347
|
buildSummary(checks) {
|
|
87337
87348
|
let passed = 0;
|
|
@@ -90362,9 +90373,10 @@ function createDefaultDeps() {
|
|
|
90362
90373
|
};
|
|
90363
90374
|
}
|
|
90364
90375
|
function createDefaultDns() {
|
|
90376
|
+
const lookupFamily = (host, family) => dnsPromises.lookup(host, { family, all: true }).then((records) => records.map((record) => record.address));
|
|
90365
90377
|
return {
|
|
90366
|
-
resolve4: (host) =>
|
|
90367
|
-
resolve6: (host) =>
|
|
90378
|
+
resolve4: (host) => lookupFamily(host, 4),
|
|
90379
|
+
resolve6: (host) => lookupFamily(host, 6)
|
|
90368
90380
|
};
|
|
90369
90381
|
}
|
|
90370
90382
|
function createDefaultTcp() {
|
|
@@ -90545,11 +90557,25 @@ async function checkGitHubReachability(deps) {
|
|
|
90545
90557
|
}
|
|
90546
90558
|
function raceTimeout(promise, ms) {
|
|
90547
90559
|
return new Promise((resolve38, reject) => {
|
|
90548
|
-
|
|
90560
|
+
let settled = false;
|
|
90561
|
+
const timer = setTimeout(() => {
|
|
90562
|
+
setImmediate(() => {
|
|
90563
|
+
if (settled)
|
|
90564
|
+
return;
|
|
90565
|
+
settled = true;
|
|
90566
|
+
reject(new Error(`timeout after ${ms}ms`));
|
|
90567
|
+
});
|
|
90568
|
+
}, ms);
|
|
90549
90569
|
promise.then((v2) => {
|
|
90570
|
+
if (settled)
|
|
90571
|
+
return;
|
|
90572
|
+
settled = true;
|
|
90550
90573
|
clearTimeout(timer);
|
|
90551
90574
|
resolve38(v2);
|
|
90552
90575
|
}, (e2) => {
|
|
90576
|
+
if (settled)
|
|
90577
|
+
return;
|
|
90578
|
+
settled = true;
|
|
90553
90579
|
clearTimeout(timer);
|
|
90554
90580
|
reject(e2);
|
|
90555
90581
|
});
|
|
@@ -101977,7 +102003,7 @@ import { join as join121 } from "node:path";
|
|
|
101977
102003
|
|
|
101978
102004
|
// src/domains/installation/deletion-handler.ts
|
|
101979
102005
|
import { existsSync as existsSync65, lstatSync as lstatSync3, readdirSync as readdirSync9, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
101980
|
-
import { dirname as dirname37, join as join106, relative as relative21, resolve as
|
|
102006
|
+
import { dirname as dirname37, join as join106, relative as relative21, resolve as resolve42, sep as sep12 } from "node:path";
|
|
101981
102007
|
|
|
101982
102008
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
101983
102009
|
init_metadata_migration();
|
|
@@ -102202,8 +102228,8 @@ function expandGlobPatterns(patterns, claudeDir3) {
|
|
|
102202
102228
|
}
|
|
102203
102229
|
var MAX_CLEANUP_ITERATIONS = 50;
|
|
102204
102230
|
function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
102205
|
-
const normalizedClaudeDir =
|
|
102206
|
-
let currentDir =
|
|
102231
|
+
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102232
|
+
let currentDir = resolve42(dirname37(filePath));
|
|
102207
102233
|
let iterations = 0;
|
|
102208
102234
|
while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir) && iterations < MAX_CLEANUP_ITERATIONS) {
|
|
102209
102235
|
iterations++;
|
|
@@ -102212,7 +102238,7 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
|
102212
102238
|
if (entries.length === 0) {
|
|
102213
102239
|
rmdirSync(currentDir);
|
|
102214
102240
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
102215
|
-
currentDir =
|
|
102241
|
+
currentDir = resolve42(dirname37(currentDir));
|
|
102216
102242
|
} else {
|
|
102217
102243
|
break;
|
|
102218
102244
|
}
|
|
@@ -102222,8 +102248,8 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
|
102222
102248
|
}
|
|
102223
102249
|
}
|
|
102224
102250
|
function deletePath(fullPath, claudeDir3) {
|
|
102225
|
-
const normalizedPath =
|
|
102226
|
-
const normalizedClaudeDir =
|
|
102251
|
+
const normalizedPath = resolve42(fullPath);
|
|
102252
|
+
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102227
102253
|
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep12}`) && normalizedPath !== normalizedClaudeDir) {
|
|
102228
102254
|
throw new Error(`Path traversal detected: ${fullPath}`);
|
|
102229
102255
|
}
|
|
@@ -102296,8 +102322,8 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
|
|
|
102296
102322
|
const result = { deletedPaths: [], preservedPaths: [], errors: [] };
|
|
102297
102323
|
for (const path16 of deletions) {
|
|
102298
102324
|
const fullPath = join106(claudeDir3, path16);
|
|
102299
|
-
const normalizedPath =
|
|
102300
|
-
const normalizedClaudeDir =
|
|
102325
|
+
const normalizedPath = resolve42(fullPath);
|
|
102326
|
+
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102301
102327
|
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep12}`)) {
|
|
102302
102328
|
logger.warning(`Skipping invalid path: ${path16}`);
|
|
102303
102329
|
result.errors.push(path16);
|
|
@@ -105939,7 +105965,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
|
|
|
105939
105965
|
init_logger();
|
|
105940
105966
|
init_skip_directories();
|
|
105941
105967
|
var import_fs_extra20 = __toESM(require_lib(), 1);
|
|
105942
|
-
import { join as join116, relative as relative26, resolve as
|
|
105968
|
+
import { join as join116, relative as relative26, resolve as resolve43 } from "node:path";
|
|
105943
105969
|
|
|
105944
105970
|
class FileScanner2 {
|
|
105945
105971
|
static async getFiles(dirPath, relativeTo) {
|
|
@@ -106019,8 +106045,8 @@ class FileScanner2 {
|
|
|
106019
106045
|
return customFiles;
|
|
106020
106046
|
}
|
|
106021
106047
|
static isSafePath(basePath, targetPath) {
|
|
106022
|
-
const resolvedBase =
|
|
106023
|
-
const resolvedTarget =
|
|
106048
|
+
const resolvedBase = resolve43(basePath);
|
|
106049
|
+
const resolvedTarget = resolve43(targetPath);
|
|
106024
106050
|
return resolvedTarget.startsWith(resolvedBase);
|
|
106025
106051
|
}
|
|
106026
106052
|
static toPosixPath(path17) {
|
|
@@ -108167,7 +108193,7 @@ async function handlePostInstall(ctx) {
|
|
|
108167
108193
|
init_config_manager();
|
|
108168
108194
|
init_github_client();
|
|
108169
108195
|
import { mkdir as mkdir36 } from "node:fs/promises";
|
|
108170
|
-
import { join as join135, resolve as
|
|
108196
|
+
import { join as join135, resolve as resolve46 } from "node:path";
|
|
108171
108197
|
|
|
108172
108198
|
// src/domains/github/kit-access-checker.ts
|
|
108173
108199
|
init_error2();
|
|
@@ -108337,7 +108363,7 @@ async function runPreflightChecks() {
|
|
|
108337
108363
|
// src/domains/installation/fresh-installer.ts
|
|
108338
108364
|
init_metadata_migration();
|
|
108339
108365
|
import { existsSync as existsSync67, readdirSync as readdirSync10, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
|
|
108340
|
-
import { basename as basename28, dirname as dirname42, join as join133, resolve as
|
|
108366
|
+
import { basename as basename28, dirname as dirname42, join as join133, resolve as resolve44 } from "node:path";
|
|
108341
108367
|
init_logger();
|
|
108342
108368
|
init_safe_spinner();
|
|
108343
108369
|
var import_fs_extra35 = __toESM(require_lib(), 1);
|
|
@@ -108389,15 +108415,15 @@ async function analyzeFreshInstallation(claudeDir3) {
|
|
|
108389
108415
|
};
|
|
108390
108416
|
}
|
|
108391
108417
|
function cleanupEmptyDirectories2(filePath, claudeDir3) {
|
|
108392
|
-
const normalizedClaudeDir =
|
|
108393
|
-
let currentDir =
|
|
108418
|
+
const normalizedClaudeDir = resolve44(claudeDir3);
|
|
108419
|
+
let currentDir = resolve44(dirname42(filePath));
|
|
108394
108420
|
while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir)) {
|
|
108395
108421
|
try {
|
|
108396
108422
|
const entries = readdirSync10(currentDir);
|
|
108397
108423
|
if (entries.length === 0) {
|
|
108398
108424
|
rmdirSync2(currentDir);
|
|
108399
108425
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
108400
|
-
currentDir =
|
|
108426
|
+
currentDir = resolve44(dirname42(currentDir));
|
|
108401
108427
|
} else {
|
|
108402
108428
|
break;
|
|
108403
108429
|
}
|
|
@@ -108587,7 +108613,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
|
|
|
108587
108613
|
var import_fs_extra36 = __toESM(require_lib(), 1);
|
|
108588
108614
|
import { cp as cp5, mkdir as mkdir35, readdir as readdir42, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
|
|
108589
108615
|
import { homedir as homedir47 } from "node:os";
|
|
108590
|
-
import { dirname as dirname43, join as join134, normalize as normalize11, resolve as
|
|
108616
|
+
import { dirname as dirname43, join as join134, normalize as normalize11, resolve as resolve45 } from "node:path";
|
|
108591
108617
|
var LEGACY_KIT_MARKERS = [
|
|
108592
108618
|
"metadata.json",
|
|
108593
108619
|
".ck.json",
|
|
@@ -108613,7 +108639,7 @@ function uniqueNormalizedPaths(paths) {
|
|
|
108613
108639
|
const seen = new Set;
|
|
108614
108640
|
const result = [];
|
|
108615
108641
|
for (const path17 of paths) {
|
|
108616
|
-
const normalized = normalize11(
|
|
108642
|
+
const normalized = normalize11(resolve45(path17));
|
|
108617
108643
|
if (seen.has(normalized))
|
|
108618
108644
|
continue;
|
|
108619
108645
|
seen.add(normalized);
|
|
@@ -108678,8 +108704,8 @@ async function repairLegacyWindowsGlobalKitDir(options2) {
|
|
|
108678
108704
|
if (safeEnvPath(env2.CLAUDE_CONFIG_DIR)) {
|
|
108679
108705
|
return { status: "skipped", reason: "custom-global-dir", candidateDirs: [] };
|
|
108680
108706
|
}
|
|
108681
|
-
const targetDir = normalize11(
|
|
108682
|
-
const candidateDirs = getLegacyWindowsGlobalKitDirCandidates(env2, options2.homeDir).filter((candidate) => normalize11(
|
|
108707
|
+
const targetDir = normalize11(resolve45(options2.targetDir));
|
|
108708
|
+
const candidateDirs = getLegacyWindowsGlobalKitDirCandidates(env2, options2.homeDir).filter((candidate) => normalize11(resolve45(candidate)) !== targetDir);
|
|
108683
108709
|
const legacyDirs = [];
|
|
108684
108710
|
for (const candidate of candidateDirs) {
|
|
108685
108711
|
if (await hasKitMarkers(candidate)) {
|
|
@@ -108902,7 +108928,7 @@ async function handleSelection(ctx) {
|
|
|
108902
108928
|
}
|
|
108903
108929
|
}
|
|
108904
108930
|
}
|
|
108905
|
-
const resolvedDir =
|
|
108931
|
+
const resolvedDir = resolve46(targetDir);
|
|
108906
108932
|
if (ctx.options.global) {
|
|
108907
108933
|
try {
|
|
108908
108934
|
const repairResult = await repairLegacyWindowsGlobalKitDir({ targetDir: resolvedDir });
|
|
@@ -109099,7 +109125,7 @@ async function handleSelection(ctx) {
|
|
|
109099
109125
|
}
|
|
109100
109126
|
// src/commands/init/phases/sync-handler.ts
|
|
109101
109127
|
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";
|
|
109102
|
-
import { dirname as dirname44, join as join136, resolve as
|
|
109128
|
+
import { dirname as dirname44, join as join136, resolve as resolve47 } from "node:path";
|
|
109103
109129
|
init_logger();
|
|
109104
109130
|
init_path_resolver();
|
|
109105
109131
|
var import_fs_extra38 = __toESM(require_lib(), 1);
|
|
@@ -109108,7 +109134,7 @@ async function handleSync(ctx) {
|
|
|
109108
109134
|
if (!ctx.options.sync) {
|
|
109109
109135
|
return ctx;
|
|
109110
109136
|
}
|
|
109111
|
-
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() :
|
|
109137
|
+
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve47(ctx.options.dir || ".");
|
|
109112
109138
|
const claudeDir3 = ctx.options.global ? resolvedDir : join136(resolvedDir, ".claude");
|
|
109113
109139
|
if (!await import_fs_extra38.pathExists(claudeDir3)) {
|
|
109114
109140
|
logger.error("Cannot sync: no .claude directory found");
|
|
@@ -109242,7 +109268,7 @@ async function acquireSyncLock(global3) {
|
|
|
109242
109268
|
}
|
|
109243
109269
|
logger.debug(`Lock stat failed: ${statError}`);
|
|
109244
109270
|
}
|
|
109245
|
-
await new Promise((
|
|
109271
|
+
await new Promise((resolve48) => setTimeout(resolve48, 100));
|
|
109246
109272
|
continue;
|
|
109247
109273
|
}
|
|
109248
109274
|
throw err;
|
|
@@ -110229,7 +110255,7 @@ var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
|
110229
110255
|
import { existsSync as existsSync68 } from "node:fs";
|
|
110230
110256
|
import { readFile as readFile65, rm as rm18, unlink as unlink14 } from "node:fs/promises";
|
|
110231
110257
|
import { homedir as homedir52 } from "node:os";
|
|
110232
|
-
import { basename as basename30, join as join144, resolve as
|
|
110258
|
+
import { basename as basename30, join as join144, resolve as resolve48 } from "node:path";
|
|
110233
110259
|
init_logger();
|
|
110234
110260
|
|
|
110235
110261
|
// src/ui/ck-cli-design/next-steps-footer.ts
|
|
@@ -111613,7 +111639,7 @@ function shouldExecuteAction2(action) {
|
|
|
111613
111639
|
}
|
|
111614
111640
|
async function executeDeleteAction(action, options2) {
|
|
111615
111641
|
const preservePaths = options2?.preservePaths ?? new Set;
|
|
111616
|
-
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(
|
|
111642
|
+
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve48(action.targetPath));
|
|
111617
111643
|
try {
|
|
111618
111644
|
if (!shouldPreserveTarget && action.targetPath && existsSync68(action.targetPath)) {
|
|
111619
111645
|
await rm18(action.targetPath, { recursive: true, force: true });
|
|
@@ -111646,7 +111672,7 @@ async function executeDeleteAction(action, options2) {
|
|
|
111646
111672
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
111647
111673
|
if (!skillSourcePath)
|
|
111648
111674
|
return;
|
|
111649
|
-
const sourceMetadataPath = join144(
|
|
111675
|
+
const sourceMetadataPath = join144(resolve48(skillSourcePath, ".."), "metadata.json");
|
|
111650
111676
|
if (!existsSync68(sourceMetadataPath))
|
|
111651
111677
|
return;
|
|
111652
111678
|
let sourceMetadata;
|
|
@@ -112067,7 +112093,7 @@ async function migrateCommand(options2) {
|
|
|
112067
112093
|
const recordSuccessfulWrites = (task, taskResults) => {
|
|
112068
112094
|
for (const result of taskResults.filter((entry) => entry.success && !entry.skipped)) {
|
|
112069
112095
|
if (result.path.length > 0) {
|
|
112070
|
-
writtenPaths.add(
|
|
112096
|
+
writtenPaths.add(resolve48(result.path));
|
|
112071
112097
|
}
|
|
112072
112098
|
if (task.type === "hooks") {
|
|
112073
112099
|
const existing = successfulHookFiles.get(task.provider) ?? {
|
|
@@ -112078,7 +112104,7 @@ async function migrateCommand(options2) {
|
|
|
112078
112104
|
successfulHookFiles.set(task.provider, existing);
|
|
112079
112105
|
if (result.path.length > 0) {
|
|
112080
112106
|
const absExisting = successfulHookAbsPaths.get(task.provider) ?? [];
|
|
112081
|
-
absExisting.push(
|
|
112107
|
+
absExisting.push(resolve48(result.path));
|
|
112082
112108
|
successfulHookAbsPaths.set(task.provider, absExisting);
|
|
112083
112109
|
}
|
|
112084
112110
|
}
|
|
@@ -112221,7 +112247,7 @@ async function migrateCommand(options2) {
|
|
|
112221
112247
|
}
|
|
112222
112248
|
}
|
|
112223
112249
|
try {
|
|
112224
|
-
const kitRoot = (agentSource ?
|
|
112250
|
+
const kitRoot = (agentSource ? resolve48(agentSource, "..") : null) ?? (commandSource ? resolve48(commandSource, "..") : null) ?? (skillSource ? resolve48(skillSource, "..") : null) ?? null;
|
|
112225
112251
|
const manifest = kitRoot ? await loadPortableManifest(kitRoot) : null;
|
|
112226
112252
|
if (manifest?.cliVersion) {
|
|
112227
112253
|
await updateAppliedManifestVersion(manifest.cliVersion);
|
|
@@ -112418,7 +112444,7 @@ var import_picocolors31 = __toESM(require_picocolors(), 1);
|
|
|
112418
112444
|
|
|
112419
112445
|
// src/commands/new/phases/directory-setup.ts
|
|
112420
112446
|
init_config_manager();
|
|
112421
|
-
import { resolve as
|
|
112447
|
+
import { resolve as resolve49 } from "node:path";
|
|
112422
112448
|
init_logger();
|
|
112423
112449
|
init_path_resolver();
|
|
112424
112450
|
init_types3();
|
|
@@ -112503,7 +112529,7 @@ async function directorySetup(validOptions, prompts) {
|
|
|
112503
112529
|
targetDir = await prompts.getDirectory(targetDir);
|
|
112504
112530
|
}
|
|
112505
112531
|
}
|
|
112506
|
-
const resolvedDir =
|
|
112532
|
+
const resolvedDir = resolve49(targetDir);
|
|
112507
112533
|
logger.info(`Target directory: ${resolvedDir}`);
|
|
112508
112534
|
if (PathResolver.isLocalSameAsGlobal(resolvedDir)) {
|
|
112509
112535
|
logger.warning("You're creating a project at HOME directory.");
|
|
@@ -112837,7 +112863,7 @@ Please use only one download method.`);
|
|
|
112837
112863
|
// src/commands/plan/plan-command.ts
|
|
112838
112864
|
init_output_manager();
|
|
112839
112865
|
import { existsSync as existsSync71, statSync as statSync12 } from "node:fs";
|
|
112840
|
-
import { dirname as dirname50, isAbsolute as isAbsolute14, join as join149, parse as parse7, resolve as
|
|
112866
|
+
import { dirname as dirname50, isAbsolute as isAbsolute14, join as join149, parse as parse7, resolve as resolve53 } from "node:path";
|
|
112841
112867
|
|
|
112842
112868
|
// src/commands/plan/plan-read-handlers.ts
|
|
112843
112869
|
init_config();
|
|
@@ -112847,7 +112873,7 @@ init_logger();
|
|
|
112847
112873
|
init_output_manager();
|
|
112848
112874
|
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
112849
112875
|
import { existsSync as existsSync70, statSync as statSync11 } from "node:fs";
|
|
112850
|
-
import { basename as basename31, dirname as dirname48, join as join148, relative as relative32, resolve as
|
|
112876
|
+
import { basename as basename31, dirname as dirname48, join as join148, relative as relative32, resolve as resolve51 } from "node:path";
|
|
112851
112877
|
|
|
112852
112878
|
// src/commands/plan/plan-dependencies.ts
|
|
112853
112879
|
init_config();
|
|
@@ -112905,14 +112931,14 @@ init_config();
|
|
|
112905
112931
|
init_plan_parser();
|
|
112906
112932
|
init_plan_scope();
|
|
112907
112933
|
init_plans_registry();
|
|
112908
|
-
import { isAbsolute as isAbsolute13, resolve as
|
|
112934
|
+
import { isAbsolute as isAbsolute13, resolve as resolve50 } from "node:path";
|
|
112909
112935
|
async function getGlobalPlansDirFromCwd() {
|
|
112910
112936
|
const projectRoot = findProjectRoot(process.cwd());
|
|
112911
112937
|
const { config } = await CkConfigManager.loadFull(projectRoot);
|
|
112912
112938
|
return resolveGlobalPlansDir(config);
|
|
112913
112939
|
}
|
|
112914
112940
|
function resolveTargetFromBase(target, baseDir) {
|
|
112915
|
-
const resolvedTarget = isAbsolute13(target) ?
|
|
112941
|
+
const resolvedTarget = isAbsolute13(target) ? resolve50(target) : resolve50(baseDir, target);
|
|
112916
112942
|
return isWithinDir(resolvedTarget, baseDir) ? resolvedTarget : null;
|
|
112917
112943
|
}
|
|
112918
112944
|
|
|
@@ -113015,7 +113041,7 @@ async function handleStatus(target, options2) {
|
|
|
113015
113041
|
return;
|
|
113016
113042
|
}
|
|
113017
113043
|
const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
|
|
113018
|
-
const t = effectiveTarget ?
|
|
113044
|
+
const t = effectiveTarget ? resolve51(effectiveTarget) : null;
|
|
113019
113045
|
const plansDir = t && existsSync70(t) && statSync11(t).isDirectory() && !existsSync70(join148(t, "plan.md")) ? t : null;
|
|
113020
113046
|
if (plansDir) {
|
|
113021
113047
|
const planFiles = scanPlanDir(plansDir);
|
|
@@ -113200,7 +113226,7 @@ init_plan_parser();
|
|
|
113200
113226
|
init_plans_registry();
|
|
113201
113227
|
init_output_manager();
|
|
113202
113228
|
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
113203
|
-
import { basename as basename32, dirname as dirname49, relative as relative33, resolve as
|
|
113229
|
+
import { basename as basename32, dirname as dirname49, relative as relative33, resolve as resolve52 } from "node:path";
|
|
113204
113230
|
function quoteReadTarget(filePath) {
|
|
113205
113231
|
return `"${filePath.replace(/\\/g, "/").replace(/"/g, "\\\"")}"`;
|
|
113206
113232
|
}
|
|
@@ -113243,13 +113269,13 @@ async function handleCreate(target, options2) {
|
|
|
113243
113269
|
return;
|
|
113244
113270
|
}
|
|
113245
113271
|
const globalBaseDir = options2.global ? await getGlobalPlansDirFromCwd() : undefined;
|
|
113246
|
-
const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) :
|
|
113272
|
+
const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) : resolve52(dir);
|
|
113247
113273
|
if (globalBaseDir && !resolvedDir) {
|
|
113248
113274
|
output.error("[X] Target directory must stay within the configured global plans root");
|
|
113249
113275
|
process.exitCode = 1;
|
|
113250
113276
|
return;
|
|
113251
113277
|
}
|
|
113252
|
-
const safeResolvedDir = resolvedDir ??
|
|
113278
|
+
const safeResolvedDir = resolvedDir ?? resolve52(dir);
|
|
113253
113279
|
const result = scaffoldPlan({
|
|
113254
113280
|
title: options2.title,
|
|
113255
113281
|
phases: phaseNames.map((name2) => ({ name: name2 })),
|
|
@@ -113428,19 +113454,19 @@ async function handleAddPhase(target, options2) {
|
|
|
113428
113454
|
// src/commands/plan/plan-command.ts
|
|
113429
113455
|
function resolveTargetPath(target, baseDir) {
|
|
113430
113456
|
if (!baseDir) {
|
|
113431
|
-
return
|
|
113457
|
+
return resolve53(target);
|
|
113432
113458
|
}
|
|
113433
113459
|
if (isAbsolute14(target)) {
|
|
113434
|
-
return
|
|
113460
|
+
return resolve53(target);
|
|
113435
113461
|
}
|
|
113436
|
-
const cwdCandidate =
|
|
113462
|
+
const cwdCandidate = resolve53(target);
|
|
113437
113463
|
if (existsSync71(cwdCandidate)) {
|
|
113438
113464
|
return cwdCandidate;
|
|
113439
113465
|
}
|
|
113440
|
-
return
|
|
113466
|
+
return resolve53(baseDir, target);
|
|
113441
113467
|
}
|
|
113442
113468
|
function resolvePlanFile(target, baseDir) {
|
|
113443
|
-
const t = target ? resolveTargetPath(target, baseDir) : baseDir ?
|
|
113469
|
+
const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve53(baseDir) : process.cwd();
|
|
113444
113470
|
if (existsSync71(t)) {
|
|
113445
113471
|
const stat24 = statSync12(t);
|
|
113446
113472
|
if (stat24.isFile())
|
|
@@ -113504,7 +113530,7 @@ async function planCommand(action, target, options2) {
|
|
|
113504
113530
|
let resolvedTarget = target;
|
|
113505
113531
|
if (resolvedAction && !knownActions.has(resolvedAction)) {
|
|
113506
113532
|
const looksLikePath = resolvedAction.includes("/") || resolvedAction.includes("\\") || resolvedAction.endsWith(".md") || resolvedAction === "." || resolvedAction === "..";
|
|
113507
|
-
const existsOnDisk = !looksLikePath && existsSync71(
|
|
113533
|
+
const existsOnDisk = !looksLikePath && existsSync71(resolve53(resolvedAction));
|
|
113508
113534
|
if (looksLikePath || existsOnDisk) {
|
|
113509
113535
|
resolvedTarget = resolvedAction;
|
|
113510
113536
|
resolvedAction = undefined;
|
|
@@ -113547,11 +113573,11 @@ init_logger();
|
|
|
113547
113573
|
init_safe_prompts();
|
|
113548
113574
|
var import_picocolors34 = __toESM(require_picocolors(), 1);
|
|
113549
113575
|
import { existsSync as existsSync72 } from "node:fs";
|
|
113550
|
-
import { resolve as
|
|
113576
|
+
import { resolve as resolve54 } from "node:path";
|
|
113551
113577
|
async function handleAdd(projectPath, options2) {
|
|
113552
113578
|
logger.debug(`Adding project: ${projectPath}, options: ${JSON.stringify(options2)}`);
|
|
113553
113579
|
intro("Add Project");
|
|
113554
|
-
const absolutePath =
|
|
113580
|
+
const absolutePath = resolve54(projectPath);
|
|
113555
113581
|
if (!existsSync72(absolutePath)) {
|
|
113556
113582
|
log.error(`Path does not exist: ${absolutePath}`);
|
|
113557
113583
|
process.exitCode = 1;
|
|
@@ -113976,7 +114002,7 @@ import { readFile as readFile66 } from "node:fs/promises";
|
|
|
113976
114002
|
import { join as join151 } from "node:path";
|
|
113977
114003
|
|
|
113978
114004
|
// src/commands/skills/installed-skills-inventory.ts
|
|
113979
|
-
import { join as join150, resolve as
|
|
114005
|
+
import { join as join150, resolve as resolve55 } from "node:path";
|
|
113980
114006
|
init_path_resolver();
|
|
113981
114007
|
var SCOPE_SORT_ORDER = {
|
|
113982
114008
|
project: 0,
|
|
@@ -113984,8 +114010,8 @@ var SCOPE_SORT_ORDER = {
|
|
|
113984
114010
|
};
|
|
113985
114011
|
async function getActiveClaudeSkillInstallations(options2 = {}) {
|
|
113986
114012
|
const projectDir = options2.projectDir ?? process.cwd();
|
|
113987
|
-
const globalDir =
|
|
113988
|
-
const projectClaudeDir =
|
|
114013
|
+
const globalDir = resolve55(options2.globalDir ?? PathResolver.getGlobalKitDir());
|
|
114014
|
+
const projectClaudeDir = resolve55(projectDir, ".claude");
|
|
113989
114015
|
const projectScopeAliasesGlobal = projectClaudeDir === globalDir;
|
|
113990
114016
|
const [projectSkills, globalSkills] = await Promise.all([
|
|
113991
114017
|
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(join150(projectClaudeDir, "skills")),
|
|
@@ -114732,7 +114758,7 @@ async function detectInstallations() {
|
|
|
114732
114758
|
|
|
114733
114759
|
// src/commands/uninstall/removal-handler.ts
|
|
114734
114760
|
import { readdirSync as readdirSync12, rmSync as rmSync5 } from "node:fs";
|
|
114735
|
-
import { basename as basename33, join as join153, resolve as
|
|
114761
|
+
import { basename as basename33, join as join153, resolve as resolve56, sep as sep14 } from "node:path";
|
|
114736
114762
|
init_logger();
|
|
114737
114763
|
init_safe_prompts();
|
|
114738
114764
|
init_safe_spinner();
|
|
@@ -114916,8 +114942,8 @@ async function restoreUninstallBackup(backup) {
|
|
|
114916
114942
|
}
|
|
114917
114943
|
async function isPathSafeToRemove(filePath, baseDir) {
|
|
114918
114944
|
try {
|
|
114919
|
-
const resolvedPath =
|
|
114920
|
-
const resolvedBase =
|
|
114945
|
+
const resolvedPath = resolve56(filePath);
|
|
114946
|
+
const resolvedBase = resolve56(baseDir);
|
|
114921
114947
|
if (!resolvedPath.startsWith(resolvedBase + sep14) && resolvedPath !== resolvedBase) {
|
|
114922
114948
|
logger.debug(`Path outside installation directory: ${filePath}`);
|
|
114923
114949
|
return false;
|
|
@@ -114925,7 +114951,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
|
|
|
114925
114951
|
const stats = await import_fs_extra43.lstat(filePath);
|
|
114926
114952
|
if (stats.isSymbolicLink()) {
|
|
114927
114953
|
const realPath = await import_fs_extra43.realpath(filePath);
|
|
114928
|
-
const resolvedReal =
|
|
114954
|
+
const resolvedReal = resolve56(realPath);
|
|
114929
114955
|
if (!resolvedReal.startsWith(resolvedBase + sep14) && resolvedReal !== resolvedBase) {
|
|
114930
114956
|
logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
|
|
114931
114957
|
return false;
|
|
@@ -115463,7 +115489,7 @@ function getDisclaimerMarker() {
|
|
|
115463
115489
|
return AI_DISCLAIMER;
|
|
115464
115490
|
}
|
|
115465
115491
|
function spawnAndCollect2(command, args) {
|
|
115466
|
-
return new Promise((
|
|
115492
|
+
return new Promise((resolve57, reject) => {
|
|
115467
115493
|
const child = spawn6(command, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
115468
115494
|
const chunks = [];
|
|
115469
115495
|
const stderrChunks = [];
|
|
@@ -115476,7 +115502,7 @@ function spawnAndCollect2(command, args) {
|
|
|
115476
115502
|
reject(new Error(`${command} exited with code ${code2}: ${stderr}`));
|
|
115477
115503
|
return;
|
|
115478
115504
|
}
|
|
115479
|
-
|
|
115505
|
+
resolve57(Buffer.concat(chunks).toString("utf-8"));
|
|
115480
115506
|
});
|
|
115481
115507
|
});
|
|
115482
115508
|
}
|
|
@@ -115584,7 +115610,7 @@ function formatResponse(content, showBranding) {
|
|
|
115584
115610
|
return disclaimer + formatted + branding;
|
|
115585
115611
|
}
|
|
115586
115612
|
async function postViaGh(owner, repo, issueNumber, body) {
|
|
115587
|
-
return new Promise((
|
|
115613
|
+
return new Promise((resolve57, reject) => {
|
|
115588
115614
|
const args = [
|
|
115589
115615
|
"issue",
|
|
115590
115616
|
"comment",
|
|
@@ -115606,7 +115632,7 @@ async function postViaGh(owner, repo, issueNumber, body) {
|
|
|
115606
115632
|
reject(new Error(`gh exited with code ${code2}: ${stderr}`));
|
|
115607
115633
|
return;
|
|
115608
115634
|
}
|
|
115609
|
-
|
|
115635
|
+
resolve57();
|
|
115610
115636
|
});
|
|
115611
115637
|
});
|
|
115612
115638
|
}
|
|
@@ -115724,7 +115750,7 @@ After completing the implementation:
|
|
|
115724
115750
|
"--allowedTools",
|
|
115725
115751
|
tools
|
|
115726
115752
|
];
|
|
115727
|
-
await new Promise((
|
|
115753
|
+
await new Promise((resolve57, reject) => {
|
|
115728
115754
|
const child = spawn8("claude", args, { cwd: cwd2, stdio: ["pipe", "pipe", "pipe"], detached: false });
|
|
115729
115755
|
child.stdin.write(prompt);
|
|
115730
115756
|
child.stdin.end();
|
|
@@ -115749,7 +115775,7 @@ After completing the implementation:
|
|
|
115749
115775
|
reject(new Error(`Claude exited ${code2}: ${stderr.slice(0, 500)}`));
|
|
115750
115776
|
return;
|
|
115751
115777
|
}
|
|
115752
|
-
|
|
115778
|
+
resolve57();
|
|
115753
115779
|
});
|
|
115754
115780
|
});
|
|
115755
115781
|
}
|
|
@@ -115893,7 +115919,7 @@ function checkRateLimit2(processedThisHour, maxPerHour) {
|
|
|
115893
115919
|
return processedThisHour < maxPerHour;
|
|
115894
115920
|
}
|
|
115895
115921
|
function spawnAndCollect3(command, args) {
|
|
115896
|
-
return new Promise((
|
|
115922
|
+
return new Promise((resolve57, reject) => {
|
|
115897
115923
|
const child = spawn9(command, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
115898
115924
|
const chunks = [];
|
|
115899
115925
|
const stderrChunks = [];
|
|
@@ -115906,7 +115932,7 @@ function spawnAndCollect3(command, args) {
|
|
|
115906
115932
|
reject(new Error(`${command} exited with code ${code2}: ${stderr}`));
|
|
115907
115933
|
return;
|
|
115908
115934
|
}
|
|
115909
|
-
|
|
115935
|
+
resolve57(Buffer.concat(chunks).toString("utf-8"));
|
|
115910
115936
|
});
|
|
115911
115937
|
});
|
|
115912
115938
|
}
|
|
@@ -115958,7 +115984,7 @@ async function invokeClaude(options2) {
|
|
|
115958
115984
|
return collectClaudeOutput(child, options2.timeoutSec, verbose);
|
|
115959
115985
|
}
|
|
115960
115986
|
function collectClaudeOutput(child, timeoutSec, verbose = false) {
|
|
115961
|
-
return new Promise((
|
|
115987
|
+
return new Promise((resolve57, reject) => {
|
|
115962
115988
|
const chunks = [];
|
|
115963
115989
|
const stderrChunks = [];
|
|
115964
115990
|
child.stdout?.on("data", (chunk) => {
|
|
@@ -115988,7 +116014,7 @@ function collectClaudeOutput(child, timeoutSec, verbose = false) {
|
|
|
115988
116014
|
reject(new Error(`Claude exited with code ${code2}: ${stderr}`));
|
|
115989
116015
|
return;
|
|
115990
116016
|
}
|
|
115991
|
-
|
|
116017
|
+
resolve57(verbose ? parseStreamJsonOutput(stdout2) : parseClaudeOutput(stdout2));
|
|
115992
116018
|
});
|
|
115993
116019
|
});
|
|
115994
116020
|
}
|
|
@@ -117252,7 +117278,7 @@ function formatQueueInfo(state) {
|
|
|
117252
117278
|
return "idle";
|
|
117253
117279
|
}
|
|
117254
117280
|
function sleep(ms) {
|
|
117255
|
-
return new Promise((
|
|
117281
|
+
return new Promise((resolve57) => setTimeout(resolve57, ms));
|
|
117256
117282
|
}
|
|
117257
117283
|
// src/cli/command-registry.ts
|
|
117258
117284
|
init_logger();
|