Skip to content

armgit / Ix

Public Imported from GitHub
0

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

fix(cli): follow Ix-pro's `ix bugs` -> `ix bug list` collapse (#396)

Joseph Mikhailfa6ad7b0ff52
diff --git a/CLAUDE.md b/CLAUDE.md
index 11bd3d13..36c277b8 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -180,7 +180,7 @@ Only the first four work without Pro.
| **[Pro]** List goals | `ix truth list` | `ix truth list --format json` |
| **[Pro]** Bug tracking | `ix bug create` | `ix bug create "title" --severity high --affects Entity` |
| **[Pro]** Update bug status | `ix bug update` | `ix bug update <id> --status resolved` |
-| **[Pro]** Bug listing | `ix bugs` | `ix bugs --status open --format json` |
+| **[Pro]** Bug listing | `ix bug list` | `ix bug list --status open --format json` |
| **[Pro]** Bug details | `ix bug show` | `ix bug show <id> --format json` |
### Planning (Pro)
diff --git a/ix-cli/src/cli/__tests__/help-topics.test.ts b/ix-cli/src/cli/__tests__/help-topics.test.ts
index 05c2f114..7bfe24a7 100644
--- a/ix-cli/src/cli/__tests__/help-topics.test.ts
+++ b/ix-cli/src/cli/__tests__/help-topics.test.ts
@@ -1,7 +1,11 @@
import { describe, it, expect } from "vitest";
+import { Command } from "commander";
import * as fs from "node:fs";
import * as path from "node:path";
+import { registerProStubs } from "../register/oss.js";
+import { registerWorkflowsHelpCommand } from "../commands/workflows.js";
+
/**
* Verify that the help command properly routes topic arguments
* to the matching command's help, not just the workflows subcommand.
@@ -39,3 +43,63 @@ describe("help topic routing", () => {
expect(workflowsContent).toContain("Unknown help topic");
});
});
+
+/**
+ * Behavioral coverage for the collapsed-plural forwarder. The assertions above
+ * are source-text greps, which is how `ix help bugs` broke unnoticed: @ix/pro
+ * collapsed `ix bugs` into `ix bug list` (Ix-pro#108) and dropping the `bugs`
+ * stub left the topic resolving to nothing. Run the real command instead.
+ */
+describe("collapsed plural help topics resolve", () => {
+ function runHelp(topic: string): { stdout: string; stderr: string; exitCode: number | string | undefined } {
+ const program = new Command();
+ program.name("ix").exitOverride();
+ registerProStubs(program);
+ registerWorkflowsHelpCommand(program);
+
+ const stdout: string[] = [];
+ const stderr: string[] = [];
+ const origWrite = process.stdout.write.bind(process.stdout);
+ const origErr = console.error;
+ const origExit = process.exitCode;
+ process.stdout.write = ((chunk: unknown) => {
+ stdout.push(String(chunk));
+ return true;
+ }) as typeof process.stdout.write;
+ console.error = (...a: unknown[]) => void stderr.push(a.join(" "));
+ process.exitCode = undefined;
+
+ let code: number | string | undefined;
+ try {
+ program.parse(["node", "ix", "help", topic]);
+ } catch (e) {
+ stderr.push(String((e as Error).message));
+ } finally {
+ code = process.exitCode;
+ process.stdout.write = origWrite;
+ console.error = origErr;
+ process.exitCode = origExit;
+ }
+ return { stdout: stdout.join(""), stderr: stderr.join("\n"), exitCode: code };
+ }
+
+ it.each([
+ ["bugs", "bug"],
+ ["goals", "goal"],
+ ])("ix help %s forwards to the %s command instead of erroring", (plural, singular) => {
+ const { stdout, stderr, exitCode } = runHelp(plural);
+ expect(stderr).not.toContain("Unknown help topic");
+ expect(exitCode).toBeUndefined();
+ // Anchored on a word boundary, not a prefix: `goals` is still a registered
+ // Pro stub, and its own help starts `Usage: ix goals` — which *contains*
+ // `Usage: ix goal`. Without the boundary this assertion passes with the
+ // forwarder deleted outright, which is exactly how it was first written.
+ expect(stdout).toMatch(new RegExp(`^Usage: ix ${singular}\\b`, "m"));
+ });
+
+ it("still rejects a topic that was never a command", () => {
+ const { stderr, exitCode } = runHelp("nonsense");
+ expect(stderr).toContain('Unknown help topic: "nonsense"');
+ expect(exitCode).toBe(1);
+ });
+});
diff --git a/ix-cli/src/cli/__tests__/pro-stub-message.test.ts b/ix-cli/src/cli/__tests__/pro-stub-message.test.ts
index c9bc2ff1..dfb1221f 100644
--- a/ix-cli/src/cli/__tests__/pro-stub-message.test.ts
+++ b/ix-cli/src/cli/__tests__/pro-stub-message.test.ts
@@ -53,7 +53,6 @@ describe("Pro stubs", () => {
["bug", ["bug", "create", "a title", "--affects", "Entity"]],
["bug", ["bug", "update", "abc123", "--status", "resolved"]],
["bug", ["bug", "show", "abc123", "--format", "json"]],
- ["bugs", ["bugs", "--status", "open", "--format", "json"]],
["truth", ["truth", "add", "Support 100k file repos"]],
["truth", ["truth", "list", "--format", "json"]],
["goal", ["goal", "create", "Support GitHub", "--format", "json"]],
@@ -101,13 +100,18 @@ describe("Pro stubs", () => {
expect(patches?.options.map(o => o.long)).toContain("--format");
});
- // @ix/pro registers a plural list command alongside each singular manager
- // (`bug`/`bugs`, `plan`/`plans`, `task`/`tasks`, `goal`/`goals`). Stubbing only
- // the singular is the failure this pins: `ix goals` fell through to commander's
+ // @ix/pro registers a plural list command alongside `plan` and `task`
+ // (register.ts: registerPlansCommand, registerTasksCommand). Stubbing only the
+ // singular is the failure this pins: the plural fell through to commander's
// "unknown command" instead of the sentinel above, so an agent told to stop on
// `requires Ix Pro.` saw an unrecognized error and had nothing to match.
+ //
+ // `goals` is NOT in that category and is only still stubbed by oversight:
+ // Ix-pro#103 deleted the command, #327 correctly dropped the stub, and #384
+ // re-added it on the stated premise that Pro registers a plural for *every*
+ // singular — which was already false. Do not use this row as evidence that
+ // `ix goals` exists; removing it is a pending follow-up.
it.each([
- ["bug", "bugs"],
["plan", "plans"],
["task", "tasks"],
["goal", "goals"],
@@ -117,6 +121,17 @@ describe("Pro stubs", () => {
}
});
+ // `bugs` is deliberately absent from the pairs above: @ix/pro collapsed it into
+ // `ix bug list` (Ix-pro#108), so there is no plural command left to stub. The
+ // singular stub has to cover the subcommand form instead — it swallows operands,
+ // so `bug list` still reaches the sentinel rather than "unknown command".
+ it("stubs the collapsed 'bug list' subcommand, not a 'bugs' command", () => {
+ expect(runStub(["bug", "list", "--status", "open", "--format", "json"]).err).toContain(
+ "The 'bug' command requires Ix Pro.",
+ );
+ expect(runStub(["bugs"]).err).not.toContain("requires Ix Pro");
+ });
+
it("emits the message verbatim as CLAUDE.md quotes it", () => {
// Single quotes around the name, trailing period. Agents match on this.
expect(runStub(["decide", "Use X"]).err).toContain("The 'decide' command requires Ix Pro.");
diff --git a/ix-cli/src/cli/commands/workflows.ts b/ix-cli/src/cli/commands/workflows.ts
index 64b5130d..cdfa4958 100644
--- a/ix-cli/src/cli/commands/workflows.ts
+++ b/ix-cli/src/cli/commands/workflows.ts
@@ -29,7 +29,7 @@ Staged Workflows:
ix workflow run task <id> --stage discover Run one stage
Bug Workflow:
- ix bugs --status open See open bugs
+ ix bug list --status open See open bugs
ix bug show <id> Get bug details
ix plan create "Fix X" --goal <id> --responds-to <bugId>
ix plan task "Step 1" --plan <id> --resolves <bugId>
@@ -59,6 +59,12 @@ Advanced (low-level graph commands):
Use "ix <command> --help" for details on any command.
`;
+/** Retired plural names -> the singular that absorbed them as a subcommand. */
+const COLLAPSED_HELP_TOPICS: Record<string, string> = {
+ goals: "goal",
+ bugs: "bug",
+};
+
export function registerWorkflowsHelpCommand(program: Command): void {
const help = program
.command("help [topic]")
@@ -80,13 +86,18 @@ export function registerWorkflowsHelpCommand(program: Command): void {
return;
}
- // "goals" → forward to "goal" command help
- if (topic === "goals") {
- const goalCmd = program.commands.find(
- (c: Command) => c.name() === "goal"
+ // Plural commands @ix/pro collapsed into a subcommand of the singular
+ // (`ix goals` -> `ix goal list`, Ix-pro#103; `ix bugs` -> `ix bug list`,
+ // Ix-pro#108). The plural is no longer a command anywhere, so `ix help
+ // bugs` would fall through to "Unknown help topic". Forward it to the
+ // singular, whose help documents the new subcommand.
+ const collapsed = COLLAPSED_HELP_TOPICS[topic];
+ if (collapsed) {
+ const target = program.commands.find(
+ (c: Command) => c.name() === collapsed
);
- if (goalCmd) {
- goalCmd.outputHelp();
+ if (target) {
+ target.outputHelp();
return;
}
}
diff --git a/ix-cli/src/cli/register/oss.ts b/ix-cli/src/cli/register/oss.ts
index 964889a8..0d783b69 100644
--- a/ix-cli/src/cli/register/oss.ts
+++ b/ix-cli/src/cli/register/oss.ts
@@ -39,7 +39,6 @@ import { registerPatchesCommand } from "../commands/patches.js";
const PRO_COMMANDS: { name: string; desc: string }[] = [
{ name: "briefing", desc: "Session-resume briefing" },
{ name: "bug", desc: "Manage bugs" },
- { name: "bugs", desc: "List all bugs" },
{ name: "decide", desc: "Record a design decision" },
{ name: "decisions", desc: "List recorded design decisions" },
{ name: "goal", desc: "Manage project goals" },
diff --git a/skills/ix/references/commands.md b/skills/ix/references/commands.md
index 0db632b8..017e9716 100644
--- a/skills/ix/references/commands.md
+++ b/skills/ix/references/commands.md
@@ -125,9 +125,10 @@ ix inventory --kind function --path auth.py --format llm
- `registerProCommands` is async (each Pro command is dynamically imported)
and MUST be awaited; skipping the await makes every `ix <pro-cmd>` fail
with "unknown command".
- - Real example: `registerPatchesCommand` is defined but never called in
- `oss.ts`, so `ix patches` errors as an unknown command today; wiring it in
- would flip it to OSS.
+ - Real example: `registerPatchesCommand` was defined but never called in
+ `oss.ts`, so a `patches` entry in `PRO_COMMANDS` shadowed it and `ix
+ patches` answered "requires Ix Pro" (#371). #390 wired the call in and
+ dropped the stub, so `ix patches` is an OSS command today.
## Do NOT Use
diff --git a/skills/ix/references/output-formats.md b/skills/ix/references/output-formats.md
index bfacbc4a..22e958c9 100644
--- a/skills/ix/references/output-formats.md
+++ b/skills/ix/references/output-formats.md
@@ -33,7 +33,7 @@ does not have them — skip that step, do not retry it, and do not mention it
again for the rest of the session. Nothing outside those marks is Pro-gated.
Pro-only surface: `plan`, `plans`, `task`, `tasks`, `workflow`, `decide`,
-`decisions`, `goal`, `truth`, `bug`, `bugs`, `briefing`, `patches`.
+`decisions`, `goal`, `truth`, `bug`, `briefing`.
### Semantic boundaries (Pro record types)