Skip to content

armgit / Ix

Public Imported from GitHub
0

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

feat: add ix goal create/list — aliases for ix truth

riley02274f736c41e34f
diff --git a/ix-cli/src/cli/commands/goal.ts b/ix-cli/src/cli/commands/goal.ts
new file mode 100644
index 00000000..cdb0d130
--- /dev/null
+++ b/ix-cli/src/cli/commands/goal.ts
@@ -0,0 +1,35 @@
+import type { Command } from "commander";
+import { IxClient } from "../../client/api.js";
+import { getEndpoint } from "../config.js";
+import { formatIntents } from "../format.js";
+
+export function registerGoalCommand(program: Command): void {
+ const goal = program
+ .command("goal")
+ .description("Manage project goals (aliases for ix truth)");
+
+ goal
+ .command("create <statement>")
+ .description("Create a new goal")
+ .option("--parent <id>", "Parent goal ID")
+ .option("--format <fmt>", "Output format (text|json)", "text")
+ .action(async (statement: string, opts: { parent?: string; format: string }) => {
+ const client = new IxClient(getEndpoint());
+ const result = await client.createTruth(statement, opts.parent);
+ if (opts.format === "json") {
+ console.log(JSON.stringify(result, null, 2));
+ } else {
+ console.log(`Goal created: ${result.nodeId} (rev ${result.rev})`);
+ }
+ });
+
+ goal
+ .command("list")
+ .description("List all goals")
+ .option("--format <fmt>", "Output format (text|json)", "text")
+ .action(async (opts: { format: string }) => {
+ const client = new IxClient(getEndpoint());
+ const intents = await client.listTruth();
+ formatIntents(intents, opts.format);
+ });
+}
diff --git a/ix-cli/src/cli/main.ts b/ix-cli/src/cli/main.ts
index 3afe1ea0..aa6ce9a0 100644
--- a/ix-cli/src/cli/main.ts
+++ b/ix-cli/src/cli/main.ts
@@ -27,6 +27,7 @@ import { registerInventoryCommand } from "./commands/inventory.js";
import { registerImpactCommand } from "./commands/impact.js";
import { registerRankCommand } from "./commands/rank.js";
import { registerOverviewCommand } from "./commands/overview.js";
+import { registerGoalCommand } from "./commands/goal.js";
const program = new Command();
program
@@ -61,5 +62,6 @@ registerInventoryCommand(program);
registerImpactCommand(program);
registerRankCommand(program);
registerOverviewCommand(program);
+registerGoalCommand(program);
program.parse();