claudekit-cli 3.35.0-dev.25 → 3.35.0-dev.27
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
CHANGED
|
@@ -51613,11 +51613,14 @@ var init_skill_scanner = __esm(() => {
|
|
|
51613
51613
|
|
|
51614
51614
|
// src/services/claude-data/settings-reader.ts
|
|
51615
51615
|
import { existsSync as existsSync23 } from "node:fs";
|
|
51616
|
-
import { readFile as readFile18 } from "node:fs/promises";
|
|
51616
|
+
import { copyFile as copyFile2, mkdir as mkdir8, readFile as readFile18, rename as rename5, rm as rm6, writeFile as writeFile10 } from "node:fs/promises";
|
|
51617
51617
|
import { homedir as homedir17 } from "node:os";
|
|
51618
51618
|
import { join as join26 } from "node:path";
|
|
51619
|
+
function getSettingsPath() {
|
|
51620
|
+
return join26(claudeDir, settingsFilename);
|
|
51621
|
+
}
|
|
51619
51622
|
async function readSettings() {
|
|
51620
|
-
const settingsPath =
|
|
51623
|
+
const settingsPath = getSettingsPath();
|
|
51621
51624
|
try {
|
|
51622
51625
|
if (!existsSync23(settingsPath))
|
|
51623
51626
|
return null;
|
|
@@ -51627,6 +51630,31 @@ async function readSettings() {
|
|
|
51627
51630
|
return null;
|
|
51628
51631
|
}
|
|
51629
51632
|
}
|
|
51633
|
+
function getBackupTimestamp() {
|
|
51634
|
+
return new Date().toISOString().replace(/[-:]/g, "").replace(/\..+/, "").replace("T", "-");
|
|
51635
|
+
}
|
|
51636
|
+
async function backupAndSaveSettings(settings) {
|
|
51637
|
+
const settingsPath = getSettingsPath();
|
|
51638
|
+
await mkdir8(claudeDir, { recursive: true });
|
|
51639
|
+
let backupPath = null;
|
|
51640
|
+
if (existsSync23(settingsPath)) {
|
|
51641
|
+
await mkdir8(settingsBackupDir, { recursive: true });
|
|
51642
|
+
backupPath = join26(settingsBackupDir, `${getBackupTimestamp()}-${settingsFilename}`);
|
|
51643
|
+
await copyFile2(settingsPath, backupPath);
|
|
51644
|
+
}
|
|
51645
|
+
const tempPath = `${settingsPath}.tmp-${Date.now()}`;
|
|
51646
|
+
try {
|
|
51647
|
+
await writeFile10(tempPath, `${JSON.stringify(settings, null, 2)}
|
|
51648
|
+
`, "utf-8");
|
|
51649
|
+
await rename5(tempPath, settingsPath);
|
|
51650
|
+
return { backupPath, savedPath: settingsPath };
|
|
51651
|
+
} catch (error) {
|
|
51652
|
+
await rm6(tempPath, { force: true }).catch(() => {
|
|
51653
|
+
return;
|
|
51654
|
+
});
|
|
51655
|
+
throw error;
|
|
51656
|
+
}
|
|
51657
|
+
}
|
|
51630
51658
|
function getCurrentModel() {
|
|
51631
51659
|
return process.env.ANTHROPIC_MODEL || null;
|
|
51632
51660
|
}
|
|
@@ -51646,9 +51674,10 @@ function countMcpServers(settings) {
|
|
|
51646
51674
|
return 0;
|
|
51647
51675
|
return Object.keys(settings.mcpServers).length;
|
|
51648
51676
|
}
|
|
51649
|
-
var claudeDir;
|
|
51677
|
+
var claudeDir, settingsFilename = "settings.json", settingsBackupDir;
|
|
51650
51678
|
var init_settings_reader = __esm(() => {
|
|
51651
51679
|
claudeDir = join26(homedir17(), ".claude");
|
|
51680
|
+
settingsBackupDir = join26(claudeDir, ".ck-backups", "settings");
|
|
51652
51681
|
});
|
|
51653
51682
|
|
|
51654
51683
|
// src/services/claude-data/project-scanner.ts
|
|
@@ -52244,6 +52273,7 @@ var init_session_routes = __esm(() => {
|
|
|
52244
52273
|
});
|
|
52245
52274
|
|
|
52246
52275
|
// src/domains/web-server/routes/settings-routes.ts
|
|
52276
|
+
import { homedir as homedir22 } from "node:os";
|
|
52247
52277
|
function registerSettingsRoutes(app) {
|
|
52248
52278
|
app.get("/api/settings", async (_req, res) => {
|
|
52249
52279
|
try {
|
|
@@ -52255,20 +52285,85 @@ function registerSettingsRoutes(app) {
|
|
|
52255
52285
|
model,
|
|
52256
52286
|
hookCount,
|
|
52257
52287
|
mcpServerCount,
|
|
52258
|
-
permissions: settings?.permissions || null
|
|
52288
|
+
permissions: settings?.permissions || null,
|
|
52289
|
+
settingsPath: "~/.claude/settings.json",
|
|
52290
|
+
settingsExists: settings !== null,
|
|
52291
|
+
settings: settings ?? {}
|
|
52259
52292
|
});
|
|
52260
52293
|
} catch (error) {
|
|
52261
52294
|
res.status(500).json({ error: "Failed to read settings" });
|
|
52262
52295
|
}
|
|
52263
52296
|
});
|
|
52297
|
+
app.get("/api/settings/raw", async (_req, res) => {
|
|
52298
|
+
try {
|
|
52299
|
+
const settings = await readSettings();
|
|
52300
|
+
res.json({
|
|
52301
|
+
path: "~/.claude/settings.json",
|
|
52302
|
+
exists: settings !== null,
|
|
52303
|
+
settings: settings ?? {}
|
|
52304
|
+
});
|
|
52305
|
+
} catch (error) {
|
|
52306
|
+
res.status(500).json({ error: "Failed to read settings file" });
|
|
52307
|
+
}
|
|
52308
|
+
});
|
|
52309
|
+
app.put("/api/settings/raw", async (req, res) => {
|
|
52310
|
+
try {
|
|
52311
|
+
const payload = req.body;
|
|
52312
|
+
if (!payload || typeof payload !== "object" || payload.settings === undefined) {
|
|
52313
|
+
res.status(400).json({ error: "Missing settings payload" });
|
|
52314
|
+
return;
|
|
52315
|
+
}
|
|
52316
|
+
if (payload.settings === null || typeof payload.settings !== "object") {
|
|
52317
|
+
res.status(400).json({ error: "settings must be a JSON object" });
|
|
52318
|
+
return;
|
|
52319
|
+
}
|
|
52320
|
+
const validation = ClaudeSettingsWriteSchema.safeParse(payload.settings);
|
|
52321
|
+
if (!validation.success) {
|
|
52322
|
+
res.status(400).json({
|
|
52323
|
+
error: "Settings validation failed",
|
|
52324
|
+
details: validation.error.issues
|
|
52325
|
+
});
|
|
52326
|
+
return;
|
|
52327
|
+
}
|
|
52328
|
+
const saveResult = await backupAndSaveSettings(validation.data);
|
|
52329
|
+
res.json({
|
|
52330
|
+
success: true,
|
|
52331
|
+
path: "~/.claude/settings.json",
|
|
52332
|
+
backupPath: saveResult.backupPath ? saveResult.backupPath.replace(homedir22(), "~") : null,
|
|
52333
|
+
absolutePath: getSettingsPath()
|
|
52334
|
+
});
|
|
52335
|
+
} catch (error) {
|
|
52336
|
+
res.status(500).json({ error: "Failed to save settings file" });
|
|
52337
|
+
}
|
|
52338
|
+
});
|
|
52264
52339
|
}
|
|
52340
|
+
var HookGroupSchema, ClaudeSettingsWriteSchema;
|
|
52265
52341
|
var init_settings_routes = __esm(() => {
|
|
52266
52342
|
init_claude_data();
|
|
52343
|
+
init_zod();
|
|
52344
|
+
HookGroupSchema = exports_external.object({
|
|
52345
|
+
matcher: exports_external.string().optional(),
|
|
52346
|
+
hooks: exports_external.array(exports_external.unknown())
|
|
52347
|
+
}).passthrough();
|
|
52348
|
+
ClaudeSettingsWriteSchema = exports_external.object({
|
|
52349
|
+
model: exports_external.string().optional(),
|
|
52350
|
+
includeCoAuthoredBy: exports_external.boolean().optional(),
|
|
52351
|
+
permissions: exports_external.object({
|
|
52352
|
+
allow: exports_external.array(exports_external.string()).optional(),
|
|
52353
|
+
deny: exports_external.array(exports_external.string()).optional(),
|
|
52354
|
+
defaultMode: exports_external.string().optional()
|
|
52355
|
+
}).passthrough().optional(),
|
|
52356
|
+
hooks: exports_external.record(exports_external.array(HookGroupSchema)).optional(),
|
|
52357
|
+
mcpServers: exports_external.record(exports_external.unknown()).optional(),
|
|
52358
|
+
statusLine: exports_external.unknown().optional(),
|
|
52359
|
+
enabledPlugins: exports_external.record(exports_external.unknown()).optional(),
|
|
52360
|
+
effortLevel: exports_external.string().optional()
|
|
52361
|
+
}).passthrough();
|
|
52267
52362
|
});
|
|
52268
52363
|
|
|
52269
52364
|
// src/commands/skills/agents.ts
|
|
52270
52365
|
import { existsSync as existsSync25 } from "node:fs";
|
|
52271
|
-
import { homedir as
|
|
52366
|
+
import { homedir as homedir23 } from "node:os";
|
|
52272
52367
|
import { join as join31 } from "node:path";
|
|
52273
52368
|
async function detectInstalledAgents() {
|
|
52274
52369
|
const installed = [];
|
|
@@ -52293,7 +52388,7 @@ function isSkillInstalled(skillName, agent, options2) {
|
|
|
52293
52388
|
}
|
|
52294
52389
|
var home6, agents;
|
|
52295
52390
|
var init_agents = __esm(() => {
|
|
52296
|
-
home6 =
|
|
52391
|
+
home6 = homedir23();
|
|
52297
52392
|
agents = {
|
|
52298
52393
|
"claude-code": {
|
|
52299
52394
|
name: "claude-code",
|
|
@@ -52398,8 +52493,8 @@ var init_agents = __esm(() => {
|
|
|
52398
52493
|
|
|
52399
52494
|
// src/commands/skills/skills-registry.ts
|
|
52400
52495
|
import { existsSync as existsSync26 } from "node:fs";
|
|
52401
|
-
import { mkdir as
|
|
52402
|
-
import { homedir as
|
|
52496
|
+
import { mkdir as mkdir9, readFile as readFile21, writeFile as writeFile11 } from "node:fs/promises";
|
|
52497
|
+
import { homedir as homedir24 } from "node:os";
|
|
52403
52498
|
import { dirname as dirname10, join as join32 } from "node:path";
|
|
52404
52499
|
function getCliVersion3() {
|
|
52405
52500
|
try {
|
|
@@ -52435,9 +52530,9 @@ async function readRegistry() {
|
|
|
52435
52530
|
async function writeRegistry(registry) {
|
|
52436
52531
|
const dir = dirname10(REGISTRY_PATH2);
|
|
52437
52532
|
if (!existsSync26(dir)) {
|
|
52438
|
-
await
|
|
52533
|
+
await mkdir9(dir, { recursive: true });
|
|
52439
52534
|
}
|
|
52440
|
-
await
|
|
52535
|
+
await writeFile11(REGISTRY_PATH2, JSON.stringify(registry, null, 2), "utf-8");
|
|
52441
52536
|
}
|
|
52442
52537
|
async function addInstallation(skill, agent, global3, path4, sourcePath) {
|
|
52443
52538
|
const registry = await readRegistry();
|
|
@@ -52492,7 +52587,7 @@ async function syncRegistry() {
|
|
|
52492
52587
|
var home7, REGISTRY_PATH2, SkillInstallationSchema, SkillRegistrySchema;
|
|
52493
52588
|
var init_skills_registry = __esm(() => {
|
|
52494
52589
|
init_zod();
|
|
52495
|
-
home7 =
|
|
52590
|
+
home7 = homedir24();
|
|
52496
52591
|
REGISTRY_PATH2 = join32(home7, ".claudekit", "skill-registry.json");
|
|
52497
52592
|
SkillInstallationSchema = exports_external.object({
|
|
52498
52593
|
skill: exports_external.string(),
|
|
@@ -52511,7 +52606,7 @@ var init_skills_registry = __esm(() => {
|
|
|
52511
52606
|
|
|
52512
52607
|
// src/commands/skills/skills-installer.ts
|
|
52513
52608
|
import { existsSync as existsSync27 } from "node:fs";
|
|
52514
|
-
import { cp as cp2, mkdir as
|
|
52609
|
+
import { cp as cp2, mkdir as mkdir10, stat as stat7 } from "node:fs/promises";
|
|
52515
52610
|
import { dirname as dirname11, resolve as resolve10 } from "node:path";
|
|
52516
52611
|
function isSamePath2(path1, path22) {
|
|
52517
52612
|
try {
|
|
@@ -52556,7 +52651,7 @@ async function installSkillForAgent(skill, agent, options2) {
|
|
|
52556
52651
|
try {
|
|
52557
52652
|
const parentDir = dirname11(targetPath);
|
|
52558
52653
|
if (!existsSync27(parentDir)) {
|
|
52559
|
-
await
|
|
52654
|
+
await mkdir10(parentDir, { recursive: true });
|
|
52560
52655
|
}
|
|
52561
52656
|
if (existsSync27(targetPath)) {
|
|
52562
52657
|
const stats = await stat7(targetPath);
|
|
@@ -52615,7 +52710,7 @@ var init_skills_installer = __esm(() => {
|
|
|
52615
52710
|
|
|
52616
52711
|
// src/commands/skills/skills-uninstaller.ts
|
|
52617
52712
|
import { existsSync as existsSync28 } from "node:fs";
|
|
52618
|
-
import { rm as
|
|
52713
|
+
import { rm as rm7 } from "node:fs/promises";
|
|
52619
52714
|
import { join as join33 } from "node:path";
|
|
52620
52715
|
async function uninstallSkillFromAgent(skill, agent, global3) {
|
|
52621
52716
|
const agentConfig = agents[agent];
|
|
@@ -52637,7 +52732,7 @@ async function uninstallSkillFromAgent(skill, agent, global3) {
|
|
|
52637
52732
|
const fileExists = existsSync28(path4);
|
|
52638
52733
|
try {
|
|
52639
52734
|
if (fileExists) {
|
|
52640
|
-
await
|
|
52735
|
+
await rm7(path4, { recursive: true, force: true });
|
|
52641
52736
|
}
|
|
52642
52737
|
await removeInstallation(skill, agent, global3);
|
|
52643
52738
|
return {
|
|
@@ -52677,7 +52772,7 @@ async function forceUninstallSkill(skill, agent, global3) {
|
|
|
52677
52772
|
};
|
|
52678
52773
|
}
|
|
52679
52774
|
try {
|
|
52680
|
-
await
|
|
52775
|
+
await rm7(path4, { recursive: true, force: true });
|
|
52681
52776
|
await removeInstallation(skill, agent, global3);
|
|
52682
52777
|
return {
|
|
52683
52778
|
skill,
|
|
@@ -53206,7 +53301,7 @@ var init_pnpm_detector = __esm(() => {
|
|
|
53206
53301
|
|
|
53207
53302
|
// src/domains/installation/package-managers/detection-core.ts
|
|
53208
53303
|
import { existsSync as existsSync29, realpathSync } from "node:fs";
|
|
53209
|
-
import { chmod as chmod2, mkdir as
|
|
53304
|
+
import { chmod as chmod2, mkdir as mkdir11, readFile as readFile22, writeFile as writeFile12 } from "node:fs/promises";
|
|
53210
53305
|
import { platform as platform4 } from "node:os";
|
|
53211
53306
|
import { join as join34, sep as sep3 } from "node:path";
|
|
53212
53307
|
function detectFromBinaryPath() {
|
|
@@ -53306,7 +53401,7 @@ async function saveCachedPm(pm, getVersion) {
|
|
|
53306
53401
|
const configDir = PathResolver.getConfigDir(false);
|
|
53307
53402
|
const cacheFile = join34(configDir, CACHE_FILE);
|
|
53308
53403
|
if (!existsSync29(configDir)) {
|
|
53309
|
-
await
|
|
53404
|
+
await mkdir11(configDir, { recursive: true });
|
|
53310
53405
|
if (platform4() !== "win32") {
|
|
53311
53406
|
await chmod2(configDir, 448);
|
|
53312
53407
|
}
|
|
@@ -53317,7 +53412,7 @@ async function saveCachedPm(pm, getVersion) {
|
|
|
53317
53412
|
detectedAt: Date.now(),
|
|
53318
53413
|
version: version ?? undefined
|
|
53319
53414
|
};
|
|
53320
|
-
await
|
|
53415
|
+
await writeFile12(cacheFile, JSON.stringify(data, null, 2), "utf-8");
|
|
53321
53416
|
if (platform4() !== "win32") {
|
|
53322
53417
|
await chmod2(cacheFile, 384);
|
|
53323
53418
|
}
|
|
@@ -53918,7 +54013,7 @@ var package_default;
|
|
|
53918
54013
|
var init_package = __esm(() => {
|
|
53919
54014
|
package_default = {
|
|
53920
54015
|
name: "claudekit-cli",
|
|
53921
|
-
version: "3.35.0-dev.
|
|
54016
|
+
version: "3.35.0-dev.27",
|
|
53922
54017
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
53923
54018
|
type: "module",
|
|
53924
54019
|
repository: {
|
|
@@ -53943,8 +54038,8 @@ var init_package = __esm(() => {
|
|
|
53943
54038
|
"ui:build": "cd src/ui && bun install --silent && bun run build",
|
|
53944
54039
|
"ui:dev": "cd src/ui && bun run dev",
|
|
53945
54040
|
build: "bun build src/index.ts --outdir dist --target node --external @octokit/rest",
|
|
53946
|
-
compile: "bun build
|
|
53947
|
-
"compile:binary": "bun build
|
|
54041
|
+
compile: "bun run ui:build && bun run scripts/compile-binary.ts",
|
|
54042
|
+
"compile:binary": "bun run ui:build && bun run scripts/compile-binary.ts --outfile bin/ck && cp bin/ck /usr/local/bin/ck && echo '✅ Installed globally: /usr/local/bin/ck'",
|
|
53948
54043
|
"compile:binaries": "node scripts/build-all-binaries.js",
|
|
53949
54044
|
"check-version-sync": "node scripts/check-binary-version-sync.js",
|
|
53950
54045
|
"build:platform-binaries": "bun run scripts/build-platform-binaries.js",
|
|
@@ -54763,7 +54858,7 @@ var init_error_handler2 = __esm(() => {
|
|
|
54763
54858
|
|
|
54764
54859
|
// src/domains/versioning/release-cache.ts
|
|
54765
54860
|
import { existsSync as existsSync30 } from "node:fs";
|
|
54766
|
-
import { mkdir as
|
|
54861
|
+
import { mkdir as mkdir12, readFile as readFile26, unlink as unlink6, writeFile as writeFile14 } from "node:fs/promises";
|
|
54767
54862
|
import { join as join38 } from "node:path";
|
|
54768
54863
|
var ReleaseCacheEntrySchema, ReleaseCache;
|
|
54769
54864
|
var init_release_cache = __esm(() => {
|
|
@@ -54809,12 +54904,12 @@ var init_release_cache = __esm(() => {
|
|
|
54809
54904
|
async set(key, releases) {
|
|
54810
54905
|
const cacheFile = this.getCachePath(key);
|
|
54811
54906
|
try {
|
|
54812
|
-
await
|
|
54907
|
+
await mkdir12(this.cacheDir, { recursive: true, mode: 448 });
|
|
54813
54908
|
const cacheEntry = {
|
|
54814
54909
|
timestamp: Date.now(),
|
|
54815
54910
|
releases
|
|
54816
54911
|
};
|
|
54817
|
-
await
|
|
54912
|
+
await writeFile14(cacheFile, JSON.stringify(cacheEntry, null, 2), "utf-8");
|
|
54818
54913
|
logger.debug(`Release cache set for key: ${key}, cached ${releases.length} releases`);
|
|
54819
54914
|
} catch (error) {
|
|
54820
54915
|
logger.debug(`Failed to set release cache for key ${key}: ${error}`);
|
|
@@ -55525,7 +55620,7 @@ var init_version_utils = __esm(() => {
|
|
|
55525
55620
|
|
|
55526
55621
|
// src/domains/versioning/version-cache.ts
|
|
55527
55622
|
import { existsSync as existsSync31 } from "node:fs";
|
|
55528
|
-
import { mkdir as
|
|
55623
|
+
import { mkdir as mkdir13, readFile as readFile27, writeFile as writeFile15 } from "node:fs/promises";
|
|
55529
55624
|
import { join as join39 } from "node:path";
|
|
55530
55625
|
var VersionCacheManager;
|
|
55531
55626
|
var init_version_cache = __esm(() => {
|
|
@@ -55563,9 +55658,9 @@ var init_version_cache = __esm(() => {
|
|
|
55563
55658
|
const cacheDir = PathResolver.getCacheDir(false);
|
|
55564
55659
|
try {
|
|
55565
55660
|
if (!existsSync31(cacheDir)) {
|
|
55566
|
-
await
|
|
55661
|
+
await mkdir13(cacheDir, { recursive: true, mode: 448 });
|
|
55567
55662
|
}
|
|
55568
|
-
await
|
|
55663
|
+
await writeFile15(cacheFile, JSON.stringify(cache3, null, 2), "utf-8");
|
|
55569
55664
|
logger.debug(`Version check cache saved to ${cacheFile}`);
|
|
55570
55665
|
} catch (error) {
|
|
55571
55666
|
logger.debug(`Failed to save version check cache: ${error}`);
|
|
@@ -56191,8 +56286,65 @@ var init_routes = __esm(() => {
|
|
|
56191
56286
|
|
|
56192
56287
|
// src/domains/web-server/static-server.ts
|
|
56193
56288
|
import { existsSync as existsSync33 } from "node:fs";
|
|
56194
|
-
import { dirname as dirname12, join as join41 } from "node:path";
|
|
56289
|
+
import { dirname as dirname12, extname as extname3, join as join41 } from "node:path";
|
|
56195
56290
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
56291
|
+
function tryServeFromEmbedded(app) {
|
|
56292
|
+
if (typeof globalThis.Bun === "undefined" || !globalThis.Bun.embeddedFiles?.length) {
|
|
56293
|
+
return false;
|
|
56294
|
+
}
|
|
56295
|
+
let prefix = "";
|
|
56296
|
+
for (const blob of globalThis.Bun.embeddedFiles) {
|
|
56297
|
+
const name = blob.name;
|
|
56298
|
+
if (name === "index.html" || name.endsWith("/index.html")) {
|
|
56299
|
+
prefix = name.replace("index.html", "");
|
|
56300
|
+
break;
|
|
56301
|
+
}
|
|
56302
|
+
}
|
|
56303
|
+
const fileMap = new Map;
|
|
56304
|
+
let indexBlob = null;
|
|
56305
|
+
for (const blob of globalThis.Bun.embeddedFiles) {
|
|
56306
|
+
const rawName = blob.name;
|
|
56307
|
+
const name = prefix && rawName.startsWith(prefix) ? rawName.slice(prefix.length) : rawName;
|
|
56308
|
+
fileMap.set(name, blob);
|
|
56309
|
+
if (name === "index.html") {
|
|
56310
|
+
indexBlob = blob;
|
|
56311
|
+
}
|
|
56312
|
+
}
|
|
56313
|
+
if (!indexBlob) {
|
|
56314
|
+
logger.debug("Embedded files found but no index.html — skipping embedded serving");
|
|
56315
|
+
return false;
|
|
56316
|
+
}
|
|
56317
|
+
logger.debug(`Serving UI from ${fileMap.size} embedded files`);
|
|
56318
|
+
app.use(async (req, res, next) => {
|
|
56319
|
+
if (req.path.startsWith("/api/") || req.path === "/ws" || req.path.startsWith("/ws/")) {
|
|
56320
|
+
return next();
|
|
56321
|
+
}
|
|
56322
|
+
const reqPath = req.path.replace(/^\//, "");
|
|
56323
|
+
if (reqPath.includes("..") || reqPath.includes("\x00")) {
|
|
56324
|
+
return next();
|
|
56325
|
+
}
|
|
56326
|
+
const blob = fileMap.get(reqPath);
|
|
56327
|
+
if (blob) {
|
|
56328
|
+
const ext = extname3(reqPath);
|
|
56329
|
+
const contentType = blob.type || MIME_FALLBACK[ext] || "application/octet-stream";
|
|
56330
|
+
res.setHeader("Content-Type", contentType);
|
|
56331
|
+
const cacheControl = ext === ".html" ? "no-cache" : "public, max-age=31536000, immutable";
|
|
56332
|
+
res.setHeader("Cache-Control", cacheControl);
|
|
56333
|
+
res.send(Buffer.from(await blob.arrayBuffer()));
|
|
56334
|
+
return;
|
|
56335
|
+
}
|
|
56336
|
+
const hasExt = req.path.match(/\.(js|css|ico|png|jpg|svg|woff2?)$/);
|
|
56337
|
+
if (!hasExt && indexBlob) {
|
|
56338
|
+
const contentType = indexBlob.type || "text/html";
|
|
56339
|
+
res.setHeader("Content-Type", contentType);
|
|
56340
|
+
res.setHeader("Cache-Control", "no-cache");
|
|
56341
|
+
res.send(Buffer.from(await indexBlob.arrayBuffer()));
|
|
56342
|
+
return;
|
|
56343
|
+
}
|
|
56344
|
+
return next();
|
|
56345
|
+
});
|
|
56346
|
+
return true;
|
|
56347
|
+
}
|
|
56196
56348
|
function resolveUiDistPath() {
|
|
56197
56349
|
const candidates = [
|
|
56198
56350
|
join41(__dirname3, "ui"),
|
|
@@ -56207,6 +56359,9 @@ function resolveUiDistPath() {
|
|
|
56207
56359
|
return candidates[0];
|
|
56208
56360
|
}
|
|
56209
56361
|
function serveStatic(app) {
|
|
56362
|
+
if (tryServeFromEmbedded(app)) {
|
|
56363
|
+
return;
|
|
56364
|
+
}
|
|
56210
56365
|
const uiDistPath = resolveUiDistPath();
|
|
56211
56366
|
if (!existsSync33(uiDistPath)) {
|
|
56212
56367
|
logger.warning(`UI dist not found at ${uiDistPath}. Run 'bun run ui:build' first.`);
|
|
@@ -56244,11 +56399,22 @@ function serveStatic(app) {
|
|
|
56244
56399
|
});
|
|
56245
56400
|
logger.debug(`Serving static files from ${uiDistPath}`);
|
|
56246
56401
|
}
|
|
56247
|
-
var import_express, __dirname3;
|
|
56402
|
+
var import_express, __dirname3, MIME_FALLBACK;
|
|
56248
56403
|
var init_static_server = __esm(() => {
|
|
56249
56404
|
init_logger();
|
|
56250
56405
|
import_express = __toESM(require_express2(), 1);
|
|
56251
56406
|
__dirname3 = dirname12(fileURLToPath2(import.meta.url));
|
|
56407
|
+
MIME_FALLBACK = {
|
|
56408
|
+
".html": "text/html",
|
|
56409
|
+
".js": "application/javascript",
|
|
56410
|
+
".css": "text/css",
|
|
56411
|
+
".json": "application/json",
|
|
56412
|
+
".svg": "image/svg+xml",
|
|
56413
|
+
".png": "image/png",
|
|
56414
|
+
".ico": "image/x-icon",
|
|
56415
|
+
".woff2": "font/woff2",
|
|
56416
|
+
".woff": "font/woff"
|
|
56417
|
+
};
|
|
56252
56418
|
});
|
|
56253
56419
|
|
|
56254
56420
|
// node_modules/ws/lib/constants.js
|
|
@@ -61656,7 +61822,7 @@ var init_skills_installer2 = __esm(() => {
|
|
|
61656
61822
|
|
|
61657
61823
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
61658
61824
|
import { existsSync as existsSync45 } from "node:fs";
|
|
61659
|
-
import { mkdir as
|
|
61825
|
+
import { mkdir as mkdir17, readFile as readFile35, writeFile as writeFile20 } from "node:fs/promises";
|
|
61660
61826
|
import { dirname as dirname15, join as join62 } from "node:path";
|
|
61661
61827
|
async function readJsonFile(filePath) {
|
|
61662
61828
|
try {
|
|
@@ -61687,7 +61853,7 @@ async function addGeminiToGitignore(projectDir) {
|
|
|
61687
61853
|
`) || content === "" ? "" : `
|
|
61688
61854
|
`;
|
|
61689
61855
|
const comment = "# Gemini CLI settings (contains user-specific config)";
|
|
61690
|
-
await
|
|
61856
|
+
await writeFile20(gitignorePath, `${content}${newLine}${comment}
|
|
61691
61857
|
${geminiPattern}
|
|
61692
61858
|
`, "utf-8");
|
|
61693
61859
|
logger.debug(`Added ${geminiPattern} to .gitignore`);
|
|
@@ -61699,7 +61865,7 @@ ${geminiPattern}
|
|
|
61699
61865
|
async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
61700
61866
|
const linkDir = dirname15(geminiSettingsPath);
|
|
61701
61867
|
if (!existsSync45(linkDir)) {
|
|
61702
|
-
await
|
|
61868
|
+
await mkdir17(linkDir, { recursive: true });
|
|
61703
61869
|
logger.debug(`Created directory: ${linkDir}`);
|
|
61704
61870
|
}
|
|
61705
61871
|
const mcpConfig = await readJsonFile(mcpConfigPath);
|
|
@@ -61712,7 +61878,7 @@ async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
|
61712
61878
|
}
|
|
61713
61879
|
const newSettings = { mcpServers };
|
|
61714
61880
|
try {
|
|
61715
|
-
await
|
|
61881
|
+
await writeFile20(geminiSettingsPath, JSON.stringify(newSettings, null, 2), "utf-8");
|
|
61716
61882
|
logger.debug(`Created new Gemini settings with mcpServers: ${geminiSettingsPath}`);
|
|
61717
61883
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
61718
61884
|
} catch (error) {
|
|
@@ -61742,7 +61908,7 @@ async function mergeGeminiSettings(geminiSettingsPath, mcpConfigPath) {
|
|
|
61742
61908
|
mcpServers
|
|
61743
61909
|
};
|
|
61744
61910
|
try {
|
|
61745
|
-
await
|
|
61911
|
+
await writeFile20(geminiSettingsPath, JSON.stringify(mergedSettings, null, 2), "utf-8");
|
|
61746
61912
|
logger.debug(`Merged mcpServers into: ${geminiSettingsPath}`);
|
|
61747
61913
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
61748
61914
|
} catch (error) {
|
|
@@ -61760,10 +61926,10 @@ var init_config_manager2 = __esm(() => {
|
|
|
61760
61926
|
|
|
61761
61927
|
// src/services/package-installer/gemini-mcp/validation.ts
|
|
61762
61928
|
import { existsSync as existsSync46, lstatSync, readlinkSync } from "node:fs";
|
|
61763
|
-
import { homedir as
|
|
61929
|
+
import { homedir as homedir27 } from "node:os";
|
|
61764
61930
|
import { join as join63 } from "node:path";
|
|
61765
61931
|
function getGlobalMcpConfigPath() {
|
|
61766
|
-
return join63(
|
|
61932
|
+
return join63(homedir27(), ".claude", ".mcp.json");
|
|
61767
61933
|
}
|
|
61768
61934
|
function getLocalMcpConfigPath(projectDir) {
|
|
61769
61935
|
return join63(projectDir, ".mcp.json");
|
|
@@ -61784,7 +61950,7 @@ function findMcpConfigPath(projectDir) {
|
|
|
61784
61950
|
}
|
|
61785
61951
|
function getGeminiSettingsPath(projectDir, isGlobal) {
|
|
61786
61952
|
if (isGlobal) {
|
|
61787
|
-
return join63(
|
|
61953
|
+
return join63(homedir27(), ".gemini", "settings.json");
|
|
61788
61954
|
}
|
|
61789
61955
|
return join63(projectDir, ".gemini", "settings.json");
|
|
61790
61956
|
}
|
|
@@ -61815,12 +61981,12 @@ var init_validation = __esm(() => {
|
|
|
61815
61981
|
|
|
61816
61982
|
// src/services/package-installer/gemini-mcp/linker-core.ts
|
|
61817
61983
|
import { existsSync as existsSync47 } from "node:fs";
|
|
61818
|
-
import { mkdir as
|
|
61984
|
+
import { mkdir as mkdir18, symlink as symlink2 } from "node:fs/promises";
|
|
61819
61985
|
import { dirname as dirname16, join as join64 } from "node:path";
|
|
61820
61986
|
async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
61821
61987
|
const linkDir = dirname16(linkPath);
|
|
61822
61988
|
if (!existsSync47(linkDir)) {
|
|
61823
|
-
await
|
|
61989
|
+
await mkdir18(linkDir, { recursive: true });
|
|
61824
61990
|
logger.debug(`Created directory: ${linkDir}`);
|
|
61825
61991
|
}
|
|
61826
61992
|
let symlinkTarget;
|
|
@@ -68891,7 +69057,7 @@ function checkComponentCounts(setup) {
|
|
|
68891
69057
|
// src/domains/health-checks/checkers/permissions-checker.ts
|
|
68892
69058
|
init_logger();
|
|
68893
69059
|
init_path_resolver();
|
|
68894
|
-
import { constants as constants2, access as access2, unlink as unlink7, writeFile as
|
|
69060
|
+
import { constants as constants2, access as access2, unlink as unlink7, writeFile as writeFile16 } from "node:fs/promises";
|
|
68895
69061
|
import { join as join45 } from "node:path";
|
|
68896
69062
|
|
|
68897
69063
|
// src/domains/health-checks/checkers/shared.ts
|
|
@@ -68960,7 +69126,7 @@ async function checkGlobalDirWritable() {
|
|
|
68960
69126
|
const random = Math.random().toString(36).substring(2);
|
|
68961
69127
|
const testFile = join45(globalDir, `.ck-write-test-${timestamp}-${random}`);
|
|
68962
69128
|
try {
|
|
68963
|
-
await
|
|
69129
|
+
await writeFile16(testFile, "test", { encoding: "utf-8", flag: "wx" });
|
|
68964
69130
|
} catch (error) {
|
|
68965
69131
|
return {
|
|
68966
69132
|
id: "ck-global-dir-writable",
|
|
@@ -69133,7 +69299,7 @@ init_logger();
|
|
|
69133
69299
|
init_path_resolver();
|
|
69134
69300
|
import { existsSync as existsSync40 } from "node:fs";
|
|
69135
69301
|
import { readFile as readFile30 } from "node:fs/promises";
|
|
69136
|
-
import { homedir as
|
|
69302
|
+
import { homedir as homedir25 } from "node:os";
|
|
69137
69303
|
import { dirname as dirname13, join as join48, normalize as normalize5, resolve as resolve11 } from "node:path";
|
|
69138
69304
|
async function checkPathRefsValid(projectDir) {
|
|
69139
69305
|
const globalClaudeMd = join48(PathResolver.getGlobalKitDir(), "CLAUDE.md");
|
|
@@ -69166,7 +69332,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
69166
69332
|
};
|
|
69167
69333
|
}
|
|
69168
69334
|
const baseDir = dirname13(claudeMdPath);
|
|
69169
|
-
const home8 =
|
|
69335
|
+
const home8 = homedir25();
|
|
69170
69336
|
const broken = [];
|
|
69171
69337
|
for (const ref of refs) {
|
|
69172
69338
|
let refPath;
|
|
@@ -70794,8 +70960,8 @@ import { platform as platform6 } from "node:os";
|
|
|
70794
70960
|
// src/domains/health-checks/platform/environment-checker.ts
|
|
70795
70961
|
init_environment();
|
|
70796
70962
|
init_path_resolver();
|
|
70797
|
-
import { constants as constants3, access as access3, mkdir as
|
|
70798
|
-
import { arch as arch2, homedir as
|
|
70963
|
+
import { constants as constants3, access as access3, mkdir as mkdir14, readFile as readFile32, unlink as unlink8, writeFile as writeFile17 } from "node:fs/promises";
|
|
70964
|
+
import { arch as arch2, homedir as homedir26, platform as platform5 } from "node:os";
|
|
70799
70965
|
import { join as join54, normalize as normalize6 } from "node:path";
|
|
70800
70966
|
function shouldSkipExpensiveOperations4() {
|
|
70801
70967
|
return shouldSkipExpensiveOperations();
|
|
@@ -70818,7 +70984,7 @@ async function checkPlatformDetect() {
|
|
|
70818
70984
|
};
|
|
70819
70985
|
}
|
|
70820
70986
|
async function checkHomeDirResolution() {
|
|
70821
|
-
const nodeHome = normalize6(
|
|
70987
|
+
const nodeHome = normalize6(homedir26());
|
|
70822
70988
|
const rawEnvHome = getHomeDirectoryFromEnv(platform5());
|
|
70823
70989
|
const envHome = rawEnvHome ? normalize6(rawEnvHome) : "";
|
|
70824
70990
|
const match = nodeHome === envHome && envHome !== "";
|
|
@@ -70889,8 +71055,8 @@ async function checkGlobalDirAccess() {
|
|
|
70889
71055
|
}
|
|
70890
71056
|
const testFile = join54(globalDir, ".ck-doctor-access-test");
|
|
70891
71057
|
try {
|
|
70892
|
-
await
|
|
70893
|
-
await
|
|
71058
|
+
await mkdir14(globalDir, { recursive: true });
|
|
71059
|
+
await writeFile17(testFile, "test", "utf-8");
|
|
70894
71060
|
const content = await readFile32(testFile, "utf-8");
|
|
70895
71061
|
await unlink8(testFile);
|
|
70896
71062
|
if (content !== "test")
|
|
@@ -70964,7 +71130,7 @@ async function checkWSLBoundary() {
|
|
|
70964
71130
|
|
|
70965
71131
|
// src/domains/health-checks/platform/windows-checker.ts
|
|
70966
71132
|
init_path_resolver();
|
|
70967
|
-
import { mkdir as
|
|
71133
|
+
import { mkdir as mkdir15, symlink, unlink as unlink9, writeFile as writeFile18 } from "node:fs/promises";
|
|
70968
71134
|
import { join as join55 } from "node:path";
|
|
70969
71135
|
async function checkLongPathSupport() {
|
|
70970
71136
|
if (shouldSkipExpensiveOperations4()) {
|
|
@@ -71020,8 +71186,8 @@ async function checkSymlinkSupport() {
|
|
|
71020
71186
|
const target = join55(testDir, ".ck-symlink-test-target");
|
|
71021
71187
|
const link = join55(testDir, ".ck-symlink-test-link");
|
|
71022
71188
|
try {
|
|
71023
|
-
await
|
|
71024
|
-
await
|
|
71189
|
+
await mkdir15(testDir, { recursive: true });
|
|
71190
|
+
await writeFile18(target, "test", "utf-8");
|
|
71025
71191
|
await symlink(target, link);
|
|
71026
71192
|
await unlink9(link);
|
|
71027
71193
|
await unlink9(target);
|
|
@@ -71784,7 +71950,7 @@ init_claudekit_constants();
|
|
|
71784
71950
|
init_logger();
|
|
71785
71951
|
init_path_resolver();
|
|
71786
71952
|
var import_compare_versions6 = __toESM(require_umd(), 1);
|
|
71787
|
-
import { mkdir as
|
|
71953
|
+
import { mkdir as mkdir16, readFile as readFile33, unlink as unlink10, writeFile as writeFile19 } from "node:fs/promises";
|
|
71788
71954
|
import { join as join57 } from "node:path";
|
|
71789
71955
|
var CACHE_TTL_HOURS = 24;
|
|
71790
71956
|
var DEFAULT_CACHE_TTL_MS = CACHE_TTL_HOURS * 60 * 60 * 1000;
|
|
@@ -71842,8 +72008,8 @@ class ConfigVersionChecker {
|
|
|
71842
72008
|
try {
|
|
71843
72009
|
const cachePath = ConfigVersionChecker.getCacheFilePath(kitType, global3);
|
|
71844
72010
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
71845
|
-
await
|
|
71846
|
-
await
|
|
72011
|
+
await mkdir16(cacheDir, { recursive: true });
|
|
72012
|
+
await writeFile19(cachePath, JSON.stringify(cache3, null, 2));
|
|
71847
72013
|
} catch (error) {
|
|
71848
72014
|
logger.debug(`Cache write failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
71849
72015
|
}
|
|
@@ -74577,7 +74743,7 @@ init_logger();
|
|
|
74577
74743
|
// src/shared/process-lock.ts
|
|
74578
74744
|
init_logger();
|
|
74579
74745
|
var import_proper_lockfile4 = __toESM(require_proper_lockfile(), 1);
|
|
74580
|
-
import { mkdir as
|
|
74746
|
+
import { mkdir as mkdir19 } from "node:fs/promises";
|
|
74581
74747
|
import os5 from "node:os";
|
|
74582
74748
|
import { join as join65 } from "node:path";
|
|
74583
74749
|
var LOCK_CONFIG = {
|
|
@@ -74610,7 +74776,7 @@ function registerCleanupHandlers() {
|
|
|
74610
74776
|
}
|
|
74611
74777
|
async function ensureLocksDir() {
|
|
74612
74778
|
const lockDir = getLocksDir();
|
|
74613
|
-
await
|
|
74779
|
+
await mkdir19(lockDir, { recursive: true });
|
|
74614
74780
|
}
|
|
74615
74781
|
async function withProcessLock(lockName, fn) {
|
|
74616
74782
|
registerCleanupHandlers();
|
|
@@ -74765,7 +74931,7 @@ init_github_client();
|
|
|
74765
74931
|
init_environment();
|
|
74766
74932
|
init_logger();
|
|
74767
74933
|
init_safe_spinner();
|
|
74768
|
-
import { mkdir as
|
|
74934
|
+
import { mkdir as mkdir25, stat as stat12 } from "node:fs/promises";
|
|
74769
74935
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
74770
74936
|
import { join as join73 } from "node:path";
|
|
74771
74937
|
|
|
@@ -74785,7 +74951,7 @@ var import_ignore = __toESM(require_ignore(), 1);
|
|
|
74785
74951
|
init_logger();
|
|
74786
74952
|
init_output_manager();
|
|
74787
74953
|
import { createWriteStream as createWriteStream2, rmSync } from "node:fs";
|
|
74788
|
-
import { mkdir as
|
|
74954
|
+
import { mkdir as mkdir20 } from "node:fs/promises";
|
|
74789
74955
|
import { join as join67 } from "node:path";
|
|
74790
74956
|
|
|
74791
74957
|
// src/shared/progress-bar.ts
|
|
@@ -74997,7 +75163,7 @@ class FileDownloader {
|
|
|
74997
75163
|
async downloadAsset(asset, destDir) {
|
|
74998
75164
|
try {
|
|
74999
75165
|
const destPath = join67(destDir, asset.name);
|
|
75000
|
-
await
|
|
75166
|
+
await mkdir20(destDir, { recursive: true });
|
|
75001
75167
|
output.info(`Downloading ${asset.name} (${formatBytes(asset.size)})...`);
|
|
75002
75168
|
logger.verbose("Download details", {
|
|
75003
75169
|
url: asset.browser_download_url,
|
|
@@ -75082,7 +75248,7 @@ class FileDownloader {
|
|
|
75082
75248
|
async downloadFile(params) {
|
|
75083
75249
|
const { url, name, size, destDir, token } = params;
|
|
75084
75250
|
const destPath = join67(destDir, name);
|
|
75085
|
-
await
|
|
75251
|
+
await mkdir20(destDir, { recursive: true });
|
|
75086
75252
|
output.info(`Downloading ${name}${size ? ` (${formatBytes(size)})` : ""}...`);
|
|
75087
75253
|
const headers = {};
|
|
75088
75254
|
if (token && url.includes("api.github.com")) {
|
|
@@ -75200,7 +75366,7 @@ async function validateExtraction(extractDir) {
|
|
|
75200
75366
|
|
|
75201
75367
|
// src/domains/installation/extraction/tar-extractor.ts
|
|
75202
75368
|
init_logger();
|
|
75203
|
-
import { copyFile as
|
|
75369
|
+
import { copyFile as copyFile4, mkdir as mkdir23, readdir as readdir15, rm as rm8, stat as stat10 } from "node:fs/promises";
|
|
75204
75370
|
import { join as join71 } from "node:path";
|
|
75205
75371
|
|
|
75206
75372
|
// node_modules/@isaacs/fs-minipass/dist/esm/index.js
|
|
@@ -80830,7 +80996,7 @@ var checkCwd = (dir, cb) => {
|
|
|
80830
80996
|
cb(er);
|
|
80831
80997
|
});
|
|
80832
80998
|
};
|
|
80833
|
-
var
|
|
80999
|
+
var mkdir21 = (dir, opt, cb) => {
|
|
80834
81000
|
dir = normalizeWindowsPath(dir);
|
|
80835
81001
|
const umask = opt.umask ?? 18;
|
|
80836
81002
|
const mode = opt.mode | 448;
|
|
@@ -81353,7 +81519,7 @@ class Unpack extends Parser {
|
|
|
81353
81519
|
}
|
|
81354
81520
|
}
|
|
81355
81521
|
[MKDIR](dir, mode, cb) {
|
|
81356
|
-
|
|
81522
|
+
mkdir21(normalizeWindowsPath(dir), {
|
|
81357
81523
|
uid: this.uid,
|
|
81358
81524
|
gid: this.gid,
|
|
81359
81525
|
processUid: this.processUid,
|
|
@@ -82069,7 +82235,7 @@ function decodeFilePath(path12) {
|
|
|
82069
82235
|
// src/domains/installation/utils/file-utils.ts
|
|
82070
82236
|
init_logger();
|
|
82071
82237
|
init_types3();
|
|
82072
|
-
import { copyFile as
|
|
82238
|
+
import { copyFile as copyFile3, lstat as lstat4, mkdir as mkdir22, readdir as readdir14 } from "node:fs/promises";
|
|
82073
82239
|
import { join as join70, relative as relative9 } from "node:path";
|
|
82074
82240
|
async function withRetry(fn, retries = 3) {
|
|
82075
82241
|
for (let i = 0;i < retries; i++) {
|
|
@@ -82089,7 +82255,7 @@ var isRetryable = (e2) => {
|
|
|
82089
82255
|
};
|
|
82090
82256
|
var delay = (ms) => new Promise((r2) => setTimeout(r2, ms));
|
|
82091
82257
|
async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
82092
|
-
await
|
|
82258
|
+
await mkdir22(destDir, { recursive: true });
|
|
82093
82259
|
const entries = await readdir14(sourceDir, { encoding: "utf8" });
|
|
82094
82260
|
for (const entry of entries) {
|
|
82095
82261
|
const sourcePath = join70(sourceDir, entry);
|
|
@@ -82110,14 +82276,14 @@ async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTrac
|
|
|
82110
82276
|
if (sizeTracker) {
|
|
82111
82277
|
sizeTracker.checkExtractionSize(entryStat.size);
|
|
82112
82278
|
}
|
|
82113
|
-
await withRetry(() =>
|
|
82279
|
+
await withRetry(() => copyFile3(sourcePath, destPath));
|
|
82114
82280
|
} else {
|
|
82115
82281
|
throw new ExtractionError(`Not a regular file: ${relativePath}`);
|
|
82116
82282
|
}
|
|
82117
82283
|
}
|
|
82118
82284
|
}
|
|
82119
82285
|
async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
82120
|
-
await
|
|
82286
|
+
await mkdir22(destDir, { recursive: true });
|
|
82121
82287
|
const entries = await readdir14(sourceDir, { encoding: "utf8" });
|
|
82122
82288
|
for (const entry of entries) {
|
|
82123
82289
|
const sourcePath = join70(sourceDir, entry);
|
|
@@ -82138,7 +82304,7 @@ async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
|
82138
82304
|
if (sizeTracker) {
|
|
82139
82305
|
sizeTracker.checkExtractionSize(entryStat.size);
|
|
82140
82306
|
}
|
|
82141
|
-
await withRetry(() =>
|
|
82307
|
+
await withRetry(() => copyFile3(sourcePath, destPath));
|
|
82142
82308
|
} else {
|
|
82143
82309
|
throw new ExtractionError(`Not a regular file: ${relativePath}`);
|
|
82144
82310
|
}
|
|
@@ -82149,7 +82315,7 @@ async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
|
82149
82315
|
class TarExtractor {
|
|
82150
82316
|
async extract(archivePath, destDir, shouldExclude, sizeTracker) {
|
|
82151
82317
|
const tempExtractDir = `${destDir}-temp`;
|
|
82152
|
-
await
|
|
82318
|
+
await mkdir23(tempExtractDir, { recursive: true });
|
|
82153
82319
|
try {
|
|
82154
82320
|
await extract({
|
|
82155
82321
|
file: archivePath,
|
|
@@ -82184,18 +82350,18 @@ class TarExtractor {
|
|
|
82184
82350
|
await moveDirectoryContents(tempExtractDir, destDir, shouldExclude, sizeTracker);
|
|
82185
82351
|
}
|
|
82186
82352
|
} else {
|
|
82187
|
-
await
|
|
82188
|
-
await
|
|
82353
|
+
await mkdir23(destDir, { recursive: true });
|
|
82354
|
+
await copyFile4(rootPath, join71(destDir, rootEntry));
|
|
82189
82355
|
}
|
|
82190
82356
|
} else {
|
|
82191
82357
|
logger.debug("Multiple root entries - moving all");
|
|
82192
82358
|
await moveDirectoryContents(tempExtractDir, destDir, shouldExclude, sizeTracker);
|
|
82193
82359
|
}
|
|
82194
82360
|
logger.debug(`Moved contents to: ${destDir}`);
|
|
82195
|
-
await
|
|
82361
|
+
await rm8(tempExtractDir, { recursive: true, force: true });
|
|
82196
82362
|
} catch (error) {
|
|
82197
82363
|
try {
|
|
82198
|
-
await
|
|
82364
|
+
await rm8(tempExtractDir, { recursive: true, force: true });
|
|
82199
82365
|
} catch {}
|
|
82200
82366
|
throw error;
|
|
82201
82367
|
}
|
|
@@ -82207,7 +82373,7 @@ init_environment();
|
|
|
82207
82373
|
init_logger();
|
|
82208
82374
|
var import_extract_zip = __toESM(require_extract_zip(), 1);
|
|
82209
82375
|
import { execFile as execFile8 } from "node:child_process";
|
|
82210
|
-
import { copyFile as
|
|
82376
|
+
import { copyFile as copyFile5, mkdir as mkdir24, readdir as readdir16, rm as rm9, stat as stat11 } from "node:fs/promises";
|
|
82211
82377
|
import { join as join72 } from "node:path";
|
|
82212
82378
|
class ZipExtractor {
|
|
82213
82379
|
async tryNativeUnzip(archivePath, destDir) {
|
|
@@ -82215,7 +82381,7 @@ class ZipExtractor {
|
|
|
82215
82381
|
return false;
|
|
82216
82382
|
}
|
|
82217
82383
|
return new Promise((resolve16) => {
|
|
82218
|
-
|
|
82384
|
+
mkdir24(destDir, { recursive: true }).then(() => {
|
|
82219
82385
|
execFile8("unzip", ["-o", "-q", archivePath, "-d", destDir], (error, _stdout, stderr) => {
|
|
82220
82386
|
if (error) {
|
|
82221
82387
|
logger.debug(`Native unzip failed: ${stderr || error.message}`);
|
|
@@ -82233,7 +82399,7 @@ class ZipExtractor {
|
|
|
82233
82399
|
}
|
|
82234
82400
|
async extract(archivePath, destDir, shouldExclude, sizeTracker) {
|
|
82235
82401
|
const tempExtractDir = `${destDir}-temp`;
|
|
82236
|
-
await
|
|
82402
|
+
await mkdir24(tempExtractDir, { recursive: true });
|
|
82237
82403
|
try {
|
|
82238
82404
|
const nativeSuccess = await this.tryNativeUnzip(archivePath, tempExtractDir);
|
|
82239
82405
|
if (!nativeSuccess) {
|
|
@@ -82271,18 +82437,18 @@ class ZipExtractor {
|
|
|
82271
82437
|
await moveDirectoryContents(tempExtractDir, destDir, shouldExclude, sizeTracker);
|
|
82272
82438
|
}
|
|
82273
82439
|
} else {
|
|
82274
|
-
await
|
|
82275
|
-
await
|
|
82440
|
+
await mkdir24(destDir, { recursive: true });
|
|
82441
|
+
await copyFile5(rootPath, join72(destDir, rootEntry));
|
|
82276
82442
|
}
|
|
82277
82443
|
} else {
|
|
82278
82444
|
logger.debug("Multiple root entries - moving all");
|
|
82279
82445
|
await moveDirectoryContents(tempExtractDir, destDir, shouldExclude, sizeTracker);
|
|
82280
82446
|
}
|
|
82281
82447
|
logger.debug(`Moved contents to: ${destDir}`);
|
|
82282
|
-
await
|
|
82448
|
+
await rm9(tempExtractDir, { recursive: true, force: true });
|
|
82283
82449
|
} catch (error) {
|
|
82284
82450
|
try {
|
|
82285
|
-
await
|
|
82451
|
+
await rm9(tempExtractDir, { recursive: true, force: true });
|
|
82286
82452
|
} catch {}
|
|
82287
82453
|
throw error;
|
|
82288
82454
|
}
|
|
@@ -82346,7 +82512,7 @@ class DownloadManager {
|
|
|
82346
82512
|
try {
|
|
82347
82513
|
this.sizeTracker.reset();
|
|
82348
82514
|
const detectedType = archiveType || detectArchiveType(archivePath);
|
|
82349
|
-
await
|
|
82515
|
+
await mkdir25(destDir, { recursive: true });
|
|
82350
82516
|
if (detectedType === "tar.gz") {
|
|
82351
82517
|
await this.tarExtractor.extract(archivePath, destDir, this.shouldExclude, this.sizeTracker);
|
|
82352
82518
|
} else if (detectedType === "zip") {
|
|
@@ -82373,7 +82539,7 @@ class DownloadManager {
|
|
|
82373
82539
|
const counter = DownloadManager.tempDirCounter++;
|
|
82374
82540
|
const primaryTempDir = join73(tmpdir4(), `claudekit-${timestamp}-${counter}`);
|
|
82375
82541
|
try {
|
|
82376
|
-
await
|
|
82542
|
+
await mkdir25(primaryTempDir, { recursive: true });
|
|
82377
82543
|
logger.debug(`Created temp directory: ${primaryTempDir}`);
|
|
82378
82544
|
registerTempDir(primaryTempDir);
|
|
82379
82545
|
return primaryTempDir;
|
|
@@ -82390,7 +82556,7 @@ Solutions:
|
|
|
82390
82556
|
}
|
|
82391
82557
|
const fallbackTempDir = join73(homeDir, ".claudekit", "tmp", `claudekit-${timestamp}-${counter}`);
|
|
82392
82558
|
try {
|
|
82393
|
-
await
|
|
82559
|
+
await mkdir25(fallbackTempDir, { recursive: true });
|
|
82394
82560
|
logger.debug(`Created temp directory (fallback): ${fallbackTempDir}`);
|
|
82395
82561
|
logger.warning(`Using fallback temp directory: ${fallbackTempDir}
|
|
82396
82562
|
(OS temp directory was not accessible)`);
|
|
@@ -84765,7 +84931,7 @@ import { execSync as execSync4 } from "node:child_process";
|
|
|
84765
84931
|
// src/domains/config/installed-settings-tracker.ts
|
|
84766
84932
|
init_shared();
|
|
84767
84933
|
import { existsSync as existsSync49 } from "node:fs";
|
|
84768
|
-
import { mkdir as
|
|
84934
|
+
import { mkdir as mkdir26, readFile as readFile38, writeFile as writeFile22 } from "node:fs/promises";
|
|
84769
84935
|
import { dirname as dirname19, join as join78 } from "node:path";
|
|
84770
84936
|
var CK_JSON_FILE = ".ck.json";
|
|
84771
84937
|
|
|
@@ -84817,8 +84983,8 @@ class InstalledSettingsTracker {
|
|
|
84817
84983
|
data.kits[this.kitName] = {};
|
|
84818
84984
|
}
|
|
84819
84985
|
data.kits[this.kitName].installedSettings = settings;
|
|
84820
|
-
await
|
|
84821
|
-
await
|
|
84986
|
+
await mkdir26(dirname19(ckJsonPath), { recursive: true });
|
|
84987
|
+
await writeFile22(ckJsonPath, JSON.stringify(data, null, 2), "utf-8");
|
|
84822
84988
|
logger.debug(`Saved installed settings to ${ckJsonPath}`);
|
|
84823
84989
|
} catch (error) {
|
|
84824
84990
|
logger.warning(`Failed to save installed settings: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -86192,12 +86358,12 @@ class FileScanner2 {
|
|
|
86192
86358
|
// src/services/transformers/commands-prefix/prefix-applier.ts
|
|
86193
86359
|
init_logger();
|
|
86194
86360
|
var import_fs_extra17 = __toESM(require_lib3(), 1);
|
|
86195
|
-
import { lstat as lstat7, mkdir as
|
|
86361
|
+
import { lstat as lstat7, mkdir as mkdir27, readdir as readdir21, stat as stat15 } from "node:fs/promises";
|
|
86196
86362
|
import { join as join86 } from "node:path";
|
|
86197
86363
|
|
|
86198
86364
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
86199
86365
|
init_logger();
|
|
86200
|
-
import { readFile as readFile42, readdir as readdir20, writeFile as
|
|
86366
|
+
import { readFile as readFile42, readdir as readdir20, writeFile as writeFile26 } from "node:fs/promises";
|
|
86201
86367
|
import { join as join85 } from "node:path";
|
|
86202
86368
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
86203
86369
|
".md",
|
|
@@ -86273,7 +86439,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
86273
86439
|
if (options2.dryRun) {
|
|
86274
86440
|
logger.debug(`[dry-run] Would transform ${changes} command ref(s) in ${fullPath}`);
|
|
86275
86441
|
} else {
|
|
86276
|
-
await
|
|
86442
|
+
await writeFile26(fullPath, transformed, "utf-8");
|
|
86277
86443
|
if (options2.verbose) {
|
|
86278
86444
|
logger.verbose(`Transformed ${changes} command ref(s) in ${fullPath}`);
|
|
86279
86445
|
}
|
|
@@ -86358,9 +86524,9 @@ async function applyPrefix(extractDir) {
|
|
|
86358
86524
|
}
|
|
86359
86525
|
await import_fs_extra17.copy(commandsDir, backupDir);
|
|
86360
86526
|
logger.verbose("Created backup of commands directory");
|
|
86361
|
-
await
|
|
86527
|
+
await mkdir27(tempDir, { recursive: true });
|
|
86362
86528
|
const ckDir = join86(tempDir, "ck");
|
|
86363
|
-
await
|
|
86529
|
+
await mkdir27(ckDir, { recursive: true });
|
|
86364
86530
|
let processedCount = 0;
|
|
86365
86531
|
for (const entry of entries) {
|
|
86366
86532
|
const sourcePath = join86(commandsDir, entry);
|
|
@@ -86798,7 +86964,7 @@ init_skip_directories();
|
|
|
86798
86964
|
init_types3();
|
|
86799
86965
|
var import_fs_extra21 = __toESM(require_lib3(), 1);
|
|
86800
86966
|
import { createHash as createHash4 } from "node:crypto";
|
|
86801
|
-
import { readFile as readFile44, readdir as readdir24, writeFile as
|
|
86967
|
+
import { readFile as readFile44, readdir as readdir24, writeFile as writeFile27 } from "node:fs/promises";
|
|
86802
86968
|
import { join as join90, relative as relative15 } from "node:path";
|
|
86803
86969
|
|
|
86804
86970
|
class SkillsManifestManager {
|
|
@@ -86822,7 +86988,7 @@ class SkillsManifestManager {
|
|
|
86822
86988
|
}
|
|
86823
86989
|
static async writeManifest(skillsDir2, manifest) {
|
|
86824
86990
|
const manifestPath = join90(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
86825
|
-
await
|
|
86991
|
+
await writeFile27(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
86826
86992
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
86827
86993
|
}
|
|
86828
86994
|
static async readManifest(skillsDir2) {
|
|
@@ -87215,7 +87381,7 @@ import { join as join96 } from "node:path";
|
|
|
87215
87381
|
|
|
87216
87382
|
// src/domains/skills/migrator/migration-executor.ts
|
|
87217
87383
|
init_logger();
|
|
87218
|
-
import { copyFile as
|
|
87384
|
+
import { copyFile as copyFile6, mkdir as mkdir28, readdir as readdir26, rm as rm10 } from "node:fs/promises";
|
|
87219
87385
|
import { join as join92 } from "node:path";
|
|
87220
87386
|
var import_fs_extra24 = __toESM(require_lib3(), 1);
|
|
87221
87387
|
|
|
@@ -87378,7 +87544,7 @@ Detected changes:`;
|
|
|
87378
87544
|
|
|
87379
87545
|
// src/domains/skills/migrator/migration-executor.ts
|
|
87380
87546
|
async function copySkillDirectory(sourceDir, destDir) {
|
|
87381
|
-
await
|
|
87547
|
+
await mkdir28(destDir, { recursive: true });
|
|
87382
87548
|
const entries = await readdir26(sourceDir, { withFileTypes: true });
|
|
87383
87549
|
for (const entry of entries) {
|
|
87384
87550
|
const sourcePath = join92(sourceDir, entry.name);
|
|
@@ -87389,7 +87555,7 @@ async function copySkillDirectory(sourceDir, destDir) {
|
|
|
87389
87555
|
if (entry.isDirectory()) {
|
|
87390
87556
|
await copySkillDirectory(sourcePath, destPath);
|
|
87391
87557
|
} else if (entry.isFile()) {
|
|
87392
|
-
await
|
|
87558
|
+
await copyFile6(sourcePath, destPath);
|
|
87393
87559
|
}
|
|
87394
87560
|
}
|
|
87395
87561
|
}
|
|
@@ -87398,7 +87564,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
87398
87564
|
const preserved = [];
|
|
87399
87565
|
const errors2 = [];
|
|
87400
87566
|
const tempDir = join92(currentSkillsDir, "..", ".skills-migration-temp");
|
|
87401
|
-
await
|
|
87567
|
+
await mkdir28(tempDir, { recursive: true });
|
|
87402
87568
|
try {
|
|
87403
87569
|
for (const mapping of mappings) {
|
|
87404
87570
|
try {
|
|
@@ -87420,7 +87586,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
87420
87586
|
const category = mapping.category;
|
|
87421
87587
|
const targetPath = category ? join92(tempDir, category, skillName) : join92(tempDir, skillName);
|
|
87422
87588
|
if (category) {
|
|
87423
|
-
await
|
|
87589
|
+
await mkdir28(join92(tempDir, category), { recursive: true });
|
|
87424
87590
|
}
|
|
87425
87591
|
await copySkillDirectory(currentSkillPath, targetPath);
|
|
87426
87592
|
migrated.push(skillName);
|
|
@@ -87438,14 +87604,14 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
87438
87604
|
logger.error(`Failed to migrate ${mapping.skillName}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
87439
87605
|
}
|
|
87440
87606
|
}
|
|
87441
|
-
await
|
|
87442
|
-
await
|
|
87607
|
+
await rm10(currentSkillsDir, { recursive: true, force: true });
|
|
87608
|
+
await mkdir28(currentSkillsDir, { recursive: true });
|
|
87443
87609
|
await copySkillDirectory(tempDir, currentSkillsDir);
|
|
87444
|
-
await
|
|
87610
|
+
await rm10(tempDir, { recursive: true, force: true });
|
|
87445
87611
|
return { migrated, preserved, errors: errors2 };
|
|
87446
87612
|
} catch (error) {
|
|
87447
87613
|
try {
|
|
87448
|
-
await
|
|
87614
|
+
await rm10(tempDir, { recursive: true, force: true });
|
|
87449
87615
|
} catch {}
|
|
87450
87616
|
throw error;
|
|
87451
87617
|
}
|
|
@@ -87486,7 +87652,7 @@ function validateMigrationPath(path14, paramName) {
|
|
|
87486
87652
|
init_logger();
|
|
87487
87653
|
init_types3();
|
|
87488
87654
|
var import_fs_extra25 = __toESM(require_lib3(), 1);
|
|
87489
|
-
import { copyFile as
|
|
87655
|
+
import { copyFile as copyFile7, mkdir as mkdir29, readdir as readdir27, rm as rm11, stat as stat16 } from "node:fs/promises";
|
|
87490
87656
|
import { basename as basename10, join as join93, normalize as normalize8 } from "node:path";
|
|
87491
87657
|
function validatePath2(path14, paramName) {
|
|
87492
87658
|
if (!path14 || typeof path14 !== "string") {
|
|
@@ -87516,13 +87682,13 @@ class SkillsBackupManager {
|
|
|
87516
87682
|
const backupDir = parentDir ? join93(parentDir, backupDirName) : join93(skillsDir2, "..", backupDirName);
|
|
87517
87683
|
logger.info(`Creating backup at: ${backupDir}`);
|
|
87518
87684
|
try {
|
|
87519
|
-
await
|
|
87685
|
+
await mkdir29(backupDir, { recursive: true });
|
|
87520
87686
|
await SkillsBackupManager.copyDirectory(skillsDir2, backupDir);
|
|
87521
87687
|
logger.success("Backup created successfully");
|
|
87522
87688
|
return backupDir;
|
|
87523
87689
|
} catch (error) {
|
|
87524
87690
|
try {
|
|
87525
|
-
await
|
|
87691
|
+
await rm11(backupDir, { recursive: true, force: true });
|
|
87526
87692
|
} catch {}
|
|
87527
87693
|
throw new SkillsMigrationError(`Failed to create backup: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
87528
87694
|
}
|
|
@@ -87536,9 +87702,9 @@ class SkillsBackupManager {
|
|
|
87536
87702
|
logger.info(`Restoring from backup: ${backupDir}`);
|
|
87537
87703
|
try {
|
|
87538
87704
|
if (await import_fs_extra25.pathExists(targetDir)) {
|
|
87539
|
-
await
|
|
87705
|
+
await rm11(targetDir, { recursive: true, force: true });
|
|
87540
87706
|
}
|
|
87541
|
-
await
|
|
87707
|
+
await mkdir29(targetDir, { recursive: true });
|
|
87542
87708
|
await SkillsBackupManager.copyDirectory(backupDir, targetDir);
|
|
87543
87709
|
logger.success("Backup restored successfully");
|
|
87544
87710
|
} catch (error) {
|
|
@@ -87552,7 +87718,7 @@ class SkillsBackupManager {
|
|
|
87552
87718
|
}
|
|
87553
87719
|
logger.debug(`Deleting backup: ${backupDir}`);
|
|
87554
87720
|
try {
|
|
87555
|
-
await
|
|
87721
|
+
await rm11(backupDir, { recursive: true, force: true });
|
|
87556
87722
|
logger.debug("Backup deleted successfully");
|
|
87557
87723
|
} catch (error) {
|
|
87558
87724
|
logger.warning(`Failed to delete backup: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -87598,10 +87764,10 @@ class SkillsBackupManager {
|
|
|
87598
87764
|
continue;
|
|
87599
87765
|
}
|
|
87600
87766
|
if (entry.isDirectory()) {
|
|
87601
|
-
await
|
|
87767
|
+
await mkdir29(destPath, { recursive: true });
|
|
87602
87768
|
await SkillsBackupManager.copyDirectory(sourcePath, destPath);
|
|
87603
87769
|
} else if (entry.isFile()) {
|
|
87604
|
-
await
|
|
87770
|
+
await copyFile7(sourcePath, destPath);
|
|
87605
87771
|
}
|
|
87606
87772
|
}
|
|
87607
87773
|
}
|
|
@@ -88012,14 +88178,14 @@ async function handleMigration(ctx) {
|
|
|
88012
88178
|
return ctx;
|
|
88013
88179
|
}
|
|
88014
88180
|
// src/commands/init/phases/opencode-handler.ts
|
|
88015
|
-
import { cp as cp3, readdir as readdir31, rm as
|
|
88181
|
+
import { cp as cp3, readdir as readdir31, rm as rm12 } from "node:fs/promises";
|
|
88016
88182
|
import { join as join99 } from "node:path";
|
|
88017
88183
|
|
|
88018
88184
|
// src/services/transformers/opencode-path-transformer.ts
|
|
88019
88185
|
init_logger();
|
|
88020
|
-
import { readFile as readFile46, readdir as readdir30, writeFile as
|
|
88186
|
+
import { readFile as readFile46, readdir as readdir30, writeFile as writeFile28 } from "node:fs/promises";
|
|
88021
88187
|
import { platform as platform12 } from "node:os";
|
|
88022
|
-
import { extname as
|
|
88188
|
+
import { extname as extname5, join as join98 } from "node:path";
|
|
88023
88189
|
var IS_WINDOWS2 = platform12() === "win32";
|
|
88024
88190
|
function getOpenCodeGlobalPath() {
|
|
88025
88191
|
return "$HOME/.config/opencode/";
|
|
@@ -88070,7 +88236,7 @@ function transformOpenCodeContent(content) {
|
|
|
88070
88236
|
return { transformed, changes };
|
|
88071
88237
|
}
|
|
88072
88238
|
function shouldTransformFile2(filename) {
|
|
88073
|
-
const ext2 =
|
|
88239
|
+
const ext2 = extname5(filename).toLowerCase();
|
|
88074
88240
|
return TRANSFORMABLE_EXTENSIONS2.has(ext2);
|
|
88075
88241
|
}
|
|
88076
88242
|
async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
@@ -88091,7 +88257,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
88091
88257
|
const content = await readFile46(fullPath, "utf-8");
|
|
88092
88258
|
const { transformed, changes } = transformOpenCodeContent(content);
|
|
88093
88259
|
if (changes > 0) {
|
|
88094
|
-
await
|
|
88260
|
+
await writeFile28(fullPath, transformed, "utf-8");
|
|
88095
88261
|
filesTransformed++;
|
|
88096
88262
|
totalChanges += changes;
|
|
88097
88263
|
if (options2.verbose) {
|
|
@@ -88148,7 +88314,7 @@ async function handleOpenCode(ctx) {
|
|
|
88148
88314
|
await cp3(sourcePath, targetPath, { recursive: true });
|
|
88149
88315
|
logger.verbose(`Copied: ${entry.name}`);
|
|
88150
88316
|
}
|
|
88151
|
-
await
|
|
88317
|
+
await rm12(openCodeSource, { recursive: true, force: true });
|
|
88152
88318
|
logger.success(`OpenCode config installed to ${targetDir}`);
|
|
88153
88319
|
} else {
|
|
88154
88320
|
logger.debug("Local mode: .opencode will be placed at project root");
|
|
@@ -88316,7 +88482,7 @@ async function handlePostInstall(ctx) {
|
|
|
88316
88482
|
// src/commands/init/phases/selection-handler.ts
|
|
88317
88483
|
init_config_manager();
|
|
88318
88484
|
init_github_client();
|
|
88319
|
-
import { mkdir as
|
|
88485
|
+
import { mkdir as mkdir30 } from "node:fs/promises";
|
|
88320
88486
|
import { join as join102, resolve as resolve20 } from "node:path";
|
|
88321
88487
|
|
|
88322
88488
|
// src/domains/github/kit-access-checker.ts
|
|
@@ -88839,7 +89005,7 @@ async function handleSelection(ctx) {
|
|
|
88839
89005
|
}
|
|
88840
89006
|
if (!await import_fs_extra32.pathExists(resolvedDir)) {
|
|
88841
89007
|
if (ctx.options.global) {
|
|
88842
|
-
await
|
|
89008
|
+
await mkdir30(resolvedDir, { recursive: true });
|
|
88843
89009
|
logger.info(`Created global directory: ${resolvedDir}`);
|
|
88844
89010
|
} else {
|
|
88845
89011
|
logger.error(`Directory does not exist: ${resolvedDir}`);
|
|
@@ -88974,7 +89140,7 @@ async function handleSelection(ctx) {
|
|
|
88974
89140
|
};
|
|
88975
89141
|
}
|
|
88976
89142
|
// src/commands/init/phases/sync-handler.ts
|
|
88977
|
-
import { copyFile as
|
|
89143
|
+
import { copyFile as copyFile8, mkdir as mkdir31, open as open4, readFile as readFile48, rename as rename6, stat as stat17, unlink as unlink11, writeFile as writeFile30 } from "node:fs/promises";
|
|
88978
89144
|
import { dirname as dirname22, join as join103, resolve as resolve21 } from "node:path";
|
|
88979
89145
|
init_logger();
|
|
88980
89146
|
init_path_resolver();
|
|
@@ -89094,7 +89260,7 @@ async function acquireSyncLock(global3) {
|
|
|
89094
89260
|
const lockPath = join103(cacheDir, ".sync-lock");
|
|
89095
89261
|
const startTime = Date.now();
|
|
89096
89262
|
const lockTimeout = getLockTimeout();
|
|
89097
|
-
await
|
|
89263
|
+
await mkdir31(dirname22(lockPath), { recursive: true });
|
|
89098
89264
|
while (Date.now() - startTime < lockTimeout) {
|
|
89099
89265
|
try {
|
|
89100
89266
|
const handle = await open4(lockPath, "wx");
|
|
@@ -89174,7 +89340,7 @@ async function executeSyncMerge(ctx) {
|
|
|
89174
89340
|
const targetPath = await validateSyncPath(ctx.claudeDir, file.path);
|
|
89175
89341
|
const targetDir = join103(targetPath, "..");
|
|
89176
89342
|
try {
|
|
89177
|
-
await
|
|
89343
|
+
await mkdir31(targetDir, { recursive: true });
|
|
89178
89344
|
} catch (mkdirError) {
|
|
89179
89345
|
const errCode = mkdirError.code;
|
|
89180
89346
|
if (errCode === "ENOSPC") {
|
|
@@ -89189,7 +89355,7 @@ async function executeSyncMerge(ctx) {
|
|
|
89189
89355
|
}
|
|
89190
89356
|
throw mkdirError;
|
|
89191
89357
|
}
|
|
89192
|
-
await
|
|
89358
|
+
await copyFile8(sourcePath, targetPath);
|
|
89193
89359
|
logger.debug(`Updated: ${file.path}`);
|
|
89194
89360
|
updateSuccess++;
|
|
89195
89361
|
} catch (error) {
|
|
@@ -89253,8 +89419,8 @@ async function executeSyncMerge(ctx) {
|
|
|
89253
89419
|
try {
|
|
89254
89420
|
const tempPath = `${currentPath}.tmp.${Date.now()}`;
|
|
89255
89421
|
try {
|
|
89256
|
-
await
|
|
89257
|
-
await
|
|
89422
|
+
await writeFile30(tempPath, result.result, "utf-8");
|
|
89423
|
+
await rename6(tempPath, currentPath);
|
|
89258
89424
|
} catch (atomicError) {
|
|
89259
89425
|
await unlink11(tempPath).catch(() => {});
|
|
89260
89426
|
throw atomicError;
|
|
@@ -89337,15 +89503,15 @@ function displaySyncPlan(plan) {
|
|
|
89337
89503
|
console.log(import_picocolors23.default.dim("─".repeat(40)));
|
|
89338
89504
|
}
|
|
89339
89505
|
async function createBackup(claudeDir2, files, backupDir) {
|
|
89340
|
-
await
|
|
89506
|
+
await mkdir31(backupDir, { recursive: true });
|
|
89341
89507
|
for (const file of files) {
|
|
89342
89508
|
try {
|
|
89343
89509
|
const sourcePath = await validateSyncPath(claudeDir2, file.path);
|
|
89344
89510
|
if (await import_fs_extra33.pathExists(sourcePath)) {
|
|
89345
89511
|
const targetPath = await validateSyncPath(backupDir, file.path);
|
|
89346
89512
|
const targetDir = join103(targetPath, "..");
|
|
89347
|
-
await
|
|
89348
|
-
await
|
|
89513
|
+
await mkdir31(targetDir, { recursive: true });
|
|
89514
|
+
await copyFile8(sourcePath, targetPath);
|
|
89349
89515
|
}
|
|
89350
89516
|
} catch (error) {
|
|
89351
89517
|
const errCode = error.code;
|
|
@@ -89368,7 +89534,7 @@ init_types3();
|
|
|
89368
89534
|
init_logger();
|
|
89369
89535
|
init_types3();
|
|
89370
89536
|
var import_fs_extra34 = __toESM(require_lib3(), 1);
|
|
89371
|
-
import { rename as
|
|
89537
|
+
import { rename as rename7, rm as rm13 } from "node:fs/promises";
|
|
89372
89538
|
import { join as join104, relative as relative18 } from "node:path";
|
|
89373
89539
|
async function collectDirsToRename(extractDir, folders) {
|
|
89374
89540
|
const dirsToRename = [];
|
|
@@ -89408,12 +89574,12 @@ async function collectDirsToRename(extractDir, folders) {
|
|
|
89408
89574
|
}
|
|
89409
89575
|
async function moveAcrossDevices(src, dest) {
|
|
89410
89576
|
try {
|
|
89411
|
-
await
|
|
89577
|
+
await rename7(src, dest);
|
|
89412
89578
|
} catch (e2) {
|
|
89413
89579
|
if (e2.code === "EXDEV") {
|
|
89414
89580
|
logger.debug(`Cross-device move detected, using copy+delete: ${src} -> ${dest}`);
|
|
89415
89581
|
await import_fs_extra34.copy(src, dest, { overwrite: true });
|
|
89416
|
-
await
|
|
89582
|
+
await rm13(src, { recursive: true, force: true });
|
|
89417
89583
|
} else {
|
|
89418
89584
|
throw e2;
|
|
89419
89585
|
}
|
|
@@ -89440,7 +89606,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
89440
89606
|
// src/services/transformers/folder-transform/path-replacer.ts
|
|
89441
89607
|
init_logger();
|
|
89442
89608
|
init_types3();
|
|
89443
|
-
import { readFile as readFile49, readdir as readdir32, writeFile as
|
|
89609
|
+
import { readFile as readFile49, readdir as readdir32, writeFile as writeFile31 } from "node:fs/promises";
|
|
89444
89610
|
import { join as join105, relative as relative19 } from "node:path";
|
|
89445
89611
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
89446
89612
|
".md",
|
|
@@ -89523,7 +89689,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
89523
89689
|
if (options2.dryRun) {
|
|
89524
89690
|
logger.debug(`[dry-run] Would update ${relative19(dir, fullPath)}: ${changeCount} replacement(s)`);
|
|
89525
89691
|
} else {
|
|
89526
|
-
await
|
|
89692
|
+
await writeFile31(fullPath, newContent, "utf-8");
|
|
89527
89693
|
logger.debug(`Updated ${relative19(dir, fullPath)}: ${changeCount} replacement(s)`);
|
|
89528
89694
|
}
|
|
89529
89695
|
filesChanged++;
|
|
@@ -89629,9 +89795,9 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
89629
89795
|
|
|
89630
89796
|
// src/services/transformers/global-path-transformer.ts
|
|
89631
89797
|
init_logger();
|
|
89632
|
-
import { readFile as readFile50, readdir as readdir33, writeFile as
|
|
89798
|
+
import { readFile as readFile50, readdir as readdir33, writeFile as writeFile32 } from "node:fs/promises";
|
|
89633
89799
|
import { platform as platform13 } from "node:os";
|
|
89634
|
-
import { extname as
|
|
89800
|
+
import { extname as extname6, join as join106 } from "node:path";
|
|
89635
89801
|
var IS_WINDOWS3 = platform13() === "win32";
|
|
89636
89802
|
var HOME_PREFIX = IS_WINDOWS3 ? "%USERPROFILE%" : "$HOME";
|
|
89637
89803
|
function getHomeDirPrefix() {
|
|
@@ -89729,7 +89895,7 @@ function transformContent(content) {
|
|
|
89729
89895
|
return { transformed, changes };
|
|
89730
89896
|
}
|
|
89731
89897
|
function shouldTransformFile3(filename) {
|
|
89732
|
-
const ext2 =
|
|
89898
|
+
const ext2 = extname6(filename).toLowerCase();
|
|
89733
89899
|
const basename11 = filename.split("/").pop() || filename;
|
|
89734
89900
|
return TRANSFORMABLE_EXTENSIONS3.has(ext2) || ALWAYS_TRANSFORM_FILES.has(basename11);
|
|
89735
89901
|
}
|
|
@@ -89752,7 +89918,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
89752
89918
|
const content = await readFile50(fullPath, "utf-8");
|
|
89753
89919
|
const { transformed, changes } = transformContent(content);
|
|
89754
89920
|
if (changes > 0) {
|
|
89755
|
-
await
|
|
89921
|
+
await writeFile32(fullPath, transformed, "utf-8");
|
|
89756
89922
|
filesTransformed++;
|
|
89757
89923
|
totalChanges += changes;
|
|
89758
89924
|
if (options2.verbose) {
|
|
@@ -90011,7 +90177,7 @@ init_checksum_utils();
|
|
|
90011
90177
|
init_config_discovery();
|
|
90012
90178
|
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
90013
90179
|
import { existsSync as existsSync51 } from "node:fs";
|
|
90014
|
-
import { readFile as readFile51, rm as
|
|
90180
|
+
import { readFile as readFile51, rm as rm14, unlink as unlink12 } from "node:fs/promises";
|
|
90015
90181
|
import { resolve as resolve22 } from "node:path";
|
|
90016
90182
|
|
|
90017
90183
|
// src/commands/portable/conflict-resolver.ts
|
|
@@ -90362,7 +90528,7 @@ async function executeDeleteAction(action, options2) {
|
|
|
90362
90528
|
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve22(action.targetPath));
|
|
90363
90529
|
try {
|
|
90364
90530
|
if (!shouldPreserveTarget && action.targetPath && existsSync51(action.targetPath)) {
|
|
90365
|
-
await
|
|
90531
|
+
await rm14(action.targetPath, { recursive: true, force: true });
|
|
90366
90532
|
}
|
|
90367
90533
|
await removePortableInstallation(action.item, action.type, action.provider, action.global);
|
|
90368
90534
|
return {
|
|
@@ -90729,7 +90895,7 @@ async function rollbackResults(results) {
|
|
|
90729
90895
|
continue;
|
|
90730
90896
|
const stat18 = await import("node:fs/promises").then((fs19) => fs19.stat(result.path));
|
|
90731
90897
|
if (stat18.isDirectory()) {
|
|
90732
|
-
await
|
|
90898
|
+
await rm14(result.path, { recursive: true, force: true });
|
|
90733
90899
|
} else {
|
|
90734
90900
|
await unlink12(result.path);
|
|
90735
90901
|
}
|