claudekit-cli 3.36.0-dev.13 → 3.36.0-dev.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +489 -424
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -48304,11 +48304,38 @@ var init_skill_directory_installer = __esm(() => {
|
|
|
48304
48304
|
import { existsSync as existsSync17 } from "node:fs";
|
|
48305
48305
|
import { readFile as readFile12, readdir as readdir5 } from "node:fs/promises";
|
|
48306
48306
|
import { homedir as homedir13 } from "node:os";
|
|
48307
|
-
import { extname as extname3, join as join21, relative as relative5 } from "node:path";
|
|
48307
|
+
import { extname as extname3, join as join21, relative as relative5, sep as sep3 } from "node:path";
|
|
48308
|
+
function resolveSourceOrigin(sourcePath) {
|
|
48309
|
+
if (!sourcePath)
|
|
48310
|
+
return "global";
|
|
48311
|
+
const home5 = homedir13();
|
|
48312
|
+
const cwd2 = process.cwd();
|
|
48313
|
+
if (cwd2 === home5)
|
|
48314
|
+
return "global";
|
|
48315
|
+
const cwdPrefix = cwd2.endsWith(sep3) ? cwd2 : `${cwd2}${sep3}`;
|
|
48316
|
+
if (sourcePath === cwd2 || sourcePath.startsWith(cwdPrefix))
|
|
48317
|
+
return "project";
|
|
48318
|
+
return "global";
|
|
48319
|
+
}
|
|
48308
48320
|
function getConfigSourcePath() {
|
|
48321
|
+
const projectPath = join21(process.cwd(), "CLAUDE.md");
|
|
48322
|
+
if (existsSync17(projectPath)) {
|
|
48323
|
+
return projectPath;
|
|
48324
|
+
}
|
|
48325
|
+
const projectDotClaudePath = join21(process.cwd(), ".claude", "CLAUDE.md");
|
|
48326
|
+
if (existsSync17(projectDotClaudePath)) {
|
|
48327
|
+
return projectDotClaudePath;
|
|
48328
|
+
}
|
|
48329
|
+
return getGlobalConfigSourcePath();
|
|
48330
|
+
}
|
|
48331
|
+
function getGlobalConfigSourcePath() {
|
|
48309
48332
|
return join21(homedir13(), ".claude", "CLAUDE.md");
|
|
48310
48333
|
}
|
|
48311
48334
|
function getRulesSourcePath() {
|
|
48335
|
+
const projectPath = join21(process.cwd(), ".claude", "rules");
|
|
48336
|
+
if (existsSync17(projectPath)) {
|
|
48337
|
+
return projectPath;
|
|
48338
|
+
}
|
|
48312
48339
|
return join21(homedir13(), ".claude", "rules");
|
|
48313
48340
|
}
|
|
48314
48341
|
function getHooksSourcePath() {
|
|
@@ -51121,7 +51148,8 @@ var init_migration_result_utils = __esm(() => {
|
|
|
51121
51148
|
// src/domains/web-server/routes/migration-routes.ts
|
|
51122
51149
|
import { existsSync as existsSync21 } from "node:fs";
|
|
51123
51150
|
import { readFile as readFile15, rm as rm5 } from "node:fs/promises";
|
|
51124
|
-
import {
|
|
51151
|
+
import { homedir as homedir15 } from "node:os";
|
|
51152
|
+
import { basename as basename7, join as join24, resolve as resolve8 } from "node:path";
|
|
51125
51153
|
function isDisallowedControlCode(codePoint) {
|
|
51126
51154
|
return codePoint >= 0 && codePoint <= 8 || codePoint >= 11 && codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
51127
51155
|
}
|
|
@@ -51272,7 +51300,7 @@ function parseConfigSource(input) {
|
|
|
51272
51300
|
return { ok: true, value: undefined };
|
|
51273
51301
|
}
|
|
51274
51302
|
const projectSourcePath = resolve8(process.cwd(), "CLAUDE.md");
|
|
51275
|
-
const globalSourcePath = resolve8(
|
|
51303
|
+
const globalSourcePath = resolve8(getGlobalConfigSourcePath());
|
|
51276
51304
|
const sourceMap = {
|
|
51277
51305
|
default: undefined,
|
|
51278
51306
|
global: globalSourcePath,
|
|
@@ -51567,14 +51595,17 @@ async function discoverMigrationItems(include, configSource) {
|
|
|
51567
51595
|
const commandsSource = include.commands ? getCommandSourcePath() : null;
|
|
51568
51596
|
const skillsSource = include.skills ? getSkillSourcePath() : null;
|
|
51569
51597
|
const hooksSource = include.hooks ? getHooksSourcePath() : null;
|
|
51598
|
+
const configSourcePath = include.config ? configSource ?? getConfigSourcePath() : null;
|
|
51599
|
+
const rulesSourcePath = include.rules ? getRulesSourcePath() : null;
|
|
51570
51600
|
const [agents, commands, skills, configItem, ruleItems, hookItems] = await Promise.all([
|
|
51571
51601
|
agentsSource ? discoverAgents(agentsSource) : Promise.resolve([]),
|
|
51572
51602
|
commandsSource ? discoverCommands(commandsSource) : Promise.resolve([]),
|
|
51573
51603
|
skillsSource ? discoverSkills(skillsSource) : Promise.resolve([]),
|
|
51574
|
-
|
|
51575
|
-
|
|
51604
|
+
configSourcePath ? discoverConfig(configSourcePath) : Promise.resolve(null),
|
|
51605
|
+
rulesSourcePath ? discoverRules(rulesSourcePath) : Promise.resolve([]),
|
|
51576
51606
|
hooksSource ? discoverHooks(hooksSource).then(({ items, skippedShellHooks }) => {
|
|
51577
|
-
if (skippedShellHooks.length > 0) {
|
|
51607
|
+
if (skippedShellHooks.length > 0 && !shellHookWarningShown) {
|
|
51608
|
+
shellHookWarningShown = true;
|
|
51578
51609
|
console.warn(`[migrate] Skipping ${skippedShellHooks.length} shell hook(s) not supported for migration (node-runnable only): ${skippedShellHooks.join(", ")}`);
|
|
51579
51610
|
}
|
|
51580
51611
|
return items;
|
|
@@ -51591,7 +51622,9 @@ async function discoverMigrationItems(include, configSource) {
|
|
|
51591
51622
|
agents: agentsSource,
|
|
51592
51623
|
commands: commandsSource,
|
|
51593
51624
|
skills: skillsSource,
|
|
51594
|
-
hooks: hooksSource
|
|
51625
|
+
hooks: hooksSource,
|
|
51626
|
+
config: configSourcePath,
|
|
51627
|
+
rules: rulesSourcePath
|
|
51595
51628
|
}
|
|
51596
51629
|
};
|
|
51597
51630
|
}
|
|
@@ -51639,8 +51672,23 @@ function registerMigrationRoutes(app) {
|
|
|
51639
51672
|
hooks: true
|
|
51640
51673
|
};
|
|
51641
51674
|
const discovered = await discoverMigrationItems(includeAll);
|
|
51675
|
+
const cwd2 = process.cwd();
|
|
51676
|
+
const home6 = homedir15();
|
|
51642
51677
|
res.status(200).json({
|
|
51678
|
+
cwd: cwd2,
|
|
51679
|
+
targetPaths: {
|
|
51680
|
+
project: join24(cwd2, ".claude"),
|
|
51681
|
+
global: join24(home6, ".claude")
|
|
51682
|
+
},
|
|
51643
51683
|
sourcePaths: discovered.sourcePaths,
|
|
51684
|
+
sourceOrigins: {
|
|
51685
|
+
agents: discovered.sourcePaths.agents ? resolveSourceOrigin(discovered.sourcePaths.agents) : null,
|
|
51686
|
+
commands: discovered.sourcePaths.commands ? resolveSourceOrigin(discovered.sourcePaths.commands) : null,
|
|
51687
|
+
skills: discovered.sourcePaths.skills ? resolveSourceOrigin(discovered.sourcePaths.skills) : null,
|
|
51688
|
+
config: discovered.sourcePaths.config ? resolveSourceOrigin(discovered.sourcePaths.config) : null,
|
|
51689
|
+
rules: discovered.sourcePaths.rules ? resolveSourceOrigin(discovered.sourcePaths.rules) : null,
|
|
51690
|
+
hooks: discovered.sourcePaths.hooks ? resolveSourceOrigin(discovered.sourcePaths.hooks) : null
|
|
51691
|
+
},
|
|
51644
51692
|
counts: {
|
|
51645
51693
|
agents: discovered.agents.length,
|
|
51646
51694
|
commands: discovered.commands.length,
|
|
@@ -52206,7 +52254,7 @@ function registerMigrationRoutes(app) {
|
|
|
52206
52254
|
}
|
|
52207
52255
|
});
|
|
52208
52256
|
}
|
|
52209
|
-
var MIGRATION_TYPES, MAX_PROVIDER_COUNT = 20, MAX_PLAN_ACTIONS = 5000, ALLOWED_CONFIG_SOURCE_KEYS, CONFLICT_RESOLUTION_SCHEMA, RECONCILE_ACTION_SCHEMA, RECONCILE_PLAN_SCHEMA, PLAN_EXECUTE_PAYLOAD_SCHEMA, PLURAL_TO_SINGULAR;
|
|
52257
|
+
var MIGRATION_TYPES, MAX_PROVIDER_COUNT = 20, MAX_PLAN_ACTIONS = 5000, ALLOWED_CONFIG_SOURCE_KEYS, CONFLICT_RESOLUTION_SCHEMA, RECONCILE_ACTION_SCHEMA, RECONCILE_PLAN_SCHEMA, PLAN_EXECUTE_PAYLOAD_SCHEMA, PLURAL_TO_SINGULAR, shellHookWarningShown = false;
|
|
52210
52258
|
var init_migration_routes = __esm(() => {
|
|
52211
52259
|
init_agents_discovery();
|
|
52212
52260
|
init_commands_discovery();
|
|
@@ -52663,12 +52711,12 @@ var init_plan_table_parser = __esm(() => {
|
|
|
52663
52711
|
|
|
52664
52712
|
// src/domains/plan-parser/plan-scanner.ts
|
|
52665
52713
|
import { existsSync as existsSync22, readdirSync as readdirSync3 } from "node:fs";
|
|
52666
|
-
import { join as
|
|
52714
|
+
import { join as join25 } from "node:path";
|
|
52667
52715
|
function scanPlanDir(dir) {
|
|
52668
52716
|
if (!existsSync22(dir))
|
|
52669
52717
|
return [];
|
|
52670
52718
|
try {
|
|
52671
|
-
return readdirSync3(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
52719
|
+
return readdirSync3(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join25(dir, entry.name, "plan.md")).filter(existsSync22);
|
|
52672
52720
|
} catch {
|
|
52673
52721
|
return [];
|
|
52674
52722
|
}
|
|
@@ -52743,7 +52791,7 @@ var init_plan_validator = __esm(() => {
|
|
|
52743
52791
|
// src/domains/plan-parser/plan-writer.ts
|
|
52744
52792
|
import { mkdirSync as mkdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync2 } from "node:fs";
|
|
52745
52793
|
import { existsSync as existsSync24 } from "node:fs";
|
|
52746
|
-
import { basename as basename9, dirname as dirname13, join as
|
|
52794
|
+
import { basename as basename9, dirname as dirname13, join as join26 } from "node:path";
|
|
52747
52795
|
function phaseNameToFilename(id, name) {
|
|
52748
52796
|
const numMatch = /^(\d+)([a-z]*)$/i.exec(id);
|
|
52749
52797
|
const num = numMatch ? numMatch[1] : id;
|
|
@@ -52851,12 +52899,12 @@ function scaffoldPlan(options2) {
|
|
|
52851
52899
|
mkdirSync2(dir, { recursive: true });
|
|
52852
52900
|
const resolvedPhases = resolvePhaseIds(options2.phases);
|
|
52853
52901
|
const optionsWithResolved = { ...options2, phases: resolvedPhases };
|
|
52854
|
-
const planFile =
|
|
52902
|
+
const planFile = join26(dir, "plan.md");
|
|
52855
52903
|
writeFileSync2(planFile, generatePlanMd(optionsWithResolved), "utf8");
|
|
52856
52904
|
const phaseFiles = [];
|
|
52857
52905
|
for (const phase of resolvedPhases) {
|
|
52858
52906
|
const filename = phaseNameToFilename(phase.id, phase.name);
|
|
52859
|
-
const phaseFile =
|
|
52907
|
+
const phaseFile = join26(dir, filename);
|
|
52860
52908
|
writeFileSync2(phaseFile, generatePhaseTemplate(phase), "utf8");
|
|
52861
52909
|
phaseFiles.push(phaseFile);
|
|
52862
52910
|
}
|
|
@@ -52936,7 +52984,7 @@ function phaseNameFilenameFromTableRow(body, phaseId, planDir) {
|
|
|
52936
52984
|
continue;
|
|
52937
52985
|
const linkMatch = /\[([^\]]+)\]\(\.\/([^)]+)\)/.exec(row);
|
|
52938
52986
|
if (linkMatch)
|
|
52939
|
-
return
|
|
52987
|
+
return join26(planDir, linkMatch[2]);
|
|
52940
52988
|
}
|
|
52941
52989
|
return null;
|
|
52942
52990
|
}
|
|
@@ -53017,7 +53065,7 @@ function addPhase(planFile, name, afterId) {
|
|
|
53017
53065
|
`);
|
|
53018
53066
|
}
|
|
53019
53067
|
writeFileSync2(planFile, import_gray_matter7.default.stringify(updatedBody, frontmatter), "utf8");
|
|
53020
|
-
const phaseFilePath =
|
|
53068
|
+
const phaseFilePath = join26(planDir, filename);
|
|
53021
53069
|
writeFileSync2(phaseFilePath, generatePhaseTemplate({ id: phaseId, name }), "utf8");
|
|
53022
53070
|
return { phaseId, phaseFile: phaseFilePath };
|
|
53023
53071
|
}
|
|
@@ -53056,11 +53104,11 @@ var init_plan_parser = __esm(() => {
|
|
|
53056
53104
|
|
|
53057
53105
|
// src/domains/web-server/routes/plan-routes.ts
|
|
53058
53106
|
import { existsSync as existsSync25, realpathSync } from "node:fs";
|
|
53059
|
-
import { basename as basename10, dirname as dirname15, relative as relative6, resolve as resolve10, sep as
|
|
53107
|
+
import { basename as basename10, dirname as dirname15, relative as relative6, resolve as resolve10, sep as sep4 } from "node:path";
|
|
53060
53108
|
function isWithinCwd(filePath) {
|
|
53061
53109
|
const cwd2 = process.cwd();
|
|
53062
53110
|
const resolved = resolve10(filePath);
|
|
53063
|
-
const cwdPrefix = cwd2.endsWith(
|
|
53111
|
+
const cwdPrefix = cwd2.endsWith(sep4) ? cwd2 : `${cwd2}${sep4}`;
|
|
53064
53112
|
if (!resolved.startsWith(cwdPrefix) && resolved !== cwd2)
|
|
53065
53113
|
return false;
|
|
53066
53114
|
if (existsSync25(resolved)) {
|
|
@@ -53207,11 +53255,11 @@ var init_types5 = __esm(() => {
|
|
|
53207
53255
|
|
|
53208
53256
|
// src/services/claude-data/history-parser.ts
|
|
53209
53257
|
import { createReadStream, statSync as statSync4 } from "node:fs";
|
|
53210
|
-
import { homedir as
|
|
53211
|
-
import { join as
|
|
53258
|
+
import { homedir as homedir16 } from "node:os";
|
|
53259
|
+
import { join as join27 } from "node:path";
|
|
53212
53260
|
import { createInterface as createInterface2 } from "node:readline";
|
|
53213
53261
|
function getHistoryPath() {
|
|
53214
|
-
return process.env.CLAUDE_HISTORY_PATH ??
|
|
53262
|
+
return process.env.CLAUDE_HISTORY_PATH ?? join27(homedir16(), ".claude", "history.jsonl");
|
|
53215
53263
|
}
|
|
53216
53264
|
function emptyResult(parseTimeMs, error) {
|
|
53217
53265
|
return { projects: [], totalEntries: 0, errorCount: 0, parseTimeMs, error };
|
|
@@ -53295,7 +53343,7 @@ var init_history_parser = __esm(() => {
|
|
|
53295
53343
|
// src/services/claude-data/session-parser.ts
|
|
53296
53344
|
import { existsSync as existsSync26 } from "node:fs";
|
|
53297
53345
|
import { readFile as readFile16, readdir as readdir7, stat as stat5 } from "node:fs/promises";
|
|
53298
|
-
import { join as
|
|
53346
|
+
import { join as join28 } from "node:path";
|
|
53299
53347
|
function formatTimestamp(date) {
|
|
53300
53348
|
const now = new Date;
|
|
53301
53349
|
const isToday = date.toDateString() === now.toDateString();
|
|
@@ -53392,7 +53440,7 @@ async function getProjectSessions(projectDir, limit = 10) {
|
|
|
53392
53440
|
const files = await readdir7(projectDir);
|
|
53393
53441
|
const jsonlFiles = files.filter((f3) => f3.endsWith(".jsonl"));
|
|
53394
53442
|
const fileStats = await Promise.all(jsonlFiles.map(async (file) => {
|
|
53395
|
-
const filePath =
|
|
53443
|
+
const filePath = join28(projectDir, file);
|
|
53396
53444
|
const fileStat = await stat5(filePath).catch(() => null);
|
|
53397
53445
|
return { file, filePath, mtime: fileStat?.mtime || new Date(0) };
|
|
53398
53446
|
}));
|
|
@@ -53409,10 +53457,10 @@ var init_session_parser = () => {};
|
|
|
53409
53457
|
// src/services/claude-data/skill-scanner.ts
|
|
53410
53458
|
import { existsSync as existsSync27 } from "node:fs";
|
|
53411
53459
|
import { readFile as readFile17, readdir as readdir8 } from "node:fs/promises";
|
|
53412
|
-
import { homedir as
|
|
53413
|
-
import { join as
|
|
53460
|
+
import { homedir as homedir17 } from "node:os";
|
|
53461
|
+
import { join as join29 } from "node:path";
|
|
53414
53462
|
async function getCkSkillMetadata(scope) {
|
|
53415
|
-
const metaPath = scope === "global" ?
|
|
53463
|
+
const metaPath = scope === "global" ? join29(homedir17(), ".claude", "metadata.json") : join29(process.cwd(), ".claude", "metadata.json");
|
|
53416
53464
|
if (!existsSync27(metaPath))
|
|
53417
53465
|
return null;
|
|
53418
53466
|
const result = new Map;
|
|
@@ -53448,7 +53496,7 @@ async function getCkSkillMetadata(scope) {
|
|
|
53448
53496
|
return result.size > 0 ? result : null;
|
|
53449
53497
|
}
|
|
53450
53498
|
async function getSkillMetadata(skillPath) {
|
|
53451
|
-
const skillMdPath =
|
|
53499
|
+
const skillMdPath = join29(skillPath, "SKILL.md");
|
|
53452
53500
|
if (!existsSync27(skillMdPath))
|
|
53453
53501
|
return null;
|
|
53454
53502
|
try {
|
|
@@ -53497,8 +53545,8 @@ async function scanSkills() {
|
|
|
53497
53545
|
continue;
|
|
53498
53546
|
if (ckMeta && !ckMeta.has(entry))
|
|
53499
53547
|
continue;
|
|
53500
|
-
const entryPath =
|
|
53501
|
-
const skillMdPath =
|
|
53548
|
+
const entryPath = join29(skillsDir, entry);
|
|
53549
|
+
const skillMdPath = join29(entryPath, "SKILL.md");
|
|
53502
53550
|
if (!existsSync27(skillMdPath))
|
|
53503
53551
|
continue;
|
|
53504
53552
|
const frontmatter = await getSkillMetadata(entryPath);
|
|
@@ -53543,17 +53591,17 @@ async function scanSkills() {
|
|
|
53543
53591
|
var import_gray_matter8, skillsDir, SKIP_DIRS3;
|
|
53544
53592
|
var init_skill_scanner = __esm(() => {
|
|
53545
53593
|
import_gray_matter8 = __toESM(require_gray_matter(), 1);
|
|
53546
|
-
skillsDir =
|
|
53594
|
+
skillsDir = join29(homedir17(), ".claude", "skills");
|
|
53547
53595
|
SKIP_DIRS3 = [".venv", "scripts", "__pycache__", "node_modules", ".git", "common"];
|
|
53548
53596
|
});
|
|
53549
53597
|
|
|
53550
53598
|
// src/services/claude-data/settings-reader.ts
|
|
53551
53599
|
import { existsSync as existsSync28 } from "node:fs";
|
|
53552
53600
|
import { copyFile as copyFile2, mkdir as mkdir8, readFile as readFile18, rename as rename5, rm as rm6, writeFile as writeFile10 } from "node:fs/promises";
|
|
53553
|
-
import { homedir as
|
|
53554
|
-
import { join as
|
|
53601
|
+
import { homedir as homedir18 } from "node:os";
|
|
53602
|
+
import { join as join30 } from "node:path";
|
|
53555
53603
|
function getSettingsPath() {
|
|
53556
|
-
return
|
|
53604
|
+
return join30(claudeDir, settingsFilename);
|
|
53557
53605
|
}
|
|
53558
53606
|
async function readSettings() {
|
|
53559
53607
|
const settingsPath = getSettingsPath();
|
|
@@ -53575,7 +53623,7 @@ async function backupAndSaveSettings(settings) {
|
|
|
53575
53623
|
let backupPath = null;
|
|
53576
53624
|
if (existsSync28(settingsPath)) {
|
|
53577
53625
|
await mkdir8(settingsBackupDir, { recursive: true });
|
|
53578
|
-
backupPath =
|
|
53626
|
+
backupPath = join30(settingsBackupDir, `${getBackupTimestamp()}-${settingsFilename}`);
|
|
53579
53627
|
await copyFile2(settingsPath, backupPath);
|
|
53580
53628
|
}
|
|
53581
53629
|
const tempPath = `${settingsPath}.tmp-${Date.now()}`;
|
|
@@ -53612,19 +53660,19 @@ function countMcpServers(settings) {
|
|
|
53612
53660
|
}
|
|
53613
53661
|
var claudeDir, settingsFilename = "settings.json", settingsBackupDir;
|
|
53614
53662
|
var init_settings_reader = __esm(() => {
|
|
53615
|
-
claudeDir =
|
|
53616
|
-
settingsBackupDir =
|
|
53663
|
+
claudeDir = join30(homedir18(), ".claude");
|
|
53664
|
+
settingsBackupDir = join30(claudeDir, ".ck-backups", "settings");
|
|
53617
53665
|
});
|
|
53618
53666
|
|
|
53619
53667
|
// src/services/claude-data/project-scanner.ts
|
|
53620
|
-
import { homedir as
|
|
53621
|
-
import { basename as basename11, join as
|
|
53668
|
+
import { homedir as homedir19 } from "node:os";
|
|
53669
|
+
import { basename as basename11, join as join31, normalize as normalize3 } from "node:path";
|
|
53622
53670
|
function encodePath(path4) {
|
|
53623
53671
|
return path4.replace(/\//g, "-").replace(/^-/, "-");
|
|
53624
53672
|
}
|
|
53625
53673
|
var projectsDir;
|
|
53626
53674
|
var init_project_scanner = __esm(() => {
|
|
53627
|
-
projectsDir =
|
|
53675
|
+
projectsDir = join31(homedir19(), ".claude", "projects");
|
|
53628
53676
|
});
|
|
53629
53677
|
|
|
53630
53678
|
// src/services/claude-data/project-discovery.ts
|
|
@@ -53719,10 +53767,10 @@ var init_project_discovery = __esm(() => {
|
|
|
53719
53767
|
|
|
53720
53768
|
// src/services/claude-data/user-preferences.ts
|
|
53721
53769
|
import { readFile as readFile19, stat as stat6 } from "node:fs/promises";
|
|
53722
|
-
import { homedir as
|
|
53723
|
-
import { join as
|
|
53770
|
+
import { homedir as homedir20 } from "node:os";
|
|
53771
|
+
import { join as join32 } from "node:path";
|
|
53724
53772
|
function getPreferencesPath() {
|
|
53725
|
-
return
|
|
53773
|
+
return join32(homedir20(), ".claude.json");
|
|
53726
53774
|
}
|
|
53727
53775
|
async function readUserPreferences(filePath) {
|
|
53728
53776
|
const path4 = filePath ?? getPreferencesPath();
|
|
@@ -53812,8 +53860,8 @@ var init_claude_data = __esm(() => {
|
|
|
53812
53860
|
// src/domains/web-server/routes/project-routes.ts
|
|
53813
53861
|
import { existsSync as existsSync29 } from "node:fs";
|
|
53814
53862
|
import { readFile as readFile20 } from "node:fs/promises";
|
|
53815
|
-
import { homedir as
|
|
53816
|
-
import { basename as basename13, join as
|
|
53863
|
+
import { homedir as homedir21 } from "node:os";
|
|
53864
|
+
import { basename as basename13, join as join33, resolve as resolve11 } from "node:path";
|
|
53817
53865
|
function registerProjectRoutes(app) {
|
|
53818
53866
|
app.get("/api/projects", async (req, res) => {
|
|
53819
53867
|
try {
|
|
@@ -53832,7 +53880,7 @@ function registerProjectRoutes(app) {
|
|
|
53832
53880
|
for (const discovered of discoveredProjects) {
|
|
53833
53881
|
if (registeredPaths.has(discovered.path))
|
|
53834
53882
|
continue;
|
|
53835
|
-
if (discovered.path ===
|
|
53883
|
+
if (discovered.path === join33(homedir21(), ".claude"))
|
|
53836
53884
|
continue;
|
|
53837
53885
|
const projectInfo = await detectAndBuildProjectInfo(discovered.path, `discovered-${discovered.path}`);
|
|
53838
53886
|
if (projectInfo) {
|
|
@@ -53848,7 +53896,7 @@ function registerProjectRoutes(app) {
|
|
|
53848
53896
|
if (cwdProject) {
|
|
53849
53897
|
projects.push(cwdProject);
|
|
53850
53898
|
}
|
|
53851
|
-
const globalDir =
|
|
53899
|
+
const globalDir = join33(homedir21(), ".claude");
|
|
53852
53900
|
const globalProject = await detectAndBuildProjectInfo(globalDir, "global");
|
|
53853
53901
|
if (globalProject) {
|
|
53854
53902
|
projects.push(globalProject);
|
|
@@ -53920,12 +53968,12 @@ function registerProjectRoutes(app) {
|
|
|
53920
53968
|
const body = validation.data;
|
|
53921
53969
|
let projectPath = body.path;
|
|
53922
53970
|
if (projectPath.startsWith("~/") || projectPath === "~") {
|
|
53923
|
-
projectPath =
|
|
53971
|
+
projectPath = join33(homedir21(), projectPath.slice(1));
|
|
53924
53972
|
} else if (projectPath.startsWith("~\\")) {
|
|
53925
|
-
projectPath =
|
|
53973
|
+
projectPath = join33(homedir21(), projectPath.slice(1));
|
|
53926
53974
|
}
|
|
53927
53975
|
projectPath = resolve11(projectPath);
|
|
53928
|
-
const homeDir =
|
|
53976
|
+
const homeDir = homedir21();
|
|
53929
53977
|
if (projectPath.includes("..") || !projectPath.startsWith(homeDir)) {
|
|
53930
53978
|
res.status(400).json({ error: "Invalid path after expansion" });
|
|
53931
53979
|
return;
|
|
@@ -53982,7 +54030,7 @@ function registerProjectRoutes(app) {
|
|
|
53982
54030
|
if (id === "current") {
|
|
53983
54031
|
projectPath = process.cwd();
|
|
53984
54032
|
} else if (id === "global") {
|
|
53985
|
-
projectPath =
|
|
54033
|
+
projectPath = join33(homedir21(), ".claude");
|
|
53986
54034
|
} else {
|
|
53987
54035
|
res.status(404).json({ error: "Project not found" });
|
|
53988
54036
|
return;
|
|
@@ -54044,8 +54092,8 @@ function registerProjectRoutes(app) {
|
|
|
54044
54092
|
});
|
|
54045
54093
|
}
|
|
54046
54094
|
async function buildProjectInfoFromRegistry(registered) {
|
|
54047
|
-
const claudeDir2 =
|
|
54048
|
-
const metadataPath =
|
|
54095
|
+
const claudeDir2 = join33(registered.path, ".claude");
|
|
54096
|
+
const metadataPath = join33(claudeDir2, "metadata.json");
|
|
54049
54097
|
if (!existsSync29(registered.path)) {
|
|
54050
54098
|
return null;
|
|
54051
54099
|
}
|
|
@@ -54062,7 +54110,7 @@ async function buildProjectInfoFromRegistry(registered) {
|
|
|
54062
54110
|
const hasLocalConfig = hasClaudeDir && CkConfigManager.projectConfigExists(registered.path, false);
|
|
54063
54111
|
const settings = await readSettings();
|
|
54064
54112
|
const skills = await scanSkills();
|
|
54065
|
-
const settingsPath =
|
|
54113
|
+
const settingsPath = join33(homedir21(), ".claude", "settings.json");
|
|
54066
54114
|
const health = existsSync29(settingsPath) ? "healthy" : "warning";
|
|
54067
54115
|
const model = getCurrentModel() || settings?.model || "claude-sonnet-4";
|
|
54068
54116
|
return {
|
|
@@ -54085,8 +54133,8 @@ async function buildProjectInfoFromRegistry(registered) {
|
|
|
54085
54133
|
};
|
|
54086
54134
|
}
|
|
54087
54135
|
async function detectAndBuildProjectInfo(path4, id) {
|
|
54088
|
-
const claudeDir2 = id === "global" ? path4 :
|
|
54089
|
-
const metadataPath =
|
|
54136
|
+
const claudeDir2 = id === "global" ? path4 : join33(path4, ".claude");
|
|
54137
|
+
const metadataPath = join33(claudeDir2, "metadata.json");
|
|
54090
54138
|
if (!existsSync29(metadataPath)) {
|
|
54091
54139
|
if (!existsSync29(claudeDir2)) {
|
|
54092
54140
|
return null;
|
|
@@ -54104,7 +54152,7 @@ async function detectAndBuildProjectInfo(path4, id) {
|
|
|
54104
54152
|
const hasLocalConfig = CkConfigManager.projectConfigExists(path4, id === "global");
|
|
54105
54153
|
const settings = await readSettings();
|
|
54106
54154
|
const skills = await scanSkills();
|
|
54107
|
-
const settingsPath =
|
|
54155
|
+
const settingsPath = join33(homedir21(), ".claude", "settings.json");
|
|
54108
54156
|
const health = existsSync29(settingsPath) ? "healthy" : "warning";
|
|
54109
54157
|
const model = getCurrentModel() || settings?.model || "claude-sonnet-4";
|
|
54110
54158
|
return {
|
|
@@ -54145,32 +54193,32 @@ var init_project_routes = __esm(() => {
|
|
|
54145
54193
|
});
|
|
54146
54194
|
|
|
54147
54195
|
// src/domains/web-server/routes/session-routes.ts
|
|
54148
|
-
import { homedir as
|
|
54149
|
-
import { join as
|
|
54196
|
+
import { homedir as homedir22 } from "node:os";
|
|
54197
|
+
import { join as join34 } from "node:path";
|
|
54150
54198
|
async function resolveSessionDir(projectId) {
|
|
54151
|
-
const home6 =
|
|
54199
|
+
const home6 = homedir22();
|
|
54152
54200
|
if (projectId.startsWith("discovered-")) {
|
|
54153
54201
|
try {
|
|
54154
54202
|
const encodedPathB64 = projectId.slice("discovered-".length);
|
|
54155
54203
|
const projectPath = Buffer.from(encodedPathB64, "base64url").toString("utf-8");
|
|
54156
54204
|
const claudeEncoded = encodePath(projectPath);
|
|
54157
|
-
return
|
|
54205
|
+
return join34(home6, ".claude", "projects", claudeEncoded);
|
|
54158
54206
|
} catch {
|
|
54159
54207
|
return null;
|
|
54160
54208
|
}
|
|
54161
54209
|
}
|
|
54162
54210
|
if (projectId === "current") {
|
|
54163
54211
|
const cwdEncoded = encodePath(process.cwd());
|
|
54164
|
-
return
|
|
54212
|
+
return join34(home6, ".claude", "projects", cwdEncoded);
|
|
54165
54213
|
}
|
|
54166
54214
|
if (projectId === "global") {
|
|
54167
|
-
const globalEncoded = encodePath(
|
|
54168
|
-
return
|
|
54215
|
+
const globalEncoded = encodePath(join34(home6, ".claude"));
|
|
54216
|
+
return join34(home6, ".claude", "projects", globalEncoded);
|
|
54169
54217
|
}
|
|
54170
54218
|
const registered = await ProjectsRegistryManager.getProject(projectId);
|
|
54171
54219
|
if (registered) {
|
|
54172
54220
|
const claudeEncoded = encodePath(registered.path);
|
|
54173
|
-
return
|
|
54221
|
+
return join34(home6, ".claude", "projects", claudeEncoded);
|
|
54174
54222
|
}
|
|
54175
54223
|
return null;
|
|
54176
54224
|
}
|
|
@@ -54187,7 +54235,7 @@ function registerSessionRoutes(app) {
|
|
|
54187
54235
|
res.status(404).json({ error: "Project not found" });
|
|
54188
54236
|
return;
|
|
54189
54237
|
}
|
|
54190
|
-
const allowedBase =
|
|
54238
|
+
const allowedBase = join34(homedir22(), ".claude", "projects");
|
|
54191
54239
|
if (!projectDir.startsWith(allowedBase)) {
|
|
54192
54240
|
res.status(403).json({ error: "Access denied" });
|
|
54193
54241
|
return;
|
|
@@ -54209,7 +54257,7 @@ var init_session_routes = __esm(() => {
|
|
|
54209
54257
|
});
|
|
54210
54258
|
|
|
54211
54259
|
// src/domains/web-server/routes/settings-routes.ts
|
|
54212
|
-
import { homedir as
|
|
54260
|
+
import { homedir as homedir23 } from "node:os";
|
|
54213
54261
|
function registerSettingsRoutes(app) {
|
|
54214
54262
|
app.get("/api/settings", async (_req, res) => {
|
|
54215
54263
|
try {
|
|
@@ -54265,7 +54313,7 @@ function registerSettingsRoutes(app) {
|
|
|
54265
54313
|
res.json({
|
|
54266
54314
|
success: true,
|
|
54267
54315
|
path: "~/.claude/settings.json",
|
|
54268
|
-
backupPath: saveResult.backupPath ? saveResult.backupPath.replace(
|
|
54316
|
+
backupPath: saveResult.backupPath ? saveResult.backupPath.replace(homedir23(), "~") : null,
|
|
54269
54317
|
absolutePath: getSettingsPath()
|
|
54270
54318
|
});
|
|
54271
54319
|
} catch (error) {
|
|
@@ -54299,8 +54347,8 @@ var init_settings_routes = __esm(() => {
|
|
|
54299
54347
|
|
|
54300
54348
|
// src/commands/skills/agents.ts
|
|
54301
54349
|
import { existsSync as existsSync30 } from "node:fs";
|
|
54302
|
-
import { homedir as
|
|
54303
|
-
import { join as
|
|
54350
|
+
import { homedir as homedir24 } from "node:os";
|
|
54351
|
+
import { join as join35 } from "node:path";
|
|
54304
54352
|
async function detectInstalledAgents() {
|
|
54305
54353
|
const installed = [];
|
|
54306
54354
|
for (const [type, config] of Object.entries(agents)) {
|
|
@@ -54316,7 +54364,7 @@ function getAgentConfig(type) {
|
|
|
54316
54364
|
function getInstallPath(skillName, agent, options2) {
|
|
54317
54365
|
const config = agents[agent];
|
|
54318
54366
|
const basePath = options2.global ? config.globalPath : config.projectPath;
|
|
54319
|
-
return
|
|
54367
|
+
return join35(basePath, skillName);
|
|
54320
54368
|
}
|
|
54321
54369
|
function isSkillInstalled(skillName, agent, options2) {
|
|
54322
54370
|
const installPath = getInstallPath(skillName, agent, options2);
|
|
@@ -54324,105 +54372,105 @@ function isSkillInstalled(skillName, agent, options2) {
|
|
|
54324
54372
|
}
|
|
54325
54373
|
var home6, agents;
|
|
54326
54374
|
var init_agents = __esm(() => {
|
|
54327
|
-
home6 =
|
|
54375
|
+
home6 = homedir24();
|
|
54328
54376
|
agents = {
|
|
54329
54377
|
"claude-code": {
|
|
54330
54378
|
name: "claude-code",
|
|
54331
54379
|
displayName: "Claude Code",
|
|
54332
54380
|
projectPath: ".claude/skills",
|
|
54333
|
-
globalPath:
|
|
54334
|
-
detect: async () => existsSync30(
|
|
54381
|
+
globalPath: join35(home6, ".claude/skills"),
|
|
54382
|
+
detect: async () => existsSync30(join35(home6, ".claude"))
|
|
54335
54383
|
},
|
|
54336
54384
|
cursor: {
|
|
54337
54385
|
name: "cursor",
|
|
54338
54386
|
displayName: "Cursor",
|
|
54339
54387
|
projectPath: ".cursor/skills",
|
|
54340
|
-
globalPath:
|
|
54341
|
-
detect: async () => existsSync30(
|
|
54388
|
+
globalPath: join35(home6, ".cursor/skills"),
|
|
54389
|
+
detect: async () => existsSync30(join35(home6, ".cursor"))
|
|
54342
54390
|
},
|
|
54343
54391
|
codex: {
|
|
54344
54392
|
name: "codex",
|
|
54345
54393
|
displayName: "Codex",
|
|
54346
54394
|
projectPath: ".codex/skills",
|
|
54347
|
-
globalPath:
|
|
54348
|
-
detect: async () => existsSync30(
|
|
54395
|
+
globalPath: join35(home6, ".codex/skills"),
|
|
54396
|
+
detect: async () => existsSync30(join35(home6, ".codex"))
|
|
54349
54397
|
},
|
|
54350
54398
|
opencode: {
|
|
54351
54399
|
name: "opencode",
|
|
54352
54400
|
displayName: "OpenCode",
|
|
54353
54401
|
projectPath: ".opencode/skills",
|
|
54354
|
-
globalPath:
|
|
54355
|
-
detect: async () => existsSync30(
|
|
54402
|
+
globalPath: join35(home6, ".config/opencode/skills"),
|
|
54403
|
+
detect: async () => existsSync30(join35(home6, ".config/opencode"))
|
|
54356
54404
|
},
|
|
54357
54405
|
goose: {
|
|
54358
54406
|
name: "goose",
|
|
54359
54407
|
displayName: "Goose",
|
|
54360
54408
|
projectPath: ".goose/skills",
|
|
54361
|
-
globalPath:
|
|
54362
|
-
detect: async () => existsSync30(
|
|
54409
|
+
globalPath: join35(home6, ".config/goose/skills"),
|
|
54410
|
+
detect: async () => existsSync30(join35(home6, ".config/goose"))
|
|
54363
54411
|
},
|
|
54364
54412
|
"gemini-cli": {
|
|
54365
54413
|
name: "gemini-cli",
|
|
54366
54414
|
displayName: "Gemini CLI",
|
|
54367
54415
|
projectPath: ".gemini/skills",
|
|
54368
|
-
globalPath:
|
|
54369
|
-
detect: async () => existsSync30(
|
|
54416
|
+
globalPath: join35(home6, ".gemini/skills"),
|
|
54417
|
+
detect: async () => existsSync30(join35(home6, ".gemini"))
|
|
54370
54418
|
},
|
|
54371
54419
|
antigravity: {
|
|
54372
54420
|
name: "antigravity",
|
|
54373
54421
|
displayName: "Antigravity",
|
|
54374
54422
|
projectPath: ".agent/skills",
|
|
54375
|
-
globalPath:
|
|
54376
|
-
detect: async () => existsSync30(
|
|
54423
|
+
globalPath: join35(home6, ".gemini/antigravity/skills"),
|
|
54424
|
+
detect: async () => existsSync30(join35(process.cwd(), ".agent")) || existsSync30(join35(home6, ".gemini/antigravity"))
|
|
54377
54425
|
},
|
|
54378
54426
|
"github-copilot": {
|
|
54379
54427
|
name: "github-copilot",
|
|
54380
54428
|
displayName: "GitHub Copilot",
|
|
54381
54429
|
projectPath: ".github/skills",
|
|
54382
|
-
globalPath:
|
|
54383
|
-
detect: async () => existsSync30(
|
|
54430
|
+
globalPath: join35(home6, ".copilot/skills"),
|
|
54431
|
+
detect: async () => existsSync30(join35(home6, ".copilot"))
|
|
54384
54432
|
},
|
|
54385
54433
|
amp: {
|
|
54386
54434
|
name: "amp",
|
|
54387
54435
|
displayName: "Amp",
|
|
54388
54436
|
projectPath: ".agents/skills",
|
|
54389
|
-
globalPath:
|
|
54390
|
-
detect: async () => existsSync30(
|
|
54437
|
+
globalPath: join35(home6, ".config/agents/skills"),
|
|
54438
|
+
detect: async () => existsSync30(join35(home6, ".config/amp"))
|
|
54391
54439
|
},
|
|
54392
54440
|
kilo: {
|
|
54393
54441
|
name: "kilo",
|
|
54394
54442
|
displayName: "Kilo Code",
|
|
54395
54443
|
projectPath: ".kilocode/skills",
|
|
54396
|
-
globalPath:
|
|
54397
|
-
detect: async () => existsSync30(
|
|
54444
|
+
globalPath: join35(home6, ".kilocode/skills"),
|
|
54445
|
+
detect: async () => existsSync30(join35(home6, ".kilocode"))
|
|
54398
54446
|
},
|
|
54399
54447
|
roo: {
|
|
54400
54448
|
name: "roo",
|
|
54401
54449
|
displayName: "Roo Code",
|
|
54402
54450
|
projectPath: ".roo/skills",
|
|
54403
|
-
globalPath:
|
|
54404
|
-
detect: async () => existsSync30(
|
|
54451
|
+
globalPath: join35(home6, ".roo/skills"),
|
|
54452
|
+
detect: async () => existsSync30(join35(home6, ".roo"))
|
|
54405
54453
|
},
|
|
54406
54454
|
windsurf: {
|
|
54407
54455
|
name: "windsurf",
|
|
54408
54456
|
displayName: "Windsurf",
|
|
54409
54457
|
projectPath: ".windsurf/skills",
|
|
54410
|
-
globalPath:
|
|
54411
|
-
detect: async () => existsSync30(
|
|
54458
|
+
globalPath: join35(home6, ".codeium/windsurf/skills"),
|
|
54459
|
+
detect: async () => existsSync30(join35(home6, ".codeium/windsurf"))
|
|
54412
54460
|
},
|
|
54413
54461
|
cline: {
|
|
54414
54462
|
name: "cline",
|
|
54415
54463
|
displayName: "Cline",
|
|
54416
54464
|
projectPath: ".cline/skills",
|
|
54417
|
-
globalPath:
|
|
54418
|
-
detect: async () => existsSync30(
|
|
54465
|
+
globalPath: join35(home6, ".cline/skills"),
|
|
54466
|
+
detect: async () => existsSync30(join35(home6, ".cline"))
|
|
54419
54467
|
},
|
|
54420
54468
|
openhands: {
|
|
54421
54469
|
name: "openhands",
|
|
54422
54470
|
displayName: "OpenHands",
|
|
54423
54471
|
projectPath: ".openhands/skills",
|
|
54424
|
-
globalPath:
|
|
54425
|
-
detect: async () => existsSync30(
|
|
54472
|
+
globalPath: join35(home6, ".openhands/skills"),
|
|
54473
|
+
detect: async () => existsSync30(join35(home6, ".openhands"))
|
|
54426
54474
|
}
|
|
54427
54475
|
};
|
|
54428
54476
|
});
|
|
@@ -54430,8 +54478,8 @@ var init_agents = __esm(() => {
|
|
|
54430
54478
|
// src/commands/skills/skills-registry.ts
|
|
54431
54479
|
import { existsSync as existsSync31 } from "node:fs";
|
|
54432
54480
|
import { mkdir as mkdir9, readFile as readFile21, writeFile as writeFile11 } from "node:fs/promises";
|
|
54433
|
-
import { homedir as
|
|
54434
|
-
import { dirname as dirname16, join as
|
|
54481
|
+
import { homedir as homedir25 } from "node:os";
|
|
54482
|
+
import { dirname as dirname16, join as join36 } from "node:path";
|
|
54435
54483
|
function getCliVersion3() {
|
|
54436
54484
|
try {
|
|
54437
54485
|
if (process.env.npm_package_version) {
|
|
@@ -54523,8 +54571,8 @@ async function syncRegistry() {
|
|
|
54523
54571
|
var home7, REGISTRY_PATH2, SkillInstallationSchema, SkillRegistrySchema;
|
|
54524
54572
|
var init_skills_registry = __esm(() => {
|
|
54525
54573
|
init_zod();
|
|
54526
|
-
home7 =
|
|
54527
|
-
REGISTRY_PATH2 =
|
|
54574
|
+
home7 = homedir25();
|
|
54575
|
+
REGISTRY_PATH2 = join36(home7, ".claudekit", "skill-registry.json");
|
|
54528
54576
|
SkillInstallationSchema = exports_external.object({
|
|
54529
54577
|
skill: exports_external.string(),
|
|
54530
54578
|
agent: exports_external.string(),
|
|
@@ -54647,7 +54695,7 @@ var init_skills_installer = __esm(() => {
|
|
|
54647
54695
|
// src/commands/skills/skills-uninstaller.ts
|
|
54648
54696
|
import { existsSync as existsSync33 } from "node:fs";
|
|
54649
54697
|
import { rm as rm7 } from "node:fs/promises";
|
|
54650
|
-
import { join as
|
|
54698
|
+
import { join as join37 } from "node:path";
|
|
54651
54699
|
async function uninstallSkillFromAgent(skill, agent, global3) {
|
|
54652
54700
|
const agentConfig = agents[agent];
|
|
54653
54701
|
const registry = await readRegistry();
|
|
@@ -54695,7 +54743,7 @@ async function uninstallSkillFromAgent(skill, agent, global3) {
|
|
|
54695
54743
|
async function forceUninstallSkill(skill, agent, global3) {
|
|
54696
54744
|
const agentConfig = agents[agent];
|
|
54697
54745
|
const basePath = global3 ? agentConfig.globalPath : agentConfig.projectPath;
|
|
54698
|
-
const path4 =
|
|
54746
|
+
const path4 = join37(basePath, skill);
|
|
54699
54747
|
if (!existsSync33(path4)) {
|
|
54700
54748
|
return {
|
|
54701
54749
|
skill,
|
|
@@ -55239,7 +55287,7 @@ var init_pnpm_detector = __esm(() => {
|
|
|
55239
55287
|
import { existsSync as existsSync34, realpathSync as realpathSync2 } from "node:fs";
|
|
55240
55288
|
import { chmod as chmod2, mkdir as mkdir11, readFile as readFile22, writeFile as writeFile12 } from "node:fs/promises";
|
|
55241
55289
|
import { platform as platform4 } from "node:os";
|
|
55242
|
-
import { join as
|
|
55290
|
+
import { join as join38 } from "node:path";
|
|
55243
55291
|
function detectFromBinaryPath() {
|
|
55244
55292
|
const normalizePath2 = (pathValue) => pathValue.replace(/\\/g, "/").toLowerCase();
|
|
55245
55293
|
const detectFromNormalizedPath = (normalized) => {
|
|
@@ -55316,7 +55364,7 @@ function detectFromEnv() {
|
|
|
55316
55364
|
}
|
|
55317
55365
|
async function readCachedPm() {
|
|
55318
55366
|
try {
|
|
55319
|
-
const cacheFile =
|
|
55367
|
+
const cacheFile = join38(PathResolver.getConfigDir(false), CACHE_FILE);
|
|
55320
55368
|
if (!existsSync34(cacheFile)) {
|
|
55321
55369
|
return null;
|
|
55322
55370
|
}
|
|
@@ -55347,7 +55395,7 @@ async function saveCachedPm(pm, getVersion) {
|
|
|
55347
55395
|
return;
|
|
55348
55396
|
try {
|
|
55349
55397
|
const configDir = PathResolver.getConfigDir(false);
|
|
55350
|
-
const cacheFile =
|
|
55398
|
+
const cacheFile = join38(configDir, CACHE_FILE);
|
|
55351
55399
|
if (!existsSync34(configDir)) {
|
|
55352
55400
|
await mkdir11(configDir, { recursive: true });
|
|
55353
55401
|
if (platform4() !== "win32") {
|
|
@@ -55410,7 +55458,7 @@ async function findOwningPm() {
|
|
|
55410
55458
|
async function clearCache() {
|
|
55411
55459
|
try {
|
|
55412
55460
|
const { unlink: unlink6 } = await import("node:fs/promises");
|
|
55413
|
-
const cacheFile =
|
|
55461
|
+
const cacheFile = join38(PathResolver.getConfigDir(false), CACHE_FILE);
|
|
55414
55462
|
if (existsSync34(cacheFile)) {
|
|
55415
55463
|
await unlink6(cacheFile);
|
|
55416
55464
|
logger.debug("Package manager cache cleared");
|
|
@@ -55567,9 +55615,9 @@ var init_package_manager_detector = __esm(() => {
|
|
|
55567
55615
|
});
|
|
55568
55616
|
|
|
55569
55617
|
// src/domains/migration/metadata-migration.ts
|
|
55570
|
-
import { join as
|
|
55618
|
+
import { join as join39 } from "node:path";
|
|
55571
55619
|
async function detectMetadataFormat(claudeDir2) {
|
|
55572
|
-
const metadataPath =
|
|
55620
|
+
const metadataPath = join39(claudeDir2, "metadata.json");
|
|
55573
55621
|
if (!await import_fs_extra3.pathExists(metadataPath)) {
|
|
55574
55622
|
return { format: "none", metadata: null, detectedKit: null };
|
|
55575
55623
|
}
|
|
@@ -55621,7 +55669,7 @@ async function migrateToMultiKit(claudeDir2) {
|
|
|
55621
55669
|
toFormat: "multi-kit"
|
|
55622
55670
|
};
|
|
55623
55671
|
}
|
|
55624
|
-
const metadataPath =
|
|
55672
|
+
const metadataPath = join39(claudeDir2, "metadata.json");
|
|
55625
55673
|
const legacy = detection.metadata;
|
|
55626
55674
|
if (!legacy) {
|
|
55627
55675
|
return {
|
|
@@ -55733,7 +55781,7 @@ var init_metadata_migration = __esm(() => {
|
|
|
55733
55781
|
});
|
|
55734
55782
|
|
|
55735
55783
|
// src/services/file-operations/claudekit-scanner.ts
|
|
55736
|
-
import { join as
|
|
55784
|
+
import { join as join40 } from "node:path";
|
|
55737
55785
|
async function scanClaudeKitDirectory(directoryPath) {
|
|
55738
55786
|
const counts = {
|
|
55739
55787
|
agents: 0,
|
|
@@ -55747,33 +55795,33 @@ async function scanClaudeKitDirectory(directoryPath) {
|
|
|
55747
55795
|
}
|
|
55748
55796
|
const items = await import_fs_extra4.readdir(directoryPath);
|
|
55749
55797
|
if (items.includes("agents")) {
|
|
55750
|
-
const agentsPath =
|
|
55798
|
+
const agentsPath = join40(directoryPath, "agents");
|
|
55751
55799
|
const agentFiles = await import_fs_extra4.readdir(agentsPath);
|
|
55752
55800
|
counts.agents = agentFiles.filter((file) => file.endsWith(".md")).length;
|
|
55753
55801
|
}
|
|
55754
55802
|
if (items.includes("commands")) {
|
|
55755
|
-
const commandsPath =
|
|
55803
|
+
const commandsPath = join40(directoryPath, "commands");
|
|
55756
55804
|
const commandFiles = await import_fs_extra4.readdir(commandsPath);
|
|
55757
55805
|
counts.commands = commandFiles.filter((file) => file.endsWith(".md")).length;
|
|
55758
55806
|
}
|
|
55759
55807
|
if (items.includes("rules")) {
|
|
55760
|
-
const rulesPath =
|
|
55808
|
+
const rulesPath = join40(directoryPath, "rules");
|
|
55761
55809
|
const ruleFiles = await import_fs_extra4.readdir(rulesPath);
|
|
55762
55810
|
counts.rules = ruleFiles.filter((file) => file.endsWith(".md")).length;
|
|
55763
55811
|
} else if (items.includes("workflows")) {
|
|
55764
|
-
const workflowsPath =
|
|
55812
|
+
const workflowsPath = join40(directoryPath, "workflows");
|
|
55765
55813
|
const workflowFiles = await import_fs_extra4.readdir(workflowsPath);
|
|
55766
55814
|
counts.rules = workflowFiles.filter((file) => file.endsWith(".md")).length;
|
|
55767
55815
|
}
|
|
55768
55816
|
if (items.includes("skills")) {
|
|
55769
|
-
const skillsPath =
|
|
55817
|
+
const skillsPath = join40(directoryPath, "skills");
|
|
55770
55818
|
const skillItems = await import_fs_extra4.readdir(skillsPath);
|
|
55771
55819
|
let skillCount = 0;
|
|
55772
55820
|
for (const item of skillItems) {
|
|
55773
55821
|
if (SKIP_DIRS_CLAUDE_INTERNAL.includes(item)) {
|
|
55774
55822
|
continue;
|
|
55775
55823
|
}
|
|
55776
|
-
const itemPath =
|
|
55824
|
+
const itemPath = join40(skillsPath, item);
|
|
55777
55825
|
const stat8 = await import_fs_extra4.readdir(itemPath).catch(() => null);
|
|
55778
55826
|
if (stat8?.includes("SKILL.md")) {
|
|
55779
55827
|
skillCount++;
|
|
@@ -55815,14 +55863,14 @@ async function getClaudeKitSetup(projectDir = process.cwd()) {
|
|
|
55815
55863
|
const globalDir = getGlobalInstallDir();
|
|
55816
55864
|
if (await import_fs_extra4.pathExists(globalDir)) {
|
|
55817
55865
|
setup.global.path = globalDir;
|
|
55818
|
-
setup.global.metadata = await readClaudeKitMetadata(
|
|
55866
|
+
setup.global.metadata = await readClaudeKitMetadata(join40(globalDir, "metadata.json"));
|
|
55819
55867
|
setup.global.components = await scanClaudeKitDirectory(globalDir);
|
|
55820
55868
|
}
|
|
55821
|
-
const projectClaudeDir =
|
|
55869
|
+
const projectClaudeDir = join40(projectDir, ".claude");
|
|
55822
55870
|
const isLocalSameAsGlobal = projectClaudeDir === globalDir;
|
|
55823
55871
|
if (!isLocalSameAsGlobal && await import_fs_extra4.pathExists(projectClaudeDir)) {
|
|
55824
55872
|
setup.project.path = projectClaudeDir;
|
|
55825
|
-
setup.project.metadata = await readClaudeKitMetadata(
|
|
55873
|
+
setup.project.metadata = await readClaudeKitMetadata(join40(projectClaudeDir, "metadata.json"));
|
|
55826
55874
|
setup.project.components = await scanClaudeKitDirectory(projectClaudeDir);
|
|
55827
55875
|
}
|
|
55828
55876
|
return setup;
|
|
@@ -55961,7 +56009,7 @@ var package_default;
|
|
|
55961
56009
|
var init_package = __esm(() => {
|
|
55962
56010
|
package_default = {
|
|
55963
56011
|
name: "claudekit-cli",
|
|
55964
|
-
version: "3.36.0-dev.
|
|
56012
|
+
version: "3.36.0-dev.15",
|
|
55965
56013
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
55966
56014
|
type: "module",
|
|
55967
56015
|
repository: {
|
|
@@ -56070,7 +56118,7 @@ var init_package = __esm(() => {
|
|
|
56070
56118
|
|
|
56071
56119
|
// src/commands/update-cli.ts
|
|
56072
56120
|
import { exec as exec2 } from "node:child_process";
|
|
56073
|
-
import { join as
|
|
56121
|
+
import { join as join41 } from "node:path";
|
|
56074
56122
|
import { promisify as promisify8 } from "node:util";
|
|
56075
56123
|
function getDefaultUpdateCliCommandDeps() {
|
|
56076
56124
|
return {
|
|
@@ -56149,7 +56197,7 @@ function selectKitForUpdate(params) {
|
|
|
56149
56197
|
};
|
|
56150
56198
|
}
|
|
56151
56199
|
async function readMetadataFile(claudeDir2) {
|
|
56152
|
-
const metadataPath =
|
|
56200
|
+
const metadataPath = join41(claudeDir2, "metadata.json");
|
|
56153
56201
|
try {
|
|
56154
56202
|
if (!await import_fs_extra5.pathExists(metadataPath)) {
|
|
56155
56203
|
return null;
|
|
@@ -56873,7 +56921,7 @@ var init_error_handler2 = __esm(() => {
|
|
|
56873
56921
|
// src/domains/versioning/release-cache.ts
|
|
56874
56922
|
import { existsSync as existsSync35 } from "node:fs";
|
|
56875
56923
|
import { mkdir as mkdir12, readFile as readFile26, unlink as unlink6, writeFile as writeFile14 } from "node:fs/promises";
|
|
56876
|
-
import { join as
|
|
56924
|
+
import { join as join42 } from "node:path";
|
|
56877
56925
|
var ReleaseCacheEntrySchema, ReleaseCache;
|
|
56878
56926
|
var init_release_cache = __esm(() => {
|
|
56879
56927
|
init_logger();
|
|
@@ -56888,7 +56936,7 @@ var init_release_cache = __esm(() => {
|
|
|
56888
56936
|
static CACHE_TTL_SECONDS = Number(process.env.CK_CACHE_TTL) || 3600;
|
|
56889
56937
|
cacheDir;
|
|
56890
56938
|
constructor() {
|
|
56891
|
-
this.cacheDir =
|
|
56939
|
+
this.cacheDir = join42(PathResolver.getCacheDir(false), ReleaseCache.CACHE_DIR);
|
|
56892
56940
|
}
|
|
56893
56941
|
async get(key) {
|
|
56894
56942
|
const cacheFile = this.getCachePath(key);
|
|
@@ -56946,7 +56994,7 @@ var init_release_cache = __esm(() => {
|
|
|
56946
56994
|
const files = await readdir10(this.cacheDir);
|
|
56947
56995
|
for (const file of files) {
|
|
56948
56996
|
if (file.endsWith(".json")) {
|
|
56949
|
-
await unlink6(
|
|
56997
|
+
await unlink6(join42(this.cacheDir, file));
|
|
56950
56998
|
}
|
|
56951
56999
|
}
|
|
56952
57000
|
logger.debug("All release cache cleared");
|
|
@@ -56957,7 +57005,7 @@ var init_release_cache = __esm(() => {
|
|
|
56957
57005
|
}
|
|
56958
57006
|
getCachePath(key) {
|
|
56959
57007
|
const safeKey = key.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
56960
|
-
return
|
|
57008
|
+
return join42(this.cacheDir, `${safeKey}.json`);
|
|
56961
57009
|
}
|
|
56962
57010
|
isExpired(timestamp) {
|
|
56963
57011
|
const now = Date.now();
|
|
@@ -57635,7 +57683,7 @@ var init_version_utils = __esm(() => {
|
|
|
57635
57683
|
// src/domains/versioning/version-cache.ts
|
|
57636
57684
|
import { existsSync as existsSync36 } from "node:fs";
|
|
57637
57685
|
import { mkdir as mkdir13, readFile as readFile27, writeFile as writeFile15 } from "node:fs/promises";
|
|
57638
|
-
import { join as
|
|
57686
|
+
import { join as join43 } from "node:path";
|
|
57639
57687
|
var VersionCacheManager;
|
|
57640
57688
|
var init_version_cache = __esm(() => {
|
|
57641
57689
|
init_logger();
|
|
@@ -57645,7 +57693,7 @@ var init_version_cache = __esm(() => {
|
|
|
57645
57693
|
static CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
57646
57694
|
static getCacheFile() {
|
|
57647
57695
|
const cacheDir = PathResolver.getCacheDir(false);
|
|
57648
|
-
return
|
|
57696
|
+
return join43(cacheDir, VersionCacheManager.CACHE_FILENAME);
|
|
57649
57697
|
}
|
|
57650
57698
|
static async load() {
|
|
57651
57699
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
@@ -57914,7 +57962,7 @@ var init_version_checker = __esm(() => {
|
|
|
57914
57962
|
import { spawn as spawn2 } from "node:child_process";
|
|
57915
57963
|
import { existsSync as existsSync37 } from "node:fs";
|
|
57916
57964
|
import { readFile as readFile28 } from "node:fs/promises";
|
|
57917
|
-
import { join as
|
|
57965
|
+
import { join as join44 } from "node:path";
|
|
57918
57966
|
function hasCliUpdate(currentVersion, latestVersion) {
|
|
57919
57967
|
if (!latestVersion) {
|
|
57920
57968
|
return false;
|
|
@@ -58157,7 +58205,7 @@ async function getPackageJson() {
|
|
|
58157
58205
|
}
|
|
58158
58206
|
async function getKitMetadata2(kitName) {
|
|
58159
58207
|
try {
|
|
58160
|
-
const metadataPath =
|
|
58208
|
+
const metadataPath = join44(PathResolver.getGlobalKitDir(), "metadata.json");
|
|
58161
58209
|
if (!existsSync37(metadataPath))
|
|
58162
58210
|
return null;
|
|
58163
58211
|
const content = await readFile28(metadataPath, "utf-8");
|
|
@@ -58302,7 +58350,7 @@ var init_routes = __esm(() => {
|
|
|
58302
58350
|
|
|
58303
58351
|
// src/domains/web-server/static-server.ts
|
|
58304
58352
|
import { existsSync as existsSync38 } from "node:fs";
|
|
58305
|
-
import { dirname as dirname18, extname as extname4, join as
|
|
58353
|
+
import { dirname as dirname18, extname as extname4, join as join45 } from "node:path";
|
|
58306
58354
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
58307
58355
|
function tryServeFromEmbedded(app) {
|
|
58308
58356
|
if (typeof globalThis.Bun === "undefined" || !globalThis.Bun.embeddedFiles?.length) {
|
|
@@ -58363,12 +58411,12 @@ function tryServeFromEmbedded(app) {
|
|
|
58363
58411
|
}
|
|
58364
58412
|
function resolveUiDistPath() {
|
|
58365
58413
|
const candidates = [
|
|
58366
|
-
|
|
58367
|
-
|
|
58368
|
-
|
|
58414
|
+
join45(__dirname3, "ui"),
|
|
58415
|
+
join45(process.cwd(), "dist", "ui"),
|
|
58416
|
+
join45(process.cwd(), "src", "ui", "dist")
|
|
58369
58417
|
];
|
|
58370
58418
|
for (const path4 of candidates) {
|
|
58371
|
-
if (existsSync38(
|
|
58419
|
+
if (existsSync38(join45(path4, "index.html"))) {
|
|
58372
58420
|
return path4;
|
|
58373
58421
|
}
|
|
58374
58422
|
}
|
|
@@ -58411,7 +58459,7 @@ function serveStatic(app) {
|
|
|
58411
58459
|
if (req.path.startsWith("/assets/") || req.path.match(/\.(js|css|ico|png|jpg|svg|woff2?)$/)) {
|
|
58412
58460
|
return next();
|
|
58413
58461
|
}
|
|
58414
|
-
res.sendFile(
|
|
58462
|
+
res.sendFile(join45(uiDistPath, "index.html"), { dotfiles: "allow" });
|
|
58415
58463
|
});
|
|
58416
58464
|
logger.debug(`Serving static files from ${uiDistPath}`);
|
|
58417
58465
|
}
|
|
@@ -63411,7 +63459,7 @@ var init_gemini_installer = __esm(() => {
|
|
|
63411
63459
|
});
|
|
63412
63460
|
|
|
63413
63461
|
// src/services/package-installer/opencode-installer.ts
|
|
63414
|
-
import { join as
|
|
63462
|
+
import { join as join63 } from "node:path";
|
|
63415
63463
|
async function isOpenCodeInstalled() {
|
|
63416
63464
|
try {
|
|
63417
63465
|
await execAsync7("opencode --version", { timeout: 5000 });
|
|
@@ -63434,7 +63482,7 @@ async function installOpenCode() {
|
|
|
63434
63482
|
logger.info(`Installing ${displayName}...`);
|
|
63435
63483
|
const { unlink: unlink11 } = await import("node:fs/promises");
|
|
63436
63484
|
const { tmpdir: tmpdir4 } = await import("node:os");
|
|
63437
|
-
const tempScriptPath =
|
|
63485
|
+
const tempScriptPath = join63(tmpdir4(), "opencode-install.sh");
|
|
63438
63486
|
try {
|
|
63439
63487
|
logger.info("Downloading OpenCode installation script...");
|
|
63440
63488
|
await execFileAsync5("curl", ["-fsSL", "https://opencode.ai/install", "-o", tempScriptPath], {
|
|
@@ -63486,7 +63534,7 @@ var PARTIAL_INSTALL_VERSION = "partial", EXIT_CODE_CRITICAL_FAILURE = 1, EXIT_CO
|
|
|
63486
63534
|
|
|
63487
63535
|
// src/services/package-installer/install-error-handler.ts
|
|
63488
63536
|
import { existsSync as existsSync49, readFileSync as readFileSync12, unlinkSync as unlinkSync2 } from "node:fs";
|
|
63489
|
-
import { join as
|
|
63537
|
+
import { join as join64 } from "node:path";
|
|
63490
63538
|
function parseNameReason(str2) {
|
|
63491
63539
|
const colonIndex = str2.indexOf(":");
|
|
63492
63540
|
if (colonIndex === -1) {
|
|
@@ -63495,7 +63543,7 @@ function parseNameReason(str2) {
|
|
|
63495
63543
|
return [str2.slice(0, colonIndex).trim(), str2.slice(colonIndex + 1).trim()];
|
|
63496
63544
|
}
|
|
63497
63545
|
function displayInstallErrors(skillsDir2) {
|
|
63498
|
-
const summaryPath =
|
|
63546
|
+
const summaryPath = join64(skillsDir2, ".install-error-summary.json");
|
|
63499
63547
|
if (!existsSync49(summaryPath)) {
|
|
63500
63548
|
logger.error("Skills installation failed. Run with --verbose for details.");
|
|
63501
63549
|
return;
|
|
@@ -63586,7 +63634,7 @@ async function checkNeedsSudoPackages() {
|
|
|
63586
63634
|
}
|
|
63587
63635
|
}
|
|
63588
63636
|
function hasInstallState(skillsDir2) {
|
|
63589
|
-
const stateFilePath =
|
|
63637
|
+
const stateFilePath = join64(skillsDir2, ".install-state.json");
|
|
63590
63638
|
return existsSync49(stateFilePath);
|
|
63591
63639
|
}
|
|
63592
63640
|
var WHICH_COMMAND_TIMEOUT_MS = 5000;
|
|
@@ -63595,7 +63643,7 @@ var init_install_error_handler = __esm(() => {
|
|
|
63595
63643
|
});
|
|
63596
63644
|
|
|
63597
63645
|
// src/services/package-installer/skills-installer.ts
|
|
63598
|
-
import { join as
|
|
63646
|
+
import { join as join65 } from "node:path";
|
|
63599
63647
|
async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
63600
63648
|
const { skipConfirm = false, withSudo = false } = options2;
|
|
63601
63649
|
const displayName = "Skills Dependencies";
|
|
@@ -63621,7 +63669,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
63621
63669
|
const clack = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
63622
63670
|
const platform7 = process.platform;
|
|
63623
63671
|
const scriptName = platform7 === "win32" ? "install.ps1" : "install.sh";
|
|
63624
|
-
const scriptPath =
|
|
63672
|
+
const scriptPath = join65(skillsDir2, scriptName);
|
|
63625
63673
|
try {
|
|
63626
63674
|
validateScriptPath(skillsDir2, scriptPath);
|
|
63627
63675
|
} catch (error) {
|
|
@@ -63637,7 +63685,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
63637
63685
|
logger.warning(`Skills installation script not found: ${scriptPath}`);
|
|
63638
63686
|
logger.info("");
|
|
63639
63687
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
63640
|
-
logger.info(` See: ${
|
|
63688
|
+
logger.info(` See: ${join65(skillsDir2, "INSTALLATION.md")}`);
|
|
63641
63689
|
logger.info("");
|
|
63642
63690
|
logger.info("Quick start:");
|
|
63643
63691
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -63684,7 +63732,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
63684
63732
|
logger.info(` ${platform7 === "win32" ? `powershell -File "${scriptPath}"` : `bash ${scriptPath}`}`);
|
|
63685
63733
|
logger.info("");
|
|
63686
63734
|
logger.info("Or see complete guide:");
|
|
63687
|
-
logger.info(` ${
|
|
63735
|
+
logger.info(` ${join65(skillsDir2, "INSTALLATION.md")}`);
|
|
63688
63736
|
return {
|
|
63689
63737
|
success: false,
|
|
63690
63738
|
package: displayName,
|
|
@@ -63805,7 +63853,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
63805
63853
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
63806
63854
|
logger.info("");
|
|
63807
63855
|
logger.info("See complete guide:");
|
|
63808
|
-
logger.info(` cat ${
|
|
63856
|
+
logger.info(` cat ${join65(skillsDir2, "INSTALLATION.md")}`);
|
|
63809
63857
|
logger.info("");
|
|
63810
63858
|
logger.info("Quick start:");
|
|
63811
63859
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -63851,7 +63899,7 @@ var init_skills_installer2 = __esm(() => {
|
|
|
63851
63899
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
63852
63900
|
import { existsSync as existsSync50 } from "node:fs";
|
|
63853
63901
|
import { mkdir as mkdir17, readFile as readFile35, writeFile as writeFile20 } from "node:fs/promises";
|
|
63854
|
-
import { dirname as dirname21, join as
|
|
63902
|
+
import { dirname as dirname21, join as join66 } from "node:path";
|
|
63855
63903
|
async function readJsonFile(filePath) {
|
|
63856
63904
|
try {
|
|
63857
63905
|
const content = await readFile35(filePath, "utf-8");
|
|
@@ -63863,7 +63911,7 @@ async function readJsonFile(filePath) {
|
|
|
63863
63911
|
}
|
|
63864
63912
|
}
|
|
63865
63913
|
async function addGeminiToGitignore(projectDir) {
|
|
63866
|
-
const gitignorePath =
|
|
63914
|
+
const gitignorePath = join66(projectDir, ".gitignore");
|
|
63867
63915
|
const geminiPattern = ".gemini/";
|
|
63868
63916
|
try {
|
|
63869
63917
|
let content = "";
|
|
@@ -63954,13 +64002,13 @@ var init_config_manager2 = __esm(() => {
|
|
|
63954
64002
|
|
|
63955
64003
|
// src/services/package-installer/gemini-mcp/validation.ts
|
|
63956
64004
|
import { existsSync as existsSync51, lstatSync, readlinkSync } from "node:fs";
|
|
63957
|
-
import { homedir as
|
|
63958
|
-
import { join as
|
|
64005
|
+
import { homedir as homedir28 } from "node:os";
|
|
64006
|
+
import { join as join67 } from "node:path";
|
|
63959
64007
|
function getGlobalMcpConfigPath() {
|
|
63960
|
-
return
|
|
64008
|
+
return join67(homedir28(), ".claude", ".mcp.json");
|
|
63961
64009
|
}
|
|
63962
64010
|
function getLocalMcpConfigPath(projectDir) {
|
|
63963
|
-
return
|
|
64011
|
+
return join67(projectDir, ".mcp.json");
|
|
63964
64012
|
}
|
|
63965
64013
|
function findMcpConfigPath(projectDir) {
|
|
63966
64014
|
const localPath = getLocalMcpConfigPath(projectDir);
|
|
@@ -63978,9 +64026,9 @@ function findMcpConfigPath(projectDir) {
|
|
|
63978
64026
|
}
|
|
63979
64027
|
function getGeminiSettingsPath(projectDir, isGlobal) {
|
|
63980
64028
|
if (isGlobal) {
|
|
63981
|
-
return
|
|
64029
|
+
return join67(homedir28(), ".gemini", "settings.json");
|
|
63982
64030
|
}
|
|
63983
|
-
return
|
|
64031
|
+
return join67(projectDir, ".gemini", "settings.json");
|
|
63984
64032
|
}
|
|
63985
64033
|
function checkExistingGeminiConfig(projectDir, isGlobal = false) {
|
|
63986
64034
|
const geminiSettingsPath = getGeminiSettingsPath(projectDir, isGlobal);
|
|
@@ -64010,7 +64058,7 @@ var init_validation = __esm(() => {
|
|
|
64010
64058
|
// src/services/package-installer/gemini-mcp/linker-core.ts
|
|
64011
64059
|
import { existsSync as existsSync52 } from "node:fs";
|
|
64012
64060
|
import { mkdir as mkdir18, symlink as symlink2 } from "node:fs/promises";
|
|
64013
|
-
import { dirname as dirname22, join as
|
|
64061
|
+
import { dirname as dirname22, join as join68 } from "node:path";
|
|
64014
64062
|
async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
64015
64063
|
const linkDir = dirname22(linkPath);
|
|
64016
64064
|
if (!existsSync52(linkDir)) {
|
|
@@ -64021,7 +64069,7 @@ async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
|
64021
64069
|
if (isGlobal) {
|
|
64022
64070
|
symlinkTarget = getGlobalMcpConfigPath();
|
|
64023
64071
|
} else {
|
|
64024
|
-
const localMcpPath =
|
|
64072
|
+
const localMcpPath = join68(projectDir, ".mcp.json");
|
|
64025
64073
|
const isLocalConfig = targetPath === localMcpPath;
|
|
64026
64074
|
symlinkTarget = isLocalConfig ? "../.mcp.json" : targetPath;
|
|
64027
64075
|
}
|
|
@@ -70922,14 +70970,14 @@ async function checkCliInstallMethod() {
|
|
|
70922
70970
|
}
|
|
70923
70971
|
// src/domains/health-checks/checkers/claude-md-checker.ts
|
|
70924
70972
|
import { existsSync as existsSync40, statSync as statSync5 } from "node:fs";
|
|
70925
|
-
import { join as
|
|
70973
|
+
import { join as join46 } from "node:path";
|
|
70926
70974
|
function checkClaudeMd(setup, projectDir) {
|
|
70927
70975
|
const results = [];
|
|
70928
70976
|
if (setup.global.path) {
|
|
70929
|
-
const globalClaudeMd =
|
|
70977
|
+
const globalClaudeMd = join46(setup.global.path, "CLAUDE.md");
|
|
70930
70978
|
results.push(checkClaudeMdFile(globalClaudeMd, "Global CLAUDE.md", "ck-global-claude-md"));
|
|
70931
70979
|
}
|
|
70932
|
-
const projectClaudeMd =
|
|
70980
|
+
const projectClaudeMd = join46(projectDir, ".claude", "CLAUDE.md");
|
|
70933
70981
|
results.push(checkClaudeMdFile(projectClaudeMd, "Project CLAUDE.md", "ck-project-claude-md"));
|
|
70934
70982
|
return results;
|
|
70935
70983
|
}
|
|
@@ -70988,9 +71036,9 @@ function checkClaudeMdFile(path4, name, id) {
|
|
|
70988
71036
|
}
|
|
70989
71037
|
// src/domains/health-checks/checkers/active-plan-checker.ts
|
|
70990
71038
|
import { existsSync as existsSync41, readFileSync as readFileSync9 } from "node:fs";
|
|
70991
|
-
import { join as
|
|
71039
|
+
import { join as join47 } from "node:path";
|
|
70992
71040
|
function checkActivePlan(projectDir) {
|
|
70993
|
-
const activePlanPath =
|
|
71041
|
+
const activePlanPath = join47(projectDir, ".claude", "active-plan");
|
|
70994
71042
|
if (!existsSync41(activePlanPath)) {
|
|
70995
71043
|
return {
|
|
70996
71044
|
id: "ck-active-plan",
|
|
@@ -71004,7 +71052,7 @@ function checkActivePlan(projectDir) {
|
|
|
71004
71052
|
}
|
|
71005
71053
|
try {
|
|
71006
71054
|
const targetPath = readFileSync9(activePlanPath, "utf-8").trim();
|
|
71007
|
-
const fullPath =
|
|
71055
|
+
const fullPath = join47(projectDir, targetPath);
|
|
71008
71056
|
if (!existsSync41(fullPath)) {
|
|
71009
71057
|
return {
|
|
71010
71058
|
id: "ck-active-plan",
|
|
@@ -71042,13 +71090,13 @@ function checkActivePlan(projectDir) {
|
|
|
71042
71090
|
}
|
|
71043
71091
|
// src/domains/health-checks/checkers/skills-checker.ts
|
|
71044
71092
|
import { existsSync as existsSync42 } from "node:fs";
|
|
71045
|
-
import { join as
|
|
71093
|
+
import { join as join48 } from "node:path";
|
|
71046
71094
|
function checkSkillsScripts(setup) {
|
|
71047
71095
|
const results = [];
|
|
71048
71096
|
const platform5 = process.platform;
|
|
71049
71097
|
const scriptName = platform5 === "win32" ? "install.ps1" : "install.sh";
|
|
71050
71098
|
if (setup.global.path) {
|
|
71051
|
-
const globalScriptPath =
|
|
71099
|
+
const globalScriptPath = join48(setup.global.path, "skills", scriptName);
|
|
71052
71100
|
const hasGlobalScript = existsSync42(globalScriptPath);
|
|
71053
71101
|
results.push({
|
|
71054
71102
|
id: "ck-global-skills-script",
|
|
@@ -71063,7 +71111,7 @@ function checkSkillsScripts(setup) {
|
|
|
71063
71111
|
});
|
|
71064
71112
|
}
|
|
71065
71113
|
if (setup.project.metadata) {
|
|
71066
|
-
const projectScriptPath =
|
|
71114
|
+
const projectScriptPath = join48(setup.project.path, "skills", scriptName);
|
|
71067
71115
|
const hasProjectScript = existsSync42(projectScriptPath);
|
|
71068
71116
|
results.push({
|
|
71069
71117
|
id: "ck-project-skills-script",
|
|
@@ -71102,7 +71150,7 @@ function checkComponentCounts(setup) {
|
|
|
71102
71150
|
init_logger();
|
|
71103
71151
|
init_path_resolver();
|
|
71104
71152
|
import { constants as constants2, access as access2, unlink as unlink7, writeFile as writeFile16 } from "node:fs/promises";
|
|
71105
|
-
import { join as
|
|
71153
|
+
import { join as join49 } from "node:path";
|
|
71106
71154
|
|
|
71107
71155
|
// src/domains/health-checks/checkers/shared.ts
|
|
71108
71156
|
init_environment();
|
|
@@ -71168,7 +71216,7 @@ async function checkGlobalDirWritable() {
|
|
|
71168
71216
|
}
|
|
71169
71217
|
const timestamp = Date.now();
|
|
71170
71218
|
const random = Math.random().toString(36).substring(2);
|
|
71171
|
-
const testFile =
|
|
71219
|
+
const testFile = join49(globalDir, `.ck-write-test-${timestamp}-${random}`);
|
|
71172
71220
|
try {
|
|
71173
71221
|
await writeFile16(testFile, "test", { encoding: "utf-8", flag: "wx" });
|
|
71174
71222
|
} catch (error) {
|
|
@@ -71204,7 +71252,7 @@ async function checkGlobalDirWritable() {
|
|
|
71204
71252
|
init_path_resolver();
|
|
71205
71253
|
import { existsSync as existsSync43 } from "node:fs";
|
|
71206
71254
|
import { readdir as readdir10 } from "node:fs/promises";
|
|
71207
|
-
import { join as
|
|
71255
|
+
import { join as join50 } from "node:path";
|
|
71208
71256
|
|
|
71209
71257
|
// src/domains/health-checks/utils/path-normalizer.ts
|
|
71210
71258
|
import { normalize as normalize4 } from "node:path";
|
|
@@ -71216,8 +71264,8 @@ function normalizePath2(filePath) {
|
|
|
71216
71264
|
|
|
71217
71265
|
// src/domains/health-checks/checkers/hooks-checker.ts
|
|
71218
71266
|
async function checkHooksExist(projectDir) {
|
|
71219
|
-
const globalHooksDir =
|
|
71220
|
-
const projectHooksDir =
|
|
71267
|
+
const globalHooksDir = join50(PathResolver.getGlobalKitDir(), "hooks");
|
|
71268
|
+
const projectHooksDir = join50(projectDir, ".claude", "hooks");
|
|
71221
71269
|
const globalExists = existsSync43(globalHooksDir);
|
|
71222
71270
|
const projectExists = existsSync43(projectHooksDir);
|
|
71223
71271
|
let hookCount = 0;
|
|
@@ -71226,7 +71274,7 @@ async function checkHooksExist(projectDir) {
|
|
|
71226
71274
|
const files = await readdir10(globalHooksDir, { withFileTypes: false });
|
|
71227
71275
|
const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((ext) => f3.endsWith(ext)));
|
|
71228
71276
|
hooks.forEach((hook) => {
|
|
71229
|
-
const fullPath =
|
|
71277
|
+
const fullPath = join50(globalHooksDir, hook);
|
|
71230
71278
|
checkedFiles.add(normalizePath2(fullPath));
|
|
71231
71279
|
});
|
|
71232
71280
|
}
|
|
@@ -71236,7 +71284,7 @@ async function checkHooksExist(projectDir) {
|
|
|
71236
71284
|
const files = await readdir10(projectHooksDir, { withFileTypes: false });
|
|
71237
71285
|
const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((ext) => f3.endsWith(ext)));
|
|
71238
71286
|
hooks.forEach((hook) => {
|
|
71239
|
-
const fullPath =
|
|
71287
|
+
const fullPath = join50(projectHooksDir, hook);
|
|
71240
71288
|
checkedFiles.add(normalizePath2(fullPath));
|
|
71241
71289
|
});
|
|
71242
71290
|
}
|
|
@@ -71268,10 +71316,10 @@ init_logger();
|
|
|
71268
71316
|
init_path_resolver();
|
|
71269
71317
|
import { existsSync as existsSync44 } from "node:fs";
|
|
71270
71318
|
import { readFile as readFile29 } from "node:fs/promises";
|
|
71271
|
-
import { join as
|
|
71319
|
+
import { join as join51 } from "node:path";
|
|
71272
71320
|
async function checkSettingsValid(projectDir) {
|
|
71273
|
-
const globalSettings =
|
|
71274
|
-
const projectSettings =
|
|
71321
|
+
const globalSettings = join51(PathResolver.getGlobalKitDir(), "settings.json");
|
|
71322
|
+
const projectSettings = join51(projectDir, ".claude", "settings.json");
|
|
71275
71323
|
const settingsPath = existsSync44(globalSettings) ? globalSettings : existsSync44(projectSettings) ? projectSettings : null;
|
|
71276
71324
|
if (!settingsPath) {
|
|
71277
71325
|
return {
|
|
@@ -71343,11 +71391,11 @@ init_logger();
|
|
|
71343
71391
|
init_path_resolver();
|
|
71344
71392
|
import { existsSync as existsSync45 } from "node:fs";
|
|
71345
71393
|
import { readFile as readFile30 } from "node:fs/promises";
|
|
71346
|
-
import { homedir as
|
|
71347
|
-
import { dirname as dirname19, join as
|
|
71394
|
+
import { homedir as homedir26 } from "node:os";
|
|
71395
|
+
import { dirname as dirname19, join as join52, normalize as normalize5, resolve as resolve13 } from "node:path";
|
|
71348
71396
|
async function checkPathRefsValid(projectDir) {
|
|
71349
|
-
const globalClaudeMd =
|
|
71350
|
-
const projectClaudeMd =
|
|
71397
|
+
const globalClaudeMd = join52(PathResolver.getGlobalKitDir(), "CLAUDE.md");
|
|
71398
|
+
const projectClaudeMd = join52(projectDir, ".claude", "CLAUDE.md");
|
|
71351
71399
|
const claudeMdPath = existsSync45(globalClaudeMd) ? globalClaudeMd : existsSync45(projectClaudeMd) ? projectClaudeMd : null;
|
|
71352
71400
|
if (!claudeMdPath) {
|
|
71353
71401
|
return {
|
|
@@ -71376,7 +71424,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
71376
71424
|
};
|
|
71377
71425
|
}
|
|
71378
71426
|
const baseDir = dirname19(claudeMdPath);
|
|
71379
|
-
const home8 =
|
|
71427
|
+
const home8 = homedir26();
|
|
71380
71428
|
const broken = [];
|
|
71381
71429
|
for (const ref of refs) {
|
|
71382
71430
|
let refPath;
|
|
@@ -71442,7 +71490,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
71442
71490
|
// src/domains/health-checks/checkers/config-completeness-checker.ts
|
|
71443
71491
|
import { existsSync as existsSync46 } from "node:fs";
|
|
71444
71492
|
import { readdir as readdir11 } from "node:fs/promises";
|
|
71445
|
-
import { join as
|
|
71493
|
+
import { join as join53 } from "node:path";
|
|
71446
71494
|
async function checkProjectConfigCompleteness(setup, projectDir) {
|
|
71447
71495
|
if (setup.project.path === setup.global.path) {
|
|
71448
71496
|
return {
|
|
@@ -71455,16 +71503,16 @@ async function checkProjectConfigCompleteness(setup, projectDir) {
|
|
|
71455
71503
|
autoFixable: false
|
|
71456
71504
|
};
|
|
71457
71505
|
}
|
|
71458
|
-
const projectClaudeDir =
|
|
71506
|
+
const projectClaudeDir = join53(projectDir, ".claude");
|
|
71459
71507
|
const requiredDirs = ["agents", "commands", "skills"];
|
|
71460
71508
|
const missingDirs = [];
|
|
71461
71509
|
for (const dir of requiredDirs) {
|
|
71462
|
-
const dirPath =
|
|
71510
|
+
const dirPath = join53(projectClaudeDir, dir);
|
|
71463
71511
|
if (!existsSync46(dirPath)) {
|
|
71464
71512
|
missingDirs.push(dir);
|
|
71465
71513
|
}
|
|
71466
71514
|
}
|
|
71467
|
-
const hasRulesOrWorkflows = existsSync46(
|
|
71515
|
+
const hasRulesOrWorkflows = existsSync46(join53(projectClaudeDir, "rules")) || existsSync46(join53(projectClaudeDir, "workflows"));
|
|
71468
71516
|
if (!hasRulesOrWorkflows) {
|
|
71469
71517
|
missingDirs.push("rules");
|
|
71470
71518
|
}
|
|
@@ -71509,7 +71557,7 @@ async function checkProjectConfigCompleteness(setup, projectDir) {
|
|
|
71509
71557
|
};
|
|
71510
71558
|
}
|
|
71511
71559
|
// src/domains/health-checks/checkers/env-keys-checker.ts
|
|
71512
|
-
import { join as
|
|
71560
|
+
import { join as join55 } from "node:path";
|
|
71513
71561
|
|
|
71514
71562
|
// src/domains/installation/setup-wizard.ts
|
|
71515
71563
|
init_config_generator();
|
|
@@ -71518,7 +71566,7 @@ init_logger();
|
|
|
71518
71566
|
init_path_resolver();
|
|
71519
71567
|
init_dist2();
|
|
71520
71568
|
var import_fs_extra6 = __toESM(require_lib3(), 1);
|
|
71521
|
-
import { join as
|
|
71569
|
+
import { join as join54 } from "node:path";
|
|
71522
71570
|
var REQUIRED_ENV_KEYS = [
|
|
71523
71571
|
{ key: "GEMINI_API_KEY", label: "Gemini API Key" }
|
|
71524
71572
|
];
|
|
@@ -71595,7 +71643,7 @@ async function parseEnvFile(path4) {
|
|
|
71595
71643
|
}
|
|
71596
71644
|
}
|
|
71597
71645
|
async function checkGlobalConfig() {
|
|
71598
|
-
const globalEnvPath =
|
|
71646
|
+
const globalEnvPath = join54(PathResolver.getGlobalKitDir(), ".env");
|
|
71599
71647
|
if (!await import_fs_extra6.pathExists(globalEnvPath))
|
|
71600
71648
|
return false;
|
|
71601
71649
|
const env2 = await parseEnvFile(globalEnvPath);
|
|
@@ -71611,7 +71659,7 @@ async function runSetupWizard(options2) {
|
|
|
71611
71659
|
let globalEnv = {};
|
|
71612
71660
|
const hasGlobalConfig = !isGlobal && await checkGlobalConfig();
|
|
71613
71661
|
if (!isGlobal) {
|
|
71614
|
-
const globalEnvPath =
|
|
71662
|
+
const globalEnvPath = join54(PathResolver.getGlobalKitDir(), ".env");
|
|
71615
71663
|
if (await import_fs_extra6.pathExists(globalEnvPath)) {
|
|
71616
71664
|
globalEnv = await parseEnvFile(globalEnvPath);
|
|
71617
71665
|
}
|
|
@@ -71674,7 +71722,7 @@ async function runSetupWizard(options2) {
|
|
|
71674
71722
|
}
|
|
71675
71723
|
}
|
|
71676
71724
|
await generateEnvFile(targetDir, values);
|
|
71677
|
-
f2.success(`Configuration saved to ${
|
|
71725
|
+
f2.success(`Configuration saved to ${join54(targetDir, ".env")}`);
|
|
71678
71726
|
return true;
|
|
71679
71727
|
}
|
|
71680
71728
|
async function promptForAdditionalGeminiKeys(primaryKey) {
|
|
@@ -71749,7 +71797,7 @@ Optional: DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN`, "Configuration skipped");
|
|
|
71749
71797
|
async function checkEnvKeys(setup) {
|
|
71750
71798
|
const results = [];
|
|
71751
71799
|
if (setup.global.path) {
|
|
71752
|
-
const globalEnvPath =
|
|
71800
|
+
const globalEnvPath = join55(setup.global.path, ".env");
|
|
71753
71801
|
const globalCheck = await checkRequiredKeysExist(globalEnvPath);
|
|
71754
71802
|
if (!globalCheck.allPresent) {
|
|
71755
71803
|
const missingKeys = globalCheck.missing.map((m2) => m2.label).join(", ");
|
|
@@ -71778,7 +71826,7 @@ async function checkEnvKeys(setup) {
|
|
|
71778
71826
|
}
|
|
71779
71827
|
}
|
|
71780
71828
|
if (setup.project.metadata) {
|
|
71781
|
-
const projectEnvPath =
|
|
71829
|
+
const projectEnvPath = join55(setup.project.path, ".env");
|
|
71782
71830
|
const projectCheck = await checkRequiredKeysExist(projectEnvPath);
|
|
71783
71831
|
if (!projectCheck.allPresent) {
|
|
71784
71832
|
const missingKeys = projectCheck.missing.map((m2) => m2.label).join(", ");
|
|
@@ -71816,7 +71864,7 @@ import { spawnSync as spawnSync2 } from "node:child_process";
|
|
|
71816
71864
|
import { existsSync as existsSync47, readFileSync as readFileSync10, statSync as statSync6, writeFileSync as writeFileSync3 } from "node:fs";
|
|
71817
71865
|
import { readdir as readdir12 } from "node:fs/promises";
|
|
71818
71866
|
import { tmpdir } from "node:os";
|
|
71819
|
-
import { join as
|
|
71867
|
+
import { join as join56, resolve as resolve14 } from "node:path";
|
|
71820
71868
|
var HOOK_CHECK_TIMEOUT_MS = 5000;
|
|
71821
71869
|
var PYTHON_CHECK_TIMEOUT_MS = 3000;
|
|
71822
71870
|
var MAX_LOG_FILE_SIZE_BYTES = 10 * 1024 * 1024;
|
|
@@ -71861,7 +71909,7 @@ async function checkHookSyntax(projectDir) {
|
|
|
71861
71909
|
}
|
|
71862
71910
|
const errors2 = [];
|
|
71863
71911
|
for (const file of cjsFiles) {
|
|
71864
|
-
const filePath =
|
|
71912
|
+
const filePath = join56(hooksDir, file);
|
|
71865
71913
|
if (!isPathWithin(filePath, hooksDir))
|
|
71866
71914
|
continue;
|
|
71867
71915
|
const result = spawnSync2("node", ["--check", filePath], {
|
|
@@ -71947,7 +71995,7 @@ async function checkHookDeps(projectDir) {
|
|
|
71947
71995
|
const missingDeps = [];
|
|
71948
71996
|
const requireRegex = /require\(['"]([^'"]+)['"]\)/g;
|
|
71949
71997
|
for (const file of cjsFiles) {
|
|
71950
|
-
const filePath =
|
|
71998
|
+
const filePath = join56(hooksDir, file);
|
|
71951
71999
|
if (!isPathWithin(filePath, hooksDir))
|
|
71952
72000
|
continue;
|
|
71953
72001
|
const content = readFileSync10(filePath, "utf-8");
|
|
@@ -71957,10 +72005,10 @@ async function checkHookDeps(projectDir) {
|
|
|
71957
72005
|
continue;
|
|
71958
72006
|
}
|
|
71959
72007
|
if (depPath.startsWith(".")) {
|
|
71960
|
-
const resolvedPath =
|
|
72008
|
+
const resolvedPath = join56(hooksDir, depPath);
|
|
71961
72009
|
const extensions = [".js", ".cjs", ".mjs", ".json"];
|
|
71962
72010
|
const indexFiles = ["index.js", "index.cjs", "index.mjs"];
|
|
71963
|
-
const exists = existsSync47(resolvedPath) || extensions.some((ext) => existsSync47(resolvedPath + ext)) || indexFiles.some((idx) => existsSync47(
|
|
72011
|
+
const exists = existsSync47(resolvedPath) || extensions.some((ext) => existsSync47(resolvedPath + ext)) || indexFiles.some((idx) => existsSync47(join56(resolvedPath, idx)));
|
|
71964
72012
|
if (!exists) {
|
|
71965
72013
|
missingDeps.push(`${file}: ${depPath}`);
|
|
71966
72014
|
}
|
|
@@ -72077,11 +72125,11 @@ async function checkHookRuntime(projectDir) {
|
|
|
72077
72125
|
}
|
|
72078
72126
|
const syntheticPayload = JSON.stringify({
|
|
72079
72127
|
tool_name: "Read",
|
|
72080
|
-
tool_input: { file_path:
|
|
72128
|
+
tool_input: { file_path: join56(tmpdir(), "ck-doctor-test.txt") }
|
|
72081
72129
|
});
|
|
72082
72130
|
const failures = [];
|
|
72083
72131
|
for (const file of cjsFiles) {
|
|
72084
|
-
const filePath =
|
|
72132
|
+
const filePath = join56(hooksDir, file);
|
|
72085
72133
|
if (!isPathWithin(filePath, hooksDir))
|
|
72086
72134
|
continue;
|
|
72087
72135
|
const result = spawnSync2("node", [filePath], {
|
|
@@ -72143,8 +72191,8 @@ async function checkHookRuntime(projectDir) {
|
|
|
72143
72191
|
}
|
|
72144
72192
|
}
|
|
72145
72193
|
async function checkHookConfig(projectDir) {
|
|
72146
|
-
const projectConfigPath =
|
|
72147
|
-
const globalConfigPath =
|
|
72194
|
+
const projectConfigPath = join56(projectDir, ".claude", ".ck.json");
|
|
72195
|
+
const globalConfigPath = join56(PathResolver.getGlobalKitDir(), ".ck.json");
|
|
72148
72196
|
const configPath = existsSync47(projectConfigPath) ? projectConfigPath : existsSync47(globalConfigPath) ? globalConfigPath : null;
|
|
72149
72197
|
if (!configPath) {
|
|
72150
72198
|
return {
|
|
@@ -72268,7 +72316,7 @@ async function checkHookLogs(projectDir) {
|
|
|
72268
72316
|
autoFixable: false
|
|
72269
72317
|
};
|
|
72270
72318
|
}
|
|
72271
|
-
const logPath =
|
|
72319
|
+
const logPath = join56(hooksDir, ".logs", "hook-log.jsonl");
|
|
72272
72320
|
if (!existsSync47(logPath)) {
|
|
72273
72321
|
return {
|
|
72274
72322
|
id: "hook-logs",
|
|
@@ -72523,9 +72571,9 @@ async function checkCliVersion() {
|
|
|
72523
72571
|
}
|
|
72524
72572
|
async function checkPythonVenv(projectDir) {
|
|
72525
72573
|
const isWindows3 = process.platform === "win32";
|
|
72526
|
-
const venvBin = isWindows3 ?
|
|
72527
|
-
const projectVenvPath =
|
|
72528
|
-
const globalVenvPath =
|
|
72574
|
+
const venvBin = isWindows3 ? join56("Scripts", "python.exe") : join56("bin", "python3");
|
|
72575
|
+
const projectVenvPath = join56(projectDir, ".claude", "skills", ".venv", venvBin);
|
|
72576
|
+
const globalVenvPath = join56(PathResolver.getGlobalKitDir(), "skills", ".venv", venvBin);
|
|
72529
72577
|
const venvPath = existsSync47(projectVenvPath) ? projectVenvPath : existsSync47(globalVenvPath) ? globalVenvPath : null;
|
|
72530
72578
|
if (!venvPath) {
|
|
72531
72579
|
return {
|
|
@@ -73005,8 +73053,8 @@ import { platform as platform6 } from "node:os";
|
|
|
73005
73053
|
init_environment();
|
|
73006
73054
|
init_path_resolver();
|
|
73007
73055
|
import { constants as constants3, access as access3, mkdir as mkdir14, readFile as readFile32, unlink as unlink8, writeFile as writeFile17 } from "node:fs/promises";
|
|
73008
|
-
import { arch as arch2, homedir as
|
|
73009
|
-
import { join as
|
|
73056
|
+
import { arch as arch2, homedir as homedir27, platform as platform5 } from "node:os";
|
|
73057
|
+
import { join as join58, normalize as normalize6 } from "node:path";
|
|
73010
73058
|
function shouldSkipExpensiveOperations4() {
|
|
73011
73059
|
return shouldSkipExpensiveOperations();
|
|
73012
73060
|
}
|
|
@@ -73028,7 +73076,7 @@ async function checkPlatformDetect() {
|
|
|
73028
73076
|
};
|
|
73029
73077
|
}
|
|
73030
73078
|
async function checkHomeDirResolution() {
|
|
73031
|
-
const nodeHome = normalize6(
|
|
73079
|
+
const nodeHome = normalize6(homedir27());
|
|
73032
73080
|
const rawEnvHome = getHomeDirectoryFromEnv(platform5());
|
|
73033
73081
|
const envHome = rawEnvHome ? normalize6(rawEnvHome) : "";
|
|
73034
73082
|
const match = nodeHome === envHome && envHome !== "";
|
|
@@ -73097,7 +73145,7 @@ async function checkGlobalDirAccess() {
|
|
|
73097
73145
|
autoFixable: false
|
|
73098
73146
|
};
|
|
73099
73147
|
}
|
|
73100
|
-
const testFile =
|
|
73148
|
+
const testFile = join58(globalDir, ".ck-doctor-access-test");
|
|
73101
73149
|
try {
|
|
73102
73150
|
await mkdir14(globalDir, { recursive: true });
|
|
73103
73151
|
await writeFile17(testFile, "test", "utf-8");
|
|
@@ -73175,7 +73223,7 @@ async function checkWSLBoundary() {
|
|
|
73175
73223
|
// src/domains/health-checks/platform/windows-checker.ts
|
|
73176
73224
|
init_path_resolver();
|
|
73177
73225
|
import { mkdir as mkdir15, symlink, unlink as unlink9, writeFile as writeFile18 } from "node:fs/promises";
|
|
73178
|
-
import { join as
|
|
73226
|
+
import { join as join59 } from "node:path";
|
|
73179
73227
|
async function checkLongPathSupport() {
|
|
73180
73228
|
if (shouldSkipExpensiveOperations4()) {
|
|
73181
73229
|
return {
|
|
@@ -73227,8 +73275,8 @@ async function checkSymlinkSupport() {
|
|
|
73227
73275
|
};
|
|
73228
73276
|
}
|
|
73229
73277
|
const testDir = PathResolver.getGlobalKitDir();
|
|
73230
|
-
const target =
|
|
73231
|
-
const link =
|
|
73278
|
+
const target = join59(testDir, ".ck-symlink-test-target");
|
|
73279
|
+
const link = join59(testDir, ".ck-symlink-test-link");
|
|
73232
73280
|
try {
|
|
73233
73281
|
await mkdir15(testDir, { recursive: true });
|
|
73234
73282
|
await writeFile18(target, "test", "utf-8");
|
|
@@ -73522,7 +73570,7 @@ class AutoHealer {
|
|
|
73522
73570
|
import { execSync as execSync3, spawnSync as spawnSync5 } from "node:child_process";
|
|
73523
73571
|
import { readFileSync as readFileSync11, unlinkSync, writeFileSync as writeFileSync4 } from "node:fs";
|
|
73524
73572
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
73525
|
-
import { dirname as dirname20, join as
|
|
73573
|
+
import { dirname as dirname20, join as join60 } from "node:path";
|
|
73526
73574
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
73527
73575
|
init_environment();
|
|
73528
73576
|
init_logger();
|
|
@@ -73530,7 +73578,7 @@ init_dist2();
|
|
|
73530
73578
|
function getCliVersion4() {
|
|
73531
73579
|
try {
|
|
73532
73580
|
const __dirname4 = dirname20(fileURLToPath4(import.meta.url));
|
|
73533
|
-
const pkgPath =
|
|
73581
|
+
const pkgPath = join60(__dirname4, "../../../package.json");
|
|
73534
73582
|
const pkg = JSON.parse(readFileSync11(pkgPath, "utf-8"));
|
|
73535
73583
|
return pkg.version || "unknown";
|
|
73536
73584
|
} catch (err) {
|
|
@@ -73669,7 +73717,7 @@ class ReportGenerator {
|
|
|
73669
73717
|
return null;
|
|
73670
73718
|
}
|
|
73671
73719
|
}
|
|
73672
|
-
const tmpFile =
|
|
73720
|
+
const tmpFile = join60(tmpdir3(), `ck-report-${Date.now()}.txt`);
|
|
73673
73721
|
writeFileSync4(tmpFile, report);
|
|
73674
73722
|
try {
|
|
73675
73723
|
const result = spawnSync5("gh", ["gist", "create", tmpFile, "--desc", "ClaudeKit Diagnostic Report"], {
|
|
@@ -73995,7 +74043,7 @@ init_logger();
|
|
|
73995
74043
|
init_path_resolver();
|
|
73996
74044
|
var import_compare_versions6 = __toESM(require_umd(), 1);
|
|
73997
74045
|
import { mkdir as mkdir16, readFile as readFile33, unlink as unlink10, writeFile as writeFile19 } from "node:fs/promises";
|
|
73998
|
-
import { join as
|
|
74046
|
+
import { join as join61 } from "node:path";
|
|
73999
74047
|
var CACHE_TTL_HOURS = 24;
|
|
74000
74048
|
var DEFAULT_CACHE_TTL_MS = CACHE_TTL_HOURS * 60 * 60 * 1000;
|
|
74001
74049
|
var MIN_CACHE_TTL_MS = 60 * 1000;
|
|
@@ -74032,7 +74080,7 @@ var KIT_REPOS = {
|
|
|
74032
74080
|
class ConfigVersionChecker {
|
|
74033
74081
|
static getCacheFilePath(kitType, global3) {
|
|
74034
74082
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
74035
|
-
return
|
|
74083
|
+
return join61(cacheDir, `${kitType}-${CACHE_FILENAME}`);
|
|
74036
74084
|
}
|
|
74037
74085
|
static async loadCache(kitType, global3) {
|
|
74038
74086
|
try {
|
|
@@ -74195,7 +74243,7 @@ class ConfigVersionChecker {
|
|
|
74195
74243
|
}
|
|
74196
74244
|
// src/domains/sync/sync-engine.ts
|
|
74197
74245
|
import { lstat as lstat3, readFile as readFile34, readlink, realpath as realpath3, stat as stat9 } from "node:fs/promises";
|
|
74198
|
-
import { isAbsolute as isAbsolute3, join as
|
|
74246
|
+
import { isAbsolute as isAbsolute3, join as join62, normalize as normalize7, relative as relative8 } from "node:path";
|
|
74199
74247
|
|
|
74200
74248
|
// src/services/file-operations/ownership-checker.ts
|
|
74201
74249
|
init_metadata_migration();
|
|
@@ -75556,7 +75604,7 @@ async function validateSymlinkChain(path5, basePath, maxDepth = MAX_SYMLINK_DEPT
|
|
|
75556
75604
|
if (!stats.isSymbolicLink())
|
|
75557
75605
|
break;
|
|
75558
75606
|
const target = await readlink(current);
|
|
75559
|
-
const resolvedTarget = isAbsolute3(target) ? target :
|
|
75607
|
+
const resolvedTarget = isAbsolute3(target) ? target : join62(current, "..", target);
|
|
75560
75608
|
const normalizedTarget = normalize7(resolvedTarget);
|
|
75561
75609
|
const rel = relative8(basePath, normalizedTarget);
|
|
75562
75610
|
if (rel.startsWith("..") || isAbsolute3(rel)) {
|
|
@@ -75592,7 +75640,7 @@ async function validateSyncPath(basePath, filePath) {
|
|
|
75592
75640
|
if (normalized.startsWith("..") || normalized.includes("/../")) {
|
|
75593
75641
|
throw new Error(`Path traversal not allowed: ${filePath}`);
|
|
75594
75642
|
}
|
|
75595
|
-
const fullPath =
|
|
75643
|
+
const fullPath = join62(basePath, normalized);
|
|
75596
75644
|
const rel = relative8(basePath, fullPath);
|
|
75597
75645
|
if (rel.startsWith("..") || isAbsolute3(rel)) {
|
|
75598
75646
|
throw new Error(`Path escapes base directory: ${filePath}`);
|
|
@@ -75607,7 +75655,7 @@ async function validateSyncPath(basePath, filePath) {
|
|
|
75607
75655
|
}
|
|
75608
75656
|
} catch (error) {
|
|
75609
75657
|
if (error.code === "ENOENT") {
|
|
75610
|
-
const parentPath =
|
|
75658
|
+
const parentPath = join62(fullPath, "..");
|
|
75611
75659
|
try {
|
|
75612
75660
|
const resolvedBase = await realpath3(basePath);
|
|
75613
75661
|
const resolvedParent = await realpath3(parentPath);
|
|
@@ -76789,7 +76837,7 @@ init_logger();
|
|
|
76789
76837
|
var import_proper_lockfile4 = __toESM(require_proper_lockfile(), 1);
|
|
76790
76838
|
import { mkdir as mkdir19 } from "node:fs/promises";
|
|
76791
76839
|
import os5 from "node:os";
|
|
76792
|
-
import { join as
|
|
76840
|
+
import { join as join69 } from "node:path";
|
|
76793
76841
|
var LOCK_CONFIG = {
|
|
76794
76842
|
stale: 60000,
|
|
76795
76843
|
retries: 0
|
|
@@ -76797,12 +76845,12 @@ var LOCK_CONFIG = {
|
|
|
76797
76845
|
var activeLocks = new Set;
|
|
76798
76846
|
var cleanupRegistered = false;
|
|
76799
76847
|
function getLocksDir() {
|
|
76800
|
-
return
|
|
76848
|
+
return join69(os5.homedir(), ".claudekit", "locks");
|
|
76801
76849
|
}
|
|
76802
76850
|
function cleanupLocks() {
|
|
76803
76851
|
for (const name of activeLocks) {
|
|
76804
76852
|
try {
|
|
76805
|
-
const lockPath =
|
|
76853
|
+
const lockPath = join69(getLocksDir(), `${name}.lock`);
|
|
76806
76854
|
import_proper_lockfile4.default.unlockSync(lockPath, { realpath: false });
|
|
76807
76855
|
} catch {
|
|
76808
76856
|
try {
|
|
@@ -76825,7 +76873,7 @@ async function ensureLocksDir() {
|
|
|
76825
76873
|
async function withProcessLock(lockName, fn) {
|
|
76826
76874
|
registerCleanupHandlers();
|
|
76827
76875
|
await ensureLocksDir();
|
|
76828
|
-
const lockPath =
|
|
76876
|
+
const lockPath = join69(getLocksDir(), `${lockName}.lock`);
|
|
76829
76877
|
let release;
|
|
76830
76878
|
try {
|
|
76831
76879
|
release = await import_proper_lockfile4.default.lock(lockPath, { ...LOCK_CONFIG, realpath: false });
|
|
@@ -76856,7 +76904,7 @@ init_logger();
|
|
|
76856
76904
|
init_logger();
|
|
76857
76905
|
init_path_resolver();
|
|
76858
76906
|
var import_fs_extra7 = __toESM(require_lib3(), 1);
|
|
76859
|
-
import { join as
|
|
76907
|
+
import { join as join70 } from "node:path";
|
|
76860
76908
|
async function handleConflicts(ctx) {
|
|
76861
76909
|
if (ctx.cancelled)
|
|
76862
76910
|
return ctx;
|
|
@@ -76865,7 +76913,7 @@ async function handleConflicts(ctx) {
|
|
|
76865
76913
|
if (PathResolver.isLocalSameAsGlobal()) {
|
|
76866
76914
|
return ctx;
|
|
76867
76915
|
}
|
|
76868
|
-
const localSettingsPath =
|
|
76916
|
+
const localSettingsPath = join70(process.cwd(), ".claude", "settings.json");
|
|
76869
76917
|
if (!await import_fs_extra7.pathExists(localSettingsPath)) {
|
|
76870
76918
|
return ctx;
|
|
76871
76919
|
}
|
|
@@ -76880,7 +76928,7 @@ async function handleConflicts(ctx) {
|
|
|
76880
76928
|
return { ...ctx, cancelled: true };
|
|
76881
76929
|
}
|
|
76882
76930
|
if (choice === "remove") {
|
|
76883
|
-
const localClaudeDir =
|
|
76931
|
+
const localClaudeDir = join70(process.cwd(), ".claude");
|
|
76884
76932
|
try {
|
|
76885
76933
|
await import_fs_extra7.remove(localClaudeDir);
|
|
76886
76934
|
logger.success("Removed local .claude/ directory");
|
|
@@ -76977,7 +77025,7 @@ init_logger();
|
|
|
76977
77025
|
init_safe_spinner();
|
|
76978
77026
|
import { mkdir as mkdir25, stat as stat12 } from "node:fs/promises";
|
|
76979
77027
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
76980
|
-
import { join as
|
|
77028
|
+
import { join as join77 } from "node:path";
|
|
76981
77029
|
|
|
76982
77030
|
// src/shared/temp-cleanup.ts
|
|
76983
77031
|
init_logger();
|
|
@@ -76996,7 +77044,7 @@ init_logger();
|
|
|
76996
77044
|
init_output_manager();
|
|
76997
77045
|
import { createWriteStream as createWriteStream2, rmSync as rmSync2 } from "node:fs";
|
|
76998
77046
|
import { mkdir as mkdir20 } from "node:fs/promises";
|
|
76999
|
-
import { join as
|
|
77047
|
+
import { join as join71 } from "node:path";
|
|
77000
77048
|
|
|
77001
77049
|
// src/shared/progress-bar.ts
|
|
77002
77050
|
init_output_manager();
|
|
@@ -77206,7 +77254,7 @@ var MAX_DOWNLOAD_SIZE = 500 * 1024 * 1024;
|
|
|
77206
77254
|
class FileDownloader {
|
|
77207
77255
|
async downloadAsset(asset, destDir) {
|
|
77208
77256
|
try {
|
|
77209
|
-
const destPath =
|
|
77257
|
+
const destPath = join71(destDir, asset.name);
|
|
77210
77258
|
await mkdir20(destDir, { recursive: true });
|
|
77211
77259
|
output.info(`Downloading ${asset.name} (${formatBytes(asset.size)})...`);
|
|
77212
77260
|
logger.verbose("Download details", {
|
|
@@ -77291,7 +77339,7 @@ class FileDownloader {
|
|
|
77291
77339
|
}
|
|
77292
77340
|
async downloadFile(params) {
|
|
77293
77341
|
const { url, name, size, destDir, token } = params;
|
|
77294
|
-
const destPath =
|
|
77342
|
+
const destPath = join71(destDir, name);
|
|
77295
77343
|
await mkdir20(destDir, { recursive: true });
|
|
77296
77344
|
output.info(`Downloading ${name}${size ? ` (${formatBytes(size)})` : ""}...`);
|
|
77297
77345
|
const headers = {};
|
|
@@ -77377,7 +77425,7 @@ init_logger();
|
|
|
77377
77425
|
init_types3();
|
|
77378
77426
|
import { constants as constants4 } from "node:fs";
|
|
77379
77427
|
import { access as access4, readdir as readdir13 } from "node:fs/promises";
|
|
77380
|
-
import { join as
|
|
77428
|
+
import { join as join72 } from "node:path";
|
|
77381
77429
|
async function validateExtraction(extractDir) {
|
|
77382
77430
|
try {
|
|
77383
77431
|
const entries = await readdir13(extractDir, { encoding: "utf8" });
|
|
@@ -77389,7 +77437,7 @@ async function validateExtraction(extractDir) {
|
|
|
77389
77437
|
const missingPaths = [];
|
|
77390
77438
|
for (const path5 of criticalPaths) {
|
|
77391
77439
|
try {
|
|
77392
|
-
await access4(
|
|
77440
|
+
await access4(join72(extractDir, path5), constants4.F_OK);
|
|
77393
77441
|
logger.debug(`Found: ${path5}`);
|
|
77394
77442
|
} catch {
|
|
77395
77443
|
logger.warning(`Expected path not found: ${path5}`);
|
|
@@ -77411,7 +77459,7 @@ async function validateExtraction(extractDir) {
|
|
|
77411
77459
|
// src/domains/installation/extraction/tar-extractor.ts
|
|
77412
77460
|
init_logger();
|
|
77413
77461
|
import { copyFile as copyFile4, mkdir as mkdir23, readdir as readdir15, rm as rm8, stat as stat10 } from "node:fs/promises";
|
|
77414
|
-
import { join as
|
|
77462
|
+
import { join as join75 } from "node:path";
|
|
77415
77463
|
|
|
77416
77464
|
// node_modules/@isaacs/fs-minipass/dist/esm/index.js
|
|
77417
77465
|
import EE from "events";
|
|
@@ -83173,7 +83221,7 @@ var mkdirSync3 = (dir, opt) => {
|
|
|
83173
83221
|
};
|
|
83174
83222
|
|
|
83175
83223
|
// node_modules/tar/dist/esm/path-reservations.js
|
|
83176
|
-
import { join as
|
|
83224
|
+
import { join as join73 } from "node:path";
|
|
83177
83225
|
|
|
83178
83226
|
// node_modules/tar/dist/esm/normalize-unicode.js
|
|
83179
83227
|
var normalizeCache = Object.create(null);
|
|
@@ -83206,7 +83254,7 @@ var getDirs = (path10) => {
|
|
|
83206
83254
|
const dirs = path10.split("/").slice(0, -1).reduce((set, path11) => {
|
|
83207
83255
|
const s = set[set.length - 1];
|
|
83208
83256
|
if (s !== undefined) {
|
|
83209
|
-
path11 =
|
|
83257
|
+
path11 = join73(s, path11);
|
|
83210
83258
|
}
|
|
83211
83259
|
set.push(path11 || "/");
|
|
83212
83260
|
return set;
|
|
@@ -83220,7 +83268,7 @@ class PathReservations {
|
|
|
83220
83268
|
#running = new Set;
|
|
83221
83269
|
reserve(paths, fn) {
|
|
83222
83270
|
paths = isWindows4 ? ["win32 parallelization disabled"] : paths.map((p) => {
|
|
83223
|
-
return stripTrailingSlashes(
|
|
83271
|
+
return stripTrailingSlashes(join73(normalizeUnicode(p))).toLowerCase();
|
|
83224
83272
|
});
|
|
83225
83273
|
const dirs = new Set(paths.map((path10) => getDirs(path10)).reduce((a3, b3) => a3.concat(b3)));
|
|
83226
83274
|
this.#reservations.set(fn, { dirs, paths });
|
|
@@ -84280,7 +84328,7 @@ function decodeFilePath(path12) {
|
|
|
84280
84328
|
init_logger();
|
|
84281
84329
|
init_types3();
|
|
84282
84330
|
import { copyFile as copyFile3, lstat as lstat4, mkdir as mkdir22, readdir as readdir14 } from "node:fs/promises";
|
|
84283
|
-
import { join as
|
|
84331
|
+
import { join as join74, relative as relative10 } from "node:path";
|
|
84284
84332
|
async function withRetry(fn, retries = 3) {
|
|
84285
84333
|
for (let i = 0;i < retries; i++) {
|
|
84286
84334
|
try {
|
|
@@ -84302,8 +84350,8 @@ async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTrac
|
|
|
84302
84350
|
await mkdir22(destDir, { recursive: true });
|
|
84303
84351
|
const entries = await readdir14(sourceDir, { encoding: "utf8" });
|
|
84304
84352
|
for (const entry of entries) {
|
|
84305
|
-
const sourcePath =
|
|
84306
|
-
const destPath =
|
|
84353
|
+
const sourcePath = join74(sourceDir, entry);
|
|
84354
|
+
const destPath = join74(destDir, entry);
|
|
84307
84355
|
const relativePath = relative10(sourceDir, sourcePath);
|
|
84308
84356
|
if (!isPathSafe(destDir, destPath)) {
|
|
84309
84357
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -84330,8 +84378,8 @@ async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
|
84330
84378
|
await mkdir22(destDir, { recursive: true });
|
|
84331
84379
|
const entries = await readdir14(sourceDir, { encoding: "utf8" });
|
|
84332
84380
|
for (const entry of entries) {
|
|
84333
|
-
const sourcePath =
|
|
84334
|
-
const destPath =
|
|
84381
|
+
const sourcePath = join74(sourceDir, entry);
|
|
84382
|
+
const destPath = join74(destDir, entry);
|
|
84335
84383
|
const relativePath = relative10(sourceDir, sourcePath);
|
|
84336
84384
|
if (!isPathSafe(destDir, destPath)) {
|
|
84337
84385
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -84379,7 +84427,7 @@ class TarExtractor {
|
|
|
84379
84427
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
84380
84428
|
if (entries.length === 1) {
|
|
84381
84429
|
const rootEntry = entries[0];
|
|
84382
|
-
const rootPath =
|
|
84430
|
+
const rootPath = join75(tempExtractDir, rootEntry);
|
|
84383
84431
|
const rootStat = await stat10(rootPath);
|
|
84384
84432
|
if (rootStat.isDirectory()) {
|
|
84385
84433
|
const rootContents = await readdir15(rootPath, { encoding: "utf8" });
|
|
@@ -84395,7 +84443,7 @@ class TarExtractor {
|
|
|
84395
84443
|
}
|
|
84396
84444
|
} else {
|
|
84397
84445
|
await mkdir23(destDir, { recursive: true });
|
|
84398
|
-
await copyFile4(rootPath,
|
|
84446
|
+
await copyFile4(rootPath, join75(destDir, rootEntry));
|
|
84399
84447
|
}
|
|
84400
84448
|
} else {
|
|
84401
84449
|
logger.debug("Multiple root entries - moving all");
|
|
@@ -84418,7 +84466,7 @@ init_logger();
|
|
|
84418
84466
|
var import_extract_zip = __toESM(require_extract_zip(), 1);
|
|
84419
84467
|
import { execFile as execFile8 } from "node:child_process";
|
|
84420
84468
|
import { copyFile as copyFile5, mkdir as mkdir24, readdir as readdir16, rm as rm9, stat as stat11 } from "node:fs/promises";
|
|
84421
|
-
import { join as
|
|
84469
|
+
import { join as join76 } from "node:path";
|
|
84422
84470
|
class ZipExtractor {
|
|
84423
84471
|
async tryNativeUnzip(archivePath, destDir) {
|
|
84424
84472
|
if (!isMacOS()) {
|
|
@@ -84466,7 +84514,7 @@ class ZipExtractor {
|
|
|
84466
84514
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
84467
84515
|
if (entries.length === 1) {
|
|
84468
84516
|
const rootEntry = entries[0];
|
|
84469
|
-
const rootPath =
|
|
84517
|
+
const rootPath = join76(tempExtractDir, rootEntry);
|
|
84470
84518
|
const rootStat = await stat11(rootPath);
|
|
84471
84519
|
if (rootStat.isDirectory()) {
|
|
84472
84520
|
const rootContents = await readdir16(rootPath, { encoding: "utf8" });
|
|
@@ -84482,7 +84530,7 @@ class ZipExtractor {
|
|
|
84482
84530
|
}
|
|
84483
84531
|
} else {
|
|
84484
84532
|
await mkdir24(destDir, { recursive: true });
|
|
84485
|
-
await copyFile5(rootPath,
|
|
84533
|
+
await copyFile5(rootPath, join76(destDir, rootEntry));
|
|
84486
84534
|
}
|
|
84487
84535
|
} else {
|
|
84488
84536
|
logger.debug("Multiple root entries - moving all");
|
|
@@ -84581,7 +84629,7 @@ class DownloadManager {
|
|
|
84581
84629
|
async createTempDir() {
|
|
84582
84630
|
const timestamp = Date.now();
|
|
84583
84631
|
const counter = DownloadManager.tempDirCounter++;
|
|
84584
|
-
const primaryTempDir =
|
|
84632
|
+
const primaryTempDir = join77(tmpdir4(), `claudekit-${timestamp}-${counter}`);
|
|
84585
84633
|
try {
|
|
84586
84634
|
await mkdir25(primaryTempDir, { recursive: true });
|
|
84587
84635
|
logger.debug(`Created temp directory: ${primaryTempDir}`);
|
|
@@ -84598,7 +84646,7 @@ Solutions:
|
|
|
84598
84646
|
2. Set HOME environment variable
|
|
84599
84647
|
3. Try running from a different directory`);
|
|
84600
84648
|
}
|
|
84601
|
-
const fallbackTempDir =
|
|
84649
|
+
const fallbackTempDir = join77(homeDir, ".claudekit", "tmp", `claudekit-${timestamp}-${counter}`);
|
|
84602
84650
|
try {
|
|
84603
84651
|
await mkdir25(fallbackTempDir, { recursive: true });
|
|
84604
84652
|
logger.debug(`Created temp directory (fallback): ${fallbackTempDir}`);
|
|
@@ -84947,20 +84995,20 @@ async function handleDownload(ctx) {
|
|
|
84947
84995
|
};
|
|
84948
84996
|
}
|
|
84949
84997
|
// src/commands/init/phases/merge-handler.ts
|
|
84950
|
-
import { join as
|
|
84998
|
+
import { join as join93 } from "node:path";
|
|
84951
84999
|
|
|
84952
85000
|
// src/domains/installation/deletion-handler.ts
|
|
84953
85001
|
import { existsSync as existsSync53, lstatSync as lstatSync3, readdirSync as readdirSync4, rmSync as rmSync3, rmdirSync, unlinkSync as unlinkSync3 } from "node:fs";
|
|
84954
|
-
import { dirname as dirname24, join as
|
|
85002
|
+
import { dirname as dirname24, join as join80, relative as relative11, resolve as resolve19, sep as sep5 } from "node:path";
|
|
84955
85003
|
|
|
84956
85004
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
84957
85005
|
init_metadata_migration();
|
|
84958
85006
|
init_logger();
|
|
84959
85007
|
init_types3();
|
|
84960
85008
|
var import_fs_extra8 = __toESM(require_lib3(), 1);
|
|
84961
|
-
import { join as
|
|
85009
|
+
import { join as join79 } from "node:path";
|
|
84962
85010
|
async function readManifest(claudeDir2) {
|
|
84963
|
-
const metadataPath =
|
|
85011
|
+
const metadataPath = join79(claudeDir2, "metadata.json");
|
|
84964
85012
|
if (!await import_fs_extra8.pathExists(metadataPath)) {
|
|
84965
85013
|
return null;
|
|
84966
85014
|
}
|
|
@@ -85138,7 +85186,7 @@ function collectFilesRecursively(dir, baseDir) {
|
|
|
85138
85186
|
try {
|
|
85139
85187
|
const entries = readdirSync4(dir, { withFileTypes: true });
|
|
85140
85188
|
for (const entry of entries) {
|
|
85141
|
-
const fullPath =
|
|
85189
|
+
const fullPath = join80(dir, entry.name);
|
|
85142
85190
|
const relativePath = relative11(baseDir, fullPath);
|
|
85143
85191
|
if (entry.isDirectory()) {
|
|
85144
85192
|
results.push(...collectFilesRecursively(fullPath, baseDir));
|
|
@@ -85190,7 +85238,7 @@ function cleanupEmptyDirectories(filePath, claudeDir2) {
|
|
|
85190
85238
|
function deletePath(fullPath, claudeDir2) {
|
|
85191
85239
|
const normalizedPath = resolve19(fullPath);
|
|
85192
85240
|
const normalizedClaudeDir = resolve19(claudeDir2);
|
|
85193
|
-
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${
|
|
85241
|
+
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep5}`) && normalizedPath !== normalizedClaudeDir) {
|
|
85194
85242
|
throw new Error(`Path traversal detected: ${fullPath}`);
|
|
85195
85243
|
}
|
|
85196
85244
|
try {
|
|
@@ -85206,7 +85254,7 @@ function deletePath(fullPath, claudeDir2) {
|
|
|
85206
85254
|
}
|
|
85207
85255
|
}
|
|
85208
85256
|
async function updateMetadataAfterDeletion(claudeDir2, deletedPaths) {
|
|
85209
|
-
const metadataPath =
|
|
85257
|
+
const metadataPath = join80(claudeDir2, "metadata.json");
|
|
85210
85258
|
if (!await import_fs_extra9.pathExists(metadataPath)) {
|
|
85211
85259
|
return;
|
|
85212
85260
|
}
|
|
@@ -85261,10 +85309,10 @@ async function handleDeletions(sourceMetadata, claudeDir2) {
|
|
|
85261
85309
|
const userMetadata = await readManifest(claudeDir2);
|
|
85262
85310
|
const result = { deletedPaths: [], preservedPaths: [], errors: [] };
|
|
85263
85311
|
for (const path13 of deletions) {
|
|
85264
|
-
const fullPath =
|
|
85312
|
+
const fullPath = join80(claudeDir2, path13);
|
|
85265
85313
|
const normalizedPath = resolve19(fullPath);
|
|
85266
85314
|
const normalizedClaudeDir = resolve19(claudeDir2);
|
|
85267
|
-
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${
|
|
85315
|
+
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep5}`)) {
|
|
85268
85316
|
logger.warning(`Skipping invalid path: ${path13}`);
|
|
85269
85317
|
result.errors.push(path13);
|
|
85270
85318
|
continue;
|
|
@@ -85301,7 +85349,7 @@ init_logger();
|
|
|
85301
85349
|
init_types3();
|
|
85302
85350
|
var import_fs_extra12 = __toESM(require_lib3(), 1);
|
|
85303
85351
|
var import_ignore3 = __toESM(require_ignore(), 1);
|
|
85304
|
-
import { dirname as dirname26, join as
|
|
85352
|
+
import { dirname as dirname26, join as join83, relative as relative13 } from "node:path";
|
|
85305
85353
|
|
|
85306
85354
|
// src/domains/installation/selective-merger.ts
|
|
85307
85355
|
import { stat as stat13 } from "node:fs/promises";
|
|
@@ -85480,7 +85528,7 @@ init_logger();
|
|
|
85480
85528
|
var import_fs_extra10 = __toESM(require_lib3(), 1);
|
|
85481
85529
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
85482
85530
|
import { relative as relative12 } from "node:path";
|
|
85483
|
-
import { join as
|
|
85531
|
+
import { join as join81 } from "node:path";
|
|
85484
85532
|
|
|
85485
85533
|
// node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
85486
85534
|
var balanced = (a3, b3, str2) => {
|
|
@@ -86287,8 +86335,8 @@ var path13 = {
|
|
|
86287
86335
|
win32: { sep: "\\" },
|
|
86288
86336
|
posix: { sep: "/" }
|
|
86289
86337
|
};
|
|
86290
|
-
var
|
|
86291
|
-
minimatch.sep =
|
|
86338
|
+
var sep6 = defaultPlatform === "win32" ? path13.win32.sep : path13.posix.sep;
|
|
86339
|
+
minimatch.sep = sep6;
|
|
86292
86340
|
var GLOBSTAR = Symbol("globstar **");
|
|
86293
86341
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
86294
86342
|
var qmark2 = "[^/]";
|
|
@@ -86936,7 +86984,7 @@ class FileScanner {
|
|
|
86936
86984
|
const files = [];
|
|
86937
86985
|
const entries = await import_fs_extra10.readdir(dir, { encoding: "utf8" });
|
|
86938
86986
|
for (const entry of entries) {
|
|
86939
|
-
const fullPath =
|
|
86987
|
+
const fullPath = join81(dir, entry);
|
|
86940
86988
|
const relativePath = relative12(baseDir, fullPath);
|
|
86941
86989
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
86942
86990
|
const stats = await import_fs_extra10.lstat(fullPath);
|
|
@@ -86976,7 +87024,7 @@ import { execSync as execSync4 } from "node:child_process";
|
|
|
86976
87024
|
init_shared();
|
|
86977
87025
|
import { existsSync as existsSync54 } from "node:fs";
|
|
86978
87026
|
import { mkdir as mkdir26, readFile as readFile38, writeFile as writeFile22 } from "node:fs/promises";
|
|
86979
|
-
import { dirname as dirname25, join as
|
|
87027
|
+
import { dirname as dirname25, join as join82 } from "node:path";
|
|
86980
87028
|
var CK_JSON_FILE = ".ck.json";
|
|
86981
87029
|
|
|
86982
87030
|
class InstalledSettingsTracker {
|
|
@@ -86990,9 +87038,9 @@ class InstalledSettingsTracker {
|
|
|
86990
87038
|
}
|
|
86991
87039
|
getCkJsonPath() {
|
|
86992
87040
|
if (this.isGlobal) {
|
|
86993
|
-
return
|
|
87041
|
+
return join82(this.projectDir, CK_JSON_FILE);
|
|
86994
87042
|
}
|
|
86995
|
-
return
|
|
87043
|
+
return join82(this.projectDir, ".claude", CK_JSON_FILE);
|
|
86996
87044
|
}
|
|
86997
87045
|
async loadInstalledSettings() {
|
|
86998
87046
|
const ckJsonPath = this.getCkJsonPath();
|
|
@@ -87609,7 +87657,7 @@ class CopyExecutor {
|
|
|
87609
87657
|
for (const file of files) {
|
|
87610
87658
|
const relativePath = relative13(sourceDir, file);
|
|
87611
87659
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
87612
|
-
const destPath =
|
|
87660
|
+
const destPath = join83(destDir, relativePath);
|
|
87613
87661
|
if (await import_fs_extra12.pathExists(destPath)) {
|
|
87614
87662
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
87615
87663
|
logger.debug(`Security-sensitive file exists but won't be overwritten: ${normalizedRelativePath}`);
|
|
@@ -87631,7 +87679,7 @@ class CopyExecutor {
|
|
|
87631
87679
|
for (const file of files) {
|
|
87632
87680
|
const relativePath = relative13(sourceDir, file);
|
|
87633
87681
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
87634
|
-
const destPath =
|
|
87682
|
+
const destPath = join83(destDir, relativePath);
|
|
87635
87683
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
87636
87684
|
logger.debug(`Skipping security-sensitive file: ${normalizedRelativePath}`);
|
|
87637
87685
|
skippedCount++;
|
|
@@ -87804,15 +87852,15 @@ class FileMerger {
|
|
|
87804
87852
|
|
|
87805
87853
|
// src/domains/migration/legacy-migration.ts
|
|
87806
87854
|
import { readdir as readdir18, stat as stat14 } from "node:fs/promises";
|
|
87807
|
-
import { join as
|
|
87855
|
+
import { join as join87, relative as relative14 } from "node:path";
|
|
87808
87856
|
// src/services/file-operations/manifest/manifest-tracker.ts
|
|
87809
|
-
import { join as
|
|
87857
|
+
import { join as join86 } from "node:path";
|
|
87810
87858
|
|
|
87811
87859
|
// src/domains/migration/release-manifest.ts
|
|
87812
87860
|
init_logger();
|
|
87813
87861
|
init_zod();
|
|
87814
87862
|
var import_fs_extra13 = __toESM(require_lib3(), 1);
|
|
87815
|
-
import { join as
|
|
87863
|
+
import { join as join84 } from "node:path";
|
|
87816
87864
|
var ReleaseManifestFileSchema = exports_external.object({
|
|
87817
87865
|
path: exports_external.string(),
|
|
87818
87866
|
checksum: exports_external.string().regex(/^[a-f0-9]{64}$/),
|
|
@@ -87827,7 +87875,7 @@ var ReleaseManifestSchema = exports_external.object({
|
|
|
87827
87875
|
|
|
87828
87876
|
class ReleaseManifestLoader {
|
|
87829
87877
|
static async load(extractDir) {
|
|
87830
|
-
const manifestPath =
|
|
87878
|
+
const manifestPath = join84(extractDir, "release-manifest.json");
|
|
87831
87879
|
try {
|
|
87832
87880
|
const content = await import_fs_extra13.readFile(manifestPath, "utf-8");
|
|
87833
87881
|
const parsed = JSON.parse(content);
|
|
@@ -87853,9 +87901,9 @@ init_logger();
|
|
|
87853
87901
|
init_types3();
|
|
87854
87902
|
var import_fs_extra14 = __toESM(require_lib3(), 1);
|
|
87855
87903
|
var import_proper_lockfile5 = __toESM(require_proper_lockfile(), 1);
|
|
87856
|
-
import { join as
|
|
87904
|
+
import { join as join85 } from "node:path";
|
|
87857
87905
|
async function writeManifest(claudeDir2, kitName, version, scope, kitType, trackedFiles, userConfigFiles) {
|
|
87858
|
-
const metadataPath =
|
|
87906
|
+
const metadataPath = join85(claudeDir2, "metadata.json");
|
|
87859
87907
|
const kit = kitType || (/\bmarketing\b/i.test(kitName) ? "marketing" : "engineer");
|
|
87860
87908
|
await import_fs_extra14.ensureFile(metadataPath);
|
|
87861
87909
|
let release = null;
|
|
@@ -87911,7 +87959,7 @@ async function writeManifest(claudeDir2, kitName, version, scope, kitType, track
|
|
|
87911
87959
|
}
|
|
87912
87960
|
}
|
|
87913
87961
|
async function removeKitFromManifest(claudeDir2, kit) {
|
|
87914
|
-
const metadataPath =
|
|
87962
|
+
const metadataPath = join85(claudeDir2, "metadata.json");
|
|
87915
87963
|
if (!await import_fs_extra14.pathExists(metadataPath))
|
|
87916
87964
|
return false;
|
|
87917
87965
|
let release = null;
|
|
@@ -88041,7 +88089,7 @@ function buildFileTrackingList(options2) {
|
|
|
88041
88089
|
if (!isGlobal && !installedPath.startsWith(".claude/"))
|
|
88042
88090
|
continue;
|
|
88043
88091
|
const relativePath = isGlobal ? installedPath : installedPath.replace(/^\.claude\//, "");
|
|
88044
|
-
const filePath =
|
|
88092
|
+
const filePath = join86(claudeDir2, relativePath);
|
|
88045
88093
|
const manifestEntry = releaseManifest ? ReleaseManifestLoader.findFile(releaseManifest, installedPath) : null;
|
|
88046
88094
|
const ownership = manifestEntry ? "ck" : "user";
|
|
88047
88095
|
filesToTrack.push({
|
|
@@ -88148,7 +88196,7 @@ class LegacyMigration {
|
|
|
88148
88196
|
continue;
|
|
88149
88197
|
if (SKIP_DIRS_ALL.includes(entry))
|
|
88150
88198
|
continue;
|
|
88151
|
-
const fullPath =
|
|
88199
|
+
const fullPath = join87(dir, entry);
|
|
88152
88200
|
let stats;
|
|
88153
88201
|
try {
|
|
88154
88202
|
stats = await stat14(fullPath);
|
|
@@ -88250,7 +88298,7 @@ User-created files (sample):`);
|
|
|
88250
88298
|
];
|
|
88251
88299
|
if (filesToChecksum.length > 0) {
|
|
88252
88300
|
const checksumResults = await mapWithLimit(filesToChecksum, async ({ relativePath, ownership }) => {
|
|
88253
|
-
const fullPath =
|
|
88301
|
+
const fullPath = join87(claudeDir2, relativePath);
|
|
88254
88302
|
const checksum = await OwnershipChecker.calculateChecksum(fullPath);
|
|
88255
88303
|
return { relativePath, checksum, ownership };
|
|
88256
88304
|
});
|
|
@@ -88271,7 +88319,7 @@ User-created files (sample):`);
|
|
|
88271
88319
|
installedAt: new Date().toISOString(),
|
|
88272
88320
|
files: trackedFiles
|
|
88273
88321
|
};
|
|
88274
|
-
const metadataPath =
|
|
88322
|
+
const metadataPath = join87(claudeDir2, "metadata.json");
|
|
88275
88323
|
await import_fs_extra15.writeFile(metadataPath, JSON.stringify(updatedMetadata, null, 2));
|
|
88276
88324
|
logger.success(`Migration complete: tracked ${trackedFiles.length} files`);
|
|
88277
88325
|
return true;
|
|
@@ -88377,7 +88425,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
|
|
|
88377
88425
|
init_logger();
|
|
88378
88426
|
init_skip_directories();
|
|
88379
88427
|
var import_fs_extra16 = __toESM(require_lib3(), 1);
|
|
88380
|
-
import { join as
|
|
88428
|
+
import { join as join88, relative as relative15, resolve as resolve20 } from "node:path";
|
|
88381
88429
|
|
|
88382
88430
|
class FileScanner2 {
|
|
88383
88431
|
static async getFiles(dirPath, relativeTo) {
|
|
@@ -88393,7 +88441,7 @@ class FileScanner2 {
|
|
|
88393
88441
|
logger.debug(`Skipping directory: ${entry}`);
|
|
88394
88442
|
continue;
|
|
88395
88443
|
}
|
|
88396
|
-
const fullPath =
|
|
88444
|
+
const fullPath = join88(dirPath, entry);
|
|
88397
88445
|
if (!FileScanner2.isSafePath(basePath, fullPath)) {
|
|
88398
88446
|
logger.warning(`Skipping potentially unsafe path: ${entry}`);
|
|
88399
88447
|
continue;
|
|
@@ -88428,8 +88476,8 @@ class FileScanner2 {
|
|
|
88428
88476
|
return files;
|
|
88429
88477
|
}
|
|
88430
88478
|
static async findCustomFiles(destDir, sourceDir, subPath) {
|
|
88431
|
-
const destSubDir =
|
|
88432
|
-
const sourceSubDir =
|
|
88479
|
+
const destSubDir = join88(destDir, subPath);
|
|
88480
|
+
const sourceSubDir = join88(sourceDir, subPath);
|
|
88433
88481
|
logger.debug(`findCustomFiles - destDir: ${destDir}`);
|
|
88434
88482
|
logger.debug(`findCustomFiles - sourceDir: ${sourceDir}`);
|
|
88435
88483
|
logger.debug(`findCustomFiles - subPath: "${subPath}"`);
|
|
@@ -88470,12 +88518,12 @@ class FileScanner2 {
|
|
|
88470
88518
|
init_logger();
|
|
88471
88519
|
var import_fs_extra17 = __toESM(require_lib3(), 1);
|
|
88472
88520
|
import { lstat as lstat7, mkdir as mkdir27, readdir as readdir21, stat as stat15 } from "node:fs/promises";
|
|
88473
|
-
import { join as
|
|
88521
|
+
import { join as join90 } from "node:path";
|
|
88474
88522
|
|
|
88475
88523
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
88476
88524
|
init_logger();
|
|
88477
88525
|
import { readFile as readFile42, readdir as readdir20, writeFile as writeFile26 } from "node:fs/promises";
|
|
88478
|
-
import { join as
|
|
88526
|
+
import { join as join89 } from "node:path";
|
|
88479
88527
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
88480
88528
|
".md",
|
|
88481
88529
|
".txt",
|
|
@@ -88536,7 +88584,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
88536
88584
|
async function processDirectory(dir) {
|
|
88537
88585
|
const entries = await readdir20(dir, { withFileTypes: true });
|
|
88538
88586
|
for (const entry of entries) {
|
|
88539
|
-
const fullPath =
|
|
88587
|
+
const fullPath = join89(dir, entry.name);
|
|
88540
88588
|
if (entry.isDirectory()) {
|
|
88541
88589
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
88542
88590
|
continue;
|
|
@@ -88611,14 +88659,14 @@ function shouldApplyPrefix(options2) {
|
|
|
88611
88659
|
// src/services/transformers/commands-prefix/prefix-applier.ts
|
|
88612
88660
|
async function applyPrefix(extractDir) {
|
|
88613
88661
|
validatePath(extractDir, "extractDir");
|
|
88614
|
-
const commandsDir =
|
|
88662
|
+
const commandsDir = join90(extractDir, ".claude", "commands");
|
|
88615
88663
|
if (!await import_fs_extra17.pathExists(commandsDir)) {
|
|
88616
88664
|
logger.verbose("No commands directory found, skipping prefix application");
|
|
88617
88665
|
return;
|
|
88618
88666
|
}
|
|
88619
88667
|
logger.info("Applying /ck: prefix to slash commands...");
|
|
88620
|
-
const backupDir =
|
|
88621
|
-
const tempDir =
|
|
88668
|
+
const backupDir = join90(extractDir, ".commands-backup");
|
|
88669
|
+
const tempDir = join90(extractDir, ".commands-prefix-temp");
|
|
88622
88670
|
try {
|
|
88623
88671
|
const entries = await readdir21(commandsDir);
|
|
88624
88672
|
if (entries.length === 0) {
|
|
@@ -88626,7 +88674,7 @@ async function applyPrefix(extractDir) {
|
|
|
88626
88674
|
return;
|
|
88627
88675
|
}
|
|
88628
88676
|
if (entries.length === 1 && entries[0] === "ck") {
|
|
88629
|
-
const ckDir2 =
|
|
88677
|
+
const ckDir2 = join90(commandsDir, "ck");
|
|
88630
88678
|
const ckStat = await stat15(ckDir2);
|
|
88631
88679
|
if (ckStat.isDirectory()) {
|
|
88632
88680
|
logger.verbose("Commands already have /ck: prefix, skipping");
|
|
@@ -88636,17 +88684,17 @@ async function applyPrefix(extractDir) {
|
|
|
88636
88684
|
await import_fs_extra17.copy(commandsDir, backupDir);
|
|
88637
88685
|
logger.verbose("Created backup of commands directory");
|
|
88638
88686
|
await mkdir27(tempDir, { recursive: true });
|
|
88639
|
-
const ckDir =
|
|
88687
|
+
const ckDir = join90(tempDir, "ck");
|
|
88640
88688
|
await mkdir27(ckDir, { recursive: true });
|
|
88641
88689
|
let processedCount = 0;
|
|
88642
88690
|
for (const entry of entries) {
|
|
88643
|
-
const sourcePath =
|
|
88691
|
+
const sourcePath = join90(commandsDir, entry);
|
|
88644
88692
|
const stats = await lstat7(sourcePath);
|
|
88645
88693
|
if (stats.isSymbolicLink()) {
|
|
88646
88694
|
logger.warning(`Skipping symlink for security: ${entry}`);
|
|
88647
88695
|
continue;
|
|
88648
88696
|
}
|
|
88649
|
-
const destPath =
|
|
88697
|
+
const destPath = join90(ckDir, entry);
|
|
88650
88698
|
await import_fs_extra17.copy(sourcePath, destPath, {
|
|
88651
88699
|
overwrite: false,
|
|
88652
88700
|
errorOnExist: true
|
|
@@ -88664,7 +88712,7 @@ async function applyPrefix(extractDir) {
|
|
|
88664
88712
|
await import_fs_extra17.move(tempDir, commandsDir);
|
|
88665
88713
|
await import_fs_extra17.remove(backupDir);
|
|
88666
88714
|
logger.success("Successfully reorganized commands to /ck: prefix");
|
|
88667
|
-
const claudeDir2 =
|
|
88715
|
+
const claudeDir2 = join90(extractDir, ".claude");
|
|
88668
88716
|
logger.info("Transforming command references in file contents...");
|
|
88669
88717
|
const transformResult = await transformCommandReferences(claudeDir2, {
|
|
88670
88718
|
verbose: logger.isVerbose()
|
|
@@ -88702,20 +88750,20 @@ async function applyPrefix(extractDir) {
|
|
|
88702
88750
|
// src/services/transformers/commands-prefix/prefix-cleaner.ts
|
|
88703
88751
|
init_metadata_migration();
|
|
88704
88752
|
import { lstat as lstat9, readdir as readdir23 } from "node:fs/promises";
|
|
88705
|
-
import { join as
|
|
88753
|
+
import { join as join92 } from "node:path";
|
|
88706
88754
|
init_logger();
|
|
88707
88755
|
var import_fs_extra19 = __toESM(require_lib3(), 1);
|
|
88708
88756
|
|
|
88709
88757
|
// src/services/transformers/commands-prefix/file-processor.ts
|
|
88710
88758
|
import { lstat as lstat8, readdir as readdir22 } from "node:fs/promises";
|
|
88711
|
-
import { join as
|
|
88759
|
+
import { join as join91 } from "node:path";
|
|
88712
88760
|
init_logger();
|
|
88713
88761
|
var import_fs_extra18 = __toESM(require_lib3(), 1);
|
|
88714
88762
|
async function scanDirectoryFiles(dir) {
|
|
88715
88763
|
const files = [];
|
|
88716
88764
|
const entries = await readdir22(dir);
|
|
88717
88765
|
for (const entry of entries) {
|
|
88718
|
-
const fullPath =
|
|
88766
|
+
const fullPath = join91(dir, entry);
|
|
88719
88767
|
const stats = await lstat8(fullPath);
|
|
88720
88768
|
if (stats.isSymbolicLink()) {
|
|
88721
88769
|
continue;
|
|
@@ -88843,8 +88891,8 @@ function isDifferentKitDirectory(dirName, currentKit) {
|
|
|
88843
88891
|
async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
88844
88892
|
const { dryRun = false } = options2;
|
|
88845
88893
|
validatePath(targetDir, "targetDir");
|
|
88846
|
-
const claudeDir2 = isGlobal ? targetDir :
|
|
88847
|
-
const commandsDir =
|
|
88894
|
+
const claudeDir2 = isGlobal ? targetDir : join92(targetDir, ".claude");
|
|
88895
|
+
const commandsDir = join92(claudeDir2, "commands");
|
|
88848
88896
|
const accumulator = {
|
|
88849
88897
|
results: [],
|
|
88850
88898
|
deletedCount: 0,
|
|
@@ -88886,7 +88934,7 @@ async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
|
88886
88934
|
}
|
|
88887
88935
|
const metadataForChecks = options2.kitType ? createKitSpecificMetadata(metadata, options2.kitType) : metadata;
|
|
88888
88936
|
for (const entry of entries) {
|
|
88889
|
-
const entryPath =
|
|
88937
|
+
const entryPath = join92(commandsDir, entry);
|
|
88890
88938
|
const stats = await lstat9(entryPath);
|
|
88891
88939
|
if (stats.isSymbolicLink()) {
|
|
88892
88940
|
addSymlinkSkip(entry, accumulator);
|
|
@@ -88943,7 +88991,7 @@ async function handleMerge(ctx) {
|
|
|
88943
88991
|
let customClaudeFiles = [];
|
|
88944
88992
|
if (!ctx.options.fresh) {
|
|
88945
88993
|
logger.info("Scanning for custom .claude files...");
|
|
88946
|
-
const scanSourceDir = ctx.options.global ?
|
|
88994
|
+
const scanSourceDir = ctx.options.global ? join93(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
88947
88995
|
const scanTargetSubdir = ctx.options.global ? "" : ".claude";
|
|
88948
88996
|
customClaudeFiles = await FileScanner2.findCustomFiles(ctx.resolvedDir, scanSourceDir, scanTargetSubdir);
|
|
88949
88997
|
} else {
|
|
@@ -89008,8 +89056,8 @@ async function handleMerge(ctx) {
|
|
|
89008
89056
|
return { ...ctx, cancelled: true };
|
|
89009
89057
|
}
|
|
89010
89058
|
}
|
|
89011
|
-
const sourceDir = ctx.options.global ?
|
|
89012
|
-
const sourceMetadataPath = ctx.options.global ?
|
|
89059
|
+
const sourceDir = ctx.options.global ? join93(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
89060
|
+
const sourceMetadataPath = ctx.options.global ? join93(sourceDir, "metadata.json") : join93(sourceDir, ".claude", "metadata.json");
|
|
89013
89061
|
let sourceMetadata = null;
|
|
89014
89062
|
try {
|
|
89015
89063
|
if (await import_fs_extra20.pathExists(sourceMetadataPath)) {
|
|
@@ -89066,7 +89114,7 @@ async function handleMerge(ctx) {
|
|
|
89066
89114
|
};
|
|
89067
89115
|
}
|
|
89068
89116
|
// src/commands/init/phases/migration-handler.ts
|
|
89069
|
-
import { join as
|
|
89117
|
+
import { join as join101 } from "node:path";
|
|
89070
89118
|
|
|
89071
89119
|
// src/domains/skills/skills-detector.ts
|
|
89072
89120
|
init_logger();
|
|
@@ -89082,7 +89130,7 @@ init_types3();
|
|
|
89082
89130
|
var import_fs_extra21 = __toESM(require_lib3(), 1);
|
|
89083
89131
|
import { createHash as createHash4 } from "node:crypto";
|
|
89084
89132
|
import { readFile as readFile44, readdir as readdir24, writeFile as writeFile27 } from "node:fs/promises";
|
|
89085
|
-
import { join as
|
|
89133
|
+
import { join as join94, relative as relative16 } from "node:path";
|
|
89086
89134
|
|
|
89087
89135
|
class SkillsManifestManager {
|
|
89088
89136
|
static MANIFEST_FILENAME = ".skills-manifest.json";
|
|
@@ -89104,12 +89152,12 @@ class SkillsManifestManager {
|
|
|
89104
89152
|
return manifest;
|
|
89105
89153
|
}
|
|
89106
89154
|
static async writeManifest(skillsDir2, manifest) {
|
|
89107
|
-
const manifestPath =
|
|
89155
|
+
const manifestPath = join94(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
89108
89156
|
await writeFile27(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
89109
89157
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
89110
89158
|
}
|
|
89111
89159
|
static async readManifest(skillsDir2) {
|
|
89112
|
-
const manifestPath =
|
|
89160
|
+
const manifestPath = join94(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
89113
89161
|
if (!await import_fs_extra21.pathExists(manifestPath)) {
|
|
89114
89162
|
logger.debug(`No manifest found at: ${manifestPath}`);
|
|
89115
89163
|
return null;
|
|
@@ -89132,7 +89180,7 @@ class SkillsManifestManager {
|
|
|
89132
89180
|
return "flat";
|
|
89133
89181
|
}
|
|
89134
89182
|
for (const dir of dirs.slice(0, 3)) {
|
|
89135
|
-
const dirPath =
|
|
89183
|
+
const dirPath = join94(skillsDir2, dir.name);
|
|
89136
89184
|
const subEntries = await readdir24(dirPath, { withFileTypes: true });
|
|
89137
89185
|
const hasSubdirs = subEntries.some((entry) => entry.isDirectory());
|
|
89138
89186
|
if (hasSubdirs) {
|
|
@@ -89151,7 +89199,7 @@ class SkillsManifestManager {
|
|
|
89151
89199
|
const entries = await readdir24(skillsDir2, { withFileTypes: true });
|
|
89152
89200
|
for (const entry of entries) {
|
|
89153
89201
|
if (entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith(".")) {
|
|
89154
|
-
const skillPath =
|
|
89202
|
+
const skillPath = join94(skillsDir2, entry.name);
|
|
89155
89203
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
89156
89204
|
skills.push({
|
|
89157
89205
|
name: entry.name,
|
|
@@ -89163,11 +89211,11 @@ class SkillsManifestManager {
|
|
|
89163
89211
|
const categories = await readdir24(skillsDir2, { withFileTypes: true });
|
|
89164
89212
|
for (const category of categories) {
|
|
89165
89213
|
if (category.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(category.name) && !category.name.startsWith(".")) {
|
|
89166
|
-
const categoryPath =
|
|
89214
|
+
const categoryPath = join94(skillsDir2, category.name);
|
|
89167
89215
|
const skillEntries = await readdir24(categoryPath, { withFileTypes: true });
|
|
89168
89216
|
for (const skillEntry of skillEntries) {
|
|
89169
89217
|
if (skillEntry.isDirectory() && !skillEntry.name.startsWith(".")) {
|
|
89170
|
-
const skillPath =
|
|
89218
|
+
const skillPath = join94(categoryPath, skillEntry.name);
|
|
89171
89219
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
89172
89220
|
skills.push({
|
|
89173
89221
|
name: skillEntry.name,
|
|
@@ -89197,7 +89245,7 @@ class SkillsManifestManager {
|
|
|
89197
89245
|
const files = [];
|
|
89198
89246
|
const entries = await readdir24(dirPath, { withFileTypes: true });
|
|
89199
89247
|
for (const entry of entries) {
|
|
89200
|
-
const fullPath =
|
|
89248
|
+
const fullPath = join94(dirPath, entry.name);
|
|
89201
89249
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name)) {
|
|
89202
89250
|
continue;
|
|
89203
89251
|
}
|
|
@@ -89319,7 +89367,7 @@ function getPathMapping(skillName, oldBasePath, newBasePath) {
|
|
|
89319
89367
|
// src/domains/skills/detection/script-detector.ts
|
|
89320
89368
|
var import_fs_extra22 = __toESM(require_lib3(), 1);
|
|
89321
89369
|
import { readdir as readdir25 } from "node:fs/promises";
|
|
89322
|
-
import { join as
|
|
89370
|
+
import { join as join95 } from "node:path";
|
|
89323
89371
|
async function scanDirectory(skillsDir2) {
|
|
89324
89372
|
if (!await import_fs_extra22.pathExists(skillsDir2)) {
|
|
89325
89373
|
return ["flat", []];
|
|
@@ -89332,12 +89380,12 @@ async function scanDirectory(skillsDir2) {
|
|
|
89332
89380
|
let totalSkillLikeCount = 0;
|
|
89333
89381
|
const allSkills = [];
|
|
89334
89382
|
for (const dir of dirs) {
|
|
89335
|
-
const dirPath =
|
|
89383
|
+
const dirPath = join95(skillsDir2, dir.name);
|
|
89336
89384
|
const subEntries = await readdir25(dirPath, { withFileTypes: true });
|
|
89337
89385
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
89338
89386
|
if (subdirs.length > 0) {
|
|
89339
89387
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
89340
|
-
const subdirPath =
|
|
89388
|
+
const subdirPath = join95(dirPath, subdir.name);
|
|
89341
89389
|
const subdirFiles = await readdir25(subdirPath, { withFileTypes: true });
|
|
89342
89390
|
const hasSkillMarker = subdirFiles.some((file) => file.isFile() && (file.name === "skill.md" || file.name === "README.md" || file.name === "readme.md" || file.name === "config.json" || file.name === "package.json"));
|
|
89343
89391
|
if (hasSkillMarker) {
|
|
@@ -89494,12 +89542,12 @@ class SkillsMigrationDetector {
|
|
|
89494
89542
|
// src/domains/skills/skills-migrator.ts
|
|
89495
89543
|
init_logger();
|
|
89496
89544
|
init_types3();
|
|
89497
|
-
import { join as
|
|
89545
|
+
import { join as join100 } from "node:path";
|
|
89498
89546
|
|
|
89499
89547
|
// src/domains/skills/migrator/migration-executor.ts
|
|
89500
89548
|
init_logger();
|
|
89501
89549
|
import { copyFile as copyFile6, mkdir as mkdir28, readdir as readdir26, rm as rm10 } from "node:fs/promises";
|
|
89502
|
-
import { join as
|
|
89550
|
+
import { join as join96 } from "node:path";
|
|
89503
89551
|
var import_fs_extra24 = __toESM(require_lib3(), 1);
|
|
89504
89552
|
|
|
89505
89553
|
// src/domains/skills/skills-migration-prompts.ts
|
|
@@ -89664,8 +89712,8 @@ async function copySkillDirectory(sourceDir, destDir) {
|
|
|
89664
89712
|
await mkdir28(destDir, { recursive: true });
|
|
89665
89713
|
const entries = await readdir26(sourceDir, { withFileTypes: true });
|
|
89666
89714
|
for (const entry of entries) {
|
|
89667
|
-
const sourcePath =
|
|
89668
|
-
const destPath =
|
|
89715
|
+
const sourcePath = join96(sourceDir, entry.name);
|
|
89716
|
+
const destPath = join96(destDir, entry.name);
|
|
89669
89717
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
89670
89718
|
continue;
|
|
89671
89719
|
}
|
|
@@ -89680,7 +89728,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
89680
89728
|
const migrated = [];
|
|
89681
89729
|
const preserved = [];
|
|
89682
89730
|
const errors2 = [];
|
|
89683
|
-
const tempDir =
|
|
89731
|
+
const tempDir = join96(currentSkillsDir, "..", ".skills-migration-temp");
|
|
89684
89732
|
await mkdir28(tempDir, { recursive: true });
|
|
89685
89733
|
try {
|
|
89686
89734
|
for (const mapping of mappings) {
|
|
@@ -89701,9 +89749,9 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
89701
89749
|
}
|
|
89702
89750
|
}
|
|
89703
89751
|
const category = mapping.category;
|
|
89704
|
-
const targetPath = category ?
|
|
89752
|
+
const targetPath = category ? join96(tempDir, category, skillName) : join96(tempDir, skillName);
|
|
89705
89753
|
if (category) {
|
|
89706
|
-
await mkdir28(
|
|
89754
|
+
await mkdir28(join96(tempDir, category), { recursive: true });
|
|
89707
89755
|
}
|
|
89708
89756
|
await copySkillDirectory(currentSkillPath, targetPath);
|
|
89709
89757
|
migrated.push(skillName);
|
|
@@ -89770,7 +89818,7 @@ init_logger();
|
|
|
89770
89818
|
init_types3();
|
|
89771
89819
|
var import_fs_extra25 = __toESM(require_lib3(), 1);
|
|
89772
89820
|
import { copyFile as copyFile7, mkdir as mkdir29, readdir as readdir27, rm as rm11, stat as stat16 } from "node:fs/promises";
|
|
89773
|
-
import { basename as basename15, join as
|
|
89821
|
+
import { basename as basename15, join as join97, normalize as normalize8 } from "node:path";
|
|
89774
89822
|
function validatePath2(path14, paramName) {
|
|
89775
89823
|
if (!path14 || typeof path14 !== "string") {
|
|
89776
89824
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -89796,7 +89844,7 @@ class SkillsBackupManager {
|
|
|
89796
89844
|
const timestamp = Date.now();
|
|
89797
89845
|
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
|
89798
89846
|
const backupDirName = `${SkillsBackupManager.BACKUP_PREFIX}${timestamp}-${randomSuffix}`;
|
|
89799
|
-
const backupDir = parentDir ?
|
|
89847
|
+
const backupDir = parentDir ? join97(parentDir, backupDirName) : join97(skillsDir2, "..", backupDirName);
|
|
89800
89848
|
logger.info(`Creating backup at: ${backupDir}`);
|
|
89801
89849
|
try {
|
|
89802
89850
|
await mkdir29(backupDir, { recursive: true });
|
|
@@ -89847,7 +89895,7 @@ class SkillsBackupManager {
|
|
|
89847
89895
|
}
|
|
89848
89896
|
try {
|
|
89849
89897
|
const entries = await readdir27(parentDir, { withFileTypes: true });
|
|
89850
|
-
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) =>
|
|
89898
|
+
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) => join97(parentDir, entry.name));
|
|
89851
89899
|
backups.sort().reverse();
|
|
89852
89900
|
return backups;
|
|
89853
89901
|
} catch (error) {
|
|
@@ -89875,8 +89923,8 @@ class SkillsBackupManager {
|
|
|
89875
89923
|
static async copyDirectory(sourceDir, destDir) {
|
|
89876
89924
|
const entries = await readdir27(sourceDir, { withFileTypes: true });
|
|
89877
89925
|
for (const entry of entries) {
|
|
89878
|
-
const sourcePath =
|
|
89879
|
-
const destPath =
|
|
89926
|
+
const sourcePath = join97(sourceDir, entry.name);
|
|
89927
|
+
const destPath = join97(destDir, entry.name);
|
|
89880
89928
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
89881
89929
|
continue;
|
|
89882
89930
|
}
|
|
@@ -89892,7 +89940,7 @@ class SkillsBackupManager {
|
|
|
89892
89940
|
let size = 0;
|
|
89893
89941
|
const entries = await readdir27(dirPath, { withFileTypes: true });
|
|
89894
89942
|
for (const entry of entries) {
|
|
89895
|
-
const fullPath =
|
|
89943
|
+
const fullPath = join97(dirPath, entry.name);
|
|
89896
89944
|
if (entry.isSymbolicLink()) {
|
|
89897
89945
|
continue;
|
|
89898
89946
|
}
|
|
@@ -89928,12 +89976,12 @@ init_skip_directories();
|
|
|
89928
89976
|
import { createHash as createHash5 } from "node:crypto";
|
|
89929
89977
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
89930
89978
|
import { readFile as readFile45, readdir as readdir28 } from "node:fs/promises";
|
|
89931
|
-
import { join as
|
|
89979
|
+
import { join as join98, relative as relative17 } from "node:path";
|
|
89932
89980
|
async function getAllFiles(dirPath) {
|
|
89933
89981
|
const files = [];
|
|
89934
89982
|
const entries = await readdir28(dirPath, { withFileTypes: true });
|
|
89935
89983
|
for (const entry of entries) {
|
|
89936
|
-
const fullPath =
|
|
89984
|
+
const fullPath = join98(dirPath, entry.name);
|
|
89937
89985
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name) || entry.isSymbolicLink()) {
|
|
89938
89986
|
continue;
|
|
89939
89987
|
}
|
|
@@ -90060,7 +90108,7 @@ async function detectFileChanges(currentSkillPath, baselineSkillPath) {
|
|
|
90060
90108
|
init_types3();
|
|
90061
90109
|
var import_fs_extra27 = __toESM(require_lib3(), 1);
|
|
90062
90110
|
import { readdir as readdir29 } from "node:fs/promises";
|
|
90063
|
-
import { join as
|
|
90111
|
+
import { join as join99, normalize as normalize9 } from "node:path";
|
|
90064
90112
|
function validatePath3(path14, paramName) {
|
|
90065
90113
|
if (!path14 || typeof path14 !== "string") {
|
|
90066
90114
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -90081,13 +90129,13 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
90081
90129
|
if (dirs.length === 0) {
|
|
90082
90130
|
return ["flat", []];
|
|
90083
90131
|
}
|
|
90084
|
-
const firstDirPath =
|
|
90132
|
+
const firstDirPath = join99(skillsDir2, dirs[0].name);
|
|
90085
90133
|
const subEntries = await readdir29(firstDirPath, { withFileTypes: true });
|
|
90086
90134
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
90087
90135
|
if (subdirs.length > 0) {
|
|
90088
90136
|
let skillLikeCount = 0;
|
|
90089
90137
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
90090
|
-
const subdirPath =
|
|
90138
|
+
const subdirPath = join99(firstDirPath, subdir.name);
|
|
90091
90139
|
const subdirFiles = await readdir29(subdirPath, { withFileTypes: true });
|
|
90092
90140
|
const hasSkillMarker = subdirFiles.some((file) => file.isFile() && (file.name === "skill.md" || file.name === "README.md" || file.name === "readme.md" || file.name === "config.json" || file.name === "package.json"));
|
|
90093
90141
|
if (hasSkillMarker) {
|
|
@@ -90097,7 +90145,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
90097
90145
|
if (skillLikeCount > 0) {
|
|
90098
90146
|
const skills = [];
|
|
90099
90147
|
for (const dir of dirs) {
|
|
90100
|
-
const categoryPath =
|
|
90148
|
+
const categoryPath = join99(skillsDir2, dir.name);
|
|
90101
90149
|
const skillDirs = await readdir29(categoryPath, { withFileTypes: true });
|
|
90102
90150
|
skills.push(...skillDirs.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name));
|
|
90103
90151
|
}
|
|
@@ -90107,7 +90155,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
90107
90155
|
return ["flat", dirs.map((dir) => dir.name)];
|
|
90108
90156
|
}
|
|
90109
90157
|
async function findSkillPath(skillsDir2, skillName) {
|
|
90110
|
-
const flatPath =
|
|
90158
|
+
const flatPath = join99(skillsDir2, skillName);
|
|
90111
90159
|
if (await import_fs_extra27.pathExists(flatPath)) {
|
|
90112
90160
|
return { path: flatPath, category: undefined };
|
|
90113
90161
|
}
|
|
@@ -90116,8 +90164,8 @@ async function findSkillPath(skillsDir2, skillName) {
|
|
|
90116
90164
|
if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
90117
90165
|
continue;
|
|
90118
90166
|
}
|
|
90119
|
-
const categoryPath =
|
|
90120
|
-
const skillPath =
|
|
90167
|
+
const categoryPath = join99(skillsDir2, entry.name);
|
|
90168
|
+
const skillPath = join99(categoryPath, skillName);
|
|
90121
90169
|
if (await import_fs_extra27.pathExists(skillPath)) {
|
|
90122
90170
|
return { path: skillPath, category: entry.name };
|
|
90123
90171
|
}
|
|
@@ -90211,7 +90259,7 @@ class SkillsMigrator {
|
|
|
90211
90259
|
}
|
|
90212
90260
|
}
|
|
90213
90261
|
if (options2.backup && !options2.dryRun) {
|
|
90214
|
-
const claudeDir2 =
|
|
90262
|
+
const claudeDir2 = join100(currentSkillsDir, "..");
|
|
90215
90263
|
result.backupPath = await SkillsBackupManager.createBackup(currentSkillsDir, claudeDir2);
|
|
90216
90264
|
logger.success(`Backup created at: ${result.backupPath}`);
|
|
90217
90265
|
}
|
|
@@ -90272,7 +90320,7 @@ async function handleMigration(ctx) {
|
|
|
90272
90320
|
logger.debug("Skipping skills migration (fresh installation)");
|
|
90273
90321
|
return ctx;
|
|
90274
90322
|
}
|
|
90275
|
-
const newSkillsDir =
|
|
90323
|
+
const newSkillsDir = join101(ctx.extractDir, ".claude", "skills");
|
|
90276
90324
|
const currentSkillsDir = PathResolver.buildSkillsPath(ctx.resolvedDir, ctx.options.global);
|
|
90277
90325
|
if (!await import_fs_extra28.pathExists(newSkillsDir) || !await import_fs_extra28.pathExists(currentSkillsDir)) {
|
|
90278
90326
|
return ctx;
|
|
@@ -90296,13 +90344,13 @@ async function handleMigration(ctx) {
|
|
|
90296
90344
|
}
|
|
90297
90345
|
// src/commands/init/phases/opencode-handler.ts
|
|
90298
90346
|
import { cp as cp3, readdir as readdir31, rm as rm12 } from "node:fs/promises";
|
|
90299
|
-
import { join as
|
|
90347
|
+
import { join as join103 } from "node:path";
|
|
90300
90348
|
|
|
90301
90349
|
// src/services/transformers/opencode-path-transformer.ts
|
|
90302
90350
|
init_logger();
|
|
90303
90351
|
import { readFile as readFile46, readdir as readdir30, writeFile as writeFile28 } from "node:fs/promises";
|
|
90304
90352
|
import { platform as platform12 } from "node:os";
|
|
90305
|
-
import { extname as extname6, join as
|
|
90353
|
+
import { extname as extname6, join as join102 } from "node:path";
|
|
90306
90354
|
var IS_WINDOWS2 = platform12() === "win32";
|
|
90307
90355
|
function getOpenCodeGlobalPath() {
|
|
90308
90356
|
return "$HOME/.config/opencode/";
|
|
@@ -90363,7 +90411,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
90363
90411
|
async function processDirectory2(dir) {
|
|
90364
90412
|
const entries = await readdir30(dir, { withFileTypes: true });
|
|
90365
90413
|
for (const entry of entries) {
|
|
90366
|
-
const fullPath =
|
|
90414
|
+
const fullPath = join102(dir, entry.name);
|
|
90367
90415
|
if (entry.isDirectory()) {
|
|
90368
90416
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
90369
90417
|
continue;
|
|
@@ -90402,7 +90450,7 @@ async function handleOpenCode(ctx) {
|
|
|
90402
90450
|
if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir) {
|
|
90403
90451
|
return ctx;
|
|
90404
90452
|
}
|
|
90405
|
-
const openCodeSource =
|
|
90453
|
+
const openCodeSource = join103(ctx.extractDir, ".opencode");
|
|
90406
90454
|
if (!await import_fs_extra29.pathExists(openCodeSource)) {
|
|
90407
90455
|
logger.debug("No .opencode directory in archive, skipping");
|
|
90408
90456
|
return ctx;
|
|
@@ -90420,8 +90468,8 @@ async function handleOpenCode(ctx) {
|
|
|
90420
90468
|
await import_fs_extra29.ensureDir(targetDir);
|
|
90421
90469
|
const entries = await readdir31(openCodeSource, { withFileTypes: true });
|
|
90422
90470
|
for (const entry of entries) {
|
|
90423
|
-
const sourcePath =
|
|
90424
|
-
const targetPath =
|
|
90471
|
+
const sourcePath = join103(openCodeSource, entry.name);
|
|
90472
|
+
const targetPath = join103(targetDir, entry.name);
|
|
90425
90473
|
if (await import_fs_extra29.pathExists(targetPath)) {
|
|
90426
90474
|
if (!ctx.options.forceOverwrite) {
|
|
90427
90475
|
logger.verbose(`Skipping existing: ${entry.name}`);
|
|
@@ -90518,7 +90566,7 @@ Please use only one download method.`);
|
|
|
90518
90566
|
}
|
|
90519
90567
|
// src/commands/init/phases/post-install-handler.ts
|
|
90520
90568
|
init_projects_registry();
|
|
90521
|
-
import { join as
|
|
90569
|
+
import { join as join104 } from "node:path";
|
|
90522
90570
|
init_logger();
|
|
90523
90571
|
init_path_resolver();
|
|
90524
90572
|
var import_fs_extra30 = __toESM(require_lib3(), 1);
|
|
@@ -90527,8 +90575,8 @@ async function handlePostInstall(ctx) {
|
|
|
90527
90575
|
return ctx;
|
|
90528
90576
|
}
|
|
90529
90577
|
if (ctx.options.global) {
|
|
90530
|
-
const claudeMdSource =
|
|
90531
|
-
const claudeMdDest =
|
|
90578
|
+
const claudeMdSource = join104(ctx.extractDir, "CLAUDE.md");
|
|
90579
|
+
const claudeMdDest = join104(ctx.resolvedDir, "CLAUDE.md");
|
|
90532
90580
|
if (await import_fs_extra30.pathExists(claudeMdSource)) {
|
|
90533
90581
|
if (ctx.options.fresh || !await import_fs_extra30.pathExists(claudeMdDest)) {
|
|
90534
90582
|
await import_fs_extra30.copy(claudeMdSource, claudeMdDest);
|
|
@@ -90576,7 +90624,7 @@ async function handlePostInstall(ctx) {
|
|
|
90576
90624
|
}
|
|
90577
90625
|
if (!ctx.options.skipSetup) {
|
|
90578
90626
|
await promptSetupWizardIfNeeded({
|
|
90579
|
-
envPath:
|
|
90627
|
+
envPath: join104(ctx.claudeDir, ".env"),
|
|
90580
90628
|
claudeDir: ctx.claudeDir,
|
|
90581
90629
|
isGlobal: ctx.options.global,
|
|
90582
90630
|
isNonInteractive: ctx.isNonInteractive,
|
|
@@ -90600,7 +90648,7 @@ async function handlePostInstall(ctx) {
|
|
|
90600
90648
|
init_config_manager();
|
|
90601
90649
|
init_github_client();
|
|
90602
90650
|
import { mkdir as mkdir30 } from "node:fs/promises";
|
|
90603
|
-
import { join as
|
|
90651
|
+
import { join as join106, resolve as resolve22 } from "node:path";
|
|
90604
90652
|
|
|
90605
90653
|
// src/domains/github/kit-access-checker.ts
|
|
90606
90654
|
init_logger();
|
|
@@ -90731,7 +90779,7 @@ async function runPreflightChecks() {
|
|
|
90731
90779
|
// src/domains/installation/fresh-installer.ts
|
|
90732
90780
|
init_metadata_migration();
|
|
90733
90781
|
import { existsSync as existsSync55, readdirSync as readdirSync5, rmSync as rmSync4, rmdirSync as rmdirSync2, unlinkSync as unlinkSync4 } from "node:fs";
|
|
90734
|
-
import { dirname as dirname27, join as
|
|
90782
|
+
import { dirname as dirname27, join as join105, resolve as resolve21 } from "node:path";
|
|
90735
90783
|
init_logger();
|
|
90736
90784
|
init_safe_spinner();
|
|
90737
90785
|
var import_fs_extra31 = __toESM(require_lib3(), 1);
|
|
@@ -90804,7 +90852,7 @@ async function removeFilesByOwnership(claudeDir2, analysis, includeModified) {
|
|
|
90804
90852
|
const filesToRemove = includeModified ? [...analysis.ckFiles, ...analysis.ckModifiedFiles] : analysis.ckFiles;
|
|
90805
90853
|
const filesToPreserve = includeModified ? analysis.userFiles : [...analysis.ckModifiedFiles, ...analysis.userFiles];
|
|
90806
90854
|
for (const file of filesToRemove) {
|
|
90807
|
-
const fullPath =
|
|
90855
|
+
const fullPath = join105(claudeDir2, file.path);
|
|
90808
90856
|
try {
|
|
90809
90857
|
if (existsSync55(fullPath)) {
|
|
90810
90858
|
unlinkSync4(fullPath);
|
|
@@ -90829,7 +90877,7 @@ async function removeFilesByOwnership(claudeDir2, analysis, includeModified) {
|
|
|
90829
90877
|
};
|
|
90830
90878
|
}
|
|
90831
90879
|
async function updateMetadataAfterFresh(claudeDir2, removedFiles) {
|
|
90832
|
-
const metadataPath =
|
|
90880
|
+
const metadataPath = join105(claudeDir2, "metadata.json");
|
|
90833
90881
|
if (!await import_fs_extra31.pathExists(metadataPath)) {
|
|
90834
90882
|
return;
|
|
90835
90883
|
}
|
|
@@ -90872,7 +90920,7 @@ async function removeSubdirectoriesFallback(claudeDir2) {
|
|
|
90872
90920
|
const removedFiles = [];
|
|
90873
90921
|
let removedDirCount = 0;
|
|
90874
90922
|
for (const subdir of CLAUDEKIT_SUBDIRECTORIES) {
|
|
90875
|
-
const subdirPath =
|
|
90923
|
+
const subdirPath = join105(claudeDir2, subdir);
|
|
90876
90924
|
if (await import_fs_extra31.pathExists(subdirPath)) {
|
|
90877
90925
|
rmSync4(subdirPath, { recursive: true, force: true });
|
|
90878
90926
|
removedDirCount++;
|
|
@@ -90880,7 +90928,7 @@ async function removeSubdirectoriesFallback(claudeDir2) {
|
|
|
90880
90928
|
logger.debug(`Removed subdirectory: ${subdir}/`);
|
|
90881
90929
|
}
|
|
90882
90930
|
}
|
|
90883
|
-
const metadataPath =
|
|
90931
|
+
const metadataPath = join105(claudeDir2, "metadata.json");
|
|
90884
90932
|
if (await import_fs_extra31.pathExists(metadataPath)) {
|
|
90885
90933
|
unlinkSync4(metadataPath);
|
|
90886
90934
|
removedFiles.push("metadata.json");
|
|
@@ -91132,7 +91180,7 @@ async function handleSelection(ctx) {
|
|
|
91132
91180
|
}
|
|
91133
91181
|
if (!ctx.options.fresh) {
|
|
91134
91182
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
91135
|
-
const claudeDir2 = prefix ?
|
|
91183
|
+
const claudeDir2 = prefix ? join106(resolvedDir, prefix) : resolvedDir;
|
|
91136
91184
|
try {
|
|
91137
91185
|
const existingMetadata = await readManifest(claudeDir2);
|
|
91138
91186
|
if (existingMetadata?.kits) {
|
|
@@ -91164,7 +91212,7 @@ async function handleSelection(ctx) {
|
|
|
91164
91212
|
}
|
|
91165
91213
|
if (ctx.options.fresh) {
|
|
91166
91214
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
91167
|
-
const claudeDir2 = prefix ?
|
|
91215
|
+
const claudeDir2 = prefix ? join106(resolvedDir, prefix) : resolvedDir;
|
|
91168
91216
|
const canProceed = await handleFreshInstallation(claudeDir2, ctx.prompts);
|
|
91169
91217
|
if (!canProceed) {
|
|
91170
91218
|
return { ...ctx, cancelled: true };
|
|
@@ -91183,7 +91231,7 @@ async function handleSelection(ctx) {
|
|
|
91183
91231
|
logger.info("Fetching available versions...");
|
|
91184
91232
|
let currentVersion = null;
|
|
91185
91233
|
try {
|
|
91186
|
-
const metadataPath = ctx.options.global ?
|
|
91234
|
+
const metadataPath = ctx.options.global ? join106(PathResolver.getGlobalKitDir(), "metadata.json") : join106(resolvedDir, ".claude", "metadata.json");
|
|
91187
91235
|
const metadata = await readClaudeKitMetadata(metadataPath);
|
|
91188
91236
|
currentVersion = metadata?.version || null;
|
|
91189
91237
|
if (currentVersion) {
|
|
@@ -91258,7 +91306,7 @@ async function handleSelection(ctx) {
|
|
|
91258
91306
|
}
|
|
91259
91307
|
// src/commands/init/phases/sync-handler.ts
|
|
91260
91308
|
import { copyFile as copyFile8, mkdir as mkdir31, open as open4, readFile as readFile48, rename as rename6, stat as stat17, unlink as unlink11, writeFile as writeFile30 } from "node:fs/promises";
|
|
91261
|
-
import { dirname as dirname28, join as
|
|
91309
|
+
import { dirname as dirname28, join as join107, resolve as resolve23 } from "node:path";
|
|
91262
91310
|
init_logger();
|
|
91263
91311
|
init_path_resolver();
|
|
91264
91312
|
var import_fs_extra33 = __toESM(require_lib3(), 1);
|
|
@@ -91268,13 +91316,13 @@ async function handleSync(ctx) {
|
|
|
91268
91316
|
return ctx;
|
|
91269
91317
|
}
|
|
91270
91318
|
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve23(ctx.options.dir || ".");
|
|
91271
|
-
const claudeDir2 = ctx.options.global ? resolvedDir :
|
|
91319
|
+
const claudeDir2 = ctx.options.global ? resolvedDir : join107(resolvedDir, ".claude");
|
|
91272
91320
|
if (!await import_fs_extra33.pathExists(claudeDir2)) {
|
|
91273
91321
|
logger.error("Cannot sync: no .claude directory found");
|
|
91274
91322
|
ctx.prompts.note("Run 'ck init' without --sync to install first.", "No Installation Found");
|
|
91275
91323
|
return { ...ctx, cancelled: true };
|
|
91276
91324
|
}
|
|
91277
|
-
const metadataPath =
|
|
91325
|
+
const metadataPath = join107(claudeDir2, "metadata.json");
|
|
91278
91326
|
if (!await import_fs_extra33.pathExists(metadataPath)) {
|
|
91279
91327
|
logger.error("Cannot sync: no metadata.json found");
|
|
91280
91328
|
ctx.prompts.note(`Your installation may be from an older version.
|
|
@@ -91374,7 +91422,7 @@ function getLockTimeout() {
|
|
|
91374
91422
|
var STALE_LOCK_THRESHOLD_MS = 5 * 60 * 1000;
|
|
91375
91423
|
async function acquireSyncLock(global3) {
|
|
91376
91424
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
91377
|
-
const lockPath =
|
|
91425
|
+
const lockPath = join107(cacheDir, ".sync-lock");
|
|
91378
91426
|
const startTime = Date.now();
|
|
91379
91427
|
const lockTimeout = getLockTimeout();
|
|
91380
91428
|
await mkdir31(dirname28(lockPath), { recursive: true });
|
|
@@ -91420,10 +91468,10 @@ async function executeSyncMerge(ctx) {
|
|
|
91420
91468
|
const releaseLock = await acquireSyncLock(ctx.options.global);
|
|
91421
91469
|
try {
|
|
91422
91470
|
const trackedFiles = ctx.syncTrackedFiles;
|
|
91423
|
-
const upstreamDir = ctx.options.global ?
|
|
91471
|
+
const upstreamDir = ctx.options.global ? join107(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
91424
91472
|
let deletions = [];
|
|
91425
91473
|
try {
|
|
91426
|
-
const sourceMetadataPath =
|
|
91474
|
+
const sourceMetadataPath = join107(upstreamDir, "metadata.json");
|
|
91427
91475
|
if (await import_fs_extra33.pathExists(sourceMetadataPath)) {
|
|
91428
91476
|
const content = await readFile48(sourceMetadataPath, "utf-8");
|
|
91429
91477
|
const sourceMetadata = JSON.parse(content);
|
|
@@ -91455,7 +91503,7 @@ async function executeSyncMerge(ctx) {
|
|
|
91455
91503
|
try {
|
|
91456
91504
|
const sourcePath = await validateSyncPath(upstreamDir, file.path);
|
|
91457
91505
|
const targetPath = await validateSyncPath(ctx.claudeDir, file.path);
|
|
91458
|
-
const targetDir =
|
|
91506
|
+
const targetDir = join107(targetPath, "..");
|
|
91459
91507
|
try {
|
|
91460
91508
|
await mkdir31(targetDir, { recursive: true });
|
|
91461
91509
|
} catch (mkdirError) {
|
|
@@ -91626,7 +91674,7 @@ async function createBackup(claudeDir2, files, backupDir) {
|
|
|
91626
91674
|
const sourcePath = await validateSyncPath(claudeDir2, file.path);
|
|
91627
91675
|
if (await import_fs_extra33.pathExists(sourcePath)) {
|
|
91628
91676
|
const targetPath = await validateSyncPath(backupDir, file.path);
|
|
91629
|
-
const targetDir =
|
|
91677
|
+
const targetDir = join107(targetPath, "..");
|
|
91630
91678
|
await mkdir31(targetDir, { recursive: true });
|
|
91631
91679
|
await copyFile8(sourcePath, targetPath);
|
|
91632
91680
|
}
|
|
@@ -91641,7 +91689,7 @@ async function createBackup(claudeDir2, files, backupDir) {
|
|
|
91641
91689
|
}
|
|
91642
91690
|
// src/commands/init/phases/transform-handler.ts
|
|
91643
91691
|
init_config_manager();
|
|
91644
|
-
import { join as
|
|
91692
|
+
import { join as join111 } from "node:path";
|
|
91645
91693
|
|
|
91646
91694
|
// src/services/transformers/folder-path-transformer.ts
|
|
91647
91695
|
init_logger();
|
|
@@ -91652,38 +91700,38 @@ init_logger();
|
|
|
91652
91700
|
init_types3();
|
|
91653
91701
|
var import_fs_extra34 = __toESM(require_lib3(), 1);
|
|
91654
91702
|
import { rename as rename7, rm as rm13 } from "node:fs/promises";
|
|
91655
|
-
import { join as
|
|
91703
|
+
import { join as join108, relative as relative19 } from "node:path";
|
|
91656
91704
|
async function collectDirsToRename(extractDir, folders) {
|
|
91657
91705
|
const dirsToRename = [];
|
|
91658
91706
|
if (folders.docs !== DEFAULT_FOLDERS.docs) {
|
|
91659
|
-
const docsPath =
|
|
91707
|
+
const docsPath = join108(extractDir, DEFAULT_FOLDERS.docs);
|
|
91660
91708
|
if (await import_fs_extra34.pathExists(docsPath)) {
|
|
91661
91709
|
dirsToRename.push({
|
|
91662
91710
|
from: docsPath,
|
|
91663
|
-
to:
|
|
91711
|
+
to: join108(extractDir, folders.docs)
|
|
91664
91712
|
});
|
|
91665
91713
|
}
|
|
91666
|
-
const claudeDocsPath =
|
|
91714
|
+
const claudeDocsPath = join108(extractDir, ".claude", DEFAULT_FOLDERS.docs);
|
|
91667
91715
|
if (await import_fs_extra34.pathExists(claudeDocsPath)) {
|
|
91668
91716
|
dirsToRename.push({
|
|
91669
91717
|
from: claudeDocsPath,
|
|
91670
|
-
to:
|
|
91718
|
+
to: join108(extractDir, ".claude", folders.docs)
|
|
91671
91719
|
});
|
|
91672
91720
|
}
|
|
91673
91721
|
}
|
|
91674
91722
|
if (folders.plans !== DEFAULT_FOLDERS.plans) {
|
|
91675
|
-
const plansPath =
|
|
91723
|
+
const plansPath = join108(extractDir, DEFAULT_FOLDERS.plans);
|
|
91676
91724
|
if (await import_fs_extra34.pathExists(plansPath)) {
|
|
91677
91725
|
dirsToRename.push({
|
|
91678
91726
|
from: plansPath,
|
|
91679
|
-
to:
|
|
91727
|
+
to: join108(extractDir, folders.plans)
|
|
91680
91728
|
});
|
|
91681
91729
|
}
|
|
91682
|
-
const claudePlansPath =
|
|
91730
|
+
const claudePlansPath = join108(extractDir, ".claude", DEFAULT_FOLDERS.plans);
|
|
91683
91731
|
if (await import_fs_extra34.pathExists(claudePlansPath)) {
|
|
91684
91732
|
dirsToRename.push({
|
|
91685
91733
|
from: claudePlansPath,
|
|
91686
|
-
to:
|
|
91734
|
+
to: join108(extractDir, ".claude", folders.plans)
|
|
91687
91735
|
});
|
|
91688
91736
|
}
|
|
91689
91737
|
}
|
|
@@ -91724,7 +91772,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
91724
91772
|
init_logger();
|
|
91725
91773
|
init_types3();
|
|
91726
91774
|
import { readFile as readFile49, readdir as readdir32, writeFile as writeFile31 } from "node:fs/promises";
|
|
91727
|
-
import { join as
|
|
91775
|
+
import { join as join109, relative as relative20 } from "node:path";
|
|
91728
91776
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
91729
91777
|
".md",
|
|
91730
91778
|
".txt",
|
|
@@ -91777,7 +91825,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
91777
91825
|
let replacementsCount = 0;
|
|
91778
91826
|
const entries = await readdir32(dir, { withFileTypes: true });
|
|
91779
91827
|
for (const entry of entries) {
|
|
91780
|
-
const fullPath =
|
|
91828
|
+
const fullPath = join109(dir, entry.name);
|
|
91781
91829
|
if (entry.isDirectory()) {
|
|
91782
91830
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
91783
91831
|
continue;
|
|
@@ -91914,7 +91962,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
91914
91962
|
init_logger();
|
|
91915
91963
|
import { readFile as readFile50, readdir as readdir33, writeFile as writeFile32 } from "node:fs/promises";
|
|
91916
91964
|
import { platform as platform13 } from "node:os";
|
|
91917
|
-
import { extname as extname7, join as
|
|
91965
|
+
import { extname as extname7, join as join110 } from "node:path";
|
|
91918
91966
|
var IS_WINDOWS3 = platform13() === "win32";
|
|
91919
91967
|
var HOME_PREFIX = IS_WINDOWS3 ? "%USERPROFILE%" : "$HOME";
|
|
91920
91968
|
function getHomeDirPrefix() {
|
|
@@ -92024,7 +92072,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
92024
92072
|
async function processDirectory2(dir) {
|
|
92025
92073
|
const entries = await readdir33(dir, { withFileTypes: true });
|
|
92026
92074
|
for (const entry of entries) {
|
|
92027
|
-
const fullPath =
|
|
92075
|
+
const fullPath = join110(dir, entry.name);
|
|
92028
92076
|
if (entry.isDirectory()) {
|
|
92029
92077
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
92030
92078
|
continue;
|
|
@@ -92100,7 +92148,7 @@ async function handleTransforms(ctx) {
|
|
|
92100
92148
|
logger.debug(ctx.options.global ? "Saved folder configuration to ~/.claude/.ck.json" : "Saved folder configuration to .claude/.ck.json");
|
|
92101
92149
|
}
|
|
92102
92150
|
}
|
|
92103
|
-
const claudeDir2 = ctx.options.global ? ctx.resolvedDir :
|
|
92151
|
+
const claudeDir2 = ctx.options.global ? ctx.resolvedDir : join111(ctx.resolvedDir, ".claude");
|
|
92104
92152
|
return {
|
|
92105
92153
|
...ctx,
|
|
92106
92154
|
foldersConfig,
|
|
@@ -92290,8 +92338,8 @@ init_dist2();
|
|
|
92290
92338
|
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
92291
92339
|
import { existsSync as existsSync56 } from "node:fs";
|
|
92292
92340
|
import { readFile as readFile51, rm as rm14, unlink as unlink12 } from "node:fs/promises";
|
|
92293
|
-
import { homedir as
|
|
92294
|
-
import { basename as basename16, join as
|
|
92341
|
+
import { homedir as homedir29 } from "node:os";
|
|
92342
|
+
import { basename as basename16, join as join112, resolve as resolve24 } from "node:path";
|
|
92295
92343
|
init_logger();
|
|
92296
92344
|
init_agents_discovery();
|
|
92297
92345
|
init_commands_discovery();
|
|
@@ -92712,7 +92760,7 @@ async function executeDeleteAction(action, options2) {
|
|
|
92712
92760
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
92713
92761
|
if (!skillSourcePath)
|
|
92714
92762
|
return;
|
|
92715
|
-
const sourceMetadataPath =
|
|
92763
|
+
const sourceMetadataPath = join112(resolve24(skillSourcePath, ".."), "metadata.json");
|
|
92716
92764
|
if (!existsSync56(sourceMetadataPath))
|
|
92717
92765
|
return;
|
|
92718
92766
|
let sourceMetadata;
|
|
@@ -92725,7 +92773,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
92725
92773
|
}
|
|
92726
92774
|
if (!sourceMetadata.deletions || sourceMetadata.deletions.length === 0)
|
|
92727
92775
|
return;
|
|
92728
|
-
const claudeDir2 = installGlobally ?
|
|
92776
|
+
const claudeDir2 = installGlobally ? join112(homedir29(), ".claude") : join112(process.cwd(), ".claude");
|
|
92729
92777
|
if (!existsSync56(claudeDir2))
|
|
92730
92778
|
return;
|
|
92731
92779
|
try {
|
|
@@ -92748,11 +92796,12 @@ async function migrateCommand(options2) {
|
|
|
92748
92796
|
const commandSource = scope.commands ? getCommandSourcePath() : null;
|
|
92749
92797
|
const skillSource = scope.skills ? getSkillSourcePath() : null;
|
|
92750
92798
|
const hooksSource = scope.hooks ? getHooksSourcePath() : null;
|
|
92799
|
+
const rulesSourcePath = scope.rules ? getRulesSourcePath() : null;
|
|
92751
92800
|
const agents2 = agentSource ? await discoverAgents(agentSource) : [];
|
|
92752
92801
|
const commands = commandSource ? await discoverCommands(commandSource) : [];
|
|
92753
92802
|
const skills = skillSource ? await discoverSkills(skillSource) : [];
|
|
92754
92803
|
const configItem = scope.config ? await discoverConfig(options2.source) : null;
|
|
92755
|
-
const ruleItems =
|
|
92804
|
+
const ruleItems = rulesSourcePath ? await discoverRules(rulesSourcePath) : [];
|
|
92756
92805
|
const { items: hookItems, skippedShellHooks } = hooksSource ? await discoverHooks(hooksSource) : { items: [], skippedShellHooks: [] };
|
|
92757
92806
|
if (skippedShellHooks.length > 0) {
|
|
92758
92807
|
logger.warning(`[migrate] Skipping ${skippedShellHooks.length} shell hook(s) not supported for migration (node-runnable only): ${skippedShellHooks.join(", ")}`);
|
|
@@ -92761,23 +92810,36 @@ async function migrateCommand(options2) {
|
|
|
92761
92810
|
const hasItems = agents2.length > 0 || commands.length > 0 || skills.length > 0 || configItem !== null || ruleItems.length > 0 || hookItems.length > 0;
|
|
92762
92811
|
if (!hasItems) {
|
|
92763
92812
|
f2.error("Nothing to migrate.");
|
|
92764
|
-
f2.info(import_picocolors25.default.dim("Check
|
|
92813
|
+
f2.info(import_picocolors25.default.dim("Check .claude/agents/, .claude/commands/, .claude/skills/, .claude/rules/, .claude/hooks/, and CLAUDE.md (project or ~/.claude/)"));
|
|
92765
92814
|
$e(import_picocolors25.default.red("Nothing to migrate"));
|
|
92766
92815
|
return;
|
|
92767
92816
|
}
|
|
92817
|
+
f2.info(import_picocolors25.default.dim(` CWD: ${process.cwd()}`));
|
|
92768
92818
|
const parts = [];
|
|
92769
|
-
if (agents2.length > 0)
|
|
92770
|
-
|
|
92771
|
-
|
|
92772
|
-
|
|
92773
|
-
if (
|
|
92774
|
-
|
|
92775
|
-
|
|
92776
|
-
|
|
92777
|
-
if (
|
|
92778
|
-
|
|
92779
|
-
|
|
92780
|
-
|
|
92819
|
+
if (agents2.length > 0) {
|
|
92820
|
+
const origin = resolveSourceOrigin(agentSource);
|
|
92821
|
+
parts.push(`${agents2.length} agent(s) ${import_picocolors25.default.dim(`<- ${origin}`)}`);
|
|
92822
|
+
}
|
|
92823
|
+
if (commands.length > 0) {
|
|
92824
|
+
const origin = resolveSourceOrigin(commandSource);
|
|
92825
|
+
parts.push(`${commands.length} command(s) ${import_picocolors25.default.dim(`<- ${origin}`)}`);
|
|
92826
|
+
}
|
|
92827
|
+
if (skills.length > 0) {
|
|
92828
|
+
const origin = resolveSourceOrigin(skillSource);
|
|
92829
|
+
parts.push(`${skills.length} skill(s) ${import_picocolors25.default.dim(`<- ${origin}`)}`);
|
|
92830
|
+
}
|
|
92831
|
+
if (configItem) {
|
|
92832
|
+
const origin = resolveSourceOrigin(configItem.sourcePath);
|
|
92833
|
+
parts.push(`config ${import_picocolors25.default.dim(`<- ${origin}`)}`);
|
|
92834
|
+
}
|
|
92835
|
+
if (ruleItems.length > 0) {
|
|
92836
|
+
const origin = resolveSourceOrigin(rulesSourcePath);
|
|
92837
|
+
parts.push(`${ruleItems.length} rule(s) ${import_picocolors25.default.dim(`<- ${origin}`)}`);
|
|
92838
|
+
}
|
|
92839
|
+
if (hookItems.length > 0) {
|
|
92840
|
+
const origin = resolveSourceOrigin(hooksSource);
|
|
92841
|
+
parts.push(`${hookItems.length} hook(s) ${import_picocolors25.default.dim(`<- ${origin}`)}`);
|
|
92842
|
+
}
|
|
92781
92843
|
f2.info(`Found: ${parts.join(", ")}`);
|
|
92782
92844
|
const detectedProviders = await detectInstalledProviders();
|
|
92783
92845
|
let selectedProviders;
|
|
@@ -92859,18 +92921,20 @@ async function migrateCommand(options2) {
|
|
|
92859
92921
|
selectedProviders = Array.from(new Set(selectedProviders));
|
|
92860
92922
|
let installGlobally = options2.global ?? false;
|
|
92861
92923
|
if (options2.global === undefined && !options2.yes) {
|
|
92924
|
+
const projectTarget = join112(process.cwd(), ".claude");
|
|
92925
|
+
const globalTarget = join112(homedir29(), ".claude");
|
|
92862
92926
|
const scopeChoice = await ie({
|
|
92863
92927
|
message: "Installation scope",
|
|
92864
92928
|
options: [
|
|
92865
92929
|
{
|
|
92866
92930
|
value: false,
|
|
92867
92931
|
label: "Project",
|
|
92868
|
-
hint:
|
|
92932
|
+
hint: `-> ${projectTarget}`
|
|
92869
92933
|
},
|
|
92870
92934
|
{
|
|
92871
92935
|
value: true,
|
|
92872
92936
|
label: "Global",
|
|
92873
|
-
hint:
|
|
92937
|
+
hint: `-> ${globalTarget}`
|
|
92874
92938
|
}
|
|
92875
92939
|
]
|
|
92876
92940
|
});
|
|
@@ -92910,7 +92974,8 @@ async function migrateCommand(options2) {
|
|
|
92910
92974
|
}
|
|
92911
92975
|
const providerNames = selectedProviders.map((prov) => import_picocolors25.default.cyan(providers[prov].displayName)).join(", ");
|
|
92912
92976
|
f2.message(` Providers: ${providerNames}`);
|
|
92913
|
-
|
|
92977
|
+
const targetDir = installGlobally ? join112(homedir29(), ".claude") : join112(process.cwd(), ".claude");
|
|
92978
|
+
f2.message(` Scope: ${installGlobally ? "Global" : "Project"} ${import_picocolors25.default.dim(`-> ${targetDir}`)}`);
|
|
92914
92979
|
const cmdProviders = getProvidersSupporting("commands");
|
|
92915
92980
|
const unsupportedCmd = selectedProviders.filter((pv) => !cmdProviders.includes(pv));
|
|
92916
92981
|
if (commands.length > 0 && unsupportedCmd.length > 0) {
|
|
@@ -93413,7 +93478,7 @@ async function handleDirectorySetup(ctx) {
|
|
|
93413
93478
|
// src/commands/new/phases/project-creation.ts
|
|
93414
93479
|
init_config_manager();
|
|
93415
93480
|
init_github_client();
|
|
93416
|
-
import { join as
|
|
93481
|
+
import { join as join113 } from "node:path";
|
|
93417
93482
|
init_logger();
|
|
93418
93483
|
init_output_manager();
|
|
93419
93484
|
init_types3();
|
|
@@ -93539,7 +93604,7 @@ async function projectCreation(kit, resolvedDir, validOptions, isNonInteractive2
|
|
|
93539
93604
|
output.section("Installing");
|
|
93540
93605
|
logger.verbose("Installation target", { directory: resolvedDir });
|
|
93541
93606
|
const merger = new FileMerger;
|
|
93542
|
-
const claudeDir2 =
|
|
93607
|
+
const claudeDir2 = join113(resolvedDir, ".claude");
|
|
93543
93608
|
merger.setMultiKitContext(claudeDir2, kit);
|
|
93544
93609
|
if (validOptions.exclude && validOptions.exclude.length > 0) {
|
|
93545
93610
|
merger.addIgnorePatterns(validOptions.exclude);
|
|
@@ -93586,7 +93651,7 @@ async function handleProjectCreation(ctx) {
|
|
|
93586
93651
|
}
|
|
93587
93652
|
// src/commands/new/phases/post-setup.ts
|
|
93588
93653
|
init_projects_registry();
|
|
93589
|
-
import { join as
|
|
93654
|
+
import { join as join114 } from "node:path";
|
|
93590
93655
|
init_package_installer();
|
|
93591
93656
|
init_logger();
|
|
93592
93657
|
init_path_resolver();
|
|
@@ -93618,9 +93683,9 @@ async function postSetup(resolvedDir, validOptions, isNonInteractive2, prompts)
|
|
|
93618
93683
|
withSudo: validOptions.withSudo
|
|
93619
93684
|
});
|
|
93620
93685
|
}
|
|
93621
|
-
const claudeDir2 =
|
|
93686
|
+
const claudeDir2 = join114(resolvedDir, ".claude");
|
|
93622
93687
|
await promptSetupWizardIfNeeded({
|
|
93623
|
-
envPath:
|
|
93688
|
+
envPath: join114(claudeDir2, ".env"),
|
|
93624
93689
|
claudeDir: claudeDir2,
|
|
93625
93690
|
isGlobal: false,
|
|
93626
93691
|
isNonInteractive: isNonInteractive2,
|
|
@@ -93690,7 +93755,7 @@ Please use only one download method.`);
|
|
|
93690
93755
|
// src/commands/plan/plan-command.ts
|
|
93691
93756
|
init_output_manager();
|
|
93692
93757
|
import { existsSync as existsSync58, statSync as statSync8 } from "node:fs";
|
|
93693
|
-
import { dirname as dirname30, join as
|
|
93758
|
+
import { dirname as dirname30, join as join116, parse as parse6, resolve as resolve28 } from "node:path";
|
|
93694
93759
|
|
|
93695
93760
|
// src/commands/plan/plan-read-handlers.ts
|
|
93696
93761
|
init_plan_parser();
|
|
@@ -93698,7 +93763,7 @@ init_logger();
|
|
|
93698
93763
|
init_output_manager();
|
|
93699
93764
|
var import_picocolors27 = __toESM(require_picocolors(), 1);
|
|
93700
93765
|
import { existsSync as existsSync57, statSync as statSync7 } from "node:fs";
|
|
93701
|
-
import { basename as basename17, dirname as dirname29, join as
|
|
93766
|
+
import { basename as basename17, dirname as dirname29, join as join115, relative as relative21, resolve as resolve26 } from "node:path";
|
|
93702
93767
|
async function handleParse(target, options2) {
|
|
93703
93768
|
const planFile = resolvePlanFile(target);
|
|
93704
93769
|
if (!planFile) {
|
|
@@ -93774,7 +93839,7 @@ async function handleValidate(target, options2) {
|
|
|
93774
93839
|
}
|
|
93775
93840
|
async function handleStatus(target, options2) {
|
|
93776
93841
|
const t = target ? resolve26(target) : null;
|
|
93777
|
-
const plansDir = t && existsSync57(t) && statSync7(t).isDirectory() && !existsSync57(
|
|
93842
|
+
const plansDir = t && existsSync57(t) && statSync7(t).isDirectory() && !existsSync57(join115(t, "plan.md")) ? t : null;
|
|
93778
93843
|
if (plansDir) {
|
|
93779
93844
|
const planFiles = scanPlanDir(plansDir);
|
|
93780
93845
|
if (planFiles.length === 0) {
|
|
@@ -94046,7 +94111,7 @@ function resolvePlanFile(target) {
|
|
|
94046
94111
|
const stat18 = statSync8(t);
|
|
94047
94112
|
if (stat18.isFile())
|
|
94048
94113
|
return t;
|
|
94049
|
-
const candidate =
|
|
94114
|
+
const candidate = join116(t, "plan.md");
|
|
94050
94115
|
if (existsSync58(candidate))
|
|
94051
94116
|
return candidate;
|
|
94052
94117
|
}
|
|
@@ -94054,7 +94119,7 @@ function resolvePlanFile(target) {
|
|
|
94054
94119
|
let dir = process.cwd();
|
|
94055
94120
|
const root = parse6(dir).root;
|
|
94056
94121
|
while (dir !== root) {
|
|
94057
|
-
const candidate =
|
|
94122
|
+
const candidate = join116(dir, "plan.md");
|
|
94058
94123
|
if (existsSync58(candidate))
|
|
94059
94124
|
return candidate;
|
|
94060
94125
|
dir = dirname30(dir);
|
|
@@ -95081,7 +95146,7 @@ async function detectInstallations() {
|
|
|
95081
95146
|
|
|
95082
95147
|
// src/commands/uninstall/removal-handler.ts
|
|
95083
95148
|
import { readdirSync as readdirSync7, rmSync as rmSync6 } from "node:fs";
|
|
95084
|
-
import { join as
|
|
95149
|
+
import { join as join118, resolve as resolve30, sep as sep7 } from "node:path";
|
|
95085
95150
|
init_logger();
|
|
95086
95151
|
init_safe_prompts();
|
|
95087
95152
|
init_safe_spinner();
|
|
@@ -95090,7 +95155,7 @@ var import_fs_extra37 = __toESM(require_lib3(), 1);
|
|
|
95090
95155
|
// src/commands/uninstall/analysis-handler.ts
|
|
95091
95156
|
init_metadata_migration();
|
|
95092
95157
|
import { readdirSync as readdirSync6, rmSync as rmSync5 } from "node:fs";
|
|
95093
|
-
import { dirname as dirname31, join as
|
|
95158
|
+
import { dirname as dirname31, join as join117 } from "node:path";
|
|
95094
95159
|
init_logger();
|
|
95095
95160
|
init_safe_prompts();
|
|
95096
95161
|
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
@@ -95138,7 +95203,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
95138
95203
|
if (uninstallManifest.isMultiKit && kit && metadata?.kits?.[kit]) {
|
|
95139
95204
|
const kitFiles = metadata.kits[kit].files || [];
|
|
95140
95205
|
for (const trackedFile of kitFiles) {
|
|
95141
|
-
const filePath =
|
|
95206
|
+
const filePath = join117(installation.path, trackedFile.path);
|
|
95142
95207
|
if (uninstallManifest.filesToPreserve.includes(trackedFile.path)) {
|
|
95143
95208
|
result.toPreserve.push({ path: trackedFile.path, reason: "shared with other kit" });
|
|
95144
95209
|
continue;
|
|
@@ -95168,7 +95233,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
95168
95233
|
return result;
|
|
95169
95234
|
}
|
|
95170
95235
|
for (const trackedFile of allTrackedFiles) {
|
|
95171
|
-
const filePath =
|
|
95236
|
+
const filePath = join117(installation.path, trackedFile.path);
|
|
95172
95237
|
const ownershipResult = await OwnershipChecker.checkOwnership(filePath, metadata, installation.path);
|
|
95173
95238
|
if (!ownershipResult.exists)
|
|
95174
95239
|
continue;
|
|
@@ -95224,7 +95289,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
|
|
|
95224
95289
|
try {
|
|
95225
95290
|
const resolvedPath = resolve30(filePath);
|
|
95226
95291
|
const resolvedBase = resolve30(baseDir);
|
|
95227
|
-
if (!resolvedPath.startsWith(resolvedBase +
|
|
95292
|
+
if (!resolvedPath.startsWith(resolvedBase + sep7) && resolvedPath !== resolvedBase) {
|
|
95228
95293
|
logger.debug(`Path outside installation directory: ${filePath}`);
|
|
95229
95294
|
return false;
|
|
95230
95295
|
}
|
|
@@ -95232,7 +95297,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
|
|
|
95232
95297
|
if (stats.isSymbolicLink()) {
|
|
95233
95298
|
const realPath = await import_fs_extra37.realpath(filePath);
|
|
95234
95299
|
const resolvedReal = resolve30(realPath);
|
|
95235
|
-
if (!resolvedReal.startsWith(resolvedBase +
|
|
95300
|
+
if (!resolvedReal.startsWith(resolvedBase + sep7) && resolvedReal !== resolvedBase) {
|
|
95236
95301
|
logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
|
|
95237
95302
|
return false;
|
|
95238
95303
|
}
|
|
@@ -95265,7 +95330,7 @@ async function removeInstallations(installations, options2) {
|
|
|
95265
95330
|
let removedCount = 0;
|
|
95266
95331
|
let cleanedDirs = 0;
|
|
95267
95332
|
for (const item of analysis.toDelete) {
|
|
95268
|
-
const filePath =
|
|
95333
|
+
const filePath = join118(installation.path, item.path);
|
|
95269
95334
|
if (!await import_fs_extra37.pathExists(filePath))
|
|
95270
95335
|
continue;
|
|
95271
95336
|
if (!await isPathSafeToRemove(filePath, installation.path)) {
|
|
@@ -95661,7 +95726,7 @@ init_logger();
|
|
|
95661
95726
|
init_path_resolver();
|
|
95662
95727
|
init_types3();
|
|
95663
95728
|
import { existsSync as existsSync60, readFileSync as readFileSync13 } from "node:fs";
|
|
95664
|
-
import { join as
|
|
95729
|
+
import { join as join119 } from "node:path";
|
|
95665
95730
|
var packageVersion = package_default.version;
|
|
95666
95731
|
function formatInstalledKits(metadata) {
|
|
95667
95732
|
if (!metadata.kits || Object.keys(metadata.kits).length === 0) {
|
|
@@ -95693,9 +95758,9 @@ async function displayVersion() {
|
|
|
95693
95758
|
let localKitVersion = null;
|
|
95694
95759
|
let isGlobalOnlyKit = false;
|
|
95695
95760
|
const globalKitDir = PathResolver.getGlobalKitDir();
|
|
95696
|
-
const globalMetadataPath =
|
|
95761
|
+
const globalMetadataPath = join119(globalKitDir, "metadata.json");
|
|
95697
95762
|
const prefix = PathResolver.getPathPrefix(false);
|
|
95698
|
-
const localMetadataPath = prefix ?
|
|
95763
|
+
const localMetadataPath = prefix ? join119(process.cwd(), prefix, "metadata.json") : join119(process.cwd(), "metadata.json");
|
|
95699
95764
|
const isLocalSameAsGlobal = localMetadataPath === globalMetadataPath;
|
|
95700
95765
|
if (!isLocalSameAsGlobal && existsSync60(localMetadataPath)) {
|
|
95701
95766
|
try {
|