Skip to content

armgit / Ix

Public Imported from GitHub
0

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

feat: briefing command, task workflow support, docs for bug/briefing

Tanner Kocherc722e30504e3
diff --git a/.gitignore b/.gitignore
index 4eabf48e..9ba0231d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,6 @@ target/
*.jar
.DS_Store
.worktrees/
-ix-cli/node_modules/
+ix-cli/node_modules/*
ix-cli/dist/
.vscode/
\ No newline at end of file
diff --git a/AGENTS.md b/AGENTS.md
index 43129a45..253b579b 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -65,6 +65,10 @@ ix goal create <statement> --format json # Create a project goal
ix plan create <title> --goal <id> --format json # Create a plan
ix plan next <plan-id> --format json # Next actionable task
ix decide <title> --rationale <text> --affects <entities> --format json # Record linked decision
+ix briefing --format json # Session-scoped resume summary
+ix bug create "title" --affects Entity # Track a bug
+ix bugs --format json # List bugs
+ix bug show <id> --format json # Bug details
```
**When to use which:**
@@ -128,12 +132,21 @@ ix goal create "GitHub ingestion pipeline" --format json
ix goal list --format json
ix plan create "GitHub Ingestion" --goal <goal-id> --format json
ix plan task "API fetch layer" --plan <plan-id> --depends-on <task-id> --format json
+ix plan task "title" --plan <id> --workflow "cmd1,cmd2" --format json # Task with workflow
ix plan status <plan-id> --format json
ix plan next <plan-id> --format json
+ix plan next <plan-id> --with-workflow --format json # Next task with workflow commands
+ix task show <task-id> --with-workflow --format json # Task details with workflow
ix task update <task-id> --status done --format json
ix decide "Use client-side patch" --rationale "..." --affects IngestionService --format json
```
+## Semantic boundaries
+
+- **decision** — a choice between alternatives, with rationale. Use `ix decide`.
+- **bug** — something broken, missing, or incorrect. Use `ix bug create`.
+- **task/plan** — intended work and sequencing. Use `ix plan` / `ix plan task`.
+
## Chaining pattern
1. Start broad: `ix overview MyClass --format json` or `ix impact MyClass --format json`
diff --git a/CLAUDE.md b/CLAUDE.md
index 72c81c72..839d1921 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -34,6 +34,8 @@ Start here. These aggregate multiple graph operations into single bounded respon
| Plan work | `ix plan` | `ix plan next <plan-id> --format json` |
| Track decisions | `ix decide` | `ix decide "Use X" --rationale "..." --affects Entity` |
| Create goals | `ix goal` | `ix goal create "Support GitHub" --format json` |
+| Session resume | `ix briefing` | `ix briefing --format json` |
+| Track bugs | `ix bug` | `ix bug create "title" --affects Entity` |
### Low-Level Primitives
@@ -69,6 +71,9 @@ Underlying structural commands — useful for debugging or fine-grained inspecti
| Record a decision | `ix decide` | `ix decide "Use CONTAINS" --rationale "Normalize edges"` |
| Record a goal | `ix truth add` | `ix truth add "Support 100k file repos"` |
| List goals | `ix truth list` | `ix truth list --format json` |
+| Bug tracking | `ix bug create` | `ix bug create "title" --severity high --affects Entity` |
+| Bug listing | `ix bugs` | `ix bugs --format json` |
+| Bug details | `ix bug show` | `ix bug show <id> --format json` |
### Ingestion & Health
| Goal | Command | Example |
@@ -117,6 +122,14 @@ ix inventory --kind function --format json
- Use exact entity IDs from previous JSON results
- Decompose large questions into multiple targeted calls
+## Semantic Boundaries
+
+Use the right entity type for the right purpose:
+
+- **decision** — a choice between alternatives, with rationale. Use `ix decide`.
+- **bug** — something broken, missing, or incorrect. Use `ix bug create`.
+- **task/plan** — intended work and sequencing. Use `ix plan` / `ix plan task`.
+
## Do NOT Use
- `ix query` — deprecated, produces oversized low-signal responses
- NLP-style QA in a single command
diff --git a/ix-cli/src/cli/__tests__/briefing.test.ts b/ix-cli/src/cli/__tests__/briefing.test.ts
new file mode 100644
index 00000000..877387b2
--- /dev/null
+++ b/ix-cli/src/cli/__tests__/briefing.test.ts
@@ -0,0 +1,141 @@
+import { describe, it, expect, vi } from "vitest";
+import { buildBriefing, type BriefingResult } from "../commands/briefing.js";
+
+function mockClient(overrides: Partial<Record<string, any>> = {}): any {
+ return {
+ health: vi.fn().mockResolvedValue({ status: "ok" }),
+ listByKind: vi.fn().mockImplementation((kind: string) => {
+ if (overrides[`listByKind:${kind}`]) return Promise.resolve(overrides[`listByKind:${kind}`]);
+ return Promise.resolve([]);
+ }),
+ listDecisions: vi.fn().mockResolvedValue(overrides.decisions ?? []),
+ listPatches: vi.fn().mockResolvedValue(overrides.patches ?? []),
+ conflicts: vi.fn().mockResolvedValue(overrides.conflicts ?? []),
+ expand: vi.fn().mockResolvedValue({ nodes: [], edges: [] }),
+ entity: vi.fn().mockResolvedValue({ node: { attrs: {} }, claims: [], edges: [] }),
+ ...overrides.clientOverrides,
+ };
+}
+
+describe("buildBriefing", () => {
+ it("returns all expected top-level keys", async () => {
+ const client = mockClient();
+ const result = await buildBriefing(client);
+ expect(result).toHaveProperty("lastIngestAt");
+ expect(result).toHaveProperty("revision");
+ expect(result).toHaveProperty("activeGoals");
+ expect(result).toHaveProperty("activePlans");
+ expect(result).toHaveProperty("openBugs");
+ expect(result).toHaveProperty("recentDecisions");
+ expect(result).toHaveProperty("recentChanges");
+ expect(result).toHaveProperty("conflicts");
+ expect(result).toHaveProperty("diagnostics");
+ });
+
+ it("produces valid output with empty state (no crashes)", async () => {
+ const client = mockClient();
+ const result = await buildBriefing(client);
+ expect(result.activeGoals).toEqual([]);
+ expect(result.activePlans).toEqual([]);
+ expect(result.openBugs).toEqual([]);
+ expect(result.recentDecisions).toEqual([]);
+ expect(result.recentChanges).toEqual([]);
+ expect(result.conflicts).toEqual([]);
+ expect(result.diagnostics).toEqual([]);
+ expect(result.lastIngestAt).toBeNull();
+ expect(result.revision).toBeNull();
+ });
+
+ it("maps goals from intent nodes", async () => {
+ const client = mockClient({
+ "listByKind:intent": [
+ { id: "g1", name: "Support GitHub", attrs: {} },
+ { id: "g2", name: "Scale to 100k", attrs: {} },
+ ],
+ });
+ const result = await buildBriefing(client);
+ expect(result.activeGoals).toHaveLength(2);
+ expect(result.activeGoals[0]).toEqual({ id: "g1", name: "Support GitHub" });
+ expect(result.activeGoals[1]).toEqual({ id: "g2", name: "Scale to 100k" });
+ });
+
+ it("filters bugs to open/investigating only", async () => {
+ const client = mockClient({
+ "listByKind:bug": [
+ { id: "b1", name: "Login crash", attrs: { status: "open", severity: "high" } },
+ { id: "b2", name: "Fixed bug", attrs: { status: "resolved", severity: "low" } },
+ { id: "b3", name: "Under review", attrs: { status: "investigating", severity: "medium" } },
+ ],
+ });
+ const result = await buildBriefing(client);
+ expect(result.openBugs).toHaveLength(2);
+ expect(result.openBugs.map(b => b.id)).toEqual(["b1", "b3"]);
+ });
+
+ it("extracts revision and lastIngestAt from patches", async () => {
+ const client = mockClient({
+ patches: [
+ { patch_id: "p1", rev: 42, intent: "Ingest src", timestamp: "2026-03-08T10:00:00Z" },
+ ],
+ });
+ const result = await buildBriefing(client);
+ expect(result.revision).toBe(42);
+ expect(result.lastIngestAt).toBe("2026-03-08T10:00:00Z");
+ });
+
+ it("maps recent decisions", async () => {
+ const client = mockClient({
+ decisions: [
+ { id: "d1", name: "Use CONTAINS", attrs: { rationale: "Normalize edges" } },
+ ],
+ });
+ const result = await buildBriefing(client);
+ expect(result.recentDecisions).toHaveLength(1);
+ expect(result.recentDecisions[0].name).toBe("Use CONTAINS");
+ expect(result.recentDecisions[0].rationale).toBe("Normalize edges");
+ });
+
+ it("includes plan task summary with nextTask", async () => {
+ const planNode = { id: "plan-1", name: "Fix Auth", kind: "plan", attrs: {} };
+ const taskNode = { id: "task-1", name: "Update token", kind: "task", attrs: { status: "pending" } };
+
+ const client = mockClient({
+ "listByKind:plan": [planNode],
+ clientOverrides: {
+ expand: vi.fn().mockImplementation((id: string, opts: any) => {
+ if (id === "plan-1" && opts.predicates?.includes("PLAN_HAS_TASK")) {
+ return Promise.resolve({ nodes: [taskNode], edges: [] });
+ }
+ return Promise.resolve({ nodes: [], edges: [] });
+ }),
+ entity: vi.fn().mockResolvedValue({
+ node: { attrs: { status: "pending" } },
+ claims: [],
+ edges: [],
+ }),
+ },
+ });
+
+ const result = await buildBriefing(client);
+ expect(result.activePlans).toHaveLength(1);
+ expect(result.activePlans[0].name).toBe("Fix Auth");
+ expect(result.activePlans[0].taskSummary.total).toBe(1);
+ expect(result.activePlans[0].taskSummary.pending).toBe(1);
+ expect(result.activePlans[0].nextTask).toBe("Update token");
+ });
+
+ it("records diagnostics when endpoints fail", async () => {
+ const client = mockClient({
+ clientOverrides: {
+ health: vi.fn().mockRejectedValue(new Error("unreachable")),
+ listByKind: vi.fn().mockRejectedValue(new Error("down")),
+ listDecisions: vi.fn().mockRejectedValue(new Error("down")),
+ listPatches: vi.fn().mockRejectedValue(new Error("down")),
+ conflicts: vi.fn().mockRejectedValue(new Error("down")),
+ },
+ });
+ const result = await buildBriefing(client);
+ expect(result.diagnostics.length).toBeGreaterThan(0);
+ expect(result.diagnostics).toContain("health endpoint unreachable");
+ });
+});
diff --git a/ix-cli/src/cli/__tests__/plan-patch.test.ts b/ix-cli/src/cli/__tests__/plan-patch.test.ts
index b86c827d..dc3622a2 100644
--- a/ix-cli/src/cli/__tests__/plan-patch.test.ts
+++ b/ix-cli/src/cli/__tests__/plan-patch.test.ts
@@ -65,6 +65,21 @@ describe("buildTaskPatch", () => {
expect(patch.ops[2].predicate).toBe("TASK_AFFECTS");
});
+ it("stores workflow array in attrs when provided", () => {
+ const patch = buildTaskPatch("Investigate auth", {
+ planId: "plan-123",
+ workflow: ["ix overview AuthService", "ix explain verifyToken"],
+ });
+ const attrs = patch.ops[0].attrs as Record<string, unknown>;
+ expect(attrs.workflow).toEqual(["ix overview AuthService", "ix explain verifyToken"]);
+ });
+
+ it("omits workflow from attrs when not provided", () => {
+ const patch = buildTaskPatch("Simple task", { planId: "plan-123" });
+ const attrs = patch.ops[0].attrs as Record<string, unknown>;
+ expect(attrs).not.toHaveProperty("workflow");
+ });
+
it("uses sourceType cli", () => {
const patch = buildTaskPatch("Task", { planId: "plan-123" });
expect(patch.source.sourceType).toBe("cli");
diff --git a/ix-cli/src/cli/commands/briefing.ts b/ix-cli/src/cli/commands/briefing.ts
new file mode 100644
index 00000000..3f8383de
--- /dev/null
+++ b/ix-cli/src/cli/commands/briefing.ts
@@ -0,0 +1,306 @@
+import type { Command } from "commander";
+import { IxClient } from "../../client/api.js";
+import { getEndpoint } from "../config.js";
+import chalk from "chalk";
+
+interface BriefingGoal {
+ id: string;
+ name: string;
+}
+
+interface BriefingPlan {
+ id: string;
+ name: string;
+ taskSummary: { total: number; done: number; pending: number };
+ nextTask: string | null;
+}
+
+interface BriefingBug {
+ id: string;
+ title: string;
+ severity: string;
+ status: string;
+}
+
+interface BriefingDecision {
+ id: string;
+ name: string;
+ rationale: string;
+}
+
+interface BriefingChange {
+ patchId: string;
+ intent: string | null;
+ rev: number;
+}
+
+export interface BriefingResult {
+ lastIngestAt: string | null;
+ revision: number | null;
+ activeGoals: BriefingGoal[];
+ activePlans: BriefingPlan[];
+ openBugs: BriefingBug[];
+ recentDecisions: BriefingDecision[];
+ recentChanges: BriefingChange[];
+ conflicts: unknown[];
+ diagnostics: string[];
+}
+
+export async function buildBriefing(client: IxClient): Promise<BriefingResult> {
+ const diagnostics: string[] = [];
+
+ // Fetch all data sources in parallel
+ const [healthResult, goals, plans, bugs, decisions, patches, conflicts] =
+ await Promise.all([
+ client.health().catch(() => {
+ diagnostics.push("health endpoint unreachable");
+ return null;
+ }),
+ client.listByKind("intent", { limit: 50 }).catch(() => {
+ diagnostics.push("could not list goals");
+ return [] as any[];
+ }),
+ client.listByKind("plan", { limit: 50 }).catch(() => {
+ diagnostics.push("could not list plans");
+ return [] as any[];
+ }),
+ client.listByKind("bug", { limit: 50 }).catch(() => {
+ diagnostics.push("could not list bugs");
+ return [] as any[];
+ }),
+ client.listDecisions({ limit: 5 }).catch(() => {
+ diagnostics.push("could not list decisions");
+ return [] as any[];
+ }),
+ client.listPatches({ limit: 10 }).catch(() => {
+ diagnostics.push("could not list patches");
+ return [] as any[];
+ }),
+ client.conflicts().catch(() => {
+ diagnostics.push("could not check conflicts");
+ return [] as unknown[];
+ }),
+ ]);
+
+ // Extract last ingest time and revision from patches
+ let lastIngestAt: string | null = null;
+ let revision: number | null = null;
+ if (patches.length > 0) {
+ const latest = patches[0] as any;
+ lastIngestAt = latest.timestamp ?? null;
+ revision = latest.rev ?? null;
+ }
+
+ // Map goals
+ const activeGoals: BriefingGoal[] = goals.map((g: any) => ({
+ id: g.id,
+ name: g.name ?? g.attrs?.statement ?? "(unnamed)",
+ }));
+
+ // Map bugs — filter to open/investigating only
+ const openBugs: BriefingBug[] = bugs
+ .filter((b: any) => {
+ const status = b.attrs?.status ?? "open";
+ return status === "open" || status === "investigating";
+ })
+ .map((b: any) => ({
+ id: b.id,
+ title: b.name,
+ severity: b.attrs?.severity ?? "medium",
+ status: b.attrs?.status ?? "open",
+ }));
+
+ // Map decisions
+ const recentDecisions: BriefingDecision[] = decisions.map((d: any) => ({
+ id: d.id,
+ name: d.name ?? d.title ?? "(unnamed)",
+ rationale: d.attrs?.rationale ?? d.rationale ?? "",
+ }));
+
+ // Map patches/changes
+ const recentChanges: BriefingChange[] = patches.map((p: any) => ({
+ patchId: p.patch_id ?? p.patchId ?? p.id,
+ intent: p.intent ?? null,
+ rev: p.rev ?? 0,
+ }));
+
+ // Enrich plans with task summaries (up to 5 plans)
+ const activePlans: BriefingPlan[] = [];
+ const plansToProcess = plans.slice(0, 5);
+
+ for (const plan of plansToProcess) {
+ try {
+ const { nodes: taskNodes } = await client.expand(plan.id, {
+ direction: "out",
+ predicates: ["PLAN_HAS_TASK"],
+ });
+
+ const tasks = taskNodes.filter((n: any) => n.kind === "task");
+ let doneCount = 0;
+ let pendingCount = 0;
+ let nextTask: string | null = null;
+
+ // Get status for each task
+ const doneIds = new Set<string>();
+ const taskDetails: { id: string; name: string; status: string; dependsOn: string[] }[] = [];
+
+ for (const t of tasks) {
+ const detail = await client.entity(t.id);
+ const statusClaim = detail.claims?.find(
+ (c: any) => c.field === "status" || c.statement?.includes("status")
+ );
+ let status = "pending";
+ if (statusClaim) {
+ const val = (statusClaim as any).value ?? (statusClaim as any).statement;
+ if (typeof val === "string") status = val;
+ } else if (detail.node?.attrs?.status) {
+ status = detail.node.attrs.status as string;
+ }
+
+ if (status === "done") {
+ doneCount++;
+ doneIds.add(t.id);
+ } else if (status === "pending") {
+ pendingCount++;
+ }
+
+ const { edges: depEdges } = await client.expand(t.id, {
+ direction: "out",
+ predicates: ["DEPENDS_ON"],
+ });
+ taskDetails.push({
+ id: t.id,
+ name: t.name,
+ status,
+ dependsOn: depEdges.map((e: any) => e.dst as string),
+ });
+ }
+
+ // Find next actionable
+ const actionable = taskDetails.find(
+ (t) =>
+ t.status !== "done" &&
+ t.status !== "abandoned" &&
+ t.dependsOn.every((dep) => doneIds.has(dep))
+ );
+ if (actionable) nextTask = actionable.name;
+
+ activePlans.push({
+ id: plan.id,
+ name: plan.name ?? "(unnamed)",
+ taskSummary: { total: tasks.length, done: doneCount, pending: pendingCount },
+ nextTask,
+ });
+ } catch {
+ activePlans.push({
+ id: plan.id,
+ name: plan.name ?? "(unnamed)",
+ taskSummary: { total: 0, done: 0, pending: 0 },
+ nextTask: null,
+ });
+ }
+ }
+
+ return {
+ lastIngestAt,
+ revision,
+ activeGoals,
+ activePlans,
+ openBugs,
+ recentDecisions,
+ recentChanges,
+ conflicts,
+ diagnostics,
+ };
+}
+
+export function registerBriefingCommand(program: Command): void {
+ program
+ .command("briefing")
+ .description("Session-resume briefing — aggregated project status")
+ .option("--format <fmt>", "Output format (text|json)", "text")
+ .action(async (opts: { format: string }) => {
+ const client = new IxClient(getEndpoint());
+ const briefing = await buildBriefing(client);
+
+ if (opts.format === "json") {
+ console.log(JSON.stringify(briefing, null, 2));
+ } else {
+ // Header
+ console.log(chalk.bold("Ix Briefing"));
+ if (briefing.revision !== null) {
+ console.log(chalk.dim(` Revision: ${briefing.revision}`));
+ }
+ if (briefing.lastIngestAt) {
+ console.log(chalk.dim(` Last ingest: ${briefing.lastIngestAt}`));
+ }
+
+ // Goals
+ if (briefing.activeGoals.length > 0) {
+ console.log(`\n${chalk.bold("Goals")} (${briefing.activeGoals.length})`);
+ for (const g of briefing.activeGoals) {
+ console.log(` ${chalk.cyan("◆")} ${g.name}`);
+ }
+ }
+
+ // Plans
+ if (briefing.activePlans.length > 0) {
+ console.log(`\n${chalk.bold("Plans")} (${briefing.activePlans.length})`);
+ for (const p of briefing.activePlans) {
+ const { done, total } = p.taskSummary;
+ console.log(` ${chalk.cyan("▸")} ${p.name} ${chalk.dim(`(${done}/${total} done)`)}`);
+ if (p.nextTask) {
+ console.log(` ${chalk.green("Next:")} ${p.nextTask}`);
+ }
+ }
+ }
+
+ // Bugs
+ if (briefing.openBugs.length > 0) {
+ console.log(`\n${chalk.bold("Open Bugs")} (${briefing.openBugs.length})`);
+ for (const b of briefing.openBugs) {
+ const sev = b.severity === "critical" || b.severity === "high"
+ ? chalk.red(b.severity)
+ : chalk.yellow(b.severity);
+ console.log(` ${chalk.red("○")} ${b.title} ${chalk.dim(`[${sev}]`)}`);
+ }
+ }
+
+ // Decisions
+ if (briefing.recentDecisions.length > 0) {
+ console.log(`\n${chalk.bold("Recent Decisions")} (${briefing.recentDecisions.length})`);
+ for (const d of briefing.recentDecisions) {
+ console.log(` ${chalk.magenta("◇")} ${d.name}`);
+ if (d.rationale) {
+ console.log(` ${chalk.dim(d.rationale.slice(0, 80))}`);
+ }
+ }
+ }
+
+ // Changes
+ if (briefing.recentChanges.length > 0) {
+ console.log(`\n${chalk.bold("Recent Changes")} (${briefing.recentChanges.length})`);
+ for (const c of briefing.recentChanges) {
+ const label = c.intent ?? chalk.dim("(no intent)");
+ console.log(` rev ${chalk.dim(String(c.rev))} ${label}`);
+ }
+ }
+
+ // Conflicts
+ if (briefing.conflicts.length > 0) {
+ console.log(`\n${chalk.red.bold("Conflicts")} (${briefing.conflicts.length})`);
+ for (const c of briefing.conflicts as any[]) {
+ console.log(` ${chalk.red("⚠")} ${c.reason ?? JSON.stringify(c)}`);
+ }
+ }
+
+ // Diagnostics
+ if (briefing.diagnostics.length > 0) {
+ console.log(`\n${chalk.yellow("Diagnostics:")}`);
+ for (const d of briefing.diagnostics) {
+ console.log(` ${chalk.yellow("!")} ${d}`);
+ }
+ }
+ }
+ });
+}
diff --git a/ix-cli/src/cli/commands/plan.ts b/ix-cli/src/cli/commands/plan.ts
index f5ef9d19..9bb1480e 100644
--- a/ix-cli/src/cli/commands/plan.ts
+++ b/ix-cli/src/cli/commands/plan.ts
@@ -65,6 +65,7 @@ export interface TaskOpts {
planId: string;
dependsOn?: string;
affects?: { id: string; kind: string; name: string }[];
+ workflow?: string[];
}
export function buildTaskPatch(title: string, opts: TaskOpts): GraphPatchPayload {
@@ -76,7 +77,11 @@ export function buildTaskPatch(title: string, opts: TaskOpts): GraphPatchPayload
id: taskId,
kind: "task",
name: title,
- attrs: { status: "pending", created_at: new Date().toISOString() },
+ attrs: {
+ status: "pending",
+ created_at: new Date().toISOString(),
+ ...(opts.workflow ? { workflow: opts.workflow } : {}),
+ },
},
{
type: "UpsertEdge",
@@ -171,8 +176,9 @@ export function registerPlanCommand(program: Command): void {
.requiredOption("--plan <id>", "Plan ID")
.option("--depends-on <id>", "Task ID this task depends on")
.option("--affects <entities>", "Comma-separated entity names this task affects")
+ .option("--workflow <commands>", "Comma-separated ix commands to run for this task")
.option("--format <fmt>", "Output format (text|json)", "text")
- .action(async (title: string, opts: { plan: string; dependsOn?: string; affects?: string; format: string }) => {
+ .action(async (title: string, opts: { plan: string; dependsOn?: string; affects?: string; workflow?: string; format: string }) => {
const client = new IxClient(getEndpoint());
let affectsEntities: { id: string; kind: string; name: string }[] | undefined;
@@ -190,10 +196,15 @@ export function registerPlanCommand(program: Command): void {
}
}
+ const workflowArr = opts.workflow
+ ? opts.workflow.split(",").map(s => s.trim())
+ : undefined;
+
const patch = buildTaskPatch(title, {
planId: opts.plan,
dependsOn: opts.dependsOn,
affects: affectsEntities,
+ workflow: workflowArr,
});
const result = await client.commitPatch(patch);
const taskId = patch.ops[0].id as string;
@@ -295,8 +306,9 @@ export function registerPlanCommand(program: Command): void {
plan
.command("next <planId>")
.description("Show the next actionable task in a plan")
+ .option("--with-workflow", "Include workflow commands in output")
.option("--format <fmt>", "Output format (text|json)", "text")
- .action(async (planId: string, opts: { format: string }) => {
+ .action(async (planId: string, opts: { withWorkflow?: boolean; format: string }) => {
const client = new IxClient(getEndpoint());
const { nodes: taskNodes } = await client.expand(planId, {
@@ -328,17 +340,33 @@ export function registerPlanCommand(program: Command): void {
if (opts.format === "json") {
if (nextActionable) {
- console.log(JSON.stringify({
+ const result: Record<string, unknown> = {
task: nextActionable.title,
taskId: nextActionable.id,
reason: "all dependencies satisfied",
- }, null, 2));
+ };
+ if (opts.withWorkflow) {
+ const detail = await client.entity(nextActionable.id);
+ const workflow = (detail.node?.attrs?.workflow as string[] | undefined) ?? [];
+ result.workflow = workflow;
+ }
+ console.log(JSON.stringify(result, null, 2));
} else {
console.log(JSON.stringify({ task: null, reason: "no actionable tasks" }, null, 2));
}
} else {
if (nextActionable) {
console.log(`${chalk.green("Next:")} ${nextActionable.title} (${nextActionable.id.slice(0, 8)})`);
+ if (opts.withWorkflow) {
+ const detail = await client.entity(nextActionable.id);
+ const workflow = (detail.node?.attrs?.workflow as string[] | undefined) ?? [];
+ if (workflow.length > 0) {
+ console.log(chalk.dim("Workflow:"));
+ for (const cmd of workflow) {
+ console.log(` ${chalk.cyan("▸")} ${cmd}`);
+ }
+ }
+ }
} else {
console.log(chalk.dim("No actionable tasks."));
}
@@ -351,6 +379,49 @@ export function registerTaskCommand(program: Command): void {
.command("task")
.description("Manage tasks");
+ task
+ .command("show <taskId>")
+ .description("Show task details")
+ .option("--with-workflow", "Include workflow commands in output")
+ .option("--format <fmt>", "Output format (text|json)", "text")
+ .action(async (taskId: string, opts: { withWorkflow?: boolean; format: string }) => {
+ const client = new IxClient(getEndpoint());
+ const details = await client.entity(taskId);
+ const node = details.node as any;
+
+ const statusClaim = details.claims?.find(
+ (c: any) => c.field === "status" || c.statement?.includes("status")
+ );
+ const status = statusClaim
+ ? ((statusClaim as any).value ?? (statusClaim as any).statement ?? "pending")
+ : (node.attrs?.status ?? "pending");
+
+ const workflow = (node.attrs?.workflow as string[] | undefined) ?? [];
+
+ if (opts.format === "json") {
+ const result: Record<string, unknown> = {
+ taskId,
+ title: node.name,
+ status,
+ created_at: node.attrs?.created_at ?? node.createdAt,
+ };
+ if (opts.withWorkflow) {
+ result.workflow = workflow;
+ }
+ console.log(JSON.stringify(result, null, 2));
+ } else {
+ const icon = STATUS_ICONS[status] ?? "?";
+ console.log(`${icon} ${chalk.bold(node.name)}`);
+ console.log(` Status: ${status}`);
+ if (opts.withWorkflow && workflow.length > 0) {
+ console.log(chalk.dim(" Workflow:"));
+ for (const cmd of workflow) {
+ console.log(` ${chalk.cyan("▸")} ${cmd}`);
+ }
+ }
+ }
+ });
+
task
.command("update <taskId>")
.description("Update a task's status")
diff --git a/ix-cli/src/cli/main.ts b/ix-cli/src/cli/main.ts
index 5e673ac4..45a5dc1b 100644
--- a/ix-cli/src/cli/main.ts
+++ b/ix-cli/src/cli/main.ts
@@ -33,6 +33,7 @@ import { registerBugCommand } from "./commands/bug.js";
import { registerBugsCommand } from "./commands/bugs.js";
import { registerPlansCommand } from "./commands/plans.js";
import { registerWatchCommand } from "./commands/watch.js";
+import { registerBriefingCommand } from "./commands/briefing.js";
const program = new Command();
program
@@ -74,5 +75,6 @@ registerBugCommand(program);
registerBugsCommand(program);
registerPlansCommand(program);
registerWatchCommand(program);
+registerBriefingCommand(program);
program.parse();