@cleocode/cleo 2026.5.13 → 2026.5.14
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 +135 -104
- 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 = [];
|
|
@@ -3163,6 +3279,10 @@ var init_renderers = __esm({
|
|
|
3163
3279
|
"brain-plasticity-stats": renderBrainPlasticityStats,
|
|
3164
3280
|
"brain-quality": renderBrainQuality,
|
|
3165
3281
|
"brain-export": renderBrainExport,
|
|
3282
|
+
// Audit subcommand renderers (T1729)
|
|
3283
|
+
"audit-reconstruct": renderAuditReconstruct,
|
|
3284
|
+
// Schema command renderer (T1729)
|
|
3285
|
+
schema: renderSchemaCommand,
|
|
3166
3286
|
// Nexus subcommand renderers (T1720)
|
|
3167
3287
|
"nexus-status": renderNexusStatus,
|
|
3168
3288
|
"nexus-setup": renderNexusSetup,
|
|
@@ -31936,6 +32056,7 @@ var archiveStatsCommand = defineCommand({
|
|
|
31936
32056
|
|
|
31937
32057
|
// packages/cleo/src/cli/commands/audit.ts
|
|
31938
32058
|
import { getProjectRoot as getProjectRoot19, reconstructLineage } from "@cleocode/core/internal";
|
|
32059
|
+
init_renderers();
|
|
31939
32060
|
var reconstructCommand = defineCommand({
|
|
31940
32061
|
meta: {
|
|
31941
32062
|
name: "reconstruct",
|
|
@@ -31960,9 +32081,11 @@ var reconstructCommand = defineCommand({
|
|
|
31960
32081
|
async run({ args }) {
|
|
31961
32082
|
const taskId = args["taskId"];
|
|
31962
32083
|
if (!taskId || !/^T\d+$/i.test(taskId)) {
|
|
31963
|
-
|
|
31964
|
-
`
|
|
31965
|
-
|
|
32084
|
+
cliError(
|
|
32085
|
+
`taskId must match /^T\\d+$/ (e.g. T991). Got: ${JSON.stringify(taskId)}`,
|
|
32086
|
+
1,
|
|
32087
|
+
{ name: "E_VALIDATION" },
|
|
32088
|
+
{ operation: "audit.reconstruct" }
|
|
31966
32089
|
);
|
|
31967
32090
|
process.exit(1);
|
|
31968
32091
|
}
|
|
@@ -31977,53 +32100,11 @@ var reconstructCommand = defineCommand({
|
|
|
31977
32100
|
}
|
|
31978
32101
|
}
|
|
31979
32102
|
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
|
-
`);
|
|
32103
|
+
cliOutput(result, {
|
|
32104
|
+
command: "audit-reconstruct",
|
|
32105
|
+
operation: "audit.reconstruct",
|
|
32106
|
+
message: `Lineage for ${result.taskId}`
|
|
32107
|
+
});
|
|
32027
32108
|
}
|
|
32028
32109
|
});
|
|
32029
32110
|
var auditCommand = defineCommand({
|
|
@@ -47899,6 +47980,7 @@ var safestopCommand = defineCommand({
|
|
|
47899
47980
|
// packages/cleo/src/cli/commands/schema.ts
|
|
47900
47981
|
import { describeOperation } from "@cleocode/lafs";
|
|
47901
47982
|
init_registry();
|
|
47983
|
+
init_format_context();
|
|
47902
47984
|
init_renderers();
|
|
47903
47985
|
function resolveOperationDef(operationArg) {
|
|
47904
47986
|
const dotIdx = operationArg.indexOf(".");
|
|
@@ -47913,56 +47995,6 @@ function resolveOperationDef(operationArg) {
|
|
|
47913
47995
|
const operation = operationArg.slice(dotIdx + 1);
|
|
47914
47996
|
return OPERATIONS.find((op) => op.domain === domain && op.operation === operation) ?? null;
|
|
47915
47997
|
}
|
|
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
47998
|
var schemaCommand = defineCommand({
|
|
47967
47999
|
meta: {
|
|
47968
48000
|
name: "schema",
|
|
@@ -47998,6 +48030,9 @@ var schemaCommand = defineCommand({
|
|
|
47998
48030
|
const format = args.format ?? "json";
|
|
47999
48031
|
const includeGates = args["include-gates"] !== false;
|
|
48000
48032
|
const includeExamples = args["include-examples"] === true;
|
|
48033
|
+
if (format === "human") {
|
|
48034
|
+
setFormatContext({ format: "human", source: "flag", quiet: false });
|
|
48035
|
+
}
|
|
48001
48036
|
const def = resolveOperationDef(args.operation);
|
|
48002
48037
|
if (def === null) {
|
|
48003
48038
|
cliError(
|
|
@@ -48015,10 +48050,6 @@ var schemaCommand = defineCommand({
|
|
|
48015
48050
|
includeGates,
|
|
48016
48051
|
includeExamples
|
|
48017
48052
|
});
|
|
48018
|
-
if (format === "human") {
|
|
48019
|
-
console.log(renderSchemaHuman(schema2));
|
|
48020
|
-
return;
|
|
48021
|
-
}
|
|
48022
48053
|
cliOutput(schema2, {
|
|
48023
48054
|
command: "schema",
|
|
48024
48055
|
operation: `schema.${args.operation}`,
|