claudekit-cli 4.0.0-dev.5 → 4.0.0-dev.6
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 +64 -47
- package/package.json +1 -1
package/cli-manifest.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -53903,36 +53903,43 @@ function ensureFlagInFeaturesSection(content, headerStartIdx) {
|
|
|
53903
53903
|
const nextHeaderMatch = /\n\[[^\]]+\]/.exec(rest);
|
|
53904
53904
|
const bodyEnd = nextHeaderMatch ? bodyStart + nextHeaderMatch.index + 1 : content.length;
|
|
53905
53905
|
const body = content.slice(bodyStart, bodyEnd);
|
|
53906
|
-
const
|
|
53907
|
-
const
|
|
53906
|
+
const legacyFlagRegex = new RegExp(`^[ \\t]*${LEGACY_FEATURE_FLAG}[ \\t]*=[ \\t]*(?:true|false)(?:[ \\t]*#[^\\r\\n]*)?[ \\t]*(?:\\r?\\n|$)`, "gm");
|
|
53907
|
+
const cleanedBody = body.replace(legacyFlagRegex, "");
|
|
53908
|
+
const changed = cleanedBody !== body;
|
|
53909
|
+
const flagRegex = new RegExp(`^([ \\t]*${CURRENT_FEATURE_FLAG}[ \\t]*=[ \\t]*)(true|false)([ \\t]*#[^\\r\\n]*)?[ \\t]*$`, "m");
|
|
53910
|
+
const flagMatch = flagRegex.exec(cleanedBody);
|
|
53908
53911
|
if (flagMatch) {
|
|
53909
53912
|
if (flagMatch[2] === "true") {
|
|
53910
|
-
return {
|
|
53913
|
+
return {
|
|
53914
|
+
updated: content.slice(0, bodyStart) + cleanedBody + content.slice(bodyEnd),
|
|
53915
|
+
changed
|
|
53916
|
+
};
|
|
53911
53917
|
}
|
|
53912
|
-
const
|
|
53918
|
+
const newBody2 = cleanedBody.replace(flagRegex, (_m, prefix, _v, trailing) => `${prefix}true${trailing ?? ""}`);
|
|
53913
53919
|
return {
|
|
53914
|
-
updated: content.slice(0, bodyStart) +
|
|
53920
|
+
updated: content.slice(0, bodyStart) + newBody2 + content.slice(bodyEnd),
|
|
53915
53921
|
changed: true
|
|
53916
53922
|
};
|
|
53917
53923
|
}
|
|
53918
53924
|
if (headerLineEnd === -1) {
|
|
53919
53925
|
return { updated: `${content}
|
|
53920
|
-
|
|
53926
|
+
${CURRENT_FEATURE_FLAG} = true
|
|
53921
53927
|
`, changed: true };
|
|
53922
53928
|
}
|
|
53923
|
-
let insertAt =
|
|
53924
|
-
while (insertAt >
|
|
53925
|
-
` &&
|
|
53929
|
+
let insertAt = cleanedBody.length;
|
|
53930
|
+
while (insertAt > 0 && cleanedBody[insertAt - 1] === `
|
|
53931
|
+
` && cleanedBody[insertAt - 2] === `
|
|
53926
53932
|
`) {
|
|
53927
53933
|
insertAt -= 1;
|
|
53928
53934
|
}
|
|
53929
|
-
const needsLeadingNewline = insertAt >
|
|
53935
|
+
const needsLeadingNewline = insertAt > 0 && cleanedBody[insertAt - 1] !== `
|
|
53930
53936
|
`;
|
|
53931
53937
|
const insertion = `${needsLeadingNewline ? `
|
|
53932
|
-
` : ""}
|
|
53938
|
+
` : ""}${CURRENT_FEATURE_FLAG} = true
|
|
53933
53939
|
`;
|
|
53940
|
+
const newBody = cleanedBody.slice(0, insertAt) + insertion + cleanedBody.slice(insertAt);
|
|
53934
53941
|
return {
|
|
53935
|
-
updated: content.slice(0,
|
|
53942
|
+
updated: content.slice(0, bodyStart) + newBody + content.slice(bodyEnd),
|
|
53936
53943
|
changed: true
|
|
53937
53944
|
};
|
|
53938
53945
|
}
|
|
@@ -53976,12 +53983,12 @@ async function atomicWrite(filePath, content) {
|
|
|
53976
53983
|
throw err;
|
|
53977
53984
|
}
|
|
53978
53985
|
}
|
|
53979
|
-
var SENTINEL_START2 = "# --- ck-managed-features-start ---", SENTINEL_END2 = "# --- ck-managed-features-end ---", MANAGED_BLOCK;
|
|
53986
|
+
var SENTINEL_START2 = "# --- ck-managed-features-start ---", SENTINEL_END2 = "# --- ck-managed-features-end ---", CURRENT_FEATURE_FLAG = "hooks", LEGACY_FEATURE_FLAG = "codex_hooks", MANAGED_BLOCK;
|
|
53980
53987
|
var init_codex_features_flag = __esm(() => {
|
|
53981
53988
|
init_codex_path_safety();
|
|
53982
53989
|
MANAGED_BLOCK = `${SENTINEL_START2}
|
|
53983
53990
|
[features]
|
|
53984
|
-
|
|
53991
|
+
${CURRENT_FEATURE_FLAG} = true
|
|
53985
53992
|
${SENTINEL_END2}`;
|
|
53986
53993
|
});
|
|
53987
53994
|
|
|
@@ -62835,7 +62842,7 @@ var package_default;
|
|
|
62835
62842
|
var init_package = __esm(() => {
|
|
62836
62843
|
package_default = {
|
|
62837
62844
|
name: "claudekit-cli",
|
|
62838
|
-
version: "4.0.0-dev.
|
|
62845
|
+
version: "4.0.0-dev.6",
|
|
62839
62846
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
62840
62847
|
type: "module",
|
|
62841
62848
|
repository: {
|
|
@@ -107560,12 +107567,15 @@ function renderPreflightRow(options2) {
|
|
|
107560
107567
|
const icon = options2.icon ?? context.box.bullet;
|
|
107561
107568
|
const label = padVisible(options2.label, 10);
|
|
107562
107569
|
const count = String(options2.count).padStart(3, " ");
|
|
107563
|
-
const prefix = ` [${icon}] ${label} ${count}
|
|
107564
|
-
const
|
|
107570
|
+
const prefix = ` [${icon}] ${label} ${count} `;
|
|
107571
|
+
const flowPrefix = `${" ".repeat(prefix.length)}-> `;
|
|
107572
|
+
const availableWidth = Math.max(10, context.width - flowPrefix.length);
|
|
107565
107573
|
const [firstDestination, ...extraDestinations] = options2.destinations.length > 0 ? options2.destinations : ["unsupported for selected provider(s)"];
|
|
107566
|
-
const
|
|
107574
|
+
const source = options2.source ? `from ${options2.source}` : "from source unavailable";
|
|
107575
|
+
const lines = [`${prefix}${truncateMiddle(source, Math.max(10, context.width - prefix.length))}`];
|
|
107576
|
+
lines.push(`${flowPrefix}${truncateMiddle(firstDestination, availableWidth)}`);
|
|
107567
107577
|
for (const destination of extraDestinations) {
|
|
107568
|
-
lines.push(`${
|
|
107578
|
+
lines.push(`${flowPrefix}${truncateMiddle(destination, availableWidth)}`);
|
|
107569
107579
|
}
|
|
107570
107580
|
for (const note2 of options2.notes ?? []) {
|
|
107571
107581
|
lines.push(`${" ".repeat(prefix.length)}${paint(`(${note2})`, "muted", context)}`);
|
|
@@ -108583,6 +108593,13 @@ var PORTABLE_TYPES = [
|
|
|
108583
108593
|
{ key: "hooks", label: "Hooks" }
|
|
108584
108594
|
];
|
|
108585
108595
|
var MERGE_STRATEGIES = new Set(["merge-single", "yaml-merge", "json-merge"]);
|
|
108596
|
+
var DISCOVERY_NOUNS = {
|
|
108597
|
+
Agents: "agent",
|
|
108598
|
+
Commands: "command",
|
|
108599
|
+
Hooks: "hook",
|
|
108600
|
+
Rules: "rule",
|
|
108601
|
+
Skills: "skill"
|
|
108602
|
+
};
|
|
108586
108603
|
function buildPreflightRows(counts, selectedProviders, options2) {
|
|
108587
108604
|
return PORTABLE_TYPES.flatMap(({ key, label }) => {
|
|
108588
108605
|
const count = counts[key];
|
|
@@ -108628,7 +108645,8 @@ function buildPreflightRows(counts, selectedProviders, options2) {
|
|
|
108628
108645
|
count,
|
|
108629
108646
|
destinations: Array.from(destinations.keys()),
|
|
108630
108647
|
label,
|
|
108631
|
-
notes: Array.from(notes)
|
|
108648
|
+
notes: Array.from(notes),
|
|
108649
|
+
source: options2.sourceDisplays?.[key]
|
|
108632
108650
|
}
|
|
108633
108651
|
];
|
|
108634
108652
|
});
|
|
@@ -108638,10 +108656,15 @@ function buildTargetSummaryLines(rows) {
|
|
|
108638
108656
|
if (allDestinations.length === 0) {
|
|
108639
108657
|
return ["No compatible destination found for the selected providers"];
|
|
108640
108658
|
}
|
|
108641
|
-
|
|
108642
|
-
|
|
108643
|
-
|
|
108644
|
-
return
|
|
108659
|
+
return allDestinations;
|
|
108660
|
+
}
|
|
108661
|
+
function buildDiscoverySummaryLines(rows) {
|
|
108662
|
+
return rows.map((row) => {
|
|
108663
|
+
const noun = DISCOVERY_NOUNS[row.label] ?? row.label.toLowerCase();
|
|
108664
|
+
const count = row.label === "Config" ? "config" : `${row.count} ${noun}${row.count === 1 ? "" : "s"}`;
|
|
108665
|
+
const source = row.source ? ` <- ${row.source}` : "";
|
|
108666
|
+
return `${row.label.padEnd(8)} ${count}${source}`;
|
|
108667
|
+
});
|
|
108645
108668
|
}
|
|
108646
108669
|
function buildProviderScopeSubtitle(selectedProviders, requestedGlobal, counts) {
|
|
108647
108670
|
const activeTypes = PORTABLE_TYPES.filter(({ key }) => !counts || counts[key] > 0);
|
|
@@ -109087,33 +109110,22 @@ async function migrateCommand(options2) {
|
|
|
109087
109110
|
rulesSourcePath,
|
|
109088
109111
|
hooksSource
|
|
109089
109112
|
].filter((origin) => origin !== null);
|
|
109090
|
-
const preflightRows = buildPreflightRows(sourceCounts, selectedProviders, {
|
|
109091
|
-
requestedGlobal
|
|
109092
|
-
});
|
|
109093
|
-
const discoveryParts = [];
|
|
109094
109113
|
const agentSourceDisplay = agentSource ? formatDisplayPath(agentSource) : "source unavailable";
|
|
109095
109114
|
const commandSourceDisplay = commandSource ? formatDisplayPath(commandSource) : "source unavailable";
|
|
109096
109115
|
const skillSourceDisplay = skillSource ? formatDisplayPath(skillSource) : "source unavailable";
|
|
109097
109116
|
const rulesSourceDisplay = rulesSourcePath ? formatDisplayPath(rulesSourcePath) : "source unavailable";
|
|
109098
109117
|
const hooksSourceDisplay = hooksSource ? formatDisplayPath(hooksSource) : "source unavailable";
|
|
109099
|
-
|
|
109100
|
-
|
|
109101
|
-
|
|
109102
|
-
|
|
109103
|
-
|
|
109104
|
-
|
|
109105
|
-
|
|
109106
|
-
|
|
109107
|
-
|
|
109108
|
-
|
|
109109
|
-
|
|
109110
|
-
}
|
|
109111
|
-
if (ruleItems.length > 0) {
|
|
109112
|
-
discoveryParts.push(`${ruleItems.length} rule(s) ${import_picocolors30.default.dim(`<- ${rulesSourceDisplay}`)}`);
|
|
109113
|
-
}
|
|
109114
|
-
if (hookItems.length > 0) {
|
|
109115
|
-
discoveryParts.push(`${hookItems.length} hook(s) ${import_picocolors30.default.dim(`<- ${hooksSourceDisplay}`)}`);
|
|
109116
|
-
}
|
|
109118
|
+
const preflightRows = buildPreflightRows(sourceCounts, selectedProviders, {
|
|
109119
|
+
requestedGlobal,
|
|
109120
|
+
sourceDisplays: {
|
|
109121
|
+
agents: agentSourceDisplay,
|
|
109122
|
+
commands: commandSourceDisplay,
|
|
109123
|
+
config: configItem ? formatDisplayPath(configItem.sourcePath) : undefined,
|
|
109124
|
+
hooks: hooksSourceDisplay,
|
|
109125
|
+
rules: rulesSourceDisplay,
|
|
109126
|
+
skills: skillSourceDisplay
|
|
109127
|
+
}
|
|
109128
|
+
});
|
|
109117
109129
|
console.log();
|
|
109118
109130
|
console.log(renderSourceTargetHeader({
|
|
109119
109131
|
sourceLines: buildSourceSummaryLines(sourceCounts, sourceOrigins),
|
|
@@ -109123,7 +109135,12 @@ async function migrateCommand(options2) {
|
|
|
109123
109135
|
}).join(`
|
|
109124
109136
|
`));
|
|
109125
109137
|
f2.info(import_picocolors30.default.dim(` CWD: ${process.cwd()}`));
|
|
109126
|
-
|
|
109138
|
+
console.log();
|
|
109139
|
+
console.log(renderPanel({
|
|
109140
|
+
title: "Found",
|
|
109141
|
+
zones: [{ label: "ITEMS", lines: buildDiscoverySummaryLines(preflightRows) }]
|
|
109142
|
+
}).join(`
|
|
109143
|
+
`));
|
|
109127
109144
|
console.log();
|
|
109128
109145
|
f2.step(import_picocolors30.default.bold("Migrate Summary"));
|
|
109129
109146
|
const providerNames = selectedProviders.map((prov) => import_picocolors30.default.cyan(providers[prov].displayName)).join(", ");
|