claudekit-cli 3.36.0-dev.16 → 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 +83 -28
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12972,39 +12972,64 @@ async function cleanupStaleCodexConfigEntries(options2) {
|
|
|
12972
12972
|
return [];
|
|
12973
12973
|
try {
|
|
12974
12974
|
return await withCodexTargetLock(configTomlPath, async () => {
|
|
12975
|
-
|
|
12976
|
-
const
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
12980
|
-
|
|
12981
|
-
|
|
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) {
|
|
12982
13010
|
const tomlPath = join3(agentsDir, `${slug}.toml`);
|
|
12983
|
-
if (
|
|
12984
|
-
|
|
12985
|
-
|
|
12986
|
-
|
|
13011
|
+
if (!isPathWithinBoundary(tomlPath, agentsDir))
|
|
13012
|
+
continue;
|
|
13013
|
+
if (!existsSync3(tomlPath)) {
|
|
13014
|
+
legacyStaleSlugs.push(slug);
|
|
12987
13015
|
}
|
|
12988
13016
|
}
|
|
12989
|
-
if (
|
|
12990
|
-
|
|
12991
|
-
|
|
12992
|
-
|
|
12993
|
-
|
|
12994
|
-
|
|
12995
|
-
|
|
12996
|
-
const managedBlock = sortedEntries.join(`
|
|
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, `
|
|
12997
13024
|
|
|
12998
13025
|
`);
|
|
12999
|
-
|
|
13000
|
-
if (mergeResult.error) {
|
|
13001
|
-
logger.verbose(`[codex-cleanup] Failed to merge config.toml: ${mergeResult.error}`);
|
|
13002
|
-
return [];
|
|
13003
|
-
}
|
|
13004
|
-
await writeFile2(configTomlPath, mergeResult.content, "utf-8");
|
|
13026
|
+
allStaleSlugs.push(...legacyStaleSlugs);
|
|
13005
13027
|
}
|
|
13006
|
-
|
|
13007
|
-
|
|
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;
|
|
13008
13033
|
});
|
|
13009
13034
|
} catch (error) {
|
|
13010
13035
|
logger.verbose(`[codex-cleanup] Failed to clean up config.toml: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -52161,6 +52186,35 @@ function registerMigrationRoutes(app) {
|
|
|
52161
52186
|
deleteResult.itemName = deleteAction.item;
|
|
52162
52187
|
allResults.push(deleteResult);
|
|
52163
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 {}
|
|
52164
52218
|
const sortedResults2 = sortPortableInstallResults(allResults);
|
|
52165
52219
|
const counts2 = toExecutionCounts(sortedResults2);
|
|
52166
52220
|
const planScopes = [
|
|
@@ -52338,6 +52392,7 @@ var init_migration_routes = __esm(() => {
|
|
|
52338
52392
|
init_commands_discovery();
|
|
52339
52393
|
init_skill_directory_installer();
|
|
52340
52394
|
init_checksum_utils();
|
|
52395
|
+
init_codex_toml_installer();
|
|
52341
52396
|
init_config_discovery();
|
|
52342
52397
|
init_hooks_settings_merger();
|
|
52343
52398
|
init_portable_installer();
|
|
@@ -56087,7 +56142,7 @@ var package_default;
|
|
|
56087
56142
|
var init_package = __esm(() => {
|
|
56088
56143
|
package_default = {
|
|
56089
56144
|
name: "claudekit-cli",
|
|
56090
|
-
version: "3.36.0-dev.
|
|
56145
|
+
version: "3.36.0-dev.17",
|
|
56091
56146
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
56092
56147
|
type: "module",
|
|
56093
56148
|
repository: {
|