claudekit-cli 4.2.1 → 4.2.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 +77 -5
- package/package.json +1 -1
package/cli-manifest.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -45544,6 +45544,45 @@ function formatCanonicalClaudeCommand(nodePrefix, root, relativePath, suffix = "
|
|
|
45544
45544
|
}
|
|
45545
45545
|
return normalizedRoot === "$CLAUDE_PROJECT_DIR" ? `${nodePrefix}"${normalizedRoot}"/${normalizedRelativePath}${suffix}` : `${nodePrefix}"${normalizedRoot}/${normalizedRelativePath}"${suffix}`;
|
|
45546
45546
|
}
|
|
45547
|
+
function resolveClaudePathArg(arg, root) {
|
|
45548
|
+
const normalizedArg = arg.replace(/\\/g, "/");
|
|
45549
|
+
const bareRelativeMatch = normalizedArg.match(/^(?:\.\/)?(\.claude\/.+)$/);
|
|
45550
|
+
if (bareRelativeMatch) {
|
|
45551
|
+
return { root, relativePath: bareRelativeMatch[1] };
|
|
45552
|
+
}
|
|
45553
|
+
const variableMatch = normalizedArg.match(/^(?:\$HOME|\$\{HOME\}|\$CLAUDE_PROJECT_DIR|\$\{CLAUDE_PROJECT_DIR\}|%USERPROFILE%|%CLAUDE_PROJECT_DIR%)\/(\.claude\/.+)$/);
|
|
45554
|
+
if (variableMatch) {
|
|
45555
|
+
return { root, relativePath: variableMatch[1] };
|
|
45556
|
+
}
|
|
45557
|
+
const tildeMatch = normalizedArg.match(/^~\/(\.claude\/.+)$/);
|
|
45558
|
+
if (tildeMatch) {
|
|
45559
|
+
return { root, relativePath: tildeMatch[1] };
|
|
45560
|
+
}
|
|
45561
|
+
const absoluteMatch = normalizedArg.match(/^((?:[A-Za-z]:\/|\/).*?\/\.claude\/.+)$/);
|
|
45562
|
+
if (absoluteMatch) {
|
|
45563
|
+
const absolutePath = absoluteMatch[1];
|
|
45564
|
+
const dotClaudeIdx = absolutePath.indexOf("/.claude/");
|
|
45565
|
+
if (dotClaudeIdx === -1) {
|
|
45566
|
+
return null;
|
|
45567
|
+
}
|
|
45568
|
+
const isWin2 = process.platform === "win32";
|
|
45569
|
+
const cmp = (s) => isWin2 ? s.toLowerCase() : s;
|
|
45570
|
+
const globalRoots = [
|
|
45571
|
+
`${homedir12().replace(/\\/g, "/").replace(/\/+$/, "")}/.claude/`,
|
|
45572
|
+
`${PathResolver.getGlobalKitDir().replace(/\\/g, "/").replace(/\/+$/, "")}/`
|
|
45573
|
+
];
|
|
45574
|
+
const isUnderGlobal = globalRoots.some((g2) => cmp(absolutePath).startsWith(cmp(g2)));
|
|
45575
|
+
const resolvedRoot = isUnderGlobal ? "$HOME" : root;
|
|
45576
|
+
return {
|
|
45577
|
+
root: resolvedRoot,
|
|
45578
|
+
relativePath: absolutePath.slice(dotClaudeIdx + 1)
|
|
45579
|
+
};
|
|
45580
|
+
}
|
|
45581
|
+
return null;
|
|
45582
|
+
}
|
|
45583
|
+
function formatCanonicalClaudeArg(pathArg) {
|
|
45584
|
+
return formatCanonicalClaudeCommand("", pathArg.root, pathArg.relativePath);
|
|
45585
|
+
}
|
|
45547
45586
|
function isNodeClaudeCommand(cmd) {
|
|
45548
45587
|
if (!cmd)
|
|
45549
45588
|
return false;
|
|
@@ -45611,6 +45650,39 @@ function repairClaudeNodeCommandPath(cmd, root) {
|
|
|
45611
45650
|
}
|
|
45612
45651
|
return { command: cmd, changed: false, issue: null };
|
|
45613
45652
|
}
|
|
45653
|
+
function repairClaudeHookRunnerCommandPath(cmd, root) {
|
|
45654
|
+
if (!cmd) {
|
|
45655
|
+
return { command: cmd ?? "", changed: false, issue: null };
|
|
45656
|
+
}
|
|
45657
|
+
const runnerMatch = cmd.match(/^(\s*bash\s+)(?:"([^"]+)"|([^\s"]+))\s+(?:"([^"]+)"|([^\s"]+))(.*)$/);
|
|
45658
|
+
if (!runnerMatch) {
|
|
45659
|
+
return { command: cmd, changed: false, issue: null };
|
|
45660
|
+
}
|
|
45661
|
+
const [, bashPrefix, quotedRunner, unquotedRunner, quotedTarget, unquotedTarget, suffix] = runnerMatch;
|
|
45662
|
+
const runnerArg = quotedRunner ?? unquotedRunner;
|
|
45663
|
+
const targetArg = quotedTarget ?? unquotedTarget;
|
|
45664
|
+
const runnerPath = resolveClaudePathArg(runnerArg, root);
|
|
45665
|
+
if (!runnerPath || runnerPath.relativePath.replace(/\\/g, "/") !== ".claude/hooks/node-hook-runner.sh") {
|
|
45666
|
+
return { command: cmd, changed: false, issue: null };
|
|
45667
|
+
}
|
|
45668
|
+
const targetPath = resolveClaudePathArg(targetArg, root);
|
|
45669
|
+
if (!targetPath) {
|
|
45670
|
+
return { command: cmd, changed: false, issue: null };
|
|
45671
|
+
}
|
|
45672
|
+
const command = `${bashPrefix}${formatCanonicalClaudeArg(runnerPath)} ${formatCanonicalClaudeArg(targetPath)}${suffix}`;
|
|
45673
|
+
return {
|
|
45674
|
+
command,
|
|
45675
|
+
changed: command !== cmd,
|
|
45676
|
+
issue: command !== cmd ? "invalid-format" : null
|
|
45677
|
+
};
|
|
45678
|
+
}
|
|
45679
|
+
function repairClaudeHookCommandPath(cmd, root) {
|
|
45680
|
+
const nodeRepair = repairClaudeNodeCommandPath(cmd, root);
|
|
45681
|
+
if (nodeRepair.changed || nodeRepair.issue || isNodeClaudeCommand(cmd)) {
|
|
45682
|
+
return nodeRepair;
|
|
45683
|
+
}
|
|
45684
|
+
return repairClaudeHookRunnerCommandPath(cmd, root);
|
|
45685
|
+
}
|
|
45614
45686
|
function normalizeCommand(cmd) {
|
|
45615
45687
|
if (!cmd)
|
|
45616
45688
|
return "";
|
|
@@ -62890,7 +62962,7 @@ var package_default;
|
|
|
62890
62962
|
var init_package = __esm(() => {
|
|
62891
62963
|
package_default = {
|
|
62892
62964
|
name: "claudekit-cli",
|
|
62893
|
-
version: "4.2.
|
|
62965
|
+
version: "4.2.2",
|
|
62894
62966
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
62895
62967
|
type: "module",
|
|
62896
62968
|
repository: {
|
|
@@ -86280,7 +86352,7 @@ function getClaudeSettingsFiles(projectDir) {
|
|
|
86280
86352
|
return candidates.filter((candidate) => existsSync56(candidate.path));
|
|
86281
86353
|
}
|
|
86282
86354
|
function isAlreadyCanonical(cmd) {
|
|
86283
|
-
return /^node\s+"\$HOME\/\.claude\/[^"]+"/.test(cmd) || /^node\s+"\$CLAUDE_PROJECT_DIR"\/\.claude\/\S+/.test(cmd);
|
|
86355
|
+
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);
|
|
86284
86356
|
}
|
|
86285
86357
|
function collectHookCommandFindings(settings, settingsFile) {
|
|
86286
86358
|
if (!settings.hooks) {
|
|
@@ -86292,7 +86364,7 @@ function collectHookCommandFindings(settings, settingsFile) {
|
|
|
86292
86364
|
if ("command" in entry && typeof entry.command === "string") {
|
|
86293
86365
|
if (isAlreadyCanonical(entry.command))
|
|
86294
86366
|
continue;
|
|
86295
|
-
const repair =
|
|
86367
|
+
const repair = repairClaudeHookCommandPath(entry.command, settingsFile.root);
|
|
86296
86368
|
if (repair.changed && repair.issue) {
|
|
86297
86369
|
findings.push({
|
|
86298
86370
|
path: settingsFile.path,
|
|
@@ -86313,7 +86385,7 @@ function collectHookCommandFindings(settings, settingsFile) {
|
|
|
86313
86385
|
}
|
|
86314
86386
|
if (isAlreadyCanonical(hook.command))
|
|
86315
86387
|
continue;
|
|
86316
|
-
const repair =
|
|
86388
|
+
const repair = repairClaudeHookCommandPath(hook.command, settingsFile.root);
|
|
86317
86389
|
if (!repair.changed || !repair.issue) {
|
|
86318
86390
|
continue;
|
|
86319
86391
|
}
|
|
@@ -102339,7 +102411,7 @@ class SettingsProcessor {
|
|
|
102339
102411
|
return fixed;
|
|
102340
102412
|
}
|
|
102341
102413
|
fixSingleCommandPath(cmd) {
|
|
102342
|
-
return
|
|
102414
|
+
return repairClaudeHookCommandPath(cmd, this.getClaudeCommandRoot()).command;
|
|
102343
102415
|
}
|
|
102344
102416
|
formatCommandPath(nodePrefix, capturedVar, relativePath, suffix = "") {
|
|
102345
102417
|
const canonicalRoot = this.canonicalizePathRoot(capturedVar);
|