claudekit-cli 4.5.0-dev.5 → 4.5.0-dev.7
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 +899 -685
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -52475,11 +52475,56 @@ function getRulesSourcePath(globalOnly = false) {
|
|
|
52475
52475
|
return globalPath;
|
|
52476
52476
|
return findExistingProjectLayoutPath(process.cwd(), "rules") ?? globalPath;
|
|
52477
52477
|
}
|
|
52478
|
+
function isRecord2(value) {
|
|
52479
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
52480
|
+
}
|
|
52481
|
+
function isClaudeKitPluginEnabled(settings) {
|
|
52482
|
+
if (!isRecord2(settings))
|
|
52483
|
+
return false;
|
|
52484
|
+
const enabledPlugins = settings.enabledPlugins;
|
|
52485
|
+
if (Array.isArray(enabledPlugins)) {
|
|
52486
|
+
return enabledPlugins.includes("ck@claudekit");
|
|
52487
|
+
}
|
|
52488
|
+
return isRecord2(enabledPlugins) && enabledPlugins["ck@claudekit"] === true;
|
|
52489
|
+
}
|
|
52490
|
+
function readJsonSafe2(filePath) {
|
|
52491
|
+
try {
|
|
52492
|
+
return JSON.parse(readFileSync7(filePath, "utf-8"));
|
|
52493
|
+
} catch {
|
|
52494
|
+
return null;
|
|
52495
|
+
}
|
|
52496
|
+
}
|
|
52497
|
+
function resolveConfiguredClaudeKitPluginSourceSubpath(relativePath) {
|
|
52498
|
+
const claudeDir3 = join42(homedir23(), ".claude");
|
|
52499
|
+
const settings = readJsonSafe2(join42(claudeDir3, "settings.json"));
|
|
52500
|
+
if (!isClaudeKitPluginEnabled(settings) || !isRecord2(settings))
|
|
52501
|
+
return null;
|
|
52502
|
+
const marketplaces = settings.extraKnownMarketplaces;
|
|
52503
|
+
const claudekit = isRecord2(marketplaces) ? marketplaces.claudekit : null;
|
|
52504
|
+
const source = isRecord2(claudekit) ? claudekit.source : null;
|
|
52505
|
+
const sourcePath = isRecord2(source) && typeof source.path === "string" ? source.path : null;
|
|
52506
|
+
if (!sourcePath)
|
|
52507
|
+
return null;
|
|
52508
|
+
const candidates = [join42(sourcePath, ".claude", relativePath), join42(sourcePath, relativePath)];
|
|
52509
|
+
return candidates.find((candidate) => existsSync24(candidate)) ?? null;
|
|
52510
|
+
}
|
|
52511
|
+
function hasAdjacentSettings(sourceDir) {
|
|
52512
|
+
return existsSync24(join42(dirname12(sourceDir), "settings.json"));
|
|
52513
|
+
}
|
|
52514
|
+
function resolveClaudeKitPluginHooksSourcePath() {
|
|
52515
|
+
const candidates = [
|
|
52516
|
+
resolveConfiguredClaudeKitPluginSourceSubpath("hooks"),
|
|
52517
|
+
resolveInstalledPluginCacheSubpath("hooks", join42(homedir23(), ".claude"))
|
|
52518
|
+
].filter((path4) => typeof path4 === "string");
|
|
52519
|
+
return candidates.find((candidate) => hasAdjacentSettings(candidate)) ?? null;
|
|
52520
|
+
}
|
|
52478
52521
|
function getHooksSourcePath(globalOnly = false) {
|
|
52479
52522
|
const globalPath = join42(homedir23(), ".claude", "hooks");
|
|
52523
|
+
const pluginPath = resolveClaudeKitPluginHooksSourcePath();
|
|
52524
|
+
const globalCandidate = pluginPath ?? globalPath;
|
|
52480
52525
|
if (globalOnly)
|
|
52481
|
-
return
|
|
52482
|
-
return findExistingProjectLayoutPath(process.cwd(), "hooks") ??
|
|
52526
|
+
return globalCandidate;
|
|
52527
|
+
return findExistingProjectLayoutPath(process.cwd(), "hooks") ?? globalCandidate;
|
|
52483
52528
|
}
|
|
52484
52529
|
async function discoverConfig(sourcePath) {
|
|
52485
52530
|
const path4 = sourcePath ?? getConfigSourcePath();
|
|
@@ -52725,6 +52770,7 @@ async function discoverPortableFiles(dir, baseDir, options2) {
|
|
|
52725
52770
|
}
|
|
52726
52771
|
var HOOK_EXTENSIONS, SHELL_HOOK_EXTENSIONS, HOOK_ASSET_EXTENSIONS, HOOK_DEPENDENCY_SKIP_SEGMENTS, HOOKS_SKIP_DIR_NAMES, HOOKS_COMPANION_DOTFILES;
|
|
52727
52772
|
var init_config_discovery = __esm(() => {
|
|
52773
|
+
init_install_mode_detector();
|
|
52728
52774
|
init_kit_layout();
|
|
52729
52775
|
init_hook_migration_compatibility();
|
|
52730
52776
|
HOOK_EXTENSIONS = new Set([".js", ".cjs", ".mjs", ".ts"]);
|
|
@@ -55317,13 +55363,25 @@ var init_gemini_hook_event_map = __esm(() => {
|
|
|
55317
55363
|
});
|
|
55318
55364
|
|
|
55319
55365
|
// src/commands/portable/hooks-settings-merger.ts
|
|
55320
|
-
import { existsSync as existsSync27 } from "node:fs";
|
|
55366
|
+
import { existsSync as existsSync27, readFileSync as readFileSync8 } from "node:fs";
|
|
55321
55367
|
import { mkdir as mkdir13, readFile as readFile22, rename as rename8, rm as rm6, writeFile as writeFile13 } from "node:fs/promises";
|
|
55322
55368
|
import { homedir as homedir26 } from "node:os";
|
|
55323
|
-
import { basename as basename14, dirname as dirname16, extname as extname4, join as join45, resolve as resolve20 } from "node:path";
|
|
55369
|
+
import { basename as basename14, dirname as dirname16, extname as extname4, isAbsolute as isAbsolute6, join as join45, resolve as resolve20 } from "node:path";
|
|
55370
|
+
function resolveSettingsPath(pathValue, isGlobal) {
|
|
55371
|
+
if (isGlobal || isAbsolute6(pathValue))
|
|
55372
|
+
return pathValue;
|
|
55373
|
+
return join45(process.cwd(), pathValue);
|
|
55374
|
+
}
|
|
55324
55375
|
function isCodexWrappableHookPath(filePath) {
|
|
55325
55376
|
return hookAssetBasename(filePath) !== "node-hook-runner.sh" && CODEX_WRAPPABLE_HOOK_EXTENSIONS.has(extname4(filePath).toLowerCase());
|
|
55326
55377
|
}
|
|
55378
|
+
function collectSourceHookDirs(sourceHooksDirOverride, providerSourceHooksDir) {
|
|
55379
|
+
const dirs = [sourceHooksDirOverride, providerSourceHooksDir].filter((value) => typeof value === "string" && value.length > 0);
|
|
55380
|
+
return Array.from(new Set(dirs));
|
|
55381
|
+
}
|
|
55382
|
+
function rewriteHookPathsFromSourceDirs(hooks, sourceHooksDirs, targetHooksDir) {
|
|
55383
|
+
return sourceHooksDirs.reduce((currentHooks, sourceHooksDir) => rewriteHookPaths(currentHooks, sourceHooksDir, targetHooksDir), hooks);
|
|
55384
|
+
}
|
|
55327
55385
|
function validateHooksSectionShape(value) {
|
|
55328
55386
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
55329
55387
|
return "hooks must be a non-null object";
|
|
@@ -55523,8 +55581,9 @@ function pruneIncompatibleHookRegistrations(hooks, options2) {
|
|
|
55523
55581
|
const keptHooks = group.hooks.filter((entry) => {
|
|
55524
55582
|
const refs = extractHookReferencesFromCommand(entry.command);
|
|
55525
55583
|
const targetOwned = commandTargetsHookDir(entry.command, targetHooksDir);
|
|
55584
|
+
const foreignCkOwned = commandTargetsForeignCkHookDir(entry.command, targetHooksDir);
|
|
55526
55585
|
const incompatible = !isCodexSupportedHookEvent(event) || refs.some((ref) => isExcludedHookAsset(ref));
|
|
55527
|
-
if (targetOwned && incompatible) {
|
|
55586
|
+
if (foreignCkOwned || targetOwned && incompatible) {
|
|
55528
55587
|
hooksPruned += 1;
|
|
55529
55588
|
return false;
|
|
55530
55589
|
}
|
|
@@ -55569,10 +55628,44 @@ function commandTargetsHookDir(command, targetHooksDir) {
|
|
|
55569
55628
|
const normalizedDir = targetHooksDir.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
55570
55629
|
return normalizedCommand.includes(`${normalizedDir}/`) || normalizedCommand.includes("$HOME/.codex/hooks/") || normalizedCommand.includes("~/.codex/hooks/");
|
|
55571
55630
|
}
|
|
55631
|
+
function commandTargetsForeignCkHookDir(command, targetHooksDir) {
|
|
55632
|
+
const normalizedCommand = command.replace(/\\/g, "/");
|
|
55633
|
+
const normalizedDir = targetHooksDir.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
55634
|
+
const targetTokens = [
|
|
55635
|
+
`${normalizedDir}/`,
|
|
55636
|
+
"$HOME/.codex/hooks/",
|
|
55637
|
+
"~/.codex/hooks/",
|
|
55638
|
+
".codex/hooks/"
|
|
55639
|
+
];
|
|
55640
|
+
if (targetTokens.some((token) => normalizedCommand.includes(token)))
|
|
55641
|
+
return false;
|
|
55642
|
+
return normalizedCommand.includes("$HOME/.claude/hooks/") || normalizedCommand.includes("~/.claude/hooks/") || normalizedCommand.includes(".claude/hooks/");
|
|
55643
|
+
}
|
|
55572
55644
|
function isCkManagedHookPath(absPath) {
|
|
55573
55645
|
const normalized = absPath.replace(/\\/g, "/");
|
|
55574
55646
|
return normalized.includes("/.claude/hooks/") || normalized.includes("/.codex/hooks/") || normalized.includes("/.gemini/hooks/");
|
|
55575
55647
|
}
|
|
55648
|
+
function readCodexWrapperOriginalHookPath(wrapperPath) {
|
|
55649
|
+
try {
|
|
55650
|
+
const content = readFileSync8(wrapperPath, "utf8");
|
|
55651
|
+
const match = content.match(/const\s+ORIGINAL_HOOK\s*=\s*("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/);
|
|
55652
|
+
if (!match)
|
|
55653
|
+
return null;
|
|
55654
|
+
const literal = match[1];
|
|
55655
|
+
if (literal.startsWith('"')) {
|
|
55656
|
+
return JSON.parse(literal);
|
|
55657
|
+
}
|
|
55658
|
+
return literal.slice(1, -1).replace(/\\'/g, "'").replace(/\\\\/g, "\\");
|
|
55659
|
+
} catch {
|
|
55660
|
+
return null;
|
|
55661
|
+
}
|
|
55662
|
+
}
|
|
55663
|
+
function codexWrapperReferencesMissingOriginal(wrapperPath) {
|
|
55664
|
+
const originalPath = readCodexWrapperOriginalHookPath(wrapperPath);
|
|
55665
|
+
if (!originalPath || !isCkManagedHookPath(originalPath))
|
|
55666
|
+
return false;
|
|
55667
|
+
return !existsSync27(originalPath);
|
|
55668
|
+
}
|
|
55576
55669
|
function extractAbsolutePaths(command) {
|
|
55577
55670
|
const matches = [];
|
|
55578
55671
|
const pathPattern = /(?:^|[\s"'(])(\/[^\s"'()]+)/g;
|
|
@@ -55593,7 +55686,7 @@ function pruneStaleFileHooks(existing) {
|
|
|
55593
55686
|
const ckPaths = paths.filter(isCkManagedHookPath);
|
|
55594
55687
|
if (ckPaths.length === 0)
|
|
55595
55688
|
return true;
|
|
55596
|
-
return ckPaths.some((p) => existsSync27(p));
|
|
55689
|
+
return ckPaths.some((p) => existsSync27(p) && !codexWrapperReferencesMissingOriginal(p));
|
|
55597
55690
|
});
|
|
55598
55691
|
if (survivingHooks.length > 0) {
|
|
55599
55692
|
prunedGroups.push({ ...group, hooks: survivingHooks });
|
|
@@ -55658,7 +55751,7 @@ async function migrateHooksSettings(options2) {
|
|
|
55658
55751
|
targetSettingsPath: null
|
|
55659
55752
|
};
|
|
55660
55753
|
}
|
|
55661
|
-
const sourceSettingsPath = isGlobal ? sourceConfig.settingsJsonPath?.globalPath : sourceConfig.settingsJsonPath?.projectPath;
|
|
55754
|
+
const sourceSettingsPath = options2.sourceSettingsPath ?? (isGlobal ? sourceConfig.settingsJsonPath?.globalPath : sourceConfig.settingsJsonPath?.projectPath);
|
|
55662
55755
|
const targetSettingsPath = isGlobal ? targetConfig.settingsJsonPath?.globalPath : targetConfig.settingsJsonPath?.projectPath;
|
|
55663
55756
|
if (!sourceSettingsPath) {
|
|
55664
55757
|
return {
|
|
@@ -55682,7 +55775,7 @@ async function migrateHooksSettings(options2) {
|
|
|
55682
55775
|
targetSettingsPath: null
|
|
55683
55776
|
};
|
|
55684
55777
|
}
|
|
55685
|
-
const resolvedSourcePath =
|
|
55778
|
+
const resolvedSourcePath = resolveSettingsPath(sourceSettingsPath, isGlobal);
|
|
55686
55779
|
const resolvedTargetPath = isGlobal ? targetSettingsPath : join45(process.cwd(), targetSettingsPath);
|
|
55687
55780
|
const sourceHooksResult = await inspectHooksSettings(resolvedSourcePath);
|
|
55688
55781
|
if (sourceHooksResult.status === "missing-file") {
|
|
@@ -55730,14 +55823,15 @@ async function migrateHooksSettings(options2) {
|
|
|
55730
55823
|
targetSettingsPath: resolvedTargetPath
|
|
55731
55824
|
};
|
|
55732
55825
|
}
|
|
55733
|
-
const
|
|
55826
|
+
const providerSourceHooksDir = isGlobal ? sourceConfig.hooks?.globalPath ?? "" : sourceConfig.hooks?.projectPath ?? "";
|
|
55827
|
+
const sourceHooksDirs = collectSourceHookDirs(options2.sourceHooksDir, providerSourceHooksDir);
|
|
55734
55828
|
const targetHooksDir = isGlobal ? targetConfig.hooks?.globalPath ?? "" : targetConfig.hooks?.projectPath ?? "";
|
|
55735
55829
|
const warnings = [];
|
|
55736
55830
|
const filtered = filterToInstalledHooks(sourceHooks, installedHookFiles, {
|
|
55737
55831
|
targetProvider,
|
|
55738
55832
|
warnings
|
|
55739
55833
|
});
|
|
55740
|
-
const rewritten =
|
|
55834
|
+
const rewritten = rewriteHookPathsFromSourceDirs(filtered, sourceHooksDirs, targetHooksDir);
|
|
55741
55835
|
const eventMapped = mapHookEventsForProvider(rewritten, targetProvider);
|
|
55742
55836
|
let hooksRegistered = 0;
|
|
55743
55837
|
for (const groups of Object.values(eventMapped)) {
|
|
@@ -55815,7 +55909,7 @@ async function migrateHooksSettingsForCodex(options2) {
|
|
|
55815
55909
|
};
|
|
55816
55910
|
}
|
|
55817
55911
|
const capabilities = await detectCodexCapabilities();
|
|
55818
|
-
const sourceSettingsPath = isGlobal ? sourceConfig.settingsJsonPath.globalPath : sourceConfig.settingsJsonPath.projectPath;
|
|
55912
|
+
const sourceSettingsPath = options2.sourceSettingsPath ?? (isGlobal ? sourceConfig.settingsJsonPath.globalPath : sourceConfig.settingsJsonPath.projectPath);
|
|
55819
55913
|
const targetSettingsPath = isGlobal ? codexConfig.settingsJsonPath?.globalPath ?? null : codexConfig.settingsJsonPath?.projectPath ?? null;
|
|
55820
55914
|
if (!targetSettingsPath) {
|
|
55821
55915
|
return {
|
|
@@ -55828,7 +55922,7 @@ async function migrateHooksSettingsForCodex(options2) {
|
|
|
55828
55922
|
targetSettingsPath: null
|
|
55829
55923
|
};
|
|
55830
55924
|
}
|
|
55831
|
-
const resolvedSourcePath =
|
|
55925
|
+
const resolvedSourcePath = resolveSettingsPath(sourceSettingsPath, isGlobal);
|
|
55832
55926
|
const resolvedTargetPath = isGlobal ? targetSettingsPath : join45(process.cwd(), targetSettingsPath);
|
|
55833
55927
|
const projectDir = isGlobal ? undefined : process.cwd();
|
|
55834
55928
|
const sourceHooksResult = await inspectHooksSettings(resolvedSourcePath);
|
|
@@ -55875,7 +55969,9 @@ async function migrateHooksSettingsForCodex(options2) {
|
|
|
55875
55969
|
warnings
|
|
55876
55970
|
});
|
|
55877
55971
|
const targetHooksDir = isGlobal ? codexConfig.hooks?.globalPath ?? "" : codexConfig.hooks?.projectPath ?? "";
|
|
55878
|
-
const
|
|
55972
|
+
const providerSourceHooksDir = isGlobal ? sourceConfig.hooks?.globalPath ?? "" : sourceConfig.hooks?.projectPath ?? "";
|
|
55973
|
+
const sourceHooksDir = options2.sourceHooksDir ?? providerSourceHooksDir;
|
|
55974
|
+
const sourceHookCommandDirs = collectSourceHookDirs(options2.sourceHooksDir, providerSourceHooksDir);
|
|
55879
55975
|
const wrapperPaths = [];
|
|
55880
55976
|
const commandSubstitutions = new Map;
|
|
55881
55977
|
if (installedHookAbsolutePaths && installedHookAbsolutePaths.length > 0 && targetHooksDir) {
|
|
@@ -55891,11 +55987,11 @@ async function migrateHooksSettingsForCodex(options2) {
|
|
|
55891
55987
|
addKey(join45(targetHooksDir, base));
|
|
55892
55988
|
addKey(`./${join45(targetHooksDir, base)}`);
|
|
55893
55989
|
}
|
|
55894
|
-
|
|
55895
|
-
const sourceAbs = join45(resolve20(
|
|
55990
|
+
for (const commandSourceHooksDir of sourceHookCommandDirs) {
|
|
55991
|
+
const sourceAbs = join45(resolve20(commandSourceHooksDir), base);
|
|
55896
55992
|
addKey(sourceAbs);
|
|
55897
|
-
addKey(join45(
|
|
55898
|
-
addKey(`./${join45(
|
|
55993
|
+
addKey(join45(commandSourceHooksDir, base));
|
|
55994
|
+
addKey(`./${join45(commandSourceHooksDir, base)}`);
|
|
55899
55995
|
if (sourceAbs.startsWith("/private/")) {
|
|
55900
55996
|
addKey(sourceAbs.slice("/private".length));
|
|
55901
55997
|
} else if (sourceAbs.startsWith("/var/")) {
|
|
@@ -55905,7 +56001,8 @@ async function migrateHooksSettingsForCodex(options2) {
|
|
|
55905
56001
|
}
|
|
55906
56002
|
}
|
|
55907
56003
|
}
|
|
55908
|
-
|
|
56004
|
+
const pathRewriteSourceDir = providerSourceHooksDir || sourceHooksDir;
|
|
56005
|
+
if (!pathRewriteSourceDir) {
|
|
55909
56006
|
const convertedNoRewrite = convertClaudeHooksToCodex(filtered, capabilities);
|
|
55910
56007
|
let hooksRegisteredNoRewrite = 0;
|
|
55911
56008
|
for (const groups of Object.values(convertedNoRewrite)) {
|
|
@@ -55944,7 +56041,7 @@ async function migrateHooksSettingsForCodex(options2) {
|
|
|
55944
56041
|
}
|
|
55945
56042
|
const effectiveTargetDir = targetHooksDir || sourceHooksDir;
|
|
55946
56043
|
const converted = convertClaudeHooksToCodex(filtered, capabilities, {
|
|
55947
|
-
sourceDir:
|
|
56044
|
+
sourceDir: pathRewriteSourceDir,
|
|
55948
56045
|
targetDir: effectiveTargetDir,
|
|
55949
56046
|
commandSubstitutions: commandSubstitutions.size > 0 ? commandSubstitutions : undefined,
|
|
55950
56047
|
projectDir
|
|
@@ -56055,7 +56152,7 @@ var init_generated_context_hooks = __esm(() => {
|
|
|
56055
56152
|
// src/commands/portable/migrated-hook-settings-cleanup.ts
|
|
56056
56153
|
import { existsSync as existsSync28, realpathSync } from "node:fs";
|
|
56057
56154
|
import { readFile as readFile23, rename as rename9, rm as rm7, unlink as unlink7, writeFile as writeFile14 } from "node:fs/promises";
|
|
56058
|
-
import { basename as basename16, isAbsolute as
|
|
56155
|
+
import { basename as basename16, isAbsolute as isAbsolute7, relative as relative10, resolve as resolve21 } from "node:path";
|
|
56059
56156
|
async function pruneSettingsHooks(settingsPath, hooksDir) {
|
|
56060
56157
|
const filesToRemove = new Set;
|
|
56061
56158
|
const warnings = [];
|
|
@@ -56138,7 +56235,7 @@ function hookFilesFromCommand(command, hooksDir) {
|
|
|
56138
56235
|
const name = basename16(cleaned);
|
|
56139
56236
|
if (!name || !isGeneratedContextHookName(name))
|
|
56140
56237
|
continue;
|
|
56141
|
-
if (
|
|
56238
|
+
if (isAbsolute7(cleaned) && isPathWithin(cleaned, hooksDir))
|
|
56142
56239
|
files.add(resolve21(cleaned));
|
|
56143
56240
|
else if (referencesHooksDir(cleaned, hooksDir) || cleaned.includes(".claude/hooks/")) {
|
|
56144
56241
|
files.add(resolve21(hooksDir, name));
|
|
@@ -56153,7 +56250,7 @@ function referencesHooksDir(command, hooksDir) {
|
|
|
56153
56250
|
}
|
|
56154
56251
|
function isPathWithin(filePath, parentDir) {
|
|
56155
56252
|
const rel = relative10(resolvePathForContainment(parentDir), resolvePathForContainment(filePath));
|
|
56156
|
-
return rel === "" || !!rel && !rel.startsWith("..") && !
|
|
56253
|
+
return rel === "" || !!rel && !rel.startsWith("..") && !isAbsolute7(rel);
|
|
56157
56254
|
}
|
|
56158
56255
|
function resolvePathForContainment(pathValue) {
|
|
56159
56256
|
try {
|
|
@@ -56186,7 +56283,7 @@ __export(exports_migrated_hooks_cleanup, {
|
|
|
56186
56283
|
isGeneratedContextHookName: () => isGeneratedContextHookName,
|
|
56187
56284
|
cleanupMigratedHooksForProviders: () => cleanupMigratedHooksForProviders
|
|
56188
56285
|
});
|
|
56189
|
-
import { isAbsolute as
|
|
56286
|
+
import { isAbsolute as isAbsolute8, resolve as resolve22 } from "node:path";
|
|
56190
56287
|
async function cleanupMigratedHooksForProviders(providerIds, options2) {
|
|
56191
56288
|
const uniqueProviders = Array.from(new Set(providerIds));
|
|
56192
56289
|
const results = [];
|
|
@@ -56240,7 +56337,7 @@ async function cleanupMigratedHooksForProvider(provider, options2) {
|
|
|
56240
56337
|
function resolveProviderPath(pathValue) {
|
|
56241
56338
|
if (!pathValue)
|
|
56242
56339
|
return null;
|
|
56243
|
-
return
|
|
56340
|
+
return isAbsolute8(pathValue) ? pathValue : resolve22(process.cwd(), pathValue);
|
|
56244
56341
|
}
|
|
56245
56342
|
var init_migrated_hooks_cleanup = __esm(() => {
|
|
56246
56343
|
init_generated_context_hooks();
|
|
@@ -59296,10 +59393,10 @@ var init_migration_routes = __esm(() => {
|
|
|
59296
59393
|
});
|
|
59297
59394
|
|
|
59298
59395
|
// src/domains/plan-parser/plan-metadata.ts
|
|
59299
|
-
import { readFileSync as
|
|
59396
|
+
import { readFileSync as readFileSync9, statSync as statSync7 } from "node:fs";
|
|
59300
59397
|
function readMatter(filePath) {
|
|
59301
59398
|
try {
|
|
59302
|
-
return import_gray_matter6.default(
|
|
59399
|
+
return import_gray_matter6.default(readFileSync9(filePath, "utf8")).data;
|
|
59303
59400
|
} catch {
|
|
59304
59401
|
return {};
|
|
59305
59402
|
}
|
|
@@ -59406,7 +59503,7 @@ var init_plan_metadata = __esm(() => {
|
|
|
59406
59503
|
});
|
|
59407
59504
|
|
|
59408
59505
|
// src/domains/plan-parser/plan-table-parser.ts
|
|
59409
|
-
import { readFileSync as
|
|
59506
|
+
import { readFileSync as readFileSync10 } from "node:fs";
|
|
59410
59507
|
import { dirname as dirname18, resolve as resolve24 } from "node:path";
|
|
59411
59508
|
function normalizeStatus(raw) {
|
|
59412
59509
|
const s = raw.toLowerCase().trim();
|
|
@@ -59771,7 +59868,7 @@ function parsePhasesFromBody(body, dir, options2) {
|
|
|
59771
59868
|
return parseFormat6(normalizedBody, dir, options2);
|
|
59772
59869
|
}
|
|
59773
59870
|
function parsePlanFile(planFilePath, options2) {
|
|
59774
|
-
const content =
|
|
59871
|
+
const content = readFileSync10(planFilePath, "utf8");
|
|
59775
59872
|
const dir = dirname18(planFilePath);
|
|
59776
59873
|
const { data: frontmatter, content: body } = import_gray_matter7.default(content, {
|
|
59777
59874
|
engines: { javascript: { parse: () => ({}) } }
|
|
@@ -59919,13 +60016,13 @@ var init_plan_scanner = () => {};
|
|
|
59919
60016
|
|
|
59920
60017
|
// src/domains/plan-parser/plan-scope.ts
|
|
59921
60018
|
import { homedir as homedir29 } from "node:os";
|
|
59922
|
-
import { isAbsolute as
|
|
60019
|
+
import { isAbsolute as isAbsolute9, join as join50, relative as relative12, resolve as resolve25 } from "node:path";
|
|
59923
60020
|
function resolveConfiguredDir(configuredPath, baseDir) {
|
|
59924
60021
|
const trimmed = configuredPath?.trim();
|
|
59925
60022
|
if (!trimmed) {
|
|
59926
60023
|
return join50(baseDir, DEFAULT_PLANS_DIRNAME);
|
|
59927
60024
|
}
|
|
59928
|
-
return
|
|
60025
|
+
return isAbsolute9(trimmed) ? resolve25(trimmed) : resolve25(baseDir, trimmed);
|
|
59929
60026
|
}
|
|
59930
60027
|
function resolveProjectPlansDir(projectRoot, config) {
|
|
59931
60028
|
return resolveConfiguredDir(config?.paths?.plans, projectRoot);
|
|
@@ -59940,7 +60037,7 @@ function isWithinDir(targetPath, baseDir) {
|
|
|
59940
60037
|
const resolvedTarget = resolve25(targetPath);
|
|
59941
60038
|
const resolvedBase = resolve25(baseDir);
|
|
59942
60039
|
const relativePath = relative12(resolvedBase, resolvedTarget);
|
|
59943
|
-
return relativePath === "" || !relativePath.startsWith("..") && relativePath !== ".." && !
|
|
60040
|
+
return relativePath === "" || !relativePath.startsWith("..") && relativePath !== ".." && !isAbsolute9(relativePath);
|
|
59944
60041
|
}
|
|
59945
60042
|
function inferPlanScopeForDir(planDir, config) {
|
|
59946
60043
|
return isWithinDir(planDir, resolveGlobalPlansDir(config)) ? "global" : "project";
|
|
@@ -59949,7 +60046,7 @@ function parsePlanReference(reference, defaultScope) {
|
|
|
59949
60046
|
const trimmed = reference.trim();
|
|
59950
60047
|
const normalizePlanId = (rawPlanId) => {
|
|
59951
60048
|
const planId = rawPlanId.trim();
|
|
59952
|
-
const valid = planId.length > 0 && !
|
|
60049
|
+
const valid = planId.length > 0 && !isAbsolute9(planId) && !planId.includes("/") && !planId.includes("\\") && PLAN_ID_PATTERN.test(planId);
|
|
59953
60050
|
return { planId, valid };
|
|
59954
60051
|
};
|
|
59955
60052
|
if (trimmed.startsWith(GLOBAL_PLAN_PREFIX)) {
|
|
@@ -60067,10 +60164,10 @@ var init_timeline_builder = __esm(() => {
|
|
|
60067
60164
|
});
|
|
60068
60165
|
|
|
60069
60166
|
// src/domains/plan-parser/plan-validator.ts
|
|
60070
|
-
import { existsSync as existsSync34, readFileSync as
|
|
60167
|
+
import { existsSync as existsSync34, readFileSync as readFileSync11 } from "node:fs";
|
|
60071
60168
|
import { basename as basename18, dirname as dirname19 } from "node:path";
|
|
60072
60169
|
function validatePlanFile(filePath, strict = false) {
|
|
60073
|
-
const rawContent =
|
|
60170
|
+
const rawContent = readFileSync11(filePath, "utf8");
|
|
60074
60171
|
const content = rawContent.replace(/\r\n/g, `
|
|
60075
60172
|
`);
|
|
60076
60173
|
const dir = dirname19(filePath);
|
|
@@ -60137,7 +60234,7 @@ var init_plan_validator = __esm(() => {
|
|
|
60137
60234
|
|
|
60138
60235
|
// src/domains/plan-parser/plan-writer.ts
|
|
60139
60236
|
import { execSync } from "node:child_process";
|
|
60140
|
-
import { mkdirSync as mkdirSync2, readFileSync as
|
|
60237
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync12, writeFileSync as writeFileSync3 } from "node:fs";
|
|
60141
60238
|
import { existsSync as existsSync35 } from "node:fs";
|
|
60142
60239
|
import { basename as basename19, dirname as dirname20, join as join52 } from "node:path";
|
|
60143
60240
|
function phaseNameToFilename(id, name) {
|
|
@@ -60310,7 +60407,7 @@ function isCanonicalFormat(content) {
|
|
|
60310
60407
|
return /^\|\s*phase\s*\|\s*name\s*\|\s*status\s*\|/im.test(content);
|
|
60311
60408
|
}
|
|
60312
60409
|
function updatePhaseStatus(planFile, phaseId, newStatus) {
|
|
60313
|
-
const raw =
|
|
60410
|
+
const raw = readFileSync12(planFile, "utf8").replace(/\r\n/g, `
|
|
60314
60411
|
`);
|
|
60315
60412
|
if (!isCanonicalFormat(raw)) {
|
|
60316
60413
|
console.error("[!] plan.md is not in canonical format — skipping status update");
|
|
@@ -60372,7 +60469,7 @@ function phaseNameFilenameFromTableRow(body, phaseId, planDir) {
|
|
|
60372
60469
|
return null;
|
|
60373
60470
|
}
|
|
60374
60471
|
function updatePhaseFileFrontmatter(phaseFile, newStatus) {
|
|
60375
|
-
const raw =
|
|
60472
|
+
const raw = readFileSync12(phaseFile, "utf8");
|
|
60376
60473
|
const { data: frontmatter, content: body } = import_gray_matter9.default(raw, {
|
|
60377
60474
|
engines: { javascript: { parse: () => ({}) } }
|
|
60378
60475
|
});
|
|
@@ -60380,7 +60477,7 @@ function updatePhaseFileFrontmatter(phaseFile, newStatus) {
|
|
|
60380
60477
|
writeFileSync3(phaseFile, import_gray_matter9.default.stringify(body, updated), "utf8");
|
|
60381
60478
|
}
|
|
60382
60479
|
function addPhase(planFile, name, afterId) {
|
|
60383
|
-
const raw =
|
|
60480
|
+
const raw = readFileSync12(planFile, "utf8").replace(/\r\n/g, `
|
|
60384
60481
|
`);
|
|
60385
60482
|
if (!isCanonicalFormat(raw)) {
|
|
60386
60483
|
console.error("[!] plan.md is not in canonical format — cannot add phase");
|
|
@@ -60725,12 +60822,12 @@ var init_plan_types = __esm(() => {
|
|
|
60725
60822
|
import {
|
|
60726
60823
|
existsSync as existsSync36,
|
|
60727
60824
|
mkdirSync as mkdirSync3,
|
|
60728
|
-
readFileSync as
|
|
60825
|
+
readFileSync as readFileSync13,
|
|
60729
60826
|
renameSync,
|
|
60730
60827
|
unlinkSync,
|
|
60731
60828
|
writeFileSync as writeFileSync4
|
|
60732
60829
|
} from "node:fs";
|
|
60733
|
-
import { dirname as dirname22, isAbsolute as
|
|
60830
|
+
import { dirname as dirname22, isAbsolute as isAbsolute10, join as join53, parse as parse2, relative as relative13, resolve as resolve26 } from "node:path";
|
|
60734
60831
|
function createEmptyRegistry() {
|
|
60735
60832
|
return {
|
|
60736
60833
|
version: 1,
|
|
@@ -60756,7 +60853,7 @@ function migrateFromProjectLocal(cwd2, globalPath) {
|
|
|
60756
60853
|
return;
|
|
60757
60854
|
}
|
|
60758
60855
|
try {
|
|
60759
|
-
const oldData = JSON.parse(
|
|
60856
|
+
const oldData = JSON.parse(readFileSync13(oldPath, "utf8"));
|
|
60760
60857
|
if (oldData && typeof oldData === "object" && Array.isArray(oldData.plans)) {
|
|
60761
60858
|
const migrated = {
|
|
60762
60859
|
version: 1,
|
|
@@ -60785,7 +60882,7 @@ function migrateFromProjectLocal(cwd2, globalPath) {
|
|
|
60785
60882
|
}
|
|
60786
60883
|
}
|
|
60787
60884
|
function normalizeRegistryDir(cwd2, dir) {
|
|
60788
|
-
const absoluteDir =
|
|
60885
|
+
const absoluteDir = isAbsolute10(dir) ? dir : resolve26(cwd2, dir);
|
|
60789
60886
|
const relativeDir = relative13(cwd2, absoluteDir) || dir;
|
|
60790
60887
|
return relativeDir.replace(/\\/g, "/");
|
|
60791
60888
|
}
|
|
@@ -60807,7 +60904,7 @@ function readRegistry(cwd2 = process.cwd()) {
|
|
|
60807
60904
|
return createEmptyRegistry();
|
|
60808
60905
|
}
|
|
60809
60906
|
try {
|
|
60810
|
-
const parsed = PlansRegistrySchema.safeParse(JSON.parse(
|
|
60907
|
+
const parsed = PlansRegistrySchema.safeParse(JSON.parse(readFileSync13(globalPath, "utf8")));
|
|
60811
60908
|
return parsed.success ? parsed.data : createEmptyRegistry();
|
|
60812
60909
|
} catch {
|
|
60813
60910
|
return createEmptyRegistry();
|
|
@@ -60820,7 +60917,7 @@ function writeRegistry(registry, cwd2 = process.cwd()) {
|
|
|
60820
60917
|
mkdirSync3(dirname22(globalPath), { recursive: true });
|
|
60821
60918
|
if (existsSync36(globalPath)) {
|
|
60822
60919
|
try {
|
|
60823
|
-
writeFileSync4(`${globalPath}.bak`,
|
|
60920
|
+
writeFileSync4(`${globalPath}.bak`, readFileSync13(globalPath));
|
|
60824
60921
|
} catch {}
|
|
60825
60922
|
}
|
|
60826
60923
|
const tempPath = `${globalPath}.tmp-${process.pid}-${Date.now()}`;
|
|
@@ -61202,7 +61299,7 @@ var init_p_limit = __esm(() => {
|
|
|
61202
61299
|
});
|
|
61203
61300
|
|
|
61204
61301
|
// src/domains/web-server/routes/plan-routes.ts
|
|
61205
|
-
import { existsSync as existsSync37, readFileSync as
|
|
61302
|
+
import { existsSync as existsSync37, readFileSync as readFileSync14, realpathSync as realpathSync2 } from "node:fs";
|
|
61206
61303
|
import { homedir as homedir30 } from "node:os";
|
|
61207
61304
|
import { basename as basename20, dirname as dirname24, join as join55, relative as relative14, resolve as resolve27, sep as sep8 } from "node:path";
|
|
61208
61305
|
function sanitizeError(err) {
|
|
@@ -61251,7 +61348,7 @@ function getGlobalPlanRoot() {
|
|
|
61251
61348
|
if (!existsSync37(configPath)) {
|
|
61252
61349
|
value = resolveGlobalPlansDir();
|
|
61253
61350
|
} else {
|
|
61254
|
-
const raw = JSON.parse(
|
|
61351
|
+
const raw = JSON.parse(readFileSync14(configPath, "utf8"));
|
|
61255
61352
|
const parsed = CkConfigSchema.parse(normalizeCkConfigInput(raw));
|
|
61256
61353
|
value = resolveGlobalPlansDir(parsed);
|
|
61257
61354
|
}
|
|
@@ -61581,7 +61678,7 @@ function registerPlanRoutes(app) {
|
|
|
61581
61678
|
return;
|
|
61582
61679
|
}
|
|
61583
61680
|
try {
|
|
61584
|
-
const raw =
|
|
61681
|
+
const raw = readFileSync14(file, "utf8");
|
|
61585
61682
|
const parsed = import_gray_matter10.default(raw);
|
|
61586
61683
|
res.json({
|
|
61587
61684
|
file: relative14(process.cwd(), file),
|
|
@@ -63153,12 +63250,12 @@ function getCliVersion3() {
|
|
|
63153
63250
|
if (process.env.npm_package_version) {
|
|
63154
63251
|
return process.env.npm_package_version;
|
|
63155
63252
|
}
|
|
63156
|
-
const { readFileSync:
|
|
63253
|
+
const { readFileSync: readFileSync15 } = __require("node:fs");
|
|
63157
63254
|
const { dirname: dirname27, join: joinPath } = __require("node:path");
|
|
63158
63255
|
const { fileURLToPath: fileURLToPath2 } = __require("node:url");
|
|
63159
63256
|
const __dirname3 = dirname27(fileURLToPath2(import.meta.url));
|
|
63160
63257
|
const pkgPath = joinPath(__dirname3, "../../../package.json");
|
|
63161
|
-
const pkg = JSON.parse(
|
|
63258
|
+
const pkg = JSON.parse(readFileSync15(pkgPath, "utf-8"));
|
|
63162
63259
|
return pkg.version || "unknown";
|
|
63163
63260
|
} catch {
|
|
63164
63261
|
return "unknown";
|
|
@@ -64421,7 +64518,7 @@ var package_default;
|
|
|
64421
64518
|
var init_package = __esm(() => {
|
|
64422
64519
|
package_default = {
|
|
64423
64520
|
name: "claudekit-cli",
|
|
64424
|
-
version: "4.5.0-dev.
|
|
64521
|
+
version: "4.5.0-dev.7",
|
|
64425
64522
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
64426
64523
|
type: "module",
|
|
64427
64524
|
repository: {
|
|
@@ -64923,7 +65020,7 @@ var init_package_manager_runner = __esm(() => {
|
|
|
64923
65020
|
// src/domains/installation/merger/zombie-wirings-pruner.ts
|
|
64924
65021
|
import { existsSync as existsSync45, readdirSync as readdirSync8 } from "node:fs";
|
|
64925
65022
|
import { homedir as homedir39 } from "node:os";
|
|
64926
|
-
import { basename as basename23, dirname as dirname28, isAbsolute as
|
|
65023
|
+
import { basename as basename23, dirname as dirname28, isAbsolute as isAbsolute11, resolve as resolve32, sep as sep10 } from "node:path";
|
|
64927
65024
|
function pruneZombieEngineerWirings(settings, hookDir, preserveCommands = new Set) {
|
|
64928
65025
|
const pruned = [];
|
|
64929
65026
|
const normalizedPreserveCommands = new Set(Array.from(preserveCommands).map((command) => normalizeCommand(command)));
|
|
@@ -65021,7 +65118,7 @@ function extractHookFilePath(command, hookDir) {
|
|
|
65021
65118
|
const bashMatch = command.match(/^bash\s+["']([^"']+\.sh)["']/);
|
|
65022
65119
|
if (bashMatch) {
|
|
65023
65120
|
const rawPath = bashMatch[1].replace(/\\/g, "/");
|
|
65024
|
-
const resolved =
|
|
65121
|
+
const resolved = isAbsolute11(rawPath) || /^[A-Za-z]:[\\/]/.test(rawPath) ? rawPath : resolve32(hookDir, rawPath);
|
|
65025
65122
|
return process.platform === "win32" ? resolved.replace(/\//g, sep10) : resolved;
|
|
65026
65123
|
}
|
|
65027
65124
|
return null;
|
|
@@ -65043,7 +65140,7 @@ function extractHookFilePath(command, hookDir) {
|
|
|
65043
65140
|
return process.platform === "win32" ? resolved.replace(/\//g, sep10) : resolved;
|
|
65044
65141
|
}
|
|
65045
65142
|
const tildeResolved = rawArg.replace(/^~(?=\/)/, home5);
|
|
65046
|
-
if (
|
|
65143
|
+
if (isAbsolute11(tildeResolved) || /^[A-Za-z]:[\\/]/.test(tildeResolved)) {
|
|
65047
65144
|
return process.platform === "win32" ? tildeResolved.replace(/\//g, sep10) : tildeResolved;
|
|
65048
65145
|
}
|
|
65049
65146
|
return resolve32(hookDir, tildeResolved);
|
|
@@ -65057,7 +65154,7 @@ function extractHookFilePath(command, hookDir) {
|
|
|
65057
65154
|
return process.platform === "win32" ? resolved.replace(/\//g, sep10) : resolved;
|
|
65058
65155
|
}
|
|
65059
65156
|
const tildeResolved = rawArg.replace(/^~(?=\/)/, home5);
|
|
65060
|
-
if (
|
|
65157
|
+
if (isAbsolute11(tildeResolved) || /^[A-Za-z]:[\\/]/.test(tildeResolved)) {
|
|
65061
65158
|
return process.platform === "win32" ? tildeResolved.replace(/\//g, sep10) : tildeResolved;
|
|
65062
65159
|
}
|
|
65063
65160
|
return resolve32(hookDir, tildeResolved);
|
|
@@ -65080,7 +65177,7 @@ var init_shared2 = __esm(() => {
|
|
|
65080
65177
|
|
|
65081
65178
|
// src/domains/health-checks/checkers/hook-health-checker.ts
|
|
65082
65179
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
65083
|
-
import { existsSync as existsSync46, readFileSync as
|
|
65180
|
+
import { existsSync as existsSync46, readFileSync as readFileSync15, readdirSync as readdirSync9, statSync as statSync10, writeFileSync as writeFileSync5 } from "node:fs";
|
|
65084
65181
|
import { readdir as readdir17 } from "node:fs/promises";
|
|
65085
65182
|
import { homedir as homedir40, tmpdir } from "node:os";
|
|
65086
65183
|
import { dirname as dirname29, join as join65, resolve as resolve33, sep as sep11 } from "node:path";
|
|
@@ -65120,7 +65217,7 @@ function readManagedHookNamesForClaudeDir(claudeDir3) {
|
|
|
65120
65217
|
if (!existsSync46(manifestPath))
|
|
65121
65218
|
return new Set;
|
|
65122
65219
|
try {
|
|
65123
|
-
const data = JSON.parse(
|
|
65220
|
+
const data = JSON.parse(readFileSync15(manifestPath, "utf-8"));
|
|
65124
65221
|
if (!Array.isArray(data.managedHooks))
|
|
65125
65222
|
return new Set;
|
|
65126
65223
|
return new Set(data.managedHooks.filter((name) => typeof name === "string"));
|
|
@@ -65591,7 +65688,7 @@ async function checkHookDeps(projectDir) {
|
|
|
65591
65688
|
const filePath = join65(hooksDir, file);
|
|
65592
65689
|
if (!isPathWithin2(filePath, hooksDir))
|
|
65593
65690
|
continue;
|
|
65594
|
-
const content =
|
|
65691
|
+
const content = readFileSync15(filePath, "utf-8");
|
|
65595
65692
|
for (let match = requireRegex.exec(content);match !== null; match = requireRegex.exec(content)) {
|
|
65596
65693
|
const depPath = match[1];
|
|
65597
65694
|
if (depPath.startsWith("node:") || isNodeBuiltin(depPath)) {
|
|
@@ -66140,7 +66237,7 @@ async function checkHookConfig(projectDir) {
|
|
|
66140
66237
|
};
|
|
66141
66238
|
}
|
|
66142
66239
|
try {
|
|
66143
|
-
const configContent =
|
|
66240
|
+
const configContent = readFileSync15(configPath, "utf-8");
|
|
66144
66241
|
const config = JSON.parse(configContent);
|
|
66145
66242
|
if (!config.hooks || typeof config.hooks !== "object") {
|
|
66146
66243
|
return {
|
|
@@ -66276,7 +66373,7 @@ async function checkHookLogs(projectDir) {
|
|
|
66276
66373
|
}
|
|
66277
66374
|
};
|
|
66278
66375
|
}
|
|
66279
|
-
const logContent =
|
|
66376
|
+
const logContent = readFileSync15(logPath, "utf-8");
|
|
66280
66377
|
const lines = logContent.trim().split(`
|
|
66281
66378
|
`).filter(Boolean);
|
|
66282
66379
|
const now = Date.now();
|
|
@@ -74784,6 +74881,164 @@ var init_process_executor = __esm(() => {
|
|
|
74784
74881
|
execFileAsync7 = promisify15(execFile10);
|
|
74785
74882
|
});
|
|
74786
74883
|
|
|
74884
|
+
// src/services/package-installer/agy-installer.ts
|
|
74885
|
+
import { join as join90 } from "node:path";
|
|
74886
|
+
async function isAgyInstalled() {
|
|
74887
|
+
try {
|
|
74888
|
+
await execAsync7("agy --version", { timeout: 1e4 });
|
|
74889
|
+
return true;
|
|
74890
|
+
} catch {
|
|
74891
|
+
return false;
|
|
74892
|
+
}
|
|
74893
|
+
}
|
|
74894
|
+
async function installAgyUnix() {
|
|
74895
|
+
const { unlink: unlink13 } = await import("node:fs/promises");
|
|
74896
|
+
const { tmpdir: tmpdir4 } = await import("node:os");
|
|
74897
|
+
const tempScriptPath = join90(tmpdir4(), "agy-install.sh");
|
|
74898
|
+
try {
|
|
74899
|
+
logger.info("Downloading Antigravity CLI installation script...");
|
|
74900
|
+
await execFileAsync7("curl", ["-fsSL", AGY_INSTALL_SH_URL, "-o", tempScriptPath], {
|
|
74901
|
+
timeout: 30000
|
|
74902
|
+
});
|
|
74903
|
+
await execFileAsync7("chmod", ["+x", tempScriptPath], { timeout: 5000 });
|
|
74904
|
+
logger.info("Executing Antigravity CLI installation script...");
|
|
74905
|
+
await execFileAsync7("bash", [tempScriptPath], {
|
|
74906
|
+
timeout: 120000
|
|
74907
|
+
});
|
|
74908
|
+
} finally {
|
|
74909
|
+
try {
|
|
74910
|
+
await unlink13(tempScriptPath);
|
|
74911
|
+
} catch {}
|
|
74912
|
+
}
|
|
74913
|
+
}
|
|
74914
|
+
async function installAgyWindows() {
|
|
74915
|
+
logger.info("Executing Antigravity CLI installation script (PowerShell)...");
|
|
74916
|
+
await execFileAsync7("powershell.exe", ["-NoLogo", "-ExecutionPolicy", "Bypass", "-Command", `irm ${AGY_INSTALL_PS1_URL} | iex`], { timeout: 120000 });
|
|
74917
|
+
}
|
|
74918
|
+
async function installAgy() {
|
|
74919
|
+
const displayName = AGY_DISPLAY_NAME;
|
|
74920
|
+
if (isCIEnvironment()) {
|
|
74921
|
+
logger.info("CI environment detected: skipping Antigravity CLI installation");
|
|
74922
|
+
return {
|
|
74923
|
+
success: false,
|
|
74924
|
+
package: displayName,
|
|
74925
|
+
error: "Installation skipped in CI environment",
|
|
74926
|
+
skipped: true
|
|
74927
|
+
};
|
|
74928
|
+
}
|
|
74929
|
+
try {
|
|
74930
|
+
logger.info(`Installing ${displayName}...`);
|
|
74931
|
+
if (isWindows()) {
|
|
74932
|
+
await installAgyWindows();
|
|
74933
|
+
} else {
|
|
74934
|
+
await installAgyUnix();
|
|
74935
|
+
}
|
|
74936
|
+
const installed = await isAgyInstalled();
|
|
74937
|
+
if (installed) {
|
|
74938
|
+
logger.success(`${displayName} installed successfully`);
|
|
74939
|
+
return {
|
|
74940
|
+
success: true,
|
|
74941
|
+
package: displayName
|
|
74942
|
+
};
|
|
74943
|
+
}
|
|
74944
|
+
const pathHint = isWindows() ? "%LOCALAPPDATA%\\agy\\bin" : "~/.local/bin";
|
|
74945
|
+
logger.warning(`${displayName} installed, but 'agy' is not on your PATH yet. Restart your shell or add "${pathHint}" to PATH.`);
|
|
74946
|
+
return {
|
|
74947
|
+
success: false,
|
|
74948
|
+
package: displayName,
|
|
74949
|
+
error: `Installed but 'agy' not found on PATH. Restart your shell or add "${pathHint}" to PATH.`
|
|
74950
|
+
};
|
|
74951
|
+
} catch (error) {
|
|
74952
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
74953
|
+
logger.error(`Failed to install ${displayName}: ${errorMessage}`);
|
|
74954
|
+
return {
|
|
74955
|
+
success: false,
|
|
74956
|
+
package: displayName,
|
|
74957
|
+
error: errorMessage
|
|
74958
|
+
};
|
|
74959
|
+
}
|
|
74960
|
+
}
|
|
74961
|
+
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";
|
|
74962
|
+
var init_agy_installer = __esm(() => {
|
|
74963
|
+
init_environment();
|
|
74964
|
+
init_logger();
|
|
74965
|
+
init_process_executor();
|
|
74966
|
+
});
|
|
74967
|
+
|
|
74968
|
+
// src/services/package-installer/opencode-installer.ts
|
|
74969
|
+
import { join as join91 } from "node:path";
|
|
74970
|
+
async function isOpenCodeInstalled() {
|
|
74971
|
+
try {
|
|
74972
|
+
await execAsync7("opencode --version", { timeout: 5000 });
|
|
74973
|
+
return true;
|
|
74974
|
+
} catch {
|
|
74975
|
+
return false;
|
|
74976
|
+
}
|
|
74977
|
+
}
|
|
74978
|
+
async function installOpenCode() {
|
|
74979
|
+
const displayName = "OpenCode CLI";
|
|
74980
|
+
if (isCIEnvironment()) {
|
|
74981
|
+
logger.info("CI environment detected: skipping OpenCode installation");
|
|
74982
|
+
return {
|
|
74983
|
+
success: false,
|
|
74984
|
+
package: displayName,
|
|
74985
|
+
error: "Installation skipped in CI environment"
|
|
74986
|
+
};
|
|
74987
|
+
}
|
|
74988
|
+
try {
|
|
74989
|
+
logger.info(`Installing ${displayName}...`);
|
|
74990
|
+
const { unlink: unlink13 } = await import("node:fs/promises");
|
|
74991
|
+
const { tmpdir: tmpdir4 } = await import("node:os");
|
|
74992
|
+
const tempScriptPath = join91(tmpdir4(), "opencode-install.sh");
|
|
74993
|
+
try {
|
|
74994
|
+
logger.info("Downloading OpenCode installation script...");
|
|
74995
|
+
await execFileAsync7("curl", ["-fsSL", "https://opencode.ai/install", "-o", tempScriptPath], {
|
|
74996
|
+
timeout: 30000
|
|
74997
|
+
});
|
|
74998
|
+
await execFileAsync7("chmod", ["+x", tempScriptPath], {
|
|
74999
|
+
timeout: 5000
|
|
75000
|
+
});
|
|
75001
|
+
logger.info("Executing OpenCode installation script...");
|
|
75002
|
+
await execFileAsync7("bash", [tempScriptPath], {
|
|
75003
|
+
timeout: 120000
|
|
75004
|
+
});
|
|
75005
|
+
} finally {
|
|
75006
|
+
try {
|
|
75007
|
+
await unlink13(tempScriptPath);
|
|
75008
|
+
} catch {}
|
|
75009
|
+
}
|
|
75010
|
+
const installed = await isOpenCodeInstalled();
|
|
75011
|
+
if (installed) {
|
|
75012
|
+
logger.success(`${displayName} installed successfully`);
|
|
75013
|
+
return {
|
|
75014
|
+
success: true,
|
|
75015
|
+
package: displayName
|
|
75016
|
+
};
|
|
75017
|
+
}
|
|
75018
|
+
return {
|
|
75019
|
+
success: false,
|
|
75020
|
+
package: displayName,
|
|
75021
|
+
error: "Installation completed but opencode command not found in PATH"
|
|
75022
|
+
};
|
|
75023
|
+
} catch (error) {
|
|
75024
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
75025
|
+
logger.error(`Failed to install ${displayName}: ${errorMessage}`);
|
|
75026
|
+
return {
|
|
75027
|
+
success: false,
|
|
75028
|
+
package: displayName,
|
|
75029
|
+
error: errorMessage
|
|
75030
|
+
};
|
|
75031
|
+
}
|
|
75032
|
+
}
|
|
75033
|
+
var init_opencode_installer = __esm(() => {
|
|
75034
|
+
init_environment();
|
|
75035
|
+
init_logger();
|
|
75036
|
+
init_process_executor();
|
|
75037
|
+
});
|
|
75038
|
+
|
|
75039
|
+
// src/services/package-installer/types.ts
|
|
75040
|
+
var PARTIAL_INSTALL_VERSION = "partial", EXIT_CODE_CRITICAL_FAILURE = 1, EXIT_CODE_PARTIAL_SUCCESS = 2;
|
|
75041
|
+
|
|
74787
75042
|
// src/services/package-installer/validators.ts
|
|
74788
75043
|
import { resolve as resolve38 } from "node:path";
|
|
74789
75044
|
function validatePackageName(packageName) {
|
|
@@ -74968,100 +75223,9 @@ var init_npm_package_manager = __esm(() => {
|
|
|
74968
75223
|
init_validators();
|
|
74969
75224
|
});
|
|
74970
75225
|
|
|
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
75226
|
// src/services/package-installer/install-error-handler.ts
|
|
75063
|
-
import { existsSync as existsSync62, readFileSync as
|
|
75064
|
-
import { join as
|
|
75227
|
+
import { existsSync as existsSync62, readFileSync as readFileSync20, unlinkSync as unlinkSync3 } from "node:fs";
|
|
75228
|
+
import { join as join92 } from "node:path";
|
|
75065
75229
|
function parseNameReason(str2) {
|
|
75066
75230
|
const colonIndex = str2.indexOf(":");
|
|
75067
75231
|
if (colonIndex === -1) {
|
|
@@ -75124,14 +75288,14 @@ function getSystemPackageCommands(summary, systemFailures) {
|
|
|
75124
75288
|
return summary.remediation.sudo_packages ? [summary.remediation.sudo_packages] : [];
|
|
75125
75289
|
}
|
|
75126
75290
|
function displayInstallErrors(skillsDir2) {
|
|
75127
|
-
const summaryPath =
|
|
75291
|
+
const summaryPath = join92(skillsDir2, ".install-error-summary.json");
|
|
75128
75292
|
if (!existsSync62(summaryPath)) {
|
|
75129
75293
|
logger.error("Skills installation failed. Run with --verbose for details.");
|
|
75130
75294
|
return;
|
|
75131
75295
|
}
|
|
75132
75296
|
let summary;
|
|
75133
75297
|
try {
|
|
75134
|
-
summary = JSON.parse(
|
|
75298
|
+
summary = JSON.parse(readFileSync20(summaryPath, "utf-8"));
|
|
75135
75299
|
} catch (parseError) {
|
|
75136
75300
|
logger.error("Failed to parse error summary. File may be corrupted.");
|
|
75137
75301
|
logger.debug(`Parse error: ${parseError instanceof Error ? parseError.message : String(parseError)}`);
|
|
@@ -75223,7 +75387,7 @@ async function checkNeedsSudoPackages() {
|
|
|
75223
75387
|
}
|
|
75224
75388
|
}
|
|
75225
75389
|
function hasInstallState(skillsDir2) {
|
|
75226
|
-
const stateFilePath =
|
|
75390
|
+
const stateFilePath = join92(skillsDir2, ".install-state.json");
|
|
75227
75391
|
return existsSync62(stateFilePath);
|
|
75228
75392
|
}
|
|
75229
75393
|
var WHICH_COMMAND_TIMEOUT_MS = 5000, WINDOWS_SYSTEM_PACKAGES, SYSTEM_TOOL_KEYS, WINDOWS_RSVG_COMMANDS;
|
|
@@ -75241,7 +75405,7 @@ var init_install_error_handler = __esm(() => {
|
|
|
75241
75405
|
});
|
|
75242
75406
|
|
|
75243
75407
|
// src/services/package-installer/skills-installer.ts
|
|
75244
|
-
import { join as
|
|
75408
|
+
import { join as join93 } from "node:path";
|
|
75245
75409
|
async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
75246
75410
|
const { skipConfirm = false, withSudo = false } = options2;
|
|
75247
75411
|
const displayName = "Skills Dependencies";
|
|
@@ -75267,7 +75431,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75267
75431
|
const clack = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
75268
75432
|
const platform10 = process.platform;
|
|
75269
75433
|
const scriptName = platform10 === "win32" ? "install.ps1" : "install.sh";
|
|
75270
|
-
const scriptPath =
|
|
75434
|
+
const scriptPath = join93(skillsDir2, scriptName);
|
|
75271
75435
|
try {
|
|
75272
75436
|
validateScriptPath(skillsDir2, scriptPath);
|
|
75273
75437
|
} catch (error) {
|
|
@@ -75283,7 +75447,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75283
75447
|
logger.warning(`Skills installation script not found: ${scriptPath}`);
|
|
75284
75448
|
logger.info("");
|
|
75285
75449
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
75286
|
-
logger.info(` See: ${
|
|
75450
|
+
logger.info(` See: ${join93(skillsDir2, "INSTALLATION.md")}`);
|
|
75287
75451
|
logger.info("");
|
|
75288
75452
|
logger.info("Quick start:");
|
|
75289
75453
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -75330,7 +75494,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75330
75494
|
logger.info(` ${platform10 === "win32" ? `powershell -File "${scriptPath}"` : `bash ${scriptPath}`}`);
|
|
75331
75495
|
logger.info("");
|
|
75332
75496
|
logger.info("Or see complete guide:");
|
|
75333
|
-
logger.info(` ${
|
|
75497
|
+
logger.info(` ${join93(skillsDir2, "INSTALLATION.md")}`);
|
|
75334
75498
|
return {
|
|
75335
75499
|
success: false,
|
|
75336
75500
|
package: displayName,
|
|
@@ -75451,7 +75615,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75451
75615
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
75452
75616
|
logger.info("");
|
|
75453
75617
|
logger.info("See complete guide:");
|
|
75454
|
-
logger.info(` cat ${
|
|
75618
|
+
logger.info(` cat ${join93(skillsDir2, "INSTALLATION.md")}`);
|
|
75455
75619
|
logger.info("");
|
|
75456
75620
|
logger.info("Quick start:");
|
|
75457
75621
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -75494,10 +75658,10 @@ var init_skills_installer2 = __esm(() => {
|
|
|
75494
75658
|
init_validators();
|
|
75495
75659
|
});
|
|
75496
75660
|
|
|
75497
|
-
// src/services/package-installer/
|
|
75661
|
+
// src/services/package-installer/agy-mcp/config-manager.ts
|
|
75498
75662
|
import { existsSync as existsSync63 } from "node:fs";
|
|
75499
75663
|
import { mkdir as mkdir23, readFile as readFile49, writeFile as writeFile25 } from "node:fs/promises";
|
|
75500
|
-
import { dirname as dirname34, join as
|
|
75664
|
+
import { dirname as dirname34, join as join94 } from "node:path";
|
|
75501
75665
|
async function readJsonFile(filePath) {
|
|
75502
75666
|
try {
|
|
75503
75667
|
const content = await readFile49(filePath, "utf-8");
|
|
@@ -75508,36 +75672,39 @@ async function readJsonFile(filePath) {
|
|
|
75508
75672
|
return null;
|
|
75509
75673
|
}
|
|
75510
75674
|
}
|
|
75511
|
-
async function
|
|
75512
|
-
const gitignorePath =
|
|
75513
|
-
const geminiPattern = ".gemini/";
|
|
75675
|
+
async function addAgyToGitignore(projectDir) {
|
|
75676
|
+
const gitignorePath = join94(projectDir, ".gitignore");
|
|
75514
75677
|
try {
|
|
75515
75678
|
let content = "";
|
|
75516
75679
|
if (existsSync63(gitignorePath)) {
|
|
75517
75680
|
content = await readFile49(gitignorePath, "utf-8");
|
|
75518
75681
|
const lines = content.split(`
|
|
75519
75682
|
`).map((line) => line.trim()).filter((line) => !line.startsWith("#"));
|
|
75520
|
-
const
|
|
75521
|
-
|
|
75522
|
-
|
|
75683
|
+
const agyPatterns = [
|
|
75684
|
+
".agents/mcp_config.json",
|
|
75685
|
+
"/.agents/mcp_config.json",
|
|
75686
|
+
".agents/mcp_config.json/"
|
|
75687
|
+
];
|
|
75688
|
+
if (lines.some((line) => agyPatterns.includes(line))) {
|
|
75689
|
+
logger.debug(".agents/mcp_config.json already in .gitignore");
|
|
75523
75690
|
return;
|
|
75524
75691
|
}
|
|
75525
75692
|
}
|
|
75526
75693
|
const newLine = content.endsWith(`
|
|
75527
75694
|
`) || content === "" ? "" : `
|
|
75528
75695
|
`;
|
|
75529
|
-
const comment = "#
|
|
75696
|
+
const comment = "# Antigravity CLI MCP config (symlinked to your Claude MCP config)";
|
|
75530
75697
|
await writeFile25(gitignorePath, `${content}${newLine}${comment}
|
|
75531
|
-
${
|
|
75698
|
+
${AGY_GITIGNORE_PATTERN}
|
|
75532
75699
|
`, "utf-8");
|
|
75533
|
-
logger.debug(`Added ${
|
|
75700
|
+
logger.debug(`Added ${AGY_GITIGNORE_PATTERN} to .gitignore`);
|
|
75534
75701
|
} catch (error) {
|
|
75535
75702
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
75536
75703
|
logger.warning(`Failed to update .gitignore: ${errorMessage}`);
|
|
75537
75704
|
}
|
|
75538
75705
|
}
|
|
75539
|
-
async function createNewSettingsWithMerge(
|
|
75540
|
-
const linkDir = dirname34(
|
|
75706
|
+
async function createNewSettingsWithMerge(agyConfigPath, mcpConfigPath) {
|
|
75707
|
+
const linkDir = dirname34(agyConfigPath);
|
|
75541
75708
|
if (!existsSync63(linkDir)) {
|
|
75542
75709
|
await mkdir23(linkDir, { recursive: true });
|
|
75543
75710
|
logger.debug(`Created directory: ${linkDir}`);
|
|
@@ -75552,8 +75719,8 @@ async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
|
75552
75719
|
}
|
|
75553
75720
|
const newSettings = { mcpServers };
|
|
75554
75721
|
try {
|
|
75555
|
-
await writeFile25(
|
|
75556
|
-
logger.debug(`Created new
|
|
75722
|
+
await writeFile25(agyConfigPath, JSON.stringify(newSettings, null, 2), "utf-8");
|
|
75723
|
+
logger.debug(`Created new agy mcp_config.json with mcpServers: ${agyConfigPath}`);
|
|
75557
75724
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
75558
75725
|
} catch (error) {
|
|
75559
75726
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -75564,10 +75731,14 @@ async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
|
75564
75731
|
};
|
|
75565
75732
|
}
|
|
75566
75733
|
}
|
|
75567
|
-
async function
|
|
75568
|
-
const
|
|
75569
|
-
if (!
|
|
75570
|
-
return {
|
|
75734
|
+
async function mergeAgySettings(agyConfigPath, mcpConfigPath) {
|
|
75735
|
+
const agyConfig = await readJsonFile(agyConfigPath);
|
|
75736
|
+
if (!agyConfig) {
|
|
75737
|
+
return {
|
|
75738
|
+
success: false,
|
|
75739
|
+
method: "merge",
|
|
75740
|
+
error: "Failed to read existing agy mcp_config.json"
|
|
75741
|
+
};
|
|
75571
75742
|
}
|
|
75572
75743
|
const mcpConfig = await readJsonFile(mcpConfigPath);
|
|
75573
75744
|
if (!mcpConfig) {
|
|
@@ -75578,12 +75749,12 @@ async function mergeGeminiSettings(geminiSettingsPath, mcpConfigPath) {
|
|
|
75578
75749
|
return { success: false, method: "merge", error: "MCP config has no valid mcpServers object" };
|
|
75579
75750
|
}
|
|
75580
75751
|
const mergedSettings = {
|
|
75581
|
-
...
|
|
75752
|
+
...agyConfig,
|
|
75582
75753
|
mcpServers
|
|
75583
75754
|
};
|
|
75584
75755
|
try {
|
|
75585
|
-
await writeFile25(
|
|
75586
|
-
logger.debug(`Merged mcpServers into: ${
|
|
75756
|
+
await writeFile25(agyConfigPath, JSON.stringify(mergedSettings, null, 2), "utf-8");
|
|
75757
|
+
logger.debug(`Merged mcpServers into: ${agyConfigPath}`);
|
|
75587
75758
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
75588
75759
|
} catch (error) {
|
|
75589
75760
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -75594,19 +75765,20 @@ async function mergeGeminiSettings(geminiSettingsPath, mcpConfigPath) {
|
|
|
75594
75765
|
};
|
|
75595
75766
|
}
|
|
75596
75767
|
}
|
|
75768
|
+
var AGY_GITIGNORE_PATTERN = ".agents/mcp_config.json";
|
|
75597
75769
|
var init_config_manager2 = __esm(() => {
|
|
75598
75770
|
init_logger();
|
|
75599
75771
|
});
|
|
75600
75772
|
|
|
75601
|
-
// src/services/package-installer/
|
|
75773
|
+
// src/services/package-installer/agy-mcp/validation.ts
|
|
75602
75774
|
import { existsSync as existsSync64, lstatSync, readlinkSync } from "node:fs";
|
|
75603
75775
|
import { homedir as homedir45 } from "node:os";
|
|
75604
|
-
import { join as
|
|
75776
|
+
import { join as join95 } from "node:path";
|
|
75605
75777
|
function getGlobalMcpConfigPath() {
|
|
75606
|
-
return
|
|
75778
|
+
return join95(homedir45(), ".claude", ".mcp.json");
|
|
75607
75779
|
}
|
|
75608
75780
|
function getLocalMcpConfigPath(projectDir) {
|
|
75609
|
-
return
|
|
75781
|
+
return join95(projectDir, ".mcp.json");
|
|
75610
75782
|
}
|
|
75611
75783
|
function findMcpConfigPath(projectDir) {
|
|
75612
75784
|
const localPath = getLocalMcpConfigPath(projectDir);
|
|
@@ -75622,41 +75794,41 @@ function findMcpConfigPath(projectDir) {
|
|
|
75622
75794
|
logger.debug("No MCP config found (local or global)");
|
|
75623
75795
|
return null;
|
|
75624
75796
|
}
|
|
75625
|
-
function
|
|
75797
|
+
function getAgyMcpConfigPath(projectDir, isGlobal) {
|
|
75626
75798
|
if (isGlobal) {
|
|
75627
|
-
return
|
|
75799
|
+
return join95(homedir45(), ".gemini", "config", "mcp_config.json");
|
|
75628
75800
|
}
|
|
75629
|
-
return
|
|
75801
|
+
return join95(projectDir, ".agents", "mcp_config.json");
|
|
75630
75802
|
}
|
|
75631
|
-
function
|
|
75632
|
-
const
|
|
75633
|
-
if (!existsSync64(
|
|
75634
|
-
return { exists: false, isSymlink: false, settingsPath:
|
|
75803
|
+
function checkExistingAgyConfig(projectDir, isGlobal = false) {
|
|
75804
|
+
const agyConfigPath = getAgyMcpConfigPath(projectDir, isGlobal);
|
|
75805
|
+
if (!existsSync64(agyConfigPath)) {
|
|
75806
|
+
return { exists: false, isSymlink: false, settingsPath: agyConfigPath };
|
|
75635
75807
|
}
|
|
75636
75808
|
try {
|
|
75637
|
-
const stats = lstatSync(
|
|
75809
|
+
const stats = lstatSync(agyConfigPath);
|
|
75638
75810
|
if (stats.isSymbolicLink()) {
|
|
75639
|
-
const target = readlinkSync(
|
|
75811
|
+
const target = readlinkSync(agyConfigPath);
|
|
75640
75812
|
return {
|
|
75641
75813
|
exists: true,
|
|
75642
75814
|
isSymlink: true,
|
|
75643
75815
|
currentTarget: target,
|
|
75644
|
-
settingsPath:
|
|
75816
|
+
settingsPath: agyConfigPath
|
|
75645
75817
|
};
|
|
75646
75818
|
}
|
|
75647
|
-
return { exists: true, isSymlink: false, settingsPath:
|
|
75819
|
+
return { exists: true, isSymlink: false, settingsPath: agyConfigPath };
|
|
75648
75820
|
} catch {
|
|
75649
|
-
return { exists: true, isSymlink: false, settingsPath:
|
|
75821
|
+
return { exists: true, isSymlink: false, settingsPath: agyConfigPath };
|
|
75650
75822
|
}
|
|
75651
75823
|
}
|
|
75652
75824
|
var init_validation = __esm(() => {
|
|
75653
75825
|
init_logger();
|
|
75654
75826
|
});
|
|
75655
75827
|
|
|
75656
|
-
// src/services/package-installer/
|
|
75828
|
+
// src/services/package-installer/agy-mcp/linker-core.ts
|
|
75657
75829
|
import { existsSync as existsSync65 } from "node:fs";
|
|
75658
75830
|
import { mkdir as mkdir24, symlink as symlink3 } from "node:fs/promises";
|
|
75659
|
-
import { dirname as dirname35, join as
|
|
75831
|
+
import { dirname as dirname35, join as join96 } from "node:path";
|
|
75660
75832
|
async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
75661
75833
|
const linkDir = dirname35(linkPath);
|
|
75662
75834
|
if (!existsSync65(linkDir)) {
|
|
@@ -75667,14 +75839,14 @@ async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
|
75667
75839
|
if (isGlobal) {
|
|
75668
75840
|
symlinkTarget = getGlobalMcpConfigPath();
|
|
75669
75841
|
} else {
|
|
75670
|
-
const localMcpPath =
|
|
75842
|
+
const localMcpPath = join96(projectDir, ".mcp.json");
|
|
75671
75843
|
const isLocalConfig = targetPath === localMcpPath;
|
|
75672
75844
|
symlinkTarget = isLocalConfig ? "../.mcp.json" : targetPath;
|
|
75673
75845
|
}
|
|
75674
75846
|
try {
|
|
75675
75847
|
await symlink3(symlinkTarget, linkPath, isWindows() ? "file" : undefined);
|
|
75676
75848
|
logger.debug(`Created symlink: ${linkPath} → ${symlinkTarget}`);
|
|
75677
|
-
return { success: true, method: "symlink", targetPath,
|
|
75849
|
+
return { success: true, method: "symlink", targetPath, agyConfigPath: linkPath };
|
|
75678
75850
|
} catch (error) {
|
|
75679
75851
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
75680
75852
|
return {
|
|
@@ -75690,21 +75862,21 @@ var init_linker_core = __esm(() => {
|
|
|
75690
75862
|
init_validation();
|
|
75691
75863
|
});
|
|
75692
75864
|
|
|
75693
|
-
// src/services/package-installer/
|
|
75694
|
-
var
|
|
75695
|
-
__export(
|
|
75696
|
-
|
|
75697
|
-
|
|
75698
|
-
|
|
75865
|
+
// src/services/package-installer/agy-mcp-linker.ts
|
|
75866
|
+
var exports_agy_mcp_linker = {};
|
|
75867
|
+
__export(exports_agy_mcp_linker, {
|
|
75868
|
+
processAgyMcpLinking: () => processAgyMcpLinking,
|
|
75869
|
+
linkAgyMcpConfig: () => linkAgyMcpConfig,
|
|
75870
|
+
getAgyMcpConfigPath: () => getAgyMcpConfigPath,
|
|
75699
75871
|
findMcpConfigPath: () => findMcpConfigPath,
|
|
75700
|
-
|
|
75701
|
-
|
|
75872
|
+
checkExistingAgyConfig: () => checkExistingAgyConfig,
|
|
75873
|
+
addAgyToGitignore: () => addAgyToGitignore
|
|
75702
75874
|
});
|
|
75703
75875
|
import { resolve as resolve39 } from "node:path";
|
|
75704
|
-
async function
|
|
75876
|
+
async function linkAgyMcpConfig(projectDir, options2 = {}) {
|
|
75705
75877
|
const { skipGitignore = false, isGlobal = false } = options2;
|
|
75706
75878
|
const resolvedProjectDir = resolve39(projectDir);
|
|
75707
|
-
const
|
|
75879
|
+
const agyConfigPath = getAgyMcpConfigPath(resolvedProjectDir, isGlobal);
|
|
75708
75880
|
const mcpConfigPath = findMcpConfigPath(resolvedProjectDir);
|
|
75709
75881
|
if (!mcpConfigPath) {
|
|
75710
75882
|
return {
|
|
@@ -75713,50 +75885,50 @@ async function linkGeminiMcpConfig(projectDir, options2 = {}) {
|
|
|
75713
75885
|
error: "No MCP config found. Create .mcp.json or ~/.claude/.mcp.json first."
|
|
75714
75886
|
};
|
|
75715
75887
|
}
|
|
75716
|
-
const existing =
|
|
75888
|
+
const existing = checkExistingAgyConfig(resolvedProjectDir, isGlobal);
|
|
75717
75889
|
let result;
|
|
75718
75890
|
if (!existing.exists) {
|
|
75719
|
-
result = await createSymlink(mcpConfigPath,
|
|
75891
|
+
result = await createSymlink(mcpConfigPath, agyConfigPath, resolvedProjectDir, isGlobal);
|
|
75720
75892
|
if (!result.success && process.platform === "win32") {
|
|
75721
75893
|
logger.debug("Symlink failed on Windows, falling back to merge");
|
|
75722
|
-
result = await createNewSettingsWithMerge(
|
|
75894
|
+
result = await createNewSettingsWithMerge(agyConfigPath, mcpConfigPath);
|
|
75723
75895
|
}
|
|
75724
75896
|
} else if (existing.isSymlink) {
|
|
75725
75897
|
result = {
|
|
75726
75898
|
success: true,
|
|
75727
75899
|
method: "skipped",
|
|
75728
75900
|
targetPath: existing.currentTarget,
|
|
75729
|
-
|
|
75901
|
+
agyConfigPath
|
|
75730
75902
|
};
|
|
75731
75903
|
} else {
|
|
75732
|
-
result = await
|
|
75904
|
+
result = await mergeAgySettings(agyConfigPath, mcpConfigPath);
|
|
75733
75905
|
}
|
|
75734
75906
|
if (result.success && !skipGitignore && !isGlobal) {
|
|
75735
|
-
await
|
|
75907
|
+
await addAgyToGitignore(resolvedProjectDir);
|
|
75736
75908
|
}
|
|
75737
75909
|
return result;
|
|
75738
75910
|
}
|
|
75739
|
-
async function
|
|
75740
|
-
logger.info("Setting up
|
|
75741
|
-
const result = await
|
|
75742
|
-
const
|
|
75911
|
+
async function processAgyMcpLinking(projectDir, options2 = {}) {
|
|
75912
|
+
logger.info("Setting up Antigravity (agy) CLI MCP integration...");
|
|
75913
|
+
const result = await linkAgyMcpConfig(projectDir, options2);
|
|
75914
|
+
const configPath = result.agyConfigPath || (options2.isGlobal ? "~/.gemini/config/mcp_config.json" : ".agents/mcp_config.json");
|
|
75743
75915
|
if (result.success) {
|
|
75744
75916
|
if (result.method === "symlink") {
|
|
75745
|
-
logger.success(`
|
|
75917
|
+
logger.success(`agy MCP linked: ${configPath} → ${result.targetPath}`);
|
|
75746
75918
|
logger.info("MCP servers will auto-sync with your Claude config.");
|
|
75747
75919
|
} else if (result.method === "merge") {
|
|
75748
|
-
logger.success("
|
|
75920
|
+
logger.success("agy MCP config updated (merged mcpServers, preserved your settings)");
|
|
75749
75921
|
logger.info("Note: Run 'ck init' again to sync MCP config changes.");
|
|
75750
75922
|
} else {
|
|
75751
|
-
logger.info("
|
|
75923
|
+
logger.info("agy MCP config already configured.");
|
|
75752
75924
|
}
|
|
75753
75925
|
} else {
|
|
75754
|
-
logger.warning(`
|
|
75755
|
-
const cmd = options2.isGlobal ? "mkdir -p ~/.gemini && ln -sf ~/.claude/.mcp.json ~/.gemini/
|
|
75926
|
+
logger.warning(`agy MCP setup incomplete: ${result.error}`);
|
|
75927
|
+
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
75928
|
logger.info(`Manual setup: ${cmd}`);
|
|
75757
75929
|
}
|
|
75758
75930
|
}
|
|
75759
|
-
var
|
|
75931
|
+
var init_agy_mcp_linker = __esm(() => {
|
|
75760
75932
|
init_logger();
|
|
75761
75933
|
init_config_manager2();
|
|
75762
75934
|
init_linker_core();
|
|
@@ -75773,11 +75945,11 @@ __export(exports_package_installer, {
|
|
|
75773
75945
|
processPackageInstallations: () => processPackageInstallations,
|
|
75774
75946
|
isPackageInstalled: () => isPackageInstalled,
|
|
75775
75947
|
isOpenCodeInstalled: () => isOpenCodeInstalled,
|
|
75776
|
-
|
|
75948
|
+
isAgyInstalled: () => isAgyInstalled,
|
|
75777
75949
|
installSkillsDependencies: () => installSkillsDependencies,
|
|
75778
75950
|
installPackageGlobally: () => installPackageGlobally,
|
|
75779
75951
|
installOpenCode: () => installOpenCode,
|
|
75780
|
-
|
|
75952
|
+
installAgy: () => installAgy,
|
|
75781
75953
|
handleSkillsInstallation: () => handleSkillsInstallation,
|
|
75782
75954
|
getPackageVersion: () => getPackageVersion,
|
|
75783
75955
|
getNpmCommand: () => getNpmCommand,
|
|
@@ -75786,9 +75958,10 @@ __export(exports_package_installer, {
|
|
|
75786
75958
|
execAsync: () => execAsync7,
|
|
75787
75959
|
PARTIAL_INSTALL_VERSION: () => PARTIAL_INSTALL_VERSION,
|
|
75788
75960
|
EXIT_CODE_PARTIAL_SUCCESS: () => EXIT_CODE_PARTIAL_SUCCESS,
|
|
75789
|
-
EXIT_CODE_CRITICAL_FAILURE: () => EXIT_CODE_CRITICAL_FAILURE
|
|
75961
|
+
EXIT_CODE_CRITICAL_FAILURE: () => EXIT_CODE_CRITICAL_FAILURE,
|
|
75962
|
+
AGY_DISPLAY_NAME: () => AGY_DISPLAY_NAME
|
|
75790
75963
|
});
|
|
75791
|
-
async function processPackageInstallations(shouldInstallOpenCode,
|
|
75964
|
+
async function processPackageInstallations(shouldInstallOpenCode, shouldInstallAgy, projectDir) {
|
|
75792
75965
|
const results = {};
|
|
75793
75966
|
if (shouldInstallOpenCode) {
|
|
75794
75967
|
if (isTestEnvironment()) {
|
|
@@ -75810,28 +75983,28 @@ async function processPackageInstallations(shouldInstallOpenCode, shouldInstallG
|
|
|
75810
75983
|
}
|
|
75811
75984
|
}
|
|
75812
75985
|
}
|
|
75813
|
-
if (
|
|
75986
|
+
if (shouldInstallAgy) {
|
|
75814
75987
|
if (isTestEnvironment()) {
|
|
75815
|
-
results.
|
|
75988
|
+
results.agy = {
|
|
75816
75989
|
success: true,
|
|
75817
|
-
package:
|
|
75990
|
+
package: AGY_DISPLAY_NAME,
|
|
75818
75991
|
skipped: true
|
|
75819
75992
|
};
|
|
75820
75993
|
} else {
|
|
75821
|
-
const alreadyInstalled = await
|
|
75994
|
+
const alreadyInstalled = await isAgyInstalled();
|
|
75822
75995
|
if (alreadyInstalled) {
|
|
75823
|
-
logger.info(
|
|
75824
|
-
results.
|
|
75996
|
+
logger.info(`${AGY_DISPLAY_NAME} already installed`);
|
|
75997
|
+
results.agy = {
|
|
75825
75998
|
success: true,
|
|
75826
|
-
package:
|
|
75999
|
+
package: AGY_DISPLAY_NAME
|
|
75827
76000
|
};
|
|
75828
76001
|
} else {
|
|
75829
|
-
results.
|
|
76002
|
+
results.agy = await installAgy();
|
|
75830
76003
|
}
|
|
75831
|
-
const
|
|
75832
|
-
if (projectDir &&
|
|
75833
|
-
const {
|
|
75834
|
-
await
|
|
76004
|
+
const agyAvailable = alreadyInstalled || results.agy?.success;
|
|
76005
|
+
if (projectDir && agyAvailable) {
|
|
76006
|
+
const { processAgyMcpLinking: processAgyMcpLinking2 } = await Promise.resolve().then(() => (init_agy_mcp_linker(), exports_agy_mcp_linker));
|
|
76007
|
+
await processAgyMcpLinking2(projectDir);
|
|
75835
76008
|
}
|
|
75836
76009
|
}
|
|
75837
76010
|
}
|
|
@@ -75840,13 +76013,13 @@ async function processPackageInstallations(shouldInstallOpenCode, shouldInstallG
|
|
|
75840
76013
|
var init_package_installer = __esm(() => {
|
|
75841
76014
|
init_environment();
|
|
75842
76015
|
init_logger();
|
|
75843
|
-
|
|
76016
|
+
init_agy_installer();
|
|
75844
76017
|
init_opencode_installer();
|
|
75845
76018
|
init_validators();
|
|
75846
76019
|
init_process_executor();
|
|
75847
76020
|
init_npm_package_manager();
|
|
75848
76021
|
init_opencode_installer();
|
|
75849
|
-
|
|
76022
|
+
init_agy_installer();
|
|
75850
76023
|
init_skills_installer2();
|
|
75851
76024
|
});
|
|
75852
76025
|
|
|
@@ -78084,9 +78257,9 @@ __export(exports_worktree_manager, {
|
|
|
78084
78257
|
});
|
|
78085
78258
|
import { existsSync as existsSync77 } from "node:fs";
|
|
78086
78259
|
import { readFile as readFile70, writeFile as writeFile41 } from "node:fs/promises";
|
|
78087
|
-
import { join as
|
|
78260
|
+
import { join as join160 } from "node:path";
|
|
78088
78261
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
78089
|
-
const worktreePath =
|
|
78262
|
+
const worktreePath = join160(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
78090
78263
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
78091
78264
|
await spawnAndCollect("git", ["fetch", "origin", baseBranch], projectDir).catch(() => {
|
|
78092
78265
|
logger.warning(`[worktree] Could not fetch origin/${baseBranch}, using local`);
|
|
@@ -78104,7 +78277,7 @@ async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
|
78104
78277
|
return worktreePath;
|
|
78105
78278
|
}
|
|
78106
78279
|
async function removeWorktree(projectDir, issueNumber) {
|
|
78107
|
-
const worktreePath =
|
|
78280
|
+
const worktreePath = join160(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
78108
78281
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
78109
78282
|
try {
|
|
78110
78283
|
await spawnAndCollect("git", ["worktree", "remove", worktreePath, "--force"], projectDir);
|
|
@@ -78118,7 +78291,7 @@ async function listActiveWorktrees(projectDir) {
|
|
|
78118
78291
|
try {
|
|
78119
78292
|
const output2 = await spawnAndCollect("git", ["worktree", "list", "--porcelain"], projectDir);
|
|
78120
78293
|
const issueNumbers = [];
|
|
78121
|
-
const worktreePrefix =
|
|
78294
|
+
const worktreePrefix = join160(projectDir, WORKTREE_DIR, "issue-").replace(/\\/g, "/");
|
|
78122
78295
|
for (const line of output2.split(`
|
|
78123
78296
|
`)) {
|
|
78124
78297
|
if (line.startsWith("worktree ")) {
|
|
@@ -78146,7 +78319,7 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
78146
78319
|
await spawnAndCollect("git", ["worktree", "prune"], projectDir).catch(() => {});
|
|
78147
78320
|
}
|
|
78148
78321
|
async function ensureGitignore(projectDir) {
|
|
78149
|
-
const gitignorePath =
|
|
78322
|
+
const gitignorePath = join160(projectDir, ".gitignore");
|
|
78150
78323
|
try {
|
|
78151
78324
|
const content = existsSync77(gitignorePath) ? await readFile70(gitignorePath, "utf-8") : "";
|
|
78152
78325
|
if (!content.includes(".worktrees")) {
|
|
@@ -78250,16 +78423,16 @@ var init_content_validator = __esm(() => {
|
|
|
78250
78423
|
|
|
78251
78424
|
// src/commands/content/phases/context-cache-manager.ts
|
|
78252
78425
|
import { createHash as createHash9 } from "node:crypto";
|
|
78253
|
-
import { existsSync as existsSync83, mkdirSync as mkdirSync7, readFileSync as
|
|
78426
|
+
import { existsSync as existsSync83, mkdirSync as mkdirSync7, readFileSync as readFileSync23, readdirSync as readdirSync14, statSync as statSync15 } from "node:fs";
|
|
78254
78427
|
import { rename as rename16, writeFile as writeFile43 } from "node:fs/promises";
|
|
78255
78428
|
import { homedir as homedir54 } from "node:os";
|
|
78256
|
-
import { basename as basename34, join as
|
|
78429
|
+
import { basename as basename34, join as join167 } from "node:path";
|
|
78257
78430
|
function getCachedContext(repoPath) {
|
|
78258
78431
|
const cachePath = getCacheFilePath(repoPath);
|
|
78259
78432
|
if (!existsSync83(cachePath))
|
|
78260
78433
|
return null;
|
|
78261
78434
|
try {
|
|
78262
|
-
const raw2 =
|
|
78435
|
+
const raw2 = readFileSync23(cachePath, "utf-8");
|
|
78263
78436
|
const cache5 = JSON.parse(raw2);
|
|
78264
78437
|
const age = Date.now() - new Date(cache5.createdAt).getTime();
|
|
78265
78438
|
if (age >= CACHE_TTL_MS5)
|
|
@@ -78296,25 +78469,25 @@ function computeSourceHash(repoPath) {
|
|
|
78296
78469
|
}
|
|
78297
78470
|
function getDocSourcePaths(repoPath) {
|
|
78298
78471
|
const paths = [];
|
|
78299
|
-
const docsDir =
|
|
78472
|
+
const docsDir = join167(repoPath, "docs");
|
|
78300
78473
|
if (existsSync83(docsDir)) {
|
|
78301
78474
|
try {
|
|
78302
78475
|
const files = readdirSync14(docsDir);
|
|
78303
78476
|
for (const f3 of files) {
|
|
78304
78477
|
if (f3.endsWith(".md"))
|
|
78305
|
-
paths.push(
|
|
78478
|
+
paths.push(join167(docsDir, f3));
|
|
78306
78479
|
}
|
|
78307
78480
|
} catch {}
|
|
78308
78481
|
}
|
|
78309
|
-
const readme =
|
|
78482
|
+
const readme = join167(repoPath, "README.md");
|
|
78310
78483
|
if (existsSync83(readme))
|
|
78311
78484
|
paths.push(readme);
|
|
78312
|
-
const stylesDir =
|
|
78485
|
+
const stylesDir = join167(repoPath, "assets", "writing-styles");
|
|
78313
78486
|
if (existsSync83(stylesDir)) {
|
|
78314
78487
|
try {
|
|
78315
78488
|
const files = readdirSync14(stylesDir);
|
|
78316
78489
|
for (const f3 of files) {
|
|
78317
|
-
paths.push(
|
|
78490
|
+
paths.push(join167(stylesDir, f3));
|
|
78318
78491
|
}
|
|
78319
78492
|
} catch {}
|
|
78320
78493
|
}
|
|
@@ -78323,11 +78496,11 @@ function getDocSourcePaths(repoPath) {
|
|
|
78323
78496
|
function getCacheFilePath(repoPath) {
|
|
78324
78497
|
const repoName = basename34(repoPath).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
78325
78498
|
const pathHash = createHash9("sha256").update(repoPath).digest("hex").slice(0, 8);
|
|
78326
|
-
return
|
|
78499
|
+
return join167(CACHE_DIR, `${repoName}-${pathHash}-context-cache.json`);
|
|
78327
78500
|
}
|
|
78328
78501
|
var CACHE_DIR, CACHE_TTL_MS5;
|
|
78329
78502
|
var init_context_cache_manager = __esm(() => {
|
|
78330
|
-
CACHE_DIR =
|
|
78503
|
+
CACHE_DIR = join167(homedir54(), ".claudekit", "cache");
|
|
78331
78504
|
CACHE_TTL_MS5 = 24 * 60 * 60 * 1000;
|
|
78332
78505
|
});
|
|
78333
78506
|
|
|
@@ -78507,8 +78680,8 @@ function extractContentFromResponse(response) {
|
|
|
78507
78680
|
|
|
78508
78681
|
// src/commands/content/phases/docs-summarizer.ts
|
|
78509
78682
|
import { execSync as execSync7 } from "node:child_process";
|
|
78510
|
-
import { existsSync as existsSync84, readFileSync as
|
|
78511
|
-
import { join as
|
|
78683
|
+
import { existsSync as existsSync84, readFileSync as readFileSync24, readdirSync as readdirSync15 } from "node:fs";
|
|
78684
|
+
import { join as join168 } from "node:path";
|
|
78512
78685
|
async function summarizeProjectDocs(repoPath, contentLogger) {
|
|
78513
78686
|
const rawContent = collectRawDocs(repoPath);
|
|
78514
78687
|
if (rawContent.total.length < 200) {
|
|
@@ -78556,18 +78729,18 @@ function collectRawDocs(repoPath) {
|
|
|
78556
78729
|
return "";
|
|
78557
78730
|
if (totalChars >= MAX_RAW_CONTENT_CHARS)
|
|
78558
78731
|
return "";
|
|
78559
|
-
const content =
|
|
78732
|
+
const content = readFileSync24(filePath, "utf-8");
|
|
78560
78733
|
const capped = content.slice(0, Math.min(maxChars, MAX_RAW_CONTENT_CHARS - totalChars));
|
|
78561
78734
|
totalChars += capped.length;
|
|
78562
78735
|
return capped;
|
|
78563
78736
|
};
|
|
78564
78737
|
const docsContent = [];
|
|
78565
|
-
const docsDir =
|
|
78738
|
+
const docsDir = join168(repoPath, "docs");
|
|
78566
78739
|
if (existsSync84(docsDir)) {
|
|
78567
78740
|
try {
|
|
78568
78741
|
const files = readdirSync15(docsDir).filter((f3) => f3.endsWith(".md")).sort();
|
|
78569
78742
|
for (const f3 of files) {
|
|
78570
|
-
const content = readCapped(
|
|
78743
|
+
const content = readCapped(join168(docsDir, f3), 5000);
|
|
78571
78744
|
if (content) {
|
|
78572
78745
|
docsContent.push(`### ${f3}
|
|
78573
78746
|
${content}`);
|
|
@@ -78581,21 +78754,21 @@ ${content}`);
|
|
|
78581
78754
|
let brand = "";
|
|
78582
78755
|
const brandCandidates = ["docs/brand-guidelines.md", "docs/design-guidelines.md"];
|
|
78583
78756
|
for (const p of brandCandidates) {
|
|
78584
|
-
brand = readCapped(
|
|
78757
|
+
brand = readCapped(join168(repoPath, p), 3000);
|
|
78585
78758
|
if (brand)
|
|
78586
78759
|
break;
|
|
78587
78760
|
}
|
|
78588
78761
|
let styles3 = "";
|
|
78589
|
-
const stylesDir =
|
|
78762
|
+
const stylesDir = join168(repoPath, "assets", "writing-styles");
|
|
78590
78763
|
if (existsSync84(stylesDir)) {
|
|
78591
78764
|
try {
|
|
78592
78765
|
const files = readdirSync15(stylesDir).slice(0, 3);
|
|
78593
|
-
styles3 = files.map((f3) => readCapped(
|
|
78766
|
+
styles3 = files.map((f3) => readCapped(join168(stylesDir, f3), 1000)).filter(Boolean).join(`
|
|
78594
78767
|
|
|
78595
78768
|
`);
|
|
78596
78769
|
} catch {}
|
|
78597
78770
|
}
|
|
78598
|
-
const readme = readCapped(
|
|
78771
|
+
const readme = readCapped(join168(repoPath, "README.md"), 3000);
|
|
78599
78772
|
const total = [docs, brand, styles3, readme].join(`
|
|
78600
78773
|
`);
|
|
78601
78774
|
return { docs, brand, styles: styles3, readme, total };
|
|
@@ -78782,9 +78955,9 @@ IMPORTANT: Generate the image and output the path as JSON: {"imagePath": "/path/
|
|
|
78782
78955
|
import { execSync as execSync8 } from "node:child_process";
|
|
78783
78956
|
import { existsSync as existsSync85, mkdirSync as mkdirSync8, readdirSync as readdirSync16 } from "node:fs";
|
|
78784
78957
|
import { homedir as homedir55 } from "node:os";
|
|
78785
|
-
import { join as
|
|
78958
|
+
import { join as join169 } from "node:path";
|
|
78786
78959
|
async function generatePhoto(_content, context, config, platform18, contentId, contentLogger) {
|
|
78787
|
-
const mediaDir =
|
|
78960
|
+
const mediaDir = join169(config.contentDir.replace(/^~/, homedir55()), "media", String(contentId));
|
|
78788
78961
|
if (!existsSync85(mediaDir)) {
|
|
78789
78962
|
mkdirSync8(mediaDir, { recursive: true });
|
|
78790
78963
|
}
|
|
@@ -78809,7 +78982,7 @@ async function generatePhoto(_content, context, config, platform18, contentId, c
|
|
|
78809
78982
|
const imageFile = files.find((f3) => /\.(png|jpg|jpeg|webp)$/i.test(f3));
|
|
78810
78983
|
if (imageFile) {
|
|
78811
78984
|
const ext2 = imageFile.split(".").pop() ?? "png";
|
|
78812
|
-
return { path:
|
|
78985
|
+
return { path: join169(mediaDir, imageFile), ...dimensions, format: ext2 };
|
|
78813
78986
|
}
|
|
78814
78987
|
contentLogger.warn(`Photo generation produced no image for content ${contentId}`);
|
|
78815
78988
|
return null;
|
|
@@ -78899,7 +79072,7 @@ var init_content_creator = __esm(() => {
|
|
|
78899
79072
|
// src/commands/content/phases/content-logger.ts
|
|
78900
79073
|
import { createWriteStream as createWriteStream4, existsSync as existsSync86, mkdirSync as mkdirSync9, statSync as statSync16 } from "node:fs";
|
|
78901
79074
|
import { homedir as homedir56 } from "node:os";
|
|
78902
|
-
import { join as
|
|
79075
|
+
import { join as join170 } from "node:path";
|
|
78903
79076
|
|
|
78904
79077
|
class ContentLogger {
|
|
78905
79078
|
stream = null;
|
|
@@ -78907,7 +79080,7 @@ class ContentLogger {
|
|
|
78907
79080
|
logDir;
|
|
78908
79081
|
maxBytes;
|
|
78909
79082
|
constructor(maxBytes = 0) {
|
|
78910
|
-
this.logDir =
|
|
79083
|
+
this.logDir = join170(homedir56(), ".claudekit", "logs");
|
|
78911
79084
|
this.maxBytes = maxBytes;
|
|
78912
79085
|
}
|
|
78913
79086
|
init() {
|
|
@@ -78939,7 +79112,7 @@ class ContentLogger {
|
|
|
78939
79112
|
}
|
|
78940
79113
|
}
|
|
78941
79114
|
getLogPath() {
|
|
78942
|
-
return
|
|
79115
|
+
return join170(this.logDir, `content-${this.getDateStr()}.log`);
|
|
78943
79116
|
}
|
|
78944
79117
|
write(level, message) {
|
|
78945
79118
|
this.rotateIfNeeded();
|
|
@@ -78956,18 +79129,18 @@ class ContentLogger {
|
|
|
78956
79129
|
if (dateStr !== this.currentDate) {
|
|
78957
79130
|
this.close();
|
|
78958
79131
|
this.currentDate = dateStr;
|
|
78959
|
-
const logPath =
|
|
79132
|
+
const logPath = join170(this.logDir, `content-${dateStr}.log`);
|
|
78960
79133
|
this.stream = createWriteStream4(logPath, { flags: "a", mode: 384 });
|
|
78961
79134
|
return;
|
|
78962
79135
|
}
|
|
78963
79136
|
if (this.maxBytes > 0 && this.stream) {
|
|
78964
|
-
const logPath =
|
|
79137
|
+
const logPath = join170(this.logDir, `content-${this.currentDate}.log`);
|
|
78965
79138
|
try {
|
|
78966
79139
|
const stat26 = statSync16(logPath);
|
|
78967
79140
|
if (stat26.size >= this.maxBytes) {
|
|
78968
79141
|
this.close();
|
|
78969
79142
|
const suffix = Date.now();
|
|
78970
|
-
const rotatedPath =
|
|
79143
|
+
const rotatedPath = join170(this.logDir, `content-${this.currentDate}-${suffix}.log`);
|
|
78971
79144
|
import("node:fs/promises").then(({ rename: rename17 }) => rename17(logPath, rotatedPath).catch(() => {}));
|
|
78972
79145
|
this.stream = createWriteStream4(logPath, { flags: "w", mode: 384 });
|
|
78973
79146
|
}
|
|
@@ -79050,7 +79223,7 @@ var init_sqlite_client = __esm(() => {
|
|
|
79050
79223
|
|
|
79051
79224
|
// src/commands/content/phases/db-manager.ts
|
|
79052
79225
|
import { existsSync as existsSync87, mkdirSync as mkdirSync10 } from "node:fs";
|
|
79053
|
-
import { dirname as
|
|
79226
|
+
import { dirname as dirname56 } from "node:path";
|
|
79054
79227
|
function initDatabase(dbPath) {
|
|
79055
79228
|
ensureParentDir(dbPath);
|
|
79056
79229
|
const db = openDatabase(dbPath);
|
|
@@ -79071,7 +79244,7 @@ function runRetentionCleanup(db, retentionDays = 90) {
|
|
|
79071
79244
|
db.prepare("DELETE FROM git_events WHERE processed = 1 AND created_at < ?").run(cutoff);
|
|
79072
79245
|
}
|
|
79073
79246
|
function ensureParentDir(dbPath) {
|
|
79074
|
-
const dir =
|
|
79247
|
+
const dir = dirname56(dbPath);
|
|
79075
79248
|
if (dir && !existsSync87(dir)) {
|
|
79076
79249
|
mkdirSync10(dir, { recursive: true });
|
|
79077
79250
|
}
|
|
@@ -79237,8 +79410,8 @@ function isNoiseCommit(title, author) {
|
|
|
79237
79410
|
|
|
79238
79411
|
// src/commands/content/phases/change-detector.ts
|
|
79239
79412
|
import { execSync as execSync10, spawnSync as spawnSync9 } from "node:child_process";
|
|
79240
|
-
import { existsSync as existsSync88, readFileSync as
|
|
79241
|
-
import { join as
|
|
79413
|
+
import { existsSync as existsSync88, readFileSync as readFileSync25, readdirSync as readdirSync17, statSync as statSync17 } from "node:fs";
|
|
79414
|
+
import { join as join171 } from "node:path";
|
|
79242
79415
|
function detectCommits(repo, since) {
|
|
79243
79416
|
try {
|
|
79244
79417
|
const fetchUrl = sshToHttps(repo.remoteUrl);
|
|
@@ -79347,7 +79520,7 @@ function detectTags(repo, since) {
|
|
|
79347
79520
|
}
|
|
79348
79521
|
}
|
|
79349
79522
|
function detectCompletedPlans(repo, since) {
|
|
79350
|
-
const plansDir =
|
|
79523
|
+
const plansDir = join171(repo.path, "plans");
|
|
79351
79524
|
if (!existsSync88(plansDir))
|
|
79352
79525
|
return [];
|
|
79353
79526
|
const sinceMs = new Date(since).getTime();
|
|
@@ -79357,14 +79530,14 @@ function detectCompletedPlans(repo, since) {
|
|
|
79357
79530
|
for (const entry of entries) {
|
|
79358
79531
|
if (!entry.isDirectory())
|
|
79359
79532
|
continue;
|
|
79360
|
-
const planFile =
|
|
79533
|
+
const planFile = join171(plansDir, entry.name, "plan.md");
|
|
79361
79534
|
if (!existsSync88(planFile))
|
|
79362
79535
|
continue;
|
|
79363
79536
|
try {
|
|
79364
79537
|
const stat26 = statSync17(planFile);
|
|
79365
79538
|
if (stat26.mtimeMs < sinceMs)
|
|
79366
79539
|
continue;
|
|
79367
|
-
const content =
|
|
79540
|
+
const content = readFileSync25(planFile, "utf-8");
|
|
79368
79541
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
79369
79542
|
if (!frontmatterMatch)
|
|
79370
79543
|
continue;
|
|
@@ -79435,7 +79608,7 @@ function classifyCommit(event) {
|
|
|
79435
79608
|
// src/commands/content/phases/repo-discoverer.ts
|
|
79436
79609
|
import { execSync as execSync11 } from "node:child_process";
|
|
79437
79610
|
import { readdirSync as readdirSync18 } from "node:fs";
|
|
79438
|
-
import { join as
|
|
79611
|
+
import { join as join172 } from "node:path";
|
|
79439
79612
|
function discoverRepos2(cwd2) {
|
|
79440
79613
|
const repos = [];
|
|
79441
79614
|
if (isGitRepoRoot(cwd2)) {
|
|
@@ -79448,7 +79621,7 @@ function discoverRepos2(cwd2) {
|
|
|
79448
79621
|
for (const entry of entries) {
|
|
79449
79622
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
79450
79623
|
continue;
|
|
79451
|
-
const dirPath =
|
|
79624
|
+
const dirPath = join172(cwd2, entry.name);
|
|
79452
79625
|
if (isGitRepoRoot(dirPath)) {
|
|
79453
79626
|
const info = getRepoInfo(dirPath);
|
|
79454
79627
|
if (info)
|
|
@@ -80116,9 +80289,9 @@ var init_types6 = __esm(() => {
|
|
|
80116
80289
|
|
|
80117
80290
|
// src/commands/content/phases/state-manager.ts
|
|
80118
80291
|
import { readFile as readFile72, rename as rename17, writeFile as writeFile44 } from "node:fs/promises";
|
|
80119
|
-
import { join as
|
|
80292
|
+
import { join as join173 } from "node:path";
|
|
80120
80293
|
async function loadContentConfig(projectDir) {
|
|
80121
|
-
const configPath =
|
|
80294
|
+
const configPath = join173(projectDir, CK_CONFIG_FILE2);
|
|
80122
80295
|
try {
|
|
80123
80296
|
const raw2 = await readFile72(configPath, "utf-8");
|
|
80124
80297
|
const json = JSON.parse(raw2);
|
|
@@ -80128,13 +80301,13 @@ async function loadContentConfig(projectDir) {
|
|
|
80128
80301
|
}
|
|
80129
80302
|
}
|
|
80130
80303
|
async function saveContentConfig(projectDir, config) {
|
|
80131
|
-
const configPath =
|
|
80132
|
-
const json = await
|
|
80304
|
+
const configPath = join173(projectDir, CK_CONFIG_FILE2);
|
|
80305
|
+
const json = await readJsonSafe5(configPath);
|
|
80133
80306
|
json.content = { ...json.content, ...config };
|
|
80134
80307
|
await atomicWrite3(configPath, json);
|
|
80135
80308
|
}
|
|
80136
80309
|
async function loadContentState(projectDir) {
|
|
80137
|
-
const configPath =
|
|
80310
|
+
const configPath = join173(projectDir, CK_CONFIG_FILE2);
|
|
80138
80311
|
try {
|
|
80139
80312
|
const raw2 = await readFile72(configPath, "utf-8");
|
|
80140
80313
|
const json = JSON.parse(raw2);
|
|
@@ -80145,7 +80318,7 @@ async function loadContentState(projectDir) {
|
|
|
80145
80318
|
}
|
|
80146
80319
|
}
|
|
80147
80320
|
async function saveContentState(projectDir, state) {
|
|
80148
|
-
const configPath =
|
|
80321
|
+
const configPath = join173(projectDir, CK_CONFIG_FILE2);
|
|
80149
80322
|
const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);
|
|
80150
80323
|
for (const key of Object.keys(state.dailyPostCounts)) {
|
|
80151
80324
|
const dateStr = key.slice(-10);
|
|
@@ -80154,14 +80327,14 @@ async function saveContentState(projectDir, state) {
|
|
|
80154
80327
|
}
|
|
80155
80328
|
}
|
|
80156
80329
|
ContentStateSchema.parse(state);
|
|
80157
|
-
const json = await
|
|
80330
|
+
const json = await readJsonSafe5(configPath);
|
|
80158
80331
|
if (!json.content || typeof json.content !== "object") {
|
|
80159
80332
|
json.content = {};
|
|
80160
80333
|
}
|
|
80161
80334
|
json.content.state = state;
|
|
80162
80335
|
await atomicWrite3(configPath, json);
|
|
80163
80336
|
}
|
|
80164
|
-
async function
|
|
80337
|
+
async function readJsonSafe5(filePath) {
|
|
80165
80338
|
try {
|
|
80166
80339
|
const raw2 = await readFile72(filePath, "utf-8");
|
|
80167
80340
|
return JSON.parse(raw2);
|
|
@@ -80427,7 +80600,7 @@ var init_platform_setup_x = __esm(() => {
|
|
|
80427
80600
|
|
|
80428
80601
|
// src/commands/content/phases/setup-wizard.ts
|
|
80429
80602
|
import { existsSync as existsSync89 } from "node:fs";
|
|
80430
|
-
import { join as
|
|
80603
|
+
import { join as join174 } from "node:path";
|
|
80431
80604
|
async function runSetupWizard2(cwd2, contentLogger) {
|
|
80432
80605
|
console.log();
|
|
80433
80606
|
oe(import_picocolors43.default.bgCyan(import_picocolors43.default.white(" CK Content — Multi-Channel Content Engine ")));
|
|
@@ -80495,8 +80668,8 @@ async function showRepoSummary(cwd2) {
|
|
|
80495
80668
|
function detectBrandAssets(cwd2, contentLogger) {
|
|
80496
80669
|
const repos = discoverRepos2(cwd2);
|
|
80497
80670
|
for (const repo of repos) {
|
|
80498
|
-
const hasGuidelines = existsSync89(
|
|
80499
|
-
const hasStyles = existsSync89(
|
|
80671
|
+
const hasGuidelines = existsSync89(join174(repo.path, "docs", "brand-guidelines.md"));
|
|
80672
|
+
const hasStyles = existsSync89(join174(repo.path, "assets", "writing-styles"));
|
|
80500
80673
|
if (!hasGuidelines) {
|
|
80501
80674
|
f2.warning(`${repo.name}: No docs/brand-guidelines.md — content will use generic tone.`);
|
|
80502
80675
|
contentLogger.warn(`${repo.name}: missing docs/brand-guidelines.md`);
|
|
@@ -80636,15 +80809,15 @@ __export(exports_content_subcommands, {
|
|
|
80636
80809
|
logsContent: () => logsContent,
|
|
80637
80810
|
approveContentCmd: () => approveContentCmd
|
|
80638
80811
|
});
|
|
80639
|
-
import { existsSync as existsSync91, readFileSync as
|
|
80812
|
+
import { existsSync as existsSync91, readFileSync as readFileSync26, unlinkSync as unlinkSync6 } from "node:fs";
|
|
80640
80813
|
import { homedir as homedir58 } from "node:os";
|
|
80641
|
-
import { join as
|
|
80814
|
+
import { join as join175 } from "node:path";
|
|
80642
80815
|
function isDaemonRunning() {
|
|
80643
|
-
const lockFile =
|
|
80816
|
+
const lockFile = join175(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
80644
80817
|
if (!existsSync91(lockFile))
|
|
80645
80818
|
return { running: false, pid: null };
|
|
80646
80819
|
try {
|
|
80647
|
-
const pidStr =
|
|
80820
|
+
const pidStr = readFileSync26(lockFile, "utf-8").trim();
|
|
80648
80821
|
const pid = Number.parseInt(pidStr, 10);
|
|
80649
80822
|
if (Number.isNaN(pid)) {
|
|
80650
80823
|
unlinkSync6(lockFile);
|
|
@@ -80672,13 +80845,13 @@ async function startContent(options2) {
|
|
|
80672
80845
|
await contentCommand(options2);
|
|
80673
80846
|
}
|
|
80674
80847
|
async function stopContent() {
|
|
80675
|
-
const lockFile =
|
|
80848
|
+
const lockFile = join175(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
80676
80849
|
if (!existsSync91(lockFile)) {
|
|
80677
80850
|
logger.info("Content daemon is not running.");
|
|
80678
80851
|
return;
|
|
80679
80852
|
}
|
|
80680
80853
|
try {
|
|
80681
|
-
const pidStr =
|
|
80854
|
+
const pidStr = readFileSync26(lockFile, "utf-8").trim();
|
|
80682
80855
|
const pid = Number.parseInt(pidStr, 10);
|
|
80683
80856
|
if (!Number.isNaN(pid)) {
|
|
80684
80857
|
process.kill(pid, "SIGTERM");
|
|
@@ -80711,9 +80884,9 @@ async function statusContent() {
|
|
|
80711
80884
|
} catch {}
|
|
80712
80885
|
}
|
|
80713
80886
|
async function logsContent(options2) {
|
|
80714
|
-
const logDir =
|
|
80887
|
+
const logDir = join175(homedir58(), ".claudekit", "logs");
|
|
80715
80888
|
const dateStr = new Date().toISOString().slice(0, 10).replace(/-/g, "");
|
|
80716
|
-
const logPath =
|
|
80889
|
+
const logPath = join175(logDir, `content-${dateStr}.log`);
|
|
80717
80890
|
if (!existsSync91(logPath)) {
|
|
80718
80891
|
logger.info("No content logs found for today.");
|
|
80719
80892
|
return;
|
|
@@ -80726,7 +80899,7 @@ async function logsContent(options2) {
|
|
|
80726
80899
|
process.exit(0);
|
|
80727
80900
|
});
|
|
80728
80901
|
} else {
|
|
80729
|
-
const content =
|
|
80902
|
+
const content = readFileSync26(logPath, "utf-8");
|
|
80730
80903
|
console.log(content);
|
|
80731
80904
|
}
|
|
80732
80905
|
}
|
|
@@ -80745,13 +80918,13 @@ var init_content_subcommands = __esm(() => {
|
|
|
80745
80918
|
init_setup_wizard();
|
|
80746
80919
|
init_state_manager();
|
|
80747
80920
|
init_content_review_commands();
|
|
80748
|
-
LOCK_DIR =
|
|
80921
|
+
LOCK_DIR = join175(homedir58(), ".claudekit", "locks");
|
|
80749
80922
|
});
|
|
80750
80923
|
|
|
80751
80924
|
// src/commands/content/content-command.ts
|
|
80752
80925
|
import { existsSync as existsSync92, mkdirSync as mkdirSync11, unlinkSync as unlinkSync7, writeFileSync as writeFileSync9 } from "node:fs";
|
|
80753
80926
|
import { homedir as homedir59 } from "node:os";
|
|
80754
|
-
import { join as
|
|
80927
|
+
import { join as join176 } from "node:path";
|
|
80755
80928
|
async function contentCommand(options2) {
|
|
80756
80929
|
const cwd2 = process.cwd();
|
|
80757
80930
|
const contentLogger = new ContentLogger;
|
|
@@ -80929,8 +81102,8 @@ var init_content_command = __esm(() => {
|
|
|
80929
81102
|
init_publisher();
|
|
80930
81103
|
init_review_manager();
|
|
80931
81104
|
init_state_manager();
|
|
80932
|
-
LOCK_DIR2 =
|
|
80933
|
-
LOCK_FILE =
|
|
81105
|
+
LOCK_DIR2 = join176(homedir59(), ".claudekit", "locks");
|
|
81106
|
+
LOCK_FILE = join176(LOCK_DIR2, "ck-content.lock");
|
|
80934
81107
|
});
|
|
80935
81108
|
|
|
80936
81109
|
// src/commands/content/index.ts
|
|
@@ -88101,7 +88274,7 @@ import { promisify as promisify14 } from "node:util";
|
|
|
88101
88274
|
// src/domains/github/gh-cli-utils.ts
|
|
88102
88275
|
init_environment();
|
|
88103
88276
|
init_logger();
|
|
88104
|
-
import { readFileSync as
|
|
88277
|
+
import { readFileSync as readFileSync16 } from "node:fs";
|
|
88105
88278
|
var MIN_GH_CLI_VERSION = "2.20.0";
|
|
88106
88279
|
var GH_COMMAND_TIMEOUT_MS = 1e4;
|
|
88107
88280
|
function compareVersions6(a3, b3) {
|
|
@@ -88122,7 +88295,7 @@ function isWSL2() {
|
|
|
88122
88295
|
if (process.platform !== "linux")
|
|
88123
88296
|
return false;
|
|
88124
88297
|
try {
|
|
88125
|
-
const release =
|
|
88298
|
+
const release = readFileSync16("/proc/version", "utf-8").toLowerCase();
|
|
88126
88299
|
return release.includes("microsoft") || release.includes("wsl");
|
|
88127
88300
|
} catch (error) {
|
|
88128
88301
|
logger.debug(`WSL detection skipped: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
@@ -88951,7 +89124,7 @@ function checkClaudeMdFile(path7, name, id) {
|
|
|
88951
89124
|
}
|
|
88952
89125
|
}
|
|
88953
89126
|
// src/domains/health-checks/checkers/active-plan-checker.ts
|
|
88954
|
-
import { existsSync as existsSync53, readFileSync as
|
|
89127
|
+
import { existsSync as existsSync53, readFileSync as readFileSync18 } from "node:fs";
|
|
88955
89128
|
import { join as join74 } from "node:path";
|
|
88956
89129
|
function checkActivePlan(projectDir) {
|
|
88957
89130
|
const activePlanPath = join74(projectDir, ".claude", "active-plan");
|
|
@@ -88967,7 +89140,7 @@ function checkActivePlan(projectDir) {
|
|
|
88967
89140
|
};
|
|
88968
89141
|
}
|
|
88969
89142
|
try {
|
|
88970
|
-
const targetPath =
|
|
89143
|
+
const targetPath = readFileSync18(activePlanPath, "utf-8").trim();
|
|
88971
89144
|
const fullPath = join74(projectDir, targetPath);
|
|
88972
89145
|
if (!existsSync53(fullPath)) {
|
|
88973
89146
|
return {
|
|
@@ -91508,7 +91681,7 @@ class AutoHealer {
|
|
|
91508
91681
|
}
|
|
91509
91682
|
// src/domains/health-checks/report-generator.ts
|
|
91510
91683
|
import { execSync as execSync4, spawnSync as spawnSync6 } from "node:child_process";
|
|
91511
|
-
import { readFileSync as
|
|
91684
|
+
import { readFileSync as readFileSync19, unlinkSync as unlinkSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
91512
91685
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
91513
91686
|
import { dirname as dirname33, join as join88 } from "node:path";
|
|
91514
91687
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
@@ -91519,7 +91692,7 @@ function getCliVersion4() {
|
|
|
91519
91692
|
try {
|
|
91520
91693
|
const __dirname4 = dirname33(fileURLToPath4(import.meta.url));
|
|
91521
91694
|
const pkgPath = join88(__dirname4, "../../../package.json");
|
|
91522
|
-
const pkg = JSON.parse(
|
|
91695
|
+
const pkg = JSON.parse(readFileSync19(pkgPath, "utf-8"));
|
|
91523
91696
|
return pkg.version || "unknown";
|
|
91524
91697
|
} catch (err) {
|
|
91525
91698
|
logger.debug(`Failed to read CLI version: ${err}`);
|
|
@@ -91999,7 +92172,7 @@ init_config_version_checker();
|
|
|
91999
92172
|
|
|
92000
92173
|
// src/domains/sync/sync-engine.ts
|
|
92001
92174
|
import { lstat as lstat6, readFile as readFile48, readlink as readlink2, realpath as realpath8, stat as stat14 } from "node:fs/promises";
|
|
92002
|
-
import { isAbsolute as
|
|
92175
|
+
import { isAbsolute as isAbsolute12, join as join89, normalize as normalize8, relative as relative18 } from "node:path";
|
|
92003
92176
|
|
|
92004
92177
|
// src/services/file-operations/ownership-checker.ts
|
|
92005
92178
|
init_metadata_migration();
|
|
@@ -93214,10 +93387,10 @@ async function validateSymlinkChain(path8, basePath, maxDepth = MAX_SYMLINK_DEPT
|
|
|
93214
93387
|
if (!stats.isSymbolicLink())
|
|
93215
93388
|
break;
|
|
93216
93389
|
const target = await readlink2(current);
|
|
93217
|
-
const resolvedTarget =
|
|
93390
|
+
const resolvedTarget = isAbsolute12(target) ? target : join89(current, "..", target);
|
|
93218
93391
|
const normalizedTarget = normalize8(resolvedTarget);
|
|
93219
93392
|
const rel = relative18(basePath, normalizedTarget);
|
|
93220
|
-
if (rel.startsWith("..") ||
|
|
93393
|
+
if (rel.startsWith("..") || isAbsolute12(rel)) {
|
|
93221
93394
|
throw new Error(`Symlink chain escapes base directory at depth ${depth}: ${path8}`);
|
|
93222
93395
|
}
|
|
93223
93396
|
current = normalizedTarget;
|
|
@@ -93244,7 +93417,7 @@ async function validateSyncPath(basePath, filePath) {
|
|
|
93244
93417
|
throw new Error(`Path too long: ${filePath.slice(0, 50)}...`);
|
|
93245
93418
|
}
|
|
93246
93419
|
const normalized = normalize8(filePath);
|
|
93247
|
-
if (
|
|
93420
|
+
if (isAbsolute12(normalized)) {
|
|
93248
93421
|
throw new Error(`Absolute paths not allowed: ${filePath}`);
|
|
93249
93422
|
}
|
|
93250
93423
|
if (normalized.startsWith("..") || normalized.includes("/../")) {
|
|
@@ -93252,7 +93425,7 @@ async function validateSyncPath(basePath, filePath) {
|
|
|
93252
93425
|
}
|
|
93253
93426
|
const fullPath = join89(basePath, normalized);
|
|
93254
93427
|
const rel = relative18(basePath, fullPath);
|
|
93255
|
-
if (rel.startsWith("..") ||
|
|
93428
|
+
if (rel.startsWith("..") || isAbsolute12(rel)) {
|
|
93256
93429
|
throw new Error(`Path escapes base directory: ${filePath}`);
|
|
93257
93430
|
}
|
|
93258
93431
|
await validateSymlinkChain(fullPath, basePath);
|
|
@@ -93260,7 +93433,7 @@ async function validateSyncPath(basePath, filePath) {
|
|
|
93260
93433
|
const resolvedBase = await realpath8(basePath);
|
|
93261
93434
|
const resolvedFull = await realpath8(fullPath);
|
|
93262
93435
|
const resolvedRel = relative18(resolvedBase, resolvedFull);
|
|
93263
|
-
if (resolvedRel.startsWith("..") ||
|
|
93436
|
+
if (resolvedRel.startsWith("..") || isAbsolute12(resolvedRel)) {
|
|
93264
93437
|
throw new Error(`Symlink escapes base directory: ${filePath}`);
|
|
93265
93438
|
}
|
|
93266
93439
|
} catch (error) {
|
|
@@ -93270,7 +93443,7 @@ async function validateSyncPath(basePath, filePath) {
|
|
|
93270
93443
|
const resolvedBase = await realpath8(basePath);
|
|
93271
93444
|
const resolvedParent = await realpath8(parentPath);
|
|
93272
93445
|
const resolvedRel = relative18(resolvedBase, resolvedParent);
|
|
93273
|
-
if (resolvedRel.startsWith("..") ||
|
|
93446
|
+
if (resolvedRel.startsWith("..") || isAbsolute12(resolvedRel)) {
|
|
93274
93447
|
throw new Error(`Parent symlink escapes base directory: ${filePath}`);
|
|
93275
93448
|
}
|
|
93276
93449
|
} catch (parentError) {
|
|
@@ -94174,7 +94347,7 @@ async function getLatestVersion(kit, includePrereleases = false) {
|
|
|
94174
94347
|
init_logger();
|
|
94175
94348
|
init_path_resolver();
|
|
94176
94349
|
init_safe_prompts();
|
|
94177
|
-
import { join as
|
|
94350
|
+
import { join as join97 } from "node:path";
|
|
94178
94351
|
async function promptUpdateMode() {
|
|
94179
94352
|
const updateEverything = await se({
|
|
94180
94353
|
message: "Do you want to update everything?"
|
|
@@ -94216,7 +94389,7 @@ async function promptDirectorySelection(global3 = false) {
|
|
|
94216
94389
|
return selectedCategories;
|
|
94217
94390
|
}
|
|
94218
94391
|
async function promptFreshConfirmation(targetPath, analysis) {
|
|
94219
|
-
const backupRoot =
|
|
94392
|
+
const backupRoot = join97(PathResolver.getConfigDir(false), "backups");
|
|
94220
94393
|
logger.warning("[!] Fresh installation will remove ClaudeKit files:");
|
|
94221
94394
|
logger.info(`Path: ${targetPath}`);
|
|
94222
94395
|
logger.info(`Recovery backup: ${backupRoot}`);
|
|
@@ -94386,12 +94559,12 @@ class PromptsManager {
|
|
|
94386
94559
|
}
|
|
94387
94560
|
async promptPackageInstallations() {
|
|
94388
94561
|
log.step("Optional Package Installations");
|
|
94389
|
-
const [openCodeInstalled,
|
|
94562
|
+
const [openCodeInstalled, agyInstalled] = await Promise.all([
|
|
94390
94563
|
isOpenCodeInstalled(),
|
|
94391
|
-
|
|
94564
|
+
isAgyInstalled()
|
|
94392
94565
|
]);
|
|
94393
94566
|
let installOpenCode2 = false;
|
|
94394
|
-
let
|
|
94567
|
+
let installAgy2 = false;
|
|
94395
94568
|
if (openCodeInstalled) {
|
|
94396
94569
|
logger.success("OpenCode CLI is already installed");
|
|
94397
94570
|
} else {
|
|
@@ -94403,20 +94576,20 @@ class PromptsManager {
|
|
|
94403
94576
|
}
|
|
94404
94577
|
installOpenCode2 = shouldInstallOpenCode;
|
|
94405
94578
|
}
|
|
94406
|
-
if (
|
|
94407
|
-
logger.success("
|
|
94579
|
+
if (agyInstalled) {
|
|
94580
|
+
logger.success("Antigravity CLI (agy) is already installed");
|
|
94408
94581
|
} else {
|
|
94409
|
-
const
|
|
94410
|
-
message: "Install
|
|
94582
|
+
const shouldInstallAgy = await se({
|
|
94583
|
+
message: "Install Antigravity CLI (agy) for AI-powered assistance? (Optional additional AI capabilities)"
|
|
94411
94584
|
});
|
|
94412
|
-
if (lD(
|
|
94585
|
+
if (lD(shouldInstallAgy)) {
|
|
94413
94586
|
throw new Error("Package installation cancelled");
|
|
94414
94587
|
}
|
|
94415
|
-
|
|
94588
|
+
installAgy2 = shouldInstallAgy;
|
|
94416
94589
|
}
|
|
94417
94590
|
return {
|
|
94418
94591
|
installOpenCode: installOpenCode2,
|
|
94419
|
-
|
|
94592
|
+
installAgy: installAgy2
|
|
94420
94593
|
};
|
|
94421
94594
|
}
|
|
94422
94595
|
async promptSkillsInstallation() {
|
|
@@ -94432,11 +94605,11 @@ class PromptsManager {
|
|
|
94432
94605
|
failedInstalls.push(`${results.opencode.package}: ${results.opencode.error || "Installation failed"}`);
|
|
94433
94606
|
}
|
|
94434
94607
|
}
|
|
94435
|
-
if (results.
|
|
94436
|
-
if (results.
|
|
94437
|
-
successfulInstalls.push(`${results.
|
|
94608
|
+
if (results.agy) {
|
|
94609
|
+
if (results.agy.success) {
|
|
94610
|
+
successfulInstalls.push(`${results.agy.package}${results.agy.version ? ` v${results.agy.version}` : ""}`);
|
|
94438
94611
|
} else {
|
|
94439
|
-
failedInstalls.push(`${results.
|
|
94612
|
+
failedInstalls.push(`${results.agy.package}: ${results.agy.error || "Installation failed"}`);
|
|
94440
94613
|
}
|
|
94441
94614
|
}
|
|
94442
94615
|
if (successfulInstalls.length > 0) {
|
|
@@ -94444,7 +94617,7 @@ class PromptsManager {
|
|
|
94444
94617
|
}
|
|
94445
94618
|
if (failedInstalls.length > 0) {
|
|
94446
94619
|
logger.warning(`Failed to install: ${failedInstalls.join(", ")}`);
|
|
94447
|
-
logger.info("You can install these manually later
|
|
94620
|
+
logger.info("You can install these manually later from each tool's official install guide.");
|
|
94448
94621
|
}
|
|
94449
94622
|
}
|
|
94450
94623
|
async promptFreshConfirmation(targetPath, analysis) {
|
|
@@ -94493,7 +94666,7 @@ init_logger();
|
|
|
94493
94666
|
init_logger();
|
|
94494
94667
|
init_path_resolver();
|
|
94495
94668
|
var import_fs_extra10 = __toESM(require_lib(), 1);
|
|
94496
|
-
import { join as
|
|
94669
|
+
import { join as join98 } from "node:path";
|
|
94497
94670
|
async function handleConflicts(ctx) {
|
|
94498
94671
|
if (ctx.cancelled)
|
|
94499
94672
|
return ctx;
|
|
@@ -94502,7 +94675,7 @@ async function handleConflicts(ctx) {
|
|
|
94502
94675
|
if (PathResolver.isLocalSameAsGlobal()) {
|
|
94503
94676
|
return ctx;
|
|
94504
94677
|
}
|
|
94505
|
-
const localSettingsPath =
|
|
94678
|
+
const localSettingsPath = join98(process.cwd(), ".claude", "settings.json");
|
|
94506
94679
|
if (!await import_fs_extra10.pathExists(localSettingsPath)) {
|
|
94507
94680
|
return ctx;
|
|
94508
94681
|
}
|
|
@@ -94517,7 +94690,7 @@ async function handleConflicts(ctx) {
|
|
|
94517
94690
|
return { ...ctx, cancelled: true };
|
|
94518
94691
|
}
|
|
94519
94692
|
if (choice === "remove") {
|
|
94520
|
-
const localClaudeDir =
|
|
94693
|
+
const localClaudeDir = join98(process.cwd(), ".claude");
|
|
94521
94694
|
try {
|
|
94522
94695
|
await import_fs_extra10.remove(localClaudeDir);
|
|
94523
94696
|
logger.success("Removed local .claude/ directory");
|
|
@@ -94614,7 +94787,7 @@ init_logger();
|
|
|
94614
94787
|
init_safe_spinner();
|
|
94615
94788
|
import { mkdir as mkdir30, stat as stat17 } from "node:fs/promises";
|
|
94616
94789
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
94617
|
-
import { join as
|
|
94790
|
+
import { join as join105 } from "node:path";
|
|
94618
94791
|
|
|
94619
94792
|
// src/shared/temp-cleanup.ts
|
|
94620
94793
|
init_logger();
|
|
@@ -94633,7 +94806,7 @@ init_logger();
|
|
|
94633
94806
|
init_output_manager();
|
|
94634
94807
|
import { createWriteStream as createWriteStream2, rmSync } from "node:fs";
|
|
94635
94808
|
import { mkdir as mkdir25 } from "node:fs/promises";
|
|
94636
|
-
import { join as
|
|
94809
|
+
import { join as join99 } from "node:path";
|
|
94637
94810
|
|
|
94638
94811
|
// src/shared/progress-bar.ts
|
|
94639
94812
|
init_output_manager();
|
|
@@ -94843,7 +95016,7 @@ var MAX_DOWNLOAD_SIZE = 500 * 1024 * 1024;
|
|
|
94843
95016
|
class FileDownloader {
|
|
94844
95017
|
async downloadAsset(asset, destDir) {
|
|
94845
95018
|
try {
|
|
94846
|
-
const destPath =
|
|
95019
|
+
const destPath = join99(destDir, asset.name);
|
|
94847
95020
|
await mkdir25(destDir, { recursive: true });
|
|
94848
95021
|
output.info(`Downloading ${asset.name} (${formatBytes2(asset.size)})...`);
|
|
94849
95022
|
logger.verbose("Download details", {
|
|
@@ -94928,7 +95101,7 @@ class FileDownloader {
|
|
|
94928
95101
|
}
|
|
94929
95102
|
async downloadFile(params) {
|
|
94930
95103
|
const { url, name, size, destDir, token } = params;
|
|
94931
|
-
const destPath =
|
|
95104
|
+
const destPath = join99(destDir, name);
|
|
94932
95105
|
await mkdir25(destDir, { recursive: true });
|
|
94933
95106
|
output.info(`Downloading ${name}${size ? ` (${formatBytes2(size)})` : ""}...`);
|
|
94934
95107
|
const headers = {};
|
|
@@ -95014,7 +95187,7 @@ init_logger();
|
|
|
95014
95187
|
init_types3();
|
|
95015
95188
|
import { constants as constants4 } from "node:fs";
|
|
95016
95189
|
import { access as access5, readdir as readdir23 } from "node:fs/promises";
|
|
95017
|
-
import { join as
|
|
95190
|
+
import { join as join100 } from "node:path";
|
|
95018
95191
|
async function pathExists11(path8) {
|
|
95019
95192
|
try {
|
|
95020
95193
|
await access5(path8, constants4.F_OK);
|
|
@@ -95033,7 +95206,7 @@ async function validateExtraction(extractDir) {
|
|
|
95033
95206
|
const criticalPaths = [".claude"];
|
|
95034
95207
|
const missingPaths = [];
|
|
95035
95208
|
for (const path8 of criticalPaths) {
|
|
95036
|
-
if (await pathExists11(
|
|
95209
|
+
if (await pathExists11(join100(extractDir, path8))) {
|
|
95037
95210
|
logger.debug(`Found: ${path8}`);
|
|
95038
95211
|
continue;
|
|
95039
95212
|
}
|
|
@@ -95043,7 +95216,7 @@ async function validateExtraction(extractDir) {
|
|
|
95043
95216
|
const guidancePaths = ["CLAUDE.md", ".claude/CLAUDE.md", ".claude/rules/CLAUDE.md"];
|
|
95044
95217
|
let guidancePath = null;
|
|
95045
95218
|
for (const path8 of guidancePaths) {
|
|
95046
|
-
if (await pathExists11(
|
|
95219
|
+
if (await pathExists11(join100(extractDir, path8))) {
|
|
95047
95220
|
guidancePath = path8;
|
|
95048
95221
|
break;
|
|
95049
95222
|
}
|
|
@@ -95068,7 +95241,7 @@ async function validateExtraction(extractDir) {
|
|
|
95068
95241
|
// src/domains/installation/extraction/tar-extractor.ts
|
|
95069
95242
|
init_logger();
|
|
95070
95243
|
import { copyFile as copyFile4, mkdir as mkdir28, readdir as readdir25, rm as rm11, stat as stat15 } from "node:fs/promises";
|
|
95071
|
-
import { join as
|
|
95244
|
+
import { join as join103 } from "node:path";
|
|
95072
95245
|
|
|
95073
95246
|
// node_modules/@isaacs/fs-minipass/dist/esm/index.js
|
|
95074
95247
|
import EE from "events";
|
|
@@ -99119,11 +99292,11 @@ var modeFix = (mode, isDir2, portable) => {
|
|
|
99119
99292
|
|
|
99120
99293
|
// node_modules/tar/dist/esm/strip-absolute-path.js
|
|
99121
99294
|
import { win32 as win322 } from "node:path";
|
|
99122
|
-
var { isAbsolute:
|
|
99295
|
+
var { isAbsolute: isAbsolute13, parse: parse5 } = win322;
|
|
99123
99296
|
var stripAbsolutePath = (path8) => {
|
|
99124
99297
|
let r2 = "";
|
|
99125
99298
|
let parsed = parse5(path8);
|
|
99126
|
-
while (
|
|
99299
|
+
while (isAbsolute13(path8) || parsed.root) {
|
|
99127
99300
|
const root = path8.charAt(0) === "/" && path8.slice(0, 4) !== "//?/" ? "/" : parsed.root;
|
|
99128
99301
|
path8 = path8.slice(root.length);
|
|
99129
99302
|
r2 += root;
|
|
@@ -100830,7 +101003,7 @@ var mkdirSync4 = (dir, opt) => {
|
|
|
100830
101003
|
};
|
|
100831
101004
|
|
|
100832
101005
|
// node_modules/tar/dist/esm/path-reservations.js
|
|
100833
|
-
import { join as
|
|
101006
|
+
import { join as join101 } from "node:path";
|
|
100834
101007
|
|
|
100835
101008
|
// node_modules/tar/dist/esm/normalize-unicode.js
|
|
100836
101009
|
var normalizeCache = Object.create(null);
|
|
@@ -100863,7 +101036,7 @@ var getDirs = (path13) => {
|
|
|
100863
101036
|
const dirs = path13.split("/").slice(0, -1).reduce((set, path14) => {
|
|
100864
101037
|
const s = set[set.length - 1];
|
|
100865
101038
|
if (s !== undefined) {
|
|
100866
|
-
path14 =
|
|
101039
|
+
path14 = join101(s, path14);
|
|
100867
101040
|
}
|
|
100868
101041
|
set.push(path14 || "/");
|
|
100869
101042
|
return set;
|
|
@@ -100877,7 +101050,7 @@ class PathReservations {
|
|
|
100877
101050
|
#running = new Set;
|
|
100878
101051
|
reserve(paths, fn) {
|
|
100879
101052
|
paths = isWindows4 ? ["win32 parallelization disabled"] : paths.map((p) => {
|
|
100880
|
-
return stripTrailingSlashes(
|
|
101053
|
+
return stripTrailingSlashes(join101(normalizeUnicode(p))).toLowerCase();
|
|
100881
101054
|
});
|
|
100882
101055
|
const dirs = new Set(paths.map((path13) => getDirs(path13)).reduce((a3, b3) => a3.concat(b3)));
|
|
100883
101056
|
this.#reservations.set(fn, { dirs, paths });
|
|
@@ -101937,7 +102110,7 @@ function decodeFilePath(path15) {
|
|
|
101937
102110
|
init_logger();
|
|
101938
102111
|
init_types3();
|
|
101939
102112
|
import { copyFile as copyFile3, lstat as lstat7, mkdir as mkdir27, readdir as readdir24 } from "node:fs/promises";
|
|
101940
|
-
import { join as
|
|
102113
|
+
import { join as join102, relative as relative20 } from "node:path";
|
|
101941
102114
|
async function withRetry(fn, retries = 3) {
|
|
101942
102115
|
for (let i = 0;i < retries; i++) {
|
|
101943
102116
|
try {
|
|
@@ -101959,8 +102132,8 @@ async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTrac
|
|
|
101959
102132
|
await mkdir27(destDir, { recursive: true });
|
|
101960
102133
|
const entries = await readdir24(sourceDir, { encoding: "utf8" });
|
|
101961
102134
|
for (const entry of entries) {
|
|
101962
|
-
const sourcePath =
|
|
101963
|
-
const destPath =
|
|
102135
|
+
const sourcePath = join102(sourceDir, entry);
|
|
102136
|
+
const destPath = join102(destDir, entry);
|
|
101964
102137
|
const relativePath = relative20(sourceDir, sourcePath);
|
|
101965
102138
|
if (!isPathSafe(destDir, destPath)) {
|
|
101966
102139
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -101987,8 +102160,8 @@ async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
|
101987
102160
|
await mkdir27(destDir, { recursive: true });
|
|
101988
102161
|
const entries = await readdir24(sourceDir, { encoding: "utf8" });
|
|
101989
102162
|
for (const entry of entries) {
|
|
101990
|
-
const sourcePath =
|
|
101991
|
-
const destPath =
|
|
102163
|
+
const sourcePath = join102(sourceDir, entry);
|
|
102164
|
+
const destPath = join102(destDir, entry);
|
|
101992
102165
|
const relativePath = relative20(sourceDir, sourcePath);
|
|
101993
102166
|
if (!isPathSafe(destDir, destPath)) {
|
|
101994
102167
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -102036,7 +102209,7 @@ class TarExtractor {
|
|
|
102036
102209
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
102037
102210
|
if (entries.length === 1) {
|
|
102038
102211
|
const rootEntry = entries[0];
|
|
102039
|
-
const rootPath =
|
|
102212
|
+
const rootPath = join103(tempExtractDir, rootEntry);
|
|
102040
102213
|
const rootStat = await stat15(rootPath);
|
|
102041
102214
|
if (rootStat.isDirectory()) {
|
|
102042
102215
|
const rootContents = await readdir25(rootPath, { encoding: "utf8" });
|
|
@@ -102052,7 +102225,7 @@ class TarExtractor {
|
|
|
102052
102225
|
}
|
|
102053
102226
|
} else {
|
|
102054
102227
|
await mkdir28(destDir, { recursive: true });
|
|
102055
|
-
await copyFile4(rootPath,
|
|
102228
|
+
await copyFile4(rootPath, join103(destDir, rootEntry));
|
|
102056
102229
|
}
|
|
102057
102230
|
} else {
|
|
102058
102231
|
logger.debug("Multiple root entries - moving all");
|
|
@@ -102074,7 +102247,7 @@ init_logger();
|
|
|
102074
102247
|
var import_extract_zip = __toESM(require_extract_zip(), 1);
|
|
102075
102248
|
import { execFile as execFile11 } from "node:child_process";
|
|
102076
102249
|
import { copyFile as copyFile5, mkdir as mkdir29, readdir as readdir26, rm as rm12, stat as stat16 } from "node:fs/promises";
|
|
102077
|
-
import { join as
|
|
102250
|
+
import { join as join104 } from "node:path";
|
|
102078
102251
|
import { promisify as promisify16 } from "node:util";
|
|
102079
102252
|
|
|
102080
102253
|
// src/domains/installation/extraction/native-zip-commands.ts
|
|
@@ -102166,7 +102339,7 @@ class ZipExtractor {
|
|
|
102166
102339
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
102167
102340
|
if (entries.length === 1) {
|
|
102168
102341
|
const rootEntry = entries[0];
|
|
102169
|
-
const rootPath =
|
|
102342
|
+
const rootPath = join104(tempExtractDir, rootEntry);
|
|
102170
102343
|
const rootStat = await stat16(rootPath);
|
|
102171
102344
|
if (rootStat.isDirectory()) {
|
|
102172
102345
|
const rootContents = await readdir26(rootPath, { encoding: "utf8" });
|
|
@@ -102182,7 +102355,7 @@ class ZipExtractor {
|
|
|
102182
102355
|
}
|
|
102183
102356
|
} else {
|
|
102184
102357
|
await mkdir29(destDir, { recursive: true });
|
|
102185
|
-
await copyFile5(rootPath,
|
|
102358
|
+
await copyFile5(rootPath, join104(destDir, rootEntry));
|
|
102186
102359
|
}
|
|
102187
102360
|
} else {
|
|
102188
102361
|
logger.debug("Multiple root entries - moving all");
|
|
@@ -102283,7 +102456,7 @@ class DownloadManager {
|
|
|
102283
102456
|
async createTempDir() {
|
|
102284
102457
|
const timestamp = Date.now();
|
|
102285
102458
|
const counter = DownloadManager.tempDirCounter++;
|
|
102286
|
-
const primaryTempDir =
|
|
102459
|
+
const primaryTempDir = join105(tmpdir4(), `claudekit-${timestamp}-${counter}`);
|
|
102287
102460
|
try {
|
|
102288
102461
|
await mkdir30(primaryTempDir, { recursive: true });
|
|
102289
102462
|
logger.debug(`Created temp directory: ${primaryTempDir}`);
|
|
@@ -102300,7 +102473,7 @@ Solutions:
|
|
|
102300
102473
|
2. Set HOME environment variable
|
|
102301
102474
|
3. Try running from a different directory`);
|
|
102302
102475
|
}
|
|
102303
|
-
const fallbackTempDir =
|
|
102476
|
+
const fallbackTempDir = join105(homeDir, ".claudekit", "tmp", `claudekit-${timestamp}-${counter}`);
|
|
102304
102477
|
try {
|
|
102305
102478
|
await mkdir30(fallbackTempDir, { recursive: true });
|
|
102306
102479
|
logger.debug(`Created temp directory (fallback): ${fallbackTempDir}`);
|
|
@@ -102760,20 +102933,20 @@ async function handleDownload(ctx) {
|
|
|
102760
102933
|
};
|
|
102761
102934
|
}
|
|
102762
102935
|
// src/commands/init/phases/merge-handler.ts
|
|
102763
|
-
import { join as
|
|
102936
|
+
import { join as join123 } from "node:path";
|
|
102764
102937
|
|
|
102765
102938
|
// src/domains/installation/deletion-handler.ts
|
|
102766
102939
|
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
|
|
102940
|
+
import { dirname as dirname38, join as join108, relative as relative21, resolve as resolve42, sep as sep12 } from "node:path";
|
|
102768
102941
|
|
|
102769
102942
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
102770
102943
|
init_metadata_migration();
|
|
102771
102944
|
init_logger();
|
|
102772
102945
|
init_types3();
|
|
102773
102946
|
var import_fs_extra11 = __toESM(require_lib(), 1);
|
|
102774
|
-
import { join as
|
|
102947
|
+
import { join as join107 } from "node:path";
|
|
102775
102948
|
async function readManifest(claudeDir3) {
|
|
102776
|
-
const metadataPath =
|
|
102949
|
+
const metadataPath = join107(claudeDir3, "metadata.json");
|
|
102777
102950
|
if (!await import_fs_extra11.pathExists(metadataPath)) {
|
|
102778
102951
|
return null;
|
|
102779
102952
|
}
|
|
@@ -102959,7 +103132,7 @@ function collectFilesRecursively(dir, baseDir) {
|
|
|
102959
103132
|
try {
|
|
102960
103133
|
const entries = readdirSync10(dir, { withFileTypes: true });
|
|
102961
103134
|
for (const entry of entries) {
|
|
102962
|
-
const fullPath =
|
|
103135
|
+
const fullPath = join108(dir, entry.name);
|
|
102963
103136
|
const relativePath = relative21(baseDir, fullPath);
|
|
102964
103137
|
if (entry.isDirectory()) {
|
|
102965
103138
|
results.push(...collectFilesRecursively(fullPath, baseDir));
|
|
@@ -103027,7 +103200,7 @@ function deletePath(fullPath, claudeDir3) {
|
|
|
103027
103200
|
}
|
|
103028
103201
|
}
|
|
103029
103202
|
async function updateMetadataAfterDeletion(claudeDir3, deletedPaths) {
|
|
103030
|
-
const metadataPath =
|
|
103203
|
+
const metadataPath = join108(claudeDir3, "metadata.json");
|
|
103031
103204
|
if (!await import_fs_extra12.pathExists(metadataPath)) {
|
|
103032
103205
|
return;
|
|
103033
103206
|
}
|
|
@@ -103082,7 +103255,7 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
|
|
|
103082
103255
|
const userMetadata = await readManifest(claudeDir3);
|
|
103083
103256
|
const result = { deletedPaths: [], preservedPaths: [], errors: [] };
|
|
103084
103257
|
for (const path16 of deletions) {
|
|
103085
|
-
const fullPath =
|
|
103258
|
+
const fullPath = join108(claudeDir3, path16);
|
|
103086
103259
|
const normalizedPath = resolve42(fullPath);
|
|
103087
103260
|
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
103088
103261
|
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep12}`)) {
|
|
@@ -103122,7 +103295,7 @@ init_logger();
|
|
|
103122
103295
|
init_types3();
|
|
103123
103296
|
var import_fs_extra16 = __toESM(require_lib(), 1);
|
|
103124
103297
|
var import_ignore3 = __toESM(require_ignore(), 1);
|
|
103125
|
-
import { dirname as dirname42, join as
|
|
103298
|
+
import { dirname as dirname42, join as join113, relative as relative24 } from "node:path";
|
|
103126
103299
|
|
|
103127
103300
|
// src/domains/installation/selective-merger.ts
|
|
103128
103301
|
import { stat as stat18 } from "node:fs/promises";
|
|
@@ -103298,7 +103471,7 @@ class SelectiveMerger {
|
|
|
103298
103471
|
|
|
103299
103472
|
// src/domains/installation/merger/deleted-skill-preservation.ts
|
|
103300
103473
|
init_metadata_migration();
|
|
103301
|
-
import { dirname as dirname39, join as
|
|
103474
|
+
import { dirname as dirname39, join as join109, relative as relative22 } from "node:path";
|
|
103302
103475
|
var import_fs_extra13 = __toESM(require_lib(), 1);
|
|
103303
103476
|
async function findIgnoredSkillDirectories({
|
|
103304
103477
|
files,
|
|
@@ -103326,7 +103499,7 @@ async function findIgnoredSkillDirectories({
|
|
|
103326
103499
|
return root ? [root] : [];
|
|
103327
103500
|
}));
|
|
103328
103501
|
for (const [metadataRoot, sourceRoot] of sourceSkillRoots) {
|
|
103329
|
-
const destSkillRoot =
|
|
103502
|
+
const destSkillRoot = join109(destDir, ...sourceRoot.split("/"));
|
|
103330
103503
|
const skillExists = await import_fs_extra13.pathExists(destSkillRoot);
|
|
103331
103504
|
if (existingIgnoredRoots.has(metadataRoot) || !skillExists && previouslyTrackedRoots.has(metadataRoot)) {
|
|
103332
103505
|
ignoredSkillDirectories.add(metadataRoot);
|
|
@@ -103376,7 +103549,7 @@ init_logger();
|
|
|
103376
103549
|
var import_fs_extra14 = __toESM(require_lib(), 1);
|
|
103377
103550
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
103378
103551
|
import { relative as relative23 } from "node:path";
|
|
103379
|
-
import { join as
|
|
103552
|
+
import { join as join110 } from "node:path";
|
|
103380
103553
|
|
|
103381
103554
|
// node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
103382
103555
|
var balanced = (a3, b3, str2) => {
|
|
@@ -104832,7 +105005,7 @@ class FileScanner {
|
|
|
104832
105005
|
const files = [];
|
|
104833
105006
|
const entries = await import_fs_extra14.readdir(dir, { encoding: "utf8" });
|
|
104834
105007
|
for (const entry of entries) {
|
|
104835
|
-
const fullPath =
|
|
105008
|
+
const fullPath = join110(dir, entry);
|
|
104836
105009
|
const relativePath = relative23(baseDir, fullPath);
|
|
104837
105010
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
104838
105011
|
const stats = await import_fs_extra14.lstat(fullPath);
|
|
@@ -104868,13 +105041,13 @@ class FileScanner {
|
|
|
104868
105041
|
// src/domains/installation/merger/settings-processor.ts
|
|
104869
105042
|
import { execSync as execSync5 } from "node:child_process";
|
|
104870
105043
|
import { homedir as homedir46 } from "node:os";
|
|
104871
|
-
import { dirname as dirname41, join as
|
|
105044
|
+
import { dirname as dirname41, join as join112 } from "node:path";
|
|
104872
105045
|
|
|
104873
105046
|
// src/domains/config/installed-settings-tracker.ts
|
|
104874
105047
|
init_shared();
|
|
104875
105048
|
import { existsSync as existsSync67 } from "node:fs";
|
|
104876
105049
|
import { mkdir as mkdir31, readFile as readFile52, writeFile as writeFile27 } from "node:fs/promises";
|
|
104877
|
-
import { dirname as dirname40, join as
|
|
105050
|
+
import { dirname as dirname40, join as join111 } from "node:path";
|
|
104878
105051
|
var CK_JSON_FILE = ".ck.json";
|
|
104879
105052
|
|
|
104880
105053
|
class InstalledSettingsTracker {
|
|
@@ -104888,9 +105061,9 @@ class InstalledSettingsTracker {
|
|
|
104888
105061
|
}
|
|
104889
105062
|
getCkJsonPath() {
|
|
104890
105063
|
if (this.isGlobal) {
|
|
104891
|
-
return
|
|
105064
|
+
return join111(this.projectDir, CK_JSON_FILE);
|
|
104892
105065
|
}
|
|
104893
|
-
return
|
|
105066
|
+
return join111(this.projectDir, ".claude", CK_JSON_FILE);
|
|
104894
105067
|
}
|
|
104895
105068
|
async loadInstalledSettings() {
|
|
104896
105069
|
const ckJsonPath = this.getCkJsonPath();
|
|
@@ -105158,10 +105331,10 @@ class SettingsProcessor {
|
|
|
105158
105331
|
};
|
|
105159
105332
|
try {
|
|
105160
105333
|
if (this.isGlobal) {
|
|
105161
|
-
await addFromConfig(
|
|
105334
|
+
await addFromConfig(join112(this.projectDir, ".ck.json"));
|
|
105162
105335
|
} else {
|
|
105163
|
-
await addFromConfig(
|
|
105164
|
-
await addFromConfig(
|
|
105336
|
+
await addFromConfig(join112(PathResolver.getGlobalKitDir(), ".ck.json"));
|
|
105337
|
+
await addFromConfig(join112(this.projectDir, ".claude", ".ck.json"));
|
|
105165
105338
|
}
|
|
105166
105339
|
} catch (error) {
|
|
105167
105340
|
logger.debug(`Failed to load .ck.json hook preferences: ${error instanceof Error ? error.message : "unknown"}`);
|
|
@@ -105548,7 +105721,7 @@ class SettingsProcessor {
|
|
|
105548
105721
|
return false;
|
|
105549
105722
|
}
|
|
105550
105723
|
const configuredGlobalDir = PathResolver.getGlobalKitDir().replace(/\\/g, "/").replace(/\/+$/, "");
|
|
105551
|
-
const defaultGlobalDir =
|
|
105724
|
+
const defaultGlobalDir = join112(homedir46(), ".claude").replace(/\\/g, "/");
|
|
105552
105725
|
return configuredGlobalDir !== defaultGlobalDir;
|
|
105553
105726
|
}
|
|
105554
105727
|
getClaudeCommandRoot() {
|
|
@@ -105568,7 +105741,7 @@ class SettingsProcessor {
|
|
|
105568
105741
|
return true;
|
|
105569
105742
|
}
|
|
105570
105743
|
async repairSiblingSettingsLocal(destFile) {
|
|
105571
|
-
const settingsLocalPath =
|
|
105744
|
+
const settingsLocalPath = join112(dirname41(destFile), "settings.local.json");
|
|
105572
105745
|
if (settingsLocalPath === destFile || !await import_fs_extra15.pathExists(settingsLocalPath)) {
|
|
105573
105746
|
return;
|
|
105574
105747
|
}
|
|
@@ -105665,7 +105838,7 @@ class SettingsProcessor {
|
|
|
105665
105838
|
}
|
|
105666
105839
|
}
|
|
105667
105840
|
async dynamicTeamHookHandlerExists(destFile, handler) {
|
|
105668
|
-
return import_fs_extra15.pathExists(
|
|
105841
|
+
return import_fs_extra15.pathExists(join112(dirname41(destFile), "hooks", handler));
|
|
105669
105842
|
}
|
|
105670
105843
|
removeDynamicTeamHookRegistrations(settings) {
|
|
105671
105844
|
let removed = 0;
|
|
@@ -105806,7 +105979,7 @@ class CopyExecutor {
|
|
|
105806
105979
|
for (const file of files) {
|
|
105807
105980
|
const relativePath = relative24(sourceDir, file);
|
|
105808
105981
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
105809
|
-
const destPath =
|
|
105982
|
+
const destPath = join113(destDir, relativePath);
|
|
105810
105983
|
if (await import_fs_extra16.pathExists(destPath)) {
|
|
105811
105984
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
105812
105985
|
logger.debug(`Security-sensitive file exists but won't be overwritten: ${normalizedRelativePath}`);
|
|
@@ -105830,7 +106003,7 @@ class CopyExecutor {
|
|
|
105830
106003
|
for (const file of files) {
|
|
105831
106004
|
const relativePath = relative24(sourceDir, file);
|
|
105832
106005
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
105833
|
-
const destPath =
|
|
106006
|
+
const destPath = join113(destDir, relativePath);
|
|
105834
106007
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
105835
106008
|
logger.debug(`Skipping security-sensitive file: ${normalizedRelativePath}`);
|
|
105836
106009
|
skippedCount++;
|
|
@@ -106042,15 +106215,15 @@ class FileMerger {
|
|
|
106042
106215
|
|
|
106043
106216
|
// src/domains/migration/legacy-migration.ts
|
|
106044
106217
|
import { readdir as readdir28, stat as stat19 } from "node:fs/promises";
|
|
106045
|
-
import { join as
|
|
106218
|
+
import { join as join117, relative as relative25 } from "node:path";
|
|
106046
106219
|
// src/services/file-operations/manifest/manifest-tracker.ts
|
|
106047
|
-
import { join as
|
|
106220
|
+
import { join as join116 } from "node:path";
|
|
106048
106221
|
|
|
106049
106222
|
// src/domains/migration/release-manifest.ts
|
|
106050
106223
|
init_logger();
|
|
106051
106224
|
init_zod();
|
|
106052
106225
|
var import_fs_extra17 = __toESM(require_lib(), 1);
|
|
106053
|
-
import { join as
|
|
106226
|
+
import { join as join114 } from "node:path";
|
|
106054
106227
|
var ReleaseManifestFileSchema = exports_external.object({
|
|
106055
106228
|
path: exports_external.string(),
|
|
106056
106229
|
checksum: exports_external.string().regex(/^[a-f0-9]{64}$/),
|
|
@@ -106065,7 +106238,7 @@ var ReleaseManifestSchema = exports_external.object({
|
|
|
106065
106238
|
|
|
106066
106239
|
class ReleaseManifestLoader {
|
|
106067
106240
|
static async load(extractDir) {
|
|
106068
|
-
const manifestPath =
|
|
106241
|
+
const manifestPath = join114(extractDir, "release-manifest.json");
|
|
106069
106242
|
try {
|
|
106070
106243
|
const content = await import_fs_extra17.readFile(manifestPath, "utf-8");
|
|
106071
106244
|
const parsed = JSON.parse(content);
|
|
@@ -106088,12 +106261,12 @@ init_p_limit();
|
|
|
106088
106261
|
|
|
106089
106262
|
// src/services/file-operations/manifest/manifest-updater.ts
|
|
106090
106263
|
init_metadata_migration();
|
|
106091
|
-
import { join as
|
|
106264
|
+
import { join as join115 } from "node:path";
|
|
106092
106265
|
init_logger();
|
|
106093
106266
|
init_types3();
|
|
106094
106267
|
var import_fs_extra18 = __toESM(require_lib(), 1);
|
|
106095
106268
|
async function writeManifest(claudeDir3, kitName, version, scope, kitType, trackedFiles, userConfigFiles, ignoredSkills = []) {
|
|
106096
|
-
const metadataPath =
|
|
106269
|
+
const metadataPath = join115(claudeDir3, "metadata.json");
|
|
106097
106270
|
const kit = kitType || (/\bmarketing\b/i.test(kitName) ? "marketing" : "engineer");
|
|
106098
106271
|
await import_fs_extra18.ensureFile(metadataPath);
|
|
106099
106272
|
let release = null;
|
|
@@ -106165,7 +106338,7 @@ function uniqueNormalizedSkillRoots(paths) {
|
|
|
106165
106338
|
}))).sort();
|
|
106166
106339
|
}
|
|
106167
106340
|
async function removeKitFromManifest(claudeDir3, kit, options2) {
|
|
106168
|
-
const metadataPath =
|
|
106341
|
+
const metadataPath = join115(claudeDir3, "metadata.json");
|
|
106169
106342
|
if (!await import_fs_extra18.pathExists(metadataPath))
|
|
106170
106343
|
return false;
|
|
106171
106344
|
let release = null;
|
|
@@ -106197,7 +106370,7 @@ async function removeKitFromManifest(claudeDir3, kit, options2) {
|
|
|
106197
106370
|
}
|
|
106198
106371
|
}
|
|
106199
106372
|
async function retainTrackedFilesInManifest(claudeDir3, retainedPaths, options2) {
|
|
106200
|
-
const metadataPath =
|
|
106373
|
+
const metadataPath = join115(claudeDir3, "metadata.json");
|
|
106201
106374
|
if (!await import_fs_extra18.pathExists(metadataPath))
|
|
106202
106375
|
return false;
|
|
106203
106376
|
const normalizedPaths = new Set(retainedPaths.map((path17) => path17.replace(/\\/g, "/")));
|
|
@@ -106378,7 +106551,7 @@ function buildFileTrackingList(options2) {
|
|
|
106378
106551
|
if (!isGlobal && !installedPath.startsWith(".claude/"))
|
|
106379
106552
|
continue;
|
|
106380
106553
|
const relativePath = isGlobal ? installedPath : installedPath.replace(/^\.claude\//, "");
|
|
106381
|
-
const filePath =
|
|
106554
|
+
const filePath = join116(claudeDir3, relativePath);
|
|
106382
106555
|
const manifestEntry = releaseManifest ? ReleaseManifestLoader.findFile(releaseManifest, installedPath) : null;
|
|
106383
106556
|
const ownership = manifestEntry ? "ck" : "user";
|
|
106384
106557
|
filesToTrack.push({
|
|
@@ -106489,7 +106662,7 @@ class LegacyMigration {
|
|
|
106489
106662
|
continue;
|
|
106490
106663
|
if (SKIP_DIRS_ALL.includes(entry))
|
|
106491
106664
|
continue;
|
|
106492
|
-
const fullPath =
|
|
106665
|
+
const fullPath = join117(dir, entry);
|
|
106493
106666
|
let stats;
|
|
106494
106667
|
try {
|
|
106495
106668
|
stats = await stat19(fullPath);
|
|
@@ -106599,7 +106772,7 @@ User-created files (sample):`);
|
|
|
106599
106772
|
];
|
|
106600
106773
|
if (filesToChecksum.length > 0) {
|
|
106601
106774
|
const checksumResults = await mapWithLimit(filesToChecksum, async ({ relativePath, ownership }) => {
|
|
106602
|
-
const fullPath =
|
|
106775
|
+
const fullPath = join117(claudeDir3, relativePath);
|
|
106603
106776
|
const checksum = await OwnershipChecker.calculateChecksum(fullPath);
|
|
106604
106777
|
return { relativePath, checksum, ownership };
|
|
106605
106778
|
}, getOptimalConcurrency());
|
|
@@ -106620,7 +106793,7 @@ User-created files (sample):`);
|
|
|
106620
106793
|
installedAt: new Date().toISOString(),
|
|
106621
106794
|
files: trackedFiles
|
|
106622
106795
|
};
|
|
106623
|
-
const metadataPath =
|
|
106796
|
+
const metadataPath = join117(claudeDir3, "metadata.json");
|
|
106624
106797
|
await import_fs_extra19.writeFile(metadataPath, JSON.stringify(updatedMetadata, null, 2));
|
|
106625
106798
|
logger.success(`Migration complete: tracked ${trackedFiles.length} files`);
|
|
106626
106799
|
return true;
|
|
@@ -106726,7 +106899,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
|
|
|
106726
106899
|
init_logger();
|
|
106727
106900
|
init_skip_directories();
|
|
106728
106901
|
var import_fs_extra20 = __toESM(require_lib(), 1);
|
|
106729
|
-
import { join as
|
|
106902
|
+
import { join as join118, relative as relative26, resolve as resolve43 } from "node:path";
|
|
106730
106903
|
|
|
106731
106904
|
class FileScanner2 {
|
|
106732
106905
|
static async getFiles(dirPath, relativeTo) {
|
|
@@ -106742,7 +106915,7 @@ class FileScanner2 {
|
|
|
106742
106915
|
logger.debug(`Skipping directory: ${entry}`);
|
|
106743
106916
|
continue;
|
|
106744
106917
|
}
|
|
106745
|
-
const fullPath =
|
|
106918
|
+
const fullPath = join118(dirPath, entry);
|
|
106746
106919
|
if (!FileScanner2.isSafePath(basePath, fullPath)) {
|
|
106747
106920
|
logger.warning(`Skipping potentially unsafe path: ${entry}`);
|
|
106748
106921
|
continue;
|
|
@@ -106777,8 +106950,8 @@ class FileScanner2 {
|
|
|
106777
106950
|
return files;
|
|
106778
106951
|
}
|
|
106779
106952
|
static async findCustomFiles(destDir, sourceDir, subPath) {
|
|
106780
|
-
const destSubDir =
|
|
106781
|
-
const sourceSubDir =
|
|
106953
|
+
const destSubDir = join118(destDir, subPath);
|
|
106954
|
+
const sourceSubDir = join118(sourceDir, subPath);
|
|
106782
106955
|
logger.debug(`findCustomFiles - destDir: ${destDir}`);
|
|
106783
106956
|
logger.debug(`findCustomFiles - sourceDir: ${sourceDir}`);
|
|
106784
106957
|
logger.debug(`findCustomFiles - subPath: "${subPath}"`);
|
|
@@ -106819,12 +106992,12 @@ class FileScanner2 {
|
|
|
106819
106992
|
init_logger();
|
|
106820
106993
|
var import_fs_extra21 = __toESM(require_lib(), 1);
|
|
106821
106994
|
import { lstat as lstat10, mkdir as mkdir32, readdir as readdir31, stat as stat20 } from "node:fs/promises";
|
|
106822
|
-
import { join as
|
|
106995
|
+
import { join as join120 } from "node:path";
|
|
106823
106996
|
|
|
106824
106997
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
106825
106998
|
init_logger();
|
|
106826
106999
|
import { readFile as readFile56, readdir as readdir30, writeFile as writeFile31 } from "node:fs/promises";
|
|
106827
|
-
import { join as
|
|
107000
|
+
import { join as join119 } from "node:path";
|
|
106828
107001
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
106829
107002
|
".md",
|
|
106830
107003
|
".txt",
|
|
@@ -106884,7 +107057,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
106884
107057
|
async function processDirectory(dir) {
|
|
106885
107058
|
const entries = await readdir30(dir, { withFileTypes: true });
|
|
106886
107059
|
for (const entry of entries) {
|
|
106887
|
-
const fullPath =
|
|
107060
|
+
const fullPath = join119(dir, entry.name);
|
|
106888
107061
|
if (entry.isDirectory()) {
|
|
106889
107062
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
106890
107063
|
continue;
|
|
@@ -106959,14 +107132,14 @@ function shouldApplyPrefix(options2) {
|
|
|
106959
107132
|
// src/services/transformers/commands-prefix/prefix-applier.ts
|
|
106960
107133
|
async function applyPrefix(extractDir) {
|
|
106961
107134
|
validatePath(extractDir, "extractDir");
|
|
106962
|
-
const commandsDir =
|
|
107135
|
+
const commandsDir = join120(extractDir, ".claude", "commands");
|
|
106963
107136
|
if (!await import_fs_extra21.pathExists(commandsDir)) {
|
|
106964
107137
|
logger.verbose("No commands directory found, skipping prefix application");
|
|
106965
107138
|
return;
|
|
106966
107139
|
}
|
|
106967
107140
|
logger.info("Applying /ck: prefix to slash commands...");
|
|
106968
|
-
const backupDir =
|
|
106969
|
-
const tempDir =
|
|
107141
|
+
const backupDir = join120(extractDir, ".commands-backup");
|
|
107142
|
+
const tempDir = join120(extractDir, ".commands-prefix-temp");
|
|
106970
107143
|
try {
|
|
106971
107144
|
const entries = await readdir31(commandsDir);
|
|
106972
107145
|
if (entries.length === 0) {
|
|
@@ -106974,7 +107147,7 @@ async function applyPrefix(extractDir) {
|
|
|
106974
107147
|
return;
|
|
106975
107148
|
}
|
|
106976
107149
|
if (entries.length === 1 && entries[0] === "ck") {
|
|
106977
|
-
const ckDir2 =
|
|
107150
|
+
const ckDir2 = join120(commandsDir, "ck");
|
|
106978
107151
|
const ckStat = await stat20(ckDir2);
|
|
106979
107152
|
if (ckStat.isDirectory()) {
|
|
106980
107153
|
logger.verbose("Commands already have /ck: prefix, skipping");
|
|
@@ -106984,17 +107157,17 @@ async function applyPrefix(extractDir) {
|
|
|
106984
107157
|
await import_fs_extra21.copy(commandsDir, backupDir);
|
|
106985
107158
|
logger.verbose("Created backup of commands directory");
|
|
106986
107159
|
await mkdir32(tempDir, { recursive: true });
|
|
106987
|
-
const ckDir =
|
|
107160
|
+
const ckDir = join120(tempDir, "ck");
|
|
106988
107161
|
await mkdir32(ckDir, { recursive: true });
|
|
106989
107162
|
let processedCount = 0;
|
|
106990
107163
|
for (const entry of entries) {
|
|
106991
|
-
const sourcePath =
|
|
107164
|
+
const sourcePath = join120(commandsDir, entry);
|
|
106992
107165
|
const stats = await lstat10(sourcePath);
|
|
106993
107166
|
if (stats.isSymbolicLink()) {
|
|
106994
107167
|
logger.warning(`Skipping symlink for security: ${entry}`);
|
|
106995
107168
|
continue;
|
|
106996
107169
|
}
|
|
106997
|
-
const destPath =
|
|
107170
|
+
const destPath = join120(ckDir, entry);
|
|
106998
107171
|
await import_fs_extra21.copy(sourcePath, destPath, {
|
|
106999
107172
|
overwrite: false,
|
|
107000
107173
|
errorOnExist: true
|
|
@@ -107012,7 +107185,7 @@ async function applyPrefix(extractDir) {
|
|
|
107012
107185
|
await import_fs_extra21.move(tempDir, commandsDir);
|
|
107013
107186
|
await import_fs_extra21.remove(backupDir);
|
|
107014
107187
|
logger.success("Successfully reorganized commands to /ck: prefix");
|
|
107015
|
-
const claudeDir3 =
|
|
107188
|
+
const claudeDir3 = join120(extractDir, ".claude");
|
|
107016
107189
|
logger.info("Transforming command references in file contents...");
|
|
107017
107190
|
const transformResult = await transformCommandReferences(claudeDir3, {
|
|
107018
107191
|
verbose: logger.isVerbose()
|
|
@@ -107050,20 +107223,20 @@ async function applyPrefix(extractDir) {
|
|
|
107050
107223
|
// src/services/transformers/commands-prefix/prefix-cleaner.ts
|
|
107051
107224
|
init_metadata_migration();
|
|
107052
107225
|
import { lstat as lstat12, readdir as readdir33 } from "node:fs/promises";
|
|
107053
|
-
import { join as
|
|
107226
|
+
import { join as join122 } from "node:path";
|
|
107054
107227
|
init_logger();
|
|
107055
107228
|
var import_fs_extra23 = __toESM(require_lib(), 1);
|
|
107056
107229
|
|
|
107057
107230
|
// src/services/transformers/commands-prefix/file-processor.ts
|
|
107058
107231
|
import { lstat as lstat11, readdir as readdir32 } from "node:fs/promises";
|
|
107059
|
-
import { join as
|
|
107232
|
+
import { join as join121 } from "node:path";
|
|
107060
107233
|
init_logger();
|
|
107061
107234
|
var import_fs_extra22 = __toESM(require_lib(), 1);
|
|
107062
107235
|
async function scanDirectoryFiles(dir) {
|
|
107063
107236
|
const files = [];
|
|
107064
107237
|
const entries = await readdir32(dir);
|
|
107065
107238
|
for (const entry of entries) {
|
|
107066
|
-
const fullPath =
|
|
107239
|
+
const fullPath = join121(dir, entry);
|
|
107067
107240
|
const stats = await lstat11(fullPath);
|
|
107068
107241
|
if (stats.isSymbolicLink()) {
|
|
107069
107242
|
continue;
|
|
@@ -107191,8 +107364,8 @@ function isDifferentKitDirectory(dirName, currentKit) {
|
|
|
107191
107364
|
async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
107192
107365
|
const { dryRun = false } = options2;
|
|
107193
107366
|
validatePath(targetDir, "targetDir");
|
|
107194
|
-
const claudeDir3 = isGlobal ? targetDir :
|
|
107195
|
-
const commandsDir =
|
|
107367
|
+
const claudeDir3 = isGlobal ? targetDir : join122(targetDir, ".claude");
|
|
107368
|
+
const commandsDir = join122(claudeDir3, "commands");
|
|
107196
107369
|
const accumulator = {
|
|
107197
107370
|
results: [],
|
|
107198
107371
|
deletedCount: 0,
|
|
@@ -107234,7 +107407,7 @@ async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
|
107234
107407
|
}
|
|
107235
107408
|
const metadataForChecks = options2.kitType ? createKitSpecificMetadata(metadata, options2.kitType) : metadata;
|
|
107236
107409
|
for (const entry of entries) {
|
|
107237
|
-
const entryPath =
|
|
107410
|
+
const entryPath = join122(commandsDir, entry);
|
|
107238
107411
|
const stats = await lstat12(entryPath);
|
|
107239
107412
|
if (stats.isSymbolicLink()) {
|
|
107240
107413
|
addSymlinkSkip(entry, accumulator);
|
|
@@ -107291,7 +107464,7 @@ async function handleMerge(ctx) {
|
|
|
107291
107464
|
let customClaudeFiles = [];
|
|
107292
107465
|
if (!ctx.options.fresh) {
|
|
107293
107466
|
logger.info("Scanning for custom .claude files...");
|
|
107294
|
-
const scanSourceDir = ctx.options.global ?
|
|
107467
|
+
const scanSourceDir = ctx.options.global ? join123(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
107295
107468
|
const scanTargetSubdir = ctx.options.global ? "" : ".claude";
|
|
107296
107469
|
customClaudeFiles = await FileScanner2.findCustomFiles(ctx.resolvedDir, scanSourceDir, scanTargetSubdir);
|
|
107297
107470
|
} else {
|
|
@@ -107330,7 +107503,7 @@ async function handleMerge(ctx) {
|
|
|
107330
107503
|
merger.setRestoreCkHooks(ctx.options.restoreCkHooks);
|
|
107331
107504
|
merger.setProjectDir(ctx.resolvedDir);
|
|
107332
107505
|
merger.setKitName(ctx.kit.name);
|
|
107333
|
-
merger.setZombiePrunerHookDir(
|
|
107506
|
+
merger.setZombiePrunerHookDir(join123(ctx.claudeDir, "hooks"));
|
|
107334
107507
|
if (ctx.kitType) {
|
|
107335
107508
|
merger.setMultiKitContext(ctx.claudeDir, ctx.kitType);
|
|
107336
107509
|
}
|
|
@@ -107359,8 +107532,8 @@ async function handleMerge(ctx) {
|
|
|
107359
107532
|
return { ...ctx, cancelled: true };
|
|
107360
107533
|
}
|
|
107361
107534
|
}
|
|
107362
|
-
const sourceDir = ctx.options.global ?
|
|
107363
|
-
const sourceMetadataPath = ctx.options.global ?
|
|
107535
|
+
const sourceDir = ctx.options.global ? join123(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
107536
|
+
const sourceMetadataPath = ctx.options.global ? join123(sourceDir, "metadata.json") : join123(sourceDir, ".claude", "metadata.json");
|
|
107364
107537
|
let sourceMetadata = null;
|
|
107365
107538
|
try {
|
|
107366
107539
|
if (await import_fs_extra24.pathExists(sourceMetadataPath)) {
|
|
@@ -107418,7 +107591,7 @@ async function handleMerge(ctx) {
|
|
|
107418
107591
|
};
|
|
107419
107592
|
}
|
|
107420
107593
|
// src/commands/init/phases/migration-handler.ts
|
|
107421
|
-
import { join as
|
|
107594
|
+
import { join as join131 } from "node:path";
|
|
107422
107595
|
|
|
107423
107596
|
// src/domains/skills/skills-detector.ts
|
|
107424
107597
|
init_logger();
|
|
@@ -107434,7 +107607,7 @@ init_types3();
|
|
|
107434
107607
|
var import_fs_extra25 = __toESM(require_lib(), 1);
|
|
107435
107608
|
import { createHash as createHash7 } from "node:crypto";
|
|
107436
107609
|
import { readFile as readFile58, readdir as readdir34, writeFile as writeFile32 } from "node:fs/promises";
|
|
107437
|
-
import { join as
|
|
107610
|
+
import { join as join124, relative as relative27 } from "node:path";
|
|
107438
107611
|
|
|
107439
107612
|
class SkillsManifestManager {
|
|
107440
107613
|
static MANIFEST_FILENAME = ".skills-manifest.json";
|
|
@@ -107456,12 +107629,12 @@ class SkillsManifestManager {
|
|
|
107456
107629
|
return manifest;
|
|
107457
107630
|
}
|
|
107458
107631
|
static async writeManifest(skillsDir2, manifest) {
|
|
107459
|
-
const manifestPath =
|
|
107632
|
+
const manifestPath = join124(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
107460
107633
|
await writeFile32(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
107461
107634
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
107462
107635
|
}
|
|
107463
107636
|
static async readManifest(skillsDir2) {
|
|
107464
|
-
const manifestPath =
|
|
107637
|
+
const manifestPath = join124(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
107465
107638
|
if (!await import_fs_extra25.pathExists(manifestPath)) {
|
|
107466
107639
|
logger.debug(`No manifest found at: ${manifestPath}`);
|
|
107467
107640
|
return null;
|
|
@@ -107484,7 +107657,7 @@ class SkillsManifestManager {
|
|
|
107484
107657
|
return "flat";
|
|
107485
107658
|
}
|
|
107486
107659
|
for (const dir of dirs.slice(0, 3)) {
|
|
107487
|
-
const dirPath =
|
|
107660
|
+
const dirPath = join124(skillsDir2, dir.name);
|
|
107488
107661
|
const subEntries = await readdir34(dirPath, { withFileTypes: true });
|
|
107489
107662
|
const hasSubdirs = subEntries.some((entry) => entry.isDirectory());
|
|
107490
107663
|
if (hasSubdirs) {
|
|
@@ -107503,7 +107676,7 @@ class SkillsManifestManager {
|
|
|
107503
107676
|
const entries = await readdir34(skillsDir2, { withFileTypes: true });
|
|
107504
107677
|
for (const entry of entries) {
|
|
107505
107678
|
if (entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith(".")) {
|
|
107506
|
-
const skillPath =
|
|
107679
|
+
const skillPath = join124(skillsDir2, entry.name);
|
|
107507
107680
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
107508
107681
|
skills.push({
|
|
107509
107682
|
name: entry.name,
|
|
@@ -107515,11 +107688,11 @@ class SkillsManifestManager {
|
|
|
107515
107688
|
const categories = await readdir34(skillsDir2, { withFileTypes: true });
|
|
107516
107689
|
for (const category of categories) {
|
|
107517
107690
|
if (category.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(category.name) && !category.name.startsWith(".")) {
|
|
107518
|
-
const categoryPath =
|
|
107691
|
+
const categoryPath = join124(skillsDir2, category.name);
|
|
107519
107692
|
const skillEntries = await readdir34(categoryPath, { withFileTypes: true });
|
|
107520
107693
|
for (const skillEntry of skillEntries) {
|
|
107521
107694
|
if (skillEntry.isDirectory() && !skillEntry.name.startsWith(".")) {
|
|
107522
|
-
const skillPath =
|
|
107695
|
+
const skillPath = join124(categoryPath, skillEntry.name);
|
|
107523
107696
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
107524
107697
|
skills.push({
|
|
107525
107698
|
name: skillEntry.name,
|
|
@@ -107549,7 +107722,7 @@ class SkillsManifestManager {
|
|
|
107549
107722
|
const files = [];
|
|
107550
107723
|
const entries = await readdir34(dirPath, { withFileTypes: true });
|
|
107551
107724
|
for (const entry of entries) {
|
|
107552
|
-
const fullPath =
|
|
107725
|
+
const fullPath = join124(dirPath, entry.name);
|
|
107553
107726
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name)) {
|
|
107554
107727
|
continue;
|
|
107555
107728
|
}
|
|
@@ -107671,7 +107844,7 @@ function getPathMapping(skillName, oldBasePath, newBasePath) {
|
|
|
107671
107844
|
// src/domains/skills/detection/script-detector.ts
|
|
107672
107845
|
var import_fs_extra26 = __toESM(require_lib(), 1);
|
|
107673
107846
|
import { readdir as readdir35 } from "node:fs/promises";
|
|
107674
|
-
import { join as
|
|
107847
|
+
import { join as join125 } from "node:path";
|
|
107675
107848
|
async function scanDirectory(skillsDir2) {
|
|
107676
107849
|
if (!await import_fs_extra26.pathExists(skillsDir2)) {
|
|
107677
107850
|
return ["flat", []];
|
|
@@ -107684,12 +107857,12 @@ async function scanDirectory(skillsDir2) {
|
|
|
107684
107857
|
let totalSkillLikeCount = 0;
|
|
107685
107858
|
const allSkills = [];
|
|
107686
107859
|
for (const dir of dirs) {
|
|
107687
|
-
const dirPath =
|
|
107860
|
+
const dirPath = join125(skillsDir2, dir.name);
|
|
107688
107861
|
const subEntries = await readdir35(dirPath, { withFileTypes: true });
|
|
107689
107862
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
107690
107863
|
if (subdirs.length > 0) {
|
|
107691
107864
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
107692
|
-
const subdirPath =
|
|
107865
|
+
const subdirPath = join125(dirPath, subdir.name);
|
|
107693
107866
|
const subdirFiles = await readdir35(subdirPath, { withFileTypes: true });
|
|
107694
107867
|
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
107868
|
if (hasSkillMarker) {
|
|
@@ -107846,12 +108019,12 @@ class SkillsMigrationDetector {
|
|
|
107846
108019
|
// src/domains/skills/skills-migrator.ts
|
|
107847
108020
|
init_logger();
|
|
107848
108021
|
init_types3();
|
|
107849
|
-
import { join as
|
|
108022
|
+
import { join as join130 } from "node:path";
|
|
107850
108023
|
|
|
107851
108024
|
// src/domains/skills/migrator/migration-executor.ts
|
|
107852
108025
|
init_logger();
|
|
107853
108026
|
import { copyFile as copyFile6, mkdir as mkdir33, readdir as readdir36, rm as rm13 } from "node:fs/promises";
|
|
107854
|
-
import { join as
|
|
108027
|
+
import { join as join126 } from "node:path";
|
|
107855
108028
|
var import_fs_extra28 = __toESM(require_lib(), 1);
|
|
107856
108029
|
|
|
107857
108030
|
// src/domains/skills/skills-migration-prompts.ts
|
|
@@ -108016,8 +108189,8 @@ async function copySkillDirectory(sourceDir, destDir) {
|
|
|
108016
108189
|
await mkdir33(destDir, { recursive: true });
|
|
108017
108190
|
const entries = await readdir36(sourceDir, { withFileTypes: true });
|
|
108018
108191
|
for (const entry of entries) {
|
|
108019
|
-
const sourcePath =
|
|
108020
|
-
const destPath =
|
|
108192
|
+
const sourcePath = join126(sourceDir, entry.name);
|
|
108193
|
+
const destPath = join126(destDir, entry.name);
|
|
108021
108194
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
108022
108195
|
continue;
|
|
108023
108196
|
}
|
|
@@ -108032,7 +108205,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
108032
108205
|
const migrated = [];
|
|
108033
108206
|
const preserved = [];
|
|
108034
108207
|
const errors2 = [];
|
|
108035
|
-
const tempDir =
|
|
108208
|
+
const tempDir = join126(currentSkillsDir, "..", ".skills-migration-temp");
|
|
108036
108209
|
await mkdir33(tempDir, { recursive: true });
|
|
108037
108210
|
try {
|
|
108038
108211
|
for (const mapping of mappings) {
|
|
@@ -108053,9 +108226,9 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
108053
108226
|
}
|
|
108054
108227
|
}
|
|
108055
108228
|
const category = mapping.category;
|
|
108056
|
-
const targetPath = category ?
|
|
108229
|
+
const targetPath = category ? join126(tempDir, category, skillName) : join126(tempDir, skillName);
|
|
108057
108230
|
if (category) {
|
|
108058
|
-
await mkdir33(
|
|
108231
|
+
await mkdir33(join126(tempDir, category), { recursive: true });
|
|
108059
108232
|
}
|
|
108060
108233
|
await copySkillDirectory(currentSkillPath, targetPath);
|
|
108061
108234
|
migrated.push(skillName);
|
|
@@ -108122,7 +108295,7 @@ init_logger();
|
|
|
108122
108295
|
init_types3();
|
|
108123
108296
|
var import_fs_extra29 = __toESM(require_lib(), 1);
|
|
108124
108297
|
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
|
|
108298
|
+
import { basename as basename27, join as join127, normalize as normalize9 } from "node:path";
|
|
108126
108299
|
function validatePath2(path17, paramName) {
|
|
108127
108300
|
if (!path17 || typeof path17 !== "string") {
|
|
108128
108301
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -108148,7 +108321,7 @@ class SkillsBackupManager {
|
|
|
108148
108321
|
const timestamp = Date.now();
|
|
108149
108322
|
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
|
108150
108323
|
const backupDirName = `${SkillsBackupManager.BACKUP_PREFIX}${timestamp}-${randomSuffix}`;
|
|
108151
|
-
const backupDir = parentDir ?
|
|
108324
|
+
const backupDir = parentDir ? join127(parentDir, backupDirName) : join127(skillsDir2, "..", backupDirName);
|
|
108152
108325
|
logger.info(`Creating backup at: ${backupDir}`);
|
|
108153
108326
|
try {
|
|
108154
108327
|
await mkdir34(backupDir, { recursive: true });
|
|
@@ -108199,7 +108372,7 @@ class SkillsBackupManager {
|
|
|
108199
108372
|
}
|
|
108200
108373
|
try {
|
|
108201
108374
|
const entries = await readdir37(parentDir, { withFileTypes: true });
|
|
108202
|
-
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) =>
|
|
108375
|
+
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) => join127(parentDir, entry.name));
|
|
108203
108376
|
backups.sort().reverse();
|
|
108204
108377
|
return backups;
|
|
108205
108378
|
} catch (error) {
|
|
@@ -108227,8 +108400,8 @@ class SkillsBackupManager {
|
|
|
108227
108400
|
static async copyDirectory(sourceDir, destDir) {
|
|
108228
108401
|
const entries = await readdir37(sourceDir, { withFileTypes: true });
|
|
108229
108402
|
for (const entry of entries) {
|
|
108230
|
-
const sourcePath =
|
|
108231
|
-
const destPath =
|
|
108403
|
+
const sourcePath = join127(sourceDir, entry.name);
|
|
108404
|
+
const destPath = join127(destDir, entry.name);
|
|
108232
108405
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
108233
108406
|
continue;
|
|
108234
108407
|
}
|
|
@@ -108244,7 +108417,7 @@ class SkillsBackupManager {
|
|
|
108244
108417
|
let size = 0;
|
|
108245
108418
|
const entries = await readdir37(dirPath, { withFileTypes: true });
|
|
108246
108419
|
for (const entry of entries) {
|
|
108247
|
-
const fullPath =
|
|
108420
|
+
const fullPath = join127(dirPath, entry.name);
|
|
108248
108421
|
if (entry.isSymbolicLink()) {
|
|
108249
108422
|
continue;
|
|
108250
108423
|
}
|
|
@@ -108280,12 +108453,12 @@ init_skip_directories();
|
|
|
108280
108453
|
import { createHash as createHash8 } from "node:crypto";
|
|
108281
108454
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
108282
108455
|
import { readFile as readFile59, readdir as readdir38 } from "node:fs/promises";
|
|
108283
|
-
import { join as
|
|
108456
|
+
import { join as join128, relative as relative28 } from "node:path";
|
|
108284
108457
|
async function getAllFiles(dirPath) {
|
|
108285
108458
|
const files = [];
|
|
108286
108459
|
const entries = await readdir38(dirPath, { withFileTypes: true });
|
|
108287
108460
|
for (const entry of entries) {
|
|
108288
|
-
const fullPath =
|
|
108461
|
+
const fullPath = join128(dirPath, entry.name);
|
|
108289
108462
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name) || entry.isSymbolicLink()) {
|
|
108290
108463
|
continue;
|
|
108291
108464
|
}
|
|
@@ -108412,7 +108585,7 @@ async function detectFileChanges(currentSkillPath, baselineSkillPath) {
|
|
|
108412
108585
|
init_types3();
|
|
108413
108586
|
var import_fs_extra31 = __toESM(require_lib(), 1);
|
|
108414
108587
|
import { readdir as readdir39 } from "node:fs/promises";
|
|
108415
|
-
import { join as
|
|
108588
|
+
import { join as join129, normalize as normalize10 } from "node:path";
|
|
108416
108589
|
function validatePath3(path17, paramName) {
|
|
108417
108590
|
if (!path17 || typeof path17 !== "string") {
|
|
108418
108591
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -108433,13 +108606,13 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
108433
108606
|
if (dirs.length === 0) {
|
|
108434
108607
|
return ["flat", []];
|
|
108435
108608
|
}
|
|
108436
|
-
const firstDirPath =
|
|
108609
|
+
const firstDirPath = join129(skillsDir2, dirs[0].name);
|
|
108437
108610
|
const subEntries = await readdir39(firstDirPath, { withFileTypes: true });
|
|
108438
108611
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
108439
108612
|
if (subdirs.length > 0) {
|
|
108440
108613
|
let skillLikeCount = 0;
|
|
108441
108614
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
108442
|
-
const subdirPath =
|
|
108615
|
+
const subdirPath = join129(firstDirPath, subdir.name);
|
|
108443
108616
|
const subdirFiles = await readdir39(subdirPath, { withFileTypes: true });
|
|
108444
108617
|
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
108618
|
if (hasSkillMarker) {
|
|
@@ -108449,7 +108622,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
108449
108622
|
if (skillLikeCount > 0) {
|
|
108450
108623
|
const skills = [];
|
|
108451
108624
|
for (const dir of dirs) {
|
|
108452
|
-
const categoryPath =
|
|
108625
|
+
const categoryPath = join129(skillsDir2, dir.name);
|
|
108453
108626
|
const skillDirs = await readdir39(categoryPath, { withFileTypes: true });
|
|
108454
108627
|
skills.push(...skillDirs.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name));
|
|
108455
108628
|
}
|
|
@@ -108459,7 +108632,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
108459
108632
|
return ["flat", dirs.map((dir) => dir.name)];
|
|
108460
108633
|
}
|
|
108461
108634
|
async function findSkillPath(skillsDir2, skillName) {
|
|
108462
|
-
const flatPath =
|
|
108635
|
+
const flatPath = join129(skillsDir2, skillName);
|
|
108463
108636
|
if (await import_fs_extra31.pathExists(flatPath)) {
|
|
108464
108637
|
return { path: flatPath, category: undefined };
|
|
108465
108638
|
}
|
|
@@ -108468,8 +108641,8 @@ async function findSkillPath(skillsDir2, skillName) {
|
|
|
108468
108641
|
if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
108469
108642
|
continue;
|
|
108470
108643
|
}
|
|
108471
|
-
const categoryPath =
|
|
108472
|
-
const skillPath =
|
|
108644
|
+
const categoryPath = join129(skillsDir2, entry.name);
|
|
108645
|
+
const skillPath = join129(categoryPath, skillName);
|
|
108473
108646
|
if (await import_fs_extra31.pathExists(skillPath)) {
|
|
108474
108647
|
return { path: skillPath, category: entry.name };
|
|
108475
108648
|
}
|
|
@@ -108563,7 +108736,7 @@ class SkillsMigrator {
|
|
|
108563
108736
|
}
|
|
108564
108737
|
}
|
|
108565
108738
|
if (options2.backup && !options2.dryRun) {
|
|
108566
|
-
const claudeDir3 =
|
|
108739
|
+
const claudeDir3 = join130(currentSkillsDir, "..");
|
|
108567
108740
|
result.backupPath = await SkillsBackupManager.createBackup(currentSkillsDir, claudeDir3);
|
|
108568
108741
|
logger.success(`Backup created at: ${result.backupPath}`);
|
|
108569
108742
|
}
|
|
@@ -108624,7 +108797,7 @@ async function handleMigration(ctx) {
|
|
|
108624
108797
|
logger.debug("Skipping skills migration (fresh installation)");
|
|
108625
108798
|
return ctx;
|
|
108626
108799
|
}
|
|
108627
|
-
const newSkillsDir =
|
|
108800
|
+
const newSkillsDir = join131(ctx.extractDir, ".claude", "skills");
|
|
108628
108801
|
const currentSkillsDir = PathResolver.buildSkillsPath(ctx.resolvedDir, ctx.options.global);
|
|
108629
108802
|
if (!await import_fs_extra32.pathExists(newSkillsDir) || !await import_fs_extra32.pathExists(currentSkillsDir)) {
|
|
108630
108803
|
return ctx;
|
|
@@ -108648,13 +108821,13 @@ async function handleMigration(ctx) {
|
|
|
108648
108821
|
}
|
|
108649
108822
|
// src/commands/init/phases/opencode-handler.ts
|
|
108650
108823
|
import { cp as cp4, readdir as readdir41, rm as rm15 } from "node:fs/promises";
|
|
108651
|
-
import { join as
|
|
108824
|
+
import { join as join133 } from "node:path";
|
|
108652
108825
|
|
|
108653
108826
|
// src/services/transformers/opencode-path-transformer.ts
|
|
108654
108827
|
init_logger();
|
|
108655
108828
|
import { readFile as readFile60, readdir as readdir40, writeFile as writeFile33 } from "node:fs/promises";
|
|
108656
108829
|
import { platform as platform15 } from "node:os";
|
|
108657
|
-
import { extname as extname6, join as
|
|
108830
|
+
import { extname as extname6, join as join132 } from "node:path";
|
|
108658
108831
|
var IS_WINDOWS2 = platform15() === "win32";
|
|
108659
108832
|
function getOpenCodeGlobalPath() {
|
|
108660
108833
|
return "$HOME/.config/opencode/";
|
|
@@ -108715,7 +108888,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
108715
108888
|
async function processDirectory2(dir) {
|
|
108716
108889
|
const entries = await readdir40(dir, { withFileTypes: true });
|
|
108717
108890
|
for (const entry of entries) {
|
|
108718
|
-
const fullPath =
|
|
108891
|
+
const fullPath = join132(dir, entry.name);
|
|
108719
108892
|
if (entry.isDirectory()) {
|
|
108720
108893
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
108721
108894
|
continue;
|
|
@@ -108754,7 +108927,7 @@ async function handleOpenCode(ctx) {
|
|
|
108754
108927
|
if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir) {
|
|
108755
108928
|
return ctx;
|
|
108756
108929
|
}
|
|
108757
|
-
const openCodeSource =
|
|
108930
|
+
const openCodeSource = join133(ctx.extractDir, ".opencode");
|
|
108758
108931
|
if (!await import_fs_extra33.pathExists(openCodeSource)) {
|
|
108759
108932
|
logger.debug("No .opencode directory in archive, skipping");
|
|
108760
108933
|
return ctx;
|
|
@@ -108772,8 +108945,8 @@ async function handleOpenCode(ctx) {
|
|
|
108772
108945
|
await import_fs_extra33.ensureDir(targetDir);
|
|
108773
108946
|
const entries = await readdir41(openCodeSource, { withFileTypes: true });
|
|
108774
108947
|
for (const entry of entries) {
|
|
108775
|
-
const sourcePath =
|
|
108776
|
-
const targetPath =
|
|
108948
|
+
const sourcePath = join133(openCodeSource, entry.name);
|
|
108949
|
+
const targetPath = join133(targetDir, entry.name);
|
|
108777
108950
|
if (await import_fs_extra33.pathExists(targetPath)) {
|
|
108778
108951
|
if (!ctx.options.forceOverwrite) {
|
|
108779
108952
|
logger.verbose(`Skipping existing: ${entry.name}`);
|
|
@@ -108872,7 +109045,7 @@ Please use only one download method.`);
|
|
|
108872
109045
|
}
|
|
108873
109046
|
// src/commands/init/phases/post-install-handler.ts
|
|
108874
109047
|
init_projects_registry();
|
|
108875
|
-
import { join as
|
|
109048
|
+
import { join as join134 } from "node:path";
|
|
108876
109049
|
init_logger();
|
|
108877
109050
|
init_path_resolver();
|
|
108878
109051
|
var import_fs_extra34 = __toESM(require_lib(), 1);
|
|
@@ -108881,8 +109054,8 @@ async function handlePostInstall(ctx) {
|
|
|
108881
109054
|
return ctx;
|
|
108882
109055
|
}
|
|
108883
109056
|
if (ctx.options.global) {
|
|
108884
|
-
const claudeMdSource =
|
|
108885
|
-
const claudeMdDest =
|
|
109057
|
+
const claudeMdSource = join134(ctx.extractDir, "CLAUDE.md");
|
|
109058
|
+
const claudeMdDest = join134(ctx.resolvedDir, "CLAUDE.md");
|
|
108886
109059
|
if (await import_fs_extra34.pathExists(claudeMdSource)) {
|
|
108887
109060
|
if (ctx.options.fresh || !await import_fs_extra34.pathExists(claudeMdDest)) {
|
|
108888
109061
|
await import_fs_extra34.copy(claudeMdSource, claudeMdDest);
|
|
@@ -108905,24 +109078,24 @@ async function handlePostInstall(ctx) {
|
|
|
108905
109078
|
});
|
|
108906
109079
|
}
|
|
108907
109080
|
if (!ctx.isNonInteractive) {
|
|
108908
|
-
const {
|
|
108909
|
-
const {
|
|
108910
|
-
const
|
|
108911
|
-
const existingConfig =
|
|
109081
|
+
const { isAgyInstalled: isAgyInstalled2 } = await Promise.resolve().then(() => (init_package_installer(), exports_package_installer));
|
|
109082
|
+
const { checkExistingAgyConfig: checkExistingAgyConfig2, findMcpConfigPath: findMcpConfigPath2, processAgyMcpLinking: processAgyMcpLinking2 } = await Promise.resolve().then(() => (init_agy_mcp_linker(), exports_agy_mcp_linker));
|
|
109083
|
+
const agyInstalled = await isAgyInstalled2();
|
|
109084
|
+
const existingConfig = checkExistingAgyConfig2(ctx.resolvedDir, ctx.options.global);
|
|
108912
109085
|
const mcpConfigPath = findMcpConfigPath2(ctx.resolvedDir);
|
|
108913
109086
|
const mcpConfigExists = mcpConfigPath !== null;
|
|
108914
|
-
if (
|
|
108915
|
-
const
|
|
109087
|
+
if (agyInstalled && !existingConfig.exists && mcpConfigExists) {
|
|
109088
|
+
const agyPath = ctx.options.global ? "~/.gemini/config/mcp_config.json" : ".agents/mcp_config.json";
|
|
108916
109089
|
const mcpPath = ctx.options.global ? "~/.claude/.mcp.json" : ".mcp.json";
|
|
108917
109090
|
const promptMessage = [
|
|
108918
|
-
"
|
|
108919
|
-
` → Creates ${
|
|
108920
|
-
" →
|
|
109091
|
+
"Antigravity CLI (agy) detected. Set up MCP integration?",
|
|
109092
|
+
` → Creates ${agyPath} symlink to ${mcpPath}`,
|
|
109093
|
+
" → agy will share MCP servers with Claude Code"
|
|
108921
109094
|
].join(`
|
|
108922
109095
|
`);
|
|
108923
|
-
const
|
|
108924
|
-
if (
|
|
108925
|
-
await
|
|
109096
|
+
const shouldSetupAgy = await ctx.prompts.confirm(promptMessage);
|
|
109097
|
+
if (shouldSetupAgy) {
|
|
109098
|
+
await processAgyMcpLinking2(ctx.resolvedDir, {
|
|
108926
109099
|
isGlobal: ctx.options.global
|
|
108927
109100
|
});
|
|
108928
109101
|
}
|
|
@@ -108930,7 +109103,7 @@ async function handlePostInstall(ctx) {
|
|
|
108930
109103
|
}
|
|
108931
109104
|
if (!ctx.options.skipSetup) {
|
|
108932
109105
|
await promptSetupWizardIfNeeded({
|
|
108933
|
-
envPath:
|
|
109106
|
+
envPath: join134(ctx.claudeDir, ".env"),
|
|
108934
109107
|
claudeDir: ctx.claudeDir,
|
|
108935
109108
|
isGlobal: ctx.options.global,
|
|
108936
109109
|
isNonInteractive: ctx.isNonInteractive,
|
|
@@ -108952,13 +109125,13 @@ async function handlePostInstall(ctx) {
|
|
|
108952
109125
|
}
|
|
108953
109126
|
// src/commands/init/phases/plugin-install-handler.ts
|
|
108954
109127
|
init_codex_plugin_installer();
|
|
108955
|
-
import { cpSync as cpSync2, existsSync as existsSync69, mkdirSync as mkdirSync6, readFileSync as
|
|
108956
|
-
import { join as
|
|
109128
|
+
import { cpSync as cpSync2, existsSync as existsSync69, mkdirSync as mkdirSync6, readFileSync as readFileSync22, rmSync as rmSync4, writeFileSync as writeFileSync8 } from "node:fs";
|
|
109129
|
+
import { join as join136 } from "node:path";
|
|
108957
109130
|
|
|
108958
109131
|
// src/domains/installation/plugin/migrate-legacy-to-plugin.ts
|
|
108959
109132
|
init_install_mode_detector();
|
|
108960
|
-
import { cpSync, existsSync as existsSync68, mkdirSync as mkdirSync5, readFileSync as
|
|
108961
|
-
import { dirname as dirname43, join as
|
|
109133
|
+
import { cpSync, existsSync as existsSync68, mkdirSync as mkdirSync5, readFileSync as readFileSync21, rmSync as rmSync3, writeFileSync as writeFileSync7 } from "node:fs";
|
|
109134
|
+
import { dirname as dirname43, join as join135 } from "node:path";
|
|
108962
109135
|
|
|
108963
109136
|
// src/domains/installation/plugin/plugin-installer.ts
|
|
108964
109137
|
init_install_mode_detector();
|
|
@@ -109090,7 +109263,7 @@ async function migrateLegacyToPlugin(opts) {
|
|
|
109090
109263
|
let backupDir = null;
|
|
109091
109264
|
let removedPaths = [];
|
|
109092
109265
|
if (before.legacy.installed) {
|
|
109093
|
-
backupDir =
|
|
109266
|
+
backupDir = join135(claudeDir3, "backups", `ck-legacy-${ts.replace(/[:.]/g, "-")}`);
|
|
109094
109267
|
mkdirSync5(backupDir, { recursive: true });
|
|
109095
109268
|
removedPaths = removeLegacy(claudeDir3, backupDir);
|
|
109096
109269
|
}
|
|
@@ -109124,7 +109297,7 @@ function base(action, modeBefore, pluginVerified) {
|
|
|
109124
109297
|
}
|
|
109125
109298
|
var PLUGIN_SUPPLIED_LEGACY_PREFIXES2 = ["agents/", "skills/"];
|
|
109126
109299
|
function defaultLegacyRemover(claudeDir3, backupDir) {
|
|
109127
|
-
const meta =
|
|
109300
|
+
const meta = readJsonSafe3(join135(claudeDir3, "metadata.json"));
|
|
109128
109301
|
const files = collectTrackedFiles2(meta);
|
|
109129
109302
|
const removed = [];
|
|
109130
109303
|
for (const file of files) {
|
|
@@ -109132,10 +109305,10 @@ function defaultLegacyRemover(claudeDir3, backupDir) {
|
|
|
109132
109305
|
continue;
|
|
109133
109306
|
if (!isPluginSuppliedLegacyPath(file.path))
|
|
109134
109307
|
continue;
|
|
109135
|
-
const abs =
|
|
109308
|
+
const abs = join135(claudeDir3, file.path);
|
|
109136
109309
|
if (!existsSync68(abs))
|
|
109137
109310
|
continue;
|
|
109138
|
-
const backupTarget =
|
|
109311
|
+
const backupTarget = join135(backupDir, file.path);
|
|
109139
109312
|
mkdirSync5(dirname43(backupTarget), { recursive: true });
|
|
109140
109313
|
cpSync(abs, backupTarget, { recursive: true });
|
|
109141
109314
|
rmSync3(abs, { recursive: true, force: true });
|
|
@@ -109148,22 +109321,22 @@ function isPluginSuppliedLegacyPath(pathValue) {
|
|
|
109148
109321
|
return PLUGIN_SUPPLIED_LEGACY_PREFIXES2.some((prefix) => normalized.startsWith(prefix));
|
|
109149
109322
|
}
|
|
109150
109323
|
function collectTrackedFiles2(meta) {
|
|
109151
|
-
if (!
|
|
109324
|
+
if (!isRecord3(meta))
|
|
109152
109325
|
return [];
|
|
109153
109326
|
const out = [];
|
|
109154
109327
|
const push2 = (arr) => {
|
|
109155
109328
|
if (!Array.isArray(arr))
|
|
109156
109329
|
return;
|
|
109157
109330
|
for (const f3 of arr) {
|
|
109158
|
-
if (
|
|
109331
|
+
if (isRecord3(f3) && typeof f3.path === "string") {
|
|
109159
109332
|
const ownership = f3.ownership === "user" || f3.ownership === "ck-modified" ? f3.ownership : "ck";
|
|
109160
109333
|
out.push({ path: f3.path, ownership });
|
|
109161
109334
|
}
|
|
109162
109335
|
}
|
|
109163
109336
|
};
|
|
109164
|
-
if (
|
|
109337
|
+
if (isRecord3(meta.kits)) {
|
|
109165
109338
|
const engineer = meta.kits[ENGINEER_KIT_KEY];
|
|
109166
|
-
if (
|
|
109339
|
+
if (isRecord3(engineer))
|
|
109167
109340
|
push2(engineer.files);
|
|
109168
109341
|
} else {
|
|
109169
109342
|
push2(meta.files);
|
|
@@ -109171,22 +109344,22 @@ function collectTrackedFiles2(meta) {
|
|
|
109171
109344
|
return out;
|
|
109172
109345
|
}
|
|
109173
109346
|
function writeReceipt(claudeDir3, receipt) {
|
|
109174
|
-
const receiptPath =
|
|
109175
|
-
const existing =
|
|
109347
|
+
const receiptPath = join135(claudeDir3, ".ck-migration-log.json");
|
|
109348
|
+
const existing = readJsonSafe3(receiptPath);
|
|
109176
109349
|
const history = Array.isArray(existing) ? existing : [];
|
|
109177
109350
|
history.push(receipt);
|
|
109178
109351
|
writeFileSync7(receiptPath, `${JSON.stringify(history, null, 2)}
|
|
109179
109352
|
`, "utf-8");
|
|
109180
109353
|
return receiptPath;
|
|
109181
109354
|
}
|
|
109182
|
-
function
|
|
109355
|
+
function readJsonSafe3(filePath) {
|
|
109183
109356
|
try {
|
|
109184
|
-
return JSON.parse(
|
|
109357
|
+
return JSON.parse(readFileSync21(filePath, "utf-8"));
|
|
109185
109358
|
} catch {
|
|
109186
109359
|
return null;
|
|
109187
109360
|
}
|
|
109188
109361
|
}
|
|
109189
|
-
function
|
|
109362
|
+
function isRecord3(value) {
|
|
109190
109363
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
109191
109364
|
}
|
|
109192
109365
|
|
|
@@ -109220,14 +109393,14 @@ async function handlePluginInstall(ctx, deps = {}) {
|
|
|
109220
109393
|
return ctx;
|
|
109221
109394
|
}
|
|
109222
109395
|
function stagePluginSource(extractDir, stageBaseDir) {
|
|
109223
|
-
const base2 = stageBaseDir ??
|
|
109224
|
-
const payloadSrc =
|
|
109396
|
+
const base2 = stageBaseDir ?? join136(PathResolver.getCacheDir(true), "ck-plugin-source");
|
|
109397
|
+
const payloadSrc = join136(extractDir, ".claude");
|
|
109225
109398
|
if (!existsSync69(payloadSrc)) {
|
|
109226
109399
|
throw new Error(`plugin payload not found in archive: ${payloadSrc}`);
|
|
109227
109400
|
}
|
|
109228
109401
|
rmSync4(base2, { recursive: true, force: true });
|
|
109229
109402
|
mkdirSync6(base2, { recursive: true });
|
|
109230
|
-
const stagedPayload =
|
|
109403
|
+
const stagedPayload = join136(base2, ".claude");
|
|
109231
109404
|
cpSync2(payloadSrc, stagedPayload, { recursive: true });
|
|
109232
109405
|
ensureCodexPluginManifest(stagedPayload);
|
|
109233
109406
|
const claudeMarketplace = {
|
|
@@ -109235,8 +109408,8 @@ function stagePluginSource(extractDir, stageBaseDir) {
|
|
|
109235
109408
|
owner: { name: "ClaudeKit" },
|
|
109236
109409
|
plugins: [{ name: "ck", source: "./.claude", description: "ClaudeKit Engineer" }]
|
|
109237
109410
|
};
|
|
109238
|
-
mkdirSync6(
|
|
109239
|
-
writeFileSync8(
|
|
109411
|
+
mkdirSync6(join136(base2, ".claude-plugin"), { recursive: true });
|
|
109412
|
+
writeFileSync8(join136(base2, ".claude-plugin", "marketplace.json"), `${JSON.stringify(claudeMarketplace, null, 2)}
|
|
109240
109413
|
`, "utf-8");
|
|
109241
109414
|
const codexMarketplace = {
|
|
109242
109415
|
name: "claudekit",
|
|
@@ -109250,16 +109423,16 @@ function stagePluginSource(extractDir, stageBaseDir) {
|
|
|
109250
109423
|
}
|
|
109251
109424
|
]
|
|
109252
109425
|
};
|
|
109253
|
-
mkdirSync6(
|
|
109254
|
-
writeFileSync8(
|
|
109426
|
+
mkdirSync6(join136(base2, ".agents", "plugins"), { recursive: true });
|
|
109427
|
+
writeFileSync8(join136(base2, ".agents", "plugins", "marketplace.json"), `${JSON.stringify(codexMarketplace, null, 2)}
|
|
109255
109428
|
`, "utf-8");
|
|
109256
109429
|
return base2;
|
|
109257
109430
|
}
|
|
109258
109431
|
function ensureCodexPluginManifest(pluginRoot) {
|
|
109259
|
-
const manifestPath =
|
|
109432
|
+
const manifestPath = join136(pluginRoot, ".codex-plugin", "plugin.json");
|
|
109260
109433
|
if (existsSync69(manifestPath))
|
|
109261
109434
|
return;
|
|
109262
|
-
const claudeManifest =
|
|
109435
|
+
const claudeManifest = readJsonSafe4(join136(pluginRoot, ".claude-plugin", "plugin.json"));
|
|
109263
109436
|
const manifest = pruneUndefined({
|
|
109264
109437
|
name: stringField(claudeManifest, "name") ?? "ck",
|
|
109265
109438
|
version: stringField(claudeManifest, "version") ?? "0.0.0",
|
|
@@ -109280,14 +109453,14 @@ function ensureCodexPluginManifest(pluginRoot) {
|
|
|
109280
109453
|
websiteURL: "https://github.com/claudekit/claudekit-engineer"
|
|
109281
109454
|
}
|
|
109282
109455
|
});
|
|
109283
|
-
mkdirSync6(
|
|
109456
|
+
mkdirSync6(join136(pluginRoot, ".codex-plugin"), { recursive: true });
|
|
109284
109457
|
writeFileSync8(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
109285
109458
|
`, "utf-8");
|
|
109286
109459
|
}
|
|
109287
|
-
function
|
|
109460
|
+
function readJsonSafe4(filePath) {
|
|
109288
109461
|
try {
|
|
109289
|
-
const parsed = JSON.parse(
|
|
109290
|
-
return
|
|
109462
|
+
const parsed = JSON.parse(readFileSync22(filePath, "utf-8"));
|
|
109463
|
+
return isRecord4(parsed) ? parsed : null;
|
|
109291
109464
|
} catch {
|
|
109292
109465
|
return null;
|
|
109293
109466
|
}
|
|
@@ -109298,7 +109471,7 @@ function stringField(source, key) {
|
|
|
109298
109471
|
}
|
|
109299
109472
|
function authorField(source) {
|
|
109300
109473
|
const author = source?.author;
|
|
109301
|
-
if (
|
|
109474
|
+
if (isRecord4(author) && typeof author.name === "string" && author.name.trim() !== "") {
|
|
109302
109475
|
return { name: author.name };
|
|
109303
109476
|
}
|
|
109304
109477
|
return { name: "ClaudeKit" };
|
|
@@ -109306,7 +109479,7 @@ function authorField(source) {
|
|
|
109306
109479
|
function pruneUndefined(value) {
|
|
109307
109480
|
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== undefined));
|
|
109308
109481
|
}
|
|
109309
|
-
function
|
|
109482
|
+
function isRecord4(value) {
|
|
109310
109483
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
109311
109484
|
}
|
|
109312
109485
|
function logPluginResult(result) {
|
|
@@ -109345,7 +109518,7 @@ function logCodexPluginResult(result) {
|
|
|
109345
109518
|
init_config_manager();
|
|
109346
109519
|
init_github_client();
|
|
109347
109520
|
import { mkdir as mkdir36 } from "node:fs/promises";
|
|
109348
|
-
import { join as
|
|
109521
|
+
import { join as join139, resolve as resolve46 } from "node:path";
|
|
109349
109522
|
|
|
109350
109523
|
// src/domains/github/kit-access-checker.ts
|
|
109351
109524
|
init_error2();
|
|
@@ -109518,7 +109691,7 @@ init_hook_health_checker();
|
|
|
109518
109691
|
// src/domains/installation/fresh-installer.ts
|
|
109519
109692
|
init_metadata_migration();
|
|
109520
109693
|
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
|
|
109694
|
+
import { basename as basename28, dirname as dirname44, join as join137, resolve as resolve44 } from "node:path";
|
|
109522
109695
|
init_logger();
|
|
109523
109696
|
init_safe_spinner();
|
|
109524
109697
|
var import_fs_extra35 = __toESM(require_lib(), 1);
|
|
@@ -109600,7 +109773,7 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
|
|
|
109600
109773
|
logger.debug(`${KIT_MANIFEST_FILE} was self-tracked; skipping from delete loop — will be rewritten by updateMetadataAfterFresh`);
|
|
109601
109774
|
}
|
|
109602
109775
|
for (const file of filesToRemove) {
|
|
109603
|
-
const fullPath =
|
|
109776
|
+
const fullPath = join137(claudeDir3, file.path);
|
|
109604
109777
|
if (!existsSync70(fullPath)) {
|
|
109605
109778
|
continue;
|
|
109606
109779
|
}
|
|
@@ -109628,7 +109801,7 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
|
|
|
109628
109801
|
};
|
|
109629
109802
|
}
|
|
109630
109803
|
async function updateMetadataAfterFresh(claudeDir3, removedFiles, metadata) {
|
|
109631
|
-
const metadataPath =
|
|
109804
|
+
const metadataPath = join137(claudeDir3, KIT_MANIFEST_FILE);
|
|
109632
109805
|
const removedSet = new Set(removedFiles);
|
|
109633
109806
|
if (metadata.kits) {
|
|
109634
109807
|
for (const kitName of Object.keys(metadata.kits)) {
|
|
@@ -109659,8 +109832,8 @@ function getFreshBackupTargets(claudeDir3, analysis, includeModified) {
|
|
|
109659
109832
|
mutatePaths: filesToRemove.length > 0 ? ["metadata.json"] : []
|
|
109660
109833
|
};
|
|
109661
109834
|
}
|
|
109662
|
-
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync70(
|
|
109663
|
-
if (existsSync70(
|
|
109835
|
+
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync70(join137(claudeDir3, subdir)));
|
|
109836
|
+
if (existsSync70(join137(claudeDir3, "metadata.json"))) {
|
|
109664
109837
|
deletePaths.push("metadata.json");
|
|
109665
109838
|
}
|
|
109666
109839
|
return {
|
|
@@ -109682,7 +109855,7 @@ async function removeSubdirectoriesFallback(claudeDir3) {
|
|
|
109682
109855
|
const removedFiles = [];
|
|
109683
109856
|
let removedDirCount = 0;
|
|
109684
109857
|
for (const subdir of CLAUDEKIT_SUBDIRECTORIES) {
|
|
109685
|
-
const subdirPath =
|
|
109858
|
+
const subdirPath = join137(claudeDir3, subdir);
|
|
109686
109859
|
if (await import_fs_extra35.pathExists(subdirPath)) {
|
|
109687
109860
|
rmSync5(subdirPath, { recursive: true, force: true });
|
|
109688
109861
|
removedDirCount++;
|
|
@@ -109690,7 +109863,7 @@ async function removeSubdirectoriesFallback(claudeDir3) {
|
|
|
109690
109863
|
logger.debug(`Removed subdirectory: ${subdir}/`);
|
|
109691
109864
|
}
|
|
109692
109865
|
}
|
|
109693
|
-
const metadataPath =
|
|
109866
|
+
const metadataPath = join137(claudeDir3, "metadata.json");
|
|
109694
109867
|
if (await import_fs_extra35.pathExists(metadataPath)) {
|
|
109695
109868
|
unlinkSync5(metadataPath);
|
|
109696
109869
|
removedFiles.push("metadata.json");
|
|
@@ -109768,7 +109941,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
|
|
|
109768
109941
|
var import_fs_extra36 = __toESM(require_lib(), 1);
|
|
109769
109942
|
import { cp as cp5, mkdir as mkdir35, readdir as readdir42, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
|
|
109770
109943
|
import { homedir as homedir47 } from "node:os";
|
|
109771
|
-
import { dirname as dirname45, join as
|
|
109944
|
+
import { dirname as dirname45, join as join138, normalize as normalize11, resolve as resolve45 } from "node:path";
|
|
109772
109945
|
var LEGACY_KIT_MARKERS = [
|
|
109773
109946
|
"metadata.json",
|
|
109774
109947
|
".ck.json",
|
|
@@ -109807,10 +109980,10 @@ function getLegacyWindowsGlobalKitDirCandidates(env2 = process.env, homeDir = ho
|
|
|
109807
109980
|
const localAppData = safeEnvPath(env2.LOCALAPPDATA);
|
|
109808
109981
|
const appData = safeEnvPath(env2.APPDATA);
|
|
109809
109982
|
if (localAppData) {
|
|
109810
|
-
candidates.push(
|
|
109983
|
+
candidates.push(join138(localAppData, ".claude"));
|
|
109811
109984
|
}
|
|
109812
109985
|
if (appData) {
|
|
109813
|
-
candidates.push(
|
|
109986
|
+
candidates.push(join138(appData, ".claude"));
|
|
109814
109987
|
}
|
|
109815
109988
|
if (homeDir) {
|
|
109816
109989
|
candidates.push(`${withoutTrailingSeparators(homeDir)}.claude`);
|
|
@@ -109828,7 +110001,7 @@ async function hasKitMarkers(dir) {
|
|
|
109828
110001
|
if (!await isDirectory(dir))
|
|
109829
110002
|
return false;
|
|
109830
110003
|
for (const marker of LEGACY_KIT_MARKERS) {
|
|
109831
|
-
if (await import_fs_extra36.pathExists(
|
|
110004
|
+
if (await import_fs_extra36.pathExists(join138(dir, marker))) {
|
|
109832
110005
|
return true;
|
|
109833
110006
|
}
|
|
109834
110007
|
}
|
|
@@ -110130,7 +110303,7 @@ async function handleSelection(ctx) {
|
|
|
110130
110303
|
}
|
|
110131
110304
|
if (!ctx.options.fresh) {
|
|
110132
110305
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
110133
|
-
const claudeDir3 = prefix ?
|
|
110306
|
+
const claudeDir3 = prefix ? join139(resolvedDir, prefix) : resolvedDir;
|
|
110134
110307
|
try {
|
|
110135
110308
|
const existingMetadata = await readManifest(claudeDir3);
|
|
110136
110309
|
if (existingMetadata?.kits) {
|
|
@@ -110167,7 +110340,7 @@ async function handleSelection(ctx) {
|
|
|
110167
110340
|
}
|
|
110168
110341
|
if (ctx.options.fresh) {
|
|
110169
110342
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
110170
|
-
const claudeDir3 = prefix ?
|
|
110343
|
+
const claudeDir3 = prefix ? join139(resolvedDir, prefix) : resolvedDir;
|
|
110171
110344
|
const canProceed = await handleFreshInstallation(claudeDir3, ctx.prompts);
|
|
110172
110345
|
if (!canProceed) {
|
|
110173
110346
|
return { ...ctx, cancelled: true };
|
|
@@ -110187,7 +110360,7 @@ async function handleSelection(ctx) {
|
|
|
110187
110360
|
let currentVersion = null;
|
|
110188
110361
|
try {
|
|
110189
110362
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
110190
|
-
const claudeDir3 = prefix ?
|
|
110363
|
+
const claudeDir3 = prefix ? join139(resolvedDir, prefix) : resolvedDir;
|
|
110191
110364
|
const existingMetadata = await readManifest(claudeDir3);
|
|
110192
110365
|
currentVersion = existingMetadata?.kits?.[kitType]?.version || null;
|
|
110193
110366
|
if (currentVersion) {
|
|
@@ -110256,7 +110429,7 @@ async function handleSelection(ctx) {
|
|
|
110256
110429
|
if (ctx.options.yes && !ctx.options.fresh && !ctx.options.force && !ctx.options.restoreCkHooks && releaseTag && !isOfflineMode && !pendingKits?.length) {
|
|
110257
110430
|
try {
|
|
110258
110431
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
110259
|
-
const claudeDir3 = prefix ?
|
|
110432
|
+
const claudeDir3 = prefix ? join139(resolvedDir, prefix) : resolvedDir;
|
|
110260
110433
|
const existingMetadata = await readManifest(claudeDir3);
|
|
110261
110434
|
const installedKitVersion = existingMetadata?.kits?.[kitType]?.version;
|
|
110262
110435
|
if (installedKitVersion && versionsMatch(installedKitVersion, releaseTag)) {
|
|
@@ -110285,7 +110458,7 @@ async function handleSelection(ctx) {
|
|
|
110285
110458
|
}
|
|
110286
110459
|
// src/commands/init/phases/sync-handler.ts
|
|
110287
110460
|
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
|
|
110461
|
+
import { dirname as dirname46, join as join140, resolve as resolve47 } from "node:path";
|
|
110289
110462
|
init_logger();
|
|
110290
110463
|
init_path_resolver();
|
|
110291
110464
|
var import_fs_extra38 = __toESM(require_lib(), 1);
|
|
@@ -110295,13 +110468,13 @@ async function handleSync(ctx) {
|
|
|
110295
110468
|
return ctx;
|
|
110296
110469
|
}
|
|
110297
110470
|
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve47(ctx.options.dir || ".");
|
|
110298
|
-
const claudeDir3 = ctx.options.global ? resolvedDir :
|
|
110471
|
+
const claudeDir3 = ctx.options.global ? resolvedDir : join140(resolvedDir, ".claude");
|
|
110299
110472
|
if (!await import_fs_extra38.pathExists(claudeDir3)) {
|
|
110300
110473
|
logger.error("Cannot sync: no .claude directory found");
|
|
110301
110474
|
ctx.prompts.note("Run 'ck init' without --sync to install first.", "No Installation Found");
|
|
110302
110475
|
return { ...ctx, cancelled: true };
|
|
110303
110476
|
}
|
|
110304
|
-
const metadataPath =
|
|
110477
|
+
const metadataPath = join140(claudeDir3, "metadata.json");
|
|
110305
110478
|
if (!await import_fs_extra38.pathExists(metadataPath)) {
|
|
110306
110479
|
logger.error("Cannot sync: no metadata.json found");
|
|
110307
110480
|
ctx.prompts.note(`Your installation may be from an older version.
|
|
@@ -110401,7 +110574,7 @@ function getLockTimeout() {
|
|
|
110401
110574
|
var STALE_LOCK_THRESHOLD_MS = 5 * 60 * 1000;
|
|
110402
110575
|
async function acquireSyncLock(global3) {
|
|
110403
110576
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
110404
|
-
const lockPath =
|
|
110577
|
+
const lockPath = join140(cacheDir, ".sync-lock");
|
|
110405
110578
|
const startTime = Date.now();
|
|
110406
110579
|
const lockTimeout = getLockTimeout();
|
|
110407
110580
|
await mkdir37(dirname46(lockPath), { recursive: true });
|
|
@@ -110447,11 +110620,11 @@ async function executeSyncMerge(ctx) {
|
|
|
110447
110620
|
const releaseLock = await acquireSyncLock(ctx.options.global);
|
|
110448
110621
|
try {
|
|
110449
110622
|
const trackedFiles = ctx.syncTrackedFiles;
|
|
110450
|
-
const upstreamDir = ctx.options.global ?
|
|
110623
|
+
const upstreamDir = ctx.options.global ? join140(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
110451
110624
|
let sourceMetadata = null;
|
|
110452
110625
|
let deletions = [];
|
|
110453
110626
|
try {
|
|
110454
|
-
const sourceMetadataPath =
|
|
110627
|
+
const sourceMetadataPath = join140(upstreamDir, "metadata.json");
|
|
110455
110628
|
if (await import_fs_extra38.pathExists(sourceMetadataPath)) {
|
|
110456
110629
|
const content = await readFile61(sourceMetadataPath, "utf-8");
|
|
110457
110630
|
sourceMetadata = JSON.parse(content);
|
|
@@ -110513,7 +110686,7 @@ async function executeSyncMerge(ctx) {
|
|
|
110513
110686
|
try {
|
|
110514
110687
|
const sourcePath = await validateSyncPath(upstreamDir, file.path);
|
|
110515
110688
|
const targetPath = await validateSyncPath(ctx.claudeDir, file.path);
|
|
110516
|
-
const targetDir =
|
|
110689
|
+
const targetDir = join140(targetPath, "..");
|
|
110517
110690
|
try {
|
|
110518
110691
|
await mkdir37(targetDir, { recursive: true });
|
|
110519
110692
|
} catch (mkdirError) {
|
|
@@ -110684,7 +110857,7 @@ async function createBackup(claudeDir3, files, backupDir) {
|
|
|
110684
110857
|
const sourcePath = await validateSyncPath(claudeDir3, file.path);
|
|
110685
110858
|
if (await import_fs_extra38.pathExists(sourcePath)) {
|
|
110686
110859
|
const targetPath = await validateSyncPath(backupDir, file.path);
|
|
110687
|
-
const targetDir =
|
|
110860
|
+
const targetDir = join140(targetPath, "..");
|
|
110688
110861
|
await mkdir37(targetDir, { recursive: true });
|
|
110689
110862
|
await copyFile8(sourcePath, targetPath);
|
|
110690
110863
|
}
|
|
@@ -110699,7 +110872,7 @@ async function createBackup(claudeDir3, files, backupDir) {
|
|
|
110699
110872
|
}
|
|
110700
110873
|
// src/commands/init/phases/transform-handler.ts
|
|
110701
110874
|
init_config_manager();
|
|
110702
|
-
import { join as
|
|
110875
|
+
import { join as join144 } from "node:path";
|
|
110703
110876
|
|
|
110704
110877
|
// src/services/transformers/folder-path-transformer.ts
|
|
110705
110878
|
init_logger();
|
|
@@ -110710,38 +110883,38 @@ init_logger();
|
|
|
110710
110883
|
init_types3();
|
|
110711
110884
|
var import_fs_extra39 = __toESM(require_lib(), 1);
|
|
110712
110885
|
import { rename as rename13, rm as rm17 } from "node:fs/promises";
|
|
110713
|
-
import { join as
|
|
110886
|
+
import { join as join141, relative as relative30 } from "node:path";
|
|
110714
110887
|
async function collectDirsToRename(extractDir, folders) {
|
|
110715
110888
|
const dirsToRename = [];
|
|
110716
110889
|
if (folders.docs !== DEFAULT_FOLDERS.docs) {
|
|
110717
|
-
const docsPath =
|
|
110890
|
+
const docsPath = join141(extractDir, DEFAULT_FOLDERS.docs);
|
|
110718
110891
|
if (await import_fs_extra39.pathExists(docsPath)) {
|
|
110719
110892
|
dirsToRename.push({
|
|
110720
110893
|
from: docsPath,
|
|
110721
|
-
to:
|
|
110894
|
+
to: join141(extractDir, folders.docs)
|
|
110722
110895
|
});
|
|
110723
110896
|
}
|
|
110724
|
-
const claudeDocsPath =
|
|
110897
|
+
const claudeDocsPath = join141(extractDir, ".claude", DEFAULT_FOLDERS.docs);
|
|
110725
110898
|
if (await import_fs_extra39.pathExists(claudeDocsPath)) {
|
|
110726
110899
|
dirsToRename.push({
|
|
110727
110900
|
from: claudeDocsPath,
|
|
110728
|
-
to:
|
|
110901
|
+
to: join141(extractDir, ".claude", folders.docs)
|
|
110729
110902
|
});
|
|
110730
110903
|
}
|
|
110731
110904
|
}
|
|
110732
110905
|
if (folders.plans !== DEFAULT_FOLDERS.plans) {
|
|
110733
|
-
const plansPath =
|
|
110906
|
+
const plansPath = join141(extractDir, DEFAULT_FOLDERS.plans);
|
|
110734
110907
|
if (await import_fs_extra39.pathExists(plansPath)) {
|
|
110735
110908
|
dirsToRename.push({
|
|
110736
110909
|
from: plansPath,
|
|
110737
|
-
to:
|
|
110910
|
+
to: join141(extractDir, folders.plans)
|
|
110738
110911
|
});
|
|
110739
110912
|
}
|
|
110740
|
-
const claudePlansPath =
|
|
110913
|
+
const claudePlansPath = join141(extractDir, ".claude", DEFAULT_FOLDERS.plans);
|
|
110741
110914
|
if (await import_fs_extra39.pathExists(claudePlansPath)) {
|
|
110742
110915
|
dirsToRename.push({
|
|
110743
110916
|
from: claudePlansPath,
|
|
110744
|
-
to:
|
|
110917
|
+
to: join141(extractDir, ".claude", folders.plans)
|
|
110745
110918
|
});
|
|
110746
110919
|
}
|
|
110747
110920
|
}
|
|
@@ -110782,7 +110955,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
110782
110955
|
init_logger();
|
|
110783
110956
|
init_types3();
|
|
110784
110957
|
import { readFile as readFile62, readdir as readdir43, writeFile as writeFile36 } from "node:fs/promises";
|
|
110785
|
-
import { join as
|
|
110958
|
+
import { join as join142, relative as relative31 } from "node:path";
|
|
110786
110959
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
110787
110960
|
".md",
|
|
110788
110961
|
".txt",
|
|
@@ -110835,7 +111008,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
110835
111008
|
let replacementsCount = 0;
|
|
110836
111009
|
const entries = await readdir43(dir, { withFileTypes: true });
|
|
110837
111010
|
for (const entry of entries) {
|
|
110838
|
-
const fullPath =
|
|
111011
|
+
const fullPath = join142(dir, entry.name);
|
|
110839
111012
|
if (entry.isDirectory()) {
|
|
110840
111013
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
110841
111014
|
continue;
|
|
@@ -110972,7 +111145,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
110972
111145
|
init_logger();
|
|
110973
111146
|
import { readFile as readFile63, readdir as readdir44, writeFile as writeFile37 } from "node:fs/promises";
|
|
110974
111147
|
import { homedir as homedir48, platform as platform16 } from "node:os";
|
|
110975
|
-
import { extname as extname7, join as
|
|
111148
|
+
import { extname as extname7, join as join143 } from "node:path";
|
|
110976
111149
|
var IS_WINDOWS3 = platform16() === "win32";
|
|
110977
111150
|
var HOME_PREFIX = "$HOME";
|
|
110978
111151
|
function getHomeDirPrefix() {
|
|
@@ -110982,7 +111155,7 @@ function normalizeInstallPath(path17) {
|
|
|
110982
111155
|
return path17.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
110983
111156
|
}
|
|
110984
111157
|
function getDefaultGlobalClaudeDir() {
|
|
110985
|
-
return normalizeInstallPath(
|
|
111158
|
+
return normalizeInstallPath(join143(homedir48(), ".claude"));
|
|
110986
111159
|
}
|
|
110987
111160
|
function getCustomGlobalClaudeDir(targetClaudeDir) {
|
|
110988
111161
|
if (!targetClaudeDir)
|
|
@@ -111113,7 +111286,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
111113
111286
|
async function processDirectory2(dir) {
|
|
111114
111287
|
const entries = await readdir44(dir, { withFileTypes: true });
|
|
111115
111288
|
for (const entry of entries) {
|
|
111116
|
-
const fullPath =
|
|
111289
|
+
const fullPath = join143(dir, entry.name);
|
|
111117
111290
|
if (entry.isDirectory()) {
|
|
111118
111291
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
111119
111292
|
continue;
|
|
@@ -111192,7 +111365,7 @@ async function handleTransforms(ctx) {
|
|
|
111192
111365
|
logger.debug(ctx.options.global ? "Saved folder configuration to ~/.claude/.ck.json" : "Saved folder configuration to .claude/.ck.json");
|
|
111193
111366
|
}
|
|
111194
111367
|
}
|
|
111195
|
-
const claudeDir3 = ctx.options.global ? ctx.resolvedDir :
|
|
111368
|
+
const claudeDir3 = ctx.options.global ? ctx.resolvedDir : join144(ctx.resolvedDir, ".claude");
|
|
111196
111369
|
return {
|
|
111197
111370
|
...ctx,
|
|
111198
111371
|
foldersConfig,
|
|
@@ -111419,7 +111592,7 @@ var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
|
111419
111592
|
import { existsSync as existsSync71 } from "node:fs";
|
|
111420
111593
|
import { readFile as readFile67, rm as rm18, unlink as unlink14 } from "node:fs/promises";
|
|
111421
111594
|
import { homedir as homedir52 } from "node:os";
|
|
111422
|
-
import { basename as basename30, join as
|
|
111595
|
+
import { basename as basename30, dirname as dirname49, join as join148, resolve as resolve48 } from "node:path";
|
|
111423
111596
|
init_logger();
|
|
111424
111597
|
|
|
111425
111598
|
// src/ui/ck-cli-design/next-steps-footer.ts
|
|
@@ -111634,13 +111807,13 @@ init_dist2();
|
|
|
111634
111807
|
init_model_taxonomy();
|
|
111635
111808
|
import { mkdir as mkdir39, readFile as readFile66, writeFile as writeFile39 } from "node:fs/promises";
|
|
111636
111809
|
import { homedir as homedir51 } from "node:os";
|
|
111637
|
-
import { dirname as dirname47, join as
|
|
111810
|
+
import { dirname as dirname47, join as join147 } from "node:path";
|
|
111638
111811
|
|
|
111639
111812
|
// src/commands/portable/models-dev-cache.ts
|
|
111640
111813
|
init_logger();
|
|
111641
111814
|
import { mkdir as mkdir38, readFile as readFile64, rename as rename14, writeFile as writeFile38 } from "node:fs/promises";
|
|
111642
111815
|
import { homedir as homedir49 } from "node:os";
|
|
111643
|
-
import { join as
|
|
111816
|
+
import { join as join145 } from "node:path";
|
|
111644
111817
|
|
|
111645
111818
|
class ModelsDevUnavailableError extends Error {
|
|
111646
111819
|
constructor(message, cause) {
|
|
@@ -111652,13 +111825,13 @@ var MODELS_DEV_URL = "https://models.dev/api.json";
|
|
|
111652
111825
|
var CACHE_TTL_MS3 = 24 * 60 * 60 * 1000;
|
|
111653
111826
|
var FETCH_TIMEOUT_MS = 1e4;
|
|
111654
111827
|
function defaultCacheDir() {
|
|
111655
|
-
return
|
|
111828
|
+
return join145(homedir49(), ".config", "claudekit", "cache");
|
|
111656
111829
|
}
|
|
111657
111830
|
function cacheFilePath(cacheDir) {
|
|
111658
|
-
return
|
|
111831
|
+
return join145(cacheDir, "models-dev.json");
|
|
111659
111832
|
}
|
|
111660
111833
|
function tmpFilePath(cacheDir) {
|
|
111661
|
-
return
|
|
111834
|
+
return join145(cacheDir, "models-dev.json.tmp");
|
|
111662
111835
|
}
|
|
111663
111836
|
async function readCacheEntry(cacheDir) {
|
|
111664
111837
|
const filePath = cacheFilePath(cacheDir);
|
|
@@ -111733,14 +111906,14 @@ async function getModelsDevCatalog(opts = {}) {
|
|
|
111733
111906
|
init_logger();
|
|
111734
111907
|
import { readFile as readFile65 } from "node:fs/promises";
|
|
111735
111908
|
import { homedir as homedir50, platform as platform17 } from "node:os";
|
|
111736
|
-
import { join as
|
|
111909
|
+
import { join as join146 } from "node:path";
|
|
111737
111910
|
function resolveOpenCodeAuthPath(homeDir) {
|
|
111738
111911
|
if (platform17() === "win32") {
|
|
111739
|
-
const dataRoot2 = process.env.LOCALAPPDATA ??
|
|
111740
|
-
return
|
|
111912
|
+
const dataRoot2 = process.env.LOCALAPPDATA ?? join146(homeDir, "AppData", "Local");
|
|
111913
|
+
return join146(dataRoot2, "opencode", "auth.json");
|
|
111741
111914
|
}
|
|
111742
|
-
const dataRoot = process.env.XDG_DATA_HOME ??
|
|
111743
|
-
return
|
|
111915
|
+
const dataRoot = process.env.XDG_DATA_HOME ?? join146(homeDir, ".local", "share");
|
|
111916
|
+
return join146(dataRoot, "opencode", "auth.json");
|
|
111744
111917
|
}
|
|
111745
111918
|
async function readAuthedProviders(homeDir) {
|
|
111746
111919
|
const authPath = resolveOpenCodeAuthPath(homeDir);
|
|
@@ -111842,9 +112015,9 @@ function messageForReason(reason) {
|
|
|
111842
112015
|
}
|
|
111843
112016
|
function getOpenCodeConfigPath(options2) {
|
|
111844
112017
|
if (options2.global) {
|
|
111845
|
-
return
|
|
112018
|
+
return join147(options2.homeDir ?? homedir51(), ".config", "opencode", "opencode.json");
|
|
111846
112019
|
}
|
|
111847
|
-
return
|
|
112020
|
+
return join147(options2.cwd ?? process.cwd(), "opencode.json");
|
|
111848
112021
|
}
|
|
111849
112022
|
function makeCatalogOpts(options2) {
|
|
111850
112023
|
return {
|
|
@@ -112717,7 +112890,7 @@ function appendFallbackSkillActionsToPlan(plan, skills, selectedProviders, insta
|
|
|
112717
112890
|
reason: "New item, not previously installed",
|
|
112718
112891
|
reasonCode: "new-item",
|
|
112719
112892
|
reasonCopy: "New - not previously installed",
|
|
112720
|
-
targetPath:
|
|
112893
|
+
targetPath: join148(basePath, skill.name),
|
|
112721
112894
|
type: "skill"
|
|
112722
112895
|
});
|
|
112723
112896
|
}
|
|
@@ -112935,10 +113108,28 @@ function createSkippedPathMigrationCleanupResult2(action) {
|
|
|
112935
113108
|
skipReason: "Legacy path cleanup skipped because no successful replacement write was recorded"
|
|
112936
113109
|
};
|
|
112937
113110
|
}
|
|
113111
|
+
function resolveHookTargetPath(item, provider, global3) {
|
|
113112
|
+
const pathConfig = providers[provider].hooks;
|
|
113113
|
+
if (!pathConfig)
|
|
113114
|
+
return null;
|
|
113115
|
+
const basePath = global3 ? pathConfig.globalPath : pathConfig.projectPath;
|
|
113116
|
+
if (!basePath)
|
|
113117
|
+
return null;
|
|
113118
|
+
const converted = convertItem(item, pathConfig.format, provider, { global: global3 });
|
|
113119
|
+
if (converted.error)
|
|
113120
|
+
return null;
|
|
113121
|
+
const targetPath = pathConfig.writeStrategy === "single-file" ? basePath : join148(basePath, converted.filename);
|
|
113122
|
+
const resolvedTarget = resolve48(targetPath).replace(/\\/g, "/");
|
|
113123
|
+
const resolvedBase = resolve48(basePath).replace(/\\/g, "/").replace(/\/+$/, "");
|
|
113124
|
+
if (resolvedTarget !== resolvedBase && !resolvedTarget.startsWith(`${resolvedBase}/`)) {
|
|
113125
|
+
return null;
|
|
113126
|
+
}
|
|
113127
|
+
return targetPath;
|
|
113128
|
+
}
|
|
112938
113129
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
112939
113130
|
if (!skillSourcePath)
|
|
112940
113131
|
return;
|
|
112941
|
-
const sourceMetadataPath =
|
|
113132
|
+
const sourceMetadataPath = join148(resolve48(skillSourcePath, ".."), "metadata.json");
|
|
112942
113133
|
if (!existsSync71(sourceMetadataPath))
|
|
112943
113134
|
return;
|
|
112944
113135
|
let sourceMetadata;
|
|
@@ -112951,7 +113142,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
112951
113142
|
}
|
|
112952
113143
|
if (!sourceMetadata.deletions || sourceMetadata.deletions.length === 0)
|
|
112953
113144
|
return;
|
|
112954
|
-
const claudeDir3 = installGlobally ?
|
|
113145
|
+
const claudeDir3 = installGlobally ? join148(homedir52(), ".claude") : join148(process.cwd(), ".claude");
|
|
112955
113146
|
if (!existsSync71(claudeDir3))
|
|
112956
113147
|
return;
|
|
112957
113148
|
try {
|
|
@@ -113079,8 +113270,8 @@ async function migrateCommand(options2) {
|
|
|
113079
113270
|
let requestedGlobal = options2.global ?? false;
|
|
113080
113271
|
let installGlobally = requestedGlobal;
|
|
113081
113272
|
if (options2.global === undefined && !options2.yes) {
|
|
113082
|
-
const projectTarget =
|
|
113083
|
-
const globalTarget =
|
|
113273
|
+
const projectTarget = join148(process.cwd(), ".claude");
|
|
113274
|
+
const globalTarget = join148(homedir52(), ".claude");
|
|
113084
113275
|
const scopeChoice = await ie({
|
|
113085
113276
|
message: "Installation scope",
|
|
113086
113277
|
options: [
|
|
@@ -113153,7 +113344,7 @@ async function migrateCommand(options2) {
|
|
|
113153
113344
|
}).join(`
|
|
113154
113345
|
`));
|
|
113155
113346
|
if (sourceGlobalOnly) {
|
|
113156
|
-
f2.info(import_picocolors30.default.dim(` Scope: global (--global / -g) - reading from ${formatDisplayPath(
|
|
113347
|
+
f2.info(import_picocolors30.default.dim(` Scope: global (--global / -g) - reading from ${formatDisplayPath(join148(homedir52(), ".claude"))}`));
|
|
113157
113348
|
} else {
|
|
113158
113349
|
f2.info(import_picocolors30.default.dim(` CWD: ${process.cwd()}`));
|
|
113159
113350
|
}
|
|
@@ -113342,23 +113533,31 @@ async function migrateCommand(options2) {
|
|
|
113342
113533
|
}
|
|
113343
113534
|
const progressSink = createMigrateProgressSink(writeTasks.length + plannedDeleteActions.length);
|
|
113344
113535
|
const writtenPaths = new Set;
|
|
113536
|
+
const recordHookTargetForSettings = (provider, global3, targetPath) => {
|
|
113537
|
+
if (targetPath.length === 0 || !existsSync71(targetPath))
|
|
113538
|
+
return;
|
|
113539
|
+
const resolvedPath = resolve48(targetPath);
|
|
113540
|
+
const entry = successfulHookFiles.get(provider) ?? {
|
|
113541
|
+
files: [],
|
|
113542
|
+
global: global3
|
|
113543
|
+
};
|
|
113544
|
+
const hookFile = basename30(targetPath);
|
|
113545
|
+
if (!entry.files.includes(hookFile))
|
|
113546
|
+
entry.files.push(hookFile);
|
|
113547
|
+
successfulHookFiles.set(provider, entry);
|
|
113548
|
+
const absExisting = successfulHookAbsPaths.get(provider) ?? [];
|
|
113549
|
+
if (!absExisting.includes(resolvedPath)) {
|
|
113550
|
+
absExisting.push(resolvedPath);
|
|
113551
|
+
successfulHookAbsPaths.set(provider, absExisting);
|
|
113552
|
+
}
|
|
113553
|
+
};
|
|
113345
113554
|
const recordSuccessfulWrites = (task, taskResults) => {
|
|
113346
|
-
for (const result of taskResults.filter((entry) => entry.success
|
|
113347
|
-
if (result.path.length > 0) {
|
|
113555
|
+
for (const result of taskResults.filter((entry) => entry.success)) {
|
|
113556
|
+
if (!result.skipped && result.path.length > 0) {
|
|
113348
113557
|
writtenPaths.add(resolve48(result.path));
|
|
113349
113558
|
}
|
|
113350
113559
|
if (task.type === "hooks") {
|
|
113351
|
-
|
|
113352
|
-
files: [],
|
|
113353
|
-
global: task.global
|
|
113354
|
-
};
|
|
113355
|
-
existing.files.push(basename30(result.path));
|
|
113356
|
-
successfulHookFiles.set(task.provider, existing);
|
|
113357
|
-
if (result.path.length > 0) {
|
|
113358
|
-
const absExisting = successfulHookAbsPaths.get(task.provider) ?? [];
|
|
113359
|
-
absExisting.push(resolve48(result.path));
|
|
113360
|
-
successfulHookAbsPaths.set(task.provider, absExisting);
|
|
113361
|
-
}
|
|
113560
|
+
recordHookTargetForSettings(task.provider, task.global, result.path);
|
|
113362
113561
|
}
|
|
113363
113562
|
}
|
|
113364
113563
|
};
|
|
@@ -113393,6 +113592,18 @@ async function migrateCommand(options2) {
|
|
|
113393
113592
|
recordSuccessfulWrites(task, taskResults);
|
|
113394
113593
|
progressSink.tick(progressLabelForType(task.type));
|
|
113395
113594
|
}
|
|
113595
|
+
if (hooksSource && effectiveHookItems.length > 0) {
|
|
113596
|
+
for (const provider of selectedProviders) {
|
|
113597
|
+
if (!getProvidersSupporting("hooks").includes(provider))
|
|
113598
|
+
continue;
|
|
113599
|
+
const global3 = resolvePortableTypeGlobal(provider, "hooks", installGlobally);
|
|
113600
|
+
for (const item of effectiveHookItems) {
|
|
113601
|
+
const targetPath = resolveHookTargetPath(item, provider, global3);
|
|
113602
|
+
if (targetPath)
|
|
113603
|
+
recordHookTargetForSettings(provider, global3, targetPath);
|
|
113604
|
+
}
|
|
113605
|
+
}
|
|
113606
|
+
}
|
|
113396
113607
|
if (selectedProviders.includes("opencode")) {
|
|
113397
113608
|
try {
|
|
113398
113609
|
const result = await ensureOpenCodeModel({
|
|
@@ -113442,12 +113653,15 @@ async function migrateCommand(options2) {
|
|
|
113442
113653
|
for (const [hooksProvider, entry] of successfulHookFiles) {
|
|
113443
113654
|
if (entry.files.length === 0)
|
|
113444
113655
|
continue;
|
|
113656
|
+
const sourceSettingsPath = hooksSource ? join148(dirname49(hooksSource), "settings.json") : undefined;
|
|
113445
113657
|
const mergeResult = await migrateHooksSettings({
|
|
113446
113658
|
sourceProvider: "claude-code",
|
|
113447
113659
|
targetProvider: hooksProvider,
|
|
113448
113660
|
installedHookFiles: entry.files,
|
|
113449
113661
|
installedHookAbsolutePaths: successfulHookAbsPaths.get(hooksProvider),
|
|
113450
|
-
global: entry.global
|
|
113662
|
+
global: entry.global,
|
|
113663
|
+
sourceSettingsPath,
|
|
113664
|
+
sourceHooksDir: hooksSource ?? undefined
|
|
113451
113665
|
});
|
|
113452
113666
|
appendMigrationWarningMessages(postProgressWarnings, mergeResult.warnings);
|
|
113453
113667
|
if (mergeResult.success && mergeResult.hooksRegistered > 0) {
|
|
@@ -113817,7 +114031,7 @@ async function handleDirectorySetup(ctx) {
|
|
|
113817
114031
|
// src/commands/new/phases/project-creation.ts
|
|
113818
114032
|
init_config_manager();
|
|
113819
114033
|
init_github_client();
|
|
113820
|
-
import { join as
|
|
114034
|
+
import { join as join149 } from "node:path";
|
|
113821
114035
|
init_logger();
|
|
113822
114036
|
init_output_manager();
|
|
113823
114037
|
init_types3();
|
|
@@ -113943,7 +114157,7 @@ async function projectCreation(kit, resolvedDir, validOptions, isNonInteractive2
|
|
|
113943
114157
|
output.section("Installing");
|
|
113944
114158
|
logger.verbose("Installation target", { directory: resolvedDir });
|
|
113945
114159
|
const merger = new FileMerger;
|
|
113946
|
-
const claudeDir3 =
|
|
114160
|
+
const claudeDir3 = join149(resolvedDir, ".claude");
|
|
113947
114161
|
merger.setMultiKitContext(claudeDir3, kit);
|
|
113948
114162
|
if (validOptions.exclude && validOptions.exclude.length > 0) {
|
|
113949
114163
|
merger.addIgnorePatterns(validOptions.exclude);
|
|
@@ -113990,28 +114204,28 @@ async function handleProjectCreation(ctx) {
|
|
|
113990
114204
|
}
|
|
113991
114205
|
// src/commands/new/phases/post-setup.ts
|
|
113992
114206
|
init_projects_registry();
|
|
113993
|
-
import { join as
|
|
114207
|
+
import { join as join150 } from "node:path";
|
|
113994
114208
|
init_package_installer();
|
|
113995
114209
|
init_logger();
|
|
113996
114210
|
init_path_resolver();
|
|
113997
114211
|
async function postSetup(resolvedDir, validOptions, isNonInteractive2, prompts) {
|
|
113998
114212
|
let installOpenCode2 = validOptions.opencode;
|
|
113999
|
-
let
|
|
114213
|
+
let installAgy2 = validOptions.gemini;
|
|
114000
114214
|
let installSkills = validOptions.installSkills;
|
|
114001
|
-
if (!isNonInteractive2 && !installOpenCode2 && !
|
|
114215
|
+
if (!isNonInteractive2 && !installOpenCode2 && !installAgy2 && !installSkills) {
|
|
114002
114216
|
const packageChoices = await prompts.promptPackageInstallations();
|
|
114003
114217
|
installOpenCode2 = packageChoices.installOpenCode;
|
|
114004
|
-
|
|
114218
|
+
installAgy2 = packageChoices.installAgy;
|
|
114005
114219
|
installSkills = await prompts.promptSkillsInstallation();
|
|
114006
114220
|
}
|
|
114007
|
-
if (installOpenCode2 ||
|
|
114221
|
+
if (installOpenCode2 || installAgy2) {
|
|
114008
114222
|
logger.info("Installing optional packages...");
|
|
114009
114223
|
try {
|
|
114010
|
-
const installationResults = await processPackageInstallations(installOpenCode2,
|
|
114224
|
+
const installationResults = await processPackageInstallations(installOpenCode2, installAgy2, resolvedDir);
|
|
114011
114225
|
prompts.showPackageInstallationResults(installationResults);
|
|
114012
114226
|
} catch (error) {
|
|
114013
114227
|
logger.warning(`Package installation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
114014
|
-
logger.info("You can install these packages manually later
|
|
114228
|
+
logger.info("You can install these packages manually later from each tool's official install guide.");
|
|
114015
114229
|
}
|
|
114016
114230
|
}
|
|
114017
114231
|
if (installSkills) {
|
|
@@ -114022,9 +114236,9 @@ async function postSetup(resolvedDir, validOptions, isNonInteractive2, prompts)
|
|
|
114022
114236
|
withSudo: validOptions.withSudo
|
|
114023
114237
|
});
|
|
114024
114238
|
}
|
|
114025
|
-
const claudeDir3 =
|
|
114239
|
+
const claudeDir3 = join150(resolvedDir, ".claude");
|
|
114026
114240
|
await promptSetupWizardIfNeeded({
|
|
114027
|
-
envPath:
|
|
114241
|
+
envPath: join150(claudeDir3, ".env"),
|
|
114028
114242
|
claudeDir: claudeDir3,
|
|
114029
114243
|
isGlobal: false,
|
|
114030
114244
|
isNonInteractive: isNonInteractive2,
|
|
@@ -114094,7 +114308,7 @@ Please use only one download method.`);
|
|
|
114094
114308
|
// src/commands/plan/plan-command.ts
|
|
114095
114309
|
init_output_manager();
|
|
114096
114310
|
import { existsSync as existsSync74, statSync as statSync13 } from "node:fs";
|
|
114097
|
-
import { dirname as
|
|
114311
|
+
import { dirname as dirname53, isAbsolute as isAbsolute15, join as join153, parse as parse7, resolve as resolve53 } from "node:path";
|
|
114098
114312
|
|
|
114099
114313
|
// src/commands/plan/plan-read-handlers.ts
|
|
114100
114314
|
init_config();
|
|
@@ -114104,18 +114318,18 @@ init_logger();
|
|
|
114104
114318
|
init_output_manager();
|
|
114105
114319
|
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
114106
114320
|
import { existsSync as existsSync73, statSync as statSync12 } from "node:fs";
|
|
114107
|
-
import { basename as basename31, dirname as
|
|
114321
|
+
import { basename as basename31, dirname as dirname51, join as join152, relative as relative32, resolve as resolve51 } from "node:path";
|
|
114108
114322
|
|
|
114109
114323
|
// src/commands/plan/plan-dependencies.ts
|
|
114110
114324
|
init_config();
|
|
114111
114325
|
init_plan_parser();
|
|
114112
114326
|
init_plans_registry();
|
|
114113
114327
|
import { existsSync as existsSync72 } from "node:fs";
|
|
114114
|
-
import { dirname as
|
|
114328
|
+
import { dirname as dirname50, join as join151 } from "node:path";
|
|
114115
114329
|
async function resolvePlanDependencies(references, currentPlanFile, options2 = {}) {
|
|
114116
114330
|
if (references.length === 0)
|
|
114117
114331
|
return [];
|
|
114118
|
-
const currentPlanDir =
|
|
114332
|
+
const currentPlanDir = dirname50(currentPlanFile);
|
|
114119
114333
|
const projectRoot = findProjectRoot(currentPlanDir);
|
|
114120
114334
|
const config = options2.preloadedConfig ?? (await CkConfigManager.loadFull(projectRoot)).config;
|
|
114121
114335
|
const defaultScope = inferPlanScopeForDir(currentPlanDir, config);
|
|
@@ -114131,7 +114345,7 @@ async function resolvePlanDependencies(references, currentPlanFile, options2 = {
|
|
|
114131
114345
|
};
|
|
114132
114346
|
}
|
|
114133
114347
|
const scopeRoot = resolvePlanDirForScope(scope, projectRoot, config);
|
|
114134
|
-
const planFile =
|
|
114348
|
+
const planFile = join151(scopeRoot, planId, "plan.md");
|
|
114135
114349
|
const isSelfReference = planFile === currentPlanFile;
|
|
114136
114350
|
if (!existsSync72(planFile)) {
|
|
114137
114351
|
return {
|
|
@@ -114162,14 +114376,14 @@ init_config();
|
|
|
114162
114376
|
init_plan_parser();
|
|
114163
114377
|
init_plan_scope();
|
|
114164
114378
|
init_plans_registry();
|
|
114165
|
-
import { isAbsolute as
|
|
114379
|
+
import { isAbsolute as isAbsolute14, resolve as resolve50 } from "node:path";
|
|
114166
114380
|
async function getGlobalPlansDirFromCwd() {
|
|
114167
114381
|
const projectRoot = findProjectRoot(process.cwd());
|
|
114168
114382
|
const { config } = await CkConfigManager.loadFull(projectRoot);
|
|
114169
114383
|
return resolveGlobalPlansDir(config);
|
|
114170
114384
|
}
|
|
114171
114385
|
function resolveTargetFromBase(target, baseDir) {
|
|
114172
|
-
const resolvedTarget =
|
|
114386
|
+
const resolvedTarget = isAbsolute14(target) ? resolve50(target) : resolve50(baseDir, target);
|
|
114173
114387
|
return isWithinDir(resolvedTarget, baseDir) ? resolvedTarget : null;
|
|
114174
114388
|
}
|
|
114175
114389
|
|
|
@@ -114202,7 +114416,7 @@ async function handleParse(target, options2) {
|
|
|
114202
114416
|
console.log(JSON.stringify({ file: relative32(process.cwd(), planFile), frontmatter, phases }, null, 2));
|
|
114203
114417
|
return;
|
|
114204
114418
|
}
|
|
114205
|
-
const title = typeof frontmatter.title === "string" ? frontmatter.title : basename31(
|
|
114419
|
+
const title = typeof frontmatter.title === "string" ? frontmatter.title : basename31(dirname51(planFile));
|
|
114206
114420
|
console.log();
|
|
114207
114421
|
console.log(import_picocolors32.default.bold(` Plan: ${title}`));
|
|
114208
114422
|
console.log(` File: ${planFile}`);
|
|
@@ -114273,7 +114487,7 @@ async function handleStatus(target, options2) {
|
|
|
114273
114487
|
}
|
|
114274
114488
|
const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
|
|
114275
114489
|
const t = effectiveTarget ? resolve51(effectiveTarget) : null;
|
|
114276
|
-
const plansDir = t && existsSync73(t) && statSync12(t).isDirectory() && !existsSync73(
|
|
114490
|
+
const plansDir = t && existsSync73(t) && statSync12(t).isDirectory() && !existsSync73(join152(t, "plan.md")) ? t : null;
|
|
114277
114491
|
if (plansDir) {
|
|
114278
114492
|
const planFiles = scanPlanDir(plansDir);
|
|
114279
114493
|
if (planFiles.length === 0) {
|
|
@@ -114313,7 +114527,7 @@ async function handleStatus(target, options2) {
|
|
|
114313
114527
|
const blockedBy2 = await resolvePlanDependencies(s.blockedBy, pf, { preloadedConfig });
|
|
114314
114528
|
const blocks2 = await resolvePlanDependencies(s.blocks, pf, { preloadedConfig });
|
|
114315
114529
|
const bar = progressBar(s.completed, s.totalPhases);
|
|
114316
|
-
const title2 = s.title ?? basename31(
|
|
114530
|
+
const title2 = s.title ?? basename31(dirname51(pf));
|
|
114317
114531
|
console.log(` ${import_picocolors32.default.bold(title2)}`);
|
|
114318
114532
|
console.log(` ${bar}`);
|
|
114319
114533
|
if (s.inProgress > 0)
|
|
@@ -114332,7 +114546,7 @@ async function handleStatus(target, options2) {
|
|
|
114332
114546
|
}
|
|
114333
114547
|
console.log();
|
|
114334
114548
|
} catch {
|
|
114335
|
-
console.log(` [X] Failed to read: ${basename31(
|
|
114549
|
+
console.log(` [X] Failed to read: ${basename31(dirname51(pf))}`);
|
|
114336
114550
|
console.log();
|
|
114337
114551
|
}
|
|
114338
114552
|
}
|
|
@@ -114359,7 +114573,7 @@ async function handleStatus(target, options2) {
|
|
|
114359
114573
|
console.log(JSON.stringify({ ...summary, dependencyStatus: { blockedBy, blocks } }, null, 2));
|
|
114360
114574
|
return;
|
|
114361
114575
|
}
|
|
114362
|
-
const title = summary.title ?? basename31(
|
|
114576
|
+
const title = summary.title ?? basename31(dirname51(planFile));
|
|
114363
114577
|
console.log();
|
|
114364
114578
|
console.log(import_picocolors32.default.bold(` ${title}`));
|
|
114365
114579
|
if (summary.status)
|
|
@@ -114422,7 +114636,7 @@ async function handleKanban(target, options2) {
|
|
|
114422
114636
|
process.exitCode = 1;
|
|
114423
114637
|
return;
|
|
114424
114638
|
}
|
|
114425
|
-
const route = `/plans?dir=${encodeURIComponent(
|
|
114639
|
+
const route = `/plans?dir=${encodeURIComponent(dirname51(dirname51(planFile)))}&view=kanban`;
|
|
114426
114640
|
const url = `http://localhost:${server.port}${route}`;
|
|
114427
114641
|
console.log();
|
|
114428
114642
|
console.log(import_picocolors32.default.bold(" ClaudeKit Dashboard — Plans"));
|
|
@@ -114457,7 +114671,7 @@ init_plan_parser();
|
|
|
114457
114671
|
init_plans_registry();
|
|
114458
114672
|
init_output_manager();
|
|
114459
114673
|
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
114460
|
-
import { basename as basename32, dirname as
|
|
114674
|
+
import { basename as basename32, dirname as dirname52, relative as relative33, resolve as resolve52 } from "node:path";
|
|
114461
114675
|
function quoteReadTarget(filePath) {
|
|
114462
114676
|
return `"${filePath.replace(/\\/g, "/").replace(/"/g, "\\\"")}"`;
|
|
114463
114677
|
}
|
|
@@ -114571,7 +114785,7 @@ async function handleCheck(target, options2) {
|
|
|
114571
114785
|
process.exitCode = 1;
|
|
114572
114786
|
return;
|
|
114573
114787
|
}
|
|
114574
|
-
const planDir =
|
|
114788
|
+
const planDir = dirname52(planFile);
|
|
114575
114789
|
let planStatus = "pending";
|
|
114576
114790
|
try {
|
|
114577
114791
|
const projectRoot = findProjectRoot(planDir);
|
|
@@ -114620,7 +114834,7 @@ async function handleUncheck(target, options2) {
|
|
|
114620
114834
|
process.exitCode = 1;
|
|
114621
114835
|
return;
|
|
114622
114836
|
}
|
|
114623
|
-
const planDir =
|
|
114837
|
+
const planDir = dirname52(planFile);
|
|
114624
114838
|
try {
|
|
114625
114839
|
const projectRoot = findProjectRoot(planDir);
|
|
114626
114840
|
const summary = buildPlanSummary(planFile);
|
|
@@ -114659,7 +114873,7 @@ async function handleAddPhase(target, options2) {
|
|
|
114659
114873
|
try {
|
|
114660
114874
|
const result = addPhase(planFile, target, options2.after);
|
|
114661
114875
|
try {
|
|
114662
|
-
const planDir =
|
|
114876
|
+
const planDir = dirname52(planFile);
|
|
114663
114877
|
const projectRoot = findProjectRoot(planDir);
|
|
114664
114878
|
updateRegistryAddPhase({
|
|
114665
114879
|
planDir,
|
|
@@ -114687,7 +114901,7 @@ function resolveTargetPath(target, baseDir) {
|
|
|
114687
114901
|
if (!baseDir) {
|
|
114688
114902
|
return resolve53(target);
|
|
114689
114903
|
}
|
|
114690
|
-
if (
|
|
114904
|
+
if (isAbsolute15(target)) {
|
|
114691
114905
|
return resolve53(target);
|
|
114692
114906
|
}
|
|
114693
114907
|
const cwdCandidate = resolve53(target);
|
|
@@ -114702,7 +114916,7 @@ function resolvePlanFile(target, baseDir) {
|
|
|
114702
114916
|
const stat24 = statSync13(t);
|
|
114703
114917
|
if (stat24.isFile())
|
|
114704
114918
|
return t;
|
|
114705
|
-
const candidate =
|
|
114919
|
+
const candidate = join153(t, "plan.md");
|
|
114706
114920
|
if (existsSync74(candidate))
|
|
114707
114921
|
return candidate;
|
|
114708
114922
|
}
|
|
@@ -114710,10 +114924,10 @@ function resolvePlanFile(target, baseDir) {
|
|
|
114710
114924
|
let dir = process.cwd();
|
|
114711
114925
|
const root = parse7(dir).root;
|
|
114712
114926
|
while (dir !== root) {
|
|
114713
|
-
const candidate =
|
|
114927
|
+
const candidate = join153(dir, "plan.md");
|
|
114714
114928
|
if (existsSync74(candidate))
|
|
114715
114929
|
return candidate;
|
|
114716
|
-
dir =
|
|
114930
|
+
dir = dirname53(dir);
|
|
114717
114931
|
}
|
|
114718
114932
|
}
|
|
114719
114933
|
return null;
|
|
@@ -115072,7 +115286,7 @@ async function handleEnvironmentConfig(ctx) {
|
|
|
115072
115286
|
};
|
|
115073
115287
|
}
|
|
115074
115288
|
// src/commands/setup/phases/packages-optional.ts
|
|
115075
|
-
|
|
115289
|
+
init_agy_installer();
|
|
115076
115290
|
init_opencode_installer();
|
|
115077
115291
|
init_dist2();
|
|
115078
115292
|
async function handleOptionalPackages(ctx) {
|
|
@@ -115102,23 +115316,23 @@ async function handleOptionalPackages(ctx) {
|
|
|
115102
115316
|
}
|
|
115103
115317
|
}
|
|
115104
115318
|
}
|
|
115105
|
-
const
|
|
115106
|
-
if (
|
|
115107
|
-
f2.success("
|
|
115319
|
+
const hasAgy = await isAgyInstalled();
|
|
115320
|
+
if (hasAgy) {
|
|
115321
|
+
f2.success("Antigravity CLI (agy): already installed");
|
|
115108
115322
|
} else {
|
|
115109
|
-
const
|
|
115110
|
-
message: "Install
|
|
115323
|
+
const installAgyChoice = await se({
|
|
115324
|
+
message: "Install Antigravity CLI (agy)? (AI assistant)",
|
|
115111
115325
|
initialValue: false
|
|
115112
115326
|
});
|
|
115113
|
-
if (lD(
|
|
115327
|
+
if (lD(installAgyChoice)) {
|
|
115114
115328
|
return { ...ctx, cancelled: true };
|
|
115115
115329
|
}
|
|
115116
|
-
if (
|
|
115117
|
-
const result = await
|
|
115330
|
+
if (installAgyChoice) {
|
|
115331
|
+
const result = await installAgy();
|
|
115118
115332
|
if (result.success) {
|
|
115119
|
-
installedPackages.push("
|
|
115333
|
+
installedPackages.push("Antigravity CLI (agy)");
|
|
115120
115334
|
} else {
|
|
115121
|
-
f2.warning(`Failed to install
|
|
115335
|
+
f2.warning(`Failed to install Antigravity CLI (agy): ${result.error || "Unknown error"}`);
|
|
115122
115336
|
}
|
|
115123
115337
|
}
|
|
115124
115338
|
}
|
|
@@ -115230,10 +115444,10 @@ init_agents();
|
|
|
115230
115444
|
var import_gray_matter12 = __toESM(require_gray_matter(), 1);
|
|
115231
115445
|
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
115232
115446
|
import { readFile as readFile68 } from "node:fs/promises";
|
|
115233
|
-
import { join as
|
|
115447
|
+
import { join as join155 } from "node:path";
|
|
115234
115448
|
|
|
115235
115449
|
// src/commands/skills/installed-skills-inventory.ts
|
|
115236
|
-
import { join as
|
|
115450
|
+
import { join as join154, resolve as resolve55 } from "node:path";
|
|
115237
115451
|
init_path_resolver();
|
|
115238
115452
|
var SCOPE_SORT_ORDER = {
|
|
115239
115453
|
project: 0,
|
|
@@ -115245,8 +115459,8 @@ async function getActiveClaudeSkillInstallations(options2 = {}) {
|
|
|
115245
115459
|
const projectClaudeDir = resolve55(projectDir, ".claude");
|
|
115246
115460
|
const projectScopeAliasesGlobal = projectClaudeDir === globalDir;
|
|
115247
115461
|
const [projectSkills, globalSkills] = await Promise.all([
|
|
115248
|
-
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(
|
|
115249
|
-
scanSkills2(
|
|
115462
|
+
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(join154(projectClaudeDir, "skills")),
|
|
115463
|
+
scanSkills2(join154(globalDir, "skills"))
|
|
115250
115464
|
]);
|
|
115251
115465
|
const projectIds = new Set(projectSkills.map((skill) => skill.id));
|
|
115252
115466
|
const globalIds = new Set(globalSkills.map((skill) => skill.id));
|
|
@@ -115407,7 +115621,7 @@ async function handleValidate2(sourcePath) {
|
|
|
115407
115621
|
spinner.stop(`Checked ${skills.length} skill(s)`);
|
|
115408
115622
|
let hasIssues = false;
|
|
115409
115623
|
for (const skill of skills) {
|
|
115410
|
-
const skillMdPath =
|
|
115624
|
+
const skillMdPath = join155(skill.path, "SKILL.md");
|
|
115411
115625
|
try {
|
|
115412
115626
|
const content = await readFile68(skillMdPath, "utf-8");
|
|
115413
115627
|
const { data } = import_gray_matter12.default(content, {
|
|
@@ -115943,7 +116157,7 @@ init_skills_uninstaller();
|
|
|
115943
116157
|
// src/domains/installation/plugin/uninstall-plugin.ts
|
|
115944
116158
|
init_install_mode_detector();
|
|
115945
116159
|
import { existsSync as existsSync76, rmSync as rmSync6 } from "node:fs";
|
|
115946
|
-
import { join as
|
|
116160
|
+
import { join as join156 } from "node:path";
|
|
115947
116161
|
init_path_resolver();
|
|
115948
116162
|
async function uninstallEnginePlugin(opts = {}) {
|
|
115949
116163
|
const claudeDir3 = opts.claudeDir ?? PathResolver.getGlobalKitDir();
|
|
@@ -115957,7 +116171,7 @@ async function uninstallEnginePlugin(opts = {}) {
|
|
|
115957
116171
|
}
|
|
115958
116172
|
let staleCacheRemoved = false;
|
|
115959
116173
|
const marketplace = state.marketplace ?? CK_MARKETPLACE_NAME;
|
|
115960
|
-
const cacheDir =
|
|
116174
|
+
const cacheDir = join156(claudeDir3, "plugins", "cache", marketplace, CK_PLUGIN_NAME);
|
|
115961
116175
|
if (existsSync76(cacheDir)) {
|
|
115962
116176
|
rmSync6(cacheDir, { recursive: true, force: true });
|
|
115963
116177
|
staleCacheRemoved = true;
|
|
@@ -116015,7 +116229,7 @@ async function detectInstallations() {
|
|
|
116015
116229
|
|
|
116016
116230
|
// src/commands/uninstall/removal-handler.ts
|
|
116017
116231
|
import { readdirSync as readdirSync13, rmSync as rmSync8 } from "node:fs";
|
|
116018
|
-
import { basename as basename33, join as
|
|
116232
|
+
import { basename as basename33, join as join159, resolve as resolve56, sep as sep14 } from "node:path";
|
|
116019
116233
|
init_logger();
|
|
116020
116234
|
init_safe_prompts();
|
|
116021
116235
|
init_safe_spinner();
|
|
@@ -116024,7 +116238,7 @@ var import_fs_extra44 = __toESM(require_lib(), 1);
|
|
|
116024
116238
|
// src/commands/uninstall/analysis-handler.ts
|
|
116025
116239
|
init_metadata_migration();
|
|
116026
116240
|
import { readdirSync as readdirSync12, rmSync as rmSync7 } from "node:fs";
|
|
116027
|
-
import { dirname as
|
|
116241
|
+
import { dirname as dirname54, join as join157 } from "node:path";
|
|
116028
116242
|
init_logger();
|
|
116029
116243
|
init_safe_prompts();
|
|
116030
116244
|
var import_fs_extra42 = __toESM(require_lib(), 1);
|
|
@@ -116046,7 +116260,7 @@ function classifyFileByOwnership(ownership, forceOverwrite, deleteReason) {
|
|
|
116046
116260
|
}
|
|
116047
116261
|
async function cleanupEmptyDirectories3(filePath, installationRoot) {
|
|
116048
116262
|
let cleaned = 0;
|
|
116049
|
-
let currentDir =
|
|
116263
|
+
let currentDir = dirname54(filePath);
|
|
116050
116264
|
while (currentDir !== installationRoot && currentDir.startsWith(installationRoot)) {
|
|
116051
116265
|
try {
|
|
116052
116266
|
const entries = readdirSync12(currentDir);
|
|
@@ -116054,7 +116268,7 @@ async function cleanupEmptyDirectories3(filePath, installationRoot) {
|
|
|
116054
116268
|
rmSync7(currentDir, { recursive: true });
|
|
116055
116269
|
cleaned++;
|
|
116056
116270
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
116057
|
-
currentDir =
|
|
116271
|
+
currentDir = dirname54(currentDir);
|
|
116058
116272
|
} else {
|
|
116059
116273
|
break;
|
|
116060
116274
|
}
|
|
@@ -116084,7 +116298,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
116084
116298
|
const remainingFiles = metadata.kits?.[remainingKit]?.files || [];
|
|
116085
116299
|
for (const file of remainingFiles) {
|
|
116086
116300
|
const relativePath = normalizeTrackedPath(file.path);
|
|
116087
|
-
if (await import_fs_extra42.pathExists(
|
|
116301
|
+
if (await import_fs_extra42.pathExists(join157(installation.path, relativePath))) {
|
|
116088
116302
|
result.retainedManifestPaths.push(relativePath);
|
|
116089
116303
|
}
|
|
116090
116304
|
}
|
|
@@ -116092,7 +116306,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
116092
116306
|
const kitFiles = metadata.kits[kit].files || [];
|
|
116093
116307
|
for (const trackedFile of kitFiles) {
|
|
116094
116308
|
const relativePath = normalizeTrackedPath(trackedFile.path);
|
|
116095
|
-
const filePath =
|
|
116309
|
+
const filePath = join157(installation.path, relativePath);
|
|
116096
116310
|
if (preservedPaths.has(relativePath)) {
|
|
116097
116311
|
result.toPreserve.push({ path: relativePath, reason: "shared with other kit" });
|
|
116098
116312
|
continue;
|
|
@@ -116125,7 +116339,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
116125
116339
|
}
|
|
116126
116340
|
for (const trackedFile of allTrackedFiles) {
|
|
116127
116341
|
const relativePath = normalizeTrackedPath(trackedFile.path);
|
|
116128
|
-
const filePath =
|
|
116342
|
+
const filePath = join157(installation.path, relativePath);
|
|
116129
116343
|
const ownershipResult = await OwnershipChecker.checkOwnership(filePath, metadata, installation.path);
|
|
116130
116344
|
if (!ownershipResult.exists)
|
|
116131
116345
|
continue;
|
|
@@ -116176,7 +116390,7 @@ init_settings_merger();
|
|
|
116176
116390
|
init_command_normalizer();
|
|
116177
116391
|
init_logger();
|
|
116178
116392
|
var import_fs_extra43 = __toESM(require_lib(), 1);
|
|
116179
|
-
import { join as
|
|
116393
|
+
import { join as join158 } from "node:path";
|
|
116180
116394
|
var CK_JSON_FILE2 = ".ck.json";
|
|
116181
116395
|
var SETTINGS_FILE = "settings.json";
|
|
116182
116396
|
var EMPTY_RESULT = {
|
|
@@ -116298,7 +116512,7 @@ async function cleanupCkJson(ckJsonPath, data, removedKitNames, dryRun) {
|
|
|
116298
116512
|
return false;
|
|
116299
116513
|
}
|
|
116300
116514
|
async function cleanupUninstalledSettings(installationPath, options2) {
|
|
116301
|
-
const ckJsonPath =
|
|
116515
|
+
const ckJsonPath = join158(installationPath, CK_JSON_FILE2);
|
|
116302
116516
|
if (!await import_fs_extra43.pathExists(ckJsonPath)) {
|
|
116303
116517
|
return { ...EMPTY_RESULT };
|
|
116304
116518
|
}
|
|
@@ -116313,7 +116527,7 @@ async function cleanupUninstalledSettings(installationPath, options2) {
|
|
|
116313
116527
|
const removedKitNames = options2.kit ? [options2.kit] : Object.keys(kits);
|
|
116314
116528
|
const { hooks, servers } = resolveRemovalTargets(kits, removedKitNames, options2.remainingKits);
|
|
116315
116529
|
const result = { ...EMPTY_RESULT };
|
|
116316
|
-
const settingsPath =
|
|
116530
|
+
const settingsPath = join158(installationPath, SETTINGS_FILE);
|
|
116317
116531
|
const settings = await SettingsMerger.readSettingsFile(settingsPath);
|
|
116318
116532
|
if (settings) {
|
|
116319
116533
|
result.hooksRemoved = removeHooksFromSettings(settings, hooks);
|
|
@@ -116427,8 +116641,8 @@ async function removeInstallations(installations, options2) {
|
|
|
116427
116641
|
}
|
|
116428
116642
|
const mutatePaths = getUninstallMutatePaths({
|
|
116429
116643
|
retainedManifestPaths: analysis.retainedManifestPaths,
|
|
116430
|
-
settingsFileExists: await import_fs_extra44.pathExists(
|
|
116431
|
-
ckJsonExists: await import_fs_extra44.pathExists(
|
|
116644
|
+
settingsFileExists: await import_fs_extra44.pathExists(join159(installation.path, "settings.json")),
|
|
116645
|
+
ckJsonExists: await import_fs_extra44.pathExists(join159(installation.path, ".ck.json"))
|
|
116432
116646
|
});
|
|
116433
116647
|
let backup = null;
|
|
116434
116648
|
if (analysis.toDelete.length > 0 || mutatePaths.length > 0) {
|
|
@@ -116456,7 +116670,7 @@ async function removeInstallations(installations, options2) {
|
|
|
116456
116670
|
let removedCount = 0;
|
|
116457
116671
|
let cleanedDirs = 0;
|
|
116458
116672
|
for (const item of analysis.toDelete) {
|
|
116459
|
-
const filePath =
|
|
116673
|
+
const filePath = join159(installation.path, item.path);
|
|
116460
116674
|
if (!await import_fs_extra44.pathExists(filePath))
|
|
116461
116675
|
continue;
|
|
116462
116676
|
if (!await isPathSafeToRemove(filePath, installation.path)) {
|
|
@@ -116883,7 +117097,7 @@ ${import_picocolors40.default.bold(import_picocolors40.default.cyan(result.kitCo
|
|
|
116883
117097
|
init_logger();
|
|
116884
117098
|
import { existsSync as existsSync82 } from "node:fs";
|
|
116885
117099
|
import { rm as rm19 } from "node:fs/promises";
|
|
116886
|
-
import { join as
|
|
117100
|
+
import { join as join166 } from "node:path";
|
|
116887
117101
|
var import_picocolors41 = __toESM(require_picocolors(), 1);
|
|
116888
117102
|
|
|
116889
117103
|
// src/commands/watch/phases/implementation-runner.ts
|
|
@@ -117402,7 +117616,7 @@ function spawnAndCollect3(command, args) {
|
|
|
117402
117616
|
|
|
117403
117617
|
// src/commands/watch/phases/issue-processor.ts
|
|
117404
117618
|
import { mkdir as mkdir40, writeFile as writeFile42 } from "node:fs/promises";
|
|
117405
|
-
import { join as
|
|
117619
|
+
import { join as join162 } from "node:path";
|
|
117406
117620
|
|
|
117407
117621
|
// src/commands/watch/phases/approval-detector.ts
|
|
117408
117622
|
init_logger();
|
|
@@ -117780,9 +117994,9 @@ async function checkAwaitingApproval(state, setup, options2, watchLog, projectDi
|
|
|
117780
117994
|
|
|
117781
117995
|
// src/commands/watch/phases/plan-dir-finder.ts
|
|
117782
117996
|
import { readdir as readdir46, stat as stat24 } from "node:fs/promises";
|
|
117783
|
-
import { join as
|
|
117997
|
+
import { join as join161 } from "node:path";
|
|
117784
117998
|
async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
117785
|
-
const plansRoot =
|
|
117999
|
+
const plansRoot = join161(cwd2, "plans");
|
|
117786
118000
|
try {
|
|
117787
118001
|
const entries = await readdir46(plansRoot);
|
|
117788
118002
|
const tenMinAgo = Date.now() - 10 * 60 * 1000;
|
|
@@ -117791,14 +118005,14 @@ async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
|
117791
118005
|
for (const entry of entries) {
|
|
117792
118006
|
if (entry === "watch" || entry === "reports" || entry === "visuals")
|
|
117793
118007
|
continue;
|
|
117794
|
-
const dirPath =
|
|
118008
|
+
const dirPath = join161(plansRoot, entry);
|
|
117795
118009
|
const dirStat = await stat24(dirPath);
|
|
117796
118010
|
if (!dirStat.isDirectory())
|
|
117797
118011
|
continue;
|
|
117798
118012
|
if (dirStat.mtimeMs < tenMinAgo)
|
|
117799
118013
|
continue;
|
|
117800
118014
|
try {
|
|
117801
|
-
await stat24(
|
|
118015
|
+
await stat24(join161(dirPath, "plan.md"));
|
|
117802
118016
|
} catch {
|
|
117803
118017
|
continue;
|
|
117804
118018
|
}
|
|
@@ -118029,13 +118243,13 @@ async function handlePlanGeneration(issue, state, config, setup, options2, watch
|
|
|
118029
118243
|
stats.plansCreated++;
|
|
118030
118244
|
const detectedPlanDir = await findRecentPlanDir(projectDir, issue.number, watchLog);
|
|
118031
118245
|
if (detectedPlanDir) {
|
|
118032
|
-
state.activeIssues[numStr].planPath =
|
|
118246
|
+
state.activeIssues[numStr].planPath = join162(detectedPlanDir, "plan.md");
|
|
118033
118247
|
watchLog.info(`Plan directory detected: ${detectedPlanDir}`);
|
|
118034
118248
|
} else {
|
|
118035
118249
|
try {
|
|
118036
|
-
const planDir =
|
|
118250
|
+
const planDir = join162(projectDir, "plans", "watch");
|
|
118037
118251
|
await mkdir40(planDir, { recursive: true });
|
|
118038
|
-
const planFilePath =
|
|
118252
|
+
const planFilePath = join162(planDir, `issue-${issue.number}-plan.md`);
|
|
118039
118253
|
await writeFile42(planFilePath, planResult.planText, "utf-8");
|
|
118040
118254
|
state.activeIssues[numStr].planPath = planFilePath;
|
|
118041
118255
|
watchLog.info(`Plan saved (fallback) to ${planFilePath}`);
|
|
@@ -118182,7 +118396,7 @@ init_file_io();
|
|
|
118182
118396
|
init_logger();
|
|
118183
118397
|
import { existsSync as existsSync78 } from "node:fs";
|
|
118184
118398
|
import { mkdir as mkdir41, readFile as readFile71 } from "node:fs/promises";
|
|
118185
|
-
import { dirname as
|
|
118399
|
+
import { dirname as dirname55 } from "node:path";
|
|
118186
118400
|
var PROCESSED_ISSUES_CAP = 500;
|
|
118187
118401
|
async function readCkJson(projectDir) {
|
|
118188
118402
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
@@ -118212,7 +118426,7 @@ async function loadWatchState(projectDir) {
|
|
|
118212
118426
|
}
|
|
118213
118427
|
async function saveWatchState(projectDir, state) {
|
|
118214
118428
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
118215
|
-
const configDir =
|
|
118429
|
+
const configDir = dirname55(configPath);
|
|
118216
118430
|
if (!existsSync78(configDir)) {
|
|
118217
118431
|
await mkdir41(configDir, { recursive: true });
|
|
118218
118432
|
}
|
|
@@ -118342,18 +118556,18 @@ init_logger();
|
|
|
118342
118556
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
118343
118557
|
import { existsSync as existsSync79 } from "node:fs";
|
|
118344
118558
|
import { readdir as readdir47, stat as stat25 } from "node:fs/promises";
|
|
118345
|
-
import { join as
|
|
118559
|
+
import { join as join163 } from "node:path";
|
|
118346
118560
|
async function scanForRepos(parentDir) {
|
|
118347
118561
|
const repos = [];
|
|
118348
118562
|
const entries = await readdir47(parentDir);
|
|
118349
118563
|
for (const entry of entries) {
|
|
118350
118564
|
if (entry.startsWith("."))
|
|
118351
118565
|
continue;
|
|
118352
|
-
const fullPath =
|
|
118566
|
+
const fullPath = join163(parentDir, entry);
|
|
118353
118567
|
const entryStat = await stat25(fullPath);
|
|
118354
118568
|
if (!entryStat.isDirectory())
|
|
118355
118569
|
continue;
|
|
118356
|
-
const gitDir =
|
|
118570
|
+
const gitDir = join163(fullPath, ".git");
|
|
118357
118571
|
if (!existsSync79(gitDir))
|
|
118358
118572
|
continue;
|
|
118359
118573
|
const result = spawnSync7("gh", ["repo", "view", "--json", "owner,name"], {
|
|
@@ -118380,7 +118594,7 @@ init_logger();
|
|
|
118380
118594
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
118381
118595
|
import { existsSync as existsSync80 } from "node:fs";
|
|
118382
118596
|
import { homedir as homedir53 } from "node:os";
|
|
118383
|
-
import { join as
|
|
118597
|
+
import { join as join164 } from "node:path";
|
|
118384
118598
|
async function validateSetup(cwd2) {
|
|
118385
118599
|
const workDir = cwd2 ?? process.cwd();
|
|
118386
118600
|
const ghVersion = spawnSync8("gh", ["--version"], { encoding: "utf-8", timeout: 1e4 });
|
|
@@ -118411,7 +118625,7 @@ Run this command from a directory with a GitHub remote.`);
|
|
|
118411
118625
|
} catch {
|
|
118412
118626
|
throw new Error(`Failed to parse repository info: ${ghRepo.stdout}`);
|
|
118413
118627
|
}
|
|
118414
|
-
const skillsPath =
|
|
118628
|
+
const skillsPath = join164(homedir53(), ".claude", "skills");
|
|
118415
118629
|
const skillsAvailable = existsSync80(skillsPath);
|
|
118416
118630
|
if (!skillsAvailable) {
|
|
118417
118631
|
logger.warning(`ClaudeKit Engineer skills not found at ${skillsPath}`);
|
|
@@ -118430,7 +118644,7 @@ init_path_resolver();
|
|
|
118430
118644
|
import { createWriteStream as createWriteStream3, statSync as statSync14 } from "node:fs";
|
|
118431
118645
|
import { existsSync as existsSync81 } from "node:fs";
|
|
118432
118646
|
import { mkdir as mkdir42, rename as rename15 } from "node:fs/promises";
|
|
118433
|
-
import { join as
|
|
118647
|
+
import { join as join165 } from "node:path";
|
|
118434
118648
|
|
|
118435
118649
|
class WatchLogger {
|
|
118436
118650
|
logStream = null;
|
|
@@ -118438,7 +118652,7 @@ class WatchLogger {
|
|
|
118438
118652
|
logPath = null;
|
|
118439
118653
|
maxBytes;
|
|
118440
118654
|
constructor(logDir, maxBytes = 0) {
|
|
118441
|
-
this.logDir = logDir ??
|
|
118655
|
+
this.logDir = logDir ?? join165(PathResolver.getClaudeKitDir(), "logs");
|
|
118442
118656
|
this.maxBytes = maxBytes;
|
|
118443
118657
|
}
|
|
118444
118658
|
async init() {
|
|
@@ -118447,7 +118661,7 @@ class WatchLogger {
|
|
|
118447
118661
|
await mkdir42(this.logDir, { recursive: true });
|
|
118448
118662
|
}
|
|
118449
118663
|
const dateStr = formatDate(new Date);
|
|
118450
|
-
this.logPath =
|
|
118664
|
+
this.logPath = join165(this.logDir, `watch-${dateStr}.log`);
|
|
118451
118665
|
this.logStream = createWriteStream3(this.logPath, { flags: "a", mode: 384 });
|
|
118452
118666
|
} catch (error) {
|
|
118453
118667
|
logger.warning(`Cannot create watch log file: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -118629,7 +118843,7 @@ async function watchCommand(options2) {
|
|
|
118629
118843
|
}
|
|
118630
118844
|
async function discoverRepos(options2, watchLog) {
|
|
118631
118845
|
const cwd2 = process.cwd();
|
|
118632
|
-
const isGitRepo = existsSync82(
|
|
118846
|
+
const isGitRepo = existsSync82(join166(cwd2, ".git"));
|
|
118633
118847
|
if (options2.force) {
|
|
118634
118848
|
await forceRemoveLock(watchLog);
|
|
118635
118849
|
}
|
|
@@ -118886,8 +119100,8 @@ function registerCommands(cli) {
|
|
|
118886
119100
|
// src/cli/version-display.ts
|
|
118887
119101
|
init_package();
|
|
118888
119102
|
init_config_version_checker();
|
|
118889
|
-
import { existsSync as existsSync94, readFileSync as
|
|
118890
|
-
import { join as
|
|
119103
|
+
import { existsSync as existsSync94, readFileSync as readFileSync27 } from "node:fs";
|
|
119104
|
+
import { join as join178 } from "node:path";
|
|
118891
119105
|
|
|
118892
119106
|
// src/domains/versioning/version-checker.ts
|
|
118893
119107
|
init_version_utils();
|
|
@@ -118902,14 +119116,14 @@ init_logger();
|
|
|
118902
119116
|
init_path_resolver();
|
|
118903
119117
|
import { existsSync as existsSync93 } from "node:fs";
|
|
118904
119118
|
import { mkdir as mkdir43, readFile as readFile73, writeFile as writeFile45 } from "node:fs/promises";
|
|
118905
|
-
import { join as
|
|
119119
|
+
import { join as join177 } from "node:path";
|
|
118906
119120
|
|
|
118907
119121
|
class VersionCacheManager {
|
|
118908
119122
|
static CACHE_FILENAME = "version-check.json";
|
|
118909
119123
|
static CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
118910
119124
|
static getCacheFile() {
|
|
118911
119125
|
const cacheDir = PathResolver.getCacheDir(false);
|
|
118912
|
-
return
|
|
119126
|
+
return join177(cacheDir, VersionCacheManager.CACHE_FILENAME);
|
|
118913
119127
|
}
|
|
118914
119128
|
static async load() {
|
|
118915
119129
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
@@ -119220,13 +119434,13 @@ async function displayVersion() {
|
|
|
119220
119434
|
let localInstalledKits = [];
|
|
119221
119435
|
let globalInstalledKits = [];
|
|
119222
119436
|
const globalKitDir = PathResolver.getGlobalKitDir();
|
|
119223
|
-
const globalMetadataPath =
|
|
119437
|
+
const globalMetadataPath = join178(globalKitDir, "metadata.json");
|
|
119224
119438
|
const prefix = PathResolver.getPathPrefix(false);
|
|
119225
|
-
const localMetadataPath = prefix ?
|
|
119439
|
+
const localMetadataPath = prefix ? join178(process.cwd(), prefix, "metadata.json") : join178(process.cwd(), "metadata.json");
|
|
119226
119440
|
const isLocalSameAsGlobal = localMetadataPath === globalMetadataPath;
|
|
119227
119441
|
if (!isLocalSameAsGlobal && existsSync94(localMetadataPath)) {
|
|
119228
119442
|
try {
|
|
119229
|
-
const rawMetadata = JSON.parse(
|
|
119443
|
+
const rawMetadata = JSON.parse(readFileSync27(localMetadataPath, "utf-8"));
|
|
119230
119444
|
const metadata = MetadataSchema.parse(rawMetadata);
|
|
119231
119445
|
const kitsDisplay = formatInstalledKits(metadata);
|
|
119232
119446
|
if (kitsDisplay) {
|
|
@@ -119240,7 +119454,7 @@ async function displayVersion() {
|
|
|
119240
119454
|
}
|
|
119241
119455
|
if (existsSync94(globalMetadataPath)) {
|
|
119242
119456
|
try {
|
|
119243
|
-
const rawMetadata = JSON.parse(
|
|
119457
|
+
const rawMetadata = JSON.parse(readFileSync27(globalMetadataPath, "utf-8"));
|
|
119244
119458
|
const metadata = MetadataSchema.parse(rawMetadata);
|
|
119245
119459
|
const kitsDisplay = formatInstalledKits(metadata);
|
|
119246
119460
|
if (kitsDisplay) {
|