claudekit-cli 3.36.0-dev.14 → 3.36.0-dev.16
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 +110 -3
- 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,62 @@ 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
|
+
const existing = await readFile3(configTomlPath, "utf-8");
|
|
12976
|
+
const managedEntries = extractManagedAgentEntries(existing);
|
|
12977
|
+
if (managedEntries.size === 0)
|
|
12978
|
+
return [];
|
|
12979
|
+
const staleSlugs = [];
|
|
12980
|
+
const validEntries = new Map;
|
|
12981
|
+
for (const [slug, entry] of managedEntries) {
|
|
12982
|
+
const tomlPath = join3(agentsDir, `${slug}.toml`);
|
|
12983
|
+
if (existsSync3(tomlPath)) {
|
|
12984
|
+
validEntries.set(slug, entry);
|
|
12985
|
+
} else {
|
|
12986
|
+
staleSlugs.push(slug);
|
|
12987
|
+
}
|
|
12988
|
+
}
|
|
12989
|
+
if (staleSlugs.length === 0)
|
|
12990
|
+
return [];
|
|
12991
|
+
if (validEntries.size === 0) {
|
|
12992
|
+
const analysis = analyzeConfigToml(existing);
|
|
12993
|
+
await writeFile2(configTomlPath, analysis.unmanagedContent, "utf-8");
|
|
12994
|
+
} else {
|
|
12995
|
+
const sortedEntries = [...validEntries.entries()].sort(([a3], [b3]) => a3.localeCompare(b3)).map(([, entry]) => entry);
|
|
12996
|
+
const managedBlock = sortedEntries.join(`
|
|
12997
|
+
|
|
12998
|
+
`);
|
|
12999
|
+
const mergeResult = mergeConfigTomlWithDiagnostics(existing, managedBlock);
|
|
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");
|
|
13005
|
+
}
|
|
13006
|
+
logger.verbose(`[codex-cleanup] Removed ${staleSlugs.length} stale config.toml entries: ${staleSlugs.join(", ")}`);
|
|
13007
|
+
return staleSlugs;
|
|
13008
|
+
});
|
|
13009
|
+
} catch (error) {
|
|
13010
|
+
logger.verbose(`[codex-cleanup] Failed to clean up config.toml: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
13011
|
+
return [];
|
|
13012
|
+
}
|
|
13013
|
+
}
|
|
12937
13014
|
var import_proper_lockfile2, SENTINEL_START = "# --- ck-managed-agents-start ---", SENTINEL_END = "# --- ck-managed-agents-end ---", MAX_WINDOWS_PATH_LENGTH = 240;
|
|
12938
13015
|
var init_codex_toml_installer = __esm(() => {
|
|
13016
|
+
init_logger();
|
|
12939
13017
|
init_checksum_utils();
|
|
12940
13018
|
init_fm_to_codex_toml();
|
|
12941
13019
|
init_converters();
|
|
@@ -51604,7 +51682,8 @@ async function discoverMigrationItems(include, configSource) {
|
|
|
51604
51682
|
configSourcePath ? discoverConfig(configSourcePath) : Promise.resolve(null),
|
|
51605
51683
|
rulesSourcePath ? discoverRules(rulesSourcePath) : Promise.resolve([]),
|
|
51606
51684
|
hooksSource ? discoverHooks(hooksSource).then(({ items, skippedShellHooks }) => {
|
|
51607
|
-
if (skippedShellHooks.length > 0) {
|
|
51685
|
+
if (skippedShellHooks.length > 0 && !shellHookWarningShown) {
|
|
51686
|
+
shellHookWarningShown = true;
|
|
51608
51687
|
console.warn(`[migrate] Skipping ${skippedShellHooks.length} shell hook(s) not supported for migration (node-runnable only): ${skippedShellHooks.join(", ")}`);
|
|
51609
51688
|
}
|
|
51610
51689
|
return items;
|
|
@@ -52253,7 +52332,7 @@ function registerMigrationRoutes(app) {
|
|
|
52253
52332
|
}
|
|
52254
52333
|
});
|
|
52255
52334
|
}
|
|
52256
|
-
var MIGRATION_TYPES, MAX_PROVIDER_COUNT = 20, MAX_PLAN_ACTIONS = 5000, ALLOWED_CONFIG_SOURCE_KEYS, CONFLICT_RESOLUTION_SCHEMA, RECONCILE_ACTION_SCHEMA, RECONCILE_PLAN_SCHEMA, PLAN_EXECUTE_PAYLOAD_SCHEMA, PLURAL_TO_SINGULAR;
|
|
52335
|
+
var MIGRATION_TYPES, MAX_PROVIDER_COUNT = 20, MAX_PLAN_ACTIONS = 5000, ALLOWED_CONFIG_SOURCE_KEYS, CONFLICT_RESOLUTION_SCHEMA, RECONCILE_ACTION_SCHEMA, RECONCILE_PLAN_SCHEMA, PLAN_EXECUTE_PAYLOAD_SCHEMA, PLURAL_TO_SINGULAR, shellHookWarningShown = false;
|
|
52257
52336
|
var init_migration_routes = __esm(() => {
|
|
52258
52337
|
init_agents_discovery();
|
|
52259
52338
|
init_commands_discovery();
|
|
@@ -56008,7 +56087,7 @@ var package_default;
|
|
|
56008
56087
|
var init_package = __esm(() => {
|
|
56009
56088
|
package_default = {
|
|
56010
56089
|
name: "claudekit-cli",
|
|
56011
|
-
version: "3.36.0-dev.
|
|
56090
|
+
version: "3.36.0-dev.16",
|
|
56012
56091
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
56013
56092
|
type: "module",
|
|
56014
56093
|
repository: {
|
|
@@ -92343,6 +92422,7 @@ init_logger();
|
|
|
92343
92422
|
init_agents_discovery();
|
|
92344
92423
|
init_commands_discovery();
|
|
92345
92424
|
init_checksum_utils();
|
|
92425
|
+
init_codex_toml_installer();
|
|
92346
92426
|
init_config_discovery();
|
|
92347
92427
|
|
|
92348
92428
|
// src/commands/portable/conflict-resolver.ts
|
|
@@ -92664,6 +92744,7 @@ function displayMigrationSummary(plan, results, options2) {
|
|
|
92664
92744
|
|
|
92665
92745
|
// src/commands/migrate/migrate-command.ts
|
|
92666
92746
|
init_portable_installer();
|
|
92747
|
+
init_portable_manifest();
|
|
92667
92748
|
init_portable_registry();
|
|
92668
92749
|
init_provider_registry();
|
|
92669
92750
|
init_reconciler();
|
|
@@ -93165,6 +93246,32 @@ async function migrateCommand(options2) {
|
|
|
93165
93246
|
}
|
|
93166
93247
|
}
|
|
93167
93248
|
}
|
|
93249
|
+
for (const provider of selectedProviders) {
|
|
93250
|
+
const providerConfig = providers[provider];
|
|
93251
|
+
if (providerConfig.agents?.writeStrategy !== "codex-toml")
|
|
93252
|
+
continue;
|
|
93253
|
+
const staleSlugs = await cleanupStaleCodexConfigEntries({
|
|
93254
|
+
global: installGlobally,
|
|
93255
|
+
provider
|
|
93256
|
+
});
|
|
93257
|
+
if (staleSlugs.length > 0) {
|
|
93258
|
+
const staleSlugSet = new Set(staleSlugs.map((s) => `${s}.toml`));
|
|
93259
|
+
const removed = await removeInstallationsByFilter((i) => i.type === "agent" && i.provider === provider && i.global === installGlobally && staleSlugSet.has(basename16(i.path)));
|
|
93260
|
+
for (const entry of removed) {
|
|
93261
|
+
logger.verbose(`[migrate] Cleaned stale registry entry: ${entry.item} (${provider})`);
|
|
93262
|
+
}
|
|
93263
|
+
}
|
|
93264
|
+
}
|
|
93265
|
+
try {
|
|
93266
|
+
const kitRoot = (agentSource ? resolve24(agentSource, "..") : null) ?? (commandSource ? resolve24(commandSource, "..") : null) ?? (skillSource ? resolve24(skillSource, "..") : null) ?? null;
|
|
93267
|
+
const manifest = kitRoot ? await loadPortableManifest(kitRoot) : null;
|
|
93268
|
+
if (manifest?.cliVersion) {
|
|
93269
|
+
await updateAppliedManifestVersion(manifest.cliVersion);
|
|
93270
|
+
logger.verbose(`[migrate] Updated appliedManifestVersion to ${manifest.cliVersion}`);
|
|
93271
|
+
}
|
|
93272
|
+
} catch {
|
|
93273
|
+
logger.debug("[migrate] Failed to update appliedManifestVersion — will retry on next run");
|
|
93274
|
+
}
|
|
93168
93275
|
installSpinner.stop("Migrate complete");
|
|
93169
93276
|
displayMigrationSummary(plan, allResults, { color: useColor });
|
|
93170
93277
|
const failed = allResults.filter((r2) => !r2.success);
|