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