claudekit-cli 4.5.0-dev.1 → 4.5.0-dev.2
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 +205 -138
- package/package.json +1 -1
package/cli-manifest.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -64236,7 +64236,7 @@ var package_default;
|
|
|
64236
64236
|
var init_package = __esm(() => {
|
|
64237
64237
|
package_default = {
|
|
64238
64238
|
name: "claudekit-cli",
|
|
64239
|
-
version: "4.5.0-dev.
|
|
64239
|
+
version: "4.5.0-dev.2",
|
|
64240
64240
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
64241
64241
|
type: "module",
|
|
64242
64242
|
repository: {
|
|
@@ -64898,7 +64898,7 @@ import { spawnSync as spawnSync3 } from "node:child_process";
|
|
|
64898
64898
|
import { existsSync as existsSync45, readFileSync as readFileSync13, readdirSync as readdirSync8, statSync as statSync9, writeFileSync as writeFileSync5 } from "node:fs";
|
|
64899
64899
|
import { readdir as readdir17 } from "node:fs/promises";
|
|
64900
64900
|
import { homedir as homedir40, tmpdir } from "node:os";
|
|
64901
|
-
import { join as join64, resolve as resolve33 } from "node:path";
|
|
64901
|
+
import { dirname as dirname29, join as join64, resolve as resolve33 } from "node:path";
|
|
64902
64902
|
function resolveDoctorCkExecutable(platformName = process.platform) {
|
|
64903
64903
|
return platformName === "win32" ? "ck.cmd" : "ck";
|
|
64904
64904
|
}
|
|
@@ -64930,8 +64930,22 @@ function getCanonicalGlobalCommandRoot() {
|
|
|
64930
64930
|
const defaultGlobalDir = join64(homedir40(), ".claude").replace(/\\/g, "/");
|
|
64931
64931
|
return configuredGlobalDir === defaultGlobalDir ? "$HOME" : configuredGlobalDir;
|
|
64932
64932
|
}
|
|
64933
|
+
function readManagedHookNamesForClaudeDir(claudeDir3) {
|
|
64934
|
+
const manifestPath = join64(claudeDir3, "hooks", "managed-hooks.json");
|
|
64935
|
+
if (!existsSync45(manifestPath))
|
|
64936
|
+
return new Set;
|
|
64937
|
+
try {
|
|
64938
|
+
const data = JSON.parse(readFileSync13(manifestPath, "utf-8"));
|
|
64939
|
+
if (!Array.isArray(data.managedHooks))
|
|
64940
|
+
return new Set;
|
|
64941
|
+
return new Set(data.managedHooks.filter((name) => typeof name === "string"));
|
|
64942
|
+
} catch {
|
|
64943
|
+
return new Set;
|
|
64944
|
+
}
|
|
64945
|
+
}
|
|
64933
64946
|
function getClaudeSettingsFiles(projectDir) {
|
|
64934
64947
|
const globalClaudeDir = PathResolver.getGlobalKitDir();
|
|
64948
|
+
const globalManagedHookNames = readManagedHookNamesForClaudeDir(globalClaudeDir);
|
|
64935
64949
|
const ccsSettingsDir = join64(process.env.CK_TEST_HOME ?? homedir40(), ".ccs");
|
|
64936
64950
|
const candidates = [
|
|
64937
64951
|
{
|
|
@@ -64947,12 +64961,14 @@ function getClaudeSettingsFiles(projectDir) {
|
|
|
64947
64961
|
{
|
|
64948
64962
|
path: resolve33(globalClaudeDir, "settings.json"),
|
|
64949
64963
|
label: "global settings.json",
|
|
64950
|
-
root: getCanonicalGlobalCommandRoot()
|
|
64964
|
+
root: getCanonicalGlobalCommandRoot(),
|
|
64965
|
+
managedHookNames: globalManagedHookNames
|
|
64951
64966
|
},
|
|
64952
64967
|
{
|
|
64953
64968
|
path: resolve33(globalClaudeDir, "settings.local.json"),
|
|
64954
64969
|
label: "global settings.local.json",
|
|
64955
|
-
root: getCanonicalGlobalCommandRoot()
|
|
64970
|
+
root: getCanonicalGlobalCommandRoot(),
|
|
64971
|
+
managedHookNames: globalManagedHookNames
|
|
64956
64972
|
}
|
|
64957
64973
|
];
|
|
64958
64974
|
try {
|
|
@@ -64968,30 +64984,84 @@ function getClaudeSettingsFiles(projectDir) {
|
|
|
64968
64984
|
} catch {}
|
|
64969
64985
|
return candidates.filter((candidate) => existsSync45(candidate.path));
|
|
64970
64986
|
}
|
|
64987
|
+
function isProjectScopedCanonicalHookCommand(cmd) {
|
|
64988
|
+
return /^node\s+"\$CLAUDE_PROJECT_DIR"\/\.claude\/\S+/.test(cmd) || /^bash\s+"\$CLAUDE_PROJECT_DIR"\/\.claude\/hooks\/node-hook-runner\.sh\s+"\$CLAUDE_PROJECT_DIR"\/\.claude\/\S+/.test(cmd);
|
|
64989
|
+
}
|
|
64990
|
+
function isProjectScopedStatusLineCommand(cmd) {
|
|
64991
|
+
return /^node\s+"\$CLAUDE_PROJECT_DIR"\/\.claude\/statusline\.cjs(?:\s|$)/.test(cmd) || /^bash\s+"\$CLAUDE_PROJECT_DIR"\/\.claude\/hooks\/node-hook-runner\.sh\s+"\$CLAUDE_PROJECT_DIR"\/\.claude\/statusline\.cjs(?:\s|$)/.test(cmd);
|
|
64992
|
+
}
|
|
64993
|
+
function extractHookNames(command) {
|
|
64994
|
+
const normalized = command.replace(/\\/g, "/");
|
|
64995
|
+
const names = [];
|
|
64996
|
+
const pattern = /\/hooks\/([^/"'\s]+)\.(?:cjs|mjs|js)(?:["'\s]|$)/g;
|
|
64997
|
+
for (const match of normalized.matchAll(pattern)) {
|
|
64998
|
+
if (match[1])
|
|
64999
|
+
names.push(match[1]);
|
|
65000
|
+
}
|
|
65001
|
+
return names;
|
|
65002
|
+
}
|
|
65003
|
+
function getManagedHookNames(settingsFile) {
|
|
65004
|
+
return settingsFile.managedHookNames ?? readManagedHookNamesForClaudeDir(dirname29(settingsFile.path));
|
|
65005
|
+
}
|
|
65006
|
+
function isManagedHookCommand(command, settingsFile) {
|
|
65007
|
+
const managedHookNames = getManagedHookNames(settingsFile);
|
|
65008
|
+
if (managedHookNames.size === 0)
|
|
65009
|
+
return false;
|
|
65010
|
+
return extractHookNames(command).some((name) => managedHookNames.has(name));
|
|
65011
|
+
}
|
|
65012
|
+
function shouldRepairManagedGlobalProjectRoot(command, settingsFile, eventName) {
|
|
65013
|
+
if (settingsFile.root === "$CLAUDE_PROJECT_DIR")
|
|
65014
|
+
return false;
|
|
65015
|
+
if (eventName === "statusLine" && isProjectScopedStatusLineCommand(command))
|
|
65016
|
+
return true;
|
|
65017
|
+
if (!isProjectScopedCanonicalHookCommand(command))
|
|
65018
|
+
return false;
|
|
65019
|
+
return isManagedHookCommand(command, settingsFile);
|
|
65020
|
+
}
|
|
64971
65021
|
function isAlreadyCanonical(cmd) {
|
|
64972
65022
|
return /^node\s+"\$HOME\/\.claude\/[^"]+"/.test(cmd) || /^node\s+"\$CLAUDE_PROJECT_DIR"\/\.claude\/\S+/.test(cmd) || /^bash\s+"\$HOME\/\.claude\/hooks\/node-hook-runner\.sh"\s+"\$HOME\/\.claude\/[^"]+"/.test(cmd) || /^bash\s+"\$CLAUDE_PROJECT_DIR"\/\.claude\/hooks\/node-hook-runner\.sh\s+"\$CLAUDE_PROJECT_DIR"\/\.claude\/\S+/.test(cmd);
|
|
64973
65023
|
}
|
|
65024
|
+
function isAlreadyCanonicalForSettingsFile(cmd, settingsFile) {
|
|
65025
|
+
if (isAlreadyCanonical(cmd))
|
|
65026
|
+
return true;
|
|
65027
|
+
const root = settingsFile.root.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
65028
|
+
if (root === "$HOME" || root === "$CLAUDE_PROJECT_DIR")
|
|
65029
|
+
return false;
|
|
65030
|
+
const command = cmd.replace(/\\/g, "/");
|
|
65031
|
+
const escapedRoot = escapeRegex2(root);
|
|
65032
|
+
return new RegExp(`^node\\s+"${escapedRoot}/[^"]+"`).test(command) || new RegExp(`^bash\\s+"${escapedRoot}/hooks/node-hook-runner\\.sh"\\s+"${escapedRoot}/[^"]+"`).test(command);
|
|
65033
|
+
}
|
|
64974
65034
|
function collectHookCommandFindings(settings, settingsFile) {
|
|
65035
|
+
const findings = [];
|
|
65036
|
+
const collectCommand = (eventName, command, matcher) => {
|
|
65037
|
+
if (isAlreadyCanonicalForSettingsFile(command, settingsFile) && !shouldRepairManagedGlobalProjectRoot(command, settingsFile, eventName)) {
|
|
65038
|
+
return;
|
|
65039
|
+
}
|
|
65040
|
+
const repair = repairClaudeHookCommandPath(command, settingsFile.root);
|
|
65041
|
+
if (!repair.changed || !repair.issue) {
|
|
65042
|
+
return;
|
|
65043
|
+
}
|
|
65044
|
+
findings.push({
|
|
65045
|
+
path: settingsFile.path,
|
|
65046
|
+
label: settingsFile.label,
|
|
65047
|
+
eventName,
|
|
65048
|
+
matcher,
|
|
65049
|
+
command,
|
|
65050
|
+
expected: repair.command,
|
|
65051
|
+
issue: repair.issue
|
|
65052
|
+
});
|
|
65053
|
+
};
|
|
65054
|
+
const statusLine = settings.statusLine;
|
|
65055
|
+
if (typeof statusLine?.command === "string") {
|
|
65056
|
+
collectCommand("statusLine", statusLine.command);
|
|
65057
|
+
}
|
|
64975
65058
|
if (!settings.hooks) {
|
|
64976
|
-
return
|
|
65059
|
+
return findings;
|
|
64977
65060
|
}
|
|
64978
|
-
const findings = [];
|
|
64979
65061
|
for (const [eventName, entries] of Object.entries(settings.hooks)) {
|
|
64980
65062
|
for (const entry of entries) {
|
|
64981
65063
|
if ("command" in entry && typeof entry.command === "string") {
|
|
64982
|
-
|
|
64983
|
-
continue;
|
|
64984
|
-
const repair = repairClaudeHookCommandPath(entry.command, settingsFile.root);
|
|
64985
|
-
if (repair.changed && repair.issue) {
|
|
64986
|
-
findings.push({
|
|
64987
|
-
path: settingsFile.path,
|
|
64988
|
-
label: settingsFile.label,
|
|
64989
|
-
eventName,
|
|
64990
|
-
command: entry.command,
|
|
64991
|
-
expected: repair.command,
|
|
64992
|
-
issue: repair.issue
|
|
64993
|
-
});
|
|
64994
|
-
}
|
|
65064
|
+
collectCommand(eventName, entry.command);
|
|
64995
65065
|
}
|
|
64996
65066
|
if (!("hooks" in entry) || !entry.hooks) {
|
|
64997
65067
|
continue;
|
|
@@ -65000,21 +65070,7 @@ function collectHookCommandFindings(settings, settingsFile) {
|
|
|
65000
65070
|
if (!hook.command) {
|
|
65001
65071
|
continue;
|
|
65002
65072
|
}
|
|
65003
|
-
|
|
65004
|
-
continue;
|
|
65005
|
-
const repair = repairClaudeHookCommandPath(hook.command, settingsFile.root);
|
|
65006
|
-
if (!repair.changed || !repair.issue) {
|
|
65007
|
-
continue;
|
|
65008
|
-
}
|
|
65009
|
-
findings.push({
|
|
65010
|
-
path: settingsFile.path,
|
|
65011
|
-
label: settingsFile.label,
|
|
65012
|
-
eventName,
|
|
65013
|
-
matcher: "matcher" in entry ? entry.matcher : undefined,
|
|
65014
|
-
command: hook.command,
|
|
65015
|
-
expected: repair.command,
|
|
65016
|
-
issue: repair.issue
|
|
65017
|
-
});
|
|
65073
|
+
collectCommand(eventName, hook.command, "matcher" in entry ? entry.matcher : undefined);
|
|
65018
65074
|
}
|
|
65019
65075
|
}
|
|
65020
65076
|
}
|
|
@@ -65022,7 +65078,7 @@ function collectHookCommandFindings(settings, settingsFile) {
|
|
|
65022
65078
|
}
|
|
65023
65079
|
async function repairHookCommandsInSettingsFile(settingsFile) {
|
|
65024
65080
|
const settings = await SettingsMerger.readSettingsFile(settingsFile.path);
|
|
65025
|
-
if (!settings
|
|
65081
|
+
if (!settings) {
|
|
65026
65082
|
return 0;
|
|
65027
65083
|
}
|
|
65028
65084
|
const findings = collectHookCommandFindings(settings, settingsFile);
|
|
@@ -65031,26 +65087,36 @@ async function repairHookCommandsInSettingsFile(settingsFile) {
|
|
|
65031
65087
|
}
|
|
65032
65088
|
const repairMap = new Map(findings.map((f3) => [f3.command, f3.expected]));
|
|
65033
65089
|
let repaired = 0;
|
|
65034
|
-
|
|
65035
|
-
|
|
65036
|
-
|
|
65037
|
-
|
|
65038
|
-
|
|
65039
|
-
|
|
65040
|
-
|
|
65090
|
+
const statusLine = settings.statusLine;
|
|
65091
|
+
if (typeof statusLine?.command === "string") {
|
|
65092
|
+
const fixed = repairMap.get(statusLine.command);
|
|
65093
|
+
if (fixed !== undefined) {
|
|
65094
|
+
statusLine.command = fixed;
|
|
65095
|
+
repaired++;
|
|
65096
|
+
}
|
|
65097
|
+
}
|
|
65098
|
+
if (settings.hooks) {
|
|
65099
|
+
for (const entries of Object.values(settings.hooks)) {
|
|
65100
|
+
for (const entry of entries) {
|
|
65101
|
+
if ("command" in entry && typeof entry.command === "string") {
|
|
65102
|
+
const fixed = repairMap.get(entry.command);
|
|
65103
|
+
if (fixed !== undefined) {
|
|
65104
|
+
entry.command = fixed;
|
|
65105
|
+
repaired++;
|
|
65106
|
+
}
|
|
65041
65107
|
}
|
|
65042
|
-
|
|
65043
|
-
if (!("hooks" in entry) || !entry.hooks) {
|
|
65044
|
-
continue;
|
|
65045
|
-
}
|
|
65046
|
-
for (const hook of entry.hooks) {
|
|
65047
|
-
if (!hook.command) {
|
|
65108
|
+
if (!("hooks" in entry) || !entry.hooks) {
|
|
65048
65109
|
continue;
|
|
65049
65110
|
}
|
|
65050
|
-
const
|
|
65051
|
-
|
|
65052
|
-
|
|
65053
|
-
|
|
65111
|
+
for (const hook of entry.hooks) {
|
|
65112
|
+
if (!hook.command) {
|
|
65113
|
+
continue;
|
|
65114
|
+
}
|
|
65115
|
+
const fixed = repairMap.get(hook.command);
|
|
65116
|
+
if (fixed !== undefined) {
|
|
65117
|
+
hook.command = fixed;
|
|
65118
|
+
repaired++;
|
|
65119
|
+
}
|
|
65054
65120
|
}
|
|
65055
65121
|
}
|
|
65056
65122
|
}
|
|
@@ -68106,7 +68172,7 @@ import { exec as exec2, spawn as spawn2 } from "node:child_process";
|
|
|
68106
68172
|
import { existsSync as existsSync47 } from "node:fs";
|
|
68107
68173
|
import { readdir as readdir19 } from "node:fs/promises";
|
|
68108
68174
|
import { builtinModules } from "node:module";
|
|
68109
|
-
import { dirname as
|
|
68175
|
+
import { dirname as dirname30, join as join68 } from "node:path";
|
|
68110
68176
|
import { promisify as promisify9 } from "node:util";
|
|
68111
68177
|
function selectKitForUpdate(params) {
|
|
68112
68178
|
const { hasLocal, hasGlobal, localKits, globalKits } = params;
|
|
@@ -68160,30 +68226,32 @@ function extractCkHookName(command) {
|
|
|
68160
68226
|
const match = normalized.match(/\/hooks\/([^/"'\s]+)\.(?:cjs|mjs|js)(?:["'\s]|$)/);
|
|
68161
68227
|
return match?.[1] ?? null;
|
|
68162
68228
|
}
|
|
68163
|
-
function
|
|
68164
|
-
|
|
68229
|
+
function commandUsesProjectDirRoot(command) {
|
|
68230
|
+
return /\$\{?CLAUDE_PROJECT_DIR\}?|%CLAUDE_PROJECT_DIR%/.test(command);
|
|
68231
|
+
}
|
|
68232
|
+
function collectSettingsHookRegistrations(settings, options2 = {}) {
|
|
68233
|
+
const registrations = new Map;
|
|
68234
|
+
const addCommand = (command) => {
|
|
68235
|
+
const hookName = extractCkHookName(command);
|
|
68236
|
+
if (!hookName)
|
|
68237
|
+
return;
|
|
68238
|
+
const previous = registrations.get(hookName);
|
|
68239
|
+
const hasCorrectScope = previous?.hasCorrectScope || !(options2.isGlobal === true && commandUsesProjectDirRoot(command));
|
|
68240
|
+
registrations.set(hookName, { hasCorrectScope });
|
|
68241
|
+
};
|
|
68165
68242
|
for (const entries of Object.values(settings.hooks ?? {})) {
|
|
68166
68243
|
for (const entry of entries) {
|
|
68167
68244
|
if (typeof entry.command === "string") {
|
|
68168
|
-
|
|
68245
|
+
addCommand(entry.command);
|
|
68169
68246
|
}
|
|
68170
68247
|
for (const hook of entry.hooks ?? []) {
|
|
68171
68248
|
if (typeof hook.command === "string") {
|
|
68172
|
-
|
|
68249
|
+
addCommand(hook.command);
|
|
68173
68250
|
}
|
|
68174
68251
|
}
|
|
68175
68252
|
}
|
|
68176
68253
|
}
|
|
68177
|
-
return
|
|
68178
|
-
}
|
|
68179
|
-
function collectSettingsHookNames(settings) {
|
|
68180
|
-
const names = new Set;
|
|
68181
|
-
for (const command of collectSettingsHookCommands(settings)) {
|
|
68182
|
-
const hookName = extractCkHookName(command);
|
|
68183
|
-
if (hookName)
|
|
68184
|
-
names.add(hookName);
|
|
68185
|
-
}
|
|
68186
|
-
return names;
|
|
68254
|
+
return registrations;
|
|
68187
68255
|
}
|
|
68188
68256
|
async function readManagedHookNames(claudeDir3) {
|
|
68189
68257
|
const manifestPath = join68(claudeDir3, "hooks", MANAGED_HOOKS_MANIFEST);
|
|
@@ -68211,7 +68279,7 @@ async function readDisabledHookNames(claudeDir3) {
|
|
|
68211
68279
|
return new Set;
|
|
68212
68280
|
}
|
|
68213
68281
|
}
|
|
68214
|
-
async function countMissingCkHookRegistrations(claudeDir3, kit) {
|
|
68282
|
+
async function countMissingCkHookRegistrations(claudeDir3, kit, options2 = {}) {
|
|
68215
68283
|
const settingsPath = join68(claudeDir3, "settings.json");
|
|
68216
68284
|
if (!existsSync47(settingsPath))
|
|
68217
68285
|
return 0;
|
|
@@ -68219,7 +68287,7 @@ async function countMissingCkHookRegistrations(claudeDir3, kit) {
|
|
|
68219
68287
|
if (managedHooks.length === 0)
|
|
68220
68288
|
return 0;
|
|
68221
68289
|
const settings = parseJsonContent(await import_fs_extra8.readFile(settingsPath, "utf-8"));
|
|
68222
|
-
const
|
|
68290
|
+
const liveHookRegistrations = collectSettingsHookRegistrations(settings, options2);
|
|
68223
68291
|
const disabledHooks = await readDisabledHookNames(claudeDir3);
|
|
68224
68292
|
const hooksDir = join68(claudeDir3, "hooks");
|
|
68225
68293
|
let missing = 0;
|
|
@@ -68228,7 +68296,7 @@ async function countMissingCkHookRegistrations(claudeDir3, kit) {
|
|
|
68228
68296
|
continue;
|
|
68229
68297
|
if (!existsSync47(join68(hooksDir, `${name}.cjs`)))
|
|
68230
68298
|
continue;
|
|
68231
|
-
if (!
|
|
68299
|
+
if (!liveHookRegistrations.get(name)?.hasCorrectScope)
|
|
68232
68300
|
missing++;
|
|
68233
68301
|
}
|
|
68234
68302
|
return missing;
|
|
@@ -68337,7 +68405,7 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
68337
68405
|
}
|
|
68338
68406
|
try {
|
|
68339
68407
|
const countMissingHookRefsFn = deps?.countMissingHookFileReferencesFn ?? countMissingHookFileReferences;
|
|
68340
|
-
const missingHookRefs = await countMissingHookRefsFn(
|
|
68408
|
+
const missingHookRefs = await countMissingHookRefsFn(dirname30(setup.project.path));
|
|
68341
68409
|
if (missingHookRefs > 0) {
|
|
68342
68410
|
logger.warning(`Detected ${missingHookRefs} local broken hook registration(s); reinstalling local kit content`);
|
|
68343
68411
|
forceKitReinstall = true;
|
|
@@ -68366,7 +68434,7 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
68366
68434
|
logger.verbose(`Selected hook dependency self-heal check skipped: ${error instanceof Error ? error.message : "unknown"}`);
|
|
68367
68435
|
}
|
|
68368
68436
|
try {
|
|
68369
|
-
const missingHookRegistrations = await countMissingCkHookRegistrations(selectedClaudeDir, selection.kit);
|
|
68437
|
+
const missingHookRegistrations = await countMissingCkHookRegistrations(selectedClaudeDir, selection.kit, { isGlobal: selection.isGlobal });
|
|
68370
68438
|
if (missingHookRegistrations > 0) {
|
|
68371
68439
|
logger.warning(`Detected ${missingHookRegistrations} ${selection.isGlobal ? "global" : "local"} missing hook registration(s); reinstalling kit content`);
|
|
68372
68440
|
forceKitReinstall = true;
|
|
@@ -68407,7 +68475,7 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
68407
68475
|
if (alreadyAtLatest) {
|
|
68408
68476
|
try {
|
|
68409
68477
|
const countMissingHookRefsFn = deps?.countMissingHookFileReferencesFn ?? countMissingHookFileReferences;
|
|
68410
|
-
const projectDir = setup.project.path ?
|
|
68478
|
+
const projectDir = setup.project.path ? dirname30(setup.project.path) : process.cwd();
|
|
68411
68479
|
const missingHookRefs = await countMissingHookRefsFn(projectDir);
|
|
68412
68480
|
if (missingHookRefs > 0) {
|
|
68413
68481
|
logger.warning(`Detected ${missingHookRefs} broken hook registration(s); reinstalling kit content`);
|
|
@@ -68648,7 +68716,6 @@ var init_post_update_handler = __esm(() => {
|
|
|
68648
68716
|
init_metadata_migration();
|
|
68649
68717
|
init_version_utils();
|
|
68650
68718
|
init_claudekit_scanner();
|
|
68651
|
-
init_command_normalizer();
|
|
68652
68719
|
init_logger();
|
|
68653
68720
|
init_safe_prompts();
|
|
68654
68721
|
init_types3();
|
|
@@ -69501,7 +69568,7 @@ var init_routes = __esm(() => {
|
|
|
69501
69568
|
|
|
69502
69569
|
// src/domains/web-server/static-server.ts
|
|
69503
69570
|
import { existsSync as existsSync49 } from "node:fs";
|
|
69504
|
-
import { basename as basename24, dirname as
|
|
69571
|
+
import { basename as basename24, dirname as dirname31, join as join71, resolve as resolve35 } from "node:path";
|
|
69505
69572
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
69506
69573
|
function addRuntimeUiCandidate(candidates, runtimePath) {
|
|
69507
69574
|
if (!runtimePath) {
|
|
@@ -69511,7 +69578,7 @@ function addRuntimeUiCandidate(candidates, runtimePath) {
|
|
|
69511
69578
|
if (!looksLikePath) {
|
|
69512
69579
|
return;
|
|
69513
69580
|
}
|
|
69514
|
-
const entryDir =
|
|
69581
|
+
const entryDir = dirname31(resolve35(runtimePath));
|
|
69515
69582
|
if (basename24(entryDir) === "dist") {
|
|
69516
69583
|
candidates.add(join71(entryDir, "ui"));
|
|
69517
69584
|
}
|
|
@@ -69572,7 +69639,7 @@ var import_express, __dirname3;
|
|
|
69572
69639
|
var init_static_server = __esm(() => {
|
|
69573
69640
|
init_logger();
|
|
69574
69641
|
import_express = __toESM(require_express2(), 1);
|
|
69575
|
-
__dirname3 =
|
|
69642
|
+
__dirname3 = dirname31(fileURLToPath2(import.meta.url));
|
|
69576
69643
|
});
|
|
69577
69644
|
|
|
69578
69645
|
// node_modules/ws/lib/constants.js
|
|
@@ -75082,7 +75149,7 @@ var init_skills_installer2 = __esm(() => {
|
|
|
75082
75149
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
75083
75150
|
import { existsSync as existsSync62 } from "node:fs";
|
|
75084
75151
|
import { mkdir as mkdir23, readFile as readFile49, writeFile as writeFile25 } from "node:fs/promises";
|
|
75085
|
-
import { dirname as
|
|
75152
|
+
import { dirname as dirname34, join as join92 } from "node:path";
|
|
75086
75153
|
async function readJsonFile(filePath) {
|
|
75087
75154
|
try {
|
|
75088
75155
|
const content = await readFile49(filePath, "utf-8");
|
|
@@ -75122,7 +75189,7 @@ ${geminiPattern}
|
|
|
75122
75189
|
}
|
|
75123
75190
|
}
|
|
75124
75191
|
async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
75125
|
-
const linkDir =
|
|
75192
|
+
const linkDir = dirname34(geminiSettingsPath);
|
|
75126
75193
|
if (!existsSync62(linkDir)) {
|
|
75127
75194
|
await mkdir23(linkDir, { recursive: true });
|
|
75128
75195
|
logger.debug(`Created directory: ${linkDir}`);
|
|
@@ -75241,9 +75308,9 @@ var init_validation = __esm(() => {
|
|
|
75241
75308
|
// src/services/package-installer/gemini-mcp/linker-core.ts
|
|
75242
75309
|
import { existsSync as existsSync64 } from "node:fs";
|
|
75243
75310
|
import { mkdir as mkdir24, symlink as symlink3 } from "node:fs/promises";
|
|
75244
|
-
import { dirname as
|
|
75311
|
+
import { dirname as dirname35, join as join94 } from "node:path";
|
|
75245
75312
|
async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
75246
|
-
const linkDir =
|
|
75313
|
+
const linkDir = dirname35(linkPath);
|
|
75247
75314
|
if (!existsSync64(linkDir)) {
|
|
75248
75315
|
await mkdir24(linkDir, { recursive: true });
|
|
75249
75316
|
logger.debug(`Created directory: ${linkDir}`);
|
|
@@ -78635,7 +78702,7 @@ var init_sqlite_client = __esm(() => {
|
|
|
78635
78702
|
|
|
78636
78703
|
// src/commands/content/phases/db-manager.ts
|
|
78637
78704
|
import { existsSync as existsSync83, mkdirSync as mkdirSync8 } from "node:fs";
|
|
78638
|
-
import { dirname as
|
|
78705
|
+
import { dirname as dirname54 } from "node:path";
|
|
78639
78706
|
function initDatabase(dbPath) {
|
|
78640
78707
|
ensureParentDir(dbPath);
|
|
78641
78708
|
const db = openDatabase(dbPath);
|
|
@@ -78656,7 +78723,7 @@ function runRetentionCleanup(db, retentionDays = 90) {
|
|
|
78656
78723
|
db.prepare("DELETE FROM git_events WHERE processed = 1 AND created_at < ?").run(cutoff);
|
|
78657
78724
|
}
|
|
78658
78725
|
function ensureParentDir(dbPath) {
|
|
78659
|
-
const dir =
|
|
78726
|
+
const dir = dirname54(dbPath);
|
|
78660
78727
|
if (dir && !existsSync83(dir)) {
|
|
78661
78728
|
mkdirSync8(dir, { recursive: true });
|
|
78662
78729
|
}
|
|
@@ -89169,7 +89236,7 @@ init_path_resolver();
|
|
|
89169
89236
|
import { existsSync as existsSync58 } from "node:fs";
|
|
89170
89237
|
import { readFile as readFile44 } from "node:fs/promises";
|
|
89171
89238
|
import { homedir as homedir43 } from "node:os";
|
|
89172
|
-
import { dirname as
|
|
89239
|
+
import { dirname as dirname32, join as join80, normalize as normalize6, resolve as resolve37 } from "node:path";
|
|
89173
89240
|
async function checkPathRefsValid(projectDir) {
|
|
89174
89241
|
const globalClaudeMd = join80(PathResolver.getGlobalKitDir(), "CLAUDE.md");
|
|
89175
89242
|
const projectClaudeMd = join80(projectDir, ".claude", "CLAUDE.md");
|
|
@@ -89200,7 +89267,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
89200
89267
|
autoFixable: false
|
|
89201
89268
|
};
|
|
89202
89269
|
}
|
|
89203
|
-
const baseDir =
|
|
89270
|
+
const baseDir = dirname32(claudeMdPath);
|
|
89204
89271
|
const home5 = homedir43();
|
|
89205
89272
|
const broken = [];
|
|
89206
89273
|
for (const ref of refs) {
|
|
@@ -91047,14 +91114,14 @@ class AutoHealer {
|
|
|
91047
91114
|
import { execSync as execSync4, spawnSync as spawnSync6 } from "node:child_process";
|
|
91048
91115
|
import { readFileSync as readFileSync17, unlinkSync as unlinkSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
91049
91116
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
91050
|
-
import { dirname as
|
|
91117
|
+
import { dirname as dirname33, join as join87 } from "node:path";
|
|
91051
91118
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
91052
91119
|
init_environment();
|
|
91053
91120
|
init_logger();
|
|
91054
91121
|
init_dist2();
|
|
91055
91122
|
function getCliVersion4() {
|
|
91056
91123
|
try {
|
|
91057
|
-
const __dirname4 =
|
|
91124
|
+
const __dirname4 = dirname33(fileURLToPath4(import.meta.url));
|
|
91058
91125
|
const pkgPath = join87(__dirname4, "../../../package.json");
|
|
91059
91126
|
const pkg = JSON.parse(readFileSync17(pkgPath, "utf-8"));
|
|
91060
91127
|
return pkg.version || "unknown";
|
|
@@ -95657,7 +95724,7 @@ import path10 from "node:path";
|
|
|
95657
95724
|
|
|
95658
95725
|
// node_modules/tar/dist/esm/list.js
|
|
95659
95726
|
import fs10 from "node:fs";
|
|
95660
|
-
import { dirname as
|
|
95727
|
+
import { dirname as dirname36, parse as parse4 } from "path";
|
|
95661
95728
|
|
|
95662
95729
|
// node_modules/tar/dist/esm/options.js
|
|
95663
95730
|
var argmap = new Map([
|
|
@@ -98557,7 +98624,7 @@ var filesFilter = (opt, files) => {
|
|
|
98557
98624
|
if (m2 !== undefined) {
|
|
98558
98625
|
ret = m2;
|
|
98559
98626
|
} else {
|
|
98560
|
-
ret = mapHas(
|
|
98627
|
+
ret = mapHas(dirname36(file), root);
|
|
98561
98628
|
}
|
|
98562
98629
|
}
|
|
98563
98630
|
map.set(file, ret);
|
|
@@ -102300,7 +102367,7 @@ import { join as join121 } from "node:path";
|
|
|
102300
102367
|
|
|
102301
102368
|
// src/domains/installation/deletion-handler.ts
|
|
102302
102369
|
import { existsSync as existsSync65, lstatSync as lstatSync3, readdirSync as readdirSync9, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
102303
|
-
import { dirname as
|
|
102370
|
+
import { dirname as dirname38, join as join106, relative as relative21, resolve as resolve42, sep as sep11 } from "node:path";
|
|
102304
102371
|
|
|
102305
102372
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
102306
102373
|
init_metadata_migration();
|
|
@@ -102526,7 +102593,7 @@ function expandGlobPatterns(patterns, claudeDir3) {
|
|
|
102526
102593
|
var MAX_CLEANUP_ITERATIONS = 50;
|
|
102527
102594
|
function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
102528
102595
|
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102529
|
-
let currentDir = resolve42(
|
|
102596
|
+
let currentDir = resolve42(dirname38(filePath));
|
|
102530
102597
|
let iterations = 0;
|
|
102531
102598
|
while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir) && iterations < MAX_CLEANUP_ITERATIONS) {
|
|
102532
102599
|
iterations++;
|
|
@@ -102535,7 +102602,7 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
|
102535
102602
|
if (entries.length === 0) {
|
|
102536
102603
|
rmdirSync(currentDir);
|
|
102537
102604
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
102538
|
-
currentDir = resolve42(
|
|
102605
|
+
currentDir = resolve42(dirname38(currentDir));
|
|
102539
102606
|
} else {
|
|
102540
102607
|
break;
|
|
102541
102608
|
}
|
|
@@ -102658,7 +102725,7 @@ init_logger();
|
|
|
102658
102725
|
init_types3();
|
|
102659
102726
|
var import_fs_extra16 = __toESM(require_lib(), 1);
|
|
102660
102727
|
var import_ignore3 = __toESM(require_ignore(), 1);
|
|
102661
|
-
import { dirname as
|
|
102728
|
+
import { dirname as dirname42, join as join111, relative as relative24 } from "node:path";
|
|
102662
102729
|
|
|
102663
102730
|
// src/domains/installation/selective-merger.ts
|
|
102664
102731
|
import { stat as stat18 } from "node:fs/promises";
|
|
@@ -102834,7 +102901,7 @@ class SelectiveMerger {
|
|
|
102834
102901
|
|
|
102835
102902
|
// src/domains/installation/merger/deleted-skill-preservation.ts
|
|
102836
102903
|
init_metadata_migration();
|
|
102837
|
-
import { dirname as
|
|
102904
|
+
import { dirname as dirname39, join as join107, relative as relative22 } from "node:path";
|
|
102838
102905
|
var import_fs_extra13 = __toESM(require_lib(), 1);
|
|
102839
102906
|
async function findIgnoredSkillDirectories({
|
|
102840
102907
|
files,
|
|
@@ -102883,8 +102950,8 @@ function findSourceSkillRoots(files, sourceDir) {
|
|
|
102883
102950
|
const metadataPath = toMetadataPath(normalizedPath);
|
|
102884
102951
|
if (!metadataPath?.endsWith("/SKILL.md"))
|
|
102885
102952
|
continue;
|
|
102886
|
-
const metadataRoot =
|
|
102887
|
-
const sourceRoot =
|
|
102953
|
+
const metadataRoot = dirname39(metadataPath).replace(/\\/g, "/");
|
|
102954
|
+
const sourceRoot = dirname39(normalizedPath).replace(/\\/g, "/");
|
|
102888
102955
|
sourceSkillRoots.set(metadataRoot, sourceRoot);
|
|
102889
102956
|
}
|
|
102890
102957
|
return sourceSkillRoots;
|
|
@@ -104404,13 +104471,13 @@ class FileScanner {
|
|
|
104404
104471
|
// src/domains/installation/merger/settings-processor.ts
|
|
104405
104472
|
import { execSync as execSync5 } from "node:child_process";
|
|
104406
104473
|
import { homedir as homedir46 } from "node:os";
|
|
104407
|
-
import { dirname as
|
|
104474
|
+
import { dirname as dirname41, join as join110 } from "node:path";
|
|
104408
104475
|
|
|
104409
104476
|
// src/domains/config/installed-settings-tracker.ts
|
|
104410
104477
|
init_shared();
|
|
104411
104478
|
import { existsSync as existsSync66 } from "node:fs";
|
|
104412
104479
|
import { mkdir as mkdir31, readFile as readFile52, writeFile as writeFile27 } from "node:fs/promises";
|
|
104413
|
-
import { dirname as
|
|
104480
|
+
import { dirname as dirname40, join as join109 } from "node:path";
|
|
104414
104481
|
var CK_JSON_FILE = ".ck.json";
|
|
104415
104482
|
|
|
104416
104483
|
class InstalledSettingsTracker {
|
|
@@ -104461,7 +104528,7 @@ class InstalledSettingsTracker {
|
|
|
104461
104528
|
data.kits[this.kitName] = {};
|
|
104462
104529
|
}
|
|
104463
104530
|
data.kits[this.kitName].installedSettings = settings;
|
|
104464
|
-
await mkdir31(
|
|
104531
|
+
await mkdir31(dirname40(ckJsonPath), { recursive: true });
|
|
104465
104532
|
await writeFile27(ckJsonPath, JSON.stringify(data, null, 2), "utf-8");
|
|
104466
104533
|
logger.debug(`Saved installed settings to ${ckJsonPath}`);
|
|
104467
104534
|
} catch (error) {
|
|
@@ -105104,7 +105171,7 @@ class SettingsProcessor {
|
|
|
105104
105171
|
return true;
|
|
105105
105172
|
}
|
|
105106
105173
|
async repairSiblingSettingsLocal(destFile) {
|
|
105107
|
-
const settingsLocalPath = join110(
|
|
105174
|
+
const settingsLocalPath = join110(dirname41(destFile), "settings.local.json");
|
|
105108
105175
|
if (settingsLocalPath === destFile || !await import_fs_extra15.pathExists(settingsLocalPath)) {
|
|
105109
105176
|
return;
|
|
105110
105177
|
}
|
|
@@ -105201,7 +105268,7 @@ class SettingsProcessor {
|
|
|
105201
105268
|
}
|
|
105202
105269
|
}
|
|
105203
105270
|
async dynamicTeamHookHandlerExists(destFile, handler) {
|
|
105204
|
-
return import_fs_extra15.pathExists(join110(
|
|
105271
|
+
return import_fs_extra15.pathExists(join110(dirname41(destFile), "hooks", handler));
|
|
105205
105272
|
}
|
|
105206
105273
|
removeDynamicTeamHookRegistrations(settings) {
|
|
105207
105274
|
let removed = 0;
|
|
@@ -105453,10 +105520,10 @@ class CopyExecutor {
|
|
|
105453
105520
|
}
|
|
105454
105521
|
trackInstalledFile(relativePath) {
|
|
105455
105522
|
this.installedFiles.add(relativePath);
|
|
105456
|
-
let dir =
|
|
105523
|
+
let dir = dirname42(relativePath);
|
|
105457
105524
|
while (dir && dir !== "." && dir !== "/") {
|
|
105458
105525
|
this.installedDirectories.add(`${dir}/`);
|
|
105459
|
-
dir =
|
|
105526
|
+
dir = dirname42(dir);
|
|
105460
105527
|
}
|
|
105461
105528
|
}
|
|
105462
105529
|
async loadIgnoredSkillDirectories(files, sourceDir, destDir) {
|
|
@@ -108660,7 +108727,7 @@ async function runPreflightChecks() {
|
|
|
108660
108727
|
// src/domains/installation/fresh-installer.ts
|
|
108661
108728
|
init_metadata_migration();
|
|
108662
108729
|
import { existsSync as existsSync67, readdirSync as readdirSync10, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
|
|
108663
|
-
import { basename as basename28, dirname as
|
|
108730
|
+
import { basename as basename28, dirname as dirname43, join as join133, resolve as resolve44 } from "node:path";
|
|
108664
108731
|
init_logger();
|
|
108665
108732
|
init_safe_spinner();
|
|
108666
108733
|
var import_fs_extra35 = __toESM(require_lib(), 1);
|
|
@@ -108713,14 +108780,14 @@ async function analyzeFreshInstallation(claudeDir3) {
|
|
|
108713
108780
|
}
|
|
108714
108781
|
function cleanupEmptyDirectories2(filePath, claudeDir3) {
|
|
108715
108782
|
const normalizedClaudeDir = resolve44(claudeDir3);
|
|
108716
|
-
let currentDir = resolve44(
|
|
108783
|
+
let currentDir = resolve44(dirname43(filePath));
|
|
108717
108784
|
while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir)) {
|
|
108718
108785
|
try {
|
|
108719
108786
|
const entries = readdirSync10(currentDir);
|
|
108720
108787
|
if (entries.length === 0) {
|
|
108721
108788
|
rmdirSync2(currentDir);
|
|
108722
108789
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
108723
|
-
currentDir = resolve44(
|
|
108790
|
+
currentDir = resolve44(dirname43(currentDir));
|
|
108724
108791
|
} else {
|
|
108725
108792
|
break;
|
|
108726
108793
|
}
|
|
@@ -108910,7 +108977,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
|
|
|
108910
108977
|
var import_fs_extra36 = __toESM(require_lib(), 1);
|
|
108911
108978
|
import { cp as cp5, mkdir as mkdir35, readdir as readdir42, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
|
|
108912
108979
|
import { homedir as homedir47 } from "node:os";
|
|
108913
|
-
import { dirname as
|
|
108980
|
+
import { dirname as dirname44, join as join134, normalize as normalize11, resolve as resolve45 } from "node:path";
|
|
108914
108981
|
var LEGACY_KIT_MARKERS = [
|
|
108915
108982
|
"metadata.json",
|
|
108916
108983
|
".ck.json",
|
|
@@ -109023,7 +109090,7 @@ async function repairLegacyWindowsGlobalKitDir(options2) {
|
|
|
109023
109090
|
if (targetExists) {
|
|
109024
109091
|
await rm16(targetDir, { recursive: true, force: true });
|
|
109025
109092
|
}
|
|
109026
|
-
await mkdir35(
|
|
109093
|
+
await mkdir35(dirname44(targetDir), { recursive: true });
|
|
109027
109094
|
await moveDirectory(legacyDir, targetDir);
|
|
109028
109095
|
return { status: "repaired", reason: "repaired", legacyDir, candidateDirs };
|
|
109029
109096
|
}
|
|
@@ -109422,7 +109489,7 @@ async function handleSelection(ctx) {
|
|
|
109422
109489
|
}
|
|
109423
109490
|
// src/commands/init/phases/sync-handler.ts
|
|
109424
109491
|
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";
|
|
109425
|
-
import { dirname as
|
|
109492
|
+
import { dirname as dirname45, join as join136, resolve as resolve47 } from "node:path";
|
|
109426
109493
|
init_logger();
|
|
109427
109494
|
init_path_resolver();
|
|
109428
109495
|
var import_fs_extra38 = __toESM(require_lib(), 1);
|
|
@@ -109541,7 +109608,7 @@ async function acquireSyncLock(global3) {
|
|
|
109541
109608
|
const lockPath = join136(cacheDir, ".sync-lock");
|
|
109542
109609
|
const startTime = Date.now();
|
|
109543
109610
|
const lockTimeout = getLockTimeout();
|
|
109544
|
-
await mkdir37(
|
|
109611
|
+
await mkdir37(dirname45(lockPath), { recursive: true });
|
|
109545
109612
|
while (Date.now() - startTime < lockTimeout) {
|
|
109546
109613
|
try {
|
|
109547
109614
|
const handle = await open5(lockPath, "wx");
|
|
@@ -110767,7 +110834,7 @@ init_dist2();
|
|
|
110767
110834
|
init_model_taxonomy();
|
|
110768
110835
|
import { mkdir as mkdir39, readFile as readFile66, writeFile as writeFile39 } from "node:fs/promises";
|
|
110769
110836
|
import { homedir as homedir51 } from "node:os";
|
|
110770
|
-
import { dirname as
|
|
110837
|
+
import { dirname as dirname46, join as join143 } from "node:path";
|
|
110771
110838
|
|
|
110772
110839
|
// src/commands/portable/models-dev-cache.ts
|
|
110773
110840
|
init_logger();
|
|
@@ -111120,7 +111187,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
111120
111187
|
}
|
|
111121
111188
|
const chosenModel2 = response2.action === "custom" ? response2.value : suggestion2.model;
|
|
111122
111189
|
const next2 = { ...existing, model: chosenModel2 };
|
|
111123
|
-
await mkdir39(
|
|
111190
|
+
await mkdir39(dirname46(configPath), { recursive: true });
|
|
111124
111191
|
await writeFile39(configPath, `${JSON.stringify(next2, null, 2)}
|
|
111125
111192
|
`, "utf-8");
|
|
111126
111193
|
return { path: configPath, action: "added", model: chosenModel2, reason: suggestion2.reason };
|
|
@@ -111131,7 +111198,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
111131
111198
|
throw new OpenCodeAuthRequiredError(suggestion.failure);
|
|
111132
111199
|
}
|
|
111133
111200
|
const next2 = { ...existing ?? {}, model: suggestion.model };
|
|
111134
|
-
await mkdir39(
|
|
111201
|
+
await mkdir39(dirname46(configPath), { recursive: true });
|
|
111135
111202
|
await writeFile39(configPath, `${JSON.stringify(next2, null, 2)}
|
|
111136
111203
|
`, "utf-8");
|
|
111137
111204
|
return {
|
|
@@ -111153,7 +111220,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
111153
111220
|
}
|
|
111154
111221
|
const chosenModel = response.action === "custom" ? response.value : suggestion.ok ? suggestion.model : "";
|
|
111155
111222
|
const next = { ...existing ?? {}, model: chosenModel };
|
|
111156
|
-
await mkdir39(
|
|
111223
|
+
await mkdir39(dirname46(configPath), { recursive: true });
|
|
111157
111224
|
await writeFile39(configPath, `${JSON.stringify(next, null, 2)}
|
|
111158
111225
|
`, "utf-8");
|
|
111159
111226
|
return {
|
|
@@ -111166,7 +111233,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
111166
111233
|
|
|
111167
111234
|
// src/commands/portable/plan-display.ts
|
|
111168
111235
|
var import_picocolors28 = __toESM(require_picocolors(), 1);
|
|
111169
|
-
import { basename as basename29, dirname as
|
|
111236
|
+
import { basename as basename29, dirname as dirname47, extname as extname8 } from "node:path";
|
|
111170
111237
|
var DEFAULT_MAX_PLAN_GROUP_ITEMS = 20;
|
|
111171
111238
|
var TYPE_ORDER = [
|
|
111172
111239
|
"agent",
|
|
@@ -111392,21 +111459,21 @@ function collectPlannedWhereLines(plan) {
|
|
|
111392
111459
|
return destinations.map((destination) => `${formatDisplayPath(destination)} -> ${formatCdHint(resolveCdTarget(destination))}`);
|
|
111393
111460
|
}
|
|
111394
111461
|
function resolveCdTarget(destination) {
|
|
111395
|
-
return extname8(destination).length > 0 ?
|
|
111462
|
+
return extname8(destination).length > 0 ? dirname47(destination) : destination;
|
|
111396
111463
|
}
|
|
111397
111464
|
function normalizeWhereDestination(path17, portableType) {
|
|
111398
111465
|
if (portableType === "agent" || portableType === "command" || portableType === "skill") {
|
|
111399
|
-
return
|
|
111466
|
+
return dirname47(path17);
|
|
111400
111467
|
}
|
|
111401
111468
|
if (portableType === "hooks") {
|
|
111402
|
-
return
|
|
111469
|
+
return dirname47(path17);
|
|
111403
111470
|
}
|
|
111404
111471
|
if (portableType === "rules") {
|
|
111405
111472
|
const fileName = basename29(path17).toLowerCase();
|
|
111406
111473
|
if (fileName === "agents.md" || fileName === "gemini.md" || fileName === ".goosehints" || fileName === "custom_modes.yaml" || fileName === "custom_modes.yml") {
|
|
111407
111474
|
return path17;
|
|
111408
111475
|
}
|
|
111409
|
-
return
|
|
111476
|
+
return dirname47(path17);
|
|
111410
111477
|
}
|
|
111411
111478
|
return path17;
|
|
111412
111479
|
}
|
|
@@ -113227,7 +113294,7 @@ Please use only one download method.`);
|
|
|
113227
113294
|
// src/commands/plan/plan-command.ts
|
|
113228
113295
|
init_output_manager();
|
|
113229
113296
|
import { existsSync as existsSync71, statSync as statSync12 } from "node:fs";
|
|
113230
|
-
import { dirname as
|
|
113297
|
+
import { dirname as dirname51, isAbsolute as isAbsolute14, join as join149, parse as parse7, resolve as resolve53 } from "node:path";
|
|
113231
113298
|
|
|
113232
113299
|
// src/commands/plan/plan-read-handlers.ts
|
|
113233
113300
|
init_config();
|
|
@@ -113237,18 +113304,18 @@ init_logger();
|
|
|
113237
113304
|
init_output_manager();
|
|
113238
113305
|
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
113239
113306
|
import { existsSync as existsSync70, statSync as statSync11 } from "node:fs";
|
|
113240
|
-
import { basename as basename31, dirname as
|
|
113307
|
+
import { basename as basename31, dirname as dirname49, join as join148, relative as relative32, resolve as resolve51 } from "node:path";
|
|
113241
113308
|
|
|
113242
113309
|
// src/commands/plan/plan-dependencies.ts
|
|
113243
113310
|
init_config();
|
|
113244
113311
|
init_plan_parser();
|
|
113245
113312
|
init_plans_registry();
|
|
113246
113313
|
import { existsSync as existsSync69 } from "node:fs";
|
|
113247
|
-
import { dirname as
|
|
113314
|
+
import { dirname as dirname48, join as join147 } from "node:path";
|
|
113248
113315
|
async function resolvePlanDependencies(references, currentPlanFile, options2 = {}) {
|
|
113249
113316
|
if (references.length === 0)
|
|
113250
113317
|
return [];
|
|
113251
|
-
const currentPlanDir =
|
|
113318
|
+
const currentPlanDir = dirname48(currentPlanFile);
|
|
113252
113319
|
const projectRoot = findProjectRoot(currentPlanDir);
|
|
113253
113320
|
const config = options2.preloadedConfig ?? (await CkConfigManager.loadFull(projectRoot)).config;
|
|
113254
113321
|
const defaultScope = inferPlanScopeForDir(currentPlanDir, config);
|
|
@@ -113335,7 +113402,7 @@ async function handleParse(target, options2) {
|
|
|
113335
113402
|
console.log(JSON.stringify({ file: relative32(process.cwd(), planFile), frontmatter, phases }, null, 2));
|
|
113336
113403
|
return;
|
|
113337
113404
|
}
|
|
113338
|
-
const title = typeof frontmatter.title === "string" ? frontmatter.title : basename31(
|
|
113405
|
+
const title = typeof frontmatter.title === "string" ? frontmatter.title : basename31(dirname49(planFile));
|
|
113339
113406
|
console.log();
|
|
113340
113407
|
console.log(import_picocolors32.default.bold(` Plan: ${title}`));
|
|
113341
113408
|
console.log(` File: ${planFile}`);
|
|
@@ -113446,7 +113513,7 @@ async function handleStatus(target, options2) {
|
|
|
113446
113513
|
const blockedBy2 = await resolvePlanDependencies(s.blockedBy, pf, { preloadedConfig });
|
|
113447
113514
|
const blocks2 = await resolvePlanDependencies(s.blocks, pf, { preloadedConfig });
|
|
113448
113515
|
const bar = progressBar(s.completed, s.totalPhases);
|
|
113449
|
-
const title2 = s.title ?? basename31(
|
|
113516
|
+
const title2 = s.title ?? basename31(dirname49(pf));
|
|
113450
113517
|
console.log(` ${import_picocolors32.default.bold(title2)}`);
|
|
113451
113518
|
console.log(` ${bar}`);
|
|
113452
113519
|
if (s.inProgress > 0)
|
|
@@ -113465,7 +113532,7 @@ async function handleStatus(target, options2) {
|
|
|
113465
113532
|
}
|
|
113466
113533
|
console.log();
|
|
113467
113534
|
} catch {
|
|
113468
|
-
console.log(` [X] Failed to read: ${basename31(
|
|
113535
|
+
console.log(` [X] Failed to read: ${basename31(dirname49(pf))}`);
|
|
113469
113536
|
console.log();
|
|
113470
113537
|
}
|
|
113471
113538
|
}
|
|
@@ -113492,7 +113559,7 @@ async function handleStatus(target, options2) {
|
|
|
113492
113559
|
console.log(JSON.stringify({ ...summary, dependencyStatus: { blockedBy, blocks } }, null, 2));
|
|
113493
113560
|
return;
|
|
113494
113561
|
}
|
|
113495
|
-
const title = summary.title ?? basename31(
|
|
113562
|
+
const title = summary.title ?? basename31(dirname49(planFile));
|
|
113496
113563
|
console.log();
|
|
113497
113564
|
console.log(import_picocolors32.default.bold(` ${title}`));
|
|
113498
113565
|
if (summary.status)
|
|
@@ -113555,7 +113622,7 @@ async function handleKanban(target, options2) {
|
|
|
113555
113622
|
process.exitCode = 1;
|
|
113556
113623
|
return;
|
|
113557
113624
|
}
|
|
113558
|
-
const route = `/plans?dir=${encodeURIComponent(
|
|
113625
|
+
const route = `/plans?dir=${encodeURIComponent(dirname49(dirname49(planFile)))}&view=kanban`;
|
|
113559
113626
|
const url = `http://localhost:${server.port}${route}`;
|
|
113560
113627
|
console.log();
|
|
113561
113628
|
console.log(import_picocolors32.default.bold(" ClaudeKit Dashboard — Plans"));
|
|
@@ -113590,7 +113657,7 @@ init_plan_parser();
|
|
|
113590
113657
|
init_plans_registry();
|
|
113591
113658
|
init_output_manager();
|
|
113592
113659
|
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
113593
|
-
import { basename as basename32, dirname as
|
|
113660
|
+
import { basename as basename32, dirname as dirname50, relative as relative33, resolve as resolve52 } from "node:path";
|
|
113594
113661
|
function quoteReadTarget(filePath) {
|
|
113595
113662
|
return `"${filePath.replace(/\\/g, "/").replace(/"/g, "\\\"")}"`;
|
|
113596
113663
|
}
|
|
@@ -113704,7 +113771,7 @@ async function handleCheck(target, options2) {
|
|
|
113704
113771
|
process.exitCode = 1;
|
|
113705
113772
|
return;
|
|
113706
113773
|
}
|
|
113707
|
-
const planDir =
|
|
113774
|
+
const planDir = dirname50(planFile);
|
|
113708
113775
|
let planStatus = "pending";
|
|
113709
113776
|
try {
|
|
113710
113777
|
const projectRoot = findProjectRoot(planDir);
|
|
@@ -113753,7 +113820,7 @@ async function handleUncheck(target, options2) {
|
|
|
113753
113820
|
process.exitCode = 1;
|
|
113754
113821
|
return;
|
|
113755
113822
|
}
|
|
113756
|
-
const planDir =
|
|
113823
|
+
const planDir = dirname50(planFile);
|
|
113757
113824
|
try {
|
|
113758
113825
|
const projectRoot = findProjectRoot(planDir);
|
|
113759
113826
|
const summary = buildPlanSummary(planFile);
|
|
@@ -113792,7 +113859,7 @@ async function handleAddPhase(target, options2) {
|
|
|
113792
113859
|
try {
|
|
113793
113860
|
const result = addPhase(planFile, target, options2.after);
|
|
113794
113861
|
try {
|
|
113795
|
-
const planDir =
|
|
113862
|
+
const planDir = dirname50(planFile);
|
|
113796
113863
|
const projectRoot = findProjectRoot(planDir);
|
|
113797
113864
|
updateRegistryAddPhase({
|
|
113798
113865
|
planDir,
|
|
@@ -113846,7 +113913,7 @@ function resolvePlanFile(target, baseDir) {
|
|
|
113846
113913
|
const candidate = join149(dir, "plan.md");
|
|
113847
113914
|
if (existsSync71(candidate))
|
|
113848
113915
|
return candidate;
|
|
113849
|
-
dir =
|
|
113916
|
+
dir = dirname51(dir);
|
|
113850
113917
|
}
|
|
113851
113918
|
}
|
|
113852
113919
|
return null;
|
|
@@ -115132,7 +115199,7 @@ var import_fs_extra43 = __toESM(require_lib(), 1);
|
|
|
115132
115199
|
// src/commands/uninstall/analysis-handler.ts
|
|
115133
115200
|
init_metadata_migration();
|
|
115134
115201
|
import { readdirSync as readdirSync11, rmSync as rmSync4 } from "node:fs";
|
|
115135
|
-
import { dirname as
|
|
115202
|
+
import { dirname as dirname52, join as join152 } from "node:path";
|
|
115136
115203
|
init_logger();
|
|
115137
115204
|
init_safe_prompts();
|
|
115138
115205
|
var import_fs_extra42 = __toESM(require_lib(), 1);
|
|
@@ -115154,7 +115221,7 @@ function classifyFileByOwnership(ownership, forceOverwrite, deleteReason) {
|
|
|
115154
115221
|
}
|
|
115155
115222
|
async function cleanupEmptyDirectories3(filePath, installationRoot) {
|
|
115156
115223
|
let cleaned = 0;
|
|
115157
|
-
let currentDir =
|
|
115224
|
+
let currentDir = dirname52(filePath);
|
|
115158
115225
|
while (currentDir !== installationRoot && currentDir.startsWith(installationRoot)) {
|
|
115159
115226
|
try {
|
|
115160
115227
|
const entries = readdirSync11(currentDir);
|
|
@@ -115162,7 +115229,7 @@ async function cleanupEmptyDirectories3(filePath, installationRoot) {
|
|
|
115162
115229
|
rmSync4(currentDir, { recursive: true });
|
|
115163
115230
|
cleaned++;
|
|
115164
115231
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
115165
|
-
currentDir =
|
|
115232
|
+
currentDir = dirname52(currentDir);
|
|
115166
115233
|
} else {
|
|
115167
115234
|
break;
|
|
115168
115235
|
}
|
|
@@ -117084,7 +117151,7 @@ init_file_io();
|
|
|
117084
117151
|
init_logger();
|
|
117085
117152
|
import { existsSync as existsSync74 } from "node:fs";
|
|
117086
117153
|
import { mkdir as mkdir41, readFile as readFile70 } from "node:fs/promises";
|
|
117087
|
-
import { dirname as
|
|
117154
|
+
import { dirname as dirname53 } from "node:path";
|
|
117088
117155
|
var PROCESSED_ISSUES_CAP = 500;
|
|
117089
117156
|
async function readCkJson(projectDir) {
|
|
117090
117157
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
@@ -117114,7 +117181,7 @@ async function loadWatchState(projectDir) {
|
|
|
117114
117181
|
}
|
|
117115
117182
|
async function saveWatchState(projectDir, state) {
|
|
117116
117183
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
117117
|
-
const configDir =
|
|
117184
|
+
const configDir = dirname53(configPath);
|
|
117118
117185
|
if (!existsSync74(configDir)) {
|
|
117119
117186
|
await mkdir41(configDir, { recursive: true });
|
|
117120
117187
|
}
|