opencode-swarm-plugin 0.59.1 → 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +14 -1
  2. package/bin/commands/doctor.test.ts +622 -0
  3. package/bin/commands/doctor.ts +658 -0
  4. package/bin/commands/status.test.ts +506 -0
  5. package/bin/commands/status.ts +520 -0
  6. package/bin/commands/tree.ts +39 -3
  7. package/bin/swarm.ts +19 -3
  8. package/claude-plugin/.claude-plugin/plugin.json +1 -1
  9. package/claude-plugin/commands/swarm.md +125 -2
  10. package/claude-plugin/dist/index.js +669 -308
  11. package/claude-plugin/dist/schemas/cell.d.ts +2 -0
  12. package/claude-plugin/dist/schemas/cell.d.ts.map +1 -1
  13. package/claude-plugin/dist/utils/adapter-cache.d.ts +36 -0
  14. package/claude-plugin/dist/utils/adapter-cache.d.ts.map +1 -0
  15. package/claude-plugin/dist/utils/event-utils.d.ts +31 -0
  16. package/claude-plugin/dist/utils/event-utils.d.ts.map +1 -0
  17. package/claude-plugin/dist/utils/git-commit-info.d.ts +10 -0
  18. package/claude-plugin/dist/utils/git-commit-info.d.ts.map +1 -0
  19. package/claude-plugin/dist/utils/tree-renderer.d.ts +69 -13
  20. package/claude-plugin/dist/utils/tree-renderer.d.ts.map +1 -1
  21. package/dist/bin/swarm.js +2664 -980
  22. package/dist/cass-tools.d.ts.map +1 -1
  23. package/dist/dashboard.d.ts.map +1 -1
  24. package/dist/hive.d.ts +8 -0
  25. package/dist/hive.d.ts.map +1 -1
  26. package/dist/hive.js +81 -101
  27. package/dist/hivemind-tools.d.ts.map +1 -1
  28. package/dist/index.d.ts +22 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +458 -311
  31. package/dist/marketplace/index.js +669 -308
  32. package/dist/memory-tools.d.ts.map +1 -1
  33. package/dist/memory.d.ts.map +1 -1
  34. package/dist/plugin.js +456 -308
  35. package/dist/replay-tools.d.ts +5 -1
  36. package/dist/replay-tools.d.ts.map +1 -1
  37. package/dist/schemas/cell.d.ts +2 -0
  38. package/dist/schemas/cell.d.ts.map +1 -1
  39. package/dist/skills.d.ts +4 -0
  40. package/dist/skills.d.ts.map +1 -1
  41. package/dist/storage.d.ts +7 -0
  42. package/dist/storage.d.ts.map +1 -1
  43. package/dist/swarm-mail.d.ts +2 -2
  44. package/dist/swarm-mail.d.ts.map +1 -1
  45. package/dist/swarm-orchestrate.d.ts +12 -0
  46. package/dist/swarm-orchestrate.d.ts.map +1 -1
  47. package/dist/swarm-prompts.d.ts +1 -1
  48. package/dist/swarm-prompts.d.ts.map +1 -1
  49. package/dist/swarm-prompts.js +408 -274
  50. package/dist/swarm-verify.d.ts +100 -0
  51. package/dist/swarm-verify.d.ts.map +1 -0
  52. package/dist/swarm.d.ts +19 -1
  53. package/dist/swarm.d.ts.map +1 -1
  54. package/dist/test-utils/msw-server.d.ts +21 -0
  55. package/dist/test-utils/msw-server.d.ts.map +1 -0
  56. package/dist/utils/adapter-cache.d.ts +36 -0
  57. package/dist/utils/adapter-cache.d.ts.map +1 -0
  58. package/dist/utils/event-utils.d.ts +31 -0
  59. package/dist/utils/event-utils.d.ts.map +1 -0
  60. package/dist/utils/git-commit-info.d.ts +10 -0
  61. package/dist/utils/git-commit-info.d.ts.map +1 -0
  62. package/dist/utils/tree-renderer.d.ts +69 -13
  63. package/dist/utils/tree-renderer.d.ts.map +1 -1
  64. package/package.json +3 -2
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Swarm Verify Module - Verification gate for worker completions
3
+ *
4
+ * Handles verification logic for swarm workers:
5
+ * - Typecheck verification (tsc --noEmit)
6
+ * - Test verification for touched files
7
+ * - Verification gate orchestration
8
+ *
9
+ * Implements the Gate Function (IDENTIFY → RUN → READ → VERIFY → CLAIM)
10
+ * from the superpowers pattern.
11
+ *
12
+ * @module swarm-verify
13
+ */
14
+ /**
15
+ * Verification Gate result - tracks each verification step
16
+ *
17
+ * Based on the Gate Function from superpowers:
18
+ * 1. IDENTIFY: What command proves this claim?
19
+ * 2. RUN: Execute the FULL command (fresh, complete)
20
+ * 3. READ: Full output, check exit code, count failures
21
+ * 4. VERIFY: Does output confirm the claim?
22
+ * 5. ONLY THEN: Make the claim
23
+ */
24
+ export interface VerificationStep {
25
+ name: string;
26
+ command: string;
27
+ passed: boolean;
28
+ exitCode: number;
29
+ output?: string;
30
+ error?: string;
31
+ skipped?: boolean;
32
+ skipReason?: string;
33
+ }
34
+ export interface VerificationGateResult {
35
+ passed: boolean;
36
+ steps: VerificationStep[];
37
+ summary: string;
38
+ blockers: string[];
39
+ }
40
+ /**
41
+ * Run typecheck verification
42
+ *
43
+ * Attempts to run TypeScript type checking on the project.
44
+ * Falls back gracefully if tsc is not available.
45
+ */
46
+ export declare function runTypecheckVerification(): Promise<VerificationStep>;
47
+ /**
48
+ * Run test verification for specific files
49
+ *
50
+ * Attempts to find and run tests related to the touched files.
51
+ * Uses common test patterns (*.test.ts, *.spec.ts, __tests__/).
52
+ */
53
+ export declare function runTestVerification(filesTouched: string[]): Promise<VerificationStep>;
54
+ /**
55
+ * Run the full Verification Gate
56
+ *
57
+ * Implements the Gate Function (IDENTIFY → RUN → READ → VERIFY → CLAIM):
58
+ * 1. Typecheck
59
+ * 2. Tests for touched files
60
+ *
61
+ * NOTE: Bug scanning was removed in v0.31 - it was slowing down completion
62
+ * without providing proportional value.
63
+ *
64
+ * All steps must pass (or be skipped with valid reason) to proceed.
65
+ */
66
+ export declare function runVerificationGate(filesTouched: string[], _skipUbs?: boolean): Promise<VerificationGateResult>;
67
+ /**
68
+ * Run verification gate for a set of files
69
+ *
70
+ * Delegates to the verification worker to run typecheck and tests.
71
+ * Returns structured verification results.
72
+ */
73
+ export declare const swarm_verify: {
74
+ description: string;
75
+ args: {
76
+ files_touched: import("zod").ZodArray<import("zod").ZodString>;
77
+ skip_verification: import("zod").ZodOptional<import("zod").ZodBoolean>;
78
+ };
79
+ execute(args: {
80
+ files_touched: string[];
81
+ skip_verification?: boolean | undefined;
82
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
83
+ };
84
+ /**
85
+ * Verification tools for plugin registration
86
+ */
87
+ export declare const verificationTools: {
88
+ swarm_verify: {
89
+ description: string;
90
+ args: {
91
+ files_touched: import("zod").ZodArray<import("zod").ZodString>;
92
+ skip_verification: import("zod").ZodOptional<import("zod").ZodBoolean>;
93
+ };
94
+ execute(args: {
95
+ files_touched: string[];
96
+ skip_verification?: boolean | undefined;
97
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
98
+ };
99
+ };
100
+ //# sourceMappingURL=swarm-verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swarm-verify.d.ts","sourceRoot":"","sources":["../src/swarm-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAMD;;;;;GAKG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAiC1E;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,MAAM,EAAE,GACrB,OAAO,CAAC,gBAAgB,CAAC,CAoE3B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,MAAM,EAAE,EACtB,QAAQ,GAAE,OAAe,GACxB,OAAO,CAAC,sBAAsB,CAAC,CAsCjC;AAMD;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;CAsFvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;CAE7B,CAAC"}
package/dist/swarm.d.ts CHANGED
@@ -16,11 +16,23 @@ export * from "./swarm-prompts";
16
16
  export * from "./swarm-orchestrate";
17
17
  export * from "./swarm-research";
18
18
  export * from "./swarm-adversarial-review";
19
+ export * from "./swarm-verify";
19
20
  /**
20
21
  * Combined swarm tools for plugin registration.
21
- * Includes all tools from strategy, decompose, prompt, orchestrate, research, and adversarial-review modules.
22
+ * Includes all tools from strategy, decompose, prompt, orchestrate, research, adversarial-review, and verification modules.
22
23
  */
23
24
  export declare const swarmTools: {
25
+ swarm_verify: {
26
+ description: string;
27
+ args: {
28
+ files_touched: import("zod").ZodArray<import("zod").ZodString>;
29
+ skip_verification: import("zod").ZodOptional<import("zod").ZodBoolean>;
30
+ };
31
+ execute(args: {
32
+ files_touched: string[];
33
+ skip_verification?: boolean | undefined;
34
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
35
+ };
24
36
  swarm_adversarial_review: {
25
37
  description: string;
26
38
  args: {
@@ -141,6 +153,9 @@ export declare const swarmTools: {
141
153
  error_count: import("zod").ZodOptional<import("zod").ZodNumber>;
142
154
  retry_count: import("zod").ZodOptional<import("zod").ZodNumber>;
143
155
  skip_review: import("zod").ZodOptional<import("zod").ZodBoolean>;
156
+ commit_sha: import("zod").ZodOptional<import("zod").ZodString>;
157
+ commit_message: import("zod").ZodOptional<import("zod").ZodString>;
158
+ commit_branch: import("zod").ZodOptional<import("zod").ZodString>;
144
159
  };
145
160
  execute(args: {
146
161
  project_key: string;
@@ -155,6 +170,9 @@ export declare const swarmTools: {
155
170
  error_count?: number | undefined;
156
171
  retry_count?: number | undefined;
157
172
  skip_review?: boolean | undefined;
173
+ commit_sha?: string | undefined;
174
+ commit_message?: string | undefined;
175
+ commit_branch?: string | undefined;
158
176
  }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
159
177
  };
160
178
  swarm_record_outcome: {
@@ -1 +1 @@
1
- {"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../src/swarm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAU3C;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOtB,CAAC"}
1
+ {"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../src/swarm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAW/B;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQtB,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Generate a deterministic 1024-dim embedding from text using bag-of-words hashing.
3
+ * Tokens that overlap between texts produce overlapping dimensions → positive cosine similarity.
4
+ * This replaces real Ollama calls (network + GPU) with pure computation (~0ms).
5
+ */
6
+ export declare function fakeDeterministicEmbedding(text: string): number[];
7
+ export declare const ollamaHandlers: import("msw").HttpHandler[];
8
+ /**
9
+ * Creates MSW handlers for the Agent Mail MCP server at 127.0.0.1:8765.
10
+ *
11
+ * @param requests - Mutable array to track intercepted requests (tool name + args)
12
+ * @param toolResponses - Map of tool name → response body to return
13
+ * @returns Array of MSW handlers (MCP endpoint + health check)
14
+ */
15
+ export declare function createAgentMailHandlers(requests: Array<{
16
+ tool: string;
17
+ args: Record<string, unknown>;
18
+ }>, toolResponses?: Record<string, unknown>): import("msw").HttpHandler[];
19
+ /** Shared MSW server with Ollama handlers pre-configured. */
20
+ export declare const server: import("msw/node").SetupServerApi;
21
+ //# sourceMappingURL=msw-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"msw-server.d.ts","sourceRoot":"","sources":["../../src/test-utils/msw-server.ts"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAyBjE;AAMD,eAAO,MAAM,cAAc,6BAiB1B,CAAC;AAMF;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACtC,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC,EAChE,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,+BAqC3C;AAMD,6DAA6D;AAC7D,eAAO,MAAM,MAAM,mCAAiC,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Generic adapter cache for project-scoped singletons
3
+ *
4
+ * Caches expensive adapters (database connections, indexers, etc.)
5
+ * keyed by project path. Ensures one instance per project.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const memoryCache = new AdapterCache<MemoryAdapter>();
10
+ * const adapter = await memoryCache.get(projectPath, async (path) => {
11
+ * const db = await getDatabase(path);
12
+ * return createMemoryAdapter(db);
13
+ * });
14
+ * ```
15
+ */
16
+ export declare class AdapterCache<T> {
17
+ private cached;
18
+ private cachedPath;
19
+ /**
20
+ * Get cached adapter or create new one
21
+ *
22
+ * @param projectPath - Project path to scope the adapter to
23
+ * @param factory - Async factory function to create the adapter
24
+ * @returns Cached or newly created adapter instance
25
+ */
26
+ get(projectPath: string, factory: (path: string) => Promise<T>): Promise<T>;
27
+ /**
28
+ * Clear the cache (useful for testing)
29
+ */
30
+ clear(): void;
31
+ /**
32
+ * Get the currently cached project path
33
+ */
34
+ getCachedPath(): string | null;
35
+ }
36
+ //# sourceMappingURL=adapter-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-cache.d.ts","sourceRoot":"","sources":["../../src/utils/adapter-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,qBAAa,YAAY,CAAC,CAAC;IAC1B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,UAAU,CAAuB;IAEzC;;;;;;OAMG;IACG,GAAG,CACR,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GACnC,OAAO,CAAC,CAAC,CAAC;IAUb;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;CAG9B"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Event Utilities - Safe event emission for swarm-mail
3
+ *
4
+ * Provides a standardized way to emit events with error handling across all tools.
5
+ * Events are emitted to the swarm-mail event store for observability and learning.
6
+ *
7
+ * Pattern extracted from 21+ identical try-catch blocks across tool files.
8
+ */
9
+ /**
10
+ * Safely emit an event to the swarm-mail event store.
11
+ *
12
+ * Wraps event creation and emission in a try-catch to prevent tool failures
13
+ * from event system issues. Logs warnings on failure but continues execution.
14
+ *
15
+ * @param eventType - The type of event to emit (e.g., "cell_created", "memory_stored")
16
+ * @param data - Event data (project_key is added automatically if not present)
17
+ * @param toolName - Name of the calling tool for logging (e.g., "hive_create", "hivemind_store")
18
+ * @param projectPath - Project path for event storage (defaults to process.cwd())
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * await safeEmitEvent(
23
+ * "cell_created",
24
+ * { cell_id: cell.id, title: "Fix bug" },
25
+ * "hive_create",
26
+ * "/path/to/project"
27
+ * );
28
+ * ```
29
+ */
30
+ export declare function safeEmitEvent(eventType: string, data: Record<string, unknown>, toolName: string, projectPath?: string): Promise<void>;
31
+ //# sourceMappingURL=event-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-utils.d.ts","sourceRoot":"","sources":["../../src/utils/event-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,aAAa,CAClC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAcf"}
@@ -0,0 +1,10 @@
1
+ export interface GitCommitInfo {
2
+ sha: string;
3
+ message: string;
4
+ branch: string;
5
+ }
6
+ /**
7
+ * Get current git commit info. Returns null if not in a git repo or on error.
8
+ */
9
+ export declare function getGitCommitInfo(cwd?: string): GitCommitInfo | null;
10
+ //# sourceMappingURL=git-commit-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-commit-info.d.ts","sourceRoot":"","sources":["../../src/utils/git-commit-info.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAUnE"}
@@ -4,15 +4,25 @@
4
4
  * Inspired by Chainlink's tree command.
5
5
  * Credit: https://github.com/dollspace-gay/chainlink
6
6
  *
7
- * Renders cell/epic hierarchies with ASCII box-drawing characters:
8
- * - open
9
- * - in_progress
10
- * - closed
11
- * - blocked
12
- *
13
- * Priority indicators: P0 (critical), P1 (high), P2 (medium), P3 (low)
7
+ * Renders cell/epic hierarchies with box-drawing characters and rich indicators:
8
+ * - [x] closed, [ ] open, [~] in_progress, [!] blocked
9
+ * - Priority coloring: P0/P1 = red, P2 = yellow, P3+ = default
10
+ * - Blocker IDs: [B: abc12, def34] for blocked cells
11
+ * - Epic completion: (3/5 done)
12
+ * - Proper tree connectors: ├──, └──, │
14
13
  */
15
14
  import type { Cell } from "swarm-mail";
15
+ export declare const ansi: {
16
+ red: (s: string) => string;
17
+ yellow: (s: string) => string;
18
+ green: (s: string) => string;
19
+ dim: (s: string) => string;
20
+ bold: (s: string) => string;
21
+ /**
22
+ * Strip ANSI escape codes for length calculation
23
+ */
24
+ strip: (s: string) => string;
25
+ };
16
26
  export interface TreeNode {
17
27
  cell: Cell;
18
28
  children: TreeNode[];
@@ -25,7 +35,24 @@ export interface CellDisplay {
25
35
  blocked: boolean;
26
36
  }
27
37
  /**
28
- * Get status indicator character
38
+ * Blocker info map: cell_id -> array of blocker cell IDs
39
+ */
40
+ export type BlockerMap = Map<string, string[]>;
41
+ /**
42
+ * Options for rendering the tree
43
+ */
44
+ export interface TreeRenderOptions {
45
+ /** Map of cell_id -> blocker IDs */
46
+ blockers?: BlockerMap;
47
+ /** Terminal width for truncation (default: process.stdout.columns || 80) */
48
+ terminalWidth?: number;
49
+ }
50
+ /**
51
+ * Get status marker in checkbox style
52
+ */
53
+ export declare function getStatusMarker(status: string): string;
54
+ /**
55
+ * Get status indicator character (legacy, kept for compatibility)
29
56
  */
30
57
  export declare function getStatusIndicator(status: string): string;
31
58
  /**
@@ -33,9 +60,37 @@ export declare function getStatusIndicator(status: string): string;
33
60
  */
34
61
  export declare function getPriorityLabel(priority: number): string;
35
62
  /**
36
- * Format a single cell line with status, priority, and type
63
+ * Apply priority coloring to a string
64
+ * P0/P1 = red, P2 = yellow, P3+ = default
65
+ */
66
+ export declare function colorByPriority(text: string, priority: number): string;
67
+ /**
68
+ * Count closed children for epic completion display
69
+ */
70
+ export declare function getEpicCompletion(node: TreeNode): {
71
+ done: number;
72
+ total: number;
73
+ };
74
+ /**
75
+ * Format epic completion string: (3/5 done)
76
+ */
77
+ export declare function formatEpicCompletion(node: TreeNode): string;
78
+ /**
79
+ * Shorten a cell ID to last 5 characters for display
80
+ */
81
+ export declare function shortId(id: string): string;
82
+ /**
83
+ * Format blocker suffix: [B: abc12, def34]
84
+ */
85
+ export declare function formatBlockers(blockerIds: string[]): string;
86
+ /**
87
+ * Format a single cell line with status marker, ID, title, priority, epic completion, and blockers
88
+ */
89
+ export declare function formatCellLine(node: TreeNode, options?: TreeRenderOptions): string;
90
+ /**
91
+ * Truncate a line to fit terminal width, accounting for ANSI codes
37
92
  */
38
- export declare function formatCellLine(cell: CellDisplay): string;
93
+ export declare function truncateLine(line: string, maxWidth: number): string;
39
94
  /**
40
95
  * Build tree structure from flat cell list
41
96
  *
@@ -49,13 +104,14 @@ export declare function buildTreeStructure(cells: Cell[]): TreeNode[];
49
104
  * Render a tree node with box-drawing characters
50
105
  *
51
106
  * @param node - The node to render
52
- * @param prefix - Prefix string for indentation
107
+ * @param prefix - Prefix string for indentation (tree connectors for parent levels)
53
108
  * @param isLast - Whether this is the last child of its parent
109
+ * @param options - Rendering options (blockers, terminal width)
54
110
  * @returns Array of output lines
55
111
  */
56
- export declare function renderTreeNode(node: TreeNode, prefix: string, isLast: boolean): string[];
112
+ export declare function renderTreeNode(node: TreeNode, prefix: string, isLast: boolean, options?: TreeRenderOptions): string[];
57
113
  /**
58
114
  * Render full tree from multiple root nodes
59
115
  */
60
- export declare function renderTree(roots: TreeNode[]): string;
116
+ export declare function renderTree(roots: TreeNode[], options?: TreeRenderOptions): string;
61
117
  //# sourceMappingURL=tree-renderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tree-renderer.d.ts","sourceRoot":"","sources":["../../src/utils/tree-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,QAAQ,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAazD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAaxD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,CAqB5D;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,GACd,MAAM,EAAE,CAmCV;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAepD"}
1
+ {"version":3,"file":"tree-renderer.d.ts","sourceRoot":"","sources":["../../src/utils/tree-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAavC,eAAO,MAAM,IAAI;aACN,MAAM;gBACH,MAAM;eACP,MAAM;aACR,MAAM;cACL,MAAM;IAChB;;OAEG;eACQ,MAAM;CAClB,CAAC;AAMF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,QAAQ,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAMD;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAatD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAazD;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQtE;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAIjF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAM3D;AAMD;;GAEG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAG3D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,EACd,OAAO,GAAE,iBAAsB,GAC9B,MAAM,CA6BR;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CA2BnE;AAcD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,CAkC5D;AAMD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,EACf,OAAO,GAAE,iBAAsB,GAC9B,MAAM,EAAE,CAmCV;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,QAAQ,EAAE,EACjB,OAAO,GAAE,iBAAsB,GAC9B,MAAM,CAeR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm-plugin",
3
- "version": "0.59.1",
3
+ "version": "0.60.0",
4
4
  "description": "Multi-agent swarm coordination for OpenCode with learning capabilities, beads integration, and Agent Mail",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -70,7 +70,7 @@
70
70
  "minimatch": "^10.1.1",
71
71
  "pino": "^9.6.0",
72
72
  "pino-roll": "^1.3.0",
73
- "swarm-mail": "1.10.3",
73
+ "swarm-mail": "1.11.0",
74
74
  "yaml": "^2.8.2",
75
75
  "zod": "4.1.8"
76
76
  },
@@ -81,6 +81,7 @@
81
81
  "ai": "6.0.0-beta.150",
82
82
  "bun-types": "^1.3.4",
83
83
  "evalite": "^0.19.0",
84
+ "msw": "^2.12.7",
84
85
  "pino-pretty": "^13.1.3",
85
86
  "turbo": "^2.6.3",
86
87
  "typescript": "^5.7.0",