claudekit-cli 4.0.0-dev.9 → 4.1.0-dev.1
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 +279 -186
- package/package.json +1 -1
package/cli-manifest.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -13095,6 +13095,14 @@ function isManagedAgentBlock(content) {
|
|
|
13095
13095
|
const hasAgentConfig = /^\s*config_file\s*=\s*"agents\/.+?"\s*$/m.test(content);
|
|
13096
13096
|
return hasAgentTable && (hasDescription || hasAgentConfig);
|
|
13097
13097
|
}
|
|
13098
|
+
function repairInlineAgentTableHeaders(content, lineEnding) {
|
|
13099
|
+
let repairedCount = 0;
|
|
13100
|
+
const repairedContent = content.replace(/([^\r\n])(\[agents\.(?:"[^"\r\n]+"|[^\]\r\n]+)\][ \t]*(?:#[^\r\n]*)?)(?=\r?\n|$)/g, (_match, prefix, header) => {
|
|
13101
|
+
repairedCount += 1;
|
|
13102
|
+
return `${prefix}${lineEnding}${header}`;
|
|
13103
|
+
});
|
|
13104
|
+
return { content: repairedContent, repairedCount };
|
|
13105
|
+
}
|
|
13098
13106
|
function extractManagedAgentEntries(existing) {
|
|
13099
13107
|
const entries = new Map;
|
|
13100
13108
|
const escapedStart = escapeRegExp(SENTINEL_START);
|
|
@@ -13150,22 +13158,27 @@ function stripRanges(content, ranges) {
|
|
|
13150
13158
|
function analyzeConfigToml(existing) {
|
|
13151
13159
|
const lineEnding = detectLineEnding(existing);
|
|
13152
13160
|
const warnings = [];
|
|
13161
|
+
const repairResult = repairInlineAgentTableHeaders(existing, lineEnding);
|
|
13162
|
+
const normalizedContent = repairResult.content;
|
|
13163
|
+
if (repairResult.repairedCount > 0) {
|
|
13164
|
+
warnings.push(`Repaired ${repairResult.repairedCount} inline [agents.*] table header(s) in config.toml`);
|
|
13165
|
+
}
|
|
13153
13166
|
const escapedStart = escapeRegExp(SENTINEL_START);
|
|
13154
13167
|
const escapedEnd = escapeRegExp(SENTINEL_END);
|
|
13155
13168
|
const startLineRegex = new RegExp(`^${escapedStart}\\s*$`, "gm");
|
|
13156
13169
|
const endLineRegex = new RegExp(`^${escapedEnd}\\s*$`, "gm");
|
|
13157
|
-
const startCount = [...
|
|
13158
|
-
const endCount = [...
|
|
13170
|
+
const startCount = [...normalizedContent.matchAll(startLineRegex)].length;
|
|
13171
|
+
const endCount = [...normalizedContent.matchAll(endLineRegex)].length;
|
|
13159
13172
|
const blockRegex = new RegExp(`^${escapedStart}\\s*\\r?\\n[\\s\\S]*?^${escapedEnd}\\s*(?:\\r?\\n)?`, "gm");
|
|
13160
13173
|
const candidateRanges = [];
|
|
13161
|
-
let match = blockRegex.exec(
|
|
13174
|
+
let match = blockRegex.exec(normalizedContent);
|
|
13162
13175
|
while (match) {
|
|
13163
13176
|
candidateRanges.push({
|
|
13164
13177
|
start: match.index,
|
|
13165
13178
|
end: match.index + match[0].length,
|
|
13166
13179
|
content: match[0]
|
|
13167
13180
|
});
|
|
13168
|
-
match = blockRegex.exec(
|
|
13181
|
+
match = blockRegex.exec(normalizedContent);
|
|
13169
13182
|
}
|
|
13170
13183
|
const candidateCount = candidateRanges.length;
|
|
13171
13184
|
const unmatchedStart = Math.max(0, startCount - candidateCount);
|
|
@@ -13173,7 +13186,8 @@ function analyzeConfigToml(existing) {
|
|
|
13173
13186
|
if (unmatchedStart > 0 || unmatchedEnd > 0) {
|
|
13174
13187
|
return {
|
|
13175
13188
|
lineEnding,
|
|
13176
|
-
|
|
13189
|
+
normalizedContent,
|
|
13190
|
+
unmanagedContent: normalizedContent,
|
|
13177
13191
|
warnings,
|
|
13178
13192
|
error: "Malformed CK managed agent sentinels in config.toml (unmatched start/end markers). Please clean up sentinels manually."
|
|
13179
13193
|
};
|
|
@@ -13182,9 +13196,10 @@ function analyzeConfigToml(existing) {
|
|
|
13182
13196
|
if (managedRanges.length > 1) {
|
|
13183
13197
|
warnings.push(`Found ${managedRanges.length} CK-managed agent blocks in config.toml; collapsing into one managed block`);
|
|
13184
13198
|
}
|
|
13185
|
-
const unmanagedContent = stripRanges(
|
|
13199
|
+
const unmanagedContent = stripRanges(normalizedContent, managedRanges);
|
|
13186
13200
|
return {
|
|
13187
13201
|
lineEnding,
|
|
13202
|
+
normalizedContent,
|
|
13188
13203
|
unmanagedContent,
|
|
13189
13204
|
warnings
|
|
13190
13205
|
};
|
|
@@ -13367,6 +13382,7 @@ async function installCodexToml(items, provider, portableType, options2) {
|
|
|
13367
13382
|
snapshottedPaths.add(configTomlPath);
|
|
13368
13383
|
const existingConfig = configSnapshot.content ?? "";
|
|
13369
13384
|
const configAnalysis = analyzeConfigToml(existingConfig);
|
|
13385
|
+
const normalizedConfig = configAnalysis.normalizedContent;
|
|
13370
13386
|
allWarnings.push(...configAnalysis.warnings);
|
|
13371
13387
|
if (configAnalysis.error) {
|
|
13372
13388
|
return {
|
|
@@ -13378,7 +13394,7 @@ async function installCodexToml(items, provider, portableType, options2) {
|
|
|
13378
13394
|
warnings: allWarnings.length > 0 ? allWarnings : undefined
|
|
13379
13395
|
};
|
|
13380
13396
|
}
|
|
13381
|
-
const existingManagedEntries = extractManagedAgentEntries(
|
|
13397
|
+
const existingManagedEntries = extractManagedAgentEntries(normalizedConfig);
|
|
13382
13398
|
const unmanagedAgentSlugs = extractUnmanagedAgentSlugs(configAnalysis.unmanagedContent);
|
|
13383
13399
|
for (const item of items) {
|
|
13384
13400
|
const result = convertItem(item, pathConfig.format, provider, {
|
|
@@ -13436,6 +13452,9 @@ async function installCodexToml(items, provider, portableType, options2) {
|
|
|
13436
13452
|
});
|
|
13437
13453
|
}
|
|
13438
13454
|
if (pendingInstalls.length === 0) {
|
|
13455
|
+
if (normalizedConfig !== existingConfig) {
|
|
13456
|
+
await writeFile2(configTomlPath, normalizedConfig, "utf-8");
|
|
13457
|
+
}
|
|
13439
13458
|
return {
|
|
13440
13459
|
provider,
|
|
13441
13460
|
providerDisplayName: config.displayName,
|
|
@@ -13454,7 +13473,7 @@ async function installCodexToml(items, provider, portableType, options2) {
|
|
|
13454
13473
|
const managedBlock = sortedEntries.join(`
|
|
13455
13474
|
|
|
13456
13475
|
`);
|
|
13457
|
-
const mergeResult = mergeConfigTomlWithDiagnostics(
|
|
13476
|
+
const mergeResult = mergeConfigTomlWithDiagnostics(normalizedConfig, managedBlock);
|
|
13458
13477
|
allWarnings.push(...mergeResult.warnings);
|
|
13459
13478
|
if (mergeResult.error) {
|
|
13460
13479
|
return {
|
|
@@ -13537,7 +13556,13 @@ async function cleanupStaleCodexConfigEntries(options2) {
|
|
|
13537
13556
|
try {
|
|
13538
13557
|
return await withCodexTargetLock(configTomlPath, async () => {
|
|
13539
13558
|
let content = await readFile3(configTomlPath, "utf-8");
|
|
13559
|
+
let contentChanged = false;
|
|
13540
13560
|
const allStaleSlugs = [];
|
|
13561
|
+
const initialAnalysis = analyzeConfigToml(content);
|
|
13562
|
+
if (!initialAnalysis.error && initialAnalysis.normalizedContent !== content) {
|
|
13563
|
+
content = initialAnalysis.normalizedContent;
|
|
13564
|
+
contentChanged = true;
|
|
13565
|
+
}
|
|
13541
13566
|
const managedEntries = extractManagedAgentEntries(content);
|
|
13542
13567
|
if (managedEntries.size > 0) {
|
|
13543
13568
|
const validEntries = new Map;
|
|
@@ -13553,6 +13578,7 @@ async function cleanupStaleCodexConfigEntries(options2) {
|
|
|
13553
13578
|
if (validEntries.size === 0) {
|
|
13554
13579
|
const analysis2 = analyzeConfigToml(content);
|
|
13555
13580
|
content = analysis2.unmanagedContent;
|
|
13581
|
+
contentChanged = true;
|
|
13556
13582
|
} else {
|
|
13557
13583
|
const sortedEntries = [...validEntries.entries()].sort(([a3], [b3]) => a3.localeCompare(b3)).map(([, entry]) => entry);
|
|
13558
13584
|
const managedBlock = sortedEntries.join(`
|
|
@@ -13563,6 +13589,7 @@ async function cleanupStaleCodexConfigEntries(options2) {
|
|
|
13563
13589
|
logger.verbose(`[codex-cleanup] Phase 1 merge failed: ${mergeResult.error}`);
|
|
13564
13590
|
} else {
|
|
13565
13591
|
content = mergeResult.content;
|
|
13592
|
+
contentChanged = true;
|
|
13566
13593
|
}
|
|
13567
13594
|
}
|
|
13568
13595
|
}
|
|
@@ -13587,12 +13614,17 @@ async function cleanupStaleCodexConfigEntries(options2) {
|
|
|
13587
13614
|
content = content.replace(/\n{3,}/g, `
|
|
13588
13615
|
|
|
13589
13616
|
`);
|
|
13617
|
+
contentChanged = true;
|
|
13590
13618
|
allStaleSlugs.push(...legacyStaleSlugs);
|
|
13591
13619
|
}
|
|
13592
|
-
if (allStaleSlugs.length === 0)
|
|
13620
|
+
if (allStaleSlugs.length === 0 && !contentChanged)
|
|
13593
13621
|
return [];
|
|
13594
13622
|
await writeFile2(configTomlPath, content, "utf-8");
|
|
13595
|
-
|
|
13623
|
+
if (allStaleSlugs.length > 0) {
|
|
13624
|
+
logger.verbose(`[codex-cleanup] Removed ${allStaleSlugs.length} stale config.toml entries: ${allStaleSlugs.join(", ")}`);
|
|
13625
|
+
} else {
|
|
13626
|
+
logger.verbose("[codex-cleanup] Repaired malformed inline agent table headers");
|
|
13627
|
+
}
|
|
13596
13628
|
return allStaleSlugs;
|
|
13597
13629
|
});
|
|
13598
13630
|
} catch (error) {
|
|
@@ -16105,10 +16137,14 @@ var init_frontmatter_parser = __esm(() => {
|
|
|
16105
16137
|
import { readdir } from "node:fs/promises";
|
|
16106
16138
|
import { homedir as homedir6 } from "node:os";
|
|
16107
16139
|
import { join as join6 } from "node:path";
|
|
16108
|
-
function getAgentSourcePath() {
|
|
16140
|
+
function getAgentSourcePath(globalOnly = false) {
|
|
16141
|
+
const globalPath = join6(homedir6(), ".claude/agents");
|
|
16142
|
+
if (globalOnly) {
|
|
16143
|
+
return findFirstExistingPath([globalPath]);
|
|
16144
|
+
}
|
|
16109
16145
|
return findFirstExistingPath([
|
|
16110
16146
|
...getProjectLayoutCandidates(process.cwd(), "agents"),
|
|
16111
|
-
|
|
16147
|
+
globalPath
|
|
16112
16148
|
]);
|
|
16113
16149
|
}
|
|
16114
16150
|
async function discoverAgents(sourcePath) {
|
|
@@ -16145,12 +16181,10 @@ async function findAgentByName(name, sourcePath) {
|
|
|
16145
16181
|
const agents = await discoverAgents(sourcePath);
|
|
16146
16182
|
return agents.find((a3) => a3.name.toLowerCase() === name.toLowerCase()) || null;
|
|
16147
16183
|
}
|
|
16148
|
-
var home3;
|
|
16149
16184
|
var init_agents_discovery = __esm(() => {
|
|
16150
16185
|
init_kit_layout();
|
|
16151
16186
|
init_logger();
|
|
16152
16187
|
init_frontmatter_parser();
|
|
16153
|
-
home3 = homedir6();
|
|
16154
16188
|
});
|
|
16155
16189
|
|
|
16156
16190
|
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
@@ -20787,10 +20821,14 @@ var init_safe_prompts = __esm(() => {
|
|
|
20787
20821
|
import { readdir as readdir4 } from "node:fs/promises";
|
|
20788
20822
|
import { homedir as homedir10 } from "node:os";
|
|
20789
20823
|
import { join as join16, relative as relative3 } from "node:path";
|
|
20790
|
-
function getCommandSourcePath() {
|
|
20824
|
+
function getCommandSourcePath(globalOnly = false) {
|
|
20825
|
+
const globalPath = join16(homedir10(), ".claude/commands");
|
|
20826
|
+
if (globalOnly) {
|
|
20827
|
+
return findFirstExistingPath([globalPath]);
|
|
20828
|
+
}
|
|
20791
20829
|
return findFirstExistingPath([
|
|
20792
20830
|
...getProjectLayoutCandidates(process.cwd(), "commands"),
|
|
20793
|
-
|
|
20831
|
+
globalPath
|
|
20794
20832
|
]);
|
|
20795
20833
|
}
|
|
20796
20834
|
async function scanCommandDir(dir, rootDir) {
|
|
@@ -20840,12 +20878,11 @@ async function findCommandByName(name, sourcePath) {
|
|
|
20840
20878
|
const commands = await discoverCommands(sourcePath);
|
|
20841
20879
|
return commands.find((c2) => c2.name.toLowerCase() === name.toLowerCase()) || commands.find((c2) => c2.displayName?.toLowerCase() === name.toLowerCase()) || null;
|
|
20842
20880
|
}
|
|
20843
|
-
var
|
|
20881
|
+
var SKIP_DIRS;
|
|
20844
20882
|
var init_commands_discovery = __esm(() => {
|
|
20845
20883
|
init_kit_layout();
|
|
20846
20884
|
init_logger();
|
|
20847
20885
|
init_frontmatter_parser();
|
|
20848
|
-
home4 = homedir10();
|
|
20849
20886
|
SKIP_DIRS = ["node_modules", ".git", "dist", "build"];
|
|
20850
20887
|
});
|
|
20851
20888
|
|
|
@@ -49268,7 +49305,7 @@ function resolveAgentDirs() {
|
|
|
49268
49305
|
dirs.push({ path: candidate, label: rel });
|
|
49269
49306
|
}
|
|
49270
49307
|
}
|
|
49271
|
-
const globalPath = join28(
|
|
49308
|
+
const globalPath = join28(home3, ".claude", "agents");
|
|
49272
49309
|
dirs.push({ path: globalPath, label: "~/.claude/agents" });
|
|
49273
49310
|
const seen = new Set;
|
|
49274
49311
|
return dirs.filter(({ path: path3 }) => {
|
|
@@ -49357,11 +49394,11 @@ function registerAgentsBrowserRoutes(app) {
|
|
|
49357
49394
|
res.status(404).json({ error: "Agent not found" });
|
|
49358
49395
|
});
|
|
49359
49396
|
}
|
|
49360
|
-
var
|
|
49397
|
+
var home3;
|
|
49361
49398
|
var init_agents_routes = __esm(() => {
|
|
49362
49399
|
init_frontmatter_parser();
|
|
49363
49400
|
init_kit_layout();
|
|
49364
|
-
|
|
49401
|
+
home3 = homedir15();
|
|
49365
49402
|
});
|
|
49366
49403
|
|
|
49367
49404
|
// src/schemas/ck-config.schema.json
|
|
@@ -51413,10 +51450,10 @@ function mergeServers(lists) {
|
|
|
51413
51450
|
function isSafeProjectPath(projectPath) {
|
|
51414
51451
|
if (projectPath.includes(".."))
|
|
51415
51452
|
return false;
|
|
51416
|
-
const
|
|
51453
|
+
const home4 = homedir23();
|
|
51417
51454
|
try {
|
|
51418
51455
|
const resolved = resolve14(projectPath);
|
|
51419
|
-
if (!resolved.startsWith(
|
|
51456
|
+
if (!resolved.startsWith(home4))
|
|
51420
51457
|
return false;
|
|
51421
51458
|
return existsSync21(resolved);
|
|
51422
51459
|
} catch {
|
|
@@ -51742,26 +51779,34 @@ async function copyHooksCompanionDirs(sourceDir, targetDir) {
|
|
|
51742
51779
|
function resolveSourceOrigin(sourcePath) {
|
|
51743
51780
|
if (!sourcePath)
|
|
51744
51781
|
return "global";
|
|
51745
|
-
const
|
|
51782
|
+
const home4 = homedir24();
|
|
51746
51783
|
const cwd2 = process.cwd();
|
|
51747
|
-
if (cwd2 ===
|
|
51784
|
+
if (cwd2 === home4)
|
|
51748
51785
|
return "global";
|
|
51749
51786
|
const cwdPrefix = cwd2.endsWith(sep6) ? cwd2 : `${cwd2}${sep6}`;
|
|
51750
51787
|
if (sourcePath === cwd2 || sourcePath.startsWith(cwdPrefix))
|
|
51751
51788
|
return "project";
|
|
51752
51789
|
return "global";
|
|
51753
51790
|
}
|
|
51754
|
-
function getConfigSourcePath() {
|
|
51791
|
+
function getConfigSourcePath(globalOnly = false) {
|
|
51792
|
+
if (globalOnly)
|
|
51793
|
+
return getGlobalConfigSourcePath();
|
|
51755
51794
|
return findExistingProjectConfigPath(process.cwd()) ?? getGlobalConfigSourcePath();
|
|
51756
51795
|
}
|
|
51757
51796
|
function getGlobalConfigSourcePath() {
|
|
51758
51797
|
return join41(homedir24(), ".claude", "CLAUDE.md");
|
|
51759
51798
|
}
|
|
51760
|
-
function getRulesSourcePath() {
|
|
51761
|
-
|
|
51799
|
+
function getRulesSourcePath(globalOnly = false) {
|
|
51800
|
+
const globalPath = join41(homedir24(), ".claude", "rules");
|
|
51801
|
+
if (globalOnly)
|
|
51802
|
+
return globalPath;
|
|
51803
|
+
return findExistingProjectLayoutPath(process.cwd(), "rules") ?? globalPath;
|
|
51762
51804
|
}
|
|
51763
|
-
function getHooksSourcePath() {
|
|
51764
|
-
|
|
51805
|
+
function getHooksSourcePath(globalOnly = false) {
|
|
51806
|
+
const globalPath = join41(homedir24(), ".claude", "hooks");
|
|
51807
|
+
if (globalOnly)
|
|
51808
|
+
return globalPath;
|
|
51809
|
+
return findExistingProjectLayoutPath(process.cwd(), "hooks") ?? globalPath;
|
|
51765
51810
|
}
|
|
51766
51811
|
async function discoverConfig(sourcePath) {
|
|
51767
51812
|
const path3 = sourcePath ?? getConfigSourcePath();
|
|
@@ -54266,12 +54311,12 @@ function scrubHookEntry(entry, event, capabilities, pathRewrite) {
|
|
|
54266
54311
|
}
|
|
54267
54312
|
function rewriteCommandPath(command, pathRewrite) {
|
|
54268
54313
|
if (pathRewrite.commandSubstitutions && pathRewrite.commandSubstitutions.size > 0) {
|
|
54269
|
-
const
|
|
54314
|
+
const home4 = homedir26();
|
|
54270
54315
|
for (const [originalAbsPath, wrapperAbsPath] of pathRewrite.commandSubstitutions) {
|
|
54271
54316
|
const candidates = new Set([
|
|
54272
54317
|
originalAbsPath,
|
|
54273
|
-
originalAbsPath.replace(
|
|
54274
|
-
originalAbsPath.replace(
|
|
54318
|
+
originalAbsPath.replace(home4, "$HOME"),
|
|
54319
|
+
originalAbsPath.replace(home4, "~")
|
|
54275
54320
|
]);
|
|
54276
54321
|
for (const candidate of candidates) {
|
|
54277
54322
|
if (command.includes(candidate)) {
|
|
@@ -56077,13 +56122,17 @@ __export(exports_skills_discovery, {
|
|
|
56077
56122
|
import { readFile as readFile24, readdir as readdir13, stat as stat9 } from "node:fs/promises";
|
|
56078
56123
|
import { homedir as homedir28 } from "node:os";
|
|
56079
56124
|
import { dirname as dirname15, join as join45 } from "node:path";
|
|
56080
|
-
function getSkillSourcePath() {
|
|
56125
|
+
function getSkillSourcePath(globalOnly = false) {
|
|
56126
|
+
const globalPath = join45(homedir28(), ".claude/skills");
|
|
56127
|
+
if (globalOnly) {
|
|
56128
|
+
return findFirstExistingPath([globalPath]);
|
|
56129
|
+
}
|
|
56081
56130
|
const bundledRoot = join45(process.cwd(), "node_modules", "claudekit-engineer");
|
|
56082
56131
|
return findFirstExistingPath([
|
|
56083
56132
|
join45(bundledRoot, "skills"),
|
|
56084
56133
|
...getProjectLayoutCandidates(bundledRoot, "skills"),
|
|
56085
56134
|
...getProjectLayoutCandidates(process.cwd(), "skills"),
|
|
56086
|
-
|
|
56135
|
+
globalPath
|
|
56087
56136
|
]);
|
|
56088
56137
|
}
|
|
56089
56138
|
async function hasSkillMd(dir) {
|
|
@@ -56196,13 +56245,12 @@ async function findSkillByName(name, sourcePath) {
|
|
|
56196
56245
|
const skills = await discoverSkills(sourcePath);
|
|
56197
56246
|
return skills.find((s) => s.name.toLowerCase() === name.toLowerCase()) || null;
|
|
56198
56247
|
}
|
|
56199
|
-
var import_gray_matter5,
|
|
56248
|
+
var import_gray_matter5, SKIP_DIRS3;
|
|
56200
56249
|
var init_skills_discovery = __esm(() => {
|
|
56201
56250
|
init_kit_layout();
|
|
56202
56251
|
init_skill_frontmatter_validator();
|
|
56203
56252
|
init_logger();
|
|
56204
56253
|
import_gray_matter5 = __toESM(require_gray_matter(), 1);
|
|
56205
|
-
home6 = homedir28();
|
|
56206
56254
|
SKIP_DIRS3 = ["node_modules", ".git", "dist", "build", ".venv", "__pycache__", "common"];
|
|
56207
56255
|
});
|
|
56208
56256
|
|
|
@@ -56843,13 +56891,13 @@ function recordHookRegistrationOutcome(provider, mergeResult, warnings, feedback
|
|
|
56843
56891
|
function warnConversionFallback(warning) {
|
|
56844
56892
|
console.warn(`[migrate] Falling back to raw checksum for ${sanitizeUntrusted(warning.provider)} ${sanitizeUntrusted(warning.type)} "${sanitizeUntrusted(warning.item, 80)}" because ${sanitizeUntrusted(warning.format)} conversion failed: ${sanitizeUntrusted(warning.error, 260)}`);
|
|
56845
56893
|
}
|
|
56846
|
-
async function discoverMigrationItems(include, configSource) {
|
|
56847
|
-
const agentsSource = include.agents ? getAgentSourcePath() : null;
|
|
56848
|
-
const commandsSource = include.commands ? getCommandSourcePath() : null;
|
|
56849
|
-
const skillsSource = include.skills ? getSkillSourcePath() : null;
|
|
56850
|
-
const hooksSource = include.hooks ? getHooksSourcePath() : null;
|
|
56851
|
-
const configSourcePath = include.config ? configSource ?? getConfigSourcePath() : null;
|
|
56852
|
-
const rulesSourcePath = include.rules ? getRulesSourcePath() : null;
|
|
56894
|
+
async function discoverMigrationItems(include, configSource, globalOnly = false) {
|
|
56895
|
+
const agentsSource = include.agents ? getAgentSourcePath(globalOnly) : null;
|
|
56896
|
+
const commandsSource = include.commands ? getCommandSourcePath(globalOnly) : null;
|
|
56897
|
+
const skillsSource = include.skills ? getSkillSourcePath(globalOnly) : null;
|
|
56898
|
+
const hooksSource = include.hooks ? getHooksSourcePath(globalOnly) : null;
|
|
56899
|
+
const configSourcePath = include.config ? configSource ?? getConfigSourcePath(globalOnly) : null;
|
|
56900
|
+
const rulesSourcePath = include.rules ? getRulesSourcePath(globalOnly) : null;
|
|
56853
56901
|
const [agents, commands, skills, configItem, ruleItems, hookItems] = await Promise.all([
|
|
56854
56902
|
agentsSource ? discoverAgents(agentsSource) : Promise.resolve([]),
|
|
56855
56903
|
commandsSource ? discoverCommands(commandsSource) : Promise.resolve([]),
|
|
@@ -56926,12 +56974,12 @@ function registerMigrationRoutes(app) {
|
|
|
56926
56974
|
};
|
|
56927
56975
|
const discovered = await discoverMigrationItems(includeAll);
|
|
56928
56976
|
const cwd2 = process.cwd();
|
|
56929
|
-
const
|
|
56977
|
+
const home4 = homedir29();
|
|
56930
56978
|
res.status(200).json({
|
|
56931
56979
|
cwd: cwd2,
|
|
56932
56980
|
targetPaths: {
|
|
56933
56981
|
project: join46(cwd2, ".claude"),
|
|
56934
|
-
global: join46(
|
|
56982
|
+
global: join46(home4, ".claude")
|
|
56935
56983
|
},
|
|
56936
56984
|
sourcePaths: discovered.sourcePaths,
|
|
56937
56985
|
sourceOrigins: {
|
|
@@ -57542,7 +57590,7 @@ function registerMigrationRoutes(app) {
|
|
|
57542
57590
|
const configSource = sourceParsed.value;
|
|
57543
57591
|
const effectiveGlobal = requestedGlobal;
|
|
57544
57592
|
const warnings = [];
|
|
57545
|
-
const discovered = await discoverMigrationItems(include, configSource);
|
|
57593
|
+
const discovered = await discoverMigrationItems(include, configSource, requestedGlobal);
|
|
57546
57594
|
const hasItems = discovered.agents.length > 0 || discovered.commands.length > 0 || discovered.skills.length > 0 || discovered.configItem !== null || discovered.ruleItems.length > 0 || discovered.hookItems.length > 0;
|
|
57547
57595
|
if (!hasItems) {
|
|
57548
57596
|
res.status(200).json({
|
|
@@ -60553,8 +60601,8 @@ function toDateStr(d3) {
|
|
|
60553
60601
|
return `${y3}-${m2}-${day}`;
|
|
60554
60602
|
}
|
|
60555
60603
|
async function scanActivityMetrics(periodDays) {
|
|
60556
|
-
const
|
|
60557
|
-
const projectsDir2 = join56(
|
|
60604
|
+
const home4 = homedir33();
|
|
60605
|
+
const projectsDir2 = join56(home4, ".claude", "projects");
|
|
60558
60606
|
const cutoff = new Date;
|
|
60559
60607
|
cutoff.setDate(cutoff.getDate() - periodDays);
|
|
60560
60608
|
const dailyMap = new Map;
|
|
@@ -60624,29 +60672,29 @@ async function scanActivityMetrics(periodDays) {
|
|
|
60624
60672
|
return { totalSessions, projects: projectActivities, dailyCounts };
|
|
60625
60673
|
}
|
|
60626
60674
|
async function resolveSessionDir(projectId) {
|
|
60627
|
-
const
|
|
60675
|
+
const home4 = homedir33();
|
|
60628
60676
|
if (projectId.startsWith("discovered-")) {
|
|
60629
60677
|
try {
|
|
60630
60678
|
const encodedPathB64 = projectId.slice("discovered-".length);
|
|
60631
60679
|
const projectPath = Buffer.from(encodedPathB64, "base64url").toString("utf-8");
|
|
60632
60680
|
const claudeEncoded = encodePath(projectPath);
|
|
60633
|
-
return join56(
|
|
60681
|
+
return join56(home4, ".claude", "projects", claudeEncoded);
|
|
60634
60682
|
} catch {
|
|
60635
60683
|
return null;
|
|
60636
60684
|
}
|
|
60637
60685
|
}
|
|
60638
60686
|
if (projectId === "current") {
|
|
60639
60687
|
const cwdEncoded = encodePath(process.cwd());
|
|
60640
|
-
return join56(
|
|
60688
|
+
return join56(home4, ".claude", "projects", cwdEncoded);
|
|
60641
60689
|
}
|
|
60642
60690
|
if (projectId === "global") {
|
|
60643
|
-
const globalEncoded = encodePath(join56(
|
|
60644
|
-
return join56(
|
|
60691
|
+
const globalEncoded = encodePath(join56(home4, ".claude"));
|
|
60692
|
+
return join56(home4, ".claude", "projects", globalEncoded);
|
|
60645
60693
|
}
|
|
60646
60694
|
const registered = await ProjectsRegistryManager.getProject(projectId);
|
|
60647
60695
|
if (registered) {
|
|
60648
60696
|
const claudeEncoded = encodePath(registered.path);
|
|
60649
|
-
return join56(
|
|
60697
|
+
return join56(home4, ".claude", "projects", claudeEncoded);
|
|
60650
60698
|
}
|
|
60651
60699
|
return null;
|
|
60652
60700
|
}
|
|
@@ -60798,8 +60846,8 @@ async function parseSessionDetail(filePath, limit, offset) {
|
|
|
60798
60846
|
}
|
|
60799
60847
|
function registerSessionRoutes(app) {
|
|
60800
60848
|
app.get("/api/sessions", async (_req, res) => {
|
|
60801
|
-
const
|
|
60802
|
-
const projectsDir2 = join56(
|
|
60849
|
+
const home4 = homedir33();
|
|
60850
|
+
const projectsDir2 = join56(home4, ".claude", "projects");
|
|
60803
60851
|
if (!existsSync37(projectsDir2)) {
|
|
60804
60852
|
res.json({ projects: [] });
|
|
60805
60853
|
return;
|
|
@@ -61482,10 +61530,10 @@ function hasOpenCodeInstallSignal2() {
|
|
|
61482
61530
|
join59(process.cwd(), "opencode.jsonc"),
|
|
61483
61531
|
join59(process.cwd(), ".opencode/agents"),
|
|
61484
61532
|
join59(process.cwd(), ".opencode/commands"),
|
|
61485
|
-
join59(
|
|
61486
|
-
join59(
|
|
61487
|
-
join59(
|
|
61488
|
-
join59(
|
|
61533
|
+
join59(home4, ".config/opencode/AGENTS.md"),
|
|
61534
|
+
join59(home4, ".config/opencode/agents"),
|
|
61535
|
+
join59(home4, ".config/opencode/commands"),
|
|
61536
|
+
join59(home4, ".opencode", "bin", OPENCODE_BINARY_NAME2)
|
|
61489
61537
|
]);
|
|
61490
61538
|
}
|
|
61491
61539
|
async function detectInstalledAgents() {
|
|
@@ -61509,108 +61557,108 @@ function isSkillInstalled(skillName, agent, options2) {
|
|
|
61509
61557
|
const installPath = getInstallPath(skillName, agent, options2);
|
|
61510
61558
|
return existsSync38(installPath);
|
|
61511
61559
|
}
|
|
61512
|
-
var
|
|
61560
|
+
var home4, OPENCODE_BINARY_NAME2, agents;
|
|
61513
61561
|
var init_agents = __esm(() => {
|
|
61514
|
-
|
|
61562
|
+
home4 = homedir37();
|
|
61515
61563
|
OPENCODE_BINARY_NAME2 = platform5() === "win32" ? "opencode.exe" : "opencode";
|
|
61516
61564
|
agents = {
|
|
61517
61565
|
"claude-code": {
|
|
61518
61566
|
name: "claude-code",
|
|
61519
61567
|
displayName: "Claude Code",
|
|
61520
61568
|
projectPath: ".claude/skills",
|
|
61521
|
-
globalPath: join59(
|
|
61522
|
-
detect: async () => existsSync38(join59(
|
|
61569
|
+
globalPath: join59(home4, ".claude/skills"),
|
|
61570
|
+
detect: async () => existsSync38(join59(home4, ".claude"))
|
|
61523
61571
|
},
|
|
61524
61572
|
cursor: {
|
|
61525
61573
|
name: "cursor",
|
|
61526
61574
|
displayName: "Cursor",
|
|
61527
61575
|
projectPath: ".cursor/skills",
|
|
61528
|
-
globalPath: join59(
|
|
61529
|
-
detect: async () => existsSync38(join59(
|
|
61576
|
+
globalPath: join59(home4, ".cursor/skills"),
|
|
61577
|
+
detect: async () => existsSync38(join59(home4, ".cursor"))
|
|
61530
61578
|
},
|
|
61531
61579
|
codex: {
|
|
61532
61580
|
name: "codex",
|
|
61533
61581
|
displayName: "Codex",
|
|
61534
61582
|
projectPath: ".codex/skills",
|
|
61535
|
-
globalPath: join59(
|
|
61536
|
-
detect: async () => existsSync38(join59(
|
|
61583
|
+
globalPath: join59(home4, ".codex/skills"),
|
|
61584
|
+
detect: async () => existsSync38(join59(home4, ".codex"))
|
|
61537
61585
|
},
|
|
61538
61586
|
opencode: {
|
|
61539
61587
|
name: "opencode",
|
|
61540
61588
|
displayName: "OpenCode",
|
|
61541
61589
|
projectPath: ".claude/skills",
|
|
61542
|
-
globalPath: join59(
|
|
61590
|
+
globalPath: join59(home4, ".claude/skills"),
|
|
61543
61591
|
detect: async () => hasOpenCodeInstallSignal2()
|
|
61544
61592
|
},
|
|
61545
61593
|
goose: {
|
|
61546
61594
|
name: "goose",
|
|
61547
61595
|
displayName: "Goose",
|
|
61548
61596
|
projectPath: ".goose/skills",
|
|
61549
|
-
globalPath: join59(
|
|
61550
|
-
detect: async () => existsSync38(join59(
|
|
61597
|
+
globalPath: join59(home4, ".config/goose/skills"),
|
|
61598
|
+
detect: async () => existsSync38(join59(home4, ".config/goose"))
|
|
61551
61599
|
},
|
|
61552
61600
|
"gemini-cli": {
|
|
61553
61601
|
name: "gemini-cli",
|
|
61554
61602
|
displayName: "Gemini CLI",
|
|
61555
61603
|
projectPath: ".agents/skills",
|
|
61556
|
-
globalPath: join59(
|
|
61557
|
-
detect: async () => existsSync38(join59(
|
|
61604
|
+
globalPath: join59(home4, ".agents/skills"),
|
|
61605
|
+
detect: async () => existsSync38(join59(home4, ".gemini"))
|
|
61558
61606
|
},
|
|
61559
61607
|
antigravity: {
|
|
61560
61608
|
name: "antigravity",
|
|
61561
61609
|
displayName: "Antigravity",
|
|
61562
61610
|
projectPath: ".agent/skills",
|
|
61563
|
-
globalPath: join59(
|
|
61564
|
-
detect: async () => existsSync38(join59(process.cwd(), ".agent")) || existsSync38(join59(
|
|
61611
|
+
globalPath: join59(home4, ".gemini/antigravity/skills"),
|
|
61612
|
+
detect: async () => existsSync38(join59(process.cwd(), ".agent")) || existsSync38(join59(home4, ".gemini/antigravity"))
|
|
61565
61613
|
},
|
|
61566
61614
|
"github-copilot": {
|
|
61567
61615
|
name: "github-copilot",
|
|
61568
61616
|
displayName: "GitHub Copilot",
|
|
61569
61617
|
projectPath: ".github/skills",
|
|
61570
|
-
globalPath: join59(
|
|
61571
|
-
detect: async () => existsSync38(join59(
|
|
61618
|
+
globalPath: join59(home4, ".copilot/skills"),
|
|
61619
|
+
detect: async () => existsSync38(join59(home4, ".copilot"))
|
|
61572
61620
|
},
|
|
61573
61621
|
amp: {
|
|
61574
61622
|
name: "amp",
|
|
61575
61623
|
displayName: "Amp",
|
|
61576
61624
|
projectPath: ".agents/skills",
|
|
61577
|
-
globalPath: join59(
|
|
61578
|
-
detect: async () => existsSync38(join59(
|
|
61625
|
+
globalPath: join59(home4, ".config/agents/skills"),
|
|
61626
|
+
detect: async () => existsSync38(join59(home4, ".config/amp"))
|
|
61579
61627
|
},
|
|
61580
61628
|
kilo: {
|
|
61581
61629
|
name: "kilo",
|
|
61582
61630
|
displayName: "Kilo Code",
|
|
61583
61631
|
projectPath: ".kilocode/skills",
|
|
61584
|
-
globalPath: join59(
|
|
61585
|
-
detect: async () => existsSync38(join59(
|
|
61632
|
+
globalPath: join59(home4, ".kilocode/skills"),
|
|
61633
|
+
detect: async () => existsSync38(join59(home4, ".kilocode"))
|
|
61586
61634
|
},
|
|
61587
61635
|
roo: {
|
|
61588
61636
|
name: "roo",
|
|
61589
61637
|
displayName: "Roo Code",
|
|
61590
61638
|
projectPath: ".roo/skills",
|
|
61591
|
-
globalPath: join59(
|
|
61592
|
-
detect: async () => existsSync38(join59(
|
|
61639
|
+
globalPath: join59(home4, ".roo/skills"),
|
|
61640
|
+
detect: async () => existsSync38(join59(home4, ".roo"))
|
|
61593
61641
|
},
|
|
61594
61642
|
windsurf: {
|
|
61595
61643
|
name: "windsurf",
|
|
61596
61644
|
displayName: "Windsurf",
|
|
61597
61645
|
projectPath: ".windsurf/skills",
|
|
61598
|
-
globalPath: join59(
|
|
61599
|
-
detect: async () => existsSync38(join59(
|
|
61646
|
+
globalPath: join59(home4, ".codeium/windsurf/skills"),
|
|
61647
|
+
detect: async () => existsSync38(join59(home4, ".codeium/windsurf"))
|
|
61600
61648
|
},
|
|
61601
61649
|
cline: {
|
|
61602
61650
|
name: "cline",
|
|
61603
61651
|
displayName: "Cline",
|
|
61604
61652
|
projectPath: ".cline/skills",
|
|
61605
|
-
globalPath: join59(
|
|
61606
|
-
detect: async () => existsSync38(join59(
|
|
61653
|
+
globalPath: join59(home4, ".cline/skills"),
|
|
61654
|
+
detect: async () => existsSync38(join59(home4, ".cline"))
|
|
61607
61655
|
},
|
|
61608
61656
|
openhands: {
|
|
61609
61657
|
name: "openhands",
|
|
61610
61658
|
displayName: "OpenHands",
|
|
61611
61659
|
projectPath: ".openhands/skills",
|
|
61612
|
-
globalPath: join59(
|
|
61613
|
-
detect: async () => existsSync38(join59(
|
|
61660
|
+
globalPath: join59(home4, ".openhands/skills"),
|
|
61661
|
+
detect: async () => existsSync38(join59(home4, ".openhands"))
|
|
61614
61662
|
}
|
|
61615
61663
|
};
|
|
61616
61664
|
});
|
|
@@ -61727,11 +61775,11 @@ async function syncRegistry() {
|
|
|
61727
61775
|
}
|
|
61728
61776
|
return { removed };
|
|
61729
61777
|
}
|
|
61730
|
-
var
|
|
61778
|
+
var home5, REGISTRY_PATH2, SkillInstallationSchema, SkillRegistrySchema, REGISTRY_PATH_MIGRATIONS;
|
|
61731
61779
|
var init_skills_registry = __esm(() => {
|
|
61732
61780
|
init_zod();
|
|
61733
|
-
|
|
61734
|
-
REGISTRY_PATH2 = join60(
|
|
61781
|
+
home5 = homedir38();
|
|
61782
|
+
REGISTRY_PATH2 = join60(home5, ".claudekit", "skill-registry.json");
|
|
61735
61783
|
SkillInstallationSchema = exports_external.object({
|
|
61736
61784
|
skill: exports_external.string(),
|
|
61737
61785
|
agent: exports_external.string(),
|
|
@@ -62842,7 +62890,7 @@ var package_default;
|
|
|
62842
62890
|
var init_package = __esm(() => {
|
|
62843
62891
|
package_default = {
|
|
62844
62892
|
name: "claudekit-cli",
|
|
62845
|
-
version: "4.
|
|
62893
|
+
version: "4.1.0-dev.1",
|
|
62846
62894
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
62847
62895
|
type: "module",
|
|
62848
62896
|
repository: {
|
|
@@ -71064,6 +71112,40 @@ function parseNameReason(str2) {
|
|
|
71064
71112
|
}
|
|
71065
71113
|
return [str2.slice(0, colonIndex).trim(), str2.slice(colonIndex + 1).trim()];
|
|
71066
71114
|
}
|
|
71115
|
+
function matchesSystemToolName(name, toolName) {
|
|
71116
|
+
return name === toolName || name.startsWith(`${toolName} `) || name.includes(`(${toolName})`);
|
|
71117
|
+
}
|
|
71118
|
+
function getSystemToolKey(failure) {
|
|
71119
|
+
const [name] = parseNameReason(failure);
|
|
71120
|
+
const lowerName = name.toLowerCase().replace(/\s+/g, " ");
|
|
71121
|
+
for (const toolName of SYSTEM_TOOL_KEYS) {
|
|
71122
|
+
if (matchesSystemToolName(lowerName, toolName)) {
|
|
71123
|
+
return toolName;
|
|
71124
|
+
}
|
|
71125
|
+
}
|
|
71126
|
+
return;
|
|
71127
|
+
}
|
|
71128
|
+
function isSystemToolFailure(failure) {
|
|
71129
|
+
return getSystemToolKey(failure) !== undefined;
|
|
71130
|
+
}
|
|
71131
|
+
function isWindowsSummary(summary) {
|
|
71132
|
+
return Boolean(summary.remediation.winget_packages || summary.remediation.pip_retry.includes(".ps1") || summary.remediation.pip_retry.includes("\\"));
|
|
71133
|
+
}
|
|
71134
|
+
function getSystemPackageCommand(summary, systemFailures) {
|
|
71135
|
+
if (isWindowsSummary(summary)) {
|
|
71136
|
+
const packageIds = new Set;
|
|
71137
|
+
for (const failure of systemFailures) {
|
|
71138
|
+
const key = getSystemToolKey(failure);
|
|
71139
|
+
if (key)
|
|
71140
|
+
packageIds.add(WINDOWS_SYSTEM_PACKAGES[key]);
|
|
71141
|
+
}
|
|
71142
|
+
if (packageIds.size > 0) {
|
|
71143
|
+
return `winget install ${Array.from(packageIds).join(" ")}`;
|
|
71144
|
+
}
|
|
71145
|
+
return summary.remediation.winget_packages;
|
|
71146
|
+
}
|
|
71147
|
+
return summary.remediation.sudo_packages || undefined;
|
|
71148
|
+
}
|
|
71067
71149
|
function displayInstallErrors(skillsDir2) {
|
|
71068
71150
|
const summaryPath = join90(skillsDir2, ".install-error-summary.json");
|
|
71069
71151
|
if (!existsSync58(summaryPath)) {
|
|
@@ -71079,6 +71161,12 @@ function displayInstallErrors(skillsDir2) {
|
|
|
71079
71161
|
return;
|
|
71080
71162
|
}
|
|
71081
71163
|
try {
|
|
71164
|
+
const systemOptionalFailures = summary.optional_failures.filter(isSystemToolFailure);
|
|
71165
|
+
const pythonOptionalFailures = summary.optional_failures.filter((f3) => !isSystemToolFailure(f3));
|
|
71166
|
+
const systemPackageCommand = getSystemPackageCommand(summary, [
|
|
71167
|
+
...systemOptionalFailures,
|
|
71168
|
+
...summary.skipped
|
|
71169
|
+
]);
|
|
71082
71170
|
if (summary.critical_failures.length > 0) {
|
|
71083
71171
|
logger.error("");
|
|
71084
71172
|
logger.error("━━━ Critical Failures ━━━");
|
|
@@ -71112,17 +71200,17 @@ function displayInstallErrors(skillsDir2) {
|
|
|
71112
71200
|
logger.info("");
|
|
71113
71201
|
logger.info("━━━ How to Fix ━━━");
|
|
71114
71202
|
logger.info("");
|
|
71115
|
-
if (
|
|
71203
|
+
if (pythonOptionalFailures.some((f3) => f3.includes("no wheel") || f3.includes("build tools") || f3.includes("build failed")) && summary.remediation.build_tools) {
|
|
71116
71204
|
logger.info("Install build tools (one-time):");
|
|
71117
71205
|
logger.info(` ${summary.remediation.build_tools}`);
|
|
71118
71206
|
logger.info("");
|
|
71119
71207
|
}
|
|
71120
|
-
if (summary.skipped.length > 0
|
|
71208
|
+
if ((summary.skipped.length > 0 || systemOptionalFailures.length > 0) && systemPackageCommand) {
|
|
71121
71209
|
logger.info("Install system packages:");
|
|
71122
|
-
logger.info(` ${
|
|
71210
|
+
logger.info(` ${systemPackageCommand}`);
|
|
71123
71211
|
logger.info("");
|
|
71124
71212
|
}
|
|
71125
|
-
if (
|
|
71213
|
+
if (pythonOptionalFailures.length > 0 && summary.remediation.pip_retry) {
|
|
71126
71214
|
logger.info("Then retry failed packages manually:");
|
|
71127
71215
|
logger.info(` ${summary.remediation.pip_retry}`);
|
|
71128
71216
|
}
|
|
@@ -71159,9 +71247,16 @@ function hasInstallState(skillsDir2) {
|
|
|
71159
71247
|
const stateFilePath = join90(skillsDir2, ".install-state.json");
|
|
71160
71248
|
return existsSync58(stateFilePath);
|
|
71161
71249
|
}
|
|
71162
|
-
var WHICH_COMMAND_TIMEOUT_MS = 5000;
|
|
71250
|
+
var WHICH_COMMAND_TIMEOUT_MS = 5000, WINDOWS_SYSTEM_PACKAGES, SYSTEM_TOOL_KEYS;
|
|
71163
71251
|
var init_install_error_handler = __esm(() => {
|
|
71164
71252
|
init_logger();
|
|
71253
|
+
WINDOWS_SYSTEM_PACKAGES = {
|
|
71254
|
+
ffmpeg: "Gyan.FFmpeg",
|
|
71255
|
+
imagemagick: "ImageMagick.ImageMagick",
|
|
71256
|
+
librsvg: "GNOME.librsvg",
|
|
71257
|
+
"rsvg-convert": "GNOME.librsvg"
|
|
71258
|
+
};
|
|
71259
|
+
SYSTEM_TOOL_KEYS = Object.keys(WINDOWS_SYSTEM_PACKAGES);
|
|
71165
71260
|
});
|
|
71166
71261
|
|
|
71167
71262
|
// src/services/package-installer/skills-installer.ts
|
|
@@ -71223,8 +71318,8 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
71223
71318
|
logger.info(` Platform: ${platform9 === "win32" ? "Windows (PowerShell)" : "Unix (bash)"}`);
|
|
71224
71319
|
if (logger.isVerbose()) {
|
|
71225
71320
|
try {
|
|
71226
|
-
const { readFile:
|
|
71227
|
-
const scriptContent = await
|
|
71321
|
+
const { readFile: readFile46 } = await import("node:fs/promises");
|
|
71322
|
+
const scriptContent = await readFile46(scriptPath, "utf-8");
|
|
71228
71323
|
const previewLines = scriptContent.split(`
|
|
71229
71324
|
`).slice(0, 20);
|
|
71230
71325
|
logger.verbose("Script preview (first 20 lines):");
|
|
@@ -71420,11 +71515,11 @@ var init_skills_installer2 = __esm(() => {
|
|
|
71420
71515
|
|
|
71421
71516
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
71422
71517
|
import { existsSync as existsSync59 } from "node:fs";
|
|
71423
|
-
import { mkdir as mkdir23, readFile as
|
|
71518
|
+
import { mkdir as mkdir23, readFile as readFile46, writeFile as writeFile22 } from "node:fs/promises";
|
|
71424
71519
|
import { dirname as dirname29, join as join92 } from "node:path";
|
|
71425
71520
|
async function readJsonFile(filePath) {
|
|
71426
71521
|
try {
|
|
71427
|
-
const content = await
|
|
71522
|
+
const content = await readFile46(filePath, "utf-8");
|
|
71428
71523
|
return JSON.parse(content);
|
|
71429
71524
|
} catch (error) {
|
|
71430
71525
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -71438,7 +71533,7 @@ async function addGeminiToGitignore(projectDir) {
|
|
|
71438
71533
|
try {
|
|
71439
71534
|
let content = "";
|
|
71440
71535
|
if (existsSync59(gitignorePath)) {
|
|
71441
|
-
content = await
|
|
71536
|
+
content = await readFile46(gitignorePath, "utf-8");
|
|
71442
71537
|
const lines = content.split(`
|
|
71443
71538
|
`).map((line) => line.trim()).filter((line) => !line.startsWith("#"));
|
|
71444
71539
|
const geminiPatterns = [".gemini/", ".gemini", "/.gemini/", "/.gemini"];
|
|
@@ -74007,7 +74102,7 @@ __export(exports_worktree_manager, {
|
|
|
74007
74102
|
cleanupAllWorktrees: () => cleanupAllWorktrees
|
|
74008
74103
|
});
|
|
74009
74104
|
import { existsSync as existsSync70 } from "node:fs";
|
|
74010
|
-
import { readFile as
|
|
74105
|
+
import { readFile as readFile66, writeFile as writeFile37 } from "node:fs/promises";
|
|
74011
74106
|
import { join as join151 } from "node:path";
|
|
74012
74107
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
74013
74108
|
const worktreePath = join151(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
@@ -74072,7 +74167,7 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
74072
74167
|
async function ensureGitignore(projectDir) {
|
|
74073
74168
|
const gitignorePath = join151(projectDir, ".gitignore");
|
|
74074
74169
|
try {
|
|
74075
|
-
const content = existsSync70(gitignorePath) ? await
|
|
74170
|
+
const content = existsSync70(gitignorePath) ? await readFile66(gitignorePath, "utf-8") : "";
|
|
74076
74171
|
if (!content.includes(".worktrees")) {
|
|
74077
74172
|
const newContent = content.endsWith(`
|
|
74078
74173
|
`) ? `${content}.worktrees/
|
|
@@ -75994,12 +76089,12 @@ var init_types6 = __esm(() => {
|
|
|
75994
76089
|
});
|
|
75995
76090
|
|
|
75996
76091
|
// src/commands/content/phases/state-manager.ts
|
|
75997
|
-
import { readFile as
|
|
76092
|
+
import { readFile as readFile68, rename as rename15, writeFile as writeFile40 } from "node:fs/promises";
|
|
75998
76093
|
import { join as join164 } from "node:path";
|
|
75999
76094
|
async function loadContentConfig(projectDir) {
|
|
76000
76095
|
const configPath = join164(projectDir, CK_CONFIG_FILE2);
|
|
76001
76096
|
try {
|
|
76002
|
-
const raw2 = await
|
|
76097
|
+
const raw2 = await readFile68(configPath, "utf-8");
|
|
76003
76098
|
const json = JSON.parse(raw2);
|
|
76004
76099
|
return ContentConfigSchema.parse(json.content ?? {});
|
|
76005
76100
|
} catch {
|
|
@@ -76015,7 +76110,7 @@ async function saveContentConfig(projectDir, config) {
|
|
|
76015
76110
|
async function loadContentState(projectDir) {
|
|
76016
76111
|
const configPath = join164(projectDir, CK_CONFIG_FILE2);
|
|
76017
76112
|
try {
|
|
76018
|
-
const raw2 = await
|
|
76113
|
+
const raw2 = await readFile68(configPath, "utf-8");
|
|
76019
76114
|
const json = JSON.parse(raw2);
|
|
76020
76115
|
const contentBlock = json.content ?? {};
|
|
76021
76116
|
return ContentStateSchema.parse(contentBlock.state ?? {});
|
|
@@ -76042,7 +76137,7 @@ async function saveContentState(projectDir, state) {
|
|
|
76042
76137
|
}
|
|
76043
76138
|
async function readJsonSafe(filePath) {
|
|
76044
76139
|
try {
|
|
76045
|
-
const raw2 = await
|
|
76140
|
+
const raw2 = await readFile68(filePath, "utf-8");
|
|
76046
76141
|
return JSON.parse(raw2);
|
|
76047
76142
|
} catch {
|
|
76048
76143
|
return {};
|
|
@@ -85449,16 +85544,16 @@ async function checkPathRefsValid(projectDir) {
|
|
|
85449
85544
|
};
|
|
85450
85545
|
}
|
|
85451
85546
|
const baseDir = dirname27(claudeMdPath);
|
|
85452
|
-
const
|
|
85547
|
+
const home6 = homedir41();
|
|
85453
85548
|
const broken = [];
|
|
85454
85549
|
for (const ref of refs) {
|
|
85455
85550
|
let refPath;
|
|
85456
85551
|
if (ref.startsWith("$HOME") || ref.startsWith("${HOME}") || ref.startsWith("%USERPROFILE%")) {
|
|
85457
|
-
refPath = normalize6(ref.replace(/^\$\{?HOME\}?/,
|
|
85552
|
+
refPath = normalize6(ref.replace(/^\$\{?HOME\}?/, home6).replace("%USERPROFILE%", home6));
|
|
85458
85553
|
} else if (ref.startsWith("$CLAUDE_PROJECT_DIR") || ref.startsWith("${CLAUDE_PROJECT_DIR}") || ref.startsWith("%CLAUDE_PROJECT_DIR%")) {
|
|
85459
85554
|
refPath = normalize6(ref.replace(/^\$\{?CLAUDE_PROJECT_DIR\}?/, projectDir).replace("%CLAUDE_PROJECT_DIR%", projectDir));
|
|
85460
85555
|
} else if (ref.startsWith("~")) {
|
|
85461
|
-
refPath = normalize6(ref.replace(/^~/,
|
|
85556
|
+
refPath = normalize6(ref.replace(/^~/, home6));
|
|
85462
85557
|
} else if (ref.startsWith("/")) {
|
|
85463
85558
|
refPath = normalize6(ref);
|
|
85464
85559
|
} else if (/^[A-Za-z]:/.test(ref)) {
|
|
@@ -85467,7 +85562,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
85467
85562
|
refPath = resolve32(baseDir, ref);
|
|
85468
85563
|
}
|
|
85469
85564
|
const normalizedPath = normalize6(refPath);
|
|
85470
|
-
const isWithinHome = normalizedPath.startsWith(
|
|
85565
|
+
const isWithinHome = normalizedPath.startsWith(home6);
|
|
85471
85566
|
const isWithinBase2 = normalizedPath.startsWith(normalize6(baseDir));
|
|
85472
85567
|
const isAbsoluteAllowed = ref.startsWith("/") || /^[A-Za-z]:/.test(ref);
|
|
85473
85568
|
if (!isWithinHome && !isWithinBase2 && !isAbsoluteAllowed) {
|
|
@@ -86596,12 +86691,12 @@ function extractHookScriptPath(cmd) {
|
|
|
86596
86691
|
}
|
|
86597
86692
|
function resolveHookScriptPath(scriptPath, projectDir) {
|
|
86598
86693
|
let resolved = scriptPath.replace(/\\/g, "/");
|
|
86599
|
-
const
|
|
86600
|
-
resolved = resolved.replace(/^\$\{?HOME\}?/,
|
|
86694
|
+
const home6 = homedir42();
|
|
86695
|
+
resolved = resolved.replace(/^\$\{?HOME\}?/, home6);
|
|
86601
86696
|
resolved = resolved.replace(/^\$\{?CLAUDE_PROJECT_DIR\}?/, projectDir);
|
|
86602
|
-
resolved = resolved.replace(/^%USERPROFILE%/,
|
|
86697
|
+
resolved = resolved.replace(/^%USERPROFILE%/, home6);
|
|
86603
86698
|
resolved = resolved.replace(/^%CLAUDE_PROJECT_DIR%/, projectDir);
|
|
86604
|
-
resolved = resolved.replace(/^~\//, `${
|
|
86699
|
+
resolved = resolved.replace(/^~\//, `${home6}/`);
|
|
86605
86700
|
if (resolved.startsWith(".claude/") || resolved === ".claude") {
|
|
86606
86701
|
resolved = join83(projectDir, resolved);
|
|
86607
86702
|
}
|
|
@@ -88650,8 +88745,8 @@ class ReportGenerator {
|
|
|
88650
88745
|
};
|
|
88651
88746
|
}
|
|
88652
88747
|
scrubPath(path7) {
|
|
88653
|
-
const
|
|
88654
|
-
return
|
|
88748
|
+
const home6 = process.env.HOME || process.env.USERPROFILE || "";
|
|
88749
|
+
return home6 ? path7.replace(home6, "~") : path7;
|
|
88655
88750
|
}
|
|
88656
88751
|
getStatusIcon(status) {
|
|
88657
88752
|
switch (status) {
|
|
@@ -88765,8 +88860,8 @@ class DoctorUIRenderer {
|
|
|
88765
88860
|
}
|
|
88766
88861
|
}
|
|
88767
88862
|
shortenPath(path7) {
|
|
88768
|
-
const
|
|
88769
|
-
let shortened =
|
|
88863
|
+
const home6 = process.env.HOME || process.env.USERPROFILE || "";
|
|
88864
|
+
let shortened = home6 ? path7.replace(home6, "~") : path7;
|
|
88770
88865
|
const maxLen = 50;
|
|
88771
88866
|
if (shortened.length > maxLen) {
|
|
88772
88867
|
const start = shortened.slice(0, 20);
|
|
@@ -88943,14 +89038,13 @@ init_github_client();
|
|
|
88943
89038
|
init_config_version_checker();
|
|
88944
89039
|
|
|
88945
89040
|
// src/domains/sync/sync-engine.ts
|
|
88946
|
-
import { lstat as lstat6, readFile as
|
|
89041
|
+
import { lstat as lstat6, readFile as readFile45, readlink as readlink2, realpath as realpath6, stat as stat14 } from "node:fs/promises";
|
|
88947
89042
|
import { isAbsolute as isAbsolute8, join as join88, normalize as normalize8, relative as relative17 } from "node:path";
|
|
88948
89043
|
|
|
88949
89044
|
// src/services/file-operations/ownership-checker.ts
|
|
88950
89045
|
init_metadata_migration();
|
|
88951
89046
|
import { createHash as createHash6 } from "node:crypto";
|
|
88952
|
-
import {
|
|
88953
|
-
import { stat as stat13 } from "node:fs/promises";
|
|
89047
|
+
import { readFile as readFile44, stat as stat13 } from "node:fs/promises";
|
|
88954
89048
|
import { relative as relative16 } from "node:path";
|
|
88955
89049
|
|
|
88956
89050
|
// src/shared/concurrent-file-ops.ts
|
|
@@ -88964,18 +89058,12 @@ async function mapWithLimit(items, fn, concurrency = DEFAULT_CONCURRENCY) {
|
|
|
88964
89058
|
// src/services/file-operations/ownership-checker.ts
|
|
88965
89059
|
class OwnershipChecker {
|
|
88966
89060
|
static async calculateChecksum(filePath) {
|
|
88967
|
-
|
|
88968
|
-
|
|
88969
|
-
|
|
88970
|
-
|
|
88971
|
-
|
|
88972
|
-
|
|
88973
|
-
});
|
|
88974
|
-
stream.on("error", (err) => {
|
|
88975
|
-
stream.destroy();
|
|
88976
|
-
reject(new Error(operationError("Checksum calculation", filePath, err.message)));
|
|
88977
|
-
});
|
|
88978
|
-
});
|
|
89061
|
+
try {
|
|
89062
|
+
return createHash6("sha256").update(await readFile44(filePath)).digest("hex");
|
|
89063
|
+
} catch (err) {
|
|
89064
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
89065
|
+
throw new Error(operationError("Checksum calculation", filePath, message));
|
|
89066
|
+
}
|
|
88979
89067
|
}
|
|
88980
89068
|
static async checkOwnership(filePath, metadata, claudeDir3) {
|
|
88981
89069
|
try {
|
|
@@ -90388,7 +90476,7 @@ class SyncEngine {
|
|
|
90388
90476
|
if (lstats.size > MAX_SYNC_FILE_SIZE) {
|
|
90389
90477
|
throw new Error(`File too large for sync (${Math.round(lstats.size / 1024 / 1024)}MB > ${MAX_SYNC_FILE_SIZE / 1024 / 1024}MB limit)`);
|
|
90390
90478
|
}
|
|
90391
|
-
const buffer = await
|
|
90479
|
+
const buffer = await readFile45(filePath);
|
|
90392
90480
|
if (buffer.includes(0)) {
|
|
90393
90481
|
return { content: "", isBinary: true };
|
|
90394
90482
|
}
|
|
@@ -101730,7 +101818,7 @@ import { dirname as dirname35, join as join109 } from "node:path";
|
|
|
101730
101818
|
// src/domains/config/installed-settings-tracker.ts
|
|
101731
101819
|
init_shared();
|
|
101732
101820
|
import { existsSync as existsSync63 } from "node:fs";
|
|
101733
|
-
import { mkdir as mkdir31, readFile as
|
|
101821
|
+
import { mkdir as mkdir31, readFile as readFile49, writeFile as writeFile24 } from "node:fs/promises";
|
|
101734
101822
|
import { dirname as dirname34, join as join108 } from "node:path";
|
|
101735
101823
|
var CK_JSON_FILE = ".ck.json";
|
|
101736
101824
|
|
|
@@ -101755,7 +101843,7 @@ class InstalledSettingsTracker {
|
|
|
101755
101843
|
return { hooks: [], mcpServers: [] };
|
|
101756
101844
|
}
|
|
101757
101845
|
try {
|
|
101758
|
-
const content = await
|
|
101846
|
+
const content = await readFile49(ckJsonPath, "utf-8");
|
|
101759
101847
|
const data = JSON.parse(content);
|
|
101760
101848
|
const installed = data.kits?.[this.kitName]?.installedSettings;
|
|
101761
101849
|
if (installed) {
|
|
@@ -101772,7 +101860,7 @@ class InstalledSettingsTracker {
|
|
|
101772
101860
|
try {
|
|
101773
101861
|
let data = {};
|
|
101774
101862
|
if (existsSync63(ckJsonPath)) {
|
|
101775
|
-
const content = await
|
|
101863
|
+
const content = await readFile49(ckJsonPath, "utf-8");
|
|
101776
101864
|
data = JSON.parse(content);
|
|
101777
101865
|
}
|
|
101778
101866
|
if (!data.kits) {
|
|
@@ -103348,7 +103436,7 @@ import { join as join117 } from "node:path";
|
|
|
103348
103436
|
|
|
103349
103437
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
103350
103438
|
init_logger();
|
|
103351
|
-
import { readFile as
|
|
103439
|
+
import { readFile as readFile53, readdir as readdir29, writeFile as writeFile28 } from "node:fs/promises";
|
|
103352
103440
|
import { join as join116 } from "node:path";
|
|
103353
103441
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
103354
103442
|
".md",
|
|
@@ -103417,7 +103505,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
103417
103505
|
await processDirectory(fullPath);
|
|
103418
103506
|
} else if (entry.isFile() && shouldTransformFile(entry.name)) {
|
|
103419
103507
|
try {
|
|
103420
|
-
const content = await
|
|
103508
|
+
const content = await readFile53(fullPath, "utf-8");
|
|
103421
103509
|
const { transformed, changes } = transformCommandContent(content);
|
|
103422
103510
|
if (changes > 0) {
|
|
103423
103511
|
if (options2.dryRun) {
|
|
@@ -103954,7 +104042,7 @@ init_skip_directories();
|
|
|
103954
104042
|
init_types3();
|
|
103955
104043
|
var import_fs_extra24 = __toESM(require_lib(), 1);
|
|
103956
104044
|
import { createHash as createHash7 } from "node:crypto";
|
|
103957
|
-
import { readFile as
|
|
104045
|
+
import { readFile as readFile55, readdir as readdir33, writeFile as writeFile29 } from "node:fs/promises";
|
|
103958
104046
|
import { join as join121, relative as relative25 } from "node:path";
|
|
103959
104047
|
|
|
103960
104048
|
class SkillsManifestManager {
|
|
@@ -103988,7 +104076,7 @@ class SkillsManifestManager {
|
|
|
103988
104076
|
return null;
|
|
103989
104077
|
}
|
|
103990
104078
|
try {
|
|
103991
|
-
const content = await
|
|
104079
|
+
const content = await readFile55(manifestPath, "utf-8");
|
|
103992
104080
|
const data = JSON.parse(content);
|
|
103993
104081
|
const manifest = SkillsManifestSchema.parse(data);
|
|
103994
104082
|
logger.debug(`Read manifest from: ${manifestPath}`);
|
|
@@ -104060,7 +104148,7 @@ class SkillsManifestManager {
|
|
|
104060
104148
|
files.sort();
|
|
104061
104149
|
for (const file of files) {
|
|
104062
104150
|
const relativePath = relative25(dirPath, file);
|
|
104063
|
-
const content = await
|
|
104151
|
+
const content = await readFile55(file);
|
|
104064
104152
|
hash.update(relativePath);
|
|
104065
104153
|
hash.update(content);
|
|
104066
104154
|
}
|
|
@@ -104799,8 +104887,8 @@ import { relative as relative27 } from "node:path";
|
|
|
104799
104887
|
// src/domains/skills/customization/hash-calculator.ts
|
|
104800
104888
|
init_skip_directories();
|
|
104801
104889
|
import { createHash as createHash8 } from "node:crypto";
|
|
104802
|
-
import { createReadStream as
|
|
104803
|
-
import { readFile as
|
|
104890
|
+
import { createReadStream as createReadStream2 } from "node:fs";
|
|
104891
|
+
import { readFile as readFile56, readdir as readdir37 } from "node:fs/promises";
|
|
104804
104892
|
import { join as join125, relative as relative26 } from "node:path";
|
|
104805
104893
|
async function getAllFiles(dirPath) {
|
|
104806
104894
|
const files = [];
|
|
@@ -104822,7 +104910,7 @@ async function getAllFiles(dirPath) {
|
|
|
104822
104910
|
async function hashFile(filePath) {
|
|
104823
104911
|
return new Promise((resolve40, reject) => {
|
|
104824
104912
|
const hash = createHash8("sha256");
|
|
104825
|
-
const stream =
|
|
104913
|
+
const stream = createReadStream2(filePath);
|
|
104826
104914
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
104827
104915
|
stream.on("end", () => {
|
|
104828
104916
|
resolve40(hash.digest("hex"));
|
|
@@ -104839,7 +104927,7 @@ async function hashDirectory(dirPath) {
|
|
|
104839
104927
|
files.sort();
|
|
104840
104928
|
for (const file of files) {
|
|
104841
104929
|
const relativePath = relative26(dirPath, file);
|
|
104842
|
-
const content = await
|
|
104930
|
+
const content = await readFile56(file);
|
|
104843
104931
|
hash.update(relativePath);
|
|
104844
104932
|
hash.update(content);
|
|
104845
104933
|
}
|
|
@@ -105173,7 +105261,7 @@ import { join as join130 } from "node:path";
|
|
|
105173
105261
|
|
|
105174
105262
|
// src/services/transformers/opencode-path-transformer.ts
|
|
105175
105263
|
init_logger();
|
|
105176
|
-
import { readFile as
|
|
105264
|
+
import { readFile as readFile57, readdir as readdir39, writeFile as writeFile30 } from "node:fs/promises";
|
|
105177
105265
|
import { platform as platform14 } from "node:os";
|
|
105178
105266
|
import { extname as extname5, join as join129 } from "node:path";
|
|
105179
105267
|
var IS_WINDOWS2 = platform14() === "win32";
|
|
@@ -105244,7 +105332,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
105244
105332
|
await processDirectory2(fullPath);
|
|
105245
105333
|
} else if (entry.isFile() && shouldTransformFile2(entry.name)) {
|
|
105246
105334
|
try {
|
|
105247
|
-
const content = await
|
|
105335
|
+
const content = await readFile57(fullPath, "utf-8");
|
|
105248
105336
|
const { transformed, changes } = transformOpenCodeContent(content);
|
|
105249
105337
|
if (changes > 0) {
|
|
105250
105338
|
await writeFile30(fullPath, transformed, "utf-8");
|
|
@@ -106270,7 +106358,7 @@ async function handleSelection(ctx) {
|
|
|
106270
106358
|
};
|
|
106271
106359
|
}
|
|
106272
106360
|
// src/commands/init/phases/sync-handler.ts
|
|
106273
|
-
import { copyFile as copyFile8, mkdir as mkdir36, open as open5, readFile as
|
|
106361
|
+
import { copyFile as copyFile8, mkdir as mkdir36, open as open5, readFile as readFile58, rename as rename10, stat as stat22, unlink as unlink12, writeFile as writeFile32 } from "node:fs/promises";
|
|
106274
106362
|
import { dirname as dirname38, join as join134, resolve as resolve43 } from "node:path";
|
|
106275
106363
|
init_logger();
|
|
106276
106364
|
init_path_resolver();
|
|
@@ -106438,7 +106526,7 @@ async function executeSyncMerge(ctx) {
|
|
|
106438
106526
|
try {
|
|
106439
106527
|
const sourceMetadataPath = join134(upstreamDir, "metadata.json");
|
|
106440
106528
|
if (await import_fs_extra36.pathExists(sourceMetadataPath)) {
|
|
106441
|
-
const content = await
|
|
106529
|
+
const content = await readFile58(sourceMetadataPath, "utf-8");
|
|
106442
106530
|
const sourceMetadata = JSON.parse(content);
|
|
106443
106531
|
deletions = sourceMetadata.deletions || [];
|
|
106444
106532
|
}
|
|
@@ -106736,7 +106824,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
106736
106824
|
// src/services/transformers/folder-transform/path-replacer.ts
|
|
106737
106825
|
init_logger();
|
|
106738
106826
|
init_types3();
|
|
106739
|
-
import { readFile as
|
|
106827
|
+
import { readFile as readFile59, readdir as readdir41, writeFile as writeFile33 } from "node:fs/promises";
|
|
106740
106828
|
import { join as join136, relative as relative29 } from "node:path";
|
|
106741
106829
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
106742
106830
|
".md",
|
|
@@ -106803,7 +106891,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
106803
106891
|
if (!shouldTransform)
|
|
106804
106892
|
continue;
|
|
106805
106893
|
try {
|
|
106806
|
-
const content = await
|
|
106894
|
+
const content = await readFile59(fullPath, "utf-8");
|
|
106807
106895
|
let newContent = content;
|
|
106808
106896
|
let changeCount = 0;
|
|
106809
106897
|
for (const { regex: regex2, replacement } of compiledReplacements) {
|
|
@@ -106925,7 +107013,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
106925
107013
|
|
|
106926
107014
|
// src/services/transformers/global-path-transformer.ts
|
|
106927
107015
|
init_logger();
|
|
106928
|
-
import { readFile as
|
|
107016
|
+
import { readFile as readFile60, readdir as readdir42, writeFile as writeFile34 } from "node:fs/promises";
|
|
106929
107017
|
import { homedir as homedir46, platform as platform15 } from "node:os";
|
|
106930
107018
|
import { extname as extname6, join as join137 } from "node:path";
|
|
106931
107019
|
var IS_WINDOWS3 = platform15() === "win32";
|
|
@@ -107076,7 +107164,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
107076
107164
|
await processDirectory2(fullPath);
|
|
107077
107165
|
} else if (entry.isFile() && shouldTransformFile3(entry.name)) {
|
|
107078
107166
|
try {
|
|
107079
|
-
const content = await
|
|
107167
|
+
const content = await readFile60(fullPath, "utf-8");
|
|
107080
107168
|
const { transformed, changes } = transformContent(content, {
|
|
107081
107169
|
targetClaudeDir: options2.targetClaudeDir
|
|
107082
107170
|
});
|
|
@@ -107337,7 +107425,7 @@ async function initCommand(options2) {
|
|
|
107337
107425
|
init_dist2();
|
|
107338
107426
|
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
107339
107427
|
import { existsSync as existsSync65 } from "node:fs";
|
|
107340
|
-
import { readFile as
|
|
107428
|
+
import { readFile as readFile64, rm as rm16, unlink as unlink13 } from "node:fs/promises";
|
|
107341
107429
|
import { homedir as homedir51 } from "node:os";
|
|
107342
107430
|
import { basename as basename27, join as join142, resolve as resolve46 } from "node:path";
|
|
107343
107431
|
init_logger();
|
|
@@ -107502,11 +107590,11 @@ function wrapText(value, width) {
|
|
|
107502
107590
|
}
|
|
107503
107591
|
function formatDisplayPath(value) {
|
|
107504
107592
|
const normalized = value.replace(/\\/g, "/");
|
|
107505
|
-
const
|
|
107506
|
-
if (normalized ===
|
|
107593
|
+
const home6 = homedir47().replace(/\\/g, "/");
|
|
107594
|
+
if (normalized === home6)
|
|
107507
107595
|
return "~";
|
|
107508
|
-
if (normalized.startsWith(`${
|
|
107509
|
-
return normalized.replace(
|
|
107596
|
+
if (normalized.startsWith(`${home6}/`)) {
|
|
107597
|
+
return normalized.replace(home6, "~");
|
|
107510
107598
|
}
|
|
107511
107599
|
return normalized;
|
|
107512
107600
|
}
|
|
@@ -107814,13 +107902,13 @@ init_model_taxonomy();
|
|
|
107814
107902
|
init_logger();
|
|
107815
107903
|
init_dist2();
|
|
107816
107904
|
init_model_taxonomy();
|
|
107817
|
-
import { mkdir as mkdir38, readFile as
|
|
107905
|
+
import { mkdir as mkdir38, readFile as readFile63, writeFile as writeFile36 } from "node:fs/promises";
|
|
107818
107906
|
import { homedir as homedir50 } from "node:os";
|
|
107819
107907
|
import { dirname as dirname39, join as join141 } from "node:path";
|
|
107820
107908
|
|
|
107821
107909
|
// src/commands/portable/models-dev-cache.ts
|
|
107822
107910
|
init_logger();
|
|
107823
|
-
import { mkdir as mkdir37, readFile as
|
|
107911
|
+
import { mkdir as mkdir37, readFile as readFile61, rename as rename12, writeFile as writeFile35 } from "node:fs/promises";
|
|
107824
107912
|
import { homedir as homedir48 } from "node:os";
|
|
107825
107913
|
import { join as join139 } from "node:path";
|
|
107826
107914
|
|
|
@@ -107845,7 +107933,7 @@ function tmpFilePath(cacheDir) {
|
|
|
107845
107933
|
async function readCacheEntry(cacheDir) {
|
|
107846
107934
|
const filePath = cacheFilePath(cacheDir);
|
|
107847
107935
|
try {
|
|
107848
|
-
const raw2 = await
|
|
107936
|
+
const raw2 = await readFile61(filePath, "utf-8");
|
|
107849
107937
|
const parsed = JSON.parse(raw2);
|
|
107850
107938
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) && "fetchedAt" in parsed && typeof parsed.fetchedAt === "string" && "payload" in parsed && typeof parsed.payload === "object" && parsed.payload !== null) {
|
|
107851
107939
|
return parsed;
|
|
@@ -107913,7 +108001,7 @@ async function getModelsDevCatalog(opts = {}) {
|
|
|
107913
108001
|
|
|
107914
108002
|
// src/commands/portable/opencode-model-discovery.ts
|
|
107915
108003
|
init_logger();
|
|
107916
|
-
import { readFile as
|
|
108004
|
+
import { readFile as readFile62 } from "node:fs/promises";
|
|
107917
108005
|
import { homedir as homedir49, platform as platform17 } from "node:os";
|
|
107918
108006
|
import { join as join140 } from "node:path";
|
|
107919
108007
|
function resolveOpenCodeAuthPath(homeDir) {
|
|
@@ -107927,7 +108015,7 @@ function resolveOpenCodeAuthPath(homeDir) {
|
|
|
107927
108015
|
async function readAuthedProviders(homeDir) {
|
|
107928
108016
|
const authPath = resolveOpenCodeAuthPath(homeDir);
|
|
107929
108017
|
try {
|
|
107930
|
-
const raw2 = await
|
|
108018
|
+
const raw2 = await readFile62(authPath, "utf-8");
|
|
107931
108019
|
const parsed = JSON.parse(raw2);
|
|
107932
108020
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
107933
108021
|
return Object.keys(parsed);
|
|
@@ -107960,8 +108048,8 @@ function pickGenericModel(models) {
|
|
|
107960
108048
|
return sorted[0] ?? null;
|
|
107961
108049
|
}
|
|
107962
108050
|
async function resolveOpenCodeDefaultModel(opts = {}) {
|
|
107963
|
-
const
|
|
107964
|
-
const authedProviders = await readAuthedProviders(
|
|
108051
|
+
const home6 = opts.homeDir ?? homedir49();
|
|
108052
|
+
const authedProviders = await readAuthedProviders(home6);
|
|
107965
108053
|
if (authedProviders.length === 0) {
|
|
107966
108054
|
return { ok: false, reason: "no-auth", authedProviders: [] };
|
|
107967
108055
|
}
|
|
@@ -108129,7 +108217,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
108129
108217
|
const configPath = getOpenCodeConfigPath(options2);
|
|
108130
108218
|
let existing = null;
|
|
108131
108219
|
try {
|
|
108132
|
-
const raw2 = await
|
|
108220
|
+
const raw2 = await readFile63(configPath, "utf-8");
|
|
108133
108221
|
const parsed = JSON.parse(raw2);
|
|
108134
108222
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
108135
108223
|
existing = parsed;
|
|
@@ -109002,7 +109090,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
109002
109090
|
return;
|
|
109003
109091
|
let sourceMetadata;
|
|
109004
109092
|
try {
|
|
109005
|
-
const content = await
|
|
109093
|
+
const content = await readFile64(sourceMetadataPath, "utf-8");
|
|
109006
109094
|
sourceMetadata = JSON.parse(content);
|
|
109007
109095
|
} catch (error) {
|
|
109008
109096
|
logger.debug(`[migrate] Failed to parse source metadata.json: ${error}`);
|
|
@@ -109040,15 +109128,16 @@ async function migrateCommand(options2) {
|
|
|
109040
109128
|
const scope = resolveMigrationScope(process.argv.slice(2), options2);
|
|
109041
109129
|
const spinner = de();
|
|
109042
109130
|
spinner.start("Discovering portable items...");
|
|
109043
|
-
const
|
|
109044
|
-
const
|
|
109045
|
-
const
|
|
109046
|
-
const
|
|
109047
|
-
const
|
|
109131
|
+
const sourceGlobalOnly = options2.global === true;
|
|
109132
|
+
const agentSource = scope.agents ? getAgentSourcePath(sourceGlobalOnly) : null;
|
|
109133
|
+
const commandSource = scope.commands ? getCommandSourcePath(sourceGlobalOnly) : null;
|
|
109134
|
+
const skillSource = scope.skills ? getSkillSourcePath(sourceGlobalOnly) : null;
|
|
109135
|
+
const hooksSource = scope.hooks ? getHooksSourcePath(sourceGlobalOnly) : null;
|
|
109136
|
+
const rulesSourcePath = scope.rules ? getRulesSourcePath(sourceGlobalOnly) : null;
|
|
109048
109137
|
const agents2 = agentSource ? await discoverAgents(agentSource) : [];
|
|
109049
109138
|
const commands = commandSource ? await discoverCommands(commandSource) : [];
|
|
109050
109139
|
const skills = skillSource ? await discoverSkills(skillSource) : [];
|
|
109051
|
-
const configItem = scope.config ? await discoverConfig(options2.source) : null;
|
|
109140
|
+
const configItem = scope.config ? await discoverConfig(options2.source ?? (sourceGlobalOnly ? getConfigSourcePath(true) : undefined)) : null;
|
|
109052
109141
|
const ruleItems = rulesSourcePath ? await discoverRules(rulesSourcePath) : [];
|
|
109053
109142
|
const { items: hookItems, skippedShellHooks } = hooksSource ? await discoverHooks(hooksSource) : { items: [], skippedShellHooks: [] };
|
|
109054
109143
|
if (skippedShellHooks.length > 0) {
|
|
@@ -109196,7 +109285,11 @@ async function migrateCommand(options2) {
|
|
|
109196
109285
|
title: "ck migrate"
|
|
109197
109286
|
}).join(`
|
|
109198
109287
|
`));
|
|
109199
|
-
|
|
109288
|
+
if (sourceGlobalOnly) {
|
|
109289
|
+
f2.info(import_picocolors30.default.dim(` Scope: global (--global / -g) - reading from ${formatDisplayPath(join142(homedir51(), ".claude"))}`));
|
|
109290
|
+
} else {
|
|
109291
|
+
f2.info(import_picocolors30.default.dim(` CWD: ${process.cwd()}`));
|
|
109292
|
+
}
|
|
109200
109293
|
console.log();
|
|
109201
109294
|
console.log(renderPanel({
|
|
109202
109295
|
title: "Found",
|
|
@@ -109286,7 +109379,7 @@ async function migrateCommand(options2) {
|
|
|
109286
109379
|
for (const action of conflictActions) {
|
|
109287
109380
|
if (!action.diff && action.targetPath && existsSync65(action.targetPath)) {
|
|
109288
109381
|
try {
|
|
109289
|
-
const targetContent = await
|
|
109382
|
+
const targetContent = await readFile64(action.targetPath, "utf-8");
|
|
109290
109383
|
const sourceItem = effectiveAgents.find((a3) => a3.name === action.item) || effectiveCommands.find((c2) => c2.name === action.item) || (effectiveConfigItem?.name === action.item ? effectiveConfigItem : null) || effectiveRuleItems.find((r2) => r2.name === action.item) || effectiveHookItems.find((h2) => h2.name === action.item);
|
|
109291
109384
|
if (sourceItem) {
|
|
109292
109385
|
const providerConfig = providers[action.provider];
|
|
@@ -111292,7 +111385,7 @@ init_skills_registry();
|
|
|
111292
111385
|
init_skills_uninstaller();
|
|
111293
111386
|
var import_gray_matter12 = __toESM(require_gray_matter(), 1);
|
|
111294
111387
|
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
111295
|
-
import { readFile as
|
|
111388
|
+
import { readFile as readFile65 } from "node:fs/promises";
|
|
111296
111389
|
import { join as join148 } from "node:path";
|
|
111297
111390
|
|
|
111298
111391
|
// src/commands/skills/types.ts
|
|
@@ -111431,7 +111524,7 @@ async function handleValidate2(sourcePath) {
|
|
|
111431
111524
|
for (const skill of skills) {
|
|
111432
111525
|
const skillMdPath = join148(skill.path, "SKILL.md");
|
|
111433
111526
|
try {
|
|
111434
|
-
const content = await
|
|
111527
|
+
const content = await readFile65(skillMdPath, "utf-8");
|
|
111435
111528
|
const { data } = import_gray_matter12.default(content, {
|
|
111436
111529
|
engines: { javascript: { parse: () => ({}) } }
|
|
111437
111530
|
});
|
|
@@ -113947,7 +114040,7 @@ init_ck_config_manager();
|
|
|
113947
114040
|
init_file_io();
|
|
113948
114041
|
init_logger();
|
|
113949
114042
|
import { existsSync as existsSync71 } from "node:fs";
|
|
113950
|
-
import { mkdir as mkdir40, readFile as
|
|
114043
|
+
import { mkdir as mkdir40, readFile as readFile67 } from "node:fs/promises";
|
|
113951
114044
|
import { dirname as dirname46 } from "node:path";
|
|
113952
114045
|
var PROCESSED_ISSUES_CAP = 500;
|
|
113953
114046
|
async function readCkJson(projectDir) {
|
|
@@ -113955,7 +114048,7 @@ async function readCkJson(projectDir) {
|
|
|
113955
114048
|
try {
|
|
113956
114049
|
if (!existsSync71(configPath))
|
|
113957
114050
|
return {};
|
|
113958
|
-
const content = await
|
|
114051
|
+
const content = await readFile67(configPath, "utf-8");
|
|
113959
114052
|
return JSON.parse(content);
|
|
113960
114053
|
} catch (error) {
|
|
113961
114054
|
logger.warning(`Failed to parse .ck.json: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -114667,7 +114760,7 @@ init_types3();
|
|
|
114667
114760
|
init_logger();
|
|
114668
114761
|
init_path_resolver();
|
|
114669
114762
|
import { existsSync as existsSync86 } from "node:fs";
|
|
114670
|
-
import { mkdir as mkdir42, readFile as
|
|
114763
|
+
import { mkdir as mkdir42, readFile as readFile69, writeFile as writeFile41 } from "node:fs/promises";
|
|
114671
114764
|
import { join as join168 } from "node:path";
|
|
114672
114765
|
|
|
114673
114766
|
class VersionCacheManager {
|
|
@@ -114684,7 +114777,7 @@ class VersionCacheManager {
|
|
|
114684
114777
|
logger.debug("Version check cache not found");
|
|
114685
114778
|
return null;
|
|
114686
114779
|
}
|
|
114687
|
-
const content = await
|
|
114780
|
+
const content = await readFile69(cacheFile, "utf-8");
|
|
114688
114781
|
const cache5 = JSON.parse(content);
|
|
114689
114782
|
if (!cache5.lastCheck || !cache5.currentVersion || !cache5.latestVersion) {
|
|
114690
114783
|
logger.debug("Invalid cache structure, ignoring");
|