octie-cli 1.0.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 (162) hide show
  1. package/README.md +523 -0
  2. package/dist/cli/commands/approve.d.ts +27 -0
  3. package/dist/cli/commands/approve.d.ts.map +1 -0
  4. package/dist/cli/commands/approve.js +119 -0
  5. package/dist/cli/commands/approve.js.map +1 -0
  6. package/dist/cli/commands/batch.d.ts +15 -0
  7. package/dist/cli/commands/batch.d.ts.map +1 -0
  8. package/dist/cli/commands/batch.js +521 -0
  9. package/dist/cli/commands/batch.js.map +1 -0
  10. package/dist/cli/commands/create.d.ts +9 -0
  11. package/dist/cli/commands/create.d.ts.map +1 -0
  12. package/dist/cli/commands/create.js +321 -0
  13. package/dist/cli/commands/create.js.map +1 -0
  14. package/dist/cli/commands/delete.d.ts +9 -0
  15. package/dist/cli/commands/delete.d.ts.map +1 -0
  16. package/dist/cli/commands/delete.js +143 -0
  17. package/dist/cli/commands/delete.js.map +1 -0
  18. package/dist/cli/commands/export.d.ts +9 -0
  19. package/dist/cli/commands/export.d.ts.map +1 -0
  20. package/dist/cli/commands/export.js +66 -0
  21. package/dist/cli/commands/export.js.map +1 -0
  22. package/dist/cli/commands/find.d.ts +16 -0
  23. package/dist/cli/commands/find.d.ts.map +1 -0
  24. package/dist/cli/commands/find.js +252 -0
  25. package/dist/cli/commands/find.js.map +1 -0
  26. package/dist/cli/commands/get.d.ts +9 -0
  27. package/dist/cli/commands/get.d.ts.map +1 -0
  28. package/dist/cli/commands/get.js +74 -0
  29. package/dist/cli/commands/get.js.map +1 -0
  30. package/dist/cli/commands/graph.d.ts +9 -0
  31. package/dist/cli/commands/graph.d.ts.map +1 -0
  32. package/dist/cli/commands/graph.js +200 -0
  33. package/dist/cli/commands/graph.js.map +1 -0
  34. package/dist/cli/commands/import.d.ts +9 -0
  35. package/dist/cli/commands/import.d.ts.map +1 -0
  36. package/dist/cli/commands/import.js +807 -0
  37. package/dist/cli/commands/import.js.map +1 -0
  38. package/dist/cli/commands/init.d.ts +9 -0
  39. package/dist/cli/commands/init.d.ts.map +1 -0
  40. package/dist/cli/commands/init.js +57 -0
  41. package/dist/cli/commands/init.js.map +1 -0
  42. package/dist/cli/commands/list.d.ts +9 -0
  43. package/dist/cli/commands/list.d.ts.map +1 -0
  44. package/dist/cli/commands/list.js +175 -0
  45. package/dist/cli/commands/list.js.map +1 -0
  46. package/dist/cli/commands/merge.d.ts +9 -0
  47. package/dist/cli/commands/merge.d.ts.map +1 -0
  48. package/dist/cli/commands/merge.js +113 -0
  49. package/dist/cli/commands/merge.js.map +1 -0
  50. package/dist/cli/commands/serve.d.ts +9 -0
  51. package/dist/cli/commands/serve.d.ts.map +1 -0
  52. package/dist/cli/commands/serve.js +94 -0
  53. package/dist/cli/commands/serve.js.map +1 -0
  54. package/dist/cli/commands/update.d.ts +9 -0
  55. package/dist/cli/commands/update.d.ts.map +1 -0
  56. package/dist/cli/commands/update.js +423 -0
  57. package/dist/cli/commands/update.js.map +1 -0
  58. package/dist/cli/commands/wire.d.ts +15 -0
  59. package/dist/cli/commands/wire.d.ts.map +1 -0
  60. package/dist/cli/commands/wire.js +164 -0
  61. package/dist/cli/commands/wire.js.map +1 -0
  62. package/dist/cli/index.d.ts +7 -0
  63. package/dist/cli/index.d.ts.map +1 -0
  64. package/dist/cli/index.js +100 -0
  65. package/dist/cli/index.js.map +1 -0
  66. package/dist/cli/output/json.d.ts +16 -0
  67. package/dist/cli/output/json.d.ts.map +1 -0
  68. package/dist/cli/output/json.js +29 -0
  69. package/dist/cli/output/json.js.map +1 -0
  70. package/dist/cli/output/markdown.d.ts +15 -0
  71. package/dist/cli/output/markdown.d.ts.map +1 -0
  72. package/dist/cli/output/markdown.js +206 -0
  73. package/dist/cli/output/markdown.js.map +1 -0
  74. package/dist/cli/output/table.d.ts +23 -0
  75. package/dist/cli/output/table.d.ts.map +1 -0
  76. package/dist/cli/output/table.js +150 -0
  77. package/dist/cli/output/table.js.map +1 -0
  78. package/dist/cli/utils/helpers.d.ts +126 -0
  79. package/dist/cli/utils/helpers.d.ts.map +1 -0
  80. package/dist/cli/utils/helpers.js +325 -0
  81. package/dist/cli/utils/helpers.js.map +1 -0
  82. package/dist/core/graph/algorithms.d.ts +11 -0
  83. package/dist/core/graph/algorithms.d.ts.map +1 -0
  84. package/dist/core/graph/algorithms.js +14 -0
  85. package/dist/core/graph/algorithms.js.map +1 -0
  86. package/dist/core/graph/cycle.d.ts +155 -0
  87. package/dist/core/graph/cycle.d.ts.map +1 -0
  88. package/dist/core/graph/cycle.js +297 -0
  89. package/dist/core/graph/cycle.js.map +1 -0
  90. package/dist/core/graph/index.d.ts +223 -0
  91. package/dist/core/graph/index.d.ts.map +1 -0
  92. package/dist/core/graph/index.js +475 -0
  93. package/dist/core/graph/index.js.map +1 -0
  94. package/dist/core/graph/operations.d.ts +240 -0
  95. package/dist/core/graph/operations.d.ts.map +1 -0
  96. package/dist/core/graph/operations.js +503 -0
  97. package/dist/core/graph/operations.js.map +1 -0
  98. package/dist/core/graph/sort.d.ts +76 -0
  99. package/dist/core/graph/sort.d.ts.map +1 -0
  100. package/dist/core/graph/sort.js +254 -0
  101. package/dist/core/graph/sort.js.map +1 -0
  102. package/dist/core/graph/traversal.d.ts +122 -0
  103. package/dist/core/graph/traversal.d.ts.map +1 -0
  104. package/dist/core/graph/traversal.js +336 -0
  105. package/dist/core/graph/traversal.js.map +1 -0
  106. package/dist/core/models/task-node.d.ts +328 -0
  107. package/dist/core/models/task-node.d.ts.map +1 -0
  108. package/dist/core/models/task-node.js +1090 -0
  109. package/dist/core/models/task-node.js.map +1 -0
  110. package/dist/core/registry/index.d.ts +102 -0
  111. package/dist/core/registry/index.d.ts.map +1 -0
  112. package/dist/core/registry/index.js +249 -0
  113. package/dist/core/registry/index.js.map +1 -0
  114. package/dist/core/registry/root-guard.d.ts +19 -0
  115. package/dist/core/registry/root-guard.d.ts.map +1 -0
  116. package/dist/core/registry/root-guard.js +28 -0
  117. package/dist/core/registry/root-guard.js.map +1 -0
  118. package/dist/core/storage/atomic-write.d.ts +181 -0
  119. package/dist/core/storage/atomic-write.d.ts.map +1 -0
  120. package/dist/core/storage/atomic-write.js +379 -0
  121. package/dist/core/storage/atomic-write.js.map +1 -0
  122. package/dist/core/storage/file-store.d.ts +148 -0
  123. package/dist/core/storage/file-store.d.ts.map +1 -0
  124. package/dist/core/storage/file-store.js +423 -0
  125. package/dist/core/storage/file-store.js.map +1 -0
  126. package/dist/core/storage/indexer.d.ts +138 -0
  127. package/dist/core/storage/indexer.d.ts.map +1 -0
  128. package/dist/core/storage/indexer.js +350 -0
  129. package/dist/core/storage/indexer.js.map +1 -0
  130. package/dist/core/utils/status-helpers.d.ts +59 -0
  131. package/dist/core/utils/status-helpers.d.ts.map +1 -0
  132. package/dist/core/utils/status-helpers.js +149 -0
  133. package/dist/core/utils/status-helpers.js.map +1 -0
  134. package/dist/index.d.ts +10 -0
  135. package/dist/index.d.ts.map +1 -0
  136. package/dist/index.js +10 -0
  137. package/dist/index.js.map +1 -0
  138. package/dist/types/index.d.ts +504 -0
  139. package/dist/types/index.d.ts.map +1 -0
  140. package/dist/types/index.js +182 -0
  141. package/dist/types/index.js.map +1 -0
  142. package/dist/web/routes/graph.d.ts +17 -0
  143. package/dist/web/routes/graph.d.ts.map +1 -0
  144. package/dist/web/routes/graph.js +277 -0
  145. package/dist/web/routes/graph.js.map +1 -0
  146. package/dist/web/routes/projects.d.ts +14 -0
  147. package/dist/web/routes/projects.d.ts.map +1 -0
  148. package/dist/web/routes/projects.js +102 -0
  149. package/dist/web/routes/projects.js.map +1 -0
  150. package/dist/web/routes/tasks.d.ts +17 -0
  151. package/dist/web/routes/tasks.d.ts.map +1 -0
  152. package/dist/web/routes/tasks.js +538 -0
  153. package/dist/web/routes/tasks.js.map +1 -0
  154. package/dist/web/server.d.ts +121 -0
  155. package/dist/web/server.d.ts.map +1 -0
  156. package/dist/web/server.js +389 -0
  157. package/dist/web/server.js.map +1 -0
  158. package/dist/web-ui/assets/index-BB0qvF1y.css +1 -0
  159. package/dist/web-ui/assets/index-Vmm72oKY.js +34 -0
  160. package/dist/web-ui/index.html +14 -0
  161. package/dist/web-ui/vite.svg +1 -0
  162. package/package.json +94 -0
@@ -0,0 +1,240 @@
1
+ /**
2
+ * Graph manipulation operations
3
+ *
4
+ * Implements complex graph operations for task management:
5
+ * - Cut nodes from graph while reconnecting edges
6
+ * - Insert nodes between existing nodes
7
+ * - Move subtrees to new parents
8
+ * - Merge tasks together
9
+ *
10
+ * @module core/graph/operations
11
+ */
12
+ import type { TaskGraphStore } from './index.js';
13
+ import type { MergeResult } from '../../types/index.js';
14
+ import { TaskNode } from '../models/task-node.js';
15
+ /**
16
+ * Cut a node from the graph, reconnecting its incoming edges to its outgoing edges
17
+ *
18
+ * Before: A -> B -> C
19
+ * After: A -> C (B removed)
20
+ *
21
+ * Algorithm:
22
+ * 1. Get all incoming edges to the node
23
+ * 2. Get all outgoing edges from the node
24
+ * 3. For each incoming source, connect it to all outgoing targets
25
+ * 4. Update target blockers to reference new sources instead of deleted node
26
+ * 5. Remove the node from the graph
27
+ *
28
+ * Time Complexity: O(k * m) where k = incoming edges, m = outgoing edges
29
+ *
30
+ * @param graph - Task graph store
31
+ * @param nodeId - Task ID to cut
32
+ * @throws {TaskNotFoundError} If task not found
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * // Graph: A -> B -> C
37
+ * cutNode(graph, 'B');
38
+ * // Result: A -> C (B removed, A now points directly to C)
39
+ * // Also: C.blockers updated from [B] to [A]
40
+ * ```
41
+ */
42
+ export declare function cutNode(graph: TaskGraphStore, nodeId: string): void;
43
+ /**
44
+ * Insert a node between two existing nodes
45
+ *
46
+ * Before: A -> C
47
+ * After: A -> B -> C
48
+ *
49
+ * Algorithm:
50
+ * 1. Verify both nodes exist
51
+ * 2. Verify edge exists from afterId to beforeId
52
+ * 3. Remove the existing edge
53
+ * 4. Add the new node to the graph
54
+ * 5. Create edges: afterId -> newNodeId -> beforeId
55
+ *
56
+ * Time Complexity: O(1) for edge operations
57
+ *
58
+ * @param graph - Task graph store
59
+ * @param newNode - Task node to insert
60
+ * @param afterId - Source node ID (edge comes from here)
61
+ * @param beforeId - Target node ID (edge goes to here)
62
+ * @throws {TaskNotFoundError} If afterId or beforeId not found
63
+ * @throws {ValidationError} If edge doesn't exist or would create duplicate
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * // Graph: A -> C
68
+ * const newNode = createTaskNode({ title: 'B', ... });
69
+ * insertNodeBetween(graph, newNode, 'A', 'C');
70
+ * // Result: A -> B -> C
71
+ * ```
72
+ */
73
+ export declare function insertNodeBetween(graph: TaskGraphStore, newNode: TaskNode, afterId: string, beforeId: string): void;
74
+ /**
75
+ * Move a subtree to a new parent
76
+ *
77
+ * Moves a task (and all its descendants) to be under a new parent.
78
+ * This is useful for reorganizing task hierarchies.
79
+ *
80
+ * Before:
81
+ * A -> X
82
+ * B -> Y
83
+ * After moveSubtree(graph, 'Y', 'A'):
84
+ * A -> X -> Y
85
+ * B
86
+ *
87
+ * Algorithm:
88
+ * 1. Get all current parents of the subtree root
89
+ * 2. Remove edges from all current parents
90
+ * 3. Add edge from new parent to subtree root
91
+ *
92
+ * Time Complexity: O(k) where k = number of current parents
93
+ *
94
+ * @param graph - Task graph store
95
+ * @param subtreeRootId - Root of the subtree to move
96
+ * @param newParentId - New parent task ID
97
+ * @throws {TaskNotFoundError} If subtreeRootId or newParentId not found
98
+ * @throws {ValidationError} If edge already exists or would create self-loop
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * // Graph: A -> X, B -> Y
103
+ * moveSubtree(graph, 'Y', 'X');
104
+ * // Result: A -> X -> Y, B
105
+ * ```
106
+ */
107
+ export declare function moveSubtree(graph: TaskGraphStore, subtreeRootId: string, newParentId: string): void;
108
+ /**
109
+ * Merge two tasks into one
110
+ *
111
+ * Combines the source task into the target task by:
112
+ * 1. Merging all properties (description, success_criteria, deliverables, etc.)
113
+ * 2. Reconnecting all edges from source to point to target
114
+ * 3. Removing the source task
115
+ *
116
+ * Before:
117
+ * A -> source -> C
118
+ * B -> target -> D
119
+ * After mergeTasks(graph, 'source', 'target'):
120
+ * A -> target -> C, D
121
+ * B -> target -> C, D
122
+ * (source is removed)
123
+ *
124
+ * Algorithm:
125
+ * 1. Get source and target tasks
126
+ * 2. Merge target properties with source properties
127
+ * 3. Get all incoming edges to source (except target)
128
+ * 4. Get all outgoing edges from source (except target)
129
+ * 5. Reconnect edges: incoming -> target, target -> outgoing
130
+ * 6. Remove source node
131
+ * 7. Return merge result
132
+ *
133
+ * Time Complexity: O(k + m) where k = incoming edges, m = outgoing edges
134
+ *
135
+ * @param graph - Task graph store
136
+ * @param sourceId - Source task ID (will be removed)
137
+ * @param targetId - Target task ID (will be kept and merged into)
138
+ * @returns Merge result with merged task and affected task IDs
139
+ * @throws {TaskNotFoundError} If source or target not found
140
+ * @throws {ValidationError} If source and target are the same
141
+ *
142
+ * @example
143
+ * ```ts
144
+ * const result = mergeTasks(graph, 'task-001', 'task-002');
145
+ * console.log('Merged task:', result.task.id);
146
+ * console.log('Removed tasks:', result.removedTasks);
147
+ * ```
148
+ */
149
+ export declare function mergeTasks(graph: TaskGraphStore, sourceId: string, targetId: string): MergeResult;
150
+ /**
151
+ * Get all descendants of a node (transitive closure via outgoing edges)
152
+ *
153
+ * Returns all tasks reachable from the given node.
154
+ *
155
+ * @param graph - Task graph store
156
+ * @param nodeId - Starting task ID
157
+ * @returns Set of descendant task IDs (including the starting node)
158
+ * @throws {TaskNotFoundError} If node not found
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * // Graph: A -> B -> C, A -> D
163
+ * const descendants = getDescendants(graph, 'A');
164
+ * // Returns: ['A', 'B', 'C', 'D']
165
+ * ```
166
+ */
167
+ export declare function getDescendants(graph: TaskGraphStore, nodeId: string): Set<string>;
168
+ /**
169
+ * Get all ancestors of a node (transitive closure via incoming edges)
170
+ *
171
+ * Returns all tasks that can reach the given node.
172
+ *
173
+ * @param graph - Task graph store
174
+ * @param nodeId - Starting task ID
175
+ * @returns Set of ancestor task IDs (including the starting node)
176
+ * @throws {TaskNotFoundError} If node not found
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * // Graph: A -> B -> C
181
+ * const ancestors = getAncestors(graph, 'C');
182
+ * // Returns: ['C', 'B', 'A']
183
+ * ```
184
+ */
185
+ export declare function getAncestors(graph: TaskGraphStore, nodeId: string): Set<string>;
186
+ /**
187
+ * Validate that moving a subtree won't create a cycle
188
+ *
189
+ * Checks if adding an edge from newParentId to subtreeRootId would create a cycle.
190
+ * This is important for moveSubtree operations.
191
+ *
192
+ * @param graph - Task graph store
193
+ * @param subtreeRootId - Root of the subtree to move
194
+ * @param newParentId - Potential new parent task ID
195
+ * @returns true if move is safe (won't create cycle), false otherwise
196
+ * @throws {TaskNotFoundError} If either task not found
197
+ *
198
+ * @example
199
+ * ```ts
200
+ * // Graph: A -> B -> C
201
+ * if (isValidSubtreeMove(graph, 'C', 'A')) {
202
+ * // This would create a cycle (A -> B -> C -> A)
203
+ * // Don't allow the move
204
+ * }
205
+ * ```
206
+ */
207
+ export declare function isValidSubtreeMove(graph: TaskGraphStore, subtreeRootId: string, newParentId: string): boolean;
208
+ /**
209
+ * Cascade delete a node and all its dependent tasks
210
+ *
211
+ * Deletes the specified node and all tasks that depend on it (directly or transitively).
212
+ * Tasks are deleted in reverse order (leaves first) to maintain graph integrity.
213
+ *
214
+ * Before:
215
+ * A -> B -> C -> D
216
+ * After cascadeDelete(graph, 'B'):
217
+ * A (B, C, D removed)
218
+ *
219
+ * Algorithm:
220
+ * 1. Get all descendants of the node (tasks that depend on it transitively)
221
+ * 2. Iteratively find and delete leaf nodes (no outgoing edges) first
222
+ * 3. Continue until all descendants are deleted
223
+ *
224
+ * Time Complexity: O(k * m) where k = descendants, m = average edges
225
+ *
226
+ * @param graph - Task graph store
227
+ * @param nodeId - Task ID to cascade delete
228
+ * @returns Array of deleted task IDs (in order of deletion)
229
+ * @throws {TaskNotFoundError} If node not found
230
+ *
231
+ * @example
232
+ * ```ts
233
+ * // Graph: A -> B -> C -> D
234
+ * const deleted = cascadeDelete(graph, 'B');
235
+ * // Returns: ['D', 'C', 'B'] (deleted in this order)
236
+ * // Result: Only A remains
237
+ * ```
238
+ */
239
+ export declare function cascadeDelete(graph: TaskGraphStore, nodeId: string): string[];
240
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/core/graph/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAkCnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,IAAI,CA0BN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,cAAc,EACrB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,IAAI,CAmCN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,WAAW,CAyHb;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CA2BjF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CA2B/E;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,cAAc,EACrB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,OAAO,CAYT;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CA8C7E"}