claudekit-cli 4.3.1-dev.7 → 4.3.1-dev.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli-manifest.json +2 -2
- package/dist/index.js +246 -200
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55181,8 +55181,7 @@ var init_generated_context_hooks = __esm(() => {
|
|
|
55181
55181
|
"session-state.cjs",
|
|
55182
55182
|
"subagent-init.cjs",
|
|
55183
55183
|
"team-context-inject.cjs",
|
|
55184
|
-
"usage-context-awareness.cjs"
|
|
55185
|
-
"usage-quota-cache-refresh.cjs"
|
|
55184
|
+
"usage-context-awareness.cjs"
|
|
55186
55185
|
]);
|
|
55187
55186
|
});
|
|
55188
55187
|
|
|
@@ -63358,7 +63357,7 @@ var package_default;
|
|
|
63358
63357
|
var init_package = __esm(() => {
|
|
63359
63358
|
package_default = {
|
|
63360
63359
|
name: "claudekit-cli",
|
|
63361
|
-
version: "4.3.1-dev.
|
|
63360
|
+
version: "4.3.1-dev.8",
|
|
63362
63361
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
63363
63362
|
type: "module",
|
|
63364
63363
|
repository: {
|
|
@@ -63852,6 +63851,9 @@ import { existsSync as existsSync44, readFileSync as readFileSync12, statSync as
|
|
|
63852
63851
|
import { readdir as readdir17 } from "node:fs/promises";
|
|
63853
63852
|
import { homedir as homedir40, tmpdir } from "node:os";
|
|
63854
63853
|
import { join as join64, resolve as resolve32 } from "node:path";
|
|
63854
|
+
function resolveDoctorCkExecutable(platformName = process.platform) {
|
|
63855
|
+
return platformName === "win32" ? "ck.cmd" : "ck";
|
|
63856
|
+
}
|
|
63855
63857
|
function getHooksDir(projectDir) {
|
|
63856
63858
|
const projectHooksDir = resolve32(projectDir, ".claude", "hooks");
|
|
63857
63859
|
const globalHooksDir = resolve32(PathResolver.getGlobalKitDir(), "hooks");
|
|
@@ -64880,7 +64882,7 @@ async function checkHookLogs(projectDir) {
|
|
|
64880
64882
|
}
|
|
64881
64883
|
async function checkCliVersion() {
|
|
64882
64884
|
try {
|
|
64883
|
-
const versionResult = spawnSync3(
|
|
64885
|
+
const versionResult = spawnSync3(resolveDoctorCkExecutable(), ["-V"], {
|
|
64884
64886
|
timeout: HOOK_CHECK_TIMEOUT_MS,
|
|
64885
64887
|
encoding: "utf-8"
|
|
64886
64888
|
});
|
|
@@ -66539,6 +66541,9 @@ var init_github_client = __esm(() => {
|
|
|
66539
66541
|
|
|
66540
66542
|
// src/commands/update/post-update-handler.ts
|
|
66541
66543
|
import { exec as exec2, spawn as spawn2 } from "node:child_process";
|
|
66544
|
+
import { existsSync as existsSync46 } from "node:fs";
|
|
66545
|
+
import { readdir as readdir19 } from "node:fs/promises";
|
|
66546
|
+
import { builtinModules } from "node:module";
|
|
66542
66547
|
import { join as join68 } from "node:path";
|
|
66543
66548
|
import { promisify as promisify9 } from "node:util";
|
|
66544
66549
|
function selectKitForUpdate(params) {
|
|
@@ -66631,6 +66636,32 @@ async function fetchLatestReleaseTag(kit, beta) {
|
|
|
66631
66636
|
return null;
|
|
66632
66637
|
}
|
|
66633
66638
|
}
|
|
66639
|
+
async function findMissingHookDependencies(claudeDir3) {
|
|
66640
|
+
const hooksDir = join68(claudeDir3, "hooks");
|
|
66641
|
+
if (!existsSync46(hooksDir))
|
|
66642
|
+
return [];
|
|
66643
|
+
const files = await readdir19(hooksDir);
|
|
66644
|
+
const cjsFiles = files.filter((file) => file.endsWith(".cjs"));
|
|
66645
|
+
const missing = [];
|
|
66646
|
+
const nodeBuiltins = new Set([
|
|
66647
|
+
...builtinModules,
|
|
66648
|
+
...builtinModules.map((name) => `node:${name}`)
|
|
66649
|
+
]);
|
|
66650
|
+
for (const file of cjsFiles) {
|
|
66651
|
+
const content = await import_fs_extra8.readFile(join68(hooksDir, file), "utf8");
|
|
66652
|
+
const requireRegex = /require\(['"]([^'"]+)['"]\)/g;
|
|
66653
|
+
for (let match = requireRegex.exec(content);match; match = requireRegex.exec(content)) {
|
|
66654
|
+
const depPath = match[1];
|
|
66655
|
+
if (!depPath || nodeBuiltins.has(depPath) || !depPath.startsWith("."))
|
|
66656
|
+
continue;
|
|
66657
|
+
const resolvedPath = join68(hooksDir, depPath);
|
|
66658
|
+
const exists = existsSync46(resolvedPath) || HOOK_DEPENDENCY_EXTENSIONS.some((ext) => existsSync46(resolvedPath + ext)) || existsSync46(join68(resolvedPath, "index.js")) || existsSync46(join68(resolvedPath, "index.cjs")) || existsSync46(join68(resolvedPath, "index.mjs"));
|
|
66659
|
+
if (!exists)
|
|
66660
|
+
missing.push(`${file}: ${depPath}`);
|
|
66661
|
+
}
|
|
66662
|
+
}
|
|
66663
|
+
return missing;
|
|
66664
|
+
}
|
|
66634
66665
|
async function promptKitUpdate(beta, yes, deps) {
|
|
66635
66666
|
try {
|
|
66636
66667
|
const execFn = deps?.execAsyncFn ?? execAsync2;
|
|
@@ -66638,6 +66669,7 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
66638
66669
|
const confirmFn = deps?.confirmFn ?? se;
|
|
66639
66670
|
const isCancelFn = deps?.isCancelFn ?? lD;
|
|
66640
66671
|
const getSetupFn = deps?.getSetupFn ?? getClaudeKitSetup;
|
|
66672
|
+
const findMissingHookDepsFn = deps?.findMissingHookDependenciesFn ?? findMissingHookDependencies;
|
|
66641
66673
|
const setup = await getSetupFn();
|
|
66642
66674
|
const hasLocal = !!setup.project.metadata;
|
|
66643
66675
|
const hasGlobal = !!setup.global.metadata;
|
|
@@ -66661,19 +66693,32 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
66661
66693
|
const getTagFn = deps?.getLatestReleaseTagFn ?? fetchLatestReleaseTag;
|
|
66662
66694
|
const latestTag = await getTagFn(selection.kit, beta || isBetaInstalled);
|
|
66663
66695
|
if (latestTag && versionsMatch(kitVersion, latestTag)) {
|
|
66664
|
-
logger.success(`Already at latest version (${selection.kit}@${kitVersion}), skipping reinstall`);
|
|
66665
66696
|
alreadyAtLatest = true;
|
|
66666
66697
|
} else if (latestTag) {
|
|
66667
66698
|
logger.info(`Kit update available: ${kitVersion} -> ${latestTag}`);
|
|
66668
66699
|
}
|
|
66669
66700
|
}
|
|
66701
|
+
if (alreadyAtLatest) {
|
|
66702
|
+
try {
|
|
66703
|
+
const claudeDir3 = selection.isGlobal ? setup.global.path : setup.project.path;
|
|
66704
|
+
const missingHookDeps = claudeDir3 ? await findMissingHookDepsFn(claudeDir3) : [];
|
|
66705
|
+
if (missingHookDeps.length > 0) {
|
|
66706
|
+
logger.warning(`Detected ${missingHookDeps.length} missing hook dependency(ies); reinstalling kit content`);
|
|
66707
|
+
alreadyAtLatest = false;
|
|
66708
|
+
}
|
|
66709
|
+
} catch (error) {
|
|
66710
|
+
logger.verbose(`Hook dependency self-heal check skipped: ${error instanceof Error ? error.message : "unknown"}`);
|
|
66711
|
+
}
|
|
66712
|
+
}
|
|
66670
66713
|
let autoInit = false;
|
|
66671
66714
|
try {
|
|
66672
66715
|
const ckConfig = await loadFullConfigFn(null);
|
|
66673
66716
|
autoInit = ckConfig.config.updatePipeline?.autoInitAfterUpdate ?? false;
|
|
66674
66717
|
} catch {}
|
|
66675
|
-
if (alreadyAtLatest && !autoInit)
|
|
66718
|
+
if (alreadyAtLatest && !autoInit) {
|
|
66719
|
+
logger.success(`Already at latest version (${selection.kit}@${kitVersion}), skipping reinstall`);
|
|
66676
66720
|
return;
|
|
66721
|
+
}
|
|
66677
66722
|
if (!yes && !autoInit) {
|
|
66678
66723
|
logger.info("");
|
|
66679
66724
|
const shouldUpdate = await confirmFn({ message: promptMessage });
|
|
@@ -66859,7 +66904,7 @@ async function promptMigrateUpdate(deps) {
|
|
|
66859
66904
|
logger.verbose(`Migrate step skipped: ${error instanceof Error ? error.message : "unknown"}`);
|
|
66860
66905
|
}
|
|
66861
66906
|
}
|
|
66862
|
-
var import_fs_extra8, execAsync2, SAFE_PROVIDER_NAME;
|
|
66907
|
+
var import_fs_extra8, execAsync2, SAFE_PROVIDER_NAME, HOOK_DEPENDENCY_EXTENSIONS;
|
|
66863
66908
|
var init_post_update_handler = __esm(() => {
|
|
66864
66909
|
init_ck_config_manager();
|
|
66865
66910
|
init_hook_health_checker();
|
|
@@ -66873,6 +66918,7 @@ var init_post_update_handler = __esm(() => {
|
|
|
66873
66918
|
import_fs_extra8 = __toESM(require_lib(), 1);
|
|
66874
66919
|
execAsync2 = promisify9(exec2);
|
|
66875
66920
|
SAFE_PROVIDER_NAME = /^[a-z0-9-]+$/;
|
|
66921
|
+
HOOK_DEPENDENCY_EXTENSIONS = [".js", ".cjs", ".mjs", ".json"];
|
|
66876
66922
|
});
|
|
66877
66923
|
|
|
66878
66924
|
// src/commands/update-cli.ts
|
|
@@ -67268,7 +67314,7 @@ var init_config_version_checker = __esm(() => {
|
|
|
67268
67314
|
// src/domains/web-server/routes/system-routes.ts
|
|
67269
67315
|
import { spawn as spawn3 } from "node:child_process";
|
|
67270
67316
|
import { execFile as execFile8 } from "node:child_process";
|
|
67271
|
-
import { existsSync as
|
|
67317
|
+
import { existsSync as existsSync47 } from "node:fs";
|
|
67272
67318
|
import { readFile as readFile38 } from "node:fs/promises";
|
|
67273
67319
|
import { cpus, homedir as homedir41, totalmem } from "node:os";
|
|
67274
67320
|
import { join as join70 } from "node:path";
|
|
@@ -67557,7 +67603,7 @@ async function getPackageJson() {
|
|
|
67557
67603
|
async function getKitMetadata2(kitName) {
|
|
67558
67604
|
try {
|
|
67559
67605
|
const metadataPath = join70(PathResolver.getGlobalKitDir(), "metadata.json");
|
|
67560
|
-
if (!
|
|
67606
|
+
if (!existsSync47(metadataPath))
|
|
67561
67607
|
return null;
|
|
67562
67608
|
const content = await readFile38(metadataPath, "utf-8");
|
|
67563
67609
|
const metadata = JSON.parse(content);
|
|
@@ -67713,14 +67759,14 @@ var init_routes = __esm(() => {
|
|
|
67713
67759
|
});
|
|
67714
67760
|
|
|
67715
67761
|
// src/domains/web-server/static-server.ts
|
|
67716
|
-
import { existsSync as
|
|
67762
|
+
import { existsSync as existsSync48 } from "node:fs";
|
|
67717
67763
|
import { basename as basename23, dirname as dirname27, join as join71, resolve as resolve33 } from "node:path";
|
|
67718
67764
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
67719
67765
|
function addRuntimeUiCandidate(candidates, runtimePath) {
|
|
67720
67766
|
if (!runtimePath) {
|
|
67721
67767
|
return;
|
|
67722
67768
|
}
|
|
67723
|
-
const looksLikePath = runtimePath.includes("/") || runtimePath.includes("\\") ||
|
|
67769
|
+
const looksLikePath = runtimePath.includes("/") || runtimePath.includes("\\") || existsSync48(runtimePath);
|
|
67724
67770
|
if (!looksLikePath) {
|
|
67725
67771
|
return;
|
|
67726
67772
|
}
|
|
@@ -67737,7 +67783,7 @@ function resolveUiDistPath() {
|
|
|
67737
67783
|
candidates.add(join71(process.cwd(), "dist", "ui"));
|
|
67738
67784
|
candidates.add(join71(process.cwd(), "src", "ui", "dist"));
|
|
67739
67785
|
for (const path6 of candidates) {
|
|
67740
|
-
if (
|
|
67786
|
+
if (existsSync48(join71(path6, "index.html"))) {
|
|
67741
67787
|
return path6;
|
|
67742
67788
|
}
|
|
67743
67789
|
}
|
|
@@ -67745,7 +67791,7 @@ function resolveUiDistPath() {
|
|
|
67745
67791
|
}
|
|
67746
67792
|
function serveStatic(app) {
|
|
67747
67793
|
const uiDistPath = resolveUiDistPath();
|
|
67748
|
-
if (!
|
|
67794
|
+
if (!existsSync48(uiDistPath)) {
|
|
67749
67795
|
logger.warning(`UI dist not found at ${uiDistPath}. Run 'bun run ui:build' first.`);
|
|
67750
67796
|
app.use((req, res, next) => {
|
|
67751
67797
|
if (req.path.startsWith("/api/")) {
|
|
@@ -72858,7 +72904,7 @@ var init_opencode_installer = __esm(() => {
|
|
|
72858
72904
|
var PARTIAL_INSTALL_VERSION = "partial", EXIT_CODE_CRITICAL_FAILURE = 1, EXIT_CODE_PARTIAL_SUCCESS = 2;
|
|
72859
72905
|
|
|
72860
72906
|
// src/services/package-installer/install-error-handler.ts
|
|
72861
|
-
import { existsSync as
|
|
72907
|
+
import { existsSync as existsSync60, readFileSync as readFileSync17, unlinkSync as unlinkSync3 } from "node:fs";
|
|
72862
72908
|
import { join as join90 } from "node:path";
|
|
72863
72909
|
function parseNameReason(str2) {
|
|
72864
72910
|
const colonIndex = str2.indexOf(":");
|
|
@@ -72923,7 +72969,7 @@ function getSystemPackageCommands(summary, systemFailures) {
|
|
|
72923
72969
|
}
|
|
72924
72970
|
function displayInstallErrors(skillsDir2) {
|
|
72925
72971
|
const summaryPath = join90(skillsDir2, ".install-error-summary.json");
|
|
72926
|
-
if (!
|
|
72972
|
+
if (!existsSync60(summaryPath)) {
|
|
72927
72973
|
logger.error("Skills installation failed. Run with --verbose for details.");
|
|
72928
72974
|
return;
|
|
72929
72975
|
}
|
|
@@ -73022,7 +73068,7 @@ async function checkNeedsSudoPackages() {
|
|
|
73022
73068
|
}
|
|
73023
73069
|
function hasInstallState(skillsDir2) {
|
|
73024
73070
|
const stateFilePath = join90(skillsDir2, ".install-state.json");
|
|
73025
|
-
return
|
|
73071
|
+
return existsSync60(stateFilePath);
|
|
73026
73072
|
}
|
|
73027
73073
|
var WHICH_COMMAND_TIMEOUT_MS = 5000, WINDOWS_SYSTEM_PACKAGES, SYSTEM_TOOL_KEYS, WINDOWS_RSVG_COMMANDS;
|
|
73028
73074
|
var init_install_error_handler = __esm(() => {
|
|
@@ -73061,7 +73107,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
73061
73107
|
};
|
|
73062
73108
|
}
|
|
73063
73109
|
try {
|
|
73064
|
-
const { existsSync:
|
|
73110
|
+
const { existsSync: existsSync61 } = await import("node:fs");
|
|
73065
73111
|
const clack = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
73066
73112
|
const platform9 = process.platform;
|
|
73067
73113
|
const scriptName = platform9 === "win32" ? "install.ps1" : "install.sh";
|
|
@@ -73077,7 +73123,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
73077
73123
|
error: `Path validation failed: ${errorMessage}`
|
|
73078
73124
|
};
|
|
73079
73125
|
}
|
|
73080
|
-
if (!
|
|
73126
|
+
if (!existsSync61(scriptPath)) {
|
|
73081
73127
|
logger.warning(`Skills installation script not found: ${scriptPath}`);
|
|
73082
73128
|
logger.info("");
|
|
73083
73129
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
@@ -73293,7 +73339,7 @@ var init_skills_installer2 = __esm(() => {
|
|
|
73293
73339
|
});
|
|
73294
73340
|
|
|
73295
73341
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
73296
|
-
import { existsSync as
|
|
73342
|
+
import { existsSync as existsSync61 } from "node:fs";
|
|
73297
73343
|
import { mkdir as mkdir23, readFile as readFile47, writeFile as writeFile23 } from "node:fs/promises";
|
|
73298
73344
|
import { dirname as dirname30, join as join92 } from "node:path";
|
|
73299
73345
|
async function readJsonFile(filePath) {
|
|
@@ -73311,7 +73357,7 @@ async function addGeminiToGitignore(projectDir) {
|
|
|
73311
73357
|
const geminiPattern = ".gemini/";
|
|
73312
73358
|
try {
|
|
73313
73359
|
let content = "";
|
|
73314
|
-
if (
|
|
73360
|
+
if (existsSync61(gitignorePath)) {
|
|
73315
73361
|
content = await readFile47(gitignorePath, "utf-8");
|
|
73316
73362
|
const lines = content.split(`
|
|
73317
73363
|
`).map((line) => line.trim()).filter((line) => !line.startsWith("#"));
|
|
@@ -73336,7 +73382,7 @@ ${geminiPattern}
|
|
|
73336
73382
|
}
|
|
73337
73383
|
async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
73338
73384
|
const linkDir = dirname30(geminiSettingsPath);
|
|
73339
|
-
if (!
|
|
73385
|
+
if (!existsSync61(linkDir)) {
|
|
73340
73386
|
await mkdir23(linkDir, { recursive: true });
|
|
73341
73387
|
logger.debug(`Created directory: ${linkDir}`);
|
|
73342
73388
|
}
|
|
@@ -73397,7 +73443,7 @@ var init_config_manager2 = __esm(() => {
|
|
|
73397
73443
|
});
|
|
73398
73444
|
|
|
73399
73445
|
// src/services/package-installer/gemini-mcp/validation.ts
|
|
73400
|
-
import { existsSync as
|
|
73446
|
+
import { existsSync as existsSync62, lstatSync, readlinkSync } from "node:fs";
|
|
73401
73447
|
import { homedir as homedir44 } from "node:os";
|
|
73402
73448
|
import { join as join93 } from "node:path";
|
|
73403
73449
|
function getGlobalMcpConfigPath() {
|
|
@@ -73408,12 +73454,12 @@ function getLocalMcpConfigPath(projectDir) {
|
|
|
73408
73454
|
}
|
|
73409
73455
|
function findMcpConfigPath(projectDir) {
|
|
73410
73456
|
const localPath = getLocalMcpConfigPath(projectDir);
|
|
73411
|
-
if (
|
|
73457
|
+
if (existsSync62(localPath)) {
|
|
73412
73458
|
logger.debug(`Found local MCP config: ${localPath}`);
|
|
73413
73459
|
return localPath;
|
|
73414
73460
|
}
|
|
73415
73461
|
const globalPath = getGlobalMcpConfigPath();
|
|
73416
|
-
if (
|
|
73462
|
+
if (existsSync62(globalPath)) {
|
|
73417
73463
|
logger.debug(`Found global MCP config: ${globalPath}`);
|
|
73418
73464
|
return globalPath;
|
|
73419
73465
|
}
|
|
@@ -73428,7 +73474,7 @@ function getGeminiSettingsPath(projectDir, isGlobal) {
|
|
|
73428
73474
|
}
|
|
73429
73475
|
function checkExistingGeminiConfig(projectDir, isGlobal = false) {
|
|
73430
73476
|
const geminiSettingsPath = getGeminiSettingsPath(projectDir, isGlobal);
|
|
73431
|
-
if (!
|
|
73477
|
+
if (!existsSync62(geminiSettingsPath)) {
|
|
73432
73478
|
return { exists: false, isSymlink: false, settingsPath: geminiSettingsPath };
|
|
73433
73479
|
}
|
|
73434
73480
|
try {
|
|
@@ -73452,12 +73498,12 @@ var init_validation = __esm(() => {
|
|
|
73452
73498
|
});
|
|
73453
73499
|
|
|
73454
73500
|
// src/services/package-installer/gemini-mcp/linker-core.ts
|
|
73455
|
-
import { existsSync as
|
|
73501
|
+
import { existsSync as existsSync63 } from "node:fs";
|
|
73456
73502
|
import { mkdir as mkdir24, symlink as symlink3 } from "node:fs/promises";
|
|
73457
73503
|
import { dirname as dirname31, join as join94 } from "node:path";
|
|
73458
73504
|
async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
73459
73505
|
const linkDir = dirname31(linkPath);
|
|
73460
|
-
if (!
|
|
73506
|
+
if (!existsSync63(linkDir)) {
|
|
73461
73507
|
await mkdir24(linkDir, { recursive: true });
|
|
73462
73508
|
logger.debug(`Created directory: ${linkDir}`);
|
|
73463
73509
|
}
|
|
@@ -75880,7 +75926,7 @@ __export(exports_worktree_manager, {
|
|
|
75880
75926
|
createWorktree: () => createWorktree,
|
|
75881
75927
|
cleanupAllWorktrees: () => cleanupAllWorktrees
|
|
75882
75928
|
});
|
|
75883
|
-
import { existsSync as
|
|
75929
|
+
import { existsSync as existsSync73 } from "node:fs";
|
|
75884
75930
|
import { readFile as readFile67, writeFile as writeFile38 } from "node:fs/promises";
|
|
75885
75931
|
import { join as join153 } from "node:path";
|
|
75886
75932
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
@@ -75946,7 +75992,7 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
75946
75992
|
async function ensureGitignore(projectDir) {
|
|
75947
75993
|
const gitignorePath = join153(projectDir, ".gitignore");
|
|
75948
75994
|
try {
|
|
75949
|
-
const content =
|
|
75995
|
+
const content = existsSync73(gitignorePath) ? await readFile67(gitignorePath, "utf-8") : "";
|
|
75950
75996
|
if (!content.includes(".worktrees")) {
|
|
75951
75997
|
const newContent = content.endsWith(`
|
|
75952
75998
|
`) ? `${content}.worktrees/
|
|
@@ -76048,13 +76094,13 @@ var init_content_validator = __esm(() => {
|
|
|
76048
76094
|
|
|
76049
76095
|
// src/commands/content/phases/context-cache-manager.ts
|
|
76050
76096
|
import { createHash as createHash9 } from "node:crypto";
|
|
76051
|
-
import { existsSync as
|
|
76097
|
+
import { existsSync as existsSync79, mkdirSync as mkdirSync5, readFileSync as readFileSync18, readdirSync as readdirSync12, statSync as statSync14 } from "node:fs";
|
|
76052
76098
|
import { rename as rename16, writeFile as writeFile40 } from "node:fs/promises";
|
|
76053
76099
|
import { homedir as homedir55 } from "node:os";
|
|
76054
76100
|
import { basename as basename34, join as join160 } from "node:path";
|
|
76055
76101
|
function getCachedContext(repoPath) {
|
|
76056
76102
|
const cachePath = getCacheFilePath(repoPath);
|
|
76057
|
-
if (!
|
|
76103
|
+
if (!existsSync79(cachePath))
|
|
76058
76104
|
return null;
|
|
76059
76105
|
try {
|
|
76060
76106
|
const raw2 = readFileSync18(cachePath, "utf-8");
|
|
@@ -76071,7 +76117,7 @@ function getCachedContext(repoPath) {
|
|
|
76071
76117
|
}
|
|
76072
76118
|
}
|
|
76073
76119
|
async function saveCachedContext(repoPath, cache5) {
|
|
76074
|
-
if (!
|
|
76120
|
+
if (!existsSync79(CACHE_DIR)) {
|
|
76075
76121
|
mkdirSync5(CACHE_DIR, { recursive: true });
|
|
76076
76122
|
}
|
|
76077
76123
|
const cachePath = getCacheFilePath(repoPath);
|
|
@@ -76095,7 +76141,7 @@ function computeSourceHash(repoPath) {
|
|
|
76095
76141
|
function getDocSourcePaths(repoPath) {
|
|
76096
76142
|
const paths = [];
|
|
76097
76143
|
const docsDir = join160(repoPath, "docs");
|
|
76098
|
-
if (
|
|
76144
|
+
if (existsSync79(docsDir)) {
|
|
76099
76145
|
try {
|
|
76100
76146
|
const files = readdirSync12(docsDir);
|
|
76101
76147
|
for (const f3 of files) {
|
|
@@ -76105,10 +76151,10 @@ function getDocSourcePaths(repoPath) {
|
|
|
76105
76151
|
} catch {}
|
|
76106
76152
|
}
|
|
76107
76153
|
const readme = join160(repoPath, "README.md");
|
|
76108
|
-
if (
|
|
76154
|
+
if (existsSync79(readme))
|
|
76109
76155
|
paths.push(readme);
|
|
76110
76156
|
const stylesDir = join160(repoPath, "assets", "writing-styles");
|
|
76111
|
-
if (
|
|
76157
|
+
if (existsSync79(stylesDir)) {
|
|
76112
76158
|
try {
|
|
76113
76159
|
const files = readdirSync12(stylesDir);
|
|
76114
76160
|
for (const f3 of files) {
|
|
@@ -76305,7 +76351,7 @@ function extractContentFromResponse(response) {
|
|
|
76305
76351
|
|
|
76306
76352
|
// src/commands/content/phases/docs-summarizer.ts
|
|
76307
76353
|
import { execSync as execSync7 } from "node:child_process";
|
|
76308
|
-
import { existsSync as
|
|
76354
|
+
import { existsSync as existsSync80, readFileSync as readFileSync19, readdirSync as readdirSync13 } from "node:fs";
|
|
76309
76355
|
import { join as join161 } from "node:path";
|
|
76310
76356
|
async function summarizeProjectDocs(repoPath, contentLogger) {
|
|
76311
76357
|
const rawContent = collectRawDocs(repoPath);
|
|
@@ -76350,7 +76396,7 @@ async function summarizeProjectDocs(repoPath, contentLogger) {
|
|
|
76350
76396
|
function collectRawDocs(repoPath) {
|
|
76351
76397
|
let totalChars = 0;
|
|
76352
76398
|
const readCapped = (filePath, maxChars) => {
|
|
76353
|
-
if (!
|
|
76399
|
+
if (!existsSync80(filePath))
|
|
76354
76400
|
return "";
|
|
76355
76401
|
if (totalChars >= MAX_RAW_CONTENT_CHARS)
|
|
76356
76402
|
return "";
|
|
@@ -76361,7 +76407,7 @@ function collectRawDocs(repoPath) {
|
|
|
76361
76407
|
};
|
|
76362
76408
|
const docsContent = [];
|
|
76363
76409
|
const docsDir = join161(repoPath, "docs");
|
|
76364
|
-
if (
|
|
76410
|
+
if (existsSync80(docsDir)) {
|
|
76365
76411
|
try {
|
|
76366
76412
|
const files = readdirSync13(docsDir).filter((f3) => f3.endsWith(".md")).sort();
|
|
76367
76413
|
for (const f3 of files) {
|
|
@@ -76385,7 +76431,7 @@ ${content}`);
|
|
|
76385
76431
|
}
|
|
76386
76432
|
let styles3 = "";
|
|
76387
76433
|
const stylesDir = join161(repoPath, "assets", "writing-styles");
|
|
76388
|
-
if (
|
|
76434
|
+
if (existsSync80(stylesDir)) {
|
|
76389
76435
|
try {
|
|
76390
76436
|
const files = readdirSync13(stylesDir).slice(0, 3);
|
|
76391
76437
|
styles3 = files.map((f3) => readCapped(join161(stylesDir, f3), 1000)).filter(Boolean).join(`
|
|
@@ -76578,12 +76624,12 @@ IMPORTANT: Generate the image and output the path as JSON: {"imagePath": "/path/
|
|
|
76578
76624
|
|
|
76579
76625
|
// src/commands/content/phases/photo-generator.ts
|
|
76580
76626
|
import { execSync as execSync8 } from "node:child_process";
|
|
76581
|
-
import { existsSync as
|
|
76627
|
+
import { existsSync as existsSync81, mkdirSync as mkdirSync6, readdirSync as readdirSync14 } from "node:fs";
|
|
76582
76628
|
import { homedir as homedir56 } from "node:os";
|
|
76583
76629
|
import { join as join162 } from "node:path";
|
|
76584
76630
|
async function generatePhoto(_content, context, config, platform18, contentId, contentLogger) {
|
|
76585
76631
|
const mediaDir = join162(config.contentDir.replace(/^~/, homedir56()), "media", String(contentId));
|
|
76586
|
-
if (!
|
|
76632
|
+
if (!existsSync81(mediaDir)) {
|
|
76587
76633
|
mkdirSync6(mediaDir, { recursive: true });
|
|
76588
76634
|
}
|
|
76589
76635
|
const prompt = buildPhotoPrompt(context, platform18);
|
|
@@ -76599,7 +76645,7 @@ async function generatePhoto(_content, context, config, platform18, contentId, c
|
|
|
76599
76645
|
const parsed = parseClaudeJsonOutput(result);
|
|
76600
76646
|
if (parsed && typeof parsed === "object" && "imagePath" in parsed) {
|
|
76601
76647
|
const imagePath = String(parsed.imagePath);
|
|
76602
|
-
if (
|
|
76648
|
+
if (existsSync81(imagePath)) {
|
|
76603
76649
|
return { path: imagePath, ...dimensions, format: "png" };
|
|
76604
76650
|
}
|
|
76605
76651
|
}
|
|
@@ -76695,7 +76741,7 @@ var init_content_creator = __esm(() => {
|
|
|
76695
76741
|
});
|
|
76696
76742
|
|
|
76697
76743
|
// src/commands/content/phases/content-logger.ts
|
|
76698
|
-
import { createWriteStream as createWriteStream4, existsSync as
|
|
76744
|
+
import { createWriteStream as createWriteStream4, existsSync as existsSync82, mkdirSync as mkdirSync7, statSync as statSync15 } from "node:fs";
|
|
76699
76745
|
import { homedir as homedir57 } from "node:os";
|
|
76700
76746
|
import { join as join163 } from "node:path";
|
|
76701
76747
|
|
|
@@ -76709,7 +76755,7 @@ class ContentLogger {
|
|
|
76709
76755
|
this.maxBytes = maxBytes;
|
|
76710
76756
|
}
|
|
76711
76757
|
init() {
|
|
76712
|
-
if (!
|
|
76758
|
+
if (!existsSync82(this.logDir)) {
|
|
76713
76759
|
mkdirSync7(this.logDir, { recursive: true });
|
|
76714
76760
|
}
|
|
76715
76761
|
this.rotateIfNeeded();
|
|
@@ -76802,7 +76848,7 @@ function openDatabase(dbPath) {
|
|
|
76802
76848
|
var init_sqlite_client = () => {};
|
|
76803
76849
|
|
|
76804
76850
|
// src/commands/content/phases/db-manager.ts
|
|
76805
|
-
import { existsSync as
|
|
76851
|
+
import { existsSync as existsSync83, mkdirSync as mkdirSync8 } from "node:fs";
|
|
76806
76852
|
import { dirname as dirname50 } from "node:path";
|
|
76807
76853
|
function initDatabase(dbPath) {
|
|
76808
76854
|
ensureParentDir(dbPath);
|
|
@@ -76825,7 +76871,7 @@ function runRetentionCleanup(db, retentionDays = 90) {
|
|
|
76825
76871
|
}
|
|
76826
76872
|
function ensureParentDir(dbPath) {
|
|
76827
76873
|
const dir = dirname50(dbPath);
|
|
76828
|
-
if (dir && !
|
|
76874
|
+
if (dir && !existsSync83(dir)) {
|
|
76829
76875
|
mkdirSync8(dir, { recursive: true });
|
|
76830
76876
|
}
|
|
76831
76877
|
}
|
|
@@ -76990,7 +77036,7 @@ function isNoiseCommit(title, author) {
|
|
|
76990
77036
|
|
|
76991
77037
|
// src/commands/content/phases/change-detector.ts
|
|
76992
77038
|
import { execSync as execSync10, spawnSync as spawnSync9 } from "node:child_process";
|
|
76993
|
-
import { existsSync as
|
|
77039
|
+
import { existsSync as existsSync84, readFileSync as readFileSync20, readdirSync as readdirSync15, statSync as statSync16 } from "node:fs";
|
|
76994
77040
|
import { join as join164 } from "node:path";
|
|
76995
77041
|
function detectCommits(repo, since) {
|
|
76996
77042
|
try {
|
|
@@ -77101,7 +77147,7 @@ function detectTags(repo, since) {
|
|
|
77101
77147
|
}
|
|
77102
77148
|
function detectCompletedPlans(repo, since) {
|
|
77103
77149
|
const plansDir = join164(repo.path, "plans");
|
|
77104
|
-
if (!
|
|
77150
|
+
if (!existsSync84(plansDir))
|
|
77105
77151
|
return [];
|
|
77106
77152
|
const sinceMs = new Date(since).getTime();
|
|
77107
77153
|
const events = [];
|
|
@@ -77111,7 +77157,7 @@ function detectCompletedPlans(repo, since) {
|
|
|
77111
77157
|
if (!entry.isDirectory())
|
|
77112
77158
|
continue;
|
|
77113
77159
|
const planFile = join164(plansDir, entry.name, "plan.md");
|
|
77114
|
-
if (!
|
|
77160
|
+
if (!existsSync84(planFile))
|
|
77115
77161
|
continue;
|
|
77116
77162
|
try {
|
|
77117
77163
|
const stat26 = statSync16(planFile);
|
|
@@ -78179,7 +78225,7 @@ var init_platform_setup_x = __esm(() => {
|
|
|
78179
78225
|
});
|
|
78180
78226
|
|
|
78181
78227
|
// src/commands/content/phases/setup-wizard.ts
|
|
78182
|
-
import { existsSync as
|
|
78228
|
+
import { existsSync as existsSync85 } from "node:fs";
|
|
78183
78229
|
import { join as join167 } from "node:path";
|
|
78184
78230
|
async function runSetupWizard2(cwd2, contentLogger) {
|
|
78185
78231
|
console.log();
|
|
@@ -78248,8 +78294,8 @@ async function showRepoSummary(cwd2) {
|
|
|
78248
78294
|
function detectBrandAssets(cwd2, contentLogger) {
|
|
78249
78295
|
const repos = discoverRepos2(cwd2);
|
|
78250
78296
|
for (const repo of repos) {
|
|
78251
|
-
const hasGuidelines =
|
|
78252
|
-
const hasStyles =
|
|
78297
|
+
const hasGuidelines = existsSync85(join167(repo.path, "docs", "brand-guidelines.md"));
|
|
78298
|
+
const hasStyles = existsSync85(join167(repo.path, "assets", "writing-styles"));
|
|
78253
78299
|
if (!hasGuidelines) {
|
|
78254
78300
|
f2.warning(`${repo.name}: No docs/brand-guidelines.md — content will use generic tone.`);
|
|
78255
78301
|
contentLogger.warn(`${repo.name}: missing docs/brand-guidelines.md`);
|
|
@@ -78315,13 +78361,13 @@ var init_setup_wizard = __esm(() => {
|
|
|
78315
78361
|
});
|
|
78316
78362
|
|
|
78317
78363
|
// src/commands/content/content-review-commands.ts
|
|
78318
|
-
import { existsSync as
|
|
78364
|
+
import { existsSync as existsSync86 } from "node:fs";
|
|
78319
78365
|
import { homedir as homedir58 } from "node:os";
|
|
78320
78366
|
async function queueContent() {
|
|
78321
78367
|
const cwd2 = process.cwd();
|
|
78322
78368
|
const config = await loadContentConfig(cwd2);
|
|
78323
78369
|
const dbPath = config.dbPath.replace(/^~/, homedir58());
|
|
78324
|
-
if (!
|
|
78370
|
+
if (!existsSync86(dbPath)) {
|
|
78325
78371
|
logger.info("No content database found. Run 'ck content setup' first.");
|
|
78326
78372
|
return;
|
|
78327
78373
|
}
|
|
@@ -78389,12 +78435,12 @@ __export(exports_content_subcommands, {
|
|
|
78389
78435
|
logsContent: () => logsContent,
|
|
78390
78436
|
approveContentCmd: () => approveContentCmd
|
|
78391
78437
|
});
|
|
78392
|
-
import { existsSync as
|
|
78438
|
+
import { existsSync as existsSync87, readFileSync as readFileSync21, unlinkSync as unlinkSync6 } from "node:fs";
|
|
78393
78439
|
import { homedir as homedir59 } from "node:os";
|
|
78394
78440
|
import { join as join168 } from "node:path";
|
|
78395
78441
|
function isDaemonRunning() {
|
|
78396
78442
|
const lockFile = join168(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
78397
|
-
if (!
|
|
78443
|
+
if (!existsSync87(lockFile))
|
|
78398
78444
|
return { running: false, pid: null };
|
|
78399
78445
|
try {
|
|
78400
78446
|
const pidStr = readFileSync21(lockFile, "utf-8").trim();
|
|
@@ -78426,7 +78472,7 @@ async function startContent(options2) {
|
|
|
78426
78472
|
}
|
|
78427
78473
|
async function stopContent() {
|
|
78428
78474
|
const lockFile = join168(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
78429
|
-
if (!
|
|
78475
|
+
if (!existsSync87(lockFile)) {
|
|
78430
78476
|
logger.info("Content daemon is not running.");
|
|
78431
78477
|
return;
|
|
78432
78478
|
}
|
|
@@ -78467,7 +78513,7 @@ async function logsContent(options2) {
|
|
|
78467
78513
|
const logDir = join168(homedir59(), ".claudekit", "logs");
|
|
78468
78514
|
const dateStr = new Date().toISOString().slice(0, 10).replace(/-/g, "");
|
|
78469
78515
|
const logPath = join168(logDir, `content-${dateStr}.log`);
|
|
78470
|
-
if (!
|
|
78516
|
+
if (!existsSync87(logPath)) {
|
|
78471
78517
|
logger.info("No content logs found for today.");
|
|
78472
78518
|
return;
|
|
78473
78519
|
}
|
|
@@ -78502,7 +78548,7 @@ var init_content_subcommands = __esm(() => {
|
|
|
78502
78548
|
});
|
|
78503
78549
|
|
|
78504
78550
|
// src/commands/content/content-command.ts
|
|
78505
|
-
import { existsSync as
|
|
78551
|
+
import { existsSync as existsSync88, mkdirSync as mkdirSync9, unlinkSync as unlinkSync7, writeFileSync as writeFileSync7 } from "node:fs";
|
|
78506
78552
|
import { homedir as homedir60 } from "node:os";
|
|
78507
78553
|
import { join as join169 } from "node:path";
|
|
78508
78554
|
async function contentCommand(options2) {
|
|
@@ -78533,7 +78579,7 @@ async function contentCommand(options2) {
|
|
|
78533
78579
|
}
|
|
78534
78580
|
contentLogger.info("Setup complete. Starting daemon...");
|
|
78535
78581
|
}
|
|
78536
|
-
if (!
|
|
78582
|
+
if (!existsSync88(LOCK_DIR2))
|
|
78537
78583
|
mkdirSync9(LOCK_DIR2, { recursive: true });
|
|
78538
78584
|
writeFileSync7(LOCK_FILE, String(process.pid), "utf-8");
|
|
78539
78585
|
const dbPath = config.dbPath.replace(/^~/, homedir60());
|
|
@@ -86620,7 +86666,7 @@ async function checkCliInstallMethod() {
|
|
|
86620
86666
|
};
|
|
86621
86667
|
}
|
|
86622
86668
|
// src/domains/health-checks/checkers/claude-md-checker.ts
|
|
86623
|
-
import { existsSync as
|
|
86669
|
+
import { existsSync as existsSync50, statSync as statSync10 } from "node:fs";
|
|
86624
86670
|
import { join as join72 } from "node:path";
|
|
86625
86671
|
function checkClaudeMd(setup, projectDir) {
|
|
86626
86672
|
const results = [];
|
|
@@ -86633,7 +86679,7 @@ function checkClaudeMd(setup, projectDir) {
|
|
|
86633
86679
|
return results;
|
|
86634
86680
|
}
|
|
86635
86681
|
function checkClaudeMdFile(path6, name, id) {
|
|
86636
|
-
if (!
|
|
86682
|
+
if (!existsSync50(path6)) {
|
|
86637
86683
|
return {
|
|
86638
86684
|
id,
|
|
86639
86685
|
name,
|
|
@@ -86686,11 +86732,11 @@ function checkClaudeMdFile(path6, name, id) {
|
|
|
86686
86732
|
}
|
|
86687
86733
|
}
|
|
86688
86734
|
// src/domains/health-checks/checkers/active-plan-checker.ts
|
|
86689
|
-
import { existsSync as
|
|
86735
|
+
import { existsSync as existsSync51, readFileSync as readFileSync15 } from "node:fs";
|
|
86690
86736
|
import { join as join73 } from "node:path";
|
|
86691
86737
|
function checkActivePlan(projectDir) {
|
|
86692
86738
|
const activePlanPath = join73(projectDir, ".claude", "active-plan");
|
|
86693
|
-
if (!
|
|
86739
|
+
if (!existsSync51(activePlanPath)) {
|
|
86694
86740
|
return {
|
|
86695
86741
|
id: "ck-active-plan",
|
|
86696
86742
|
name: "Active Plan",
|
|
@@ -86704,7 +86750,7 @@ function checkActivePlan(projectDir) {
|
|
|
86704
86750
|
try {
|
|
86705
86751
|
const targetPath = readFileSync15(activePlanPath, "utf-8").trim();
|
|
86706
86752
|
const fullPath = join73(projectDir, targetPath);
|
|
86707
|
-
if (!
|
|
86753
|
+
if (!existsSync51(fullPath)) {
|
|
86708
86754
|
return {
|
|
86709
86755
|
id: "ck-active-plan",
|
|
86710
86756
|
name: "Active Plan",
|
|
@@ -86740,7 +86786,7 @@ function checkActivePlan(projectDir) {
|
|
|
86740
86786
|
}
|
|
86741
86787
|
}
|
|
86742
86788
|
// src/domains/health-checks/checkers/skills-checker.ts
|
|
86743
|
-
import { existsSync as
|
|
86789
|
+
import { existsSync as existsSync52 } from "node:fs";
|
|
86744
86790
|
import { join as join74 } from "node:path";
|
|
86745
86791
|
function checkSkillsScripts(setup) {
|
|
86746
86792
|
const results = [];
|
|
@@ -86748,7 +86794,7 @@ function checkSkillsScripts(setup) {
|
|
|
86748
86794
|
const scriptName = platform7 === "win32" ? "install.ps1" : "install.sh";
|
|
86749
86795
|
if (setup.global.path) {
|
|
86750
86796
|
const globalScriptPath = join74(setup.global.path, "skills", scriptName);
|
|
86751
|
-
const hasGlobalScript =
|
|
86797
|
+
const hasGlobalScript = existsSync52(globalScriptPath);
|
|
86752
86798
|
results.push({
|
|
86753
86799
|
id: "ck-global-skills-script",
|
|
86754
86800
|
name: "Global Skills Script",
|
|
@@ -86763,7 +86809,7 @@ function checkSkillsScripts(setup) {
|
|
|
86763
86809
|
}
|
|
86764
86810
|
if (setup.project.metadata) {
|
|
86765
86811
|
const projectScriptPath = join74(setup.project.path, "skills", scriptName);
|
|
86766
|
-
const hasProjectScript =
|
|
86812
|
+
const hasProjectScript = existsSync52(projectScriptPath);
|
|
86767
86813
|
results.push({
|
|
86768
86814
|
id: "ck-project-skills-script",
|
|
86769
86815
|
name: "Project Skills Script",
|
|
@@ -86803,12 +86849,12 @@ import { join as join76, resolve as resolve34 } from "node:path";
|
|
|
86803
86849
|
|
|
86804
86850
|
// src/domains/health-checks/checkers/skill-budget-scanner.ts
|
|
86805
86851
|
var import_gray_matter11 = __toESM(require_gray_matter(), 1);
|
|
86806
|
-
import { existsSync as
|
|
86807
|
-
import { readFile as readFile39, readdir as
|
|
86852
|
+
import { existsSync as existsSync53 } from "node:fs";
|
|
86853
|
+
import { readFile as readFile39, readdir as readdir20 } from "node:fs/promises";
|
|
86808
86854
|
import { basename as basename24, join as join75, relative as relative16 } from "node:path";
|
|
86809
86855
|
var SKIP_DIRS5 = new Set([".git", ".venv", "__pycache__", "node_modules", "scripts", "common"]);
|
|
86810
86856
|
async function scanSkills2(skillsDir2) {
|
|
86811
|
-
if (!
|
|
86857
|
+
if (!existsSync53(skillsDir2))
|
|
86812
86858
|
return [];
|
|
86813
86859
|
const skillDirs = await findSkillDirs(skillsDir2);
|
|
86814
86860
|
const skills = [];
|
|
@@ -86833,14 +86879,14 @@ async function scanSkills2(skillsDir2) {
|
|
|
86833
86879
|
async function findSkillDirs(dir) {
|
|
86834
86880
|
let entries;
|
|
86835
86881
|
try {
|
|
86836
|
-
entries = await
|
|
86882
|
+
entries = await readdir20(dir, { withFileTypes: true });
|
|
86837
86883
|
} catch {
|
|
86838
86884
|
return [];
|
|
86839
86885
|
}
|
|
86840
86886
|
const results = [];
|
|
86841
86887
|
for (const entry of entries) {
|
|
86842
86888
|
const child = join75(dir, entry.name);
|
|
86843
|
-
if (
|
|
86889
|
+
if (existsSync53(join75(child, "SKILL.md"))) {
|
|
86844
86890
|
results.push(child);
|
|
86845
86891
|
continue;
|
|
86846
86892
|
}
|
|
@@ -86858,7 +86904,7 @@ function normalizeSkillId(rawName, fallbackId) {
|
|
|
86858
86904
|
|
|
86859
86905
|
// src/domains/health-checks/checkers/skill-budget-settings.ts
|
|
86860
86906
|
init_settings_merger();
|
|
86861
|
-
import { existsSync as
|
|
86907
|
+
import { existsSync as existsSync54 } from "node:fs";
|
|
86862
86908
|
import { mkdir as mkdir20, readFile as readFile40 } from "node:fs/promises";
|
|
86863
86909
|
var CONTEXT_FLOOR_TOKENS = 200000;
|
|
86864
86910
|
var CHARS_PER_TOKEN = 4;
|
|
@@ -86867,7 +86913,7 @@ var CK_RECOMMENDED_MAX_DESC_CHARS = 512;
|
|
|
86867
86913
|
var RECOMMENDED_DESC_CHARS = 200;
|
|
86868
86914
|
var LISTING_OVERHEAD_PER_SKILL = 4;
|
|
86869
86915
|
async function readProjectSettings(settingsPath) {
|
|
86870
|
-
if (!
|
|
86916
|
+
if (!existsSync54(settingsPath))
|
|
86871
86917
|
return { exists: false, settings: null };
|
|
86872
86918
|
try {
|
|
86873
86919
|
const parsed = JSON.parse(await readFile40(settingsPath, "utf8"));
|
|
@@ -87176,8 +87222,8 @@ async function checkGlobalDirWritable() {
|
|
|
87176
87222
|
}
|
|
87177
87223
|
// src/domains/health-checks/checkers/hooks-checker.ts
|
|
87178
87224
|
init_path_resolver();
|
|
87179
|
-
import { existsSync as
|
|
87180
|
-
import { readdir as
|
|
87225
|
+
import { existsSync as existsSync55 } from "node:fs";
|
|
87226
|
+
import { readdir as readdir21 } from "node:fs/promises";
|
|
87181
87227
|
import { join as join78 } from "node:path";
|
|
87182
87228
|
|
|
87183
87229
|
// src/domains/health-checks/utils/path-normalizer.ts
|
|
@@ -87193,12 +87239,12 @@ init_shared2();
|
|
|
87193
87239
|
async function checkHooksExist(projectDir) {
|
|
87194
87240
|
const globalHooksDir = join78(PathResolver.getGlobalKitDir(), "hooks");
|
|
87195
87241
|
const projectHooksDir = join78(projectDir, ".claude", "hooks");
|
|
87196
|
-
const globalExists =
|
|
87197
|
-
const projectExists =
|
|
87242
|
+
const globalExists = existsSync55(globalHooksDir);
|
|
87243
|
+
const projectExists = existsSync55(projectHooksDir);
|
|
87198
87244
|
let hookCount = 0;
|
|
87199
87245
|
const checkedFiles = new Set;
|
|
87200
87246
|
if (globalExists) {
|
|
87201
|
-
const files = await
|
|
87247
|
+
const files = await readdir21(globalHooksDir, { withFileTypes: false });
|
|
87202
87248
|
const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((ext) => f3.endsWith(ext)));
|
|
87203
87249
|
hooks.forEach((hook) => {
|
|
87204
87250
|
const fullPath = join78(globalHooksDir, hook);
|
|
@@ -87208,7 +87254,7 @@ async function checkHooksExist(projectDir) {
|
|
|
87208
87254
|
const normalizedGlobal = normalizePath2(globalHooksDir);
|
|
87209
87255
|
const normalizedProject = normalizePath2(projectHooksDir);
|
|
87210
87256
|
if (projectExists && normalizedProject !== normalizedGlobal) {
|
|
87211
|
-
const files = await
|
|
87257
|
+
const files = await readdir21(projectHooksDir, { withFileTypes: false });
|
|
87212
87258
|
const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((ext) => f3.endsWith(ext)));
|
|
87213
87259
|
hooks.forEach((hook) => {
|
|
87214
87260
|
const fullPath = join78(projectHooksDir, hook);
|
|
@@ -87241,13 +87287,13 @@ async function checkHooksExist(projectDir) {
|
|
|
87241
87287
|
// src/domains/health-checks/checkers/settings-checker.ts
|
|
87242
87288
|
init_logger();
|
|
87243
87289
|
init_path_resolver();
|
|
87244
|
-
import { existsSync as
|
|
87290
|
+
import { existsSync as existsSync56 } from "node:fs";
|
|
87245
87291
|
import { readFile as readFile41 } from "node:fs/promises";
|
|
87246
87292
|
import { join as join79 } from "node:path";
|
|
87247
87293
|
async function checkSettingsValid(projectDir) {
|
|
87248
87294
|
const globalSettings = join79(PathResolver.getGlobalKitDir(), "settings.json");
|
|
87249
87295
|
const projectSettings = join79(projectDir, ".claude", "settings.json");
|
|
87250
|
-
const settingsPath =
|
|
87296
|
+
const settingsPath = existsSync56(globalSettings) ? globalSettings : existsSync56(projectSettings) ? projectSettings : null;
|
|
87251
87297
|
if (!settingsPath) {
|
|
87252
87298
|
return {
|
|
87253
87299
|
id: "ck-settings-valid",
|
|
@@ -87316,14 +87362,14 @@ async function checkSettingsValid(projectDir) {
|
|
|
87316
87362
|
// src/domains/health-checks/checkers/path-refs-checker.ts
|
|
87317
87363
|
init_logger();
|
|
87318
87364
|
init_path_resolver();
|
|
87319
|
-
import { existsSync as
|
|
87365
|
+
import { existsSync as existsSync57 } from "node:fs";
|
|
87320
87366
|
import { readFile as readFile42 } from "node:fs/promises";
|
|
87321
87367
|
import { homedir as homedir42 } from "node:os";
|
|
87322
87368
|
import { dirname as dirname28, join as join80, normalize as normalize6, resolve as resolve35 } from "node:path";
|
|
87323
87369
|
async function checkPathRefsValid(projectDir) {
|
|
87324
87370
|
const globalClaudeMd = join80(PathResolver.getGlobalKitDir(), "CLAUDE.md");
|
|
87325
87371
|
const projectClaudeMd = join80(projectDir, ".claude", "CLAUDE.md");
|
|
87326
|
-
const claudeMdPath =
|
|
87372
|
+
const claudeMdPath = existsSync57(globalClaudeMd) ? globalClaudeMd : existsSync57(projectClaudeMd) ? projectClaudeMd : null;
|
|
87327
87373
|
if (!claudeMdPath) {
|
|
87328
87374
|
return {
|
|
87329
87375
|
id: "ck-path-refs-valid",
|
|
@@ -87376,7 +87422,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
87376
87422
|
logger.verbose("Skipping potentially unsafe path reference", { ref, refPath });
|
|
87377
87423
|
continue;
|
|
87378
87424
|
}
|
|
87379
|
-
if (!
|
|
87425
|
+
if (!existsSync57(normalizedPath)) {
|
|
87380
87426
|
broken.push(ref);
|
|
87381
87427
|
}
|
|
87382
87428
|
}
|
|
@@ -87415,8 +87461,8 @@ async function checkPathRefsValid(projectDir) {
|
|
|
87415
87461
|
}
|
|
87416
87462
|
}
|
|
87417
87463
|
// src/domains/health-checks/checkers/config-completeness-checker.ts
|
|
87418
|
-
import { existsSync as
|
|
87419
|
-
import { readdir as
|
|
87464
|
+
import { existsSync as existsSync58 } from "node:fs";
|
|
87465
|
+
import { readdir as readdir22 } from "node:fs/promises";
|
|
87420
87466
|
import { join as join81 } from "node:path";
|
|
87421
87467
|
async function checkProjectConfigCompleteness(setup, projectDir) {
|
|
87422
87468
|
const baseResult = {
|
|
@@ -87455,15 +87501,15 @@ async function checkProjectConfigCompleteness(setup, projectDir) {
|
|
|
87455
87501
|
const requiredDirs = ["agents", "commands", "skills"];
|
|
87456
87502
|
const missingDirs = [];
|
|
87457
87503
|
for (const dir of requiredDirs) {
|
|
87458
|
-
if (!
|
|
87504
|
+
if (!existsSync58(join81(projectClaudeDir, dir))) {
|
|
87459
87505
|
missingDirs.push(dir);
|
|
87460
87506
|
}
|
|
87461
87507
|
}
|
|
87462
|
-
const hasRulesOrWorkflows =
|
|
87508
|
+
const hasRulesOrWorkflows = existsSync58(join81(projectClaudeDir, "rules")) || existsSync58(join81(projectClaudeDir, "workflows"));
|
|
87463
87509
|
if (!hasRulesOrWorkflows) {
|
|
87464
87510
|
missingDirs.push("rules");
|
|
87465
87511
|
}
|
|
87466
|
-
const files = await
|
|
87512
|
+
const files = await readdir22(projectClaudeDir).catch(() => []);
|
|
87467
87513
|
const hasOnlyClaudeMd = files.length === 1 && files.includes("CLAUDE.md");
|
|
87468
87514
|
const totalRequired = requiredDirs.length + 1;
|
|
87469
87515
|
if (hasOnlyClaudeMd || missingDirs.length === totalRequired) {
|
|
@@ -92665,11 +92711,11 @@ class FileDownloader {
|
|
|
92665
92711
|
init_logger();
|
|
92666
92712
|
init_types3();
|
|
92667
92713
|
import { constants as constants4 } from "node:fs";
|
|
92668
|
-
import { access as access5, readdir as
|
|
92714
|
+
import { access as access5, readdir as readdir23 } from "node:fs/promises";
|
|
92669
92715
|
import { join as join98 } from "node:path";
|
|
92670
92716
|
async function validateExtraction(extractDir) {
|
|
92671
92717
|
try {
|
|
92672
|
-
const entries = await
|
|
92718
|
+
const entries = await readdir23(extractDir, { encoding: "utf8" });
|
|
92673
92719
|
logger.debug(`Extracted files: ${entries.join(", ")}`);
|
|
92674
92720
|
if (entries.length === 0) {
|
|
92675
92721
|
throw new ExtractionError("Extraction resulted in no files");
|
|
@@ -92699,7 +92745,7 @@ async function validateExtraction(extractDir) {
|
|
|
92699
92745
|
|
|
92700
92746
|
// src/domains/installation/extraction/tar-extractor.ts
|
|
92701
92747
|
init_logger();
|
|
92702
|
-
import { copyFile as copyFile4, mkdir as mkdir28, readdir as
|
|
92748
|
+
import { copyFile as copyFile4, mkdir as mkdir28, readdir as readdir25, rm as rm11, stat as stat15 } from "node:fs/promises";
|
|
92703
92749
|
import { join as join101 } from "node:path";
|
|
92704
92750
|
|
|
92705
92751
|
// node_modules/@isaacs/fs-minipass/dist/esm/index.js
|
|
@@ -99568,7 +99614,7 @@ function decodeFilePath(path14) {
|
|
|
99568
99614
|
// src/domains/installation/utils/file-utils.ts
|
|
99569
99615
|
init_logger();
|
|
99570
99616
|
init_types3();
|
|
99571
|
-
import { copyFile as copyFile3, lstat as lstat7, mkdir as mkdir27, readdir as
|
|
99617
|
+
import { copyFile as copyFile3, lstat as lstat7, mkdir as mkdir27, readdir as readdir24 } from "node:fs/promises";
|
|
99572
99618
|
import { join as join100, relative as relative20 } from "node:path";
|
|
99573
99619
|
async function withRetry(fn, retries = 3) {
|
|
99574
99620
|
for (let i = 0;i < retries; i++) {
|
|
@@ -99589,7 +99635,7 @@ var isRetryable = (e2) => {
|
|
|
99589
99635
|
var delay = (ms) => new Promise((r2) => setTimeout(r2, ms));
|
|
99590
99636
|
async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
99591
99637
|
await mkdir27(destDir, { recursive: true });
|
|
99592
|
-
const entries = await
|
|
99638
|
+
const entries = await readdir24(sourceDir, { encoding: "utf8" });
|
|
99593
99639
|
for (const entry of entries) {
|
|
99594
99640
|
const sourcePath = join100(sourceDir, entry);
|
|
99595
99641
|
const destPath = join100(destDir, entry);
|
|
@@ -99617,7 +99663,7 @@ async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTrac
|
|
|
99617
99663
|
}
|
|
99618
99664
|
async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
99619
99665
|
await mkdir27(destDir, { recursive: true });
|
|
99620
|
-
const entries = await
|
|
99666
|
+
const entries = await readdir24(sourceDir, { encoding: "utf8" });
|
|
99621
99667
|
for (const entry of entries) {
|
|
99622
99668
|
const sourcePath = join100(sourceDir, entry);
|
|
99623
99669
|
const destPath = join100(destDir, entry);
|
|
@@ -99664,14 +99710,14 @@ class TarExtractor {
|
|
|
99664
99710
|
}
|
|
99665
99711
|
});
|
|
99666
99712
|
logger.debug(`Extracted TAR.GZ to temp: ${tempExtractDir}`);
|
|
99667
|
-
const entries = await
|
|
99713
|
+
const entries = await readdir25(tempExtractDir, { encoding: "utf8" });
|
|
99668
99714
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
99669
99715
|
if (entries.length === 1) {
|
|
99670
99716
|
const rootEntry = entries[0];
|
|
99671
99717
|
const rootPath = join101(tempExtractDir, rootEntry);
|
|
99672
99718
|
const rootStat = await stat15(rootPath);
|
|
99673
99719
|
if (rootStat.isDirectory()) {
|
|
99674
|
-
const rootContents = await
|
|
99720
|
+
const rootContents = await readdir25(rootPath, { encoding: "utf8" });
|
|
99675
99721
|
logger.debug(`Root directory '${rootEntry}' contains: ${rootContents.join(", ")}`);
|
|
99676
99722
|
const isWrapper = isWrapperDirectory(rootEntry);
|
|
99677
99723
|
logger.debug(`Is wrapper directory: ${isWrapper}`);
|
|
@@ -99705,7 +99751,7 @@ class TarExtractor {
|
|
|
99705
99751
|
init_logger();
|
|
99706
99752
|
var import_extract_zip = __toESM(require_extract_zip(), 1);
|
|
99707
99753
|
import { execFile as execFile10 } from "node:child_process";
|
|
99708
|
-
import { copyFile as copyFile5, mkdir as mkdir29, readdir as
|
|
99754
|
+
import { copyFile as copyFile5, mkdir as mkdir29, readdir as readdir26, rm as rm12, stat as stat16 } from "node:fs/promises";
|
|
99709
99755
|
import { join as join102 } from "node:path";
|
|
99710
99756
|
import { promisify as promisify15 } from "node:util";
|
|
99711
99757
|
|
|
@@ -99794,14 +99840,14 @@ class ZipExtractor {
|
|
|
99794
99840
|
logger.verbose(`Extracted ${extractedCount} files`);
|
|
99795
99841
|
}
|
|
99796
99842
|
logger.debug(`Extracted ZIP to temp: ${tempExtractDir}`);
|
|
99797
|
-
const entries = await
|
|
99843
|
+
const entries = await readdir26(tempExtractDir, { encoding: "utf8" });
|
|
99798
99844
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
99799
99845
|
if (entries.length === 1) {
|
|
99800
99846
|
const rootEntry = entries[0];
|
|
99801
99847
|
const rootPath = join102(tempExtractDir, rootEntry);
|
|
99802
99848
|
const rootStat = await stat16(rootPath);
|
|
99803
99849
|
if (rootStat.isDirectory()) {
|
|
99804
|
-
const rootContents = await
|
|
99850
|
+
const rootContents = await readdir26(rootPath, { encoding: "utf8" });
|
|
99805
99851
|
logger.debug(`Root directory '${rootEntry}' contains: ${rootContents.join(", ")}`);
|
|
99806
99852
|
const isWrapper = isWrapperDirectory(rootEntry);
|
|
99807
99853
|
logger.debug(`Is wrapper directory: ${isWrapper}`);
|
|
@@ -100395,7 +100441,7 @@ async function handleDownload(ctx) {
|
|
|
100395
100441
|
import { join as join120 } from "node:path";
|
|
100396
100442
|
|
|
100397
100443
|
// src/domains/installation/deletion-handler.ts
|
|
100398
|
-
import { existsSync as
|
|
100444
|
+
import { existsSync as existsSync64, lstatSync as lstatSync3, readdirSync as readdirSync7, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
100399
100445
|
import { dirname as dirname34, join as join106, relative as relative21, resolve as resolve40, sep as sep11 } from "node:path";
|
|
100400
100446
|
|
|
100401
100447
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
@@ -100586,7 +100632,7 @@ function shouldDeletePath(path15, metadata, kitType) {
|
|
|
100586
100632
|
}
|
|
100587
100633
|
function collectFilesRecursively(dir, baseDir) {
|
|
100588
100634
|
const results = [];
|
|
100589
|
-
if (!
|
|
100635
|
+
if (!existsSync64(dir))
|
|
100590
100636
|
return results;
|
|
100591
100637
|
try {
|
|
100592
100638
|
const entries = readdirSync7(dir, { withFileTypes: true });
|
|
@@ -100727,7 +100773,7 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
|
|
|
100727
100773
|
logger.verbose(`Preserved user file: ${path15}`);
|
|
100728
100774
|
continue;
|
|
100729
100775
|
}
|
|
100730
|
-
if (
|
|
100776
|
+
if (existsSync64(fullPath)) {
|
|
100731
100777
|
try {
|
|
100732
100778
|
deletePath(fullPath, claudeDir3);
|
|
100733
100779
|
result.deletedPaths.push(path15);
|
|
@@ -102429,7 +102475,7 @@ import { dirname as dirname37, join as join109 } from "node:path";
|
|
|
102429
102475
|
|
|
102430
102476
|
// src/domains/config/installed-settings-tracker.ts
|
|
102431
102477
|
init_shared();
|
|
102432
|
-
import { existsSync as
|
|
102478
|
+
import { existsSync as existsSync65 } from "node:fs";
|
|
102433
102479
|
import { mkdir as mkdir31, readFile as readFile50, writeFile as writeFile25 } from "node:fs/promises";
|
|
102434
102480
|
import { dirname as dirname35, join as join108 } from "node:path";
|
|
102435
102481
|
var CK_JSON_FILE = ".ck.json";
|
|
@@ -102451,7 +102497,7 @@ class InstalledSettingsTracker {
|
|
|
102451
102497
|
}
|
|
102452
102498
|
async loadInstalledSettings() {
|
|
102453
102499
|
const ckJsonPath = this.getCkJsonPath();
|
|
102454
|
-
if (!
|
|
102500
|
+
if (!existsSync65(ckJsonPath)) {
|
|
102455
102501
|
return { hooks: [], mcpServers: [] };
|
|
102456
102502
|
}
|
|
102457
102503
|
try {
|
|
@@ -102471,7 +102517,7 @@ class InstalledSettingsTracker {
|
|
|
102471
102517
|
const ckJsonPath = this.getCkJsonPath();
|
|
102472
102518
|
try {
|
|
102473
102519
|
let data = {};
|
|
102474
|
-
if (
|
|
102520
|
+
if (existsSync65(ckJsonPath)) {
|
|
102475
102521
|
const content = await readFile50(ckJsonPath, "utf-8");
|
|
102476
102522
|
data = JSON.parse(content);
|
|
102477
102523
|
}
|
|
@@ -102524,12 +102570,12 @@ class InstalledSettingsTracker {
|
|
|
102524
102570
|
init_settings_merger();
|
|
102525
102571
|
|
|
102526
102572
|
// src/domains/installation/merger/zombie-wirings-pruner.ts
|
|
102527
|
-
import { existsSync as
|
|
102573
|
+
import { existsSync as existsSync66, readdirSync as readdirSync8 } from "node:fs";
|
|
102528
102574
|
import { homedir as homedir45 } from "node:os";
|
|
102529
102575
|
import { basename as basename26, dirname as dirname36, isAbsolute as isAbsolute12, resolve as resolve41, sep as sep13 } from "node:path";
|
|
102530
102576
|
function pruneZombieEngineerWirings(settings, hookDir) {
|
|
102531
102577
|
const pruned = [];
|
|
102532
|
-
if (!
|
|
102578
|
+
if (!existsSync66(hookDir)) {
|
|
102533
102579
|
return { settings, pruned };
|
|
102534
102580
|
}
|
|
102535
102581
|
const hookFiles = readdirSync8(hookDir);
|
|
@@ -102582,7 +102628,7 @@ function shouldPruneEntry(entry, hookDir, pruned) {
|
|
|
102582
102628
|
const filePath = extractHookFilePath(entry.command, hookDir);
|
|
102583
102629
|
if (!filePath)
|
|
102584
102630
|
return false;
|
|
102585
|
-
if (
|
|
102631
|
+
if (existsSync66(filePath))
|
|
102586
102632
|
return false;
|
|
102587
102633
|
pruned.push(basename26(filePath));
|
|
102588
102634
|
return true;
|
|
@@ -103444,7 +103490,7 @@ class FileMerger {
|
|
|
103444
103490
|
}
|
|
103445
103491
|
|
|
103446
103492
|
// src/domains/migration/legacy-migration.ts
|
|
103447
|
-
import { readdir as
|
|
103493
|
+
import { readdir as readdir28, stat as stat19 } from "node:fs/promises";
|
|
103448
103494
|
import { join as join114, relative as relative24 } from "node:path";
|
|
103449
103495
|
// src/services/file-operations/manifest/manifest-tracker.ts
|
|
103450
103496
|
import { join as join113 } from "node:path";
|
|
@@ -103855,7 +103901,7 @@ class LegacyMigration {
|
|
|
103855
103901
|
const files = [];
|
|
103856
103902
|
let entries;
|
|
103857
103903
|
try {
|
|
103858
|
-
entries = await
|
|
103904
|
+
entries = await readdir28(dir);
|
|
103859
103905
|
} catch (err) {
|
|
103860
103906
|
const error = err;
|
|
103861
103907
|
if (error.code === "ENOENT") {
|
|
@@ -104201,12 +104247,12 @@ class FileScanner2 {
|
|
|
104201
104247
|
// src/services/transformers/commands-prefix/prefix-applier.ts
|
|
104202
104248
|
init_logger();
|
|
104203
104249
|
var import_fs_extra20 = __toESM(require_lib(), 1);
|
|
104204
|
-
import { lstat as lstat10, mkdir as mkdir32, readdir as
|
|
104250
|
+
import { lstat as lstat10, mkdir as mkdir32, readdir as readdir31, stat as stat20 } from "node:fs/promises";
|
|
104205
104251
|
import { join as join117 } from "node:path";
|
|
104206
104252
|
|
|
104207
104253
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
104208
104254
|
init_logger();
|
|
104209
|
-
import { readFile as readFile54, readdir as
|
|
104255
|
+
import { readFile as readFile54, readdir as readdir30, writeFile as writeFile29 } from "node:fs/promises";
|
|
104210
104256
|
import { join as join116 } from "node:path";
|
|
104211
104257
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
104212
104258
|
".md",
|
|
@@ -104265,7 +104311,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
104265
104311
|
let filesTransformed = 0;
|
|
104266
104312
|
let totalReplacements = 0;
|
|
104267
104313
|
async function processDirectory(dir) {
|
|
104268
|
-
const entries = await
|
|
104314
|
+
const entries = await readdir30(dir, { withFileTypes: true });
|
|
104269
104315
|
for (const entry of entries) {
|
|
104270
104316
|
const fullPath = join116(dir, entry.name);
|
|
104271
104317
|
if (entry.isDirectory()) {
|
|
@@ -104351,7 +104397,7 @@ async function applyPrefix(extractDir) {
|
|
|
104351
104397
|
const backupDir = join117(extractDir, ".commands-backup");
|
|
104352
104398
|
const tempDir = join117(extractDir, ".commands-prefix-temp");
|
|
104353
104399
|
try {
|
|
104354
|
-
const entries = await
|
|
104400
|
+
const entries = await readdir31(commandsDir);
|
|
104355
104401
|
if (entries.length === 0) {
|
|
104356
104402
|
logger.verbose("Commands directory is empty, skipping prefix application");
|
|
104357
104403
|
return;
|
|
@@ -104432,19 +104478,19 @@ async function applyPrefix(extractDir) {
|
|
|
104432
104478
|
|
|
104433
104479
|
// src/services/transformers/commands-prefix/prefix-cleaner.ts
|
|
104434
104480
|
init_metadata_migration();
|
|
104435
|
-
import { lstat as lstat12, readdir as
|
|
104481
|
+
import { lstat as lstat12, readdir as readdir33 } from "node:fs/promises";
|
|
104436
104482
|
import { join as join119 } from "node:path";
|
|
104437
104483
|
init_logger();
|
|
104438
104484
|
var import_fs_extra22 = __toESM(require_lib(), 1);
|
|
104439
104485
|
|
|
104440
104486
|
// src/services/transformers/commands-prefix/file-processor.ts
|
|
104441
|
-
import { lstat as lstat11, readdir as
|
|
104487
|
+
import { lstat as lstat11, readdir as readdir32 } from "node:fs/promises";
|
|
104442
104488
|
import { join as join118 } from "node:path";
|
|
104443
104489
|
init_logger();
|
|
104444
104490
|
var import_fs_extra21 = __toESM(require_lib(), 1);
|
|
104445
104491
|
async function scanDirectoryFiles(dir) {
|
|
104446
104492
|
const files = [];
|
|
104447
|
-
const entries = await
|
|
104493
|
+
const entries = await readdir32(dir);
|
|
104448
104494
|
for (const entry of entries) {
|
|
104449
104495
|
const fullPath = join118(dir, entry);
|
|
104450
104496
|
const stats = await lstat11(fullPath);
|
|
@@ -104610,7 +104656,7 @@ async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
|
104610
104656
|
if (options2.kitType) {
|
|
104611
104657
|
logger.verbose(`Kit-aware cleanup: only cleaning files owned by '${options2.kitType}'`);
|
|
104612
104658
|
}
|
|
104613
|
-
const entries = await
|
|
104659
|
+
const entries = await readdir33(commandsDir);
|
|
104614
104660
|
if (entries.length === 0) {
|
|
104615
104661
|
logger.verbose("Commands directory is empty");
|
|
104616
104662
|
return result;
|
|
@@ -104813,7 +104859,7 @@ init_skip_directories();
|
|
|
104813
104859
|
init_types3();
|
|
104814
104860
|
var import_fs_extra24 = __toESM(require_lib(), 1);
|
|
104815
104861
|
import { createHash as createHash7 } from "node:crypto";
|
|
104816
|
-
import { readFile as readFile56, readdir as
|
|
104862
|
+
import { readFile as readFile56, readdir as readdir34, writeFile as writeFile30 } from "node:fs/promises";
|
|
104817
104863
|
import { join as join121, relative as relative26 } from "node:path";
|
|
104818
104864
|
|
|
104819
104865
|
class SkillsManifestManager {
|
|
@@ -104858,14 +104904,14 @@ class SkillsManifestManager {
|
|
|
104858
104904
|
}
|
|
104859
104905
|
}
|
|
104860
104906
|
static async detectStructure(skillsDir2) {
|
|
104861
|
-
const entries = await
|
|
104907
|
+
const entries = await readdir34(skillsDir2, { withFileTypes: true });
|
|
104862
104908
|
const dirs = entries.filter((entry) => entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith("."));
|
|
104863
104909
|
if (dirs.length === 0) {
|
|
104864
104910
|
return "flat";
|
|
104865
104911
|
}
|
|
104866
104912
|
for (const dir of dirs.slice(0, 3)) {
|
|
104867
104913
|
const dirPath = join121(skillsDir2, dir.name);
|
|
104868
|
-
const subEntries = await
|
|
104914
|
+
const subEntries = await readdir34(dirPath, { withFileTypes: true });
|
|
104869
104915
|
const hasSubdirs = subEntries.some((entry) => entry.isDirectory());
|
|
104870
104916
|
if (hasSubdirs) {
|
|
104871
104917
|
return "categorized";
|
|
@@ -104880,7 +104926,7 @@ class SkillsManifestManager {
|
|
|
104880
104926
|
static async scanSkills(skillsDir2, structure) {
|
|
104881
104927
|
const skills = [];
|
|
104882
104928
|
if (structure === "flat") {
|
|
104883
|
-
const entries = await
|
|
104929
|
+
const entries = await readdir34(skillsDir2, { withFileTypes: true });
|
|
104884
104930
|
for (const entry of entries) {
|
|
104885
104931
|
if (entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith(".")) {
|
|
104886
104932
|
const skillPath = join121(skillsDir2, entry.name);
|
|
@@ -104892,11 +104938,11 @@ class SkillsManifestManager {
|
|
|
104892
104938
|
}
|
|
104893
104939
|
}
|
|
104894
104940
|
} else {
|
|
104895
|
-
const categories = await
|
|
104941
|
+
const categories = await readdir34(skillsDir2, { withFileTypes: true });
|
|
104896
104942
|
for (const category of categories) {
|
|
104897
104943
|
if (category.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(category.name) && !category.name.startsWith(".")) {
|
|
104898
104944
|
const categoryPath = join121(skillsDir2, category.name);
|
|
104899
|
-
const skillEntries = await
|
|
104945
|
+
const skillEntries = await readdir34(categoryPath, { withFileTypes: true });
|
|
104900
104946
|
for (const skillEntry of skillEntries) {
|
|
104901
104947
|
if (skillEntry.isDirectory() && !skillEntry.name.startsWith(".")) {
|
|
104902
104948
|
const skillPath = join121(categoryPath, skillEntry.name);
|
|
@@ -104927,7 +104973,7 @@ class SkillsManifestManager {
|
|
|
104927
104973
|
}
|
|
104928
104974
|
static async getAllFiles(dirPath) {
|
|
104929
104975
|
const files = [];
|
|
104930
|
-
const entries = await
|
|
104976
|
+
const entries = await readdir34(dirPath, { withFileTypes: true });
|
|
104931
104977
|
for (const entry of entries) {
|
|
104932
104978
|
const fullPath = join121(dirPath, entry.name);
|
|
104933
104979
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name)) {
|
|
@@ -105050,13 +105096,13 @@ function getPathMapping(skillName, oldBasePath, newBasePath) {
|
|
|
105050
105096
|
|
|
105051
105097
|
// src/domains/skills/detection/script-detector.ts
|
|
105052
105098
|
var import_fs_extra25 = __toESM(require_lib(), 1);
|
|
105053
|
-
import { readdir as
|
|
105099
|
+
import { readdir as readdir35 } from "node:fs/promises";
|
|
105054
105100
|
import { join as join122 } from "node:path";
|
|
105055
105101
|
async function scanDirectory(skillsDir2) {
|
|
105056
105102
|
if (!await import_fs_extra25.pathExists(skillsDir2)) {
|
|
105057
105103
|
return ["flat", []];
|
|
105058
105104
|
}
|
|
105059
|
-
const entries = await
|
|
105105
|
+
const entries = await readdir35(skillsDir2, { withFileTypes: true });
|
|
105060
105106
|
const dirs = entries.filter((entry) => entry.isDirectory() && entry.name !== "node_modules" && !entry.name.startsWith("."));
|
|
105061
105107
|
if (dirs.length === 0) {
|
|
105062
105108
|
return ["flat", []];
|
|
@@ -105065,12 +105111,12 @@ async function scanDirectory(skillsDir2) {
|
|
|
105065
105111
|
const allSkills = [];
|
|
105066
105112
|
for (const dir of dirs) {
|
|
105067
105113
|
const dirPath = join122(skillsDir2, dir.name);
|
|
105068
|
-
const subEntries = await
|
|
105114
|
+
const subEntries = await readdir35(dirPath, { withFileTypes: true });
|
|
105069
105115
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
105070
105116
|
if (subdirs.length > 0) {
|
|
105071
105117
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
105072
105118
|
const subdirPath = join122(dirPath, subdir.name);
|
|
105073
|
-
const subdirFiles = await
|
|
105119
|
+
const subdirFiles = await readdir35(subdirPath, { withFileTypes: true });
|
|
105074
105120
|
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"));
|
|
105075
105121
|
if (hasSkillMarker) {
|
|
105076
105122
|
totalSkillLikeCount++;
|
|
@@ -105230,7 +105276,7 @@ import { join as join127 } from "node:path";
|
|
|
105230
105276
|
|
|
105231
105277
|
// src/domains/skills/migrator/migration-executor.ts
|
|
105232
105278
|
init_logger();
|
|
105233
|
-
import { copyFile as copyFile6, mkdir as mkdir33, readdir as
|
|
105279
|
+
import { copyFile as copyFile6, mkdir as mkdir33, readdir as readdir36, rm as rm13 } from "node:fs/promises";
|
|
105234
105280
|
import { join as join123 } from "node:path";
|
|
105235
105281
|
var import_fs_extra27 = __toESM(require_lib(), 1);
|
|
105236
105282
|
|
|
@@ -105394,7 +105440,7 @@ Detected changes:`;
|
|
|
105394
105440
|
// src/domains/skills/migrator/migration-executor.ts
|
|
105395
105441
|
async function copySkillDirectory(sourceDir, destDir) {
|
|
105396
105442
|
await mkdir33(destDir, { recursive: true });
|
|
105397
|
-
const entries = await
|
|
105443
|
+
const entries = await readdir36(sourceDir, { withFileTypes: true });
|
|
105398
105444
|
for (const entry of entries) {
|
|
105399
105445
|
const sourcePath = join123(sourceDir, entry.name);
|
|
105400
105446
|
const destPath = join123(destDir, entry.name);
|
|
@@ -105501,7 +105547,7 @@ function validateMigrationPath(path16, paramName) {
|
|
|
105501
105547
|
init_logger();
|
|
105502
105548
|
init_types3();
|
|
105503
105549
|
var import_fs_extra28 = __toESM(require_lib(), 1);
|
|
105504
|
-
import { copyFile as copyFile7, mkdir as mkdir34, readdir as
|
|
105550
|
+
import { copyFile as copyFile7, mkdir as mkdir34, readdir as readdir37, rm as rm14, stat as stat21 } from "node:fs/promises";
|
|
105505
105551
|
import { basename as basename27, join as join124, normalize as normalize9 } from "node:path";
|
|
105506
105552
|
function validatePath2(path16, paramName) {
|
|
105507
105553
|
if (!path16 || typeof path16 !== "string") {
|
|
@@ -105578,7 +105624,7 @@ class SkillsBackupManager {
|
|
|
105578
105624
|
return [];
|
|
105579
105625
|
}
|
|
105580
105626
|
try {
|
|
105581
|
-
const entries = await
|
|
105627
|
+
const entries = await readdir37(parentDir, { withFileTypes: true });
|
|
105582
105628
|
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) => join124(parentDir, entry.name));
|
|
105583
105629
|
backups.sort().reverse();
|
|
105584
105630
|
return backups;
|
|
@@ -105605,7 +105651,7 @@ class SkillsBackupManager {
|
|
|
105605
105651
|
return await SkillsBackupManager.getDirectorySize(backupDir);
|
|
105606
105652
|
}
|
|
105607
105653
|
static async copyDirectory(sourceDir, destDir) {
|
|
105608
|
-
const entries = await
|
|
105654
|
+
const entries = await readdir37(sourceDir, { withFileTypes: true });
|
|
105609
105655
|
for (const entry of entries) {
|
|
105610
105656
|
const sourcePath = join124(sourceDir, entry.name);
|
|
105611
105657
|
const destPath = join124(destDir, entry.name);
|
|
@@ -105622,7 +105668,7 @@ class SkillsBackupManager {
|
|
|
105622
105668
|
}
|
|
105623
105669
|
static async getDirectorySize(dirPath) {
|
|
105624
105670
|
let size = 0;
|
|
105625
|
-
const entries = await
|
|
105671
|
+
const entries = await readdir37(dirPath, { withFileTypes: true });
|
|
105626
105672
|
for (const entry of entries) {
|
|
105627
105673
|
const fullPath = join124(dirPath, entry.name);
|
|
105628
105674
|
if (entry.isSymbolicLink()) {
|
|
@@ -105659,11 +105705,11 @@ import { relative as relative28 } from "node:path";
|
|
|
105659
105705
|
init_skip_directories();
|
|
105660
105706
|
import { createHash as createHash8 } from "node:crypto";
|
|
105661
105707
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
105662
|
-
import { readFile as readFile57, readdir as
|
|
105708
|
+
import { readFile as readFile57, readdir as readdir38 } from "node:fs/promises";
|
|
105663
105709
|
import { join as join125, relative as relative27 } from "node:path";
|
|
105664
105710
|
async function getAllFiles(dirPath) {
|
|
105665
105711
|
const files = [];
|
|
105666
|
-
const entries = await
|
|
105712
|
+
const entries = await readdir38(dirPath, { withFileTypes: true });
|
|
105667
105713
|
for (const entry of entries) {
|
|
105668
105714
|
const fullPath = join125(dirPath, entry.name);
|
|
105669
105715
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name) || entry.isSymbolicLink()) {
|
|
@@ -105791,7 +105837,7 @@ async function detectFileChanges(currentSkillPath, baselineSkillPath) {
|
|
|
105791
105837
|
// src/domains/skills/customization/scan-reporter.ts
|
|
105792
105838
|
init_types3();
|
|
105793
105839
|
var import_fs_extra30 = __toESM(require_lib(), 1);
|
|
105794
|
-
import { readdir as
|
|
105840
|
+
import { readdir as readdir39 } from "node:fs/promises";
|
|
105795
105841
|
import { join as join126, normalize as normalize10 } from "node:path";
|
|
105796
105842
|
function validatePath3(path16, paramName) {
|
|
105797
105843
|
if (!path16 || typeof path16 !== "string") {
|
|
@@ -105808,19 +105854,19 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
105808
105854
|
if (!await import_fs_extra30.pathExists(skillsDir2)) {
|
|
105809
105855
|
return ["flat", []];
|
|
105810
105856
|
}
|
|
105811
|
-
const entries = await
|
|
105857
|
+
const entries = await readdir39(skillsDir2, { withFileTypes: true });
|
|
105812
105858
|
const dirs = entries.filter((entry) => entry.isDirectory() && entry.name !== "node_modules" && !entry.name.startsWith("."));
|
|
105813
105859
|
if (dirs.length === 0) {
|
|
105814
105860
|
return ["flat", []];
|
|
105815
105861
|
}
|
|
105816
105862
|
const firstDirPath = join126(skillsDir2, dirs[0].name);
|
|
105817
|
-
const subEntries = await
|
|
105863
|
+
const subEntries = await readdir39(firstDirPath, { withFileTypes: true });
|
|
105818
105864
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
105819
105865
|
if (subdirs.length > 0) {
|
|
105820
105866
|
let skillLikeCount = 0;
|
|
105821
105867
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
105822
105868
|
const subdirPath = join126(firstDirPath, subdir.name);
|
|
105823
|
-
const subdirFiles = await
|
|
105869
|
+
const subdirFiles = await readdir39(subdirPath, { withFileTypes: true });
|
|
105824
105870
|
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"));
|
|
105825
105871
|
if (hasSkillMarker) {
|
|
105826
105872
|
skillLikeCount++;
|
|
@@ -105830,7 +105876,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
105830
105876
|
const skills = [];
|
|
105831
105877
|
for (const dir of dirs) {
|
|
105832
105878
|
const categoryPath = join126(skillsDir2, dir.name);
|
|
105833
|
-
const skillDirs = await
|
|
105879
|
+
const skillDirs = await readdir39(categoryPath, { withFileTypes: true });
|
|
105834
105880
|
skills.push(...skillDirs.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name));
|
|
105835
105881
|
}
|
|
105836
105882
|
return ["categorized", skills];
|
|
@@ -105843,7 +105889,7 @@ async function findSkillPath(skillsDir2, skillName) {
|
|
|
105843
105889
|
if (await import_fs_extra30.pathExists(flatPath)) {
|
|
105844
105890
|
return { path: flatPath, category: undefined };
|
|
105845
105891
|
}
|
|
105846
|
-
const entries = await
|
|
105892
|
+
const entries = await readdir39(skillsDir2, { withFileTypes: true });
|
|
105847
105893
|
for (const entry of entries) {
|
|
105848
105894
|
if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
105849
105895
|
continue;
|
|
@@ -106027,12 +106073,12 @@ async function handleMigration(ctx) {
|
|
|
106027
106073
|
return ctx;
|
|
106028
106074
|
}
|
|
106029
106075
|
// src/commands/init/phases/opencode-handler.ts
|
|
106030
|
-
import { cp as cp4, readdir as
|
|
106076
|
+
import { cp as cp4, readdir as readdir41, rm as rm15 } from "node:fs/promises";
|
|
106031
106077
|
import { join as join130 } from "node:path";
|
|
106032
106078
|
|
|
106033
106079
|
// src/services/transformers/opencode-path-transformer.ts
|
|
106034
106080
|
init_logger();
|
|
106035
|
-
import { readFile as readFile58, readdir as
|
|
106081
|
+
import { readFile as readFile58, readdir as readdir40, writeFile as writeFile31 } from "node:fs/promises";
|
|
106036
106082
|
import { platform as platform14 } from "node:os";
|
|
106037
106083
|
import { extname as extname5, join as join129 } from "node:path";
|
|
106038
106084
|
var IS_WINDOWS2 = platform14() === "win32";
|
|
@@ -106093,7 +106139,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
106093
106139
|
let totalChanges = 0;
|
|
106094
106140
|
let filesSkipped = 0;
|
|
106095
106141
|
async function processDirectory2(dir) {
|
|
106096
|
-
const entries = await
|
|
106142
|
+
const entries = await readdir40(dir, { withFileTypes: true });
|
|
106097
106143
|
for (const entry of entries) {
|
|
106098
106144
|
const fullPath = join129(dir, entry.name);
|
|
106099
106145
|
if (entry.isDirectory()) {
|
|
@@ -106150,7 +106196,7 @@ async function handleOpenCode(ctx) {
|
|
|
106150
106196
|
logger.success(`Transformed ${transformResult.totalChanges} OpenCode path(s) in ${transformResult.filesTransformed} file(s)`);
|
|
106151
106197
|
}
|
|
106152
106198
|
await import_fs_extra32.ensureDir(targetDir);
|
|
106153
|
-
const entries = await
|
|
106199
|
+
const entries = await readdir41(openCodeSource, { withFileTypes: true });
|
|
106154
106200
|
for (const entry of entries) {
|
|
106155
106201
|
const sourcePath = join130(openCodeSource, entry.name);
|
|
106156
106202
|
const targetPath = join130(targetDir, entry.name);
|
|
@@ -106502,7 +106548,7 @@ async function runPreflightChecks() {
|
|
|
106502
106548
|
|
|
106503
106549
|
// src/domains/installation/fresh-installer.ts
|
|
106504
106550
|
init_metadata_migration();
|
|
106505
|
-
import { existsSync as
|
|
106551
|
+
import { existsSync as existsSync67, readdirSync as readdirSync9, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
|
|
106506
106552
|
import { basename as basename28, dirname as dirname39, join as join132, resolve as resolve45 } from "node:path";
|
|
106507
106553
|
init_logger();
|
|
106508
106554
|
init_safe_spinner();
|
|
@@ -106586,7 +106632,7 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
|
|
|
106586
106632
|
}
|
|
106587
106633
|
for (const file of filesToRemove) {
|
|
106588
106634
|
const fullPath = join132(claudeDir3, file.path);
|
|
106589
|
-
if (!
|
|
106635
|
+
if (!existsSync67(fullPath)) {
|
|
106590
106636
|
continue;
|
|
106591
106637
|
}
|
|
106592
106638
|
try {
|
|
@@ -106644,8 +106690,8 @@ function getFreshBackupTargets(claudeDir3, analysis, includeModified) {
|
|
|
106644
106690
|
mutatePaths: filesToRemove.length > 0 ? ["metadata.json"] : []
|
|
106645
106691
|
};
|
|
106646
106692
|
}
|
|
106647
|
-
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) =>
|
|
106648
|
-
if (
|
|
106693
|
+
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync67(join132(claudeDir3, subdir)));
|
|
106694
|
+
if (existsSync67(join132(claudeDir3, "metadata.json"))) {
|
|
106649
106695
|
deletePaths.push("metadata.json");
|
|
106650
106696
|
}
|
|
106651
106697
|
return {
|
|
@@ -106751,7 +106797,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
|
|
|
106751
106797
|
|
|
106752
106798
|
// src/domains/installation/global-kit-legacy-repair.ts
|
|
106753
106799
|
var import_fs_extra35 = __toESM(require_lib(), 1);
|
|
106754
|
-
import { cp as cp5, mkdir as mkdir35, readdir as
|
|
106800
|
+
import { cp as cp5, mkdir as mkdir35, readdir as readdir42, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
|
|
106755
106801
|
import { homedir as homedir47 } from "node:os";
|
|
106756
106802
|
import { dirname as dirname40, join as join133, normalize as normalize11, resolve as resolve46 } from "node:path";
|
|
106757
106803
|
var LEGACY_KIT_MARKERS = [
|
|
@@ -106822,7 +106868,7 @@ async function hasKitMarkers(dir) {
|
|
|
106822
106868
|
async function isEmptyDirectory(dir) {
|
|
106823
106869
|
if (!await isDirectory(dir))
|
|
106824
106870
|
return false;
|
|
106825
|
-
return (await
|
|
106871
|
+
return (await readdir42(dir)).length === 0;
|
|
106826
106872
|
}
|
|
106827
106873
|
async function moveDirectory(source, target) {
|
|
106828
106874
|
try {
|
|
@@ -107730,7 +107776,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
107730
107776
|
// src/services/transformers/folder-transform/path-replacer.ts
|
|
107731
107777
|
init_logger();
|
|
107732
107778
|
init_types3();
|
|
107733
|
-
import { readFile as readFile60, readdir as
|
|
107779
|
+
import { readFile as readFile60, readdir as readdir43, writeFile as writeFile34 } from "node:fs/promises";
|
|
107734
107780
|
import { join as join137, relative as relative30 } from "node:path";
|
|
107735
107781
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
107736
107782
|
".md",
|
|
@@ -107782,7 +107828,7 @@ function compileReplacements(replacements) {
|
|
|
107782
107828
|
async function transformFileContents(dir, compiledReplacements, options2) {
|
|
107783
107829
|
let filesChanged = 0;
|
|
107784
107830
|
let replacementsCount = 0;
|
|
107785
|
-
const entries = await
|
|
107831
|
+
const entries = await readdir43(dir, { withFileTypes: true });
|
|
107786
107832
|
for (const entry of entries) {
|
|
107787
107833
|
const fullPath = join137(dir, entry.name);
|
|
107788
107834
|
if (entry.isDirectory()) {
|
|
@@ -107919,7 +107965,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
107919
107965
|
|
|
107920
107966
|
// src/services/transformers/global-path-transformer.ts
|
|
107921
107967
|
init_logger();
|
|
107922
|
-
import { readFile as readFile61, readdir as
|
|
107968
|
+
import { readFile as readFile61, readdir as readdir44, writeFile as writeFile35 } from "node:fs/promises";
|
|
107923
107969
|
import { homedir as homedir48, platform as platform15 } from "node:os";
|
|
107924
107970
|
import { extname as extname6, join as join138 } from "node:path";
|
|
107925
107971
|
var IS_WINDOWS3 = platform15() === "win32";
|
|
@@ -108060,7 +108106,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
108060
108106
|
let filesSkipped = 0;
|
|
108061
108107
|
const skippedFiles = [];
|
|
108062
108108
|
async function processDirectory2(dir) {
|
|
108063
|
-
const entries = await
|
|
108109
|
+
const entries = await readdir44(dir, { withFileTypes: true });
|
|
108064
108110
|
for (const entry of entries) {
|
|
108065
108111
|
const fullPath = join138(dir, entry.name);
|
|
108066
108112
|
if (entry.isDirectory()) {
|
|
@@ -108346,7 +108392,7 @@ async function initCommand(options2) {
|
|
|
108346
108392
|
// src/commands/migrate/migrate-command.ts
|
|
108347
108393
|
init_dist2();
|
|
108348
108394
|
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
108349
|
-
import { existsSync as
|
|
108395
|
+
import { existsSync as existsSync68 } from "node:fs";
|
|
108350
108396
|
import { readFile as readFile65, rm as rm18, unlink as unlink14 } from "node:fs/promises";
|
|
108351
108397
|
import { homedir as homedir53 } from "node:os";
|
|
108352
108398
|
import { basename as basename30, join as join143, resolve as resolve50 } from "node:path";
|
|
@@ -109989,7 +110035,7 @@ async function executeDeleteAction(action, options2) {
|
|
|
109989
110035
|
const preservePaths = options2?.preservePaths ?? new Set;
|
|
109990
110036
|
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve50(action.targetPath));
|
|
109991
110037
|
try {
|
|
109992
|
-
if (!shouldPreserveTarget && action.targetPath &&
|
|
110038
|
+
if (!shouldPreserveTarget && action.targetPath && existsSync68(action.targetPath)) {
|
|
109993
110039
|
await rm18(action.targetPath, { recursive: true, force: true });
|
|
109994
110040
|
}
|
|
109995
110041
|
await removePortableInstallation(action.item, action.type, action.provider, action.global, action.targetPath ? { path: action.targetPath } : undefined);
|
|
@@ -110021,7 +110067,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
110021
110067
|
if (!skillSourcePath)
|
|
110022
110068
|
return;
|
|
110023
110069
|
const sourceMetadataPath = join143(resolve50(skillSourcePath, ".."), "metadata.json");
|
|
110024
|
-
if (!
|
|
110070
|
+
if (!existsSync68(sourceMetadataPath))
|
|
110025
110071
|
return;
|
|
110026
110072
|
let sourceMetadata;
|
|
110027
110073
|
try {
|
|
@@ -110034,7 +110080,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
110034
110080
|
if (!sourceMetadata.deletions || sourceMetadata.deletions.length === 0)
|
|
110035
110081
|
return;
|
|
110036
110082
|
const claudeDir3 = installGlobally ? join143(homedir53(), ".claude") : join143(process.cwd(), ".claude");
|
|
110037
|
-
if (!
|
|
110083
|
+
if (!existsSync68(claudeDir3))
|
|
110038
110084
|
return;
|
|
110039
110085
|
try {
|
|
110040
110086
|
const result = await handleDeletions(sourceMetadata, claudeDir3, inferKitTypeFromSourceMetadata(sourceMetadata));
|
|
@@ -110326,7 +110372,7 @@ async function migrateCommand(options2) {
|
|
|
110326
110372
|
const interactive = process.stdout.isTTY && !options2.yes;
|
|
110327
110373
|
const conflictActions = plan.actions.filter((a3) => a3.action === "conflict");
|
|
110328
110374
|
for (const action of conflictActions) {
|
|
110329
|
-
if (!action.diff && action.targetPath &&
|
|
110375
|
+
if (!action.diff && action.targetPath && existsSync68(action.targetPath)) {
|
|
110330
110376
|
try {
|
|
110331
110377
|
const targetContent = await readFile65(action.targetPath, "utf-8");
|
|
110332
110378
|
const sourceItem = effectiveAgents.find((a3) => a3.name === action.item) || effectiveCommands.find((c2) => c2.name === action.item) || (effectiveConfigItem?.name === action.item ? effectiveConfigItem : null) || effectiveRuleItems.find((r2) => r2.name === action.item) || effectiveHookItems.find((h2) => h2.name === action.item);
|
|
@@ -110642,7 +110688,7 @@ async function migrateCommand(options2) {
|
|
|
110642
110688
|
async function rollbackResults(results) {
|
|
110643
110689
|
const rolledBackPaths = new Set;
|
|
110644
110690
|
for (const result of results) {
|
|
110645
|
-
if (!result.path || !
|
|
110691
|
+
if (!result.path || !existsSync68(result.path))
|
|
110646
110692
|
continue;
|
|
110647
110693
|
try {
|
|
110648
110694
|
if (result.overwritten)
|
|
@@ -111209,7 +111255,7 @@ Please use only one download method.`);
|
|
|
111209
111255
|
}
|
|
111210
111256
|
// src/commands/plan/plan-command.ts
|
|
111211
111257
|
init_output_manager();
|
|
111212
|
-
import { existsSync as
|
|
111258
|
+
import { existsSync as existsSync71, statSync as statSync12 } from "node:fs";
|
|
111213
111259
|
import { dirname as dirname47, isAbsolute as isAbsolute14, join as join148, parse as parse7, resolve as resolve55 } from "node:path";
|
|
111214
111260
|
|
|
111215
111261
|
// src/commands/plan/plan-read-handlers.ts
|
|
@@ -111219,14 +111265,14 @@ init_plans_registry();
|
|
|
111219
111265
|
init_logger();
|
|
111220
111266
|
init_output_manager();
|
|
111221
111267
|
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
111222
|
-
import { existsSync as
|
|
111268
|
+
import { existsSync as existsSync70, statSync as statSync11 } from "node:fs";
|
|
111223
111269
|
import { basename as basename31, dirname as dirname45, join as join147, relative as relative31, resolve as resolve53 } from "node:path";
|
|
111224
111270
|
|
|
111225
111271
|
// src/commands/plan/plan-dependencies.ts
|
|
111226
111272
|
init_config();
|
|
111227
111273
|
init_plan_parser();
|
|
111228
111274
|
init_plans_registry();
|
|
111229
|
-
import { existsSync as
|
|
111275
|
+
import { existsSync as existsSync69 } from "node:fs";
|
|
111230
111276
|
import { dirname as dirname44, join as join146 } from "node:path";
|
|
111231
111277
|
async function resolvePlanDependencies(references, currentPlanFile, options2 = {}) {
|
|
111232
111278
|
if (references.length === 0)
|
|
@@ -111249,7 +111295,7 @@ async function resolvePlanDependencies(references, currentPlanFile, options2 = {
|
|
|
111249
111295
|
const scopeRoot = resolvePlanDirForScope(scope, projectRoot, config);
|
|
111250
111296
|
const planFile = join146(scopeRoot, planId, "plan.md");
|
|
111251
111297
|
const isSelfReference = planFile === currentPlanFile;
|
|
111252
|
-
if (!
|
|
111298
|
+
if (!existsSync69(planFile)) {
|
|
111253
111299
|
return {
|
|
111254
111300
|
reference,
|
|
111255
111301
|
scope,
|
|
@@ -111389,7 +111435,7 @@ async function handleStatus(target, options2) {
|
|
|
111389
111435
|
}
|
|
111390
111436
|
const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
|
|
111391
111437
|
const t = effectiveTarget ? resolve53(effectiveTarget) : null;
|
|
111392
|
-
const plansDir = t &&
|
|
111438
|
+
const plansDir = t && existsSync70(t) && statSync11(t).isDirectory() && !existsSync70(join147(t, "plan.md")) ? t : null;
|
|
111393
111439
|
if (plansDir) {
|
|
111394
111440
|
const planFiles = scanPlanDir(plansDir);
|
|
111395
111441
|
if (planFiles.length === 0) {
|
|
@@ -111807,19 +111853,19 @@ function resolveTargetPath(target, baseDir) {
|
|
|
111807
111853
|
return resolve55(target);
|
|
111808
111854
|
}
|
|
111809
111855
|
const cwdCandidate = resolve55(target);
|
|
111810
|
-
if (
|
|
111856
|
+
if (existsSync71(cwdCandidate)) {
|
|
111811
111857
|
return cwdCandidate;
|
|
111812
111858
|
}
|
|
111813
111859
|
return resolve55(baseDir, target);
|
|
111814
111860
|
}
|
|
111815
111861
|
function resolvePlanFile(target, baseDir) {
|
|
111816
111862
|
const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve55(baseDir) : process.cwd();
|
|
111817
|
-
if (
|
|
111863
|
+
if (existsSync71(t)) {
|
|
111818
111864
|
const stat24 = statSync12(t);
|
|
111819
111865
|
if (stat24.isFile())
|
|
111820
111866
|
return t;
|
|
111821
111867
|
const candidate = join148(t, "plan.md");
|
|
111822
|
-
if (
|
|
111868
|
+
if (existsSync71(candidate))
|
|
111823
111869
|
return candidate;
|
|
111824
111870
|
}
|
|
111825
111871
|
if (!target && !baseDir) {
|
|
@@ -111827,7 +111873,7 @@ function resolvePlanFile(target, baseDir) {
|
|
|
111827
111873
|
const root = parse7(dir).root;
|
|
111828
111874
|
while (dir !== root) {
|
|
111829
111875
|
const candidate = join148(dir, "plan.md");
|
|
111830
|
-
if (
|
|
111876
|
+
if (existsSync71(candidate))
|
|
111831
111877
|
return candidate;
|
|
111832
111878
|
dir = dirname47(dir);
|
|
111833
111879
|
}
|
|
@@ -111877,7 +111923,7 @@ async function planCommand(action, target, options2) {
|
|
|
111877
111923
|
let resolvedTarget = target;
|
|
111878
111924
|
if (resolvedAction && !knownActions.has(resolvedAction)) {
|
|
111879
111925
|
const looksLikePath = resolvedAction.includes("/") || resolvedAction.includes("\\") || resolvedAction.endsWith(".md") || resolvedAction === "." || resolvedAction === "..";
|
|
111880
|
-
const existsOnDisk = !looksLikePath &&
|
|
111926
|
+
const existsOnDisk = !looksLikePath && existsSync71(resolve55(resolvedAction));
|
|
111881
111927
|
if (looksLikePath || existsOnDisk) {
|
|
111882
111928
|
resolvedTarget = resolvedAction;
|
|
111883
111929
|
resolvedAction = undefined;
|
|
@@ -111919,13 +111965,13 @@ init_claudekit_data2();
|
|
|
111919
111965
|
init_logger();
|
|
111920
111966
|
init_safe_prompts();
|
|
111921
111967
|
var import_picocolors34 = __toESM(require_picocolors(), 1);
|
|
111922
|
-
import { existsSync as
|
|
111968
|
+
import { existsSync as existsSync72 } from "node:fs";
|
|
111923
111969
|
import { resolve as resolve56 } from "node:path";
|
|
111924
111970
|
async function handleAdd(projectPath, options2) {
|
|
111925
111971
|
logger.debug(`Adding project: ${projectPath}, options: ${JSON.stringify(options2)}`);
|
|
111926
111972
|
intro("Add Project");
|
|
111927
111973
|
const absolutePath = resolve56(projectPath);
|
|
111928
|
-
if (!
|
|
111974
|
+
if (!existsSync72(absolutePath)) {
|
|
111929
111975
|
log.error(`Path does not exist: ${absolutePath}`);
|
|
111930
111976
|
process.exitCode = 1;
|
|
111931
111977
|
return;
|
|
@@ -113764,7 +113810,7 @@ ${import_picocolors40.default.bold(import_picocolors40.default.cyan(result.kitCo
|
|
|
113764
113810
|
|
|
113765
113811
|
// src/commands/watch/watch-command.ts
|
|
113766
113812
|
init_logger();
|
|
113767
|
-
import { existsSync as
|
|
113813
|
+
import { existsSync as existsSync78 } from "node:fs";
|
|
113768
113814
|
import { rm as rm19 } from "node:fs/promises";
|
|
113769
113815
|
import { join as join159 } from "node:path";
|
|
113770
113816
|
var import_picocolors41 = __toESM(require_picocolors(), 1);
|
|
@@ -114662,12 +114708,12 @@ async function checkAwaitingApproval(state, setup, options2, watchLog, projectDi
|
|
|
114662
114708
|
}
|
|
114663
114709
|
|
|
114664
114710
|
// src/commands/watch/phases/plan-dir-finder.ts
|
|
114665
|
-
import { readdir as
|
|
114711
|
+
import { readdir as readdir46, stat as stat24 } from "node:fs/promises";
|
|
114666
114712
|
import { join as join154 } from "node:path";
|
|
114667
114713
|
async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
114668
114714
|
const plansRoot = join154(cwd2, "plans");
|
|
114669
114715
|
try {
|
|
114670
|
-
const entries = await
|
|
114716
|
+
const entries = await readdir46(plansRoot);
|
|
114671
114717
|
const tenMinAgo = Date.now() - 10 * 60 * 1000;
|
|
114672
114718
|
const issueStr = String(issueNumber);
|
|
114673
114719
|
const candidates = [];
|
|
@@ -115063,14 +115109,14 @@ function cleanExpiredIssues(state, ttlDays) {
|
|
|
115063
115109
|
init_ck_config_manager();
|
|
115064
115110
|
init_file_io();
|
|
115065
115111
|
init_logger();
|
|
115066
|
-
import { existsSync as
|
|
115112
|
+
import { existsSync as existsSync74 } from "node:fs";
|
|
115067
115113
|
import { mkdir as mkdir41, readFile as readFile68 } from "node:fs/promises";
|
|
115068
115114
|
import { dirname as dirname49 } from "node:path";
|
|
115069
115115
|
var PROCESSED_ISSUES_CAP = 500;
|
|
115070
115116
|
async function readCkJson(projectDir) {
|
|
115071
115117
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
115072
115118
|
try {
|
|
115073
|
-
if (!
|
|
115119
|
+
if (!existsSync74(configPath))
|
|
115074
115120
|
return {};
|
|
115075
115121
|
const content = await readFile68(configPath, "utf-8");
|
|
115076
115122
|
return JSON.parse(content);
|
|
@@ -115096,7 +115142,7 @@ async function loadWatchState(projectDir) {
|
|
|
115096
115142
|
async function saveWatchState(projectDir, state) {
|
|
115097
115143
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
115098
115144
|
const configDir = dirname49(configPath);
|
|
115099
|
-
if (!
|
|
115145
|
+
if (!existsSync74(configDir)) {
|
|
115100
115146
|
await mkdir41(configDir, { recursive: true });
|
|
115101
115147
|
}
|
|
115102
115148
|
const raw2 = await readCkJson(projectDir);
|
|
@@ -115223,12 +115269,12 @@ async function processImplementationQueue(state, config, setup, options2, watchL
|
|
|
115223
115269
|
// src/commands/watch/phases/repo-scanner.ts
|
|
115224
115270
|
init_logger();
|
|
115225
115271
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
115226
|
-
import { existsSync as
|
|
115227
|
-
import { readdir as
|
|
115272
|
+
import { existsSync as existsSync75 } from "node:fs";
|
|
115273
|
+
import { readdir as readdir47, stat as stat25 } from "node:fs/promises";
|
|
115228
115274
|
import { join as join156 } from "node:path";
|
|
115229
115275
|
async function scanForRepos(parentDir) {
|
|
115230
115276
|
const repos = [];
|
|
115231
|
-
const entries = await
|
|
115277
|
+
const entries = await readdir47(parentDir);
|
|
115232
115278
|
for (const entry of entries) {
|
|
115233
115279
|
if (entry.startsWith("."))
|
|
115234
115280
|
continue;
|
|
@@ -115237,7 +115283,7 @@ async function scanForRepos(parentDir) {
|
|
|
115237
115283
|
if (!entryStat.isDirectory())
|
|
115238
115284
|
continue;
|
|
115239
115285
|
const gitDir = join156(fullPath, ".git");
|
|
115240
|
-
if (!
|
|
115286
|
+
if (!existsSync75(gitDir))
|
|
115241
115287
|
continue;
|
|
115242
115288
|
const result = spawnSync7("gh", ["repo", "view", "--json", "owner,name"], {
|
|
115243
115289
|
encoding: "utf-8",
|
|
@@ -115261,7 +115307,7 @@ async function scanForRepos(parentDir) {
|
|
|
115261
115307
|
// src/commands/watch/phases/setup-validator.ts
|
|
115262
115308
|
init_logger();
|
|
115263
115309
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
115264
|
-
import { existsSync as
|
|
115310
|
+
import { existsSync as existsSync76 } from "node:fs";
|
|
115265
115311
|
import { homedir as homedir54 } from "node:os";
|
|
115266
115312
|
import { join as join157 } from "node:path";
|
|
115267
115313
|
async function validateSetup(cwd2) {
|
|
@@ -115295,7 +115341,7 @@ Run this command from a directory with a GitHub remote.`);
|
|
|
115295
115341
|
throw new Error(`Failed to parse repository info: ${ghRepo.stdout}`);
|
|
115296
115342
|
}
|
|
115297
115343
|
const skillsPath = join157(homedir54(), ".claude", "skills");
|
|
115298
|
-
const skillsAvailable =
|
|
115344
|
+
const skillsAvailable = existsSync76(skillsPath);
|
|
115299
115345
|
if (!skillsAvailable) {
|
|
115300
115346
|
logger.warning(`ClaudeKit Engineer skills not found at ${skillsPath}`);
|
|
115301
115347
|
}
|
|
@@ -115311,7 +115357,7 @@ Run this command from a directory with a GitHub remote.`);
|
|
|
115311
115357
|
init_logger();
|
|
115312
115358
|
init_path_resolver();
|
|
115313
115359
|
import { createWriteStream as createWriteStream3, statSync as statSync13 } from "node:fs";
|
|
115314
|
-
import { existsSync as
|
|
115360
|
+
import { existsSync as existsSync77 } from "node:fs";
|
|
115315
115361
|
import { mkdir as mkdir42, rename as rename15 } from "node:fs/promises";
|
|
115316
115362
|
import { join as join158 } from "node:path";
|
|
115317
115363
|
|
|
@@ -115326,7 +115372,7 @@ class WatchLogger {
|
|
|
115326
115372
|
}
|
|
115327
115373
|
async init() {
|
|
115328
115374
|
try {
|
|
115329
|
-
if (!
|
|
115375
|
+
if (!existsSync77(this.logDir)) {
|
|
115330
115376
|
await mkdir42(this.logDir, { recursive: true });
|
|
115331
115377
|
}
|
|
115332
115378
|
const dateStr = formatDate(new Date);
|
|
@@ -115512,7 +115558,7 @@ async function watchCommand(options2) {
|
|
|
115512
115558
|
}
|
|
115513
115559
|
async function discoverRepos(options2, watchLog) {
|
|
115514
115560
|
const cwd2 = process.cwd();
|
|
115515
|
-
const isGitRepo =
|
|
115561
|
+
const isGitRepo = existsSync78(join159(cwd2, ".git"));
|
|
115516
115562
|
if (options2.force) {
|
|
115517
115563
|
await forceRemoveLock(watchLog);
|
|
115518
115564
|
}
|
|
@@ -115769,7 +115815,7 @@ function registerCommands(cli) {
|
|
|
115769
115815
|
// src/cli/version-display.ts
|
|
115770
115816
|
init_package();
|
|
115771
115817
|
init_config_version_checker();
|
|
115772
|
-
import { existsSync as
|
|
115818
|
+
import { existsSync as existsSync90, readFileSync as readFileSync22 } from "node:fs";
|
|
115773
115819
|
import { join as join171 } from "node:path";
|
|
115774
115820
|
|
|
115775
115821
|
// src/domains/versioning/version-checker.ts
|
|
@@ -115783,7 +115829,7 @@ init_types3();
|
|
|
115783
115829
|
// src/domains/versioning/version-cache.ts
|
|
115784
115830
|
init_logger();
|
|
115785
115831
|
init_path_resolver();
|
|
115786
|
-
import { existsSync as
|
|
115832
|
+
import { existsSync as existsSync89 } from "node:fs";
|
|
115787
115833
|
import { mkdir as mkdir43, readFile as readFile70, writeFile as writeFile42 } from "node:fs/promises";
|
|
115788
115834
|
import { join as join170 } from "node:path";
|
|
115789
115835
|
|
|
@@ -115797,7 +115843,7 @@ class VersionCacheManager {
|
|
|
115797
115843
|
static async load() {
|
|
115798
115844
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
115799
115845
|
try {
|
|
115800
|
-
if (!
|
|
115846
|
+
if (!existsSync89(cacheFile)) {
|
|
115801
115847
|
logger.debug("Version check cache not found");
|
|
115802
115848
|
return null;
|
|
115803
115849
|
}
|
|
@@ -115818,7 +115864,7 @@ class VersionCacheManager {
|
|
|
115818
115864
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
115819
115865
|
const cacheDir = PathResolver.getCacheDir(false);
|
|
115820
115866
|
try {
|
|
115821
|
-
if (!
|
|
115867
|
+
if (!existsSync89(cacheDir)) {
|
|
115822
115868
|
await mkdir43(cacheDir, { recursive: true, mode: 448 });
|
|
115823
115869
|
}
|
|
115824
115870
|
await writeFile42(cacheFile, JSON.stringify(cache5, null, 2), "utf-8");
|
|
@@ -115840,7 +115886,7 @@ class VersionCacheManager {
|
|
|
115840
115886
|
static async clear() {
|
|
115841
115887
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
115842
115888
|
try {
|
|
115843
|
-
if (
|
|
115889
|
+
if (existsSync89(cacheFile)) {
|
|
115844
115890
|
const fs20 = await import("node:fs/promises");
|
|
115845
115891
|
await fs20.unlink(cacheFile);
|
|
115846
115892
|
logger.debug("Version check cache cleared");
|
|
@@ -116107,7 +116153,7 @@ async function displayVersion() {
|
|
|
116107
116153
|
const prefix = PathResolver.getPathPrefix(false);
|
|
116108
116154
|
const localMetadataPath = prefix ? join171(process.cwd(), prefix, "metadata.json") : join171(process.cwd(), "metadata.json");
|
|
116109
116155
|
const isLocalSameAsGlobal = localMetadataPath === globalMetadataPath;
|
|
116110
|
-
if (!isLocalSameAsGlobal &&
|
|
116156
|
+
if (!isLocalSameAsGlobal && existsSync90(localMetadataPath)) {
|
|
116111
116157
|
try {
|
|
116112
116158
|
const rawMetadata = JSON.parse(readFileSync22(localMetadataPath, "utf-8"));
|
|
116113
116159
|
const metadata = MetadataSchema.parse(rawMetadata);
|
|
@@ -116121,7 +116167,7 @@ async function displayVersion() {
|
|
|
116121
116167
|
logger.verbose("Failed to parse local metadata.json", { error });
|
|
116122
116168
|
}
|
|
116123
116169
|
}
|
|
116124
|
-
if (
|
|
116170
|
+
if (existsSync90(globalMetadataPath)) {
|
|
116125
116171
|
try {
|
|
116126
116172
|
const rawMetadata = JSON.parse(readFileSync22(globalMetadataPath, "utf-8"));
|
|
116127
116173
|
const metadata = MetadataSchema.parse(rawMetadata);
|