@cleocode/cleo 2026.5.13 → 2026.5.15
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/cli/index.js +160 -111
- package/dist/cli/index.js.map +2 -2
- package/package.json +9 -9
package/dist/cli/index.js
CHANGED
|
@@ -1976,6 +1976,122 @@ function renderBrainExport(data, quiet) {
|
|
|
1976
1976
|
if (quiet) return String(data["outputFile"] ?? "");
|
|
1977
1977
|
return `${GREEN}Exported to ${data["outputFile"]}:${NC} ${data["nodeCount"]} nodes, ${data["edgeCount"]} edges (${String(data["format"] ?? "").toUpperCase()})`;
|
|
1978
1978
|
}
|
|
1979
|
+
function renderAuditReconstruct(data, quiet) {
|
|
1980
|
+
if (quiet) return "";
|
|
1981
|
+
const taskId = data["taskId"];
|
|
1982
|
+
const directCommits = data["directCommits"] ?? [];
|
|
1983
|
+
const childIdRange = data["childIdRange"];
|
|
1984
|
+
const childCommits = data["childCommits"] ?? {};
|
|
1985
|
+
const releaseTags = data["releaseTags"] ?? [];
|
|
1986
|
+
const inferredChildren = data["inferredChildren"] ?? [];
|
|
1987
|
+
const firstSeenAt = data["firstSeenAt"];
|
|
1988
|
+
const lastSeenAt = data["lastSeenAt"];
|
|
1989
|
+
const lines = [
|
|
1990
|
+
`${BOLD}Lineage for ${taskId ?? "?"}${NC}`,
|
|
1991
|
+
"=".repeat(40),
|
|
1992
|
+
"",
|
|
1993
|
+
`${DIM}Direct commits:${NC} ${directCommits.length}`
|
|
1994
|
+
];
|
|
1995
|
+
for (const c of directCommits) {
|
|
1996
|
+
const sha = typeof c["sha"] === "string" ? c["sha"].slice(0, 10) : "?";
|
|
1997
|
+
const subject = typeof c["subject"] === "string" ? c["subject"] : "";
|
|
1998
|
+
lines.push(` ${CYAN}${sha}${NC} ${subject}`);
|
|
1999
|
+
}
|
|
2000
|
+
lines.push("");
|
|
2001
|
+
if (childIdRange) {
|
|
2002
|
+
lines.push(
|
|
2003
|
+
`${DIM}Inferred children:${NC} ${inferredChildren.join(", ")} (${childIdRange.min} \u2192 ${childIdRange.max})`
|
|
2004
|
+
);
|
|
2005
|
+
} else {
|
|
2006
|
+
lines.push(`${DIM}Inferred children:${NC} none`);
|
|
2007
|
+
}
|
|
2008
|
+
const childEntries = Object.entries(childCommits);
|
|
2009
|
+
if (childEntries.length > 0) {
|
|
2010
|
+
lines.push("");
|
|
2011
|
+
lines.push(`${BOLD}Child commits:${NC}`);
|
|
2012
|
+
for (const [childId, commits] of childEntries) {
|
|
2013
|
+
lines.push(` ${CYAN}${childId}${NC}: ${commits.length} commit(s)`);
|
|
2014
|
+
for (const c of commits) {
|
|
2015
|
+
const sha = typeof c["sha"] === "string" ? c["sha"].slice(0, 10) : "?";
|
|
2016
|
+
const subject = typeof c["subject"] === "string" ? c["subject"] : "";
|
|
2017
|
+
lines.push(` ${DIM}${sha}${NC} ${subject}`);
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
lines.push("");
|
|
2022
|
+
if (releaseTags.length > 0) {
|
|
2023
|
+
lines.push(`${BOLD}Release tags (${releaseTags.length}):${NC}`);
|
|
2024
|
+
for (const t of releaseTags) {
|
|
2025
|
+
const tag = typeof t["tag"] === "string" ? t["tag"] : "?";
|
|
2026
|
+
const sha = typeof t["commitSha"] === "string" ? t["commitSha"].slice(0, 10) : "?";
|
|
2027
|
+
const subject = typeof t["subject"] === "string" ? t["subject"] : "";
|
|
2028
|
+
lines.push(` ${GREEN}${tag}${NC} ${DIM}${sha}${NC} ${subject}`);
|
|
2029
|
+
}
|
|
2030
|
+
} else {
|
|
2031
|
+
lines.push(`${DIM}Release tags:${NC} none found`);
|
|
2032
|
+
}
|
|
2033
|
+
lines.push("");
|
|
2034
|
+
lines.push(`${DIM}First seen:${NC} ${firstSeenAt ?? "n/a"}`);
|
|
2035
|
+
lines.push(`${DIM}Last seen: ${NC} ${lastSeenAt ?? "n/a"}`);
|
|
2036
|
+
return lines.join("\n");
|
|
2037
|
+
}
|
|
2038
|
+
function renderSchemaCommand(data, quiet) {
|
|
2039
|
+
if (quiet) return "";
|
|
2040
|
+
const lines = [];
|
|
2041
|
+
lines.push(`Operation : ${String(data["operation"] ?? "")}`);
|
|
2042
|
+
lines.push(`Gateway : ${String(data["gateway"] ?? "")}`);
|
|
2043
|
+
lines.push(`Description: ${String(data["description"] ?? "")}`);
|
|
2044
|
+
lines.push("");
|
|
2045
|
+
const params = data["params"] ?? [];
|
|
2046
|
+
lines.push("Parameters:");
|
|
2047
|
+
if (params.length === 0) {
|
|
2048
|
+
lines.push(" (none declared)");
|
|
2049
|
+
} else {
|
|
2050
|
+
for (const p of params) {
|
|
2051
|
+
const req = p["required"] ? "[required]" : "[optional]";
|
|
2052
|
+
const enumVal = p["enum"];
|
|
2053
|
+
const enumStr = enumVal ? ` enum: ${enumVal.join(" | ")}` : "";
|
|
2054
|
+
const cli = p["cli"];
|
|
2055
|
+
let cliStr = "";
|
|
2056
|
+
if (cli) {
|
|
2057
|
+
const parts = [];
|
|
2058
|
+
if (cli["positional"]) parts.push("positional");
|
|
2059
|
+
if (cli["short"]) parts.push(`short: ${String(cli["short"])}`);
|
|
2060
|
+
if (cli["flag"]) parts.push(`flag: --${String(cli["flag"])}`);
|
|
2061
|
+
if (parts.length > 0) cliStr = ` cli: ${parts.join(", ")}`;
|
|
2062
|
+
}
|
|
2063
|
+
lines.push(` ${String(p["name"] ?? "")} (${String(p["type"] ?? "")}) ${req}`);
|
|
2064
|
+
lines.push(` ${String(p["description"] ?? "")}${enumStr}${cliStr}`);
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
const gates = data["gates"];
|
|
2068
|
+
if (gates !== void 0) {
|
|
2069
|
+
lines.push("");
|
|
2070
|
+
lines.push("Gates:");
|
|
2071
|
+
if (gates.length === 0) {
|
|
2072
|
+
lines.push(" (none declared \u2014 see note on static gate table)");
|
|
2073
|
+
} else {
|
|
2074
|
+
for (const g of gates) {
|
|
2075
|
+
lines.push(` ${String(g["name"] ?? "")} \u2192 ${String(g["errorCode"] ?? "")}`);
|
|
2076
|
+
lines.push(` ${String(g["description"] ?? "")}`);
|
|
2077
|
+
const triggers = g["triggers"] ?? [];
|
|
2078
|
+
for (const t of triggers) {
|
|
2079
|
+
lines.push(` - ${t}`);
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
const examples = data["examples"];
|
|
2085
|
+
if (examples !== void 0 && examples.length > 0) {
|
|
2086
|
+
lines.push("");
|
|
2087
|
+
lines.push("Examples:");
|
|
2088
|
+
for (const ex of examples) {
|
|
2089
|
+
lines.push(` ${String(ex["command"] ?? "")}`);
|
|
2090
|
+
lines.push(` ${String(ex["description"] ?? "")}`);
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
return lines.join("\n");
|
|
2094
|
+
}
|
|
1979
2095
|
function renderGeneric(data, quiet) {
|
|
1980
2096
|
if (quiet) return "";
|
|
1981
2097
|
const lines = [];
|
|
@@ -2273,6 +2389,21 @@ function renderNexusProjectsClean(data, quiet) {
|
|
|
2273
2389
|
}
|
|
2274
2390
|
return `[nexus] Purged ${purged} project(s). ${remaining} project(s) remaining in registry.`;
|
|
2275
2391
|
}
|
|
2392
|
+
function renderNexusProjectsCleanPreview(data, _quiet) {
|
|
2393
|
+
const matched = Number(data["matched"] ?? 0);
|
|
2394
|
+
const totalCount = Number(data["totalCount"] ?? 0);
|
|
2395
|
+
const samplePaths = data["sample"] ?? [];
|
|
2396
|
+
const lines = [
|
|
2397
|
+
`[nexus] Clean preview \u2014 ${matched} project(s) of ${totalCount} total match criteria:`
|
|
2398
|
+
];
|
|
2399
|
+
if (matched === 0) {
|
|
2400
|
+
lines.push(" (no matches)");
|
|
2401
|
+
} else {
|
|
2402
|
+
for (const p of samplePaths) lines.push(` ${p}`);
|
|
2403
|
+
if (matched > 10) lines.push(` ... and ${matched - 10} more`);
|
|
2404
|
+
}
|
|
2405
|
+
return lines.join("\n");
|
|
2406
|
+
}
|
|
2276
2407
|
function renderNexusRefreshBridge(data, quiet) {
|
|
2277
2408
|
if (quiet) return "";
|
|
2278
2409
|
if (data["written"]) {
|
|
@@ -2995,7 +3126,7 @@ function cliOutput(data, opts) {
|
|
|
2995
3126
|
process.exit(4);
|
|
2996
3127
|
}
|
|
2997
3128
|
if (typeof extracted !== "object" || extracted === null) {
|
|
2998
|
-
|
|
3129
|
+
process.stdout.write(String(extracted) + "\n");
|
|
2999
3130
|
return;
|
|
3000
3131
|
}
|
|
3001
3132
|
if (Array.isArray(extracted)) {
|
|
@@ -3009,7 +3140,7 @@ function cliOutput(data, opts) {
|
|
|
3009
3140
|
const renderer = fieldExtracted ? renderGeneric : renderers[opts.command] ?? renderGeneric;
|
|
3010
3141
|
const text = renderer(normalized, ctx.quiet);
|
|
3011
3142
|
if (text) {
|
|
3012
|
-
|
|
3143
|
+
process.stdout.write(text + "\n");
|
|
3013
3144
|
}
|
|
3014
3145
|
return;
|
|
3015
3146
|
}
|
|
@@ -3077,14 +3208,16 @@ function cliOutput(data, opts) {
|
|
|
3077
3208
|
}
|
|
3078
3209
|
}
|
|
3079
3210
|
}
|
|
3080
|
-
|
|
3211
|
+
process.stdout.write(envelopeString + "\n");
|
|
3081
3212
|
}
|
|
3082
3213
|
function cliError(message, code, details, meta) {
|
|
3083
3214
|
const ctx = getFormatContext();
|
|
3084
3215
|
if (ctx.format === "human") {
|
|
3085
|
-
|
|
3216
|
+
process.stderr.write(`Error: ${message}${code ? ` (${code})` : ""}
|
|
3217
|
+
`);
|
|
3086
3218
|
if (typeof details?.fix === "string") {
|
|
3087
|
-
|
|
3219
|
+
process.stderr.write(`Fix: ${details.fix}
|
|
3220
|
+
`);
|
|
3088
3221
|
}
|
|
3089
3222
|
return;
|
|
3090
3223
|
}
|
|
@@ -3108,7 +3241,7 @@ function cliError(message, code, details, meta) {
|
|
|
3108
3241
|
error: errorObj,
|
|
3109
3242
|
meta: errorMeta
|
|
3110
3243
|
};
|
|
3111
|
-
|
|
3244
|
+
process.stdout.write(JSON.stringify(envelope) + "\n");
|
|
3112
3245
|
}
|
|
3113
3246
|
var renderers;
|
|
3114
3247
|
var init_renderers = __esm({
|
|
@@ -3163,6 +3296,10 @@ var init_renderers = __esm({
|
|
|
3163
3296
|
"brain-plasticity-stats": renderBrainPlasticityStats,
|
|
3164
3297
|
"brain-quality": renderBrainQuality,
|
|
3165
3298
|
"brain-export": renderBrainExport,
|
|
3299
|
+
// Audit subcommand renderers (T1729)
|
|
3300
|
+
"audit-reconstruct": renderAuditReconstruct,
|
|
3301
|
+
// Schema command renderer (T1729)
|
|
3302
|
+
schema: renderSchemaCommand,
|
|
3166
3303
|
// Nexus subcommand renderers (T1720)
|
|
3167
3304
|
"nexus-status": renderNexusStatus,
|
|
3168
3305
|
"nexus-setup": renderNexusSetup,
|
|
@@ -3176,6 +3313,7 @@ var init_renderers = __esm({
|
|
|
3176
3313
|
"nexus-projects-remove": renderNexusProjectsRemove,
|
|
3177
3314
|
"nexus-projects-scan": renderNexusProjectsScan,
|
|
3178
3315
|
"nexus-projects-clean": renderNexusProjectsClean,
|
|
3316
|
+
"nexus-projects-clean-preview": renderNexusProjectsCleanPreview,
|
|
3179
3317
|
"nexus-refresh-bridge": renderNexusRefreshBridge,
|
|
3180
3318
|
"nexus-diff": renderNexusDiff,
|
|
3181
3319
|
"nexus-query": renderNexusQuery,
|
|
@@ -31936,6 +32074,7 @@ var archiveStatsCommand = defineCommand({
|
|
|
31936
32074
|
|
|
31937
32075
|
// packages/cleo/src/cli/commands/audit.ts
|
|
31938
32076
|
import { getProjectRoot as getProjectRoot19, reconstructLineage } from "@cleocode/core/internal";
|
|
32077
|
+
init_renderers();
|
|
31939
32078
|
var reconstructCommand = defineCommand({
|
|
31940
32079
|
meta: {
|
|
31941
32080
|
name: "reconstruct",
|
|
@@ -31960,9 +32099,11 @@ var reconstructCommand = defineCommand({
|
|
|
31960
32099
|
async run({ args }) {
|
|
31961
32100
|
const taskId = args["taskId"];
|
|
31962
32101
|
if (!taskId || !/^T\d+$/i.test(taskId)) {
|
|
31963
|
-
|
|
31964
|
-
`
|
|
31965
|
-
|
|
32102
|
+
cliError(
|
|
32103
|
+
`taskId must match /^T\\d+$/ (e.g. T991). Got: ${JSON.stringify(taskId)}`,
|
|
32104
|
+
1,
|
|
32105
|
+
{ name: "E_VALIDATION" },
|
|
32106
|
+
{ operation: "audit.reconstruct" }
|
|
31966
32107
|
);
|
|
31967
32108
|
process.exit(1);
|
|
31968
32109
|
}
|
|
@@ -31977,53 +32118,11 @@ var reconstructCommand = defineCommand({
|
|
|
31977
32118
|
}
|
|
31978
32119
|
}
|
|
31979
32120
|
const result = await reconstructLineage(taskId, repoRoot);
|
|
31980
|
-
|
|
31981
|
-
|
|
31982
|
-
|
|
31983
|
-
|
|
31984
|
-
}
|
|
31985
|
-
const lines = [
|
|
31986
|
-
`Lineage for ${result.taskId}`,
|
|
31987
|
-
`${"=".repeat(40)}`,
|
|
31988
|
-
"",
|
|
31989
|
-
`Direct commits: ${result.directCommits.length}`
|
|
31990
|
-
];
|
|
31991
|
-
for (const c of result.directCommits) {
|
|
31992
|
-
lines.push(` ${c.sha.slice(0, 10)} ${c.subject}`);
|
|
31993
|
-
}
|
|
31994
|
-
lines.push("");
|
|
31995
|
-
if (result.childIdRange) {
|
|
31996
|
-
lines.push(
|
|
31997
|
-
`Inferred children: ${result.inferredChildren.join(", ")} (${result.childIdRange.min} \u2192 ${result.childIdRange.max})`
|
|
31998
|
-
);
|
|
31999
|
-
} else {
|
|
32000
|
-
lines.push("Inferred children: none");
|
|
32001
|
-
}
|
|
32002
|
-
const childEntries = Object.entries(result.childCommits);
|
|
32003
|
-
if (childEntries.length > 0) {
|
|
32004
|
-
lines.push("");
|
|
32005
|
-
lines.push("Child commits:");
|
|
32006
|
-
for (const [childId, commits] of childEntries) {
|
|
32007
|
-
lines.push(` ${childId}: ${commits.length} commit(s)`);
|
|
32008
|
-
for (const c of commits) {
|
|
32009
|
-
lines.push(` ${c.sha.slice(0, 10)} ${c.subject}`);
|
|
32010
|
-
}
|
|
32011
|
-
}
|
|
32012
|
-
}
|
|
32013
|
-
lines.push("");
|
|
32014
|
-
if (result.releaseTags.length > 0) {
|
|
32015
|
-
lines.push(`Release tags (${result.releaseTags.length}):`);
|
|
32016
|
-
for (const t of result.releaseTags) {
|
|
32017
|
-
lines.push(` ${t.tag} ${t.commitSha.slice(0, 10)} ${t.subject}`);
|
|
32018
|
-
}
|
|
32019
|
-
} else {
|
|
32020
|
-
lines.push("Release tags: none found");
|
|
32021
|
-
}
|
|
32022
|
-
lines.push("");
|
|
32023
|
-
lines.push(`First seen: ${result.firstSeenAt ?? "n/a"}`);
|
|
32024
|
-
lines.push(`Last seen: ${result.lastSeenAt ?? "n/a"}`);
|
|
32025
|
-
process.stdout.write(`${lines.join("\n")}
|
|
32026
|
-
`);
|
|
32121
|
+
cliOutput(result, {
|
|
32122
|
+
command: "audit-reconstruct",
|
|
32123
|
+
operation: "audit.reconstruct",
|
|
32124
|
+
message: `Lineage for ${result.taskId}`
|
|
32125
|
+
});
|
|
32027
32126
|
}
|
|
32028
32127
|
});
|
|
32029
32128
|
var auditCommand = defineCommand({
|
|
@@ -43080,7 +43179,7 @@ var projectsCleanCommand = defineCommand({
|
|
|
43080
43179
|
if (ctx.format !== "json") {
|
|
43081
43180
|
cliOutput(
|
|
43082
43181
|
{ matched: matchCount, totalCount, sample: samplePaths },
|
|
43083
|
-
{ command: "nexus-projects-clean", operation: "nexus.projects.clean" }
|
|
43182
|
+
{ command: "nexus-projects-clean-preview", operation: "nexus.projects.clean" }
|
|
43084
43183
|
);
|
|
43085
43184
|
}
|
|
43086
43185
|
if (matchCount === 0 || dryRun) {
|
|
@@ -47899,6 +47998,7 @@ var safestopCommand = defineCommand({
|
|
|
47899
47998
|
// packages/cleo/src/cli/commands/schema.ts
|
|
47900
47999
|
import { describeOperation } from "@cleocode/lafs";
|
|
47901
48000
|
init_registry();
|
|
48001
|
+
init_format_context();
|
|
47902
48002
|
init_renderers();
|
|
47903
48003
|
function resolveOperationDef(operationArg) {
|
|
47904
48004
|
const dotIdx = operationArg.indexOf(".");
|
|
@@ -47913,56 +48013,6 @@ function resolveOperationDef(operationArg) {
|
|
|
47913
48013
|
const operation = operationArg.slice(dotIdx + 1);
|
|
47914
48014
|
return OPERATIONS.find((op) => op.domain === domain && op.operation === operation) ?? null;
|
|
47915
48015
|
}
|
|
47916
|
-
function renderSchemaHuman(schema2) {
|
|
47917
|
-
const lines = [];
|
|
47918
|
-
lines.push(`Operation : ${schema2.operation}`);
|
|
47919
|
-
lines.push(`Gateway : ${schema2.gateway}`);
|
|
47920
|
-
lines.push(`Description: ${schema2.description}`);
|
|
47921
|
-
lines.push("");
|
|
47922
|
-
lines.push("Parameters:");
|
|
47923
|
-
if (schema2.params.length === 0) {
|
|
47924
|
-
lines.push(" (none declared)");
|
|
47925
|
-
} else {
|
|
47926
|
-
for (const p of schema2.params) {
|
|
47927
|
-
const req = p.required ? "[required]" : "[optional]";
|
|
47928
|
-
const enumStr = p.enum ? ` enum: ${p.enum.join(" | ")}` : "";
|
|
47929
|
-
let cliStr = "";
|
|
47930
|
-
if (p.cli) {
|
|
47931
|
-
const parts = [];
|
|
47932
|
-
if (p.cli.positional) parts.push("positional");
|
|
47933
|
-
if (p.cli.short) parts.push(`short: ${p.cli.short}`);
|
|
47934
|
-
if (p.cli.flag) parts.push(`flag: --${p.cli.flag}`);
|
|
47935
|
-
if (parts.length > 0) cliStr = ` cli: ${parts.join(", ")}`;
|
|
47936
|
-
}
|
|
47937
|
-
lines.push(` ${p.name} (${p.type}) ${req}`);
|
|
47938
|
-
lines.push(` ${p.description}${enumStr}${cliStr}`);
|
|
47939
|
-
}
|
|
47940
|
-
}
|
|
47941
|
-
if (schema2.gates !== void 0) {
|
|
47942
|
-
lines.push("");
|
|
47943
|
-
lines.push("Gates:");
|
|
47944
|
-
if (schema2.gates.length === 0) {
|
|
47945
|
-
lines.push(" (none declared \u2014 see note on static gate table)");
|
|
47946
|
-
} else {
|
|
47947
|
-
for (const g of schema2.gates) {
|
|
47948
|
-
lines.push(` ${g.name} \u2192 ${g.errorCode}`);
|
|
47949
|
-
lines.push(` ${g.description}`);
|
|
47950
|
-
for (const t of g.triggers) {
|
|
47951
|
-
lines.push(` - ${t}`);
|
|
47952
|
-
}
|
|
47953
|
-
}
|
|
47954
|
-
}
|
|
47955
|
-
}
|
|
47956
|
-
if (schema2.examples !== void 0 && schema2.examples.length > 0) {
|
|
47957
|
-
lines.push("");
|
|
47958
|
-
lines.push("Examples:");
|
|
47959
|
-
for (const ex of schema2.examples) {
|
|
47960
|
-
lines.push(` ${ex.command}`);
|
|
47961
|
-
lines.push(` ${ex.description}`);
|
|
47962
|
-
}
|
|
47963
|
-
}
|
|
47964
|
-
return lines.join("\n");
|
|
47965
|
-
}
|
|
47966
48016
|
var schemaCommand = defineCommand({
|
|
47967
48017
|
meta: {
|
|
47968
48018
|
name: "schema",
|
|
@@ -47998,6 +48048,9 @@ var schemaCommand = defineCommand({
|
|
|
47998
48048
|
const format = args.format ?? "json";
|
|
47999
48049
|
const includeGates = args["include-gates"] !== false;
|
|
48000
48050
|
const includeExamples = args["include-examples"] === true;
|
|
48051
|
+
if (format === "human") {
|
|
48052
|
+
setFormatContext({ format: "human", source: "flag", quiet: false });
|
|
48053
|
+
}
|
|
48001
48054
|
const def = resolveOperationDef(args.operation);
|
|
48002
48055
|
if (def === null) {
|
|
48003
48056
|
cliError(
|
|
@@ -48015,10 +48068,6 @@ var schemaCommand = defineCommand({
|
|
|
48015
48068
|
includeGates,
|
|
48016
48069
|
includeExamples
|
|
48017
48070
|
});
|
|
48018
|
-
if (format === "human") {
|
|
48019
|
-
console.log(renderSchemaHuman(schema2));
|
|
48020
|
-
return;
|
|
48021
|
-
}
|
|
48022
48071
|
cliOutput(schema2, {
|
|
48023
48072
|
command: "schema",
|
|
48024
48073
|
operation: `schema.${args.operation}`,
|