claudekit-cli 3.41.3-dev.1 → 3.41.3-dev.2
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 +750 -672
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -44763,10 +44763,17 @@ function notFoundError(type, name, hint) {
|
|
|
44763
44763
|
}
|
|
44764
44764
|
|
|
44765
44765
|
// src/shared/command-normalizer.ts
|
|
44766
|
+
import { homedir as homedir12 } from "node:os";
|
|
44767
|
+
import { join as join20 } from "node:path";
|
|
44768
|
+
function escapeRegex(value) {
|
|
44769
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
44770
|
+
}
|
|
44766
44771
|
function normalizeCommand(cmd) {
|
|
44767
44772
|
if (!cmd)
|
|
44768
44773
|
return "";
|
|
44769
44774
|
let normalized = cmd;
|
|
44775
|
+
const globalKitDir = PathResolver.getGlobalKitDir().replace(/\\/g, "/").replace(/\/+$/, "");
|
|
44776
|
+
const defaultGlobalKitDir = join20(homedir12(), ".claude").replace(/\\/g, "/");
|
|
44770
44777
|
normalized = normalized.replace(/"/g, "");
|
|
44771
44778
|
normalized = normalized.replace(/~\//g, "$HOME/");
|
|
44772
44779
|
normalized = normalized.replace(/\$CLAUDE_PROJECT_DIR/g, "$HOME");
|
|
@@ -44775,9 +44782,17 @@ function normalizeCommand(cmd) {
|
|
|
44775
44782
|
normalized = normalized.replace(/%CLAUDE_PROJECT_DIR%/g, "$HOME");
|
|
44776
44783
|
normalized = normalized.replace(/(^|\s)(?:\.\/)?\.claude\//g, "$1$HOME/.claude/");
|
|
44777
44784
|
normalized = normalized.replace(/\\/g, "/");
|
|
44785
|
+
const globalPaths = [...new Set([globalKitDir, defaultGlobalKitDir].filter(Boolean))];
|
|
44786
|
+
for (const absoluteGlobalPath of globalPaths) {
|
|
44787
|
+
const absoluteGlobalPathPattern = new RegExp(escapeRegex(absoluteGlobalPath), "g");
|
|
44788
|
+
normalized = normalized.replace(absoluteGlobalPathPattern, "$HOME/.claude");
|
|
44789
|
+
}
|
|
44778
44790
|
normalized = normalized.replace(/\s+/g, " ").trim();
|
|
44779
44791
|
return normalized;
|
|
44780
44792
|
}
|
|
44793
|
+
var init_command_normalizer = __esm(() => {
|
|
44794
|
+
init_path_resolver();
|
|
44795
|
+
});
|
|
44781
44796
|
|
|
44782
44797
|
// src/shared/parse-timeout.ts
|
|
44783
44798
|
function parseTimeoutMs(rawValue, fallback2, min = 500, max = 60000) {
|
|
@@ -44807,6 +44822,7 @@ var init_shared = __esm(() => {
|
|
|
44807
44822
|
init_safe_spinner();
|
|
44808
44823
|
init_safe_prompts();
|
|
44809
44824
|
init_skip_directories();
|
|
44825
|
+
init_command_normalizer();
|
|
44810
44826
|
});
|
|
44811
44827
|
|
|
44812
44828
|
// src/domains/config/merger/diff-calculator.ts
|
|
@@ -45206,7 +45222,7 @@ var init_merge_engine = __esm(() => {
|
|
|
45206
45222
|
|
|
45207
45223
|
// src/domains/config/merger/file-io.ts
|
|
45208
45224
|
import { randomUUID } from "node:crypto";
|
|
45209
|
-
import { dirname as dirname6, join as
|
|
45225
|
+
import { dirname as dirname6, join as join21 } from "node:path";
|
|
45210
45226
|
function stripBOM(content) {
|
|
45211
45227
|
return content.charCodeAt(0) === 65279 ? content.slice(1) : content;
|
|
45212
45228
|
}
|
|
@@ -45230,7 +45246,7 @@ async function readSettingsFile(filePath) {
|
|
|
45230
45246
|
}
|
|
45231
45247
|
async function atomicWriteFile(filePath, content) {
|
|
45232
45248
|
const dir = dirname6(filePath);
|
|
45233
|
-
const tempPath =
|
|
45249
|
+
const tempPath = join21(dir, `.settings-${randomUUID()}.tmp`);
|
|
45234
45250
|
try {
|
|
45235
45251
|
await import_fs_extra4.writeFile(tempPath, content, "utf-8");
|
|
45236
45252
|
await import_fs_extra4.rename(tempPath, filePath);
|
|
@@ -45281,7 +45297,7 @@ var init_settings_merger = __esm(() => {
|
|
|
45281
45297
|
});
|
|
45282
45298
|
|
|
45283
45299
|
// src/domains/config/config-generator.ts
|
|
45284
|
-
import { join as
|
|
45300
|
+
import { join as join22 } from "node:path";
|
|
45285
45301
|
async function generateEnvFile(targetDir, values) {
|
|
45286
45302
|
const lines = [
|
|
45287
45303
|
"# Generated by ClaudeKit CLI setup wizard",
|
|
@@ -45323,7 +45339,7 @@ async function generateEnvFile(targetDir, values) {
|
|
|
45323
45339
|
for (const [key, value] of otherValues) {
|
|
45324
45340
|
lines.push(`${key}=${value}`);
|
|
45325
45341
|
}
|
|
45326
|
-
const envPath =
|
|
45342
|
+
const envPath = join22(targetDir, ".env");
|
|
45327
45343
|
await import_fs_extra5.writeFile(envPath, `${lines.join(`
|
|
45328
45344
|
`)}
|
|
45329
45345
|
`, { mode: 384 });
|
|
@@ -46947,8 +46963,8 @@ var init_chokidar = __esm(() => {
|
|
|
46947
46963
|
});
|
|
46948
46964
|
|
|
46949
46965
|
// src/domains/web-server/file-watcher.ts
|
|
46950
|
-
import { homedir as
|
|
46951
|
-
import { join as
|
|
46966
|
+
import { homedir as homedir13 } from "node:os";
|
|
46967
|
+
import { join as join25 } from "node:path";
|
|
46952
46968
|
|
|
46953
46969
|
class FileWatcher {
|
|
46954
46970
|
watcher = null;
|
|
@@ -46970,16 +46986,16 @@ class FileWatcher {
|
|
|
46970
46986
|
}
|
|
46971
46987
|
getWatchPaths() {
|
|
46972
46988
|
const paths = [];
|
|
46973
|
-
const globalDir =
|
|
46974
|
-
paths.push(
|
|
46975
|
-
const globalKitDir =
|
|
46976
|
-
paths.push(
|
|
46977
|
-
paths.push(
|
|
46978
|
-
paths.push(
|
|
46989
|
+
const globalDir = join25(homedir13(), ".claudekit");
|
|
46990
|
+
paths.push(join25(globalDir, "config.json"));
|
|
46991
|
+
const globalKitDir = join25(homedir13(), ".claude");
|
|
46992
|
+
paths.push(join25(globalKitDir, ".ck.json"));
|
|
46993
|
+
paths.push(join25(globalKitDir, "settings.json"));
|
|
46994
|
+
paths.push(join25(globalKitDir, "settings.local.json"));
|
|
46979
46995
|
const cwd2 = process.cwd();
|
|
46980
|
-
paths.push(
|
|
46981
|
-
paths.push(
|
|
46982
|
-
paths.push(
|
|
46996
|
+
paths.push(join25(cwd2, ".claude", ".ck.json"));
|
|
46997
|
+
paths.push(join25(cwd2, ".claude", "settings.json"));
|
|
46998
|
+
paths.push(join25(cwd2, ".claude", "settings.local.json"));
|
|
46983
46999
|
return paths;
|
|
46984
47000
|
}
|
|
46985
47001
|
handleFileChange(path3, type) {
|
|
@@ -47022,8 +47038,8 @@ class FileWatcher {
|
|
|
47022
47038
|
return path3.endsWith("config.json") || path3.endsWith(".ck.json") || path3.endsWith("settings.json") || path3.endsWith("settings.local.json");
|
|
47023
47039
|
}
|
|
47024
47040
|
getConfigScope(path3) {
|
|
47025
|
-
const globalDir =
|
|
47026
|
-
const globalKitDir =
|
|
47041
|
+
const globalDir = join25(homedir13(), ".claudekit");
|
|
47042
|
+
const globalKitDir = join25(homedir13(), ".claude");
|
|
47027
47043
|
return path3.startsWith(globalDir) || path3.startsWith(globalKitDir) ? "global" : "local";
|
|
47028
47044
|
}
|
|
47029
47045
|
stop() {
|
|
@@ -47416,14 +47432,14 @@ var init_projects_registry = __esm(() => {
|
|
|
47416
47432
|
|
|
47417
47433
|
// src/domains/claudekit-data/claude-projects-scanner.ts
|
|
47418
47434
|
import { existsSync as existsSync13, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
|
|
47419
|
-
import { join as
|
|
47435
|
+
import { join as join26 } from "node:path";
|
|
47420
47436
|
function extractProjectPath(claudeProjectDir) {
|
|
47421
47437
|
try {
|
|
47422
47438
|
const files = readdirSync2(claudeProjectDir);
|
|
47423
47439
|
const jsonlFile = files.find((f3) => f3.endsWith(".jsonl"));
|
|
47424
47440
|
if (!jsonlFile)
|
|
47425
47441
|
return null;
|
|
47426
|
-
const filePath =
|
|
47442
|
+
const filePath = join26(claudeProjectDir, jsonlFile);
|
|
47427
47443
|
const content = readFileSync5(filePath, "utf-8");
|
|
47428
47444
|
const lines = content.split(`
|
|
47429
47445
|
`).slice(0, 10);
|
|
@@ -47443,7 +47459,7 @@ function extractProjectPath(claudeProjectDir) {
|
|
|
47443
47459
|
}
|
|
47444
47460
|
}
|
|
47445
47461
|
function scanClaudeProjects() {
|
|
47446
|
-
const claudeProjectsDir =
|
|
47462
|
+
const claudeProjectsDir = join26(PathResolver.getGlobalKitDir(), "projects");
|
|
47447
47463
|
const now = Date.now();
|
|
47448
47464
|
if (cachedDiscoveredProjects && cachedDiscoveredProjects.expiresAt > now) {
|
|
47449
47465
|
return cachedDiscoveredProjects.projects;
|
|
@@ -47460,7 +47476,7 @@ function scanClaudeProjects() {
|
|
|
47460
47476
|
for (const entry of entries) {
|
|
47461
47477
|
if (!entry.isDirectory())
|
|
47462
47478
|
continue;
|
|
47463
|
-
const projectDirPath =
|
|
47479
|
+
const projectDirPath = join26(claudeProjectsDir, entry.name);
|
|
47464
47480
|
const projectPath = extractProjectPath(projectDirPath);
|
|
47465
47481
|
if (!projectPath) {
|
|
47466
47482
|
logger.debug(`Could not extract path from: ${entry.name}`);
|
|
@@ -47514,15 +47530,15 @@ var init_claudekit_data2 = __esm(() => {
|
|
|
47514
47530
|
// src/domains/web-server/routes/action-routes.ts
|
|
47515
47531
|
import { spawn, spawnSync } from "node:child_process";
|
|
47516
47532
|
import { existsSync as existsSync14 } from "node:fs";
|
|
47517
|
-
import { homedir as
|
|
47518
|
-
import { join as
|
|
47533
|
+
import { homedir as homedir14 } from "node:os";
|
|
47534
|
+
import { join as join27, resolve as resolve9, sep as sep4 } from "node:path";
|
|
47519
47535
|
function getWindowsPaths(...relativePaths) {
|
|
47520
47536
|
const roots = [
|
|
47521
47537
|
WINDOWS_PATHS.localAppData,
|
|
47522
47538
|
WINDOWS_PATHS.programFiles,
|
|
47523
47539
|
WINDOWS_PATHS.programFilesX86
|
|
47524
47540
|
];
|
|
47525
|
-
return roots.flatMap((root) => relativePaths.map((rel) =>
|
|
47541
|
+
return roots.flatMap((root) => relativePaths.map((rel) => join27(root, rel)));
|
|
47526
47542
|
}
|
|
47527
47543
|
function isCommandAvailable(command) {
|
|
47528
47544
|
const checkCommand = isWindows() ? "where" : "which";
|
|
@@ -47802,7 +47818,7 @@ async function isActionPathAllowed(dirPath, projectId) {
|
|
|
47802
47818
|
if (isPathInsideBase(dirPath, process.cwd())) {
|
|
47803
47819
|
return true;
|
|
47804
47820
|
}
|
|
47805
|
-
return isPathInsideBase(dirPath,
|
|
47821
|
+
return isPathInsideBase(dirPath, homedir14());
|
|
47806
47822
|
}
|
|
47807
47823
|
function buildSystemTerminalCommand(dirPath) {
|
|
47808
47824
|
if (isMacOS()) {
|
|
@@ -48141,7 +48157,7 @@ var init_action_routes = __esm(() => {
|
|
|
48141
48157
|
projectId: exports_external.string().min(1).max(256).optional()
|
|
48142
48158
|
}).strict();
|
|
48143
48159
|
WINDOWS_PATHS = {
|
|
48144
|
-
localAppData: process.env.LOCALAPPDATA ||
|
|
48160
|
+
localAppData: process.env.LOCALAPPDATA || join27(homedir14(), "AppData", "Local"),
|
|
48145
48161
|
programFiles: process.env.ProgramFiles || "C:\\Program Files",
|
|
48146
48162
|
programFilesX86: process.env["ProgramFiles(x86)"] || "C:\\Program Files (x86)"
|
|
48147
48163
|
};
|
|
@@ -48162,7 +48178,7 @@ var init_action_routes = __esm(() => {
|
|
|
48162
48178
|
openMode: "open-directory",
|
|
48163
48179
|
capabilities: ["open-directory", "run-command"],
|
|
48164
48180
|
macAppName: "iTerm",
|
|
48165
|
-
macAppPaths: ["/Applications/iTerm.app",
|
|
48181
|
+
macAppPaths: ["/Applications/iTerm.app", join27(homedir14(), "Applications", "iTerm.app")]
|
|
48166
48182
|
},
|
|
48167
48183
|
{
|
|
48168
48184
|
id: "warp",
|
|
@@ -48173,7 +48189,7 @@ var init_action_routes = __esm(() => {
|
|
|
48173
48189
|
capabilities: ["open-directory", "uri-scheme"],
|
|
48174
48190
|
commands: ["warp"],
|
|
48175
48191
|
macAppName: "Warp",
|
|
48176
|
-
macAppPaths: ["/Applications/Warp.app",
|
|
48192
|
+
macAppPaths: ["/Applications/Warp.app", join27(homedir14(), "Applications", "Warp.app")],
|
|
48177
48193
|
windowsAppPaths: getWindowsPaths("Warp\\Warp.exe"),
|
|
48178
48194
|
linuxAppPaths: ["/usr/bin/warp", "/usr/local/bin/warp"]
|
|
48179
48195
|
},
|
|
@@ -48185,7 +48201,7 @@ var init_action_routes = __esm(() => {
|
|
|
48185
48201
|
openMode: "open-directory",
|
|
48186
48202
|
capabilities: ["open-directory", "run-command"],
|
|
48187
48203
|
commands: ["wt"],
|
|
48188
|
-
windowsAppPaths: [
|
|
48204
|
+
windowsAppPaths: [join27(WINDOWS_PATHS.localAppData, "Microsoft", "WindowsApps", "wt.exe")]
|
|
48189
48205
|
},
|
|
48190
48206
|
{
|
|
48191
48207
|
id: "wezterm",
|
|
@@ -48196,7 +48212,7 @@ var init_action_routes = __esm(() => {
|
|
|
48196
48212
|
capabilities: ["open-directory"],
|
|
48197
48213
|
commands: ["wezterm"],
|
|
48198
48214
|
macAppName: "WezTerm",
|
|
48199
|
-
macAppPaths: ["/Applications/WezTerm.app",
|
|
48215
|
+
macAppPaths: ["/Applications/WezTerm.app", join27(homedir14(), "Applications", "WezTerm.app")],
|
|
48200
48216
|
windowsAppPaths: getWindowsPaths("WezTerm\\wezterm-gui.exe", "WezTerm\\wezterm.exe"),
|
|
48201
48217
|
linuxAppPaths: ["/usr/bin/wezterm", "/usr/local/bin/wezterm"]
|
|
48202
48218
|
},
|
|
@@ -48209,7 +48225,7 @@ var init_action_routes = __esm(() => {
|
|
|
48209
48225
|
capabilities: ["open-directory"],
|
|
48210
48226
|
commands: ["kitty"],
|
|
48211
48227
|
macAppName: "kitty",
|
|
48212
|
-
macAppPaths: ["/Applications/kitty.app",
|
|
48228
|
+
macAppPaths: ["/Applications/kitty.app", join27(homedir14(), "Applications", "kitty.app")],
|
|
48213
48229
|
windowsAppPaths: getWindowsPaths("kitty\\kitty.exe"),
|
|
48214
48230
|
linuxAppPaths: ["/usr/bin/kitty", "/usr/local/bin/kitty"]
|
|
48215
48231
|
},
|
|
@@ -48222,7 +48238,7 @@ var init_action_routes = __esm(() => {
|
|
|
48222
48238
|
capabilities: ["open-directory"],
|
|
48223
48239
|
commands: ["alacritty"],
|
|
48224
48240
|
macAppName: "Alacritty",
|
|
48225
|
-
macAppPaths: ["/Applications/Alacritty.app",
|
|
48241
|
+
macAppPaths: ["/Applications/Alacritty.app", join27(homedir14(), "Applications", "Alacritty.app")],
|
|
48226
48242
|
windowsAppPaths: getWindowsPaths("Alacritty\\alacritty.exe"),
|
|
48227
48243
|
linuxAppPaths: ["/usr/bin/alacritty", "/usr/local/bin/alacritty"]
|
|
48228
48244
|
},
|
|
@@ -48295,7 +48311,7 @@ var init_action_routes = __esm(() => {
|
|
|
48295
48311
|
capabilities: ["open-app"],
|
|
48296
48312
|
commands: ["termius"],
|
|
48297
48313
|
macAppName: "Termius",
|
|
48298
|
-
macAppPaths: ["/Applications/Termius.app",
|
|
48314
|
+
macAppPaths: ["/Applications/Termius.app", join27(homedir14(), "Applications", "Termius.app")],
|
|
48299
48315
|
windowsAppPaths: getWindowsPaths("Termius\\Termius.exe"),
|
|
48300
48316
|
linuxAppPaths: ["/usr/bin/termius"]
|
|
48301
48317
|
},
|
|
@@ -48318,7 +48334,7 @@ var init_action_routes = __esm(() => {
|
|
|
48318
48334
|
macAppName: "Visual Studio Code",
|
|
48319
48335
|
macAppPaths: [
|
|
48320
48336
|
"/Applications/Visual Studio Code.app",
|
|
48321
|
-
|
|
48337
|
+
join27(homedir14(), "Applications", "Visual Studio Code.app")
|
|
48322
48338
|
],
|
|
48323
48339
|
windowsAppPaths: getWindowsPaths("Programs\\Microsoft VS Code\\Code.exe", "Microsoft VS Code\\Code.exe"),
|
|
48324
48340
|
linuxAppPaths: ["/usr/bin/code", "/snap/bin/code"]
|
|
@@ -48332,7 +48348,7 @@ var init_action_routes = __esm(() => {
|
|
|
48332
48348
|
capabilities: ["open-directory"],
|
|
48333
48349
|
commands: ["cursor"],
|
|
48334
48350
|
macAppName: "Cursor",
|
|
48335
|
-
macAppPaths: ["/Applications/Cursor.app",
|
|
48351
|
+
macAppPaths: ["/Applications/Cursor.app", join27(homedir14(), "Applications", "Cursor.app")],
|
|
48336
48352
|
windowsAppPaths: getWindowsPaths("Programs\\Cursor\\Cursor.exe", "Cursor\\Cursor.exe"),
|
|
48337
48353
|
linuxAppPaths: ["/usr/bin/cursor"]
|
|
48338
48354
|
},
|
|
@@ -48345,7 +48361,7 @@ var init_action_routes = __esm(() => {
|
|
|
48345
48361
|
capabilities: ["open-directory"],
|
|
48346
48362
|
commands: ["windsurf"],
|
|
48347
48363
|
macAppName: "Windsurf",
|
|
48348
|
-
macAppPaths: ["/Applications/Windsurf.app",
|
|
48364
|
+
macAppPaths: ["/Applications/Windsurf.app", join27(homedir14(), "Applications", "Windsurf.app")],
|
|
48349
48365
|
windowsAppPaths: getWindowsPaths("Programs\\Windsurf\\Windsurf.exe", "Windsurf\\Windsurf.exe"),
|
|
48350
48366
|
linuxAppPaths: ["/usr/bin/windsurf"]
|
|
48351
48367
|
},
|
|
@@ -48360,11 +48376,11 @@ var init_action_routes = __esm(() => {
|
|
|
48360
48376
|
macAppName: "Antigravity",
|
|
48361
48377
|
macAppPaths: [
|
|
48362
48378
|
"/Applications/Antigravity.app",
|
|
48363
|
-
|
|
48379
|
+
join27(homedir14(), "Applications", "Antigravity.app")
|
|
48364
48380
|
],
|
|
48365
48381
|
windowsAppPaths: getWindowsPaths("Programs\\Antigravity\\Antigravity.exe"),
|
|
48366
48382
|
linuxAppPaths: ["/usr/bin/antigravity"],
|
|
48367
|
-
fallbackDetectionPaths: [
|
|
48383
|
+
fallbackDetectionPaths: [join27(homedir14(), ".gemini", "antigravity")]
|
|
48368
48384
|
},
|
|
48369
48385
|
{
|
|
48370
48386
|
id: "zed",
|
|
@@ -48375,7 +48391,7 @@ var init_action_routes = __esm(() => {
|
|
|
48375
48391
|
capabilities: ["open-directory"],
|
|
48376
48392
|
commands: ["zed"],
|
|
48377
48393
|
macAppName: "Zed",
|
|
48378
|
-
macAppPaths: ["/Applications/Zed.app",
|
|
48394
|
+
macAppPaths: ["/Applications/Zed.app", join27(homedir14(), "Applications", "Zed.app")],
|
|
48379
48395
|
windowsAppPaths: getWindowsPaths("Zed\\Zed.exe"),
|
|
48380
48396
|
linuxAppPaths: ["/usr/bin/zed", "/usr/local/bin/zed"]
|
|
48381
48397
|
},
|
|
@@ -48390,7 +48406,7 @@ var init_action_routes = __esm(() => {
|
|
|
48390
48406
|
macAppName: "Sublime Text",
|
|
48391
48407
|
macAppPaths: [
|
|
48392
48408
|
"/Applications/Sublime Text.app",
|
|
48393
|
-
|
|
48409
|
+
join27(homedir14(), "Applications", "Sublime Text.app")
|
|
48394
48410
|
],
|
|
48395
48411
|
windowsAppPaths: getWindowsPaths("Sublime Text\\sublime_text.exe"),
|
|
48396
48412
|
linuxAppPaths: ["/usr/bin/subl", "/snap/bin/subl"]
|
|
@@ -49013,7 +49029,7 @@ var init_ck_config_schema = __esm(() => {
|
|
|
49013
49029
|
// src/domains/web-server/routes/ck-config-routes.ts
|
|
49014
49030
|
import { existsSync as existsSync15 } from "node:fs";
|
|
49015
49031
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
49016
|
-
import { join as
|
|
49032
|
+
import { join as join28 } from "node:path";
|
|
49017
49033
|
async function resolveProjectDir(projectId) {
|
|
49018
49034
|
if (!projectId)
|
|
49019
49035
|
return null;
|
|
@@ -49155,7 +49171,7 @@ function registerCkConfigRoutes(app) {
|
|
|
49155
49171
|
});
|
|
49156
49172
|
app.get("/api/metadata/global", async (_req, res) => {
|
|
49157
49173
|
try {
|
|
49158
|
-
const metadataPath =
|
|
49174
|
+
const metadataPath = join28(PathResolver.getGlobalKitDir(), "metadata.json");
|
|
49159
49175
|
let metadata = {};
|
|
49160
49176
|
if (existsSync15(metadataPath)) {
|
|
49161
49177
|
const content = await readFile11(metadataPath, "utf-8");
|
|
@@ -49235,11 +49251,11 @@ var init_types5 = __esm(() => {
|
|
|
49235
49251
|
|
|
49236
49252
|
// src/services/claude-data/history-parser.ts
|
|
49237
49253
|
import { createReadStream, statSync as statSync4 } from "node:fs";
|
|
49238
|
-
import { homedir as
|
|
49239
|
-
import { join as
|
|
49254
|
+
import { homedir as homedir15 } from "node:os";
|
|
49255
|
+
import { join as join29 } from "node:path";
|
|
49240
49256
|
import { createInterface as createInterface2 } from "node:readline";
|
|
49241
49257
|
function getHistoryPath() {
|
|
49242
|
-
return process.env.CLAUDE_HISTORY_PATH ??
|
|
49258
|
+
return process.env.CLAUDE_HISTORY_PATH ?? join29(homedir15(), ".claude", "history.jsonl");
|
|
49243
49259
|
}
|
|
49244
49260
|
function emptyResult(parseTimeMs, error) {
|
|
49245
49261
|
return { projects: [], totalEntries: 0, errorCount: 0, parseTimeMs, error };
|
|
@@ -49323,7 +49339,7 @@ var init_history_parser = __esm(() => {
|
|
|
49323
49339
|
// src/services/claude-data/session-parser.ts
|
|
49324
49340
|
import { existsSync as existsSync16 } from "node:fs";
|
|
49325
49341
|
import { readFile as readFile12, readdir as readdir7, stat as stat5 } from "node:fs/promises";
|
|
49326
|
-
import { join as
|
|
49342
|
+
import { join as join30 } from "node:path";
|
|
49327
49343
|
function formatTimestamp(date) {
|
|
49328
49344
|
const now = new Date;
|
|
49329
49345
|
const isToday = date.toDateString() === now.toDateString();
|
|
@@ -49420,7 +49436,7 @@ async function getProjectSessions(projectDir, limit = 10) {
|
|
|
49420
49436
|
const files = await readdir7(projectDir);
|
|
49421
49437
|
const jsonlFiles = files.filter((f3) => f3.endsWith(".jsonl"));
|
|
49422
49438
|
const fileStats = await Promise.all(jsonlFiles.map(async (file) => {
|
|
49423
|
-
const filePath =
|
|
49439
|
+
const filePath = join30(projectDir, file);
|
|
49424
49440
|
const fileStat = await stat5(filePath).catch(() => null);
|
|
49425
49441
|
return { file, filePath, mtime: fileStat?.mtime || new Date(0) };
|
|
49426
49442
|
}));
|
|
@@ -49437,10 +49453,10 @@ var init_session_parser = () => {};
|
|
|
49437
49453
|
// src/services/claude-data/skill-scanner.ts
|
|
49438
49454
|
import { existsSync as existsSync17 } from "node:fs";
|
|
49439
49455
|
import { readFile as readFile13, readdir as readdir8 } from "node:fs/promises";
|
|
49440
|
-
import { homedir as
|
|
49441
|
-
import { join as
|
|
49456
|
+
import { homedir as homedir16 } from "node:os";
|
|
49457
|
+
import { join as join31 } from "node:path";
|
|
49442
49458
|
async function getCkSkillMetadata(scope) {
|
|
49443
|
-
const metaPath = scope === "global" ?
|
|
49459
|
+
const metaPath = scope === "global" ? join31(homedir16(), ".claude", "metadata.json") : join31(process.cwd(), ".claude", "metadata.json");
|
|
49444
49460
|
if (!existsSync17(metaPath))
|
|
49445
49461
|
return null;
|
|
49446
49462
|
const result = new Map;
|
|
@@ -49476,7 +49492,7 @@ async function getCkSkillMetadata(scope) {
|
|
|
49476
49492
|
return result.size > 0 ? result : null;
|
|
49477
49493
|
}
|
|
49478
49494
|
async function getSkillMetadata(skillPath) {
|
|
49479
|
-
const skillMdPath =
|
|
49495
|
+
const skillMdPath = join31(skillPath, "SKILL.md");
|
|
49480
49496
|
if (!existsSync17(skillMdPath))
|
|
49481
49497
|
return null;
|
|
49482
49498
|
try {
|
|
@@ -49525,8 +49541,8 @@ async function scanSkills() {
|
|
|
49525
49541
|
continue;
|
|
49526
49542
|
if (ckMeta && !ckMeta.has(entry))
|
|
49527
49543
|
continue;
|
|
49528
|
-
const entryPath =
|
|
49529
|
-
const skillMdPath =
|
|
49544
|
+
const entryPath = join31(skillsDir, entry);
|
|
49545
|
+
const skillMdPath = join31(entryPath, "SKILL.md");
|
|
49530
49546
|
if (!existsSync17(skillMdPath))
|
|
49531
49547
|
continue;
|
|
49532
49548
|
const frontmatter = await getSkillMetadata(entryPath);
|
|
@@ -49571,17 +49587,17 @@ async function scanSkills() {
|
|
|
49571
49587
|
var import_gray_matter4, skillsDir, SKIP_DIRS2;
|
|
49572
49588
|
var init_skill_scanner = __esm(() => {
|
|
49573
49589
|
import_gray_matter4 = __toESM(require_gray_matter(), 1);
|
|
49574
|
-
skillsDir =
|
|
49590
|
+
skillsDir = join31(homedir16(), ".claude", "skills");
|
|
49575
49591
|
SKIP_DIRS2 = [".venv", "scripts", "__pycache__", "node_modules", ".git", "common"];
|
|
49576
49592
|
});
|
|
49577
49593
|
|
|
49578
49594
|
// src/services/claude-data/settings-reader.ts
|
|
49579
49595
|
import { existsSync as existsSync18 } from "node:fs";
|
|
49580
49596
|
import { copyFile as copyFile2, mkdir as mkdir9, readFile as readFile14, rename as rename5, rm as rm4, writeFile as writeFile10 } from "node:fs/promises";
|
|
49581
|
-
import { homedir as
|
|
49582
|
-
import { join as
|
|
49597
|
+
import { homedir as homedir17 } from "node:os";
|
|
49598
|
+
import { join as join32 } from "node:path";
|
|
49583
49599
|
function getSettingsPath() {
|
|
49584
|
-
return
|
|
49600
|
+
return join32(claudeDir, settingsFilename);
|
|
49585
49601
|
}
|
|
49586
49602
|
async function readSettings() {
|
|
49587
49603
|
const settingsPath = getSettingsPath();
|
|
@@ -49603,7 +49619,7 @@ async function backupAndSaveSettings(settings) {
|
|
|
49603
49619
|
let backupPath = null;
|
|
49604
49620
|
if (existsSync18(settingsPath)) {
|
|
49605
49621
|
await mkdir9(settingsBackupDir, { recursive: true });
|
|
49606
|
-
backupPath =
|
|
49622
|
+
backupPath = join32(settingsBackupDir, `${getBackupTimestamp()}-${settingsFilename}`);
|
|
49607
49623
|
await copyFile2(settingsPath, backupPath);
|
|
49608
49624
|
}
|
|
49609
49625
|
const tempPath = `${settingsPath}.tmp-${Date.now()}`;
|
|
@@ -49640,13 +49656,13 @@ function countMcpServers(settings) {
|
|
|
49640
49656
|
}
|
|
49641
49657
|
var claudeDir, settingsFilename = "settings.json", settingsBackupDir;
|
|
49642
49658
|
var init_settings_reader = __esm(() => {
|
|
49643
|
-
claudeDir =
|
|
49644
|
-
settingsBackupDir =
|
|
49659
|
+
claudeDir = join32(homedir17(), ".claude");
|
|
49660
|
+
settingsBackupDir = join32(claudeDir, ".ck-backups", "settings");
|
|
49645
49661
|
});
|
|
49646
49662
|
|
|
49647
49663
|
// src/services/claude-data/hook-log-reader.ts
|
|
49648
49664
|
import { open as open4 } from "node:fs/promises";
|
|
49649
|
-
import { join as
|
|
49665
|
+
import { join as join33 } from "node:path";
|
|
49650
49666
|
function createEmptySummary() {
|
|
49651
49667
|
return {
|
|
49652
49668
|
total: 0,
|
|
@@ -49694,9 +49710,9 @@ async function resolveProjectPath(projectId) {
|
|
|
49694
49710
|
}
|
|
49695
49711
|
function getHookLogPath(scope, basePath) {
|
|
49696
49712
|
if (scope === "global") {
|
|
49697
|
-
return
|
|
49713
|
+
return join33(basePath, "hooks", ".logs", "hook-log.jsonl");
|
|
49698
49714
|
}
|
|
49699
|
-
return
|
|
49715
|
+
return join33(basePath, ".claude", "hooks", ".logs", "hook-log.jsonl");
|
|
49700
49716
|
}
|
|
49701
49717
|
function parseEntry(line) {
|
|
49702
49718
|
try {
|
|
@@ -49808,14 +49824,14 @@ var init_hook_log_reader = __esm(() => {
|
|
|
49808
49824
|
});
|
|
49809
49825
|
|
|
49810
49826
|
// src/services/claude-data/project-scanner.ts
|
|
49811
|
-
import { homedir as
|
|
49812
|
-
import { basename as basename8, join as
|
|
49827
|
+
import { homedir as homedir18 } from "node:os";
|
|
49828
|
+
import { basename as basename8, join as join34, normalize as normalize4 } from "node:path";
|
|
49813
49829
|
function encodePath(path3) {
|
|
49814
49830
|
return path3.replace(/\//g, "-").replace(/^-/, "-");
|
|
49815
49831
|
}
|
|
49816
49832
|
var projectsDir;
|
|
49817
49833
|
var init_project_scanner = __esm(() => {
|
|
49818
|
-
projectsDir =
|
|
49834
|
+
projectsDir = join34(homedir18(), ".claude", "projects");
|
|
49819
49835
|
});
|
|
49820
49836
|
|
|
49821
49837
|
// src/services/claude-data/project-discovery.ts
|
|
@@ -49910,10 +49926,10 @@ var init_project_discovery = __esm(() => {
|
|
|
49910
49926
|
|
|
49911
49927
|
// src/services/claude-data/user-preferences.ts
|
|
49912
49928
|
import { readFile as readFile15, stat as stat6 } from "node:fs/promises";
|
|
49913
|
-
import { homedir as
|
|
49914
|
-
import { join as
|
|
49929
|
+
import { homedir as homedir19 } from "node:os";
|
|
49930
|
+
import { join as join35 } from "node:path";
|
|
49915
49931
|
function getPreferencesPath() {
|
|
49916
|
-
return
|
|
49932
|
+
return join35(homedir19(), ".claude.json");
|
|
49917
49933
|
}
|
|
49918
49934
|
async function readUserPreferences(filePath) {
|
|
49919
49935
|
const path3 = filePath ?? getPreferencesPath();
|
|
@@ -50047,7 +50063,7 @@ var init_hook_log_routes = __esm(() => {
|
|
|
50047
50063
|
// src/commands/migrate/skill-directory-installer.ts
|
|
50048
50064
|
import { existsSync as existsSync19 } from "node:fs";
|
|
50049
50065
|
import { cp, mkdir as mkdir10, rename as rename6, rm as rm5 } from "node:fs/promises";
|
|
50050
|
-
import { join as
|
|
50066
|
+
import { join as join36, resolve as resolve10 } from "node:path";
|
|
50051
50067
|
async function installSkillDirectories(skills, targetProviders, options2) {
|
|
50052
50068
|
const results = [];
|
|
50053
50069
|
for (const provider of targetProviders) {
|
|
@@ -50075,7 +50091,7 @@ async function installSkillDirectories(skills, targetProviders, options2) {
|
|
|
50075
50091
|
continue;
|
|
50076
50092
|
}
|
|
50077
50093
|
for (const skill of skills) {
|
|
50078
|
-
const targetDir =
|
|
50094
|
+
const targetDir = join36(basePath, skill.name);
|
|
50079
50095
|
if (resolve10(skill.path) === resolve10(targetDir)) {
|
|
50080
50096
|
results.push({
|
|
50081
50097
|
provider,
|
|
@@ -50151,12 +50167,12 @@ var init_skill_directory_installer = __esm(() => {
|
|
|
50151
50167
|
// src/commands/portable/config-discovery.ts
|
|
50152
50168
|
import { existsSync as existsSync20 } from "node:fs";
|
|
50153
50169
|
import { readFile as readFile16, readdir as readdir9 } from "node:fs/promises";
|
|
50154
|
-
import { homedir as
|
|
50155
|
-
import { extname as extname3, join as
|
|
50170
|
+
import { homedir as homedir20 } from "node:os";
|
|
50171
|
+
import { extname as extname3, join as join37, relative as relative5, sep as sep5 } from "node:path";
|
|
50156
50172
|
function resolveSourceOrigin(sourcePath) {
|
|
50157
50173
|
if (!sourcePath)
|
|
50158
50174
|
return "global";
|
|
50159
|
-
const home5 =
|
|
50175
|
+
const home5 = homedir20();
|
|
50160
50176
|
const cwd2 = process.cwd();
|
|
50161
50177
|
if (cwd2 === home5)
|
|
50162
50178
|
return "global";
|
|
@@ -50169,13 +50185,13 @@ function getConfigSourcePath() {
|
|
|
50169
50185
|
return findExistingProjectConfigPath(process.cwd()) ?? getGlobalConfigSourcePath();
|
|
50170
50186
|
}
|
|
50171
50187
|
function getGlobalConfigSourcePath() {
|
|
50172
|
-
return
|
|
50188
|
+
return join37(homedir20(), ".claude", "CLAUDE.md");
|
|
50173
50189
|
}
|
|
50174
50190
|
function getRulesSourcePath() {
|
|
50175
|
-
return findExistingProjectLayoutPath(process.cwd(), "rules") ??
|
|
50191
|
+
return findExistingProjectLayoutPath(process.cwd(), "rules") ?? join37(homedir20(), ".claude", "rules");
|
|
50176
50192
|
}
|
|
50177
50193
|
function getHooksSourcePath() {
|
|
50178
|
-
return findExistingProjectLayoutPath(process.cwd(), "hooks") ??
|
|
50194
|
+
return findExistingProjectLayoutPath(process.cwd(), "hooks") ?? join37(homedir20(), ".claude", "hooks");
|
|
50179
50195
|
}
|
|
50180
50196
|
async function discoverConfig(sourcePath) {
|
|
50181
50197
|
const path3 = sourcePath ?? getConfigSourcePath();
|
|
@@ -50227,7 +50243,7 @@ async function discoverHooks(sourcePath) {
|
|
|
50227
50243
|
}
|
|
50228
50244
|
if (!HOOK_EXTENSIONS.has(ext))
|
|
50229
50245
|
continue;
|
|
50230
|
-
const fullPath =
|
|
50246
|
+
const fullPath = join37(path3, entry.name);
|
|
50231
50247
|
try {
|
|
50232
50248
|
const content = await readFile16(fullPath, "utf-8");
|
|
50233
50249
|
items.push({
|
|
@@ -50253,7 +50269,7 @@ async function discoverPortableFiles(dir, baseDir, options2) {
|
|
|
50253
50269
|
for (const entry of entries) {
|
|
50254
50270
|
if (entry.name.startsWith("."))
|
|
50255
50271
|
continue;
|
|
50256
|
-
const fullPath =
|
|
50272
|
+
const fullPath = join37(dir, entry.name);
|
|
50257
50273
|
if (entry.isSymbolicLink()) {
|
|
50258
50274
|
continue;
|
|
50259
50275
|
}
|
|
@@ -50297,7 +50313,7 @@ var init_config_discovery = __esm(() => {
|
|
|
50297
50313
|
// src/commands/portable/hooks-settings-merger.ts
|
|
50298
50314
|
import { existsSync as existsSync21, mkdirSync, renameSync, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
50299
50315
|
import { readFile as readFile17 } from "node:fs/promises";
|
|
50300
|
-
import { basename as basename10, dirname as dirname10, join as
|
|
50316
|
+
import { basename as basename10, dirname as dirname10, join as join38 } from "node:path";
|
|
50301
50317
|
async function inspectHooksSettings(settingsPath) {
|
|
50302
50318
|
try {
|
|
50303
50319
|
if (!existsSync21(settingsPath)) {
|
|
@@ -50478,8 +50494,8 @@ async function migrateHooksSettings(options2) {
|
|
|
50478
50494
|
targetSettingsPath: null
|
|
50479
50495
|
};
|
|
50480
50496
|
}
|
|
50481
|
-
const resolvedSourcePath = isGlobal ? sourceSettingsPath :
|
|
50482
|
-
const resolvedTargetPath = isGlobal ? targetSettingsPath :
|
|
50497
|
+
const resolvedSourcePath = isGlobal ? sourceSettingsPath : join38(process.cwd(), sourceSettingsPath);
|
|
50498
|
+
const resolvedTargetPath = isGlobal ? targetSettingsPath : join38(process.cwd(), targetSettingsPath);
|
|
50483
50499
|
const sourceHooksResult = await inspectHooksSettings(resolvedSourcePath);
|
|
50484
50500
|
if (sourceHooksResult.status === "missing-file") {
|
|
50485
50501
|
return {
|
|
@@ -53075,20 +53091,20 @@ var init_reconciler = __esm(() => {
|
|
|
53075
53091
|
|
|
53076
53092
|
// src/commands/skills/skills-discovery.ts
|
|
53077
53093
|
import { readFile as readFile20, readdir as readdir10, stat as stat7 } from "node:fs/promises";
|
|
53078
|
-
import { homedir as
|
|
53079
|
-
import { dirname as dirname11, join as
|
|
53094
|
+
import { homedir as homedir21 } from "node:os";
|
|
53095
|
+
import { dirname as dirname11, join as join39 } from "node:path";
|
|
53080
53096
|
function getSkillSourcePath() {
|
|
53081
|
-
const bundledRoot =
|
|
53097
|
+
const bundledRoot = join39(process.cwd(), "node_modules", "claudekit-engineer");
|
|
53082
53098
|
return findFirstExistingPath([
|
|
53083
|
-
|
|
53099
|
+
join39(bundledRoot, "skills"),
|
|
53084
53100
|
...getProjectLayoutCandidates(bundledRoot, "skills"),
|
|
53085
53101
|
...getProjectLayoutCandidates(process.cwd(), "skills"),
|
|
53086
|
-
|
|
53102
|
+
join39(home5, ".claude/skills")
|
|
53087
53103
|
]);
|
|
53088
53104
|
}
|
|
53089
53105
|
async function hasSkillMd(dir) {
|
|
53090
53106
|
try {
|
|
53091
|
-
const skillPath =
|
|
53107
|
+
const skillPath = join39(dir, "SKILL.md");
|
|
53092
53108
|
const stats = await stat7(skillPath);
|
|
53093
53109
|
return stats.isFile();
|
|
53094
53110
|
} catch {
|
|
@@ -53136,9 +53152,9 @@ async function discoverSkills(sourcePath) {
|
|
|
53136
53152
|
if (!entry.isDirectory() || SKIP_DIRS3.includes(entry.name)) {
|
|
53137
53153
|
continue;
|
|
53138
53154
|
}
|
|
53139
|
-
const skillDir =
|
|
53155
|
+
const skillDir = join39(searchPath, entry.name);
|
|
53140
53156
|
if (await hasSkillMd(skillDir)) {
|
|
53141
|
-
const skill = await parseSkillMd(
|
|
53157
|
+
const skill = await parseSkillMd(join39(skillDir, "SKILL.md"));
|
|
53142
53158
|
if (skill && !seenNames.has(skill.name)) {
|
|
53143
53159
|
skills.push(skill);
|
|
53144
53160
|
seenNames.add(skill.name);
|
|
@@ -53157,7 +53173,7 @@ var init_skills_discovery = __esm(() => {
|
|
|
53157
53173
|
init_kit_layout();
|
|
53158
53174
|
init_logger();
|
|
53159
53175
|
import_gray_matter5 = __toESM(require_gray_matter(), 1);
|
|
53160
|
-
home5 =
|
|
53176
|
+
home5 = homedir21();
|
|
53161
53177
|
SKIP_DIRS3 = ["node_modules", ".git", "dist", "build", ".venv", "__pycache__", "common"];
|
|
53162
53178
|
});
|
|
53163
53179
|
|
|
@@ -53260,8 +53276,8 @@ var init_migration_result_utils = __esm(() => {
|
|
|
53260
53276
|
// src/domains/web-server/routes/migration-routes.ts
|
|
53261
53277
|
import { existsSync as existsSync24 } from "node:fs";
|
|
53262
53278
|
import { readFile as readFile21, rm as rm6 } from "node:fs/promises";
|
|
53263
|
-
import { homedir as
|
|
53264
|
-
import { basename as basename11, join as
|
|
53279
|
+
import { homedir as homedir22 } from "node:os";
|
|
53280
|
+
import { basename as basename11, join as join40, resolve as resolve11 } from "node:path";
|
|
53265
53281
|
function isDisallowedControlCode(codePoint) {
|
|
53266
53282
|
return codePoint >= 0 && codePoint <= 8 || codePoint >= 11 && codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
53267
53283
|
}
|
|
@@ -53828,12 +53844,12 @@ function registerMigrationRoutes(app) {
|
|
|
53828
53844
|
};
|
|
53829
53845
|
const discovered = await discoverMigrationItems(includeAll);
|
|
53830
53846
|
const cwd2 = process.cwd();
|
|
53831
|
-
const home6 =
|
|
53847
|
+
const home6 = homedir22();
|
|
53832
53848
|
res.status(200).json({
|
|
53833
53849
|
cwd: cwd2,
|
|
53834
53850
|
targetPaths: {
|
|
53835
|
-
project:
|
|
53836
|
-
global:
|
|
53851
|
+
project: join40(cwd2, ".claude"),
|
|
53852
|
+
global: join40(home6, ".claude")
|
|
53837
53853
|
},
|
|
53838
53854
|
sourcePaths: discovered.sourcePaths,
|
|
53839
53855
|
sourceOrigins: {
|
|
@@ -54862,12 +54878,12 @@ var init_plan_table_parser = __esm(() => {
|
|
|
54862
54878
|
|
|
54863
54879
|
// src/domains/plan-parser/plan-scanner.ts
|
|
54864
54880
|
import { existsSync as existsSync25, readdirSync as readdirSync3 } from "node:fs";
|
|
54865
|
-
import { join as
|
|
54881
|
+
import { join as join41 } from "node:path";
|
|
54866
54882
|
function scanPlanDir(dir) {
|
|
54867
54883
|
if (!existsSync25(dir))
|
|
54868
54884
|
return [];
|
|
54869
54885
|
try {
|
|
54870
|
-
return readdirSync3(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
54886
|
+
return readdirSync3(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join41(dir, entry.name, "plan.md")).filter(existsSync25);
|
|
54871
54887
|
} catch {
|
|
54872
54888
|
return [];
|
|
54873
54889
|
}
|
|
@@ -54942,7 +54958,7 @@ var init_plan_validator = __esm(() => {
|
|
|
54942
54958
|
// src/domains/plan-parser/plan-writer.ts
|
|
54943
54959
|
import { mkdirSync as mkdirSync2, readFileSync as readFileSync8, writeFileSync as writeFileSync3 } from "node:fs";
|
|
54944
54960
|
import { existsSync as existsSync27 } from "node:fs";
|
|
54945
|
-
import { basename as basename13, dirname as dirname14, join as
|
|
54961
|
+
import { basename as basename13, dirname as dirname14, join as join42 } from "node:path";
|
|
54946
54962
|
function phaseNameToFilename(id, name) {
|
|
54947
54963
|
const numMatch = /^(\d+)([a-z]*)$/i.exec(id);
|
|
54948
54964
|
const num = numMatch ? numMatch[1] : id;
|
|
@@ -55050,12 +55066,12 @@ function scaffoldPlan(options2) {
|
|
|
55050
55066
|
mkdirSync2(dir, { recursive: true });
|
|
55051
55067
|
const resolvedPhases = resolvePhaseIds(options2.phases);
|
|
55052
55068
|
const optionsWithResolved = { ...options2, phases: resolvedPhases };
|
|
55053
|
-
const planFile =
|
|
55069
|
+
const planFile = join42(dir, "plan.md");
|
|
55054
55070
|
writeFileSync3(planFile, generatePlanMd(optionsWithResolved), "utf8");
|
|
55055
55071
|
const phaseFiles = [];
|
|
55056
55072
|
for (const phase of resolvedPhases) {
|
|
55057
55073
|
const filename = phaseNameToFilename(phase.id, phase.name);
|
|
55058
|
-
const phaseFile =
|
|
55074
|
+
const phaseFile = join42(dir, filename);
|
|
55059
55075
|
writeFileSync3(phaseFile, generatePhaseTemplate(phase), "utf8");
|
|
55060
55076
|
phaseFiles.push(phaseFile);
|
|
55061
55077
|
}
|
|
@@ -55135,7 +55151,7 @@ function phaseNameFilenameFromTableRow(body, phaseId, planDir) {
|
|
|
55135
55151
|
continue;
|
|
55136
55152
|
const linkMatch = /\[([^\]]+)\]\(\.\/([^)]+)\)/.exec(row);
|
|
55137
55153
|
if (linkMatch)
|
|
55138
|
-
return
|
|
55154
|
+
return join42(planDir, linkMatch[2]);
|
|
55139
55155
|
}
|
|
55140
55156
|
return null;
|
|
55141
55157
|
}
|
|
@@ -55216,7 +55232,7 @@ function addPhase(planFile, name, afterId) {
|
|
|
55216
55232
|
`);
|
|
55217
55233
|
}
|
|
55218
55234
|
writeFileSync3(planFile, import_gray_matter8.default.stringify(updatedBody, frontmatter), "utf8");
|
|
55219
|
-
const phaseFilePath =
|
|
55235
|
+
const phaseFilePath = join42(planDir, filename);
|
|
55220
55236
|
writeFileSync3(phaseFilePath, generatePhaseTemplate({ id: phaseId, name }), "utf8");
|
|
55221
55237
|
return { phaseId, phaseFile: phaseFilePath };
|
|
55222
55238
|
}
|
|
@@ -55380,8 +55396,8 @@ var init_plan_routes = __esm(() => {
|
|
|
55380
55396
|
// src/domains/web-server/routes/project-routes.ts
|
|
55381
55397
|
import { existsSync as existsSync29 } from "node:fs";
|
|
55382
55398
|
import { readFile as readFile22 } from "node:fs/promises";
|
|
55383
|
-
import { homedir as
|
|
55384
|
-
import { basename as basename15, join as
|
|
55399
|
+
import { homedir as homedir23 } from "node:os";
|
|
55400
|
+
import { basename as basename15, join as join43, resolve as resolve14 } from "node:path";
|
|
55385
55401
|
function registerProjectRoutes(app) {
|
|
55386
55402
|
app.get("/api/projects", async (req, res) => {
|
|
55387
55403
|
try {
|
|
@@ -55400,7 +55416,7 @@ function registerProjectRoutes(app) {
|
|
|
55400
55416
|
for (const discovered of discoveredProjects) {
|
|
55401
55417
|
if (registeredPaths.has(discovered.path))
|
|
55402
55418
|
continue;
|
|
55403
|
-
if (discovered.path ===
|
|
55419
|
+
if (discovered.path === join43(homedir23(), ".claude"))
|
|
55404
55420
|
continue;
|
|
55405
55421
|
const projectInfo = await detectAndBuildProjectInfo(discovered.path, `discovered-${discovered.path}`);
|
|
55406
55422
|
if (projectInfo) {
|
|
@@ -55416,7 +55432,7 @@ function registerProjectRoutes(app) {
|
|
|
55416
55432
|
if (cwdProject) {
|
|
55417
55433
|
projects.push(cwdProject);
|
|
55418
55434
|
}
|
|
55419
|
-
const globalDir =
|
|
55435
|
+
const globalDir = join43(homedir23(), ".claude");
|
|
55420
55436
|
const globalProject = await detectAndBuildProjectInfo(globalDir, "global");
|
|
55421
55437
|
if (globalProject) {
|
|
55422
55438
|
projects.push(globalProject);
|
|
@@ -55488,12 +55504,12 @@ function registerProjectRoutes(app) {
|
|
|
55488
55504
|
const body = validation.data;
|
|
55489
55505
|
let projectPath = body.path;
|
|
55490
55506
|
if (projectPath.startsWith("~/") || projectPath === "~") {
|
|
55491
|
-
projectPath =
|
|
55507
|
+
projectPath = join43(homedir23(), projectPath.slice(1));
|
|
55492
55508
|
} else if (projectPath.startsWith("~\\")) {
|
|
55493
|
-
projectPath =
|
|
55509
|
+
projectPath = join43(homedir23(), projectPath.slice(1));
|
|
55494
55510
|
}
|
|
55495
55511
|
projectPath = resolve14(projectPath);
|
|
55496
|
-
const homeDir =
|
|
55512
|
+
const homeDir = homedir23();
|
|
55497
55513
|
if (projectPath.includes("..") || !projectPath.startsWith(homeDir)) {
|
|
55498
55514
|
res.status(400).json({ error: "Invalid path after expansion" });
|
|
55499
55515
|
return;
|
|
@@ -55550,7 +55566,7 @@ function registerProjectRoutes(app) {
|
|
|
55550
55566
|
if (id === "current") {
|
|
55551
55567
|
projectPath = process.cwd();
|
|
55552
55568
|
} else if (id === "global") {
|
|
55553
|
-
projectPath =
|
|
55569
|
+
projectPath = join43(homedir23(), ".claude");
|
|
55554
55570
|
} else {
|
|
55555
55571
|
res.status(404).json({ error: "Project not found" });
|
|
55556
55572
|
return;
|
|
@@ -55612,8 +55628,8 @@ function registerProjectRoutes(app) {
|
|
|
55612
55628
|
});
|
|
55613
55629
|
}
|
|
55614
55630
|
async function buildProjectInfoFromRegistry(registered) {
|
|
55615
|
-
const claudeDir2 =
|
|
55616
|
-
const metadataPath =
|
|
55631
|
+
const claudeDir2 = join43(registered.path, ".claude");
|
|
55632
|
+
const metadataPath = join43(claudeDir2, "metadata.json");
|
|
55617
55633
|
if (!existsSync29(registered.path)) {
|
|
55618
55634
|
return null;
|
|
55619
55635
|
}
|
|
@@ -55630,7 +55646,7 @@ async function buildProjectInfoFromRegistry(registered) {
|
|
|
55630
55646
|
const hasLocalConfig = hasClaudeDir && CkConfigManager.projectConfigExists(registered.path, false);
|
|
55631
55647
|
const settings = await readSettings();
|
|
55632
55648
|
const skills = await scanSkills();
|
|
55633
|
-
const settingsPath =
|
|
55649
|
+
const settingsPath = join43(homedir23(), ".claude", "settings.json");
|
|
55634
55650
|
const health = existsSync29(settingsPath) ? "healthy" : "warning";
|
|
55635
55651
|
const model = getCurrentModel() || settings?.model || "claude-sonnet-4";
|
|
55636
55652
|
return {
|
|
@@ -55653,8 +55669,8 @@ async function buildProjectInfoFromRegistry(registered) {
|
|
|
55653
55669
|
};
|
|
55654
55670
|
}
|
|
55655
55671
|
async function detectAndBuildProjectInfo(path5, id) {
|
|
55656
|
-
const claudeDir2 = id === "global" ? path5 :
|
|
55657
|
-
const metadataPath =
|
|
55672
|
+
const claudeDir2 = id === "global" ? path5 : join43(path5, ".claude");
|
|
55673
|
+
const metadataPath = join43(claudeDir2, "metadata.json");
|
|
55658
55674
|
if (!existsSync29(metadataPath)) {
|
|
55659
55675
|
if (!existsSync29(claudeDir2)) {
|
|
55660
55676
|
return null;
|
|
@@ -55672,7 +55688,7 @@ async function detectAndBuildProjectInfo(path5, id) {
|
|
|
55672
55688
|
const hasLocalConfig = CkConfigManager.projectConfigExists(path5, id === "global");
|
|
55673
55689
|
const settings = await readSettings();
|
|
55674
55690
|
const skills = await scanSkills();
|
|
55675
|
-
const settingsPath =
|
|
55691
|
+
const settingsPath = join43(homedir23(), ".claude", "settings.json");
|
|
55676
55692
|
const health = existsSync29(settingsPath) ? "healthy" : "warning";
|
|
55677
55693
|
const model = getCurrentModel() || settings?.model || "claude-sonnet-4";
|
|
55678
55694
|
return {
|
|
@@ -55713,32 +55729,32 @@ var init_project_routes = __esm(() => {
|
|
|
55713
55729
|
});
|
|
55714
55730
|
|
|
55715
55731
|
// src/domains/web-server/routes/session-routes.ts
|
|
55716
|
-
import { homedir as
|
|
55717
|
-
import { join as
|
|
55732
|
+
import { homedir as homedir24 } from "node:os";
|
|
55733
|
+
import { join as join44 } from "node:path";
|
|
55718
55734
|
async function resolveSessionDir(projectId) {
|
|
55719
|
-
const home6 =
|
|
55735
|
+
const home6 = homedir24();
|
|
55720
55736
|
if (projectId.startsWith("discovered-")) {
|
|
55721
55737
|
try {
|
|
55722
55738
|
const encodedPathB64 = projectId.slice("discovered-".length);
|
|
55723
55739
|
const projectPath = Buffer.from(encodedPathB64, "base64url").toString("utf-8");
|
|
55724
55740
|
const claudeEncoded = encodePath(projectPath);
|
|
55725
|
-
return
|
|
55741
|
+
return join44(home6, ".claude", "projects", claudeEncoded);
|
|
55726
55742
|
} catch {
|
|
55727
55743
|
return null;
|
|
55728
55744
|
}
|
|
55729
55745
|
}
|
|
55730
55746
|
if (projectId === "current") {
|
|
55731
55747
|
const cwdEncoded = encodePath(process.cwd());
|
|
55732
|
-
return
|
|
55748
|
+
return join44(home6, ".claude", "projects", cwdEncoded);
|
|
55733
55749
|
}
|
|
55734
55750
|
if (projectId === "global") {
|
|
55735
|
-
const globalEncoded = encodePath(
|
|
55736
|
-
return
|
|
55751
|
+
const globalEncoded = encodePath(join44(home6, ".claude"));
|
|
55752
|
+
return join44(home6, ".claude", "projects", globalEncoded);
|
|
55737
55753
|
}
|
|
55738
55754
|
const registered = await ProjectsRegistryManager.getProject(projectId);
|
|
55739
55755
|
if (registered) {
|
|
55740
55756
|
const claudeEncoded = encodePath(registered.path);
|
|
55741
|
-
return
|
|
55757
|
+
return join44(home6, ".claude", "projects", claudeEncoded);
|
|
55742
55758
|
}
|
|
55743
55759
|
return null;
|
|
55744
55760
|
}
|
|
@@ -55755,7 +55771,7 @@ function registerSessionRoutes(app) {
|
|
|
55755
55771
|
res.status(404).json({ error: "Project not found" });
|
|
55756
55772
|
return;
|
|
55757
55773
|
}
|
|
55758
|
-
const allowedBase =
|
|
55774
|
+
const allowedBase = join44(homedir24(), ".claude", "projects");
|
|
55759
55775
|
if (!projectDir.startsWith(allowedBase)) {
|
|
55760
55776
|
res.status(403).json({ error: "Access denied" });
|
|
55761
55777
|
return;
|
|
@@ -55777,7 +55793,7 @@ var init_session_routes = __esm(() => {
|
|
|
55777
55793
|
});
|
|
55778
55794
|
|
|
55779
55795
|
// src/domains/web-server/routes/settings-routes.ts
|
|
55780
|
-
import { homedir as
|
|
55796
|
+
import { homedir as homedir25 } from "node:os";
|
|
55781
55797
|
function registerSettingsRoutes(app) {
|
|
55782
55798
|
app.get("/api/settings", async (_req, res) => {
|
|
55783
55799
|
try {
|
|
@@ -55833,7 +55849,7 @@ function registerSettingsRoutes(app) {
|
|
|
55833
55849
|
res.json({
|
|
55834
55850
|
success: true,
|
|
55835
55851
|
path: "~/.claude/settings.json",
|
|
55836
|
-
backupPath: saveResult.backupPath ? saveResult.backupPath.replace(
|
|
55852
|
+
backupPath: saveResult.backupPath ? saveResult.backupPath.replace(homedir25(), "~") : null,
|
|
55837
55853
|
absolutePath: getSettingsPath()
|
|
55838
55854
|
});
|
|
55839
55855
|
} catch (error) {
|
|
@@ -55867,8 +55883,8 @@ var init_settings_routes = __esm(() => {
|
|
|
55867
55883
|
|
|
55868
55884
|
// src/commands/skills/agents.ts
|
|
55869
55885
|
import { existsSync as existsSync30, readdirSync as readdirSync4, statSync as statSync5 } from "node:fs";
|
|
55870
|
-
import { homedir as
|
|
55871
|
-
import { join as
|
|
55886
|
+
import { homedir as homedir26, platform as platform5 } from "node:os";
|
|
55887
|
+
import { join as join45 } from "node:path";
|
|
55872
55888
|
function hasInstallSignal2(path5) {
|
|
55873
55889
|
if (!path5 || !existsSync30(path5)) {
|
|
55874
55890
|
return false;
|
|
@@ -55891,14 +55907,14 @@ function hasAnyInstallSignal2(paths) {
|
|
|
55891
55907
|
}
|
|
55892
55908
|
function hasOpenCodeInstallSignal2() {
|
|
55893
55909
|
return hasAnyInstallSignal2([
|
|
55894
|
-
|
|
55895
|
-
|
|
55896
|
-
|
|
55897
|
-
|
|
55898
|
-
|
|
55899
|
-
|
|
55900
|
-
|
|
55901
|
-
|
|
55910
|
+
join45(process.cwd(), "opencode.json"),
|
|
55911
|
+
join45(process.cwd(), "opencode.jsonc"),
|
|
55912
|
+
join45(process.cwd(), ".opencode/agents"),
|
|
55913
|
+
join45(process.cwd(), ".opencode/commands"),
|
|
55914
|
+
join45(home6, ".config/opencode/AGENTS.md"),
|
|
55915
|
+
join45(home6, ".config/opencode/agents"),
|
|
55916
|
+
join45(home6, ".config/opencode/commands"),
|
|
55917
|
+
join45(home6, ".opencode", "bin", OPENCODE_BINARY_NAME2)
|
|
55902
55918
|
]);
|
|
55903
55919
|
}
|
|
55904
55920
|
async function detectInstalledAgents() {
|
|
@@ -55916,7 +55932,7 @@ function getAgentConfig(type) {
|
|
|
55916
55932
|
function getInstallPath(skillName, agent, options2) {
|
|
55917
55933
|
const config = agents[agent];
|
|
55918
55934
|
const basePath = options2.global ? config.globalPath : config.projectPath;
|
|
55919
|
-
return
|
|
55935
|
+
return join45(basePath, skillName);
|
|
55920
55936
|
}
|
|
55921
55937
|
function isSkillInstalled(skillName, agent, options2) {
|
|
55922
55938
|
const installPath = getInstallPath(skillName, agent, options2);
|
|
@@ -55924,106 +55940,106 @@ function isSkillInstalled(skillName, agent, options2) {
|
|
|
55924
55940
|
}
|
|
55925
55941
|
var home6, OPENCODE_BINARY_NAME2, agents;
|
|
55926
55942
|
var init_agents = __esm(() => {
|
|
55927
|
-
home6 =
|
|
55943
|
+
home6 = homedir26();
|
|
55928
55944
|
OPENCODE_BINARY_NAME2 = platform5() === "win32" ? "opencode.exe" : "opencode";
|
|
55929
55945
|
agents = {
|
|
55930
55946
|
"claude-code": {
|
|
55931
55947
|
name: "claude-code",
|
|
55932
55948
|
displayName: "Claude Code",
|
|
55933
55949
|
projectPath: ".claude/skills",
|
|
55934
|
-
globalPath:
|
|
55935
|
-
detect: async () => existsSync30(
|
|
55950
|
+
globalPath: join45(home6, ".claude/skills"),
|
|
55951
|
+
detect: async () => existsSync30(join45(home6, ".claude"))
|
|
55936
55952
|
},
|
|
55937
55953
|
cursor: {
|
|
55938
55954
|
name: "cursor",
|
|
55939
55955
|
displayName: "Cursor",
|
|
55940
55956
|
projectPath: ".cursor/skills",
|
|
55941
|
-
globalPath:
|
|
55942
|
-
detect: async () => existsSync30(
|
|
55957
|
+
globalPath: join45(home6, ".cursor/skills"),
|
|
55958
|
+
detect: async () => existsSync30(join45(home6, ".cursor"))
|
|
55943
55959
|
},
|
|
55944
55960
|
codex: {
|
|
55945
55961
|
name: "codex",
|
|
55946
55962
|
displayName: "Codex",
|
|
55947
55963
|
projectPath: ".codex/skills",
|
|
55948
|
-
globalPath:
|
|
55949
|
-
detect: async () => existsSync30(
|
|
55964
|
+
globalPath: join45(home6, ".codex/skills"),
|
|
55965
|
+
detect: async () => existsSync30(join45(home6, ".codex"))
|
|
55950
55966
|
},
|
|
55951
55967
|
opencode: {
|
|
55952
55968
|
name: "opencode",
|
|
55953
55969
|
displayName: "OpenCode",
|
|
55954
55970
|
projectPath: ".claude/skills",
|
|
55955
|
-
globalPath:
|
|
55971
|
+
globalPath: join45(home6, ".claude/skills"),
|
|
55956
55972
|
detect: async () => hasOpenCodeInstallSignal2()
|
|
55957
55973
|
},
|
|
55958
55974
|
goose: {
|
|
55959
55975
|
name: "goose",
|
|
55960
55976
|
displayName: "Goose",
|
|
55961
55977
|
projectPath: ".goose/skills",
|
|
55962
|
-
globalPath:
|
|
55963
|
-
detect: async () => existsSync30(
|
|
55978
|
+
globalPath: join45(home6, ".config/goose/skills"),
|
|
55979
|
+
detect: async () => existsSync30(join45(home6, ".config/goose"))
|
|
55964
55980
|
},
|
|
55965
55981
|
"gemini-cli": {
|
|
55966
55982
|
name: "gemini-cli",
|
|
55967
55983
|
displayName: "Gemini CLI",
|
|
55968
55984
|
projectPath: ".agents/skills",
|
|
55969
|
-
globalPath:
|
|
55970
|
-
detect: async () => existsSync30(
|
|
55985
|
+
globalPath: join45(home6, ".agents/skills"),
|
|
55986
|
+
detect: async () => existsSync30(join45(home6, ".gemini"))
|
|
55971
55987
|
},
|
|
55972
55988
|
antigravity: {
|
|
55973
55989
|
name: "antigravity",
|
|
55974
55990
|
displayName: "Antigravity",
|
|
55975
55991
|
projectPath: ".agent/skills",
|
|
55976
|
-
globalPath:
|
|
55977
|
-
detect: async () => existsSync30(
|
|
55992
|
+
globalPath: join45(home6, ".gemini/antigravity/skills"),
|
|
55993
|
+
detect: async () => existsSync30(join45(process.cwd(), ".agent")) || existsSync30(join45(home6, ".gemini/antigravity"))
|
|
55978
55994
|
},
|
|
55979
55995
|
"github-copilot": {
|
|
55980
55996
|
name: "github-copilot",
|
|
55981
55997
|
displayName: "GitHub Copilot",
|
|
55982
55998
|
projectPath: ".github/skills",
|
|
55983
|
-
globalPath:
|
|
55984
|
-
detect: async () => existsSync30(
|
|
55999
|
+
globalPath: join45(home6, ".copilot/skills"),
|
|
56000
|
+
detect: async () => existsSync30(join45(home6, ".copilot"))
|
|
55985
56001
|
},
|
|
55986
56002
|
amp: {
|
|
55987
56003
|
name: "amp",
|
|
55988
56004
|
displayName: "Amp",
|
|
55989
56005
|
projectPath: ".agents/skills",
|
|
55990
|
-
globalPath:
|
|
55991
|
-
detect: async () => existsSync30(
|
|
56006
|
+
globalPath: join45(home6, ".config/agents/skills"),
|
|
56007
|
+
detect: async () => existsSync30(join45(home6, ".config/amp"))
|
|
55992
56008
|
},
|
|
55993
56009
|
kilo: {
|
|
55994
56010
|
name: "kilo",
|
|
55995
56011
|
displayName: "Kilo Code",
|
|
55996
56012
|
projectPath: ".kilocode/skills",
|
|
55997
|
-
globalPath:
|
|
55998
|
-
detect: async () => existsSync30(
|
|
56013
|
+
globalPath: join45(home6, ".kilocode/skills"),
|
|
56014
|
+
detect: async () => existsSync30(join45(home6, ".kilocode"))
|
|
55999
56015
|
},
|
|
56000
56016
|
roo: {
|
|
56001
56017
|
name: "roo",
|
|
56002
56018
|
displayName: "Roo Code",
|
|
56003
56019
|
projectPath: ".roo/skills",
|
|
56004
|
-
globalPath:
|
|
56005
|
-
detect: async () => existsSync30(
|
|
56020
|
+
globalPath: join45(home6, ".roo/skills"),
|
|
56021
|
+
detect: async () => existsSync30(join45(home6, ".roo"))
|
|
56006
56022
|
},
|
|
56007
56023
|
windsurf: {
|
|
56008
56024
|
name: "windsurf",
|
|
56009
56025
|
displayName: "Windsurf",
|
|
56010
56026
|
projectPath: ".windsurf/skills",
|
|
56011
|
-
globalPath:
|
|
56012
|
-
detect: async () => existsSync30(
|
|
56027
|
+
globalPath: join45(home6, ".codeium/windsurf/skills"),
|
|
56028
|
+
detect: async () => existsSync30(join45(home6, ".codeium/windsurf"))
|
|
56013
56029
|
},
|
|
56014
56030
|
cline: {
|
|
56015
56031
|
name: "cline",
|
|
56016
56032
|
displayName: "Cline",
|
|
56017
56033
|
projectPath: ".cline/skills",
|
|
56018
|
-
globalPath:
|
|
56019
|
-
detect: async () => existsSync30(
|
|
56034
|
+
globalPath: join45(home6, ".cline/skills"),
|
|
56035
|
+
detect: async () => existsSync30(join45(home6, ".cline"))
|
|
56020
56036
|
},
|
|
56021
56037
|
openhands: {
|
|
56022
56038
|
name: "openhands",
|
|
56023
56039
|
displayName: "OpenHands",
|
|
56024
56040
|
projectPath: ".openhands/skills",
|
|
56025
|
-
globalPath:
|
|
56026
|
-
detect: async () => existsSync30(
|
|
56041
|
+
globalPath: join45(home6, ".openhands/skills"),
|
|
56042
|
+
detect: async () => existsSync30(join45(home6, ".openhands"))
|
|
56027
56043
|
}
|
|
56028
56044
|
};
|
|
56029
56045
|
});
|
|
@@ -56031,8 +56047,8 @@ var init_agents = __esm(() => {
|
|
|
56031
56047
|
// src/commands/skills/skills-registry.ts
|
|
56032
56048
|
import { existsSync as existsSync31 } from "node:fs";
|
|
56033
56049
|
import { mkdir as mkdir11, readFile as readFile23, writeFile as writeFile11 } from "node:fs/promises";
|
|
56034
|
-
import { homedir as
|
|
56035
|
-
import { dirname as dirname17, join as
|
|
56050
|
+
import { homedir as homedir27 } from "node:os";
|
|
56051
|
+
import { dirname as dirname17, join as join46, sep as sep7 } from "node:path";
|
|
56036
56052
|
function getCliVersion3() {
|
|
56037
56053
|
try {
|
|
56038
56054
|
if (process.env.npm_package_version) {
|
|
@@ -56143,8 +56159,8 @@ async function syncRegistry() {
|
|
|
56143
56159
|
var home7, REGISTRY_PATH2, SkillInstallationSchema, SkillRegistrySchema, REGISTRY_PATH_MIGRATIONS;
|
|
56144
56160
|
var init_skills_registry = __esm(() => {
|
|
56145
56161
|
init_zod();
|
|
56146
|
-
home7 =
|
|
56147
|
-
REGISTRY_PATH2 =
|
|
56162
|
+
home7 = homedir27();
|
|
56163
|
+
REGISTRY_PATH2 = join46(home7, ".claudekit", "skill-registry.json");
|
|
56148
56164
|
SkillInstallationSchema = exports_external.object({
|
|
56149
56165
|
skill: exports_external.string(),
|
|
56150
56166
|
agent: exports_external.string(),
|
|
@@ -56175,8 +56191,8 @@ var init_skills_registry = __esm(() => {
|
|
|
56175
56191
|
// src/commands/skills/skills-installer.ts
|
|
56176
56192
|
import { existsSync as existsSync32 } from "node:fs";
|
|
56177
56193
|
import { cp as cp2, mkdir as mkdir12, rm as rm7, stat as stat8 } from "node:fs/promises";
|
|
56178
|
-
import { homedir as
|
|
56179
|
-
import { dirname as dirname18, join as
|
|
56194
|
+
import { homedir as homedir28 } from "node:os";
|
|
56195
|
+
import { dirname as dirname18, join as join47, resolve as resolve15 } from "node:path";
|
|
56180
56196
|
function isSamePath2(path1, path22) {
|
|
56181
56197
|
try {
|
|
56182
56198
|
return resolve15(path1) === resolve15(path22);
|
|
@@ -56208,7 +56224,7 @@ async function cleanupLegacySkillPath(skillName, agent, global3) {
|
|
|
56208
56224
|
if (!legacy)
|
|
56209
56225
|
return;
|
|
56210
56226
|
const legacyBase = global3 ? legacy.global : legacy.project;
|
|
56211
|
-
const legacyPath =
|
|
56227
|
+
const legacyPath = join47(legacyBase, skillName);
|
|
56212
56228
|
if (!existsSync32(legacyPath))
|
|
56213
56229
|
return;
|
|
56214
56230
|
await rm7(legacyPath, { recursive: true, force: true });
|
|
@@ -56218,7 +56234,7 @@ async function cleanupLegacySkillPath(skillName, agent, global3) {
|
|
|
56218
56234
|
if (entry.skill === skillName && entry.agent === agent && entry.global === global3) {
|
|
56219
56235
|
if (entry.path === legacyPath) {
|
|
56220
56236
|
const newBase = global3 ? agents[agent].globalPath : agents[agent].projectPath;
|
|
56221
|
-
entry.path =
|
|
56237
|
+
entry.path = join47(newBase, skillName);
|
|
56222
56238
|
changed = true;
|
|
56223
56239
|
}
|
|
56224
56240
|
}
|
|
@@ -56306,7 +56322,7 @@ var init_skills_installer = __esm(() => {
|
|
|
56306
56322
|
LEGACY_SKILL_PATHS = {
|
|
56307
56323
|
"gemini-cli": {
|
|
56308
56324
|
project: ".gemini/skills",
|
|
56309
|
-
global:
|
|
56325
|
+
global: join47(homedir28(), ".gemini/skills")
|
|
56310
56326
|
}
|
|
56311
56327
|
};
|
|
56312
56328
|
});
|
|
@@ -56314,7 +56330,7 @@ var init_skills_installer = __esm(() => {
|
|
|
56314
56330
|
// src/commands/skills/skills-uninstaller.ts
|
|
56315
56331
|
import { existsSync as existsSync33 } from "node:fs";
|
|
56316
56332
|
import { rm as rm8 } from "node:fs/promises";
|
|
56317
|
-
import { join as
|
|
56333
|
+
import { join as join48, resolve as resolve16 } from "node:path";
|
|
56318
56334
|
function isSamePath3(path1, path22) {
|
|
56319
56335
|
try {
|
|
56320
56336
|
return resolve16(path1) === resolve16(path22);
|
|
@@ -56370,7 +56386,7 @@ async function uninstallSkillFromAgent(skill, agent, global3) {
|
|
|
56370
56386
|
async function forceUninstallSkill(skill, agent, global3) {
|
|
56371
56387
|
const agentConfig = agents[agent];
|
|
56372
56388
|
const basePath = global3 ? agentConfig.globalPath : agentConfig.projectPath;
|
|
56373
|
-
const path5 =
|
|
56389
|
+
const path5 = join48(basePath, skill);
|
|
56374
56390
|
const registry = await readRegistry();
|
|
56375
56391
|
if (!existsSync33(path5)) {
|
|
56376
56392
|
return {
|
|
@@ -56923,7 +56939,7 @@ var init_pnpm_detector = __esm(() => {
|
|
|
56923
56939
|
import { existsSync as existsSync34, realpathSync as realpathSync2 } from "node:fs";
|
|
56924
56940
|
import { chmod as chmod2, mkdir as mkdir13, readFile as readFile24, writeFile as writeFile12 } from "node:fs/promises";
|
|
56925
56941
|
import { platform as platform6 } from "node:os";
|
|
56926
|
-
import { join as
|
|
56942
|
+
import { join as join49 } from "node:path";
|
|
56927
56943
|
function detectFromBinaryPath() {
|
|
56928
56944
|
const normalizePath2 = (pathValue) => pathValue.replace(/\\/g, "/").toLowerCase();
|
|
56929
56945
|
const detectFromNormalizedPath = (normalized) => {
|
|
@@ -57000,7 +57016,7 @@ function detectFromEnv() {
|
|
|
57000
57016
|
}
|
|
57001
57017
|
async function readCachedPm() {
|
|
57002
57018
|
try {
|
|
57003
|
-
const cacheFile =
|
|
57019
|
+
const cacheFile = join49(PathResolver.getConfigDir(false), CACHE_FILE);
|
|
57004
57020
|
if (!existsSync34(cacheFile)) {
|
|
57005
57021
|
return null;
|
|
57006
57022
|
}
|
|
@@ -57031,7 +57047,7 @@ async function saveCachedPm(pm, getVersion) {
|
|
|
57031
57047
|
return;
|
|
57032
57048
|
try {
|
|
57033
57049
|
const configDir = PathResolver.getConfigDir(false);
|
|
57034
|
-
const cacheFile =
|
|
57050
|
+
const cacheFile = join49(configDir, CACHE_FILE);
|
|
57035
57051
|
if (!existsSync34(configDir)) {
|
|
57036
57052
|
await mkdir13(configDir, { recursive: true });
|
|
57037
57053
|
if (platform6() !== "win32") {
|
|
@@ -57094,7 +57110,7 @@ async function findOwningPm() {
|
|
|
57094
57110
|
async function clearCache() {
|
|
57095
57111
|
try {
|
|
57096
57112
|
const { unlink: unlink6 } = await import("node:fs/promises");
|
|
57097
|
-
const cacheFile =
|
|
57113
|
+
const cacheFile = join49(PathResolver.getConfigDir(false), CACHE_FILE);
|
|
57098
57114
|
if (existsSync34(cacheFile)) {
|
|
57099
57115
|
await unlink6(cacheFile);
|
|
57100
57116
|
logger.debug("Package manager cache cleared");
|
|
@@ -57255,7 +57271,7 @@ var package_default;
|
|
|
57255
57271
|
var init_package = __esm(() => {
|
|
57256
57272
|
package_default = {
|
|
57257
57273
|
name: "claudekit-cli",
|
|
57258
|
-
version: "3.41.3-dev.
|
|
57274
|
+
version: "3.41.3-dev.2",
|
|
57259
57275
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
57260
57276
|
type: "module",
|
|
57261
57277
|
repository: {
|
|
@@ -57728,9 +57744,9 @@ var init_package_manager_runner = __esm(() => {
|
|
|
57728
57744
|
});
|
|
57729
57745
|
|
|
57730
57746
|
// src/domains/migration/metadata-migration.ts
|
|
57731
|
-
import { join as
|
|
57747
|
+
import { join as join50 } from "node:path";
|
|
57732
57748
|
async function detectMetadataFormat(claudeDir2) {
|
|
57733
|
-
const metadataPath =
|
|
57749
|
+
const metadataPath = join50(claudeDir2, "metadata.json");
|
|
57734
57750
|
if (!await import_fs_extra6.pathExists(metadataPath)) {
|
|
57735
57751
|
return { format: "none", metadata: null, detectedKit: null };
|
|
57736
57752
|
}
|
|
@@ -57782,7 +57798,7 @@ async function migrateToMultiKit(claudeDir2) {
|
|
|
57782
57798
|
toFormat: "multi-kit"
|
|
57783
57799
|
};
|
|
57784
57800
|
}
|
|
57785
|
-
const metadataPath =
|
|
57801
|
+
const metadataPath = join50(claudeDir2, "metadata.json");
|
|
57786
57802
|
const legacy = detection.metadata;
|
|
57787
57803
|
if (!legacy) {
|
|
57788
57804
|
return {
|
|
@@ -57894,7 +57910,7 @@ var init_metadata_migration = __esm(() => {
|
|
|
57894
57910
|
});
|
|
57895
57911
|
|
|
57896
57912
|
// src/services/file-operations/claudekit-scanner.ts
|
|
57897
|
-
import { join as
|
|
57913
|
+
import { join as join51 } from "node:path";
|
|
57898
57914
|
async function scanClaudeKitDirectory(directoryPath) {
|
|
57899
57915
|
const counts = {
|
|
57900
57916
|
agents: 0,
|
|
@@ -57908,33 +57924,33 @@ async function scanClaudeKitDirectory(directoryPath) {
|
|
|
57908
57924
|
}
|
|
57909
57925
|
const items = await import_fs_extra7.readdir(directoryPath);
|
|
57910
57926
|
if (items.includes("agents")) {
|
|
57911
|
-
const agentsPath =
|
|
57927
|
+
const agentsPath = join51(directoryPath, "agents");
|
|
57912
57928
|
const agentFiles = await import_fs_extra7.readdir(agentsPath);
|
|
57913
57929
|
counts.agents = agentFiles.filter((file) => file.endsWith(".md")).length;
|
|
57914
57930
|
}
|
|
57915
57931
|
if (items.includes("commands")) {
|
|
57916
|
-
const commandsPath =
|
|
57932
|
+
const commandsPath = join51(directoryPath, "commands");
|
|
57917
57933
|
const commandFiles = await import_fs_extra7.readdir(commandsPath);
|
|
57918
57934
|
counts.commands = commandFiles.filter((file) => file.endsWith(".md")).length;
|
|
57919
57935
|
}
|
|
57920
57936
|
if (items.includes("rules")) {
|
|
57921
|
-
const rulesPath =
|
|
57937
|
+
const rulesPath = join51(directoryPath, "rules");
|
|
57922
57938
|
const ruleFiles = await import_fs_extra7.readdir(rulesPath);
|
|
57923
57939
|
counts.rules = ruleFiles.filter((file) => file.endsWith(".md")).length;
|
|
57924
57940
|
} else if (items.includes("workflows")) {
|
|
57925
|
-
const workflowsPath =
|
|
57941
|
+
const workflowsPath = join51(directoryPath, "workflows");
|
|
57926
57942
|
const workflowFiles = await import_fs_extra7.readdir(workflowsPath);
|
|
57927
57943
|
counts.rules = workflowFiles.filter((file) => file.endsWith(".md")).length;
|
|
57928
57944
|
}
|
|
57929
57945
|
if (items.includes("skills")) {
|
|
57930
|
-
const skillsPath =
|
|
57946
|
+
const skillsPath = join51(directoryPath, "skills");
|
|
57931
57947
|
const skillItems = await import_fs_extra7.readdir(skillsPath);
|
|
57932
57948
|
let skillCount = 0;
|
|
57933
57949
|
for (const item of skillItems) {
|
|
57934
57950
|
if (SKIP_DIRS_CLAUDE_INTERNAL.includes(item)) {
|
|
57935
57951
|
continue;
|
|
57936
57952
|
}
|
|
57937
|
-
const itemPath =
|
|
57953
|
+
const itemPath = join51(skillsPath, item);
|
|
57938
57954
|
const stat9 = await import_fs_extra7.readdir(itemPath).catch(() => null);
|
|
57939
57955
|
if (stat9?.includes("SKILL.md")) {
|
|
57940
57956
|
skillCount++;
|
|
@@ -57976,14 +57992,14 @@ async function getClaudeKitSetup(projectDir = process.cwd()) {
|
|
|
57976
57992
|
const globalDir = getGlobalInstallDir();
|
|
57977
57993
|
if (await import_fs_extra7.pathExists(globalDir)) {
|
|
57978
57994
|
setup.global.path = globalDir;
|
|
57979
|
-
setup.global.metadata = await readClaudeKitMetadata(
|
|
57995
|
+
setup.global.metadata = await readClaudeKitMetadata(join51(globalDir, "metadata.json"));
|
|
57980
57996
|
setup.global.components = await scanClaudeKitDirectory(globalDir);
|
|
57981
57997
|
}
|
|
57982
|
-
const projectClaudeDir =
|
|
57998
|
+
const projectClaudeDir = join51(projectDir, ".claude");
|
|
57983
57999
|
const isLocalSameAsGlobal = projectClaudeDir === globalDir;
|
|
57984
58000
|
if (!isLocalSameAsGlobal && await import_fs_extra7.pathExists(projectClaudeDir)) {
|
|
57985
58001
|
setup.project.path = projectClaudeDir;
|
|
57986
|
-
setup.project.metadata = await readClaudeKitMetadata(
|
|
58002
|
+
setup.project.metadata = await readClaudeKitMetadata(join51(projectClaudeDir, "metadata.json"));
|
|
57987
58003
|
setup.project.components = await scanClaudeKitDirectory(projectClaudeDir);
|
|
57988
58004
|
}
|
|
57989
58005
|
return setup;
|
|
@@ -58441,7 +58457,7 @@ var init_error_handler2 = __esm(() => {
|
|
|
58441
58457
|
// src/domains/versioning/release-cache.ts
|
|
58442
58458
|
import { existsSync as existsSync35 } from "node:fs";
|
|
58443
58459
|
import { mkdir as mkdir14, readFile as readFile27, unlink as unlink6, writeFile as writeFile14 } from "node:fs/promises";
|
|
58444
|
-
import { join as
|
|
58460
|
+
import { join as join52 } from "node:path";
|
|
58445
58461
|
var ReleaseCacheEntrySchema, ReleaseCache;
|
|
58446
58462
|
var init_release_cache = __esm(() => {
|
|
58447
58463
|
init_logger();
|
|
@@ -58456,7 +58472,7 @@ var init_release_cache = __esm(() => {
|
|
|
58456
58472
|
static CACHE_TTL_SECONDS = Number(process.env.CK_CACHE_TTL) || 3600;
|
|
58457
58473
|
cacheDir;
|
|
58458
58474
|
constructor() {
|
|
58459
|
-
this.cacheDir =
|
|
58475
|
+
this.cacheDir = join52(PathResolver.getCacheDir(false), ReleaseCache.CACHE_DIR);
|
|
58460
58476
|
}
|
|
58461
58477
|
async get(key) {
|
|
58462
58478
|
const cacheFile = this.getCachePath(key);
|
|
@@ -58514,7 +58530,7 @@ var init_release_cache = __esm(() => {
|
|
|
58514
58530
|
const files = await readdir12(this.cacheDir);
|
|
58515
58531
|
for (const file of files) {
|
|
58516
58532
|
if (file.endsWith(".json")) {
|
|
58517
|
-
await unlink6(
|
|
58533
|
+
await unlink6(join52(this.cacheDir, file));
|
|
58518
58534
|
}
|
|
58519
58535
|
}
|
|
58520
58536
|
logger.debug("All release cache cleared");
|
|
@@ -58525,7 +58541,7 @@ var init_release_cache = __esm(() => {
|
|
|
58525
58541
|
}
|
|
58526
58542
|
getCachePath(key) {
|
|
58527
58543
|
const safeKey = key.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
58528
|
-
return
|
|
58544
|
+
return join52(this.cacheDir, `${safeKey}.json`);
|
|
58529
58545
|
}
|
|
58530
58546
|
isExpired(timestamp) {
|
|
58531
58547
|
const now = Date.now();
|
|
@@ -59166,7 +59182,7 @@ var init_github_client = __esm(() => {
|
|
|
59166
59182
|
|
|
59167
59183
|
// src/commands/update/post-update-handler.ts
|
|
59168
59184
|
import { exec as exec2, spawn as spawn2 } from "node:child_process";
|
|
59169
|
-
import { join as
|
|
59185
|
+
import { join as join53 } from "node:path";
|
|
59170
59186
|
import { promisify as promisify8 } from "node:util";
|
|
59171
59187
|
function selectKitForUpdate(params) {
|
|
59172
59188
|
const { hasLocal, hasGlobal, localKits, globalKits } = params;
|
|
@@ -59198,7 +59214,7 @@ function selectKitForUpdate(params) {
|
|
|
59198
59214
|
};
|
|
59199
59215
|
}
|
|
59200
59216
|
async function readMetadataFile(claudeDir2) {
|
|
59201
|
-
const metadataPath =
|
|
59217
|
+
const metadataPath = join53(claudeDir2, "metadata.json");
|
|
59202
59218
|
try {
|
|
59203
59219
|
if (!await import_fs_extra8.pathExists(metadataPath))
|
|
59204
59220
|
return null;
|
|
@@ -59569,7 +59585,7 @@ var init_update_cli = __esm(() => {
|
|
|
59569
59585
|
// src/domains/versioning/version-cache.ts
|
|
59570
59586
|
import { existsSync as existsSync36 } from "node:fs";
|
|
59571
59587
|
import { mkdir as mkdir15, readFile as readFile29, writeFile as writeFile15 } from "node:fs/promises";
|
|
59572
|
-
import { join as
|
|
59588
|
+
import { join as join54 } from "node:path";
|
|
59573
59589
|
var VersionCacheManager;
|
|
59574
59590
|
var init_version_cache = __esm(() => {
|
|
59575
59591
|
init_logger();
|
|
@@ -59579,7 +59595,7 @@ var init_version_cache = __esm(() => {
|
|
|
59579
59595
|
static CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
59580
59596
|
static getCacheFile() {
|
|
59581
59597
|
const cacheDir = PathResolver.getCacheDir(false);
|
|
59582
|
-
return
|
|
59598
|
+
return join54(cacheDir, VersionCacheManager.CACHE_FILENAME);
|
|
59583
59599
|
}
|
|
59584
59600
|
static async load() {
|
|
59585
59601
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
@@ -59848,7 +59864,7 @@ var init_version_checker = __esm(() => {
|
|
|
59848
59864
|
import { spawn as spawn3 } from "node:child_process";
|
|
59849
59865
|
import { existsSync as existsSync37 } from "node:fs";
|
|
59850
59866
|
import { readFile as readFile30 } from "node:fs/promises";
|
|
59851
|
-
import { join as
|
|
59867
|
+
import { join as join55 } from "node:path";
|
|
59852
59868
|
function hasCliUpdate(currentVersion, latestVersion) {
|
|
59853
59869
|
if (!latestVersion) {
|
|
59854
59870
|
return false;
|
|
@@ -60091,7 +60107,7 @@ async function getPackageJson() {
|
|
|
60091
60107
|
}
|
|
60092
60108
|
async function getKitMetadata2(kitName) {
|
|
60093
60109
|
try {
|
|
60094
|
-
const metadataPath =
|
|
60110
|
+
const metadataPath = join55(PathResolver.getGlobalKitDir(), "metadata.json");
|
|
60095
60111
|
if (!existsSync37(metadataPath))
|
|
60096
60112
|
return null;
|
|
60097
60113
|
const content = await readFile30(metadataPath, "utf-8");
|
|
@@ -60238,7 +60254,7 @@ var init_routes = __esm(() => {
|
|
|
60238
60254
|
|
|
60239
60255
|
// src/domains/web-server/static-server.ts
|
|
60240
60256
|
import { existsSync as existsSync38 } from "node:fs";
|
|
60241
|
-
import { dirname as dirname19, join as
|
|
60257
|
+
import { dirname as dirname19, join as join56, resolve as resolve17 } from "node:path";
|
|
60242
60258
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
60243
60259
|
function addRuntimeUiCandidate(candidates, runtimePath) {
|
|
60244
60260
|
if (!runtimePath) {
|
|
@@ -60249,21 +60265,21 @@ function addRuntimeUiCandidate(candidates, runtimePath) {
|
|
|
60249
60265
|
return;
|
|
60250
60266
|
}
|
|
60251
60267
|
const entryDir = dirname19(resolve17(runtimePath));
|
|
60252
|
-
candidates.add(
|
|
60253
|
-
candidates.add(
|
|
60268
|
+
candidates.add(join56(entryDir, "ui"));
|
|
60269
|
+
candidates.add(join56(entryDir, "..", "dist", "ui"));
|
|
60254
60270
|
}
|
|
60255
60271
|
function resolveUiDistPath() {
|
|
60256
60272
|
const candidates = new Set;
|
|
60257
60273
|
addRuntimeUiCandidate(candidates, process.argv[1]);
|
|
60258
|
-
candidates.add(
|
|
60259
|
-
candidates.add(
|
|
60260
|
-
candidates.add(
|
|
60274
|
+
candidates.add(join56(__dirname3, "ui"));
|
|
60275
|
+
candidates.add(join56(process.cwd(), "dist", "ui"));
|
|
60276
|
+
candidates.add(join56(process.cwd(), "src", "ui", "dist"));
|
|
60261
60277
|
for (const path5 of candidates) {
|
|
60262
|
-
if (existsSync38(
|
|
60278
|
+
if (existsSync38(join56(path5, "index.html"))) {
|
|
60263
60279
|
return path5;
|
|
60264
60280
|
}
|
|
60265
60281
|
}
|
|
60266
|
-
return Array.from(candidates)[0] ??
|
|
60282
|
+
return Array.from(candidates)[0] ?? join56(process.cwd(), "dist", "ui");
|
|
60267
60283
|
}
|
|
60268
60284
|
function serveStatic(app) {
|
|
60269
60285
|
const uiDistPath = resolveUiDistPath();
|
|
@@ -60299,7 +60315,7 @@ function serveStatic(app) {
|
|
|
60299
60315
|
if (req.path.startsWith("/assets/") || req.path.match(/\.(js|css|ico|png|jpg|svg|woff2?)$/)) {
|
|
60300
60316
|
return next();
|
|
60301
60317
|
}
|
|
60302
|
-
res.sendFile(
|
|
60318
|
+
res.sendFile(join56(uiDistPath, "index.html"), { dotfiles: "allow" });
|
|
60303
60319
|
});
|
|
60304
60320
|
logger.debug(`Serving static files from ${uiDistPath}`);
|
|
60305
60321
|
}
|
|
@@ -65148,7 +65164,7 @@ function getNpmLookupTimeoutMs() {
|
|
|
65148
65164
|
function getNpmInstallTimeoutMs() {
|
|
65149
65165
|
return parseTimeoutMs(process.env.CK_NPM_INSTALL_TIMEOUT_MS, DEFAULT_NPM_INSTALL_TIMEOUT_MS, MIN_NPM_TIMEOUT_MS, MAX_NPM_TIMEOUT_MS);
|
|
65150
65166
|
}
|
|
65151
|
-
function
|
|
65167
|
+
function escapeRegex2(value) {
|
|
65152
65168
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
65153
65169
|
}
|
|
65154
65170
|
async function isPackageInstalled(packageName) {
|
|
@@ -65180,7 +65196,7 @@ async function isPackageInstalled(packageName) {
|
|
|
65180
65196
|
const { stdout: stdout2 } = await execAsync7(`${getNpmCommand()} list -g ${packageName} --depth=0`, {
|
|
65181
65197
|
timeout: getNpmLookupTimeoutMs()
|
|
65182
65198
|
});
|
|
65183
|
-
const exactPattern = new RegExp(`(?:^|\\s|[├└│─]+)${
|
|
65199
|
+
const exactPattern = new RegExp(`(?:^|\\s|[├└│─]+)${escapeRegex2(packageName)}@([^\\s\\n]+)(?:\\s|$)`, "m");
|
|
65184
65200
|
return exactPattern.test(stdout2);
|
|
65185
65201
|
} catch {
|
|
65186
65202
|
return false;
|
|
@@ -65226,8 +65242,8 @@ async function getPackageVersion(packageName) {
|
|
|
65226
65242
|
timeout: getNpmLookupTimeoutMs()
|
|
65227
65243
|
});
|
|
65228
65244
|
const patterns = [
|
|
65229
|
-
new RegExp(`${
|
|
65230
|
-
new RegExp(`${
|
|
65245
|
+
new RegExp(`${escapeRegex2(packageName)}@([^\\s\\n]+)`),
|
|
65246
|
+
new RegExp(`${escapeRegex2(packageName)}@([0-9]+\\.[0-9]+\\.[0-9]+(?:-[\\w.-]+)?)`)
|
|
65231
65247
|
];
|
|
65232
65248
|
for (const pattern of patterns) {
|
|
65233
65249
|
const match = stdout2.match(pattern);
|
|
@@ -65306,7 +65322,7 @@ var init_gemini_installer = __esm(() => {
|
|
|
65306
65322
|
});
|
|
65307
65323
|
|
|
65308
65324
|
// src/services/package-installer/opencode-installer.ts
|
|
65309
|
-
import { join as
|
|
65325
|
+
import { join as join74 } from "node:path";
|
|
65310
65326
|
async function isOpenCodeInstalled() {
|
|
65311
65327
|
try {
|
|
65312
65328
|
await execAsync7("opencode --version", { timeout: 5000 });
|
|
@@ -65329,7 +65345,7 @@ async function installOpenCode() {
|
|
|
65329
65345
|
logger.info(`Installing ${displayName}...`);
|
|
65330
65346
|
const { unlink: unlink11 } = await import("node:fs/promises");
|
|
65331
65347
|
const { tmpdir: tmpdir4 } = await import("node:os");
|
|
65332
|
-
const tempScriptPath =
|
|
65348
|
+
const tempScriptPath = join74(tmpdir4(), "opencode-install.sh");
|
|
65333
65349
|
try {
|
|
65334
65350
|
logger.info("Downloading OpenCode installation script...");
|
|
65335
65351
|
await execFileAsync5("curl", ["-fsSL", "https://opencode.ai/install", "-o", tempScriptPath], {
|
|
@@ -65381,7 +65397,7 @@ var PARTIAL_INSTALL_VERSION = "partial", EXIT_CODE_CRITICAL_FAILURE = 1, EXIT_CO
|
|
|
65381
65397
|
|
|
65382
65398
|
// src/services/package-installer/install-error-handler.ts
|
|
65383
65399
|
import { existsSync as existsSync49, readFileSync as readFileSync14, unlinkSync as unlinkSync2 } from "node:fs";
|
|
65384
|
-
import { join as
|
|
65400
|
+
import { join as join75 } from "node:path";
|
|
65385
65401
|
function parseNameReason(str2) {
|
|
65386
65402
|
const colonIndex = str2.indexOf(":");
|
|
65387
65403
|
if (colonIndex === -1) {
|
|
@@ -65390,7 +65406,7 @@ function parseNameReason(str2) {
|
|
|
65390
65406
|
return [str2.slice(0, colonIndex).trim(), str2.slice(colonIndex + 1).trim()];
|
|
65391
65407
|
}
|
|
65392
65408
|
function displayInstallErrors(skillsDir2) {
|
|
65393
|
-
const summaryPath =
|
|
65409
|
+
const summaryPath = join75(skillsDir2, ".install-error-summary.json");
|
|
65394
65410
|
if (!existsSync49(summaryPath)) {
|
|
65395
65411
|
logger.error("Skills installation failed. Run with --verbose for details.");
|
|
65396
65412
|
return;
|
|
@@ -65481,7 +65497,7 @@ async function checkNeedsSudoPackages() {
|
|
|
65481
65497
|
}
|
|
65482
65498
|
}
|
|
65483
65499
|
function hasInstallState(skillsDir2) {
|
|
65484
|
-
const stateFilePath =
|
|
65500
|
+
const stateFilePath = join75(skillsDir2, ".install-state.json");
|
|
65485
65501
|
return existsSync49(stateFilePath);
|
|
65486
65502
|
}
|
|
65487
65503
|
var WHICH_COMMAND_TIMEOUT_MS = 5000;
|
|
@@ -65490,7 +65506,7 @@ var init_install_error_handler = __esm(() => {
|
|
|
65490
65506
|
});
|
|
65491
65507
|
|
|
65492
65508
|
// src/services/package-installer/skills-installer.ts
|
|
65493
|
-
import { join as
|
|
65509
|
+
import { join as join76 } from "node:path";
|
|
65494
65510
|
async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
65495
65511
|
const { skipConfirm = false, withSudo = false } = options2;
|
|
65496
65512
|
const displayName = "Skills Dependencies";
|
|
@@ -65516,7 +65532,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
65516
65532
|
const clack = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
65517
65533
|
const platform9 = process.platform;
|
|
65518
65534
|
const scriptName = platform9 === "win32" ? "install.ps1" : "install.sh";
|
|
65519
|
-
const scriptPath =
|
|
65535
|
+
const scriptPath = join76(skillsDir2, scriptName);
|
|
65520
65536
|
try {
|
|
65521
65537
|
validateScriptPath(skillsDir2, scriptPath);
|
|
65522
65538
|
} catch (error) {
|
|
@@ -65532,7 +65548,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
65532
65548
|
logger.warning(`Skills installation script not found: ${scriptPath}`);
|
|
65533
65549
|
logger.info("");
|
|
65534
65550
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
65535
|
-
logger.info(` See: ${
|
|
65551
|
+
logger.info(` See: ${join76(skillsDir2, "INSTALLATION.md")}`);
|
|
65536
65552
|
logger.info("");
|
|
65537
65553
|
logger.info("Quick start:");
|
|
65538
65554
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -65579,7 +65595,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
65579
65595
|
logger.info(` ${platform9 === "win32" ? `powershell -File "${scriptPath}"` : `bash ${scriptPath}`}`);
|
|
65580
65596
|
logger.info("");
|
|
65581
65597
|
logger.info("Or see complete guide:");
|
|
65582
|
-
logger.info(` ${
|
|
65598
|
+
logger.info(` ${join76(skillsDir2, "INSTALLATION.md")}`);
|
|
65583
65599
|
return {
|
|
65584
65600
|
success: false,
|
|
65585
65601
|
package: displayName,
|
|
@@ -65700,7 +65716,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
65700
65716
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
65701
65717
|
logger.info("");
|
|
65702
65718
|
logger.info("See complete guide:");
|
|
65703
|
-
logger.info(` cat ${
|
|
65719
|
+
logger.info(` cat ${join76(skillsDir2, "INSTALLATION.md")}`);
|
|
65704
65720
|
logger.info("");
|
|
65705
65721
|
logger.info("Quick start:");
|
|
65706
65722
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -65746,7 +65762,7 @@ var init_skills_installer2 = __esm(() => {
|
|
|
65746
65762
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
65747
65763
|
import { existsSync as existsSync50 } from "node:fs";
|
|
65748
65764
|
import { mkdir as mkdir19, readFile as readFile37, writeFile as writeFile20 } from "node:fs/promises";
|
|
65749
|
-
import { dirname as dirname22, join as
|
|
65765
|
+
import { dirname as dirname22, join as join77 } from "node:path";
|
|
65750
65766
|
async function readJsonFile(filePath) {
|
|
65751
65767
|
try {
|
|
65752
65768
|
const content = await readFile37(filePath, "utf-8");
|
|
@@ -65758,7 +65774,7 @@ async function readJsonFile(filePath) {
|
|
|
65758
65774
|
}
|
|
65759
65775
|
}
|
|
65760
65776
|
async function addGeminiToGitignore(projectDir) {
|
|
65761
|
-
const gitignorePath =
|
|
65777
|
+
const gitignorePath = join77(projectDir, ".gitignore");
|
|
65762
65778
|
const geminiPattern = ".gemini/";
|
|
65763
65779
|
try {
|
|
65764
65780
|
let content = "";
|
|
@@ -65849,13 +65865,13 @@ var init_config_manager2 = __esm(() => {
|
|
|
65849
65865
|
|
|
65850
65866
|
// src/services/package-installer/gemini-mcp/validation.ts
|
|
65851
65867
|
import { existsSync as existsSync51, lstatSync, readlinkSync } from "node:fs";
|
|
65852
|
-
import { homedir as
|
|
65853
|
-
import { join as
|
|
65868
|
+
import { homedir as homedir31 } from "node:os";
|
|
65869
|
+
import { join as join78 } from "node:path";
|
|
65854
65870
|
function getGlobalMcpConfigPath() {
|
|
65855
|
-
return
|
|
65871
|
+
return join78(homedir31(), ".claude", ".mcp.json");
|
|
65856
65872
|
}
|
|
65857
65873
|
function getLocalMcpConfigPath(projectDir) {
|
|
65858
|
-
return
|
|
65874
|
+
return join78(projectDir, ".mcp.json");
|
|
65859
65875
|
}
|
|
65860
65876
|
function findMcpConfigPath(projectDir) {
|
|
65861
65877
|
const localPath = getLocalMcpConfigPath(projectDir);
|
|
@@ -65873,9 +65889,9 @@ function findMcpConfigPath(projectDir) {
|
|
|
65873
65889
|
}
|
|
65874
65890
|
function getGeminiSettingsPath(projectDir, isGlobal) {
|
|
65875
65891
|
if (isGlobal) {
|
|
65876
|
-
return
|
|
65892
|
+
return join78(homedir31(), ".gemini", "settings.json");
|
|
65877
65893
|
}
|
|
65878
|
-
return
|
|
65894
|
+
return join78(projectDir, ".gemini", "settings.json");
|
|
65879
65895
|
}
|
|
65880
65896
|
function checkExistingGeminiConfig(projectDir, isGlobal = false) {
|
|
65881
65897
|
const geminiSettingsPath = getGeminiSettingsPath(projectDir, isGlobal);
|
|
@@ -65905,7 +65921,7 @@ var init_validation = __esm(() => {
|
|
|
65905
65921
|
// src/services/package-installer/gemini-mcp/linker-core.ts
|
|
65906
65922
|
import { existsSync as existsSync52 } from "node:fs";
|
|
65907
65923
|
import { mkdir as mkdir20, symlink as symlink3 } from "node:fs/promises";
|
|
65908
|
-
import { dirname as dirname23, join as
|
|
65924
|
+
import { dirname as dirname23, join as join79 } from "node:path";
|
|
65909
65925
|
async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
65910
65926
|
const linkDir = dirname23(linkPath);
|
|
65911
65927
|
if (!existsSync52(linkDir)) {
|
|
@@ -65916,7 +65932,7 @@ async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
|
65916
65932
|
if (isGlobal) {
|
|
65917
65933
|
symlinkTarget = getGlobalMcpConfigPath();
|
|
65918
65934
|
} else {
|
|
65919
|
-
const localMcpPath =
|
|
65935
|
+
const localMcpPath = join79(projectDir, ".mcp.json");
|
|
65920
65936
|
const isLocalConfig = targetPath === localMcpPath;
|
|
65921
65937
|
symlinkTarget = isLocalConfig ? "../.mcp.json" : targetPath;
|
|
65922
65938
|
}
|
|
@@ -68333,9 +68349,9 @@ __export(exports_worktree_manager, {
|
|
|
68333
68349
|
});
|
|
68334
68350
|
import { existsSync as existsSync60 } from "node:fs";
|
|
68335
68351
|
import { readFile as readFile54, writeFile as writeFile33 } from "node:fs/promises";
|
|
68336
|
-
import { join as
|
|
68352
|
+
import { join as join131 } from "node:path";
|
|
68337
68353
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
68338
|
-
const worktreePath =
|
|
68354
|
+
const worktreePath = join131(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
68339
68355
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
68340
68356
|
await spawnAndCollect("git", ["fetch", "origin", baseBranch], projectDir).catch(() => {
|
|
68341
68357
|
logger.warning(`[worktree] Could not fetch origin/${baseBranch}, using local`);
|
|
@@ -68353,7 +68369,7 @@ async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
|
68353
68369
|
return worktreePath;
|
|
68354
68370
|
}
|
|
68355
68371
|
async function removeWorktree(projectDir, issueNumber) {
|
|
68356
|
-
const worktreePath =
|
|
68372
|
+
const worktreePath = join131(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
68357
68373
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
68358
68374
|
try {
|
|
68359
68375
|
await spawnAndCollect("git", ["worktree", "remove", worktreePath, "--force"], projectDir);
|
|
@@ -68367,7 +68383,7 @@ async function listActiveWorktrees(projectDir) {
|
|
|
68367
68383
|
try {
|
|
68368
68384
|
const output2 = await spawnAndCollect("git", ["worktree", "list", "--porcelain"], projectDir);
|
|
68369
68385
|
const issueNumbers = [];
|
|
68370
|
-
const worktreePrefix =
|
|
68386
|
+
const worktreePrefix = join131(projectDir, WORKTREE_DIR, "issue-").replace(/\\/g, "/");
|
|
68371
68387
|
for (const line of output2.split(`
|
|
68372
68388
|
`)) {
|
|
68373
68389
|
if (line.startsWith("worktree ")) {
|
|
@@ -68395,7 +68411,7 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
68395
68411
|
await spawnAndCollect("git", ["worktree", "prune"], projectDir).catch(() => {});
|
|
68396
68412
|
}
|
|
68397
68413
|
async function ensureGitignore(projectDir) {
|
|
68398
|
-
const gitignorePath =
|
|
68414
|
+
const gitignorePath = join131(projectDir, ".gitignore");
|
|
68399
68415
|
try {
|
|
68400
68416
|
const content = existsSync60(gitignorePath) ? await readFile54(gitignorePath, "utf-8") : "";
|
|
68401
68417
|
if (!content.includes(".worktrees")) {
|
|
@@ -68501,8 +68517,8 @@ var init_content_validator = __esm(() => {
|
|
|
68501
68517
|
import { createHash as createHash7 } from "node:crypto";
|
|
68502
68518
|
import { existsSync as existsSync66, mkdirSync as mkdirSync4, readFileSync as readFileSync15, readdirSync as readdirSync9, statSync as statSync11 } from "node:fs";
|
|
68503
68519
|
import { rename as rename10, writeFile as writeFile35 } from "node:fs/promises";
|
|
68504
|
-
import { homedir as
|
|
68505
|
-
import { basename as basename23, join as
|
|
68520
|
+
import { homedir as homedir36 } from "node:os";
|
|
68521
|
+
import { basename as basename23, join as join138 } from "node:path";
|
|
68506
68522
|
function getCachedContext(repoPath) {
|
|
68507
68523
|
const cachePath = getCacheFilePath(repoPath);
|
|
68508
68524
|
if (!existsSync66(cachePath))
|
|
@@ -68545,25 +68561,25 @@ function computeSourceHash(repoPath) {
|
|
|
68545
68561
|
}
|
|
68546
68562
|
function getDocSourcePaths(repoPath) {
|
|
68547
68563
|
const paths = [];
|
|
68548
|
-
const docsDir =
|
|
68564
|
+
const docsDir = join138(repoPath, "docs");
|
|
68549
68565
|
if (existsSync66(docsDir)) {
|
|
68550
68566
|
try {
|
|
68551
68567
|
const files = readdirSync9(docsDir);
|
|
68552
68568
|
for (const f3 of files) {
|
|
68553
68569
|
if (f3.endsWith(".md"))
|
|
68554
|
-
paths.push(
|
|
68570
|
+
paths.push(join138(docsDir, f3));
|
|
68555
68571
|
}
|
|
68556
68572
|
} catch {}
|
|
68557
68573
|
}
|
|
68558
|
-
const readme =
|
|
68574
|
+
const readme = join138(repoPath, "README.md");
|
|
68559
68575
|
if (existsSync66(readme))
|
|
68560
68576
|
paths.push(readme);
|
|
68561
|
-
const stylesDir =
|
|
68577
|
+
const stylesDir = join138(repoPath, "assets", "writing-styles");
|
|
68562
68578
|
if (existsSync66(stylesDir)) {
|
|
68563
68579
|
try {
|
|
68564
68580
|
const files = readdirSync9(stylesDir);
|
|
68565
68581
|
for (const f3 of files) {
|
|
68566
|
-
paths.push(
|
|
68582
|
+
paths.push(join138(stylesDir, f3));
|
|
68567
68583
|
}
|
|
68568
68584
|
} catch {}
|
|
68569
68585
|
}
|
|
@@ -68572,11 +68588,11 @@ function getDocSourcePaths(repoPath) {
|
|
|
68572
68588
|
function getCacheFilePath(repoPath) {
|
|
68573
68589
|
const repoName = basename23(repoPath).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
68574
68590
|
const pathHash = createHash7("sha256").update(repoPath).digest("hex").slice(0, 8);
|
|
68575
|
-
return
|
|
68591
|
+
return join138(CACHE_DIR, `${repoName}-${pathHash}-context-cache.json`);
|
|
68576
68592
|
}
|
|
68577
68593
|
var CACHE_DIR, CACHE_TTL_MS4;
|
|
68578
68594
|
var init_context_cache_manager = __esm(() => {
|
|
68579
|
-
CACHE_DIR =
|
|
68595
|
+
CACHE_DIR = join138(homedir36(), ".claudekit", "cache");
|
|
68580
68596
|
CACHE_TTL_MS4 = 24 * 60 * 60 * 1000;
|
|
68581
68597
|
});
|
|
68582
68598
|
|
|
@@ -68757,7 +68773,7 @@ function extractContentFromResponse(response) {
|
|
|
68757
68773
|
// src/commands/content/phases/docs-summarizer.ts
|
|
68758
68774
|
import { execSync as execSync6 } from "node:child_process";
|
|
68759
68775
|
import { existsSync as existsSync67, readFileSync as readFileSync16, readdirSync as readdirSync10 } from "node:fs";
|
|
68760
|
-
import { join as
|
|
68776
|
+
import { join as join139 } from "node:path";
|
|
68761
68777
|
async function summarizeProjectDocs(repoPath, contentLogger) {
|
|
68762
68778
|
const rawContent = collectRawDocs(repoPath);
|
|
68763
68779
|
if (rawContent.total.length < 200) {
|
|
@@ -68811,12 +68827,12 @@ function collectRawDocs(repoPath) {
|
|
|
68811
68827
|
return capped;
|
|
68812
68828
|
};
|
|
68813
68829
|
const docsContent = [];
|
|
68814
|
-
const docsDir =
|
|
68830
|
+
const docsDir = join139(repoPath, "docs");
|
|
68815
68831
|
if (existsSync67(docsDir)) {
|
|
68816
68832
|
try {
|
|
68817
68833
|
const files = readdirSync10(docsDir).filter((f3) => f3.endsWith(".md")).sort();
|
|
68818
68834
|
for (const f3 of files) {
|
|
68819
|
-
const content = readCapped(
|
|
68835
|
+
const content = readCapped(join139(docsDir, f3), 5000);
|
|
68820
68836
|
if (content) {
|
|
68821
68837
|
docsContent.push(`### ${f3}
|
|
68822
68838
|
${content}`);
|
|
@@ -68830,21 +68846,21 @@ ${content}`);
|
|
|
68830
68846
|
let brand = "";
|
|
68831
68847
|
const brandCandidates = ["docs/brand-guidelines.md", "docs/design-guidelines.md"];
|
|
68832
68848
|
for (const p of brandCandidates) {
|
|
68833
|
-
brand = readCapped(
|
|
68849
|
+
brand = readCapped(join139(repoPath, p), 3000);
|
|
68834
68850
|
if (brand)
|
|
68835
68851
|
break;
|
|
68836
68852
|
}
|
|
68837
68853
|
let styles3 = "";
|
|
68838
|
-
const stylesDir =
|
|
68854
|
+
const stylesDir = join139(repoPath, "assets", "writing-styles");
|
|
68839
68855
|
if (existsSync67(stylesDir)) {
|
|
68840
68856
|
try {
|
|
68841
68857
|
const files = readdirSync10(stylesDir).slice(0, 3);
|
|
68842
|
-
styles3 = files.map((f3) => readCapped(
|
|
68858
|
+
styles3 = files.map((f3) => readCapped(join139(stylesDir, f3), 1000)).filter(Boolean).join(`
|
|
68843
68859
|
|
|
68844
68860
|
`);
|
|
68845
68861
|
} catch {}
|
|
68846
68862
|
}
|
|
68847
|
-
const readme = readCapped(
|
|
68863
|
+
const readme = readCapped(join139(repoPath, "README.md"), 3000);
|
|
68848
68864
|
const total = [docs, brand, styles3, readme].join(`
|
|
68849
68865
|
`);
|
|
68850
68866
|
return { docs, brand, styles: styles3, readme, total };
|
|
@@ -69030,10 +69046,10 @@ IMPORTANT: Generate the image and output the path as JSON: {"imagePath": "/path/
|
|
|
69030
69046
|
// src/commands/content/phases/photo-generator.ts
|
|
69031
69047
|
import { execSync as execSync7 } from "node:child_process";
|
|
69032
69048
|
import { existsSync as existsSync68, mkdirSync as mkdirSync5, readdirSync as readdirSync11 } from "node:fs";
|
|
69033
|
-
import { homedir as
|
|
69034
|
-
import { join as
|
|
69049
|
+
import { homedir as homedir37 } from "node:os";
|
|
69050
|
+
import { join as join140 } from "node:path";
|
|
69035
69051
|
async function generatePhoto(_content, context, config, platform16, contentId, contentLogger) {
|
|
69036
|
-
const mediaDir =
|
|
69052
|
+
const mediaDir = join140(config.contentDir.replace(/^~/, homedir37()), "media", String(contentId));
|
|
69037
69053
|
if (!existsSync68(mediaDir)) {
|
|
69038
69054
|
mkdirSync5(mediaDir, { recursive: true });
|
|
69039
69055
|
}
|
|
@@ -69058,7 +69074,7 @@ async function generatePhoto(_content, context, config, platform16, contentId, c
|
|
|
69058
69074
|
const imageFile = files.find((f3) => /\.(png|jpg|jpeg|webp)$/i.test(f3));
|
|
69059
69075
|
if (imageFile) {
|
|
69060
69076
|
const ext2 = imageFile.split(".").pop() ?? "png";
|
|
69061
|
-
return { path:
|
|
69077
|
+
return { path: join140(mediaDir, imageFile), ...dimensions, format: ext2 };
|
|
69062
69078
|
}
|
|
69063
69079
|
contentLogger.warn(`Photo generation produced no image for content ${contentId}`);
|
|
69064
69080
|
return null;
|
|
@@ -69147,8 +69163,8 @@ var init_content_creator = __esm(() => {
|
|
|
69147
69163
|
|
|
69148
69164
|
// src/commands/content/phases/content-logger.ts
|
|
69149
69165
|
import { createWriteStream as createWriteStream4, existsSync as existsSync69, mkdirSync as mkdirSync6, statSync as statSync12 } from "node:fs";
|
|
69150
|
-
import { homedir as
|
|
69151
|
-
import { join as
|
|
69166
|
+
import { homedir as homedir38 } from "node:os";
|
|
69167
|
+
import { join as join141 } from "node:path";
|
|
69152
69168
|
|
|
69153
69169
|
class ContentLogger {
|
|
69154
69170
|
stream = null;
|
|
@@ -69156,7 +69172,7 @@ class ContentLogger {
|
|
|
69156
69172
|
logDir;
|
|
69157
69173
|
maxBytes;
|
|
69158
69174
|
constructor(maxBytes = 0) {
|
|
69159
|
-
this.logDir =
|
|
69175
|
+
this.logDir = join141(homedir38(), ".claudekit", "logs");
|
|
69160
69176
|
this.maxBytes = maxBytes;
|
|
69161
69177
|
}
|
|
69162
69178
|
init() {
|
|
@@ -69188,7 +69204,7 @@ class ContentLogger {
|
|
|
69188
69204
|
}
|
|
69189
69205
|
}
|
|
69190
69206
|
getLogPath() {
|
|
69191
|
-
return
|
|
69207
|
+
return join141(this.logDir, `content-${this.getDateStr()}.log`);
|
|
69192
69208
|
}
|
|
69193
69209
|
write(level, message) {
|
|
69194
69210
|
this.rotateIfNeeded();
|
|
@@ -69205,18 +69221,18 @@ class ContentLogger {
|
|
|
69205
69221
|
if (dateStr !== this.currentDate) {
|
|
69206
69222
|
this.close();
|
|
69207
69223
|
this.currentDate = dateStr;
|
|
69208
|
-
const logPath =
|
|
69224
|
+
const logPath = join141(this.logDir, `content-${dateStr}.log`);
|
|
69209
69225
|
this.stream = createWriteStream4(logPath, { flags: "a", mode: 384 });
|
|
69210
69226
|
return;
|
|
69211
69227
|
}
|
|
69212
69228
|
if (this.maxBytes > 0 && this.stream) {
|
|
69213
|
-
const logPath =
|
|
69229
|
+
const logPath = join141(this.logDir, `content-${this.currentDate}.log`);
|
|
69214
69230
|
try {
|
|
69215
69231
|
const stat21 = statSync12(logPath);
|
|
69216
69232
|
if (stat21.size >= this.maxBytes) {
|
|
69217
69233
|
this.close();
|
|
69218
69234
|
const suffix = Date.now();
|
|
69219
|
-
const rotatedPath =
|
|
69235
|
+
const rotatedPath = join141(this.logDir, `content-${this.currentDate}-${suffix}.log`);
|
|
69220
69236
|
import("node:fs/promises").then(({ rename: rename11 }) => rename11(logPath, rotatedPath).catch(() => {}));
|
|
69221
69237
|
this.stream = createWriteStream4(logPath, { flags: "w", mode: 384 });
|
|
69222
69238
|
}
|
|
@@ -69442,7 +69458,7 @@ function isNoiseCommit(title, author) {
|
|
|
69442
69458
|
// src/commands/content/phases/change-detector.ts
|
|
69443
69459
|
import { execSync as execSync9 } from "node:child_process";
|
|
69444
69460
|
import { existsSync as existsSync71, readFileSync as readFileSync17, readdirSync as readdirSync12, statSync as statSync13 } from "node:fs";
|
|
69445
|
-
import { join as
|
|
69461
|
+
import { join as join142 } from "node:path";
|
|
69446
69462
|
function detectCommits(repo, since) {
|
|
69447
69463
|
try {
|
|
69448
69464
|
const fetchUrl = sshToHttps(repo.remoteUrl);
|
|
@@ -69540,7 +69556,7 @@ function detectTags(repo, since) {
|
|
|
69540
69556
|
}
|
|
69541
69557
|
}
|
|
69542
69558
|
function detectCompletedPlans(repo, since) {
|
|
69543
|
-
const plansDir =
|
|
69559
|
+
const plansDir = join142(repo.path, "plans");
|
|
69544
69560
|
if (!existsSync71(plansDir))
|
|
69545
69561
|
return [];
|
|
69546
69562
|
const sinceMs = new Date(since).getTime();
|
|
@@ -69550,7 +69566,7 @@ function detectCompletedPlans(repo, since) {
|
|
|
69550
69566
|
for (const entry of entries) {
|
|
69551
69567
|
if (!entry.isDirectory())
|
|
69552
69568
|
continue;
|
|
69553
|
-
const planFile =
|
|
69569
|
+
const planFile = join142(plansDir, entry.name, "plan.md");
|
|
69554
69570
|
if (!existsSync71(planFile))
|
|
69555
69571
|
continue;
|
|
69556
69572
|
try {
|
|
@@ -69628,7 +69644,7 @@ function classifyCommit(event) {
|
|
|
69628
69644
|
// src/commands/content/phases/repo-discoverer.ts
|
|
69629
69645
|
import { execSync as execSync10 } from "node:child_process";
|
|
69630
69646
|
import { readdirSync as readdirSync13 } from "node:fs";
|
|
69631
|
-
import { join as
|
|
69647
|
+
import { join as join143 } from "node:path";
|
|
69632
69648
|
function discoverRepos2(cwd2) {
|
|
69633
69649
|
const repos = [];
|
|
69634
69650
|
if (isGitRepoRoot(cwd2)) {
|
|
@@ -69641,7 +69657,7 @@ function discoverRepos2(cwd2) {
|
|
|
69641
69657
|
for (const entry of entries) {
|
|
69642
69658
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
69643
69659
|
continue;
|
|
69644
|
-
const dirPath =
|
|
69660
|
+
const dirPath = join143(cwd2, entry.name);
|
|
69645
69661
|
if (isGitRepoRoot(dirPath)) {
|
|
69646
69662
|
const info = getRepoInfo(dirPath);
|
|
69647
69663
|
if (info)
|
|
@@ -70308,9 +70324,9 @@ var init_types6 = __esm(() => {
|
|
|
70308
70324
|
|
|
70309
70325
|
// src/commands/content/phases/state-manager.ts
|
|
70310
70326
|
import { readFile as readFile56, rename as rename11, writeFile as writeFile36 } from "node:fs/promises";
|
|
70311
|
-
import { join as
|
|
70327
|
+
import { join as join144 } from "node:path";
|
|
70312
70328
|
async function loadContentConfig(projectDir) {
|
|
70313
|
-
const configPath =
|
|
70329
|
+
const configPath = join144(projectDir, CK_CONFIG_FILE2);
|
|
70314
70330
|
try {
|
|
70315
70331
|
const raw2 = await readFile56(configPath, "utf-8");
|
|
70316
70332
|
const json = JSON.parse(raw2);
|
|
@@ -70320,13 +70336,13 @@ async function loadContentConfig(projectDir) {
|
|
|
70320
70336
|
}
|
|
70321
70337
|
}
|
|
70322
70338
|
async function saveContentConfig(projectDir, config) {
|
|
70323
|
-
const configPath =
|
|
70339
|
+
const configPath = join144(projectDir, CK_CONFIG_FILE2);
|
|
70324
70340
|
const json = await readJsonSafe(configPath);
|
|
70325
70341
|
json.content = { ...json.content, ...config };
|
|
70326
70342
|
await atomicWrite(configPath, json);
|
|
70327
70343
|
}
|
|
70328
70344
|
async function loadContentState(projectDir) {
|
|
70329
|
-
const configPath =
|
|
70345
|
+
const configPath = join144(projectDir, CK_CONFIG_FILE2);
|
|
70330
70346
|
try {
|
|
70331
70347
|
const raw2 = await readFile56(configPath, "utf-8");
|
|
70332
70348
|
const json = JSON.parse(raw2);
|
|
@@ -70337,7 +70353,7 @@ async function loadContentState(projectDir) {
|
|
|
70337
70353
|
}
|
|
70338
70354
|
}
|
|
70339
70355
|
async function saveContentState(projectDir, state) {
|
|
70340
|
-
const configPath =
|
|
70356
|
+
const configPath = join144(projectDir, CK_CONFIG_FILE2);
|
|
70341
70357
|
const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);
|
|
70342
70358
|
for (const key of Object.keys(state.dailyPostCounts)) {
|
|
70343
70359
|
const dateStr = key.slice(-10);
|
|
@@ -70619,7 +70635,7 @@ var init_platform_setup_x = __esm(() => {
|
|
|
70619
70635
|
|
|
70620
70636
|
// src/commands/content/phases/setup-wizard.ts
|
|
70621
70637
|
import { existsSync as existsSync72 } from "node:fs";
|
|
70622
|
-
import { join as
|
|
70638
|
+
import { join as join145 } from "node:path";
|
|
70623
70639
|
async function runSetupWizard2(cwd2, contentLogger) {
|
|
70624
70640
|
console.log();
|
|
70625
70641
|
oe(import_picocolors42.default.bgCyan(import_picocolors42.default.white(" CK Content — Multi-Channel Content Engine ")));
|
|
@@ -70687,8 +70703,8 @@ async function showRepoSummary(cwd2) {
|
|
|
70687
70703
|
function detectBrandAssets(cwd2, contentLogger) {
|
|
70688
70704
|
const repos = discoverRepos2(cwd2);
|
|
70689
70705
|
for (const repo of repos) {
|
|
70690
|
-
const hasGuidelines = existsSync72(
|
|
70691
|
-
const hasStyles = existsSync72(
|
|
70706
|
+
const hasGuidelines = existsSync72(join145(repo.path, "docs", "brand-guidelines.md"));
|
|
70707
|
+
const hasStyles = existsSync72(join145(repo.path, "assets", "writing-styles"));
|
|
70692
70708
|
if (!hasGuidelines) {
|
|
70693
70709
|
f2.warning(`${repo.name}: No docs/brand-guidelines.md — content will use generic tone.`);
|
|
70694
70710
|
contentLogger.warn(`${repo.name}: missing docs/brand-guidelines.md`);
|
|
@@ -70755,11 +70771,11 @@ var init_setup_wizard = __esm(() => {
|
|
|
70755
70771
|
|
|
70756
70772
|
// src/commands/content/content-review-commands.ts
|
|
70757
70773
|
import { existsSync as existsSync73 } from "node:fs";
|
|
70758
|
-
import { homedir as
|
|
70774
|
+
import { homedir as homedir39 } from "node:os";
|
|
70759
70775
|
async function queueContent() {
|
|
70760
70776
|
const cwd2 = process.cwd();
|
|
70761
70777
|
const config = await loadContentConfig(cwd2);
|
|
70762
|
-
const dbPath = config.dbPath.replace(/^~/,
|
|
70778
|
+
const dbPath = config.dbPath.replace(/^~/, homedir39());
|
|
70763
70779
|
if (!existsSync73(dbPath)) {
|
|
70764
70780
|
logger.info("No content database found. Run 'ck content setup' first.");
|
|
70765
70781
|
return;
|
|
@@ -70786,7 +70802,7 @@ async function queueContent() {
|
|
|
70786
70802
|
async function approveContentCmd(id) {
|
|
70787
70803
|
const cwd2 = process.cwd();
|
|
70788
70804
|
const config = await loadContentConfig(cwd2);
|
|
70789
|
-
const dbPath = config.dbPath.replace(/^~/,
|
|
70805
|
+
const dbPath = config.dbPath.replace(/^~/, homedir39());
|
|
70790
70806
|
const db = initDatabase(dbPath);
|
|
70791
70807
|
try {
|
|
70792
70808
|
approveContent(db, Number.parseInt(id, 10));
|
|
@@ -70798,7 +70814,7 @@ async function approveContentCmd(id) {
|
|
|
70798
70814
|
async function rejectContentCmd(id, reason) {
|
|
70799
70815
|
const cwd2 = process.cwd();
|
|
70800
70816
|
const config = await loadContentConfig(cwd2);
|
|
70801
|
-
const dbPath = config.dbPath.replace(/^~/,
|
|
70817
|
+
const dbPath = config.dbPath.replace(/^~/, homedir39());
|
|
70802
70818
|
const db = initDatabase(dbPath);
|
|
70803
70819
|
try {
|
|
70804
70820
|
rejectContent(db, Number.parseInt(id, 10), reason);
|
|
@@ -70829,10 +70845,10 @@ __export(exports_content_subcommands, {
|
|
|
70829
70845
|
approveContentCmd: () => approveContentCmd
|
|
70830
70846
|
});
|
|
70831
70847
|
import { existsSync as existsSync74, readFileSync as readFileSync18, unlinkSync as unlinkSync5 } from "node:fs";
|
|
70832
|
-
import { homedir as
|
|
70833
|
-
import { join as
|
|
70848
|
+
import { homedir as homedir40 } from "node:os";
|
|
70849
|
+
import { join as join146 } from "node:path";
|
|
70834
70850
|
function isDaemonRunning() {
|
|
70835
|
-
const lockFile =
|
|
70851
|
+
const lockFile = join146(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
70836
70852
|
if (!existsSync74(lockFile))
|
|
70837
70853
|
return { running: false, pid: null };
|
|
70838
70854
|
try {
|
|
@@ -70864,7 +70880,7 @@ async function startContent(options2) {
|
|
|
70864
70880
|
await contentCommand(options2);
|
|
70865
70881
|
}
|
|
70866
70882
|
async function stopContent() {
|
|
70867
|
-
const lockFile =
|
|
70883
|
+
const lockFile = join146(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
70868
70884
|
if (!existsSync74(lockFile)) {
|
|
70869
70885
|
logger.info("Content daemon is not running.");
|
|
70870
70886
|
return;
|
|
@@ -70903,9 +70919,9 @@ async function statusContent() {
|
|
|
70903
70919
|
} catch {}
|
|
70904
70920
|
}
|
|
70905
70921
|
async function logsContent(options2) {
|
|
70906
|
-
const logDir =
|
|
70922
|
+
const logDir = join146(homedir40(), ".claudekit", "logs");
|
|
70907
70923
|
const dateStr = new Date().toISOString().slice(0, 10).replace(/-/g, "");
|
|
70908
|
-
const logPath =
|
|
70924
|
+
const logPath = join146(logDir, `content-${dateStr}.log`);
|
|
70909
70925
|
if (!existsSync74(logPath)) {
|
|
70910
70926
|
logger.info("No content logs found for today.");
|
|
70911
70927
|
return;
|
|
@@ -70937,13 +70953,13 @@ var init_content_subcommands = __esm(() => {
|
|
|
70937
70953
|
init_setup_wizard();
|
|
70938
70954
|
init_state_manager();
|
|
70939
70955
|
init_content_review_commands();
|
|
70940
|
-
LOCK_DIR =
|
|
70956
|
+
LOCK_DIR = join146(homedir40(), ".claudekit", "locks");
|
|
70941
70957
|
});
|
|
70942
70958
|
|
|
70943
70959
|
// src/commands/content/content-command.ts
|
|
70944
70960
|
import { existsSync as existsSync75, mkdirSync as mkdirSync8, unlinkSync as unlinkSync6, writeFileSync as writeFileSync6 } from "node:fs";
|
|
70945
|
-
import { homedir as
|
|
70946
|
-
import { join as
|
|
70961
|
+
import { homedir as homedir41 } from "node:os";
|
|
70962
|
+
import { join as join147 } from "node:path";
|
|
70947
70963
|
async function contentCommand(options2) {
|
|
70948
70964
|
const cwd2 = process.cwd();
|
|
70949
70965
|
const contentLogger = new ContentLogger;
|
|
@@ -70975,7 +70991,7 @@ async function contentCommand(options2) {
|
|
|
70975
70991
|
if (!existsSync75(LOCK_DIR2))
|
|
70976
70992
|
mkdirSync8(LOCK_DIR2, { recursive: true });
|
|
70977
70993
|
writeFileSync6(LOCK_FILE, String(process.pid), "utf-8");
|
|
70978
|
-
const dbPath = config.dbPath.replace(/^~/,
|
|
70994
|
+
const dbPath = config.dbPath.replace(/^~/, homedir41());
|
|
70979
70995
|
const db = initDatabase(dbPath);
|
|
70980
70996
|
contentLogger.info(`Database initialised at ${dbPath}`);
|
|
70981
70997
|
const adapters = initializeAdapters(config);
|
|
@@ -71121,8 +71137,8 @@ var init_content_command = __esm(() => {
|
|
|
71121
71137
|
init_publisher();
|
|
71122
71138
|
init_review_manager();
|
|
71123
71139
|
init_state_manager();
|
|
71124
|
-
LOCK_DIR2 =
|
|
71125
|
-
LOCK_FILE =
|
|
71140
|
+
LOCK_DIR2 = join147(homedir41(), ".claudekit", "locks");
|
|
71141
|
+
LOCK_FILE = join147(LOCK_DIR2, "ck-content.lock");
|
|
71126
71142
|
});
|
|
71127
71143
|
|
|
71128
71144
|
// src/commands/content/index.ts
|
|
@@ -77985,14 +78001,14 @@ async function checkCliInstallMethod() {
|
|
|
77985
78001
|
}
|
|
77986
78002
|
// src/domains/health-checks/checkers/claude-md-checker.ts
|
|
77987
78003
|
import { existsSync as existsSync40, statSync as statSync6 } from "node:fs";
|
|
77988
|
-
import { join as
|
|
78004
|
+
import { join as join57 } from "node:path";
|
|
77989
78005
|
function checkClaudeMd(setup, projectDir) {
|
|
77990
78006
|
const results = [];
|
|
77991
78007
|
if (setup.global.path) {
|
|
77992
|
-
const globalClaudeMd =
|
|
78008
|
+
const globalClaudeMd = join57(setup.global.path, "CLAUDE.md");
|
|
77993
78009
|
results.push(checkClaudeMdFile(globalClaudeMd, "Global CLAUDE.md", "ck-global-claude-md"));
|
|
77994
78010
|
}
|
|
77995
|
-
const projectClaudeMd =
|
|
78011
|
+
const projectClaudeMd = join57(projectDir, ".claude", "CLAUDE.md");
|
|
77996
78012
|
results.push(checkClaudeMdFile(projectClaudeMd, "Project CLAUDE.md", "ck-project-claude-md"));
|
|
77997
78013
|
return results;
|
|
77998
78014
|
}
|
|
@@ -78051,9 +78067,9 @@ function checkClaudeMdFile(path5, name, id) {
|
|
|
78051
78067
|
}
|
|
78052
78068
|
// src/domains/health-checks/checkers/active-plan-checker.ts
|
|
78053
78069
|
import { existsSync as existsSync41, readFileSync as readFileSync11 } from "node:fs";
|
|
78054
|
-
import { join as
|
|
78070
|
+
import { join as join58 } from "node:path";
|
|
78055
78071
|
function checkActivePlan(projectDir) {
|
|
78056
|
-
const activePlanPath =
|
|
78072
|
+
const activePlanPath = join58(projectDir, ".claude", "active-plan");
|
|
78057
78073
|
if (!existsSync41(activePlanPath)) {
|
|
78058
78074
|
return {
|
|
78059
78075
|
id: "ck-active-plan",
|
|
@@ -78067,7 +78083,7 @@ function checkActivePlan(projectDir) {
|
|
|
78067
78083
|
}
|
|
78068
78084
|
try {
|
|
78069
78085
|
const targetPath = readFileSync11(activePlanPath, "utf-8").trim();
|
|
78070
|
-
const fullPath =
|
|
78086
|
+
const fullPath = join58(projectDir, targetPath);
|
|
78071
78087
|
if (!existsSync41(fullPath)) {
|
|
78072
78088
|
return {
|
|
78073
78089
|
id: "ck-active-plan",
|
|
@@ -78105,13 +78121,13 @@ function checkActivePlan(projectDir) {
|
|
|
78105
78121
|
}
|
|
78106
78122
|
// src/domains/health-checks/checkers/skills-checker.ts
|
|
78107
78123
|
import { existsSync as existsSync42 } from "node:fs";
|
|
78108
|
-
import { join as
|
|
78124
|
+
import { join as join59 } from "node:path";
|
|
78109
78125
|
function checkSkillsScripts(setup) {
|
|
78110
78126
|
const results = [];
|
|
78111
78127
|
const platform7 = process.platform;
|
|
78112
78128
|
const scriptName = platform7 === "win32" ? "install.ps1" : "install.sh";
|
|
78113
78129
|
if (setup.global.path) {
|
|
78114
|
-
const globalScriptPath =
|
|
78130
|
+
const globalScriptPath = join59(setup.global.path, "skills", scriptName);
|
|
78115
78131
|
const hasGlobalScript = existsSync42(globalScriptPath);
|
|
78116
78132
|
results.push({
|
|
78117
78133
|
id: "ck-global-skills-script",
|
|
@@ -78126,7 +78142,7 @@ function checkSkillsScripts(setup) {
|
|
|
78126
78142
|
});
|
|
78127
78143
|
}
|
|
78128
78144
|
if (setup.project.metadata) {
|
|
78129
|
-
const projectScriptPath =
|
|
78145
|
+
const projectScriptPath = join59(setup.project.path, "skills", scriptName);
|
|
78130
78146
|
const hasProjectScript = existsSync42(projectScriptPath);
|
|
78131
78147
|
results.push({
|
|
78132
78148
|
id: "ck-project-skills-script",
|
|
@@ -78165,7 +78181,7 @@ function checkComponentCounts(setup) {
|
|
|
78165
78181
|
init_logger();
|
|
78166
78182
|
init_path_resolver();
|
|
78167
78183
|
import { constants as constants2, access as access2, unlink as unlink7, writeFile as writeFile16 } from "node:fs/promises";
|
|
78168
|
-
import { join as
|
|
78184
|
+
import { join as join60 } from "node:path";
|
|
78169
78185
|
|
|
78170
78186
|
// src/domains/health-checks/checkers/shared.ts
|
|
78171
78187
|
init_environment();
|
|
@@ -78231,7 +78247,7 @@ async function checkGlobalDirWritable() {
|
|
|
78231
78247
|
}
|
|
78232
78248
|
const timestamp = Date.now();
|
|
78233
78249
|
const random = Math.random().toString(36).substring(2);
|
|
78234
|
-
const testFile =
|
|
78250
|
+
const testFile = join60(globalDir, `.ck-write-test-${timestamp}-${random}`);
|
|
78235
78251
|
try {
|
|
78236
78252
|
await writeFile16(testFile, "test", { encoding: "utf-8", flag: "wx" });
|
|
78237
78253
|
} catch (error) {
|
|
@@ -78267,7 +78283,7 @@ async function checkGlobalDirWritable() {
|
|
|
78267
78283
|
init_path_resolver();
|
|
78268
78284
|
import { existsSync as existsSync43 } from "node:fs";
|
|
78269
78285
|
import { readdir as readdir12 } from "node:fs/promises";
|
|
78270
|
-
import { join as
|
|
78286
|
+
import { join as join61 } from "node:path";
|
|
78271
78287
|
|
|
78272
78288
|
// src/domains/health-checks/utils/path-normalizer.ts
|
|
78273
78289
|
import { normalize as normalize5 } from "node:path";
|
|
@@ -78279,8 +78295,8 @@ function normalizePath2(filePath) {
|
|
|
78279
78295
|
|
|
78280
78296
|
// src/domains/health-checks/checkers/hooks-checker.ts
|
|
78281
78297
|
async function checkHooksExist(projectDir) {
|
|
78282
|
-
const globalHooksDir =
|
|
78283
|
-
const projectHooksDir =
|
|
78298
|
+
const globalHooksDir = join61(PathResolver.getGlobalKitDir(), "hooks");
|
|
78299
|
+
const projectHooksDir = join61(projectDir, ".claude", "hooks");
|
|
78284
78300
|
const globalExists = existsSync43(globalHooksDir);
|
|
78285
78301
|
const projectExists = existsSync43(projectHooksDir);
|
|
78286
78302
|
let hookCount = 0;
|
|
@@ -78289,7 +78305,7 @@ async function checkHooksExist(projectDir) {
|
|
|
78289
78305
|
const files = await readdir12(globalHooksDir, { withFileTypes: false });
|
|
78290
78306
|
const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((ext) => f3.endsWith(ext)));
|
|
78291
78307
|
hooks.forEach((hook) => {
|
|
78292
|
-
const fullPath =
|
|
78308
|
+
const fullPath = join61(globalHooksDir, hook);
|
|
78293
78309
|
checkedFiles.add(normalizePath2(fullPath));
|
|
78294
78310
|
});
|
|
78295
78311
|
}
|
|
@@ -78299,7 +78315,7 @@ async function checkHooksExist(projectDir) {
|
|
|
78299
78315
|
const files = await readdir12(projectHooksDir, { withFileTypes: false });
|
|
78300
78316
|
const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((ext) => f3.endsWith(ext)));
|
|
78301
78317
|
hooks.forEach((hook) => {
|
|
78302
|
-
const fullPath =
|
|
78318
|
+
const fullPath = join61(projectHooksDir, hook);
|
|
78303
78319
|
checkedFiles.add(normalizePath2(fullPath));
|
|
78304
78320
|
});
|
|
78305
78321
|
}
|
|
@@ -78331,10 +78347,10 @@ init_logger();
|
|
|
78331
78347
|
init_path_resolver();
|
|
78332
78348
|
import { existsSync as existsSync44 } from "node:fs";
|
|
78333
78349
|
import { readFile as readFile31 } from "node:fs/promises";
|
|
78334
|
-
import { join as
|
|
78350
|
+
import { join as join62 } from "node:path";
|
|
78335
78351
|
async function checkSettingsValid(projectDir) {
|
|
78336
|
-
const globalSettings =
|
|
78337
|
-
const projectSettings =
|
|
78352
|
+
const globalSettings = join62(PathResolver.getGlobalKitDir(), "settings.json");
|
|
78353
|
+
const projectSettings = join62(projectDir, ".claude", "settings.json");
|
|
78338
78354
|
const settingsPath = existsSync44(globalSettings) ? globalSettings : existsSync44(projectSettings) ? projectSettings : null;
|
|
78339
78355
|
if (!settingsPath) {
|
|
78340
78356
|
return {
|
|
@@ -78406,11 +78422,11 @@ init_logger();
|
|
|
78406
78422
|
init_path_resolver();
|
|
78407
78423
|
import { existsSync as existsSync45 } from "node:fs";
|
|
78408
78424
|
import { readFile as readFile32 } from "node:fs/promises";
|
|
78409
|
-
import { homedir as
|
|
78410
|
-
import { dirname as dirname20, join as
|
|
78425
|
+
import { homedir as homedir29 } from "node:os";
|
|
78426
|
+
import { dirname as dirname20, join as join63, normalize as normalize6, resolve as resolve18 } from "node:path";
|
|
78411
78427
|
async function checkPathRefsValid(projectDir) {
|
|
78412
|
-
const globalClaudeMd =
|
|
78413
|
-
const projectClaudeMd =
|
|
78428
|
+
const globalClaudeMd = join63(PathResolver.getGlobalKitDir(), "CLAUDE.md");
|
|
78429
|
+
const projectClaudeMd = join63(projectDir, ".claude", "CLAUDE.md");
|
|
78414
78430
|
const claudeMdPath = existsSync45(globalClaudeMd) ? globalClaudeMd : existsSync45(projectClaudeMd) ? projectClaudeMd : null;
|
|
78415
78431
|
if (!claudeMdPath) {
|
|
78416
78432
|
return {
|
|
@@ -78439,7 +78455,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
78439
78455
|
};
|
|
78440
78456
|
}
|
|
78441
78457
|
const baseDir = dirname20(claudeMdPath);
|
|
78442
|
-
const home8 =
|
|
78458
|
+
const home8 = homedir29();
|
|
78443
78459
|
const broken = [];
|
|
78444
78460
|
for (const ref of refs) {
|
|
78445
78461
|
let refPath;
|
|
@@ -78505,7 +78521,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
78505
78521
|
// src/domains/health-checks/checkers/config-completeness-checker.ts
|
|
78506
78522
|
import { existsSync as existsSync46 } from "node:fs";
|
|
78507
78523
|
import { readdir as readdir13 } from "node:fs/promises";
|
|
78508
|
-
import { join as
|
|
78524
|
+
import { join as join64 } from "node:path";
|
|
78509
78525
|
async function checkProjectConfigCompleteness(setup, projectDir) {
|
|
78510
78526
|
if (setup.project.path === setup.global.path) {
|
|
78511
78527
|
return {
|
|
@@ -78518,16 +78534,16 @@ async function checkProjectConfigCompleteness(setup, projectDir) {
|
|
|
78518
78534
|
autoFixable: false
|
|
78519
78535
|
};
|
|
78520
78536
|
}
|
|
78521
|
-
const projectClaudeDir =
|
|
78537
|
+
const projectClaudeDir = join64(projectDir, ".claude");
|
|
78522
78538
|
const requiredDirs = ["agents", "commands", "skills"];
|
|
78523
78539
|
const missingDirs = [];
|
|
78524
78540
|
for (const dir of requiredDirs) {
|
|
78525
|
-
const dirPath =
|
|
78541
|
+
const dirPath = join64(projectClaudeDir, dir);
|
|
78526
78542
|
if (!existsSync46(dirPath)) {
|
|
78527
78543
|
missingDirs.push(dir);
|
|
78528
78544
|
}
|
|
78529
78545
|
}
|
|
78530
|
-
const hasRulesOrWorkflows = existsSync46(
|
|
78546
|
+
const hasRulesOrWorkflows = existsSync46(join64(projectClaudeDir, "rules")) || existsSync46(join64(projectClaudeDir, "workflows"));
|
|
78531
78547
|
if (!hasRulesOrWorkflows) {
|
|
78532
78548
|
missingDirs.push("rules");
|
|
78533
78549
|
}
|
|
@@ -78572,7 +78588,7 @@ async function checkProjectConfigCompleteness(setup, projectDir) {
|
|
|
78572
78588
|
};
|
|
78573
78589
|
}
|
|
78574
78590
|
// src/domains/health-checks/checkers/env-keys-checker.ts
|
|
78575
|
-
import { join as
|
|
78591
|
+
import { join as join66 } from "node:path";
|
|
78576
78592
|
|
|
78577
78593
|
// src/domains/installation/setup-wizard.ts
|
|
78578
78594
|
init_config_generator();
|
|
@@ -78581,7 +78597,7 @@ init_logger();
|
|
|
78581
78597
|
init_path_resolver();
|
|
78582
78598
|
init_dist2();
|
|
78583
78599
|
var import_fs_extra9 = __toESM(require_lib(), 1);
|
|
78584
|
-
import { join as
|
|
78600
|
+
import { join as join65 } from "node:path";
|
|
78585
78601
|
var REQUIRED_ENV_KEYS = [
|
|
78586
78602
|
{ key: "GEMINI_API_KEY", label: "Gemini API Key" }
|
|
78587
78603
|
];
|
|
@@ -78658,7 +78674,7 @@ async function parseEnvFile(path5) {
|
|
|
78658
78674
|
}
|
|
78659
78675
|
}
|
|
78660
78676
|
async function checkGlobalConfig() {
|
|
78661
|
-
const globalEnvPath =
|
|
78677
|
+
const globalEnvPath = join65(PathResolver.getGlobalKitDir(), ".env");
|
|
78662
78678
|
if (!await import_fs_extra9.pathExists(globalEnvPath))
|
|
78663
78679
|
return false;
|
|
78664
78680
|
const env2 = await parseEnvFile(globalEnvPath);
|
|
@@ -78674,7 +78690,7 @@ async function runSetupWizard(options2) {
|
|
|
78674
78690
|
let globalEnv = {};
|
|
78675
78691
|
const hasGlobalConfig = !isGlobal && await checkGlobalConfig();
|
|
78676
78692
|
if (!isGlobal) {
|
|
78677
|
-
const globalEnvPath =
|
|
78693
|
+
const globalEnvPath = join65(PathResolver.getGlobalKitDir(), ".env");
|
|
78678
78694
|
if (await import_fs_extra9.pathExists(globalEnvPath)) {
|
|
78679
78695
|
globalEnv = await parseEnvFile(globalEnvPath);
|
|
78680
78696
|
}
|
|
@@ -78737,7 +78753,7 @@ async function runSetupWizard(options2) {
|
|
|
78737
78753
|
}
|
|
78738
78754
|
}
|
|
78739
78755
|
await generateEnvFile(targetDir, values);
|
|
78740
|
-
f2.success(`Configuration saved to ${
|
|
78756
|
+
f2.success(`Configuration saved to ${join65(targetDir, ".env")}`);
|
|
78741
78757
|
return true;
|
|
78742
78758
|
}
|
|
78743
78759
|
async function promptForAdditionalGeminiKeys(primaryKey) {
|
|
@@ -78812,7 +78828,7 @@ Optional: DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN`, "Configuration skipped");
|
|
|
78812
78828
|
async function checkEnvKeys(setup) {
|
|
78813
78829
|
const results = [];
|
|
78814
78830
|
if (setup.global.path) {
|
|
78815
|
-
const globalEnvPath =
|
|
78831
|
+
const globalEnvPath = join66(setup.global.path, ".env");
|
|
78816
78832
|
const globalCheck = await checkRequiredKeysExist(globalEnvPath);
|
|
78817
78833
|
if (!globalCheck.allPresent) {
|
|
78818
78834
|
const missingKeys = globalCheck.missing.map((m2) => m2.label).join(", ");
|
|
@@ -78841,7 +78857,7 @@ async function checkEnvKeys(setup) {
|
|
|
78841
78857
|
}
|
|
78842
78858
|
}
|
|
78843
78859
|
if (setup.project.metadata) {
|
|
78844
|
-
const projectEnvPath =
|
|
78860
|
+
const projectEnvPath = join66(setup.project.path, ".env");
|
|
78845
78861
|
const projectCheck = await checkRequiredKeysExist(projectEnvPath);
|
|
78846
78862
|
if (!projectCheck.allPresent) {
|
|
78847
78863
|
const missingKeys = projectCheck.missing.map((m2) => m2.label).join(", ");
|
|
@@ -78879,7 +78895,7 @@ import { spawnSync as spawnSync2 } from "node:child_process";
|
|
|
78879
78895
|
import { existsSync as existsSync47, readFileSync as readFileSync12, statSync as statSync7, writeFileSync as writeFileSync4 } from "node:fs";
|
|
78880
78896
|
import { readdir as readdir14 } from "node:fs/promises";
|
|
78881
78897
|
import { tmpdir } from "node:os";
|
|
78882
|
-
import { join as
|
|
78898
|
+
import { join as join67, resolve as resolve19 } from "node:path";
|
|
78883
78899
|
var HOOK_CHECK_TIMEOUT_MS = 5000;
|
|
78884
78900
|
var PYTHON_CHECK_TIMEOUT_MS = 3000;
|
|
78885
78901
|
var MAX_LOG_FILE_SIZE_BYTES = 10 * 1024 * 1024;
|
|
@@ -78924,7 +78940,7 @@ async function checkHookSyntax(projectDir) {
|
|
|
78924
78940
|
}
|
|
78925
78941
|
const errors2 = [];
|
|
78926
78942
|
for (const file of cjsFiles) {
|
|
78927
|
-
const filePath =
|
|
78943
|
+
const filePath = join67(hooksDir, file);
|
|
78928
78944
|
if (!isPathWithin(filePath, hooksDir))
|
|
78929
78945
|
continue;
|
|
78930
78946
|
const result = spawnSync2("node", ["--check", filePath], {
|
|
@@ -79010,7 +79026,7 @@ async function checkHookDeps(projectDir) {
|
|
|
79010
79026
|
const missingDeps = [];
|
|
79011
79027
|
const requireRegex = /require\(['"]([^'"]+)['"]\)/g;
|
|
79012
79028
|
for (const file of cjsFiles) {
|
|
79013
|
-
const filePath =
|
|
79029
|
+
const filePath = join67(hooksDir, file);
|
|
79014
79030
|
if (!isPathWithin(filePath, hooksDir))
|
|
79015
79031
|
continue;
|
|
79016
79032
|
const content = readFileSync12(filePath, "utf-8");
|
|
@@ -79020,10 +79036,10 @@ async function checkHookDeps(projectDir) {
|
|
|
79020
79036
|
continue;
|
|
79021
79037
|
}
|
|
79022
79038
|
if (depPath.startsWith(".")) {
|
|
79023
|
-
const resolvedPath =
|
|
79039
|
+
const resolvedPath = join67(hooksDir, depPath);
|
|
79024
79040
|
const extensions = [".js", ".cjs", ".mjs", ".json"];
|
|
79025
79041
|
const indexFiles = ["index.js", "index.cjs", "index.mjs"];
|
|
79026
|
-
const exists = existsSync47(resolvedPath) || extensions.some((ext) => existsSync47(resolvedPath + ext)) || indexFiles.some((idx) => existsSync47(
|
|
79042
|
+
const exists = existsSync47(resolvedPath) || extensions.some((ext) => existsSync47(resolvedPath + ext)) || indexFiles.some((idx) => existsSync47(join67(resolvedPath, idx)));
|
|
79027
79043
|
if (!exists) {
|
|
79028
79044
|
missingDeps.push(`${file}: ${depPath}`);
|
|
79029
79045
|
}
|
|
@@ -79140,11 +79156,11 @@ async function checkHookRuntime(projectDir) {
|
|
|
79140
79156
|
}
|
|
79141
79157
|
const syntheticPayload = JSON.stringify({
|
|
79142
79158
|
tool_name: "Read",
|
|
79143
|
-
tool_input: { file_path:
|
|
79159
|
+
tool_input: { file_path: join67(tmpdir(), "ck-doctor-test.txt") }
|
|
79144
79160
|
});
|
|
79145
79161
|
const failures = [];
|
|
79146
79162
|
for (const file of cjsFiles) {
|
|
79147
|
-
const filePath =
|
|
79163
|
+
const filePath = join67(hooksDir, file);
|
|
79148
79164
|
if (!isPathWithin(filePath, hooksDir))
|
|
79149
79165
|
continue;
|
|
79150
79166
|
const result = spawnSync2("node", [filePath], {
|
|
@@ -79206,8 +79222,8 @@ async function checkHookRuntime(projectDir) {
|
|
|
79206
79222
|
}
|
|
79207
79223
|
}
|
|
79208
79224
|
async function checkHookConfig(projectDir) {
|
|
79209
|
-
const projectConfigPath =
|
|
79210
|
-
const globalConfigPath =
|
|
79225
|
+
const projectConfigPath = join67(projectDir, ".claude", ".ck.json");
|
|
79226
|
+
const globalConfigPath = join67(PathResolver.getGlobalKitDir(), ".ck.json");
|
|
79211
79227
|
const configPath = existsSync47(projectConfigPath) ? projectConfigPath : existsSync47(globalConfigPath) ? globalConfigPath : null;
|
|
79212
79228
|
if (!configPath) {
|
|
79213
79229
|
return {
|
|
@@ -79331,7 +79347,7 @@ async function checkHookLogs(projectDir) {
|
|
|
79331
79347
|
autoFixable: false
|
|
79332
79348
|
};
|
|
79333
79349
|
}
|
|
79334
|
-
const logPath =
|
|
79350
|
+
const logPath = join67(hooksDir, ".logs", "hook-log.jsonl");
|
|
79335
79351
|
if (!existsSync47(logPath)) {
|
|
79336
79352
|
return {
|
|
79337
79353
|
id: "hook-logs",
|
|
@@ -79586,9 +79602,9 @@ async function checkCliVersion() {
|
|
|
79586
79602
|
}
|
|
79587
79603
|
async function checkPythonVenv(projectDir) {
|
|
79588
79604
|
const isWindows3 = process.platform === "win32";
|
|
79589
|
-
const venvBin = isWindows3 ?
|
|
79590
|
-
const projectVenvPath =
|
|
79591
|
-
const globalVenvPath =
|
|
79605
|
+
const venvBin = isWindows3 ? join67("Scripts", "python.exe") : join67("bin", "python3");
|
|
79606
|
+
const projectVenvPath = join67(projectDir, ".claude", "skills", ".venv", venvBin);
|
|
79607
|
+
const globalVenvPath = join67(PathResolver.getGlobalKitDir(), "skills", ".venv", venvBin);
|
|
79592
79608
|
const venvPath = existsSync47(projectVenvPath) ? projectVenvPath : existsSync47(globalVenvPath) ? globalVenvPath : null;
|
|
79593
79609
|
if (!venvPath) {
|
|
79594
79610
|
return {
|
|
@@ -80068,8 +80084,8 @@ import { platform as platform8 } from "node:os";
|
|
|
80068
80084
|
init_environment();
|
|
80069
80085
|
init_path_resolver();
|
|
80070
80086
|
import { constants as constants3, access as access3, mkdir as mkdir16, readFile as readFile34, unlink as unlink8, writeFile as writeFile17 } from "node:fs/promises";
|
|
80071
|
-
import { arch as arch2, homedir as
|
|
80072
|
-
import { join as
|
|
80087
|
+
import { arch as arch2, homedir as homedir30, platform as platform7 } from "node:os";
|
|
80088
|
+
import { join as join69, normalize as normalize7 } from "node:path";
|
|
80073
80089
|
function shouldSkipExpensiveOperations4() {
|
|
80074
80090
|
return shouldSkipExpensiveOperations();
|
|
80075
80091
|
}
|
|
@@ -80091,7 +80107,7 @@ async function checkPlatformDetect() {
|
|
|
80091
80107
|
};
|
|
80092
80108
|
}
|
|
80093
80109
|
async function checkHomeDirResolution() {
|
|
80094
|
-
const nodeHome = normalize7(
|
|
80110
|
+
const nodeHome = normalize7(homedir30());
|
|
80095
80111
|
const rawEnvHome = getHomeDirectoryFromEnv(platform7());
|
|
80096
80112
|
const envHome = rawEnvHome ? normalize7(rawEnvHome) : "";
|
|
80097
80113
|
const match = nodeHome === envHome && envHome !== "";
|
|
@@ -80160,7 +80176,7 @@ async function checkGlobalDirAccess() {
|
|
|
80160
80176
|
autoFixable: false
|
|
80161
80177
|
};
|
|
80162
80178
|
}
|
|
80163
|
-
const testFile =
|
|
80179
|
+
const testFile = join69(globalDir, ".ck-doctor-access-test");
|
|
80164
80180
|
try {
|
|
80165
80181
|
await mkdir16(globalDir, { recursive: true });
|
|
80166
80182
|
await writeFile17(testFile, "test", "utf-8");
|
|
@@ -80238,7 +80254,7 @@ async function checkWSLBoundary() {
|
|
|
80238
80254
|
// src/domains/health-checks/platform/windows-checker.ts
|
|
80239
80255
|
init_path_resolver();
|
|
80240
80256
|
import { mkdir as mkdir17, symlink as symlink2, unlink as unlink9, writeFile as writeFile18 } from "node:fs/promises";
|
|
80241
|
-
import { join as
|
|
80257
|
+
import { join as join70 } from "node:path";
|
|
80242
80258
|
async function checkLongPathSupport() {
|
|
80243
80259
|
if (shouldSkipExpensiveOperations4()) {
|
|
80244
80260
|
return {
|
|
@@ -80290,8 +80306,8 @@ async function checkSymlinkSupport() {
|
|
|
80290
80306
|
};
|
|
80291
80307
|
}
|
|
80292
80308
|
const testDir = PathResolver.getGlobalKitDir();
|
|
80293
|
-
const target =
|
|
80294
|
-
const link =
|
|
80309
|
+
const target = join70(testDir, ".ck-symlink-test-target");
|
|
80310
|
+
const link = join70(testDir, ".ck-symlink-test-link");
|
|
80295
80311
|
try {
|
|
80296
80312
|
await mkdir17(testDir, { recursive: true });
|
|
80297
80313
|
await writeFile18(target, "test", "utf-8");
|
|
@@ -80585,7 +80601,7 @@ class AutoHealer {
|
|
|
80585
80601
|
import { execSync as execSync3, spawnSync as spawnSync5 } from "node:child_process";
|
|
80586
80602
|
import { readFileSync as readFileSync13, unlinkSync, writeFileSync as writeFileSync5 } from "node:fs";
|
|
80587
80603
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
80588
|
-
import { dirname as dirname21, join as
|
|
80604
|
+
import { dirname as dirname21, join as join71 } from "node:path";
|
|
80589
80605
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
80590
80606
|
init_environment();
|
|
80591
80607
|
init_logger();
|
|
@@ -80593,7 +80609,7 @@ init_dist2();
|
|
|
80593
80609
|
function getCliVersion4() {
|
|
80594
80610
|
try {
|
|
80595
80611
|
const __dirname4 = dirname21(fileURLToPath4(import.meta.url));
|
|
80596
|
-
const pkgPath =
|
|
80612
|
+
const pkgPath = join71(__dirname4, "../../../package.json");
|
|
80597
80613
|
const pkg = JSON.parse(readFileSync13(pkgPath, "utf-8"));
|
|
80598
80614
|
return pkg.version || "unknown";
|
|
80599
80615
|
} catch (err) {
|
|
@@ -80732,7 +80748,7 @@ class ReportGenerator {
|
|
|
80732
80748
|
return null;
|
|
80733
80749
|
}
|
|
80734
80750
|
}
|
|
80735
|
-
const tmpFile =
|
|
80751
|
+
const tmpFile = join71(tmpdir3(), `ck-report-${Date.now()}.txt`);
|
|
80736
80752
|
writeFileSync5(tmpFile, report);
|
|
80737
80753
|
try {
|
|
80738
80754
|
const result = spawnSync5("gh", ["gist", "create", tmpFile, "--desc", "ClaudeKit Diagnostic Report"], {
|
|
@@ -81058,7 +81074,7 @@ init_claudekit_constants();
|
|
|
81058
81074
|
init_logger();
|
|
81059
81075
|
init_path_resolver();
|
|
81060
81076
|
import { mkdir as mkdir18, readFile as readFile35, unlink as unlink10, writeFile as writeFile19 } from "node:fs/promises";
|
|
81061
|
-
import { join as
|
|
81077
|
+
import { join as join72 } from "node:path";
|
|
81062
81078
|
var CACHE_TTL_HOURS = 24;
|
|
81063
81079
|
var DEFAULT_CACHE_TTL_MS = CACHE_TTL_HOURS * 60 * 60 * 1000;
|
|
81064
81080
|
var MIN_CACHE_TTL_MS = 60 * 1000;
|
|
@@ -81095,7 +81111,7 @@ var KIT_REPOS = {
|
|
|
81095
81111
|
class ConfigVersionChecker {
|
|
81096
81112
|
static getCacheFilePath(kitType, global3) {
|
|
81097
81113
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
81098
|
-
return
|
|
81114
|
+
return join72(cacheDir, `${kitType}-${CACHE_FILENAME}`);
|
|
81099
81115
|
}
|
|
81100
81116
|
static async loadCache(kitType, global3) {
|
|
81101
81117
|
try {
|
|
@@ -81258,7 +81274,7 @@ class ConfigVersionChecker {
|
|
|
81258
81274
|
}
|
|
81259
81275
|
// src/domains/sync/sync-engine.ts
|
|
81260
81276
|
import { lstat as lstat4, readFile as readFile36, readlink as readlink2, realpath as realpath5, stat as stat10 } from "node:fs/promises";
|
|
81261
|
-
import { isAbsolute as isAbsolute4, join as
|
|
81277
|
+
import { isAbsolute as isAbsolute4, join as join73, normalize as normalize8, relative as relative8 } from "node:path";
|
|
81262
81278
|
|
|
81263
81279
|
// src/services/file-operations/ownership-checker.ts
|
|
81264
81280
|
init_metadata_migration();
|
|
@@ -82619,7 +82635,7 @@ async function validateSymlinkChain(path6, basePath, maxDepth = MAX_SYMLINK_DEPT
|
|
|
82619
82635
|
if (!stats.isSymbolicLink())
|
|
82620
82636
|
break;
|
|
82621
82637
|
const target = await readlink2(current);
|
|
82622
|
-
const resolvedTarget = isAbsolute4(target) ? target :
|
|
82638
|
+
const resolvedTarget = isAbsolute4(target) ? target : join73(current, "..", target);
|
|
82623
82639
|
const normalizedTarget = normalize8(resolvedTarget);
|
|
82624
82640
|
const rel = relative8(basePath, normalizedTarget);
|
|
82625
82641
|
if (rel.startsWith("..") || isAbsolute4(rel)) {
|
|
@@ -82655,7 +82671,7 @@ async function validateSyncPath(basePath, filePath) {
|
|
|
82655
82671
|
if (normalized.startsWith("..") || normalized.includes("/../")) {
|
|
82656
82672
|
throw new Error(`Path traversal not allowed: ${filePath}`);
|
|
82657
82673
|
}
|
|
82658
|
-
const fullPath =
|
|
82674
|
+
const fullPath = join73(basePath, normalized);
|
|
82659
82675
|
const rel = relative8(basePath, fullPath);
|
|
82660
82676
|
if (rel.startsWith("..") || isAbsolute4(rel)) {
|
|
82661
82677
|
throw new Error(`Path escapes base directory: ${filePath}`);
|
|
@@ -82670,7 +82686,7 @@ async function validateSyncPath(basePath, filePath) {
|
|
|
82670
82686
|
}
|
|
82671
82687
|
} catch (error) {
|
|
82672
82688
|
if (error.code === "ENOENT") {
|
|
82673
|
-
const parentPath =
|
|
82689
|
+
const parentPath = join73(fullPath, "..");
|
|
82674
82690
|
try {
|
|
82675
82691
|
const resolvedBase = await realpath5(basePath);
|
|
82676
82692
|
const resolvedParent = await realpath5(parentPath);
|
|
@@ -83578,7 +83594,7 @@ async function getLatestVersion(kit, includePrereleases = false) {
|
|
|
83578
83594
|
init_logger();
|
|
83579
83595
|
init_path_resolver();
|
|
83580
83596
|
init_safe_prompts();
|
|
83581
|
-
import { join as
|
|
83597
|
+
import { join as join80 } from "node:path";
|
|
83582
83598
|
async function promptUpdateMode() {
|
|
83583
83599
|
const updateEverything = await se({
|
|
83584
83600
|
message: "Do you want to update everything?"
|
|
@@ -83620,7 +83636,7 @@ async function promptDirectorySelection(global3 = false) {
|
|
|
83620
83636
|
return selectedCategories;
|
|
83621
83637
|
}
|
|
83622
83638
|
async function promptFreshConfirmation(targetPath, analysis) {
|
|
83623
|
-
const backupRoot =
|
|
83639
|
+
const backupRoot = join80(PathResolver.getConfigDir(false), "backups");
|
|
83624
83640
|
logger.warning("[!] Fresh installation will remove ClaudeKit files:");
|
|
83625
83641
|
logger.info(`Path: ${targetPath}`);
|
|
83626
83642
|
logger.info(`Recovery backup: ${backupRoot}`);
|
|
@@ -83894,7 +83910,7 @@ init_logger();
|
|
|
83894
83910
|
init_logger();
|
|
83895
83911
|
init_path_resolver();
|
|
83896
83912
|
var import_fs_extra10 = __toESM(require_lib(), 1);
|
|
83897
|
-
import { join as
|
|
83913
|
+
import { join as join81 } from "node:path";
|
|
83898
83914
|
async function handleConflicts(ctx) {
|
|
83899
83915
|
if (ctx.cancelled)
|
|
83900
83916
|
return ctx;
|
|
@@ -83903,7 +83919,7 @@ async function handleConflicts(ctx) {
|
|
|
83903
83919
|
if (PathResolver.isLocalSameAsGlobal()) {
|
|
83904
83920
|
return ctx;
|
|
83905
83921
|
}
|
|
83906
|
-
const localSettingsPath =
|
|
83922
|
+
const localSettingsPath = join81(process.cwd(), ".claude", "settings.json");
|
|
83907
83923
|
if (!await import_fs_extra10.pathExists(localSettingsPath)) {
|
|
83908
83924
|
return ctx;
|
|
83909
83925
|
}
|
|
@@ -83918,7 +83934,7 @@ async function handleConflicts(ctx) {
|
|
|
83918
83934
|
return { ...ctx, cancelled: true };
|
|
83919
83935
|
}
|
|
83920
83936
|
if (choice === "remove") {
|
|
83921
|
-
const localClaudeDir =
|
|
83937
|
+
const localClaudeDir = join81(process.cwd(), ".claude");
|
|
83922
83938
|
try {
|
|
83923
83939
|
await import_fs_extra10.remove(localClaudeDir);
|
|
83924
83940
|
logger.success("Removed local .claude/ directory");
|
|
@@ -84015,7 +84031,7 @@ init_logger();
|
|
|
84015
84031
|
init_safe_spinner();
|
|
84016
84032
|
import { mkdir as mkdir26, stat as stat13 } from "node:fs/promises";
|
|
84017
84033
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
84018
|
-
import { join as
|
|
84034
|
+
import { join as join88 } from "node:path";
|
|
84019
84035
|
|
|
84020
84036
|
// src/shared/temp-cleanup.ts
|
|
84021
84037
|
init_logger();
|
|
@@ -84034,7 +84050,7 @@ init_logger();
|
|
|
84034
84050
|
init_output_manager();
|
|
84035
84051
|
import { createWriteStream as createWriteStream2, rmSync as rmSync2 } from "node:fs";
|
|
84036
84052
|
import { mkdir as mkdir21 } from "node:fs/promises";
|
|
84037
|
-
import { join as
|
|
84053
|
+
import { join as join82 } from "node:path";
|
|
84038
84054
|
|
|
84039
84055
|
// src/shared/progress-bar.ts
|
|
84040
84056
|
init_output_manager();
|
|
@@ -84244,7 +84260,7 @@ var MAX_DOWNLOAD_SIZE = 500 * 1024 * 1024;
|
|
|
84244
84260
|
class FileDownloader {
|
|
84245
84261
|
async downloadAsset(asset, destDir) {
|
|
84246
84262
|
try {
|
|
84247
|
-
const destPath =
|
|
84263
|
+
const destPath = join82(destDir, asset.name);
|
|
84248
84264
|
await mkdir21(destDir, { recursive: true });
|
|
84249
84265
|
output.info(`Downloading ${asset.name} (${formatBytes2(asset.size)})...`);
|
|
84250
84266
|
logger.verbose("Download details", {
|
|
@@ -84329,7 +84345,7 @@ class FileDownloader {
|
|
|
84329
84345
|
}
|
|
84330
84346
|
async downloadFile(params) {
|
|
84331
84347
|
const { url, name, size, destDir, token } = params;
|
|
84332
|
-
const destPath =
|
|
84348
|
+
const destPath = join82(destDir, name);
|
|
84333
84349
|
await mkdir21(destDir, { recursive: true });
|
|
84334
84350
|
output.info(`Downloading ${name}${size ? ` (${formatBytes2(size)})` : ""}...`);
|
|
84335
84351
|
const headers = {};
|
|
@@ -84415,7 +84431,7 @@ init_logger();
|
|
|
84415
84431
|
init_types3();
|
|
84416
84432
|
import { constants as constants4 } from "node:fs";
|
|
84417
84433
|
import { access as access4, readdir as readdir15 } from "node:fs/promises";
|
|
84418
|
-
import { join as
|
|
84434
|
+
import { join as join83 } from "node:path";
|
|
84419
84435
|
async function validateExtraction(extractDir) {
|
|
84420
84436
|
try {
|
|
84421
84437
|
const entries = await readdir15(extractDir, { encoding: "utf8" });
|
|
@@ -84427,7 +84443,7 @@ async function validateExtraction(extractDir) {
|
|
|
84427
84443
|
const missingPaths = [];
|
|
84428
84444
|
for (const path6 of criticalPaths) {
|
|
84429
84445
|
try {
|
|
84430
|
-
await access4(
|
|
84446
|
+
await access4(join83(extractDir, path6), constants4.F_OK);
|
|
84431
84447
|
logger.debug(`Found: ${path6}`);
|
|
84432
84448
|
} catch {
|
|
84433
84449
|
logger.warning(`Expected path not found: ${path6}`);
|
|
@@ -84449,7 +84465,7 @@ async function validateExtraction(extractDir) {
|
|
|
84449
84465
|
// src/domains/installation/extraction/tar-extractor.ts
|
|
84450
84466
|
init_logger();
|
|
84451
84467
|
import { copyFile as copyFile4, mkdir as mkdir24, readdir as readdir17, rm as rm9, stat as stat11 } from "node:fs/promises";
|
|
84452
|
-
import { join as
|
|
84468
|
+
import { join as join86 } from "node:path";
|
|
84453
84469
|
|
|
84454
84470
|
// node_modules/@isaacs/fs-minipass/dist/esm/index.js
|
|
84455
84471
|
import EE from "events";
|
|
@@ -90211,7 +90227,7 @@ var mkdirSync3 = (dir, opt) => {
|
|
|
90211
90227
|
};
|
|
90212
90228
|
|
|
90213
90229
|
// node_modules/tar/dist/esm/path-reservations.js
|
|
90214
|
-
import { join as
|
|
90230
|
+
import { join as join84 } from "node:path";
|
|
90215
90231
|
|
|
90216
90232
|
// node_modules/tar/dist/esm/normalize-unicode.js
|
|
90217
90233
|
var normalizeCache = Object.create(null);
|
|
@@ -90244,7 +90260,7 @@ var getDirs = (path11) => {
|
|
|
90244
90260
|
const dirs = path11.split("/").slice(0, -1).reduce((set, path12) => {
|
|
90245
90261
|
const s = set[set.length - 1];
|
|
90246
90262
|
if (s !== undefined) {
|
|
90247
|
-
path12 =
|
|
90263
|
+
path12 = join84(s, path12);
|
|
90248
90264
|
}
|
|
90249
90265
|
set.push(path12 || "/");
|
|
90250
90266
|
return set;
|
|
@@ -90258,7 +90274,7 @@ class PathReservations {
|
|
|
90258
90274
|
#running = new Set;
|
|
90259
90275
|
reserve(paths, fn) {
|
|
90260
90276
|
paths = isWindows4 ? ["win32 parallelization disabled"] : paths.map((p) => {
|
|
90261
|
-
return stripTrailingSlashes(
|
|
90277
|
+
return stripTrailingSlashes(join84(normalizeUnicode(p))).toLowerCase();
|
|
90262
90278
|
});
|
|
90263
90279
|
const dirs = new Set(paths.map((path11) => getDirs(path11)).reduce((a3, b3) => a3.concat(b3)));
|
|
90264
90280
|
this.#reservations.set(fn, { dirs, paths });
|
|
@@ -91318,7 +91334,7 @@ function decodeFilePath(path13) {
|
|
|
91318
91334
|
init_logger();
|
|
91319
91335
|
init_types3();
|
|
91320
91336
|
import { copyFile as copyFile3, lstat as lstat5, mkdir as mkdir23, readdir as readdir16 } from "node:fs/promises";
|
|
91321
|
-
import { join as
|
|
91337
|
+
import { join as join85, relative as relative10 } from "node:path";
|
|
91322
91338
|
async function withRetry(fn, retries = 3) {
|
|
91323
91339
|
for (let i = 0;i < retries; i++) {
|
|
91324
91340
|
try {
|
|
@@ -91340,8 +91356,8 @@ async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTrac
|
|
|
91340
91356
|
await mkdir23(destDir, { recursive: true });
|
|
91341
91357
|
const entries = await readdir16(sourceDir, { encoding: "utf8" });
|
|
91342
91358
|
for (const entry of entries) {
|
|
91343
|
-
const sourcePath =
|
|
91344
|
-
const destPath =
|
|
91359
|
+
const sourcePath = join85(sourceDir, entry);
|
|
91360
|
+
const destPath = join85(destDir, entry);
|
|
91345
91361
|
const relativePath = relative10(sourceDir, sourcePath);
|
|
91346
91362
|
if (!isPathSafe(destDir, destPath)) {
|
|
91347
91363
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -91368,8 +91384,8 @@ async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
|
91368
91384
|
await mkdir23(destDir, { recursive: true });
|
|
91369
91385
|
const entries = await readdir16(sourceDir, { encoding: "utf8" });
|
|
91370
91386
|
for (const entry of entries) {
|
|
91371
|
-
const sourcePath =
|
|
91372
|
-
const destPath =
|
|
91387
|
+
const sourcePath = join85(sourceDir, entry);
|
|
91388
|
+
const destPath = join85(destDir, entry);
|
|
91373
91389
|
const relativePath = relative10(sourceDir, sourcePath);
|
|
91374
91390
|
if (!isPathSafe(destDir, destPath)) {
|
|
91375
91391
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -91417,7 +91433,7 @@ class TarExtractor {
|
|
|
91417
91433
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
91418
91434
|
if (entries.length === 1) {
|
|
91419
91435
|
const rootEntry = entries[0];
|
|
91420
|
-
const rootPath =
|
|
91436
|
+
const rootPath = join86(tempExtractDir, rootEntry);
|
|
91421
91437
|
const rootStat = await stat11(rootPath);
|
|
91422
91438
|
if (rootStat.isDirectory()) {
|
|
91423
91439
|
const rootContents = await readdir17(rootPath, { encoding: "utf8" });
|
|
@@ -91433,7 +91449,7 @@ class TarExtractor {
|
|
|
91433
91449
|
}
|
|
91434
91450
|
} else {
|
|
91435
91451
|
await mkdir24(destDir, { recursive: true });
|
|
91436
|
-
await copyFile4(rootPath,
|
|
91452
|
+
await copyFile4(rootPath, join86(destDir, rootEntry));
|
|
91437
91453
|
}
|
|
91438
91454
|
} else {
|
|
91439
91455
|
logger.debug("Multiple root entries - moving all");
|
|
@@ -91456,7 +91472,7 @@ init_logger();
|
|
|
91456
91472
|
var import_extract_zip = __toESM(require_extract_zip(), 1);
|
|
91457
91473
|
import { execFile as execFile8 } from "node:child_process";
|
|
91458
91474
|
import { copyFile as copyFile5, mkdir as mkdir25, readdir as readdir18, rm as rm10, stat as stat12 } from "node:fs/promises";
|
|
91459
|
-
import { join as
|
|
91475
|
+
import { join as join87 } from "node:path";
|
|
91460
91476
|
class ZipExtractor {
|
|
91461
91477
|
async tryNativeUnzip(archivePath, destDir) {
|
|
91462
91478
|
if (!isMacOS()) {
|
|
@@ -91504,7 +91520,7 @@ class ZipExtractor {
|
|
|
91504
91520
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
91505
91521
|
if (entries.length === 1) {
|
|
91506
91522
|
const rootEntry = entries[0];
|
|
91507
|
-
const rootPath =
|
|
91523
|
+
const rootPath = join87(tempExtractDir, rootEntry);
|
|
91508
91524
|
const rootStat = await stat12(rootPath);
|
|
91509
91525
|
if (rootStat.isDirectory()) {
|
|
91510
91526
|
const rootContents = await readdir18(rootPath, { encoding: "utf8" });
|
|
@@ -91520,7 +91536,7 @@ class ZipExtractor {
|
|
|
91520
91536
|
}
|
|
91521
91537
|
} else {
|
|
91522
91538
|
await mkdir25(destDir, { recursive: true });
|
|
91523
|
-
await copyFile5(rootPath,
|
|
91539
|
+
await copyFile5(rootPath, join87(destDir, rootEntry));
|
|
91524
91540
|
}
|
|
91525
91541
|
} else {
|
|
91526
91542
|
logger.debug("Multiple root entries - moving all");
|
|
@@ -91619,7 +91635,7 @@ class DownloadManager {
|
|
|
91619
91635
|
async createTempDir() {
|
|
91620
91636
|
const timestamp = Date.now();
|
|
91621
91637
|
const counter = DownloadManager.tempDirCounter++;
|
|
91622
|
-
const primaryTempDir =
|
|
91638
|
+
const primaryTempDir = join88(tmpdir4(), `claudekit-${timestamp}-${counter}`);
|
|
91623
91639
|
try {
|
|
91624
91640
|
await mkdir26(primaryTempDir, { recursive: true });
|
|
91625
91641
|
logger.debug(`Created temp directory: ${primaryTempDir}`);
|
|
@@ -91636,7 +91652,7 @@ Solutions:
|
|
|
91636
91652
|
2. Set HOME environment variable
|
|
91637
91653
|
3. Try running from a different directory`);
|
|
91638
91654
|
}
|
|
91639
|
-
const fallbackTempDir =
|
|
91655
|
+
const fallbackTempDir = join88(homeDir, ".claudekit", "tmp", `claudekit-${timestamp}-${counter}`);
|
|
91640
91656
|
try {
|
|
91641
91657
|
await mkdir26(fallbackTempDir, { recursive: true });
|
|
91642
91658
|
logger.debug(`Created temp directory (fallback): ${fallbackTempDir}`);
|
|
@@ -92056,20 +92072,20 @@ async function handleDownload(ctx) {
|
|
|
92056
92072
|
};
|
|
92057
92073
|
}
|
|
92058
92074
|
// src/commands/init/phases/merge-handler.ts
|
|
92059
|
-
import { join as
|
|
92075
|
+
import { join as join105 } from "node:path";
|
|
92060
92076
|
|
|
92061
92077
|
// src/domains/installation/deletion-handler.ts
|
|
92062
92078
|
import { existsSync as existsSync53, lstatSync as lstatSync3, readdirSync as readdirSync5, rmSync as rmSync3, rmdirSync, unlinkSync as unlinkSync3 } from "node:fs";
|
|
92063
|
-
import { dirname as dirname26, join as
|
|
92079
|
+
import { dirname as dirname26, join as join91, relative as relative11, resolve as resolve24, sep as sep8 } from "node:path";
|
|
92064
92080
|
|
|
92065
92081
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
92066
92082
|
init_metadata_migration();
|
|
92067
92083
|
init_logger();
|
|
92068
92084
|
init_types3();
|
|
92069
92085
|
var import_fs_extra11 = __toESM(require_lib(), 1);
|
|
92070
|
-
import { join as
|
|
92086
|
+
import { join as join90 } from "node:path";
|
|
92071
92087
|
async function readManifest(claudeDir2) {
|
|
92072
|
-
const metadataPath =
|
|
92088
|
+
const metadataPath = join90(claudeDir2, "metadata.json");
|
|
92073
92089
|
if (!await import_fs_extra11.pathExists(metadataPath)) {
|
|
92074
92090
|
return null;
|
|
92075
92091
|
}
|
|
@@ -92255,7 +92271,7 @@ function collectFilesRecursively(dir, baseDir) {
|
|
|
92255
92271
|
try {
|
|
92256
92272
|
const entries = readdirSync5(dir, { withFileTypes: true });
|
|
92257
92273
|
for (const entry of entries) {
|
|
92258
|
-
const fullPath =
|
|
92274
|
+
const fullPath = join91(dir, entry.name);
|
|
92259
92275
|
const relativePath = relative11(baseDir, fullPath);
|
|
92260
92276
|
if (entry.isDirectory()) {
|
|
92261
92277
|
results.push(...collectFilesRecursively(fullPath, baseDir));
|
|
@@ -92323,7 +92339,7 @@ function deletePath(fullPath, claudeDir2) {
|
|
|
92323
92339
|
}
|
|
92324
92340
|
}
|
|
92325
92341
|
async function updateMetadataAfterDeletion(claudeDir2, deletedPaths) {
|
|
92326
|
-
const metadataPath =
|
|
92342
|
+
const metadataPath = join91(claudeDir2, "metadata.json");
|
|
92327
92343
|
if (!await import_fs_extra12.pathExists(metadataPath)) {
|
|
92328
92344
|
return;
|
|
92329
92345
|
}
|
|
@@ -92378,7 +92394,7 @@ async function handleDeletions(sourceMetadata, claudeDir2, kitType) {
|
|
|
92378
92394
|
const userMetadata = await readManifest(claudeDir2);
|
|
92379
92395
|
const result = { deletedPaths: [], preservedPaths: [], errors: [] };
|
|
92380
92396
|
for (const path14 of deletions) {
|
|
92381
|
-
const fullPath =
|
|
92397
|
+
const fullPath = join91(claudeDir2, path14);
|
|
92382
92398
|
const normalizedPath = resolve24(fullPath);
|
|
92383
92399
|
const normalizedClaudeDir = resolve24(claudeDir2);
|
|
92384
92400
|
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep8}`)) {
|
|
@@ -92418,7 +92434,7 @@ init_logger();
|
|
|
92418
92434
|
init_types3();
|
|
92419
92435
|
var import_fs_extra15 = __toESM(require_lib(), 1);
|
|
92420
92436
|
var import_ignore3 = __toESM(require_ignore(), 1);
|
|
92421
|
-
import { dirname as dirname28, join as
|
|
92437
|
+
import { dirname as dirname28, join as join95, relative as relative13 } from "node:path";
|
|
92422
92438
|
|
|
92423
92439
|
// src/domains/installation/selective-merger.ts
|
|
92424
92440
|
import { stat as stat14 } from "node:fs/promises";
|
|
@@ -92597,7 +92613,7 @@ init_logger();
|
|
|
92597
92613
|
var import_fs_extra13 = __toESM(require_lib(), 1);
|
|
92598
92614
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
92599
92615
|
import { relative as relative12 } from "node:path";
|
|
92600
|
-
import { join as
|
|
92616
|
+
import { join as join92 } from "node:path";
|
|
92601
92617
|
|
|
92602
92618
|
// node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
92603
92619
|
var balanced = (a3, b3, str2) => {
|
|
@@ -94053,7 +94069,7 @@ class FileScanner {
|
|
|
94053
94069
|
const files = [];
|
|
94054
94070
|
const entries = await import_fs_extra13.readdir(dir, { encoding: "utf8" });
|
|
94055
94071
|
for (const entry of entries) {
|
|
94056
|
-
const fullPath =
|
|
94072
|
+
const fullPath = join92(dir, entry);
|
|
94057
94073
|
const relativePath = relative12(baseDir, fullPath);
|
|
94058
94074
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
94059
94075
|
const stats = await import_fs_extra13.lstat(fullPath);
|
|
@@ -94088,12 +94104,14 @@ class FileScanner {
|
|
|
94088
94104
|
|
|
94089
94105
|
// src/domains/installation/merger/settings-processor.ts
|
|
94090
94106
|
import { execSync as execSync4 } from "node:child_process";
|
|
94107
|
+
import { homedir as homedir32 } from "node:os";
|
|
94108
|
+
import { join as join94 } from "node:path";
|
|
94091
94109
|
|
|
94092
94110
|
// src/domains/config/installed-settings-tracker.ts
|
|
94093
94111
|
init_shared();
|
|
94094
94112
|
import { existsSync as existsSync54 } from "node:fs";
|
|
94095
94113
|
import { mkdir as mkdir27, readFile as readFile40, writeFile as writeFile22 } from "node:fs/promises";
|
|
94096
|
-
import { dirname as dirname27, join as
|
|
94114
|
+
import { dirname as dirname27, join as join93 } from "node:path";
|
|
94097
94115
|
var CK_JSON_FILE = ".ck.json";
|
|
94098
94116
|
|
|
94099
94117
|
class InstalledSettingsTracker {
|
|
@@ -94107,9 +94125,9 @@ class InstalledSettingsTracker {
|
|
|
94107
94125
|
}
|
|
94108
94126
|
getCkJsonPath() {
|
|
94109
94127
|
if (this.isGlobal) {
|
|
94110
|
-
return
|
|
94128
|
+
return join93(this.projectDir, CK_JSON_FILE);
|
|
94111
94129
|
}
|
|
94112
|
-
return
|
|
94130
|
+
return join93(this.projectDir, ".claude", CK_JSON_FILE);
|
|
94113
94131
|
}
|
|
94114
94132
|
async loadInstalledSettings() {
|
|
94115
94133
|
const ckJsonPath = this.getCkJsonPath();
|
|
@@ -94184,7 +94202,9 @@ class InstalledSettingsTracker {
|
|
|
94184
94202
|
|
|
94185
94203
|
// src/domains/installation/merger/settings-processor.ts
|
|
94186
94204
|
init_settings_merger();
|
|
94205
|
+
init_command_normalizer();
|
|
94187
94206
|
init_logger();
|
|
94207
|
+
init_path_resolver();
|
|
94188
94208
|
var import_fs_extra14 = __toESM(require_lib(), 1);
|
|
94189
94209
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
94190
94210
|
|
|
@@ -94228,16 +94248,15 @@ class SettingsProcessor {
|
|
|
94228
94248
|
const sourceContent = await import_fs_extra14.readFile(sourceFile, "utf-8");
|
|
94229
94249
|
let transformedSource = sourceContent;
|
|
94230
94250
|
if (this.isGlobal) {
|
|
94231
|
-
const
|
|
94232
|
-
transformedSource = this.transformClaudePaths(sourceContent,
|
|
94251
|
+
const globalRoot = this.getCanonicalGlobalCommandRoot();
|
|
94252
|
+
transformedSource = this.transformClaudePaths(sourceContent, globalRoot);
|
|
94233
94253
|
if (transformedSource !== sourceContent) {
|
|
94234
|
-
logger.debug(`Transformed .claude/ paths to ${
|
|
94254
|
+
logger.debug(`Transformed .claude/ paths to ${globalRoot} in settings.json for global installation`);
|
|
94235
94255
|
}
|
|
94236
94256
|
} else {
|
|
94237
|
-
|
|
94238
|
-
transformedSource = this.transformClaudePaths(sourceContent, projectDirVar);
|
|
94257
|
+
transformedSource = this.transformClaudePaths(sourceContent, "$CLAUDE_PROJECT_DIR");
|
|
94239
94258
|
if (transformedSource !== sourceContent) {
|
|
94240
|
-
logger.debug(
|
|
94259
|
+
logger.debug('Transformed .claude/ paths to "$CLAUDE_PROJECT_DIR"/.claude/ in settings.json for local installation');
|
|
94241
94260
|
}
|
|
94242
94261
|
}
|
|
94243
94262
|
const destExists = await import_fs_extra14.pathExists(destFile);
|
|
@@ -94469,36 +94488,27 @@ class SettingsProcessor {
|
|
|
94469
94488
|
const content = await import_fs_extra14.readFile(destFile, "utf-8");
|
|
94470
94489
|
if (!content.trim())
|
|
94471
94490
|
return null;
|
|
94472
|
-
const
|
|
94473
|
-
|
|
94474
|
-
|
|
94475
|
-
normalized = normalized.replace(/\$CLAUDE_PROJECT_DIR/g, homeVar);
|
|
94476
|
-
normalized = normalized.replace(/"%CLAUDE_PROJECT_DIR%"/g, `"${homeVar}"`);
|
|
94477
|
-
normalized = normalized.replace(/%CLAUDE_PROJECT_DIR%/g, homeVar);
|
|
94478
|
-
normalized = normalized.replace(/"%USERPROFILE%"/g, `"${homeVar}"`);
|
|
94479
|
-
normalized = normalized.replace(/%USERPROFILE%/g, homeVar);
|
|
94480
|
-
if (normalized !== content) {
|
|
94481
|
-
logger.debug("Normalized $CLAUDE_PROJECT_DIR paths to $HOME in existing global settings");
|
|
94482
|
-
}
|
|
94483
|
-
return JSON.parse(normalized);
|
|
94491
|
+
const parsedSettings = JSON.parse(content);
|
|
94492
|
+
this.fixHookCommandPaths(parsedSettings);
|
|
94493
|
+
return parsedSettings;
|
|
94484
94494
|
} catch {
|
|
94485
94495
|
return null;
|
|
94486
94496
|
}
|
|
94487
94497
|
}
|
|
94488
|
-
transformClaudePaths(content,
|
|
94498
|
+
transformClaudePaths(content, root) {
|
|
94489
94499
|
if (/\.claude\/[^\s"']*[;`$&|><]/.test(content)) {
|
|
94490
94500
|
logger.warning("Potentially unsafe characters detected in .claude/ paths");
|
|
94491
94501
|
throw new Error("Settings file contains potentially unsafe path characters");
|
|
94492
94502
|
}
|
|
94493
94503
|
let transformed = content;
|
|
94494
|
-
const rawPrefix = prefix.replace(/"/g, "");
|
|
94495
94504
|
transformed = transformed.replace(/(node\s+)(?:\.\/)?(\.claude\/[^\s"\\]+)([^"\\]*)/g, (_match, nodePrefix, relativePath, suffix) => {
|
|
94496
|
-
|
|
94497
|
-
return rawPrefix === "$CLAUDE_PROJECT_DIR" ? `${nodePrefix}\\"${rawPrefix}\\"/${normalizedRelativePath}${suffix}` : `${nodePrefix}\\"${rawPrefix}/${normalizedRelativePath}\\"${suffix}`;
|
|
94505
|
+
return this.formatCommandPath(nodePrefix, root, relativePath, suffix).replace(/"/g, "\\\"");
|
|
94498
94506
|
});
|
|
94499
|
-
if (
|
|
94500
|
-
transformed = transformed.replace(
|
|
94501
|
-
transformed = transformed.replace(
|
|
94507
|
+
if (this.isGlobal) {
|
|
94508
|
+
transformed = transformed.replace(/"\$CLAUDE_PROJECT_DIR"/g, `"${root}"`);
|
|
94509
|
+
transformed = transformed.replace(/\$CLAUDE_PROJECT_DIR/g, root);
|
|
94510
|
+
transformed = transformed.replace(/"%CLAUDE_PROJECT_DIR%"/g, `"${root}"`);
|
|
94511
|
+
transformed = transformed.replace(/%CLAUDE_PROJECT_DIR%/g, root);
|
|
94502
94512
|
}
|
|
94503
94513
|
return transformed;
|
|
94504
94514
|
}
|
|
@@ -94544,7 +94554,7 @@ class SettingsProcessor {
|
|
|
94544
94554
|
const bareRelativeMatch = cmd.match(/^(node\s+)(?:\.\/)?(\.claude[/\\][^\s"]+)(.*)$/);
|
|
94545
94555
|
if (bareRelativeMatch) {
|
|
94546
94556
|
const [, nodePrefix, relativePath, suffix] = bareRelativeMatch;
|
|
94547
|
-
return this.formatCommandPath(nodePrefix, this.isGlobal ?
|
|
94557
|
+
return this.formatCommandPath(nodePrefix, this.isGlobal ? this.getCanonicalGlobalCommandRoot() : "$CLAUDE_PROJECT_DIR", relativePath, suffix);
|
|
94548
94558
|
}
|
|
94549
94559
|
const embeddedQuotedMatch = cmd.match(/^(node\s+)"(\$HOME|\$CLAUDE_PROJECT_DIR|%USERPROFILE%|%CLAUDE_PROJECT_DIR%)[/\\](\.claude[/\\][^"]+)"(.*)$/);
|
|
94550
94560
|
if (embeddedQuotedMatch) {
|
|
@@ -94569,19 +94579,45 @@ class SettingsProcessor {
|
|
|
94569
94579
|
return cmd;
|
|
94570
94580
|
}
|
|
94571
94581
|
formatCommandPath(nodePrefix, capturedVar, relativePath, suffix = "") {
|
|
94572
|
-
const
|
|
94573
|
-
const normalizedRelativePath =
|
|
94574
|
-
return
|
|
94582
|
+
const canonicalRoot = this.canonicalizePathRoot(capturedVar);
|
|
94583
|
+
const normalizedRelativePath = this.normalizeRelativePath(canonicalRoot, relativePath);
|
|
94584
|
+
return canonicalRoot === "$CLAUDE_PROJECT_DIR" ? `${nodePrefix}"${canonicalRoot}"/${normalizedRelativePath}${suffix}` : `${nodePrefix}"${canonicalRoot}/${normalizedRelativePath}"${suffix}`;
|
|
94575
94585
|
}
|
|
94576
|
-
|
|
94586
|
+
canonicalizePathRoot(capturedVar) {
|
|
94577
94587
|
switch (capturedVar) {
|
|
94578
94588
|
case "%USERPROFILE%":
|
|
94579
|
-
|
|
94589
|
+
case "$HOME":
|
|
94590
|
+
return this.isGlobal ? this.getCanonicalGlobalCommandRoot() : "$HOME";
|
|
94580
94591
|
case "%CLAUDE_PROJECT_DIR%":
|
|
94581
|
-
|
|
94592
|
+
case "$CLAUDE_PROJECT_DIR":
|
|
94593
|
+
return this.isGlobal ? this.getCanonicalGlobalCommandRoot() : "$CLAUDE_PROJECT_DIR";
|
|
94582
94594
|
default:
|
|
94583
|
-
return capturedVar;
|
|
94595
|
+
return capturedVar.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
94596
|
+
}
|
|
94597
|
+
}
|
|
94598
|
+
normalizeRelativePath(root, relativePath) {
|
|
94599
|
+
const normalizedRelativePath = relativePath.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
94600
|
+
if (root !== "$CLAUDE_PROJECT_DIR" && this.usesCustomGlobalInstallPath()) {
|
|
94601
|
+
return normalizedRelativePath.replace(/^\.claude\//, "");
|
|
94584
94602
|
}
|
|
94603
|
+
return normalizedRelativePath;
|
|
94604
|
+
}
|
|
94605
|
+
getCanonicalGlobalCommandRoot() {
|
|
94606
|
+
if (this.usesCustomGlobalInstallPath()) {
|
|
94607
|
+
return PathResolver.getGlobalKitDir().replace(/\\/g, "/").replace(/\/+$/, "");
|
|
94608
|
+
}
|
|
94609
|
+
return "$HOME";
|
|
94610
|
+
}
|
|
94611
|
+
usesCustomGlobalInstallPath() {
|
|
94612
|
+
if (!this.isGlobal || !this.projectDir) {
|
|
94613
|
+
if (this.isGlobal && !this.projectDir) {
|
|
94614
|
+
logger.debug("usesCustomGlobalInstallPath: global mode but projectDir not set — defaulting to $HOME");
|
|
94615
|
+
}
|
|
94616
|
+
return false;
|
|
94617
|
+
}
|
|
94618
|
+
const configuredGlobalDir = PathResolver.getGlobalKitDir().replace(/\\/g, "/").replace(/\/+$/, "");
|
|
94619
|
+
const defaultGlobalDir = join94(homedir32(), ".claude").replace(/\\/g, "/");
|
|
94620
|
+
return configuredGlobalDir !== defaultGlobalDir;
|
|
94585
94621
|
}
|
|
94586
94622
|
detectClaudeCodeVersion() {
|
|
94587
94623
|
if (this.cachedVersion !== undefined)
|
|
@@ -94631,7 +94667,7 @@ class SettingsProcessor {
|
|
|
94631
94667
|
{ event: "TeammateIdle", handler: "teammate-idle-handler.cjs" }
|
|
94632
94668
|
];
|
|
94633
94669
|
for (const { event, handler } of teamHooks) {
|
|
94634
|
-
const hookCommand = this.formatCommandPath("node ", this.isGlobal ?
|
|
94670
|
+
const hookCommand = this.formatCommandPath("node ", this.isGlobal ? this.getCanonicalGlobalCommandRoot() : "$CLAUDE_PROJECT_DIR", `.claude/hooks/${handler}`);
|
|
94635
94671
|
const eventHooks = settings.hooks[event];
|
|
94636
94672
|
if (eventHooks && eventHooks.length > 0)
|
|
94637
94673
|
continue;
|
|
@@ -94738,7 +94774,7 @@ class CopyExecutor {
|
|
|
94738
94774
|
for (const file of files) {
|
|
94739
94775
|
const relativePath = relative13(sourceDir, file);
|
|
94740
94776
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
94741
|
-
const destPath =
|
|
94777
|
+
const destPath = join95(destDir, relativePath);
|
|
94742
94778
|
if (await import_fs_extra15.pathExists(destPath)) {
|
|
94743
94779
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
94744
94780
|
logger.debug(`Security-sensitive file exists but won't be overwritten: ${normalizedRelativePath}`);
|
|
@@ -94760,7 +94796,7 @@ class CopyExecutor {
|
|
|
94760
94796
|
for (const file of files) {
|
|
94761
94797
|
const relativePath = relative13(sourceDir, file);
|
|
94762
94798
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
94763
|
-
const destPath =
|
|
94799
|
+
const destPath = join95(destDir, relativePath);
|
|
94764
94800
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
94765
94801
|
logger.debug(`Skipping security-sensitive file: ${normalizedRelativePath}`);
|
|
94766
94802
|
skippedCount++;
|
|
@@ -94933,15 +94969,15 @@ class FileMerger {
|
|
|
94933
94969
|
|
|
94934
94970
|
// src/domains/migration/legacy-migration.ts
|
|
94935
94971
|
import { readdir as readdir20, stat as stat15 } from "node:fs/promises";
|
|
94936
|
-
import { join as
|
|
94972
|
+
import { join as join99, relative as relative14 } from "node:path";
|
|
94937
94973
|
// src/services/file-operations/manifest/manifest-tracker.ts
|
|
94938
|
-
import { join as
|
|
94974
|
+
import { join as join98 } from "node:path";
|
|
94939
94975
|
|
|
94940
94976
|
// src/domains/migration/release-manifest.ts
|
|
94941
94977
|
init_logger();
|
|
94942
94978
|
init_zod();
|
|
94943
94979
|
var import_fs_extra16 = __toESM(require_lib(), 1);
|
|
94944
|
-
import { join as
|
|
94980
|
+
import { join as join96 } from "node:path";
|
|
94945
94981
|
var ReleaseManifestFileSchema = exports_external.object({
|
|
94946
94982
|
path: exports_external.string(),
|
|
94947
94983
|
checksum: exports_external.string().regex(/^[a-f0-9]{64}$/),
|
|
@@ -94956,7 +94992,7 @@ var ReleaseManifestSchema = exports_external.object({
|
|
|
94956
94992
|
|
|
94957
94993
|
class ReleaseManifestLoader {
|
|
94958
94994
|
static async load(extractDir) {
|
|
94959
|
-
const manifestPath =
|
|
94995
|
+
const manifestPath = join96(extractDir, "release-manifest.json");
|
|
94960
94996
|
try {
|
|
94961
94997
|
const content = await import_fs_extra16.readFile(manifestPath, "utf-8");
|
|
94962
94998
|
const parsed = JSON.parse(content);
|
|
@@ -94978,12 +95014,12 @@ init_safe_spinner();
|
|
|
94978
95014
|
|
|
94979
95015
|
// src/services/file-operations/manifest/manifest-updater.ts
|
|
94980
95016
|
init_metadata_migration();
|
|
94981
|
-
import { join as
|
|
95017
|
+
import { join as join97 } from "node:path";
|
|
94982
95018
|
init_logger();
|
|
94983
95019
|
init_types3();
|
|
94984
95020
|
var import_fs_extra17 = __toESM(require_lib(), 1);
|
|
94985
95021
|
async function writeManifest(claudeDir2, kitName, version, scope, kitType, trackedFiles, userConfigFiles) {
|
|
94986
|
-
const metadataPath =
|
|
95022
|
+
const metadataPath = join97(claudeDir2, "metadata.json");
|
|
94987
95023
|
const kit = kitType || (/\bmarketing\b/i.test(kitName) ? "marketing" : "engineer");
|
|
94988
95024
|
await import_fs_extra17.ensureFile(metadataPath);
|
|
94989
95025
|
let release = null;
|
|
@@ -95035,7 +95071,7 @@ async function writeManifest(claudeDir2, kitName, version, scope, kitType, track
|
|
|
95035
95071
|
}
|
|
95036
95072
|
}
|
|
95037
95073
|
async function removeKitFromManifest(claudeDir2, kit, options2) {
|
|
95038
|
-
const metadataPath =
|
|
95074
|
+
const metadataPath = join97(claudeDir2, "metadata.json");
|
|
95039
95075
|
if (!await import_fs_extra17.pathExists(metadataPath))
|
|
95040
95076
|
return false;
|
|
95041
95077
|
let release = null;
|
|
@@ -95067,7 +95103,7 @@ async function removeKitFromManifest(claudeDir2, kit, options2) {
|
|
|
95067
95103
|
}
|
|
95068
95104
|
}
|
|
95069
95105
|
async function retainTrackedFilesInManifest(claudeDir2, retainedPaths, options2) {
|
|
95070
|
-
const metadataPath =
|
|
95106
|
+
const metadataPath = join97(claudeDir2, "metadata.json");
|
|
95071
95107
|
if (!await import_fs_extra17.pathExists(metadataPath))
|
|
95072
95108
|
return false;
|
|
95073
95109
|
const normalizedPaths = new Set(retainedPaths.map((path15) => path15.replace(/\\/g, "/")));
|
|
@@ -95248,7 +95284,7 @@ function buildFileTrackingList(options2) {
|
|
|
95248
95284
|
if (!isGlobal && !installedPath.startsWith(".claude/"))
|
|
95249
95285
|
continue;
|
|
95250
95286
|
const relativePath = isGlobal ? installedPath : installedPath.replace(/^\.claude\//, "");
|
|
95251
|
-
const filePath =
|
|
95287
|
+
const filePath = join98(claudeDir2, relativePath);
|
|
95252
95288
|
const manifestEntry = releaseManifest ? ReleaseManifestLoader.findFile(releaseManifest, installedPath) : null;
|
|
95253
95289
|
const ownership = manifestEntry ? "ck" : "user";
|
|
95254
95290
|
filesToTrack.push({
|
|
@@ -95358,7 +95394,7 @@ class LegacyMigration {
|
|
|
95358
95394
|
continue;
|
|
95359
95395
|
if (SKIP_DIRS_ALL.includes(entry))
|
|
95360
95396
|
continue;
|
|
95361
|
-
const fullPath =
|
|
95397
|
+
const fullPath = join99(dir, entry);
|
|
95362
95398
|
let stats;
|
|
95363
95399
|
try {
|
|
95364
95400
|
stats = await stat15(fullPath);
|
|
@@ -95460,7 +95496,7 @@ User-created files (sample):`);
|
|
|
95460
95496
|
];
|
|
95461
95497
|
if (filesToChecksum.length > 0) {
|
|
95462
95498
|
const checksumResults = await mapWithLimit(filesToChecksum, async ({ relativePath, ownership }) => {
|
|
95463
|
-
const fullPath =
|
|
95499
|
+
const fullPath = join99(claudeDir2, relativePath);
|
|
95464
95500
|
const checksum = await OwnershipChecker.calculateChecksum(fullPath);
|
|
95465
95501
|
return { relativePath, checksum, ownership };
|
|
95466
95502
|
});
|
|
@@ -95481,7 +95517,7 @@ User-created files (sample):`);
|
|
|
95481
95517
|
installedAt: new Date().toISOString(),
|
|
95482
95518
|
files: trackedFiles
|
|
95483
95519
|
};
|
|
95484
|
-
const metadataPath =
|
|
95520
|
+
const metadataPath = join99(claudeDir2, "metadata.json");
|
|
95485
95521
|
await import_fs_extra18.writeFile(metadataPath, JSON.stringify(updatedMetadata, null, 2));
|
|
95486
95522
|
logger.success(`Migration complete: tracked ${trackedFiles.length} files`);
|
|
95487
95523
|
return true;
|
|
@@ -95587,7 +95623,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
|
|
|
95587
95623
|
init_logger();
|
|
95588
95624
|
init_skip_directories();
|
|
95589
95625
|
var import_fs_extra19 = __toESM(require_lib(), 1);
|
|
95590
|
-
import { join as
|
|
95626
|
+
import { join as join100, relative as relative15, resolve as resolve25 } from "node:path";
|
|
95591
95627
|
|
|
95592
95628
|
class FileScanner2 {
|
|
95593
95629
|
static async getFiles(dirPath, relativeTo) {
|
|
@@ -95603,7 +95639,7 @@ class FileScanner2 {
|
|
|
95603
95639
|
logger.debug(`Skipping directory: ${entry}`);
|
|
95604
95640
|
continue;
|
|
95605
95641
|
}
|
|
95606
|
-
const fullPath =
|
|
95642
|
+
const fullPath = join100(dirPath, entry);
|
|
95607
95643
|
if (!FileScanner2.isSafePath(basePath, fullPath)) {
|
|
95608
95644
|
logger.warning(`Skipping potentially unsafe path: ${entry}`);
|
|
95609
95645
|
continue;
|
|
@@ -95638,8 +95674,8 @@ class FileScanner2 {
|
|
|
95638
95674
|
return files;
|
|
95639
95675
|
}
|
|
95640
95676
|
static async findCustomFiles(destDir, sourceDir, subPath) {
|
|
95641
|
-
const destSubDir =
|
|
95642
|
-
const sourceSubDir =
|
|
95677
|
+
const destSubDir = join100(destDir, subPath);
|
|
95678
|
+
const sourceSubDir = join100(sourceDir, subPath);
|
|
95643
95679
|
logger.debug(`findCustomFiles - destDir: ${destDir}`);
|
|
95644
95680
|
logger.debug(`findCustomFiles - sourceDir: ${sourceDir}`);
|
|
95645
95681
|
logger.debug(`findCustomFiles - subPath: "${subPath}"`);
|
|
@@ -95680,12 +95716,12 @@ class FileScanner2 {
|
|
|
95680
95716
|
init_logger();
|
|
95681
95717
|
var import_fs_extra20 = __toESM(require_lib(), 1);
|
|
95682
95718
|
import { lstat as lstat8, mkdir as mkdir28, readdir as readdir23, stat as stat16 } from "node:fs/promises";
|
|
95683
|
-
import { join as
|
|
95719
|
+
import { join as join102 } from "node:path";
|
|
95684
95720
|
|
|
95685
95721
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
95686
95722
|
init_logger();
|
|
95687
95723
|
import { readFile as readFile44, readdir as readdir22, writeFile as writeFile26 } from "node:fs/promises";
|
|
95688
|
-
import { join as
|
|
95724
|
+
import { join as join101 } from "node:path";
|
|
95689
95725
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
95690
95726
|
".md",
|
|
95691
95727
|
".txt",
|
|
@@ -95746,7 +95782,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
95746
95782
|
async function processDirectory(dir) {
|
|
95747
95783
|
const entries = await readdir22(dir, { withFileTypes: true });
|
|
95748
95784
|
for (const entry of entries) {
|
|
95749
|
-
const fullPath =
|
|
95785
|
+
const fullPath = join101(dir, entry.name);
|
|
95750
95786
|
if (entry.isDirectory()) {
|
|
95751
95787
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
95752
95788
|
continue;
|
|
@@ -95821,14 +95857,14 @@ function shouldApplyPrefix(options2) {
|
|
|
95821
95857
|
// src/services/transformers/commands-prefix/prefix-applier.ts
|
|
95822
95858
|
async function applyPrefix(extractDir) {
|
|
95823
95859
|
validatePath(extractDir, "extractDir");
|
|
95824
|
-
const commandsDir =
|
|
95860
|
+
const commandsDir = join102(extractDir, ".claude", "commands");
|
|
95825
95861
|
if (!await import_fs_extra20.pathExists(commandsDir)) {
|
|
95826
95862
|
logger.verbose("No commands directory found, skipping prefix application");
|
|
95827
95863
|
return;
|
|
95828
95864
|
}
|
|
95829
95865
|
logger.info("Applying /ck: prefix to slash commands...");
|
|
95830
|
-
const backupDir =
|
|
95831
|
-
const tempDir =
|
|
95866
|
+
const backupDir = join102(extractDir, ".commands-backup");
|
|
95867
|
+
const tempDir = join102(extractDir, ".commands-prefix-temp");
|
|
95832
95868
|
try {
|
|
95833
95869
|
const entries = await readdir23(commandsDir);
|
|
95834
95870
|
if (entries.length === 0) {
|
|
@@ -95836,7 +95872,7 @@ async function applyPrefix(extractDir) {
|
|
|
95836
95872
|
return;
|
|
95837
95873
|
}
|
|
95838
95874
|
if (entries.length === 1 && entries[0] === "ck") {
|
|
95839
|
-
const ckDir2 =
|
|
95875
|
+
const ckDir2 = join102(commandsDir, "ck");
|
|
95840
95876
|
const ckStat = await stat16(ckDir2);
|
|
95841
95877
|
if (ckStat.isDirectory()) {
|
|
95842
95878
|
logger.verbose("Commands already have /ck: prefix, skipping");
|
|
@@ -95846,17 +95882,17 @@ async function applyPrefix(extractDir) {
|
|
|
95846
95882
|
await import_fs_extra20.copy(commandsDir, backupDir);
|
|
95847
95883
|
logger.verbose("Created backup of commands directory");
|
|
95848
95884
|
await mkdir28(tempDir, { recursive: true });
|
|
95849
|
-
const ckDir =
|
|
95885
|
+
const ckDir = join102(tempDir, "ck");
|
|
95850
95886
|
await mkdir28(ckDir, { recursive: true });
|
|
95851
95887
|
let processedCount = 0;
|
|
95852
95888
|
for (const entry of entries) {
|
|
95853
|
-
const sourcePath =
|
|
95889
|
+
const sourcePath = join102(commandsDir, entry);
|
|
95854
95890
|
const stats = await lstat8(sourcePath);
|
|
95855
95891
|
if (stats.isSymbolicLink()) {
|
|
95856
95892
|
logger.warning(`Skipping symlink for security: ${entry}`);
|
|
95857
95893
|
continue;
|
|
95858
95894
|
}
|
|
95859
|
-
const destPath =
|
|
95895
|
+
const destPath = join102(ckDir, entry);
|
|
95860
95896
|
await import_fs_extra20.copy(sourcePath, destPath, {
|
|
95861
95897
|
overwrite: false,
|
|
95862
95898
|
errorOnExist: true
|
|
@@ -95874,7 +95910,7 @@ async function applyPrefix(extractDir) {
|
|
|
95874
95910
|
await import_fs_extra20.move(tempDir, commandsDir);
|
|
95875
95911
|
await import_fs_extra20.remove(backupDir);
|
|
95876
95912
|
logger.success("Successfully reorganized commands to /ck: prefix");
|
|
95877
|
-
const claudeDir2 =
|
|
95913
|
+
const claudeDir2 = join102(extractDir, ".claude");
|
|
95878
95914
|
logger.info("Transforming command references in file contents...");
|
|
95879
95915
|
const transformResult = await transformCommandReferences(claudeDir2, {
|
|
95880
95916
|
verbose: logger.isVerbose()
|
|
@@ -95912,20 +95948,20 @@ async function applyPrefix(extractDir) {
|
|
|
95912
95948
|
// src/services/transformers/commands-prefix/prefix-cleaner.ts
|
|
95913
95949
|
init_metadata_migration();
|
|
95914
95950
|
import { lstat as lstat10, readdir as readdir25 } from "node:fs/promises";
|
|
95915
|
-
import { join as
|
|
95951
|
+
import { join as join104 } from "node:path";
|
|
95916
95952
|
init_logger();
|
|
95917
95953
|
var import_fs_extra22 = __toESM(require_lib(), 1);
|
|
95918
95954
|
|
|
95919
95955
|
// src/services/transformers/commands-prefix/file-processor.ts
|
|
95920
95956
|
import { lstat as lstat9, readdir as readdir24 } from "node:fs/promises";
|
|
95921
|
-
import { join as
|
|
95957
|
+
import { join as join103 } from "node:path";
|
|
95922
95958
|
init_logger();
|
|
95923
95959
|
var import_fs_extra21 = __toESM(require_lib(), 1);
|
|
95924
95960
|
async function scanDirectoryFiles(dir) {
|
|
95925
95961
|
const files = [];
|
|
95926
95962
|
const entries = await readdir24(dir);
|
|
95927
95963
|
for (const entry of entries) {
|
|
95928
|
-
const fullPath =
|
|
95964
|
+
const fullPath = join103(dir, entry);
|
|
95929
95965
|
const stats = await lstat9(fullPath);
|
|
95930
95966
|
if (stats.isSymbolicLink()) {
|
|
95931
95967
|
continue;
|
|
@@ -96053,8 +96089,8 @@ function isDifferentKitDirectory(dirName, currentKit) {
|
|
|
96053
96089
|
async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
96054
96090
|
const { dryRun = false } = options2;
|
|
96055
96091
|
validatePath(targetDir, "targetDir");
|
|
96056
|
-
const claudeDir2 = isGlobal ? targetDir :
|
|
96057
|
-
const commandsDir =
|
|
96092
|
+
const claudeDir2 = isGlobal ? targetDir : join104(targetDir, ".claude");
|
|
96093
|
+
const commandsDir = join104(claudeDir2, "commands");
|
|
96058
96094
|
const accumulator = {
|
|
96059
96095
|
results: [],
|
|
96060
96096
|
deletedCount: 0,
|
|
@@ -96096,7 +96132,7 @@ async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
|
96096
96132
|
}
|
|
96097
96133
|
const metadataForChecks = options2.kitType ? createKitSpecificMetadata(metadata, options2.kitType) : metadata;
|
|
96098
96134
|
for (const entry of entries) {
|
|
96099
|
-
const entryPath =
|
|
96135
|
+
const entryPath = join104(commandsDir, entry);
|
|
96100
96136
|
const stats = await lstat10(entryPath);
|
|
96101
96137
|
if (stats.isSymbolicLink()) {
|
|
96102
96138
|
addSymlinkSkip(entry, accumulator);
|
|
@@ -96153,7 +96189,7 @@ async function handleMerge(ctx) {
|
|
|
96153
96189
|
let customClaudeFiles = [];
|
|
96154
96190
|
if (!ctx.options.fresh) {
|
|
96155
96191
|
logger.info("Scanning for custom .claude files...");
|
|
96156
|
-
const scanSourceDir = ctx.options.global ?
|
|
96192
|
+
const scanSourceDir = ctx.options.global ? join105(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
96157
96193
|
const scanTargetSubdir = ctx.options.global ? "" : ".claude";
|
|
96158
96194
|
customClaudeFiles = await FileScanner2.findCustomFiles(ctx.resolvedDir, scanSourceDir, scanTargetSubdir);
|
|
96159
96195
|
} else {
|
|
@@ -96218,8 +96254,8 @@ async function handleMerge(ctx) {
|
|
|
96218
96254
|
return { ...ctx, cancelled: true };
|
|
96219
96255
|
}
|
|
96220
96256
|
}
|
|
96221
|
-
const sourceDir = ctx.options.global ?
|
|
96222
|
-
const sourceMetadataPath = ctx.options.global ?
|
|
96257
|
+
const sourceDir = ctx.options.global ? join105(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
96258
|
+
const sourceMetadataPath = ctx.options.global ? join105(sourceDir, "metadata.json") : join105(sourceDir, ".claude", "metadata.json");
|
|
96223
96259
|
let sourceMetadata = null;
|
|
96224
96260
|
try {
|
|
96225
96261
|
if (await import_fs_extra23.pathExists(sourceMetadataPath)) {
|
|
@@ -96276,7 +96312,7 @@ async function handleMerge(ctx) {
|
|
|
96276
96312
|
};
|
|
96277
96313
|
}
|
|
96278
96314
|
// src/commands/init/phases/migration-handler.ts
|
|
96279
|
-
import { join as
|
|
96315
|
+
import { join as join113 } from "node:path";
|
|
96280
96316
|
|
|
96281
96317
|
// src/domains/skills/skills-detector.ts
|
|
96282
96318
|
init_logger();
|
|
@@ -96292,7 +96328,7 @@ init_types3();
|
|
|
96292
96328
|
var import_fs_extra24 = __toESM(require_lib(), 1);
|
|
96293
96329
|
import { createHash as createHash5 } from "node:crypto";
|
|
96294
96330
|
import { readFile as readFile46, readdir as readdir26, writeFile as writeFile27 } from "node:fs/promises";
|
|
96295
|
-
import { join as
|
|
96331
|
+
import { join as join106, relative as relative16 } from "node:path";
|
|
96296
96332
|
|
|
96297
96333
|
class SkillsManifestManager {
|
|
96298
96334
|
static MANIFEST_FILENAME = ".skills-manifest.json";
|
|
@@ -96314,12 +96350,12 @@ class SkillsManifestManager {
|
|
|
96314
96350
|
return manifest;
|
|
96315
96351
|
}
|
|
96316
96352
|
static async writeManifest(skillsDir2, manifest) {
|
|
96317
|
-
const manifestPath =
|
|
96353
|
+
const manifestPath = join106(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
96318
96354
|
await writeFile27(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
96319
96355
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
96320
96356
|
}
|
|
96321
96357
|
static async readManifest(skillsDir2) {
|
|
96322
|
-
const manifestPath =
|
|
96358
|
+
const manifestPath = join106(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
96323
96359
|
if (!await import_fs_extra24.pathExists(manifestPath)) {
|
|
96324
96360
|
logger.debug(`No manifest found at: ${manifestPath}`);
|
|
96325
96361
|
return null;
|
|
@@ -96342,7 +96378,7 @@ class SkillsManifestManager {
|
|
|
96342
96378
|
return "flat";
|
|
96343
96379
|
}
|
|
96344
96380
|
for (const dir of dirs.slice(0, 3)) {
|
|
96345
|
-
const dirPath =
|
|
96381
|
+
const dirPath = join106(skillsDir2, dir.name);
|
|
96346
96382
|
const subEntries = await readdir26(dirPath, { withFileTypes: true });
|
|
96347
96383
|
const hasSubdirs = subEntries.some((entry) => entry.isDirectory());
|
|
96348
96384
|
if (hasSubdirs) {
|
|
@@ -96361,7 +96397,7 @@ class SkillsManifestManager {
|
|
|
96361
96397
|
const entries = await readdir26(skillsDir2, { withFileTypes: true });
|
|
96362
96398
|
for (const entry of entries) {
|
|
96363
96399
|
if (entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith(".")) {
|
|
96364
|
-
const skillPath =
|
|
96400
|
+
const skillPath = join106(skillsDir2, entry.name);
|
|
96365
96401
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
96366
96402
|
skills.push({
|
|
96367
96403
|
name: entry.name,
|
|
@@ -96373,11 +96409,11 @@ class SkillsManifestManager {
|
|
|
96373
96409
|
const categories = await readdir26(skillsDir2, { withFileTypes: true });
|
|
96374
96410
|
for (const category of categories) {
|
|
96375
96411
|
if (category.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(category.name) && !category.name.startsWith(".")) {
|
|
96376
|
-
const categoryPath =
|
|
96412
|
+
const categoryPath = join106(skillsDir2, category.name);
|
|
96377
96413
|
const skillEntries = await readdir26(categoryPath, { withFileTypes: true });
|
|
96378
96414
|
for (const skillEntry of skillEntries) {
|
|
96379
96415
|
if (skillEntry.isDirectory() && !skillEntry.name.startsWith(".")) {
|
|
96380
|
-
const skillPath =
|
|
96416
|
+
const skillPath = join106(categoryPath, skillEntry.name);
|
|
96381
96417
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
96382
96418
|
skills.push({
|
|
96383
96419
|
name: skillEntry.name,
|
|
@@ -96407,7 +96443,7 @@ class SkillsManifestManager {
|
|
|
96407
96443
|
const files = [];
|
|
96408
96444
|
const entries = await readdir26(dirPath, { withFileTypes: true });
|
|
96409
96445
|
for (const entry of entries) {
|
|
96410
|
-
const fullPath =
|
|
96446
|
+
const fullPath = join106(dirPath, entry.name);
|
|
96411
96447
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name)) {
|
|
96412
96448
|
continue;
|
|
96413
96449
|
}
|
|
@@ -96529,7 +96565,7 @@ function getPathMapping(skillName, oldBasePath, newBasePath) {
|
|
|
96529
96565
|
// src/domains/skills/detection/script-detector.ts
|
|
96530
96566
|
var import_fs_extra25 = __toESM(require_lib(), 1);
|
|
96531
96567
|
import { readdir as readdir27 } from "node:fs/promises";
|
|
96532
|
-
import { join as
|
|
96568
|
+
import { join as join107 } from "node:path";
|
|
96533
96569
|
async function scanDirectory(skillsDir2) {
|
|
96534
96570
|
if (!await import_fs_extra25.pathExists(skillsDir2)) {
|
|
96535
96571
|
return ["flat", []];
|
|
@@ -96542,12 +96578,12 @@ async function scanDirectory(skillsDir2) {
|
|
|
96542
96578
|
let totalSkillLikeCount = 0;
|
|
96543
96579
|
const allSkills = [];
|
|
96544
96580
|
for (const dir of dirs) {
|
|
96545
|
-
const dirPath =
|
|
96581
|
+
const dirPath = join107(skillsDir2, dir.name);
|
|
96546
96582
|
const subEntries = await readdir27(dirPath, { withFileTypes: true });
|
|
96547
96583
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
96548
96584
|
if (subdirs.length > 0) {
|
|
96549
96585
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
96550
|
-
const subdirPath =
|
|
96586
|
+
const subdirPath = join107(dirPath, subdir.name);
|
|
96551
96587
|
const subdirFiles = await readdir27(subdirPath, { withFileTypes: true });
|
|
96552
96588
|
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"));
|
|
96553
96589
|
if (hasSkillMarker) {
|
|
@@ -96704,12 +96740,12 @@ class SkillsMigrationDetector {
|
|
|
96704
96740
|
// src/domains/skills/skills-migrator.ts
|
|
96705
96741
|
init_logger();
|
|
96706
96742
|
init_types3();
|
|
96707
|
-
import { join as
|
|
96743
|
+
import { join as join112 } from "node:path";
|
|
96708
96744
|
|
|
96709
96745
|
// src/domains/skills/migrator/migration-executor.ts
|
|
96710
96746
|
init_logger();
|
|
96711
96747
|
import { copyFile as copyFile6, mkdir as mkdir29, readdir as readdir28, rm as rm11 } from "node:fs/promises";
|
|
96712
|
-
import { join as
|
|
96748
|
+
import { join as join108 } from "node:path";
|
|
96713
96749
|
var import_fs_extra27 = __toESM(require_lib(), 1);
|
|
96714
96750
|
|
|
96715
96751
|
// src/domains/skills/skills-migration-prompts.ts
|
|
@@ -96874,8 +96910,8 @@ async function copySkillDirectory(sourceDir, destDir) {
|
|
|
96874
96910
|
await mkdir29(destDir, { recursive: true });
|
|
96875
96911
|
const entries = await readdir28(sourceDir, { withFileTypes: true });
|
|
96876
96912
|
for (const entry of entries) {
|
|
96877
|
-
const sourcePath =
|
|
96878
|
-
const destPath =
|
|
96913
|
+
const sourcePath = join108(sourceDir, entry.name);
|
|
96914
|
+
const destPath = join108(destDir, entry.name);
|
|
96879
96915
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
96880
96916
|
continue;
|
|
96881
96917
|
}
|
|
@@ -96890,7 +96926,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
96890
96926
|
const migrated = [];
|
|
96891
96927
|
const preserved = [];
|
|
96892
96928
|
const errors2 = [];
|
|
96893
|
-
const tempDir =
|
|
96929
|
+
const tempDir = join108(currentSkillsDir, "..", ".skills-migration-temp");
|
|
96894
96930
|
await mkdir29(tempDir, { recursive: true });
|
|
96895
96931
|
try {
|
|
96896
96932
|
for (const mapping of mappings) {
|
|
@@ -96911,9 +96947,9 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
96911
96947
|
}
|
|
96912
96948
|
}
|
|
96913
96949
|
const category = mapping.category;
|
|
96914
|
-
const targetPath = category ?
|
|
96950
|
+
const targetPath = category ? join108(tempDir, category, skillName) : join108(tempDir, skillName);
|
|
96915
96951
|
if (category) {
|
|
96916
|
-
await mkdir29(
|
|
96952
|
+
await mkdir29(join108(tempDir, category), { recursive: true });
|
|
96917
96953
|
}
|
|
96918
96954
|
await copySkillDirectory(currentSkillPath, targetPath);
|
|
96919
96955
|
migrated.push(skillName);
|
|
@@ -96980,7 +97016,7 @@ init_logger();
|
|
|
96980
97016
|
init_types3();
|
|
96981
97017
|
var import_fs_extra28 = __toESM(require_lib(), 1);
|
|
96982
97018
|
import { copyFile as copyFile7, mkdir as mkdir30, readdir as readdir29, rm as rm12, stat as stat17 } from "node:fs/promises";
|
|
96983
|
-
import { basename as basename17, join as
|
|
97019
|
+
import { basename as basename17, join as join109, normalize as normalize9 } from "node:path";
|
|
96984
97020
|
function validatePath2(path15, paramName) {
|
|
96985
97021
|
if (!path15 || typeof path15 !== "string") {
|
|
96986
97022
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -97006,7 +97042,7 @@ class SkillsBackupManager {
|
|
|
97006
97042
|
const timestamp = Date.now();
|
|
97007
97043
|
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
|
97008
97044
|
const backupDirName = `${SkillsBackupManager.BACKUP_PREFIX}${timestamp}-${randomSuffix}`;
|
|
97009
|
-
const backupDir = parentDir ?
|
|
97045
|
+
const backupDir = parentDir ? join109(parentDir, backupDirName) : join109(skillsDir2, "..", backupDirName);
|
|
97010
97046
|
logger.info(`Creating backup at: ${backupDir}`);
|
|
97011
97047
|
try {
|
|
97012
97048
|
await mkdir30(backupDir, { recursive: true });
|
|
@@ -97057,7 +97093,7 @@ class SkillsBackupManager {
|
|
|
97057
97093
|
}
|
|
97058
97094
|
try {
|
|
97059
97095
|
const entries = await readdir29(parentDir, { withFileTypes: true });
|
|
97060
|
-
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) =>
|
|
97096
|
+
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) => join109(parentDir, entry.name));
|
|
97061
97097
|
backups.sort().reverse();
|
|
97062
97098
|
return backups;
|
|
97063
97099
|
} catch (error) {
|
|
@@ -97085,8 +97121,8 @@ class SkillsBackupManager {
|
|
|
97085
97121
|
static async copyDirectory(sourceDir, destDir) {
|
|
97086
97122
|
const entries = await readdir29(sourceDir, { withFileTypes: true });
|
|
97087
97123
|
for (const entry of entries) {
|
|
97088
|
-
const sourcePath =
|
|
97089
|
-
const destPath =
|
|
97124
|
+
const sourcePath = join109(sourceDir, entry.name);
|
|
97125
|
+
const destPath = join109(destDir, entry.name);
|
|
97090
97126
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
97091
97127
|
continue;
|
|
97092
97128
|
}
|
|
@@ -97102,7 +97138,7 @@ class SkillsBackupManager {
|
|
|
97102
97138
|
let size = 0;
|
|
97103
97139
|
const entries = await readdir29(dirPath, { withFileTypes: true });
|
|
97104
97140
|
for (const entry of entries) {
|
|
97105
|
-
const fullPath =
|
|
97141
|
+
const fullPath = join109(dirPath, entry.name);
|
|
97106
97142
|
if (entry.isSymbolicLink()) {
|
|
97107
97143
|
continue;
|
|
97108
97144
|
}
|
|
@@ -97138,12 +97174,12 @@ init_skip_directories();
|
|
|
97138
97174
|
import { createHash as createHash6 } from "node:crypto";
|
|
97139
97175
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
97140
97176
|
import { readFile as readFile47, readdir as readdir30 } from "node:fs/promises";
|
|
97141
|
-
import { join as
|
|
97177
|
+
import { join as join110, relative as relative17 } from "node:path";
|
|
97142
97178
|
async function getAllFiles(dirPath) {
|
|
97143
97179
|
const files = [];
|
|
97144
97180
|
const entries = await readdir30(dirPath, { withFileTypes: true });
|
|
97145
97181
|
for (const entry of entries) {
|
|
97146
|
-
const fullPath =
|
|
97182
|
+
const fullPath = join110(dirPath, entry.name);
|
|
97147
97183
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name) || entry.isSymbolicLink()) {
|
|
97148
97184
|
continue;
|
|
97149
97185
|
}
|
|
@@ -97270,7 +97306,7 @@ async function detectFileChanges(currentSkillPath, baselineSkillPath) {
|
|
|
97270
97306
|
init_types3();
|
|
97271
97307
|
var import_fs_extra30 = __toESM(require_lib(), 1);
|
|
97272
97308
|
import { readdir as readdir31 } from "node:fs/promises";
|
|
97273
|
-
import { join as
|
|
97309
|
+
import { join as join111, normalize as normalize10 } from "node:path";
|
|
97274
97310
|
function validatePath3(path15, paramName) {
|
|
97275
97311
|
if (!path15 || typeof path15 !== "string") {
|
|
97276
97312
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -97291,13 +97327,13 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
97291
97327
|
if (dirs.length === 0) {
|
|
97292
97328
|
return ["flat", []];
|
|
97293
97329
|
}
|
|
97294
|
-
const firstDirPath =
|
|
97330
|
+
const firstDirPath = join111(skillsDir2, dirs[0].name);
|
|
97295
97331
|
const subEntries = await readdir31(firstDirPath, { withFileTypes: true });
|
|
97296
97332
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
97297
97333
|
if (subdirs.length > 0) {
|
|
97298
97334
|
let skillLikeCount = 0;
|
|
97299
97335
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
97300
|
-
const subdirPath =
|
|
97336
|
+
const subdirPath = join111(firstDirPath, subdir.name);
|
|
97301
97337
|
const subdirFiles = await readdir31(subdirPath, { withFileTypes: true });
|
|
97302
97338
|
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"));
|
|
97303
97339
|
if (hasSkillMarker) {
|
|
@@ -97307,7 +97343,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
97307
97343
|
if (skillLikeCount > 0) {
|
|
97308
97344
|
const skills = [];
|
|
97309
97345
|
for (const dir of dirs) {
|
|
97310
|
-
const categoryPath =
|
|
97346
|
+
const categoryPath = join111(skillsDir2, dir.name);
|
|
97311
97347
|
const skillDirs = await readdir31(categoryPath, { withFileTypes: true });
|
|
97312
97348
|
skills.push(...skillDirs.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name));
|
|
97313
97349
|
}
|
|
@@ -97317,7 +97353,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
97317
97353
|
return ["flat", dirs.map((dir) => dir.name)];
|
|
97318
97354
|
}
|
|
97319
97355
|
async function findSkillPath(skillsDir2, skillName) {
|
|
97320
|
-
const flatPath =
|
|
97356
|
+
const flatPath = join111(skillsDir2, skillName);
|
|
97321
97357
|
if (await import_fs_extra30.pathExists(flatPath)) {
|
|
97322
97358
|
return { path: flatPath, category: undefined };
|
|
97323
97359
|
}
|
|
@@ -97326,8 +97362,8 @@ async function findSkillPath(skillsDir2, skillName) {
|
|
|
97326
97362
|
if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
97327
97363
|
continue;
|
|
97328
97364
|
}
|
|
97329
|
-
const categoryPath =
|
|
97330
|
-
const skillPath =
|
|
97365
|
+
const categoryPath = join111(skillsDir2, entry.name);
|
|
97366
|
+
const skillPath = join111(categoryPath, skillName);
|
|
97331
97367
|
if (await import_fs_extra30.pathExists(skillPath)) {
|
|
97332
97368
|
return { path: skillPath, category: entry.name };
|
|
97333
97369
|
}
|
|
@@ -97421,7 +97457,7 @@ class SkillsMigrator {
|
|
|
97421
97457
|
}
|
|
97422
97458
|
}
|
|
97423
97459
|
if (options2.backup && !options2.dryRun) {
|
|
97424
|
-
const claudeDir2 =
|
|
97460
|
+
const claudeDir2 = join112(currentSkillsDir, "..");
|
|
97425
97461
|
result.backupPath = await SkillsBackupManager.createBackup(currentSkillsDir, claudeDir2);
|
|
97426
97462
|
logger.success(`Backup created at: ${result.backupPath}`);
|
|
97427
97463
|
}
|
|
@@ -97482,7 +97518,7 @@ async function handleMigration(ctx) {
|
|
|
97482
97518
|
logger.debug("Skipping skills migration (fresh installation)");
|
|
97483
97519
|
return ctx;
|
|
97484
97520
|
}
|
|
97485
|
-
const newSkillsDir =
|
|
97521
|
+
const newSkillsDir = join113(ctx.extractDir, ".claude", "skills");
|
|
97486
97522
|
const currentSkillsDir = PathResolver.buildSkillsPath(ctx.resolvedDir, ctx.options.global);
|
|
97487
97523
|
if (!await import_fs_extra31.pathExists(newSkillsDir) || !await import_fs_extra31.pathExists(currentSkillsDir)) {
|
|
97488
97524
|
return ctx;
|
|
@@ -97506,13 +97542,13 @@ async function handleMigration(ctx) {
|
|
|
97506
97542
|
}
|
|
97507
97543
|
// src/commands/init/phases/opencode-handler.ts
|
|
97508
97544
|
import { cp as cp3, readdir as readdir33, rm as rm13 } from "node:fs/promises";
|
|
97509
|
-
import { join as
|
|
97545
|
+
import { join as join115 } from "node:path";
|
|
97510
97546
|
|
|
97511
97547
|
// src/services/transformers/opencode-path-transformer.ts
|
|
97512
97548
|
init_logger();
|
|
97513
97549
|
import { readFile as readFile48, readdir as readdir32, writeFile as writeFile28 } from "node:fs/promises";
|
|
97514
97550
|
import { platform as platform14 } from "node:os";
|
|
97515
|
-
import { extname as extname5, join as
|
|
97551
|
+
import { extname as extname5, join as join114 } from "node:path";
|
|
97516
97552
|
var IS_WINDOWS2 = platform14() === "win32";
|
|
97517
97553
|
function getOpenCodeGlobalPath() {
|
|
97518
97554
|
return "$HOME/.config/opencode/";
|
|
@@ -97573,7 +97609,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
97573
97609
|
async function processDirectory2(dir) {
|
|
97574
97610
|
const entries = await readdir32(dir, { withFileTypes: true });
|
|
97575
97611
|
for (const entry of entries) {
|
|
97576
|
-
const fullPath =
|
|
97612
|
+
const fullPath = join114(dir, entry.name);
|
|
97577
97613
|
if (entry.isDirectory()) {
|
|
97578
97614
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
97579
97615
|
continue;
|
|
@@ -97612,7 +97648,7 @@ async function handleOpenCode(ctx) {
|
|
|
97612
97648
|
if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir) {
|
|
97613
97649
|
return ctx;
|
|
97614
97650
|
}
|
|
97615
|
-
const openCodeSource =
|
|
97651
|
+
const openCodeSource = join115(ctx.extractDir, ".opencode");
|
|
97616
97652
|
if (!await import_fs_extra32.pathExists(openCodeSource)) {
|
|
97617
97653
|
logger.debug("No .opencode directory in archive, skipping");
|
|
97618
97654
|
return ctx;
|
|
@@ -97630,8 +97666,8 @@ async function handleOpenCode(ctx) {
|
|
|
97630
97666
|
await import_fs_extra32.ensureDir(targetDir);
|
|
97631
97667
|
const entries = await readdir33(openCodeSource, { withFileTypes: true });
|
|
97632
97668
|
for (const entry of entries) {
|
|
97633
|
-
const sourcePath =
|
|
97634
|
-
const targetPath =
|
|
97669
|
+
const sourcePath = join115(openCodeSource, entry.name);
|
|
97670
|
+
const targetPath = join115(targetDir, entry.name);
|
|
97635
97671
|
if (await import_fs_extra32.pathExists(targetPath)) {
|
|
97636
97672
|
if (!ctx.options.forceOverwrite) {
|
|
97637
97673
|
logger.verbose(`Skipping existing: ${entry.name}`);
|
|
@@ -97729,7 +97765,7 @@ Please use only one download method.`);
|
|
|
97729
97765
|
}
|
|
97730
97766
|
// src/commands/init/phases/post-install-handler.ts
|
|
97731
97767
|
init_projects_registry();
|
|
97732
|
-
import { join as
|
|
97768
|
+
import { join as join116 } from "node:path";
|
|
97733
97769
|
init_logger();
|
|
97734
97770
|
init_path_resolver();
|
|
97735
97771
|
var import_fs_extra33 = __toESM(require_lib(), 1);
|
|
@@ -97738,8 +97774,8 @@ async function handlePostInstall(ctx) {
|
|
|
97738
97774
|
return ctx;
|
|
97739
97775
|
}
|
|
97740
97776
|
if (ctx.options.global) {
|
|
97741
|
-
const claudeMdSource =
|
|
97742
|
-
const claudeMdDest =
|
|
97777
|
+
const claudeMdSource = join116(ctx.extractDir, "CLAUDE.md");
|
|
97778
|
+
const claudeMdDest = join116(ctx.resolvedDir, "CLAUDE.md");
|
|
97743
97779
|
if (await import_fs_extra33.pathExists(claudeMdSource)) {
|
|
97744
97780
|
if (ctx.options.fresh || !await import_fs_extra33.pathExists(claudeMdDest)) {
|
|
97745
97781
|
await import_fs_extra33.copy(claudeMdSource, claudeMdDest);
|
|
@@ -97787,7 +97823,7 @@ async function handlePostInstall(ctx) {
|
|
|
97787
97823
|
}
|
|
97788
97824
|
if (!ctx.options.skipSetup) {
|
|
97789
97825
|
await promptSetupWizardIfNeeded({
|
|
97790
|
-
envPath:
|
|
97826
|
+
envPath: join116(ctx.claudeDir, ".env"),
|
|
97791
97827
|
claudeDir: ctx.claudeDir,
|
|
97792
97828
|
isGlobal: ctx.options.global,
|
|
97793
97829
|
isNonInteractive: ctx.isNonInteractive,
|
|
@@ -97811,7 +97847,7 @@ async function handlePostInstall(ctx) {
|
|
|
97811
97847
|
init_config_manager();
|
|
97812
97848
|
init_github_client();
|
|
97813
97849
|
import { mkdir as mkdir31 } from "node:fs/promises";
|
|
97814
|
-
import { join as
|
|
97850
|
+
import { join as join118, resolve as resolve27 } from "node:path";
|
|
97815
97851
|
|
|
97816
97852
|
// src/domains/github/kit-access-checker.ts
|
|
97817
97853
|
init_logger();
|
|
@@ -97942,7 +97978,7 @@ async function runPreflightChecks() {
|
|
|
97942
97978
|
// src/domains/installation/fresh-installer.ts
|
|
97943
97979
|
init_metadata_migration();
|
|
97944
97980
|
import { existsSync as existsSync55, readdirSync as readdirSync6, rmSync as rmSync4, rmdirSync as rmdirSync2, unlinkSync as unlinkSync4 } from "node:fs";
|
|
97945
|
-
import { basename as basename18, dirname as dirname29, join as
|
|
97981
|
+
import { basename as basename18, dirname as dirname29, join as join117, resolve as resolve26 } from "node:path";
|
|
97946
97982
|
init_logger();
|
|
97947
97983
|
init_safe_spinner();
|
|
97948
97984
|
var import_fs_extra34 = __toESM(require_lib(), 1);
|
|
@@ -98015,7 +98051,7 @@ async function removeFilesByOwnership(claudeDir2, analysis, includeModified) {
|
|
|
98015
98051
|
const filesToRemove = includeModified ? [...analysis.ckFiles, ...analysis.ckModifiedFiles] : analysis.ckFiles;
|
|
98016
98052
|
const filesToPreserve = includeModified ? analysis.userFiles : [...analysis.ckModifiedFiles, ...analysis.userFiles];
|
|
98017
98053
|
for (const file of filesToRemove) {
|
|
98018
|
-
const fullPath =
|
|
98054
|
+
const fullPath = join117(claudeDir2, file.path);
|
|
98019
98055
|
if (!existsSync55(fullPath)) {
|
|
98020
98056
|
continue;
|
|
98021
98057
|
}
|
|
@@ -98043,7 +98079,7 @@ async function removeFilesByOwnership(claudeDir2, analysis, includeModified) {
|
|
|
98043
98079
|
};
|
|
98044
98080
|
}
|
|
98045
98081
|
async function updateMetadataAfterFresh(claudeDir2, removedFiles) {
|
|
98046
|
-
const metadataPath =
|
|
98082
|
+
const metadataPath = join117(claudeDir2, "metadata.json");
|
|
98047
98083
|
if (!await import_fs_extra34.pathExists(metadataPath)) {
|
|
98048
98084
|
throw new Error("metadata.json is missing during fresh install cleanup");
|
|
98049
98085
|
}
|
|
@@ -98086,8 +98122,8 @@ function getFreshBackupTargets(claudeDir2, analysis, includeModified) {
|
|
|
98086
98122
|
mutatePaths: filesToRemove.length > 0 ? ["metadata.json"] : []
|
|
98087
98123
|
};
|
|
98088
98124
|
}
|
|
98089
|
-
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync55(
|
|
98090
|
-
if (existsSync55(
|
|
98125
|
+
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync55(join117(claudeDir2, subdir)));
|
|
98126
|
+
if (existsSync55(join117(claudeDir2, "metadata.json"))) {
|
|
98091
98127
|
deletePaths.push("metadata.json");
|
|
98092
98128
|
}
|
|
98093
98129
|
return {
|
|
@@ -98109,7 +98145,7 @@ async function removeSubdirectoriesFallback(claudeDir2) {
|
|
|
98109
98145
|
const removedFiles = [];
|
|
98110
98146
|
let removedDirCount = 0;
|
|
98111
98147
|
for (const subdir of CLAUDEKIT_SUBDIRECTORIES) {
|
|
98112
|
-
const subdirPath =
|
|
98148
|
+
const subdirPath = join117(claudeDir2, subdir);
|
|
98113
98149
|
if (await import_fs_extra34.pathExists(subdirPath)) {
|
|
98114
98150
|
rmSync4(subdirPath, { recursive: true, force: true });
|
|
98115
98151
|
removedDirCount++;
|
|
@@ -98117,7 +98153,7 @@ async function removeSubdirectoriesFallback(claudeDir2) {
|
|
|
98117
98153
|
logger.debug(`Removed subdirectory: ${subdir}/`);
|
|
98118
98154
|
}
|
|
98119
98155
|
}
|
|
98120
|
-
const metadataPath =
|
|
98156
|
+
const metadataPath = join117(claudeDir2, "metadata.json");
|
|
98121
98157
|
if (await import_fs_extra34.pathExists(metadataPath)) {
|
|
98122
98158
|
unlinkSync4(metadataPath);
|
|
98123
98159
|
removedFiles.push("metadata.json");
|
|
@@ -98399,7 +98435,7 @@ async function handleSelection(ctx) {
|
|
|
98399
98435
|
}
|
|
98400
98436
|
if (!ctx.options.fresh) {
|
|
98401
98437
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
98402
|
-
const claudeDir2 = prefix ?
|
|
98438
|
+
const claudeDir2 = prefix ? join118(resolvedDir, prefix) : resolvedDir;
|
|
98403
98439
|
try {
|
|
98404
98440
|
const existingMetadata = await readManifest(claudeDir2);
|
|
98405
98441
|
if (existingMetadata?.kits) {
|
|
@@ -98431,7 +98467,7 @@ async function handleSelection(ctx) {
|
|
|
98431
98467
|
}
|
|
98432
98468
|
if (ctx.options.fresh) {
|
|
98433
98469
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
98434
|
-
const claudeDir2 = prefix ?
|
|
98470
|
+
const claudeDir2 = prefix ? join118(resolvedDir, prefix) : resolvedDir;
|
|
98435
98471
|
const canProceed = await handleFreshInstallation(claudeDir2, ctx.prompts);
|
|
98436
98472
|
if (!canProceed) {
|
|
98437
98473
|
return { ...ctx, cancelled: true };
|
|
@@ -98451,7 +98487,7 @@ async function handleSelection(ctx) {
|
|
|
98451
98487
|
let currentVersion = null;
|
|
98452
98488
|
try {
|
|
98453
98489
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
98454
|
-
const claudeDir2 = prefix ?
|
|
98490
|
+
const claudeDir2 = prefix ? join118(resolvedDir, prefix) : resolvedDir;
|
|
98455
98491
|
const existingMetadata = await readManifest(claudeDir2);
|
|
98456
98492
|
currentVersion = existingMetadata?.kits?.[kitType]?.version || null;
|
|
98457
98493
|
if (currentVersion) {
|
|
@@ -98520,7 +98556,7 @@ async function handleSelection(ctx) {
|
|
|
98520
98556
|
if (ctx.options.yes && !ctx.options.fresh && !ctx.options.force && releaseTag && !isOfflineMode && !pendingKits?.length) {
|
|
98521
98557
|
try {
|
|
98522
98558
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
98523
|
-
const claudeDir2 = prefix ?
|
|
98559
|
+
const claudeDir2 = prefix ? join118(resolvedDir, prefix) : resolvedDir;
|
|
98524
98560
|
const existingMetadata = await readManifest(claudeDir2);
|
|
98525
98561
|
const installedKitVersion = existingMetadata?.kits?.[kitType]?.version;
|
|
98526
98562
|
if (installedKitVersion && versionsMatch(installedKitVersion, releaseTag)) {
|
|
@@ -98544,7 +98580,7 @@ async function handleSelection(ctx) {
|
|
|
98544
98580
|
}
|
|
98545
98581
|
// src/commands/init/phases/sync-handler.ts
|
|
98546
98582
|
import { copyFile as copyFile8, mkdir as mkdir32, open as open5, readFile as readFile50, rename as rename7, stat as stat18, unlink as unlink11, writeFile as writeFile30 } from "node:fs/promises";
|
|
98547
|
-
import { dirname as dirname30, join as
|
|
98583
|
+
import { dirname as dirname30, join as join119, resolve as resolve28 } from "node:path";
|
|
98548
98584
|
init_logger();
|
|
98549
98585
|
init_path_resolver();
|
|
98550
98586
|
var import_fs_extra36 = __toESM(require_lib(), 1);
|
|
@@ -98554,13 +98590,13 @@ async function handleSync(ctx) {
|
|
|
98554
98590
|
return ctx;
|
|
98555
98591
|
}
|
|
98556
98592
|
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve28(ctx.options.dir || ".");
|
|
98557
|
-
const claudeDir2 = ctx.options.global ? resolvedDir :
|
|
98593
|
+
const claudeDir2 = ctx.options.global ? resolvedDir : join119(resolvedDir, ".claude");
|
|
98558
98594
|
if (!await import_fs_extra36.pathExists(claudeDir2)) {
|
|
98559
98595
|
logger.error("Cannot sync: no .claude directory found");
|
|
98560
98596
|
ctx.prompts.note("Run 'ck init' without --sync to install first.", "No Installation Found");
|
|
98561
98597
|
return { ...ctx, cancelled: true };
|
|
98562
98598
|
}
|
|
98563
|
-
const metadataPath =
|
|
98599
|
+
const metadataPath = join119(claudeDir2, "metadata.json");
|
|
98564
98600
|
if (!await import_fs_extra36.pathExists(metadataPath)) {
|
|
98565
98601
|
logger.error("Cannot sync: no metadata.json found");
|
|
98566
98602
|
ctx.prompts.note(`Your installation may be from an older version.
|
|
@@ -98660,7 +98696,7 @@ function getLockTimeout() {
|
|
|
98660
98696
|
var STALE_LOCK_THRESHOLD_MS = 5 * 60 * 1000;
|
|
98661
98697
|
async function acquireSyncLock(global3) {
|
|
98662
98698
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
98663
|
-
const lockPath =
|
|
98699
|
+
const lockPath = join119(cacheDir, ".sync-lock");
|
|
98664
98700
|
const startTime = Date.now();
|
|
98665
98701
|
const lockTimeout = getLockTimeout();
|
|
98666
98702
|
await mkdir32(dirname30(lockPath), { recursive: true });
|
|
@@ -98706,10 +98742,10 @@ async function executeSyncMerge(ctx) {
|
|
|
98706
98742
|
const releaseLock = await acquireSyncLock(ctx.options.global);
|
|
98707
98743
|
try {
|
|
98708
98744
|
const trackedFiles = ctx.syncTrackedFiles;
|
|
98709
|
-
const upstreamDir = ctx.options.global ?
|
|
98745
|
+
const upstreamDir = ctx.options.global ? join119(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
98710
98746
|
let deletions = [];
|
|
98711
98747
|
try {
|
|
98712
|
-
const sourceMetadataPath =
|
|
98748
|
+
const sourceMetadataPath = join119(upstreamDir, "metadata.json");
|
|
98713
98749
|
if (await import_fs_extra36.pathExists(sourceMetadataPath)) {
|
|
98714
98750
|
const content = await readFile50(sourceMetadataPath, "utf-8");
|
|
98715
98751
|
const sourceMetadata = JSON.parse(content);
|
|
@@ -98741,7 +98777,7 @@ async function executeSyncMerge(ctx) {
|
|
|
98741
98777
|
try {
|
|
98742
98778
|
const sourcePath = await validateSyncPath(upstreamDir, file.path);
|
|
98743
98779
|
const targetPath = await validateSyncPath(ctx.claudeDir, file.path);
|
|
98744
|
-
const targetDir =
|
|
98780
|
+
const targetDir = join119(targetPath, "..");
|
|
98745
98781
|
try {
|
|
98746
98782
|
await mkdir32(targetDir, { recursive: true });
|
|
98747
98783
|
} catch (mkdirError) {
|
|
@@ -98912,7 +98948,7 @@ async function createBackup(claudeDir2, files, backupDir) {
|
|
|
98912
98948
|
const sourcePath = await validateSyncPath(claudeDir2, file.path);
|
|
98913
98949
|
if (await import_fs_extra36.pathExists(sourcePath)) {
|
|
98914
98950
|
const targetPath = await validateSyncPath(backupDir, file.path);
|
|
98915
|
-
const targetDir =
|
|
98951
|
+
const targetDir = join119(targetPath, "..");
|
|
98916
98952
|
await mkdir32(targetDir, { recursive: true });
|
|
98917
98953
|
await copyFile8(sourcePath, targetPath);
|
|
98918
98954
|
}
|
|
@@ -98927,7 +98963,7 @@ async function createBackup(claudeDir2, files, backupDir) {
|
|
|
98927
98963
|
}
|
|
98928
98964
|
// src/commands/init/phases/transform-handler.ts
|
|
98929
98965
|
init_config_manager();
|
|
98930
|
-
import { join as
|
|
98966
|
+
import { join as join123 } from "node:path";
|
|
98931
98967
|
|
|
98932
98968
|
// src/services/transformers/folder-path-transformer.ts
|
|
98933
98969
|
init_logger();
|
|
@@ -98938,38 +98974,38 @@ init_logger();
|
|
|
98938
98974
|
init_types3();
|
|
98939
98975
|
var import_fs_extra37 = __toESM(require_lib(), 1);
|
|
98940
98976
|
import { rename as rename8, rm as rm14 } from "node:fs/promises";
|
|
98941
|
-
import { join as
|
|
98977
|
+
import { join as join120, relative as relative19 } from "node:path";
|
|
98942
98978
|
async function collectDirsToRename(extractDir, folders) {
|
|
98943
98979
|
const dirsToRename = [];
|
|
98944
98980
|
if (folders.docs !== DEFAULT_FOLDERS.docs) {
|
|
98945
|
-
const docsPath =
|
|
98981
|
+
const docsPath = join120(extractDir, DEFAULT_FOLDERS.docs);
|
|
98946
98982
|
if (await import_fs_extra37.pathExists(docsPath)) {
|
|
98947
98983
|
dirsToRename.push({
|
|
98948
98984
|
from: docsPath,
|
|
98949
|
-
to:
|
|
98985
|
+
to: join120(extractDir, folders.docs)
|
|
98950
98986
|
});
|
|
98951
98987
|
}
|
|
98952
|
-
const claudeDocsPath =
|
|
98988
|
+
const claudeDocsPath = join120(extractDir, ".claude", DEFAULT_FOLDERS.docs);
|
|
98953
98989
|
if (await import_fs_extra37.pathExists(claudeDocsPath)) {
|
|
98954
98990
|
dirsToRename.push({
|
|
98955
98991
|
from: claudeDocsPath,
|
|
98956
|
-
to:
|
|
98992
|
+
to: join120(extractDir, ".claude", folders.docs)
|
|
98957
98993
|
});
|
|
98958
98994
|
}
|
|
98959
98995
|
}
|
|
98960
98996
|
if (folders.plans !== DEFAULT_FOLDERS.plans) {
|
|
98961
|
-
const plansPath =
|
|
98997
|
+
const plansPath = join120(extractDir, DEFAULT_FOLDERS.plans);
|
|
98962
98998
|
if (await import_fs_extra37.pathExists(plansPath)) {
|
|
98963
98999
|
dirsToRename.push({
|
|
98964
99000
|
from: plansPath,
|
|
98965
|
-
to:
|
|
99001
|
+
to: join120(extractDir, folders.plans)
|
|
98966
99002
|
});
|
|
98967
99003
|
}
|
|
98968
|
-
const claudePlansPath =
|
|
99004
|
+
const claudePlansPath = join120(extractDir, ".claude", DEFAULT_FOLDERS.plans);
|
|
98969
99005
|
if (await import_fs_extra37.pathExists(claudePlansPath)) {
|
|
98970
99006
|
dirsToRename.push({
|
|
98971
99007
|
from: claudePlansPath,
|
|
98972
|
-
to:
|
|
99008
|
+
to: join120(extractDir, ".claude", folders.plans)
|
|
98973
99009
|
});
|
|
98974
99010
|
}
|
|
98975
99011
|
}
|
|
@@ -99010,7 +99046,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
99010
99046
|
init_logger();
|
|
99011
99047
|
init_types3();
|
|
99012
99048
|
import { readFile as readFile51, readdir as readdir34, writeFile as writeFile31 } from "node:fs/promises";
|
|
99013
|
-
import { join as
|
|
99049
|
+
import { join as join121, relative as relative20 } from "node:path";
|
|
99014
99050
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
99015
99051
|
".md",
|
|
99016
99052
|
".txt",
|
|
@@ -99063,7 +99099,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
99063
99099
|
let replacementsCount = 0;
|
|
99064
99100
|
const entries = await readdir34(dir, { withFileTypes: true });
|
|
99065
99101
|
for (const entry of entries) {
|
|
99066
|
-
const fullPath =
|
|
99102
|
+
const fullPath = join121(dir, entry.name);
|
|
99067
99103
|
if (entry.isDirectory()) {
|
|
99068
99104
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
99069
99105
|
continue;
|
|
@@ -99199,19 +99235,47 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
99199
99235
|
// src/services/transformers/global-path-transformer.ts
|
|
99200
99236
|
init_logger();
|
|
99201
99237
|
import { readFile as readFile52, readdir as readdir35, writeFile as writeFile32 } from "node:fs/promises";
|
|
99202
|
-
import { platform as platform15 } from "node:os";
|
|
99203
|
-
import { extname as extname6, join as
|
|
99238
|
+
import { homedir as homedir33, platform as platform15 } from "node:os";
|
|
99239
|
+
import { extname as extname6, join as join122 } from "node:path";
|
|
99204
99240
|
var IS_WINDOWS3 = platform15() === "win32";
|
|
99205
99241
|
var HOME_PREFIX = IS_WINDOWS3 ? "%USERPROFILE%" : "$HOME";
|
|
99206
99242
|
function getHomeDirPrefix() {
|
|
99207
99243
|
return HOME_PREFIX;
|
|
99208
99244
|
}
|
|
99245
|
+
function normalizeInstallPath(path15) {
|
|
99246
|
+
return path15.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
99247
|
+
}
|
|
99248
|
+
function getDefaultGlobalClaudeDir() {
|
|
99249
|
+
return normalizeInstallPath(join122(homedir33(), ".claude"));
|
|
99250
|
+
}
|
|
99251
|
+
function getCustomGlobalClaudeDir(targetClaudeDir) {
|
|
99252
|
+
if (!targetClaudeDir)
|
|
99253
|
+
return null;
|
|
99254
|
+
const normalizedTargetDir = normalizeInstallPath(targetClaudeDir);
|
|
99255
|
+
return normalizedTargetDir === getDefaultGlobalClaudeDir() ? null : normalizedTargetDir;
|
|
99256
|
+
}
|
|
99257
|
+
function getGlobalClaudePath(targetClaudeDir) {
|
|
99258
|
+
const customGlobalClaudeDir = getCustomGlobalClaudeDir(targetClaudeDir);
|
|
99259
|
+
if (customGlobalClaudeDir) {
|
|
99260
|
+
return `${customGlobalClaudeDir}/`;
|
|
99261
|
+
}
|
|
99262
|
+
return `${getHomeDirPrefix()}/.claude/`;
|
|
99263
|
+
}
|
|
99264
|
+
function replaceTracked(content, pattern, replacement) {
|
|
99265
|
+
let changes = 0;
|
|
99266
|
+
const updated = content.replace(pattern, () => {
|
|
99267
|
+
changes++;
|
|
99268
|
+
return replacement;
|
|
99269
|
+
});
|
|
99270
|
+
return { content: updated, changes };
|
|
99271
|
+
}
|
|
99209
99272
|
var TRANSFORMABLE_EXTENSIONS3 = new Set([
|
|
99210
99273
|
".md",
|
|
99211
99274
|
".js",
|
|
99212
99275
|
".cjs",
|
|
99213
99276
|
".mjs",
|
|
99214
99277
|
".ts",
|
|
99278
|
+
".py",
|
|
99215
99279
|
".json",
|
|
99216
99280
|
".sh",
|
|
99217
99281
|
".ps1",
|
|
@@ -99220,83 +99284,94 @@ var TRANSFORMABLE_EXTENSIONS3 = new Set([
|
|
|
99220
99284
|
".toml"
|
|
99221
99285
|
]);
|
|
99222
99286
|
var ALWAYS_TRANSFORM_FILES = new Set(["CLAUDE.md", "claude.md"]);
|
|
99223
|
-
function transformContent(content) {
|
|
99287
|
+
function transformContent(content, options2 = {}) {
|
|
99224
99288
|
let changes = 0;
|
|
99225
99289
|
let transformed = content;
|
|
99226
99290
|
const homePrefix = getHomeDirPrefix();
|
|
99227
|
-
const
|
|
99291
|
+
const customGlobalClaudeDir = getCustomGlobalClaudeDir(options2.targetClaudeDir);
|
|
99292
|
+
const claudePath = getGlobalClaudePath(options2.targetClaudeDir);
|
|
99228
99293
|
if (IS_WINDOWS3) {
|
|
99229
|
-
|
|
99230
|
-
|
|
99231
|
-
|
|
99232
|
-
});
|
|
99233
|
-
transformed =
|
|
99234
|
-
|
|
99235
|
-
|
|
99236
|
-
|
|
99237
|
-
|
|
99238
|
-
|
|
99239
|
-
|
|
99240
|
-
|
|
99241
|
-
|
|
99242
|
-
|
|
99243
|
-
|
|
99244
|
-
|
|
99245
|
-
}
|
|
99246
|
-
|
|
99247
|
-
|
|
99248
|
-
|
|
99249
|
-
});
|
|
99250
|
-
transformed =
|
|
99251
|
-
|
|
99252
|
-
return `"${homePrefix}"/.claude/`;
|
|
99253
|
-
});
|
|
99254
|
-
transformed = transformed.replace(/\$\{CLAUDE_PROJECT_DIR\}\/\.claude\//g, () => {
|
|
99255
|
-
changes++;
|
|
99256
|
-
return claudePath;
|
|
99257
|
-
});
|
|
99294
|
+
const homePathResult = replaceTracked(transformed, /\$HOME\/\.claude\//g, claudePath);
|
|
99295
|
+
transformed = homePathResult.content;
|
|
99296
|
+
changes += homePathResult.changes;
|
|
99297
|
+
const braceHomePathResult = replaceTracked(transformed, /\$\{HOME\}\/\.claude\//g, claudePath);
|
|
99298
|
+
transformed = braceHomePathResult.content;
|
|
99299
|
+
changes += braceHomePathResult.changes;
|
|
99300
|
+
const homePrefixResult = replaceTracked(transformed, /\$HOME(?=\/|\\)/g, homePrefix);
|
|
99301
|
+
transformed = homePrefixResult.content;
|
|
99302
|
+
changes += homePrefixResult.changes;
|
|
99303
|
+
const braceHomePrefixResult = replaceTracked(transformed, /\$\{HOME\}(?=\/|\\)/g, homePrefix);
|
|
99304
|
+
transformed = braceHomePrefixResult.content;
|
|
99305
|
+
changes += braceHomePrefixResult.changes;
|
|
99306
|
+
}
|
|
99307
|
+
const projectDirPathResult = replaceTracked(transformed, /\$CLAUDE_PROJECT_DIR\/\.claude\//g, claudePath);
|
|
99308
|
+
transformed = projectDirPathResult.content;
|
|
99309
|
+
changes += projectDirPathResult.changes;
|
|
99310
|
+
const quotedProjectDirPath = customGlobalClaudeDir ? `${customGlobalClaudeDir}/` : `"${homePrefix}"/.claude/`;
|
|
99311
|
+
const quotedProjectDirPathResult = replaceTracked(transformed, /"\$CLAUDE_PROJECT_DIR"\/\.claude\//g, quotedProjectDirPath);
|
|
99312
|
+
transformed = quotedProjectDirPathResult.content;
|
|
99313
|
+
changes += quotedProjectDirPathResult.changes;
|
|
99314
|
+
const braceProjectDirPathResult = replaceTracked(transformed, /\$\{CLAUDE_PROJECT_DIR\}\/\.claude\//g, claudePath);
|
|
99315
|
+
transformed = braceProjectDirPathResult.content;
|
|
99316
|
+
changes += braceProjectDirPathResult.changes;
|
|
99258
99317
|
if (IS_WINDOWS3) {
|
|
99259
|
-
|
|
99260
|
-
|
|
99261
|
-
|
|
99262
|
-
|
|
99263
|
-
|
|
99264
|
-
transformed =
|
|
99265
|
-
|
|
99266
|
-
|
|
99267
|
-
|
|
99268
|
-
|
|
99269
|
-
|
|
99270
|
-
|
|
99271
|
-
|
|
99272
|
-
transformed = transformed.replace(/@\.claude\//g, () => {
|
|
99273
|
-
changes++;
|
|
99274
|
-
return `@${claudePath}`;
|
|
99275
|
-
});
|
|
99318
|
+
const windowsProjectDirPathResult = replaceTracked(transformed, /%CLAUDE_PROJECT_DIR%\/\.claude\//g, claudePath);
|
|
99319
|
+
transformed = windowsProjectDirPathResult.content;
|
|
99320
|
+
changes += windowsProjectDirPathResult.changes;
|
|
99321
|
+
}
|
|
99322
|
+
const relativeClaudePathResult = replaceTracked(transformed, /\.\/\.claude\//g, claudePath);
|
|
99323
|
+
transformed = relativeClaudePathResult.content;
|
|
99324
|
+
changes += relativeClaudePathResult.changes;
|
|
99325
|
+
const atRelativeClaudePathResult = replaceTracked(transformed, /@\.\/\.claude\//g, `@${claudePath}`);
|
|
99326
|
+
transformed = atRelativeClaudePathResult.content;
|
|
99327
|
+
changes += atRelativeClaudePathResult.changes;
|
|
99328
|
+
const atClaudePathResult = replaceTracked(transformed, /@\.claude\//g, `@${claudePath}`);
|
|
99329
|
+
transformed = atClaudePathResult.content;
|
|
99330
|
+
changes += atClaudePathResult.changes;
|
|
99276
99331
|
transformed = transformed.replace(/(["'`])\.claude\//g, (_match, quote) => {
|
|
99277
99332
|
changes++;
|
|
99278
99333
|
return `${quote}${claudePath}`;
|
|
99279
99334
|
});
|
|
99280
|
-
|
|
99281
|
-
|
|
99282
|
-
|
|
99283
|
-
});
|
|
99284
|
-
transformed =
|
|
99285
|
-
|
|
99286
|
-
|
|
99287
|
-
|
|
99288
|
-
|
|
99289
|
-
|
|
99290
|
-
|
|
99291
|
-
|
|
99292
|
-
|
|
99293
|
-
|
|
99294
|
-
|
|
99295
|
-
|
|
99296
|
-
|
|
99297
|
-
|
|
99298
|
-
|
|
99299
|
-
|
|
99335
|
+
const markdownClaudePathResult = replaceTracked(transformed, /\(\.claude\//g, `(${claudePath}`);
|
|
99336
|
+
transformed = markdownClaudePathResult.content;
|
|
99337
|
+
changes += markdownClaudePathResult.changes;
|
|
99338
|
+
const spacedClaudePathResult = replaceTracked(transformed, / \.claude\//g, ` ${claudePath}`);
|
|
99339
|
+
transformed = spacedClaudePathResult.content;
|
|
99340
|
+
changes += spacedClaudePathResult.changes;
|
|
99341
|
+
const lineStartClaudePathResult = replaceTracked(transformed, /^\.claude\//gm, claudePath);
|
|
99342
|
+
transformed = lineStartClaudePathResult.content;
|
|
99343
|
+
changes += lineStartClaudePathResult.changes;
|
|
99344
|
+
const colonClaudePathResult = replaceTracked(transformed, /: \.claude\//g, `: ${claudePath}`);
|
|
99345
|
+
transformed = colonClaudePathResult.content;
|
|
99346
|
+
changes += colonClaudePathResult.changes;
|
|
99347
|
+
const compactColonClaudePathResult = replaceTracked(transformed, /:\.claude\//g, `:${claudePath}`);
|
|
99348
|
+
transformed = compactColonClaudePathResult.content;
|
|
99349
|
+
changes += compactColonClaudePathResult.changes;
|
|
99350
|
+
if (customGlobalClaudeDir) {
|
|
99351
|
+
const customPatterns = [
|
|
99352
|
+
{ pattern: /~\/\.claude\//g, replacement: `${customGlobalClaudeDir}/` },
|
|
99353
|
+
{ pattern: /~\/\.claude\b/g, replacement: customGlobalClaudeDir },
|
|
99354
|
+
{ pattern: /\$HOME\/\.claude\//g, replacement: `${customGlobalClaudeDir}/` },
|
|
99355
|
+
{ pattern: /\$HOME\/\.claude\b/g, replacement: customGlobalClaudeDir },
|
|
99356
|
+
{ pattern: /\$\{HOME\}\/\.claude\//g, replacement: `${customGlobalClaudeDir}/` },
|
|
99357
|
+
{ pattern: /\$\{HOME\}\/\.claude\b/g, replacement: customGlobalClaudeDir },
|
|
99358
|
+
{ pattern: /%USERPROFILE%[\\/]\.claude[\\/]/g, replacement: `${customGlobalClaudeDir}/` },
|
|
99359
|
+
{ pattern: /%USERPROFILE%[\\/]\.claude\b/g, replacement: customGlobalClaudeDir },
|
|
99360
|
+
{
|
|
99361
|
+
pattern: /(?:os\.)?homedir\(\)\s*,\s*(["'])\.claude\1/g,
|
|
99362
|
+
replacement: `"${customGlobalClaudeDir}"`
|
|
99363
|
+
},
|
|
99364
|
+
{
|
|
99365
|
+
pattern: /\b(?:homeDir|homedir)\b\s*,\s*(["'])\.claude\1/g,
|
|
99366
|
+
replacement: `"${customGlobalClaudeDir}"`
|
|
99367
|
+
}
|
|
99368
|
+
];
|
|
99369
|
+
for (const { pattern, replacement } of customPatterns) {
|
|
99370
|
+
const customPatternResult = replaceTracked(transformed, pattern, replacement);
|
|
99371
|
+
transformed = customPatternResult.content;
|
|
99372
|
+
changes += customPatternResult.changes;
|
|
99373
|
+
}
|
|
99374
|
+
}
|
|
99300
99375
|
return { transformed, changes };
|
|
99301
99376
|
}
|
|
99302
99377
|
function shouldTransformFile3(filename) {
|
|
@@ -99312,7 +99387,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
99312
99387
|
async function processDirectory2(dir) {
|
|
99313
99388
|
const entries = await readdir35(dir, { withFileTypes: true });
|
|
99314
99389
|
for (const entry of entries) {
|
|
99315
|
-
const fullPath =
|
|
99390
|
+
const fullPath = join122(dir, entry.name);
|
|
99316
99391
|
if (entry.isDirectory()) {
|
|
99317
99392
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
99318
99393
|
continue;
|
|
@@ -99321,7 +99396,9 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
99321
99396
|
} else if (entry.isFile() && shouldTransformFile3(entry.name)) {
|
|
99322
99397
|
try {
|
|
99323
99398
|
const content = await readFile52(fullPath, "utf-8");
|
|
99324
|
-
const { transformed, changes } = transformContent(content
|
|
99399
|
+
const { transformed, changes } = transformContent(content, {
|
|
99400
|
+
targetClaudeDir: options2.targetClaudeDir
|
|
99401
|
+
});
|
|
99325
99402
|
if (changes > 0) {
|
|
99326
99403
|
await writeFile32(fullPath, transformed, "utf-8");
|
|
99327
99404
|
filesTransformed++;
|
|
@@ -99361,6 +99438,7 @@ async function handleTransforms(ctx) {
|
|
|
99361
99438
|
if (ctx.options.global) {
|
|
99362
99439
|
logger.info("Transforming paths for global installation...");
|
|
99363
99440
|
const transformResult = await transformPathsForGlobalInstall(ctx.extractDir, {
|
|
99441
|
+
targetClaudeDir: ctx.resolvedDir,
|
|
99364
99442
|
verbose: logger.isVerbose()
|
|
99365
99443
|
});
|
|
99366
99444
|
logger.success(`Transformed ${transformResult.totalChanges} path(s) in ${transformResult.filesTransformed} file(s)`);
|
|
@@ -99388,7 +99466,7 @@ async function handleTransforms(ctx) {
|
|
|
99388
99466
|
logger.debug(ctx.options.global ? "Saved folder configuration to ~/.claude/.ck.json" : "Saved folder configuration to .claude/.ck.json");
|
|
99389
99467
|
}
|
|
99390
99468
|
}
|
|
99391
|
-
const claudeDir2 = ctx.options.global ? ctx.resolvedDir :
|
|
99469
|
+
const claudeDir2 = ctx.options.global ? ctx.resolvedDir : join123(ctx.resolvedDir, ".claude");
|
|
99392
99470
|
return {
|
|
99393
99471
|
...ctx,
|
|
99394
99472
|
foldersConfig,
|
|
@@ -99579,8 +99657,8 @@ init_dist2();
|
|
|
99579
99657
|
var import_picocolors29 = __toESM(require_picocolors(), 1);
|
|
99580
99658
|
import { existsSync as existsSync56 } from "node:fs";
|
|
99581
99659
|
import { readFile as readFile53, rm as rm15, unlink as unlink12 } from "node:fs/promises";
|
|
99582
|
-
import { homedir as
|
|
99583
|
-
import { basename as basename19, join as
|
|
99660
|
+
import { homedir as homedir34 } from "node:os";
|
|
99661
|
+
import { basename as basename19, join as join124, resolve as resolve29 } from "node:path";
|
|
99584
99662
|
init_logger();
|
|
99585
99663
|
init_agents_discovery();
|
|
99586
99664
|
init_commands_discovery();
|
|
@@ -100005,7 +100083,7 @@ async function executeDeleteAction(action, options2) {
|
|
|
100005
100083
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
100006
100084
|
if (!skillSourcePath)
|
|
100007
100085
|
return;
|
|
100008
|
-
const sourceMetadataPath =
|
|
100086
|
+
const sourceMetadataPath = join124(resolve29(skillSourcePath, ".."), "metadata.json");
|
|
100009
100087
|
if (!existsSync56(sourceMetadataPath))
|
|
100010
100088
|
return;
|
|
100011
100089
|
let sourceMetadata;
|
|
@@ -100018,7 +100096,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
100018
100096
|
}
|
|
100019
100097
|
if (!sourceMetadata.deletions || sourceMetadata.deletions.length === 0)
|
|
100020
100098
|
return;
|
|
100021
|
-
const claudeDir2 = installGlobally ?
|
|
100099
|
+
const claudeDir2 = installGlobally ? join124(homedir34(), ".claude") : join124(process.cwd(), ".claude");
|
|
100022
100100
|
if (!existsSync56(claudeDir2))
|
|
100023
100101
|
return;
|
|
100024
100102
|
try {
|
|
@@ -100173,8 +100251,8 @@ async function migrateCommand(options2) {
|
|
|
100173
100251
|
selectedProviders = Array.from(new Set(selectedProviders));
|
|
100174
100252
|
let installGlobally = options2.global ?? false;
|
|
100175
100253
|
if (options2.global === undefined && !options2.yes) {
|
|
100176
|
-
const projectTarget =
|
|
100177
|
-
const globalTarget =
|
|
100254
|
+
const projectTarget = join124(process.cwd(), ".claude");
|
|
100255
|
+
const globalTarget = join124(homedir34(), ".claude");
|
|
100178
100256
|
const scopeChoice = await ie({
|
|
100179
100257
|
message: "Installation scope",
|
|
100180
100258
|
options: [
|
|
@@ -100226,7 +100304,7 @@ async function migrateCommand(options2) {
|
|
|
100226
100304
|
}
|
|
100227
100305
|
const providerNames = selectedProviders.map((prov) => import_picocolors29.default.cyan(providers[prov].displayName)).join(", ");
|
|
100228
100306
|
f2.message(` Providers: ${providerNames}`);
|
|
100229
|
-
const targetDir = installGlobally ?
|
|
100307
|
+
const targetDir = installGlobally ? join124(homedir34(), ".claude") : join124(process.cwd(), ".claude");
|
|
100230
100308
|
f2.message(` Scope: ${installGlobally ? "Global" : "Project"} ${import_picocolors29.default.dim(`-> ${targetDir}`)}`);
|
|
100231
100309
|
const cmdProviders = getProvidersSupporting("commands");
|
|
100232
100310
|
const unsupportedCmd = selectedProviders.filter((pv) => !cmdProviders.includes(pv));
|
|
@@ -100722,7 +100800,7 @@ async function handleDirectorySetup(ctx) {
|
|
|
100722
100800
|
// src/commands/new/phases/project-creation.ts
|
|
100723
100801
|
init_config_manager();
|
|
100724
100802
|
init_github_client();
|
|
100725
|
-
import { join as
|
|
100803
|
+
import { join as join125 } from "node:path";
|
|
100726
100804
|
init_logger();
|
|
100727
100805
|
init_output_manager();
|
|
100728
100806
|
init_types3();
|
|
@@ -100848,7 +100926,7 @@ async function projectCreation(kit, resolvedDir, validOptions, isNonInteractive2
|
|
|
100848
100926
|
output.section("Installing");
|
|
100849
100927
|
logger.verbose("Installation target", { directory: resolvedDir });
|
|
100850
100928
|
const merger = new FileMerger;
|
|
100851
|
-
const claudeDir2 =
|
|
100929
|
+
const claudeDir2 = join125(resolvedDir, ".claude");
|
|
100852
100930
|
merger.setMultiKitContext(claudeDir2, kit);
|
|
100853
100931
|
if (validOptions.exclude && validOptions.exclude.length > 0) {
|
|
100854
100932
|
merger.addIgnorePatterns(validOptions.exclude);
|
|
@@ -100895,7 +100973,7 @@ async function handleProjectCreation(ctx) {
|
|
|
100895
100973
|
}
|
|
100896
100974
|
// src/commands/new/phases/post-setup.ts
|
|
100897
100975
|
init_projects_registry();
|
|
100898
|
-
import { join as
|
|
100976
|
+
import { join as join126 } from "node:path";
|
|
100899
100977
|
init_package_installer();
|
|
100900
100978
|
init_logger();
|
|
100901
100979
|
init_path_resolver();
|
|
@@ -100927,9 +101005,9 @@ async function postSetup(resolvedDir, validOptions, isNonInteractive2, prompts)
|
|
|
100927
101005
|
withSudo: validOptions.withSudo
|
|
100928
101006
|
});
|
|
100929
101007
|
}
|
|
100930
|
-
const claudeDir2 =
|
|
101008
|
+
const claudeDir2 = join126(resolvedDir, ".claude");
|
|
100931
101009
|
await promptSetupWizardIfNeeded({
|
|
100932
|
-
envPath:
|
|
101010
|
+
envPath: join126(claudeDir2, ".env"),
|
|
100933
101011
|
claudeDir: claudeDir2,
|
|
100934
101012
|
isGlobal: false,
|
|
100935
101013
|
isNonInteractive: isNonInteractive2,
|
|
@@ -100999,7 +101077,7 @@ Please use only one download method.`);
|
|
|
100999
101077
|
// src/commands/plan/plan-command.ts
|
|
101000
101078
|
init_output_manager();
|
|
101001
101079
|
import { existsSync as existsSync58, statSync as statSync9 } from "node:fs";
|
|
101002
|
-
import { dirname as dirname32, join as
|
|
101080
|
+
import { dirname as dirname32, join as join128, parse as parse6, resolve as resolve33 } from "node:path";
|
|
101003
101081
|
|
|
101004
101082
|
// src/commands/plan/plan-read-handlers.ts
|
|
101005
101083
|
init_plan_parser();
|
|
@@ -101007,7 +101085,7 @@ init_logger();
|
|
|
101007
101085
|
init_output_manager();
|
|
101008
101086
|
var import_picocolors31 = __toESM(require_picocolors(), 1);
|
|
101009
101087
|
import { existsSync as existsSync57, statSync as statSync8 } from "node:fs";
|
|
101010
|
-
import { basename as basename20, dirname as dirname31, join as
|
|
101088
|
+
import { basename as basename20, dirname as dirname31, join as join127, relative as relative21, resolve as resolve31 } from "node:path";
|
|
101011
101089
|
async function handleParse(target, options2) {
|
|
101012
101090
|
const planFile = resolvePlanFile(target);
|
|
101013
101091
|
if (!planFile) {
|
|
@@ -101083,7 +101161,7 @@ async function handleValidate(target, options2) {
|
|
|
101083
101161
|
}
|
|
101084
101162
|
async function handleStatus(target, options2) {
|
|
101085
101163
|
const t = target ? resolve31(target) : null;
|
|
101086
|
-
const plansDir = t && existsSync57(t) && statSync8(t).isDirectory() && !existsSync57(
|
|
101164
|
+
const plansDir = t && existsSync57(t) && statSync8(t).isDirectory() && !existsSync57(join127(t, "plan.md")) ? t : null;
|
|
101087
101165
|
if (plansDir) {
|
|
101088
101166
|
const planFiles = scanPlanDir(plansDir);
|
|
101089
101167
|
if (planFiles.length === 0) {
|
|
@@ -101355,7 +101433,7 @@ function resolvePlanFile(target) {
|
|
|
101355
101433
|
const stat19 = statSync9(t);
|
|
101356
101434
|
if (stat19.isFile())
|
|
101357
101435
|
return t;
|
|
101358
|
-
const candidate =
|
|
101436
|
+
const candidate = join128(t, "plan.md");
|
|
101359
101437
|
if (existsSync58(candidate))
|
|
101360
101438
|
return candidate;
|
|
101361
101439
|
}
|
|
@@ -101363,7 +101441,7 @@ function resolvePlanFile(target) {
|
|
|
101363
101441
|
let dir = process.cwd();
|
|
101364
101442
|
const root = parse6(dir).root;
|
|
101365
101443
|
while (dir !== root) {
|
|
101366
|
-
const candidate =
|
|
101444
|
+
const candidate = join128(dir, "plan.md");
|
|
101367
101445
|
if (existsSync58(candidate))
|
|
101368
101446
|
return candidate;
|
|
101369
101447
|
dir = dirname32(dir);
|
|
@@ -102391,7 +102469,7 @@ async function detectInstallations() {
|
|
|
102391
102469
|
|
|
102392
102470
|
// src/commands/uninstall/removal-handler.ts
|
|
102393
102471
|
import { readdirSync as readdirSync8, rmSync as rmSync6 } from "node:fs";
|
|
102394
|
-
import { basename as basename22, join as
|
|
102472
|
+
import { basename as basename22, join as join130, resolve as resolve35, sep as sep10 } from "node:path";
|
|
102395
102473
|
init_logger();
|
|
102396
102474
|
init_safe_prompts();
|
|
102397
102475
|
init_safe_spinner();
|
|
@@ -102400,7 +102478,7 @@ var import_fs_extra41 = __toESM(require_lib(), 1);
|
|
|
102400
102478
|
// src/commands/uninstall/analysis-handler.ts
|
|
102401
102479
|
init_metadata_migration();
|
|
102402
102480
|
import { readdirSync as readdirSync7, rmSync as rmSync5 } from "node:fs";
|
|
102403
|
-
import { dirname as dirname33, join as
|
|
102481
|
+
import { dirname as dirname33, join as join129 } from "node:path";
|
|
102404
102482
|
init_logger();
|
|
102405
102483
|
init_safe_prompts();
|
|
102406
102484
|
var import_fs_extra40 = __toESM(require_lib(), 1);
|
|
@@ -102457,7 +102535,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
102457
102535
|
const remainingFiles = metadata.kits?.[remainingKit]?.files || [];
|
|
102458
102536
|
for (const file of remainingFiles) {
|
|
102459
102537
|
const relativePath = normalizeTrackedPath(file.path);
|
|
102460
|
-
if (await import_fs_extra40.pathExists(
|
|
102538
|
+
if (await import_fs_extra40.pathExists(join129(installation.path, relativePath))) {
|
|
102461
102539
|
result.retainedManifestPaths.push(relativePath);
|
|
102462
102540
|
}
|
|
102463
102541
|
}
|
|
@@ -102465,7 +102543,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
102465
102543
|
const kitFiles = metadata.kits[kit].files || [];
|
|
102466
102544
|
for (const trackedFile of kitFiles) {
|
|
102467
102545
|
const relativePath = normalizeTrackedPath(trackedFile.path);
|
|
102468
|
-
const filePath =
|
|
102546
|
+
const filePath = join129(installation.path, relativePath);
|
|
102469
102547
|
if (preservedPaths.has(relativePath)) {
|
|
102470
102548
|
result.toPreserve.push({ path: relativePath, reason: "shared with other kit" });
|
|
102471
102549
|
continue;
|
|
@@ -102498,7 +102576,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
102498
102576
|
}
|
|
102499
102577
|
for (const trackedFile of allTrackedFiles) {
|
|
102500
102578
|
const relativePath = normalizeTrackedPath(trackedFile.path);
|
|
102501
|
-
const filePath =
|
|
102579
|
+
const filePath = join129(installation.path, relativePath);
|
|
102502
102580
|
const ownershipResult = await OwnershipChecker.checkOwnership(filePath, metadata, installation.path);
|
|
102503
102581
|
if (!ownershipResult.exists)
|
|
102504
102582
|
continue;
|
|
@@ -102641,7 +102719,7 @@ async function removeInstallations(installations, options2) {
|
|
|
102641
102719
|
let removedCount = 0;
|
|
102642
102720
|
let cleanedDirs = 0;
|
|
102643
102721
|
for (const item of analysis.toDelete) {
|
|
102644
|
-
const filePath =
|
|
102722
|
+
const filePath = join130(installation.path, item.path);
|
|
102645
102723
|
if (!await import_fs_extra41.pathExists(filePath))
|
|
102646
102724
|
continue;
|
|
102647
102725
|
if (!await isPathSafeToRemove(filePath, installation.path)) {
|
|
@@ -102975,7 +103053,7 @@ ${import_picocolors39.default.bold(import_picocolors39.default.cyan(result.kitCo
|
|
|
102975
103053
|
init_logger();
|
|
102976
103054
|
import { existsSync as existsSync65 } from "node:fs";
|
|
102977
103055
|
import { rm as rm16 } from "node:fs/promises";
|
|
102978
|
-
import { join as
|
|
103056
|
+
import { join as join137 } from "node:path";
|
|
102979
103057
|
var import_picocolors40 = __toESM(require_picocolors(), 1);
|
|
102980
103058
|
|
|
102981
103059
|
// src/commands/watch/phases/implementation-runner.ts
|
|
@@ -103494,7 +103572,7 @@ function spawnAndCollect3(command, args) {
|
|
|
103494
103572
|
|
|
103495
103573
|
// src/commands/watch/phases/issue-processor.ts
|
|
103496
103574
|
import { mkdir as mkdir33, writeFile as writeFile34 } from "node:fs/promises";
|
|
103497
|
-
import { join as
|
|
103575
|
+
import { join as join133 } from "node:path";
|
|
103498
103576
|
|
|
103499
103577
|
// src/commands/watch/phases/approval-detector.ts
|
|
103500
103578
|
init_logger();
|
|
@@ -103872,9 +103950,9 @@ async function checkAwaitingApproval(state, setup, options2, watchLog, projectDi
|
|
|
103872
103950
|
|
|
103873
103951
|
// src/commands/watch/phases/plan-dir-finder.ts
|
|
103874
103952
|
import { readdir as readdir37, stat as stat19 } from "node:fs/promises";
|
|
103875
|
-
import { join as
|
|
103953
|
+
import { join as join132 } from "node:path";
|
|
103876
103954
|
async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
103877
|
-
const plansRoot =
|
|
103955
|
+
const plansRoot = join132(cwd2, "plans");
|
|
103878
103956
|
try {
|
|
103879
103957
|
const entries = await readdir37(plansRoot);
|
|
103880
103958
|
const tenMinAgo = Date.now() - 10 * 60 * 1000;
|
|
@@ -103883,14 +103961,14 @@ async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
|
103883
103961
|
for (const entry of entries) {
|
|
103884
103962
|
if (entry === "watch" || entry === "reports" || entry === "visuals")
|
|
103885
103963
|
continue;
|
|
103886
|
-
const dirPath =
|
|
103964
|
+
const dirPath = join132(plansRoot, entry);
|
|
103887
103965
|
const dirStat = await stat19(dirPath);
|
|
103888
103966
|
if (!dirStat.isDirectory())
|
|
103889
103967
|
continue;
|
|
103890
103968
|
if (dirStat.mtimeMs < tenMinAgo)
|
|
103891
103969
|
continue;
|
|
103892
103970
|
try {
|
|
103893
|
-
await stat19(
|
|
103971
|
+
await stat19(join132(dirPath, "plan.md"));
|
|
103894
103972
|
} catch {
|
|
103895
103973
|
continue;
|
|
103896
103974
|
}
|
|
@@ -104121,13 +104199,13 @@ async function handlePlanGeneration(issue, state, config, setup, options2, watch
|
|
|
104121
104199
|
stats.plansCreated++;
|
|
104122
104200
|
const detectedPlanDir = await findRecentPlanDir(projectDir, issue.number, watchLog);
|
|
104123
104201
|
if (detectedPlanDir) {
|
|
104124
|
-
state.activeIssues[numStr].planPath =
|
|
104202
|
+
state.activeIssues[numStr].planPath = join133(detectedPlanDir, "plan.md");
|
|
104125
104203
|
watchLog.info(`Plan directory detected: ${detectedPlanDir}`);
|
|
104126
104204
|
} else {
|
|
104127
104205
|
try {
|
|
104128
|
-
const planDir =
|
|
104206
|
+
const planDir = join133(projectDir, "plans", "watch");
|
|
104129
104207
|
await mkdir33(planDir, { recursive: true });
|
|
104130
|
-
const planFilePath =
|
|
104208
|
+
const planFilePath = join133(planDir, `issue-${issue.number}-plan.md`);
|
|
104131
104209
|
await writeFile34(planFilePath, planResult.planText, "utf-8");
|
|
104132
104210
|
state.activeIssues[numStr].planPath = planFilePath;
|
|
104133
104211
|
watchLog.info(`Plan saved (fallback) to ${planFilePath}`);
|
|
@@ -104434,18 +104512,18 @@ init_logger();
|
|
|
104434
104512
|
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
104435
104513
|
import { existsSync as existsSync62 } from "node:fs";
|
|
104436
104514
|
import { readdir as readdir38, stat as stat20 } from "node:fs/promises";
|
|
104437
|
-
import { join as
|
|
104515
|
+
import { join as join134 } from "node:path";
|
|
104438
104516
|
async function scanForRepos(parentDir) {
|
|
104439
104517
|
const repos = [];
|
|
104440
104518
|
const entries = await readdir38(parentDir);
|
|
104441
104519
|
for (const entry of entries) {
|
|
104442
104520
|
if (entry.startsWith("."))
|
|
104443
104521
|
continue;
|
|
104444
|
-
const fullPath =
|
|
104522
|
+
const fullPath = join134(parentDir, entry);
|
|
104445
104523
|
const entryStat = await stat20(fullPath);
|
|
104446
104524
|
if (!entryStat.isDirectory())
|
|
104447
104525
|
continue;
|
|
104448
|
-
const gitDir =
|
|
104526
|
+
const gitDir = join134(fullPath, ".git");
|
|
104449
104527
|
if (!existsSync62(gitDir))
|
|
104450
104528
|
continue;
|
|
104451
104529
|
const result = spawnSync6("gh", ["repo", "view", "--json", "owner,name"], {
|
|
@@ -104471,8 +104549,8 @@ async function scanForRepos(parentDir) {
|
|
|
104471
104549
|
init_logger();
|
|
104472
104550
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
104473
104551
|
import { existsSync as existsSync63 } from "node:fs";
|
|
104474
|
-
import { homedir as
|
|
104475
|
-
import { join as
|
|
104552
|
+
import { homedir as homedir35 } from "node:os";
|
|
104553
|
+
import { join as join135 } from "node:path";
|
|
104476
104554
|
async function validateSetup(cwd2) {
|
|
104477
104555
|
const workDir = cwd2 ?? process.cwd();
|
|
104478
104556
|
const ghVersion = spawnSync7("gh", ["--version"], { encoding: "utf-8", timeout: 1e4 });
|
|
@@ -104503,7 +104581,7 @@ Run this command from a directory with a GitHub remote.`);
|
|
|
104503
104581
|
} catch {
|
|
104504
104582
|
throw new Error(`Failed to parse repository info: ${ghRepo.stdout}`);
|
|
104505
104583
|
}
|
|
104506
|
-
const skillsPath =
|
|
104584
|
+
const skillsPath = join135(homedir35(), ".claude", "skills");
|
|
104507
104585
|
const skillsAvailable = existsSync63(skillsPath);
|
|
104508
104586
|
if (!skillsAvailable) {
|
|
104509
104587
|
logger.warning(`ClaudeKit Engineer skills not found at ${skillsPath}`);
|
|
@@ -104522,7 +104600,7 @@ init_path_resolver();
|
|
|
104522
104600
|
import { createWriteStream as createWriteStream3, statSync as statSync10 } from "node:fs";
|
|
104523
104601
|
import { existsSync as existsSync64 } from "node:fs";
|
|
104524
104602
|
import { mkdir as mkdir35, rename as rename9 } from "node:fs/promises";
|
|
104525
|
-
import { join as
|
|
104603
|
+
import { join as join136 } from "node:path";
|
|
104526
104604
|
|
|
104527
104605
|
class WatchLogger {
|
|
104528
104606
|
logStream = null;
|
|
@@ -104530,7 +104608,7 @@ class WatchLogger {
|
|
|
104530
104608
|
logPath = null;
|
|
104531
104609
|
maxBytes;
|
|
104532
104610
|
constructor(logDir, maxBytes = 0) {
|
|
104533
|
-
this.logDir = logDir ??
|
|
104611
|
+
this.logDir = logDir ?? join136(PathResolver.getClaudeKitDir(), "logs");
|
|
104534
104612
|
this.maxBytes = maxBytes;
|
|
104535
104613
|
}
|
|
104536
104614
|
async init() {
|
|
@@ -104539,7 +104617,7 @@ class WatchLogger {
|
|
|
104539
104617
|
await mkdir35(this.logDir, { recursive: true });
|
|
104540
104618
|
}
|
|
104541
104619
|
const dateStr = formatDate(new Date);
|
|
104542
|
-
this.logPath =
|
|
104620
|
+
this.logPath = join136(this.logDir, `watch-${dateStr}.log`);
|
|
104543
104621
|
this.logStream = createWriteStream3(this.logPath, { flags: "a", mode: 384 });
|
|
104544
104622
|
} catch (error) {
|
|
104545
104623
|
logger.warning(`Cannot create watch log file: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -104721,7 +104799,7 @@ async function watchCommand(options2) {
|
|
|
104721
104799
|
}
|
|
104722
104800
|
async function discoverRepos(options2, watchLog) {
|
|
104723
104801
|
const cwd2 = process.cwd();
|
|
104724
|
-
const isGitRepo = existsSync65(
|
|
104802
|
+
const isGitRepo = existsSync65(join137(cwd2, ".git"));
|
|
104725
104803
|
if (options2.force) {
|
|
104726
104804
|
await forceRemoveLock(watchLog);
|
|
104727
104805
|
}
|
|
@@ -104979,7 +105057,7 @@ init_logger();
|
|
|
104979
105057
|
init_path_resolver();
|
|
104980
105058
|
init_types3();
|
|
104981
105059
|
import { existsSync as existsSync76, readFileSync as readFileSync19 } from "node:fs";
|
|
104982
|
-
import { join as
|
|
105060
|
+
import { join as join148 } from "node:path";
|
|
104983
105061
|
var packageVersion = package_default.version;
|
|
104984
105062
|
function formatInstalledKits(metadata) {
|
|
104985
105063
|
if (!metadata.kits || Object.keys(metadata.kits).length === 0) {
|
|
@@ -105011,9 +105089,9 @@ async function displayVersion() {
|
|
|
105011
105089
|
let localKitVersion = null;
|
|
105012
105090
|
let isGlobalOnlyKit = false;
|
|
105013
105091
|
const globalKitDir = PathResolver.getGlobalKitDir();
|
|
105014
|
-
const globalMetadataPath =
|
|
105092
|
+
const globalMetadataPath = join148(globalKitDir, "metadata.json");
|
|
105015
105093
|
const prefix = PathResolver.getPathPrefix(false);
|
|
105016
|
-
const localMetadataPath = prefix ?
|
|
105094
|
+
const localMetadataPath = prefix ? join148(process.cwd(), prefix, "metadata.json") : join148(process.cwd(), "metadata.json");
|
|
105017
105095
|
const isLocalSameAsGlobal = localMetadataPath === globalMetadataPath;
|
|
105018
105096
|
if (!isLocalSameAsGlobal && existsSync76(localMetadataPath)) {
|
|
105019
105097
|
try {
|