claudekit-cli 4.5.0-dev.5 → 4.5.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli-manifest.json +2 -2
- package/dist/index.js +621 -545
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -64421,7 +64421,7 @@ var package_default;
|
|
|
64421
64421
|
var init_package = __esm(() => {
|
|
64422
64422
|
package_default = {
|
|
64423
64423
|
name: "claudekit-cli",
|
|
64424
|
-
version: "4.5.0-dev.
|
|
64424
|
+
version: "4.5.0-dev.6",
|
|
64425
64425
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
64426
64426
|
type: "module",
|
|
64427
64427
|
repository: {
|
|
@@ -74784,6 +74784,164 @@ var init_process_executor = __esm(() => {
|
|
|
74784
74784
|
execFileAsync7 = promisify15(execFile10);
|
|
74785
74785
|
});
|
|
74786
74786
|
|
|
74787
|
+
// src/services/package-installer/agy-installer.ts
|
|
74788
|
+
import { join as join90 } from "node:path";
|
|
74789
|
+
async function isAgyInstalled() {
|
|
74790
|
+
try {
|
|
74791
|
+
await execAsync7("agy --version", { timeout: 1e4 });
|
|
74792
|
+
return true;
|
|
74793
|
+
} catch {
|
|
74794
|
+
return false;
|
|
74795
|
+
}
|
|
74796
|
+
}
|
|
74797
|
+
async function installAgyUnix() {
|
|
74798
|
+
const { unlink: unlink13 } = await import("node:fs/promises");
|
|
74799
|
+
const { tmpdir: tmpdir4 } = await import("node:os");
|
|
74800
|
+
const tempScriptPath = join90(tmpdir4(), "agy-install.sh");
|
|
74801
|
+
try {
|
|
74802
|
+
logger.info("Downloading Antigravity CLI installation script...");
|
|
74803
|
+
await execFileAsync7("curl", ["-fsSL", AGY_INSTALL_SH_URL, "-o", tempScriptPath], {
|
|
74804
|
+
timeout: 30000
|
|
74805
|
+
});
|
|
74806
|
+
await execFileAsync7("chmod", ["+x", tempScriptPath], { timeout: 5000 });
|
|
74807
|
+
logger.info("Executing Antigravity CLI installation script...");
|
|
74808
|
+
await execFileAsync7("bash", [tempScriptPath], {
|
|
74809
|
+
timeout: 120000
|
|
74810
|
+
});
|
|
74811
|
+
} finally {
|
|
74812
|
+
try {
|
|
74813
|
+
await unlink13(tempScriptPath);
|
|
74814
|
+
} catch {}
|
|
74815
|
+
}
|
|
74816
|
+
}
|
|
74817
|
+
async function installAgyWindows() {
|
|
74818
|
+
logger.info("Executing Antigravity CLI installation script (PowerShell)...");
|
|
74819
|
+
await execFileAsync7("powershell.exe", ["-NoLogo", "-ExecutionPolicy", "Bypass", "-Command", `irm ${AGY_INSTALL_PS1_URL} | iex`], { timeout: 120000 });
|
|
74820
|
+
}
|
|
74821
|
+
async function installAgy() {
|
|
74822
|
+
const displayName = AGY_DISPLAY_NAME;
|
|
74823
|
+
if (isCIEnvironment()) {
|
|
74824
|
+
logger.info("CI environment detected: skipping Antigravity CLI installation");
|
|
74825
|
+
return {
|
|
74826
|
+
success: false,
|
|
74827
|
+
package: displayName,
|
|
74828
|
+
error: "Installation skipped in CI environment",
|
|
74829
|
+
skipped: true
|
|
74830
|
+
};
|
|
74831
|
+
}
|
|
74832
|
+
try {
|
|
74833
|
+
logger.info(`Installing ${displayName}...`);
|
|
74834
|
+
if (isWindows()) {
|
|
74835
|
+
await installAgyWindows();
|
|
74836
|
+
} else {
|
|
74837
|
+
await installAgyUnix();
|
|
74838
|
+
}
|
|
74839
|
+
const installed = await isAgyInstalled();
|
|
74840
|
+
if (installed) {
|
|
74841
|
+
logger.success(`${displayName} installed successfully`);
|
|
74842
|
+
return {
|
|
74843
|
+
success: true,
|
|
74844
|
+
package: displayName
|
|
74845
|
+
};
|
|
74846
|
+
}
|
|
74847
|
+
const pathHint = isWindows() ? "%LOCALAPPDATA%\\agy\\bin" : "~/.local/bin";
|
|
74848
|
+
logger.warning(`${displayName} installed, but 'agy' is not on your PATH yet. Restart your shell or add "${pathHint}" to PATH.`);
|
|
74849
|
+
return {
|
|
74850
|
+
success: false,
|
|
74851
|
+
package: displayName,
|
|
74852
|
+
error: `Installed but 'agy' not found on PATH. Restart your shell or add "${pathHint}" to PATH.`
|
|
74853
|
+
};
|
|
74854
|
+
} catch (error) {
|
|
74855
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
74856
|
+
logger.error(`Failed to install ${displayName}: ${errorMessage}`);
|
|
74857
|
+
return {
|
|
74858
|
+
success: false,
|
|
74859
|
+
package: displayName,
|
|
74860
|
+
error: errorMessage
|
|
74861
|
+
};
|
|
74862
|
+
}
|
|
74863
|
+
}
|
|
74864
|
+
var AGY_DISPLAY_NAME = "Antigravity CLI (agy)", AGY_INSTALL_SH_URL = "https://antigravity.google/cli/install.sh", AGY_INSTALL_PS1_URL = "https://antigravity.google/cli/install.ps1";
|
|
74865
|
+
var init_agy_installer = __esm(() => {
|
|
74866
|
+
init_environment();
|
|
74867
|
+
init_logger();
|
|
74868
|
+
init_process_executor();
|
|
74869
|
+
});
|
|
74870
|
+
|
|
74871
|
+
// src/services/package-installer/opencode-installer.ts
|
|
74872
|
+
import { join as join91 } from "node:path";
|
|
74873
|
+
async function isOpenCodeInstalled() {
|
|
74874
|
+
try {
|
|
74875
|
+
await execAsync7("opencode --version", { timeout: 5000 });
|
|
74876
|
+
return true;
|
|
74877
|
+
} catch {
|
|
74878
|
+
return false;
|
|
74879
|
+
}
|
|
74880
|
+
}
|
|
74881
|
+
async function installOpenCode() {
|
|
74882
|
+
const displayName = "OpenCode CLI";
|
|
74883
|
+
if (isCIEnvironment()) {
|
|
74884
|
+
logger.info("CI environment detected: skipping OpenCode installation");
|
|
74885
|
+
return {
|
|
74886
|
+
success: false,
|
|
74887
|
+
package: displayName,
|
|
74888
|
+
error: "Installation skipped in CI environment"
|
|
74889
|
+
};
|
|
74890
|
+
}
|
|
74891
|
+
try {
|
|
74892
|
+
logger.info(`Installing ${displayName}...`);
|
|
74893
|
+
const { unlink: unlink13 } = await import("node:fs/promises");
|
|
74894
|
+
const { tmpdir: tmpdir4 } = await import("node:os");
|
|
74895
|
+
const tempScriptPath = join91(tmpdir4(), "opencode-install.sh");
|
|
74896
|
+
try {
|
|
74897
|
+
logger.info("Downloading OpenCode installation script...");
|
|
74898
|
+
await execFileAsync7("curl", ["-fsSL", "https://opencode.ai/install", "-o", tempScriptPath], {
|
|
74899
|
+
timeout: 30000
|
|
74900
|
+
});
|
|
74901
|
+
await execFileAsync7("chmod", ["+x", tempScriptPath], {
|
|
74902
|
+
timeout: 5000
|
|
74903
|
+
});
|
|
74904
|
+
logger.info("Executing OpenCode installation script...");
|
|
74905
|
+
await execFileAsync7("bash", [tempScriptPath], {
|
|
74906
|
+
timeout: 120000
|
|
74907
|
+
});
|
|
74908
|
+
} finally {
|
|
74909
|
+
try {
|
|
74910
|
+
await unlink13(tempScriptPath);
|
|
74911
|
+
} catch {}
|
|
74912
|
+
}
|
|
74913
|
+
const installed = await isOpenCodeInstalled();
|
|
74914
|
+
if (installed) {
|
|
74915
|
+
logger.success(`${displayName} installed successfully`);
|
|
74916
|
+
return {
|
|
74917
|
+
success: true,
|
|
74918
|
+
package: displayName
|
|
74919
|
+
};
|
|
74920
|
+
}
|
|
74921
|
+
return {
|
|
74922
|
+
success: false,
|
|
74923
|
+
package: displayName,
|
|
74924
|
+
error: "Installation completed but opencode command not found in PATH"
|
|
74925
|
+
};
|
|
74926
|
+
} catch (error) {
|
|
74927
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
74928
|
+
logger.error(`Failed to install ${displayName}: ${errorMessage}`);
|
|
74929
|
+
return {
|
|
74930
|
+
success: false,
|
|
74931
|
+
package: displayName,
|
|
74932
|
+
error: errorMessage
|
|
74933
|
+
};
|
|
74934
|
+
}
|
|
74935
|
+
}
|
|
74936
|
+
var init_opencode_installer = __esm(() => {
|
|
74937
|
+
init_environment();
|
|
74938
|
+
init_logger();
|
|
74939
|
+
init_process_executor();
|
|
74940
|
+
});
|
|
74941
|
+
|
|
74942
|
+
// src/services/package-installer/types.ts
|
|
74943
|
+
var PARTIAL_INSTALL_VERSION = "partial", EXIT_CODE_CRITICAL_FAILURE = 1, EXIT_CODE_PARTIAL_SUCCESS = 2;
|
|
74944
|
+
|
|
74787
74945
|
// src/services/package-installer/validators.ts
|
|
74788
74946
|
import { resolve as resolve38 } from "node:path";
|
|
74789
74947
|
function validatePackageName(packageName) {
|
|
@@ -74968,100 +75126,9 @@ var init_npm_package_manager = __esm(() => {
|
|
|
74968
75126
|
init_validators();
|
|
74969
75127
|
});
|
|
74970
75128
|
|
|
74971
|
-
// src/services/package-installer/gemini-installer.ts
|
|
74972
|
-
async function isGeminiInstalled() {
|
|
74973
|
-
try {
|
|
74974
|
-
await execAsync7("gemini --version", { timeout: 1e4 });
|
|
74975
|
-
return true;
|
|
74976
|
-
} catch {
|
|
74977
|
-
return false;
|
|
74978
|
-
}
|
|
74979
|
-
}
|
|
74980
|
-
async function installGemini() {
|
|
74981
|
-
return installPackageGlobally("@google/gemini-cli", "Google Gemini CLI");
|
|
74982
|
-
}
|
|
74983
|
-
var init_gemini_installer = __esm(() => {
|
|
74984
|
-
init_npm_package_manager();
|
|
74985
|
-
init_process_executor();
|
|
74986
|
-
});
|
|
74987
|
-
|
|
74988
|
-
// src/services/package-installer/opencode-installer.ts
|
|
74989
|
-
import { join as join90 } from "node:path";
|
|
74990
|
-
async function isOpenCodeInstalled() {
|
|
74991
|
-
try {
|
|
74992
|
-
await execAsync7("opencode --version", { timeout: 5000 });
|
|
74993
|
-
return true;
|
|
74994
|
-
} catch {
|
|
74995
|
-
return false;
|
|
74996
|
-
}
|
|
74997
|
-
}
|
|
74998
|
-
async function installOpenCode() {
|
|
74999
|
-
const displayName = "OpenCode CLI";
|
|
75000
|
-
if (isCIEnvironment()) {
|
|
75001
|
-
logger.info("CI environment detected: skipping OpenCode installation");
|
|
75002
|
-
return {
|
|
75003
|
-
success: false,
|
|
75004
|
-
package: displayName,
|
|
75005
|
-
error: "Installation skipped in CI environment"
|
|
75006
|
-
};
|
|
75007
|
-
}
|
|
75008
|
-
try {
|
|
75009
|
-
logger.info(`Installing ${displayName}...`);
|
|
75010
|
-
const { unlink: unlink13 } = await import("node:fs/promises");
|
|
75011
|
-
const { tmpdir: tmpdir4 } = await import("node:os");
|
|
75012
|
-
const tempScriptPath = join90(tmpdir4(), "opencode-install.sh");
|
|
75013
|
-
try {
|
|
75014
|
-
logger.info("Downloading OpenCode installation script...");
|
|
75015
|
-
await execFileAsync7("curl", ["-fsSL", "https://opencode.ai/install", "-o", tempScriptPath], {
|
|
75016
|
-
timeout: 30000
|
|
75017
|
-
});
|
|
75018
|
-
await execFileAsync7("chmod", ["+x", tempScriptPath], {
|
|
75019
|
-
timeout: 5000
|
|
75020
|
-
});
|
|
75021
|
-
logger.info("Executing OpenCode installation script...");
|
|
75022
|
-
await execFileAsync7("bash", [tempScriptPath], {
|
|
75023
|
-
timeout: 120000
|
|
75024
|
-
});
|
|
75025
|
-
} finally {
|
|
75026
|
-
try {
|
|
75027
|
-
await unlink13(tempScriptPath);
|
|
75028
|
-
} catch {}
|
|
75029
|
-
}
|
|
75030
|
-
const installed = await isOpenCodeInstalled();
|
|
75031
|
-
if (installed) {
|
|
75032
|
-
logger.success(`${displayName} installed successfully`);
|
|
75033
|
-
return {
|
|
75034
|
-
success: true,
|
|
75035
|
-
package: displayName
|
|
75036
|
-
};
|
|
75037
|
-
}
|
|
75038
|
-
return {
|
|
75039
|
-
success: false,
|
|
75040
|
-
package: displayName,
|
|
75041
|
-
error: "Installation completed but opencode command not found in PATH"
|
|
75042
|
-
};
|
|
75043
|
-
} catch (error) {
|
|
75044
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
75045
|
-
logger.error(`Failed to install ${displayName}: ${errorMessage}`);
|
|
75046
|
-
return {
|
|
75047
|
-
success: false,
|
|
75048
|
-
package: displayName,
|
|
75049
|
-
error: errorMessage
|
|
75050
|
-
};
|
|
75051
|
-
}
|
|
75052
|
-
}
|
|
75053
|
-
var init_opencode_installer = __esm(() => {
|
|
75054
|
-
init_environment();
|
|
75055
|
-
init_logger();
|
|
75056
|
-
init_process_executor();
|
|
75057
|
-
});
|
|
75058
|
-
|
|
75059
|
-
// src/services/package-installer/types.ts
|
|
75060
|
-
var PARTIAL_INSTALL_VERSION = "partial", EXIT_CODE_CRITICAL_FAILURE = 1, EXIT_CODE_PARTIAL_SUCCESS = 2;
|
|
75061
|
-
|
|
75062
75129
|
// src/services/package-installer/install-error-handler.ts
|
|
75063
75130
|
import { existsSync as existsSync62, readFileSync as readFileSync19, unlinkSync as unlinkSync3 } from "node:fs";
|
|
75064
|
-
import { join as
|
|
75131
|
+
import { join as join92 } from "node:path";
|
|
75065
75132
|
function parseNameReason(str2) {
|
|
75066
75133
|
const colonIndex = str2.indexOf(":");
|
|
75067
75134
|
if (colonIndex === -1) {
|
|
@@ -75124,7 +75191,7 @@ function getSystemPackageCommands(summary, systemFailures) {
|
|
|
75124
75191
|
return summary.remediation.sudo_packages ? [summary.remediation.sudo_packages] : [];
|
|
75125
75192
|
}
|
|
75126
75193
|
function displayInstallErrors(skillsDir2) {
|
|
75127
|
-
const summaryPath =
|
|
75194
|
+
const summaryPath = join92(skillsDir2, ".install-error-summary.json");
|
|
75128
75195
|
if (!existsSync62(summaryPath)) {
|
|
75129
75196
|
logger.error("Skills installation failed. Run with --verbose for details.");
|
|
75130
75197
|
return;
|
|
@@ -75223,7 +75290,7 @@ async function checkNeedsSudoPackages() {
|
|
|
75223
75290
|
}
|
|
75224
75291
|
}
|
|
75225
75292
|
function hasInstallState(skillsDir2) {
|
|
75226
|
-
const stateFilePath =
|
|
75293
|
+
const stateFilePath = join92(skillsDir2, ".install-state.json");
|
|
75227
75294
|
return existsSync62(stateFilePath);
|
|
75228
75295
|
}
|
|
75229
75296
|
var WHICH_COMMAND_TIMEOUT_MS = 5000, WINDOWS_SYSTEM_PACKAGES, SYSTEM_TOOL_KEYS, WINDOWS_RSVG_COMMANDS;
|
|
@@ -75241,7 +75308,7 @@ var init_install_error_handler = __esm(() => {
|
|
|
75241
75308
|
});
|
|
75242
75309
|
|
|
75243
75310
|
// src/services/package-installer/skills-installer.ts
|
|
75244
|
-
import { join as
|
|
75311
|
+
import { join as join93 } from "node:path";
|
|
75245
75312
|
async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
75246
75313
|
const { skipConfirm = false, withSudo = false } = options2;
|
|
75247
75314
|
const displayName = "Skills Dependencies";
|
|
@@ -75267,7 +75334,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75267
75334
|
const clack = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
75268
75335
|
const platform10 = process.platform;
|
|
75269
75336
|
const scriptName = platform10 === "win32" ? "install.ps1" : "install.sh";
|
|
75270
|
-
const scriptPath =
|
|
75337
|
+
const scriptPath = join93(skillsDir2, scriptName);
|
|
75271
75338
|
try {
|
|
75272
75339
|
validateScriptPath(skillsDir2, scriptPath);
|
|
75273
75340
|
} catch (error) {
|
|
@@ -75283,7 +75350,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75283
75350
|
logger.warning(`Skills installation script not found: ${scriptPath}`);
|
|
75284
75351
|
logger.info("");
|
|
75285
75352
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
75286
|
-
logger.info(` See: ${
|
|
75353
|
+
logger.info(` See: ${join93(skillsDir2, "INSTALLATION.md")}`);
|
|
75287
75354
|
logger.info("");
|
|
75288
75355
|
logger.info("Quick start:");
|
|
75289
75356
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -75330,7 +75397,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75330
75397
|
logger.info(` ${platform10 === "win32" ? `powershell -File "${scriptPath}"` : `bash ${scriptPath}`}`);
|
|
75331
75398
|
logger.info("");
|
|
75332
75399
|
logger.info("Or see complete guide:");
|
|
75333
|
-
logger.info(` ${
|
|
75400
|
+
logger.info(` ${join93(skillsDir2, "INSTALLATION.md")}`);
|
|
75334
75401
|
return {
|
|
75335
75402
|
success: false,
|
|
75336
75403
|
package: displayName,
|
|
@@ -75451,7 +75518,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75451
75518
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
75452
75519
|
logger.info("");
|
|
75453
75520
|
logger.info("See complete guide:");
|
|
75454
|
-
logger.info(` cat ${
|
|
75521
|
+
logger.info(` cat ${join93(skillsDir2, "INSTALLATION.md")}`);
|
|
75455
75522
|
logger.info("");
|
|
75456
75523
|
logger.info("Quick start:");
|
|
75457
75524
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -75494,10 +75561,10 @@ var init_skills_installer2 = __esm(() => {
|
|
|
75494
75561
|
init_validators();
|
|
75495
75562
|
});
|
|
75496
75563
|
|
|
75497
|
-
// src/services/package-installer/
|
|
75564
|
+
// src/services/package-installer/agy-mcp/config-manager.ts
|
|
75498
75565
|
import { existsSync as existsSync63 } from "node:fs";
|
|
75499
75566
|
import { mkdir as mkdir23, readFile as readFile49, writeFile as writeFile25 } from "node:fs/promises";
|
|
75500
|
-
import { dirname as dirname34, join as
|
|
75567
|
+
import { dirname as dirname34, join as join94 } from "node:path";
|
|
75501
75568
|
async function readJsonFile(filePath) {
|
|
75502
75569
|
try {
|
|
75503
75570
|
const content = await readFile49(filePath, "utf-8");
|
|
@@ -75508,36 +75575,39 @@ async function readJsonFile(filePath) {
|
|
|
75508
75575
|
return null;
|
|
75509
75576
|
}
|
|
75510
75577
|
}
|
|
75511
|
-
async function
|
|
75512
|
-
const gitignorePath =
|
|
75513
|
-
const geminiPattern = ".gemini/";
|
|
75578
|
+
async function addAgyToGitignore(projectDir) {
|
|
75579
|
+
const gitignorePath = join94(projectDir, ".gitignore");
|
|
75514
75580
|
try {
|
|
75515
75581
|
let content = "";
|
|
75516
75582
|
if (existsSync63(gitignorePath)) {
|
|
75517
75583
|
content = await readFile49(gitignorePath, "utf-8");
|
|
75518
75584
|
const lines = content.split(`
|
|
75519
75585
|
`).map((line) => line.trim()).filter((line) => !line.startsWith("#"));
|
|
75520
|
-
const
|
|
75521
|
-
|
|
75522
|
-
|
|
75586
|
+
const agyPatterns = [
|
|
75587
|
+
".agents/mcp_config.json",
|
|
75588
|
+
"/.agents/mcp_config.json",
|
|
75589
|
+
".agents/mcp_config.json/"
|
|
75590
|
+
];
|
|
75591
|
+
if (lines.some((line) => agyPatterns.includes(line))) {
|
|
75592
|
+
logger.debug(".agents/mcp_config.json already in .gitignore");
|
|
75523
75593
|
return;
|
|
75524
75594
|
}
|
|
75525
75595
|
}
|
|
75526
75596
|
const newLine = content.endsWith(`
|
|
75527
75597
|
`) || content === "" ? "" : `
|
|
75528
75598
|
`;
|
|
75529
|
-
const comment = "#
|
|
75599
|
+
const comment = "# Antigravity CLI MCP config (symlinked to your Claude MCP config)";
|
|
75530
75600
|
await writeFile25(gitignorePath, `${content}${newLine}${comment}
|
|
75531
|
-
${
|
|
75601
|
+
${AGY_GITIGNORE_PATTERN}
|
|
75532
75602
|
`, "utf-8");
|
|
75533
|
-
logger.debug(`Added ${
|
|
75603
|
+
logger.debug(`Added ${AGY_GITIGNORE_PATTERN} to .gitignore`);
|
|
75534
75604
|
} catch (error) {
|
|
75535
75605
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
75536
75606
|
logger.warning(`Failed to update .gitignore: ${errorMessage}`);
|
|
75537
75607
|
}
|
|
75538
75608
|
}
|
|
75539
|
-
async function createNewSettingsWithMerge(
|
|
75540
|
-
const linkDir = dirname34(
|
|
75609
|
+
async function createNewSettingsWithMerge(agyConfigPath, mcpConfigPath) {
|
|
75610
|
+
const linkDir = dirname34(agyConfigPath);
|
|
75541
75611
|
if (!existsSync63(linkDir)) {
|
|
75542
75612
|
await mkdir23(linkDir, { recursive: true });
|
|
75543
75613
|
logger.debug(`Created directory: ${linkDir}`);
|
|
@@ -75552,8 +75622,8 @@ async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
|
75552
75622
|
}
|
|
75553
75623
|
const newSettings = { mcpServers };
|
|
75554
75624
|
try {
|
|
75555
|
-
await writeFile25(
|
|
75556
|
-
logger.debug(`Created new
|
|
75625
|
+
await writeFile25(agyConfigPath, JSON.stringify(newSettings, null, 2), "utf-8");
|
|
75626
|
+
logger.debug(`Created new agy mcp_config.json with mcpServers: ${agyConfigPath}`);
|
|
75557
75627
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
75558
75628
|
} catch (error) {
|
|
75559
75629
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -75564,10 +75634,14 @@ async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
|
75564
75634
|
};
|
|
75565
75635
|
}
|
|
75566
75636
|
}
|
|
75567
|
-
async function
|
|
75568
|
-
const
|
|
75569
|
-
if (!
|
|
75570
|
-
return {
|
|
75637
|
+
async function mergeAgySettings(agyConfigPath, mcpConfigPath) {
|
|
75638
|
+
const agyConfig = await readJsonFile(agyConfigPath);
|
|
75639
|
+
if (!agyConfig) {
|
|
75640
|
+
return {
|
|
75641
|
+
success: false,
|
|
75642
|
+
method: "merge",
|
|
75643
|
+
error: "Failed to read existing agy mcp_config.json"
|
|
75644
|
+
};
|
|
75571
75645
|
}
|
|
75572
75646
|
const mcpConfig = await readJsonFile(mcpConfigPath);
|
|
75573
75647
|
if (!mcpConfig) {
|
|
@@ -75578,12 +75652,12 @@ async function mergeGeminiSettings(geminiSettingsPath, mcpConfigPath) {
|
|
|
75578
75652
|
return { success: false, method: "merge", error: "MCP config has no valid mcpServers object" };
|
|
75579
75653
|
}
|
|
75580
75654
|
const mergedSettings = {
|
|
75581
|
-
...
|
|
75655
|
+
...agyConfig,
|
|
75582
75656
|
mcpServers
|
|
75583
75657
|
};
|
|
75584
75658
|
try {
|
|
75585
|
-
await writeFile25(
|
|
75586
|
-
logger.debug(`Merged mcpServers into: ${
|
|
75659
|
+
await writeFile25(agyConfigPath, JSON.stringify(mergedSettings, null, 2), "utf-8");
|
|
75660
|
+
logger.debug(`Merged mcpServers into: ${agyConfigPath}`);
|
|
75587
75661
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
75588
75662
|
} catch (error) {
|
|
75589
75663
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -75594,19 +75668,20 @@ async function mergeGeminiSettings(geminiSettingsPath, mcpConfigPath) {
|
|
|
75594
75668
|
};
|
|
75595
75669
|
}
|
|
75596
75670
|
}
|
|
75671
|
+
var AGY_GITIGNORE_PATTERN = ".agents/mcp_config.json";
|
|
75597
75672
|
var init_config_manager2 = __esm(() => {
|
|
75598
75673
|
init_logger();
|
|
75599
75674
|
});
|
|
75600
75675
|
|
|
75601
|
-
// src/services/package-installer/
|
|
75676
|
+
// src/services/package-installer/agy-mcp/validation.ts
|
|
75602
75677
|
import { existsSync as existsSync64, lstatSync, readlinkSync } from "node:fs";
|
|
75603
75678
|
import { homedir as homedir45 } from "node:os";
|
|
75604
|
-
import { join as
|
|
75679
|
+
import { join as join95 } from "node:path";
|
|
75605
75680
|
function getGlobalMcpConfigPath() {
|
|
75606
|
-
return
|
|
75681
|
+
return join95(homedir45(), ".claude", ".mcp.json");
|
|
75607
75682
|
}
|
|
75608
75683
|
function getLocalMcpConfigPath(projectDir) {
|
|
75609
|
-
return
|
|
75684
|
+
return join95(projectDir, ".mcp.json");
|
|
75610
75685
|
}
|
|
75611
75686
|
function findMcpConfigPath(projectDir) {
|
|
75612
75687
|
const localPath = getLocalMcpConfigPath(projectDir);
|
|
@@ -75622,41 +75697,41 @@ function findMcpConfigPath(projectDir) {
|
|
|
75622
75697
|
logger.debug("No MCP config found (local or global)");
|
|
75623
75698
|
return null;
|
|
75624
75699
|
}
|
|
75625
|
-
function
|
|
75700
|
+
function getAgyMcpConfigPath(projectDir, isGlobal) {
|
|
75626
75701
|
if (isGlobal) {
|
|
75627
|
-
return
|
|
75702
|
+
return join95(homedir45(), ".gemini", "config", "mcp_config.json");
|
|
75628
75703
|
}
|
|
75629
|
-
return
|
|
75704
|
+
return join95(projectDir, ".agents", "mcp_config.json");
|
|
75630
75705
|
}
|
|
75631
|
-
function
|
|
75632
|
-
const
|
|
75633
|
-
if (!existsSync64(
|
|
75634
|
-
return { exists: false, isSymlink: false, settingsPath:
|
|
75706
|
+
function checkExistingAgyConfig(projectDir, isGlobal = false) {
|
|
75707
|
+
const agyConfigPath = getAgyMcpConfigPath(projectDir, isGlobal);
|
|
75708
|
+
if (!existsSync64(agyConfigPath)) {
|
|
75709
|
+
return { exists: false, isSymlink: false, settingsPath: agyConfigPath };
|
|
75635
75710
|
}
|
|
75636
75711
|
try {
|
|
75637
|
-
const stats = lstatSync(
|
|
75712
|
+
const stats = lstatSync(agyConfigPath);
|
|
75638
75713
|
if (stats.isSymbolicLink()) {
|
|
75639
|
-
const target = readlinkSync(
|
|
75714
|
+
const target = readlinkSync(agyConfigPath);
|
|
75640
75715
|
return {
|
|
75641
75716
|
exists: true,
|
|
75642
75717
|
isSymlink: true,
|
|
75643
75718
|
currentTarget: target,
|
|
75644
|
-
settingsPath:
|
|
75719
|
+
settingsPath: agyConfigPath
|
|
75645
75720
|
};
|
|
75646
75721
|
}
|
|
75647
|
-
return { exists: true, isSymlink: false, settingsPath:
|
|
75722
|
+
return { exists: true, isSymlink: false, settingsPath: agyConfigPath };
|
|
75648
75723
|
} catch {
|
|
75649
|
-
return { exists: true, isSymlink: false, settingsPath:
|
|
75724
|
+
return { exists: true, isSymlink: false, settingsPath: agyConfigPath };
|
|
75650
75725
|
}
|
|
75651
75726
|
}
|
|
75652
75727
|
var init_validation = __esm(() => {
|
|
75653
75728
|
init_logger();
|
|
75654
75729
|
});
|
|
75655
75730
|
|
|
75656
|
-
// src/services/package-installer/
|
|
75731
|
+
// src/services/package-installer/agy-mcp/linker-core.ts
|
|
75657
75732
|
import { existsSync as existsSync65 } from "node:fs";
|
|
75658
75733
|
import { mkdir as mkdir24, symlink as symlink3 } from "node:fs/promises";
|
|
75659
|
-
import { dirname as dirname35, join as
|
|
75734
|
+
import { dirname as dirname35, join as join96 } from "node:path";
|
|
75660
75735
|
async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
75661
75736
|
const linkDir = dirname35(linkPath);
|
|
75662
75737
|
if (!existsSync65(linkDir)) {
|
|
@@ -75667,14 +75742,14 @@ async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
|
75667
75742
|
if (isGlobal) {
|
|
75668
75743
|
symlinkTarget = getGlobalMcpConfigPath();
|
|
75669
75744
|
} else {
|
|
75670
|
-
const localMcpPath =
|
|
75745
|
+
const localMcpPath = join96(projectDir, ".mcp.json");
|
|
75671
75746
|
const isLocalConfig = targetPath === localMcpPath;
|
|
75672
75747
|
symlinkTarget = isLocalConfig ? "../.mcp.json" : targetPath;
|
|
75673
75748
|
}
|
|
75674
75749
|
try {
|
|
75675
75750
|
await symlink3(symlinkTarget, linkPath, isWindows() ? "file" : undefined);
|
|
75676
75751
|
logger.debug(`Created symlink: ${linkPath} → ${symlinkTarget}`);
|
|
75677
|
-
return { success: true, method: "symlink", targetPath,
|
|
75752
|
+
return { success: true, method: "symlink", targetPath, agyConfigPath: linkPath };
|
|
75678
75753
|
} catch (error) {
|
|
75679
75754
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
75680
75755
|
return {
|
|
@@ -75690,21 +75765,21 @@ var init_linker_core = __esm(() => {
|
|
|
75690
75765
|
init_validation();
|
|
75691
75766
|
});
|
|
75692
75767
|
|
|
75693
|
-
// src/services/package-installer/
|
|
75694
|
-
var
|
|
75695
|
-
__export(
|
|
75696
|
-
|
|
75697
|
-
|
|
75698
|
-
|
|
75768
|
+
// src/services/package-installer/agy-mcp-linker.ts
|
|
75769
|
+
var exports_agy_mcp_linker = {};
|
|
75770
|
+
__export(exports_agy_mcp_linker, {
|
|
75771
|
+
processAgyMcpLinking: () => processAgyMcpLinking,
|
|
75772
|
+
linkAgyMcpConfig: () => linkAgyMcpConfig,
|
|
75773
|
+
getAgyMcpConfigPath: () => getAgyMcpConfigPath,
|
|
75699
75774
|
findMcpConfigPath: () => findMcpConfigPath,
|
|
75700
|
-
|
|
75701
|
-
|
|
75775
|
+
checkExistingAgyConfig: () => checkExistingAgyConfig,
|
|
75776
|
+
addAgyToGitignore: () => addAgyToGitignore
|
|
75702
75777
|
});
|
|
75703
75778
|
import { resolve as resolve39 } from "node:path";
|
|
75704
|
-
async function
|
|
75779
|
+
async function linkAgyMcpConfig(projectDir, options2 = {}) {
|
|
75705
75780
|
const { skipGitignore = false, isGlobal = false } = options2;
|
|
75706
75781
|
const resolvedProjectDir = resolve39(projectDir);
|
|
75707
|
-
const
|
|
75782
|
+
const agyConfigPath = getAgyMcpConfigPath(resolvedProjectDir, isGlobal);
|
|
75708
75783
|
const mcpConfigPath = findMcpConfigPath(resolvedProjectDir);
|
|
75709
75784
|
if (!mcpConfigPath) {
|
|
75710
75785
|
return {
|
|
@@ -75713,50 +75788,50 @@ async function linkGeminiMcpConfig(projectDir, options2 = {}) {
|
|
|
75713
75788
|
error: "No MCP config found. Create .mcp.json or ~/.claude/.mcp.json first."
|
|
75714
75789
|
};
|
|
75715
75790
|
}
|
|
75716
|
-
const existing =
|
|
75791
|
+
const existing = checkExistingAgyConfig(resolvedProjectDir, isGlobal);
|
|
75717
75792
|
let result;
|
|
75718
75793
|
if (!existing.exists) {
|
|
75719
|
-
result = await createSymlink(mcpConfigPath,
|
|
75794
|
+
result = await createSymlink(mcpConfigPath, agyConfigPath, resolvedProjectDir, isGlobal);
|
|
75720
75795
|
if (!result.success && process.platform === "win32") {
|
|
75721
75796
|
logger.debug("Symlink failed on Windows, falling back to merge");
|
|
75722
|
-
result = await createNewSettingsWithMerge(
|
|
75797
|
+
result = await createNewSettingsWithMerge(agyConfigPath, mcpConfigPath);
|
|
75723
75798
|
}
|
|
75724
75799
|
} else if (existing.isSymlink) {
|
|
75725
75800
|
result = {
|
|
75726
75801
|
success: true,
|
|
75727
75802
|
method: "skipped",
|
|
75728
75803
|
targetPath: existing.currentTarget,
|
|
75729
|
-
|
|
75804
|
+
agyConfigPath
|
|
75730
75805
|
};
|
|
75731
75806
|
} else {
|
|
75732
|
-
result = await
|
|
75807
|
+
result = await mergeAgySettings(agyConfigPath, mcpConfigPath);
|
|
75733
75808
|
}
|
|
75734
75809
|
if (result.success && !skipGitignore && !isGlobal) {
|
|
75735
|
-
await
|
|
75810
|
+
await addAgyToGitignore(resolvedProjectDir);
|
|
75736
75811
|
}
|
|
75737
75812
|
return result;
|
|
75738
75813
|
}
|
|
75739
|
-
async function
|
|
75740
|
-
logger.info("Setting up
|
|
75741
|
-
const result = await
|
|
75742
|
-
const
|
|
75814
|
+
async function processAgyMcpLinking(projectDir, options2 = {}) {
|
|
75815
|
+
logger.info("Setting up Antigravity (agy) CLI MCP integration...");
|
|
75816
|
+
const result = await linkAgyMcpConfig(projectDir, options2);
|
|
75817
|
+
const configPath = result.agyConfigPath || (options2.isGlobal ? "~/.gemini/config/mcp_config.json" : ".agents/mcp_config.json");
|
|
75743
75818
|
if (result.success) {
|
|
75744
75819
|
if (result.method === "symlink") {
|
|
75745
|
-
logger.success(`
|
|
75820
|
+
logger.success(`agy MCP linked: ${configPath} → ${result.targetPath}`);
|
|
75746
75821
|
logger.info("MCP servers will auto-sync with your Claude config.");
|
|
75747
75822
|
} else if (result.method === "merge") {
|
|
75748
|
-
logger.success("
|
|
75823
|
+
logger.success("agy MCP config updated (merged mcpServers, preserved your settings)");
|
|
75749
75824
|
logger.info("Note: Run 'ck init' again to sync MCP config changes.");
|
|
75750
75825
|
} else {
|
|
75751
|
-
logger.info("
|
|
75826
|
+
logger.info("agy MCP config already configured.");
|
|
75752
75827
|
}
|
|
75753
75828
|
} else {
|
|
75754
|
-
logger.warning(`
|
|
75755
|
-
const cmd = options2.isGlobal ? "mkdir -p ~/.gemini && ln -sf ~/.claude/.mcp.json ~/.gemini/
|
|
75829
|
+
logger.warning(`agy MCP setup incomplete: ${result.error}`);
|
|
75830
|
+
const cmd = options2.isGlobal ? "mkdir -p ~/.gemini/config && ln -sf ~/.claude/.mcp.json ~/.gemini/config/mcp_config.json" : "mkdir -p .agents && ln -sf ../.mcp.json .agents/mcp_config.json";
|
|
75756
75831
|
logger.info(`Manual setup: ${cmd}`);
|
|
75757
75832
|
}
|
|
75758
75833
|
}
|
|
75759
|
-
var
|
|
75834
|
+
var init_agy_mcp_linker = __esm(() => {
|
|
75760
75835
|
init_logger();
|
|
75761
75836
|
init_config_manager2();
|
|
75762
75837
|
init_linker_core();
|
|
@@ -75773,11 +75848,11 @@ __export(exports_package_installer, {
|
|
|
75773
75848
|
processPackageInstallations: () => processPackageInstallations,
|
|
75774
75849
|
isPackageInstalled: () => isPackageInstalled,
|
|
75775
75850
|
isOpenCodeInstalled: () => isOpenCodeInstalled,
|
|
75776
|
-
|
|
75851
|
+
isAgyInstalled: () => isAgyInstalled,
|
|
75777
75852
|
installSkillsDependencies: () => installSkillsDependencies,
|
|
75778
75853
|
installPackageGlobally: () => installPackageGlobally,
|
|
75779
75854
|
installOpenCode: () => installOpenCode,
|
|
75780
|
-
|
|
75855
|
+
installAgy: () => installAgy,
|
|
75781
75856
|
handleSkillsInstallation: () => handleSkillsInstallation,
|
|
75782
75857
|
getPackageVersion: () => getPackageVersion,
|
|
75783
75858
|
getNpmCommand: () => getNpmCommand,
|
|
@@ -75786,9 +75861,10 @@ __export(exports_package_installer, {
|
|
|
75786
75861
|
execAsync: () => execAsync7,
|
|
75787
75862
|
PARTIAL_INSTALL_VERSION: () => PARTIAL_INSTALL_VERSION,
|
|
75788
75863
|
EXIT_CODE_PARTIAL_SUCCESS: () => EXIT_CODE_PARTIAL_SUCCESS,
|
|
75789
|
-
EXIT_CODE_CRITICAL_FAILURE: () => EXIT_CODE_CRITICAL_FAILURE
|
|
75864
|
+
EXIT_CODE_CRITICAL_FAILURE: () => EXIT_CODE_CRITICAL_FAILURE,
|
|
75865
|
+
AGY_DISPLAY_NAME: () => AGY_DISPLAY_NAME
|
|
75790
75866
|
});
|
|
75791
|
-
async function processPackageInstallations(shouldInstallOpenCode,
|
|
75867
|
+
async function processPackageInstallations(shouldInstallOpenCode, shouldInstallAgy, projectDir) {
|
|
75792
75868
|
const results = {};
|
|
75793
75869
|
if (shouldInstallOpenCode) {
|
|
75794
75870
|
if (isTestEnvironment()) {
|
|
@@ -75810,28 +75886,28 @@ async function processPackageInstallations(shouldInstallOpenCode, shouldInstallG
|
|
|
75810
75886
|
}
|
|
75811
75887
|
}
|
|
75812
75888
|
}
|
|
75813
|
-
if (
|
|
75889
|
+
if (shouldInstallAgy) {
|
|
75814
75890
|
if (isTestEnvironment()) {
|
|
75815
|
-
results.
|
|
75891
|
+
results.agy = {
|
|
75816
75892
|
success: true,
|
|
75817
|
-
package:
|
|
75893
|
+
package: AGY_DISPLAY_NAME,
|
|
75818
75894
|
skipped: true
|
|
75819
75895
|
};
|
|
75820
75896
|
} else {
|
|
75821
|
-
const alreadyInstalled = await
|
|
75897
|
+
const alreadyInstalled = await isAgyInstalled();
|
|
75822
75898
|
if (alreadyInstalled) {
|
|
75823
|
-
logger.info(
|
|
75824
|
-
results.
|
|
75899
|
+
logger.info(`${AGY_DISPLAY_NAME} already installed`);
|
|
75900
|
+
results.agy = {
|
|
75825
75901
|
success: true,
|
|
75826
|
-
package:
|
|
75902
|
+
package: AGY_DISPLAY_NAME
|
|
75827
75903
|
};
|
|
75828
75904
|
} else {
|
|
75829
|
-
results.
|
|
75905
|
+
results.agy = await installAgy();
|
|
75830
75906
|
}
|
|
75831
|
-
const
|
|
75832
|
-
if (projectDir &&
|
|
75833
|
-
const {
|
|
75834
|
-
await
|
|
75907
|
+
const agyAvailable = alreadyInstalled || results.agy?.success;
|
|
75908
|
+
if (projectDir && agyAvailable) {
|
|
75909
|
+
const { processAgyMcpLinking: processAgyMcpLinking2 } = await Promise.resolve().then(() => (init_agy_mcp_linker(), exports_agy_mcp_linker));
|
|
75910
|
+
await processAgyMcpLinking2(projectDir);
|
|
75835
75911
|
}
|
|
75836
75912
|
}
|
|
75837
75913
|
}
|
|
@@ -75840,13 +75916,13 @@ async function processPackageInstallations(shouldInstallOpenCode, shouldInstallG
|
|
|
75840
75916
|
var init_package_installer = __esm(() => {
|
|
75841
75917
|
init_environment();
|
|
75842
75918
|
init_logger();
|
|
75843
|
-
|
|
75919
|
+
init_agy_installer();
|
|
75844
75920
|
init_opencode_installer();
|
|
75845
75921
|
init_validators();
|
|
75846
75922
|
init_process_executor();
|
|
75847
75923
|
init_npm_package_manager();
|
|
75848
75924
|
init_opencode_installer();
|
|
75849
|
-
|
|
75925
|
+
init_agy_installer();
|
|
75850
75926
|
init_skills_installer2();
|
|
75851
75927
|
});
|
|
75852
75928
|
|
|
@@ -78084,9 +78160,9 @@ __export(exports_worktree_manager, {
|
|
|
78084
78160
|
});
|
|
78085
78161
|
import { existsSync as existsSync77 } from "node:fs";
|
|
78086
78162
|
import { readFile as readFile70, writeFile as writeFile41 } from "node:fs/promises";
|
|
78087
|
-
import { join as
|
|
78163
|
+
import { join as join160 } from "node:path";
|
|
78088
78164
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
78089
|
-
const worktreePath =
|
|
78165
|
+
const worktreePath = join160(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
78090
78166
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
78091
78167
|
await spawnAndCollect("git", ["fetch", "origin", baseBranch], projectDir).catch(() => {
|
|
78092
78168
|
logger.warning(`[worktree] Could not fetch origin/${baseBranch}, using local`);
|
|
@@ -78104,7 +78180,7 @@ async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
|
78104
78180
|
return worktreePath;
|
|
78105
78181
|
}
|
|
78106
78182
|
async function removeWorktree(projectDir, issueNumber) {
|
|
78107
|
-
const worktreePath =
|
|
78183
|
+
const worktreePath = join160(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
78108
78184
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
78109
78185
|
try {
|
|
78110
78186
|
await spawnAndCollect("git", ["worktree", "remove", worktreePath, "--force"], projectDir);
|
|
@@ -78118,7 +78194,7 @@ async function listActiveWorktrees(projectDir) {
|
|
|
78118
78194
|
try {
|
|
78119
78195
|
const output2 = await spawnAndCollect("git", ["worktree", "list", "--porcelain"], projectDir);
|
|
78120
78196
|
const issueNumbers = [];
|
|
78121
|
-
const worktreePrefix =
|
|
78197
|
+
const worktreePrefix = join160(projectDir, WORKTREE_DIR, "issue-").replace(/\\/g, "/");
|
|
78122
78198
|
for (const line of output2.split(`
|
|
78123
78199
|
`)) {
|
|
78124
78200
|
if (line.startsWith("worktree ")) {
|
|
@@ -78146,7 +78222,7 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
78146
78222
|
await spawnAndCollect("git", ["worktree", "prune"], projectDir).catch(() => {});
|
|
78147
78223
|
}
|
|
78148
78224
|
async function ensureGitignore(projectDir) {
|
|
78149
|
-
const gitignorePath =
|
|
78225
|
+
const gitignorePath = join160(projectDir, ".gitignore");
|
|
78150
78226
|
try {
|
|
78151
78227
|
const content = existsSync77(gitignorePath) ? await readFile70(gitignorePath, "utf-8") : "";
|
|
78152
78228
|
if (!content.includes(".worktrees")) {
|
|
@@ -78253,7 +78329,7 @@ import { createHash as createHash9 } from "node:crypto";
|
|
|
78253
78329
|
import { existsSync as existsSync83, mkdirSync as mkdirSync7, readFileSync as readFileSync22, readdirSync as readdirSync14, statSync as statSync15 } from "node:fs";
|
|
78254
78330
|
import { rename as rename16, writeFile as writeFile43 } from "node:fs/promises";
|
|
78255
78331
|
import { homedir as homedir54 } from "node:os";
|
|
78256
|
-
import { basename as basename34, join as
|
|
78332
|
+
import { basename as basename34, join as join167 } from "node:path";
|
|
78257
78333
|
function getCachedContext(repoPath) {
|
|
78258
78334
|
const cachePath = getCacheFilePath(repoPath);
|
|
78259
78335
|
if (!existsSync83(cachePath))
|
|
@@ -78296,25 +78372,25 @@ function computeSourceHash(repoPath) {
|
|
|
78296
78372
|
}
|
|
78297
78373
|
function getDocSourcePaths(repoPath) {
|
|
78298
78374
|
const paths = [];
|
|
78299
|
-
const docsDir =
|
|
78375
|
+
const docsDir = join167(repoPath, "docs");
|
|
78300
78376
|
if (existsSync83(docsDir)) {
|
|
78301
78377
|
try {
|
|
78302
78378
|
const files = readdirSync14(docsDir);
|
|
78303
78379
|
for (const f3 of files) {
|
|
78304
78380
|
if (f3.endsWith(".md"))
|
|
78305
|
-
paths.push(
|
|
78381
|
+
paths.push(join167(docsDir, f3));
|
|
78306
78382
|
}
|
|
78307
78383
|
} catch {}
|
|
78308
78384
|
}
|
|
78309
|
-
const readme =
|
|
78385
|
+
const readme = join167(repoPath, "README.md");
|
|
78310
78386
|
if (existsSync83(readme))
|
|
78311
78387
|
paths.push(readme);
|
|
78312
|
-
const stylesDir =
|
|
78388
|
+
const stylesDir = join167(repoPath, "assets", "writing-styles");
|
|
78313
78389
|
if (existsSync83(stylesDir)) {
|
|
78314
78390
|
try {
|
|
78315
78391
|
const files = readdirSync14(stylesDir);
|
|
78316
78392
|
for (const f3 of files) {
|
|
78317
|
-
paths.push(
|
|
78393
|
+
paths.push(join167(stylesDir, f3));
|
|
78318
78394
|
}
|
|
78319
78395
|
} catch {}
|
|
78320
78396
|
}
|
|
@@ -78323,11 +78399,11 @@ function getDocSourcePaths(repoPath) {
|
|
|
78323
78399
|
function getCacheFilePath(repoPath) {
|
|
78324
78400
|
const repoName = basename34(repoPath).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
78325
78401
|
const pathHash = createHash9("sha256").update(repoPath).digest("hex").slice(0, 8);
|
|
78326
|
-
return
|
|
78402
|
+
return join167(CACHE_DIR, `${repoName}-${pathHash}-context-cache.json`);
|
|
78327
78403
|
}
|
|
78328
78404
|
var CACHE_DIR, CACHE_TTL_MS5;
|
|
78329
78405
|
var init_context_cache_manager = __esm(() => {
|
|
78330
|
-
CACHE_DIR =
|
|
78406
|
+
CACHE_DIR = join167(homedir54(), ".claudekit", "cache");
|
|
78331
78407
|
CACHE_TTL_MS5 = 24 * 60 * 60 * 1000;
|
|
78332
78408
|
});
|
|
78333
78409
|
|
|
@@ -78508,7 +78584,7 @@ function extractContentFromResponse(response) {
|
|
|
78508
78584
|
// src/commands/content/phases/docs-summarizer.ts
|
|
78509
78585
|
import { execSync as execSync7 } from "node:child_process";
|
|
78510
78586
|
import { existsSync as existsSync84, readFileSync as readFileSync23, readdirSync as readdirSync15 } from "node:fs";
|
|
78511
|
-
import { join as
|
|
78587
|
+
import { join as join168 } from "node:path";
|
|
78512
78588
|
async function summarizeProjectDocs(repoPath, contentLogger) {
|
|
78513
78589
|
const rawContent = collectRawDocs(repoPath);
|
|
78514
78590
|
if (rawContent.total.length < 200) {
|
|
@@ -78562,12 +78638,12 @@ function collectRawDocs(repoPath) {
|
|
|
78562
78638
|
return capped;
|
|
78563
78639
|
};
|
|
78564
78640
|
const docsContent = [];
|
|
78565
|
-
const docsDir =
|
|
78641
|
+
const docsDir = join168(repoPath, "docs");
|
|
78566
78642
|
if (existsSync84(docsDir)) {
|
|
78567
78643
|
try {
|
|
78568
78644
|
const files = readdirSync15(docsDir).filter((f3) => f3.endsWith(".md")).sort();
|
|
78569
78645
|
for (const f3 of files) {
|
|
78570
|
-
const content = readCapped(
|
|
78646
|
+
const content = readCapped(join168(docsDir, f3), 5000);
|
|
78571
78647
|
if (content) {
|
|
78572
78648
|
docsContent.push(`### ${f3}
|
|
78573
78649
|
${content}`);
|
|
@@ -78581,21 +78657,21 @@ ${content}`);
|
|
|
78581
78657
|
let brand = "";
|
|
78582
78658
|
const brandCandidates = ["docs/brand-guidelines.md", "docs/design-guidelines.md"];
|
|
78583
78659
|
for (const p of brandCandidates) {
|
|
78584
|
-
brand = readCapped(
|
|
78660
|
+
brand = readCapped(join168(repoPath, p), 3000);
|
|
78585
78661
|
if (brand)
|
|
78586
78662
|
break;
|
|
78587
78663
|
}
|
|
78588
78664
|
let styles3 = "";
|
|
78589
|
-
const stylesDir =
|
|
78665
|
+
const stylesDir = join168(repoPath, "assets", "writing-styles");
|
|
78590
78666
|
if (existsSync84(stylesDir)) {
|
|
78591
78667
|
try {
|
|
78592
78668
|
const files = readdirSync15(stylesDir).slice(0, 3);
|
|
78593
|
-
styles3 = files.map((f3) => readCapped(
|
|
78669
|
+
styles3 = files.map((f3) => readCapped(join168(stylesDir, f3), 1000)).filter(Boolean).join(`
|
|
78594
78670
|
|
|
78595
78671
|
`);
|
|
78596
78672
|
} catch {}
|
|
78597
78673
|
}
|
|
78598
|
-
const readme = readCapped(
|
|
78674
|
+
const readme = readCapped(join168(repoPath, "README.md"), 3000);
|
|
78599
78675
|
const total = [docs, brand, styles3, readme].join(`
|
|
78600
78676
|
`);
|
|
78601
78677
|
return { docs, brand, styles: styles3, readme, total };
|
|
@@ -78782,9 +78858,9 @@ IMPORTANT: Generate the image and output the path as JSON: {"imagePath": "/path/
|
|
|
78782
78858
|
import { execSync as execSync8 } from "node:child_process";
|
|
78783
78859
|
import { existsSync as existsSync85, mkdirSync as mkdirSync8, readdirSync as readdirSync16 } from "node:fs";
|
|
78784
78860
|
import { homedir as homedir55 } from "node:os";
|
|
78785
|
-
import { join as
|
|
78861
|
+
import { join as join169 } from "node:path";
|
|
78786
78862
|
async function generatePhoto(_content, context, config, platform18, contentId, contentLogger) {
|
|
78787
|
-
const mediaDir =
|
|
78863
|
+
const mediaDir = join169(config.contentDir.replace(/^~/, homedir55()), "media", String(contentId));
|
|
78788
78864
|
if (!existsSync85(mediaDir)) {
|
|
78789
78865
|
mkdirSync8(mediaDir, { recursive: true });
|
|
78790
78866
|
}
|
|
@@ -78809,7 +78885,7 @@ async function generatePhoto(_content, context, config, platform18, contentId, c
|
|
|
78809
78885
|
const imageFile = files.find((f3) => /\.(png|jpg|jpeg|webp)$/i.test(f3));
|
|
78810
78886
|
if (imageFile) {
|
|
78811
78887
|
const ext2 = imageFile.split(".").pop() ?? "png";
|
|
78812
|
-
return { path:
|
|
78888
|
+
return { path: join169(mediaDir, imageFile), ...dimensions, format: ext2 };
|
|
78813
78889
|
}
|
|
78814
78890
|
contentLogger.warn(`Photo generation produced no image for content ${contentId}`);
|
|
78815
78891
|
return null;
|
|
@@ -78899,7 +78975,7 @@ var init_content_creator = __esm(() => {
|
|
|
78899
78975
|
// src/commands/content/phases/content-logger.ts
|
|
78900
78976
|
import { createWriteStream as createWriteStream4, existsSync as existsSync86, mkdirSync as mkdirSync9, statSync as statSync16 } from "node:fs";
|
|
78901
78977
|
import { homedir as homedir56 } from "node:os";
|
|
78902
|
-
import { join as
|
|
78978
|
+
import { join as join170 } from "node:path";
|
|
78903
78979
|
|
|
78904
78980
|
class ContentLogger {
|
|
78905
78981
|
stream = null;
|
|
@@ -78907,7 +78983,7 @@ class ContentLogger {
|
|
|
78907
78983
|
logDir;
|
|
78908
78984
|
maxBytes;
|
|
78909
78985
|
constructor(maxBytes = 0) {
|
|
78910
|
-
this.logDir =
|
|
78986
|
+
this.logDir = join170(homedir56(), ".claudekit", "logs");
|
|
78911
78987
|
this.maxBytes = maxBytes;
|
|
78912
78988
|
}
|
|
78913
78989
|
init() {
|
|
@@ -78939,7 +79015,7 @@ class ContentLogger {
|
|
|
78939
79015
|
}
|
|
78940
79016
|
}
|
|
78941
79017
|
getLogPath() {
|
|
78942
|
-
return
|
|
79018
|
+
return join170(this.logDir, `content-${this.getDateStr()}.log`);
|
|
78943
79019
|
}
|
|
78944
79020
|
write(level, message) {
|
|
78945
79021
|
this.rotateIfNeeded();
|
|
@@ -78956,18 +79032,18 @@ class ContentLogger {
|
|
|
78956
79032
|
if (dateStr !== this.currentDate) {
|
|
78957
79033
|
this.close();
|
|
78958
79034
|
this.currentDate = dateStr;
|
|
78959
|
-
const logPath =
|
|
79035
|
+
const logPath = join170(this.logDir, `content-${dateStr}.log`);
|
|
78960
79036
|
this.stream = createWriteStream4(logPath, { flags: "a", mode: 384 });
|
|
78961
79037
|
return;
|
|
78962
79038
|
}
|
|
78963
79039
|
if (this.maxBytes > 0 && this.stream) {
|
|
78964
|
-
const logPath =
|
|
79040
|
+
const logPath = join170(this.logDir, `content-${this.currentDate}.log`);
|
|
78965
79041
|
try {
|
|
78966
79042
|
const stat26 = statSync16(logPath);
|
|
78967
79043
|
if (stat26.size >= this.maxBytes) {
|
|
78968
79044
|
this.close();
|
|
78969
79045
|
const suffix = Date.now();
|
|
78970
|
-
const rotatedPath =
|
|
79046
|
+
const rotatedPath = join170(this.logDir, `content-${this.currentDate}-${suffix}.log`);
|
|
78971
79047
|
import("node:fs/promises").then(({ rename: rename17 }) => rename17(logPath, rotatedPath).catch(() => {}));
|
|
78972
79048
|
this.stream = createWriteStream4(logPath, { flags: "w", mode: 384 });
|
|
78973
79049
|
}
|
|
@@ -79238,7 +79314,7 @@ function isNoiseCommit(title, author) {
|
|
|
79238
79314
|
// src/commands/content/phases/change-detector.ts
|
|
79239
79315
|
import { execSync as execSync10, spawnSync as spawnSync9 } from "node:child_process";
|
|
79240
79316
|
import { existsSync as existsSync88, readFileSync as readFileSync24, readdirSync as readdirSync17, statSync as statSync17 } from "node:fs";
|
|
79241
|
-
import { join as
|
|
79317
|
+
import { join as join171 } from "node:path";
|
|
79242
79318
|
function detectCommits(repo, since) {
|
|
79243
79319
|
try {
|
|
79244
79320
|
const fetchUrl = sshToHttps(repo.remoteUrl);
|
|
@@ -79347,7 +79423,7 @@ function detectTags(repo, since) {
|
|
|
79347
79423
|
}
|
|
79348
79424
|
}
|
|
79349
79425
|
function detectCompletedPlans(repo, since) {
|
|
79350
|
-
const plansDir =
|
|
79426
|
+
const plansDir = join171(repo.path, "plans");
|
|
79351
79427
|
if (!existsSync88(plansDir))
|
|
79352
79428
|
return [];
|
|
79353
79429
|
const sinceMs = new Date(since).getTime();
|
|
@@ -79357,7 +79433,7 @@ function detectCompletedPlans(repo, since) {
|
|
|
79357
79433
|
for (const entry of entries) {
|
|
79358
79434
|
if (!entry.isDirectory())
|
|
79359
79435
|
continue;
|
|
79360
|
-
const planFile =
|
|
79436
|
+
const planFile = join171(plansDir, entry.name, "plan.md");
|
|
79361
79437
|
if (!existsSync88(planFile))
|
|
79362
79438
|
continue;
|
|
79363
79439
|
try {
|
|
@@ -79435,7 +79511,7 @@ function classifyCommit(event) {
|
|
|
79435
79511
|
// src/commands/content/phases/repo-discoverer.ts
|
|
79436
79512
|
import { execSync as execSync11 } from "node:child_process";
|
|
79437
79513
|
import { readdirSync as readdirSync18 } from "node:fs";
|
|
79438
|
-
import { join as
|
|
79514
|
+
import { join as join172 } from "node:path";
|
|
79439
79515
|
function discoverRepos2(cwd2) {
|
|
79440
79516
|
const repos = [];
|
|
79441
79517
|
if (isGitRepoRoot(cwd2)) {
|
|
@@ -79448,7 +79524,7 @@ function discoverRepos2(cwd2) {
|
|
|
79448
79524
|
for (const entry of entries) {
|
|
79449
79525
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
79450
79526
|
continue;
|
|
79451
|
-
const dirPath =
|
|
79527
|
+
const dirPath = join172(cwd2, entry.name);
|
|
79452
79528
|
if (isGitRepoRoot(dirPath)) {
|
|
79453
79529
|
const info = getRepoInfo(dirPath);
|
|
79454
79530
|
if (info)
|
|
@@ -80116,9 +80192,9 @@ var init_types6 = __esm(() => {
|
|
|
80116
80192
|
|
|
80117
80193
|
// src/commands/content/phases/state-manager.ts
|
|
80118
80194
|
import { readFile as readFile72, rename as rename17, writeFile as writeFile44 } from "node:fs/promises";
|
|
80119
|
-
import { join as
|
|
80195
|
+
import { join as join173 } from "node:path";
|
|
80120
80196
|
async function loadContentConfig(projectDir) {
|
|
80121
|
-
const configPath =
|
|
80197
|
+
const configPath = join173(projectDir, CK_CONFIG_FILE2);
|
|
80122
80198
|
try {
|
|
80123
80199
|
const raw2 = await readFile72(configPath, "utf-8");
|
|
80124
80200
|
const json = JSON.parse(raw2);
|
|
@@ -80128,13 +80204,13 @@ async function loadContentConfig(projectDir) {
|
|
|
80128
80204
|
}
|
|
80129
80205
|
}
|
|
80130
80206
|
async function saveContentConfig(projectDir, config) {
|
|
80131
|
-
const configPath =
|
|
80207
|
+
const configPath = join173(projectDir, CK_CONFIG_FILE2);
|
|
80132
80208
|
const json = await readJsonSafe4(configPath);
|
|
80133
80209
|
json.content = { ...json.content, ...config };
|
|
80134
80210
|
await atomicWrite3(configPath, json);
|
|
80135
80211
|
}
|
|
80136
80212
|
async function loadContentState(projectDir) {
|
|
80137
|
-
const configPath =
|
|
80213
|
+
const configPath = join173(projectDir, CK_CONFIG_FILE2);
|
|
80138
80214
|
try {
|
|
80139
80215
|
const raw2 = await readFile72(configPath, "utf-8");
|
|
80140
80216
|
const json = JSON.parse(raw2);
|
|
@@ -80145,7 +80221,7 @@ async function loadContentState(projectDir) {
|
|
|
80145
80221
|
}
|
|
80146
80222
|
}
|
|
80147
80223
|
async function saveContentState(projectDir, state) {
|
|
80148
|
-
const configPath =
|
|
80224
|
+
const configPath = join173(projectDir, CK_CONFIG_FILE2);
|
|
80149
80225
|
const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);
|
|
80150
80226
|
for (const key of Object.keys(state.dailyPostCounts)) {
|
|
80151
80227
|
const dateStr = key.slice(-10);
|
|
@@ -80427,7 +80503,7 @@ var init_platform_setup_x = __esm(() => {
|
|
|
80427
80503
|
|
|
80428
80504
|
// src/commands/content/phases/setup-wizard.ts
|
|
80429
80505
|
import { existsSync as existsSync89 } from "node:fs";
|
|
80430
|
-
import { join as
|
|
80506
|
+
import { join as join174 } from "node:path";
|
|
80431
80507
|
async function runSetupWizard2(cwd2, contentLogger) {
|
|
80432
80508
|
console.log();
|
|
80433
80509
|
oe(import_picocolors43.default.bgCyan(import_picocolors43.default.white(" CK Content — Multi-Channel Content Engine ")));
|
|
@@ -80495,8 +80571,8 @@ async function showRepoSummary(cwd2) {
|
|
|
80495
80571
|
function detectBrandAssets(cwd2, contentLogger) {
|
|
80496
80572
|
const repos = discoverRepos2(cwd2);
|
|
80497
80573
|
for (const repo of repos) {
|
|
80498
|
-
const hasGuidelines = existsSync89(
|
|
80499
|
-
const hasStyles = existsSync89(
|
|
80574
|
+
const hasGuidelines = existsSync89(join174(repo.path, "docs", "brand-guidelines.md"));
|
|
80575
|
+
const hasStyles = existsSync89(join174(repo.path, "assets", "writing-styles"));
|
|
80500
80576
|
if (!hasGuidelines) {
|
|
80501
80577
|
f2.warning(`${repo.name}: No docs/brand-guidelines.md — content will use generic tone.`);
|
|
80502
80578
|
contentLogger.warn(`${repo.name}: missing docs/brand-guidelines.md`);
|
|
@@ -80638,9 +80714,9 @@ __export(exports_content_subcommands, {
|
|
|
80638
80714
|
});
|
|
80639
80715
|
import { existsSync as existsSync91, readFileSync as readFileSync25, unlinkSync as unlinkSync6 } from "node:fs";
|
|
80640
80716
|
import { homedir as homedir58 } from "node:os";
|
|
80641
|
-
import { join as
|
|
80717
|
+
import { join as join175 } from "node:path";
|
|
80642
80718
|
function isDaemonRunning() {
|
|
80643
|
-
const lockFile =
|
|
80719
|
+
const lockFile = join175(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
80644
80720
|
if (!existsSync91(lockFile))
|
|
80645
80721
|
return { running: false, pid: null };
|
|
80646
80722
|
try {
|
|
@@ -80672,7 +80748,7 @@ async function startContent(options2) {
|
|
|
80672
80748
|
await contentCommand(options2);
|
|
80673
80749
|
}
|
|
80674
80750
|
async function stopContent() {
|
|
80675
|
-
const lockFile =
|
|
80751
|
+
const lockFile = join175(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
80676
80752
|
if (!existsSync91(lockFile)) {
|
|
80677
80753
|
logger.info("Content daemon is not running.");
|
|
80678
80754
|
return;
|
|
@@ -80711,9 +80787,9 @@ async function statusContent() {
|
|
|
80711
80787
|
} catch {}
|
|
80712
80788
|
}
|
|
80713
80789
|
async function logsContent(options2) {
|
|
80714
|
-
const logDir =
|
|
80790
|
+
const logDir = join175(homedir58(), ".claudekit", "logs");
|
|
80715
80791
|
const dateStr = new Date().toISOString().slice(0, 10).replace(/-/g, "");
|
|
80716
|
-
const logPath =
|
|
80792
|
+
const logPath = join175(logDir, `content-${dateStr}.log`);
|
|
80717
80793
|
if (!existsSync91(logPath)) {
|
|
80718
80794
|
logger.info("No content logs found for today.");
|
|
80719
80795
|
return;
|
|
@@ -80745,13 +80821,13 @@ var init_content_subcommands = __esm(() => {
|
|
|
80745
80821
|
init_setup_wizard();
|
|
80746
80822
|
init_state_manager();
|
|
80747
80823
|
init_content_review_commands();
|
|
80748
|
-
LOCK_DIR =
|
|
80824
|
+
LOCK_DIR = join175(homedir58(), ".claudekit", "locks");
|
|
80749
80825
|
});
|
|
80750
80826
|
|
|
80751
80827
|
// src/commands/content/content-command.ts
|
|
80752
80828
|
import { existsSync as existsSync92, mkdirSync as mkdirSync11, unlinkSync as unlinkSync7, writeFileSync as writeFileSync9 } from "node:fs";
|
|
80753
80829
|
import { homedir as homedir59 } from "node:os";
|
|
80754
|
-
import { join as
|
|
80830
|
+
import { join as join176 } from "node:path";
|
|
80755
80831
|
async function contentCommand(options2) {
|
|
80756
80832
|
const cwd2 = process.cwd();
|
|
80757
80833
|
const contentLogger = new ContentLogger;
|
|
@@ -80929,8 +81005,8 @@ var init_content_command = __esm(() => {
|
|
|
80929
81005
|
init_publisher();
|
|
80930
81006
|
init_review_manager();
|
|
80931
81007
|
init_state_manager();
|
|
80932
|
-
LOCK_DIR2 =
|
|
80933
|
-
LOCK_FILE =
|
|
81008
|
+
LOCK_DIR2 = join176(homedir59(), ".claudekit", "locks");
|
|
81009
|
+
LOCK_FILE = join176(LOCK_DIR2, "ck-content.lock");
|
|
80934
81010
|
});
|
|
80935
81011
|
|
|
80936
81012
|
// src/commands/content/index.ts
|
|
@@ -94174,7 +94250,7 @@ async function getLatestVersion(kit, includePrereleases = false) {
|
|
|
94174
94250
|
init_logger();
|
|
94175
94251
|
init_path_resolver();
|
|
94176
94252
|
init_safe_prompts();
|
|
94177
|
-
import { join as
|
|
94253
|
+
import { join as join97 } from "node:path";
|
|
94178
94254
|
async function promptUpdateMode() {
|
|
94179
94255
|
const updateEverything = await se({
|
|
94180
94256
|
message: "Do you want to update everything?"
|
|
@@ -94216,7 +94292,7 @@ async function promptDirectorySelection(global3 = false) {
|
|
|
94216
94292
|
return selectedCategories;
|
|
94217
94293
|
}
|
|
94218
94294
|
async function promptFreshConfirmation(targetPath, analysis) {
|
|
94219
|
-
const backupRoot =
|
|
94295
|
+
const backupRoot = join97(PathResolver.getConfigDir(false), "backups");
|
|
94220
94296
|
logger.warning("[!] Fresh installation will remove ClaudeKit files:");
|
|
94221
94297
|
logger.info(`Path: ${targetPath}`);
|
|
94222
94298
|
logger.info(`Recovery backup: ${backupRoot}`);
|
|
@@ -94386,12 +94462,12 @@ class PromptsManager {
|
|
|
94386
94462
|
}
|
|
94387
94463
|
async promptPackageInstallations() {
|
|
94388
94464
|
log.step("Optional Package Installations");
|
|
94389
|
-
const [openCodeInstalled,
|
|
94465
|
+
const [openCodeInstalled, agyInstalled] = await Promise.all([
|
|
94390
94466
|
isOpenCodeInstalled(),
|
|
94391
|
-
|
|
94467
|
+
isAgyInstalled()
|
|
94392
94468
|
]);
|
|
94393
94469
|
let installOpenCode2 = false;
|
|
94394
|
-
let
|
|
94470
|
+
let installAgy2 = false;
|
|
94395
94471
|
if (openCodeInstalled) {
|
|
94396
94472
|
logger.success("OpenCode CLI is already installed");
|
|
94397
94473
|
} else {
|
|
@@ -94403,20 +94479,20 @@ class PromptsManager {
|
|
|
94403
94479
|
}
|
|
94404
94480
|
installOpenCode2 = shouldInstallOpenCode;
|
|
94405
94481
|
}
|
|
94406
|
-
if (
|
|
94407
|
-
logger.success("
|
|
94482
|
+
if (agyInstalled) {
|
|
94483
|
+
logger.success("Antigravity CLI (agy) is already installed");
|
|
94408
94484
|
} else {
|
|
94409
|
-
const
|
|
94410
|
-
message: "Install
|
|
94485
|
+
const shouldInstallAgy = await se({
|
|
94486
|
+
message: "Install Antigravity CLI (agy) for AI-powered assistance? (Optional additional AI capabilities)"
|
|
94411
94487
|
});
|
|
94412
|
-
if (lD(
|
|
94488
|
+
if (lD(shouldInstallAgy)) {
|
|
94413
94489
|
throw new Error("Package installation cancelled");
|
|
94414
94490
|
}
|
|
94415
|
-
|
|
94491
|
+
installAgy2 = shouldInstallAgy;
|
|
94416
94492
|
}
|
|
94417
94493
|
return {
|
|
94418
94494
|
installOpenCode: installOpenCode2,
|
|
94419
|
-
|
|
94495
|
+
installAgy: installAgy2
|
|
94420
94496
|
};
|
|
94421
94497
|
}
|
|
94422
94498
|
async promptSkillsInstallation() {
|
|
@@ -94432,11 +94508,11 @@ class PromptsManager {
|
|
|
94432
94508
|
failedInstalls.push(`${results.opencode.package}: ${results.opencode.error || "Installation failed"}`);
|
|
94433
94509
|
}
|
|
94434
94510
|
}
|
|
94435
|
-
if (results.
|
|
94436
|
-
if (results.
|
|
94437
|
-
successfulInstalls.push(`${results.
|
|
94511
|
+
if (results.agy) {
|
|
94512
|
+
if (results.agy.success) {
|
|
94513
|
+
successfulInstalls.push(`${results.agy.package}${results.agy.version ? ` v${results.agy.version}` : ""}`);
|
|
94438
94514
|
} else {
|
|
94439
|
-
failedInstalls.push(`${results.
|
|
94515
|
+
failedInstalls.push(`${results.agy.package}: ${results.agy.error || "Installation failed"}`);
|
|
94440
94516
|
}
|
|
94441
94517
|
}
|
|
94442
94518
|
if (successfulInstalls.length > 0) {
|
|
@@ -94444,7 +94520,7 @@ class PromptsManager {
|
|
|
94444
94520
|
}
|
|
94445
94521
|
if (failedInstalls.length > 0) {
|
|
94446
94522
|
logger.warning(`Failed to install: ${failedInstalls.join(", ")}`);
|
|
94447
|
-
logger.info("You can install these manually later
|
|
94523
|
+
logger.info("You can install these manually later from each tool's official install guide.");
|
|
94448
94524
|
}
|
|
94449
94525
|
}
|
|
94450
94526
|
async promptFreshConfirmation(targetPath, analysis) {
|
|
@@ -94493,7 +94569,7 @@ init_logger();
|
|
|
94493
94569
|
init_logger();
|
|
94494
94570
|
init_path_resolver();
|
|
94495
94571
|
var import_fs_extra10 = __toESM(require_lib(), 1);
|
|
94496
|
-
import { join as
|
|
94572
|
+
import { join as join98 } from "node:path";
|
|
94497
94573
|
async function handleConflicts(ctx) {
|
|
94498
94574
|
if (ctx.cancelled)
|
|
94499
94575
|
return ctx;
|
|
@@ -94502,7 +94578,7 @@ async function handleConflicts(ctx) {
|
|
|
94502
94578
|
if (PathResolver.isLocalSameAsGlobal()) {
|
|
94503
94579
|
return ctx;
|
|
94504
94580
|
}
|
|
94505
|
-
const localSettingsPath =
|
|
94581
|
+
const localSettingsPath = join98(process.cwd(), ".claude", "settings.json");
|
|
94506
94582
|
if (!await import_fs_extra10.pathExists(localSettingsPath)) {
|
|
94507
94583
|
return ctx;
|
|
94508
94584
|
}
|
|
@@ -94517,7 +94593,7 @@ async function handleConflicts(ctx) {
|
|
|
94517
94593
|
return { ...ctx, cancelled: true };
|
|
94518
94594
|
}
|
|
94519
94595
|
if (choice === "remove") {
|
|
94520
|
-
const localClaudeDir =
|
|
94596
|
+
const localClaudeDir = join98(process.cwd(), ".claude");
|
|
94521
94597
|
try {
|
|
94522
94598
|
await import_fs_extra10.remove(localClaudeDir);
|
|
94523
94599
|
logger.success("Removed local .claude/ directory");
|
|
@@ -94614,7 +94690,7 @@ init_logger();
|
|
|
94614
94690
|
init_safe_spinner();
|
|
94615
94691
|
import { mkdir as mkdir30, stat as stat17 } from "node:fs/promises";
|
|
94616
94692
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
94617
|
-
import { join as
|
|
94693
|
+
import { join as join105 } from "node:path";
|
|
94618
94694
|
|
|
94619
94695
|
// src/shared/temp-cleanup.ts
|
|
94620
94696
|
init_logger();
|
|
@@ -94633,7 +94709,7 @@ init_logger();
|
|
|
94633
94709
|
init_output_manager();
|
|
94634
94710
|
import { createWriteStream as createWriteStream2, rmSync } from "node:fs";
|
|
94635
94711
|
import { mkdir as mkdir25 } from "node:fs/promises";
|
|
94636
|
-
import { join as
|
|
94712
|
+
import { join as join99 } from "node:path";
|
|
94637
94713
|
|
|
94638
94714
|
// src/shared/progress-bar.ts
|
|
94639
94715
|
init_output_manager();
|
|
@@ -94843,7 +94919,7 @@ var MAX_DOWNLOAD_SIZE = 500 * 1024 * 1024;
|
|
|
94843
94919
|
class FileDownloader {
|
|
94844
94920
|
async downloadAsset(asset, destDir) {
|
|
94845
94921
|
try {
|
|
94846
|
-
const destPath =
|
|
94922
|
+
const destPath = join99(destDir, asset.name);
|
|
94847
94923
|
await mkdir25(destDir, { recursive: true });
|
|
94848
94924
|
output.info(`Downloading ${asset.name} (${formatBytes2(asset.size)})...`);
|
|
94849
94925
|
logger.verbose("Download details", {
|
|
@@ -94928,7 +95004,7 @@ class FileDownloader {
|
|
|
94928
95004
|
}
|
|
94929
95005
|
async downloadFile(params) {
|
|
94930
95006
|
const { url, name, size, destDir, token } = params;
|
|
94931
|
-
const destPath =
|
|
95007
|
+
const destPath = join99(destDir, name);
|
|
94932
95008
|
await mkdir25(destDir, { recursive: true });
|
|
94933
95009
|
output.info(`Downloading ${name}${size ? ` (${formatBytes2(size)})` : ""}...`);
|
|
94934
95010
|
const headers = {};
|
|
@@ -95014,7 +95090,7 @@ init_logger();
|
|
|
95014
95090
|
init_types3();
|
|
95015
95091
|
import { constants as constants4 } from "node:fs";
|
|
95016
95092
|
import { access as access5, readdir as readdir23 } from "node:fs/promises";
|
|
95017
|
-
import { join as
|
|
95093
|
+
import { join as join100 } from "node:path";
|
|
95018
95094
|
async function pathExists11(path8) {
|
|
95019
95095
|
try {
|
|
95020
95096
|
await access5(path8, constants4.F_OK);
|
|
@@ -95033,7 +95109,7 @@ async function validateExtraction(extractDir) {
|
|
|
95033
95109
|
const criticalPaths = [".claude"];
|
|
95034
95110
|
const missingPaths = [];
|
|
95035
95111
|
for (const path8 of criticalPaths) {
|
|
95036
|
-
if (await pathExists11(
|
|
95112
|
+
if (await pathExists11(join100(extractDir, path8))) {
|
|
95037
95113
|
logger.debug(`Found: ${path8}`);
|
|
95038
95114
|
continue;
|
|
95039
95115
|
}
|
|
@@ -95043,7 +95119,7 @@ async function validateExtraction(extractDir) {
|
|
|
95043
95119
|
const guidancePaths = ["CLAUDE.md", ".claude/CLAUDE.md", ".claude/rules/CLAUDE.md"];
|
|
95044
95120
|
let guidancePath = null;
|
|
95045
95121
|
for (const path8 of guidancePaths) {
|
|
95046
|
-
if (await pathExists11(
|
|
95122
|
+
if (await pathExists11(join100(extractDir, path8))) {
|
|
95047
95123
|
guidancePath = path8;
|
|
95048
95124
|
break;
|
|
95049
95125
|
}
|
|
@@ -95068,7 +95144,7 @@ async function validateExtraction(extractDir) {
|
|
|
95068
95144
|
// src/domains/installation/extraction/tar-extractor.ts
|
|
95069
95145
|
init_logger();
|
|
95070
95146
|
import { copyFile as copyFile4, mkdir as mkdir28, readdir as readdir25, rm as rm11, stat as stat15 } from "node:fs/promises";
|
|
95071
|
-
import { join as
|
|
95147
|
+
import { join as join103 } from "node:path";
|
|
95072
95148
|
|
|
95073
95149
|
// node_modules/@isaacs/fs-minipass/dist/esm/index.js
|
|
95074
95150
|
import EE from "events";
|
|
@@ -100830,7 +100906,7 @@ var mkdirSync4 = (dir, opt) => {
|
|
|
100830
100906
|
};
|
|
100831
100907
|
|
|
100832
100908
|
// node_modules/tar/dist/esm/path-reservations.js
|
|
100833
|
-
import { join as
|
|
100909
|
+
import { join as join101 } from "node:path";
|
|
100834
100910
|
|
|
100835
100911
|
// node_modules/tar/dist/esm/normalize-unicode.js
|
|
100836
100912
|
var normalizeCache = Object.create(null);
|
|
@@ -100863,7 +100939,7 @@ var getDirs = (path13) => {
|
|
|
100863
100939
|
const dirs = path13.split("/").slice(0, -1).reduce((set, path14) => {
|
|
100864
100940
|
const s = set[set.length - 1];
|
|
100865
100941
|
if (s !== undefined) {
|
|
100866
|
-
path14 =
|
|
100942
|
+
path14 = join101(s, path14);
|
|
100867
100943
|
}
|
|
100868
100944
|
set.push(path14 || "/");
|
|
100869
100945
|
return set;
|
|
@@ -100877,7 +100953,7 @@ class PathReservations {
|
|
|
100877
100953
|
#running = new Set;
|
|
100878
100954
|
reserve(paths, fn) {
|
|
100879
100955
|
paths = isWindows4 ? ["win32 parallelization disabled"] : paths.map((p) => {
|
|
100880
|
-
return stripTrailingSlashes(
|
|
100956
|
+
return stripTrailingSlashes(join101(normalizeUnicode(p))).toLowerCase();
|
|
100881
100957
|
});
|
|
100882
100958
|
const dirs = new Set(paths.map((path13) => getDirs(path13)).reduce((a3, b3) => a3.concat(b3)));
|
|
100883
100959
|
this.#reservations.set(fn, { dirs, paths });
|
|
@@ -101937,7 +102013,7 @@ function decodeFilePath(path15) {
|
|
|
101937
102013
|
init_logger();
|
|
101938
102014
|
init_types3();
|
|
101939
102015
|
import { copyFile as copyFile3, lstat as lstat7, mkdir as mkdir27, readdir as readdir24 } from "node:fs/promises";
|
|
101940
|
-
import { join as
|
|
102016
|
+
import { join as join102, relative as relative20 } from "node:path";
|
|
101941
102017
|
async function withRetry(fn, retries = 3) {
|
|
101942
102018
|
for (let i = 0;i < retries; i++) {
|
|
101943
102019
|
try {
|
|
@@ -101959,8 +102035,8 @@ async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTrac
|
|
|
101959
102035
|
await mkdir27(destDir, { recursive: true });
|
|
101960
102036
|
const entries = await readdir24(sourceDir, { encoding: "utf8" });
|
|
101961
102037
|
for (const entry of entries) {
|
|
101962
|
-
const sourcePath =
|
|
101963
|
-
const destPath =
|
|
102038
|
+
const sourcePath = join102(sourceDir, entry);
|
|
102039
|
+
const destPath = join102(destDir, entry);
|
|
101964
102040
|
const relativePath = relative20(sourceDir, sourcePath);
|
|
101965
102041
|
if (!isPathSafe(destDir, destPath)) {
|
|
101966
102042
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -101987,8 +102063,8 @@ async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
|
101987
102063
|
await mkdir27(destDir, { recursive: true });
|
|
101988
102064
|
const entries = await readdir24(sourceDir, { encoding: "utf8" });
|
|
101989
102065
|
for (const entry of entries) {
|
|
101990
|
-
const sourcePath =
|
|
101991
|
-
const destPath =
|
|
102066
|
+
const sourcePath = join102(sourceDir, entry);
|
|
102067
|
+
const destPath = join102(destDir, entry);
|
|
101992
102068
|
const relativePath = relative20(sourceDir, sourcePath);
|
|
101993
102069
|
if (!isPathSafe(destDir, destPath)) {
|
|
101994
102070
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -102036,7 +102112,7 @@ class TarExtractor {
|
|
|
102036
102112
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
102037
102113
|
if (entries.length === 1) {
|
|
102038
102114
|
const rootEntry = entries[0];
|
|
102039
|
-
const rootPath =
|
|
102115
|
+
const rootPath = join103(tempExtractDir, rootEntry);
|
|
102040
102116
|
const rootStat = await stat15(rootPath);
|
|
102041
102117
|
if (rootStat.isDirectory()) {
|
|
102042
102118
|
const rootContents = await readdir25(rootPath, { encoding: "utf8" });
|
|
@@ -102052,7 +102128,7 @@ class TarExtractor {
|
|
|
102052
102128
|
}
|
|
102053
102129
|
} else {
|
|
102054
102130
|
await mkdir28(destDir, { recursive: true });
|
|
102055
|
-
await copyFile4(rootPath,
|
|
102131
|
+
await copyFile4(rootPath, join103(destDir, rootEntry));
|
|
102056
102132
|
}
|
|
102057
102133
|
} else {
|
|
102058
102134
|
logger.debug("Multiple root entries - moving all");
|
|
@@ -102074,7 +102150,7 @@ init_logger();
|
|
|
102074
102150
|
var import_extract_zip = __toESM(require_extract_zip(), 1);
|
|
102075
102151
|
import { execFile as execFile11 } from "node:child_process";
|
|
102076
102152
|
import { copyFile as copyFile5, mkdir as mkdir29, readdir as readdir26, rm as rm12, stat as stat16 } from "node:fs/promises";
|
|
102077
|
-
import { join as
|
|
102153
|
+
import { join as join104 } from "node:path";
|
|
102078
102154
|
import { promisify as promisify16 } from "node:util";
|
|
102079
102155
|
|
|
102080
102156
|
// src/domains/installation/extraction/native-zip-commands.ts
|
|
@@ -102166,7 +102242,7 @@ class ZipExtractor {
|
|
|
102166
102242
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
102167
102243
|
if (entries.length === 1) {
|
|
102168
102244
|
const rootEntry = entries[0];
|
|
102169
|
-
const rootPath =
|
|
102245
|
+
const rootPath = join104(tempExtractDir, rootEntry);
|
|
102170
102246
|
const rootStat = await stat16(rootPath);
|
|
102171
102247
|
if (rootStat.isDirectory()) {
|
|
102172
102248
|
const rootContents = await readdir26(rootPath, { encoding: "utf8" });
|
|
@@ -102182,7 +102258,7 @@ class ZipExtractor {
|
|
|
102182
102258
|
}
|
|
102183
102259
|
} else {
|
|
102184
102260
|
await mkdir29(destDir, { recursive: true });
|
|
102185
|
-
await copyFile5(rootPath,
|
|
102261
|
+
await copyFile5(rootPath, join104(destDir, rootEntry));
|
|
102186
102262
|
}
|
|
102187
102263
|
} else {
|
|
102188
102264
|
logger.debug("Multiple root entries - moving all");
|
|
@@ -102283,7 +102359,7 @@ class DownloadManager {
|
|
|
102283
102359
|
async createTempDir() {
|
|
102284
102360
|
const timestamp = Date.now();
|
|
102285
102361
|
const counter = DownloadManager.tempDirCounter++;
|
|
102286
|
-
const primaryTempDir =
|
|
102362
|
+
const primaryTempDir = join105(tmpdir4(), `claudekit-${timestamp}-${counter}`);
|
|
102287
102363
|
try {
|
|
102288
102364
|
await mkdir30(primaryTempDir, { recursive: true });
|
|
102289
102365
|
logger.debug(`Created temp directory: ${primaryTempDir}`);
|
|
@@ -102300,7 +102376,7 @@ Solutions:
|
|
|
102300
102376
|
2. Set HOME environment variable
|
|
102301
102377
|
3. Try running from a different directory`);
|
|
102302
102378
|
}
|
|
102303
|
-
const fallbackTempDir =
|
|
102379
|
+
const fallbackTempDir = join105(homeDir, ".claudekit", "tmp", `claudekit-${timestamp}-${counter}`);
|
|
102304
102380
|
try {
|
|
102305
102381
|
await mkdir30(fallbackTempDir, { recursive: true });
|
|
102306
102382
|
logger.debug(`Created temp directory (fallback): ${fallbackTempDir}`);
|
|
@@ -102760,20 +102836,20 @@ async function handleDownload(ctx) {
|
|
|
102760
102836
|
};
|
|
102761
102837
|
}
|
|
102762
102838
|
// src/commands/init/phases/merge-handler.ts
|
|
102763
|
-
import { join as
|
|
102839
|
+
import { join as join123 } from "node:path";
|
|
102764
102840
|
|
|
102765
102841
|
// src/domains/installation/deletion-handler.ts
|
|
102766
102842
|
import { existsSync as existsSync66, lstatSync as lstatSync3, readdirSync as readdirSync10, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
102767
|
-
import { dirname as dirname38, join as
|
|
102843
|
+
import { dirname as dirname38, join as join108, relative as relative21, resolve as resolve42, sep as sep12 } from "node:path";
|
|
102768
102844
|
|
|
102769
102845
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
102770
102846
|
init_metadata_migration();
|
|
102771
102847
|
init_logger();
|
|
102772
102848
|
init_types3();
|
|
102773
102849
|
var import_fs_extra11 = __toESM(require_lib(), 1);
|
|
102774
|
-
import { join as
|
|
102850
|
+
import { join as join107 } from "node:path";
|
|
102775
102851
|
async function readManifest(claudeDir3) {
|
|
102776
|
-
const metadataPath =
|
|
102852
|
+
const metadataPath = join107(claudeDir3, "metadata.json");
|
|
102777
102853
|
if (!await import_fs_extra11.pathExists(metadataPath)) {
|
|
102778
102854
|
return null;
|
|
102779
102855
|
}
|
|
@@ -102959,7 +103035,7 @@ function collectFilesRecursively(dir, baseDir) {
|
|
|
102959
103035
|
try {
|
|
102960
103036
|
const entries = readdirSync10(dir, { withFileTypes: true });
|
|
102961
103037
|
for (const entry of entries) {
|
|
102962
|
-
const fullPath =
|
|
103038
|
+
const fullPath = join108(dir, entry.name);
|
|
102963
103039
|
const relativePath = relative21(baseDir, fullPath);
|
|
102964
103040
|
if (entry.isDirectory()) {
|
|
102965
103041
|
results.push(...collectFilesRecursively(fullPath, baseDir));
|
|
@@ -103027,7 +103103,7 @@ function deletePath(fullPath, claudeDir3) {
|
|
|
103027
103103
|
}
|
|
103028
103104
|
}
|
|
103029
103105
|
async function updateMetadataAfterDeletion(claudeDir3, deletedPaths) {
|
|
103030
|
-
const metadataPath =
|
|
103106
|
+
const metadataPath = join108(claudeDir3, "metadata.json");
|
|
103031
103107
|
if (!await import_fs_extra12.pathExists(metadataPath)) {
|
|
103032
103108
|
return;
|
|
103033
103109
|
}
|
|
@@ -103082,7 +103158,7 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
|
|
|
103082
103158
|
const userMetadata = await readManifest(claudeDir3);
|
|
103083
103159
|
const result = { deletedPaths: [], preservedPaths: [], errors: [] };
|
|
103084
103160
|
for (const path16 of deletions) {
|
|
103085
|
-
const fullPath =
|
|
103161
|
+
const fullPath = join108(claudeDir3, path16);
|
|
103086
103162
|
const normalizedPath = resolve42(fullPath);
|
|
103087
103163
|
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
103088
103164
|
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep12}`)) {
|
|
@@ -103122,7 +103198,7 @@ init_logger();
|
|
|
103122
103198
|
init_types3();
|
|
103123
103199
|
var import_fs_extra16 = __toESM(require_lib(), 1);
|
|
103124
103200
|
var import_ignore3 = __toESM(require_ignore(), 1);
|
|
103125
|
-
import { dirname as dirname42, join as
|
|
103201
|
+
import { dirname as dirname42, join as join113, relative as relative24 } from "node:path";
|
|
103126
103202
|
|
|
103127
103203
|
// src/domains/installation/selective-merger.ts
|
|
103128
103204
|
import { stat as stat18 } from "node:fs/promises";
|
|
@@ -103298,7 +103374,7 @@ class SelectiveMerger {
|
|
|
103298
103374
|
|
|
103299
103375
|
// src/domains/installation/merger/deleted-skill-preservation.ts
|
|
103300
103376
|
init_metadata_migration();
|
|
103301
|
-
import { dirname as dirname39, join as
|
|
103377
|
+
import { dirname as dirname39, join as join109, relative as relative22 } from "node:path";
|
|
103302
103378
|
var import_fs_extra13 = __toESM(require_lib(), 1);
|
|
103303
103379
|
async function findIgnoredSkillDirectories({
|
|
103304
103380
|
files,
|
|
@@ -103326,7 +103402,7 @@ async function findIgnoredSkillDirectories({
|
|
|
103326
103402
|
return root ? [root] : [];
|
|
103327
103403
|
}));
|
|
103328
103404
|
for (const [metadataRoot, sourceRoot] of sourceSkillRoots) {
|
|
103329
|
-
const destSkillRoot =
|
|
103405
|
+
const destSkillRoot = join109(destDir, ...sourceRoot.split("/"));
|
|
103330
103406
|
const skillExists = await import_fs_extra13.pathExists(destSkillRoot);
|
|
103331
103407
|
if (existingIgnoredRoots.has(metadataRoot) || !skillExists && previouslyTrackedRoots.has(metadataRoot)) {
|
|
103332
103408
|
ignoredSkillDirectories.add(metadataRoot);
|
|
@@ -103376,7 +103452,7 @@ init_logger();
|
|
|
103376
103452
|
var import_fs_extra14 = __toESM(require_lib(), 1);
|
|
103377
103453
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
103378
103454
|
import { relative as relative23 } from "node:path";
|
|
103379
|
-
import { join as
|
|
103455
|
+
import { join as join110 } from "node:path";
|
|
103380
103456
|
|
|
103381
103457
|
// node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
103382
103458
|
var balanced = (a3, b3, str2) => {
|
|
@@ -104832,7 +104908,7 @@ class FileScanner {
|
|
|
104832
104908
|
const files = [];
|
|
104833
104909
|
const entries = await import_fs_extra14.readdir(dir, { encoding: "utf8" });
|
|
104834
104910
|
for (const entry of entries) {
|
|
104835
|
-
const fullPath =
|
|
104911
|
+
const fullPath = join110(dir, entry);
|
|
104836
104912
|
const relativePath = relative23(baseDir, fullPath);
|
|
104837
104913
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
104838
104914
|
const stats = await import_fs_extra14.lstat(fullPath);
|
|
@@ -104868,13 +104944,13 @@ class FileScanner {
|
|
|
104868
104944
|
// src/domains/installation/merger/settings-processor.ts
|
|
104869
104945
|
import { execSync as execSync5 } from "node:child_process";
|
|
104870
104946
|
import { homedir as homedir46 } from "node:os";
|
|
104871
|
-
import { dirname as dirname41, join as
|
|
104947
|
+
import { dirname as dirname41, join as join112 } from "node:path";
|
|
104872
104948
|
|
|
104873
104949
|
// src/domains/config/installed-settings-tracker.ts
|
|
104874
104950
|
init_shared();
|
|
104875
104951
|
import { existsSync as existsSync67 } from "node:fs";
|
|
104876
104952
|
import { mkdir as mkdir31, readFile as readFile52, writeFile as writeFile27 } from "node:fs/promises";
|
|
104877
|
-
import { dirname as dirname40, join as
|
|
104953
|
+
import { dirname as dirname40, join as join111 } from "node:path";
|
|
104878
104954
|
var CK_JSON_FILE = ".ck.json";
|
|
104879
104955
|
|
|
104880
104956
|
class InstalledSettingsTracker {
|
|
@@ -104888,9 +104964,9 @@ class InstalledSettingsTracker {
|
|
|
104888
104964
|
}
|
|
104889
104965
|
getCkJsonPath() {
|
|
104890
104966
|
if (this.isGlobal) {
|
|
104891
|
-
return
|
|
104967
|
+
return join111(this.projectDir, CK_JSON_FILE);
|
|
104892
104968
|
}
|
|
104893
|
-
return
|
|
104969
|
+
return join111(this.projectDir, ".claude", CK_JSON_FILE);
|
|
104894
104970
|
}
|
|
104895
104971
|
async loadInstalledSettings() {
|
|
104896
104972
|
const ckJsonPath = this.getCkJsonPath();
|
|
@@ -105158,10 +105234,10 @@ class SettingsProcessor {
|
|
|
105158
105234
|
};
|
|
105159
105235
|
try {
|
|
105160
105236
|
if (this.isGlobal) {
|
|
105161
|
-
await addFromConfig(
|
|
105237
|
+
await addFromConfig(join112(this.projectDir, ".ck.json"));
|
|
105162
105238
|
} else {
|
|
105163
|
-
await addFromConfig(
|
|
105164
|
-
await addFromConfig(
|
|
105239
|
+
await addFromConfig(join112(PathResolver.getGlobalKitDir(), ".ck.json"));
|
|
105240
|
+
await addFromConfig(join112(this.projectDir, ".claude", ".ck.json"));
|
|
105165
105241
|
}
|
|
105166
105242
|
} catch (error) {
|
|
105167
105243
|
logger.debug(`Failed to load .ck.json hook preferences: ${error instanceof Error ? error.message : "unknown"}`);
|
|
@@ -105548,7 +105624,7 @@ class SettingsProcessor {
|
|
|
105548
105624
|
return false;
|
|
105549
105625
|
}
|
|
105550
105626
|
const configuredGlobalDir = PathResolver.getGlobalKitDir().replace(/\\/g, "/").replace(/\/+$/, "");
|
|
105551
|
-
const defaultGlobalDir =
|
|
105627
|
+
const defaultGlobalDir = join112(homedir46(), ".claude").replace(/\\/g, "/");
|
|
105552
105628
|
return configuredGlobalDir !== defaultGlobalDir;
|
|
105553
105629
|
}
|
|
105554
105630
|
getClaudeCommandRoot() {
|
|
@@ -105568,7 +105644,7 @@ class SettingsProcessor {
|
|
|
105568
105644
|
return true;
|
|
105569
105645
|
}
|
|
105570
105646
|
async repairSiblingSettingsLocal(destFile) {
|
|
105571
|
-
const settingsLocalPath =
|
|
105647
|
+
const settingsLocalPath = join112(dirname41(destFile), "settings.local.json");
|
|
105572
105648
|
if (settingsLocalPath === destFile || !await import_fs_extra15.pathExists(settingsLocalPath)) {
|
|
105573
105649
|
return;
|
|
105574
105650
|
}
|
|
@@ -105665,7 +105741,7 @@ class SettingsProcessor {
|
|
|
105665
105741
|
}
|
|
105666
105742
|
}
|
|
105667
105743
|
async dynamicTeamHookHandlerExists(destFile, handler) {
|
|
105668
|
-
return import_fs_extra15.pathExists(
|
|
105744
|
+
return import_fs_extra15.pathExists(join112(dirname41(destFile), "hooks", handler));
|
|
105669
105745
|
}
|
|
105670
105746
|
removeDynamicTeamHookRegistrations(settings) {
|
|
105671
105747
|
let removed = 0;
|
|
@@ -105806,7 +105882,7 @@ class CopyExecutor {
|
|
|
105806
105882
|
for (const file of files) {
|
|
105807
105883
|
const relativePath = relative24(sourceDir, file);
|
|
105808
105884
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
105809
|
-
const destPath =
|
|
105885
|
+
const destPath = join113(destDir, relativePath);
|
|
105810
105886
|
if (await import_fs_extra16.pathExists(destPath)) {
|
|
105811
105887
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
105812
105888
|
logger.debug(`Security-sensitive file exists but won't be overwritten: ${normalizedRelativePath}`);
|
|
@@ -105830,7 +105906,7 @@ class CopyExecutor {
|
|
|
105830
105906
|
for (const file of files) {
|
|
105831
105907
|
const relativePath = relative24(sourceDir, file);
|
|
105832
105908
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
105833
|
-
const destPath =
|
|
105909
|
+
const destPath = join113(destDir, relativePath);
|
|
105834
105910
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
105835
105911
|
logger.debug(`Skipping security-sensitive file: ${normalizedRelativePath}`);
|
|
105836
105912
|
skippedCount++;
|
|
@@ -106042,15 +106118,15 @@ class FileMerger {
|
|
|
106042
106118
|
|
|
106043
106119
|
// src/domains/migration/legacy-migration.ts
|
|
106044
106120
|
import { readdir as readdir28, stat as stat19 } from "node:fs/promises";
|
|
106045
|
-
import { join as
|
|
106121
|
+
import { join as join117, relative as relative25 } from "node:path";
|
|
106046
106122
|
// src/services/file-operations/manifest/manifest-tracker.ts
|
|
106047
|
-
import { join as
|
|
106123
|
+
import { join as join116 } from "node:path";
|
|
106048
106124
|
|
|
106049
106125
|
// src/domains/migration/release-manifest.ts
|
|
106050
106126
|
init_logger();
|
|
106051
106127
|
init_zod();
|
|
106052
106128
|
var import_fs_extra17 = __toESM(require_lib(), 1);
|
|
106053
|
-
import { join as
|
|
106129
|
+
import { join as join114 } from "node:path";
|
|
106054
106130
|
var ReleaseManifestFileSchema = exports_external.object({
|
|
106055
106131
|
path: exports_external.string(),
|
|
106056
106132
|
checksum: exports_external.string().regex(/^[a-f0-9]{64}$/),
|
|
@@ -106065,7 +106141,7 @@ var ReleaseManifestSchema = exports_external.object({
|
|
|
106065
106141
|
|
|
106066
106142
|
class ReleaseManifestLoader {
|
|
106067
106143
|
static async load(extractDir) {
|
|
106068
|
-
const manifestPath =
|
|
106144
|
+
const manifestPath = join114(extractDir, "release-manifest.json");
|
|
106069
106145
|
try {
|
|
106070
106146
|
const content = await import_fs_extra17.readFile(manifestPath, "utf-8");
|
|
106071
106147
|
const parsed = JSON.parse(content);
|
|
@@ -106088,12 +106164,12 @@ init_p_limit();
|
|
|
106088
106164
|
|
|
106089
106165
|
// src/services/file-operations/manifest/manifest-updater.ts
|
|
106090
106166
|
init_metadata_migration();
|
|
106091
|
-
import { join as
|
|
106167
|
+
import { join as join115 } from "node:path";
|
|
106092
106168
|
init_logger();
|
|
106093
106169
|
init_types3();
|
|
106094
106170
|
var import_fs_extra18 = __toESM(require_lib(), 1);
|
|
106095
106171
|
async function writeManifest(claudeDir3, kitName, version, scope, kitType, trackedFiles, userConfigFiles, ignoredSkills = []) {
|
|
106096
|
-
const metadataPath =
|
|
106172
|
+
const metadataPath = join115(claudeDir3, "metadata.json");
|
|
106097
106173
|
const kit = kitType || (/\bmarketing\b/i.test(kitName) ? "marketing" : "engineer");
|
|
106098
106174
|
await import_fs_extra18.ensureFile(metadataPath);
|
|
106099
106175
|
let release = null;
|
|
@@ -106165,7 +106241,7 @@ function uniqueNormalizedSkillRoots(paths) {
|
|
|
106165
106241
|
}))).sort();
|
|
106166
106242
|
}
|
|
106167
106243
|
async function removeKitFromManifest(claudeDir3, kit, options2) {
|
|
106168
|
-
const metadataPath =
|
|
106244
|
+
const metadataPath = join115(claudeDir3, "metadata.json");
|
|
106169
106245
|
if (!await import_fs_extra18.pathExists(metadataPath))
|
|
106170
106246
|
return false;
|
|
106171
106247
|
let release = null;
|
|
@@ -106197,7 +106273,7 @@ async function removeKitFromManifest(claudeDir3, kit, options2) {
|
|
|
106197
106273
|
}
|
|
106198
106274
|
}
|
|
106199
106275
|
async function retainTrackedFilesInManifest(claudeDir3, retainedPaths, options2) {
|
|
106200
|
-
const metadataPath =
|
|
106276
|
+
const metadataPath = join115(claudeDir3, "metadata.json");
|
|
106201
106277
|
if (!await import_fs_extra18.pathExists(metadataPath))
|
|
106202
106278
|
return false;
|
|
106203
106279
|
const normalizedPaths = new Set(retainedPaths.map((path17) => path17.replace(/\\/g, "/")));
|
|
@@ -106378,7 +106454,7 @@ function buildFileTrackingList(options2) {
|
|
|
106378
106454
|
if (!isGlobal && !installedPath.startsWith(".claude/"))
|
|
106379
106455
|
continue;
|
|
106380
106456
|
const relativePath = isGlobal ? installedPath : installedPath.replace(/^\.claude\//, "");
|
|
106381
|
-
const filePath =
|
|
106457
|
+
const filePath = join116(claudeDir3, relativePath);
|
|
106382
106458
|
const manifestEntry = releaseManifest ? ReleaseManifestLoader.findFile(releaseManifest, installedPath) : null;
|
|
106383
106459
|
const ownership = manifestEntry ? "ck" : "user";
|
|
106384
106460
|
filesToTrack.push({
|
|
@@ -106489,7 +106565,7 @@ class LegacyMigration {
|
|
|
106489
106565
|
continue;
|
|
106490
106566
|
if (SKIP_DIRS_ALL.includes(entry))
|
|
106491
106567
|
continue;
|
|
106492
|
-
const fullPath =
|
|
106568
|
+
const fullPath = join117(dir, entry);
|
|
106493
106569
|
let stats;
|
|
106494
106570
|
try {
|
|
106495
106571
|
stats = await stat19(fullPath);
|
|
@@ -106599,7 +106675,7 @@ User-created files (sample):`);
|
|
|
106599
106675
|
];
|
|
106600
106676
|
if (filesToChecksum.length > 0) {
|
|
106601
106677
|
const checksumResults = await mapWithLimit(filesToChecksum, async ({ relativePath, ownership }) => {
|
|
106602
|
-
const fullPath =
|
|
106678
|
+
const fullPath = join117(claudeDir3, relativePath);
|
|
106603
106679
|
const checksum = await OwnershipChecker.calculateChecksum(fullPath);
|
|
106604
106680
|
return { relativePath, checksum, ownership };
|
|
106605
106681
|
}, getOptimalConcurrency());
|
|
@@ -106620,7 +106696,7 @@ User-created files (sample):`);
|
|
|
106620
106696
|
installedAt: new Date().toISOString(),
|
|
106621
106697
|
files: trackedFiles
|
|
106622
106698
|
};
|
|
106623
|
-
const metadataPath =
|
|
106699
|
+
const metadataPath = join117(claudeDir3, "metadata.json");
|
|
106624
106700
|
await import_fs_extra19.writeFile(metadataPath, JSON.stringify(updatedMetadata, null, 2));
|
|
106625
106701
|
logger.success(`Migration complete: tracked ${trackedFiles.length} files`);
|
|
106626
106702
|
return true;
|
|
@@ -106726,7 +106802,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
|
|
|
106726
106802
|
init_logger();
|
|
106727
106803
|
init_skip_directories();
|
|
106728
106804
|
var import_fs_extra20 = __toESM(require_lib(), 1);
|
|
106729
|
-
import { join as
|
|
106805
|
+
import { join as join118, relative as relative26, resolve as resolve43 } from "node:path";
|
|
106730
106806
|
|
|
106731
106807
|
class FileScanner2 {
|
|
106732
106808
|
static async getFiles(dirPath, relativeTo) {
|
|
@@ -106742,7 +106818,7 @@ class FileScanner2 {
|
|
|
106742
106818
|
logger.debug(`Skipping directory: ${entry}`);
|
|
106743
106819
|
continue;
|
|
106744
106820
|
}
|
|
106745
|
-
const fullPath =
|
|
106821
|
+
const fullPath = join118(dirPath, entry);
|
|
106746
106822
|
if (!FileScanner2.isSafePath(basePath, fullPath)) {
|
|
106747
106823
|
logger.warning(`Skipping potentially unsafe path: ${entry}`);
|
|
106748
106824
|
continue;
|
|
@@ -106777,8 +106853,8 @@ class FileScanner2 {
|
|
|
106777
106853
|
return files;
|
|
106778
106854
|
}
|
|
106779
106855
|
static async findCustomFiles(destDir, sourceDir, subPath) {
|
|
106780
|
-
const destSubDir =
|
|
106781
|
-
const sourceSubDir =
|
|
106856
|
+
const destSubDir = join118(destDir, subPath);
|
|
106857
|
+
const sourceSubDir = join118(sourceDir, subPath);
|
|
106782
106858
|
logger.debug(`findCustomFiles - destDir: ${destDir}`);
|
|
106783
106859
|
logger.debug(`findCustomFiles - sourceDir: ${sourceDir}`);
|
|
106784
106860
|
logger.debug(`findCustomFiles - subPath: "${subPath}"`);
|
|
@@ -106819,12 +106895,12 @@ class FileScanner2 {
|
|
|
106819
106895
|
init_logger();
|
|
106820
106896
|
var import_fs_extra21 = __toESM(require_lib(), 1);
|
|
106821
106897
|
import { lstat as lstat10, mkdir as mkdir32, readdir as readdir31, stat as stat20 } from "node:fs/promises";
|
|
106822
|
-
import { join as
|
|
106898
|
+
import { join as join120 } from "node:path";
|
|
106823
106899
|
|
|
106824
106900
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
106825
106901
|
init_logger();
|
|
106826
106902
|
import { readFile as readFile56, readdir as readdir30, writeFile as writeFile31 } from "node:fs/promises";
|
|
106827
|
-
import { join as
|
|
106903
|
+
import { join as join119 } from "node:path";
|
|
106828
106904
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
106829
106905
|
".md",
|
|
106830
106906
|
".txt",
|
|
@@ -106884,7 +106960,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
106884
106960
|
async function processDirectory(dir) {
|
|
106885
106961
|
const entries = await readdir30(dir, { withFileTypes: true });
|
|
106886
106962
|
for (const entry of entries) {
|
|
106887
|
-
const fullPath =
|
|
106963
|
+
const fullPath = join119(dir, entry.name);
|
|
106888
106964
|
if (entry.isDirectory()) {
|
|
106889
106965
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
106890
106966
|
continue;
|
|
@@ -106959,14 +107035,14 @@ function shouldApplyPrefix(options2) {
|
|
|
106959
107035
|
// src/services/transformers/commands-prefix/prefix-applier.ts
|
|
106960
107036
|
async function applyPrefix(extractDir) {
|
|
106961
107037
|
validatePath(extractDir, "extractDir");
|
|
106962
|
-
const commandsDir =
|
|
107038
|
+
const commandsDir = join120(extractDir, ".claude", "commands");
|
|
106963
107039
|
if (!await import_fs_extra21.pathExists(commandsDir)) {
|
|
106964
107040
|
logger.verbose("No commands directory found, skipping prefix application");
|
|
106965
107041
|
return;
|
|
106966
107042
|
}
|
|
106967
107043
|
logger.info("Applying /ck: prefix to slash commands...");
|
|
106968
|
-
const backupDir =
|
|
106969
|
-
const tempDir =
|
|
107044
|
+
const backupDir = join120(extractDir, ".commands-backup");
|
|
107045
|
+
const tempDir = join120(extractDir, ".commands-prefix-temp");
|
|
106970
107046
|
try {
|
|
106971
107047
|
const entries = await readdir31(commandsDir);
|
|
106972
107048
|
if (entries.length === 0) {
|
|
@@ -106974,7 +107050,7 @@ async function applyPrefix(extractDir) {
|
|
|
106974
107050
|
return;
|
|
106975
107051
|
}
|
|
106976
107052
|
if (entries.length === 1 && entries[0] === "ck") {
|
|
106977
|
-
const ckDir2 =
|
|
107053
|
+
const ckDir2 = join120(commandsDir, "ck");
|
|
106978
107054
|
const ckStat = await stat20(ckDir2);
|
|
106979
107055
|
if (ckStat.isDirectory()) {
|
|
106980
107056
|
logger.verbose("Commands already have /ck: prefix, skipping");
|
|
@@ -106984,17 +107060,17 @@ async function applyPrefix(extractDir) {
|
|
|
106984
107060
|
await import_fs_extra21.copy(commandsDir, backupDir);
|
|
106985
107061
|
logger.verbose("Created backup of commands directory");
|
|
106986
107062
|
await mkdir32(tempDir, { recursive: true });
|
|
106987
|
-
const ckDir =
|
|
107063
|
+
const ckDir = join120(tempDir, "ck");
|
|
106988
107064
|
await mkdir32(ckDir, { recursive: true });
|
|
106989
107065
|
let processedCount = 0;
|
|
106990
107066
|
for (const entry of entries) {
|
|
106991
|
-
const sourcePath =
|
|
107067
|
+
const sourcePath = join120(commandsDir, entry);
|
|
106992
107068
|
const stats = await lstat10(sourcePath);
|
|
106993
107069
|
if (stats.isSymbolicLink()) {
|
|
106994
107070
|
logger.warning(`Skipping symlink for security: ${entry}`);
|
|
106995
107071
|
continue;
|
|
106996
107072
|
}
|
|
106997
|
-
const destPath =
|
|
107073
|
+
const destPath = join120(ckDir, entry);
|
|
106998
107074
|
await import_fs_extra21.copy(sourcePath, destPath, {
|
|
106999
107075
|
overwrite: false,
|
|
107000
107076
|
errorOnExist: true
|
|
@@ -107012,7 +107088,7 @@ async function applyPrefix(extractDir) {
|
|
|
107012
107088
|
await import_fs_extra21.move(tempDir, commandsDir);
|
|
107013
107089
|
await import_fs_extra21.remove(backupDir);
|
|
107014
107090
|
logger.success("Successfully reorganized commands to /ck: prefix");
|
|
107015
|
-
const claudeDir3 =
|
|
107091
|
+
const claudeDir3 = join120(extractDir, ".claude");
|
|
107016
107092
|
logger.info("Transforming command references in file contents...");
|
|
107017
107093
|
const transformResult = await transformCommandReferences(claudeDir3, {
|
|
107018
107094
|
verbose: logger.isVerbose()
|
|
@@ -107050,20 +107126,20 @@ async function applyPrefix(extractDir) {
|
|
|
107050
107126
|
// src/services/transformers/commands-prefix/prefix-cleaner.ts
|
|
107051
107127
|
init_metadata_migration();
|
|
107052
107128
|
import { lstat as lstat12, readdir as readdir33 } from "node:fs/promises";
|
|
107053
|
-
import { join as
|
|
107129
|
+
import { join as join122 } from "node:path";
|
|
107054
107130
|
init_logger();
|
|
107055
107131
|
var import_fs_extra23 = __toESM(require_lib(), 1);
|
|
107056
107132
|
|
|
107057
107133
|
// src/services/transformers/commands-prefix/file-processor.ts
|
|
107058
107134
|
import { lstat as lstat11, readdir as readdir32 } from "node:fs/promises";
|
|
107059
|
-
import { join as
|
|
107135
|
+
import { join as join121 } from "node:path";
|
|
107060
107136
|
init_logger();
|
|
107061
107137
|
var import_fs_extra22 = __toESM(require_lib(), 1);
|
|
107062
107138
|
async function scanDirectoryFiles(dir) {
|
|
107063
107139
|
const files = [];
|
|
107064
107140
|
const entries = await readdir32(dir);
|
|
107065
107141
|
for (const entry of entries) {
|
|
107066
|
-
const fullPath =
|
|
107142
|
+
const fullPath = join121(dir, entry);
|
|
107067
107143
|
const stats = await lstat11(fullPath);
|
|
107068
107144
|
if (stats.isSymbolicLink()) {
|
|
107069
107145
|
continue;
|
|
@@ -107191,8 +107267,8 @@ function isDifferentKitDirectory(dirName, currentKit) {
|
|
|
107191
107267
|
async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
107192
107268
|
const { dryRun = false } = options2;
|
|
107193
107269
|
validatePath(targetDir, "targetDir");
|
|
107194
|
-
const claudeDir3 = isGlobal ? targetDir :
|
|
107195
|
-
const commandsDir =
|
|
107270
|
+
const claudeDir3 = isGlobal ? targetDir : join122(targetDir, ".claude");
|
|
107271
|
+
const commandsDir = join122(claudeDir3, "commands");
|
|
107196
107272
|
const accumulator = {
|
|
107197
107273
|
results: [],
|
|
107198
107274
|
deletedCount: 0,
|
|
@@ -107234,7 +107310,7 @@ async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
|
107234
107310
|
}
|
|
107235
107311
|
const metadataForChecks = options2.kitType ? createKitSpecificMetadata(metadata, options2.kitType) : metadata;
|
|
107236
107312
|
for (const entry of entries) {
|
|
107237
|
-
const entryPath =
|
|
107313
|
+
const entryPath = join122(commandsDir, entry);
|
|
107238
107314
|
const stats = await lstat12(entryPath);
|
|
107239
107315
|
if (stats.isSymbolicLink()) {
|
|
107240
107316
|
addSymlinkSkip(entry, accumulator);
|
|
@@ -107291,7 +107367,7 @@ async function handleMerge(ctx) {
|
|
|
107291
107367
|
let customClaudeFiles = [];
|
|
107292
107368
|
if (!ctx.options.fresh) {
|
|
107293
107369
|
logger.info("Scanning for custom .claude files...");
|
|
107294
|
-
const scanSourceDir = ctx.options.global ?
|
|
107370
|
+
const scanSourceDir = ctx.options.global ? join123(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
107295
107371
|
const scanTargetSubdir = ctx.options.global ? "" : ".claude";
|
|
107296
107372
|
customClaudeFiles = await FileScanner2.findCustomFiles(ctx.resolvedDir, scanSourceDir, scanTargetSubdir);
|
|
107297
107373
|
} else {
|
|
@@ -107330,7 +107406,7 @@ async function handleMerge(ctx) {
|
|
|
107330
107406
|
merger.setRestoreCkHooks(ctx.options.restoreCkHooks);
|
|
107331
107407
|
merger.setProjectDir(ctx.resolvedDir);
|
|
107332
107408
|
merger.setKitName(ctx.kit.name);
|
|
107333
|
-
merger.setZombiePrunerHookDir(
|
|
107409
|
+
merger.setZombiePrunerHookDir(join123(ctx.claudeDir, "hooks"));
|
|
107334
107410
|
if (ctx.kitType) {
|
|
107335
107411
|
merger.setMultiKitContext(ctx.claudeDir, ctx.kitType);
|
|
107336
107412
|
}
|
|
@@ -107359,8 +107435,8 @@ async function handleMerge(ctx) {
|
|
|
107359
107435
|
return { ...ctx, cancelled: true };
|
|
107360
107436
|
}
|
|
107361
107437
|
}
|
|
107362
|
-
const sourceDir = ctx.options.global ?
|
|
107363
|
-
const sourceMetadataPath = ctx.options.global ?
|
|
107438
|
+
const sourceDir = ctx.options.global ? join123(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
107439
|
+
const sourceMetadataPath = ctx.options.global ? join123(sourceDir, "metadata.json") : join123(sourceDir, ".claude", "metadata.json");
|
|
107364
107440
|
let sourceMetadata = null;
|
|
107365
107441
|
try {
|
|
107366
107442
|
if (await import_fs_extra24.pathExists(sourceMetadataPath)) {
|
|
@@ -107418,7 +107494,7 @@ async function handleMerge(ctx) {
|
|
|
107418
107494
|
};
|
|
107419
107495
|
}
|
|
107420
107496
|
// src/commands/init/phases/migration-handler.ts
|
|
107421
|
-
import { join as
|
|
107497
|
+
import { join as join131 } from "node:path";
|
|
107422
107498
|
|
|
107423
107499
|
// src/domains/skills/skills-detector.ts
|
|
107424
107500
|
init_logger();
|
|
@@ -107434,7 +107510,7 @@ init_types3();
|
|
|
107434
107510
|
var import_fs_extra25 = __toESM(require_lib(), 1);
|
|
107435
107511
|
import { createHash as createHash7 } from "node:crypto";
|
|
107436
107512
|
import { readFile as readFile58, readdir as readdir34, writeFile as writeFile32 } from "node:fs/promises";
|
|
107437
|
-
import { join as
|
|
107513
|
+
import { join as join124, relative as relative27 } from "node:path";
|
|
107438
107514
|
|
|
107439
107515
|
class SkillsManifestManager {
|
|
107440
107516
|
static MANIFEST_FILENAME = ".skills-manifest.json";
|
|
@@ -107456,12 +107532,12 @@ class SkillsManifestManager {
|
|
|
107456
107532
|
return manifest;
|
|
107457
107533
|
}
|
|
107458
107534
|
static async writeManifest(skillsDir2, manifest) {
|
|
107459
|
-
const manifestPath =
|
|
107535
|
+
const manifestPath = join124(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
107460
107536
|
await writeFile32(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
107461
107537
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
107462
107538
|
}
|
|
107463
107539
|
static async readManifest(skillsDir2) {
|
|
107464
|
-
const manifestPath =
|
|
107540
|
+
const manifestPath = join124(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
107465
107541
|
if (!await import_fs_extra25.pathExists(manifestPath)) {
|
|
107466
107542
|
logger.debug(`No manifest found at: ${manifestPath}`);
|
|
107467
107543
|
return null;
|
|
@@ -107484,7 +107560,7 @@ class SkillsManifestManager {
|
|
|
107484
107560
|
return "flat";
|
|
107485
107561
|
}
|
|
107486
107562
|
for (const dir of dirs.slice(0, 3)) {
|
|
107487
|
-
const dirPath =
|
|
107563
|
+
const dirPath = join124(skillsDir2, dir.name);
|
|
107488
107564
|
const subEntries = await readdir34(dirPath, { withFileTypes: true });
|
|
107489
107565
|
const hasSubdirs = subEntries.some((entry) => entry.isDirectory());
|
|
107490
107566
|
if (hasSubdirs) {
|
|
@@ -107503,7 +107579,7 @@ class SkillsManifestManager {
|
|
|
107503
107579
|
const entries = await readdir34(skillsDir2, { withFileTypes: true });
|
|
107504
107580
|
for (const entry of entries) {
|
|
107505
107581
|
if (entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith(".")) {
|
|
107506
|
-
const skillPath =
|
|
107582
|
+
const skillPath = join124(skillsDir2, entry.name);
|
|
107507
107583
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
107508
107584
|
skills.push({
|
|
107509
107585
|
name: entry.name,
|
|
@@ -107515,11 +107591,11 @@ class SkillsManifestManager {
|
|
|
107515
107591
|
const categories = await readdir34(skillsDir2, { withFileTypes: true });
|
|
107516
107592
|
for (const category of categories) {
|
|
107517
107593
|
if (category.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(category.name) && !category.name.startsWith(".")) {
|
|
107518
|
-
const categoryPath =
|
|
107594
|
+
const categoryPath = join124(skillsDir2, category.name);
|
|
107519
107595
|
const skillEntries = await readdir34(categoryPath, { withFileTypes: true });
|
|
107520
107596
|
for (const skillEntry of skillEntries) {
|
|
107521
107597
|
if (skillEntry.isDirectory() && !skillEntry.name.startsWith(".")) {
|
|
107522
|
-
const skillPath =
|
|
107598
|
+
const skillPath = join124(categoryPath, skillEntry.name);
|
|
107523
107599
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
107524
107600
|
skills.push({
|
|
107525
107601
|
name: skillEntry.name,
|
|
@@ -107549,7 +107625,7 @@ class SkillsManifestManager {
|
|
|
107549
107625
|
const files = [];
|
|
107550
107626
|
const entries = await readdir34(dirPath, { withFileTypes: true });
|
|
107551
107627
|
for (const entry of entries) {
|
|
107552
|
-
const fullPath =
|
|
107628
|
+
const fullPath = join124(dirPath, entry.name);
|
|
107553
107629
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name)) {
|
|
107554
107630
|
continue;
|
|
107555
107631
|
}
|
|
@@ -107671,7 +107747,7 @@ function getPathMapping(skillName, oldBasePath, newBasePath) {
|
|
|
107671
107747
|
// src/domains/skills/detection/script-detector.ts
|
|
107672
107748
|
var import_fs_extra26 = __toESM(require_lib(), 1);
|
|
107673
107749
|
import { readdir as readdir35 } from "node:fs/promises";
|
|
107674
|
-
import { join as
|
|
107750
|
+
import { join as join125 } from "node:path";
|
|
107675
107751
|
async function scanDirectory(skillsDir2) {
|
|
107676
107752
|
if (!await import_fs_extra26.pathExists(skillsDir2)) {
|
|
107677
107753
|
return ["flat", []];
|
|
@@ -107684,12 +107760,12 @@ async function scanDirectory(skillsDir2) {
|
|
|
107684
107760
|
let totalSkillLikeCount = 0;
|
|
107685
107761
|
const allSkills = [];
|
|
107686
107762
|
for (const dir of dirs) {
|
|
107687
|
-
const dirPath =
|
|
107763
|
+
const dirPath = join125(skillsDir2, dir.name);
|
|
107688
107764
|
const subEntries = await readdir35(dirPath, { withFileTypes: true });
|
|
107689
107765
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
107690
107766
|
if (subdirs.length > 0) {
|
|
107691
107767
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
107692
|
-
const subdirPath =
|
|
107768
|
+
const subdirPath = join125(dirPath, subdir.name);
|
|
107693
107769
|
const subdirFiles = await readdir35(subdirPath, { withFileTypes: true });
|
|
107694
107770
|
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"));
|
|
107695
107771
|
if (hasSkillMarker) {
|
|
@@ -107846,12 +107922,12 @@ class SkillsMigrationDetector {
|
|
|
107846
107922
|
// src/domains/skills/skills-migrator.ts
|
|
107847
107923
|
init_logger();
|
|
107848
107924
|
init_types3();
|
|
107849
|
-
import { join as
|
|
107925
|
+
import { join as join130 } from "node:path";
|
|
107850
107926
|
|
|
107851
107927
|
// src/domains/skills/migrator/migration-executor.ts
|
|
107852
107928
|
init_logger();
|
|
107853
107929
|
import { copyFile as copyFile6, mkdir as mkdir33, readdir as readdir36, rm as rm13 } from "node:fs/promises";
|
|
107854
|
-
import { join as
|
|
107930
|
+
import { join as join126 } from "node:path";
|
|
107855
107931
|
var import_fs_extra28 = __toESM(require_lib(), 1);
|
|
107856
107932
|
|
|
107857
107933
|
// src/domains/skills/skills-migration-prompts.ts
|
|
@@ -108016,8 +108092,8 @@ async function copySkillDirectory(sourceDir, destDir) {
|
|
|
108016
108092
|
await mkdir33(destDir, { recursive: true });
|
|
108017
108093
|
const entries = await readdir36(sourceDir, { withFileTypes: true });
|
|
108018
108094
|
for (const entry of entries) {
|
|
108019
|
-
const sourcePath =
|
|
108020
|
-
const destPath =
|
|
108095
|
+
const sourcePath = join126(sourceDir, entry.name);
|
|
108096
|
+
const destPath = join126(destDir, entry.name);
|
|
108021
108097
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
108022
108098
|
continue;
|
|
108023
108099
|
}
|
|
@@ -108032,7 +108108,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
108032
108108
|
const migrated = [];
|
|
108033
108109
|
const preserved = [];
|
|
108034
108110
|
const errors2 = [];
|
|
108035
|
-
const tempDir =
|
|
108111
|
+
const tempDir = join126(currentSkillsDir, "..", ".skills-migration-temp");
|
|
108036
108112
|
await mkdir33(tempDir, { recursive: true });
|
|
108037
108113
|
try {
|
|
108038
108114
|
for (const mapping of mappings) {
|
|
@@ -108053,9 +108129,9 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
108053
108129
|
}
|
|
108054
108130
|
}
|
|
108055
108131
|
const category = mapping.category;
|
|
108056
|
-
const targetPath = category ?
|
|
108132
|
+
const targetPath = category ? join126(tempDir, category, skillName) : join126(tempDir, skillName);
|
|
108057
108133
|
if (category) {
|
|
108058
|
-
await mkdir33(
|
|
108134
|
+
await mkdir33(join126(tempDir, category), { recursive: true });
|
|
108059
108135
|
}
|
|
108060
108136
|
await copySkillDirectory(currentSkillPath, targetPath);
|
|
108061
108137
|
migrated.push(skillName);
|
|
@@ -108122,7 +108198,7 @@ init_logger();
|
|
|
108122
108198
|
init_types3();
|
|
108123
108199
|
var import_fs_extra29 = __toESM(require_lib(), 1);
|
|
108124
108200
|
import { copyFile as copyFile7, mkdir as mkdir34, readdir as readdir37, rm as rm14, stat as stat21 } from "node:fs/promises";
|
|
108125
|
-
import { basename as basename27, join as
|
|
108201
|
+
import { basename as basename27, join as join127, normalize as normalize9 } from "node:path";
|
|
108126
108202
|
function validatePath2(path17, paramName) {
|
|
108127
108203
|
if (!path17 || typeof path17 !== "string") {
|
|
108128
108204
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -108148,7 +108224,7 @@ class SkillsBackupManager {
|
|
|
108148
108224
|
const timestamp = Date.now();
|
|
108149
108225
|
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
|
108150
108226
|
const backupDirName = `${SkillsBackupManager.BACKUP_PREFIX}${timestamp}-${randomSuffix}`;
|
|
108151
|
-
const backupDir = parentDir ?
|
|
108227
|
+
const backupDir = parentDir ? join127(parentDir, backupDirName) : join127(skillsDir2, "..", backupDirName);
|
|
108152
108228
|
logger.info(`Creating backup at: ${backupDir}`);
|
|
108153
108229
|
try {
|
|
108154
108230
|
await mkdir34(backupDir, { recursive: true });
|
|
@@ -108199,7 +108275,7 @@ class SkillsBackupManager {
|
|
|
108199
108275
|
}
|
|
108200
108276
|
try {
|
|
108201
108277
|
const entries = await readdir37(parentDir, { withFileTypes: true });
|
|
108202
|
-
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) =>
|
|
108278
|
+
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) => join127(parentDir, entry.name));
|
|
108203
108279
|
backups.sort().reverse();
|
|
108204
108280
|
return backups;
|
|
108205
108281
|
} catch (error) {
|
|
@@ -108227,8 +108303,8 @@ class SkillsBackupManager {
|
|
|
108227
108303
|
static async copyDirectory(sourceDir, destDir) {
|
|
108228
108304
|
const entries = await readdir37(sourceDir, { withFileTypes: true });
|
|
108229
108305
|
for (const entry of entries) {
|
|
108230
|
-
const sourcePath =
|
|
108231
|
-
const destPath =
|
|
108306
|
+
const sourcePath = join127(sourceDir, entry.name);
|
|
108307
|
+
const destPath = join127(destDir, entry.name);
|
|
108232
108308
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
108233
108309
|
continue;
|
|
108234
108310
|
}
|
|
@@ -108244,7 +108320,7 @@ class SkillsBackupManager {
|
|
|
108244
108320
|
let size = 0;
|
|
108245
108321
|
const entries = await readdir37(dirPath, { withFileTypes: true });
|
|
108246
108322
|
for (const entry of entries) {
|
|
108247
|
-
const fullPath =
|
|
108323
|
+
const fullPath = join127(dirPath, entry.name);
|
|
108248
108324
|
if (entry.isSymbolicLink()) {
|
|
108249
108325
|
continue;
|
|
108250
108326
|
}
|
|
@@ -108280,12 +108356,12 @@ init_skip_directories();
|
|
|
108280
108356
|
import { createHash as createHash8 } from "node:crypto";
|
|
108281
108357
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
108282
108358
|
import { readFile as readFile59, readdir as readdir38 } from "node:fs/promises";
|
|
108283
|
-
import { join as
|
|
108359
|
+
import { join as join128, relative as relative28 } from "node:path";
|
|
108284
108360
|
async function getAllFiles(dirPath) {
|
|
108285
108361
|
const files = [];
|
|
108286
108362
|
const entries = await readdir38(dirPath, { withFileTypes: true });
|
|
108287
108363
|
for (const entry of entries) {
|
|
108288
|
-
const fullPath =
|
|
108364
|
+
const fullPath = join128(dirPath, entry.name);
|
|
108289
108365
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name) || entry.isSymbolicLink()) {
|
|
108290
108366
|
continue;
|
|
108291
108367
|
}
|
|
@@ -108412,7 +108488,7 @@ async function detectFileChanges(currentSkillPath, baselineSkillPath) {
|
|
|
108412
108488
|
init_types3();
|
|
108413
108489
|
var import_fs_extra31 = __toESM(require_lib(), 1);
|
|
108414
108490
|
import { readdir as readdir39 } from "node:fs/promises";
|
|
108415
|
-
import { join as
|
|
108491
|
+
import { join as join129, normalize as normalize10 } from "node:path";
|
|
108416
108492
|
function validatePath3(path17, paramName) {
|
|
108417
108493
|
if (!path17 || typeof path17 !== "string") {
|
|
108418
108494
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -108433,13 +108509,13 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
108433
108509
|
if (dirs.length === 0) {
|
|
108434
108510
|
return ["flat", []];
|
|
108435
108511
|
}
|
|
108436
|
-
const firstDirPath =
|
|
108512
|
+
const firstDirPath = join129(skillsDir2, dirs[0].name);
|
|
108437
108513
|
const subEntries = await readdir39(firstDirPath, { withFileTypes: true });
|
|
108438
108514
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
108439
108515
|
if (subdirs.length > 0) {
|
|
108440
108516
|
let skillLikeCount = 0;
|
|
108441
108517
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
108442
|
-
const subdirPath =
|
|
108518
|
+
const subdirPath = join129(firstDirPath, subdir.name);
|
|
108443
108519
|
const subdirFiles = await readdir39(subdirPath, { withFileTypes: true });
|
|
108444
108520
|
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"));
|
|
108445
108521
|
if (hasSkillMarker) {
|
|
@@ -108449,7 +108525,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
108449
108525
|
if (skillLikeCount > 0) {
|
|
108450
108526
|
const skills = [];
|
|
108451
108527
|
for (const dir of dirs) {
|
|
108452
|
-
const categoryPath =
|
|
108528
|
+
const categoryPath = join129(skillsDir2, dir.name);
|
|
108453
108529
|
const skillDirs = await readdir39(categoryPath, { withFileTypes: true });
|
|
108454
108530
|
skills.push(...skillDirs.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name));
|
|
108455
108531
|
}
|
|
@@ -108459,7 +108535,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
108459
108535
|
return ["flat", dirs.map((dir) => dir.name)];
|
|
108460
108536
|
}
|
|
108461
108537
|
async function findSkillPath(skillsDir2, skillName) {
|
|
108462
|
-
const flatPath =
|
|
108538
|
+
const flatPath = join129(skillsDir2, skillName);
|
|
108463
108539
|
if (await import_fs_extra31.pathExists(flatPath)) {
|
|
108464
108540
|
return { path: flatPath, category: undefined };
|
|
108465
108541
|
}
|
|
@@ -108468,8 +108544,8 @@ async function findSkillPath(skillsDir2, skillName) {
|
|
|
108468
108544
|
if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
108469
108545
|
continue;
|
|
108470
108546
|
}
|
|
108471
|
-
const categoryPath =
|
|
108472
|
-
const skillPath =
|
|
108547
|
+
const categoryPath = join129(skillsDir2, entry.name);
|
|
108548
|
+
const skillPath = join129(categoryPath, skillName);
|
|
108473
108549
|
if (await import_fs_extra31.pathExists(skillPath)) {
|
|
108474
108550
|
return { path: skillPath, category: entry.name };
|
|
108475
108551
|
}
|
|
@@ -108563,7 +108639,7 @@ class SkillsMigrator {
|
|
|
108563
108639
|
}
|
|
108564
108640
|
}
|
|
108565
108641
|
if (options2.backup && !options2.dryRun) {
|
|
108566
|
-
const claudeDir3 =
|
|
108642
|
+
const claudeDir3 = join130(currentSkillsDir, "..");
|
|
108567
108643
|
result.backupPath = await SkillsBackupManager.createBackup(currentSkillsDir, claudeDir3);
|
|
108568
108644
|
logger.success(`Backup created at: ${result.backupPath}`);
|
|
108569
108645
|
}
|
|
@@ -108624,7 +108700,7 @@ async function handleMigration(ctx) {
|
|
|
108624
108700
|
logger.debug("Skipping skills migration (fresh installation)");
|
|
108625
108701
|
return ctx;
|
|
108626
108702
|
}
|
|
108627
|
-
const newSkillsDir =
|
|
108703
|
+
const newSkillsDir = join131(ctx.extractDir, ".claude", "skills");
|
|
108628
108704
|
const currentSkillsDir = PathResolver.buildSkillsPath(ctx.resolvedDir, ctx.options.global);
|
|
108629
108705
|
if (!await import_fs_extra32.pathExists(newSkillsDir) || !await import_fs_extra32.pathExists(currentSkillsDir)) {
|
|
108630
108706
|
return ctx;
|
|
@@ -108648,13 +108724,13 @@ async function handleMigration(ctx) {
|
|
|
108648
108724
|
}
|
|
108649
108725
|
// src/commands/init/phases/opencode-handler.ts
|
|
108650
108726
|
import { cp as cp4, readdir as readdir41, rm as rm15 } from "node:fs/promises";
|
|
108651
|
-
import { join as
|
|
108727
|
+
import { join as join133 } from "node:path";
|
|
108652
108728
|
|
|
108653
108729
|
// src/services/transformers/opencode-path-transformer.ts
|
|
108654
108730
|
init_logger();
|
|
108655
108731
|
import { readFile as readFile60, readdir as readdir40, writeFile as writeFile33 } from "node:fs/promises";
|
|
108656
108732
|
import { platform as platform15 } from "node:os";
|
|
108657
|
-
import { extname as extname6, join as
|
|
108733
|
+
import { extname as extname6, join as join132 } from "node:path";
|
|
108658
108734
|
var IS_WINDOWS2 = platform15() === "win32";
|
|
108659
108735
|
function getOpenCodeGlobalPath() {
|
|
108660
108736
|
return "$HOME/.config/opencode/";
|
|
@@ -108715,7 +108791,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
108715
108791
|
async function processDirectory2(dir) {
|
|
108716
108792
|
const entries = await readdir40(dir, { withFileTypes: true });
|
|
108717
108793
|
for (const entry of entries) {
|
|
108718
|
-
const fullPath =
|
|
108794
|
+
const fullPath = join132(dir, entry.name);
|
|
108719
108795
|
if (entry.isDirectory()) {
|
|
108720
108796
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
108721
108797
|
continue;
|
|
@@ -108754,7 +108830,7 @@ async function handleOpenCode(ctx) {
|
|
|
108754
108830
|
if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir) {
|
|
108755
108831
|
return ctx;
|
|
108756
108832
|
}
|
|
108757
|
-
const openCodeSource =
|
|
108833
|
+
const openCodeSource = join133(ctx.extractDir, ".opencode");
|
|
108758
108834
|
if (!await import_fs_extra33.pathExists(openCodeSource)) {
|
|
108759
108835
|
logger.debug("No .opencode directory in archive, skipping");
|
|
108760
108836
|
return ctx;
|
|
@@ -108772,8 +108848,8 @@ async function handleOpenCode(ctx) {
|
|
|
108772
108848
|
await import_fs_extra33.ensureDir(targetDir);
|
|
108773
108849
|
const entries = await readdir41(openCodeSource, { withFileTypes: true });
|
|
108774
108850
|
for (const entry of entries) {
|
|
108775
|
-
const sourcePath =
|
|
108776
|
-
const targetPath =
|
|
108851
|
+
const sourcePath = join133(openCodeSource, entry.name);
|
|
108852
|
+
const targetPath = join133(targetDir, entry.name);
|
|
108777
108853
|
if (await import_fs_extra33.pathExists(targetPath)) {
|
|
108778
108854
|
if (!ctx.options.forceOverwrite) {
|
|
108779
108855
|
logger.verbose(`Skipping existing: ${entry.name}`);
|
|
@@ -108872,7 +108948,7 @@ Please use only one download method.`);
|
|
|
108872
108948
|
}
|
|
108873
108949
|
// src/commands/init/phases/post-install-handler.ts
|
|
108874
108950
|
init_projects_registry();
|
|
108875
|
-
import { join as
|
|
108951
|
+
import { join as join134 } from "node:path";
|
|
108876
108952
|
init_logger();
|
|
108877
108953
|
init_path_resolver();
|
|
108878
108954
|
var import_fs_extra34 = __toESM(require_lib(), 1);
|
|
@@ -108881,8 +108957,8 @@ async function handlePostInstall(ctx) {
|
|
|
108881
108957
|
return ctx;
|
|
108882
108958
|
}
|
|
108883
108959
|
if (ctx.options.global) {
|
|
108884
|
-
const claudeMdSource =
|
|
108885
|
-
const claudeMdDest =
|
|
108960
|
+
const claudeMdSource = join134(ctx.extractDir, "CLAUDE.md");
|
|
108961
|
+
const claudeMdDest = join134(ctx.resolvedDir, "CLAUDE.md");
|
|
108886
108962
|
if (await import_fs_extra34.pathExists(claudeMdSource)) {
|
|
108887
108963
|
if (ctx.options.fresh || !await import_fs_extra34.pathExists(claudeMdDest)) {
|
|
108888
108964
|
await import_fs_extra34.copy(claudeMdSource, claudeMdDest);
|
|
@@ -108905,24 +108981,24 @@ async function handlePostInstall(ctx) {
|
|
|
108905
108981
|
});
|
|
108906
108982
|
}
|
|
108907
108983
|
if (!ctx.isNonInteractive) {
|
|
108908
|
-
const {
|
|
108909
|
-
const {
|
|
108910
|
-
const
|
|
108911
|
-
const existingConfig =
|
|
108984
|
+
const { isAgyInstalled: isAgyInstalled2 } = await Promise.resolve().then(() => (init_package_installer(), exports_package_installer));
|
|
108985
|
+
const { checkExistingAgyConfig: checkExistingAgyConfig2, findMcpConfigPath: findMcpConfigPath2, processAgyMcpLinking: processAgyMcpLinking2 } = await Promise.resolve().then(() => (init_agy_mcp_linker(), exports_agy_mcp_linker));
|
|
108986
|
+
const agyInstalled = await isAgyInstalled2();
|
|
108987
|
+
const existingConfig = checkExistingAgyConfig2(ctx.resolvedDir, ctx.options.global);
|
|
108912
108988
|
const mcpConfigPath = findMcpConfigPath2(ctx.resolvedDir);
|
|
108913
108989
|
const mcpConfigExists = mcpConfigPath !== null;
|
|
108914
|
-
if (
|
|
108915
|
-
const
|
|
108990
|
+
if (agyInstalled && !existingConfig.exists && mcpConfigExists) {
|
|
108991
|
+
const agyPath = ctx.options.global ? "~/.gemini/config/mcp_config.json" : ".agents/mcp_config.json";
|
|
108916
108992
|
const mcpPath = ctx.options.global ? "~/.claude/.mcp.json" : ".mcp.json";
|
|
108917
108993
|
const promptMessage = [
|
|
108918
|
-
"
|
|
108919
|
-
` → Creates ${
|
|
108920
|
-
" →
|
|
108994
|
+
"Antigravity CLI (agy) detected. Set up MCP integration?",
|
|
108995
|
+
` → Creates ${agyPath} symlink to ${mcpPath}`,
|
|
108996
|
+
" → agy will share MCP servers with Claude Code"
|
|
108921
108997
|
].join(`
|
|
108922
108998
|
`);
|
|
108923
|
-
const
|
|
108924
|
-
if (
|
|
108925
|
-
await
|
|
108999
|
+
const shouldSetupAgy = await ctx.prompts.confirm(promptMessage);
|
|
109000
|
+
if (shouldSetupAgy) {
|
|
109001
|
+
await processAgyMcpLinking2(ctx.resolvedDir, {
|
|
108926
109002
|
isGlobal: ctx.options.global
|
|
108927
109003
|
});
|
|
108928
109004
|
}
|
|
@@ -108930,7 +109006,7 @@ async function handlePostInstall(ctx) {
|
|
|
108930
109006
|
}
|
|
108931
109007
|
if (!ctx.options.skipSetup) {
|
|
108932
109008
|
await promptSetupWizardIfNeeded({
|
|
108933
|
-
envPath:
|
|
109009
|
+
envPath: join134(ctx.claudeDir, ".env"),
|
|
108934
109010
|
claudeDir: ctx.claudeDir,
|
|
108935
109011
|
isGlobal: ctx.options.global,
|
|
108936
109012
|
isNonInteractive: ctx.isNonInteractive,
|
|
@@ -108953,12 +109029,12 @@ async function handlePostInstall(ctx) {
|
|
|
108953
109029
|
// src/commands/init/phases/plugin-install-handler.ts
|
|
108954
109030
|
init_codex_plugin_installer();
|
|
108955
109031
|
import { cpSync as cpSync2, existsSync as existsSync69, mkdirSync as mkdirSync6, readFileSync as readFileSync21, rmSync as rmSync4, writeFileSync as writeFileSync8 } from "node:fs";
|
|
108956
|
-
import { join as
|
|
109032
|
+
import { join as join136 } from "node:path";
|
|
108957
109033
|
|
|
108958
109034
|
// src/domains/installation/plugin/migrate-legacy-to-plugin.ts
|
|
108959
109035
|
init_install_mode_detector();
|
|
108960
109036
|
import { cpSync, existsSync as existsSync68, mkdirSync as mkdirSync5, readFileSync as readFileSync20, rmSync as rmSync3, writeFileSync as writeFileSync7 } from "node:fs";
|
|
108961
|
-
import { dirname as dirname43, join as
|
|
109037
|
+
import { dirname as dirname43, join as join135 } from "node:path";
|
|
108962
109038
|
|
|
108963
109039
|
// src/domains/installation/plugin/plugin-installer.ts
|
|
108964
109040
|
init_install_mode_detector();
|
|
@@ -109090,7 +109166,7 @@ async function migrateLegacyToPlugin(opts) {
|
|
|
109090
109166
|
let backupDir = null;
|
|
109091
109167
|
let removedPaths = [];
|
|
109092
109168
|
if (before.legacy.installed) {
|
|
109093
|
-
backupDir =
|
|
109169
|
+
backupDir = join135(claudeDir3, "backups", `ck-legacy-${ts.replace(/[:.]/g, "-")}`);
|
|
109094
109170
|
mkdirSync5(backupDir, { recursive: true });
|
|
109095
109171
|
removedPaths = removeLegacy(claudeDir3, backupDir);
|
|
109096
109172
|
}
|
|
@@ -109124,7 +109200,7 @@ function base(action, modeBefore, pluginVerified) {
|
|
|
109124
109200
|
}
|
|
109125
109201
|
var PLUGIN_SUPPLIED_LEGACY_PREFIXES2 = ["agents/", "skills/"];
|
|
109126
109202
|
function defaultLegacyRemover(claudeDir3, backupDir) {
|
|
109127
|
-
const meta = readJsonSafe2(
|
|
109203
|
+
const meta = readJsonSafe2(join135(claudeDir3, "metadata.json"));
|
|
109128
109204
|
const files = collectTrackedFiles2(meta);
|
|
109129
109205
|
const removed = [];
|
|
109130
109206
|
for (const file of files) {
|
|
@@ -109132,10 +109208,10 @@ function defaultLegacyRemover(claudeDir3, backupDir) {
|
|
|
109132
109208
|
continue;
|
|
109133
109209
|
if (!isPluginSuppliedLegacyPath(file.path))
|
|
109134
109210
|
continue;
|
|
109135
|
-
const abs =
|
|
109211
|
+
const abs = join135(claudeDir3, file.path);
|
|
109136
109212
|
if (!existsSync68(abs))
|
|
109137
109213
|
continue;
|
|
109138
|
-
const backupTarget =
|
|
109214
|
+
const backupTarget = join135(backupDir, file.path);
|
|
109139
109215
|
mkdirSync5(dirname43(backupTarget), { recursive: true });
|
|
109140
109216
|
cpSync(abs, backupTarget, { recursive: true });
|
|
109141
109217
|
rmSync3(abs, { recursive: true, force: true });
|
|
@@ -109171,7 +109247,7 @@ function collectTrackedFiles2(meta) {
|
|
|
109171
109247
|
return out;
|
|
109172
109248
|
}
|
|
109173
109249
|
function writeReceipt(claudeDir3, receipt) {
|
|
109174
|
-
const receiptPath =
|
|
109250
|
+
const receiptPath = join135(claudeDir3, ".ck-migration-log.json");
|
|
109175
109251
|
const existing = readJsonSafe2(receiptPath);
|
|
109176
109252
|
const history = Array.isArray(existing) ? existing : [];
|
|
109177
109253
|
history.push(receipt);
|
|
@@ -109220,14 +109296,14 @@ async function handlePluginInstall(ctx, deps = {}) {
|
|
|
109220
109296
|
return ctx;
|
|
109221
109297
|
}
|
|
109222
109298
|
function stagePluginSource(extractDir, stageBaseDir) {
|
|
109223
|
-
const base2 = stageBaseDir ??
|
|
109224
|
-
const payloadSrc =
|
|
109299
|
+
const base2 = stageBaseDir ?? join136(PathResolver.getCacheDir(true), "ck-plugin-source");
|
|
109300
|
+
const payloadSrc = join136(extractDir, ".claude");
|
|
109225
109301
|
if (!existsSync69(payloadSrc)) {
|
|
109226
109302
|
throw new Error(`plugin payload not found in archive: ${payloadSrc}`);
|
|
109227
109303
|
}
|
|
109228
109304
|
rmSync4(base2, { recursive: true, force: true });
|
|
109229
109305
|
mkdirSync6(base2, { recursive: true });
|
|
109230
|
-
const stagedPayload =
|
|
109306
|
+
const stagedPayload = join136(base2, ".claude");
|
|
109231
109307
|
cpSync2(payloadSrc, stagedPayload, { recursive: true });
|
|
109232
109308
|
ensureCodexPluginManifest(stagedPayload);
|
|
109233
109309
|
const claudeMarketplace = {
|
|
@@ -109235,8 +109311,8 @@ function stagePluginSource(extractDir, stageBaseDir) {
|
|
|
109235
109311
|
owner: { name: "ClaudeKit" },
|
|
109236
109312
|
plugins: [{ name: "ck", source: "./.claude", description: "ClaudeKit Engineer" }]
|
|
109237
109313
|
};
|
|
109238
|
-
mkdirSync6(
|
|
109239
|
-
writeFileSync8(
|
|
109314
|
+
mkdirSync6(join136(base2, ".claude-plugin"), { recursive: true });
|
|
109315
|
+
writeFileSync8(join136(base2, ".claude-plugin", "marketplace.json"), `${JSON.stringify(claudeMarketplace, null, 2)}
|
|
109240
109316
|
`, "utf-8");
|
|
109241
109317
|
const codexMarketplace = {
|
|
109242
109318
|
name: "claudekit",
|
|
@@ -109250,16 +109326,16 @@ function stagePluginSource(extractDir, stageBaseDir) {
|
|
|
109250
109326
|
}
|
|
109251
109327
|
]
|
|
109252
109328
|
};
|
|
109253
|
-
mkdirSync6(
|
|
109254
|
-
writeFileSync8(
|
|
109329
|
+
mkdirSync6(join136(base2, ".agents", "plugins"), { recursive: true });
|
|
109330
|
+
writeFileSync8(join136(base2, ".agents", "plugins", "marketplace.json"), `${JSON.stringify(codexMarketplace, null, 2)}
|
|
109255
109331
|
`, "utf-8");
|
|
109256
109332
|
return base2;
|
|
109257
109333
|
}
|
|
109258
109334
|
function ensureCodexPluginManifest(pluginRoot) {
|
|
109259
|
-
const manifestPath =
|
|
109335
|
+
const manifestPath = join136(pluginRoot, ".codex-plugin", "plugin.json");
|
|
109260
109336
|
if (existsSync69(manifestPath))
|
|
109261
109337
|
return;
|
|
109262
|
-
const claudeManifest = readJsonSafe3(
|
|
109338
|
+
const claudeManifest = readJsonSafe3(join136(pluginRoot, ".claude-plugin", "plugin.json"));
|
|
109263
109339
|
const manifest = pruneUndefined({
|
|
109264
109340
|
name: stringField(claudeManifest, "name") ?? "ck",
|
|
109265
109341
|
version: stringField(claudeManifest, "version") ?? "0.0.0",
|
|
@@ -109280,7 +109356,7 @@ function ensureCodexPluginManifest(pluginRoot) {
|
|
|
109280
109356
|
websiteURL: "https://github.com/claudekit/claudekit-engineer"
|
|
109281
109357
|
}
|
|
109282
109358
|
});
|
|
109283
|
-
mkdirSync6(
|
|
109359
|
+
mkdirSync6(join136(pluginRoot, ".codex-plugin"), { recursive: true });
|
|
109284
109360
|
writeFileSync8(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
109285
109361
|
`, "utf-8");
|
|
109286
109362
|
}
|
|
@@ -109345,7 +109421,7 @@ function logCodexPluginResult(result) {
|
|
|
109345
109421
|
init_config_manager();
|
|
109346
109422
|
init_github_client();
|
|
109347
109423
|
import { mkdir as mkdir36 } from "node:fs/promises";
|
|
109348
|
-
import { join as
|
|
109424
|
+
import { join as join139, resolve as resolve46 } from "node:path";
|
|
109349
109425
|
|
|
109350
109426
|
// src/domains/github/kit-access-checker.ts
|
|
109351
109427
|
init_error2();
|
|
@@ -109518,7 +109594,7 @@ init_hook_health_checker();
|
|
|
109518
109594
|
// src/domains/installation/fresh-installer.ts
|
|
109519
109595
|
init_metadata_migration();
|
|
109520
109596
|
import { existsSync as existsSync70, readdirSync as readdirSync11, rmSync as rmSync5, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
|
|
109521
|
-
import { basename as basename28, dirname as dirname44, join as
|
|
109597
|
+
import { basename as basename28, dirname as dirname44, join as join137, resolve as resolve44 } from "node:path";
|
|
109522
109598
|
init_logger();
|
|
109523
109599
|
init_safe_spinner();
|
|
109524
109600
|
var import_fs_extra35 = __toESM(require_lib(), 1);
|
|
@@ -109600,7 +109676,7 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
|
|
|
109600
109676
|
logger.debug(`${KIT_MANIFEST_FILE} was self-tracked; skipping from delete loop — will be rewritten by updateMetadataAfterFresh`);
|
|
109601
109677
|
}
|
|
109602
109678
|
for (const file of filesToRemove) {
|
|
109603
|
-
const fullPath =
|
|
109679
|
+
const fullPath = join137(claudeDir3, file.path);
|
|
109604
109680
|
if (!existsSync70(fullPath)) {
|
|
109605
109681
|
continue;
|
|
109606
109682
|
}
|
|
@@ -109628,7 +109704,7 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
|
|
|
109628
109704
|
};
|
|
109629
109705
|
}
|
|
109630
109706
|
async function updateMetadataAfterFresh(claudeDir3, removedFiles, metadata) {
|
|
109631
|
-
const metadataPath =
|
|
109707
|
+
const metadataPath = join137(claudeDir3, KIT_MANIFEST_FILE);
|
|
109632
109708
|
const removedSet = new Set(removedFiles);
|
|
109633
109709
|
if (metadata.kits) {
|
|
109634
109710
|
for (const kitName of Object.keys(metadata.kits)) {
|
|
@@ -109659,8 +109735,8 @@ function getFreshBackupTargets(claudeDir3, analysis, includeModified) {
|
|
|
109659
109735
|
mutatePaths: filesToRemove.length > 0 ? ["metadata.json"] : []
|
|
109660
109736
|
};
|
|
109661
109737
|
}
|
|
109662
|
-
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync70(
|
|
109663
|
-
if (existsSync70(
|
|
109738
|
+
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync70(join137(claudeDir3, subdir)));
|
|
109739
|
+
if (existsSync70(join137(claudeDir3, "metadata.json"))) {
|
|
109664
109740
|
deletePaths.push("metadata.json");
|
|
109665
109741
|
}
|
|
109666
109742
|
return {
|
|
@@ -109682,7 +109758,7 @@ async function removeSubdirectoriesFallback(claudeDir3) {
|
|
|
109682
109758
|
const removedFiles = [];
|
|
109683
109759
|
let removedDirCount = 0;
|
|
109684
109760
|
for (const subdir of CLAUDEKIT_SUBDIRECTORIES) {
|
|
109685
|
-
const subdirPath =
|
|
109761
|
+
const subdirPath = join137(claudeDir3, subdir);
|
|
109686
109762
|
if (await import_fs_extra35.pathExists(subdirPath)) {
|
|
109687
109763
|
rmSync5(subdirPath, { recursive: true, force: true });
|
|
109688
109764
|
removedDirCount++;
|
|
@@ -109690,7 +109766,7 @@ async function removeSubdirectoriesFallback(claudeDir3) {
|
|
|
109690
109766
|
logger.debug(`Removed subdirectory: ${subdir}/`);
|
|
109691
109767
|
}
|
|
109692
109768
|
}
|
|
109693
|
-
const metadataPath =
|
|
109769
|
+
const metadataPath = join137(claudeDir3, "metadata.json");
|
|
109694
109770
|
if (await import_fs_extra35.pathExists(metadataPath)) {
|
|
109695
109771
|
unlinkSync5(metadataPath);
|
|
109696
109772
|
removedFiles.push("metadata.json");
|
|
@@ -109768,7 +109844,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
|
|
|
109768
109844
|
var import_fs_extra36 = __toESM(require_lib(), 1);
|
|
109769
109845
|
import { cp as cp5, mkdir as mkdir35, readdir as readdir42, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
|
|
109770
109846
|
import { homedir as homedir47 } from "node:os";
|
|
109771
|
-
import { dirname as dirname45, join as
|
|
109847
|
+
import { dirname as dirname45, join as join138, normalize as normalize11, resolve as resolve45 } from "node:path";
|
|
109772
109848
|
var LEGACY_KIT_MARKERS = [
|
|
109773
109849
|
"metadata.json",
|
|
109774
109850
|
".ck.json",
|
|
@@ -109807,10 +109883,10 @@ function getLegacyWindowsGlobalKitDirCandidates(env2 = process.env, homeDir = ho
|
|
|
109807
109883
|
const localAppData = safeEnvPath(env2.LOCALAPPDATA);
|
|
109808
109884
|
const appData = safeEnvPath(env2.APPDATA);
|
|
109809
109885
|
if (localAppData) {
|
|
109810
|
-
candidates.push(
|
|
109886
|
+
candidates.push(join138(localAppData, ".claude"));
|
|
109811
109887
|
}
|
|
109812
109888
|
if (appData) {
|
|
109813
|
-
candidates.push(
|
|
109889
|
+
candidates.push(join138(appData, ".claude"));
|
|
109814
109890
|
}
|
|
109815
109891
|
if (homeDir) {
|
|
109816
109892
|
candidates.push(`${withoutTrailingSeparators(homeDir)}.claude`);
|
|
@@ -109828,7 +109904,7 @@ async function hasKitMarkers(dir) {
|
|
|
109828
109904
|
if (!await isDirectory(dir))
|
|
109829
109905
|
return false;
|
|
109830
109906
|
for (const marker of LEGACY_KIT_MARKERS) {
|
|
109831
|
-
if (await import_fs_extra36.pathExists(
|
|
109907
|
+
if (await import_fs_extra36.pathExists(join138(dir, marker))) {
|
|
109832
109908
|
return true;
|
|
109833
109909
|
}
|
|
109834
109910
|
}
|
|
@@ -110130,7 +110206,7 @@ async function handleSelection(ctx) {
|
|
|
110130
110206
|
}
|
|
110131
110207
|
if (!ctx.options.fresh) {
|
|
110132
110208
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
110133
|
-
const claudeDir3 = prefix ?
|
|
110209
|
+
const claudeDir3 = prefix ? join139(resolvedDir, prefix) : resolvedDir;
|
|
110134
110210
|
try {
|
|
110135
110211
|
const existingMetadata = await readManifest(claudeDir3);
|
|
110136
110212
|
if (existingMetadata?.kits) {
|
|
@@ -110167,7 +110243,7 @@ async function handleSelection(ctx) {
|
|
|
110167
110243
|
}
|
|
110168
110244
|
if (ctx.options.fresh) {
|
|
110169
110245
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
110170
|
-
const claudeDir3 = prefix ?
|
|
110246
|
+
const claudeDir3 = prefix ? join139(resolvedDir, prefix) : resolvedDir;
|
|
110171
110247
|
const canProceed = await handleFreshInstallation(claudeDir3, ctx.prompts);
|
|
110172
110248
|
if (!canProceed) {
|
|
110173
110249
|
return { ...ctx, cancelled: true };
|
|
@@ -110187,7 +110263,7 @@ async function handleSelection(ctx) {
|
|
|
110187
110263
|
let currentVersion = null;
|
|
110188
110264
|
try {
|
|
110189
110265
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
110190
|
-
const claudeDir3 = prefix ?
|
|
110266
|
+
const claudeDir3 = prefix ? join139(resolvedDir, prefix) : resolvedDir;
|
|
110191
110267
|
const existingMetadata = await readManifest(claudeDir3);
|
|
110192
110268
|
currentVersion = existingMetadata?.kits?.[kitType]?.version || null;
|
|
110193
110269
|
if (currentVersion) {
|
|
@@ -110256,7 +110332,7 @@ async function handleSelection(ctx) {
|
|
|
110256
110332
|
if (ctx.options.yes && !ctx.options.fresh && !ctx.options.force && !ctx.options.restoreCkHooks && releaseTag && !isOfflineMode && !pendingKits?.length) {
|
|
110257
110333
|
try {
|
|
110258
110334
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
110259
|
-
const claudeDir3 = prefix ?
|
|
110335
|
+
const claudeDir3 = prefix ? join139(resolvedDir, prefix) : resolvedDir;
|
|
110260
110336
|
const existingMetadata = await readManifest(claudeDir3);
|
|
110261
110337
|
const installedKitVersion = existingMetadata?.kits?.[kitType]?.version;
|
|
110262
110338
|
if (installedKitVersion && versionsMatch(installedKitVersion, releaseTag)) {
|
|
@@ -110285,7 +110361,7 @@ async function handleSelection(ctx) {
|
|
|
110285
110361
|
}
|
|
110286
110362
|
// src/commands/init/phases/sync-handler.ts
|
|
110287
110363
|
import { copyFile as copyFile8, mkdir as mkdir37, open as open5, readFile as readFile61, rename as rename12, stat as stat23, unlink as unlink13, writeFile as writeFile35 } from "node:fs/promises";
|
|
110288
|
-
import { dirname as dirname46, join as
|
|
110364
|
+
import { dirname as dirname46, join as join140, resolve as resolve47 } from "node:path";
|
|
110289
110365
|
init_logger();
|
|
110290
110366
|
init_path_resolver();
|
|
110291
110367
|
var import_fs_extra38 = __toESM(require_lib(), 1);
|
|
@@ -110295,13 +110371,13 @@ async function handleSync(ctx) {
|
|
|
110295
110371
|
return ctx;
|
|
110296
110372
|
}
|
|
110297
110373
|
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve47(ctx.options.dir || ".");
|
|
110298
|
-
const claudeDir3 = ctx.options.global ? resolvedDir :
|
|
110374
|
+
const claudeDir3 = ctx.options.global ? resolvedDir : join140(resolvedDir, ".claude");
|
|
110299
110375
|
if (!await import_fs_extra38.pathExists(claudeDir3)) {
|
|
110300
110376
|
logger.error("Cannot sync: no .claude directory found");
|
|
110301
110377
|
ctx.prompts.note("Run 'ck init' without --sync to install first.", "No Installation Found");
|
|
110302
110378
|
return { ...ctx, cancelled: true };
|
|
110303
110379
|
}
|
|
110304
|
-
const metadataPath =
|
|
110380
|
+
const metadataPath = join140(claudeDir3, "metadata.json");
|
|
110305
110381
|
if (!await import_fs_extra38.pathExists(metadataPath)) {
|
|
110306
110382
|
logger.error("Cannot sync: no metadata.json found");
|
|
110307
110383
|
ctx.prompts.note(`Your installation may be from an older version.
|
|
@@ -110401,7 +110477,7 @@ function getLockTimeout() {
|
|
|
110401
110477
|
var STALE_LOCK_THRESHOLD_MS = 5 * 60 * 1000;
|
|
110402
110478
|
async function acquireSyncLock(global3) {
|
|
110403
110479
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
110404
|
-
const lockPath =
|
|
110480
|
+
const lockPath = join140(cacheDir, ".sync-lock");
|
|
110405
110481
|
const startTime = Date.now();
|
|
110406
110482
|
const lockTimeout = getLockTimeout();
|
|
110407
110483
|
await mkdir37(dirname46(lockPath), { recursive: true });
|
|
@@ -110447,11 +110523,11 @@ async function executeSyncMerge(ctx) {
|
|
|
110447
110523
|
const releaseLock = await acquireSyncLock(ctx.options.global);
|
|
110448
110524
|
try {
|
|
110449
110525
|
const trackedFiles = ctx.syncTrackedFiles;
|
|
110450
|
-
const upstreamDir = ctx.options.global ?
|
|
110526
|
+
const upstreamDir = ctx.options.global ? join140(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
110451
110527
|
let sourceMetadata = null;
|
|
110452
110528
|
let deletions = [];
|
|
110453
110529
|
try {
|
|
110454
|
-
const sourceMetadataPath =
|
|
110530
|
+
const sourceMetadataPath = join140(upstreamDir, "metadata.json");
|
|
110455
110531
|
if (await import_fs_extra38.pathExists(sourceMetadataPath)) {
|
|
110456
110532
|
const content = await readFile61(sourceMetadataPath, "utf-8");
|
|
110457
110533
|
sourceMetadata = JSON.parse(content);
|
|
@@ -110513,7 +110589,7 @@ async function executeSyncMerge(ctx) {
|
|
|
110513
110589
|
try {
|
|
110514
110590
|
const sourcePath = await validateSyncPath(upstreamDir, file.path);
|
|
110515
110591
|
const targetPath = await validateSyncPath(ctx.claudeDir, file.path);
|
|
110516
|
-
const targetDir =
|
|
110592
|
+
const targetDir = join140(targetPath, "..");
|
|
110517
110593
|
try {
|
|
110518
110594
|
await mkdir37(targetDir, { recursive: true });
|
|
110519
110595
|
} catch (mkdirError) {
|
|
@@ -110684,7 +110760,7 @@ async function createBackup(claudeDir3, files, backupDir) {
|
|
|
110684
110760
|
const sourcePath = await validateSyncPath(claudeDir3, file.path);
|
|
110685
110761
|
if (await import_fs_extra38.pathExists(sourcePath)) {
|
|
110686
110762
|
const targetPath = await validateSyncPath(backupDir, file.path);
|
|
110687
|
-
const targetDir =
|
|
110763
|
+
const targetDir = join140(targetPath, "..");
|
|
110688
110764
|
await mkdir37(targetDir, { recursive: true });
|
|
110689
110765
|
await copyFile8(sourcePath, targetPath);
|
|
110690
110766
|
}
|
|
@@ -110699,7 +110775,7 @@ async function createBackup(claudeDir3, files, backupDir) {
|
|
|
110699
110775
|
}
|
|
110700
110776
|
// src/commands/init/phases/transform-handler.ts
|
|
110701
110777
|
init_config_manager();
|
|
110702
|
-
import { join as
|
|
110778
|
+
import { join as join144 } from "node:path";
|
|
110703
110779
|
|
|
110704
110780
|
// src/services/transformers/folder-path-transformer.ts
|
|
110705
110781
|
init_logger();
|
|
@@ -110710,38 +110786,38 @@ init_logger();
|
|
|
110710
110786
|
init_types3();
|
|
110711
110787
|
var import_fs_extra39 = __toESM(require_lib(), 1);
|
|
110712
110788
|
import { rename as rename13, rm as rm17 } from "node:fs/promises";
|
|
110713
|
-
import { join as
|
|
110789
|
+
import { join as join141, relative as relative30 } from "node:path";
|
|
110714
110790
|
async function collectDirsToRename(extractDir, folders) {
|
|
110715
110791
|
const dirsToRename = [];
|
|
110716
110792
|
if (folders.docs !== DEFAULT_FOLDERS.docs) {
|
|
110717
|
-
const docsPath =
|
|
110793
|
+
const docsPath = join141(extractDir, DEFAULT_FOLDERS.docs);
|
|
110718
110794
|
if (await import_fs_extra39.pathExists(docsPath)) {
|
|
110719
110795
|
dirsToRename.push({
|
|
110720
110796
|
from: docsPath,
|
|
110721
|
-
to:
|
|
110797
|
+
to: join141(extractDir, folders.docs)
|
|
110722
110798
|
});
|
|
110723
110799
|
}
|
|
110724
|
-
const claudeDocsPath =
|
|
110800
|
+
const claudeDocsPath = join141(extractDir, ".claude", DEFAULT_FOLDERS.docs);
|
|
110725
110801
|
if (await import_fs_extra39.pathExists(claudeDocsPath)) {
|
|
110726
110802
|
dirsToRename.push({
|
|
110727
110803
|
from: claudeDocsPath,
|
|
110728
|
-
to:
|
|
110804
|
+
to: join141(extractDir, ".claude", folders.docs)
|
|
110729
110805
|
});
|
|
110730
110806
|
}
|
|
110731
110807
|
}
|
|
110732
110808
|
if (folders.plans !== DEFAULT_FOLDERS.plans) {
|
|
110733
|
-
const plansPath =
|
|
110809
|
+
const plansPath = join141(extractDir, DEFAULT_FOLDERS.plans);
|
|
110734
110810
|
if (await import_fs_extra39.pathExists(plansPath)) {
|
|
110735
110811
|
dirsToRename.push({
|
|
110736
110812
|
from: plansPath,
|
|
110737
|
-
to:
|
|
110813
|
+
to: join141(extractDir, folders.plans)
|
|
110738
110814
|
});
|
|
110739
110815
|
}
|
|
110740
|
-
const claudePlansPath =
|
|
110816
|
+
const claudePlansPath = join141(extractDir, ".claude", DEFAULT_FOLDERS.plans);
|
|
110741
110817
|
if (await import_fs_extra39.pathExists(claudePlansPath)) {
|
|
110742
110818
|
dirsToRename.push({
|
|
110743
110819
|
from: claudePlansPath,
|
|
110744
|
-
to:
|
|
110820
|
+
to: join141(extractDir, ".claude", folders.plans)
|
|
110745
110821
|
});
|
|
110746
110822
|
}
|
|
110747
110823
|
}
|
|
@@ -110782,7 +110858,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
110782
110858
|
init_logger();
|
|
110783
110859
|
init_types3();
|
|
110784
110860
|
import { readFile as readFile62, readdir as readdir43, writeFile as writeFile36 } from "node:fs/promises";
|
|
110785
|
-
import { join as
|
|
110861
|
+
import { join as join142, relative as relative31 } from "node:path";
|
|
110786
110862
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
110787
110863
|
".md",
|
|
110788
110864
|
".txt",
|
|
@@ -110835,7 +110911,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
110835
110911
|
let replacementsCount = 0;
|
|
110836
110912
|
const entries = await readdir43(dir, { withFileTypes: true });
|
|
110837
110913
|
for (const entry of entries) {
|
|
110838
|
-
const fullPath =
|
|
110914
|
+
const fullPath = join142(dir, entry.name);
|
|
110839
110915
|
if (entry.isDirectory()) {
|
|
110840
110916
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
110841
110917
|
continue;
|
|
@@ -110972,7 +111048,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
110972
111048
|
init_logger();
|
|
110973
111049
|
import { readFile as readFile63, readdir as readdir44, writeFile as writeFile37 } from "node:fs/promises";
|
|
110974
111050
|
import { homedir as homedir48, platform as platform16 } from "node:os";
|
|
110975
|
-
import { extname as extname7, join as
|
|
111051
|
+
import { extname as extname7, join as join143 } from "node:path";
|
|
110976
111052
|
var IS_WINDOWS3 = platform16() === "win32";
|
|
110977
111053
|
var HOME_PREFIX = "$HOME";
|
|
110978
111054
|
function getHomeDirPrefix() {
|
|
@@ -110982,7 +111058,7 @@ function normalizeInstallPath(path17) {
|
|
|
110982
111058
|
return path17.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
110983
111059
|
}
|
|
110984
111060
|
function getDefaultGlobalClaudeDir() {
|
|
110985
|
-
return normalizeInstallPath(
|
|
111061
|
+
return normalizeInstallPath(join143(homedir48(), ".claude"));
|
|
110986
111062
|
}
|
|
110987
111063
|
function getCustomGlobalClaudeDir(targetClaudeDir) {
|
|
110988
111064
|
if (!targetClaudeDir)
|
|
@@ -111113,7 +111189,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
111113
111189
|
async function processDirectory2(dir) {
|
|
111114
111190
|
const entries = await readdir44(dir, { withFileTypes: true });
|
|
111115
111191
|
for (const entry of entries) {
|
|
111116
|
-
const fullPath =
|
|
111192
|
+
const fullPath = join143(dir, entry.name);
|
|
111117
111193
|
if (entry.isDirectory()) {
|
|
111118
111194
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
111119
111195
|
continue;
|
|
@@ -111192,7 +111268,7 @@ async function handleTransforms(ctx) {
|
|
|
111192
111268
|
logger.debug(ctx.options.global ? "Saved folder configuration to ~/.claude/.ck.json" : "Saved folder configuration to .claude/.ck.json");
|
|
111193
111269
|
}
|
|
111194
111270
|
}
|
|
111195
|
-
const claudeDir3 = ctx.options.global ? ctx.resolvedDir :
|
|
111271
|
+
const claudeDir3 = ctx.options.global ? ctx.resolvedDir : join144(ctx.resolvedDir, ".claude");
|
|
111196
111272
|
return {
|
|
111197
111273
|
...ctx,
|
|
111198
111274
|
foldersConfig,
|
|
@@ -111419,7 +111495,7 @@ var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
|
111419
111495
|
import { existsSync as existsSync71 } from "node:fs";
|
|
111420
111496
|
import { readFile as readFile67, rm as rm18, unlink as unlink14 } from "node:fs/promises";
|
|
111421
111497
|
import { homedir as homedir52 } from "node:os";
|
|
111422
|
-
import { basename as basename30, join as
|
|
111498
|
+
import { basename as basename30, join as join148, resolve as resolve48 } from "node:path";
|
|
111423
111499
|
init_logger();
|
|
111424
111500
|
|
|
111425
111501
|
// src/ui/ck-cli-design/next-steps-footer.ts
|
|
@@ -111634,13 +111710,13 @@ init_dist2();
|
|
|
111634
111710
|
init_model_taxonomy();
|
|
111635
111711
|
import { mkdir as mkdir39, readFile as readFile66, writeFile as writeFile39 } from "node:fs/promises";
|
|
111636
111712
|
import { homedir as homedir51 } from "node:os";
|
|
111637
|
-
import { dirname as dirname47, join as
|
|
111713
|
+
import { dirname as dirname47, join as join147 } from "node:path";
|
|
111638
111714
|
|
|
111639
111715
|
// src/commands/portable/models-dev-cache.ts
|
|
111640
111716
|
init_logger();
|
|
111641
111717
|
import { mkdir as mkdir38, readFile as readFile64, rename as rename14, writeFile as writeFile38 } from "node:fs/promises";
|
|
111642
111718
|
import { homedir as homedir49 } from "node:os";
|
|
111643
|
-
import { join as
|
|
111719
|
+
import { join as join145 } from "node:path";
|
|
111644
111720
|
|
|
111645
111721
|
class ModelsDevUnavailableError extends Error {
|
|
111646
111722
|
constructor(message, cause) {
|
|
@@ -111652,13 +111728,13 @@ var MODELS_DEV_URL = "https://models.dev/api.json";
|
|
|
111652
111728
|
var CACHE_TTL_MS3 = 24 * 60 * 60 * 1000;
|
|
111653
111729
|
var FETCH_TIMEOUT_MS = 1e4;
|
|
111654
111730
|
function defaultCacheDir() {
|
|
111655
|
-
return
|
|
111731
|
+
return join145(homedir49(), ".config", "claudekit", "cache");
|
|
111656
111732
|
}
|
|
111657
111733
|
function cacheFilePath(cacheDir) {
|
|
111658
|
-
return
|
|
111734
|
+
return join145(cacheDir, "models-dev.json");
|
|
111659
111735
|
}
|
|
111660
111736
|
function tmpFilePath(cacheDir) {
|
|
111661
|
-
return
|
|
111737
|
+
return join145(cacheDir, "models-dev.json.tmp");
|
|
111662
111738
|
}
|
|
111663
111739
|
async function readCacheEntry(cacheDir) {
|
|
111664
111740
|
const filePath = cacheFilePath(cacheDir);
|
|
@@ -111733,14 +111809,14 @@ async function getModelsDevCatalog(opts = {}) {
|
|
|
111733
111809
|
init_logger();
|
|
111734
111810
|
import { readFile as readFile65 } from "node:fs/promises";
|
|
111735
111811
|
import { homedir as homedir50, platform as platform17 } from "node:os";
|
|
111736
|
-
import { join as
|
|
111812
|
+
import { join as join146 } from "node:path";
|
|
111737
111813
|
function resolveOpenCodeAuthPath(homeDir) {
|
|
111738
111814
|
if (platform17() === "win32") {
|
|
111739
|
-
const dataRoot2 = process.env.LOCALAPPDATA ??
|
|
111740
|
-
return
|
|
111815
|
+
const dataRoot2 = process.env.LOCALAPPDATA ?? join146(homeDir, "AppData", "Local");
|
|
111816
|
+
return join146(dataRoot2, "opencode", "auth.json");
|
|
111741
111817
|
}
|
|
111742
|
-
const dataRoot = process.env.XDG_DATA_HOME ??
|
|
111743
|
-
return
|
|
111818
|
+
const dataRoot = process.env.XDG_DATA_HOME ?? join146(homeDir, ".local", "share");
|
|
111819
|
+
return join146(dataRoot, "opencode", "auth.json");
|
|
111744
111820
|
}
|
|
111745
111821
|
async function readAuthedProviders(homeDir) {
|
|
111746
111822
|
const authPath = resolveOpenCodeAuthPath(homeDir);
|
|
@@ -111842,9 +111918,9 @@ function messageForReason(reason) {
|
|
|
111842
111918
|
}
|
|
111843
111919
|
function getOpenCodeConfigPath(options2) {
|
|
111844
111920
|
if (options2.global) {
|
|
111845
|
-
return
|
|
111921
|
+
return join147(options2.homeDir ?? homedir51(), ".config", "opencode", "opencode.json");
|
|
111846
111922
|
}
|
|
111847
|
-
return
|
|
111923
|
+
return join147(options2.cwd ?? process.cwd(), "opencode.json");
|
|
111848
111924
|
}
|
|
111849
111925
|
function makeCatalogOpts(options2) {
|
|
111850
111926
|
return {
|
|
@@ -112717,7 +112793,7 @@ function appendFallbackSkillActionsToPlan(plan, skills, selectedProviders, insta
|
|
|
112717
112793
|
reason: "New item, not previously installed",
|
|
112718
112794
|
reasonCode: "new-item",
|
|
112719
112795
|
reasonCopy: "New - not previously installed",
|
|
112720
|
-
targetPath:
|
|
112796
|
+
targetPath: join148(basePath, skill.name),
|
|
112721
112797
|
type: "skill"
|
|
112722
112798
|
});
|
|
112723
112799
|
}
|
|
@@ -112938,7 +113014,7 @@ function createSkippedPathMigrationCleanupResult2(action) {
|
|
|
112938
113014
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
112939
113015
|
if (!skillSourcePath)
|
|
112940
113016
|
return;
|
|
112941
|
-
const sourceMetadataPath =
|
|
113017
|
+
const sourceMetadataPath = join148(resolve48(skillSourcePath, ".."), "metadata.json");
|
|
112942
113018
|
if (!existsSync71(sourceMetadataPath))
|
|
112943
113019
|
return;
|
|
112944
113020
|
let sourceMetadata;
|
|
@@ -112951,7 +113027,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
112951
113027
|
}
|
|
112952
113028
|
if (!sourceMetadata.deletions || sourceMetadata.deletions.length === 0)
|
|
112953
113029
|
return;
|
|
112954
|
-
const claudeDir3 = installGlobally ?
|
|
113030
|
+
const claudeDir3 = installGlobally ? join148(homedir52(), ".claude") : join148(process.cwd(), ".claude");
|
|
112955
113031
|
if (!existsSync71(claudeDir3))
|
|
112956
113032
|
return;
|
|
112957
113033
|
try {
|
|
@@ -113079,8 +113155,8 @@ async function migrateCommand(options2) {
|
|
|
113079
113155
|
let requestedGlobal = options2.global ?? false;
|
|
113080
113156
|
let installGlobally = requestedGlobal;
|
|
113081
113157
|
if (options2.global === undefined && !options2.yes) {
|
|
113082
|
-
const projectTarget =
|
|
113083
|
-
const globalTarget =
|
|
113158
|
+
const projectTarget = join148(process.cwd(), ".claude");
|
|
113159
|
+
const globalTarget = join148(homedir52(), ".claude");
|
|
113084
113160
|
const scopeChoice = await ie({
|
|
113085
113161
|
message: "Installation scope",
|
|
113086
113162
|
options: [
|
|
@@ -113153,7 +113229,7 @@ async function migrateCommand(options2) {
|
|
|
113153
113229
|
}).join(`
|
|
113154
113230
|
`));
|
|
113155
113231
|
if (sourceGlobalOnly) {
|
|
113156
|
-
f2.info(import_picocolors30.default.dim(` Scope: global (--global / -g) - reading from ${formatDisplayPath(
|
|
113232
|
+
f2.info(import_picocolors30.default.dim(` Scope: global (--global / -g) - reading from ${formatDisplayPath(join148(homedir52(), ".claude"))}`));
|
|
113157
113233
|
} else {
|
|
113158
113234
|
f2.info(import_picocolors30.default.dim(` CWD: ${process.cwd()}`));
|
|
113159
113235
|
}
|
|
@@ -113817,7 +113893,7 @@ async function handleDirectorySetup(ctx) {
|
|
|
113817
113893
|
// src/commands/new/phases/project-creation.ts
|
|
113818
113894
|
init_config_manager();
|
|
113819
113895
|
init_github_client();
|
|
113820
|
-
import { join as
|
|
113896
|
+
import { join as join149 } from "node:path";
|
|
113821
113897
|
init_logger();
|
|
113822
113898
|
init_output_manager();
|
|
113823
113899
|
init_types3();
|
|
@@ -113943,7 +114019,7 @@ async function projectCreation(kit, resolvedDir, validOptions, isNonInteractive2
|
|
|
113943
114019
|
output.section("Installing");
|
|
113944
114020
|
logger.verbose("Installation target", { directory: resolvedDir });
|
|
113945
114021
|
const merger = new FileMerger;
|
|
113946
|
-
const claudeDir3 =
|
|
114022
|
+
const claudeDir3 = join149(resolvedDir, ".claude");
|
|
113947
114023
|
merger.setMultiKitContext(claudeDir3, kit);
|
|
113948
114024
|
if (validOptions.exclude && validOptions.exclude.length > 0) {
|
|
113949
114025
|
merger.addIgnorePatterns(validOptions.exclude);
|
|
@@ -113990,28 +114066,28 @@ async function handleProjectCreation(ctx) {
|
|
|
113990
114066
|
}
|
|
113991
114067
|
// src/commands/new/phases/post-setup.ts
|
|
113992
114068
|
init_projects_registry();
|
|
113993
|
-
import { join as
|
|
114069
|
+
import { join as join150 } from "node:path";
|
|
113994
114070
|
init_package_installer();
|
|
113995
114071
|
init_logger();
|
|
113996
114072
|
init_path_resolver();
|
|
113997
114073
|
async function postSetup(resolvedDir, validOptions, isNonInteractive2, prompts) {
|
|
113998
114074
|
let installOpenCode2 = validOptions.opencode;
|
|
113999
|
-
let
|
|
114075
|
+
let installAgy2 = validOptions.gemini;
|
|
114000
114076
|
let installSkills = validOptions.installSkills;
|
|
114001
|
-
if (!isNonInteractive2 && !installOpenCode2 && !
|
|
114077
|
+
if (!isNonInteractive2 && !installOpenCode2 && !installAgy2 && !installSkills) {
|
|
114002
114078
|
const packageChoices = await prompts.promptPackageInstallations();
|
|
114003
114079
|
installOpenCode2 = packageChoices.installOpenCode;
|
|
114004
|
-
|
|
114080
|
+
installAgy2 = packageChoices.installAgy;
|
|
114005
114081
|
installSkills = await prompts.promptSkillsInstallation();
|
|
114006
114082
|
}
|
|
114007
|
-
if (installOpenCode2 ||
|
|
114083
|
+
if (installOpenCode2 || installAgy2) {
|
|
114008
114084
|
logger.info("Installing optional packages...");
|
|
114009
114085
|
try {
|
|
114010
|
-
const installationResults = await processPackageInstallations(installOpenCode2,
|
|
114086
|
+
const installationResults = await processPackageInstallations(installOpenCode2, installAgy2, resolvedDir);
|
|
114011
114087
|
prompts.showPackageInstallationResults(installationResults);
|
|
114012
114088
|
} catch (error) {
|
|
114013
114089
|
logger.warning(`Package installation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
114014
|
-
logger.info("You can install these packages manually later
|
|
114090
|
+
logger.info("You can install these packages manually later from each tool's official install guide.");
|
|
114015
114091
|
}
|
|
114016
114092
|
}
|
|
114017
114093
|
if (installSkills) {
|
|
@@ -114022,9 +114098,9 @@ async function postSetup(resolvedDir, validOptions, isNonInteractive2, prompts)
|
|
|
114022
114098
|
withSudo: validOptions.withSudo
|
|
114023
114099
|
});
|
|
114024
114100
|
}
|
|
114025
|
-
const claudeDir3 =
|
|
114101
|
+
const claudeDir3 = join150(resolvedDir, ".claude");
|
|
114026
114102
|
await promptSetupWizardIfNeeded({
|
|
114027
|
-
envPath:
|
|
114103
|
+
envPath: join150(claudeDir3, ".env"),
|
|
114028
114104
|
claudeDir: claudeDir3,
|
|
114029
114105
|
isGlobal: false,
|
|
114030
114106
|
isNonInteractive: isNonInteractive2,
|
|
@@ -114094,7 +114170,7 @@ Please use only one download method.`);
|
|
|
114094
114170
|
// src/commands/plan/plan-command.ts
|
|
114095
114171
|
init_output_manager();
|
|
114096
114172
|
import { existsSync as existsSync74, statSync as statSync13 } from "node:fs";
|
|
114097
|
-
import { dirname as dirname52, isAbsolute as isAbsolute14, join as
|
|
114173
|
+
import { dirname as dirname52, isAbsolute as isAbsolute14, join as join153, parse as parse7, resolve as resolve53 } from "node:path";
|
|
114098
114174
|
|
|
114099
114175
|
// src/commands/plan/plan-read-handlers.ts
|
|
114100
114176
|
init_config();
|
|
@@ -114104,14 +114180,14 @@ init_logger();
|
|
|
114104
114180
|
init_output_manager();
|
|
114105
114181
|
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
114106
114182
|
import { existsSync as existsSync73, statSync as statSync12 } from "node:fs";
|
|
114107
|
-
import { basename as basename31, dirname as dirname50, join as
|
|
114183
|
+
import { basename as basename31, dirname as dirname50, join as join152, relative as relative32, resolve as resolve51 } from "node:path";
|
|
114108
114184
|
|
|
114109
114185
|
// src/commands/plan/plan-dependencies.ts
|
|
114110
114186
|
init_config();
|
|
114111
114187
|
init_plan_parser();
|
|
114112
114188
|
init_plans_registry();
|
|
114113
114189
|
import { existsSync as existsSync72 } from "node:fs";
|
|
114114
|
-
import { dirname as dirname49, join as
|
|
114190
|
+
import { dirname as dirname49, join as join151 } from "node:path";
|
|
114115
114191
|
async function resolvePlanDependencies(references, currentPlanFile, options2 = {}) {
|
|
114116
114192
|
if (references.length === 0)
|
|
114117
114193
|
return [];
|
|
@@ -114131,7 +114207,7 @@ async function resolvePlanDependencies(references, currentPlanFile, options2 = {
|
|
|
114131
114207
|
};
|
|
114132
114208
|
}
|
|
114133
114209
|
const scopeRoot = resolvePlanDirForScope(scope, projectRoot, config);
|
|
114134
|
-
const planFile =
|
|
114210
|
+
const planFile = join151(scopeRoot, planId, "plan.md");
|
|
114135
114211
|
const isSelfReference = planFile === currentPlanFile;
|
|
114136
114212
|
if (!existsSync72(planFile)) {
|
|
114137
114213
|
return {
|
|
@@ -114273,7 +114349,7 @@ async function handleStatus(target, options2) {
|
|
|
114273
114349
|
}
|
|
114274
114350
|
const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
|
|
114275
114351
|
const t = effectiveTarget ? resolve51(effectiveTarget) : null;
|
|
114276
|
-
const plansDir = t && existsSync73(t) && statSync12(t).isDirectory() && !existsSync73(
|
|
114352
|
+
const plansDir = t && existsSync73(t) && statSync12(t).isDirectory() && !existsSync73(join152(t, "plan.md")) ? t : null;
|
|
114277
114353
|
if (plansDir) {
|
|
114278
114354
|
const planFiles = scanPlanDir(plansDir);
|
|
114279
114355
|
if (planFiles.length === 0) {
|
|
@@ -114702,7 +114778,7 @@ function resolvePlanFile(target, baseDir) {
|
|
|
114702
114778
|
const stat24 = statSync13(t);
|
|
114703
114779
|
if (stat24.isFile())
|
|
114704
114780
|
return t;
|
|
114705
|
-
const candidate =
|
|
114781
|
+
const candidate = join153(t, "plan.md");
|
|
114706
114782
|
if (existsSync74(candidate))
|
|
114707
114783
|
return candidate;
|
|
114708
114784
|
}
|
|
@@ -114710,7 +114786,7 @@ function resolvePlanFile(target, baseDir) {
|
|
|
114710
114786
|
let dir = process.cwd();
|
|
114711
114787
|
const root = parse7(dir).root;
|
|
114712
114788
|
while (dir !== root) {
|
|
114713
|
-
const candidate =
|
|
114789
|
+
const candidate = join153(dir, "plan.md");
|
|
114714
114790
|
if (existsSync74(candidate))
|
|
114715
114791
|
return candidate;
|
|
114716
114792
|
dir = dirname52(dir);
|
|
@@ -115072,7 +115148,7 @@ async function handleEnvironmentConfig(ctx) {
|
|
|
115072
115148
|
};
|
|
115073
115149
|
}
|
|
115074
115150
|
// src/commands/setup/phases/packages-optional.ts
|
|
115075
|
-
|
|
115151
|
+
init_agy_installer();
|
|
115076
115152
|
init_opencode_installer();
|
|
115077
115153
|
init_dist2();
|
|
115078
115154
|
async function handleOptionalPackages(ctx) {
|
|
@@ -115102,23 +115178,23 @@ async function handleOptionalPackages(ctx) {
|
|
|
115102
115178
|
}
|
|
115103
115179
|
}
|
|
115104
115180
|
}
|
|
115105
|
-
const
|
|
115106
|
-
if (
|
|
115107
|
-
f2.success("
|
|
115181
|
+
const hasAgy = await isAgyInstalled();
|
|
115182
|
+
if (hasAgy) {
|
|
115183
|
+
f2.success("Antigravity CLI (agy): already installed");
|
|
115108
115184
|
} else {
|
|
115109
|
-
const
|
|
115110
|
-
message: "Install
|
|
115185
|
+
const installAgyChoice = await se({
|
|
115186
|
+
message: "Install Antigravity CLI (agy)? (AI assistant)",
|
|
115111
115187
|
initialValue: false
|
|
115112
115188
|
});
|
|
115113
|
-
if (lD(
|
|
115189
|
+
if (lD(installAgyChoice)) {
|
|
115114
115190
|
return { ...ctx, cancelled: true };
|
|
115115
115191
|
}
|
|
115116
|
-
if (
|
|
115117
|
-
const result = await
|
|
115192
|
+
if (installAgyChoice) {
|
|
115193
|
+
const result = await installAgy();
|
|
115118
115194
|
if (result.success) {
|
|
115119
|
-
installedPackages.push("
|
|
115195
|
+
installedPackages.push("Antigravity CLI (agy)");
|
|
115120
115196
|
} else {
|
|
115121
|
-
f2.warning(`Failed to install
|
|
115197
|
+
f2.warning(`Failed to install Antigravity CLI (agy): ${result.error || "Unknown error"}`);
|
|
115122
115198
|
}
|
|
115123
115199
|
}
|
|
115124
115200
|
}
|
|
@@ -115230,10 +115306,10 @@ init_agents();
|
|
|
115230
115306
|
var import_gray_matter12 = __toESM(require_gray_matter(), 1);
|
|
115231
115307
|
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
115232
115308
|
import { readFile as readFile68 } from "node:fs/promises";
|
|
115233
|
-
import { join as
|
|
115309
|
+
import { join as join155 } from "node:path";
|
|
115234
115310
|
|
|
115235
115311
|
// src/commands/skills/installed-skills-inventory.ts
|
|
115236
|
-
import { join as
|
|
115312
|
+
import { join as join154, resolve as resolve55 } from "node:path";
|
|
115237
115313
|
init_path_resolver();
|
|
115238
115314
|
var SCOPE_SORT_ORDER = {
|
|
115239
115315
|
project: 0,
|
|
@@ -115245,8 +115321,8 @@ async function getActiveClaudeSkillInstallations(options2 = {}) {
|
|
|
115245
115321
|
const projectClaudeDir = resolve55(projectDir, ".claude");
|
|
115246
115322
|
const projectScopeAliasesGlobal = projectClaudeDir === globalDir;
|
|
115247
115323
|
const [projectSkills, globalSkills] = await Promise.all([
|
|
115248
|
-
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(
|
|
115249
|
-
scanSkills2(
|
|
115324
|
+
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(join154(projectClaudeDir, "skills")),
|
|
115325
|
+
scanSkills2(join154(globalDir, "skills"))
|
|
115250
115326
|
]);
|
|
115251
115327
|
const projectIds = new Set(projectSkills.map((skill) => skill.id));
|
|
115252
115328
|
const globalIds = new Set(globalSkills.map((skill) => skill.id));
|
|
@@ -115407,7 +115483,7 @@ async function handleValidate2(sourcePath) {
|
|
|
115407
115483
|
spinner.stop(`Checked ${skills.length} skill(s)`);
|
|
115408
115484
|
let hasIssues = false;
|
|
115409
115485
|
for (const skill of skills) {
|
|
115410
|
-
const skillMdPath =
|
|
115486
|
+
const skillMdPath = join155(skill.path, "SKILL.md");
|
|
115411
115487
|
try {
|
|
115412
115488
|
const content = await readFile68(skillMdPath, "utf-8");
|
|
115413
115489
|
const { data } = import_gray_matter12.default(content, {
|
|
@@ -115943,7 +116019,7 @@ init_skills_uninstaller();
|
|
|
115943
116019
|
// src/domains/installation/plugin/uninstall-plugin.ts
|
|
115944
116020
|
init_install_mode_detector();
|
|
115945
116021
|
import { existsSync as existsSync76, rmSync as rmSync6 } from "node:fs";
|
|
115946
|
-
import { join as
|
|
116022
|
+
import { join as join156 } from "node:path";
|
|
115947
116023
|
init_path_resolver();
|
|
115948
116024
|
async function uninstallEnginePlugin(opts = {}) {
|
|
115949
116025
|
const claudeDir3 = opts.claudeDir ?? PathResolver.getGlobalKitDir();
|
|
@@ -115957,7 +116033,7 @@ async function uninstallEnginePlugin(opts = {}) {
|
|
|
115957
116033
|
}
|
|
115958
116034
|
let staleCacheRemoved = false;
|
|
115959
116035
|
const marketplace = state.marketplace ?? CK_MARKETPLACE_NAME;
|
|
115960
|
-
const cacheDir =
|
|
116036
|
+
const cacheDir = join156(claudeDir3, "plugins", "cache", marketplace, CK_PLUGIN_NAME);
|
|
115961
116037
|
if (existsSync76(cacheDir)) {
|
|
115962
116038
|
rmSync6(cacheDir, { recursive: true, force: true });
|
|
115963
116039
|
staleCacheRemoved = true;
|
|
@@ -116015,7 +116091,7 @@ async function detectInstallations() {
|
|
|
116015
116091
|
|
|
116016
116092
|
// src/commands/uninstall/removal-handler.ts
|
|
116017
116093
|
import { readdirSync as readdirSync13, rmSync as rmSync8 } from "node:fs";
|
|
116018
|
-
import { basename as basename33, join as
|
|
116094
|
+
import { basename as basename33, join as join159, resolve as resolve56, sep as sep14 } from "node:path";
|
|
116019
116095
|
init_logger();
|
|
116020
116096
|
init_safe_prompts();
|
|
116021
116097
|
init_safe_spinner();
|
|
@@ -116024,7 +116100,7 @@ var import_fs_extra44 = __toESM(require_lib(), 1);
|
|
|
116024
116100
|
// src/commands/uninstall/analysis-handler.ts
|
|
116025
116101
|
init_metadata_migration();
|
|
116026
116102
|
import { readdirSync as readdirSync12, rmSync as rmSync7 } from "node:fs";
|
|
116027
|
-
import { dirname as dirname53, join as
|
|
116103
|
+
import { dirname as dirname53, join as join157 } from "node:path";
|
|
116028
116104
|
init_logger();
|
|
116029
116105
|
init_safe_prompts();
|
|
116030
116106
|
var import_fs_extra42 = __toESM(require_lib(), 1);
|
|
@@ -116084,7 +116160,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
116084
116160
|
const remainingFiles = metadata.kits?.[remainingKit]?.files || [];
|
|
116085
116161
|
for (const file of remainingFiles) {
|
|
116086
116162
|
const relativePath = normalizeTrackedPath(file.path);
|
|
116087
|
-
if (await import_fs_extra42.pathExists(
|
|
116163
|
+
if (await import_fs_extra42.pathExists(join157(installation.path, relativePath))) {
|
|
116088
116164
|
result.retainedManifestPaths.push(relativePath);
|
|
116089
116165
|
}
|
|
116090
116166
|
}
|
|
@@ -116092,7 +116168,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
116092
116168
|
const kitFiles = metadata.kits[kit].files || [];
|
|
116093
116169
|
for (const trackedFile of kitFiles) {
|
|
116094
116170
|
const relativePath = normalizeTrackedPath(trackedFile.path);
|
|
116095
|
-
const filePath =
|
|
116171
|
+
const filePath = join157(installation.path, relativePath);
|
|
116096
116172
|
if (preservedPaths.has(relativePath)) {
|
|
116097
116173
|
result.toPreserve.push({ path: relativePath, reason: "shared with other kit" });
|
|
116098
116174
|
continue;
|
|
@@ -116125,7 +116201,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
116125
116201
|
}
|
|
116126
116202
|
for (const trackedFile of allTrackedFiles) {
|
|
116127
116203
|
const relativePath = normalizeTrackedPath(trackedFile.path);
|
|
116128
|
-
const filePath =
|
|
116204
|
+
const filePath = join157(installation.path, relativePath);
|
|
116129
116205
|
const ownershipResult = await OwnershipChecker.checkOwnership(filePath, metadata, installation.path);
|
|
116130
116206
|
if (!ownershipResult.exists)
|
|
116131
116207
|
continue;
|
|
@@ -116176,7 +116252,7 @@ init_settings_merger();
|
|
|
116176
116252
|
init_command_normalizer();
|
|
116177
116253
|
init_logger();
|
|
116178
116254
|
var import_fs_extra43 = __toESM(require_lib(), 1);
|
|
116179
|
-
import { join as
|
|
116255
|
+
import { join as join158 } from "node:path";
|
|
116180
116256
|
var CK_JSON_FILE2 = ".ck.json";
|
|
116181
116257
|
var SETTINGS_FILE = "settings.json";
|
|
116182
116258
|
var EMPTY_RESULT = {
|
|
@@ -116298,7 +116374,7 @@ async function cleanupCkJson(ckJsonPath, data, removedKitNames, dryRun) {
|
|
|
116298
116374
|
return false;
|
|
116299
116375
|
}
|
|
116300
116376
|
async function cleanupUninstalledSettings(installationPath, options2) {
|
|
116301
|
-
const ckJsonPath =
|
|
116377
|
+
const ckJsonPath = join158(installationPath, CK_JSON_FILE2);
|
|
116302
116378
|
if (!await import_fs_extra43.pathExists(ckJsonPath)) {
|
|
116303
116379
|
return { ...EMPTY_RESULT };
|
|
116304
116380
|
}
|
|
@@ -116313,7 +116389,7 @@ async function cleanupUninstalledSettings(installationPath, options2) {
|
|
|
116313
116389
|
const removedKitNames = options2.kit ? [options2.kit] : Object.keys(kits);
|
|
116314
116390
|
const { hooks, servers } = resolveRemovalTargets(kits, removedKitNames, options2.remainingKits);
|
|
116315
116391
|
const result = { ...EMPTY_RESULT };
|
|
116316
|
-
const settingsPath =
|
|
116392
|
+
const settingsPath = join158(installationPath, SETTINGS_FILE);
|
|
116317
116393
|
const settings = await SettingsMerger.readSettingsFile(settingsPath);
|
|
116318
116394
|
if (settings) {
|
|
116319
116395
|
result.hooksRemoved = removeHooksFromSettings(settings, hooks);
|
|
@@ -116427,8 +116503,8 @@ async function removeInstallations(installations, options2) {
|
|
|
116427
116503
|
}
|
|
116428
116504
|
const mutatePaths = getUninstallMutatePaths({
|
|
116429
116505
|
retainedManifestPaths: analysis.retainedManifestPaths,
|
|
116430
|
-
settingsFileExists: await import_fs_extra44.pathExists(
|
|
116431
|
-
ckJsonExists: await import_fs_extra44.pathExists(
|
|
116506
|
+
settingsFileExists: await import_fs_extra44.pathExists(join159(installation.path, "settings.json")),
|
|
116507
|
+
ckJsonExists: await import_fs_extra44.pathExists(join159(installation.path, ".ck.json"))
|
|
116432
116508
|
});
|
|
116433
116509
|
let backup = null;
|
|
116434
116510
|
if (analysis.toDelete.length > 0 || mutatePaths.length > 0) {
|
|
@@ -116456,7 +116532,7 @@ async function removeInstallations(installations, options2) {
|
|
|
116456
116532
|
let removedCount = 0;
|
|
116457
116533
|
let cleanedDirs = 0;
|
|
116458
116534
|
for (const item of analysis.toDelete) {
|
|
116459
|
-
const filePath =
|
|
116535
|
+
const filePath = join159(installation.path, item.path);
|
|
116460
116536
|
if (!await import_fs_extra44.pathExists(filePath))
|
|
116461
116537
|
continue;
|
|
116462
116538
|
if (!await isPathSafeToRemove(filePath, installation.path)) {
|
|
@@ -116883,7 +116959,7 @@ ${import_picocolors40.default.bold(import_picocolors40.default.cyan(result.kitCo
|
|
|
116883
116959
|
init_logger();
|
|
116884
116960
|
import { existsSync as existsSync82 } from "node:fs";
|
|
116885
116961
|
import { rm as rm19 } from "node:fs/promises";
|
|
116886
|
-
import { join as
|
|
116962
|
+
import { join as join166 } from "node:path";
|
|
116887
116963
|
var import_picocolors41 = __toESM(require_picocolors(), 1);
|
|
116888
116964
|
|
|
116889
116965
|
// src/commands/watch/phases/implementation-runner.ts
|
|
@@ -117402,7 +117478,7 @@ function spawnAndCollect3(command, args) {
|
|
|
117402
117478
|
|
|
117403
117479
|
// src/commands/watch/phases/issue-processor.ts
|
|
117404
117480
|
import { mkdir as mkdir40, writeFile as writeFile42 } from "node:fs/promises";
|
|
117405
|
-
import { join as
|
|
117481
|
+
import { join as join162 } from "node:path";
|
|
117406
117482
|
|
|
117407
117483
|
// src/commands/watch/phases/approval-detector.ts
|
|
117408
117484
|
init_logger();
|
|
@@ -117780,9 +117856,9 @@ async function checkAwaitingApproval(state, setup, options2, watchLog, projectDi
|
|
|
117780
117856
|
|
|
117781
117857
|
// src/commands/watch/phases/plan-dir-finder.ts
|
|
117782
117858
|
import { readdir as readdir46, stat as stat24 } from "node:fs/promises";
|
|
117783
|
-
import { join as
|
|
117859
|
+
import { join as join161 } from "node:path";
|
|
117784
117860
|
async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
117785
|
-
const plansRoot =
|
|
117861
|
+
const plansRoot = join161(cwd2, "plans");
|
|
117786
117862
|
try {
|
|
117787
117863
|
const entries = await readdir46(plansRoot);
|
|
117788
117864
|
const tenMinAgo = Date.now() - 10 * 60 * 1000;
|
|
@@ -117791,14 +117867,14 @@ async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
|
117791
117867
|
for (const entry of entries) {
|
|
117792
117868
|
if (entry === "watch" || entry === "reports" || entry === "visuals")
|
|
117793
117869
|
continue;
|
|
117794
|
-
const dirPath =
|
|
117870
|
+
const dirPath = join161(plansRoot, entry);
|
|
117795
117871
|
const dirStat = await stat24(dirPath);
|
|
117796
117872
|
if (!dirStat.isDirectory())
|
|
117797
117873
|
continue;
|
|
117798
117874
|
if (dirStat.mtimeMs < tenMinAgo)
|
|
117799
117875
|
continue;
|
|
117800
117876
|
try {
|
|
117801
|
-
await stat24(
|
|
117877
|
+
await stat24(join161(dirPath, "plan.md"));
|
|
117802
117878
|
} catch {
|
|
117803
117879
|
continue;
|
|
117804
117880
|
}
|
|
@@ -118029,13 +118105,13 @@ async function handlePlanGeneration(issue, state, config, setup, options2, watch
|
|
|
118029
118105
|
stats.plansCreated++;
|
|
118030
118106
|
const detectedPlanDir = await findRecentPlanDir(projectDir, issue.number, watchLog);
|
|
118031
118107
|
if (detectedPlanDir) {
|
|
118032
|
-
state.activeIssues[numStr].planPath =
|
|
118108
|
+
state.activeIssues[numStr].planPath = join162(detectedPlanDir, "plan.md");
|
|
118033
118109
|
watchLog.info(`Plan directory detected: ${detectedPlanDir}`);
|
|
118034
118110
|
} else {
|
|
118035
118111
|
try {
|
|
118036
|
-
const planDir =
|
|
118112
|
+
const planDir = join162(projectDir, "plans", "watch");
|
|
118037
118113
|
await mkdir40(planDir, { recursive: true });
|
|
118038
|
-
const planFilePath =
|
|
118114
|
+
const planFilePath = join162(planDir, `issue-${issue.number}-plan.md`);
|
|
118039
118115
|
await writeFile42(planFilePath, planResult.planText, "utf-8");
|
|
118040
118116
|
state.activeIssues[numStr].planPath = planFilePath;
|
|
118041
118117
|
watchLog.info(`Plan saved (fallback) to ${planFilePath}`);
|
|
@@ -118342,18 +118418,18 @@ init_logger();
|
|
|
118342
118418
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
118343
118419
|
import { existsSync as existsSync79 } from "node:fs";
|
|
118344
118420
|
import { readdir as readdir47, stat as stat25 } from "node:fs/promises";
|
|
118345
|
-
import { join as
|
|
118421
|
+
import { join as join163 } from "node:path";
|
|
118346
118422
|
async function scanForRepos(parentDir) {
|
|
118347
118423
|
const repos = [];
|
|
118348
118424
|
const entries = await readdir47(parentDir);
|
|
118349
118425
|
for (const entry of entries) {
|
|
118350
118426
|
if (entry.startsWith("."))
|
|
118351
118427
|
continue;
|
|
118352
|
-
const fullPath =
|
|
118428
|
+
const fullPath = join163(parentDir, entry);
|
|
118353
118429
|
const entryStat = await stat25(fullPath);
|
|
118354
118430
|
if (!entryStat.isDirectory())
|
|
118355
118431
|
continue;
|
|
118356
|
-
const gitDir =
|
|
118432
|
+
const gitDir = join163(fullPath, ".git");
|
|
118357
118433
|
if (!existsSync79(gitDir))
|
|
118358
118434
|
continue;
|
|
118359
118435
|
const result = spawnSync7("gh", ["repo", "view", "--json", "owner,name"], {
|
|
@@ -118380,7 +118456,7 @@ init_logger();
|
|
|
118380
118456
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
118381
118457
|
import { existsSync as existsSync80 } from "node:fs";
|
|
118382
118458
|
import { homedir as homedir53 } from "node:os";
|
|
118383
|
-
import { join as
|
|
118459
|
+
import { join as join164 } from "node:path";
|
|
118384
118460
|
async function validateSetup(cwd2) {
|
|
118385
118461
|
const workDir = cwd2 ?? process.cwd();
|
|
118386
118462
|
const ghVersion = spawnSync8("gh", ["--version"], { encoding: "utf-8", timeout: 1e4 });
|
|
@@ -118411,7 +118487,7 @@ Run this command from a directory with a GitHub remote.`);
|
|
|
118411
118487
|
} catch {
|
|
118412
118488
|
throw new Error(`Failed to parse repository info: ${ghRepo.stdout}`);
|
|
118413
118489
|
}
|
|
118414
|
-
const skillsPath =
|
|
118490
|
+
const skillsPath = join164(homedir53(), ".claude", "skills");
|
|
118415
118491
|
const skillsAvailable = existsSync80(skillsPath);
|
|
118416
118492
|
if (!skillsAvailable) {
|
|
118417
118493
|
logger.warning(`ClaudeKit Engineer skills not found at ${skillsPath}`);
|
|
@@ -118430,7 +118506,7 @@ init_path_resolver();
|
|
|
118430
118506
|
import { createWriteStream as createWriteStream3, statSync as statSync14 } from "node:fs";
|
|
118431
118507
|
import { existsSync as existsSync81 } from "node:fs";
|
|
118432
118508
|
import { mkdir as mkdir42, rename as rename15 } from "node:fs/promises";
|
|
118433
|
-
import { join as
|
|
118509
|
+
import { join as join165 } from "node:path";
|
|
118434
118510
|
|
|
118435
118511
|
class WatchLogger {
|
|
118436
118512
|
logStream = null;
|
|
@@ -118438,7 +118514,7 @@ class WatchLogger {
|
|
|
118438
118514
|
logPath = null;
|
|
118439
118515
|
maxBytes;
|
|
118440
118516
|
constructor(logDir, maxBytes = 0) {
|
|
118441
|
-
this.logDir = logDir ??
|
|
118517
|
+
this.logDir = logDir ?? join165(PathResolver.getClaudeKitDir(), "logs");
|
|
118442
118518
|
this.maxBytes = maxBytes;
|
|
118443
118519
|
}
|
|
118444
118520
|
async init() {
|
|
@@ -118447,7 +118523,7 @@ class WatchLogger {
|
|
|
118447
118523
|
await mkdir42(this.logDir, { recursive: true });
|
|
118448
118524
|
}
|
|
118449
118525
|
const dateStr = formatDate(new Date);
|
|
118450
|
-
this.logPath =
|
|
118526
|
+
this.logPath = join165(this.logDir, `watch-${dateStr}.log`);
|
|
118451
118527
|
this.logStream = createWriteStream3(this.logPath, { flags: "a", mode: 384 });
|
|
118452
118528
|
} catch (error) {
|
|
118453
118529
|
logger.warning(`Cannot create watch log file: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -118629,7 +118705,7 @@ async function watchCommand(options2) {
|
|
|
118629
118705
|
}
|
|
118630
118706
|
async function discoverRepos(options2, watchLog) {
|
|
118631
118707
|
const cwd2 = process.cwd();
|
|
118632
|
-
const isGitRepo = existsSync82(
|
|
118708
|
+
const isGitRepo = existsSync82(join166(cwd2, ".git"));
|
|
118633
118709
|
if (options2.force) {
|
|
118634
118710
|
await forceRemoveLock(watchLog);
|
|
118635
118711
|
}
|
|
@@ -118887,7 +118963,7 @@ function registerCommands(cli) {
|
|
|
118887
118963
|
init_package();
|
|
118888
118964
|
init_config_version_checker();
|
|
118889
118965
|
import { existsSync as existsSync94, readFileSync as readFileSync26 } from "node:fs";
|
|
118890
|
-
import { join as
|
|
118966
|
+
import { join as join178 } from "node:path";
|
|
118891
118967
|
|
|
118892
118968
|
// src/domains/versioning/version-checker.ts
|
|
118893
118969
|
init_version_utils();
|
|
@@ -118902,14 +118978,14 @@ init_logger();
|
|
|
118902
118978
|
init_path_resolver();
|
|
118903
118979
|
import { existsSync as existsSync93 } from "node:fs";
|
|
118904
118980
|
import { mkdir as mkdir43, readFile as readFile73, writeFile as writeFile45 } from "node:fs/promises";
|
|
118905
|
-
import { join as
|
|
118981
|
+
import { join as join177 } from "node:path";
|
|
118906
118982
|
|
|
118907
118983
|
class VersionCacheManager {
|
|
118908
118984
|
static CACHE_FILENAME = "version-check.json";
|
|
118909
118985
|
static CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
118910
118986
|
static getCacheFile() {
|
|
118911
118987
|
const cacheDir = PathResolver.getCacheDir(false);
|
|
118912
|
-
return
|
|
118988
|
+
return join177(cacheDir, VersionCacheManager.CACHE_FILENAME);
|
|
118913
118989
|
}
|
|
118914
118990
|
static async load() {
|
|
118915
118991
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
@@ -119220,9 +119296,9 @@ async function displayVersion() {
|
|
|
119220
119296
|
let localInstalledKits = [];
|
|
119221
119297
|
let globalInstalledKits = [];
|
|
119222
119298
|
const globalKitDir = PathResolver.getGlobalKitDir();
|
|
119223
|
-
const globalMetadataPath =
|
|
119299
|
+
const globalMetadataPath = join178(globalKitDir, "metadata.json");
|
|
119224
119300
|
const prefix = PathResolver.getPathPrefix(false);
|
|
119225
|
-
const localMetadataPath = prefix ?
|
|
119301
|
+
const localMetadataPath = prefix ? join178(process.cwd(), prefix, "metadata.json") : join178(process.cwd(), "metadata.json");
|
|
119226
119302
|
const isLocalSameAsGlobal = localMetadataPath === globalMetadataPath;
|
|
119227
119303
|
if (!isLocalSameAsGlobal && existsSync94(localMetadataPath)) {
|
|
119228
119304
|
try {
|