cortexctl 0.1.0.dev20260811135705__py3-none-any.whl

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.
cortex_cli/registry.py ADDED
@@ -0,0 +1,862 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+
5
+
6
+ @dataclass(frozen=True)
7
+ class CommandLeaf:
8
+ name: str
9
+ description: str
10
+ permission: str
11
+ output: str = "human | --json"
12
+ status: str = "planned"
13
+ examples: list[str] = field(default_factory=list)
14
+
15
+
16
+ @dataclass(frozen=True)
17
+ class CommandSpec:
18
+ name: str
19
+ description: str
20
+ permission: str
21
+ commands: list[CommandLeaf]
22
+
23
+
24
+ COMMAND_GROUPS: list[CommandSpec] = [
25
+ CommandSpec(
26
+ name="auth",
27
+ description="Login, inspect current identity, and logout.",
28
+ permission="anonymous | authenticated",
29
+ commands=[
30
+ CommandLeaf(
31
+ name="login",
32
+ description=(
33
+ "Login with Feishu OAuth device flow, or debug email when "
34
+ "--email is provided."
35
+ ),
36
+ permission="anonymous",
37
+ status="implemented",
38
+ examples=[
39
+ "cortex auth login",
40
+ "cortex auth login --method loopback",
41
+ (
42
+ "cortex auth login --email user@example.com "
43
+ "--password <debug-password>"
44
+ ),
45
+ ],
46
+ ),
47
+ CommandLeaf(
48
+ name="whoami",
49
+ description="Show current user and token status.",
50
+ permission="authenticated",
51
+ status="implemented",
52
+ examples=["cortex auth whoami --json"],
53
+ ),
54
+ CommandLeaf(
55
+ name="logout",
56
+ description="Clear local credentials and revoke refresh token.",
57
+ permission="authenticated",
58
+ status="implemented",
59
+ examples=["cortex auth logout"],
60
+ ),
61
+ ],
62
+ ),
63
+ CommandSpec(
64
+ name="workspace",
65
+ description="Manage and select workspaces.",
66
+ permission="authenticated",
67
+ commands=[
68
+ CommandLeaf(
69
+ name="list",
70
+ description="List joined workspaces and pending invites.",
71
+ permission="authenticated",
72
+ status="implemented",
73
+ examples=["cortex workspace list --json"],
74
+ ),
75
+ CommandLeaf(
76
+ name="use",
77
+ description="Set the default workspace for later commands.",
78
+ permission="workspace member",
79
+ status="implemented",
80
+ examples=["cortex workspace use <workspace-id>"],
81
+ ),
82
+ CommandLeaf(
83
+ name="create",
84
+ description="Create a workspace and become its owner.",
85
+ permission="authenticated",
86
+ status="implemented",
87
+ examples=["cortex workspace create --name product-team"],
88
+ ),
89
+ CommandLeaf(
90
+ name="get",
91
+ description="Show current or specified workspace details.",
92
+ permission="workspace member",
93
+ status="implemented",
94
+ examples=["cortex workspace get --json"],
95
+ ),
96
+ CommandLeaf(
97
+ name="update",
98
+ description="Update workspace name or description.",
99
+ permission="owner | editor",
100
+ status="implemented",
101
+ examples=["cortex workspace update --name product-team-v2"],
102
+ ),
103
+ CommandLeaf(
104
+ name="delete",
105
+ description="Logically delete a workspace.",
106
+ permission="owner",
107
+ status="implemented",
108
+ examples=["cortex workspace delete <workspace-id> --json"],
109
+ ),
110
+ CommandLeaf(
111
+ name="leave",
112
+ description="Leave a workspace.",
113
+ permission="workspace member",
114
+ status="implemented",
115
+ examples=["cortex workspace leave <workspace-id> --json"],
116
+ ),
117
+ CommandLeaf(
118
+ name="transfer-owner",
119
+ description="Transfer workspace ownership to another member.",
120
+ permission="owner",
121
+ status="implemented",
122
+ examples=[
123
+ "cortex workspace transfer-owner --new-owner-id <user-id> --json"
124
+ ],
125
+ ),
126
+ CommandLeaf(
127
+ name="invite list",
128
+ description="List workspace invites with optional status filters.",
129
+ permission="owner",
130
+ status="implemented",
131
+ examples=[
132
+ "cortex workspace invite list --json",
133
+ "cortex workspace invite list --status rejected --json",
134
+ ],
135
+ ),
136
+ CommandLeaf(
137
+ name="invite create",
138
+ description="Create a pending workspace invite.",
139
+ permission="owner",
140
+ status="implemented",
141
+ examples=[
142
+ "cortex workspace invite create --email user@example.com "
143
+ "--role editor --json"
144
+ ],
145
+ ),
146
+ CommandLeaf(
147
+ name="invite revoke",
148
+ description="Revoke a pending workspace invite.",
149
+ permission="owner",
150
+ status="implemented",
151
+ examples=["cortex workspace invite revoke <invite-id> --json"],
152
+ ),
153
+ CommandLeaf(
154
+ name="invite enter",
155
+ description="Enter a workspace via a pending invite.",
156
+ permission="authenticated",
157
+ status="implemented",
158
+ examples=["cortex workspace invite enter <invite-id> --json"],
159
+ ),
160
+ CommandLeaf(
161
+ name="invite reject",
162
+ description="Reject a pending workspace invite.",
163
+ permission="authenticated",
164
+ status="implemented",
165
+ examples=["cortex workspace invite reject <invite-id> --json"],
166
+ ),
167
+ CommandLeaf(
168
+ name="invite-link list",
169
+ description="List workspace invite links.",
170
+ permission="owner",
171
+ status="implemented",
172
+ examples=["cortex workspace invite-link list --json"],
173
+ ),
174
+ CommandLeaf(
175
+ name="invite-link create",
176
+ description="Create a viewer invite link and print its one-time URL.",
177
+ permission="owner",
178
+ status="implemented",
179
+ examples=["cortex workspace invite-link create --name public --json"],
180
+ ),
181
+ CommandLeaf(
182
+ name="invite-link revoke",
183
+ description="Revoke a workspace invite link.",
184
+ permission="owner",
185
+ status="implemented",
186
+ examples=["cortex workspace invite-link revoke <link-id> --json"],
187
+ ),
188
+ CommandLeaf(
189
+ name="invite-link enter",
190
+ description="Enter a workspace via an invite link token or URL.",
191
+ permission="authenticated",
192
+ status="implemented",
193
+ examples=["cortex workspace invite-link enter <token-or-url> --json"],
194
+ ),
195
+ CommandLeaf(
196
+ name="member list",
197
+ description="List workspace members.",
198
+ permission="workspace member",
199
+ status="implemented",
200
+ examples=["cortex workspace member list --json"],
201
+ ),
202
+ CommandLeaf(
203
+ name="member set-role",
204
+ description="Update a member role.",
205
+ permission="owner",
206
+ status="implemented",
207
+ examples=[
208
+ "cortex workspace member set-role <user-id> --role viewer --json"
209
+ ],
210
+ ),
211
+ CommandLeaf(
212
+ name="member remove",
213
+ description="Remove a workspace member.",
214
+ permission="owner",
215
+ status="implemented",
216
+ examples=["cortex workspace member remove <user-id> --json"],
217
+ ),
218
+ ],
219
+ ),
220
+ CommandSpec(
221
+ name="kb",
222
+ description="Manage knowledge bases.",
223
+ permission="workspace member",
224
+ commands=[
225
+ CommandLeaf(
226
+ name="list",
227
+ description="List knowledge bases in the current workspace.",
228
+ permission="workspace member",
229
+ status="implemented",
230
+ examples=["cortex kb list --json"],
231
+ ),
232
+ CommandLeaf(
233
+ name="create",
234
+ description="Create a knowledge base.",
235
+ permission="owner | editor",
236
+ status="implemented",
237
+ examples=["cortex kb create --name policy-kb --json"],
238
+ ),
239
+ CommandLeaf(
240
+ name="get",
241
+ description="Show a knowledge base.",
242
+ permission="workspace member",
243
+ status="implemented",
244
+ examples=["cortex kb get <kb-id> --json"],
245
+ ),
246
+ CommandLeaf(
247
+ name="update",
248
+ description="Update a knowledge base.",
249
+ permission="kb writer",
250
+ status="implemented",
251
+ examples=["cortex kb update <kb-id> --name policy-v2 --json"],
252
+ ),
253
+ CommandLeaf(
254
+ name="delete",
255
+ description="Logically delete a knowledge base.",
256
+ permission="kb writer",
257
+ status="implemented",
258
+ examples=["cortex kb delete <kb-id> --yes --json"],
259
+ ),
260
+ CommandLeaf(
261
+ name="order set",
262
+ description="Set the current user's knowledge base order.",
263
+ permission="workspace member",
264
+ status="implemented",
265
+ examples=[
266
+ "cortex kb order set --kb-order <kb-id>:100 "
267
+ "--kb-order <other-kb-id>:200 --json",
268
+ "cortex kb order set --clear --json",
269
+ ],
270
+ ),
271
+ CommandLeaf(
272
+ name="permissions get",
273
+ description="Show knowledge base edit permissions.",
274
+ permission="owner",
275
+ status="implemented",
276
+ examples=["cortex kb permissions get <kb-id> --json"],
277
+ ),
278
+ CommandLeaf(
279
+ name="permissions set",
280
+ description="Set knowledge base edit policy and editor grants.",
281
+ permission="owner",
282
+ status="implemented",
283
+ examples=[
284
+ "cortex kb permissions set <kb-id> "
285
+ "--edit-policy selected_editors "
286
+ "--editor-user-id <user-id> --json"
287
+ ],
288
+ ),
289
+ ],
290
+ ),
291
+ CommandSpec(
292
+ name="folder",
293
+ description="Manage knowledge base folders.",
294
+ permission="workspace member",
295
+ commands=[
296
+ CommandLeaf(
297
+ name="tree",
298
+ description="Show the folder tree for a knowledge base.",
299
+ permission="workspace member",
300
+ status="implemented",
301
+ examples=["cortex folder tree --kb <kb-id> --json"],
302
+ ),
303
+ CommandLeaf(
304
+ name="mkdir",
305
+ description="Create a folder.",
306
+ permission="kb writer",
307
+ status="implemented",
308
+ examples=["cortex folder mkdir --kb <kb-id> --name specs --json"],
309
+ ),
310
+ CommandLeaf(
311
+ name="mv",
312
+ description="Move, rename, or reorder a folder.",
313
+ permission="kb writer",
314
+ status="implemented",
315
+ examples=["cortex folder mv <folder-id> --kb <kb-id> --root --json"],
316
+ ),
317
+ CommandLeaf(
318
+ name="rm",
319
+ description="Logically delete a folder subtree.",
320
+ permission="kb writer",
321
+ status="implemented",
322
+ examples=["cortex folder rm <folder-id> --kb <kb-id> --yes --json"],
323
+ ),
324
+ ],
325
+ ),
326
+ CommandSpec(
327
+ name="item",
328
+ description="Manage knowledge items, metadata, and mounts.",
329
+ permission="workspace member",
330
+ commands=[
331
+ CommandLeaf(
332
+ name="list",
333
+ description=(
334
+ "List items by KB, folder, availability, lock, or "
335
+ "unclassified view."
336
+ ),
337
+ permission="workspace member",
338
+ status="implemented",
339
+ examples=["cortex item list --kb <kb-id> --json"],
340
+ ),
341
+ CommandLeaf(
342
+ name="get",
343
+ description="Show an item.",
344
+ permission="workspace member",
345
+ status="implemented",
346
+ examples=["cortex item get <item-id> --json"],
347
+ ),
348
+ CommandLeaf(
349
+ name="create",
350
+ description="Create an item with optional metadata and mount.",
351
+ permission="owner | editor",
352
+ status="implemented",
353
+ examples=[
354
+ "cortex item create --title policy --metadata source=web "
355
+ "--kb <kb-id> --json"
356
+ ],
357
+ ),
358
+ CommandLeaf(
359
+ name="update",
360
+ description="Update item fields or replace metadata.",
361
+ permission="owner | editor",
362
+ status="implemented",
363
+ examples=["cortex item update <item-id> --title policy-v2 --json"],
364
+ ),
365
+ CommandLeaf(
366
+ name="delete",
367
+ description="Delete all active item locations into trash.",
368
+ permission="owner | editor",
369
+ status="implemented",
370
+ examples=["cortex item delete <item-id> --yes --json"],
371
+ ),
372
+ CommandLeaf(
373
+ name="mount",
374
+ description="Mount an item to a KB root or folder.",
375
+ permission="owner | editor",
376
+ status="implemented",
377
+ examples=["cortex item mount <item-id> --kb <kb-id> --json"],
378
+ ),
379
+ CommandLeaf(
380
+ name="unmount",
381
+ description="Delete one item location into trash.",
382
+ permission="owner | editor",
383
+ status="implemented",
384
+ examples=["cortex item unmount <item-id> --kb <kb-id> --json"],
385
+ ),
386
+ CommandLeaf(
387
+ name="import",
388
+ description="Import items from CSV or XLSX.",
389
+ permission="owner | editor",
390
+ status="implemented",
391
+ examples=["cortex item import items.csv --kb <kb-id> --yes --json"],
392
+ ),
393
+ CommandLeaf(
394
+ name="export",
395
+ description="Export items as JSON or JSONL.",
396
+ permission="workspace member",
397
+ status="implemented",
398
+ examples=["cortex item export --kb <kb-id> --jsonl"],
399
+ ),
400
+ ],
401
+ ),
402
+ CommandSpec(
403
+ name="trash",
404
+ description="Manage mixed-object trash entries.",
405
+ permission="owner | editor",
406
+ commands=[
407
+ CommandLeaf(
408
+ name="list",
409
+ description="List deleted knowledge items, folders, and files.",
410
+ permission="owner | editor",
411
+ status="implemented",
412
+ examples=["cortex trash list --json"],
413
+ ),
414
+ CommandLeaf(
415
+ name="restore",
416
+ description="Restore a deleted trash entry.",
417
+ permission="owner | editor",
418
+ status="implemented",
419
+ examples=[
420
+ "cortex trash restore <entry-id> --kb <kb-id> --json",
421
+ "cortex trash restore <entry-id> --item <item-id> --json",
422
+ "cortex trash restore <entry-id> --original --json",
423
+ ],
424
+ ),
425
+ CommandLeaf(
426
+ name="purge",
427
+ description="Logically purge a trash entry so it cannot be restored.",
428
+ permission="owner | editor",
429
+ status="implemented",
430
+ examples=["cortex trash purge <entry-id> --yes --json"],
431
+ ),
432
+ CommandLeaf(
433
+ name="discard",
434
+ description="Legacy alias for trash purge.",
435
+ permission="owner | editor",
436
+ status="implemented",
437
+ examples=["cortex trash discard <entry-id> --yes --json"],
438
+ ),
439
+ ],
440
+ ),
441
+ CommandSpec(
442
+ name="file",
443
+ description="Upload, attach, download, preview, and read files.",
444
+ permission="workspace member",
445
+ commands=[
446
+ CommandLeaf(
447
+ name="upload",
448
+ description="Upload a file and create a knowledge item.",
449
+ permission="owner | editor",
450
+ status="implemented",
451
+ examples=[
452
+ "cortex file upload ./policy.pdf --title policy --kb <kb-id> --json"
453
+ ],
454
+ ),
455
+ CommandLeaf(
456
+ name="add",
457
+ description="Add a file to an existing knowledge item.",
458
+ permission="owner | editor",
459
+ status="implemented",
460
+ examples=["cortex file add <item-id> ./appendix.pdf --json"],
461
+ ),
462
+ CommandLeaf(
463
+ name="list",
464
+ description="List files for a knowledge item.",
465
+ permission="workspace member",
466
+ status="implemented",
467
+ examples=["cortex file list <item-id> --json"],
468
+ ),
469
+ CommandLeaf(
470
+ name="download",
471
+ description="Download the original file.",
472
+ permission="workspace member",
473
+ status="implemented",
474
+ examples=["cortex file download <file-id> --output ./policy.pdf"],
475
+ ),
476
+ CommandLeaf(
477
+ name="preview",
478
+ description="Get file preview metadata or preview text.",
479
+ permission="workspace member",
480
+ status="implemented",
481
+ examples=["cortex file preview <file-id> --json"],
482
+ ),
483
+ CommandLeaf(
484
+ name="read",
485
+ description="Read extracted text or preview text for a file.",
486
+ permission="workspace member",
487
+ status="implemented",
488
+ examples=["cortex file read <file-id> --format text --json"],
489
+ ),
490
+ CommandLeaf(
491
+ name="delete",
492
+ description="Logically delete a file from an item.",
493
+ permission="owner | editor",
494
+ status="implemented",
495
+ examples=["cortex file delete <item-id> <file-id> --yes --json"],
496
+ ),
497
+ ],
498
+ ),
499
+ CommandSpec(
500
+ name="search",
501
+ description="Run keyword, advanced, and semantic search.",
502
+ permission="workspace member",
503
+ commands=[
504
+ CommandLeaf(
505
+ name="grep",
506
+ description="Search title, filename, metadata, and extracted text.",
507
+ permission="workspace member",
508
+ status="implemented",
509
+ examples=["cortex search grep permission-model --json"],
510
+ ),
511
+ CommandLeaf(
512
+ name="semantic",
513
+ description="Run semantic search over processed chunks.",
514
+ permission="workspace member",
515
+ status="implemented",
516
+ examples=["cortex search semantic owner-transfer --top-k 5 --json"],
517
+ ),
518
+ CommandLeaf(
519
+ name="advanced",
520
+ description=(
521
+ "Run filtered search with KB, mime, availability, lock, "
522
+ "and metadata."
523
+ ),
524
+ permission="workspace member",
525
+ status="implemented",
526
+ examples=[
527
+ "cortex search advanced --query button "
528
+ "--sort updated_at_desc --json"
529
+ ],
530
+ ),
531
+ ],
532
+ ),
533
+ CommandSpec(
534
+ name="chunk",
535
+ description="Fetch processed chunks and nearby context.",
536
+ permission="workspace member",
537
+ commands=[
538
+ CommandLeaf(
539
+ name="get",
540
+ description="Read one processed chunk by file and chunk index.",
541
+ permission="workspace member",
542
+ status="implemented",
543
+ examples=["cortex chunk get <file-id> --chunk 0 --json"],
544
+ ),
545
+ CommandLeaf(
546
+ name="context",
547
+ description="Read nearby processed chunk context.",
548
+ permission="workspace member",
549
+ status="implemented",
550
+ examples=["cortex chunk context <file-id> --chunk 0 --window 2 --json"],
551
+ ),
552
+ ],
553
+ ),
554
+ CommandSpec(
555
+ name="source",
556
+ description="Explore source anchors, pages, and rendered regions.",
557
+ permission="workspace member",
558
+ commands=[
559
+ CommandLeaf(
560
+ name="locate",
561
+ description="Resolve chunk anchors to normalized source blocks.",
562
+ permission="workspace member",
563
+ status="implemented",
564
+ examples=["cortex source locate <file-id> --chunk 0 --json"],
565
+ ),
566
+ CommandLeaf(
567
+ name="expand",
568
+ description="Expand a chunk by before, after, or same-page blocks.",
569
+ permission="workspace member",
570
+ status="implemented",
571
+ examples=[
572
+ "cortex source expand <file-id> --chunk 0 --mode page --json"
573
+ ],
574
+ ),
575
+ CommandLeaf(
576
+ name="page",
577
+ description=(
578
+ "Read source page blocks, regions, and optional image; "
579
+ "use --include-bytes or -o for Agent vision PNG bytes."
580
+ ),
581
+ permission="workspace member",
582
+ status="implemented",
583
+ examples=[
584
+ (
585
+ "cortex source page <file-id> "
586
+ "--page-index 0 --include-image --json"
587
+ ),
588
+ (
589
+ "cortex source page <file-id> "
590
+ "--page-index 0 --include-bytes --json"
591
+ ),
592
+ "cortex source page <file-id> --page-index 0 -o ./page.png --json",
593
+ ],
594
+ ),
595
+ CommandLeaf(
596
+ name="region-image",
597
+ description=(
598
+ "Render a PDF region PNG from an explicit bbox; "
599
+ "defaults to base64 bytes for Agent vision."
600
+ ),
601
+ permission="workspace member",
602
+ status="implemented",
603
+ examples=[
604
+ "cortex source region-image <file-id> "
605
+ "--page-index 0 --bbox 72,88,360,112 --json",
606
+ "cortex source region-image <file-id> "
607
+ "--page-index 0 --bbox 72,88,360,112 -o ./crop.png --json",
608
+ ],
609
+ ),
610
+ ],
611
+ ),
612
+ CommandSpec(
613
+ name="pipeline",
614
+ description="Manage processing pipeline configurations.",
615
+ permission="owner | editor",
616
+ commands=[
617
+ CommandLeaf(
618
+ name="list",
619
+ description="List processing pipelines.",
620
+ permission="owner | editor",
621
+ status="implemented",
622
+ examples=["cortex pipeline list --json"],
623
+ ),
624
+ CommandLeaf(
625
+ name="create",
626
+ description="Create a processing pipeline.",
627
+ permission="owner | editor",
628
+ status="implemented",
629
+ examples=["cortex pipeline create --name semantic --json"],
630
+ ),
631
+ CommandLeaf(
632
+ name="get",
633
+ description="Show a processing pipeline.",
634
+ permission="owner | editor",
635
+ status="implemented",
636
+ examples=["cortex pipeline get <pipeline-id> --json"],
637
+ ),
638
+ CommandLeaf(
639
+ name="update",
640
+ description="Update a processing pipeline.",
641
+ permission="owner | editor",
642
+ status="implemented",
643
+ examples=["cortex pipeline update <pipeline-id> --default --json"],
644
+ ),
645
+ CommandLeaf(
646
+ name="delete",
647
+ description="Logically delete a processing pipeline.",
648
+ permission="owner | editor",
649
+ status="implemented",
650
+ examples=["cortex pipeline delete <pipeline-id> --json"],
651
+ ),
652
+ ],
653
+ ),
654
+ CommandSpec(
655
+ name="processing",
656
+ description="Trigger processing, inspect status, and reconcile workflows.",
657
+ permission="workspace member | ops",
658
+ commands=[
659
+ CommandLeaf(
660
+ name="trigger",
661
+ description="Trigger processing or reprocessing for an item.",
662
+ permission="owner | editor",
663
+ status="implemented",
664
+ examples=["cortex processing trigger <item-id> --json"],
665
+ ),
666
+ CommandLeaf(
667
+ name="status",
668
+ description="List processing runs for an item.",
669
+ permission="workspace member",
670
+ status="implemented",
671
+ examples=["cortex processing status <item-id> --json"],
672
+ ),
673
+ CommandLeaf(
674
+ name="get",
675
+ description="Show a processing run.",
676
+ permission="workspace member",
677
+ status="implemented",
678
+ examples=["cortex processing get <run-id> --json"],
679
+ ),
680
+ CommandLeaf(
681
+ name="retry",
682
+ description="Retry a processing run.",
683
+ permission="owner | editor",
684
+ status="implemented",
685
+ examples=["cortex processing retry <run-id> --json"],
686
+ ),
687
+ CommandLeaf(
688
+ name="cancel",
689
+ description="Cancel a processing run projection.",
690
+ permission="owner | editor",
691
+ status="implemented",
692
+ examples=["cortex processing cancel <run-id> --json"],
693
+ ),
694
+ CommandLeaf(
695
+ name="reconcile",
696
+ description=(
697
+ "Reconcile Temporal workflow state with business projection."
698
+ ),
699
+ permission="ops",
700
+ status="implemented",
701
+ examples=["cortex processing reconcile --status running --json"],
702
+ ),
703
+ ],
704
+ ),
705
+ CommandSpec(
706
+ name="mcp",
707
+ description="Manage MCP gateway interfaces.",
708
+ permission="owner | editor",
709
+ commands=[
710
+ CommandLeaf(
711
+ name="list",
712
+ description="List MCP interfaces.",
713
+ permission="owner | editor",
714
+ status="implemented",
715
+ examples=["cortex mcp list --json"],
716
+ ),
717
+ CommandLeaf(
718
+ name="create",
719
+ description="Create an MCP interface.",
720
+ permission="owner | editor",
721
+ status="implemented",
722
+ examples=[
723
+ "cortex mcp create --name search --slug search "
724
+ "--tool recall --kb-id <kb-id> --json"
725
+ ],
726
+ ),
727
+ CommandLeaf(
728
+ name="get",
729
+ description="Show an MCP interface.",
730
+ permission="owner | editor",
731
+ status="implemented",
732
+ examples=["cortex mcp get <mcp-id> --json"],
733
+ ),
734
+ CommandLeaf(
735
+ name="update",
736
+ description="Update an MCP interface configuration.",
737
+ permission="owner | editor",
738
+ status="implemented",
739
+ examples=["cortex mcp update <mcp-id> --tool grep --json"],
740
+ ),
741
+ CommandLeaf(
742
+ name="enable",
743
+ description="Enable an MCP interface.",
744
+ permission="owner | editor",
745
+ status="implemented",
746
+ examples=["cortex mcp enable <mcp-id> --json"],
747
+ ),
748
+ CommandLeaf(
749
+ name="disable",
750
+ description="Disable an MCP interface.",
751
+ permission="owner | editor",
752
+ status="implemented",
753
+ examples=["cortex mcp disable <mcp-id> --json"],
754
+ ),
755
+ CommandLeaf(
756
+ name="delete",
757
+ description="Logically delete an MCP interface.",
758
+ permission="owner | editor",
759
+ status="implemented",
760
+ examples=["cortex mcp delete <mcp-id> --yes --json"],
761
+ ),
762
+ CommandLeaf(
763
+ name="key list",
764
+ description="List MCP API keys without cleartext keys.",
765
+ permission="owner | editor",
766
+ status="implemented",
767
+ examples=["cortex mcp key list <mcp-id> --json"],
768
+ ),
769
+ CommandLeaf(
770
+ name="key create",
771
+ description="Create an MCP API key and print it once.",
772
+ permission="owner | editor",
773
+ status="implemented",
774
+ examples=["cortex mcp key create <mcp-id> --json"],
775
+ ),
776
+ CommandLeaf(
777
+ name="key revoke",
778
+ description="Revoke an MCP API key.",
779
+ permission="owner | editor",
780
+ status="implemented",
781
+ examples=["cortex mcp key revoke <mcp-id> <key-id> --yes --json"],
782
+ ),
783
+ ],
784
+ ),
785
+ CommandSpec(
786
+ name="vector-index",
787
+ description="Inspect and explicitly rebuild workspace vector indexes.",
788
+ permission="workspace member | ops",
789
+ commands=[
790
+ CommandLeaf(
791
+ name="status",
792
+ description=(
793
+ "Show workspace vector index health, including "
794
+ "needs_rebuild when the projection is not trusted."
795
+ ),
796
+ permission="workspace member | ops",
797
+ status="implemented",
798
+ examples=[
799
+ "cortex vector-index status --workspace-id <workspace-id> --json"
800
+ ],
801
+ ),
802
+ CommandLeaf(
803
+ name="rebuild",
804
+ description=(
805
+ "Explicitly rebuild a workspace vector index from "
806
+ "PostgreSQL facts and processing artifacts."
807
+ ),
808
+ permission="owner | ops",
809
+ status="implemented",
810
+ examples=[
811
+ (
812
+ "cortex vector-index rebuild --workspace-id <workspace-id> "
813
+ "--dry-run --json"
814
+ ),
815
+ (
816
+ "cortex vector-index rebuild --workspace-id <workspace-id> "
817
+ "--yes --json"
818
+ ),
819
+ ],
820
+ ),
821
+ ],
822
+ ),
823
+ CommandSpec(
824
+ name="gc",
825
+ description="Clean physical resources after logical deletion.",
826
+ permission="ops",
827
+ commands=[
828
+ CommandLeaf(
829
+ name="workspace",
830
+ description=(
831
+ "Garbage collect files, vectors, and history for deleted "
832
+ "workspaces, or batch collect deleted workspaces before a cutoff."
833
+ ),
834
+ permission="ops",
835
+ status="implemented",
836
+ examples=[
837
+ "cortex gc workspace --workspace-id <workspace-id> --dry-run",
838
+ "cortex gc workspace --deleted-before 2026-05-01 --dry-run",
839
+ ],
840
+ ),
841
+ CommandLeaf(
842
+ name="item",
843
+ description="Garbage collect files and vectors for a deleted item.",
844
+ permission="ops",
845
+ status="implemented",
846
+ examples=[
847
+ "cortex gc item <item-id> --workspace-id <workspace-id> --dry-run"
848
+ ],
849
+ ),
850
+ CommandLeaf(
851
+ name="mcp-logs",
852
+ description="Garbage collect expired MCP runtime call logs.",
853
+ permission="owner",
854
+ status="implemented",
855
+ examples=[
856
+ "cortex gc mcp-logs --retention-days 30 --dry-run",
857
+ "cortex gc mcp-logs --deleted-before 2026-05-01 --yes",
858
+ ],
859
+ ),
860
+ ],
861
+ ),
862
+ ]