Skip to content

armgit / Ix

Public Imported from GitHub
0

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

feat: bug entity, plans/bugs listing, developer-cycle views in overview/impact

Tanner Kocher8770f6a45b2c
diff --git a/ix-cli/src/cli/__tests__/bug-patch.test.ts b/ix-cli/src/cli/__tests__/bug-patch.test.ts
new file mode 100644
index 00000000..9e61d2ba
--- /dev/null
+++ b/ix-cli/src/cli/__tests__/bug-patch.test.ts
@@ -0,0 +1,63 @@
+import { describe, it, expect } from "vitest";
+import { buildBugPatch, buildBugUpdatePatch } from "../commands/bug.js";
+
+describe("buildBugPatch", () => {
+ it("creates a Bug node with correct kind and attrs", () => {
+ const patch = buildBugPatch("Login fails", "Users cannot log in", "high");
+ expect(patch.ops[0].type).toBe("UpsertNode");
+ expect(patch.ops[0].kind).toBe("bug");
+ expect(patch.ops[0].name).toBe("Login fails");
+ const attrs = patch.ops[0].attrs as Record<string, unknown>;
+ expect(attrs.description).toBe("Users cannot log in");
+ expect(attrs.status).toBe("open");
+ expect(attrs.severity).toBe("high");
+ expect(attrs.created_at).toBeDefined();
+ });
+
+ it("defaults severity to medium", () => {
+ const patch = buildBugPatch("Minor issue", "Something small");
+ const attrs = patch.ops[0].attrs as Record<string, unknown>;
+ expect(attrs.severity).toBe("medium");
+ });
+
+ it("creates BUG_AFFECTS edges when affects provided", () => {
+ const patch = buildBugPatch("Crash bug", "Crashes on load", "critical", {
+ affects: [
+ { id: "entity-1", kind: "class", name: "AuthService" },
+ { id: "entity-2", kind: "function", name: "verifyToken" },
+ ],
+ });
+ expect(patch.ops.length).toBe(3); // 1 UpsertNode + 2 UpsertEdge
+ expect(patch.ops[1].type).toBe("UpsertEdge");
+ expect(patch.ops[1].predicate).toBe("BUG_AFFECTS");
+ expect(patch.ops[1].src).toBe(patch.ops[0].id);
+ expect(patch.ops[1].dst).toBe("entity-1");
+ expect(patch.ops[2].predicate).toBe("BUG_AFFECTS");
+ expect(patch.ops[2].dst).toBe("entity-2");
+ });
+
+ it("creates no edges when affects is empty", () => {
+ const patch = buildBugPatch("Standalone bug", "No links");
+ expect(patch.ops.length).toBe(1);
+ });
+
+ it("uses sourceType cli", () => {
+ const patch = buildBugPatch("Test bug", "desc");
+ expect(patch.source.sourceType).toBe("cli");
+ });
+});
+
+describe("buildBugUpdatePatch", () => {
+ it("creates an AssertClaim for status change", () => {
+ const patch = buildBugUpdatePatch("bug-id-123", "investigating");
+ expect(patch.ops.length).toBe(1);
+ expect(patch.ops[0].type).toBe("AssertClaim");
+ expect(patch.ops[0].field).toBe("status");
+ expect(patch.ops[0].value).toBe("investigating");
+ });
+
+ it("uses sourceType cli", () => {
+ const patch = buildBugUpdatePatch("bug-id-123", "resolved");
+ expect(patch.source.sourceType).toBe("cli");
+ });
+});
diff --git a/ix-cli/src/cli/__tests__/decide-linking.test.ts b/ix-cli/src/cli/__tests__/decide-linking.test.ts
index 7b835dd0..b75b0271 100644
--- a/ix-cli/src/cli/__tests__/decide-linking.test.ts
+++ b/ix-cli/src/cli/__tests__/decide-linking.test.ts
@@ -40,4 +40,9 @@ describe("buildDecisionPatch", () => {
expect(patch.ops[1].src).toBe("parent-decision-id"); // parent → child
expect(patch.ops[1].dst).toBe(patch.ops[0].id);
});
+
+ it("uses sourceType decision", () => {
+ const patch = buildDecisionPatch("Test", "Reason");
+ expect(patch.source.sourceType).toBe("decision");
+ });
});
diff --git a/ix-cli/src/cli/__tests__/plan-patch.test.ts b/ix-cli/src/cli/__tests__/plan-patch.test.ts
index f58adbde..b86c827d 100644
--- a/ix-cli/src/cli/__tests__/plan-patch.test.ts
+++ b/ix-cli/src/cli/__tests__/plan-patch.test.ts
@@ -13,6 +13,25 @@ describe("buildPlanPatch", () => {
expect(patch.ops[1].src).toBe("goal-id-123");
expect(patch.ops[1].dst).toBe(patch.ops[0].id);
});
+
+ it("adds RESPONDS_TO edge when respondsTo is provided", () => {
+ const patch = buildPlanPatch("Fix plan", "goal-id-123", "bug-id-456");
+ expect(patch.ops.length).toBe(3); // node + GOAL_HAS_PLAN + RESPONDS_TO
+ expect(patch.ops[2].type).toBe("UpsertEdge");
+ expect(patch.ops[2].predicate).toBe("RESPONDS_TO");
+ expect(patch.ops[2].src).toBe(patch.ops[0].id); // plan → bug
+ expect(patch.ops[2].dst).toBe("bug-id-456");
+ });
+
+ it("omits RESPONDS_TO edge when respondsTo is not provided", () => {
+ const patch = buildPlanPatch("Simple plan", "goal-id-123");
+ expect(patch.ops.length).toBe(2);
+ });
+
+ it("uses sourceType cli", () => {
+ const patch = buildPlanPatch("Plan", "goal-id");
+ expect(patch.source.sourceType).toBe("cli");
+ });
});
describe("buildTaskPatch", () => {
@@ -45,6 +64,11 @@ describe("buildTaskPatch", () => {
expect(patch.ops.length).toBe(3); // node + PLAN_HAS_TASK + TASK_AFFECTS
expect(patch.ops[2].predicate).toBe("TASK_AFFECTS");
});
+
+ it("uses sourceType cli", () => {
+ const patch = buildTaskPatch("Task", { planId: "plan-123" });
+ expect(patch.source.sourceType).toBe("cli");
+ });
});
describe("buildTaskUpdatePatch", () => {
@@ -55,4 +79,9 @@ describe("buildTaskUpdatePatch", () => {
expect(patch.ops[0].field).toBe("status");
expect(patch.ops[0].value).toBe("done");
});
+
+ it("uses sourceType cli", () => {
+ const patch = buildTaskUpdatePatch("task-id-123", "done");
+ expect(patch.source.sourceType).toBe("cli");
+ });
});
diff --git a/ix-cli/src/cli/commands/bug.ts b/ix-cli/src/cli/commands/bug.ts
new file mode 100644
index 00000000..629fae91
--- /dev/null
+++ b/ix-cli/src/cli/commands/bug.ts
@@ -0,0 +1,230 @@
+import type { Command } from "commander";
+import type { GraphPatchPayload, PatchOp } from "../../client/types.js";
+import { IxClient } from "../../client/api.js";
+import { getEndpoint } from "../config.js";
+import { deterministicId } from "../github/transform.js";
+import { resolveEntity } from "../resolve.js";
+import { stderr } from "../stderr.js";
+import chalk from "chalk";
+
+// ── Patch builders (exported for testing) ──────────────────────────
+
+function makeBugPatchEnvelope(ops: PatchOp[], intent?: string): GraphPatchPayload {
+ return {
+ patchId: deterministicId(`bug-patch-${Date.now()}-${Math.random()}`),
+ actor: "ix-cli",
+ timestamp: new Date().toISOString(),
+ source: {
+ uri: "ix-cli://bug",
+ extractor: "ix-cli-bug",
+ sourceType: "cli",
+ },
+ baseRev: 0,
+ ops,
+ replaces: [],
+ intent,
+ };
+}
+
+interface BugLinkOpts {
+ affects?: { id: string; kind: string; name: string }[];
+}
+
+export function buildBugPatch(
+ title: string,
+ description: string,
+ severity: string = "medium",
+ linkOpts: BugLinkOpts = {}
+): GraphPatchPayload {
+ const now = new Date().toISOString();
+ const bugId = deterministicId(`bug:${title}:${now}`);
+ const ops: PatchOp[] = [];
+
+ ops.push({
+ type: "UpsertNode",
+ id: bugId,
+ kind: "bug",
+ name: title,
+ attrs: { description, status: "open", severity, created_at: now },
+ });
+
+ if (linkOpts.affects) {
+ for (const entity of linkOpts.affects) {
+ ops.push({
+ type: "UpsertEdge",
+ id: deterministicId(`${bugId}:BUG_AFFECTS:${entity.id}`),
+ src: bugId,
+ dst: entity.id,
+ predicate: "BUG_AFFECTS",
+ attrs: {},
+ });
+ }
+ }
+
+ return makeBugPatchEnvelope(ops, `Create bug: ${title}`);
+}
+
+export function buildBugUpdatePatch(bugId: string, status: string): GraphPatchPayload {
+ const ops: PatchOp[] = [
+ {
+ type: "AssertClaim",
+ entityId: bugId,
+ field: "status",
+ value: status,
+ confidence: 1.0,
+ },
+ ];
+ return makeBugPatchEnvelope(ops, `Update bug ${bugId} status to ${status}`);
+}
+
+// ── CLI commands ───────────────────────────────────────────────────
+
+const VALID_STATUSES = ["open", "investigating", "resolved", "closed"];
+const VALID_SEVERITIES = ["low", "medium", "high", "critical"];
+
+const STATUS_ICONS: Record<string, string> = {
+ open: "○",
+ investigating: "◐",
+ resolved: "●",
+ closed: "✓",
+};
+
+export function registerBugCommand(program: Command): void {
+ const bug = program
+ .command("bug")
+ .description("Manage bugs");
+
+ bug
+ .command("create <title>")
+ .description("Create a new bug")
+ .option("--description <text>", "Bug description", "")
+ .option("--affects <entities>", "Comma-separated entity names to link (creates BUG_AFFECTS edges)")
+ .option("--severity <level>", `Severity (${VALID_SEVERITIES.join("|")})`, "medium")
+ .option("--format <fmt>", "Output format (text|json)", "text")
+ .action(async (title: string, opts: { description: string; affects?: string; severity: string; format: string }) => {
+ if (!VALID_SEVERITIES.includes(opts.severity)) {
+ stderr(`Invalid severity "${opts.severity}". Valid: ${VALID_SEVERITIES.join(", ")}`);
+ process.exitCode = 1;
+ return;
+ }
+
+ const client = new IxClient(getEndpoint());
+ let resolvedAffects: { id: string; kind: string; name: string }[] | undefined;
+
+ if (opts.affects) {
+ const names = opts.affects.split(",").map(s => s.trim());
+ resolvedAffects = [];
+ for (const name of names) {
+ const resolved = await resolveEntity(client, name, [
+ "class", "module", "file", "function", "method", "trait", "object", "interface",
+ ]);
+ if (resolved) {
+ resolvedAffects.push({ id: resolved.id, kind: resolved.kind, name: resolved.name });
+ }
+ }
+ }
+
+ const patch = buildBugPatch(title, opts.description, opts.severity, {
+ affects: resolvedAffects,
+ });
+ const result = await client.commitPatch(patch);
+ const bugId = patch.ops[0].id as string;
+
+ if (opts.format === "json") {
+ console.log(JSON.stringify({ bugId, rev: result.rev, status: result.status }, null, 2));
+ } else {
+ console.log(`Bug created: ${bugId} (rev ${result.rev})`);
+ if (resolvedAffects?.length) {
+ console.log(` Linked to: ${resolvedAffects.map(e => e.name).join(", ")}`);
+ }
+ }
+ });
+
+ bug
+ .command("show <bugId>")
+ .description("Show bug details")
+ .option("--format <fmt>", "Output format (text|json)", "text")
+ .action(async (bugId: string, opts: { format: string }) => {
+ const client = new IxClient(getEndpoint());
+ const details = await client.entity(bugId);
+ const node = details.node as any;
+
+ // Expand BUG_AFFECTS and RESPONDS_TO edges
+ const [affectsResult, respondsToResult] = await Promise.all([
+ client.expand(bugId, { direction: "out", predicates: ["BUG_AFFECTS"] }),
+ client.expand(bugId, { direction: "in", predicates: ["RESPONDS_TO"] }),
+ ]);
+
+ const affects = affectsResult.nodes.map((n: any) => ({
+ id: n.id,
+ kind: n.kind,
+ name: n.name || n.attrs?.name || "(unnamed)",
+ }));
+
+ const plans = respondsToResult.nodes.map((n: any) => ({
+ id: n.id,
+ name: n.name || n.attrs?.name || "(unnamed)",
+ }));
+
+ // Get status from claims or attrs
+ 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 ?? "open")
+ : (node.attrs?.status ?? "open");
+
+ if (opts.format === "json") {
+ console.log(JSON.stringify({
+ bugId,
+ title: node.name,
+ description: node.attrs?.description ?? "",
+ status,
+ severity: node.attrs?.severity ?? "medium",
+ created_at: node.attrs?.created_at ?? node.createdAt,
+ affects,
+ plans,
+ }, null, 2));
+ } else {
+ console.log(`Bug: ${chalk.bold(node.name)}`);
+ console.log(` Status: ${status}`);
+ console.log(` Severity: ${node.attrs?.severity ?? "medium"}`);
+ if (node.attrs?.description) {
+ console.log(` ${chalk.dim(node.attrs.description)}`);
+ }
+ if (affects.length > 0) {
+ console.log(`\nAffects:`);
+ for (const a of affects) {
+ console.log(` ${chalk.cyan(a.kind)} ${a.name}`);
+ }
+ }
+ if (plans.length > 0) {
+ console.log(`\nPlans responding:`);
+ for (const p of plans) {
+ console.log(` ${p.name} (${chalk.dim(p.id.slice(0, 8))})`);
+ }
+ }
+ }
+ });
+
+ bug
+ .command("update <bugId>")
+ .description("Update a bug's status")
+ .requiredOption("--status <status>", `Status (${VALID_STATUSES.join("|")})`)
+ .option("--format <fmt>", "Output format (text|json)", "text")
+ .action(async (bugId: string, opts: { status: string; format: string }) => {
+ if (!VALID_STATUSES.includes(opts.status)) {
+ stderr(`Invalid status "${opts.status}". Valid: ${VALID_STATUSES.join(", ")}`);
+ process.exitCode = 1;
+ return;
+ }
+ const client = new IxClient(getEndpoint());
+ const patch = buildBugUpdatePatch(bugId, opts.status);
+ const result = await client.commitPatch(patch);
+ if (opts.format === "json") {
+ console.log(JSON.stringify({ bugId, status: opts.status, rev: result.rev }, null, 2));
+ } else {
+ console.log(`Bug ${bugId.slice(0, 8)} updated to ${opts.status} (rev ${result.rev})`);
+ }
+ });
+}
diff --git a/ix-cli/src/cli/commands/bugs.ts b/ix-cli/src/cli/commands/bugs.ts
new file mode 100644
index 00000000..c06bea78
--- /dev/null
+++ b/ix-cli/src/cli/commands/bugs.ts
@@ -0,0 +1,26 @@
+import type { Command } from "commander";
+import { IxClient } from "../../client/api.js";
+import { getEndpoint } from "../config.js";
+import { formatBugs } from "../format.js";
+
+export function registerBugsCommand(program: Command): void {
+ program
+ .command("bugs")
+ .description("List all bugs")
+ .option("--status <status>", "Filter by status (open|investigating|resolved|closed)")
+ .option("--limit <n>", "Max results", "50")
+ .option("--format <fmt>", "Output format (text|json)", "text")
+ .action(async (opts: { status?: string; limit: string; format: string }) => {
+ const client = new IxClient(getEndpoint());
+ let nodes = await client.listByKind("bug", { limit: parseInt(opts.limit, 10) });
+
+ if (opts.status) {
+ nodes = nodes.filter((n: any) => {
+ const status = n.attrs?.status ?? "open";
+ return status === opts.status;
+ });
+ }
+
+ formatBugs(nodes, opts.format);
+ });
+}
diff --git a/ix-cli/src/cli/commands/impact.ts b/ix-cli/src/cli/commands/impact.ts
index af6f1052..020feac1 100644
--- a/ix-cli/src/cli/commands/impact.ts
+++ b/ix-cli/src/cli/commands/impact.ts
@@ -54,27 +54,29 @@ async function containerImpact(
): Promise<void> {
const diagnostics: string[] = [];
- // 1. Get contained members
- const containsResult = await client.expand(target.id, {
- direction: "out",
- predicates: ["CONTAINS"],
- });
+ // 1. Get contained members, importers, dependents, and developer-cycle context in parallel
+ const [containsResult, importersResult, dependentsResult, decisionsResult, tasksResult, bugsResult] = await Promise.all([
+ client.expand(target.id, { direction: "out", predicates: ["CONTAINS"] }),
+ client.expand(target.id, { direction: "in", predicates: ["IMPORTS"] }),
+ client.expand(target.id, { direction: "in", predicates: ["CALLS"] }),
+ client.expand(target.id, { direction: "in", predicates: ["DECISION_AFFECTS"] }),
+ client.expand(target.id, { direction: "in", predicates: ["TASK_AFFECTS"] }),
+ client.expand(target.id, { direction: "in", predicates: ["BUG_AFFECTS"] }),
+ ]);
const members = containsResult.nodes;
-
- // 2. Get direct importers
- const importersResult = await client.expand(target.id, {
- direction: "in",
- predicates: ["IMPORTS"],
- });
const directImporters = importersResult.nodes;
-
- // 3. Get direct dependents (callers of the container itself)
- const dependentsResult = await client.expand(target.id, {
- direction: "in",
- predicates: ["CALLS"],
- });
const directDependents = dependentsResult.nodes;
+ const decisions = decisionsResult.nodes.map((n: any) => ({
+ id: n.id, name: n.name || n.attrs?.name || "(unnamed)",
+ }));
+ const tasks = tasksResult.nodes.map((n: any) => ({
+ id: n.id, name: n.name || n.attrs?.name || "(unnamed)", status: String(n.attrs?.status ?? "pending"),
+ }));
+ const bugs = bugsResult.nodes.map((n: any) => ({
+ id: n.id, name: n.name || n.attrs?.name || "(unnamed)", status: String(n.attrs?.status ?? "open"), severity: String(n.attrs?.severity ?? "medium"),
+ }));
+
// 4. For each member (up to 20), get inbound callers
const membersToCheck = members.slice(0, 20);
const memberCallerCounts: { name: string; kind: string; id: string; callerCount: number }[] = [];
@@ -127,6 +129,9 @@ async function containerImpact(
memberLevelCallers: totalMemberCallers,
},
topImpactedMembers: topMembers,
+ decisions: decisions.length > 0 ? decisions : undefined,
+ tasks: tasks.length > 0 ? tasks : undefined,
+ bugs: bugs.length > 0 ? bugs : undefined,
diagnostics,
},
null,
@@ -152,6 +157,29 @@ async function containerImpact(
console.log(chalk.dim("\nNo member-level callers found."));
}
+ if (decisions.length > 0) {
+ console.log(chalk.bold("\nDecisions:"));
+ for (const d of decisions) {
+ console.log(` ${chalk.yellow(d.name)}`);
+ }
+ }
+
+ if (tasks.length > 0) {
+ console.log(chalk.bold("\nTasks:"));
+ for (const t of tasks) {
+ const icon = t.status === "done" ? "✓" : "○";
+ console.log(` ${icon} [${t.status}] ${t.name}`);
+ }
+ }
+
+ if (bugs.length > 0) {
+ console.log(chalk.bold("\nBugs:"));
+ for (const b of bugs) {
+ const icon = b.status === "closed" || b.status === "resolved" ? "✓" : "○";
+ console.log(` ${icon} [${b.status}] ${chalk.red(b.severity)} ${b.name}`);
+ }
+ }
+
if (diagnostics.length > 0) {
console.log(chalk.dim(`\nDiagnostics: ${diagnostics.join("; ")}`));
}
@@ -163,17 +191,24 @@ async function leafImpact(
target: { id: string; kind: string; name: string; resolutionMode: string },
isJson: boolean
): Promise<void> {
- // 1. Get direct callers
- const callersResult = await client.expand(target.id, {
- direction: "in",
- predicates: ["CALLS"],
- });
+ // Fetch callers, callees, and developer-cycle context in parallel
+ const [callersResult, calleesResult, decisionsResult, tasksResult, bugsResult] = await Promise.all([
+ client.expand(target.id, { direction: "in", predicates: ["CALLS"] }),
+ client.expand(target.id, { direction: "out", predicates: ["CALLS"] }),
+ client.expand(target.id, { direction: "in", predicates: ["DECISION_AFFECTS"] }),
+ client.expand(target.id, { direction: "in", predicates: ["TASK_AFFECTS"] }),
+ client.expand(target.id, { direction: "in", predicates: ["BUG_AFFECTS"] }),
+ ]);
- // 2. Get direct callees
- const calleesResult = await client.expand(target.id, {
- direction: "out",
- predicates: ["CALLS"],
- });
+ const decisions = decisionsResult.nodes.map((n: any) => ({
+ id: n.id, name: n.name || n.attrs?.name || "(unnamed)",
+ }));
+ const tasks = tasksResult.nodes.map((n: any) => ({
+ id: n.id, name: n.name || n.attrs?.name || "(unnamed)", status: String(n.attrs?.status ?? "pending"),
+ }));
+ const bugs = bugsResult.nodes.map((n: any) => ({
+ id: n.id, name: n.name || n.attrs?.name || "(unnamed)", status: String(n.attrs?.status ?? "open"), severity: String(n.attrs?.severity ?? "medium"),
+ }));
if (isJson) {
console.log(
@@ -196,6 +231,9 @@ async function leafImpact(
kind: n.kind,
name: n.name || n.attrs?.name || "(unnamed)",
})),
+ decisions: decisions.length > 0 ? decisions : undefined,
+ tasks: tasks.length > 0 ? tasks : undefined,
+ bugs: bugs.length > 0 ? bugs : undefined,
diagnostics: [],
},
null,
@@ -227,5 +265,28 @@ async function leafImpact(
console.log(` ${kindStr} ${name}`);
}
}
+
+ if (decisions.length > 0) {
+ console.log(chalk.bold("\nDecisions:"));
+ for (const d of decisions) {
+ console.log(` ${chalk.yellow(d.name)}`);
+ }
+ }
+
+ if (tasks.length > 0) {
+ console.log(chalk.bold("\nTasks:"));
+ for (const t of tasks) {
+ const icon = t.status === "done" ? "✓" : "○";
+ console.log(` ${icon} [${t.status}] ${t.name}`);
+ }
+ }
+
+ if (bugs.length > 0) {
+ console.log(chalk.bold("\nBugs:"));
+ for (const b of bugs) {
+ const icon = b.status === "closed" || b.status === "resolved" ? "✓" : "○";
+ console.log(` ${icon} [${b.status}] ${chalk.red(b.severity)} ${b.name}`);
+ }
+ }
}
}
diff --git a/ix-cli/src/cli/commands/overview.ts b/ix-cli/src/cli/commands/overview.ts
index bcac6d02..30e8b0fc 100644
--- a/ix-cli/src/cli/commands/overview.ts
+++ b/ix-cli/src/cli/commands/overview.ts
@@ -31,6 +31,7 @@ interface OverviewResult {
diagnostics: string[];
decisions: { id: string; title: string; rationale?: string }[];
tasks: { id: string; title: string; status: string }[];
+ bugs: { id: string; title: string; status: string; severity: string }[];
}
export function registerOverviewCommand(program: Command): void {
@@ -73,13 +74,14 @@ async function overviewContainer(
const diagnostics: string[] = [];
// Fetch entity details, members, imports, and inbound dependents in parallel
- const [details, membersResult, importsResult, inboundResult, decisionsResult, tasksResult] = await Promise.all([
+ const [details, membersResult, importsResult, inboundResult, decisionsResult, tasksResult, bugsResult] = await Promise.all([
client.entity(target.id),
client.expand(target.id, { direction: "out", predicates: ["CONTAINS"] }),
client.expand(target.id, { direction: "out", predicates: ["IMPORTS"] }),
client.expand(target.id, { direction: "in", predicates: ["CALLS", "IMPORTS"] }),
client.expand(target.id, { direction: "in", predicates: ["DECISION_AFFECTS"] }),
client.expand(target.id, { direction: "in", predicates: ["TASK_AFFECTS"] }),
+ client.expand(target.id, { direction: "in", predicates: ["BUG_AFFECTS"] }),
]);
const node = details.node as any;
@@ -101,6 +103,13 @@ async function overviewContainer(
status: String(n.attrs?.status ?? "pending"),
}));
+ const bugs = bugsResult.nodes.map((n: any) => ({
+ id: n.id,
+ title: n.name || n.attrs?.name || "(unnamed)",
+ status: String(n.attrs?.status ?? "open"),
+ severity: String(n.attrs?.severity ?? "medium"),
+ }));
+
// Get top 5 members by name and their inbound CALLS count
const sortedMembers = [...members]
.filter((m: any) => m.name || m.attrs?.name)
@@ -153,6 +162,7 @@ async function overviewContainer(
diagnostics,
decisions,
tasks,
+ bugs,
};
if (format === "json") {
@@ -187,6 +197,14 @@ async function overviewContainer(
console.log(` ${icon} [${t.status}] ${t.title}`);
}
}
+
+ if (bugs.length > 0) {
+ console.log(`\nBugs:`);
+ for (const b of bugs) {
+ const icon = b.status === "closed" || b.status === "resolved" ? "✓" : "○";
+ console.log(` ${icon} [${b.status}] ${chalk.red(b.severity)} ${b.title}`);
+ }
+ }
}
}
@@ -198,12 +216,13 @@ async function overviewCallable(
const diagnostics: string[] = [];
// Fetch entity details, callers, and callees in parallel
- const [details, callersResult, calleesResult, decisionsResult, tasksResult] = await Promise.all([
+ const [details, callersResult, calleesResult, decisionsResult, tasksResult, bugsResult] = await Promise.all([
client.entity(target.id),
client.expand(target.id, { direction: "in", predicates: ["CALLS"] }),
client.expand(target.id, { direction: "out", predicates: ["CALLS"] }),
client.expand(target.id, { direction: "in", predicates: ["DECISION_AFFECTS"] }),
client.expand(target.id, { direction: "in", predicates: ["TASK_AFFECTS"] }),
+ client.expand(target.id, { direction: "in", predicates: ["BUG_AFFECTS"] }),
]);
const node = details.node as any;
@@ -245,6 +264,13 @@ async function overviewCallable(
status: String(n.attrs?.status ?? "pending"),
}));
+ const bugs = bugsResult.nodes.map((n: any) => ({
+ id: n.id,
+ title: n.name || n.attrs?.name || "(unnamed)",
+ status: String(n.attrs?.status ?? "open"),
+ severity: String(n.attrs?.severity ?? "medium"),
+ }));
+
const result: OverviewResult = {
resolvedTarget: { id: target.id, kind: target.kind, name: target.name },
resolutionMode: target.resolutionMode,
@@ -260,6 +286,7 @@ async function overviewCallable(
diagnostics,
decisions,
tasks,
+ bugs,
};
if (format === "json") {
@@ -286,5 +313,13 @@ async function overviewCallable(
console.log(` ${icon} [${t.status}] ${t.title}`);
}
}
+
+ if (bugs.length > 0) {
+ console.log(`\nBugs:`);
+ for (const b of bugs) {
+ const icon = b.status === "closed" || b.status === "resolved" ? "✓" : "○";
+ console.log(` ${icon} [${b.status}] ${chalk.red(b.severity)} ${b.title}`);
+ }
+ }
}
}
diff --git a/ix-cli/src/cli/commands/plan.ts b/ix-cli/src/cli/commands/plan.ts
index 707d2dad..f5ef9d19 100644
--- a/ix-cli/src/cli/commands/plan.ts
+++ b/ix-cli/src/cli/commands/plan.ts
@@ -26,7 +26,7 @@ function makePatchEnvelope(ops: PatchOp[], intent?: string): GraphPatchPayload {
};
}
-export function buildPlanPatch(title: string, goalId: string): GraphPatchPayload {
+export function buildPlanPatch(title: string, goalId: string, respondsTo?: string): GraphPatchPayload {
const planId = deterministicId(`plan:${title}:${goalId}`);
const edgeId = deterministicId(`${goalId}:GOAL_HAS_PLAN:${planId}`);
const ops: PatchOp[] = [
@@ -46,6 +46,18 @@ export function buildPlanPatch(title: string, goalId: string): GraphPatchPayload
attrs: {},
},
];
+
+ if (respondsTo) {
+ ops.push({
+ type: "UpsertEdge",
+ id: deterministicId(`${planId}:RESPONDS_TO:${respondsTo}`),
+ src: planId,
+ dst: respondsTo,
+ predicate: "RESPONDS_TO",
+ attrs: {},
+ });
+ }
+
return makePatchEnvelope(ops, `Create plan: ${title}`);
}
@@ -139,10 +151,11 @@ export function registerPlanCommand(program: Command): void {
.command("create <title>")
.description("Create a new plan linked to a goal")
.requiredOption("--goal <id>", "Goal ID to link the plan to")
+ .option("--responds-to <bugId>", "Bug ID this plan responds to (creates RESPONDS_TO edge)")
.option("--format <fmt>", "Output format (text|json)", "text")
- .action(async (title: string, opts: { goal: string; format: string }) => {
+ .action(async (title: string, opts: { goal: string; respondsTo?: string; format: string }) => {
const client = new IxClient(getEndpoint());
- const patch = buildPlanPatch(title, opts.goal);
+ const patch = buildPlanPatch(title, opts.goal, opts.respondsTo);
const result = await client.commitPatch(patch);
const planId = patch.ops[0].id as string;
if (opts.format === "json") {
diff --git a/ix-cli/src/cli/commands/plans.ts b/ix-cli/src/cli/commands/plans.ts
new file mode 100644
index 00000000..e2306740
--- /dev/null
+++ b/ix-cli/src/cli/commands/plans.ts
@@ -0,0 +1,17 @@
+import type { Command } from "commander";
+import { IxClient } from "../../client/api.js";
+import { getEndpoint } from "../config.js";
+import { formatNodes } from "../format.js";
+
+export function registerPlansCommand(program: Command): void {
+ program
+ .command("plans")
+ .description("List all plans")
+ .option("--limit <n>", "Max results", "50")
+ .option("--format <fmt>", "Output format (text|json)", "text")
+ .action(async (opts: { limit: string; format: string }) => {
+ const client = new IxClient(getEndpoint());
+ const nodes = await client.listByKind("plan", { limit: parseInt(opts.limit, 10) });
+ formatNodes(nodes, opts.format);
+ });
+}
diff --git a/ix-cli/src/cli/format.ts b/ix-cli/src/cli/format.ts
index 7b838329..f68a8db7 100644
--- a/ix-cli/src/cli/format.ts
+++ b/ix-cli/src/cli/format.ts
@@ -123,6 +123,34 @@ export function formatDecisions(nodes: any[], format: string): void {
}
}
+const BUG_STATUS_ICONS: Record<string, string> = {
+ open: "○",
+ investigating: "◐",
+ resolved: "●",
+ closed: "✓",
+};
+
+export function formatBugs(nodes: any[], format: string): void {
+ if (format === "json") {
+ console.log(JSON.stringify(nodes, null, 2));
+ return;
+ }
+ if (nodes.length === 0) {
+ console.log("No bugs found.");
+ return;
+ }
+ for (const n of nodes) {
+ const shortId = n.id.length > 8 ? n.id.slice(0, 8) : n.id;
+ const title = n.name || n.attrs?.title || n.attrs?.name || "(untitled)";
+ const status = n.attrs?.status ?? "open";
+ const severity = n.attrs?.severity ?? "medium";
+ const icon = BUG_STATUS_ICONS[status] ?? "?";
+ console.log(
+ ` ${icon} ${chalk.dim(`[${status}]`.padEnd(16))} ${chalk.red(severity.padEnd(8))} ${chalk.dim(shortId)} ${chalk.bold(title)}`
+ );
+ }
+}
+
export function formatPatches(patches: any[], format: string): void {
if (format === "json") {
console.log(JSON.stringify(patches, null, 2));
diff --git a/ix-cli/src/cli/main.ts b/ix-cli/src/cli/main.ts
index a99320cf..5e673ac4 100644
--- a/ix-cli/src/cli/main.ts
+++ b/ix-cli/src/cli/main.ts
@@ -29,6 +29,9 @@ import { registerRankCommand } from "./commands/rank.js";
import { registerOverviewCommand } from "./commands/overview.js";
import { registerGoalCommand } from "./commands/goal.js";
import { registerPlanCommand, registerTaskCommand } from "./commands/plan.js";
+import { registerBugCommand } from "./commands/bug.js";
+import { registerBugsCommand } from "./commands/bugs.js";
+import { registerPlansCommand } from "./commands/plans.js";
import { registerWatchCommand } from "./commands/watch.js";
const program = new Command();
@@ -67,6 +70,9 @@ registerOverviewCommand(program);
registerGoalCommand(program);
registerPlanCommand(program);
registerTaskCommand(program);
+registerBugCommand(program);
+registerBugsCommand(program);
+registerPlansCommand(program);
registerWatchCommand(program);
program.parse();
diff --git a/memory-layer/src/main/scala/ix/memory/model/Node.scala b/memory-layer/src/main/scala/ix/memory/model/Node.scala
index d3769f07..1dae81d0 100644
--- a/memory-layer/src/main/scala/ix/memory/model/Node.scala
+++ b/memory-layer/src/main/scala/ix/memory/model/Node.scala
@@ -25,6 +25,7 @@ object NodeKind {
case object Method extends NodeKind
case object Plan extends NodeKind
case object Task extends NodeKind
+ case object Bug extends NodeKind
private val nameMap: Map[String, NodeKind] = Map(
"module" -> Module,
@@ -44,7 +45,8 @@ object NodeKind {
"interface" -> Interface,
"method" -> Method,
"plan" -> Plan,
- "task" -> Task
+ "task" -> Task,
+ "bug" -> Bug
)
implicit val encoder: Encoder[NodeKind] = Encoder[String].contramap {
@@ -66,6 +68,7 @@ object NodeKind {
case Method => "method"
case Plan => "plan"
case Task => "task"
+ case Bug => "bug"
}
implicit val decoder: Decoder[NodeKind] = Decoder[String].emap { s =>