Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

fix(help): show context and ingest arguments as optional, as registered

KageBinaryffa048d67843
diff --git a/ix-cli/src/cli/__tests__/help-coverage.test.ts b/ix-cli/src/cli/__tests__/help-coverage.test.ts
index 1362d297..ab12b408 100644
--- a/ix-cli/src/cli/__tests__/help-coverage.test.ts
+++ b/ix-cli/src/cli/__tests__/help-coverage.test.ts
@@ -81,3 +81,26 @@ describe("help coverage against the registrations", () => {
expect(visible.filter((name) => !listed(name))).toEqual([]);
});
});
+
+describe("help argument shapes match the registrations", () => {
+ it("marks an argument optional in the help exactly when the command does", () => {
+ const program = new Command();
+ registerOssCommands(program);
+ const wrong: string[] = [];
+ for (const line of buildHelpText().split("\n")) {
+ const match = /^\s{2}(\S+)((?:\s+[<[][^\s>\]]+[>\]])*)/.exec(line);
+ if (!match) continue;
+ const command = program.commands.find((c) => c.name() === match[1]);
+ // Commands with subcommands show the subcommand in the slot (`docker <action>`).
+ if (!command || command.commands.length > 0) continue;
+ const shown = match[2].trim().split(/\s+/).filter(Boolean);
+ shown.forEach((token, i) => {
+ const registered = command.registeredArguments[i];
+ if (!registered || registered.required !== token.startsWith("<")) {
+ wrong.push(`${match[1]} ${token}`);
+ }
+ });
+ }
+ expect(wrong).toEqual([]);
+ });
+});
diff --git a/ix-cli/src/cli/help-text.ts b/ix-cli/src/cli/help-text.ts
index 04c3d37b..484a3a49 100644
--- a/ix-cli/src/cli/help-text.ts
+++ b/ix-cli/src/cli/help-text.ts
@@ -8,13 +8,13 @@ const OSS_HELP = [
chalk.bold(`Start:`),
` map [path] Map system`,
` watch Watch changes`,
- ` ingest <path> Ingest files or GitHub data`,
+ ` ingest [path] Ingest files or GitHub data`,
` config Update config`,
``,
chalk.bold(`Understand:`),
- ` context <target> Bounded context bundle (start here)`,
+ ` context [target] Bounded context bundle (start here)`,
` search <term> Search system`,
- ` text <pattern> Search text (ripgrep)`,
+ ` text <term> Search text (ripgrep)`,
` locate <symbol> Find definition`,
` explain <symbol> Explain behavior`,
` impact <target> Analyze impact`,