claudekit-cli 3.36.0-dev.15 → 3.36.0-dev.17
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/dist/index.js +162 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12378,6 +12378,30 @@ function findPortableInstallations(registry, item, type, provider, global2) {
|
|
|
12378
12378
|
return true;
|
|
12379
12379
|
});
|
|
12380
12380
|
}
|
|
12381
|
+
async function updateAppliedManifestVersion(version) {
|
|
12382
|
+
await withRegistryLock(async () => {
|
|
12383
|
+
const registry = await readPortableRegistry();
|
|
12384
|
+
registry.appliedManifestVersion = version;
|
|
12385
|
+
await writePortableRegistry(registry);
|
|
12386
|
+
});
|
|
12387
|
+
}
|
|
12388
|
+
async function removeInstallationsByFilter(predicate) {
|
|
12389
|
+
return withRegistryLock(async () => {
|
|
12390
|
+
const registry = await readPortableRegistry();
|
|
12391
|
+
const removed = [];
|
|
12392
|
+
registry.installations = registry.installations.filter((entry) => {
|
|
12393
|
+
if (predicate(entry)) {
|
|
12394
|
+
removed.push(entry);
|
|
12395
|
+
return false;
|
|
12396
|
+
}
|
|
12397
|
+
return true;
|
|
12398
|
+
});
|
|
12399
|
+
if (removed.length > 0) {
|
|
12400
|
+
await writePortableRegistry(registry);
|
|
12401
|
+
}
|
|
12402
|
+
return removed;
|
|
12403
|
+
});
|
|
12404
|
+
}
|
|
12381
12405
|
async function syncPortableRegistry() {
|
|
12382
12406
|
return withRegistryLock(async () => {
|
|
12383
12407
|
const registry = await readPortableRegistry();
|
|
@@ -12934,8 +12958,87 @@ async function installCodexToml(items, provider, portableType, options2) {
|
|
|
12934
12958
|
};
|
|
12935
12959
|
}
|
|
12936
12960
|
}
|
|
12961
|
+
async function cleanupStaleCodexConfigEntries(options2) {
|
|
12962
|
+
const config = providers[options2.provider];
|
|
12963
|
+
const pathConfig = config.agents;
|
|
12964
|
+
if (!pathConfig)
|
|
12965
|
+
return [];
|
|
12966
|
+
const basePath = options2.global ? pathConfig.globalPath : pathConfig.projectPath;
|
|
12967
|
+
if (!basePath)
|
|
12968
|
+
return [];
|
|
12969
|
+
const agentsDir = resolve(basePath);
|
|
12970
|
+
const configTomlPath = join3(dirname2(agentsDir), "config.toml");
|
|
12971
|
+
if (!existsSync3(configTomlPath))
|
|
12972
|
+
return [];
|
|
12973
|
+
try {
|
|
12974
|
+
return await withCodexTargetLock(configTomlPath, async () => {
|
|
12975
|
+
let content = await readFile3(configTomlPath, "utf-8");
|
|
12976
|
+
const allStaleSlugs = [];
|
|
12977
|
+
const managedEntries = extractManagedAgentEntries(content);
|
|
12978
|
+
if (managedEntries.size > 0) {
|
|
12979
|
+
const validEntries = new Map;
|
|
12980
|
+
for (const [slug, entry] of managedEntries) {
|
|
12981
|
+
const tomlPath = join3(agentsDir, `${slug}.toml`);
|
|
12982
|
+
if (existsSync3(tomlPath)) {
|
|
12983
|
+
validEntries.set(slug, entry);
|
|
12984
|
+
} else {
|
|
12985
|
+
allStaleSlugs.push(slug);
|
|
12986
|
+
}
|
|
12987
|
+
}
|
|
12988
|
+
if (allStaleSlugs.length > 0) {
|
|
12989
|
+
if (validEntries.size === 0) {
|
|
12990
|
+
const analysis2 = analyzeConfigToml(content);
|
|
12991
|
+
content = analysis2.unmanagedContent;
|
|
12992
|
+
} else {
|
|
12993
|
+
const sortedEntries = [...validEntries.entries()].sort(([a3], [b3]) => a3.localeCompare(b3)).map(([, entry]) => entry);
|
|
12994
|
+
const managedBlock = sortedEntries.join(`
|
|
12995
|
+
|
|
12996
|
+
`);
|
|
12997
|
+
const mergeResult = mergeConfigTomlWithDiagnostics(content, managedBlock);
|
|
12998
|
+
if (mergeResult.error) {
|
|
12999
|
+
logger.verbose(`[codex-cleanup] Phase 1 merge failed: ${mergeResult.error}`);
|
|
13000
|
+
} else {
|
|
13001
|
+
content = mergeResult.content;
|
|
13002
|
+
}
|
|
13003
|
+
}
|
|
13004
|
+
}
|
|
13005
|
+
}
|
|
13006
|
+
const analysis = analyzeConfigToml(content);
|
|
13007
|
+
const unmanagedSlugs = extractUnmanagedAgentSlugs(analysis.unmanagedContent);
|
|
13008
|
+
const legacyStaleSlugs = [];
|
|
13009
|
+
for (const slug of unmanagedSlugs) {
|
|
13010
|
+
const tomlPath = join3(agentsDir, `${slug}.toml`);
|
|
13011
|
+
if (!isPathWithinBoundary(tomlPath, agentsDir))
|
|
13012
|
+
continue;
|
|
13013
|
+
if (!existsSync3(tomlPath)) {
|
|
13014
|
+
legacyStaleSlugs.push(slug);
|
|
13015
|
+
}
|
|
13016
|
+
}
|
|
13017
|
+
if (legacyStaleSlugs.length > 0) {
|
|
13018
|
+
for (const slug of legacyStaleSlugs) {
|
|
13019
|
+
const escapedSlug = slug.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
13020
|
+
const blockRegex = new RegExp(`\\n?^\\[agents\\.(?:"${escapedSlug}"|${escapedSlug})\\]\\s*\\r?\\n(?:(?!\\[)[^\\r\\n]*\\r?\\n?)*`, "gm");
|
|
13021
|
+
content = content.replace(blockRegex, "");
|
|
13022
|
+
}
|
|
13023
|
+
content = content.replace(/\n{3,}/g, `
|
|
13024
|
+
|
|
13025
|
+
`);
|
|
13026
|
+
allStaleSlugs.push(...legacyStaleSlugs);
|
|
13027
|
+
}
|
|
13028
|
+
if (allStaleSlugs.length === 0)
|
|
13029
|
+
return [];
|
|
13030
|
+
await writeFile2(configTomlPath, content, "utf-8");
|
|
13031
|
+
logger.verbose(`[codex-cleanup] Removed ${allStaleSlugs.length} stale config.toml entries: ${allStaleSlugs.join(", ")}`);
|
|
13032
|
+
return allStaleSlugs;
|
|
13033
|
+
});
|
|
13034
|
+
} catch (error) {
|
|
13035
|
+
logger.verbose(`[codex-cleanup] Failed to clean up config.toml: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
13036
|
+
return [];
|
|
13037
|
+
}
|
|
13038
|
+
}
|
|
12937
13039
|
var import_proper_lockfile2, SENTINEL_START = "# --- ck-managed-agents-start ---", SENTINEL_END = "# --- ck-managed-agents-end ---", MAX_WINDOWS_PATH_LENGTH = 240;
|
|
12938
13040
|
var init_codex_toml_installer = __esm(() => {
|
|
13041
|
+
init_logger();
|
|
12939
13042
|
init_checksum_utils();
|
|
12940
13043
|
init_fm_to_codex_toml();
|
|
12941
13044
|
init_converters();
|
|
@@ -52083,6 +52186,35 @@ function registerMigrationRoutes(app) {
|
|
|
52083
52186
|
deleteResult.itemName = deleteAction.item;
|
|
52084
52187
|
allResults.push(deleteResult);
|
|
52085
52188
|
}
|
|
52189
|
+
for (const provider of allPlanProviders) {
|
|
52190
|
+
if (providers[provider]?.agents?.writeStrategy !== "codex-toml")
|
|
52191
|
+
continue;
|
|
52192
|
+
const providerScopes = [
|
|
52193
|
+
...new Set(plan.actions.filter((a3) => a3.provider === provider).map((a3) => a3.global).filter((g2) => g2 !== undefined))
|
|
52194
|
+
];
|
|
52195
|
+
if (providerScopes.length === 0)
|
|
52196
|
+
providerScopes.push(false);
|
|
52197
|
+
for (const scope of providerScopes) {
|
|
52198
|
+
const staleSlugs = await cleanupStaleCodexConfigEntries({
|
|
52199
|
+
global: scope,
|
|
52200
|
+
provider
|
|
52201
|
+
});
|
|
52202
|
+
if (staleSlugs.length > 0) {
|
|
52203
|
+
const staleSlugSet = new Set(staleSlugs.map((s) => `${s}.toml`));
|
|
52204
|
+
await removeInstallationsByFilter((i) => i.type === "agent" && i.provider === provider && i.global === scope && staleSlugSet.has(basename7(i.path)));
|
|
52205
|
+
}
|
|
52206
|
+
}
|
|
52207
|
+
}
|
|
52208
|
+
try {
|
|
52209
|
+
const agentSrc = getAgentSourcePath();
|
|
52210
|
+
const cmdSrc = getCommandSourcePath();
|
|
52211
|
+
const skillSrc = getSkillSourcePath();
|
|
52212
|
+
const kitRoot = (agentSrc ? resolve8(agentSrc, "..") : null) ?? (cmdSrc ? resolve8(cmdSrc, "..") : null) ?? (skillSrc ? resolve8(skillSrc, "..") : null) ?? null;
|
|
52213
|
+
const manifest = kitRoot ? await loadPortableManifest(kitRoot) : null;
|
|
52214
|
+
if (manifest?.cliVersion) {
|
|
52215
|
+
await updateAppliedManifestVersion(manifest.cliVersion);
|
|
52216
|
+
}
|
|
52217
|
+
} catch {}
|
|
52086
52218
|
const sortedResults2 = sortPortableInstallResults(allResults);
|
|
52087
52219
|
const counts2 = toExecutionCounts(sortedResults2);
|
|
52088
52220
|
const planScopes = [
|
|
@@ -52260,6 +52392,7 @@ var init_migration_routes = __esm(() => {
|
|
|
52260
52392
|
init_commands_discovery();
|
|
52261
52393
|
init_skill_directory_installer();
|
|
52262
52394
|
init_checksum_utils();
|
|
52395
|
+
init_codex_toml_installer();
|
|
52263
52396
|
init_config_discovery();
|
|
52264
52397
|
init_hooks_settings_merger();
|
|
52265
52398
|
init_portable_installer();
|
|
@@ -56009,7 +56142,7 @@ var package_default;
|
|
|
56009
56142
|
var init_package = __esm(() => {
|
|
56010
56143
|
package_default = {
|
|
56011
56144
|
name: "claudekit-cli",
|
|
56012
|
-
version: "3.36.0-dev.
|
|
56145
|
+
version: "3.36.0-dev.17",
|
|
56013
56146
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
56014
56147
|
type: "module",
|
|
56015
56148
|
repository: {
|
|
@@ -92344,6 +92477,7 @@ init_logger();
|
|
|
92344
92477
|
init_agents_discovery();
|
|
92345
92478
|
init_commands_discovery();
|
|
92346
92479
|
init_checksum_utils();
|
|
92480
|
+
init_codex_toml_installer();
|
|
92347
92481
|
init_config_discovery();
|
|
92348
92482
|
|
|
92349
92483
|
// src/commands/portable/conflict-resolver.ts
|
|
@@ -92665,6 +92799,7 @@ function displayMigrationSummary(plan, results, options2) {
|
|
|
92665
92799
|
|
|
92666
92800
|
// src/commands/migrate/migrate-command.ts
|
|
92667
92801
|
init_portable_installer();
|
|
92802
|
+
init_portable_manifest();
|
|
92668
92803
|
init_portable_registry();
|
|
92669
92804
|
init_provider_registry();
|
|
92670
92805
|
init_reconciler();
|
|
@@ -93166,6 +93301,32 @@ async function migrateCommand(options2) {
|
|
|
93166
93301
|
}
|
|
93167
93302
|
}
|
|
93168
93303
|
}
|
|
93304
|
+
for (const provider of selectedProviders) {
|
|
93305
|
+
const providerConfig = providers[provider];
|
|
93306
|
+
if (providerConfig.agents?.writeStrategy !== "codex-toml")
|
|
93307
|
+
continue;
|
|
93308
|
+
const staleSlugs = await cleanupStaleCodexConfigEntries({
|
|
93309
|
+
global: installGlobally,
|
|
93310
|
+
provider
|
|
93311
|
+
});
|
|
93312
|
+
if (staleSlugs.length > 0) {
|
|
93313
|
+
const staleSlugSet = new Set(staleSlugs.map((s) => `${s}.toml`));
|
|
93314
|
+
const removed = await removeInstallationsByFilter((i) => i.type === "agent" && i.provider === provider && i.global === installGlobally && staleSlugSet.has(basename16(i.path)));
|
|
93315
|
+
for (const entry of removed) {
|
|
93316
|
+
logger.verbose(`[migrate] Cleaned stale registry entry: ${entry.item} (${provider})`);
|
|
93317
|
+
}
|
|
93318
|
+
}
|
|
93319
|
+
}
|
|
93320
|
+
try {
|
|
93321
|
+
const kitRoot = (agentSource ? resolve24(agentSource, "..") : null) ?? (commandSource ? resolve24(commandSource, "..") : null) ?? (skillSource ? resolve24(skillSource, "..") : null) ?? null;
|
|
93322
|
+
const manifest = kitRoot ? await loadPortableManifest(kitRoot) : null;
|
|
93323
|
+
if (manifest?.cliVersion) {
|
|
93324
|
+
await updateAppliedManifestVersion(manifest.cliVersion);
|
|
93325
|
+
logger.verbose(`[migrate] Updated appliedManifestVersion to ${manifest.cliVersion}`);
|
|
93326
|
+
}
|
|
93327
|
+
} catch {
|
|
93328
|
+
logger.debug("[migrate] Failed to update appliedManifestVersion — will retry on next run");
|
|
93329
|
+
}
|
|
93169
93330
|
installSpinner.stop("Migrate complete");
|
|
93170
93331
|
displayMigrationSummary(plan, allResults, { color: useColor });
|
|
93171
93332
|
const failed = allResults.filter((r2) => !r2.success);
|