claudekit-cli 4.5.2-dev.3 → 4.5.2-dev.4
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 +10 -2
- package/dist/index.js +637 -486
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15998,7 +15998,7 @@ var init_kit = __esm(() => {
|
|
|
15998
15998
|
});
|
|
15999
15999
|
|
|
16000
16000
|
// src/types/commands.ts
|
|
16001
|
-
var GlobalOutputOptionsSchema, ExcludePatternSchema, FoldersConfigSchema, DEFAULT_FOLDERS, NewCommandOptionsSchema, UpdateCommandOptionsSchema, VersionCommandOptionsSchema, UninstallCommandOptionsSchema, UpdateCliOptionsSchema, DoctorCommandOptionsSchema, SetupCommandOptionsSchema;
|
|
16001
|
+
var GlobalOutputOptionsSchema, ExcludePatternSchema, FoldersConfigSchema, DEFAULT_FOLDERS, SkillsPackageManagerSchema, NewCommandOptionsSchema, UpdateCommandOptionsSchema, VersionCommandOptionsSchema, UninstallCommandOptionsSchema, UpdateCliOptionsSchema, DoctorCommandOptionsSchema, SetupCommandOptionsSchema;
|
|
16002
16002
|
var init_commands = __esm(() => {
|
|
16003
16003
|
init_zod();
|
|
16004
16004
|
init_kit();
|
|
@@ -16015,6 +16015,7 @@ var init_commands = __esm(() => {
|
|
|
16015
16015
|
docs: "docs",
|
|
16016
16016
|
plans: "plans"
|
|
16017
16017
|
};
|
|
16018
|
+
SkillsPackageManagerSchema = exports_external.enum(["auto", "npm", "bun", "pnpm", "yarn"]).default("auto");
|
|
16018
16019
|
NewCommandOptionsSchema = exports_external.object({
|
|
16019
16020
|
dir: exports_external.string().default("."),
|
|
16020
16021
|
kit: exports_external.string().optional(),
|
|
@@ -16024,6 +16025,7 @@ var init_commands = __esm(() => {
|
|
|
16024
16025
|
opencode: exports_external.boolean().default(false),
|
|
16025
16026
|
gemini: exports_external.boolean().default(false),
|
|
16026
16027
|
installSkills: exports_external.boolean().default(false),
|
|
16028
|
+
packageManager: SkillsPackageManagerSchema,
|
|
16027
16029
|
withSudo: exports_external.boolean().default(false),
|
|
16028
16030
|
prefix: exports_external.boolean().default(false),
|
|
16029
16031
|
beta: exports_external.boolean().default(false),
|
|
@@ -16046,6 +16048,7 @@ var init_commands = __esm(() => {
|
|
|
16046
16048
|
fresh: exports_external.boolean().default(false),
|
|
16047
16049
|
force: exports_external.boolean().default(false),
|
|
16048
16050
|
installSkills: exports_external.boolean().default(false),
|
|
16051
|
+
packageManager: SkillsPackageManagerSchema,
|
|
16049
16052
|
withSudo: exports_external.boolean().default(false),
|
|
16050
16053
|
prefix: exports_external.boolean().default(false),
|
|
16051
16054
|
beta: exports_external.boolean().default(false),
|
|
@@ -16805,6 +16808,7 @@ __export(exports_types, {
|
|
|
16805
16808
|
StatuslineSectionConfigSchema: () => StatuslineSectionConfigSchema,
|
|
16806
16809
|
StatuslineModeSchema: () => StatuslineModeSchema,
|
|
16807
16810
|
StatuslineLayoutSchema: () => StatuslineLayoutSchema,
|
|
16811
|
+
SkillsPackageManagerSchema: () => SkillsPackageManagerSchema,
|
|
16808
16812
|
SkillsMigrationError: () => SkillsMigrationError,
|
|
16809
16813
|
SkillsManifestSchema: () => SkillsManifestSchema,
|
|
16810
16814
|
ServicesListSchema: () => ServicesListSchema,
|
|
@@ -64732,7 +64736,7 @@ var package_default;
|
|
|
64732
64736
|
var init_package = __esm(() => {
|
|
64733
64737
|
package_default = {
|
|
64734
64738
|
name: "claudekit-cli",
|
|
64735
|
-
version: "4.5.2-dev.
|
|
64739
|
+
version: "4.5.2-dev.4",
|
|
64736
64740
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
64737
64741
|
type: "module",
|
|
64738
64742
|
repository: {
|
|
@@ -69045,12 +69049,23 @@ function buildInitArgs(options2) {
|
|
|
69045
69049
|
args.push("--install-mode", options2.installMode);
|
|
69046
69050
|
}
|
|
69047
69051
|
args.push("--install-skills");
|
|
69052
|
+
if (options2.packageManager && options2.packageManager !== "auto") {
|
|
69053
|
+
args.push("--package-manager", options2.packageManager);
|
|
69054
|
+
}
|
|
69048
69055
|
if (options2.beta)
|
|
69049
69056
|
args.push("--beta");
|
|
69050
69057
|
return args;
|
|
69051
69058
|
}
|
|
69052
|
-
function buildInitCommand(isGlobal, kit, beta, yes, restoreCkHooks, installMode) {
|
|
69053
|
-
return `ck ${buildInitArgs({
|
|
69059
|
+
function buildInitCommand(isGlobal, kit, beta, yes, restoreCkHooks, installMode, packageManager) {
|
|
69060
|
+
return `ck ${buildInitArgs({
|
|
69061
|
+
isGlobal,
|
|
69062
|
+
kit,
|
|
69063
|
+
beta,
|
|
69064
|
+
yes,
|
|
69065
|
+
restoreCkHooks,
|
|
69066
|
+
installMode,
|
|
69067
|
+
packageManager
|
|
69068
|
+
}).join(" ")}`;
|
|
69054
69069
|
}
|
|
69055
69070
|
function resolveCkExecutable(platformName = process.platform) {
|
|
69056
69071
|
return platformName === "win32" ? "ck.cmd" : "ck";
|
|
@@ -69129,6 +69144,7 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
69129
69144
|
const findMissingHookDepsFn = deps?.findMissingHookDependenciesFn ?? findMissingHookDependencies;
|
|
69130
69145
|
const detectInstallModeFn = deps?.detectInstallModeFn ?? detectInstallMode;
|
|
69131
69146
|
const hasTrackedPluginSuppliedLegacyFilesFn = deps?.hasTrackedPluginSuppliedLegacyFilesFn ?? hasTrackedPluginSuppliedLegacyFiles;
|
|
69147
|
+
const skillsPackageManager = deps?.skillsPackageManager;
|
|
69132
69148
|
const shouldRefreshCodexPluginFn = deps?.shouldRefreshCodexPluginFn ?? ((options2) => shouldRefreshCodexPlugin(undefined, options2));
|
|
69133
69149
|
const cleanupStaleCodexConfigEntriesFn = deps?.cleanupStaleCodexConfigEntriesFn ?? cleanupStaleCodexConfigEntries;
|
|
69134
69150
|
const setup = await getSetupFn();
|
|
@@ -69309,7 +69325,8 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
69309
69325
|
beta: useBeta,
|
|
69310
69326
|
yes: true,
|
|
69311
69327
|
restoreCkHooks: forceKitReinstall,
|
|
69312
|
-
installMode: installModePreference
|
|
69328
|
+
installMode: installModePreference,
|
|
69329
|
+
packageManager: skillsPackageManager
|
|
69313
69330
|
});
|
|
69314
69331
|
logger.info(`Running: ck ${args.join(" ")}`);
|
|
69315
69332
|
const s = (deps?.spinnerFn ?? de)();
|
|
@@ -69353,7 +69370,8 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
69353
69370
|
kit: selection.kit,
|
|
69354
69371
|
beta: useBeta,
|
|
69355
69372
|
restoreCkHooks: forceKitReinstall,
|
|
69356
|
-
installMode: installModePreference
|
|
69373
|
+
installMode: installModePreference,
|
|
69374
|
+
packageManager: skillsPackageManager
|
|
69357
69375
|
});
|
|
69358
69376
|
const displayCmd = `ck ${args.join(" ")}`;
|
|
69359
69377
|
logger.info(`Running: ${displayCmd}`);
|
|
@@ -69599,16 +69617,18 @@ async function updateCliCommand(options2, deps = getDefaultUpdateCliCommandDeps(
|
|
|
69599
69617
|
registryUrl,
|
|
69600
69618
|
spinnerStop: (msg) => s.stop(msg)
|
|
69601
69619
|
});
|
|
69620
|
+
const skillsPackageManager = pm === "unknown" ? "auto" : pm;
|
|
69621
|
+
const promptKitUpdateWithPackageManager = () => promptKitUpdateFn(targetIsPrerelease, opts.yes, { skillsPackageManager });
|
|
69602
69622
|
const outcome = compareCliVersions(currentVersion, targetVersion, opts);
|
|
69603
69623
|
if (outcome.status === "up-to-date") {
|
|
69604
69624
|
outro(`[+] Already on the latest CLI version (${currentVersion})`);
|
|
69605
|
-
await
|
|
69625
|
+
await promptKitUpdateWithPackageManager();
|
|
69606
69626
|
await promptMigrateUpdateFn();
|
|
69607
69627
|
return;
|
|
69608
69628
|
}
|
|
69609
69629
|
if (outcome.status === "newer") {
|
|
69610
69630
|
outro(`[+] Current version (${currentVersion}) is newer than latest (${targetVersion})`);
|
|
69611
|
-
await
|
|
69631
|
+
await promptKitUpdateWithPackageManager();
|
|
69612
69632
|
await promptMigrateUpdateFn();
|
|
69613
69633
|
return;
|
|
69614
69634
|
}
|
|
@@ -69619,7 +69639,7 @@ async function updateCliCommand(options2, deps = getDefaultUpdateCliCommandDeps(
|
|
|
69619
69639
|
note(`CLI update available: ${currentVersion} -> ${targetVersion}
|
|
69620
69640
|
|
|
69621
69641
|
Run 'ck update' to install`, "Update Check");
|
|
69622
|
-
await
|
|
69642
|
+
await promptKitUpdateWithPackageManager();
|
|
69623
69643
|
await promptMigrateUpdateFn();
|
|
69624
69644
|
outro("Check complete");
|
|
69625
69645
|
return;
|
|
@@ -69646,7 +69666,7 @@ Run 'ck update' to install`, "Update Check");
|
|
|
69646
69666
|
spinnerStop: (msg) => s.stop(msg)
|
|
69647
69667
|
});
|
|
69648
69668
|
outro(`[+] Successfully updated ClaudeKit CLI to ${activeVersion}`);
|
|
69649
|
-
await
|
|
69669
|
+
await promptKitUpdateWithPackageManager();
|
|
69650
69670
|
await promptMigrateUpdateFn();
|
|
69651
69671
|
} catch (error) {
|
|
69652
69672
|
if (error instanceof CliUpdateError) {
|
|
@@ -75781,11 +75801,88 @@ var init_install_error_handler = __esm(() => {
|
|
|
75781
75801
|
];
|
|
75782
75802
|
});
|
|
75783
75803
|
|
|
75784
|
-
// src/services/package-installer/skills-
|
|
75804
|
+
// src/services/package-installer/skills-package-manager.ts
|
|
75805
|
+
import { existsSync as existsSync64 } from "node:fs";
|
|
75806
|
+
import { readFile as readFile49 } from "node:fs/promises";
|
|
75785
75807
|
import { join as join95 } from "node:path";
|
|
75808
|
+
function isSkillsJavascriptPackageManager(value) {
|
|
75809
|
+
return typeof value === "string" && SKILLS_JAVASCRIPT_PACKAGE_MANAGERS.has(value);
|
|
75810
|
+
}
|
|
75811
|
+
function normalizeDetectedPackageManager(packageManager) {
|
|
75812
|
+
return isSkillsJavascriptPackageManager(packageManager) ? packageManager : null;
|
|
75813
|
+
}
|
|
75814
|
+
async function readConfiguredProjectPackageManager(projectDir, isGlobal = false) {
|
|
75815
|
+
const configPath = isGlobal ? join95(projectDir, ".ck.json") : join95(projectDir, ".claude", ".ck.json");
|
|
75816
|
+
if (!existsSync64(configPath))
|
|
75817
|
+
return null;
|
|
75818
|
+
try {
|
|
75819
|
+
const content = await readFile49(configPath, "utf-8");
|
|
75820
|
+
const config = parseJsonContent(content);
|
|
75821
|
+
const project = config.project && typeof config.project === "object" ? config.project : null;
|
|
75822
|
+
const configured = project?.packageManager;
|
|
75823
|
+
return isSkillsJavascriptPackageManager(configured) ? configured : null;
|
|
75824
|
+
} catch (error) {
|
|
75825
|
+
logger.debug(`Could not read project package manager from ${configPath}: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
75826
|
+
return null;
|
|
75827
|
+
}
|
|
75828
|
+
}
|
|
75829
|
+
async function resolveSkillsPackageManager({
|
|
75830
|
+
requested = "auto",
|
|
75831
|
+
projectDir,
|
|
75832
|
+
isGlobal = false,
|
|
75833
|
+
detectPackageManager: detectPackageManager2 = PackageManagerDetector.detect
|
|
75834
|
+
} = {}) {
|
|
75835
|
+
if (requested !== "auto") {
|
|
75836
|
+
return {
|
|
75837
|
+
packageManager: requested,
|
|
75838
|
+
source: "explicit"
|
|
75839
|
+
};
|
|
75840
|
+
}
|
|
75841
|
+
if (projectDir && !isGlobal) {
|
|
75842
|
+
const projectPackageManager = await readConfiguredProjectPackageManager(projectDir, isGlobal);
|
|
75843
|
+
if (projectPackageManager) {
|
|
75844
|
+
return {
|
|
75845
|
+
packageManager: projectPackageManager,
|
|
75846
|
+
source: "project"
|
|
75847
|
+
};
|
|
75848
|
+
}
|
|
75849
|
+
}
|
|
75850
|
+
const detectedPackageManager = normalizeDetectedPackageManager(await detectPackageManager2());
|
|
75851
|
+
if (detectedPackageManager) {
|
|
75852
|
+
return {
|
|
75853
|
+
packageManager: detectedPackageManager,
|
|
75854
|
+
source: "detected"
|
|
75855
|
+
};
|
|
75856
|
+
}
|
|
75857
|
+
return {
|
|
75858
|
+
packageManager: "npm",
|
|
75859
|
+
source: "fallback"
|
|
75860
|
+
};
|
|
75861
|
+
}
|
|
75862
|
+
var SKILLS_JAVASCRIPT_PACKAGE_MANAGERS;
|
|
75863
|
+
var init_skills_package_manager = __esm(() => {
|
|
75864
|
+
init_package_manager_detector();
|
|
75865
|
+
init_logger();
|
|
75866
|
+
SKILLS_JAVASCRIPT_PACKAGE_MANAGERS = new Set([
|
|
75867
|
+
"npm",
|
|
75868
|
+
"bun",
|
|
75869
|
+
"pnpm",
|
|
75870
|
+
"yarn"
|
|
75871
|
+
]);
|
|
75872
|
+
});
|
|
75873
|
+
|
|
75874
|
+
// src/services/package-installer/skills-installer.ts
|
|
75875
|
+
import { join as join96 } from "node:path";
|
|
75786
75876
|
async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
75787
|
-
const {
|
|
75877
|
+
const {
|
|
75878
|
+
skipConfirm = false,
|
|
75879
|
+
packageManager = "auto",
|
|
75880
|
+
projectDir,
|
|
75881
|
+
isGlobal = false,
|
|
75882
|
+
withSudo = false
|
|
75883
|
+
} = options2;
|
|
75788
75884
|
const displayName = "Skills Dependencies";
|
|
75885
|
+
let manualGlobalInstallCommand = "npm install -g pnpm wrangler repomix";
|
|
75789
75886
|
if (isCIEnvironment()) {
|
|
75790
75887
|
logger.info("CI environment detected: skipping skills installation");
|
|
75791
75888
|
return {
|
|
@@ -75804,11 +75901,11 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75804
75901
|
};
|
|
75805
75902
|
}
|
|
75806
75903
|
try {
|
|
75807
|
-
const { existsSync:
|
|
75904
|
+
const { existsSync: existsSync65 } = await import("node:fs");
|
|
75808
75905
|
const clack = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
75809
75906
|
const platform10 = process.platform;
|
|
75810
75907
|
const scriptName = platform10 === "win32" ? "install.ps1" : "install.sh";
|
|
75811
|
-
const scriptPath =
|
|
75908
|
+
const scriptPath = join96(skillsDir2, scriptName);
|
|
75812
75909
|
try {
|
|
75813
75910
|
validateScriptPath(skillsDir2, scriptPath);
|
|
75814
75911
|
} catch (error) {
|
|
@@ -75820,11 +75917,11 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75820
75917
|
error: `Path validation failed: ${errorMessage}`
|
|
75821
75918
|
};
|
|
75822
75919
|
}
|
|
75823
|
-
if (!
|
|
75920
|
+
if (!existsSync65(scriptPath)) {
|
|
75824
75921
|
logger.warning(`Skills installation script not found: ${scriptPath}`);
|
|
75825
75922
|
logger.info("");
|
|
75826
75923
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
75827
|
-
logger.info(` See: ${
|
|
75924
|
+
logger.info(` See: ${join96(skillsDir2, "INSTALLATION.md")}`);
|
|
75828
75925
|
logger.info("");
|
|
75829
75926
|
logger.info("Quick start:");
|
|
75830
75927
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -75838,10 +75935,21 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75838
75935
|
logger.warning("Installation script will execute with user privileges");
|
|
75839
75936
|
logger.info(` Script: ${scriptPath}`);
|
|
75840
75937
|
logger.info(` Platform: ${platform10 === "win32" ? "Windows (PowerShell)" : "Unix (bash)"}`);
|
|
75938
|
+
const resolvedPackageManager = await resolveSkillsPackageManager({
|
|
75939
|
+
requested: packageManager,
|
|
75940
|
+
projectDir,
|
|
75941
|
+
isGlobal
|
|
75942
|
+
});
|
|
75943
|
+
logger.info(` JavaScript package manager: ${resolvedPackageManager.packageManager} (${resolvedPackageManager.source})`);
|
|
75944
|
+
manualGlobalInstallCommand = buildGlobalInstallCommand(resolvedPackageManager.packageManager, [
|
|
75945
|
+
"pnpm",
|
|
75946
|
+
"wrangler",
|
|
75947
|
+
"repomix"
|
|
75948
|
+
]);
|
|
75841
75949
|
if (logger.isVerbose()) {
|
|
75842
75950
|
try {
|
|
75843
|
-
const { readFile:
|
|
75844
|
-
const scriptContent = await
|
|
75951
|
+
const { readFile: readFile50 } = await import("node:fs/promises");
|
|
75952
|
+
const scriptContent = await readFile50(scriptPath, "utf-8");
|
|
75845
75953
|
const previewLines = scriptContent.split(`
|
|
75846
75954
|
`).slice(0, 20);
|
|
75847
75955
|
logger.verbose("Script preview (first 20 lines):");
|
|
@@ -75871,7 +75979,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75871
75979
|
logger.info(` ${platform10 === "win32" ? `powershell -File "${scriptPath}"` : `bash ${scriptPath}`}`);
|
|
75872
75980
|
logger.info("");
|
|
75873
75981
|
logger.info("Or see complete guide:");
|
|
75874
|
-
logger.info(` ${
|
|
75982
|
+
logger.info(` ${join96(skillsDir2, "INSTALLATION.md")}`);
|
|
75875
75983
|
return {
|
|
75876
75984
|
success: false,
|
|
75877
75985
|
package: displayName,
|
|
@@ -75880,7 +75988,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75880
75988
|
}
|
|
75881
75989
|
logger.info(`Installing ${displayName}...`);
|
|
75882
75990
|
logger.info(`Running: ${scriptPath}`);
|
|
75883
|
-
const scriptArgs = ["--yes"];
|
|
75991
|
+
const scriptArgs = ["--yes", "--package-manager", resolvedPackageManager.packageManager];
|
|
75884
75992
|
if (hasInstallState(skillsDir2)) {
|
|
75885
75993
|
if (skipConfirm || isNonInteractive()) {
|
|
75886
75994
|
logger.info("Resuming previous installation...");
|
|
@@ -75943,10 +76051,20 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75943
76051
|
}
|
|
75944
76052
|
const scriptEnv = {
|
|
75945
76053
|
...process.env,
|
|
76054
|
+
CK_SKILLS_PACKAGE_MANAGER: resolvedPackageManager.packageManager,
|
|
75946
76055
|
NON_INTERACTIVE: "1"
|
|
75947
76056
|
};
|
|
75948
76057
|
if (platform10 === "win32") {
|
|
75949
|
-
await executeInteractiveScript("powershell.exe", [
|
|
76058
|
+
await executeInteractiveScript("powershell.exe", [
|
|
76059
|
+
"-NoLogo",
|
|
76060
|
+
"-ExecutionPolicy",
|
|
76061
|
+
"Bypass",
|
|
76062
|
+
"-File",
|
|
76063
|
+
scriptPath,
|
|
76064
|
+
"-Y",
|
|
76065
|
+
"-JsPackageManager",
|
|
76066
|
+
resolvedPackageManager.packageManager
|
|
76067
|
+
], {
|
|
75950
76068
|
timeout: 600000,
|
|
75951
76069
|
cwd: skillsDir2,
|
|
75952
76070
|
env: scriptEnv
|
|
@@ -75992,7 +76110,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75992
76110
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
75993
76111
|
logger.info("");
|
|
75994
76112
|
logger.info("See complete guide:");
|
|
75995
|
-
logger.info(` cat ${
|
|
76113
|
+
logger.info(` cat ${join96(skillsDir2, "INSTALLATION.md")}`);
|
|
75996
76114
|
logger.info("");
|
|
75997
76115
|
logger.info("Quick start:");
|
|
75998
76116
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -76001,7 +76119,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
76001
76119
|
logger.info("System tools (optional):");
|
|
76002
76120
|
logger.info(" macOS: brew install ffmpeg imagemagick");
|
|
76003
76121
|
logger.info(" Linux: sudo apt-get install ffmpeg imagemagick");
|
|
76004
|
-
logger.info(
|
|
76122
|
+
logger.info(` Node.js: ${manualGlobalInstallCommand}`);
|
|
76005
76123
|
return {
|
|
76006
76124
|
success: false,
|
|
76007
76125
|
package: displayName,
|
|
@@ -76009,6 +76127,21 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
76009
76127
|
};
|
|
76010
76128
|
}
|
|
76011
76129
|
}
|
|
76130
|
+
function buildGlobalInstallCommand(packageManager, packages) {
|
|
76131
|
+
const packageList = packages.join(" ");
|
|
76132
|
+
switch (packageManager) {
|
|
76133
|
+
case "bun":
|
|
76134
|
+
return `bun add -g ${packageList}`;
|
|
76135
|
+
case "pnpm":
|
|
76136
|
+
return `pnpm add -g ${packageList}`;
|
|
76137
|
+
case "yarn":
|
|
76138
|
+
return `yarn global add ${packageList}`;
|
|
76139
|
+
case "npm":
|
|
76140
|
+
return `npm install -g ${packageList}`;
|
|
76141
|
+
}
|
|
76142
|
+
const exhaustive = packageManager;
|
|
76143
|
+
return exhaustive;
|
|
76144
|
+
}
|
|
76012
76145
|
async function handleSkillsInstallation(skillsDir2, options2 = {}) {
|
|
76013
76146
|
try {
|
|
76014
76147
|
const skillsResult = await installSkillsDependencies(skillsDir2, options2);
|
|
@@ -76032,16 +76165,17 @@ var init_skills_installer2 = __esm(() => {
|
|
|
76032
76165
|
init_logger();
|
|
76033
76166
|
init_install_error_handler();
|
|
76034
76167
|
init_process_executor();
|
|
76168
|
+
init_skills_package_manager();
|
|
76035
76169
|
init_validators();
|
|
76036
76170
|
});
|
|
76037
76171
|
|
|
76038
76172
|
// src/services/package-installer/agy-mcp/config-manager.ts
|
|
76039
|
-
import { existsSync as
|
|
76040
|
-
import { mkdir as mkdir23, readFile as
|
|
76041
|
-
import { dirname as dirname34, join as
|
|
76173
|
+
import { existsSync as existsSync65 } from "node:fs";
|
|
76174
|
+
import { mkdir as mkdir23, readFile as readFile50, writeFile as writeFile25 } from "node:fs/promises";
|
|
76175
|
+
import { dirname as dirname34, join as join97 } from "node:path";
|
|
76042
76176
|
async function readJsonFile(filePath) {
|
|
76043
76177
|
try {
|
|
76044
|
-
const content = await
|
|
76178
|
+
const content = await readFile50(filePath, "utf-8");
|
|
76045
76179
|
return JSON.parse(content);
|
|
76046
76180
|
} catch (error) {
|
|
76047
76181
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -76050,11 +76184,11 @@ async function readJsonFile(filePath) {
|
|
|
76050
76184
|
}
|
|
76051
76185
|
}
|
|
76052
76186
|
async function addAgyToGitignore(projectDir) {
|
|
76053
|
-
const gitignorePath =
|
|
76187
|
+
const gitignorePath = join97(projectDir, ".gitignore");
|
|
76054
76188
|
try {
|
|
76055
76189
|
let content = "";
|
|
76056
|
-
if (
|
|
76057
|
-
content = await
|
|
76190
|
+
if (existsSync65(gitignorePath)) {
|
|
76191
|
+
content = await readFile50(gitignorePath, "utf-8");
|
|
76058
76192
|
const lines = content.split(`
|
|
76059
76193
|
`).map((line) => line.trim()).filter((line) => !line.startsWith("#"));
|
|
76060
76194
|
const agyPatterns = [
|
|
@@ -76082,7 +76216,7 @@ ${AGY_GITIGNORE_PATTERN}
|
|
|
76082
76216
|
}
|
|
76083
76217
|
async function createNewSettingsWithMerge(agyConfigPath, mcpConfigPath) {
|
|
76084
76218
|
const linkDir = dirname34(agyConfigPath);
|
|
76085
|
-
if (!
|
|
76219
|
+
if (!existsSync65(linkDir)) {
|
|
76086
76220
|
await mkdir23(linkDir, { recursive: true });
|
|
76087
76221
|
logger.debug(`Created directory: ${linkDir}`);
|
|
76088
76222
|
}
|
|
@@ -76148,23 +76282,23 @@ var init_config_manager2 = __esm(() => {
|
|
|
76148
76282
|
});
|
|
76149
76283
|
|
|
76150
76284
|
// src/services/package-installer/agy-mcp/validation.ts
|
|
76151
|
-
import { existsSync as
|
|
76285
|
+
import { existsSync as existsSync66, lstatSync, readlinkSync } from "node:fs";
|
|
76152
76286
|
import { homedir as homedir45 } from "node:os";
|
|
76153
|
-
import { join as
|
|
76287
|
+
import { join as join98 } from "node:path";
|
|
76154
76288
|
function getGlobalMcpConfigPath() {
|
|
76155
|
-
return
|
|
76289
|
+
return join98(homedir45(), ".claude", ".mcp.json");
|
|
76156
76290
|
}
|
|
76157
76291
|
function getLocalMcpConfigPath(projectDir) {
|
|
76158
|
-
return
|
|
76292
|
+
return join98(projectDir, ".mcp.json");
|
|
76159
76293
|
}
|
|
76160
76294
|
function findMcpConfigPath(projectDir) {
|
|
76161
76295
|
const localPath = getLocalMcpConfigPath(projectDir);
|
|
76162
|
-
if (
|
|
76296
|
+
if (existsSync66(localPath)) {
|
|
76163
76297
|
logger.debug(`Found local MCP config: ${localPath}`);
|
|
76164
76298
|
return localPath;
|
|
76165
76299
|
}
|
|
76166
76300
|
const globalPath = getGlobalMcpConfigPath();
|
|
76167
|
-
if (
|
|
76301
|
+
if (existsSync66(globalPath)) {
|
|
76168
76302
|
logger.debug(`Found global MCP config: ${globalPath}`);
|
|
76169
76303
|
return globalPath;
|
|
76170
76304
|
}
|
|
@@ -76173,13 +76307,13 @@ function findMcpConfigPath(projectDir) {
|
|
|
76173
76307
|
}
|
|
76174
76308
|
function getAgyMcpConfigPath(projectDir, isGlobal) {
|
|
76175
76309
|
if (isGlobal) {
|
|
76176
|
-
return
|
|
76310
|
+
return join98(homedir45(), ".gemini", "config", "mcp_config.json");
|
|
76177
76311
|
}
|
|
76178
|
-
return
|
|
76312
|
+
return join98(projectDir, ".agents", "mcp_config.json");
|
|
76179
76313
|
}
|
|
76180
76314
|
function checkExistingAgyConfig(projectDir, isGlobal = false) {
|
|
76181
76315
|
const agyConfigPath = getAgyMcpConfigPath(projectDir, isGlobal);
|
|
76182
|
-
if (!
|
|
76316
|
+
if (!existsSync66(agyConfigPath)) {
|
|
76183
76317
|
return { exists: false, isSymlink: false, settingsPath: agyConfigPath };
|
|
76184
76318
|
}
|
|
76185
76319
|
try {
|
|
@@ -76203,12 +76337,12 @@ var init_validation = __esm(() => {
|
|
|
76203
76337
|
});
|
|
76204
76338
|
|
|
76205
76339
|
// src/services/package-installer/agy-mcp/linker-core.ts
|
|
76206
|
-
import { existsSync as
|
|
76340
|
+
import { existsSync as existsSync67 } from "node:fs";
|
|
76207
76341
|
import { mkdir as mkdir24, symlink as symlink3 } from "node:fs/promises";
|
|
76208
|
-
import { dirname as dirname35, join as
|
|
76342
|
+
import { dirname as dirname35, join as join99 } from "node:path";
|
|
76209
76343
|
async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
76210
76344
|
const linkDir = dirname35(linkPath);
|
|
76211
|
-
if (!
|
|
76345
|
+
if (!existsSync67(linkDir)) {
|
|
76212
76346
|
await mkdir24(linkDir, { recursive: true });
|
|
76213
76347
|
logger.debug(`Created directory: ${linkDir}`);
|
|
76214
76348
|
}
|
|
@@ -76216,7 +76350,7 @@ async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
|
76216
76350
|
if (isGlobal) {
|
|
76217
76351
|
symlinkTarget = getGlobalMcpConfigPath();
|
|
76218
76352
|
} else {
|
|
76219
|
-
const localMcpPath =
|
|
76353
|
+
const localMcpPath = join99(projectDir, ".mcp.json");
|
|
76220
76354
|
const isLocalConfig = targetPath === localMcpPath;
|
|
76221
76355
|
symlinkTarget = isLocalConfig ? "../.mcp.json" : targetPath;
|
|
76222
76356
|
}
|
|
@@ -78632,11 +78766,11 @@ __export(exports_worktree_manager, {
|
|
|
78632
78766
|
createWorktree: () => createWorktree,
|
|
78633
78767
|
cleanupAllWorktrees: () => cleanupAllWorktrees
|
|
78634
78768
|
});
|
|
78635
|
-
import { existsSync as
|
|
78636
|
-
import { readFile as
|
|
78637
|
-
import { join as
|
|
78769
|
+
import { existsSync as existsSync79 } from "node:fs";
|
|
78770
|
+
import { readFile as readFile71, writeFile as writeFile41 } from "node:fs/promises";
|
|
78771
|
+
import { join as join163 } from "node:path";
|
|
78638
78772
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
78639
|
-
const worktreePath =
|
|
78773
|
+
const worktreePath = join163(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
78640
78774
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
78641
78775
|
await spawnAndCollect("git", ["fetch", "origin", baseBranch], projectDir).catch(() => {
|
|
78642
78776
|
logger.warning(`[worktree] Could not fetch origin/${baseBranch}, using local`);
|
|
@@ -78654,7 +78788,7 @@ async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
|
78654
78788
|
return worktreePath;
|
|
78655
78789
|
}
|
|
78656
78790
|
async function removeWorktree(projectDir, issueNumber) {
|
|
78657
|
-
const worktreePath =
|
|
78791
|
+
const worktreePath = join163(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
78658
78792
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
78659
78793
|
try {
|
|
78660
78794
|
await spawnAndCollect("git", ["worktree", "remove", worktreePath, "--force"], projectDir);
|
|
@@ -78668,7 +78802,7 @@ async function listActiveWorktrees(projectDir) {
|
|
|
78668
78802
|
try {
|
|
78669
78803
|
const output2 = await spawnAndCollect("git", ["worktree", "list", "--porcelain"], projectDir);
|
|
78670
78804
|
const issueNumbers = [];
|
|
78671
|
-
const worktreePrefix =
|
|
78805
|
+
const worktreePrefix = join163(projectDir, WORKTREE_DIR, "issue-").replace(/\\/g, "/");
|
|
78672
78806
|
for (const line of output2.split(`
|
|
78673
78807
|
`)) {
|
|
78674
78808
|
if (line.startsWith("worktree ")) {
|
|
@@ -78696,9 +78830,9 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
78696
78830
|
await spawnAndCollect("git", ["worktree", "prune"], projectDir).catch(() => {});
|
|
78697
78831
|
}
|
|
78698
78832
|
async function ensureGitignore(projectDir) {
|
|
78699
|
-
const gitignorePath =
|
|
78833
|
+
const gitignorePath = join163(projectDir, ".gitignore");
|
|
78700
78834
|
try {
|
|
78701
|
-
const content =
|
|
78835
|
+
const content = existsSync79(gitignorePath) ? await readFile71(gitignorePath, "utf-8") : "";
|
|
78702
78836
|
if (!content.includes(".worktrees")) {
|
|
78703
78837
|
const newContent = content.endsWith(`
|
|
78704
78838
|
`) ? `${content}.worktrees/
|
|
@@ -78800,13 +78934,13 @@ var init_content_validator = __esm(() => {
|
|
|
78800
78934
|
|
|
78801
78935
|
// src/commands/content/phases/context-cache-manager.ts
|
|
78802
78936
|
import { createHash as createHash11 } from "node:crypto";
|
|
78803
|
-
import { existsSync as
|
|
78937
|
+
import { existsSync as existsSync85, mkdirSync as mkdirSync7, readFileSync as readFileSync25, readdirSync as readdirSync15, statSync as statSync15 } from "node:fs";
|
|
78804
78938
|
import { rename as rename16, writeFile as writeFile43 } from "node:fs/promises";
|
|
78805
78939
|
import { homedir as homedir54 } from "node:os";
|
|
78806
|
-
import { basename as basename34, join as
|
|
78940
|
+
import { basename as basename34, join as join170 } from "node:path";
|
|
78807
78941
|
function getCachedContext(repoPath) {
|
|
78808
78942
|
const cachePath = getCacheFilePath(repoPath);
|
|
78809
|
-
if (!
|
|
78943
|
+
if (!existsSync85(cachePath))
|
|
78810
78944
|
return null;
|
|
78811
78945
|
try {
|
|
78812
78946
|
const raw2 = readFileSync25(cachePath, "utf-8");
|
|
@@ -78823,7 +78957,7 @@ function getCachedContext(repoPath) {
|
|
|
78823
78957
|
}
|
|
78824
78958
|
}
|
|
78825
78959
|
async function saveCachedContext(repoPath, cache5) {
|
|
78826
|
-
if (!
|
|
78960
|
+
if (!existsSync85(CACHE_DIR)) {
|
|
78827
78961
|
mkdirSync7(CACHE_DIR, { recursive: true });
|
|
78828
78962
|
}
|
|
78829
78963
|
const cachePath = getCacheFilePath(repoPath);
|
|
@@ -78846,25 +78980,25 @@ function computeSourceHash(repoPath) {
|
|
|
78846
78980
|
}
|
|
78847
78981
|
function getDocSourcePaths(repoPath) {
|
|
78848
78982
|
const paths = [];
|
|
78849
|
-
const docsDir =
|
|
78850
|
-
if (
|
|
78983
|
+
const docsDir = join170(repoPath, "docs");
|
|
78984
|
+
if (existsSync85(docsDir)) {
|
|
78851
78985
|
try {
|
|
78852
78986
|
const files = readdirSync15(docsDir);
|
|
78853
78987
|
for (const f3 of files) {
|
|
78854
78988
|
if (f3.endsWith(".md"))
|
|
78855
|
-
paths.push(
|
|
78989
|
+
paths.push(join170(docsDir, f3));
|
|
78856
78990
|
}
|
|
78857
78991
|
} catch {}
|
|
78858
78992
|
}
|
|
78859
|
-
const readme =
|
|
78860
|
-
if (
|
|
78993
|
+
const readme = join170(repoPath, "README.md");
|
|
78994
|
+
if (existsSync85(readme))
|
|
78861
78995
|
paths.push(readme);
|
|
78862
|
-
const stylesDir =
|
|
78863
|
-
if (
|
|
78996
|
+
const stylesDir = join170(repoPath, "assets", "writing-styles");
|
|
78997
|
+
if (existsSync85(stylesDir)) {
|
|
78864
78998
|
try {
|
|
78865
78999
|
const files = readdirSync15(stylesDir);
|
|
78866
79000
|
for (const f3 of files) {
|
|
78867
|
-
paths.push(
|
|
79001
|
+
paths.push(join170(stylesDir, f3));
|
|
78868
79002
|
}
|
|
78869
79003
|
} catch {}
|
|
78870
79004
|
}
|
|
@@ -78873,11 +79007,11 @@ function getDocSourcePaths(repoPath) {
|
|
|
78873
79007
|
function getCacheFilePath(repoPath) {
|
|
78874
79008
|
const repoName = basename34(repoPath).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
78875
79009
|
const pathHash = createHash11("sha256").update(repoPath).digest("hex").slice(0, 8);
|
|
78876
|
-
return
|
|
79010
|
+
return join170(CACHE_DIR, `${repoName}-${pathHash}-context-cache.json`);
|
|
78877
79011
|
}
|
|
78878
79012
|
var CACHE_DIR, CACHE_TTL_MS5;
|
|
78879
79013
|
var init_context_cache_manager = __esm(() => {
|
|
78880
|
-
CACHE_DIR =
|
|
79014
|
+
CACHE_DIR = join170(homedir54(), ".claudekit", "cache");
|
|
78881
79015
|
CACHE_TTL_MS5 = 24 * 60 * 60 * 1000;
|
|
78882
79016
|
});
|
|
78883
79017
|
|
|
@@ -79057,8 +79191,8 @@ function extractContentFromResponse(response) {
|
|
|
79057
79191
|
|
|
79058
79192
|
// src/commands/content/phases/docs-summarizer.ts
|
|
79059
79193
|
import { execSync as execSync7 } from "node:child_process";
|
|
79060
|
-
import { existsSync as
|
|
79061
|
-
import { join as
|
|
79194
|
+
import { existsSync as existsSync86, readFileSync as readFileSync26, readdirSync as readdirSync16 } from "node:fs";
|
|
79195
|
+
import { join as join171 } from "node:path";
|
|
79062
79196
|
async function summarizeProjectDocs(repoPath, contentLogger) {
|
|
79063
79197
|
const rawContent = collectRawDocs(repoPath);
|
|
79064
79198
|
if (rawContent.total.length < 200) {
|
|
@@ -79102,7 +79236,7 @@ async function summarizeProjectDocs(repoPath, contentLogger) {
|
|
|
79102
79236
|
function collectRawDocs(repoPath) {
|
|
79103
79237
|
let totalChars = 0;
|
|
79104
79238
|
const readCapped = (filePath, maxChars) => {
|
|
79105
|
-
if (!
|
|
79239
|
+
if (!existsSync86(filePath))
|
|
79106
79240
|
return "";
|
|
79107
79241
|
if (totalChars >= MAX_RAW_CONTENT_CHARS)
|
|
79108
79242
|
return "";
|
|
@@ -79112,12 +79246,12 @@ function collectRawDocs(repoPath) {
|
|
|
79112
79246
|
return capped;
|
|
79113
79247
|
};
|
|
79114
79248
|
const docsContent = [];
|
|
79115
|
-
const docsDir =
|
|
79116
|
-
if (
|
|
79249
|
+
const docsDir = join171(repoPath, "docs");
|
|
79250
|
+
if (existsSync86(docsDir)) {
|
|
79117
79251
|
try {
|
|
79118
79252
|
const files = readdirSync16(docsDir).filter((f3) => f3.endsWith(".md")).sort();
|
|
79119
79253
|
for (const f3 of files) {
|
|
79120
|
-
const content = readCapped(
|
|
79254
|
+
const content = readCapped(join171(docsDir, f3), 5000);
|
|
79121
79255
|
if (content) {
|
|
79122
79256
|
docsContent.push(`### ${f3}
|
|
79123
79257
|
${content}`);
|
|
@@ -79131,21 +79265,21 @@ ${content}`);
|
|
|
79131
79265
|
let brand = "";
|
|
79132
79266
|
const brandCandidates = ["docs/brand-guidelines.md", "docs/design-guidelines.md"];
|
|
79133
79267
|
for (const p of brandCandidates) {
|
|
79134
|
-
brand = readCapped(
|
|
79268
|
+
brand = readCapped(join171(repoPath, p), 3000);
|
|
79135
79269
|
if (brand)
|
|
79136
79270
|
break;
|
|
79137
79271
|
}
|
|
79138
79272
|
let styles3 = "";
|
|
79139
|
-
const stylesDir =
|
|
79140
|
-
if (
|
|
79273
|
+
const stylesDir = join171(repoPath, "assets", "writing-styles");
|
|
79274
|
+
if (existsSync86(stylesDir)) {
|
|
79141
79275
|
try {
|
|
79142
79276
|
const files = readdirSync16(stylesDir).slice(0, 3);
|
|
79143
|
-
styles3 = files.map((f3) => readCapped(
|
|
79277
|
+
styles3 = files.map((f3) => readCapped(join171(stylesDir, f3), 1000)).filter(Boolean).join(`
|
|
79144
79278
|
|
|
79145
79279
|
`);
|
|
79146
79280
|
} catch {}
|
|
79147
79281
|
}
|
|
79148
|
-
const readme = readCapped(
|
|
79282
|
+
const readme = readCapped(join171(repoPath, "README.md"), 3000);
|
|
79149
79283
|
const total = [docs, brand, styles3, readme].join(`
|
|
79150
79284
|
`);
|
|
79151
79285
|
return { docs, brand, styles: styles3, readme, total };
|
|
@@ -79330,12 +79464,12 @@ IMPORTANT: Generate the image and output the path as JSON: {"imagePath": "/path/
|
|
|
79330
79464
|
|
|
79331
79465
|
// src/commands/content/phases/photo-generator.ts
|
|
79332
79466
|
import { execSync as execSync8 } from "node:child_process";
|
|
79333
|
-
import { existsSync as
|
|
79467
|
+
import { existsSync as existsSync87, mkdirSync as mkdirSync8, readdirSync as readdirSync17 } from "node:fs";
|
|
79334
79468
|
import { homedir as homedir55 } from "node:os";
|
|
79335
|
-
import { join as
|
|
79469
|
+
import { join as join172 } from "node:path";
|
|
79336
79470
|
async function generatePhoto(_content, context, config, platform18, contentId, contentLogger) {
|
|
79337
|
-
const mediaDir =
|
|
79338
|
-
if (!
|
|
79471
|
+
const mediaDir = join172(config.contentDir.replace(/^~/, homedir55()), "media", String(contentId));
|
|
79472
|
+
if (!existsSync87(mediaDir)) {
|
|
79339
79473
|
mkdirSync8(mediaDir, { recursive: true });
|
|
79340
79474
|
}
|
|
79341
79475
|
const prompt = buildPhotoPrompt(context, platform18);
|
|
@@ -79351,7 +79485,7 @@ async function generatePhoto(_content, context, config, platform18, contentId, c
|
|
|
79351
79485
|
const parsed = parseClaudeJsonOutput(result);
|
|
79352
79486
|
if (parsed && typeof parsed === "object" && "imagePath" in parsed) {
|
|
79353
79487
|
const imagePath = String(parsed.imagePath);
|
|
79354
|
-
if (
|
|
79488
|
+
if (existsSync87(imagePath)) {
|
|
79355
79489
|
return { path: imagePath, ...dimensions, format: "png" };
|
|
79356
79490
|
}
|
|
79357
79491
|
}
|
|
@@ -79359,7 +79493,7 @@ async function generatePhoto(_content, context, config, platform18, contentId, c
|
|
|
79359
79493
|
const imageFile = files.find((f3) => /\.(png|jpg|jpeg|webp)$/i.test(f3));
|
|
79360
79494
|
if (imageFile) {
|
|
79361
79495
|
const ext2 = imageFile.split(".").pop() ?? "png";
|
|
79362
|
-
return { path:
|
|
79496
|
+
return { path: join172(mediaDir, imageFile), ...dimensions, format: ext2 };
|
|
79363
79497
|
}
|
|
79364
79498
|
contentLogger.warn(`Photo generation produced no image for content ${contentId}`);
|
|
79365
79499
|
return null;
|
|
@@ -79447,9 +79581,9 @@ var init_content_creator = __esm(() => {
|
|
|
79447
79581
|
});
|
|
79448
79582
|
|
|
79449
79583
|
// src/commands/content/phases/content-logger.ts
|
|
79450
|
-
import { createWriteStream as createWriteStream4, existsSync as
|
|
79584
|
+
import { createWriteStream as createWriteStream4, existsSync as existsSync88, mkdirSync as mkdirSync9, statSync as statSync16 } from "node:fs";
|
|
79451
79585
|
import { homedir as homedir56 } from "node:os";
|
|
79452
|
-
import { join as
|
|
79586
|
+
import { join as join173 } from "node:path";
|
|
79453
79587
|
|
|
79454
79588
|
class ContentLogger {
|
|
79455
79589
|
stream = null;
|
|
@@ -79457,11 +79591,11 @@ class ContentLogger {
|
|
|
79457
79591
|
logDir;
|
|
79458
79592
|
maxBytes;
|
|
79459
79593
|
constructor(maxBytes = 0) {
|
|
79460
|
-
this.logDir =
|
|
79594
|
+
this.logDir = join173(homedir56(), ".claudekit", "logs");
|
|
79461
79595
|
this.maxBytes = maxBytes;
|
|
79462
79596
|
}
|
|
79463
79597
|
init() {
|
|
79464
|
-
if (!
|
|
79598
|
+
if (!existsSync88(this.logDir)) {
|
|
79465
79599
|
mkdirSync9(this.logDir, { recursive: true });
|
|
79466
79600
|
}
|
|
79467
79601
|
this.rotateIfNeeded();
|
|
@@ -79489,7 +79623,7 @@ class ContentLogger {
|
|
|
79489
79623
|
}
|
|
79490
79624
|
}
|
|
79491
79625
|
getLogPath() {
|
|
79492
|
-
return
|
|
79626
|
+
return join173(this.logDir, `content-${this.getDateStr()}.log`);
|
|
79493
79627
|
}
|
|
79494
79628
|
write(level, message) {
|
|
79495
79629
|
this.rotateIfNeeded();
|
|
@@ -79506,18 +79640,18 @@ class ContentLogger {
|
|
|
79506
79640
|
if (dateStr !== this.currentDate) {
|
|
79507
79641
|
this.close();
|
|
79508
79642
|
this.currentDate = dateStr;
|
|
79509
|
-
const logPath =
|
|
79643
|
+
const logPath = join173(this.logDir, `content-${dateStr}.log`);
|
|
79510
79644
|
this.stream = createWriteStream4(logPath, { flags: "a", mode: 384 });
|
|
79511
79645
|
return;
|
|
79512
79646
|
}
|
|
79513
79647
|
if (this.maxBytes > 0 && this.stream) {
|
|
79514
|
-
const logPath =
|
|
79648
|
+
const logPath = join173(this.logDir, `content-${this.currentDate}.log`);
|
|
79515
79649
|
try {
|
|
79516
79650
|
const stat26 = statSync16(logPath);
|
|
79517
79651
|
if (stat26.size >= this.maxBytes) {
|
|
79518
79652
|
this.close();
|
|
79519
79653
|
const suffix = Date.now();
|
|
79520
|
-
const rotatedPath =
|
|
79654
|
+
const rotatedPath = join173(this.logDir, `content-${this.currentDate}-${suffix}.log`);
|
|
79521
79655
|
import("node:fs/promises").then(({ rename: rename17 }) => rename17(logPath, rotatedPath).catch(() => {}));
|
|
79522
79656
|
this.stream = createWriteStream4(logPath, { flags: "w", mode: 384 });
|
|
79523
79657
|
}
|
|
@@ -79599,7 +79733,7 @@ var init_sqlite_client = __esm(() => {
|
|
|
79599
79733
|
});
|
|
79600
79734
|
|
|
79601
79735
|
// src/commands/content/phases/db-manager.ts
|
|
79602
|
-
import { existsSync as
|
|
79736
|
+
import { existsSync as existsSync89, mkdirSync as mkdirSync10 } from "node:fs";
|
|
79603
79737
|
import { dirname as dirname56 } from "node:path";
|
|
79604
79738
|
function initDatabase(dbPath) {
|
|
79605
79739
|
ensureParentDir(dbPath);
|
|
@@ -79622,7 +79756,7 @@ function runRetentionCleanup(db, retentionDays = 90) {
|
|
|
79622
79756
|
}
|
|
79623
79757
|
function ensureParentDir(dbPath) {
|
|
79624
79758
|
const dir = dirname56(dbPath);
|
|
79625
|
-
if (dir && !
|
|
79759
|
+
if (dir && !existsSync89(dir)) {
|
|
79626
79760
|
mkdirSync10(dir, { recursive: true });
|
|
79627
79761
|
}
|
|
79628
79762
|
}
|
|
@@ -79787,8 +79921,8 @@ function isNoiseCommit(title, author) {
|
|
|
79787
79921
|
|
|
79788
79922
|
// src/commands/content/phases/change-detector.ts
|
|
79789
79923
|
import { execSync as execSync10, spawnSync as spawnSync9 } from "node:child_process";
|
|
79790
|
-
import { existsSync as
|
|
79791
|
-
import { join as
|
|
79924
|
+
import { existsSync as existsSync90, readFileSync as readFileSync27, readdirSync as readdirSync18, statSync as statSync17 } from "node:fs";
|
|
79925
|
+
import { join as join174 } from "node:path";
|
|
79792
79926
|
function detectCommits(repo, since) {
|
|
79793
79927
|
try {
|
|
79794
79928
|
const fetchUrl = sshToHttps(repo.remoteUrl);
|
|
@@ -79897,8 +80031,8 @@ function detectTags(repo, since) {
|
|
|
79897
80031
|
}
|
|
79898
80032
|
}
|
|
79899
80033
|
function detectCompletedPlans(repo, since) {
|
|
79900
|
-
const plansDir =
|
|
79901
|
-
if (!
|
|
80034
|
+
const plansDir = join174(repo.path, "plans");
|
|
80035
|
+
if (!existsSync90(plansDir))
|
|
79902
80036
|
return [];
|
|
79903
80037
|
const sinceMs = new Date(since).getTime();
|
|
79904
80038
|
const events = [];
|
|
@@ -79907,8 +80041,8 @@ function detectCompletedPlans(repo, since) {
|
|
|
79907
80041
|
for (const entry of entries) {
|
|
79908
80042
|
if (!entry.isDirectory())
|
|
79909
80043
|
continue;
|
|
79910
|
-
const planFile =
|
|
79911
|
-
if (!
|
|
80044
|
+
const planFile = join174(plansDir, entry.name, "plan.md");
|
|
80045
|
+
if (!existsSync90(planFile))
|
|
79912
80046
|
continue;
|
|
79913
80047
|
try {
|
|
79914
80048
|
const stat26 = statSync17(planFile);
|
|
@@ -79985,7 +80119,7 @@ function classifyCommit(event) {
|
|
|
79985
80119
|
// src/commands/content/phases/repo-discoverer.ts
|
|
79986
80120
|
import { execSync as execSync11 } from "node:child_process";
|
|
79987
80121
|
import { readdirSync as readdirSync19 } from "node:fs";
|
|
79988
|
-
import { join as
|
|
80122
|
+
import { join as join175 } from "node:path";
|
|
79989
80123
|
function discoverRepos2(cwd2) {
|
|
79990
80124
|
const repos = [];
|
|
79991
80125
|
if (isGitRepoRoot(cwd2)) {
|
|
@@ -79998,7 +80132,7 @@ function discoverRepos2(cwd2) {
|
|
|
79998
80132
|
for (const entry of entries) {
|
|
79999
80133
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
80000
80134
|
continue;
|
|
80001
|
-
const dirPath =
|
|
80135
|
+
const dirPath = join175(cwd2, entry.name);
|
|
80002
80136
|
if (isGitRepoRoot(dirPath)) {
|
|
80003
80137
|
const info = getRepoInfo(dirPath);
|
|
80004
80138
|
if (info)
|
|
@@ -80665,12 +80799,12 @@ var init_types6 = __esm(() => {
|
|
|
80665
80799
|
});
|
|
80666
80800
|
|
|
80667
80801
|
// src/commands/content/phases/state-manager.ts
|
|
80668
|
-
import { readFile as
|
|
80669
|
-
import { join as
|
|
80802
|
+
import { readFile as readFile73, rename as rename17, writeFile as writeFile44 } from "node:fs/promises";
|
|
80803
|
+
import { join as join176 } from "node:path";
|
|
80670
80804
|
async function loadContentConfig(projectDir) {
|
|
80671
|
-
const configPath =
|
|
80805
|
+
const configPath = join176(projectDir, CK_CONFIG_FILE2);
|
|
80672
80806
|
try {
|
|
80673
|
-
const raw2 = await
|
|
80807
|
+
const raw2 = await readFile73(configPath, "utf-8");
|
|
80674
80808
|
const json = JSON.parse(raw2);
|
|
80675
80809
|
return ContentConfigSchema.parse(json.content ?? {});
|
|
80676
80810
|
} catch {
|
|
@@ -80678,15 +80812,15 @@ async function loadContentConfig(projectDir) {
|
|
|
80678
80812
|
}
|
|
80679
80813
|
}
|
|
80680
80814
|
async function saveContentConfig(projectDir, config) {
|
|
80681
|
-
const configPath =
|
|
80815
|
+
const configPath = join176(projectDir, CK_CONFIG_FILE2);
|
|
80682
80816
|
const json = await readJsonSafe5(configPath);
|
|
80683
80817
|
json.content = { ...json.content, ...config };
|
|
80684
80818
|
await atomicWrite3(configPath, json);
|
|
80685
80819
|
}
|
|
80686
80820
|
async function loadContentState(projectDir) {
|
|
80687
|
-
const configPath =
|
|
80821
|
+
const configPath = join176(projectDir, CK_CONFIG_FILE2);
|
|
80688
80822
|
try {
|
|
80689
|
-
const raw2 = await
|
|
80823
|
+
const raw2 = await readFile73(configPath, "utf-8");
|
|
80690
80824
|
const json = JSON.parse(raw2);
|
|
80691
80825
|
const contentBlock = json.content ?? {};
|
|
80692
80826
|
return ContentStateSchema.parse(contentBlock.state ?? {});
|
|
@@ -80695,7 +80829,7 @@ async function loadContentState(projectDir) {
|
|
|
80695
80829
|
}
|
|
80696
80830
|
}
|
|
80697
80831
|
async function saveContentState(projectDir, state) {
|
|
80698
|
-
const configPath =
|
|
80832
|
+
const configPath = join176(projectDir, CK_CONFIG_FILE2);
|
|
80699
80833
|
const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);
|
|
80700
80834
|
for (const key of Object.keys(state.dailyPostCounts)) {
|
|
80701
80835
|
const dateStr = key.slice(-10);
|
|
@@ -80713,7 +80847,7 @@ async function saveContentState(projectDir, state) {
|
|
|
80713
80847
|
}
|
|
80714
80848
|
async function readJsonSafe5(filePath) {
|
|
80715
80849
|
try {
|
|
80716
|
-
const raw2 = await
|
|
80850
|
+
const raw2 = await readFile73(filePath, "utf-8");
|
|
80717
80851
|
return JSON.parse(raw2);
|
|
80718
80852
|
} catch {
|
|
80719
80853
|
return {};
|
|
@@ -80976,8 +81110,8 @@ var init_platform_setup_x = __esm(() => {
|
|
|
80976
81110
|
});
|
|
80977
81111
|
|
|
80978
81112
|
// src/commands/content/phases/setup-wizard.ts
|
|
80979
|
-
import { existsSync as
|
|
80980
|
-
import { join as
|
|
81113
|
+
import { existsSync as existsSync91 } from "node:fs";
|
|
81114
|
+
import { join as join177 } from "node:path";
|
|
80981
81115
|
async function runSetupWizard2(cwd2, contentLogger) {
|
|
80982
81116
|
console.log();
|
|
80983
81117
|
oe(import_picocolors43.default.bgCyan(import_picocolors43.default.white(" CK Content — Multi-Channel Content Engine ")));
|
|
@@ -81045,8 +81179,8 @@ async function showRepoSummary(cwd2) {
|
|
|
81045
81179
|
function detectBrandAssets(cwd2, contentLogger) {
|
|
81046
81180
|
const repos = discoverRepos2(cwd2);
|
|
81047
81181
|
for (const repo of repos) {
|
|
81048
|
-
const hasGuidelines =
|
|
81049
|
-
const hasStyles =
|
|
81182
|
+
const hasGuidelines = existsSync91(join177(repo.path, "docs", "brand-guidelines.md"));
|
|
81183
|
+
const hasStyles = existsSync91(join177(repo.path, "assets", "writing-styles"));
|
|
81050
81184
|
if (!hasGuidelines) {
|
|
81051
81185
|
f2.warning(`${repo.name}: No docs/brand-guidelines.md — content will use generic tone.`);
|
|
81052
81186
|
contentLogger.warn(`${repo.name}: missing docs/brand-guidelines.md`);
|
|
@@ -81112,13 +81246,13 @@ var init_setup_wizard = __esm(() => {
|
|
|
81112
81246
|
});
|
|
81113
81247
|
|
|
81114
81248
|
// src/commands/content/content-review-commands.ts
|
|
81115
|
-
import { existsSync as
|
|
81249
|
+
import { existsSync as existsSync92 } from "node:fs";
|
|
81116
81250
|
import { homedir as homedir57 } from "node:os";
|
|
81117
81251
|
async function queueContent() {
|
|
81118
81252
|
const cwd2 = process.cwd();
|
|
81119
81253
|
const config = await loadContentConfig(cwd2);
|
|
81120
81254
|
const dbPath = config.dbPath.replace(/^~/, homedir57());
|
|
81121
|
-
if (!
|
|
81255
|
+
if (!existsSync92(dbPath)) {
|
|
81122
81256
|
logger.info("No content database found. Run 'ck content setup' first.");
|
|
81123
81257
|
return;
|
|
81124
81258
|
}
|
|
@@ -81186,12 +81320,12 @@ __export(exports_content_subcommands, {
|
|
|
81186
81320
|
logsContent: () => logsContent,
|
|
81187
81321
|
approveContentCmd: () => approveContentCmd
|
|
81188
81322
|
});
|
|
81189
|
-
import { existsSync as
|
|
81323
|
+
import { existsSync as existsSync93, readFileSync as readFileSync28, unlinkSync as unlinkSync6 } from "node:fs";
|
|
81190
81324
|
import { homedir as homedir58 } from "node:os";
|
|
81191
|
-
import { join as
|
|
81325
|
+
import { join as join178 } from "node:path";
|
|
81192
81326
|
function isDaemonRunning() {
|
|
81193
|
-
const lockFile =
|
|
81194
|
-
if (!
|
|
81327
|
+
const lockFile = join178(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
81328
|
+
if (!existsSync93(lockFile))
|
|
81195
81329
|
return { running: false, pid: null };
|
|
81196
81330
|
try {
|
|
81197
81331
|
const pidStr = readFileSync28(lockFile, "utf-8").trim();
|
|
@@ -81222,8 +81356,8 @@ async function startContent(options2) {
|
|
|
81222
81356
|
await contentCommand(options2);
|
|
81223
81357
|
}
|
|
81224
81358
|
async function stopContent() {
|
|
81225
|
-
const lockFile =
|
|
81226
|
-
if (!
|
|
81359
|
+
const lockFile = join178(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
81360
|
+
if (!existsSync93(lockFile)) {
|
|
81227
81361
|
logger.info("Content daemon is not running.");
|
|
81228
81362
|
return;
|
|
81229
81363
|
}
|
|
@@ -81261,10 +81395,10 @@ async function statusContent() {
|
|
|
81261
81395
|
} catch {}
|
|
81262
81396
|
}
|
|
81263
81397
|
async function logsContent(options2) {
|
|
81264
|
-
const logDir =
|
|
81398
|
+
const logDir = join178(homedir58(), ".claudekit", "logs");
|
|
81265
81399
|
const dateStr = new Date().toISOString().slice(0, 10).replace(/-/g, "");
|
|
81266
|
-
const logPath =
|
|
81267
|
-
if (!
|
|
81400
|
+
const logPath = join178(logDir, `content-${dateStr}.log`);
|
|
81401
|
+
if (!existsSync93(logPath)) {
|
|
81268
81402
|
logger.info("No content logs found for today.");
|
|
81269
81403
|
return;
|
|
81270
81404
|
}
|
|
@@ -81295,13 +81429,13 @@ var init_content_subcommands = __esm(() => {
|
|
|
81295
81429
|
init_setup_wizard();
|
|
81296
81430
|
init_state_manager();
|
|
81297
81431
|
init_content_review_commands();
|
|
81298
|
-
LOCK_DIR =
|
|
81432
|
+
LOCK_DIR = join178(homedir58(), ".claudekit", "locks");
|
|
81299
81433
|
});
|
|
81300
81434
|
|
|
81301
81435
|
// src/commands/content/content-command.ts
|
|
81302
|
-
import { existsSync as
|
|
81436
|
+
import { existsSync as existsSync94, mkdirSync as mkdirSync11, unlinkSync as unlinkSync7, writeFileSync as writeFileSync9 } from "node:fs";
|
|
81303
81437
|
import { homedir as homedir59 } from "node:os";
|
|
81304
|
-
import { join as
|
|
81438
|
+
import { join as join179 } from "node:path";
|
|
81305
81439
|
async function contentCommand(options2) {
|
|
81306
81440
|
const cwd2 = process.cwd();
|
|
81307
81441
|
const contentLogger = new ContentLogger;
|
|
@@ -81330,7 +81464,7 @@ async function contentCommand(options2) {
|
|
|
81330
81464
|
}
|
|
81331
81465
|
contentLogger.info("Setup complete. Starting daemon...");
|
|
81332
81466
|
}
|
|
81333
|
-
if (!
|
|
81467
|
+
if (!existsSync94(LOCK_DIR2))
|
|
81334
81468
|
mkdirSync11(LOCK_DIR2, { recursive: true });
|
|
81335
81469
|
writeFileSync9(LOCK_FILE, String(process.pid), "utf-8");
|
|
81336
81470
|
const dbPath = config.dbPath.replace(/^~/, homedir59());
|
|
@@ -81479,8 +81613,8 @@ var init_content_command = __esm(() => {
|
|
|
81479
81613
|
init_publisher();
|
|
81480
81614
|
init_review_manager();
|
|
81481
81615
|
init_state_manager();
|
|
81482
|
-
LOCK_DIR2 =
|
|
81483
|
-
LOCK_FILE =
|
|
81616
|
+
LOCK_DIR2 = join179(homedir59(), ".claudekit", "locks");
|
|
81617
|
+
LOCK_FILE = join179(LOCK_DIR2, "ck-content.lock");
|
|
81484
81618
|
});
|
|
81485
81619
|
|
|
81486
81620
|
// src/commands/content/index.ts
|
|
@@ -82623,6 +82757,10 @@ var init_init_command_help = __esm(() => {
|
|
|
82623
82757
|
flags: "--install-skills",
|
|
82624
82758
|
description: "Install skills dependencies (non-interactive mode)"
|
|
82625
82759
|
},
|
|
82760
|
+
{
|
|
82761
|
+
flags: "--package-manager <manager>",
|
|
82762
|
+
description: "Package manager for skills JavaScript dependencies: auto, npm, bun, pnpm, or yarn"
|
|
82763
|
+
},
|
|
82626
82764
|
{
|
|
82627
82765
|
flags: "--with-sudo",
|
|
82628
82766
|
description: "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)"
|
|
@@ -82885,6 +83023,10 @@ var init_new_command_help = __esm(() => {
|
|
|
82885
83023
|
flags: "--install-skills",
|
|
82886
83024
|
description: "Install skills dependencies (non-interactive mode)"
|
|
82887
83025
|
},
|
|
83026
|
+
{
|
|
83027
|
+
flags: "--package-manager <manager>",
|
|
83028
|
+
description: "Package manager for skills JavaScript dependencies: auto, npm, bun, pnpm, or yarn"
|
|
83029
|
+
},
|
|
82888
83030
|
{
|
|
82889
83031
|
flags: "--with-sudo",
|
|
82890
83032
|
description: "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)"
|
|
@@ -94815,7 +94957,7 @@ async function getLatestVersion(kit, includePrereleases = false) {
|
|
|
94815
94957
|
init_logger();
|
|
94816
94958
|
init_path_resolver();
|
|
94817
94959
|
init_safe_prompts();
|
|
94818
|
-
import { join as
|
|
94960
|
+
import { join as join100 } from "node:path";
|
|
94819
94961
|
async function promptUpdateMode() {
|
|
94820
94962
|
const updateEverything = await se({
|
|
94821
94963
|
message: "Do you want to update everything?"
|
|
@@ -94857,7 +94999,7 @@ async function promptDirectorySelection(global3 = false) {
|
|
|
94857
94999
|
return selectedCategories;
|
|
94858
95000
|
}
|
|
94859
95001
|
async function promptFreshConfirmation(targetPath, analysis) {
|
|
94860
|
-
const backupRoot =
|
|
95002
|
+
const backupRoot = join100(PathResolver.getConfigDir(false), "backups");
|
|
94861
95003
|
logger.warning("[!] Fresh installation will remove ClaudeKit files:");
|
|
94862
95004
|
logger.info(`Path: ${targetPath}`);
|
|
94863
95005
|
logger.info(`Recovery backup: ${backupRoot}`);
|
|
@@ -95134,7 +95276,7 @@ init_logger();
|
|
|
95134
95276
|
init_logger();
|
|
95135
95277
|
init_path_resolver();
|
|
95136
95278
|
var import_fs_extra10 = __toESM(require_lib(), 1);
|
|
95137
|
-
import { join as
|
|
95279
|
+
import { join as join101 } from "node:path";
|
|
95138
95280
|
async function handleConflicts(ctx) {
|
|
95139
95281
|
if (ctx.cancelled)
|
|
95140
95282
|
return ctx;
|
|
@@ -95143,7 +95285,7 @@ async function handleConflicts(ctx) {
|
|
|
95143
95285
|
if (PathResolver.isLocalSameAsGlobal()) {
|
|
95144
95286
|
return ctx;
|
|
95145
95287
|
}
|
|
95146
|
-
const localSettingsPath =
|
|
95288
|
+
const localSettingsPath = join101(process.cwd(), ".claude", "settings.json");
|
|
95147
95289
|
if (!await import_fs_extra10.pathExists(localSettingsPath)) {
|
|
95148
95290
|
return ctx;
|
|
95149
95291
|
}
|
|
@@ -95158,7 +95300,7 @@ async function handleConflicts(ctx) {
|
|
|
95158
95300
|
return { ...ctx, cancelled: true };
|
|
95159
95301
|
}
|
|
95160
95302
|
if (choice === "remove") {
|
|
95161
|
-
const localClaudeDir =
|
|
95303
|
+
const localClaudeDir = join101(process.cwd(), ".claude");
|
|
95162
95304
|
try {
|
|
95163
95305
|
await import_fs_extra10.remove(localClaudeDir);
|
|
95164
95306
|
logger.success("Removed local .claude/ directory");
|
|
@@ -95255,7 +95397,7 @@ init_logger();
|
|
|
95255
95397
|
init_safe_spinner();
|
|
95256
95398
|
import { mkdir as mkdir30, stat as stat17 } from "node:fs/promises";
|
|
95257
95399
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
95258
|
-
import { join as
|
|
95400
|
+
import { join as join108 } from "node:path";
|
|
95259
95401
|
|
|
95260
95402
|
// src/shared/temp-cleanup.ts
|
|
95261
95403
|
init_logger();
|
|
@@ -95274,7 +95416,7 @@ init_logger();
|
|
|
95274
95416
|
init_output_manager();
|
|
95275
95417
|
import { createWriteStream as createWriteStream2, rmSync } from "node:fs";
|
|
95276
95418
|
import { mkdir as mkdir25 } from "node:fs/promises";
|
|
95277
|
-
import { join as
|
|
95419
|
+
import { join as join102 } from "node:path";
|
|
95278
95420
|
|
|
95279
95421
|
// src/shared/progress-bar.ts
|
|
95280
95422
|
init_output_manager();
|
|
@@ -95484,7 +95626,7 @@ var MAX_DOWNLOAD_SIZE = 500 * 1024 * 1024;
|
|
|
95484
95626
|
class FileDownloader {
|
|
95485
95627
|
async downloadAsset(asset, destDir) {
|
|
95486
95628
|
try {
|
|
95487
|
-
const destPath =
|
|
95629
|
+
const destPath = join102(destDir, asset.name);
|
|
95488
95630
|
await mkdir25(destDir, { recursive: true });
|
|
95489
95631
|
output.info(`Downloading ${asset.name} (${formatBytes2(asset.size)})...`);
|
|
95490
95632
|
logger.verbose("Download details", {
|
|
@@ -95569,7 +95711,7 @@ class FileDownloader {
|
|
|
95569
95711
|
}
|
|
95570
95712
|
async downloadFile(params) {
|
|
95571
95713
|
const { url, name, size, destDir, token } = params;
|
|
95572
|
-
const destPath =
|
|
95714
|
+
const destPath = join102(destDir, name);
|
|
95573
95715
|
await mkdir25(destDir, { recursive: true });
|
|
95574
95716
|
output.info(`Downloading ${name}${size ? ` (${formatBytes2(size)})` : ""}...`);
|
|
95575
95717
|
const headers = {};
|
|
@@ -95655,7 +95797,7 @@ init_logger();
|
|
|
95655
95797
|
init_types3();
|
|
95656
95798
|
import { constants as constants4 } from "node:fs";
|
|
95657
95799
|
import { access as access5, readdir as readdir23 } from "node:fs/promises";
|
|
95658
|
-
import { join as
|
|
95800
|
+
import { join as join103 } from "node:path";
|
|
95659
95801
|
async function pathExists11(path8) {
|
|
95660
95802
|
try {
|
|
95661
95803
|
await access5(path8, constants4.F_OK);
|
|
@@ -95674,7 +95816,7 @@ async function validateExtraction(extractDir) {
|
|
|
95674
95816
|
const criticalPaths = [".claude"];
|
|
95675
95817
|
const missingPaths = [];
|
|
95676
95818
|
for (const path8 of criticalPaths) {
|
|
95677
|
-
if (await pathExists11(
|
|
95819
|
+
if (await pathExists11(join103(extractDir, path8))) {
|
|
95678
95820
|
logger.debug(`Found: ${path8}`);
|
|
95679
95821
|
continue;
|
|
95680
95822
|
}
|
|
@@ -95684,7 +95826,7 @@ async function validateExtraction(extractDir) {
|
|
|
95684
95826
|
const guidancePaths = ["CLAUDE.md", ".claude/CLAUDE.md", ".claude/rules/CLAUDE.md"];
|
|
95685
95827
|
let guidancePath = null;
|
|
95686
95828
|
for (const path8 of guidancePaths) {
|
|
95687
|
-
if (await pathExists11(
|
|
95829
|
+
if (await pathExists11(join103(extractDir, path8))) {
|
|
95688
95830
|
guidancePath = path8;
|
|
95689
95831
|
break;
|
|
95690
95832
|
}
|
|
@@ -95709,7 +95851,7 @@ async function validateExtraction(extractDir) {
|
|
|
95709
95851
|
// src/domains/installation/extraction/tar-extractor.ts
|
|
95710
95852
|
init_logger();
|
|
95711
95853
|
import { copyFile as copyFile4, mkdir as mkdir28, readdir as readdir25, rm as rm11, stat as stat15 } from "node:fs/promises";
|
|
95712
|
-
import { join as
|
|
95854
|
+
import { join as join106 } from "node:path";
|
|
95713
95855
|
|
|
95714
95856
|
// node_modules/@isaacs/fs-minipass/dist/esm/index.js
|
|
95715
95857
|
import EE from "events";
|
|
@@ -101471,7 +101613,7 @@ var mkdirSync4 = (dir, opt) => {
|
|
|
101471
101613
|
};
|
|
101472
101614
|
|
|
101473
101615
|
// node_modules/tar/dist/esm/path-reservations.js
|
|
101474
|
-
import { join as
|
|
101616
|
+
import { join as join104 } from "node:path";
|
|
101475
101617
|
|
|
101476
101618
|
// node_modules/tar/dist/esm/normalize-unicode.js
|
|
101477
101619
|
var normalizeCache = Object.create(null);
|
|
@@ -101504,7 +101646,7 @@ var getDirs = (path13) => {
|
|
|
101504
101646
|
const dirs = path13.split("/").slice(0, -1).reduce((set, path14) => {
|
|
101505
101647
|
const s = set[set.length - 1];
|
|
101506
101648
|
if (s !== undefined) {
|
|
101507
|
-
path14 =
|
|
101649
|
+
path14 = join104(s, path14);
|
|
101508
101650
|
}
|
|
101509
101651
|
set.push(path14 || "/");
|
|
101510
101652
|
return set;
|
|
@@ -101518,7 +101660,7 @@ class PathReservations {
|
|
|
101518
101660
|
#running = new Set;
|
|
101519
101661
|
reserve(paths, fn) {
|
|
101520
101662
|
paths = isWindows4 ? ["win32 parallelization disabled"] : paths.map((p) => {
|
|
101521
|
-
return stripTrailingSlashes(
|
|
101663
|
+
return stripTrailingSlashes(join104(normalizeUnicode(p))).toLowerCase();
|
|
101522
101664
|
});
|
|
101523
101665
|
const dirs = new Set(paths.map((path13) => getDirs(path13)).reduce((a3, b3) => a3.concat(b3)));
|
|
101524
101666
|
this.#reservations.set(fn, { dirs, paths });
|
|
@@ -102578,7 +102720,7 @@ function decodeFilePath(path15) {
|
|
|
102578
102720
|
init_logger();
|
|
102579
102721
|
init_types3();
|
|
102580
102722
|
import { copyFile as copyFile3, lstat as lstat7, mkdir as mkdir27, readdir as readdir24 } from "node:fs/promises";
|
|
102581
|
-
import { join as
|
|
102723
|
+
import { join as join105, relative as relative21 } from "node:path";
|
|
102582
102724
|
async function withRetry(fn, retries = 3) {
|
|
102583
102725
|
for (let i = 0;i < retries; i++) {
|
|
102584
102726
|
try {
|
|
@@ -102600,8 +102742,8 @@ async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTrac
|
|
|
102600
102742
|
await mkdir27(destDir, { recursive: true });
|
|
102601
102743
|
const entries = await readdir24(sourceDir, { encoding: "utf8" });
|
|
102602
102744
|
for (const entry of entries) {
|
|
102603
|
-
const sourcePath =
|
|
102604
|
-
const destPath =
|
|
102745
|
+
const sourcePath = join105(sourceDir, entry);
|
|
102746
|
+
const destPath = join105(destDir, entry);
|
|
102605
102747
|
const relativePath = relative21(sourceDir, sourcePath);
|
|
102606
102748
|
if (!isPathSafe(destDir, destPath)) {
|
|
102607
102749
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -102628,8 +102770,8 @@ async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
|
102628
102770
|
await mkdir27(destDir, { recursive: true });
|
|
102629
102771
|
const entries = await readdir24(sourceDir, { encoding: "utf8" });
|
|
102630
102772
|
for (const entry of entries) {
|
|
102631
|
-
const sourcePath =
|
|
102632
|
-
const destPath =
|
|
102773
|
+
const sourcePath = join105(sourceDir, entry);
|
|
102774
|
+
const destPath = join105(destDir, entry);
|
|
102633
102775
|
const relativePath = relative21(sourceDir, sourcePath);
|
|
102634
102776
|
if (!isPathSafe(destDir, destPath)) {
|
|
102635
102777
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -102677,7 +102819,7 @@ class TarExtractor {
|
|
|
102677
102819
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
102678
102820
|
if (entries.length === 1) {
|
|
102679
102821
|
const rootEntry = entries[0];
|
|
102680
|
-
const rootPath =
|
|
102822
|
+
const rootPath = join106(tempExtractDir, rootEntry);
|
|
102681
102823
|
const rootStat = await stat15(rootPath);
|
|
102682
102824
|
if (rootStat.isDirectory()) {
|
|
102683
102825
|
const rootContents = await readdir25(rootPath, { encoding: "utf8" });
|
|
@@ -102693,7 +102835,7 @@ class TarExtractor {
|
|
|
102693
102835
|
}
|
|
102694
102836
|
} else {
|
|
102695
102837
|
await mkdir28(destDir, { recursive: true });
|
|
102696
|
-
await copyFile4(rootPath,
|
|
102838
|
+
await copyFile4(rootPath, join106(destDir, rootEntry));
|
|
102697
102839
|
}
|
|
102698
102840
|
} else {
|
|
102699
102841
|
logger.debug("Multiple root entries - moving all");
|
|
@@ -102715,7 +102857,7 @@ init_logger();
|
|
|
102715
102857
|
var import_extract_zip = __toESM(require_extract_zip(), 1);
|
|
102716
102858
|
import { execFile as execFile11 } from "node:child_process";
|
|
102717
102859
|
import { copyFile as copyFile5, mkdir as mkdir29, readdir as readdir26, rm as rm12, stat as stat16 } from "node:fs/promises";
|
|
102718
|
-
import { join as
|
|
102860
|
+
import { join as join107 } from "node:path";
|
|
102719
102861
|
import { promisify as promisify16 } from "node:util";
|
|
102720
102862
|
|
|
102721
102863
|
// src/domains/installation/extraction/native-zip-commands.ts
|
|
@@ -102807,7 +102949,7 @@ class ZipExtractor {
|
|
|
102807
102949
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
102808
102950
|
if (entries.length === 1) {
|
|
102809
102951
|
const rootEntry = entries[0];
|
|
102810
|
-
const rootPath =
|
|
102952
|
+
const rootPath = join107(tempExtractDir, rootEntry);
|
|
102811
102953
|
const rootStat = await stat16(rootPath);
|
|
102812
102954
|
if (rootStat.isDirectory()) {
|
|
102813
102955
|
const rootContents = await readdir26(rootPath, { encoding: "utf8" });
|
|
@@ -102823,7 +102965,7 @@ class ZipExtractor {
|
|
|
102823
102965
|
}
|
|
102824
102966
|
} else {
|
|
102825
102967
|
await mkdir29(destDir, { recursive: true });
|
|
102826
|
-
await copyFile5(rootPath,
|
|
102968
|
+
await copyFile5(rootPath, join107(destDir, rootEntry));
|
|
102827
102969
|
}
|
|
102828
102970
|
} else {
|
|
102829
102971
|
logger.debug("Multiple root entries - moving all");
|
|
@@ -102924,7 +103066,7 @@ class DownloadManager {
|
|
|
102924
103066
|
async createTempDir() {
|
|
102925
103067
|
const timestamp = Date.now();
|
|
102926
103068
|
const counter = DownloadManager.tempDirCounter++;
|
|
102927
|
-
const primaryTempDir =
|
|
103069
|
+
const primaryTempDir = join108(tmpdir4(), `claudekit-${timestamp}-${counter}`);
|
|
102928
103070
|
try {
|
|
102929
103071
|
await mkdir30(primaryTempDir, { recursive: true });
|
|
102930
103072
|
logger.debug(`Created temp directory: ${primaryTempDir}`);
|
|
@@ -102941,7 +103083,7 @@ Solutions:
|
|
|
102941
103083
|
2. Set HOME environment variable
|
|
102942
103084
|
3. Try running from a different directory`);
|
|
102943
103085
|
}
|
|
102944
|
-
const fallbackTempDir =
|
|
103086
|
+
const fallbackTempDir = join108(homeDir, ".claudekit", "tmp", `claudekit-${timestamp}-${counter}`);
|
|
102945
103087
|
try {
|
|
102946
103088
|
await mkdir30(fallbackTempDir, { recursive: true });
|
|
102947
103089
|
logger.debug(`Created temp directory (fallback): ${fallbackTempDir}`);
|
|
@@ -103401,20 +103543,20 @@ async function handleDownload(ctx) {
|
|
|
103401
103543
|
};
|
|
103402
103544
|
}
|
|
103403
103545
|
// src/commands/init/phases/merge-handler.ts
|
|
103404
|
-
import { join as
|
|
103546
|
+
import { join as join126 } from "node:path";
|
|
103405
103547
|
|
|
103406
103548
|
// src/domains/installation/deletion-handler.ts
|
|
103407
|
-
import { existsSync as
|
|
103408
|
-
import { dirname as dirname38, join as
|
|
103549
|
+
import { existsSync as existsSync68, lstatSync as lstatSync3, readdirSync as readdirSync10, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
103550
|
+
import { dirname as dirname38, join as join111, relative as relative22, resolve as resolve44, sep as sep12 } from "node:path";
|
|
103409
103551
|
|
|
103410
103552
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
103411
103553
|
init_metadata_migration();
|
|
103412
103554
|
init_logger();
|
|
103413
103555
|
init_types3();
|
|
103414
103556
|
var import_fs_extra11 = __toESM(require_lib(), 1);
|
|
103415
|
-
import { join as
|
|
103557
|
+
import { join as join110 } from "node:path";
|
|
103416
103558
|
async function readManifest(claudeDir3) {
|
|
103417
|
-
const metadataPath =
|
|
103559
|
+
const metadataPath = join110(claudeDir3, "metadata.json");
|
|
103418
103560
|
if (!await import_fs_extra11.pathExists(metadataPath)) {
|
|
103419
103561
|
return null;
|
|
103420
103562
|
}
|
|
@@ -103595,12 +103737,12 @@ function shouldDeletePath(path16, metadata, kitType) {
|
|
|
103595
103737
|
}
|
|
103596
103738
|
function collectFilesRecursively(dir, baseDir) {
|
|
103597
103739
|
const results = [];
|
|
103598
|
-
if (!
|
|
103740
|
+
if (!existsSync68(dir))
|
|
103599
103741
|
return results;
|
|
103600
103742
|
try {
|
|
103601
103743
|
const entries = readdirSync10(dir, { withFileTypes: true });
|
|
103602
103744
|
for (const entry of entries) {
|
|
103603
|
-
const fullPath =
|
|
103745
|
+
const fullPath = join111(dir, entry.name);
|
|
103604
103746
|
const relativePath = relative22(baseDir, fullPath);
|
|
103605
103747
|
if (entry.isDirectory()) {
|
|
103606
103748
|
results.push(...collectFilesRecursively(fullPath, baseDir));
|
|
@@ -103668,7 +103810,7 @@ function deletePath(fullPath, claudeDir3) {
|
|
|
103668
103810
|
}
|
|
103669
103811
|
}
|
|
103670
103812
|
async function updateMetadataAfterDeletion(claudeDir3, deletedPaths) {
|
|
103671
|
-
const metadataPath =
|
|
103813
|
+
const metadataPath = join111(claudeDir3, "metadata.json");
|
|
103672
103814
|
if (!await import_fs_extra12.pathExists(metadataPath)) {
|
|
103673
103815
|
return;
|
|
103674
103816
|
}
|
|
@@ -103723,7 +103865,7 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
|
|
|
103723
103865
|
const userMetadata = await readManifest(claudeDir3);
|
|
103724
103866
|
const result = { deletedPaths: [], preservedPaths: [], errors: [] };
|
|
103725
103867
|
for (const path16 of deletions) {
|
|
103726
|
-
const fullPath =
|
|
103868
|
+
const fullPath = join111(claudeDir3, path16);
|
|
103727
103869
|
const normalizedPath = resolve44(fullPath);
|
|
103728
103870
|
const normalizedClaudeDir = resolve44(claudeDir3);
|
|
103729
103871
|
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep12}`)) {
|
|
@@ -103736,7 +103878,7 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
|
|
|
103736
103878
|
logger.verbose(`Preserved user file: ${path16}`);
|
|
103737
103879
|
continue;
|
|
103738
103880
|
}
|
|
103739
|
-
if (
|
|
103881
|
+
if (existsSync68(fullPath)) {
|
|
103740
103882
|
try {
|
|
103741
103883
|
deletePath(fullPath, claudeDir3);
|
|
103742
103884
|
result.deletedPaths.push(path16);
|
|
@@ -103763,7 +103905,7 @@ init_logger();
|
|
|
103763
103905
|
init_types3();
|
|
103764
103906
|
var import_fs_extra16 = __toESM(require_lib(), 1);
|
|
103765
103907
|
var import_ignore3 = __toESM(require_ignore(), 1);
|
|
103766
|
-
import { dirname as dirname42, join as
|
|
103908
|
+
import { dirname as dirname42, join as join116, relative as relative25 } from "node:path";
|
|
103767
103909
|
|
|
103768
103910
|
// src/domains/installation/selective-merger.ts
|
|
103769
103911
|
import { stat as stat18 } from "node:fs/promises";
|
|
@@ -103939,7 +104081,7 @@ class SelectiveMerger {
|
|
|
103939
104081
|
|
|
103940
104082
|
// src/domains/installation/merger/deleted-skill-preservation.ts
|
|
103941
104083
|
init_metadata_migration();
|
|
103942
|
-
import { dirname as dirname39, join as
|
|
104084
|
+
import { dirname as dirname39, join as join112, relative as relative23 } from "node:path";
|
|
103943
104085
|
var import_fs_extra13 = __toESM(require_lib(), 1);
|
|
103944
104086
|
async function findIgnoredSkillDirectories({
|
|
103945
104087
|
files,
|
|
@@ -103967,7 +104109,7 @@ async function findIgnoredSkillDirectories({
|
|
|
103967
104109
|
return root ? [root] : [];
|
|
103968
104110
|
}));
|
|
103969
104111
|
for (const [metadataRoot, sourceRoot] of sourceSkillRoots) {
|
|
103970
|
-
const destSkillRoot =
|
|
104112
|
+
const destSkillRoot = join112(destDir, ...sourceRoot.split("/"));
|
|
103971
104113
|
const skillExists = await import_fs_extra13.pathExists(destSkillRoot);
|
|
103972
104114
|
if (existingIgnoredRoots.has(metadataRoot) || !skillExists && previouslyTrackedRoots.has(metadataRoot)) {
|
|
103973
104115
|
ignoredSkillDirectories.add(metadataRoot);
|
|
@@ -104017,7 +104159,7 @@ init_logger();
|
|
|
104017
104159
|
var import_fs_extra14 = __toESM(require_lib(), 1);
|
|
104018
104160
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
104019
104161
|
import { relative as relative24 } from "node:path";
|
|
104020
|
-
import { join as
|
|
104162
|
+
import { join as join113 } from "node:path";
|
|
104021
104163
|
|
|
104022
104164
|
// node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
104023
104165
|
var balanced = (a3, b3, str2) => {
|
|
@@ -105473,7 +105615,7 @@ class FileScanner {
|
|
|
105473
105615
|
const files = [];
|
|
105474
105616
|
const entries = await import_fs_extra14.readdir(dir, { encoding: "utf8" });
|
|
105475
105617
|
for (const entry of entries) {
|
|
105476
|
-
const fullPath =
|
|
105618
|
+
const fullPath = join113(dir, entry);
|
|
105477
105619
|
const relativePath = relative24(baseDir, fullPath);
|
|
105478
105620
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
105479
105621
|
const stats = await import_fs_extra14.lstat(fullPath);
|
|
@@ -105509,13 +105651,13 @@ class FileScanner {
|
|
|
105509
105651
|
// src/domains/installation/merger/settings-processor.ts
|
|
105510
105652
|
import { execSync as execSync5 } from "node:child_process";
|
|
105511
105653
|
import { homedir as homedir46 } from "node:os";
|
|
105512
|
-
import { dirname as dirname41, join as
|
|
105654
|
+
import { dirname as dirname41, join as join115 } from "node:path";
|
|
105513
105655
|
|
|
105514
105656
|
// src/domains/config/installed-settings-tracker.ts
|
|
105515
105657
|
init_shared();
|
|
105516
|
-
import { existsSync as
|
|
105517
|
-
import { mkdir as mkdir31, readFile as
|
|
105518
|
-
import { dirname as dirname40, join as
|
|
105658
|
+
import { existsSync as existsSync69 } from "node:fs";
|
|
105659
|
+
import { mkdir as mkdir31, readFile as readFile53, writeFile as writeFile27 } from "node:fs/promises";
|
|
105660
|
+
import { dirname as dirname40, join as join114 } from "node:path";
|
|
105519
105661
|
var CK_JSON_FILE = ".ck.json";
|
|
105520
105662
|
|
|
105521
105663
|
class InstalledSettingsTracker {
|
|
@@ -105529,17 +105671,17 @@ class InstalledSettingsTracker {
|
|
|
105529
105671
|
}
|
|
105530
105672
|
getCkJsonPath() {
|
|
105531
105673
|
if (this.isGlobal) {
|
|
105532
|
-
return
|
|
105674
|
+
return join114(this.projectDir, CK_JSON_FILE);
|
|
105533
105675
|
}
|
|
105534
|
-
return
|
|
105676
|
+
return join114(this.projectDir, ".claude", CK_JSON_FILE);
|
|
105535
105677
|
}
|
|
105536
105678
|
async loadInstalledSettings() {
|
|
105537
105679
|
const ckJsonPath = this.getCkJsonPath();
|
|
105538
|
-
if (!
|
|
105680
|
+
if (!existsSync69(ckJsonPath)) {
|
|
105539
105681
|
return { hooks: [], mcpServers: [] };
|
|
105540
105682
|
}
|
|
105541
105683
|
try {
|
|
105542
|
-
const content = await
|
|
105684
|
+
const content = await readFile53(ckJsonPath, "utf-8");
|
|
105543
105685
|
const data = parseJsonContent(content);
|
|
105544
105686
|
const installed = data.kits?.[this.kitName]?.installedSettings;
|
|
105545
105687
|
if (installed) {
|
|
@@ -105555,8 +105697,8 @@ class InstalledSettingsTracker {
|
|
|
105555
105697
|
const ckJsonPath = this.getCkJsonPath();
|
|
105556
105698
|
try {
|
|
105557
105699
|
let data = {};
|
|
105558
|
-
if (
|
|
105559
|
-
const content = await
|
|
105700
|
+
if (existsSync69(ckJsonPath)) {
|
|
105701
|
+
const content = await readFile53(ckJsonPath, "utf-8");
|
|
105560
105702
|
data = parseJsonContent(content);
|
|
105561
105703
|
}
|
|
105562
105704
|
if (!data.kits) {
|
|
@@ -105799,10 +105941,10 @@ class SettingsProcessor {
|
|
|
105799
105941
|
};
|
|
105800
105942
|
try {
|
|
105801
105943
|
if (this.isGlobal) {
|
|
105802
|
-
await addFromConfig(
|
|
105944
|
+
await addFromConfig(join115(this.projectDir, ".ck.json"));
|
|
105803
105945
|
} else {
|
|
105804
|
-
await addFromConfig(
|
|
105805
|
-
await addFromConfig(
|
|
105946
|
+
await addFromConfig(join115(PathResolver.getGlobalKitDir(), ".ck.json"));
|
|
105947
|
+
await addFromConfig(join115(this.projectDir, ".claude", ".ck.json"));
|
|
105806
105948
|
}
|
|
105807
105949
|
} catch (error) {
|
|
105808
105950
|
logger.debug(`Failed to load .ck.json hook preferences: ${error instanceof Error ? error.message : "unknown"}`);
|
|
@@ -106189,7 +106331,7 @@ class SettingsProcessor {
|
|
|
106189
106331
|
return false;
|
|
106190
106332
|
}
|
|
106191
106333
|
const configuredGlobalDir = PathResolver.getGlobalKitDir().replace(/\\/g, "/").replace(/\/+$/, "");
|
|
106192
|
-
const defaultGlobalDir =
|
|
106334
|
+
const defaultGlobalDir = join115(homedir46(), ".claude").replace(/\\/g, "/");
|
|
106193
106335
|
return configuredGlobalDir !== defaultGlobalDir;
|
|
106194
106336
|
}
|
|
106195
106337
|
getClaudeCommandRoot() {
|
|
@@ -106209,7 +106351,7 @@ class SettingsProcessor {
|
|
|
106209
106351
|
return true;
|
|
106210
106352
|
}
|
|
106211
106353
|
async repairSiblingSettingsLocal(destFile) {
|
|
106212
|
-
const settingsLocalPath =
|
|
106354
|
+
const settingsLocalPath = join115(dirname41(destFile), "settings.local.json");
|
|
106213
106355
|
if (settingsLocalPath === destFile || !await import_fs_extra15.pathExists(settingsLocalPath)) {
|
|
106214
106356
|
return;
|
|
106215
106357
|
}
|
|
@@ -106306,7 +106448,7 @@ class SettingsProcessor {
|
|
|
106306
106448
|
}
|
|
106307
106449
|
}
|
|
106308
106450
|
async dynamicTeamHookHandlerExists(destFile, handler) {
|
|
106309
|
-
return import_fs_extra15.pathExists(
|
|
106451
|
+
return import_fs_extra15.pathExists(join115(dirname41(destFile), "hooks", handler));
|
|
106310
106452
|
}
|
|
106311
106453
|
removeDynamicTeamHookRegistrations(settings) {
|
|
106312
106454
|
let removed = 0;
|
|
@@ -106447,7 +106589,7 @@ class CopyExecutor {
|
|
|
106447
106589
|
for (const file of files) {
|
|
106448
106590
|
const relativePath = relative25(sourceDir, file);
|
|
106449
106591
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
106450
|
-
const destPath =
|
|
106592
|
+
const destPath = join116(destDir, relativePath);
|
|
106451
106593
|
if (await import_fs_extra16.pathExists(destPath)) {
|
|
106452
106594
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
106453
106595
|
logger.debug(`Security-sensitive file exists but won't be overwritten: ${normalizedRelativePath}`);
|
|
@@ -106471,7 +106613,7 @@ class CopyExecutor {
|
|
|
106471
106613
|
for (const file of files) {
|
|
106472
106614
|
const relativePath = relative25(sourceDir, file);
|
|
106473
106615
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
106474
|
-
const destPath =
|
|
106616
|
+
const destPath = join116(destDir, relativePath);
|
|
106475
106617
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
106476
106618
|
logger.debug(`Skipping security-sensitive file: ${normalizedRelativePath}`);
|
|
106477
106619
|
skippedCount++;
|
|
@@ -106683,15 +106825,15 @@ class FileMerger {
|
|
|
106683
106825
|
|
|
106684
106826
|
// src/domains/migration/legacy-migration.ts
|
|
106685
106827
|
import { readdir as readdir28, stat as stat19 } from "node:fs/promises";
|
|
106686
|
-
import { join as
|
|
106828
|
+
import { join as join120, relative as relative26 } from "node:path";
|
|
106687
106829
|
// src/services/file-operations/manifest/manifest-tracker.ts
|
|
106688
|
-
import { join as
|
|
106830
|
+
import { join as join119 } from "node:path";
|
|
106689
106831
|
|
|
106690
106832
|
// src/domains/migration/release-manifest.ts
|
|
106691
106833
|
init_logger();
|
|
106692
106834
|
init_zod();
|
|
106693
106835
|
var import_fs_extra17 = __toESM(require_lib(), 1);
|
|
106694
|
-
import { join as
|
|
106836
|
+
import { join as join117 } from "node:path";
|
|
106695
106837
|
var ReleaseManifestFileSchema = exports_external.object({
|
|
106696
106838
|
path: exports_external.string(),
|
|
106697
106839
|
checksum: exports_external.string().regex(/^[a-f0-9]{64}$/),
|
|
@@ -106706,7 +106848,7 @@ var ReleaseManifestSchema = exports_external.object({
|
|
|
106706
106848
|
|
|
106707
106849
|
class ReleaseManifestLoader {
|
|
106708
106850
|
static async load(extractDir) {
|
|
106709
|
-
const manifestPath =
|
|
106851
|
+
const manifestPath = join117(extractDir, "release-manifest.json");
|
|
106710
106852
|
try {
|
|
106711
106853
|
const content = await import_fs_extra17.readFile(manifestPath, "utf-8");
|
|
106712
106854
|
const parsed = JSON.parse(content);
|
|
@@ -106729,12 +106871,12 @@ init_p_limit();
|
|
|
106729
106871
|
|
|
106730
106872
|
// src/services/file-operations/manifest/manifest-updater.ts
|
|
106731
106873
|
init_metadata_migration();
|
|
106732
|
-
import { join as
|
|
106874
|
+
import { join as join118 } from "node:path";
|
|
106733
106875
|
init_logger();
|
|
106734
106876
|
init_types3();
|
|
106735
106877
|
var import_fs_extra18 = __toESM(require_lib(), 1);
|
|
106736
106878
|
async function writeManifest(claudeDir3, kitName, version, scope, kitType, trackedFiles, userConfigFiles, ignoredSkills = [], installModePreference) {
|
|
106737
|
-
const metadataPath =
|
|
106879
|
+
const metadataPath = join118(claudeDir3, "metadata.json");
|
|
106738
106880
|
const kit = kitType || (/\bmarketing\b/i.test(kitName) ? "marketing" : "engineer");
|
|
106739
106881
|
await import_fs_extra18.ensureFile(metadataPath);
|
|
106740
106882
|
let release = null;
|
|
@@ -106808,7 +106950,7 @@ function uniqueNormalizedSkillRoots(paths) {
|
|
|
106808
106950
|
}))).sort();
|
|
106809
106951
|
}
|
|
106810
106952
|
async function removeKitFromManifest(claudeDir3, kit, options2) {
|
|
106811
|
-
const metadataPath =
|
|
106953
|
+
const metadataPath = join118(claudeDir3, "metadata.json");
|
|
106812
106954
|
if (!await import_fs_extra18.pathExists(metadataPath))
|
|
106813
106955
|
return false;
|
|
106814
106956
|
let release = null;
|
|
@@ -106840,7 +106982,7 @@ async function removeKitFromManifest(claudeDir3, kit, options2) {
|
|
|
106840
106982
|
}
|
|
106841
106983
|
}
|
|
106842
106984
|
async function retainTrackedFilesInManifest(claudeDir3, retainedPaths, options2) {
|
|
106843
|
-
const metadataPath =
|
|
106985
|
+
const metadataPath = join118(claudeDir3, "metadata.json");
|
|
106844
106986
|
if (!await import_fs_extra18.pathExists(metadataPath))
|
|
106845
106987
|
return false;
|
|
106846
106988
|
const normalizedPaths = new Set(retainedPaths.map((path17) => path17.replace(/\\/g, "/")));
|
|
@@ -107021,7 +107163,7 @@ function buildFileTrackingList(options2) {
|
|
|
107021
107163
|
if (!isGlobal && !installedPath.startsWith(".claude/"))
|
|
107022
107164
|
continue;
|
|
107023
107165
|
const relativePath = isGlobal ? installedPath : installedPath.replace(/^\.claude\//, "");
|
|
107024
|
-
const filePath =
|
|
107166
|
+
const filePath = join119(claudeDir3, relativePath);
|
|
107025
107167
|
const manifestEntry = releaseManifest ? ReleaseManifestLoader.findFile(releaseManifest, installedPath) : null;
|
|
107026
107168
|
const ownership = manifestEntry ? "ck" : "user";
|
|
107027
107169
|
filesToTrack.push({
|
|
@@ -107132,7 +107274,7 @@ class LegacyMigration {
|
|
|
107132
107274
|
continue;
|
|
107133
107275
|
if (SKIP_DIRS_ALL.includes(entry))
|
|
107134
107276
|
continue;
|
|
107135
|
-
const fullPath =
|
|
107277
|
+
const fullPath = join120(dir, entry);
|
|
107136
107278
|
let stats;
|
|
107137
107279
|
try {
|
|
107138
107280
|
stats = await stat19(fullPath);
|
|
@@ -107242,7 +107384,7 @@ User-created files (sample):`);
|
|
|
107242
107384
|
];
|
|
107243
107385
|
if (filesToChecksum.length > 0) {
|
|
107244
107386
|
const checksumResults = await mapWithLimit(filesToChecksum, async ({ relativePath, ownership }) => {
|
|
107245
|
-
const fullPath =
|
|
107387
|
+
const fullPath = join120(claudeDir3, relativePath);
|
|
107246
107388
|
const checksum = await OwnershipChecker.calculateChecksum(fullPath);
|
|
107247
107389
|
return { relativePath, checksum, ownership };
|
|
107248
107390
|
}, getOptimalConcurrency());
|
|
@@ -107263,7 +107405,7 @@ User-created files (sample):`);
|
|
|
107263
107405
|
installedAt: new Date().toISOString(),
|
|
107264
107406
|
files: trackedFiles
|
|
107265
107407
|
};
|
|
107266
|
-
const metadataPath =
|
|
107408
|
+
const metadataPath = join120(claudeDir3, "metadata.json");
|
|
107267
107409
|
await import_fs_extra19.writeFile(metadataPath, JSON.stringify(updatedMetadata, null, 2));
|
|
107268
107410
|
logger.success(`Migration complete: tracked ${trackedFiles.length} files`);
|
|
107269
107411
|
return true;
|
|
@@ -107369,7 +107511,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
|
|
|
107369
107511
|
init_logger();
|
|
107370
107512
|
init_skip_directories();
|
|
107371
107513
|
var import_fs_extra20 = __toESM(require_lib(), 1);
|
|
107372
|
-
import { join as
|
|
107514
|
+
import { join as join121, relative as relative27, resolve as resolve45 } from "node:path";
|
|
107373
107515
|
|
|
107374
107516
|
class FileScanner2 {
|
|
107375
107517
|
static async getFiles(dirPath, relativeTo) {
|
|
@@ -107385,7 +107527,7 @@ class FileScanner2 {
|
|
|
107385
107527
|
logger.debug(`Skipping directory: ${entry}`);
|
|
107386
107528
|
continue;
|
|
107387
107529
|
}
|
|
107388
|
-
const fullPath =
|
|
107530
|
+
const fullPath = join121(dirPath, entry);
|
|
107389
107531
|
if (!FileScanner2.isSafePath(basePath, fullPath)) {
|
|
107390
107532
|
logger.warning(`Skipping potentially unsafe path: ${entry}`);
|
|
107391
107533
|
continue;
|
|
@@ -107420,8 +107562,8 @@ class FileScanner2 {
|
|
|
107420
107562
|
return files;
|
|
107421
107563
|
}
|
|
107422
107564
|
static async findCustomFiles(destDir, sourceDir, subPath) {
|
|
107423
|
-
const destSubDir =
|
|
107424
|
-
const sourceSubDir =
|
|
107565
|
+
const destSubDir = join121(destDir, subPath);
|
|
107566
|
+
const sourceSubDir = join121(sourceDir, subPath);
|
|
107425
107567
|
logger.debug(`findCustomFiles - destDir: ${destDir}`);
|
|
107426
107568
|
logger.debug(`findCustomFiles - sourceDir: ${sourceDir}`);
|
|
107427
107569
|
logger.debug(`findCustomFiles - subPath: "${subPath}"`);
|
|
@@ -107462,12 +107604,12 @@ class FileScanner2 {
|
|
|
107462
107604
|
init_logger();
|
|
107463
107605
|
var import_fs_extra21 = __toESM(require_lib(), 1);
|
|
107464
107606
|
import { lstat as lstat10, mkdir as mkdir32, readdir as readdir31, stat as stat20 } from "node:fs/promises";
|
|
107465
|
-
import { join as
|
|
107607
|
+
import { join as join123 } from "node:path";
|
|
107466
107608
|
|
|
107467
107609
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
107468
107610
|
init_logger();
|
|
107469
|
-
import { readFile as
|
|
107470
|
-
import { join as
|
|
107611
|
+
import { readFile as readFile57, readdir as readdir30, writeFile as writeFile31 } from "node:fs/promises";
|
|
107612
|
+
import { join as join122 } from "node:path";
|
|
107471
107613
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
107472
107614
|
".md",
|
|
107473
107615
|
".txt",
|
|
@@ -107527,7 +107669,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
107527
107669
|
async function processDirectory(dir) {
|
|
107528
107670
|
const entries = await readdir30(dir, { withFileTypes: true });
|
|
107529
107671
|
for (const entry of entries) {
|
|
107530
|
-
const fullPath =
|
|
107672
|
+
const fullPath = join122(dir, entry.name);
|
|
107531
107673
|
if (entry.isDirectory()) {
|
|
107532
107674
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
107533
107675
|
continue;
|
|
@@ -107535,7 +107677,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
107535
107677
|
await processDirectory(fullPath);
|
|
107536
107678
|
} else if (entry.isFile() && shouldTransformFile(entry.name)) {
|
|
107537
107679
|
try {
|
|
107538
|
-
const content = await
|
|
107680
|
+
const content = await readFile57(fullPath, "utf-8");
|
|
107539
107681
|
const { transformed, changes } = transformCommandContent(content);
|
|
107540
107682
|
if (changes > 0) {
|
|
107541
107683
|
if (options2.dryRun) {
|
|
@@ -107602,14 +107744,14 @@ function shouldApplyPrefix(options2) {
|
|
|
107602
107744
|
// src/services/transformers/commands-prefix/prefix-applier.ts
|
|
107603
107745
|
async function applyPrefix(extractDir) {
|
|
107604
107746
|
validatePath(extractDir, "extractDir");
|
|
107605
|
-
const commandsDir =
|
|
107747
|
+
const commandsDir = join123(extractDir, ".claude", "commands");
|
|
107606
107748
|
if (!await import_fs_extra21.pathExists(commandsDir)) {
|
|
107607
107749
|
logger.verbose("No commands directory found, skipping prefix application");
|
|
107608
107750
|
return;
|
|
107609
107751
|
}
|
|
107610
107752
|
logger.info("Applying /ck: prefix to slash commands...");
|
|
107611
|
-
const backupDir =
|
|
107612
|
-
const tempDir =
|
|
107753
|
+
const backupDir = join123(extractDir, ".commands-backup");
|
|
107754
|
+
const tempDir = join123(extractDir, ".commands-prefix-temp");
|
|
107613
107755
|
try {
|
|
107614
107756
|
const entries = await readdir31(commandsDir);
|
|
107615
107757
|
if (entries.length === 0) {
|
|
@@ -107617,7 +107759,7 @@ async function applyPrefix(extractDir) {
|
|
|
107617
107759
|
return;
|
|
107618
107760
|
}
|
|
107619
107761
|
if (entries.length === 1 && entries[0] === "ck") {
|
|
107620
|
-
const ckDir2 =
|
|
107762
|
+
const ckDir2 = join123(commandsDir, "ck");
|
|
107621
107763
|
const ckStat = await stat20(ckDir2);
|
|
107622
107764
|
if (ckStat.isDirectory()) {
|
|
107623
107765
|
logger.verbose("Commands already have /ck: prefix, skipping");
|
|
@@ -107627,17 +107769,17 @@ async function applyPrefix(extractDir) {
|
|
|
107627
107769
|
await import_fs_extra21.copy(commandsDir, backupDir);
|
|
107628
107770
|
logger.verbose("Created backup of commands directory");
|
|
107629
107771
|
await mkdir32(tempDir, { recursive: true });
|
|
107630
|
-
const ckDir =
|
|
107772
|
+
const ckDir = join123(tempDir, "ck");
|
|
107631
107773
|
await mkdir32(ckDir, { recursive: true });
|
|
107632
107774
|
let processedCount = 0;
|
|
107633
107775
|
for (const entry of entries) {
|
|
107634
|
-
const sourcePath =
|
|
107776
|
+
const sourcePath = join123(commandsDir, entry);
|
|
107635
107777
|
const stats = await lstat10(sourcePath);
|
|
107636
107778
|
if (stats.isSymbolicLink()) {
|
|
107637
107779
|
logger.warning(`Skipping symlink for security: ${entry}`);
|
|
107638
107780
|
continue;
|
|
107639
107781
|
}
|
|
107640
|
-
const destPath =
|
|
107782
|
+
const destPath = join123(ckDir, entry);
|
|
107641
107783
|
await import_fs_extra21.copy(sourcePath, destPath, {
|
|
107642
107784
|
overwrite: false,
|
|
107643
107785
|
errorOnExist: true
|
|
@@ -107655,7 +107797,7 @@ async function applyPrefix(extractDir) {
|
|
|
107655
107797
|
await import_fs_extra21.move(tempDir, commandsDir);
|
|
107656
107798
|
await import_fs_extra21.remove(backupDir);
|
|
107657
107799
|
logger.success("Successfully reorganized commands to /ck: prefix");
|
|
107658
|
-
const claudeDir3 =
|
|
107800
|
+
const claudeDir3 = join123(extractDir, ".claude");
|
|
107659
107801
|
logger.info("Transforming command references in file contents...");
|
|
107660
107802
|
const transformResult = await transformCommandReferences(claudeDir3, {
|
|
107661
107803
|
verbose: logger.isVerbose()
|
|
@@ -107693,20 +107835,20 @@ async function applyPrefix(extractDir) {
|
|
|
107693
107835
|
// src/services/transformers/commands-prefix/prefix-cleaner.ts
|
|
107694
107836
|
init_metadata_migration();
|
|
107695
107837
|
import { lstat as lstat12, readdir as readdir33 } from "node:fs/promises";
|
|
107696
|
-
import { join as
|
|
107838
|
+
import { join as join125 } from "node:path";
|
|
107697
107839
|
init_logger();
|
|
107698
107840
|
var import_fs_extra23 = __toESM(require_lib(), 1);
|
|
107699
107841
|
|
|
107700
107842
|
// src/services/transformers/commands-prefix/file-processor.ts
|
|
107701
107843
|
import { lstat as lstat11, readdir as readdir32 } from "node:fs/promises";
|
|
107702
|
-
import { join as
|
|
107844
|
+
import { join as join124 } from "node:path";
|
|
107703
107845
|
init_logger();
|
|
107704
107846
|
var import_fs_extra22 = __toESM(require_lib(), 1);
|
|
107705
107847
|
async function scanDirectoryFiles(dir) {
|
|
107706
107848
|
const files = [];
|
|
107707
107849
|
const entries = await readdir32(dir);
|
|
107708
107850
|
for (const entry of entries) {
|
|
107709
|
-
const fullPath =
|
|
107851
|
+
const fullPath = join124(dir, entry);
|
|
107710
107852
|
const stats = await lstat11(fullPath);
|
|
107711
107853
|
if (stats.isSymbolicLink()) {
|
|
107712
107854
|
continue;
|
|
@@ -107834,8 +107976,8 @@ function isDifferentKitDirectory(dirName, currentKit) {
|
|
|
107834
107976
|
async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
107835
107977
|
const { dryRun = false } = options2;
|
|
107836
107978
|
validatePath(targetDir, "targetDir");
|
|
107837
|
-
const claudeDir3 = isGlobal ? targetDir :
|
|
107838
|
-
const commandsDir =
|
|
107979
|
+
const claudeDir3 = isGlobal ? targetDir : join125(targetDir, ".claude");
|
|
107980
|
+
const commandsDir = join125(claudeDir3, "commands");
|
|
107839
107981
|
const accumulator = {
|
|
107840
107982
|
results: [],
|
|
107841
107983
|
deletedCount: 0,
|
|
@@ -107877,7 +108019,7 @@ async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
|
107877
108019
|
}
|
|
107878
108020
|
const metadataForChecks = options2.kitType ? createKitSpecificMetadata(metadata, options2.kitType) : metadata;
|
|
107879
108021
|
for (const entry of entries) {
|
|
107880
|
-
const entryPath =
|
|
108022
|
+
const entryPath = join125(commandsDir, entry);
|
|
107881
108023
|
const stats = await lstat12(entryPath);
|
|
107882
108024
|
if (stats.isSymbolicLink()) {
|
|
107883
108025
|
addSymlinkSkip(entry, accumulator);
|
|
@@ -107946,7 +108088,7 @@ async function handleMerge(ctx) {
|
|
|
107946
108088
|
let customClaudeFiles = [];
|
|
107947
108089
|
if (!ctx.options.fresh) {
|
|
107948
108090
|
logger.info("Scanning for custom .claude files...");
|
|
107949
|
-
const scanSourceDir = ctx.options.global ?
|
|
108091
|
+
const scanSourceDir = ctx.options.global ? join126(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
107950
108092
|
const scanTargetSubdir = ctx.options.global ? "" : ".claude";
|
|
107951
108093
|
customClaudeFiles = await FileScanner2.findCustomFiles(ctx.resolvedDir, scanSourceDir, scanTargetSubdir);
|
|
107952
108094
|
} else {
|
|
@@ -107985,7 +108127,7 @@ async function handleMerge(ctx) {
|
|
|
107985
108127
|
merger.setRestoreCkHooks(ctx.options.restoreCkHooks);
|
|
107986
108128
|
merger.setProjectDir(ctx.resolvedDir);
|
|
107987
108129
|
merger.setKitName(ctx.kit.name);
|
|
107988
|
-
merger.setZombiePrunerHookDir(
|
|
108130
|
+
merger.setZombiePrunerHookDir(join126(ctx.claudeDir, "hooks"));
|
|
107989
108131
|
if (ctx.kitType) {
|
|
107990
108132
|
merger.setMultiKitContext(ctx.claudeDir, ctx.kitType);
|
|
107991
108133
|
}
|
|
@@ -108014,8 +108156,8 @@ async function handleMerge(ctx) {
|
|
|
108014
108156
|
return { ...ctx, cancelled: true };
|
|
108015
108157
|
}
|
|
108016
108158
|
}
|
|
108017
|
-
const sourceDir = ctx.options.global ?
|
|
108018
|
-
const sourceMetadataPath = ctx.options.global ?
|
|
108159
|
+
const sourceDir = ctx.options.global ? join126(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
108160
|
+
const sourceMetadataPath = ctx.options.global ? join126(sourceDir, "metadata.json") : join126(sourceDir, ".claude", "metadata.json");
|
|
108019
108161
|
let sourceMetadata = null;
|
|
108020
108162
|
try {
|
|
108021
108163
|
if (await import_fs_extra24.pathExists(sourceMetadataPath)) {
|
|
@@ -108076,7 +108218,7 @@ async function handleMerge(ctx) {
|
|
|
108076
108218
|
};
|
|
108077
108219
|
}
|
|
108078
108220
|
// src/commands/init/phases/migration-handler.ts
|
|
108079
|
-
import { join as
|
|
108221
|
+
import { join as join134 } from "node:path";
|
|
108080
108222
|
|
|
108081
108223
|
// src/domains/skills/skills-detector.ts
|
|
108082
108224
|
init_logger();
|
|
@@ -108091,8 +108233,8 @@ init_skip_directories();
|
|
|
108091
108233
|
init_types3();
|
|
108092
108234
|
var import_fs_extra25 = __toESM(require_lib(), 1);
|
|
108093
108235
|
import { createHash as createHash8 } from "node:crypto";
|
|
108094
|
-
import { readFile as
|
|
108095
|
-
import { join as
|
|
108236
|
+
import { readFile as readFile59, readdir as readdir34, writeFile as writeFile32 } from "node:fs/promises";
|
|
108237
|
+
import { join as join127, relative as relative28 } from "node:path";
|
|
108096
108238
|
|
|
108097
108239
|
class SkillsManifestManager {
|
|
108098
108240
|
static MANIFEST_FILENAME = ".skills-manifest.json";
|
|
@@ -108114,18 +108256,18 @@ class SkillsManifestManager {
|
|
|
108114
108256
|
return manifest;
|
|
108115
108257
|
}
|
|
108116
108258
|
static async writeManifest(skillsDir2, manifest) {
|
|
108117
|
-
const manifestPath =
|
|
108259
|
+
const manifestPath = join127(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
108118
108260
|
await writeFile32(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
108119
108261
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
108120
108262
|
}
|
|
108121
108263
|
static async readManifest(skillsDir2) {
|
|
108122
|
-
const manifestPath =
|
|
108264
|
+
const manifestPath = join127(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
108123
108265
|
if (!await import_fs_extra25.pathExists(manifestPath)) {
|
|
108124
108266
|
logger.debug(`No manifest found at: ${manifestPath}`);
|
|
108125
108267
|
return null;
|
|
108126
108268
|
}
|
|
108127
108269
|
try {
|
|
108128
|
-
const content = await
|
|
108270
|
+
const content = await readFile59(manifestPath, "utf-8");
|
|
108129
108271
|
const data = JSON.parse(content);
|
|
108130
108272
|
const manifest = SkillsManifestSchema.parse(data);
|
|
108131
108273
|
logger.debug(`Read manifest from: ${manifestPath}`);
|
|
@@ -108142,7 +108284,7 @@ class SkillsManifestManager {
|
|
|
108142
108284
|
return "flat";
|
|
108143
108285
|
}
|
|
108144
108286
|
for (const dir of dirs.slice(0, 3)) {
|
|
108145
|
-
const dirPath =
|
|
108287
|
+
const dirPath = join127(skillsDir2, dir.name);
|
|
108146
108288
|
const subEntries = await readdir34(dirPath, { withFileTypes: true });
|
|
108147
108289
|
const hasSubdirs = subEntries.some((entry) => entry.isDirectory());
|
|
108148
108290
|
if (hasSubdirs) {
|
|
@@ -108161,7 +108303,7 @@ class SkillsManifestManager {
|
|
|
108161
108303
|
const entries = await readdir34(skillsDir2, { withFileTypes: true });
|
|
108162
108304
|
for (const entry of entries) {
|
|
108163
108305
|
if (entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith(".")) {
|
|
108164
|
-
const skillPath =
|
|
108306
|
+
const skillPath = join127(skillsDir2, entry.name);
|
|
108165
108307
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
108166
108308
|
skills.push({
|
|
108167
108309
|
name: entry.name,
|
|
@@ -108173,11 +108315,11 @@ class SkillsManifestManager {
|
|
|
108173
108315
|
const categories = await readdir34(skillsDir2, { withFileTypes: true });
|
|
108174
108316
|
for (const category of categories) {
|
|
108175
108317
|
if (category.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(category.name) && !category.name.startsWith(".")) {
|
|
108176
|
-
const categoryPath =
|
|
108318
|
+
const categoryPath = join127(skillsDir2, category.name);
|
|
108177
108319
|
const skillEntries = await readdir34(categoryPath, { withFileTypes: true });
|
|
108178
108320
|
for (const skillEntry of skillEntries) {
|
|
108179
108321
|
if (skillEntry.isDirectory() && !skillEntry.name.startsWith(".")) {
|
|
108180
|
-
const skillPath =
|
|
108322
|
+
const skillPath = join127(categoryPath, skillEntry.name);
|
|
108181
108323
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
108182
108324
|
skills.push({
|
|
108183
108325
|
name: skillEntry.name,
|
|
@@ -108197,7 +108339,7 @@ class SkillsManifestManager {
|
|
|
108197
108339
|
files.sort();
|
|
108198
108340
|
for (const file of files) {
|
|
108199
108341
|
const relativePath = relative28(dirPath, file);
|
|
108200
|
-
const content = await
|
|
108342
|
+
const content = await readFile59(file);
|
|
108201
108343
|
hash.update(relativePath);
|
|
108202
108344
|
hash.update(content);
|
|
108203
108345
|
}
|
|
@@ -108207,7 +108349,7 @@ class SkillsManifestManager {
|
|
|
108207
108349
|
const files = [];
|
|
108208
108350
|
const entries = await readdir34(dirPath, { withFileTypes: true });
|
|
108209
108351
|
for (const entry of entries) {
|
|
108210
|
-
const fullPath =
|
|
108352
|
+
const fullPath = join127(dirPath, entry.name);
|
|
108211
108353
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name)) {
|
|
108212
108354
|
continue;
|
|
108213
108355
|
}
|
|
@@ -108329,7 +108471,7 @@ function getPathMapping(skillName, oldBasePath, newBasePath) {
|
|
|
108329
108471
|
// src/domains/skills/detection/script-detector.ts
|
|
108330
108472
|
var import_fs_extra26 = __toESM(require_lib(), 1);
|
|
108331
108473
|
import { readdir as readdir35 } from "node:fs/promises";
|
|
108332
|
-
import { join as
|
|
108474
|
+
import { join as join128 } from "node:path";
|
|
108333
108475
|
async function scanDirectory(skillsDir2) {
|
|
108334
108476
|
if (!await import_fs_extra26.pathExists(skillsDir2)) {
|
|
108335
108477
|
return ["flat", []];
|
|
@@ -108342,12 +108484,12 @@ async function scanDirectory(skillsDir2) {
|
|
|
108342
108484
|
let totalSkillLikeCount = 0;
|
|
108343
108485
|
const allSkills = [];
|
|
108344
108486
|
for (const dir of dirs) {
|
|
108345
|
-
const dirPath =
|
|
108487
|
+
const dirPath = join128(skillsDir2, dir.name);
|
|
108346
108488
|
const subEntries = await readdir35(dirPath, { withFileTypes: true });
|
|
108347
108489
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
108348
108490
|
if (subdirs.length > 0) {
|
|
108349
108491
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
108350
|
-
const subdirPath =
|
|
108492
|
+
const subdirPath = join128(dirPath, subdir.name);
|
|
108351
108493
|
const subdirFiles = await readdir35(subdirPath, { withFileTypes: true });
|
|
108352
108494
|
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"));
|
|
108353
108495
|
if (hasSkillMarker) {
|
|
@@ -108504,12 +108646,12 @@ class SkillsMigrationDetector {
|
|
|
108504
108646
|
// src/domains/skills/skills-migrator.ts
|
|
108505
108647
|
init_logger();
|
|
108506
108648
|
init_types3();
|
|
108507
|
-
import { join as
|
|
108649
|
+
import { join as join133 } from "node:path";
|
|
108508
108650
|
|
|
108509
108651
|
// src/domains/skills/migrator/migration-executor.ts
|
|
108510
108652
|
init_logger();
|
|
108511
108653
|
import { copyFile as copyFile6, mkdir as mkdir33, readdir as readdir36, rm as rm13 } from "node:fs/promises";
|
|
108512
|
-
import { join as
|
|
108654
|
+
import { join as join129 } from "node:path";
|
|
108513
108655
|
var import_fs_extra28 = __toESM(require_lib(), 1);
|
|
108514
108656
|
|
|
108515
108657
|
// src/domains/skills/skills-migration-prompts.ts
|
|
@@ -108674,8 +108816,8 @@ async function copySkillDirectory(sourceDir, destDir) {
|
|
|
108674
108816
|
await mkdir33(destDir, { recursive: true });
|
|
108675
108817
|
const entries = await readdir36(sourceDir, { withFileTypes: true });
|
|
108676
108818
|
for (const entry of entries) {
|
|
108677
|
-
const sourcePath =
|
|
108678
|
-
const destPath =
|
|
108819
|
+
const sourcePath = join129(sourceDir, entry.name);
|
|
108820
|
+
const destPath = join129(destDir, entry.name);
|
|
108679
108821
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
108680
108822
|
continue;
|
|
108681
108823
|
}
|
|
@@ -108690,7 +108832,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
108690
108832
|
const migrated = [];
|
|
108691
108833
|
const preserved = [];
|
|
108692
108834
|
const errors2 = [];
|
|
108693
|
-
const tempDir =
|
|
108835
|
+
const tempDir = join129(currentSkillsDir, "..", ".skills-migration-temp");
|
|
108694
108836
|
await mkdir33(tempDir, { recursive: true });
|
|
108695
108837
|
try {
|
|
108696
108838
|
for (const mapping of mappings) {
|
|
@@ -108711,9 +108853,9 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
108711
108853
|
}
|
|
108712
108854
|
}
|
|
108713
108855
|
const category = mapping.category;
|
|
108714
|
-
const targetPath = category ?
|
|
108856
|
+
const targetPath = category ? join129(tempDir, category, skillName) : join129(tempDir, skillName);
|
|
108715
108857
|
if (category) {
|
|
108716
|
-
await mkdir33(
|
|
108858
|
+
await mkdir33(join129(tempDir, category), { recursive: true });
|
|
108717
108859
|
}
|
|
108718
108860
|
await copySkillDirectory(currentSkillPath, targetPath);
|
|
108719
108861
|
migrated.push(skillName);
|
|
@@ -108780,7 +108922,7 @@ init_logger();
|
|
|
108780
108922
|
init_types3();
|
|
108781
108923
|
var import_fs_extra29 = __toESM(require_lib(), 1);
|
|
108782
108924
|
import { copyFile as copyFile7, mkdir as mkdir34, readdir as readdir37, rm as rm14, stat as stat21 } from "node:fs/promises";
|
|
108783
|
-
import { basename as basename27, join as
|
|
108925
|
+
import { basename as basename27, join as join130, normalize as normalize10 } from "node:path";
|
|
108784
108926
|
function validatePath2(path17, paramName) {
|
|
108785
108927
|
if (!path17 || typeof path17 !== "string") {
|
|
108786
108928
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -108806,7 +108948,7 @@ class SkillsBackupManager {
|
|
|
108806
108948
|
const timestamp = Date.now();
|
|
108807
108949
|
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
|
108808
108950
|
const backupDirName = `${SkillsBackupManager.BACKUP_PREFIX}${timestamp}-${randomSuffix}`;
|
|
108809
|
-
const backupDir = parentDir ?
|
|
108951
|
+
const backupDir = parentDir ? join130(parentDir, backupDirName) : join130(skillsDir2, "..", backupDirName);
|
|
108810
108952
|
logger.info(`Creating backup at: ${backupDir}`);
|
|
108811
108953
|
try {
|
|
108812
108954
|
await mkdir34(backupDir, { recursive: true });
|
|
@@ -108857,7 +108999,7 @@ class SkillsBackupManager {
|
|
|
108857
108999
|
}
|
|
108858
109000
|
try {
|
|
108859
109001
|
const entries = await readdir37(parentDir, { withFileTypes: true });
|
|
108860
|
-
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) =>
|
|
109002
|
+
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) => join130(parentDir, entry.name));
|
|
108861
109003
|
backups.sort().reverse();
|
|
108862
109004
|
return backups;
|
|
108863
109005
|
} catch (error) {
|
|
@@ -108885,8 +109027,8 @@ class SkillsBackupManager {
|
|
|
108885
109027
|
static async copyDirectory(sourceDir, destDir) {
|
|
108886
109028
|
const entries = await readdir37(sourceDir, { withFileTypes: true });
|
|
108887
109029
|
for (const entry of entries) {
|
|
108888
|
-
const sourcePath =
|
|
108889
|
-
const destPath =
|
|
109030
|
+
const sourcePath = join130(sourceDir, entry.name);
|
|
109031
|
+
const destPath = join130(destDir, entry.name);
|
|
108890
109032
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
108891
109033
|
continue;
|
|
108892
109034
|
}
|
|
@@ -108902,7 +109044,7 @@ class SkillsBackupManager {
|
|
|
108902
109044
|
let size = 0;
|
|
108903
109045
|
const entries = await readdir37(dirPath, { withFileTypes: true });
|
|
108904
109046
|
for (const entry of entries) {
|
|
108905
|
-
const fullPath =
|
|
109047
|
+
const fullPath = join130(dirPath, entry.name);
|
|
108906
109048
|
if (entry.isSymbolicLink()) {
|
|
108907
109049
|
continue;
|
|
108908
109050
|
}
|
|
@@ -108937,13 +109079,13 @@ import { relative as relative30 } from "node:path";
|
|
|
108937
109079
|
init_skip_directories();
|
|
108938
109080
|
import { createHash as createHash9 } from "node:crypto";
|
|
108939
109081
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
108940
|
-
import { readFile as
|
|
108941
|
-
import { join as
|
|
109082
|
+
import { readFile as readFile60, readdir as readdir38 } from "node:fs/promises";
|
|
109083
|
+
import { join as join131, relative as relative29 } from "node:path";
|
|
108942
109084
|
async function getAllFiles(dirPath) {
|
|
108943
109085
|
const files = [];
|
|
108944
109086
|
const entries = await readdir38(dirPath, { withFileTypes: true });
|
|
108945
109087
|
for (const entry of entries) {
|
|
108946
|
-
const fullPath =
|
|
109088
|
+
const fullPath = join131(dirPath, entry.name);
|
|
108947
109089
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name) || entry.isSymbolicLink()) {
|
|
108948
109090
|
continue;
|
|
108949
109091
|
}
|
|
@@ -108976,7 +109118,7 @@ async function hashDirectory(dirPath) {
|
|
|
108976
109118
|
files.sort();
|
|
108977
109119
|
for (const file of files) {
|
|
108978
109120
|
const relativePath = relative29(dirPath, file);
|
|
108979
|
-
const content = await
|
|
109121
|
+
const content = await readFile60(file);
|
|
108980
109122
|
hash.update(relativePath);
|
|
108981
109123
|
hash.update(content);
|
|
108982
109124
|
}
|
|
@@ -109070,7 +109212,7 @@ async function detectFileChanges(currentSkillPath, baselineSkillPath) {
|
|
|
109070
109212
|
init_types3();
|
|
109071
109213
|
var import_fs_extra31 = __toESM(require_lib(), 1);
|
|
109072
109214
|
import { readdir as readdir39 } from "node:fs/promises";
|
|
109073
|
-
import { join as
|
|
109215
|
+
import { join as join132, normalize as normalize11 } from "node:path";
|
|
109074
109216
|
function validatePath3(path17, paramName) {
|
|
109075
109217
|
if (!path17 || typeof path17 !== "string") {
|
|
109076
109218
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -109091,13 +109233,13 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
109091
109233
|
if (dirs.length === 0) {
|
|
109092
109234
|
return ["flat", []];
|
|
109093
109235
|
}
|
|
109094
|
-
const firstDirPath =
|
|
109236
|
+
const firstDirPath = join132(skillsDir2, dirs[0].name);
|
|
109095
109237
|
const subEntries = await readdir39(firstDirPath, { withFileTypes: true });
|
|
109096
109238
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
109097
109239
|
if (subdirs.length > 0) {
|
|
109098
109240
|
let skillLikeCount = 0;
|
|
109099
109241
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
109100
|
-
const subdirPath =
|
|
109242
|
+
const subdirPath = join132(firstDirPath, subdir.name);
|
|
109101
109243
|
const subdirFiles = await readdir39(subdirPath, { withFileTypes: true });
|
|
109102
109244
|
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"));
|
|
109103
109245
|
if (hasSkillMarker) {
|
|
@@ -109107,7 +109249,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
109107
109249
|
if (skillLikeCount > 0) {
|
|
109108
109250
|
const skills = [];
|
|
109109
109251
|
for (const dir of dirs) {
|
|
109110
|
-
const categoryPath =
|
|
109252
|
+
const categoryPath = join132(skillsDir2, dir.name);
|
|
109111
109253
|
const skillDirs = await readdir39(categoryPath, { withFileTypes: true });
|
|
109112
109254
|
skills.push(...skillDirs.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name));
|
|
109113
109255
|
}
|
|
@@ -109117,7 +109259,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
109117
109259
|
return ["flat", dirs.map((dir) => dir.name)];
|
|
109118
109260
|
}
|
|
109119
109261
|
async function findSkillPath(skillsDir2, skillName) {
|
|
109120
|
-
const flatPath =
|
|
109262
|
+
const flatPath = join132(skillsDir2, skillName);
|
|
109121
109263
|
if (await import_fs_extra31.pathExists(flatPath)) {
|
|
109122
109264
|
return { path: flatPath, category: undefined };
|
|
109123
109265
|
}
|
|
@@ -109126,8 +109268,8 @@ async function findSkillPath(skillsDir2, skillName) {
|
|
|
109126
109268
|
if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
109127
109269
|
continue;
|
|
109128
109270
|
}
|
|
109129
|
-
const categoryPath =
|
|
109130
|
-
const skillPath =
|
|
109271
|
+
const categoryPath = join132(skillsDir2, entry.name);
|
|
109272
|
+
const skillPath = join132(categoryPath, skillName);
|
|
109131
109273
|
if (await import_fs_extra31.pathExists(skillPath)) {
|
|
109132
109274
|
return { path: skillPath, category: entry.name };
|
|
109133
109275
|
}
|
|
@@ -109221,7 +109363,7 @@ class SkillsMigrator {
|
|
|
109221
109363
|
}
|
|
109222
109364
|
}
|
|
109223
109365
|
if (options2.backup && !options2.dryRun) {
|
|
109224
|
-
const claudeDir3 =
|
|
109366
|
+
const claudeDir3 = join133(currentSkillsDir, "..");
|
|
109225
109367
|
result.backupPath = await SkillsBackupManager.createBackup(currentSkillsDir, claudeDir3);
|
|
109226
109368
|
logger.success(`Backup created at: ${result.backupPath}`);
|
|
109227
109369
|
}
|
|
@@ -109282,7 +109424,7 @@ async function handleMigration(ctx) {
|
|
|
109282
109424
|
logger.debug("Skipping skills migration (fresh installation)");
|
|
109283
109425
|
return ctx;
|
|
109284
109426
|
}
|
|
109285
|
-
const newSkillsDir =
|
|
109427
|
+
const newSkillsDir = join134(ctx.extractDir, ".claude", "skills");
|
|
109286
109428
|
const currentSkillsDir = PathResolver.buildSkillsPath(ctx.resolvedDir, ctx.options.global);
|
|
109287
109429
|
if (!await import_fs_extra32.pathExists(newSkillsDir) || !await import_fs_extra32.pathExists(currentSkillsDir)) {
|
|
109288
109430
|
return ctx;
|
|
@@ -109306,13 +109448,13 @@ async function handleMigration(ctx) {
|
|
|
109306
109448
|
}
|
|
109307
109449
|
// src/commands/init/phases/opencode-handler.ts
|
|
109308
109450
|
import { cp as cp4, readdir as readdir41, rm as rm15 } from "node:fs/promises";
|
|
109309
|
-
import { join as
|
|
109451
|
+
import { join as join136 } from "node:path";
|
|
109310
109452
|
|
|
109311
109453
|
// src/services/transformers/opencode-path-transformer.ts
|
|
109312
109454
|
init_logger();
|
|
109313
|
-
import { readFile as
|
|
109455
|
+
import { readFile as readFile61, readdir as readdir40, writeFile as writeFile33 } from "node:fs/promises";
|
|
109314
109456
|
import { platform as platform15 } from "node:os";
|
|
109315
|
-
import { extname as extname6, join as
|
|
109457
|
+
import { extname as extname6, join as join135 } from "node:path";
|
|
109316
109458
|
var IS_WINDOWS2 = platform15() === "win32";
|
|
109317
109459
|
function getOpenCodeGlobalPath() {
|
|
109318
109460
|
return "$HOME/.config/opencode/";
|
|
@@ -109373,7 +109515,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
109373
109515
|
async function processDirectory2(dir) {
|
|
109374
109516
|
const entries = await readdir40(dir, { withFileTypes: true });
|
|
109375
109517
|
for (const entry of entries) {
|
|
109376
|
-
const fullPath =
|
|
109518
|
+
const fullPath = join135(dir, entry.name);
|
|
109377
109519
|
if (entry.isDirectory()) {
|
|
109378
109520
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
109379
109521
|
continue;
|
|
@@ -109381,7 +109523,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
109381
109523
|
await processDirectory2(fullPath);
|
|
109382
109524
|
} else if (entry.isFile() && shouldTransformFile2(entry.name)) {
|
|
109383
109525
|
try {
|
|
109384
|
-
const content = await
|
|
109526
|
+
const content = await readFile61(fullPath, "utf-8");
|
|
109385
109527
|
const { transformed, changes } = transformOpenCodeContent(content);
|
|
109386
109528
|
if (changes > 0) {
|
|
109387
109529
|
await writeFile33(fullPath, transformed, "utf-8");
|
|
@@ -109412,7 +109554,7 @@ async function handleOpenCode(ctx) {
|
|
|
109412
109554
|
if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir) {
|
|
109413
109555
|
return ctx;
|
|
109414
109556
|
}
|
|
109415
|
-
const openCodeSource =
|
|
109557
|
+
const openCodeSource = join136(ctx.extractDir, ".opencode");
|
|
109416
109558
|
if (!await import_fs_extra33.pathExists(openCodeSource)) {
|
|
109417
109559
|
logger.debug("No .opencode directory in archive, skipping");
|
|
109418
109560
|
return ctx;
|
|
@@ -109430,8 +109572,8 @@ async function handleOpenCode(ctx) {
|
|
|
109430
109572
|
await import_fs_extra33.ensureDir(targetDir);
|
|
109431
109573
|
const entries = await readdir41(openCodeSource, { withFileTypes: true });
|
|
109432
109574
|
for (const entry of entries) {
|
|
109433
|
-
const sourcePath =
|
|
109434
|
-
const targetPath =
|
|
109575
|
+
const sourcePath = join136(openCodeSource, entry.name);
|
|
109576
|
+
const targetPath = join136(targetDir, entry.name);
|
|
109435
109577
|
if (await import_fs_extra33.pathExists(targetPath)) {
|
|
109436
109578
|
if (!ctx.options.forceOverwrite) {
|
|
109437
109579
|
logger.verbose(`Skipping existing: ${entry.name}`);
|
|
@@ -109470,6 +109612,7 @@ async function resolveOptions(ctx) {
|
|
|
109470
109612
|
docsDir: parsed.docsDir,
|
|
109471
109613
|
plansDir: parsed.plansDir,
|
|
109472
109614
|
installSkills: parsed.installSkills ?? false,
|
|
109615
|
+
packageManager: parsed.packageManager ?? "auto",
|
|
109473
109616
|
withSudo: parsed.withSudo ?? false,
|
|
109474
109617
|
skipSetup: parsed.skipSetup ?? false,
|
|
109475
109618
|
forceOverwrite: parsed.forceOverwrite ?? false,
|
|
@@ -109531,7 +109674,7 @@ Please use only one download method.`);
|
|
|
109531
109674
|
}
|
|
109532
109675
|
// src/commands/init/phases/post-install-handler.ts
|
|
109533
109676
|
init_projects_registry();
|
|
109534
|
-
import { join as
|
|
109677
|
+
import { join as join137 } from "node:path";
|
|
109535
109678
|
init_logger();
|
|
109536
109679
|
init_path_resolver();
|
|
109537
109680
|
var import_fs_extra34 = __toESM(require_lib(), 1);
|
|
@@ -109540,8 +109683,8 @@ async function handlePostInstall(ctx) {
|
|
|
109540
109683
|
return ctx;
|
|
109541
109684
|
}
|
|
109542
109685
|
if (ctx.options.global) {
|
|
109543
|
-
const claudeMdSource =
|
|
109544
|
-
const claudeMdDest =
|
|
109686
|
+
const claudeMdSource = join137(ctx.extractDir, "CLAUDE.md");
|
|
109687
|
+
const claudeMdDest = join137(ctx.resolvedDir, "CLAUDE.md");
|
|
109545
109688
|
if (await import_fs_extra34.pathExists(claudeMdSource)) {
|
|
109546
109689
|
if (ctx.options.fresh || !await import_fs_extra34.pathExists(claudeMdDest)) {
|
|
109547
109690
|
await import_fs_extra34.copy(claudeMdSource, claudeMdDest);
|
|
@@ -109560,6 +109703,9 @@ async function handlePostInstall(ctx) {
|
|
|
109560
109703
|
const skillsDir2 = PathResolver.buildSkillsPath(ctx.resolvedDir, ctx.options.global);
|
|
109561
109704
|
await handleSkillsInstallation2(skillsDir2, {
|
|
109562
109705
|
skipConfirm: ctx.isNonInteractive,
|
|
109706
|
+
packageManager: ctx.options.packageManager,
|
|
109707
|
+
projectDir: ctx.resolvedDir,
|
|
109708
|
+
isGlobal: ctx.options.global,
|
|
109563
109709
|
withSudo: ctx.options.withSudo
|
|
109564
109710
|
});
|
|
109565
109711
|
}
|
|
@@ -109589,7 +109735,7 @@ async function handlePostInstall(ctx) {
|
|
|
109589
109735
|
}
|
|
109590
109736
|
if (!ctx.options.skipSetup) {
|
|
109591
109737
|
await promptSetupWizardIfNeeded({
|
|
109592
|
-
envPath:
|
|
109738
|
+
envPath: join137(ctx.claudeDir, ".env"),
|
|
109593
109739
|
claudeDir: ctx.claudeDir,
|
|
109594
109740
|
isGlobal: ctx.options.global,
|
|
109595
109741
|
isNonInteractive: ctx.isNonInteractive,
|
|
@@ -109611,22 +109757,22 @@ async function handlePostInstall(ctx) {
|
|
|
109611
109757
|
}
|
|
109612
109758
|
// src/commands/init/phases/plugin-install-handler.ts
|
|
109613
109759
|
init_codex_plugin_installer();
|
|
109614
|
-
import { cpSync as cpSync2, existsSync as
|
|
109615
|
-
import { join as
|
|
109760
|
+
import { cpSync as cpSync2, existsSync as existsSync72, mkdirSync as mkdirSync6, readFileSync as readFileSync24, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "node:fs";
|
|
109761
|
+
import { join as join140 } from "node:path";
|
|
109616
109762
|
|
|
109617
109763
|
// src/domains/installation/plugin/migrate-legacy-to-plugin.ts
|
|
109618
109764
|
init_install_mode_detector();
|
|
109619
109765
|
import { createHash as createHash10 } from "node:crypto";
|
|
109620
109766
|
import {
|
|
109621
109767
|
cpSync,
|
|
109622
|
-
existsSync as
|
|
109768
|
+
existsSync as existsSync70,
|
|
109623
109769
|
mkdirSync as mkdirSync5,
|
|
109624
109770
|
readFileSync as readFileSync23,
|
|
109625
109771
|
readdirSync as readdirSync11,
|
|
109626
109772
|
rmSync as rmSync3,
|
|
109627
109773
|
writeFileSync as writeFileSync7
|
|
109628
109774
|
} from "node:fs";
|
|
109629
|
-
import { dirname as dirname43, join as
|
|
109775
|
+
import { dirname as dirname43, join as join138, relative as relative31, resolve as resolve46 } from "node:path";
|
|
109630
109776
|
|
|
109631
109777
|
// src/domains/installation/plugin/plugin-installer.ts
|
|
109632
109778
|
init_install_mode_detector();
|
|
@@ -109752,7 +109898,7 @@ async function migrateLegacyToPlugin(opts) {
|
|
|
109752
109898
|
let backupDir = null;
|
|
109753
109899
|
let removedPaths = [];
|
|
109754
109900
|
if (before.legacy.installed) {
|
|
109755
|
-
backupDir =
|
|
109901
|
+
backupDir = join138(claudeDir3, "backups", `ck-legacy-${ts.replace(/[:.]/g, "-")}`);
|
|
109756
109902
|
mkdirSync5(backupDir, { recursive: true });
|
|
109757
109903
|
removedPaths = removeLegacy(claudeDir3, backupDir);
|
|
109758
109904
|
prunePluginSuppliedLegacyFilesFromMetadata(claudeDir3, removedPaths);
|
|
@@ -109788,14 +109934,14 @@ function base(action, modeBefore, pluginVerified) {
|
|
|
109788
109934
|
var PLUGIN_SUPPLIED_LEGACY_PREFIXES2 = ["agents/", "skills/"];
|
|
109789
109935
|
var LEGACY_SENTINEL_FILENAMES = new Set([".gitignore"]);
|
|
109790
109936
|
function defaultLegacyRemover(claudeDir3, backupDir) {
|
|
109791
|
-
const meta = readJsonSafe3(
|
|
109937
|
+
const meta = readJsonSafe3(join138(claudeDir3, "metadata.json"));
|
|
109792
109938
|
const files = collectTrackedFiles2(meta);
|
|
109793
109939
|
const removed = [];
|
|
109794
109940
|
for (const file of files) {
|
|
109795
109941
|
const legacyPath = resolveSafePluginSuppliedLegacyPath2(claudeDir3, file.path);
|
|
109796
109942
|
if (!legacyPath)
|
|
109797
109943
|
continue;
|
|
109798
|
-
if (!
|
|
109944
|
+
if (!existsSync70(legacyPath.absolutePath))
|
|
109799
109945
|
continue;
|
|
109800
109946
|
if (!isSafeToRemovePluginSuppliedLegacyFile(file, legacyPath.absolutePath))
|
|
109801
109947
|
continue;
|
|
@@ -109826,8 +109972,8 @@ function removeOrphanLegacySentinels(claudeDir3, backupDir, removedTrackedPaths)
|
|
|
109826
109972
|
}
|
|
109827
109973
|
const removed = [];
|
|
109828
109974
|
for (const root of [...rootsToSweep].sort(compareLegacyPaths)) {
|
|
109829
|
-
const rootAbs =
|
|
109830
|
-
if (!
|
|
109975
|
+
const rootAbs = join138(claudeDir3, root);
|
|
109976
|
+
if (!existsSync70(rootAbs))
|
|
109831
109977
|
continue;
|
|
109832
109978
|
const sentinels = findLegacySentinels(rootAbs).sort((a3, b3) => compareLegacyPaths(relative31(claudeDir3, a3), relative31(claudeDir3, b3)));
|
|
109833
109979
|
for (const sentinelAbs of sentinels) {
|
|
@@ -109850,7 +109996,7 @@ function findLegacySentinels(dir) {
|
|
|
109850
109996
|
return out;
|
|
109851
109997
|
}
|
|
109852
109998
|
for (const entry of entries.sort((a3, b3) => compareLegacyPaths(a3.name, b3.name))) {
|
|
109853
|
-
const abs =
|
|
109999
|
+
const abs = join138(dir, entry.name);
|
|
109854
110000
|
if (entry.isDirectory()) {
|
|
109855
110001
|
out.push(...findLegacySentinels(abs));
|
|
109856
110002
|
} else if (entry.isFile() && LEGACY_SENTINEL_FILENAMES.has(entry.name)) {
|
|
@@ -109878,7 +110024,7 @@ function directoryContainsOnlySentinels(dir) {
|
|
|
109878
110024
|
return false;
|
|
109879
110025
|
}
|
|
109880
110026
|
for (const entry of entries) {
|
|
109881
|
-
const abs =
|
|
110027
|
+
const abs = join138(dir, entry.name);
|
|
109882
110028
|
if (entry.isDirectory()) {
|
|
109883
110029
|
if (!directoryContainsOnlySentinels(abs))
|
|
109884
110030
|
return false;
|
|
@@ -109980,7 +110126,7 @@ function collectTrackedFiles2(meta) {
|
|
|
109980
110126
|
return out;
|
|
109981
110127
|
}
|
|
109982
110128
|
function prunePluginSuppliedLegacyFilesFromMetadata(claudeDir3, removedPaths) {
|
|
109983
|
-
const metadataPath =
|
|
110129
|
+
const metadataPath = join138(claudeDir3, "metadata.json");
|
|
109984
110130
|
const meta = readJsonSafe3(metadataPath);
|
|
109985
110131
|
if (!isRecord5(meta))
|
|
109986
110132
|
return;
|
|
@@ -109994,7 +110140,7 @@ function prunePluginSuppliedLegacyFilesFromMetadata(claudeDir3, removedPaths) {
|
|
|
109994
110140
|
return true;
|
|
109995
110141
|
const normalizedPath = normalizeComparableLegacyPath(file.path);
|
|
109996
110142
|
const resolvedPath = resolveSafePluginSuppliedLegacyPath2(claudeDir3, normalizedPath);
|
|
109997
|
-
const shouldPrune = removed ? removed.has(normalizedPath) || resolvedPath !== null && !
|
|
110143
|
+
const shouldPrune = removed ? removed.has(normalizedPath) || resolvedPath !== null && !existsSync70(resolvedPath.absolutePath) : isPluginSuppliedLegacyPath2(normalizedPath);
|
|
109998
110144
|
return !shouldPrune;
|
|
109999
110145
|
});
|
|
110000
110146
|
if (pruned.length !== files.length)
|
|
@@ -110019,7 +110165,7 @@ function normalizeComparableLegacyPath(pathValue) {
|
|
|
110019
110165
|
return normalizeLegacyPath2(pathValue).replace(/^\.\/+/, "").replace(/^\.claude\//, "");
|
|
110020
110166
|
}
|
|
110021
110167
|
function writeReceipt(claudeDir3, receipt) {
|
|
110022
|
-
const receiptPath =
|
|
110168
|
+
const receiptPath = join138(claudeDir3, ".ck-migration-log.json");
|
|
110023
110169
|
const existing = readJsonSafe3(receiptPath);
|
|
110024
110170
|
const history = Array.isArray(existing) ? existing : [];
|
|
110025
110171
|
history.push(receipt);
|
|
@@ -110074,8 +110220,8 @@ function isRecord5(value) {
|
|
|
110074
110220
|
|
|
110075
110221
|
// src/domains/installation/plugin/uninstall-plugin.ts
|
|
110076
110222
|
init_install_mode_detector();
|
|
110077
|
-
import { existsSync as
|
|
110078
|
-
import { join as
|
|
110223
|
+
import { existsSync as existsSync71, rmSync as rmSync4 } from "node:fs";
|
|
110224
|
+
import { join as join139 } from "node:path";
|
|
110079
110225
|
init_path_resolver();
|
|
110080
110226
|
async function uninstallEnginePlugin(opts = {}) {
|
|
110081
110227
|
const claudeDir3 = opts.claudeDir ?? PathResolver.getGlobalKitDir();
|
|
@@ -110097,8 +110243,8 @@ async function uninstallEnginePlugin(opts = {}) {
|
|
|
110097
110243
|
}
|
|
110098
110244
|
let staleCacheRemoved = false;
|
|
110099
110245
|
const marketplace = state.marketplace ?? CK_MARKETPLACE_NAME;
|
|
110100
|
-
const cacheDir =
|
|
110101
|
-
if (
|
|
110246
|
+
const cacheDir = join139(claudeDir3, "plugins", "cache", marketplace, CK_PLUGIN_NAME);
|
|
110247
|
+
if (existsSync71(cacheDir)) {
|
|
110102
110248
|
rmSync4(cacheDir, { recursive: true, force: true });
|
|
110103
110249
|
staleCacheRemoved = true;
|
|
110104
110250
|
}
|
|
@@ -110195,14 +110341,14 @@ function logLegacyPluginCleanup(result) {
|
|
|
110195
110341
|
}
|
|
110196
110342
|
}
|
|
110197
110343
|
function stagePluginSource(extractDir, stageBaseDir) {
|
|
110198
|
-
const base2 = stageBaseDir ??
|
|
110199
|
-
const payloadSrc =
|
|
110200
|
-
if (!
|
|
110344
|
+
const base2 = stageBaseDir ?? join140(PathResolver.getCacheDir(true), "ck-plugin-source");
|
|
110345
|
+
const payloadSrc = join140(extractDir, ".claude");
|
|
110346
|
+
if (!existsSync72(payloadSrc)) {
|
|
110201
110347
|
throw new Error(`plugin payload not found in archive: ${payloadSrc}`);
|
|
110202
110348
|
}
|
|
110203
110349
|
rmSync5(base2, { recursive: true, force: true });
|
|
110204
110350
|
mkdirSync6(base2, { recursive: true });
|
|
110205
|
-
const stagedPayload =
|
|
110351
|
+
const stagedPayload = join140(base2, ".claude");
|
|
110206
110352
|
cpSync2(payloadSrc, stagedPayload, { recursive: true });
|
|
110207
110353
|
ensureCodexPluginManifest(stagedPayload);
|
|
110208
110354
|
const claudeMarketplace = {
|
|
@@ -110210,8 +110356,8 @@ function stagePluginSource(extractDir, stageBaseDir) {
|
|
|
110210
110356
|
owner: { name: "ClaudeKit" },
|
|
110211
110357
|
plugins: [{ name: "ck", source: "./.claude", description: "ClaudeKit Engineer" }]
|
|
110212
110358
|
};
|
|
110213
|
-
mkdirSync6(
|
|
110214
|
-
writeFileSync8(
|
|
110359
|
+
mkdirSync6(join140(base2, ".claude-plugin"), { recursive: true });
|
|
110360
|
+
writeFileSync8(join140(base2, ".claude-plugin", "marketplace.json"), `${JSON.stringify(claudeMarketplace, null, 2)}
|
|
110215
110361
|
`, "utf-8");
|
|
110216
110362
|
const codexMarketplace = {
|
|
110217
110363
|
name: "claudekit",
|
|
@@ -110225,16 +110371,16 @@ function stagePluginSource(extractDir, stageBaseDir) {
|
|
|
110225
110371
|
}
|
|
110226
110372
|
]
|
|
110227
110373
|
};
|
|
110228
|
-
mkdirSync6(
|
|
110229
|
-
writeFileSync8(
|
|
110374
|
+
mkdirSync6(join140(base2, ".agents", "plugins"), { recursive: true });
|
|
110375
|
+
writeFileSync8(join140(base2, ".agents", "plugins", "marketplace.json"), `${JSON.stringify(codexMarketplace, null, 2)}
|
|
110230
110376
|
`, "utf-8");
|
|
110231
110377
|
return base2;
|
|
110232
110378
|
}
|
|
110233
110379
|
function ensureCodexPluginManifest(pluginRoot) {
|
|
110234
|
-
const manifestPath =
|
|
110235
|
-
if (
|
|
110380
|
+
const manifestPath = join140(pluginRoot, ".codex-plugin", "plugin.json");
|
|
110381
|
+
if (existsSync72(manifestPath))
|
|
110236
110382
|
return;
|
|
110237
|
-
const claudeManifest = readJsonSafe4(
|
|
110383
|
+
const claudeManifest = readJsonSafe4(join140(pluginRoot, ".claude-plugin", "plugin.json"));
|
|
110238
110384
|
const manifest = pruneUndefined({
|
|
110239
110385
|
name: stringField2(claudeManifest, "name") ?? "ck",
|
|
110240
110386
|
version: stringField2(claudeManifest, "version") ?? "0.0.0",
|
|
@@ -110255,7 +110401,7 @@ function ensureCodexPluginManifest(pluginRoot) {
|
|
|
110255
110401
|
websiteURL: "https://github.com/claudekit/claudekit-engineer"
|
|
110256
110402
|
}
|
|
110257
110403
|
});
|
|
110258
|
-
mkdirSync6(
|
|
110404
|
+
mkdirSync6(join140(pluginRoot, ".codex-plugin"), { recursive: true });
|
|
110259
110405
|
writeFileSync8(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
110260
110406
|
`, "utf-8");
|
|
110261
110407
|
}
|
|
@@ -110327,7 +110473,7 @@ function logCodexPluginCleanup(result) {
|
|
|
110327
110473
|
init_config_manager();
|
|
110328
110474
|
init_github_client();
|
|
110329
110475
|
import { mkdir as mkdir36 } from "node:fs/promises";
|
|
110330
|
-
import { join as
|
|
110476
|
+
import { join as join143, resolve as resolve49 } from "node:path";
|
|
110331
110477
|
|
|
110332
110478
|
// src/domains/github/kit-access-checker.ts
|
|
110333
110479
|
init_error2();
|
|
@@ -110499,8 +110645,8 @@ init_hook_health_checker();
|
|
|
110499
110645
|
|
|
110500
110646
|
// src/domains/installation/fresh-installer.ts
|
|
110501
110647
|
init_metadata_migration();
|
|
110502
|
-
import { existsSync as
|
|
110503
|
-
import { basename as basename28, dirname as dirname44, join as
|
|
110648
|
+
import { existsSync as existsSync73, readdirSync as readdirSync12, rmSync as rmSync6, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
|
|
110649
|
+
import { basename as basename28, dirname as dirname44, join as join141, resolve as resolve47 } from "node:path";
|
|
110504
110650
|
init_logger();
|
|
110505
110651
|
init_safe_spinner();
|
|
110506
110652
|
var import_fs_extra35 = __toESM(require_lib(), 1);
|
|
@@ -110582,8 +110728,8 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
|
|
|
110582
110728
|
logger.debug(`${KIT_MANIFEST_FILE} was self-tracked; skipping from delete loop — will be rewritten by updateMetadataAfterFresh`);
|
|
110583
110729
|
}
|
|
110584
110730
|
for (const file of filesToRemove) {
|
|
110585
|
-
const fullPath =
|
|
110586
|
-
if (!
|
|
110731
|
+
const fullPath = join141(claudeDir3, file.path);
|
|
110732
|
+
if (!existsSync73(fullPath)) {
|
|
110587
110733
|
continue;
|
|
110588
110734
|
}
|
|
110589
110735
|
try {
|
|
@@ -110610,7 +110756,7 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
|
|
|
110610
110756
|
};
|
|
110611
110757
|
}
|
|
110612
110758
|
async function updateMetadataAfterFresh(claudeDir3, removedFiles, metadata) {
|
|
110613
|
-
const metadataPath =
|
|
110759
|
+
const metadataPath = join141(claudeDir3, KIT_MANIFEST_FILE);
|
|
110614
110760
|
const removedSet = new Set(removedFiles);
|
|
110615
110761
|
if (metadata.kits) {
|
|
110616
110762
|
for (const kitName of Object.keys(metadata.kits)) {
|
|
@@ -110641,8 +110787,8 @@ function getFreshBackupTargets(claudeDir3, analysis, includeModified) {
|
|
|
110641
110787
|
mutatePaths: filesToRemove.length > 0 ? ["metadata.json"] : []
|
|
110642
110788
|
};
|
|
110643
110789
|
}
|
|
110644
|
-
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) =>
|
|
110645
|
-
if (
|
|
110790
|
+
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync73(join141(claudeDir3, subdir)));
|
|
110791
|
+
if (existsSync73(join141(claudeDir3, "metadata.json"))) {
|
|
110646
110792
|
deletePaths.push("metadata.json");
|
|
110647
110793
|
}
|
|
110648
110794
|
return {
|
|
@@ -110664,7 +110810,7 @@ async function removeSubdirectoriesFallback(claudeDir3) {
|
|
|
110664
110810
|
const removedFiles = [];
|
|
110665
110811
|
let removedDirCount = 0;
|
|
110666
110812
|
for (const subdir of CLAUDEKIT_SUBDIRECTORIES) {
|
|
110667
|
-
const subdirPath =
|
|
110813
|
+
const subdirPath = join141(claudeDir3, subdir);
|
|
110668
110814
|
if (await import_fs_extra35.pathExists(subdirPath)) {
|
|
110669
110815
|
rmSync6(subdirPath, { recursive: true, force: true });
|
|
110670
110816
|
removedDirCount++;
|
|
@@ -110672,7 +110818,7 @@ async function removeSubdirectoriesFallback(claudeDir3) {
|
|
|
110672
110818
|
logger.debug(`Removed subdirectory: ${subdir}/`);
|
|
110673
110819
|
}
|
|
110674
110820
|
}
|
|
110675
|
-
const metadataPath =
|
|
110821
|
+
const metadataPath = join141(claudeDir3, "metadata.json");
|
|
110676
110822
|
if (await import_fs_extra35.pathExists(metadataPath)) {
|
|
110677
110823
|
unlinkSync5(metadataPath);
|
|
110678
110824
|
removedFiles.push("metadata.json");
|
|
@@ -110750,7 +110896,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
|
|
|
110750
110896
|
var import_fs_extra36 = __toESM(require_lib(), 1);
|
|
110751
110897
|
import { cp as cp5, mkdir as mkdir35, readdir as readdir42, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
|
|
110752
110898
|
import { homedir as homedir47 } from "node:os";
|
|
110753
|
-
import { dirname as dirname45, join as
|
|
110899
|
+
import { dirname as dirname45, join as join142, normalize as normalize12, resolve as resolve48 } from "node:path";
|
|
110754
110900
|
var LEGACY_KIT_MARKERS = [
|
|
110755
110901
|
"metadata.json",
|
|
110756
110902
|
".ck.json",
|
|
@@ -110789,10 +110935,10 @@ function getLegacyWindowsGlobalKitDirCandidates(env2 = process.env, homeDir = ho
|
|
|
110789
110935
|
const localAppData = safeEnvPath(env2.LOCALAPPDATA);
|
|
110790
110936
|
const appData = safeEnvPath(env2.APPDATA);
|
|
110791
110937
|
if (localAppData) {
|
|
110792
|
-
candidates.push(
|
|
110938
|
+
candidates.push(join142(localAppData, ".claude"));
|
|
110793
110939
|
}
|
|
110794
110940
|
if (appData) {
|
|
110795
|
-
candidates.push(
|
|
110941
|
+
candidates.push(join142(appData, ".claude"));
|
|
110796
110942
|
}
|
|
110797
110943
|
if (homeDir) {
|
|
110798
110944
|
candidates.push(`${withoutTrailingSeparators(homeDir)}.claude`);
|
|
@@ -110810,7 +110956,7 @@ async function hasKitMarkers(dir) {
|
|
|
110810
110956
|
if (!await isDirectory(dir))
|
|
110811
110957
|
return false;
|
|
110812
110958
|
for (const marker of LEGACY_KIT_MARKERS) {
|
|
110813
|
-
if (await import_fs_extra36.pathExists(
|
|
110959
|
+
if (await import_fs_extra36.pathExists(join142(dir, marker))) {
|
|
110814
110960
|
return true;
|
|
110815
110961
|
}
|
|
110816
110962
|
}
|
|
@@ -111112,7 +111258,7 @@ async function handleSelection(ctx) {
|
|
|
111112
111258
|
}
|
|
111113
111259
|
if (!ctx.options.fresh) {
|
|
111114
111260
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
111115
|
-
const claudeDir3 = prefix ?
|
|
111261
|
+
const claudeDir3 = prefix ? join143(resolvedDir, prefix) : resolvedDir;
|
|
111116
111262
|
try {
|
|
111117
111263
|
const existingMetadata = await readManifest(claudeDir3);
|
|
111118
111264
|
if (existingMetadata?.kits) {
|
|
@@ -111149,7 +111295,7 @@ async function handleSelection(ctx) {
|
|
|
111149
111295
|
}
|
|
111150
111296
|
if (ctx.options.fresh) {
|
|
111151
111297
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
111152
|
-
const claudeDir3 = prefix ?
|
|
111298
|
+
const claudeDir3 = prefix ? join143(resolvedDir, prefix) : resolvedDir;
|
|
111153
111299
|
const canProceed = await handleFreshInstallation(claudeDir3, ctx.prompts);
|
|
111154
111300
|
if (!canProceed) {
|
|
111155
111301
|
return { ...ctx, cancelled: true };
|
|
@@ -111169,7 +111315,7 @@ async function handleSelection(ctx) {
|
|
|
111169
111315
|
let currentVersion = null;
|
|
111170
111316
|
try {
|
|
111171
111317
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
111172
|
-
const claudeDir3 = prefix ?
|
|
111318
|
+
const claudeDir3 = prefix ? join143(resolvedDir, prefix) : resolvedDir;
|
|
111173
111319
|
const existingMetadata = await readManifest(claudeDir3);
|
|
111174
111320
|
currentVersion = existingMetadata?.kits?.[kitType]?.version || null;
|
|
111175
111321
|
if (currentVersion) {
|
|
@@ -111238,7 +111384,7 @@ async function handleSelection(ctx) {
|
|
|
111238
111384
|
if (ctx.options.yes && !ctx.options.fresh && !ctx.options.force && !ctx.options.restoreCkHooks && releaseTag && !isOfflineMode && !pendingKits?.length) {
|
|
111239
111385
|
try {
|
|
111240
111386
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
111241
|
-
const claudeDir3 = prefix ?
|
|
111387
|
+
const claudeDir3 = prefix ? join143(resolvedDir, prefix) : resolvedDir;
|
|
111242
111388
|
const existingMetadata = await readManifest(claudeDir3);
|
|
111243
111389
|
const installedKitVersion = existingMetadata?.kits?.[kitType]?.version;
|
|
111244
111390
|
if (installedKitVersion && versionsMatch(installedKitVersion, releaseTag)) {
|
|
@@ -111266,8 +111412,8 @@ async function handleSelection(ctx) {
|
|
|
111266
111412
|
};
|
|
111267
111413
|
}
|
|
111268
111414
|
// src/commands/init/phases/sync-handler.ts
|
|
111269
|
-
import { copyFile as copyFile8, mkdir as mkdir37, open as open5, readFile as
|
|
111270
|
-
import { dirname as dirname46, join as
|
|
111415
|
+
import { copyFile as copyFile8, mkdir as mkdir37, open as open5, readFile as readFile62, rename as rename12, stat as stat23, unlink as unlink13, writeFile as writeFile35 } from "node:fs/promises";
|
|
111416
|
+
import { dirname as dirname46, join as join144, resolve as resolve50 } from "node:path";
|
|
111271
111417
|
init_logger();
|
|
111272
111418
|
init_path_resolver();
|
|
111273
111419
|
var import_fs_extra38 = __toESM(require_lib(), 1);
|
|
@@ -111277,13 +111423,13 @@ async function handleSync(ctx) {
|
|
|
111277
111423
|
return ctx;
|
|
111278
111424
|
}
|
|
111279
111425
|
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve50(ctx.options.dir || ".");
|
|
111280
|
-
const claudeDir3 = ctx.options.global ? resolvedDir :
|
|
111426
|
+
const claudeDir3 = ctx.options.global ? resolvedDir : join144(resolvedDir, ".claude");
|
|
111281
111427
|
if (!await import_fs_extra38.pathExists(claudeDir3)) {
|
|
111282
111428
|
logger.error("Cannot sync: no .claude directory found");
|
|
111283
111429
|
ctx.prompts.note("Run 'ck init' without --sync to install first.", "No Installation Found");
|
|
111284
111430
|
return { ...ctx, cancelled: true };
|
|
111285
111431
|
}
|
|
111286
|
-
const metadataPath =
|
|
111432
|
+
const metadataPath = join144(claudeDir3, "metadata.json");
|
|
111287
111433
|
if (!await import_fs_extra38.pathExists(metadataPath)) {
|
|
111288
111434
|
logger.error("Cannot sync: no metadata.json found");
|
|
111289
111435
|
ctx.prompts.note(`Your installation may be from an older version.
|
|
@@ -111383,7 +111529,7 @@ function getLockTimeout() {
|
|
|
111383
111529
|
var STALE_LOCK_THRESHOLD_MS = 5 * 60 * 1000;
|
|
111384
111530
|
async function acquireSyncLock(global3) {
|
|
111385
111531
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
111386
|
-
const lockPath =
|
|
111532
|
+
const lockPath = join144(cacheDir, ".sync-lock");
|
|
111387
111533
|
const startTime = Date.now();
|
|
111388
111534
|
const lockTimeout = getLockTimeout();
|
|
111389
111535
|
await mkdir37(dirname46(lockPath), { recursive: true });
|
|
@@ -111429,13 +111575,13 @@ async function executeSyncMerge(ctx) {
|
|
|
111429
111575
|
const releaseLock = await acquireSyncLock(ctx.options.global);
|
|
111430
111576
|
try {
|
|
111431
111577
|
const trackedFiles = ctx.syncTrackedFiles;
|
|
111432
|
-
const upstreamDir = ctx.options.global ?
|
|
111578
|
+
const upstreamDir = ctx.options.global ? join144(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
111433
111579
|
let sourceMetadata = null;
|
|
111434
111580
|
let deletions = [];
|
|
111435
111581
|
try {
|
|
111436
|
-
const sourceMetadataPath =
|
|
111582
|
+
const sourceMetadataPath = join144(upstreamDir, "metadata.json");
|
|
111437
111583
|
if (await import_fs_extra38.pathExists(sourceMetadataPath)) {
|
|
111438
|
-
const content = await
|
|
111584
|
+
const content = await readFile62(sourceMetadataPath, "utf-8");
|
|
111439
111585
|
sourceMetadata = JSON.parse(content);
|
|
111440
111586
|
deletions = sourceMetadata.deletions || [];
|
|
111441
111587
|
}
|
|
@@ -111495,7 +111641,7 @@ async function executeSyncMerge(ctx) {
|
|
|
111495
111641
|
try {
|
|
111496
111642
|
const sourcePath = await validateSyncPath(upstreamDir, file.path);
|
|
111497
111643
|
const targetPath = await validateSyncPath(ctx.claudeDir, file.path);
|
|
111498
|
-
const targetDir =
|
|
111644
|
+
const targetDir = join144(targetPath, "..");
|
|
111499
111645
|
try {
|
|
111500
111646
|
await mkdir37(targetDir, { recursive: true });
|
|
111501
111647
|
} catch (mkdirError) {
|
|
@@ -111666,7 +111812,7 @@ async function createBackup(claudeDir3, files, backupDir) {
|
|
|
111666
111812
|
const sourcePath = await validateSyncPath(claudeDir3, file.path);
|
|
111667
111813
|
if (await import_fs_extra38.pathExists(sourcePath)) {
|
|
111668
111814
|
const targetPath = await validateSyncPath(backupDir, file.path);
|
|
111669
|
-
const targetDir =
|
|
111815
|
+
const targetDir = join144(targetPath, "..");
|
|
111670
111816
|
await mkdir37(targetDir, { recursive: true });
|
|
111671
111817
|
await copyFile8(sourcePath, targetPath);
|
|
111672
111818
|
}
|
|
@@ -111681,7 +111827,7 @@ async function createBackup(claudeDir3, files, backupDir) {
|
|
|
111681
111827
|
}
|
|
111682
111828
|
// src/commands/init/phases/transform-handler.ts
|
|
111683
111829
|
init_config_manager();
|
|
111684
|
-
import { join as
|
|
111830
|
+
import { join as join148 } from "node:path";
|
|
111685
111831
|
|
|
111686
111832
|
// src/services/transformers/folder-path-transformer.ts
|
|
111687
111833
|
init_logger();
|
|
@@ -111692,38 +111838,38 @@ init_logger();
|
|
|
111692
111838
|
init_types3();
|
|
111693
111839
|
var import_fs_extra39 = __toESM(require_lib(), 1);
|
|
111694
111840
|
import { rename as rename13, rm as rm17 } from "node:fs/promises";
|
|
111695
|
-
import { join as
|
|
111841
|
+
import { join as join145, relative as relative32 } from "node:path";
|
|
111696
111842
|
async function collectDirsToRename(extractDir, folders) {
|
|
111697
111843
|
const dirsToRename = [];
|
|
111698
111844
|
if (folders.docs !== DEFAULT_FOLDERS.docs) {
|
|
111699
|
-
const docsPath =
|
|
111845
|
+
const docsPath = join145(extractDir, DEFAULT_FOLDERS.docs);
|
|
111700
111846
|
if (await import_fs_extra39.pathExists(docsPath)) {
|
|
111701
111847
|
dirsToRename.push({
|
|
111702
111848
|
from: docsPath,
|
|
111703
|
-
to:
|
|
111849
|
+
to: join145(extractDir, folders.docs)
|
|
111704
111850
|
});
|
|
111705
111851
|
}
|
|
111706
|
-
const claudeDocsPath =
|
|
111852
|
+
const claudeDocsPath = join145(extractDir, ".claude", DEFAULT_FOLDERS.docs);
|
|
111707
111853
|
if (await import_fs_extra39.pathExists(claudeDocsPath)) {
|
|
111708
111854
|
dirsToRename.push({
|
|
111709
111855
|
from: claudeDocsPath,
|
|
111710
|
-
to:
|
|
111856
|
+
to: join145(extractDir, ".claude", folders.docs)
|
|
111711
111857
|
});
|
|
111712
111858
|
}
|
|
111713
111859
|
}
|
|
111714
111860
|
if (folders.plans !== DEFAULT_FOLDERS.plans) {
|
|
111715
|
-
const plansPath =
|
|
111861
|
+
const plansPath = join145(extractDir, DEFAULT_FOLDERS.plans);
|
|
111716
111862
|
if (await import_fs_extra39.pathExists(plansPath)) {
|
|
111717
111863
|
dirsToRename.push({
|
|
111718
111864
|
from: plansPath,
|
|
111719
|
-
to:
|
|
111865
|
+
to: join145(extractDir, folders.plans)
|
|
111720
111866
|
});
|
|
111721
111867
|
}
|
|
111722
|
-
const claudePlansPath =
|
|
111868
|
+
const claudePlansPath = join145(extractDir, ".claude", DEFAULT_FOLDERS.plans);
|
|
111723
111869
|
if (await import_fs_extra39.pathExists(claudePlansPath)) {
|
|
111724
111870
|
dirsToRename.push({
|
|
111725
111871
|
from: claudePlansPath,
|
|
111726
|
-
to:
|
|
111872
|
+
to: join145(extractDir, ".claude", folders.plans)
|
|
111727
111873
|
});
|
|
111728
111874
|
}
|
|
111729
111875
|
}
|
|
@@ -111763,8 +111909,8 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
111763
111909
|
// src/services/transformers/folder-transform/path-replacer.ts
|
|
111764
111910
|
init_logger();
|
|
111765
111911
|
init_types3();
|
|
111766
|
-
import { readFile as
|
|
111767
|
-
import { join as
|
|
111912
|
+
import { readFile as readFile63, readdir as readdir43, writeFile as writeFile36 } from "node:fs/promises";
|
|
111913
|
+
import { join as join146, relative as relative33 } from "node:path";
|
|
111768
111914
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
111769
111915
|
".md",
|
|
111770
111916
|
".txt",
|
|
@@ -111817,7 +111963,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
111817
111963
|
let replacementsCount = 0;
|
|
111818
111964
|
const entries = await readdir43(dir, { withFileTypes: true });
|
|
111819
111965
|
for (const entry of entries) {
|
|
111820
|
-
const fullPath =
|
|
111966
|
+
const fullPath = join146(dir, entry.name);
|
|
111821
111967
|
if (entry.isDirectory()) {
|
|
111822
111968
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
111823
111969
|
continue;
|
|
@@ -111830,7 +111976,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
111830
111976
|
if (!shouldTransform)
|
|
111831
111977
|
continue;
|
|
111832
111978
|
try {
|
|
111833
|
-
const content = await
|
|
111979
|
+
const content = await readFile63(fullPath, "utf-8");
|
|
111834
111980
|
let newContent = content;
|
|
111835
111981
|
let changeCount = 0;
|
|
111836
111982
|
for (const { regex: regex2, replacement } of compiledReplacements) {
|
|
@@ -111952,9 +112098,9 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
111952
112098
|
|
|
111953
112099
|
// src/services/transformers/global-path-transformer.ts
|
|
111954
112100
|
init_logger();
|
|
111955
|
-
import { readFile as
|
|
112101
|
+
import { readFile as readFile64, readdir as readdir44, writeFile as writeFile37 } from "node:fs/promises";
|
|
111956
112102
|
import { homedir as homedir48, platform as platform16 } from "node:os";
|
|
111957
|
-
import { extname as extname7, join as
|
|
112103
|
+
import { extname as extname7, join as join147 } from "node:path";
|
|
111958
112104
|
var IS_WINDOWS3 = platform16() === "win32";
|
|
111959
112105
|
var HOME_PREFIX = "$HOME";
|
|
111960
112106
|
function getHomeDirPrefix() {
|
|
@@ -111964,7 +112110,7 @@ function normalizeInstallPath(path17) {
|
|
|
111964
112110
|
return path17.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
111965
112111
|
}
|
|
111966
112112
|
function getDefaultGlobalClaudeDir() {
|
|
111967
|
-
return normalizeInstallPath(
|
|
112113
|
+
return normalizeInstallPath(join147(homedir48(), ".claude"));
|
|
111968
112114
|
}
|
|
111969
112115
|
function getCustomGlobalClaudeDir(targetClaudeDir) {
|
|
111970
112116
|
if (!targetClaudeDir)
|
|
@@ -112095,7 +112241,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
112095
112241
|
async function processDirectory2(dir) {
|
|
112096
112242
|
const entries = await readdir44(dir, { withFileTypes: true });
|
|
112097
112243
|
for (const entry of entries) {
|
|
112098
|
-
const fullPath =
|
|
112244
|
+
const fullPath = join147(dir, entry.name);
|
|
112099
112245
|
if (entry.isDirectory()) {
|
|
112100
112246
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
112101
112247
|
continue;
|
|
@@ -112103,7 +112249,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
112103
112249
|
await processDirectory2(fullPath);
|
|
112104
112250
|
} else if (entry.isFile() && shouldTransformFile3(entry.name)) {
|
|
112105
112251
|
try {
|
|
112106
|
-
const content = await
|
|
112252
|
+
const content = await readFile64(fullPath, "utf-8");
|
|
112107
112253
|
const { transformed, changes } = transformContent(content, {
|
|
112108
112254
|
targetClaudeDir: options2.targetClaudeDir
|
|
112109
112255
|
});
|
|
@@ -112174,7 +112320,7 @@ async function handleTransforms(ctx) {
|
|
|
112174
112320
|
logger.debug(ctx.options.global ? "Saved folder configuration to ~/.claude/.ck.json" : "Saved folder configuration to .claude/.ck.json");
|
|
112175
112321
|
}
|
|
112176
112322
|
}
|
|
112177
|
-
const claudeDir3 = ctx.options.global ? ctx.resolvedDir :
|
|
112323
|
+
const claudeDir3 = ctx.options.global ? ctx.resolvedDir : join148(ctx.resolvedDir, ".claude");
|
|
112178
112324
|
return {
|
|
112179
112325
|
...ctx,
|
|
112180
112326
|
foldersConfig,
|
|
@@ -112242,6 +112388,7 @@ function createInitContext(rawOptions, prompts) {
|
|
|
112242
112388
|
exclude: [],
|
|
112243
112389
|
only: [],
|
|
112244
112390
|
installSkills: false,
|
|
112391
|
+
packageManager: "auto",
|
|
112245
112392
|
withSudo: false,
|
|
112246
112393
|
skipSetup: false,
|
|
112247
112394
|
forceOverwrite: false,
|
|
@@ -112399,10 +112546,10 @@ async function initCommand(options2) {
|
|
|
112399
112546
|
// src/commands/migrate/migrate-command.ts
|
|
112400
112547
|
init_dist2();
|
|
112401
112548
|
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
112402
|
-
import { existsSync as
|
|
112403
|
-
import { readFile as
|
|
112549
|
+
import { existsSync as existsSync74 } from "node:fs";
|
|
112550
|
+
import { readFile as readFile68, rm as rm18, unlink as unlink14 } from "node:fs/promises";
|
|
112404
112551
|
import { homedir as homedir52 } from "node:os";
|
|
112405
|
-
import { basename as basename30, dirname as dirname49, join as
|
|
112552
|
+
import { basename as basename30, dirname as dirname49, join as join152, resolve as resolve51 } from "node:path";
|
|
112406
112553
|
init_logger();
|
|
112407
112554
|
|
|
112408
112555
|
// src/ui/ck-cli-design/next-steps-footer.ts
|
|
@@ -112615,15 +112762,15 @@ init_model_taxonomy();
|
|
|
112615
112762
|
init_logger();
|
|
112616
112763
|
init_dist2();
|
|
112617
112764
|
init_model_taxonomy();
|
|
112618
|
-
import { mkdir as mkdir39, readFile as
|
|
112765
|
+
import { mkdir as mkdir39, readFile as readFile67, writeFile as writeFile39 } from "node:fs/promises";
|
|
112619
112766
|
import { homedir as homedir51 } from "node:os";
|
|
112620
|
-
import { dirname as dirname47, join as
|
|
112767
|
+
import { dirname as dirname47, join as join151 } from "node:path";
|
|
112621
112768
|
|
|
112622
112769
|
// src/commands/portable/models-dev-cache.ts
|
|
112623
112770
|
init_logger();
|
|
112624
|
-
import { mkdir as mkdir38, readFile as
|
|
112771
|
+
import { mkdir as mkdir38, readFile as readFile65, rename as rename14, writeFile as writeFile38 } from "node:fs/promises";
|
|
112625
112772
|
import { homedir as homedir49 } from "node:os";
|
|
112626
|
-
import { join as
|
|
112773
|
+
import { join as join149 } from "node:path";
|
|
112627
112774
|
|
|
112628
112775
|
class ModelsDevUnavailableError extends Error {
|
|
112629
112776
|
constructor(message, cause) {
|
|
@@ -112635,18 +112782,18 @@ var MODELS_DEV_URL = "https://models.dev/api.json";
|
|
|
112635
112782
|
var CACHE_TTL_MS3 = 24 * 60 * 60 * 1000;
|
|
112636
112783
|
var FETCH_TIMEOUT_MS = 1e4;
|
|
112637
112784
|
function defaultCacheDir() {
|
|
112638
|
-
return
|
|
112785
|
+
return join149(homedir49(), ".config", "claudekit", "cache");
|
|
112639
112786
|
}
|
|
112640
112787
|
function cacheFilePath(cacheDir) {
|
|
112641
|
-
return
|
|
112788
|
+
return join149(cacheDir, "models-dev.json");
|
|
112642
112789
|
}
|
|
112643
112790
|
function tmpFilePath(cacheDir) {
|
|
112644
|
-
return
|
|
112791
|
+
return join149(cacheDir, "models-dev.json.tmp");
|
|
112645
112792
|
}
|
|
112646
112793
|
async function readCacheEntry(cacheDir) {
|
|
112647
112794
|
const filePath = cacheFilePath(cacheDir);
|
|
112648
112795
|
try {
|
|
112649
|
-
const raw2 = await
|
|
112796
|
+
const raw2 = await readFile65(filePath, "utf-8");
|
|
112650
112797
|
const parsed = JSON.parse(raw2);
|
|
112651
112798
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) && "fetchedAt" in parsed && typeof parsed.fetchedAt === "string" && "payload" in parsed && typeof parsed.payload === "object" && parsed.payload !== null) {
|
|
112652
112799
|
return parsed;
|
|
@@ -112714,21 +112861,21 @@ async function getModelsDevCatalog(opts = {}) {
|
|
|
112714
112861
|
|
|
112715
112862
|
// src/commands/portable/opencode-model-discovery.ts
|
|
112716
112863
|
init_logger();
|
|
112717
|
-
import { readFile as
|
|
112864
|
+
import { readFile as readFile66 } from "node:fs/promises";
|
|
112718
112865
|
import { homedir as homedir50, platform as platform17 } from "node:os";
|
|
112719
|
-
import { join as
|
|
112866
|
+
import { join as join150 } from "node:path";
|
|
112720
112867
|
function resolveOpenCodeAuthPath(homeDir) {
|
|
112721
112868
|
if (platform17() === "win32") {
|
|
112722
|
-
const dataRoot2 = process.env.LOCALAPPDATA ??
|
|
112723
|
-
return
|
|
112869
|
+
const dataRoot2 = process.env.LOCALAPPDATA ?? join150(homeDir, "AppData", "Local");
|
|
112870
|
+
return join150(dataRoot2, "opencode", "auth.json");
|
|
112724
112871
|
}
|
|
112725
|
-
const dataRoot = process.env.XDG_DATA_HOME ??
|
|
112726
|
-
return
|
|
112872
|
+
const dataRoot = process.env.XDG_DATA_HOME ?? join150(homeDir, ".local", "share");
|
|
112873
|
+
return join150(dataRoot, "opencode", "auth.json");
|
|
112727
112874
|
}
|
|
112728
112875
|
async function readAuthedProviders(homeDir) {
|
|
112729
112876
|
const authPath = resolveOpenCodeAuthPath(homeDir);
|
|
112730
112877
|
try {
|
|
112731
|
-
const raw2 = await
|
|
112878
|
+
const raw2 = await readFile66(authPath, "utf-8");
|
|
112732
112879
|
const parsed = JSON.parse(raw2);
|
|
112733
112880
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
112734
112881
|
return Object.keys(parsed);
|
|
@@ -112825,9 +112972,9 @@ function messageForReason(reason) {
|
|
|
112825
112972
|
}
|
|
112826
112973
|
function getOpenCodeConfigPath(options2) {
|
|
112827
112974
|
if (options2.global) {
|
|
112828
|
-
return
|
|
112975
|
+
return join151(options2.homeDir ?? homedir51(), ".config", "opencode", "opencode.json");
|
|
112829
112976
|
}
|
|
112830
|
-
return
|
|
112977
|
+
return join151(options2.cwd ?? process.cwd(), "opencode.json");
|
|
112831
112978
|
}
|
|
112832
112979
|
function makeCatalogOpts(options2) {
|
|
112833
112980
|
return {
|
|
@@ -112930,7 +113077,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
112930
113077
|
const configPath = getOpenCodeConfigPath(options2);
|
|
112931
113078
|
let existing = null;
|
|
112932
113079
|
try {
|
|
112933
|
-
const raw2 = await
|
|
113080
|
+
const raw2 = await readFile67(configPath, "utf-8");
|
|
112934
113081
|
const parsed = JSON.parse(raw2);
|
|
112935
113082
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
112936
113083
|
existing = parsed;
|
|
@@ -113700,7 +113847,7 @@ function appendFallbackSkillActionsToPlan(plan, skills, selectedProviders, insta
|
|
|
113700
113847
|
reason: "New item, not previously installed",
|
|
113701
113848
|
reasonCode: "new-item",
|
|
113702
113849
|
reasonCopy: "New - not previously installed",
|
|
113703
|
-
targetPath:
|
|
113850
|
+
targetPath: join152(basePath, skill.name),
|
|
113704
113851
|
type: "skill"
|
|
113705
113852
|
});
|
|
113706
113853
|
}
|
|
@@ -113857,7 +114004,7 @@ async function executeDeleteAction(action, options2) {
|
|
|
113857
114004
|
const preservePaths = options2?.preservePaths ?? new Set;
|
|
113858
114005
|
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve51(action.targetPath));
|
|
113859
114006
|
try {
|
|
113860
|
-
if (!shouldPreserveTarget && action.targetPath &&
|
|
114007
|
+
if (!shouldPreserveTarget && action.targetPath && existsSync74(action.targetPath)) {
|
|
113861
114008
|
await rm18(action.targetPath, { recursive: true, force: true });
|
|
113862
114009
|
}
|
|
113863
114010
|
await removePortableInstallation(action.item, action.type, action.provider, action.global, action.targetPath ? { path: action.targetPath } : undefined);
|
|
@@ -113928,7 +114075,7 @@ function resolveHookTargetPath(item, provider, global3) {
|
|
|
113928
114075
|
const converted = convertItem(item, pathConfig.format, provider, { global: global3 });
|
|
113929
114076
|
if (converted.error)
|
|
113930
114077
|
return null;
|
|
113931
|
-
const targetPath = pathConfig.writeStrategy === "single-file" ? basePath :
|
|
114078
|
+
const targetPath = pathConfig.writeStrategy === "single-file" ? basePath : join152(basePath, converted.filename);
|
|
113932
114079
|
const resolvedTarget = resolve51(targetPath).replace(/\\/g, "/");
|
|
113933
114080
|
const resolvedBase = resolve51(basePath).replace(/\\/g, "/").replace(/\/+$/, "");
|
|
113934
114081
|
if (resolvedTarget !== resolvedBase && !resolvedTarget.startsWith(`${resolvedBase}/`)) {
|
|
@@ -113939,12 +114086,12 @@ function resolveHookTargetPath(item, provider, global3) {
|
|
|
113939
114086
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
113940
114087
|
if (!skillSourcePath)
|
|
113941
114088
|
return;
|
|
113942
|
-
const sourceMetadataPath =
|
|
113943
|
-
if (!
|
|
114089
|
+
const sourceMetadataPath = join152(resolve51(skillSourcePath, ".."), "metadata.json");
|
|
114090
|
+
if (!existsSync74(sourceMetadataPath))
|
|
113944
114091
|
return;
|
|
113945
114092
|
let sourceMetadata;
|
|
113946
114093
|
try {
|
|
113947
|
-
const content = await
|
|
114094
|
+
const content = await readFile68(sourceMetadataPath, "utf-8");
|
|
113948
114095
|
sourceMetadata = JSON.parse(content);
|
|
113949
114096
|
} catch (error) {
|
|
113950
114097
|
logger.debug(`[migrate] Failed to parse source metadata.json: ${error}`);
|
|
@@ -113952,8 +114099,8 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
113952
114099
|
}
|
|
113953
114100
|
if (!sourceMetadata.deletions || sourceMetadata.deletions.length === 0)
|
|
113954
114101
|
return;
|
|
113955
|
-
const claudeDir3 = installGlobally ?
|
|
113956
|
-
if (!
|
|
114102
|
+
const claudeDir3 = installGlobally ? join152(homedir52(), ".claude") : join152(process.cwd(), ".claude");
|
|
114103
|
+
if (!existsSync74(claudeDir3))
|
|
113957
114104
|
return;
|
|
113958
114105
|
try {
|
|
113959
114106
|
const result = await handleDeletions(sourceMetadata, claudeDir3, inferKitTypeFromSourceMetadata(sourceMetadata));
|
|
@@ -114080,8 +114227,8 @@ async function migrateCommand(options2) {
|
|
|
114080
114227
|
let requestedGlobal = options2.global ?? false;
|
|
114081
114228
|
let installGlobally = requestedGlobal;
|
|
114082
114229
|
if (options2.global === undefined && !options2.yes) {
|
|
114083
|
-
const projectTarget =
|
|
114084
|
-
const globalTarget =
|
|
114230
|
+
const projectTarget = join152(process.cwd(), ".claude");
|
|
114231
|
+
const globalTarget = join152(homedir52(), ".claude");
|
|
114085
114232
|
const scopeChoice = await ie({
|
|
114086
114233
|
message: "Installation scope",
|
|
114087
114234
|
options: [
|
|
@@ -114154,7 +114301,7 @@ async function migrateCommand(options2) {
|
|
|
114154
114301
|
}).join(`
|
|
114155
114302
|
`));
|
|
114156
114303
|
if (sourceGlobalOnly) {
|
|
114157
|
-
f2.info(import_picocolors30.default.dim(` Scope: global (--global / -g) - reading from ${formatDisplayPath(
|
|
114304
|
+
f2.info(import_picocolors30.default.dim(` Scope: global (--global / -g) - reading from ${formatDisplayPath(join152(homedir52(), ".claude"))}`));
|
|
114158
114305
|
} else {
|
|
114159
114306
|
f2.info(import_picocolors30.default.dim(` CWD: ${process.cwd()}`));
|
|
114160
114307
|
}
|
|
@@ -114245,9 +114392,9 @@ async function migrateCommand(options2) {
|
|
|
114245
114392
|
const interactive = process.stdout.isTTY && !options2.yes;
|
|
114246
114393
|
const conflictActions = plan.actions.filter((a3) => a3.action === "conflict");
|
|
114247
114394
|
for (const action of conflictActions) {
|
|
114248
|
-
if (!action.diff && action.targetPath &&
|
|
114395
|
+
if (!action.diff && action.targetPath && existsSync74(action.targetPath)) {
|
|
114249
114396
|
try {
|
|
114250
|
-
const targetContent = await
|
|
114397
|
+
const targetContent = await readFile68(action.targetPath, "utf-8");
|
|
114251
114398
|
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);
|
|
114252
114399
|
if (sourceItem) {
|
|
114253
114400
|
const providerConfig = providers[action.provider];
|
|
@@ -114344,7 +114491,7 @@ async function migrateCommand(options2) {
|
|
|
114344
114491
|
const progressSink = createMigrateProgressSink(writeTasks.length + plannedDeleteActions.length);
|
|
114345
114492
|
const writtenPaths = new Set;
|
|
114346
114493
|
const recordHookTargetForSettings = (provider, global3, targetPath) => {
|
|
114347
|
-
if (targetPath.length === 0 || !
|
|
114494
|
+
if (targetPath.length === 0 || !existsSync74(targetPath))
|
|
114348
114495
|
return;
|
|
114349
114496
|
const resolvedPath = resolve51(targetPath);
|
|
114350
114497
|
const entry = successfulHookFiles.get(provider) ?? {
|
|
@@ -114463,7 +114610,7 @@ async function migrateCommand(options2) {
|
|
|
114463
114610
|
for (const [hooksProvider, entry] of successfulHookFiles) {
|
|
114464
114611
|
if (entry.files.length === 0)
|
|
114465
114612
|
continue;
|
|
114466
|
-
const sourceSettingsPath = hooksSource ?
|
|
114613
|
+
const sourceSettingsPath = hooksSource ? join152(dirname49(hooksSource), "settings.json") : undefined;
|
|
114467
114614
|
const mergeResult = await migrateHooksSettings({
|
|
114468
114615
|
sourceProvider: "claude-code",
|
|
114469
114616
|
targetProvider: hooksProvider,
|
|
@@ -114576,7 +114723,7 @@ async function migrateCommand(options2) {
|
|
|
114576
114723
|
async function rollbackResults(results) {
|
|
114577
114724
|
const rolledBackPaths = new Set;
|
|
114578
114725
|
for (const result of results) {
|
|
114579
|
-
if (!result.path || !
|
|
114726
|
+
if (!result.path || !existsSync74(result.path))
|
|
114580
114727
|
continue;
|
|
114581
114728
|
try {
|
|
114582
114729
|
if (result.overwritten)
|
|
@@ -114841,7 +114988,7 @@ async function handleDirectorySetup(ctx) {
|
|
|
114841
114988
|
// src/commands/new/phases/project-creation.ts
|
|
114842
114989
|
init_config_manager();
|
|
114843
114990
|
init_github_client();
|
|
114844
|
-
import { join as
|
|
114991
|
+
import { join as join153 } from "node:path";
|
|
114845
114992
|
init_logger();
|
|
114846
114993
|
init_output_manager();
|
|
114847
114994
|
init_types3();
|
|
@@ -114967,7 +115114,7 @@ async function projectCreation(kit, resolvedDir, validOptions, isNonInteractive2
|
|
|
114967
115114
|
output.section("Installing");
|
|
114968
115115
|
logger.verbose("Installation target", { directory: resolvedDir });
|
|
114969
115116
|
const merger = new FileMerger;
|
|
114970
|
-
const claudeDir3 =
|
|
115117
|
+
const claudeDir3 = join153(resolvedDir, ".claude");
|
|
114971
115118
|
merger.setMultiKitContext(claudeDir3, kit);
|
|
114972
115119
|
if (validOptions.exclude && validOptions.exclude.length > 0) {
|
|
114973
115120
|
merger.addIgnorePatterns(validOptions.exclude);
|
|
@@ -115014,7 +115161,7 @@ async function handleProjectCreation(ctx) {
|
|
|
115014
115161
|
}
|
|
115015
115162
|
// src/commands/new/phases/post-setup.ts
|
|
115016
115163
|
init_projects_registry();
|
|
115017
|
-
import { join as
|
|
115164
|
+
import { join as join154 } from "node:path";
|
|
115018
115165
|
init_package_installer();
|
|
115019
115166
|
init_logger();
|
|
115020
115167
|
init_path_resolver();
|
|
@@ -115043,12 +115190,15 @@ async function postSetup(resolvedDir, validOptions, isNonInteractive2, prompts)
|
|
|
115043
115190
|
const skillsDir2 = PathResolver.buildSkillsPath(resolvedDir, false);
|
|
115044
115191
|
await handleSkillsInstallation2(skillsDir2, {
|
|
115045
115192
|
skipConfirm: isNonInteractive2,
|
|
115193
|
+
packageManager: validOptions.packageManager,
|
|
115194
|
+
projectDir: resolvedDir,
|
|
115195
|
+
isGlobal: false,
|
|
115046
115196
|
withSudo: validOptions.withSudo
|
|
115047
115197
|
});
|
|
115048
115198
|
}
|
|
115049
|
-
const claudeDir3 =
|
|
115199
|
+
const claudeDir3 = join154(resolvedDir, ".claude");
|
|
115050
115200
|
await promptSetupWizardIfNeeded({
|
|
115051
|
-
envPath:
|
|
115201
|
+
envPath: join154(claudeDir3, ".env"),
|
|
115052
115202
|
claudeDir: claudeDir3,
|
|
115053
115203
|
isGlobal: false,
|
|
115054
115204
|
isNonInteractive: isNonInteractive2,
|
|
@@ -115117,8 +115267,8 @@ Please use only one download method.`);
|
|
|
115117
115267
|
}
|
|
115118
115268
|
// src/commands/plan/plan-command.ts
|
|
115119
115269
|
init_output_manager();
|
|
115120
|
-
import { existsSync as
|
|
115121
|
-
import { dirname as dirname53, isAbsolute as isAbsolute15, join as
|
|
115270
|
+
import { existsSync as existsSync77, statSync as statSync13 } from "node:fs";
|
|
115271
|
+
import { dirname as dirname53, isAbsolute as isAbsolute15, join as join157, parse as parse7, resolve as resolve56 } from "node:path";
|
|
115122
115272
|
|
|
115123
115273
|
// src/commands/plan/plan-read-handlers.ts
|
|
115124
115274
|
init_config();
|
|
@@ -115127,15 +115277,15 @@ init_plans_registry();
|
|
|
115127
115277
|
init_logger();
|
|
115128
115278
|
init_output_manager();
|
|
115129
115279
|
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
115130
|
-
import { existsSync as
|
|
115131
|
-
import { basename as basename31, dirname as dirname51, join as
|
|
115280
|
+
import { existsSync as existsSync76, statSync as statSync12 } from "node:fs";
|
|
115281
|
+
import { basename as basename31, dirname as dirname51, join as join156, relative as relative34, resolve as resolve54 } from "node:path";
|
|
115132
115282
|
|
|
115133
115283
|
// src/commands/plan/plan-dependencies.ts
|
|
115134
115284
|
init_config();
|
|
115135
115285
|
init_plan_parser();
|
|
115136
115286
|
init_plans_registry();
|
|
115137
|
-
import { existsSync as
|
|
115138
|
-
import { dirname as dirname50, join as
|
|
115287
|
+
import { existsSync as existsSync75 } from "node:fs";
|
|
115288
|
+
import { dirname as dirname50, join as join155 } from "node:path";
|
|
115139
115289
|
async function resolvePlanDependencies(references, currentPlanFile, options2 = {}) {
|
|
115140
115290
|
if (references.length === 0)
|
|
115141
115291
|
return [];
|
|
@@ -115155,9 +115305,9 @@ async function resolvePlanDependencies(references, currentPlanFile, options2 = {
|
|
|
115155
115305
|
};
|
|
115156
115306
|
}
|
|
115157
115307
|
const scopeRoot = resolvePlanDirForScope(scope, projectRoot, config);
|
|
115158
|
-
const planFile =
|
|
115308
|
+
const planFile = join155(scopeRoot, planId, "plan.md");
|
|
115159
115309
|
const isSelfReference = planFile === currentPlanFile;
|
|
115160
|
-
if (!
|
|
115310
|
+
if (!existsSync75(planFile)) {
|
|
115161
115311
|
return {
|
|
115162
115312
|
reference,
|
|
115163
115313
|
scope,
|
|
@@ -115297,7 +115447,7 @@ async function handleStatus(target, options2) {
|
|
|
115297
115447
|
}
|
|
115298
115448
|
const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
|
|
115299
115449
|
const t = effectiveTarget ? resolve54(effectiveTarget) : null;
|
|
115300
|
-
const plansDir = t &&
|
|
115450
|
+
const plansDir = t && existsSync76(t) && statSync12(t).isDirectory() && !existsSync76(join156(t, "plan.md")) ? t : null;
|
|
115301
115451
|
if (plansDir) {
|
|
115302
115452
|
const planFiles = scanPlanDir(plansDir);
|
|
115303
115453
|
if (planFiles.length === 0) {
|
|
@@ -115715,27 +115865,27 @@ function resolveTargetPath(target, baseDir) {
|
|
|
115715
115865
|
return resolve56(target);
|
|
115716
115866
|
}
|
|
115717
115867
|
const cwdCandidate = resolve56(target);
|
|
115718
|
-
if (
|
|
115868
|
+
if (existsSync77(cwdCandidate)) {
|
|
115719
115869
|
return cwdCandidate;
|
|
115720
115870
|
}
|
|
115721
115871
|
return resolve56(baseDir, target);
|
|
115722
115872
|
}
|
|
115723
115873
|
function resolvePlanFile(target, baseDir) {
|
|
115724
115874
|
const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve56(baseDir) : process.cwd();
|
|
115725
|
-
if (
|
|
115875
|
+
if (existsSync77(t)) {
|
|
115726
115876
|
const stat24 = statSync13(t);
|
|
115727
115877
|
if (stat24.isFile())
|
|
115728
115878
|
return t;
|
|
115729
|
-
const candidate =
|
|
115730
|
-
if (
|
|
115879
|
+
const candidate = join157(t, "plan.md");
|
|
115880
|
+
if (existsSync77(candidate))
|
|
115731
115881
|
return candidate;
|
|
115732
115882
|
}
|
|
115733
115883
|
if (!target && !baseDir) {
|
|
115734
115884
|
let dir = process.cwd();
|
|
115735
115885
|
const root = parse7(dir).root;
|
|
115736
115886
|
while (dir !== root) {
|
|
115737
|
-
const candidate =
|
|
115738
|
-
if (
|
|
115887
|
+
const candidate = join157(dir, "plan.md");
|
|
115888
|
+
if (existsSync77(candidate))
|
|
115739
115889
|
return candidate;
|
|
115740
115890
|
dir = dirname53(dir);
|
|
115741
115891
|
}
|
|
@@ -115785,7 +115935,7 @@ async function planCommand(action, target, options2) {
|
|
|
115785
115935
|
let resolvedTarget = target;
|
|
115786
115936
|
if (resolvedAction && !knownActions.has(resolvedAction)) {
|
|
115787
115937
|
const looksLikePath = resolvedAction.includes("/") || resolvedAction.includes("\\") || resolvedAction.endsWith(".md") || resolvedAction === "." || resolvedAction === "..";
|
|
115788
|
-
const existsOnDisk = !looksLikePath &&
|
|
115938
|
+
const existsOnDisk = !looksLikePath && existsSync77(resolve56(resolvedAction));
|
|
115789
115939
|
if (looksLikePath || existsOnDisk) {
|
|
115790
115940
|
resolvedTarget = resolvedAction;
|
|
115791
115941
|
resolvedAction = undefined;
|
|
@@ -115827,13 +115977,13 @@ init_claudekit_data2();
|
|
|
115827
115977
|
init_logger();
|
|
115828
115978
|
init_safe_prompts();
|
|
115829
115979
|
var import_picocolors34 = __toESM(require_picocolors(), 1);
|
|
115830
|
-
import { existsSync as
|
|
115980
|
+
import { existsSync as existsSync78 } from "node:fs";
|
|
115831
115981
|
import { resolve as resolve57 } from "node:path";
|
|
115832
115982
|
async function handleAdd(projectPath, options2) {
|
|
115833
115983
|
logger.debug(`Adding project: ${projectPath}, options: ${JSON.stringify(options2)}`);
|
|
115834
115984
|
intro("Add Project");
|
|
115835
115985
|
const absolutePath = resolve57(projectPath);
|
|
115836
|
-
if (!
|
|
115986
|
+
if (!existsSync78(absolutePath)) {
|
|
115837
115987
|
log.error(`Path does not exist: ${absolutePath}`);
|
|
115838
115988
|
process.exitCode = 1;
|
|
115839
115989
|
return;
|
|
@@ -116183,6 +116333,7 @@ async function handleKitSelection(ctx) {
|
|
|
116183
116333
|
fresh: false,
|
|
116184
116334
|
force: false,
|
|
116185
116335
|
installSkills: false,
|
|
116336
|
+
packageManager: "auto",
|
|
116186
116337
|
withSudo: false,
|
|
116187
116338
|
prefix: false,
|
|
116188
116339
|
beta: false,
|
|
@@ -116254,11 +116405,11 @@ init_logger();
|
|
|
116254
116405
|
init_agents();
|
|
116255
116406
|
var import_gray_matter12 = __toESM(require_gray_matter(), 1);
|
|
116256
116407
|
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
116257
|
-
import { readFile as
|
|
116258
|
-
import { join as
|
|
116408
|
+
import { readFile as readFile69 } from "node:fs/promises";
|
|
116409
|
+
import { join as join159 } from "node:path";
|
|
116259
116410
|
|
|
116260
116411
|
// src/commands/skills/installed-skills-inventory.ts
|
|
116261
|
-
import { join as
|
|
116412
|
+
import { join as join158, resolve as resolve58 } from "node:path";
|
|
116262
116413
|
init_path_resolver();
|
|
116263
116414
|
var SCOPE_SORT_ORDER = {
|
|
116264
116415
|
project: 0,
|
|
@@ -116270,8 +116421,8 @@ async function getActiveClaudeSkillInstallations(options2 = {}) {
|
|
|
116270
116421
|
const projectClaudeDir = resolve58(projectDir, ".claude");
|
|
116271
116422
|
const projectScopeAliasesGlobal = projectClaudeDir === globalDir;
|
|
116272
116423
|
const [projectSkills, globalSkills] = await Promise.all([
|
|
116273
|
-
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(
|
|
116274
|
-
scanSkills2(
|
|
116424
|
+
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(join158(projectClaudeDir, "skills")),
|
|
116425
|
+
scanSkills2(join158(globalDir, "skills"))
|
|
116275
116426
|
]);
|
|
116276
116427
|
const projectIds = new Set(projectSkills.map((skill) => skill.id));
|
|
116277
116428
|
const globalIds = new Set(globalSkills.map((skill) => skill.id));
|
|
@@ -116432,9 +116583,9 @@ async function handleValidate2(sourcePath) {
|
|
|
116432
116583
|
spinner.stop(`Checked ${skills.length} skill(s)`);
|
|
116433
116584
|
let hasIssues = false;
|
|
116434
116585
|
for (const skill of skills) {
|
|
116435
|
-
const skillMdPath =
|
|
116586
|
+
const skillMdPath = join159(skill.path, "SKILL.md");
|
|
116436
116587
|
try {
|
|
116437
|
-
const content = await
|
|
116588
|
+
const content = await readFile69(skillMdPath, "utf-8");
|
|
116438
116589
|
const { data } = import_gray_matter12.default(content, {
|
|
116439
116590
|
engines: { javascript: { parse: () => ({}) } }
|
|
116440
116591
|
});
|
|
@@ -117015,7 +117166,7 @@ async function detectInstallations() {
|
|
|
117015
117166
|
|
|
117016
117167
|
// src/commands/uninstall/removal-handler.ts
|
|
117017
117168
|
import { readdirSync as readdirSync14, rmSync as rmSync8 } from "node:fs";
|
|
117018
|
-
import { basename as basename33, join as
|
|
117169
|
+
import { basename as basename33, join as join162, resolve as resolve59, sep as sep14 } from "node:path";
|
|
117019
117170
|
init_logger();
|
|
117020
117171
|
init_safe_prompts();
|
|
117021
117172
|
init_safe_spinner();
|
|
@@ -117024,7 +117175,7 @@ var import_fs_extra44 = __toESM(require_lib(), 1);
|
|
|
117024
117175
|
// src/commands/uninstall/analysis-handler.ts
|
|
117025
117176
|
init_metadata_migration();
|
|
117026
117177
|
import { readdirSync as readdirSync13, rmSync as rmSync7 } from "node:fs";
|
|
117027
|
-
import { dirname as dirname54, join as
|
|
117178
|
+
import { dirname as dirname54, join as join160 } from "node:path";
|
|
117028
117179
|
init_logger();
|
|
117029
117180
|
init_safe_prompts();
|
|
117030
117181
|
var import_fs_extra42 = __toESM(require_lib(), 1);
|
|
@@ -117084,7 +117235,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
117084
117235
|
const remainingFiles = metadata.kits?.[remainingKit]?.files || [];
|
|
117085
117236
|
for (const file of remainingFiles) {
|
|
117086
117237
|
const relativePath = normalizeTrackedPath(file.path);
|
|
117087
|
-
if (await import_fs_extra42.pathExists(
|
|
117238
|
+
if (await import_fs_extra42.pathExists(join160(installation.path, relativePath))) {
|
|
117088
117239
|
result.retainedManifestPaths.push(relativePath);
|
|
117089
117240
|
}
|
|
117090
117241
|
}
|
|
@@ -117092,7 +117243,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
117092
117243
|
const kitFiles = metadata.kits[kit].files || [];
|
|
117093
117244
|
for (const trackedFile of kitFiles) {
|
|
117094
117245
|
const relativePath = normalizeTrackedPath(trackedFile.path);
|
|
117095
|
-
const filePath =
|
|
117246
|
+
const filePath = join160(installation.path, relativePath);
|
|
117096
117247
|
if (preservedPaths.has(relativePath)) {
|
|
117097
117248
|
result.toPreserve.push({ path: relativePath, reason: "shared with other kit" });
|
|
117098
117249
|
continue;
|
|
@@ -117125,7 +117276,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
117125
117276
|
}
|
|
117126
117277
|
for (const trackedFile of allTrackedFiles) {
|
|
117127
117278
|
const relativePath = normalizeTrackedPath(trackedFile.path);
|
|
117128
|
-
const filePath =
|
|
117279
|
+
const filePath = join160(installation.path, relativePath);
|
|
117129
117280
|
const ownershipResult = await OwnershipChecker.checkOwnership(filePath, metadata, installation.path);
|
|
117130
117281
|
if (!ownershipResult.exists)
|
|
117131
117282
|
continue;
|
|
@@ -117176,7 +117327,7 @@ init_settings_merger();
|
|
|
117176
117327
|
init_command_normalizer();
|
|
117177
117328
|
init_logger();
|
|
117178
117329
|
var import_fs_extra43 = __toESM(require_lib(), 1);
|
|
117179
|
-
import { join as
|
|
117330
|
+
import { join as join161 } from "node:path";
|
|
117180
117331
|
var CK_JSON_FILE2 = ".ck.json";
|
|
117181
117332
|
var SETTINGS_FILE = "settings.json";
|
|
117182
117333
|
var EMPTY_RESULT = {
|
|
@@ -117298,7 +117449,7 @@ async function cleanupCkJson(ckJsonPath, data, removedKitNames, dryRun) {
|
|
|
117298
117449
|
return false;
|
|
117299
117450
|
}
|
|
117300
117451
|
async function cleanupUninstalledSettings(installationPath, options2) {
|
|
117301
|
-
const ckJsonPath =
|
|
117452
|
+
const ckJsonPath = join161(installationPath, CK_JSON_FILE2);
|
|
117302
117453
|
if (!await import_fs_extra43.pathExists(ckJsonPath)) {
|
|
117303
117454
|
return { ...EMPTY_RESULT };
|
|
117304
117455
|
}
|
|
@@ -117313,7 +117464,7 @@ async function cleanupUninstalledSettings(installationPath, options2) {
|
|
|
117313
117464
|
const removedKitNames = options2.kit ? [options2.kit] : Object.keys(kits);
|
|
117314
117465
|
const { hooks, servers } = resolveRemovalTargets(kits, removedKitNames, options2.remainingKits);
|
|
117315
117466
|
const result = { ...EMPTY_RESULT };
|
|
117316
|
-
const settingsPath =
|
|
117467
|
+
const settingsPath = join161(installationPath, SETTINGS_FILE);
|
|
117317
117468
|
const settings = await SettingsMerger.readSettingsFile(settingsPath);
|
|
117318
117469
|
if (settings) {
|
|
117319
117470
|
result.hooksRemoved = removeHooksFromSettings(settings, hooks);
|
|
@@ -117427,8 +117578,8 @@ async function removeInstallations(installations, options2) {
|
|
|
117427
117578
|
}
|
|
117428
117579
|
const mutatePaths = getUninstallMutatePaths({
|
|
117429
117580
|
retainedManifestPaths: analysis.retainedManifestPaths,
|
|
117430
|
-
settingsFileExists: await import_fs_extra44.pathExists(
|
|
117431
|
-
ckJsonExists: await import_fs_extra44.pathExists(
|
|
117581
|
+
settingsFileExists: await import_fs_extra44.pathExists(join162(installation.path, "settings.json")),
|
|
117582
|
+
ckJsonExists: await import_fs_extra44.pathExists(join162(installation.path, ".ck.json"))
|
|
117432
117583
|
});
|
|
117433
117584
|
let backup = null;
|
|
117434
117585
|
if (analysis.toDelete.length > 0 || mutatePaths.length > 0) {
|
|
@@ -117456,7 +117607,7 @@ async function removeInstallations(installations, options2) {
|
|
|
117456
117607
|
let removedCount = 0;
|
|
117457
117608
|
let cleanedDirs = 0;
|
|
117458
117609
|
for (const item of analysis.toDelete) {
|
|
117459
|
-
const filePath =
|
|
117610
|
+
const filePath = join162(installation.path, item.path);
|
|
117460
117611
|
if (!await import_fs_extra44.pathExists(filePath))
|
|
117461
117612
|
continue;
|
|
117462
117613
|
if (!await isPathSafeToRemove(filePath, installation.path)) {
|
|
@@ -117881,9 +118032,9 @@ ${import_picocolors40.default.bold(import_picocolors40.default.cyan(result.kitCo
|
|
|
117881
118032
|
|
|
117882
118033
|
// src/commands/watch/watch-command.ts
|
|
117883
118034
|
init_logger();
|
|
117884
|
-
import { existsSync as
|
|
118035
|
+
import { existsSync as existsSync84 } from "node:fs";
|
|
117885
118036
|
import { rm as rm19 } from "node:fs/promises";
|
|
117886
|
-
import { join as
|
|
118037
|
+
import { join as join169 } from "node:path";
|
|
117887
118038
|
var import_picocolors41 = __toESM(require_picocolors(), 1);
|
|
117888
118039
|
|
|
117889
118040
|
// src/commands/watch/phases/implementation-runner.ts
|
|
@@ -118402,7 +118553,7 @@ function spawnAndCollect3(command, args) {
|
|
|
118402
118553
|
|
|
118403
118554
|
// src/commands/watch/phases/issue-processor.ts
|
|
118404
118555
|
import { mkdir as mkdir40, writeFile as writeFile42 } from "node:fs/promises";
|
|
118405
|
-
import { join as
|
|
118556
|
+
import { join as join165 } from "node:path";
|
|
118406
118557
|
|
|
118407
118558
|
// src/commands/watch/phases/approval-detector.ts
|
|
118408
118559
|
init_logger();
|
|
@@ -118780,9 +118931,9 @@ async function checkAwaitingApproval(state, setup, options2, watchLog, projectDi
|
|
|
118780
118931
|
|
|
118781
118932
|
// src/commands/watch/phases/plan-dir-finder.ts
|
|
118782
118933
|
import { readdir as readdir46, stat as stat24 } from "node:fs/promises";
|
|
118783
|
-
import { join as
|
|
118934
|
+
import { join as join164 } from "node:path";
|
|
118784
118935
|
async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
118785
|
-
const plansRoot =
|
|
118936
|
+
const plansRoot = join164(cwd2, "plans");
|
|
118786
118937
|
try {
|
|
118787
118938
|
const entries = await readdir46(plansRoot);
|
|
118788
118939
|
const tenMinAgo = Date.now() - 10 * 60 * 1000;
|
|
@@ -118791,14 +118942,14 @@ async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
|
118791
118942
|
for (const entry of entries) {
|
|
118792
118943
|
if (entry === "watch" || entry === "reports" || entry === "visuals")
|
|
118793
118944
|
continue;
|
|
118794
|
-
const dirPath =
|
|
118945
|
+
const dirPath = join164(plansRoot, entry);
|
|
118795
118946
|
const dirStat = await stat24(dirPath);
|
|
118796
118947
|
if (!dirStat.isDirectory())
|
|
118797
118948
|
continue;
|
|
118798
118949
|
if (dirStat.mtimeMs < tenMinAgo)
|
|
118799
118950
|
continue;
|
|
118800
118951
|
try {
|
|
118801
|
-
await stat24(
|
|
118952
|
+
await stat24(join164(dirPath, "plan.md"));
|
|
118802
118953
|
} catch {
|
|
118803
118954
|
continue;
|
|
118804
118955
|
}
|
|
@@ -119029,13 +119180,13 @@ async function handlePlanGeneration(issue, state, config, setup, options2, watch
|
|
|
119029
119180
|
stats.plansCreated++;
|
|
119030
119181
|
const detectedPlanDir = await findRecentPlanDir(projectDir, issue.number, watchLog);
|
|
119031
119182
|
if (detectedPlanDir) {
|
|
119032
|
-
state.activeIssues[numStr].planPath =
|
|
119183
|
+
state.activeIssues[numStr].planPath = join165(detectedPlanDir, "plan.md");
|
|
119033
119184
|
watchLog.info(`Plan directory detected: ${detectedPlanDir}`);
|
|
119034
119185
|
} else {
|
|
119035
119186
|
try {
|
|
119036
|
-
const planDir =
|
|
119187
|
+
const planDir = join165(projectDir, "plans", "watch");
|
|
119037
119188
|
await mkdir40(planDir, { recursive: true });
|
|
119038
|
-
const planFilePath =
|
|
119189
|
+
const planFilePath = join165(planDir, `issue-${issue.number}-plan.md`);
|
|
119039
119190
|
await writeFile42(planFilePath, planResult.planText, "utf-8");
|
|
119040
119191
|
state.activeIssues[numStr].planPath = planFilePath;
|
|
119041
119192
|
watchLog.info(`Plan saved (fallback) to ${planFilePath}`);
|
|
@@ -119180,16 +119331,16 @@ function cleanExpiredIssues(state, ttlDays) {
|
|
|
119180
119331
|
init_ck_config_manager();
|
|
119181
119332
|
init_file_io();
|
|
119182
119333
|
init_logger();
|
|
119183
|
-
import { existsSync as
|
|
119184
|
-
import { mkdir as mkdir41, readFile as
|
|
119334
|
+
import { existsSync as existsSync80 } from "node:fs";
|
|
119335
|
+
import { mkdir as mkdir41, readFile as readFile72 } from "node:fs/promises";
|
|
119185
119336
|
import { dirname as dirname55 } from "node:path";
|
|
119186
119337
|
var PROCESSED_ISSUES_CAP = 500;
|
|
119187
119338
|
async function readCkJson(projectDir) {
|
|
119188
119339
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
119189
119340
|
try {
|
|
119190
|
-
if (!
|
|
119341
|
+
if (!existsSync80(configPath))
|
|
119191
119342
|
return {};
|
|
119192
|
-
const content = await
|
|
119343
|
+
const content = await readFile72(configPath, "utf-8");
|
|
119193
119344
|
return JSON.parse(content);
|
|
119194
119345
|
} catch (error) {
|
|
119195
119346
|
logger.warning(`Failed to parse .ck.json: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -119213,7 +119364,7 @@ async function loadWatchState(projectDir) {
|
|
|
119213
119364
|
async function saveWatchState(projectDir, state) {
|
|
119214
119365
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
119215
119366
|
const configDir = dirname55(configPath);
|
|
119216
|
-
if (!
|
|
119367
|
+
if (!existsSync80(configDir)) {
|
|
119217
119368
|
await mkdir41(configDir, { recursive: true });
|
|
119218
119369
|
}
|
|
119219
119370
|
const raw2 = await readCkJson(projectDir);
|
|
@@ -119340,21 +119491,21 @@ async function processImplementationQueue(state, config, setup, options2, watchL
|
|
|
119340
119491
|
// src/commands/watch/phases/repo-scanner.ts
|
|
119341
119492
|
init_logger();
|
|
119342
119493
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
119343
|
-
import { existsSync as
|
|
119494
|
+
import { existsSync as existsSync81 } from "node:fs";
|
|
119344
119495
|
import { readdir as readdir47, stat as stat25 } from "node:fs/promises";
|
|
119345
|
-
import { join as
|
|
119496
|
+
import { join as join166 } from "node:path";
|
|
119346
119497
|
async function scanForRepos(parentDir) {
|
|
119347
119498
|
const repos = [];
|
|
119348
119499
|
const entries = await readdir47(parentDir);
|
|
119349
119500
|
for (const entry of entries) {
|
|
119350
119501
|
if (entry.startsWith("."))
|
|
119351
119502
|
continue;
|
|
119352
|
-
const fullPath =
|
|
119503
|
+
const fullPath = join166(parentDir, entry);
|
|
119353
119504
|
const entryStat = await stat25(fullPath);
|
|
119354
119505
|
if (!entryStat.isDirectory())
|
|
119355
119506
|
continue;
|
|
119356
|
-
const gitDir =
|
|
119357
|
-
if (!
|
|
119507
|
+
const gitDir = join166(fullPath, ".git");
|
|
119508
|
+
if (!existsSync81(gitDir))
|
|
119358
119509
|
continue;
|
|
119359
119510
|
const result = spawnSync7("gh", ["repo", "view", "--json", "owner,name"], {
|
|
119360
119511
|
encoding: "utf-8",
|
|
@@ -119378,9 +119529,9 @@ async function scanForRepos(parentDir) {
|
|
|
119378
119529
|
// src/commands/watch/phases/setup-validator.ts
|
|
119379
119530
|
init_logger();
|
|
119380
119531
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
119381
|
-
import { existsSync as
|
|
119532
|
+
import { existsSync as existsSync82 } from "node:fs";
|
|
119382
119533
|
import { homedir as homedir53 } from "node:os";
|
|
119383
|
-
import { join as
|
|
119534
|
+
import { join as join167 } from "node:path";
|
|
119384
119535
|
async function validateSetup(cwd2) {
|
|
119385
119536
|
const workDir = cwd2 ?? process.cwd();
|
|
119386
119537
|
const ghVersion = spawnSync8("gh", ["--version"], { encoding: "utf-8", timeout: 1e4 });
|
|
@@ -119411,8 +119562,8 @@ Run this command from a directory with a GitHub remote.`);
|
|
|
119411
119562
|
} catch {
|
|
119412
119563
|
throw new Error(`Failed to parse repository info: ${ghRepo.stdout}`);
|
|
119413
119564
|
}
|
|
119414
|
-
const skillsPath =
|
|
119415
|
-
const skillsAvailable =
|
|
119565
|
+
const skillsPath = join167(homedir53(), ".claude", "skills");
|
|
119566
|
+
const skillsAvailable = existsSync82(skillsPath);
|
|
119416
119567
|
if (!skillsAvailable) {
|
|
119417
119568
|
logger.warning(`ClaudeKit Engineer skills not found at ${skillsPath}`);
|
|
119418
119569
|
}
|
|
@@ -119428,9 +119579,9 @@ Run this command from a directory with a GitHub remote.`);
|
|
|
119428
119579
|
init_logger();
|
|
119429
119580
|
init_path_resolver();
|
|
119430
119581
|
import { createWriteStream as createWriteStream3, statSync as statSync14 } from "node:fs";
|
|
119431
|
-
import { existsSync as
|
|
119582
|
+
import { existsSync as existsSync83 } from "node:fs";
|
|
119432
119583
|
import { mkdir as mkdir42, rename as rename15 } from "node:fs/promises";
|
|
119433
|
-
import { join as
|
|
119584
|
+
import { join as join168 } from "node:path";
|
|
119434
119585
|
|
|
119435
119586
|
class WatchLogger {
|
|
119436
119587
|
logStream = null;
|
|
@@ -119438,16 +119589,16 @@ class WatchLogger {
|
|
|
119438
119589
|
logPath = null;
|
|
119439
119590
|
maxBytes;
|
|
119440
119591
|
constructor(logDir, maxBytes = 0) {
|
|
119441
|
-
this.logDir = logDir ??
|
|
119592
|
+
this.logDir = logDir ?? join168(PathResolver.getClaudeKitDir(), "logs");
|
|
119442
119593
|
this.maxBytes = maxBytes;
|
|
119443
119594
|
}
|
|
119444
119595
|
async init() {
|
|
119445
119596
|
try {
|
|
119446
|
-
if (!
|
|
119597
|
+
if (!existsSync83(this.logDir)) {
|
|
119447
119598
|
await mkdir42(this.logDir, { recursive: true });
|
|
119448
119599
|
}
|
|
119449
119600
|
const dateStr = formatDate(new Date);
|
|
119450
|
-
this.logPath =
|
|
119601
|
+
this.logPath = join168(this.logDir, `watch-${dateStr}.log`);
|
|
119451
119602
|
this.logStream = createWriteStream3(this.logPath, { flags: "a", mode: 384 });
|
|
119452
119603
|
} catch (error) {
|
|
119453
119604
|
logger.warning(`Cannot create watch log file: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -119629,7 +119780,7 @@ async function watchCommand(options2) {
|
|
|
119629
119780
|
}
|
|
119630
119781
|
async function discoverRepos(options2, watchLog) {
|
|
119631
119782
|
const cwd2 = process.cwd();
|
|
119632
|
-
const isGitRepo =
|
|
119783
|
+
const isGitRepo = existsSync84(join169(cwd2, ".git"));
|
|
119633
119784
|
if (options2.force) {
|
|
119634
119785
|
await forceRemoveLock(watchLog);
|
|
119635
119786
|
}
|
|
@@ -119746,13 +119897,13 @@ function sleep(ms) {
|
|
|
119746
119897
|
// src/cli/command-registry.ts
|
|
119747
119898
|
init_logger();
|
|
119748
119899
|
function registerCommands(cli) {
|
|
119749
|
-
cli.command("new", "Bootstrap a new ClaudeKit project (with interactive version selection)").option("--dir <dir>", "Target directory (default: .)").option("--kit <kit>", "Kit to use: engineer, marketing, all, or comma-separated").option("-r, --release <version>", "Skip version selection, use specific version (e.g., latest, v1.0.0)").option("--force", "Overwrite existing files without confirmation").option("--exclude <pattern>", "Exclude files matching glob pattern (can be used multiple times)").option("--opencode", "Install OpenCode CLI package (non-interactive mode)").option("--gemini", "Install Google Gemini CLI package (non-interactive mode)").option("--install-skills", "Install skills dependencies (non-interactive mode)").option("--with-sudo", "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)").option("--prefix", "Add /ck: prefix to all slash commands by moving them to commands/ck/ subdirectory").option("--beta", "Show beta versions in selection prompt").option("--refresh", "Bypass release cache to fetch latest versions from GitHub").option("--docs-dir <name>", "Custom docs folder name (default: docs)").option("--plans-dir <name>", "Custom plans folder name (default: plans)").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").option("--use-git", "Use git clone instead of GitHub API (uses SSH/HTTPS credentials)").option("--archive <path>", "Use local archive file instead of downloading (zip/tar.gz)").option("--kit-path <path>", "Use local kit directory instead of downloading").action(async (options2) => {
|
|
119900
|
+
cli.command("new", "Bootstrap a new ClaudeKit project (with interactive version selection)").option("--dir <dir>", "Target directory (default: .)").option("--kit <kit>", "Kit to use: engineer, marketing, all, or comma-separated").option("-r, --release <version>", "Skip version selection, use specific version (e.g., latest, v1.0.0)").option("--force", "Overwrite existing files without confirmation").option("--exclude <pattern>", "Exclude files matching glob pattern (can be used multiple times)").option("--opencode", "Install OpenCode CLI package (non-interactive mode)").option("--gemini", "Install Google Gemini CLI package (non-interactive mode)").option("--install-skills", "Install skills dependencies (non-interactive mode)").option("--package-manager <manager>", "Package manager for skills JavaScript dependencies: auto, npm, bun, pnpm, or yarn").option("--with-sudo", "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)").option("--prefix", "Add /ck: prefix to all slash commands by moving them to commands/ck/ subdirectory").option("--beta", "Show beta versions in selection prompt").option("--refresh", "Bypass release cache to fetch latest versions from GitHub").option("--docs-dir <name>", "Custom docs folder name (default: docs)").option("--plans-dir <name>", "Custom plans folder name (default: plans)").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").option("--use-git", "Use git clone instead of GitHub API (uses SSH/HTTPS credentials)").option("--archive <path>", "Use local archive file instead of downloading (zip/tar.gz)").option("--kit-path <path>", "Use local kit directory instead of downloading").action(async (options2) => {
|
|
119750
119901
|
if (options2.exclude && !Array.isArray(options2.exclude)) {
|
|
119751
119902
|
options2.exclude = [options2.exclude];
|
|
119752
119903
|
}
|
|
119753
119904
|
await newCommand(options2);
|
|
119754
119905
|
});
|
|
119755
|
-
cli.command("init", "Initialize or update ClaudeKit project (with interactive version selection)").option("--dir <dir>", "Target directory (default: .)").option("--kit <kit>", "Kit to use: engineer, marketing, all, or comma-separated").option("-r, --release <version>", "Skip version selection, use specific version (e.g., latest, v1.0.0)").option("--exclude <pattern>", "Exclude files matching glob pattern (can be used multiple times)").option("--only <pattern>", "Include only files matching glob pattern (can be used multiple times)").option("-g, --global", "Use platform-specific user configuration directory").option("--fresh", "Full reset: remove CK files, replace settings.json and CLAUDE.md, reinstall from scratch").option("--force", "Force reinstall even if already at latest version (use with --yes; re-onboards missing files without full reset)").option("--install-skills", "Install skills dependencies (non-interactive mode)").option("--with-sudo", "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)").option("--prefix", "Add /ck: prefix to all slash commands by moving them to commands/ck/ subdirectory").option("--beta", "Show beta versions in selection prompt").option("--refresh", "Bypass release cache to fetch latest versions from GitHub").option("--dry-run", "Preview changes without applying them (requires --prefix)").option("--force-overwrite", "Override ownership protections and delete user-modified files (requires --prefix)").option("--force-overwrite-settings", "Fully replace settings.json instead of selective merge (destroys user customizations)").option("--restore-ck-hooks", "Restore CK-managed hook registrations during update self-heal").option("--skip-setup", "Skip interactive configuration wizard").option("--docs-dir <name>", "Custom docs folder name (default: docs)").option("--plans-dir <name>", "Custom plans folder name (default: plans)").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").option("--sync", "Sync config files from upstream with interactive hunk-by-hunk merge").option("--install-mode <mode>", "Engineer global install mode: auto, plugin, or legacy (default: auto)").option("--use-git", "Use git clone instead of GitHub API (uses SSH/HTTPS credentials)").option("--archive <path>", "Use local archive file instead of downloading (zip/tar.gz)").option("--kit-path <path>", "Use local kit directory instead of downloading").action(async (options2) => {
|
|
119906
|
+
cli.command("init", "Initialize or update ClaudeKit project (with interactive version selection)").option("--dir <dir>", "Target directory (default: .)").option("--kit <kit>", "Kit to use: engineer, marketing, all, or comma-separated").option("-r, --release <version>", "Skip version selection, use specific version (e.g., latest, v1.0.0)").option("--exclude <pattern>", "Exclude files matching glob pattern (can be used multiple times)").option("--only <pattern>", "Include only files matching glob pattern (can be used multiple times)").option("-g, --global", "Use platform-specific user configuration directory").option("--fresh", "Full reset: remove CK files, replace settings.json and CLAUDE.md, reinstall from scratch").option("--force", "Force reinstall even if already at latest version (use with --yes; re-onboards missing files without full reset)").option("--install-skills", "Install skills dependencies (non-interactive mode)").option("--package-manager <manager>", "Package manager for skills JavaScript dependencies: auto, npm, bun, pnpm, or yarn").option("--with-sudo", "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)").option("--prefix", "Add /ck: prefix to all slash commands by moving them to commands/ck/ subdirectory").option("--beta", "Show beta versions in selection prompt").option("--refresh", "Bypass release cache to fetch latest versions from GitHub").option("--dry-run", "Preview changes without applying them (requires --prefix)").option("--force-overwrite", "Override ownership protections and delete user-modified files (requires --prefix)").option("--force-overwrite-settings", "Fully replace settings.json instead of selective merge (destroys user customizations)").option("--restore-ck-hooks", "Restore CK-managed hook registrations during update self-heal").option("--skip-setup", "Skip interactive configuration wizard").option("--docs-dir <name>", "Custom docs folder name (default: docs)").option("--plans-dir <name>", "Custom plans folder name (default: plans)").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").option("--sync", "Sync config files from upstream with interactive hunk-by-hunk merge").option("--install-mode <mode>", "Engineer global install mode: auto, plugin, or legacy (default: auto)").option("--use-git", "Use git clone instead of GitHub API (uses SSH/HTTPS credentials)").option("--archive <path>", "Use local archive file instead of downloading (zip/tar.gz)").option("--kit-path <path>", "Use local kit directory instead of downloading").action(async (options2) => {
|
|
119756
119907
|
if (options2.exclude && !Array.isArray(options2.exclude)) {
|
|
119757
119908
|
options2.exclude = [options2.exclude];
|
|
119758
119909
|
}
|
|
@@ -119886,8 +120037,8 @@ function registerCommands(cli) {
|
|
|
119886
120037
|
// src/cli/version-display.ts
|
|
119887
120038
|
init_package();
|
|
119888
120039
|
init_config_version_checker();
|
|
119889
|
-
import { existsSync as
|
|
119890
|
-
import { join as
|
|
120040
|
+
import { existsSync as existsSync96, readFileSync as readFileSync29 } from "node:fs";
|
|
120041
|
+
import { join as join181 } from "node:path";
|
|
119891
120042
|
|
|
119892
120043
|
// src/domains/versioning/version-checker.ts
|
|
119893
120044
|
init_version_utils();
|
|
@@ -119900,25 +120051,25 @@ init_types3();
|
|
|
119900
120051
|
// src/domains/versioning/version-cache.ts
|
|
119901
120052
|
init_logger();
|
|
119902
120053
|
init_path_resolver();
|
|
119903
|
-
import { existsSync as
|
|
119904
|
-
import { mkdir as mkdir43, readFile as
|
|
119905
|
-
import { join as
|
|
120054
|
+
import { existsSync as existsSync95 } from "node:fs";
|
|
120055
|
+
import { mkdir as mkdir43, readFile as readFile74, writeFile as writeFile45 } from "node:fs/promises";
|
|
120056
|
+
import { join as join180 } from "node:path";
|
|
119906
120057
|
|
|
119907
120058
|
class VersionCacheManager {
|
|
119908
120059
|
static CACHE_FILENAME = "version-check.json";
|
|
119909
120060
|
static CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
119910
120061
|
static getCacheFile() {
|
|
119911
120062
|
const cacheDir = PathResolver.getCacheDir(false);
|
|
119912
|
-
return
|
|
120063
|
+
return join180(cacheDir, VersionCacheManager.CACHE_FILENAME);
|
|
119913
120064
|
}
|
|
119914
120065
|
static async load() {
|
|
119915
120066
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
119916
120067
|
try {
|
|
119917
|
-
if (!
|
|
120068
|
+
if (!existsSync95(cacheFile)) {
|
|
119918
120069
|
logger.debug("Version check cache not found");
|
|
119919
120070
|
return null;
|
|
119920
120071
|
}
|
|
119921
|
-
const content = await
|
|
120072
|
+
const content = await readFile74(cacheFile, "utf-8");
|
|
119922
120073
|
const cache5 = JSON.parse(content);
|
|
119923
120074
|
if (!cache5.lastCheck || !cache5.currentVersion || !cache5.latestVersion) {
|
|
119924
120075
|
logger.debug("Invalid cache structure, ignoring");
|
|
@@ -119935,7 +120086,7 @@ class VersionCacheManager {
|
|
|
119935
120086
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
119936
120087
|
const cacheDir = PathResolver.getCacheDir(false);
|
|
119937
120088
|
try {
|
|
119938
|
-
if (!
|
|
120089
|
+
if (!existsSync95(cacheDir)) {
|
|
119939
120090
|
await mkdir43(cacheDir, { recursive: true, mode: 448 });
|
|
119940
120091
|
}
|
|
119941
120092
|
await writeFile45(cacheFile, JSON.stringify(cache5, null, 2), "utf-8");
|
|
@@ -119957,7 +120108,7 @@ class VersionCacheManager {
|
|
|
119957
120108
|
static async clear() {
|
|
119958
120109
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
119959
120110
|
try {
|
|
119960
|
-
if (
|
|
120111
|
+
if (existsSync95(cacheFile)) {
|
|
119961
120112
|
const fs20 = await import("node:fs/promises");
|
|
119962
120113
|
await fs20.unlink(cacheFile);
|
|
119963
120114
|
logger.debug("Version check cache cleared");
|
|
@@ -120220,11 +120371,11 @@ async function displayVersion() {
|
|
|
120220
120371
|
let localInstalledKits = [];
|
|
120221
120372
|
let globalInstalledKits = [];
|
|
120222
120373
|
const globalKitDir = PathResolver.getGlobalKitDir();
|
|
120223
|
-
const globalMetadataPath =
|
|
120374
|
+
const globalMetadataPath = join181(globalKitDir, "metadata.json");
|
|
120224
120375
|
const prefix = PathResolver.getPathPrefix(false);
|
|
120225
|
-
const localMetadataPath = prefix ?
|
|
120376
|
+
const localMetadataPath = prefix ? join181(process.cwd(), prefix, "metadata.json") : join181(process.cwd(), "metadata.json");
|
|
120226
120377
|
const isLocalSameAsGlobal = localMetadataPath === globalMetadataPath;
|
|
120227
|
-
if (!isLocalSameAsGlobal &&
|
|
120378
|
+
if (!isLocalSameAsGlobal && existsSync96(localMetadataPath)) {
|
|
120228
120379
|
try {
|
|
120229
120380
|
const rawMetadata = JSON.parse(readFileSync29(localMetadataPath, "utf-8"));
|
|
120230
120381
|
const metadata = MetadataSchema.parse(rawMetadata);
|
|
@@ -120238,7 +120389,7 @@ async function displayVersion() {
|
|
|
120238
120389
|
logger.verbose("Failed to parse local metadata.json", { error });
|
|
120239
120390
|
}
|
|
120240
120391
|
}
|
|
120241
|
-
if (
|
|
120392
|
+
if (existsSync96(globalMetadataPath)) {
|
|
120242
120393
|
try {
|
|
120243
120394
|
const rawMetadata = JSON.parse(readFileSync29(globalMetadataPath, "utf-8"));
|
|
120244
120395
|
const metadata = MetadataSchema.parse(rawMetadata);
|