claudekit-cli 4.0.0-dev.10 → 4.0.0-dev.11
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 +98 -73
- 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) {
|
|
@@ -62842,7 +62874,7 @@ var package_default;
|
|
|
62842
62874
|
var init_package = __esm(() => {
|
|
62843
62875
|
package_default = {
|
|
62844
62876
|
name: "claudekit-cli",
|
|
62845
|
-
version: "4.0.0-dev.
|
|
62877
|
+
version: "4.0.0-dev.11",
|
|
62846
62878
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
62847
62879
|
type: "module",
|
|
62848
62880
|
repository: {
|
|
@@ -71270,8 +71302,8 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
71270
71302
|
logger.info(` Platform: ${platform9 === "win32" ? "Windows (PowerShell)" : "Unix (bash)"}`);
|
|
71271
71303
|
if (logger.isVerbose()) {
|
|
71272
71304
|
try {
|
|
71273
|
-
const { readFile:
|
|
71274
|
-
const scriptContent = await
|
|
71305
|
+
const { readFile: readFile46 } = await import("node:fs/promises");
|
|
71306
|
+
const scriptContent = await readFile46(scriptPath, "utf-8");
|
|
71275
71307
|
const previewLines = scriptContent.split(`
|
|
71276
71308
|
`).slice(0, 20);
|
|
71277
71309
|
logger.verbose("Script preview (first 20 lines):");
|
|
@@ -71467,11 +71499,11 @@ var init_skills_installer2 = __esm(() => {
|
|
|
71467
71499
|
|
|
71468
71500
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
71469
71501
|
import { existsSync as existsSync59 } from "node:fs";
|
|
71470
|
-
import { mkdir as mkdir23, readFile as
|
|
71502
|
+
import { mkdir as mkdir23, readFile as readFile46, writeFile as writeFile22 } from "node:fs/promises";
|
|
71471
71503
|
import { dirname as dirname29, join as join92 } from "node:path";
|
|
71472
71504
|
async function readJsonFile(filePath) {
|
|
71473
71505
|
try {
|
|
71474
|
-
const content = await
|
|
71506
|
+
const content = await readFile46(filePath, "utf-8");
|
|
71475
71507
|
return JSON.parse(content);
|
|
71476
71508
|
} catch (error) {
|
|
71477
71509
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -71485,7 +71517,7 @@ async function addGeminiToGitignore(projectDir) {
|
|
|
71485
71517
|
try {
|
|
71486
71518
|
let content = "";
|
|
71487
71519
|
if (existsSync59(gitignorePath)) {
|
|
71488
|
-
content = await
|
|
71520
|
+
content = await readFile46(gitignorePath, "utf-8");
|
|
71489
71521
|
const lines = content.split(`
|
|
71490
71522
|
`).map((line) => line.trim()).filter((line) => !line.startsWith("#"));
|
|
71491
71523
|
const geminiPatterns = [".gemini/", ".gemini", "/.gemini/", "/.gemini"];
|
|
@@ -74054,7 +74086,7 @@ __export(exports_worktree_manager, {
|
|
|
74054
74086
|
cleanupAllWorktrees: () => cleanupAllWorktrees
|
|
74055
74087
|
});
|
|
74056
74088
|
import { existsSync as existsSync70 } from "node:fs";
|
|
74057
|
-
import { readFile as
|
|
74089
|
+
import { readFile as readFile66, writeFile as writeFile37 } from "node:fs/promises";
|
|
74058
74090
|
import { join as join151 } from "node:path";
|
|
74059
74091
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
74060
74092
|
const worktreePath = join151(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
@@ -74119,7 +74151,7 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
74119
74151
|
async function ensureGitignore(projectDir) {
|
|
74120
74152
|
const gitignorePath = join151(projectDir, ".gitignore");
|
|
74121
74153
|
try {
|
|
74122
|
-
const content = existsSync70(gitignorePath) ? await
|
|
74154
|
+
const content = existsSync70(gitignorePath) ? await readFile66(gitignorePath, "utf-8") : "";
|
|
74123
74155
|
if (!content.includes(".worktrees")) {
|
|
74124
74156
|
const newContent = content.endsWith(`
|
|
74125
74157
|
`) ? `${content}.worktrees/
|
|
@@ -76041,12 +76073,12 @@ var init_types6 = __esm(() => {
|
|
|
76041
76073
|
});
|
|
76042
76074
|
|
|
76043
76075
|
// src/commands/content/phases/state-manager.ts
|
|
76044
|
-
import { readFile as
|
|
76076
|
+
import { readFile as readFile68, rename as rename15, writeFile as writeFile40 } from "node:fs/promises";
|
|
76045
76077
|
import { join as join164 } from "node:path";
|
|
76046
76078
|
async function loadContentConfig(projectDir) {
|
|
76047
76079
|
const configPath = join164(projectDir, CK_CONFIG_FILE2);
|
|
76048
76080
|
try {
|
|
76049
|
-
const raw2 = await
|
|
76081
|
+
const raw2 = await readFile68(configPath, "utf-8");
|
|
76050
76082
|
const json = JSON.parse(raw2);
|
|
76051
76083
|
return ContentConfigSchema.parse(json.content ?? {});
|
|
76052
76084
|
} catch {
|
|
@@ -76062,7 +76094,7 @@ async function saveContentConfig(projectDir, config) {
|
|
|
76062
76094
|
async function loadContentState(projectDir) {
|
|
76063
76095
|
const configPath = join164(projectDir, CK_CONFIG_FILE2);
|
|
76064
76096
|
try {
|
|
76065
|
-
const raw2 = await
|
|
76097
|
+
const raw2 = await readFile68(configPath, "utf-8");
|
|
76066
76098
|
const json = JSON.parse(raw2);
|
|
76067
76099
|
const contentBlock = json.content ?? {};
|
|
76068
76100
|
return ContentStateSchema.parse(contentBlock.state ?? {});
|
|
@@ -76089,7 +76121,7 @@ async function saveContentState(projectDir, state) {
|
|
|
76089
76121
|
}
|
|
76090
76122
|
async function readJsonSafe(filePath) {
|
|
76091
76123
|
try {
|
|
76092
|
-
const raw2 = await
|
|
76124
|
+
const raw2 = await readFile68(filePath, "utf-8");
|
|
76093
76125
|
return JSON.parse(raw2);
|
|
76094
76126
|
} catch {
|
|
76095
76127
|
return {};
|
|
@@ -88990,14 +89022,13 @@ init_github_client();
|
|
|
88990
89022
|
init_config_version_checker();
|
|
88991
89023
|
|
|
88992
89024
|
// src/domains/sync/sync-engine.ts
|
|
88993
|
-
import { lstat as lstat6, readFile as
|
|
89025
|
+
import { lstat as lstat6, readFile as readFile45, readlink as readlink2, realpath as realpath6, stat as stat14 } from "node:fs/promises";
|
|
88994
89026
|
import { isAbsolute as isAbsolute8, join as join88, normalize as normalize8, relative as relative17 } from "node:path";
|
|
88995
89027
|
|
|
88996
89028
|
// src/services/file-operations/ownership-checker.ts
|
|
88997
89029
|
init_metadata_migration();
|
|
88998
89030
|
import { createHash as createHash6 } from "node:crypto";
|
|
88999
|
-
import {
|
|
89000
|
-
import { stat as stat13 } from "node:fs/promises";
|
|
89031
|
+
import { readFile as readFile44, stat as stat13 } from "node:fs/promises";
|
|
89001
89032
|
import { relative as relative16 } from "node:path";
|
|
89002
89033
|
|
|
89003
89034
|
// src/shared/concurrent-file-ops.ts
|
|
@@ -89011,18 +89042,12 @@ async function mapWithLimit(items, fn, concurrency = DEFAULT_CONCURRENCY) {
|
|
|
89011
89042
|
// src/services/file-operations/ownership-checker.ts
|
|
89012
89043
|
class OwnershipChecker {
|
|
89013
89044
|
static async calculateChecksum(filePath) {
|
|
89014
|
-
|
|
89015
|
-
|
|
89016
|
-
|
|
89017
|
-
|
|
89018
|
-
|
|
89019
|
-
|
|
89020
|
-
});
|
|
89021
|
-
stream.on("error", (err) => {
|
|
89022
|
-
stream.destroy();
|
|
89023
|
-
reject(new Error(operationError("Checksum calculation", filePath, err.message)));
|
|
89024
|
-
});
|
|
89025
|
-
});
|
|
89045
|
+
try {
|
|
89046
|
+
return createHash6("sha256").update(await readFile44(filePath)).digest("hex");
|
|
89047
|
+
} catch (err) {
|
|
89048
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
89049
|
+
throw new Error(operationError("Checksum calculation", filePath, message));
|
|
89050
|
+
}
|
|
89026
89051
|
}
|
|
89027
89052
|
static async checkOwnership(filePath, metadata, claudeDir3) {
|
|
89028
89053
|
try {
|
|
@@ -90435,7 +90460,7 @@ class SyncEngine {
|
|
|
90435
90460
|
if (lstats.size > MAX_SYNC_FILE_SIZE) {
|
|
90436
90461
|
throw new Error(`File too large for sync (${Math.round(lstats.size / 1024 / 1024)}MB > ${MAX_SYNC_FILE_SIZE / 1024 / 1024}MB limit)`);
|
|
90437
90462
|
}
|
|
90438
|
-
const buffer = await
|
|
90463
|
+
const buffer = await readFile45(filePath);
|
|
90439
90464
|
if (buffer.includes(0)) {
|
|
90440
90465
|
return { content: "", isBinary: true };
|
|
90441
90466
|
}
|
|
@@ -101777,7 +101802,7 @@ import { dirname as dirname35, join as join109 } from "node:path";
|
|
|
101777
101802
|
// src/domains/config/installed-settings-tracker.ts
|
|
101778
101803
|
init_shared();
|
|
101779
101804
|
import { existsSync as existsSync63 } from "node:fs";
|
|
101780
|
-
import { mkdir as mkdir31, readFile as
|
|
101805
|
+
import { mkdir as mkdir31, readFile as readFile49, writeFile as writeFile24 } from "node:fs/promises";
|
|
101781
101806
|
import { dirname as dirname34, join as join108 } from "node:path";
|
|
101782
101807
|
var CK_JSON_FILE = ".ck.json";
|
|
101783
101808
|
|
|
@@ -101802,7 +101827,7 @@ class InstalledSettingsTracker {
|
|
|
101802
101827
|
return { hooks: [], mcpServers: [] };
|
|
101803
101828
|
}
|
|
101804
101829
|
try {
|
|
101805
|
-
const content = await
|
|
101830
|
+
const content = await readFile49(ckJsonPath, "utf-8");
|
|
101806
101831
|
const data = JSON.parse(content);
|
|
101807
101832
|
const installed = data.kits?.[this.kitName]?.installedSettings;
|
|
101808
101833
|
if (installed) {
|
|
@@ -101819,7 +101844,7 @@ class InstalledSettingsTracker {
|
|
|
101819
101844
|
try {
|
|
101820
101845
|
let data = {};
|
|
101821
101846
|
if (existsSync63(ckJsonPath)) {
|
|
101822
|
-
const content = await
|
|
101847
|
+
const content = await readFile49(ckJsonPath, "utf-8");
|
|
101823
101848
|
data = JSON.parse(content);
|
|
101824
101849
|
}
|
|
101825
101850
|
if (!data.kits) {
|
|
@@ -103395,7 +103420,7 @@ import { join as join117 } from "node:path";
|
|
|
103395
103420
|
|
|
103396
103421
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
103397
103422
|
init_logger();
|
|
103398
|
-
import { readFile as
|
|
103423
|
+
import { readFile as readFile53, readdir as readdir29, writeFile as writeFile28 } from "node:fs/promises";
|
|
103399
103424
|
import { join as join116 } from "node:path";
|
|
103400
103425
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
103401
103426
|
".md",
|
|
@@ -103464,7 +103489,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
103464
103489
|
await processDirectory(fullPath);
|
|
103465
103490
|
} else if (entry.isFile() && shouldTransformFile(entry.name)) {
|
|
103466
103491
|
try {
|
|
103467
|
-
const content = await
|
|
103492
|
+
const content = await readFile53(fullPath, "utf-8");
|
|
103468
103493
|
const { transformed, changes } = transformCommandContent(content);
|
|
103469
103494
|
if (changes > 0) {
|
|
103470
103495
|
if (options2.dryRun) {
|
|
@@ -104001,7 +104026,7 @@ init_skip_directories();
|
|
|
104001
104026
|
init_types3();
|
|
104002
104027
|
var import_fs_extra24 = __toESM(require_lib(), 1);
|
|
104003
104028
|
import { createHash as createHash7 } from "node:crypto";
|
|
104004
|
-
import { readFile as
|
|
104029
|
+
import { readFile as readFile55, readdir as readdir33, writeFile as writeFile29 } from "node:fs/promises";
|
|
104005
104030
|
import { join as join121, relative as relative25 } from "node:path";
|
|
104006
104031
|
|
|
104007
104032
|
class SkillsManifestManager {
|
|
@@ -104035,7 +104060,7 @@ class SkillsManifestManager {
|
|
|
104035
104060
|
return null;
|
|
104036
104061
|
}
|
|
104037
104062
|
try {
|
|
104038
|
-
const content = await
|
|
104063
|
+
const content = await readFile55(manifestPath, "utf-8");
|
|
104039
104064
|
const data = JSON.parse(content);
|
|
104040
104065
|
const manifest = SkillsManifestSchema.parse(data);
|
|
104041
104066
|
logger.debug(`Read manifest from: ${manifestPath}`);
|
|
@@ -104107,7 +104132,7 @@ class SkillsManifestManager {
|
|
|
104107
104132
|
files.sort();
|
|
104108
104133
|
for (const file of files) {
|
|
104109
104134
|
const relativePath = relative25(dirPath, file);
|
|
104110
|
-
const content = await
|
|
104135
|
+
const content = await readFile55(file);
|
|
104111
104136
|
hash.update(relativePath);
|
|
104112
104137
|
hash.update(content);
|
|
104113
104138
|
}
|
|
@@ -104846,8 +104871,8 @@ import { relative as relative27 } from "node:path";
|
|
|
104846
104871
|
// src/domains/skills/customization/hash-calculator.ts
|
|
104847
104872
|
init_skip_directories();
|
|
104848
104873
|
import { createHash as createHash8 } from "node:crypto";
|
|
104849
|
-
import { createReadStream as
|
|
104850
|
-
import { readFile as
|
|
104874
|
+
import { createReadStream as createReadStream2 } from "node:fs";
|
|
104875
|
+
import { readFile as readFile56, readdir as readdir37 } from "node:fs/promises";
|
|
104851
104876
|
import { join as join125, relative as relative26 } from "node:path";
|
|
104852
104877
|
async function getAllFiles(dirPath) {
|
|
104853
104878
|
const files = [];
|
|
@@ -104869,7 +104894,7 @@ async function getAllFiles(dirPath) {
|
|
|
104869
104894
|
async function hashFile(filePath) {
|
|
104870
104895
|
return new Promise((resolve40, reject) => {
|
|
104871
104896
|
const hash = createHash8("sha256");
|
|
104872
|
-
const stream =
|
|
104897
|
+
const stream = createReadStream2(filePath);
|
|
104873
104898
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
104874
104899
|
stream.on("end", () => {
|
|
104875
104900
|
resolve40(hash.digest("hex"));
|
|
@@ -104886,7 +104911,7 @@ async function hashDirectory(dirPath) {
|
|
|
104886
104911
|
files.sort();
|
|
104887
104912
|
for (const file of files) {
|
|
104888
104913
|
const relativePath = relative26(dirPath, file);
|
|
104889
|
-
const content = await
|
|
104914
|
+
const content = await readFile56(file);
|
|
104890
104915
|
hash.update(relativePath);
|
|
104891
104916
|
hash.update(content);
|
|
104892
104917
|
}
|
|
@@ -105220,7 +105245,7 @@ import { join as join130 } from "node:path";
|
|
|
105220
105245
|
|
|
105221
105246
|
// src/services/transformers/opencode-path-transformer.ts
|
|
105222
105247
|
init_logger();
|
|
105223
|
-
import { readFile as
|
|
105248
|
+
import { readFile as readFile57, readdir as readdir39, writeFile as writeFile30 } from "node:fs/promises";
|
|
105224
105249
|
import { platform as platform14 } from "node:os";
|
|
105225
105250
|
import { extname as extname5, join as join129 } from "node:path";
|
|
105226
105251
|
var IS_WINDOWS2 = platform14() === "win32";
|
|
@@ -105291,7 +105316,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
105291
105316
|
await processDirectory2(fullPath);
|
|
105292
105317
|
} else if (entry.isFile() && shouldTransformFile2(entry.name)) {
|
|
105293
105318
|
try {
|
|
105294
|
-
const content = await
|
|
105319
|
+
const content = await readFile57(fullPath, "utf-8");
|
|
105295
105320
|
const { transformed, changes } = transformOpenCodeContent(content);
|
|
105296
105321
|
if (changes > 0) {
|
|
105297
105322
|
await writeFile30(fullPath, transformed, "utf-8");
|
|
@@ -106317,7 +106342,7 @@ async function handleSelection(ctx) {
|
|
|
106317
106342
|
};
|
|
106318
106343
|
}
|
|
106319
106344
|
// src/commands/init/phases/sync-handler.ts
|
|
106320
|
-
import { copyFile as copyFile8, mkdir as mkdir36, open as open5, readFile as
|
|
106345
|
+
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";
|
|
106321
106346
|
import { dirname as dirname38, join as join134, resolve as resolve43 } from "node:path";
|
|
106322
106347
|
init_logger();
|
|
106323
106348
|
init_path_resolver();
|
|
@@ -106485,7 +106510,7 @@ async function executeSyncMerge(ctx) {
|
|
|
106485
106510
|
try {
|
|
106486
106511
|
const sourceMetadataPath = join134(upstreamDir, "metadata.json");
|
|
106487
106512
|
if (await import_fs_extra36.pathExists(sourceMetadataPath)) {
|
|
106488
|
-
const content = await
|
|
106513
|
+
const content = await readFile58(sourceMetadataPath, "utf-8");
|
|
106489
106514
|
const sourceMetadata = JSON.parse(content);
|
|
106490
106515
|
deletions = sourceMetadata.deletions || [];
|
|
106491
106516
|
}
|
|
@@ -106783,7 +106808,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
106783
106808
|
// src/services/transformers/folder-transform/path-replacer.ts
|
|
106784
106809
|
init_logger();
|
|
106785
106810
|
init_types3();
|
|
106786
|
-
import { readFile as
|
|
106811
|
+
import { readFile as readFile59, readdir as readdir41, writeFile as writeFile33 } from "node:fs/promises";
|
|
106787
106812
|
import { join as join136, relative as relative29 } from "node:path";
|
|
106788
106813
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
106789
106814
|
".md",
|
|
@@ -106850,7 +106875,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
106850
106875
|
if (!shouldTransform)
|
|
106851
106876
|
continue;
|
|
106852
106877
|
try {
|
|
106853
|
-
const content = await
|
|
106878
|
+
const content = await readFile59(fullPath, "utf-8");
|
|
106854
106879
|
let newContent = content;
|
|
106855
106880
|
let changeCount = 0;
|
|
106856
106881
|
for (const { regex: regex2, replacement } of compiledReplacements) {
|
|
@@ -106972,7 +106997,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
106972
106997
|
|
|
106973
106998
|
// src/services/transformers/global-path-transformer.ts
|
|
106974
106999
|
init_logger();
|
|
106975
|
-
import { readFile as
|
|
107000
|
+
import { readFile as readFile60, readdir as readdir42, writeFile as writeFile34 } from "node:fs/promises";
|
|
106976
107001
|
import { homedir as homedir46, platform as platform15 } from "node:os";
|
|
106977
107002
|
import { extname as extname6, join as join137 } from "node:path";
|
|
106978
107003
|
var IS_WINDOWS3 = platform15() === "win32";
|
|
@@ -107123,7 +107148,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
107123
107148
|
await processDirectory2(fullPath);
|
|
107124
107149
|
} else if (entry.isFile() && shouldTransformFile3(entry.name)) {
|
|
107125
107150
|
try {
|
|
107126
|
-
const content = await
|
|
107151
|
+
const content = await readFile60(fullPath, "utf-8");
|
|
107127
107152
|
const { transformed, changes } = transformContent(content, {
|
|
107128
107153
|
targetClaudeDir: options2.targetClaudeDir
|
|
107129
107154
|
});
|
|
@@ -107384,7 +107409,7 @@ async function initCommand(options2) {
|
|
|
107384
107409
|
init_dist2();
|
|
107385
107410
|
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
107386
107411
|
import { existsSync as existsSync65 } from "node:fs";
|
|
107387
|
-
import { readFile as
|
|
107412
|
+
import { readFile as readFile64, rm as rm16, unlink as unlink13 } from "node:fs/promises";
|
|
107388
107413
|
import { homedir as homedir51 } from "node:os";
|
|
107389
107414
|
import { basename as basename27, join as join142, resolve as resolve46 } from "node:path";
|
|
107390
107415
|
init_logger();
|
|
@@ -107861,13 +107886,13 @@ init_model_taxonomy();
|
|
|
107861
107886
|
init_logger();
|
|
107862
107887
|
init_dist2();
|
|
107863
107888
|
init_model_taxonomy();
|
|
107864
|
-
import { mkdir as mkdir38, readFile as
|
|
107889
|
+
import { mkdir as mkdir38, readFile as readFile63, writeFile as writeFile36 } from "node:fs/promises";
|
|
107865
107890
|
import { homedir as homedir50 } from "node:os";
|
|
107866
107891
|
import { dirname as dirname39, join as join141 } from "node:path";
|
|
107867
107892
|
|
|
107868
107893
|
// src/commands/portable/models-dev-cache.ts
|
|
107869
107894
|
init_logger();
|
|
107870
|
-
import { mkdir as mkdir37, readFile as
|
|
107895
|
+
import { mkdir as mkdir37, readFile as readFile61, rename as rename12, writeFile as writeFile35 } from "node:fs/promises";
|
|
107871
107896
|
import { homedir as homedir48 } from "node:os";
|
|
107872
107897
|
import { join as join139 } from "node:path";
|
|
107873
107898
|
|
|
@@ -107892,7 +107917,7 @@ function tmpFilePath(cacheDir) {
|
|
|
107892
107917
|
async function readCacheEntry(cacheDir) {
|
|
107893
107918
|
const filePath = cacheFilePath(cacheDir);
|
|
107894
107919
|
try {
|
|
107895
|
-
const raw2 = await
|
|
107920
|
+
const raw2 = await readFile61(filePath, "utf-8");
|
|
107896
107921
|
const parsed = JSON.parse(raw2);
|
|
107897
107922
|
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) {
|
|
107898
107923
|
return parsed;
|
|
@@ -107960,7 +107985,7 @@ async function getModelsDevCatalog(opts = {}) {
|
|
|
107960
107985
|
|
|
107961
107986
|
// src/commands/portable/opencode-model-discovery.ts
|
|
107962
107987
|
init_logger();
|
|
107963
|
-
import { readFile as
|
|
107988
|
+
import { readFile as readFile62 } from "node:fs/promises";
|
|
107964
107989
|
import { homedir as homedir49, platform as platform17 } from "node:os";
|
|
107965
107990
|
import { join as join140 } from "node:path";
|
|
107966
107991
|
function resolveOpenCodeAuthPath(homeDir) {
|
|
@@ -107974,7 +107999,7 @@ function resolveOpenCodeAuthPath(homeDir) {
|
|
|
107974
107999
|
async function readAuthedProviders(homeDir) {
|
|
107975
108000
|
const authPath = resolveOpenCodeAuthPath(homeDir);
|
|
107976
108001
|
try {
|
|
107977
|
-
const raw2 = await
|
|
108002
|
+
const raw2 = await readFile62(authPath, "utf-8");
|
|
107978
108003
|
const parsed = JSON.parse(raw2);
|
|
107979
108004
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
107980
108005
|
return Object.keys(parsed);
|
|
@@ -108176,7 +108201,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
108176
108201
|
const configPath = getOpenCodeConfigPath(options2);
|
|
108177
108202
|
let existing = null;
|
|
108178
108203
|
try {
|
|
108179
|
-
const raw2 = await
|
|
108204
|
+
const raw2 = await readFile63(configPath, "utf-8");
|
|
108180
108205
|
const parsed = JSON.parse(raw2);
|
|
108181
108206
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
108182
108207
|
existing = parsed;
|
|
@@ -109049,7 +109074,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
109049
109074
|
return;
|
|
109050
109075
|
let sourceMetadata;
|
|
109051
109076
|
try {
|
|
109052
|
-
const content = await
|
|
109077
|
+
const content = await readFile64(sourceMetadataPath, "utf-8");
|
|
109053
109078
|
sourceMetadata = JSON.parse(content);
|
|
109054
109079
|
} catch (error) {
|
|
109055
109080
|
logger.debug(`[migrate] Failed to parse source metadata.json: ${error}`);
|
|
@@ -109333,7 +109358,7 @@ async function migrateCommand(options2) {
|
|
|
109333
109358
|
for (const action of conflictActions) {
|
|
109334
109359
|
if (!action.diff && action.targetPath && existsSync65(action.targetPath)) {
|
|
109335
109360
|
try {
|
|
109336
|
-
const targetContent = await
|
|
109361
|
+
const targetContent = await readFile64(action.targetPath, "utf-8");
|
|
109337
109362
|
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);
|
|
109338
109363
|
if (sourceItem) {
|
|
109339
109364
|
const providerConfig = providers[action.provider];
|
|
@@ -111339,7 +111364,7 @@ init_skills_registry();
|
|
|
111339
111364
|
init_skills_uninstaller();
|
|
111340
111365
|
var import_gray_matter12 = __toESM(require_gray_matter(), 1);
|
|
111341
111366
|
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
111342
|
-
import { readFile as
|
|
111367
|
+
import { readFile as readFile65 } from "node:fs/promises";
|
|
111343
111368
|
import { join as join148 } from "node:path";
|
|
111344
111369
|
|
|
111345
111370
|
// src/commands/skills/types.ts
|
|
@@ -111478,7 +111503,7 @@ async function handleValidate2(sourcePath) {
|
|
|
111478
111503
|
for (const skill of skills) {
|
|
111479
111504
|
const skillMdPath = join148(skill.path, "SKILL.md");
|
|
111480
111505
|
try {
|
|
111481
|
-
const content = await
|
|
111506
|
+
const content = await readFile65(skillMdPath, "utf-8");
|
|
111482
111507
|
const { data } = import_gray_matter12.default(content, {
|
|
111483
111508
|
engines: { javascript: { parse: () => ({}) } }
|
|
111484
111509
|
});
|
|
@@ -113994,7 +114019,7 @@ init_ck_config_manager();
|
|
|
113994
114019
|
init_file_io();
|
|
113995
114020
|
init_logger();
|
|
113996
114021
|
import { existsSync as existsSync71 } from "node:fs";
|
|
113997
|
-
import { mkdir as mkdir40, readFile as
|
|
114022
|
+
import { mkdir as mkdir40, readFile as readFile67 } from "node:fs/promises";
|
|
113998
114023
|
import { dirname as dirname46 } from "node:path";
|
|
113999
114024
|
var PROCESSED_ISSUES_CAP = 500;
|
|
114000
114025
|
async function readCkJson(projectDir) {
|
|
@@ -114002,7 +114027,7 @@ async function readCkJson(projectDir) {
|
|
|
114002
114027
|
try {
|
|
114003
114028
|
if (!existsSync71(configPath))
|
|
114004
114029
|
return {};
|
|
114005
|
-
const content = await
|
|
114030
|
+
const content = await readFile67(configPath, "utf-8");
|
|
114006
114031
|
return JSON.parse(content);
|
|
114007
114032
|
} catch (error) {
|
|
114008
114033
|
logger.warning(`Failed to parse .ck.json: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -114714,7 +114739,7 @@ init_types3();
|
|
|
114714
114739
|
init_logger();
|
|
114715
114740
|
init_path_resolver();
|
|
114716
114741
|
import { existsSync as existsSync86 } from "node:fs";
|
|
114717
|
-
import { mkdir as mkdir42, readFile as
|
|
114742
|
+
import { mkdir as mkdir42, readFile as readFile69, writeFile as writeFile41 } from "node:fs/promises";
|
|
114718
114743
|
import { join as join168 } from "node:path";
|
|
114719
114744
|
|
|
114720
114745
|
class VersionCacheManager {
|
|
@@ -114731,7 +114756,7 @@ class VersionCacheManager {
|
|
|
114731
114756
|
logger.debug("Version check cache not found");
|
|
114732
114757
|
return null;
|
|
114733
114758
|
}
|
|
114734
|
-
const content = await
|
|
114759
|
+
const content = await readFile69(cacheFile, "utf-8");
|
|
114735
114760
|
const cache5 = JSON.parse(content);
|
|
114736
114761
|
if (!cache5.lastCheck || !cache5.currentVersion || !cache5.latestVersion) {
|
|
114737
114762
|
logger.debug("Invalid cache structure, ignoring");
|