@codexa/cli 8.6.0 → 8.6.9
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.
- package/commands/architect.ts +760 -760
- package/commands/check.ts +131 -131
- package/commands/clear.ts +170 -170
- package/commands/decide.ts +249 -249
- package/commands/discover.ts +1071 -1071
- package/commands/knowledge.ts +361 -361
- package/commands/patterns.ts +621 -621
- package/commands/plan.ts +376 -376
- package/commands/product.ts +626 -626
- package/commands/research.ts +754 -754
- package/commands/review.ts +463 -463
- package/commands/standards.ts +200 -200
- package/commands/task.ts +623 -623
- package/commands/utils.ts +1021 -1021
- package/db/connection.ts +32 -32
- package/db/schema.ts +719 -719
- package/detectors/README.md +109 -109
- package/detectors/dotnet.ts +357 -357
- package/detectors/flutter.ts +350 -350
- package/detectors/go.ts +324 -324
- package/detectors/index.ts +387 -387
- package/detectors/jvm.ts +433 -433
- package/detectors/loader.ts +128 -128
- package/detectors/node.ts +493 -493
- package/detectors/python.ts +423 -423
- package/detectors/rust.ts +348 -348
- package/gates/standards-validator.ts +204 -204
- package/gates/validator.ts +441 -441
- package/package.json +44 -43
- package/protocol/process-return.ts +450 -450
- package/protocol/subagent-protocol.ts +401 -401
- package/workflow.ts +783 -782
package/workflow.ts
CHANGED
|
@@ -1,783 +1,784 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
import { Command } from "commander";
|
|
4
|
-
import { planStart, planShow, planTaskAdd, planCancel } from "./commands/plan";
|
|
5
|
-
import { checkRequest, checkApprove, checkReject } from "./commands/check";
|
|
6
|
-
import { taskNext, taskStart, taskDone } from "./commands/task";
|
|
7
|
-
import { decide, listDecisions } from "./commands/decide";
|
|
8
|
-
import { reviewStart, reviewApprove, reviewSkip } from "./commands/review";
|
|
9
|
-
import { addKnowledge, listKnowledge, acknowledgeKnowledge, queryGraph } from "./commands/knowledge";
|
|
10
|
-
import { status, contextExport, recover, contextUpdate } from "./commands/utils";
|
|
11
|
-
import {
|
|
12
|
-
discoverStart,
|
|
13
|
-
discoverConfirm,
|
|
14
|
-
discoverShow,
|
|
15
|
-
discoverSetStack,
|
|
16
|
-
discoverReset,
|
|
17
|
-
discoverRefresh,
|
|
18
|
-
discoverPatterns,
|
|
19
|
-
discoverPatternsShow,
|
|
20
|
-
discoverPatternAdd,
|
|
21
|
-
discoverPatternEdit,
|
|
22
|
-
discoverPatternRemove,
|
|
23
|
-
discoverRefreshPatterns,
|
|
24
|
-
discoverExportPatterns,
|
|
25
|
-
} from "./commands/discover";
|
|
26
|
-
import { clearTasks, clearShow } from "./commands/clear";
|
|
27
|
-
import { standardsList, standardsAdd, standardsEdit, standardsRemove, standardsExport } from "./commands/standards";
|
|
28
|
-
import { productGuide, productImport, productSet, productGoalAdd, productFeatureAdd, productConfirm, productShow, productReset } from "./commands/product";
|
|
29
|
-
import { researchStart, researchShow, researchFill, researchMapAgent, researchReset } from "./commands/research";
|
|
30
|
-
import { patternsExtract, patternsAnalyze } from "./commands/patterns";
|
|
31
|
-
import {
|
|
32
|
-
architectStart,
|
|
33
|
-
architectShow,
|
|
34
|
-
architectList,
|
|
35
|
-
architectSave,
|
|
36
|
-
architectApprove,
|
|
37
|
-
architectExport,
|
|
38
|
-
architectCancel,
|
|
39
|
-
} from "./commands/architect";
|
|
40
|
-
import { initSchema } from "./db/schema";
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.
|
|
47
|
-
.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
.
|
|
58
|
-
.
|
|
59
|
-
.option("--
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
.
|
|
67
|
-
.
|
|
68
|
-
.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
.
|
|
75
|
-
.
|
|
76
|
-
.
|
|
77
|
-
.option("--
|
|
78
|
-
.option("--
|
|
79
|
-
.option("--
|
|
80
|
-
.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
.
|
|
87
|
-
.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
.
|
|
100
|
-
.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
.
|
|
107
|
-
.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
.
|
|
114
|
-
.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
.
|
|
127
|
-
.
|
|
128
|
-
.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
.
|
|
135
|
-
.
|
|
136
|
-
.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
.
|
|
143
|
-
.
|
|
144
|
-
.option("--
|
|
145
|
-
.option("--
|
|
146
|
-
.option("--
|
|
147
|
-
.option("--force
|
|
148
|
-
.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
console.error("
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
//
|
|
167
|
-
//
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
.
|
|
172
|
-
.
|
|
173
|
-
.option("--
|
|
174
|
-
.
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
.
|
|
181
|
-
.
|
|
182
|
-
.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
//
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
.
|
|
195
|
-
.
|
|
196
|
-
.requiredOption("--
|
|
197
|
-
.
|
|
198
|
-
.option("--
|
|
199
|
-
.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
.
|
|
211
|
-
.
|
|
212
|
-
.option("--
|
|
213
|
-
.option("--
|
|
214
|
-
.option("--
|
|
215
|
-
.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
.
|
|
222
|
-
.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
.
|
|
229
|
-
.
|
|
230
|
-
.option("--
|
|
231
|
-
.option("--
|
|
232
|
-
.option("--
|
|
233
|
-
.
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
//
|
|
239
|
-
//
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
.
|
|
246
|
-
.
|
|
247
|
-
.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
.
|
|
254
|
-
.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
.
|
|
261
|
-
.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
//
|
|
267
|
-
//
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
.
|
|
272
|
-
.
|
|
273
|
-
.
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
.
|
|
282
|
-
.
|
|
283
|
-
.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
.
|
|
290
|
-
.
|
|
291
|
-
.option("--
|
|
292
|
-
.option("--
|
|
293
|
-
.
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
.
|
|
301
|
-
.
|
|
302
|
-
.
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
.
|
|
309
|
-
.
|
|
310
|
-
.option("--
|
|
311
|
-
.option("--
|
|
312
|
-
.option("--
|
|
313
|
-
.
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
.
|
|
320
|
-
.
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
//
|
|
327
|
-
//
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
.
|
|
334
|
-
.
|
|
335
|
-
.
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
.
|
|
342
|
-
.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
.
|
|
349
|
-
.
|
|
350
|
-
.
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
.
|
|
357
|
-
.
|
|
358
|
-
.option("--
|
|
359
|
-
.option("--
|
|
360
|
-
.option("--
|
|
361
|
-
.option("--
|
|
362
|
-
.option("--
|
|
363
|
-
.option("--
|
|
364
|
-
.
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
.
|
|
371
|
-
.
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
.
|
|
378
|
-
.
|
|
379
|
-
.
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
//
|
|
385
|
-
//
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
.
|
|
390
|
-
.
|
|
391
|
-
.option("--
|
|
392
|
-
.option("--
|
|
393
|
-
.
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
.
|
|
404
|
-
.
|
|
405
|
-
.requiredOption("--
|
|
406
|
-
.requiredOption("--
|
|
407
|
-
.requiredOption("--
|
|
408
|
-
.requiredOption("--
|
|
409
|
-
.requiredOption("--
|
|
410
|
-
.requiredOption("--
|
|
411
|
-
.
|
|
412
|
-
.option("--
|
|
413
|
-
.option("--
|
|
414
|
-
.
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
.
|
|
432
|
-
.
|
|
433
|
-
.option("--
|
|
434
|
-
.option("--
|
|
435
|
-
.option("--
|
|
436
|
-
.option("--
|
|
437
|
-
.option("--
|
|
438
|
-
.option("--
|
|
439
|
-
.option("--
|
|
440
|
-
.
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
.
|
|
456
|
-
.
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
.
|
|
463
|
-
.
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
.
|
|
471
|
-
.
|
|
472
|
-
.option("--
|
|
473
|
-
.option("--
|
|
474
|
-
.option("--
|
|
475
|
-
.
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
.
|
|
482
|
-
.
|
|
483
|
-
.
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
.
|
|
490
|
-
.
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
//
|
|
496
|
-
//
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
.
|
|
503
|
-
.
|
|
504
|
-
.option("--
|
|
505
|
-
.option("--
|
|
506
|
-
.
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
.
|
|
513
|
-
.
|
|
514
|
-
.requiredOption("--
|
|
515
|
-
.requiredOption("--
|
|
516
|
-
.
|
|
517
|
-
.option("--
|
|
518
|
-
.option("--
|
|
519
|
-
.option("--
|
|
520
|
-
.option("--
|
|
521
|
-
.
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
if (options.
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
.
|
|
540
|
-
.
|
|
541
|
-
.option("--
|
|
542
|
-
.option("--
|
|
543
|
-
.option("--
|
|
544
|
-
.
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
.
|
|
556
|
-
.
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
.
|
|
563
|
-
.
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
//
|
|
569
|
-
//
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
.
|
|
576
|
-
.
|
|
577
|
-
.
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
.
|
|
584
|
-
.
|
|
585
|
-
.option("--
|
|
586
|
-
.
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
.
|
|
593
|
-
.
|
|
594
|
-
.option("--
|
|
595
|
-
.option("--
|
|
596
|
-
.option("--
|
|
597
|
-
.option("--
|
|
598
|
-
.option("--
|
|
599
|
-
.option("--
|
|
600
|
-
.option("--
|
|
601
|
-
.
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
.
|
|
608
|
-
.
|
|
609
|
-
.requiredOption("--
|
|
610
|
-
.
|
|
611
|
-
.
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
.
|
|
618
|
-
.
|
|
619
|
-
.
|
|
620
|
-
.option("--
|
|
621
|
-
.
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
.
|
|
628
|
-
.
|
|
629
|
-
.option("--
|
|
630
|
-
.
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
.
|
|
637
|
-
.
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
.
|
|
644
|
-
.
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
//
|
|
650
|
-
//
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
.
|
|
657
|
-
.
|
|
658
|
-
.
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
.
|
|
665
|
-
.
|
|
666
|
-
.option("--
|
|
667
|
-
.
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
.
|
|
674
|
-
.
|
|
675
|
-
.
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
.
|
|
682
|
-
.
|
|
683
|
-
.
|
|
684
|
-
.option("--
|
|
685
|
-
.option("--
|
|
686
|
-
.
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
.
|
|
693
|
-
.
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
//
|
|
699
|
-
//
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
.
|
|
704
|
-
.
|
|
705
|
-
.option("--
|
|
706
|
-
.
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
//
|
|
716
|
-
//
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
.
|
|
723
|
-
.
|
|
724
|
-
.
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
.
|
|
731
|
-
.
|
|
732
|
-
.option("--
|
|
733
|
-
.
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
.
|
|
740
|
-
.
|
|
741
|
-
.option("--
|
|
742
|
-
.
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
.
|
|
749
|
-
.
|
|
750
|
-
.option("--
|
|
751
|
-
.
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
.
|
|
758
|
-
.
|
|
759
|
-
.option("--
|
|
760
|
-
.
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
.
|
|
767
|
-
.
|
|
768
|
-
.option("--
|
|
769
|
-
.
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
.
|
|
776
|
-
.
|
|
777
|
-
.option("--
|
|
778
|
-
.
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { planStart, planShow, planTaskAdd, planCancel } from "./commands/plan";
|
|
5
|
+
import { checkRequest, checkApprove, checkReject } from "./commands/check";
|
|
6
|
+
import { taskNext, taskStart, taskDone } from "./commands/task";
|
|
7
|
+
import { decide, listDecisions } from "./commands/decide";
|
|
8
|
+
import { reviewStart, reviewApprove, reviewSkip } from "./commands/review";
|
|
9
|
+
import { addKnowledge, listKnowledge, acknowledgeKnowledge, queryGraph } from "./commands/knowledge";
|
|
10
|
+
import { status, contextExport, recover, contextUpdate } from "./commands/utils";
|
|
11
|
+
import {
|
|
12
|
+
discoverStart,
|
|
13
|
+
discoverConfirm,
|
|
14
|
+
discoverShow,
|
|
15
|
+
discoverSetStack,
|
|
16
|
+
discoverReset,
|
|
17
|
+
discoverRefresh,
|
|
18
|
+
discoverPatterns,
|
|
19
|
+
discoverPatternsShow,
|
|
20
|
+
discoverPatternAdd,
|
|
21
|
+
discoverPatternEdit,
|
|
22
|
+
discoverPatternRemove,
|
|
23
|
+
discoverRefreshPatterns,
|
|
24
|
+
discoverExportPatterns,
|
|
25
|
+
} from "./commands/discover";
|
|
26
|
+
import { clearTasks, clearShow } from "./commands/clear";
|
|
27
|
+
import { standardsList, standardsAdd, standardsEdit, standardsRemove, standardsExport } from "./commands/standards";
|
|
28
|
+
import { productGuide, productImport, productSet, productGoalAdd, productFeatureAdd, productConfirm, productShow, productReset } from "./commands/product";
|
|
29
|
+
import { researchStart, researchShow, researchFill, researchMapAgent, researchReset } from "./commands/research";
|
|
30
|
+
import { patternsExtract, patternsAnalyze } from "./commands/patterns";
|
|
31
|
+
import {
|
|
32
|
+
architectStart,
|
|
33
|
+
architectShow,
|
|
34
|
+
architectList,
|
|
35
|
+
architectSave,
|
|
36
|
+
architectApprove,
|
|
37
|
+
architectExport,
|
|
38
|
+
architectCancel,
|
|
39
|
+
} from "./commands/architect";
|
|
40
|
+
import { initSchema } from "./db/schema";
|
|
41
|
+
import pkg from "./package.json";
|
|
42
|
+
|
|
43
|
+
const program = new Command();
|
|
44
|
+
|
|
45
|
+
program
|
|
46
|
+
.name("codexa")
|
|
47
|
+
.description(`Codexa Workflow v${pkg.version} - Sistema de workflow para Claude Code`)
|
|
48
|
+
.version(pkg.version);
|
|
49
|
+
|
|
50
|
+
// ═══════════════════════════════════════════════════════════════
|
|
51
|
+
// FASE: PLAN
|
|
52
|
+
// ═══════════════════════════════════════════════════════════════
|
|
53
|
+
|
|
54
|
+
const planCmd = program.command("plan").description("Comandos da fase PLAN");
|
|
55
|
+
|
|
56
|
+
planCmd
|
|
57
|
+
.command("start <description>")
|
|
58
|
+
.description("Inicia uma nova feature")
|
|
59
|
+
.option("--from-analysis <id>", "Importar baby steps de analise arquitetural aprovada")
|
|
60
|
+
.option("--json", "Saida em JSON")
|
|
61
|
+
.action((description: string, options: { fromAnalysis?: string; json?: boolean }) => {
|
|
62
|
+
planStart(description, options);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
planCmd
|
|
66
|
+
.command("show")
|
|
67
|
+
.description("Mostra o plano atual")
|
|
68
|
+
.option("--json", "Saida em JSON")
|
|
69
|
+
.action((options) => {
|
|
70
|
+
planShow(options.json);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
planCmd
|
|
74
|
+
.command("task-add")
|
|
75
|
+
.description("Adiciona uma task ao plano")
|
|
76
|
+
.requiredOption("--name <name>", "Nome da task")
|
|
77
|
+
.option("--agent <agent>", "Agente responsavel (database, backend, frontend, testing)")
|
|
78
|
+
.option("--depends <ids>", "IDs das tasks que esta depende (ex: 1,2)")
|
|
79
|
+
.option("--files <files>", "Arquivos esperados (ex: src/a.ts,src/b.ts)")
|
|
80
|
+
.option("--sequential", "Marca como sequencial (nao paralelizavel)")
|
|
81
|
+
.action((options) => {
|
|
82
|
+
planTaskAdd(options);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
planCmd
|
|
86
|
+
.command("cancel")
|
|
87
|
+
.description("Cancela a feature atual (soft-cancel, preserva historico)")
|
|
88
|
+
.action(() => {
|
|
89
|
+
planCancel();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// ═══════════════════════════════════════════════════════════════
|
|
93
|
+
// FASE: CHECK
|
|
94
|
+
// ═══════════════════════════════════════════════════════════════
|
|
95
|
+
|
|
96
|
+
const checkCmd = program.command("check").description("Comandos da fase CHECK");
|
|
97
|
+
|
|
98
|
+
checkCmd
|
|
99
|
+
.command("request")
|
|
100
|
+
.description("Solicita aprovacao do plano")
|
|
101
|
+
.action(() => {
|
|
102
|
+
checkRequest();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
checkCmd
|
|
106
|
+
.command("approve")
|
|
107
|
+
.description("Aprova o plano")
|
|
108
|
+
.action(() => {
|
|
109
|
+
checkApprove();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
checkCmd
|
|
113
|
+
.command("reject <reason>")
|
|
114
|
+
.description("Rejeita o plano com motivo")
|
|
115
|
+
.action((reason: string) => {
|
|
116
|
+
checkReject(reason);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// ═══════════════════════════════════════════════════════════════
|
|
120
|
+
// FASE: IMP (Implementacao)
|
|
121
|
+
// ═══════════════════════════════════════════════════════════════
|
|
122
|
+
|
|
123
|
+
const taskCmd = program.command("task").description("Comandos da fase IMP");
|
|
124
|
+
|
|
125
|
+
taskCmd
|
|
126
|
+
.command("next")
|
|
127
|
+
.description("Mostra proximas tasks disponiveis")
|
|
128
|
+
.option("--json", "Saida em JSON")
|
|
129
|
+
.action((options) => {
|
|
130
|
+
taskNext(options.json);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
taskCmd
|
|
134
|
+
.command("start <ids>")
|
|
135
|
+
.description("Inicia task(s) - pode ser multiplas separadas por virgula")
|
|
136
|
+
.option("--json", "Saida em JSON")
|
|
137
|
+
.action((ids: string, options) => {
|
|
138
|
+
taskStart(ids, options.json);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
taskCmd
|
|
142
|
+
.command("done <id>")
|
|
143
|
+
.description("Completa uma task")
|
|
144
|
+
.option("--checkpoint <text>", "Resumo do que foi feito (extraido automaticamente de --output)")
|
|
145
|
+
.option("--output <json>", "Retorno JSON do subagent (processa automaticamente)")
|
|
146
|
+
.option("--files <files>", "Arquivos criados/modificados (extraido automaticamente de --output)")
|
|
147
|
+
.option("--force", "Ignorar validacao de standards (sera registrado)")
|
|
148
|
+
.option("--force-reason <reason>", "Motivo do bypass de validacao")
|
|
149
|
+
.action((id: string, options) => {
|
|
150
|
+
// Checkpoint obrigatorio se nao houver --output
|
|
151
|
+
if (!options.output && !options.checkpoint) {
|
|
152
|
+
console.error("\n[ERRO] Checkpoint obrigatorio.");
|
|
153
|
+
console.error("Use: --checkpoint 'resumo' ou --output '{json do subagent}'\n");
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
taskDone(id, {
|
|
158
|
+
checkpoint: options.checkpoint || "",
|
|
159
|
+
files: options.files,
|
|
160
|
+
force: options.force,
|
|
161
|
+
forceReason: options.forceReason,
|
|
162
|
+
output: options.output,
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// ═══════════════════════════════════════════════════════════════
|
|
167
|
+
// DECISOES
|
|
168
|
+
// ═══════════════════════════════════════════════════════════════
|
|
169
|
+
|
|
170
|
+
program
|
|
171
|
+
.command("decide <title> <decision>")
|
|
172
|
+
.description("Registra uma decisao")
|
|
173
|
+
.option("--rationale <text>", "Justificativa da decisao")
|
|
174
|
+
.option("--force", "Ignorar deteccao de conflitos")
|
|
175
|
+
.action((title: string, decision: string, options) => {
|
|
176
|
+
decide(title, decision, options);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
program
|
|
180
|
+
.command("decisions")
|
|
181
|
+
.description("Lista decisoes")
|
|
182
|
+
.option("--json", "Saida em JSON")
|
|
183
|
+
.action((options) => {
|
|
184
|
+
listDecisions(options.json);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
// ═══════════════════════════════════════════════════════════════
|
|
188
|
+
// KNOWLEDGE BROADCAST
|
|
189
|
+
// ═══════════════════════════════════════════════════════════════
|
|
190
|
+
|
|
191
|
+
const knowledgeCmd = program.command("knowledge").description("Comandos de knowledge broadcast entre tasks");
|
|
192
|
+
|
|
193
|
+
knowledgeCmd
|
|
194
|
+
.command("add")
|
|
195
|
+
.description("Adiciona knowledge para broadcast")
|
|
196
|
+
.requiredOption("--content <text>", "Conteudo do knowledge")
|
|
197
|
+
.requiredOption("--category <cat>", "Categoria (discovery, decision, blocker, pattern, constraint)")
|
|
198
|
+
.option("--severity <level>", "Severidade (info, warning, critical)", "info")
|
|
199
|
+
.option("--broadcast <target>", "Destino (all ou IDs separados por virgula)", "all")
|
|
200
|
+
.action((options) => {
|
|
201
|
+
addKnowledge({
|
|
202
|
+
content: options.content,
|
|
203
|
+
category: options.category,
|
|
204
|
+
severity: options.severity,
|
|
205
|
+
broadcastTo: options.broadcast,
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
knowledgeCmd
|
|
210
|
+
.command("list")
|
|
211
|
+
.description("Lista knowledge da feature atual")
|
|
212
|
+
.option("--unread", "Apenas nao lidos pela task atual")
|
|
213
|
+
.option("--category <cat>", "Filtrar por categoria")
|
|
214
|
+
.option("--severity <level>", "Filtrar por severidade (critical, warning, info)")
|
|
215
|
+
.option("--json", "Saida em JSON")
|
|
216
|
+
.action((options) => {
|
|
217
|
+
listKnowledge(options);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
knowledgeCmd
|
|
221
|
+
.command("ack <id>")
|
|
222
|
+
.description("Marca knowledge como lido pela task atual")
|
|
223
|
+
.action((id: string) => {
|
|
224
|
+
acknowledgeKnowledge(id);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
knowledgeCmd
|
|
228
|
+
.command("graph")
|
|
229
|
+
.description("Consulta o knowledge graph (relacoes entre arquivos, decisoes, patterns)")
|
|
230
|
+
.option("--file <path>", "Buscar relacoes de um arquivo")
|
|
231
|
+
.option("--decision <id>", "Buscar arquivos afetados por uma decisao")
|
|
232
|
+
.option("--contradictions", "Detectar contradicoes entre decisoes")
|
|
233
|
+
.option("--json", "Saida em JSON")
|
|
234
|
+
.action((options) => {
|
|
235
|
+
queryGraph(options);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
// ═══════════════════════════════════════════════════════════════
|
|
239
|
+
// FASE: REV (Review)
|
|
240
|
+
// ═══════════════════════════════════════════════════════════════
|
|
241
|
+
|
|
242
|
+
const reviewCmd = program.command("review").description("Comandos da fase REV");
|
|
243
|
+
|
|
244
|
+
reviewCmd
|
|
245
|
+
.command("start")
|
|
246
|
+
.description("Inicia o review")
|
|
247
|
+
.option("--json", "Saida em JSON")
|
|
248
|
+
.action((options) => {
|
|
249
|
+
reviewStart(options.json);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
reviewCmd
|
|
253
|
+
.command("approve")
|
|
254
|
+
.description("Aprova o review e finaliza a feature")
|
|
255
|
+
.action(() => {
|
|
256
|
+
reviewApprove();
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
reviewCmd
|
|
260
|
+
.command("skip")
|
|
261
|
+
.description("Pula o review e finaliza a feature diretamente")
|
|
262
|
+
.action(() => {
|
|
263
|
+
reviewSkip();
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
// ═══════════════════════════════════════════════════════════════
|
|
267
|
+
// UTILITARIOS
|
|
268
|
+
// ═══════════════════════════════════════════════════════════════
|
|
269
|
+
|
|
270
|
+
program
|
|
271
|
+
.command("status")
|
|
272
|
+
.description("Mostra status atual")
|
|
273
|
+
.option("--json", "Saida em JSON")
|
|
274
|
+
.action((options) => {
|
|
275
|
+
status(options.json);
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
const contextCmd = program.command("context").description("Comandos de contexto");
|
|
279
|
+
|
|
280
|
+
contextCmd
|
|
281
|
+
.command("export")
|
|
282
|
+
.description("Exporta contexto para subagent")
|
|
283
|
+
.option("--task <id>", "ID da task especifica")
|
|
284
|
+
.action((options) => {
|
|
285
|
+
contextExport({ ...options, json: true }); // Sempre JSON
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
contextCmd
|
|
289
|
+
.command("update")
|
|
290
|
+
.description("Atualiza contexto durante implementacao")
|
|
291
|
+
.option("--approach <text>", "Adiciona nova abordagem descoberta")
|
|
292
|
+
.option("--pattern <text>", "Registra padrao identificado no codigo")
|
|
293
|
+
.option("--constraint <text>", "Adiciona nova limitacao encontrada")
|
|
294
|
+
.action((options) => {
|
|
295
|
+
contextUpdate(options);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
// Manter compatibilidade: context sem subcomando = export
|
|
299
|
+
program
|
|
300
|
+
.command("ctx")
|
|
301
|
+
.description("Alias para context export (compatibilidade)")
|
|
302
|
+
.option("--task <id>", "ID da task especifica")
|
|
303
|
+
.action((options) => {
|
|
304
|
+
contextExport({ ...options, json: true });
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
program
|
|
308
|
+
.command("recover")
|
|
309
|
+
.description("Gerencia snapshots para recovery")
|
|
310
|
+
.option("--list", "Lista snapshots disponiveis")
|
|
311
|
+
.option("--snapshot <id>", "Mostra detalhes de um snapshot")
|
|
312
|
+
.option("--restore", "Restaura o snapshot especificado")
|
|
313
|
+
.option("--auto", "Restaura o ultimo snapshot automaticamente")
|
|
314
|
+
.action((options) => {
|
|
315
|
+
recover(options);
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
program
|
|
319
|
+
.command("init")
|
|
320
|
+
.description("Inicializa o banco de dados")
|
|
321
|
+
.action(() => {
|
|
322
|
+
initSchema();
|
|
323
|
+
console.log("\nBanco de dados inicializado em .codexa/db/workflow.db\n");
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
// ═══════════════════════════════════════════════════════════════
|
|
327
|
+
// DISCOVER
|
|
328
|
+
// ═══════════════════════════════════════════════════════════════
|
|
329
|
+
|
|
330
|
+
const discoverCmd = program.command("discover").description("Comandos de descoberta do projeto");
|
|
331
|
+
|
|
332
|
+
discoverCmd
|
|
333
|
+
.command("start")
|
|
334
|
+
.description("Inicia descoberta automatica do projeto")
|
|
335
|
+
.option("--json", "Saida em JSON")
|
|
336
|
+
.action(async (options) => {
|
|
337
|
+
await discoverStart(options.json);
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
discoverCmd
|
|
341
|
+
.command("confirm")
|
|
342
|
+
.description("Confirma e salva a descoberta")
|
|
343
|
+
.action(() => {
|
|
344
|
+
discoverConfirm();
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
discoverCmd
|
|
348
|
+
.command("show")
|
|
349
|
+
.description("Mostra projeto descoberto")
|
|
350
|
+
.option("--json", "Saida em JSON")
|
|
351
|
+
.action((options) => {
|
|
352
|
+
discoverShow(options.json);
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
discoverCmd
|
|
356
|
+
.command("set-stack")
|
|
357
|
+
.description("Define ou ajusta stack manualmente")
|
|
358
|
+
.option("--frontend <value>", "Frontend (next, react, vue, flutter)")
|
|
359
|
+
.option("--backend <value>", "Backend (node, bun, csharp, python, go)")
|
|
360
|
+
.option("--database <value>", "Database (postgres, mongodb, prisma)")
|
|
361
|
+
.option("--orm <value>", "ORM (drizzle, prisma, typeorm, sequelize)")
|
|
362
|
+
.option("--styling <value>", "Styling (tailwind, styled-components)")
|
|
363
|
+
.option("--auth <value>", "Auth (supabase, next-auth, clerk)")
|
|
364
|
+
.option("--testing <value>", "Testing (vitest, jest, playwright)")
|
|
365
|
+
.action((options) => {
|
|
366
|
+
discoverSetStack(options);
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
discoverCmd
|
|
370
|
+
.command("reset")
|
|
371
|
+
.description("Reseta descoberta para refazer")
|
|
372
|
+
.action(() => {
|
|
373
|
+
discoverReset();
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
discoverCmd
|
|
377
|
+
.command("refresh")
|
|
378
|
+
.description("Re-detecta stack e mostra mudancas")
|
|
379
|
+
.option("--force", "Aplica as mudancas detectadas")
|
|
380
|
+
.action(async (options) => {
|
|
381
|
+
await discoverRefresh(options);
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
// ─────────────────────────────────────────────────────────────────
|
|
385
|
+
// PATTERNS (v7.4)
|
|
386
|
+
// ─────────────────────────────────────────────────────────────────
|
|
387
|
+
|
|
388
|
+
discoverCmd
|
|
389
|
+
.command("patterns")
|
|
390
|
+
.description("Lista implementation patterns extraidos")
|
|
391
|
+
.option("--category <cat>", "Filtrar por categoria")
|
|
392
|
+
.option("--show <name>", "Mostra detalhes de um pattern")
|
|
393
|
+
.option("--json", "Saida em JSON")
|
|
394
|
+
.action((options) => {
|
|
395
|
+
if (options.show) {
|
|
396
|
+
discoverPatternsShow(options.show, options.json);
|
|
397
|
+
} else {
|
|
398
|
+
discoverPatterns({ category: options.category, json: options.json });
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
discoverCmd
|
|
403
|
+
.command("pattern-add")
|
|
404
|
+
.description("Adiciona um implementation pattern")
|
|
405
|
+
.requiredOption("--category <cat>", "Categoria (component, hook, service, route, schema, test, action)")
|
|
406
|
+
.requiredOption("--name <name>", "Nome unico do pattern")
|
|
407
|
+
.requiredOption("--scope <scope>", "Escopo (frontend, backend, database, testing)")
|
|
408
|
+
.requiredOption("--applies-to <glob>", "Glob pattern dos arquivos (ex: src/components/**/*.tsx)")
|
|
409
|
+
.requiredOption("--structure <json>", "JSON com estrutura (imports, exports, patterns, conventions)")
|
|
410
|
+
.requiredOption("--template <code>", "Template com placeholders")
|
|
411
|
+
.requiredOption("--examples <json>", "JSON array de exemplos [{path, relevance}]")
|
|
412
|
+
.option("--anti-patterns <json>", "JSON array de anti-patterns")
|
|
413
|
+
.option("--confidence <num>", "Confianca 0-1", "0.8")
|
|
414
|
+
.option("--extracted-from <num>", "Numero de arquivos analisados", "1")
|
|
415
|
+
.action((options) => {
|
|
416
|
+
discoverPatternAdd({
|
|
417
|
+
category: options.category,
|
|
418
|
+
name: options.name,
|
|
419
|
+
scope: options.scope,
|
|
420
|
+
appliesTo: options.appliesTo,
|
|
421
|
+
structure: options.structure,
|
|
422
|
+
template: options.template,
|
|
423
|
+
examples: options.examples,
|
|
424
|
+
antiPatterns: options.antiPatterns,
|
|
425
|
+
confidence: parseFloat(options.confidence),
|
|
426
|
+
extractedFrom: parseInt(options.extractedFrom),
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
discoverCmd
|
|
431
|
+
.command("pattern-edit <name>")
|
|
432
|
+
.description("Edita um implementation pattern")
|
|
433
|
+
.option("--category <cat>", "Nova categoria")
|
|
434
|
+
.option("--scope <scope>", "Novo escopo")
|
|
435
|
+
.option("--applies-to <glob>", "Novo glob pattern")
|
|
436
|
+
.option("--structure <json>", "Nova estrutura JSON")
|
|
437
|
+
.option("--template <code>", "Novo template")
|
|
438
|
+
.option("--examples <json>", "Novos exemplos JSON")
|
|
439
|
+
.option("--anti-patterns <json>", "Novos anti-patterns JSON")
|
|
440
|
+
.option("--confidence <num>", "Nova confianca 0-1")
|
|
441
|
+
.action((name, options) => {
|
|
442
|
+
discoverPatternEdit(name, {
|
|
443
|
+
category: options.category,
|
|
444
|
+
scope: options.scope,
|
|
445
|
+
appliesTo: options.appliesTo,
|
|
446
|
+
structure: options.structure,
|
|
447
|
+
template: options.template,
|
|
448
|
+
examples: options.examples,
|
|
449
|
+
antiPatterns: options.antiPatterns,
|
|
450
|
+
confidence: options.confidence ? parseFloat(options.confidence) : undefined,
|
|
451
|
+
});
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
discoverCmd
|
|
455
|
+
.command("pattern-remove <name>")
|
|
456
|
+
.description("Remove um implementation pattern")
|
|
457
|
+
.action((name) => {
|
|
458
|
+
discoverPatternRemove(name);
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
discoverCmd
|
|
462
|
+
.command("refresh-patterns")
|
|
463
|
+
.description("Re-extrai patterns do codigo (requer analise manual)")
|
|
464
|
+
.action(() => {
|
|
465
|
+
discoverRefreshPatterns();
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
// v8.0: Extração automática de patterns via grepai
|
|
469
|
+
discoverCmd
|
|
470
|
+
.command("extract-patterns")
|
|
471
|
+
.description("Extrai patterns automaticamente via grepai (busca semântica)")
|
|
472
|
+
.option("--scope <scope>", "Escopo (frontend, backend, database, testing)")
|
|
473
|
+
.option("--all", "Extrair de todos os escopos")
|
|
474
|
+
.option("--dry-run", "Apenas mostrar o que seria extraido")
|
|
475
|
+
.option("--json", "Saida em JSON")
|
|
476
|
+
.action((options) => {
|
|
477
|
+
patternsExtract(options);
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
discoverCmd
|
|
481
|
+
.command("analyze-file <path>")
|
|
482
|
+
.description("Analisa estrutura de um arquivo (imports, exports, convencoes)")
|
|
483
|
+
.option("--json", "Saida em JSON")
|
|
484
|
+
.action((path, options) => {
|
|
485
|
+
patternsAnalyze(path, options.json);
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
discoverCmd
|
|
489
|
+
.command("export-patterns")
|
|
490
|
+
.description("Regenera arquivo patterns.md")
|
|
491
|
+
.action(() => {
|
|
492
|
+
discoverExportPatterns();
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
// ═══════════════════════════════════════════════════════════════
|
|
496
|
+
// STANDARDS
|
|
497
|
+
// ═══════════════════════════════════════════════════════════════
|
|
498
|
+
|
|
499
|
+
const standardsCmd = program.command("standards").description("Comandos de gerenciamento de standards");
|
|
500
|
+
|
|
501
|
+
standardsCmd
|
|
502
|
+
.command("list")
|
|
503
|
+
.description("Lista todos os standards")
|
|
504
|
+
.option("--category <cat>", "Filtrar por categoria")
|
|
505
|
+
.option("--scope <scope>", "Filtrar por escopo")
|
|
506
|
+
.option("--json", "Saida em JSON")
|
|
507
|
+
.action((options) => {
|
|
508
|
+
standardsList(options);
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
standardsCmd
|
|
512
|
+
.command("add")
|
|
513
|
+
.description("Adiciona um novo standard")
|
|
514
|
+
.requiredOption("--category <cat>", "Categoria (stack, structure, naming, code, library, practice)")
|
|
515
|
+
.requiredOption("--scope <scope>", "Escopo (all, database, backend, frontend, testing)")
|
|
516
|
+
.requiredOption("--rule <rule>", "Regra a ser seguida")
|
|
517
|
+
.option("--examples <list>", "Exemplos separados por virgula")
|
|
518
|
+
.option("--anti-examples <list>", "Anti-exemplos separados por virgula")
|
|
519
|
+
.option("--enforcement <level>", "Nivel de enforcement (required, recommended)")
|
|
520
|
+
.option("--required", "Alias para --enforcement required")
|
|
521
|
+
.option("--recommended", "Alias para --enforcement recommended")
|
|
522
|
+
.action((options) => {
|
|
523
|
+
// Resolver aliases de enforcement
|
|
524
|
+
let enforcement = options.enforcement;
|
|
525
|
+
if (options.required) enforcement = "required";
|
|
526
|
+
if (options.recommended) enforcement = "recommended";
|
|
527
|
+
|
|
528
|
+
standardsAdd({
|
|
529
|
+
category: options.category,
|
|
530
|
+
scope: options.scope,
|
|
531
|
+
rule: options.rule,
|
|
532
|
+
examples: options.examples,
|
|
533
|
+
antiExamples: options.antiExamples,
|
|
534
|
+
enforcement: enforcement,
|
|
535
|
+
});
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
standardsCmd
|
|
539
|
+
.command("edit <id>")
|
|
540
|
+
.description("Edita um standard existente")
|
|
541
|
+
.option("--rule <rule>", "Nova regra")
|
|
542
|
+
.option("--examples <list>", "Novos exemplos")
|
|
543
|
+
.option("--anti-examples <list>", "Novos anti-exemplos")
|
|
544
|
+
.option("--enforcement <level>", "Novo nivel de enforcement")
|
|
545
|
+
.action((id, options) => {
|
|
546
|
+
standardsEdit(id, {
|
|
547
|
+
rule: options.rule,
|
|
548
|
+
examples: options.examples,
|
|
549
|
+
antiExamples: options.antiExamples,
|
|
550
|
+
enforcement: options.enforcement,
|
|
551
|
+
});
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
standardsCmd
|
|
555
|
+
.command("remove <id>")
|
|
556
|
+
.description("Remove um standard")
|
|
557
|
+
.action((id) => {
|
|
558
|
+
standardsRemove(id);
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
standardsCmd
|
|
562
|
+
.command("export")
|
|
563
|
+
.description("Regenera arquivo standards.md")
|
|
564
|
+
.action(() => {
|
|
565
|
+
standardsExport();
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
// ═══════════════════════════════════════════════════════════════
|
|
569
|
+
// PRODUCT (Contexto de Produto / PRD)
|
|
570
|
+
// ═══════════════════════════════════════════════════════════════
|
|
571
|
+
|
|
572
|
+
const productCmd = program.command("product").description("Comandos de contexto de produto (PRD)");
|
|
573
|
+
|
|
574
|
+
productCmd
|
|
575
|
+
.command("guide")
|
|
576
|
+
.description("Inicia modo guiado para definir contexto de produto")
|
|
577
|
+
.option("--json", "Saida em JSON")
|
|
578
|
+
.action((options) => {
|
|
579
|
+
productGuide(options.json);
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
productCmd
|
|
583
|
+
.command("import")
|
|
584
|
+
.description("Importa PRD existente")
|
|
585
|
+
.option("--file <path>", "Caminho para arquivo PRD")
|
|
586
|
+
.option("--content <text>", "Conteudo do PRD")
|
|
587
|
+
.action((options) => {
|
|
588
|
+
productImport(options);
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
productCmd
|
|
592
|
+
.command("set")
|
|
593
|
+
.description("Define campos do contexto de produto")
|
|
594
|
+
.option("--name <name>", "Nome do produto")
|
|
595
|
+
.option("--problem <text>", "Problema que o produto resolve")
|
|
596
|
+
.option("--solution <text>", "Solucao proposta")
|
|
597
|
+
.option("--targetUsers <text>", "Usuarios alvo")
|
|
598
|
+
.option("--valueProposition <text>", "Proposta de valor")
|
|
599
|
+
.option("--successMetrics <list>", "Metricas de sucesso (separadas por virgula)")
|
|
600
|
+
.option("--outOfScope <list>", "Itens fora do escopo (separados por virgula)")
|
|
601
|
+
.option("--constraints <list>", "Restricoes (separadas por virgula)")
|
|
602
|
+
.action((options) => {
|
|
603
|
+
productSet(options);
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
productCmd
|
|
607
|
+
.command("goal-add")
|
|
608
|
+
.description("Adiciona um objetivo do produto")
|
|
609
|
+
.requiredOption("--category <cat>", "Categoria (negocio, tecnico, usuario, operacional)")
|
|
610
|
+
.requiredOption("--goal <text>", "Descricao do objetivo")
|
|
611
|
+
.option("--priority <level>", "Prioridade (high, medium, low)", "medium")
|
|
612
|
+
.action((options) => {
|
|
613
|
+
productGoalAdd(options);
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
productCmd
|
|
617
|
+
.command("feature-add")
|
|
618
|
+
.description("Adiciona uma feature core do produto")
|
|
619
|
+
.requiredOption("--name <name>", "Nome da feature")
|
|
620
|
+
.option("--description <text>", "Descricao da feature")
|
|
621
|
+
.option("--priority <level>", "Prioridade (high, medium, low)", "medium")
|
|
622
|
+
.action((options) => {
|
|
623
|
+
productFeatureAdd(options);
|
|
624
|
+
});
|
|
625
|
+
|
|
626
|
+
productCmd
|
|
627
|
+
.command("show")
|
|
628
|
+
.description("Mostra contexto de produto")
|
|
629
|
+
.option("--json", "Saida em JSON")
|
|
630
|
+
.option("--pending", "Mostra contexto pendente (nao confirmado)")
|
|
631
|
+
.action((options) => {
|
|
632
|
+
productShow(options);
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
productCmd
|
|
636
|
+
.command("confirm")
|
|
637
|
+
.description("Confirma e salva o contexto de produto")
|
|
638
|
+
.action(() => {
|
|
639
|
+
productConfirm();
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
productCmd
|
|
643
|
+
.command("reset")
|
|
644
|
+
.description("Reseta contexto de produto para refazer")
|
|
645
|
+
.action(() => {
|
|
646
|
+
productReset();
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
// ═══════════════════════════════════════════════════════════════
|
|
650
|
+
// RESEARCH (Contexto de Bibliotecas)
|
|
651
|
+
// ═══════════════════════════════════════════════════════════════
|
|
652
|
+
|
|
653
|
+
const researchCmd = program.command("research").description("Comandos de pesquisa de contexto de bibliotecas");
|
|
654
|
+
|
|
655
|
+
researchCmd
|
|
656
|
+
.command("start")
|
|
657
|
+
.description("Detecta bibliotecas do projeto e cria arquivos de contexto")
|
|
658
|
+
.option("--json", "Saida em JSON")
|
|
659
|
+
.action(async (options) => {
|
|
660
|
+
await researchStart(options);
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
researchCmd
|
|
664
|
+
.command("show")
|
|
665
|
+
.description("Mostra status das bibliotecas detectadas")
|
|
666
|
+
.option("--json", "Saida em JSON")
|
|
667
|
+
.option("--lib <name>", "Filtrar por biblioteca especifica")
|
|
668
|
+
.action((options) => {
|
|
669
|
+
researchShow(options);
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
researchCmd
|
|
673
|
+
.command("fill <lib>")
|
|
674
|
+
.description("Gera instrucoes para preencher contexto de uma biblioteca")
|
|
675
|
+
.option("--json", "Saida em JSON")
|
|
676
|
+
.action((lib: string, options) => {
|
|
677
|
+
researchFill(lib, options);
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
researchCmd
|
|
681
|
+
.command("map-agent")
|
|
682
|
+
.description("Gerencia mapeamento de bibliotecas para agentes")
|
|
683
|
+
.requiredOption("--agent <type>", "Tipo do agente (frontend, backend, database, testing)")
|
|
684
|
+
.option("--add <libs>", "Adicionar bibliotecas (separadas por virgula)")
|
|
685
|
+
.option("--remove <libs>", "Remover bibliotecas (separadas por virgula)")
|
|
686
|
+
.option("--json", "Saida em JSON")
|
|
687
|
+
.action((options) => {
|
|
688
|
+
researchMapAgent(options);
|
|
689
|
+
});
|
|
690
|
+
|
|
691
|
+
researchCmd
|
|
692
|
+
.command("reset")
|
|
693
|
+
.description("Remove todos os contextos de biblioteca")
|
|
694
|
+
.action(() => {
|
|
695
|
+
researchReset();
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
// ═══════════════════════════════════════════════════════════════
|
|
699
|
+
// CLEAR (Limpeza de Tasks - v8.0: limpeza completa removida)
|
|
700
|
+
// ═══════════════════════════════════════════════════════════════
|
|
701
|
+
|
|
702
|
+
program
|
|
703
|
+
.command("clear")
|
|
704
|
+
.description("Limpa tasks/features mantendo configuracoes do projeto (standards, patterns, PRD)")
|
|
705
|
+
.option("--force", "Confirma a limpeza (sem isso apenas mostra o que sera removido)")
|
|
706
|
+
.option("--show", "Mostra estado atual dos arquivos do workflow")
|
|
707
|
+
.action((options) => {
|
|
708
|
+
if (options.show) {
|
|
709
|
+
clearShow();
|
|
710
|
+
} else {
|
|
711
|
+
clearTasks({ force: options.force });
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
// ═══════════════════════════════════════════════════════════════
|
|
716
|
+
// ARCHITECT (Analise Arquitetural)
|
|
717
|
+
// ═══════════════════════════════════════════════════════════════
|
|
718
|
+
|
|
719
|
+
const architectCmd = program.command("architect").description("Comandos de analise arquitetural");
|
|
720
|
+
|
|
721
|
+
architectCmd
|
|
722
|
+
.command("start <description>")
|
|
723
|
+
.description("Inicia nova analise arquitetural")
|
|
724
|
+
.option("--json", "Saida em JSON")
|
|
725
|
+
.action((description: string, options) => {
|
|
726
|
+
architectStart(description, options);
|
|
727
|
+
});
|
|
728
|
+
|
|
729
|
+
architectCmd
|
|
730
|
+
.command("show")
|
|
731
|
+
.description("Mostra analise atual ou especifica")
|
|
732
|
+
.option("--id <id>", "ID da analise")
|
|
733
|
+
.option("--json", "Saida em JSON")
|
|
734
|
+
.action((options) => {
|
|
735
|
+
architectShow(options);
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
architectCmd
|
|
739
|
+
.command("list")
|
|
740
|
+
.description("Lista todas as analises")
|
|
741
|
+
.option("--status <status>", "Filtrar por status (pending, approved, implemented, rejected)")
|
|
742
|
+
.option("--json", "Saida em JSON")
|
|
743
|
+
.action((options) => {
|
|
744
|
+
architectList(options);
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
architectCmd
|
|
748
|
+
.command("save")
|
|
749
|
+
.description("Salva analise em arquivo markdown")
|
|
750
|
+
.option("--file <path>", "Caminho do arquivo (default: .codexa/analysis/ARCH-xxx.md)")
|
|
751
|
+
.option("--json", "Saida em JSON")
|
|
752
|
+
.action((options) => {
|
|
753
|
+
architectSave(options);
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
architectCmd
|
|
757
|
+
.command("approve")
|
|
758
|
+
.description("Aprova analise para implementacao")
|
|
759
|
+
.option("--id <id>", "ID da analise")
|
|
760
|
+
.option("--json", "Saida em JSON")
|
|
761
|
+
.action((options) => {
|
|
762
|
+
architectApprove(options);
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
architectCmd
|
|
766
|
+
.command("export")
|
|
767
|
+
.description("Exporta baby steps como comandos para criar tasks")
|
|
768
|
+
.option("--id <id>", "ID da analise")
|
|
769
|
+
.option("--json", "Saida em JSON")
|
|
770
|
+
.action((options) => {
|
|
771
|
+
architectExport(options);
|
|
772
|
+
});
|
|
773
|
+
|
|
774
|
+
architectCmd
|
|
775
|
+
.command("cancel")
|
|
776
|
+
.description("Cancela analise pendente")
|
|
777
|
+
.option("--id <id>", "ID da analise")
|
|
778
|
+
.option("--json", "Saida em JSON")
|
|
779
|
+
.action((options) => {
|
|
780
|
+
architectCancel(options);
|
|
781
|
+
});
|
|
782
|
+
|
|
783
|
+
// Parse e executa
|
|
783
784
|
program.parse();
|