mirror of
https://github.com/morluto/rea.git
synced 2026-11-18 20:53:00 +00:00
fix(cli): use canonical option flags in llms manifests (#11928)
The --llms-full manifest and discovery table rendered raw object keys (--blockSize), which disagreed with command help (--block-size). Reuse optionFlagName so manifests emit the same canonical flags as help, and update the two CLI parity goldens. Adds a boundary test asserting both surfaces agree on canonical flag names.
This commit is contained in:
1 parent
55fd0ff590
commit
f93a8db72d
4 files changed
+36
-3
No files matched your search
@@ -24,6 +24,7 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import type { CliCommandEntry } from "./commandRegistry.js";
|
||||
import { optionFlagName } from "./optionFields.js";
|
||||
|
||||
/** The manifests' format version, which callers may already check. */
|
||||
const MANIFEST_VERSION = "incur.v1";
|
||||
@@ -124,7 +125,7 @@ const commandBody = (cli: string, { name, definition }: CliCommandEntry) => {
|
||||
const text = field.description ?? "";
|
||||
const description =
|
||||
property?.deprecated === true ? `**Deprecated.** ${text}` : text;
|
||||
return `| \`--${key}\` | \`${tableType(property)}\` | ${fallback === "" ? "" : `\`${fallback}\``} | ${description} |`;
|
||||
return `| \`--${optionFlagName(key)}\` | \`${tableType(property)}\` | ${fallback === "" ? "" : `\`${fallback}\``} | ${description} |`;
|
||||
},
|
||||
);
|
||||
sections.push(
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { z } from "zod";
|
||||
|
||||
import type { CliCommandEntry } from "../../../src/cli/commandRegistry.js";
|
||||
import { formatLlmsFull } from "../../../src/cli/commandManifests.js";
|
||||
import { formatCommandHelp } from "../../../src/cli/help.js";
|
||||
|
||||
it("uses the same canonical option flags as command help", () => {
|
||||
const command: CliCommandEntry = {
|
||||
name: "sample",
|
||||
definition: {
|
||||
options: z.object({
|
||||
blockSize: z.number().optional().describe("Bytes per block"),
|
||||
dryRun: z.boolean().default(false).describe("Dry run"),
|
||||
}),
|
||||
run: () => undefined,
|
||||
},
|
||||
operations: [],
|
||||
source: { kind: "host" },
|
||||
};
|
||||
const help = formatCommandHelp("rea sample", {
|
||||
options: command.definition.options,
|
||||
});
|
||||
const manifest = formatLlmsFull("rea", [command]);
|
||||
|
||||
expect(help).toContain("--block-size <number>");
|
||||
expect(help).toContain("--dry-run");
|
||||
expect(manifest).toContain("| `--block-size` |");
|
||||
expect(manifest).toContain("| `--dry-run` |");
|
||||
expect(manifest).not.toContain("--blockSize");
|
||||
expect(manifest).not.toContain("--dryRun");
|
||||
});
|
||||
@@ -15,7 +15,7 @@ Inspect file-wide and block byte entropy without executing the file
|
||||
|
||||
| Flag | Type | Default | Description |
|
||||
|------|------|---------|-------------|
|
||||
| `--blockSize` | `unknown` | `4096` | Power-of-two block size from 256 to 65536 bytes |
|
||||
| `--block-size` | `unknown` | `4096` | Power-of-two block size from 256 to 65536 bytes |
|
||||
| `--offset` | `unknown` | `0` | Window start as a decimal file byte offset |
|
||||
| `--length` | `unknown` | | Window length in bytes; omit to extend through EOF |
|
||||
<end>
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ Inspect file-wide and block byte entropy without executing the file
|
||||
|
||||
| Flag | Type | Default | Description |
|
||||
|------|------|---------|-------------|
|
||||
| `--blockSize` | `unknown` | `4096` | Power-of-two block size from 256 to 65536 bytes |
|
||||
| `--block-size` | `unknown` | `4096` | Power-of-two block size from 256 to 65536 bytes |
|
||||
| `--offset` | `unknown` | `0` | Window start as a decimal file byte offset |
|
||||
| `--length` | `unknown` | | Window length in bytes; omit to extend through EOF |
|
||||
<end>
|
||||
|
||||
Reference in new issue
Block a user