@cortexmemory/cli 0.28.0 → 0.29.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.
- package/dist/commands/completion.d.ts +12 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +71 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +145 -40
- package/dist/commands/deploy.js.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
- package/scripts/completions/cortex.bash +379 -0
- package/scripts/completions/cortex.fish +285 -0
- package/scripts/completions/cortex.zsh +751 -0
- package/scripts/postinstall.js +196 -0
- package/scripts/preuninstall.js +121 -0
- package/templates/basic/src/chat.ts +24 -3
- package/templates/basic/src/cortex.ts +41 -5
- package/templates/basic/src/index.ts +17 -1
- package/templates/basic/src/server.ts +18 -2
- package/templates/vercel-ai-quickstart/lib/agents/memory-agent.ts +2 -1
- package/templates/vercel-ai-quickstart/next.config.js +13 -4
|
@@ -0,0 +1,751 @@
|
|
|
1
|
+
#compdef cortex
|
|
2
|
+
|
|
3
|
+
# Cortex CLI completion script for Zsh
|
|
4
|
+
# Auto-installed by @cortexmemory/cli
|
|
5
|
+
|
|
6
|
+
_cortex() {
|
|
7
|
+
local curcontext="$curcontext" state line
|
|
8
|
+
typeset -A opt_args
|
|
9
|
+
|
|
10
|
+
# Global options available to all commands
|
|
11
|
+
local -a global_opts=(
|
|
12
|
+
'-d[Deployment name to use]:deployment:_cortex_deployments'
|
|
13
|
+
'--deployment[Deployment name to use]:deployment:_cortex_deployments'
|
|
14
|
+
'--debug[Enable debug output]'
|
|
15
|
+
'-V[Show version]'
|
|
16
|
+
'--version[Show version]'
|
|
17
|
+
'-h[Show help]'
|
|
18
|
+
'--help[Show help]'
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
_arguments -C \
|
|
22
|
+
$global_opts \
|
|
23
|
+
'1:command:_cortex_commands' \
|
|
24
|
+
'*::arg:->args'
|
|
25
|
+
|
|
26
|
+
case $state in
|
|
27
|
+
args)
|
|
28
|
+
case $words[1] in
|
|
29
|
+
config) _cortex_config ;;
|
|
30
|
+
db) _cortex_db ;;
|
|
31
|
+
convex) _cortex_convex ;;
|
|
32
|
+
users) _cortex_users ;;
|
|
33
|
+
spaces) _cortex_spaces ;;
|
|
34
|
+
conversations|convs) _cortex_conversations ;;
|
|
35
|
+
memory) _cortex_memory ;;
|
|
36
|
+
facts) _cortex_facts ;;
|
|
37
|
+
use) _cortex_use ;;
|
|
38
|
+
start) _cortex_start ;;
|
|
39
|
+
stop) _cortex_stop ;;
|
|
40
|
+
deploy) _cortex_deploy ;;
|
|
41
|
+
update) _cortex_update ;;
|
|
42
|
+
status) _cortex_status ;;
|
|
43
|
+
init) _cortex_init ;;
|
|
44
|
+
dev) _cortex_dev ;;
|
|
45
|
+
completion) _cortex_completion ;;
|
|
46
|
+
esac
|
|
47
|
+
;;
|
|
48
|
+
esac
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# Dynamic deployment completion from ~/.cortexrc
|
|
52
|
+
_cortex_deployments() {
|
|
53
|
+
local config="$HOME/.cortexrc"
|
|
54
|
+
[[ -f "$config" ]] || return
|
|
55
|
+
local -a deployments
|
|
56
|
+
# Parse deployment names from JSON config
|
|
57
|
+
deployments=(${(f)"$(grep -o '"[^"]*"[[:space:]]*:[[:space:]]*{' "$config" | grep -v '"deployments"' | grep -v '"apps"' | sed 's/"//g' | sed 's/[[:space:]]*:[[:space:]]*{//')"})
|
|
58
|
+
[[ ${#deployments} -gt 0 ]] && _describe 'deployment' deployments
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
# Dynamic app completion from ~/.cortexrc
|
|
62
|
+
_cortex_apps() {
|
|
63
|
+
local config="$HOME/.cortexrc"
|
|
64
|
+
[[ -f "$config" ]] || return
|
|
65
|
+
local -a apps
|
|
66
|
+
# This is a simplified parser - apps are in the "apps" section
|
|
67
|
+
apps=(${(f)"$(grep -A1 '"apps"' "$config" | grep -o '"[^"]*"[[:space:]]*:[[:space:]]*{' | grep -v '"apps"' | sed 's/"//g' | sed 's/[[:space:]]*:[[:space:]]*{//')"})
|
|
68
|
+
[[ ${#apps} -gt 0 ]] && _describe 'app' apps
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
# Combined deployment and app names
|
|
72
|
+
_cortex_deployments_and_apps() {
|
|
73
|
+
_cortex_deployments
|
|
74
|
+
_cortex_apps
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
# Main commands
|
|
78
|
+
_cortex_commands() {
|
|
79
|
+
local -a commands=(
|
|
80
|
+
'start:Start development services (all enabled deployments)'
|
|
81
|
+
'stop:Stop background services'
|
|
82
|
+
'deploy:Deploy schema and functions to Convex'
|
|
83
|
+
'update:Update SDK packages in projects'
|
|
84
|
+
'status:Show Cortex setup status dashboard'
|
|
85
|
+
'config:Manage CLI configuration'
|
|
86
|
+
'init:Initialize a new Cortex Memory project'
|
|
87
|
+
'dev:Start interactive development mode'
|
|
88
|
+
'use:Set current deployment for all commands'
|
|
89
|
+
'db:Database-wide operations'
|
|
90
|
+
'convex:Manage Convex deployments'
|
|
91
|
+
'memory:Manage memories (vector store)'
|
|
92
|
+
'users:Manage user profiles and data'
|
|
93
|
+
'spaces:Manage memory spaces'
|
|
94
|
+
'facts:Manage extracted facts'
|
|
95
|
+
'conversations:Manage conversations'
|
|
96
|
+
'completion:Generate shell completion script'
|
|
97
|
+
)
|
|
98
|
+
_describe 'command' commands
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
# config subcommands
|
|
102
|
+
_cortex_config() {
|
|
103
|
+
local -a subcommands=(
|
|
104
|
+
'show:Show current configuration'
|
|
105
|
+
'list:List all deployments in table format'
|
|
106
|
+
'set:Set a configuration value'
|
|
107
|
+
'test:Test connection to Convex deployment'
|
|
108
|
+
'set-path:Set project path for a deployment'
|
|
109
|
+
'enable:Enable a deployment or app'
|
|
110
|
+
'disable:Disable a deployment or app'
|
|
111
|
+
'deployments:List configured deployments'
|
|
112
|
+
'add-deployment:Add a new deployment configuration'
|
|
113
|
+
'remove-deployment:Remove a deployment configuration'
|
|
114
|
+
'set-key:Set or update deploy key for a deployment'
|
|
115
|
+
'set-url:Set or update URL for a deployment'
|
|
116
|
+
'path:Show configuration file paths'
|
|
117
|
+
'reset:Reset configuration to defaults'
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
_arguments -C \
|
|
121
|
+
'1:subcommand:->subcmd' \
|
|
122
|
+
'*::arg:->args'
|
|
123
|
+
|
|
124
|
+
case $state in
|
|
125
|
+
subcmd)
|
|
126
|
+
_describe 'subcommand' subcommands
|
|
127
|
+
;;
|
|
128
|
+
args)
|
|
129
|
+
case $words[1] in
|
|
130
|
+
show)
|
|
131
|
+
_arguments '-f[Output format]:format:(table json)'
|
|
132
|
+
;;
|
|
133
|
+
set)
|
|
134
|
+
_arguments '1:key:(default format confirmDangerous)' '2:value:'
|
|
135
|
+
;;
|
|
136
|
+
test)
|
|
137
|
+
_arguments '-d[Deployment to test]:deployment:_cortex_deployments'
|
|
138
|
+
;;
|
|
139
|
+
set-path)
|
|
140
|
+
_arguments '1:deployment:_cortex_deployments' '2:path:_files -/'
|
|
141
|
+
;;
|
|
142
|
+
enable|disable)
|
|
143
|
+
_arguments '1:name:_cortex_deployments_and_apps'
|
|
144
|
+
;;
|
|
145
|
+
deployments)
|
|
146
|
+
_arguments '-f[Output format]:format:(table json)'
|
|
147
|
+
;;
|
|
148
|
+
add-deployment)
|
|
149
|
+
_arguments \
|
|
150
|
+
'1:name:' \
|
|
151
|
+
'-u[Convex deployment URL]:url:' \
|
|
152
|
+
'--url[Convex deployment URL]:url:' \
|
|
153
|
+
'-k[Convex deploy key]:key:' \
|
|
154
|
+
'--key[Convex deploy key]:key:' \
|
|
155
|
+
'--default[Set as default deployment]' \
|
|
156
|
+
'--json-only[Only save to ~/.cortexrc]'
|
|
157
|
+
;;
|
|
158
|
+
remove-deployment)
|
|
159
|
+
_arguments \
|
|
160
|
+
'1:name:_cortex_deployments' \
|
|
161
|
+
'--json-only[Only remove from ~/.cortexrc]'
|
|
162
|
+
;;
|
|
163
|
+
set-key)
|
|
164
|
+
_arguments \
|
|
165
|
+
'1:deployment:_cortex_deployments' \
|
|
166
|
+
'-k[Deploy key]:key:' \
|
|
167
|
+
'--key[Deploy key]:key:' \
|
|
168
|
+
'--json-only[Only update ~/.cortexrc]'
|
|
169
|
+
;;
|
|
170
|
+
set-url)
|
|
171
|
+
_arguments \
|
|
172
|
+
'1:deployment:_cortex_deployments' \
|
|
173
|
+
'-u[Deployment URL]:url:' \
|
|
174
|
+
'--url[Deployment URL]:url:' \
|
|
175
|
+
'--json-only[Only update ~/.cortexrc]'
|
|
176
|
+
;;
|
|
177
|
+
reset)
|
|
178
|
+
_arguments '-y[Skip confirmation]' '--yes[Skip confirmation]'
|
|
179
|
+
;;
|
|
180
|
+
esac
|
|
181
|
+
;;
|
|
182
|
+
esac
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
# db subcommands
|
|
186
|
+
_cortex_db() {
|
|
187
|
+
local -a subcommands=(
|
|
188
|
+
'stats:Show database statistics'
|
|
189
|
+
'clear:Clear entire database (DANGEROUS!)'
|
|
190
|
+
'backup:Backup database to a file'
|
|
191
|
+
'restore:Restore database from a backup file'
|
|
192
|
+
'export:Export all data to JSON'
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
_arguments -C \
|
|
196
|
+
'1:subcommand:->subcmd' \
|
|
197
|
+
'*::arg:->args'
|
|
198
|
+
|
|
199
|
+
case $state in
|
|
200
|
+
subcmd)
|
|
201
|
+
_describe 'subcommand' subcommands
|
|
202
|
+
;;
|
|
203
|
+
args)
|
|
204
|
+
case $words[1] in
|
|
205
|
+
stats)
|
|
206
|
+
_arguments \
|
|
207
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
208
|
+
'-f[Output format]:format:(table json)'
|
|
209
|
+
;;
|
|
210
|
+
clear)
|
|
211
|
+
_arguments \
|
|
212
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
213
|
+
'-y[Skip confirmation]' \
|
|
214
|
+
'--yes[Skip confirmation]' \
|
|
215
|
+
'--keep-users[Keep user profiles]'
|
|
216
|
+
;;
|
|
217
|
+
backup)
|
|
218
|
+
_arguments \
|
|
219
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
220
|
+
'-o[Output file]:file:_files' \
|
|
221
|
+
'--output[Output file]:file:_files'
|
|
222
|
+
;;
|
|
223
|
+
restore)
|
|
224
|
+
_arguments \
|
|
225
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
226
|
+
'-y[Skip confirmation]' \
|
|
227
|
+
'--yes[Skip confirmation]' \
|
|
228
|
+
'1:backup file:_files'
|
|
229
|
+
;;
|
|
230
|
+
export)
|
|
231
|
+
_arguments \
|
|
232
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
233
|
+
'-o[Output file]:file:_files' \
|
|
234
|
+
'--output[Output file]:file:_files'
|
|
235
|
+
;;
|
|
236
|
+
esac
|
|
237
|
+
;;
|
|
238
|
+
esac
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
# convex subcommands
|
|
242
|
+
_cortex_convex() {
|
|
243
|
+
local -a subcommands=(
|
|
244
|
+
'status:Check Convex deployment status'
|
|
245
|
+
'deploy:Deploy schema and functions'
|
|
246
|
+
'dev:Start Convex in development mode'
|
|
247
|
+
'logs:View Convex deployment logs'
|
|
248
|
+
'dashboard:Open Convex dashboard in browser'
|
|
249
|
+
'update:Update packages'
|
|
250
|
+
'schema:View schema information'
|
|
251
|
+
'init:Initialize Convex in current project'
|
|
252
|
+
'env:Manage environment variables'
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
_arguments -C \
|
|
256
|
+
'1:subcommand:->subcmd' \
|
|
257
|
+
'*::arg:->args'
|
|
258
|
+
|
|
259
|
+
case $state in
|
|
260
|
+
subcmd)
|
|
261
|
+
_describe 'subcommand' subcommands
|
|
262
|
+
;;
|
|
263
|
+
args)
|
|
264
|
+
case $words[1] in
|
|
265
|
+
status|deploy|dev|logs|dashboard|update|schema|init)
|
|
266
|
+
_arguments '-d[Deployment]:deployment:_cortex_deployments'
|
|
267
|
+
;;
|
|
268
|
+
env)
|
|
269
|
+
_arguments \
|
|
270
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
271
|
+
'1:action:(list set unset)'
|
|
272
|
+
;;
|
|
273
|
+
esac
|
|
274
|
+
;;
|
|
275
|
+
esac
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
# users subcommands
|
|
279
|
+
_cortex_users() {
|
|
280
|
+
local -a subcommands=(
|
|
281
|
+
'list:List all user profiles'
|
|
282
|
+
'get:Get user profile details'
|
|
283
|
+
'delete:Delete user profile'
|
|
284
|
+
'delete-many:Delete multiple users'
|
|
285
|
+
'export:Export all user data (GDPR)'
|
|
286
|
+
'stats:Show statistics for a user'
|
|
287
|
+
'update:Update user profile data'
|
|
288
|
+
'create:Create a new user profile'
|
|
289
|
+
'exists:Check if a user exists'
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
_arguments -C \
|
|
293
|
+
'1:subcommand:->subcmd' \
|
|
294
|
+
'*::arg:->args'
|
|
295
|
+
|
|
296
|
+
case $state in
|
|
297
|
+
subcmd)
|
|
298
|
+
_describe 'subcommand' subcommands
|
|
299
|
+
;;
|
|
300
|
+
args)
|
|
301
|
+
case $words[1] in
|
|
302
|
+
list)
|
|
303
|
+
_arguments \
|
|
304
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
305
|
+
'-f[Output format]:format:(table json)' \
|
|
306
|
+
'-l[Limit results]:limit:' \
|
|
307
|
+
'--limit[Limit results]:limit:'
|
|
308
|
+
;;
|
|
309
|
+
get|stats|exists)
|
|
310
|
+
_arguments \
|
|
311
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
312
|
+
'-f[Output format]:format:(table json)' \
|
|
313
|
+
'1:userId:'
|
|
314
|
+
;;
|
|
315
|
+
delete)
|
|
316
|
+
_arguments \
|
|
317
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
318
|
+
'-y[Skip confirmation]' \
|
|
319
|
+
'--yes[Skip confirmation]' \
|
|
320
|
+
'--gdpr[GDPR cascade deletion]' \
|
|
321
|
+
'1:userId:'
|
|
322
|
+
;;
|
|
323
|
+
delete-many)
|
|
324
|
+
_arguments \
|
|
325
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
326
|
+
'-y[Skip confirmation]' \
|
|
327
|
+
'--yes[Skip confirmation]' \
|
|
328
|
+
'--gdpr[GDPR cascade deletion]' \
|
|
329
|
+
'*:userIds:'
|
|
330
|
+
;;
|
|
331
|
+
export)
|
|
332
|
+
_arguments \
|
|
333
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
334
|
+
'-o[Output file]:file:_files' \
|
|
335
|
+
'--output[Output file]:file:_files' \
|
|
336
|
+
'1:userId:'
|
|
337
|
+
;;
|
|
338
|
+
update)
|
|
339
|
+
_arguments \
|
|
340
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
341
|
+
'1:userId:' \
|
|
342
|
+
'--name[User name]:name:' \
|
|
343
|
+
'--email[User email]:email:'
|
|
344
|
+
;;
|
|
345
|
+
create)
|
|
346
|
+
_arguments \
|
|
347
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
348
|
+
'1:userId:' \
|
|
349
|
+
'--name[User name]:name:' \
|
|
350
|
+
'--email[User email]:email:'
|
|
351
|
+
;;
|
|
352
|
+
esac
|
|
353
|
+
;;
|
|
354
|
+
esac
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
# spaces subcommands
|
|
358
|
+
_cortex_spaces() {
|
|
359
|
+
local -a subcommands=(
|
|
360
|
+
'list:List all memory spaces'
|
|
361
|
+
'create:Create a new memory space'
|
|
362
|
+
'get:Get memory space details'
|
|
363
|
+
'delete:Delete a memory space'
|
|
364
|
+
'archive:Archive a memory space'
|
|
365
|
+
'reactivate:Reactivate an archived space'
|
|
366
|
+
'stats:Get statistics for a space'
|
|
367
|
+
'participants:List participants in a space'
|
|
368
|
+
'add-participant:Add a participant to a space'
|
|
369
|
+
'remove-participant:Remove a participant'
|
|
370
|
+
'update:Update a memory space'
|
|
371
|
+
'count:Count memory spaces'
|
|
372
|
+
'search:Search memory spaces by name'
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
_arguments -C \
|
|
376
|
+
'1:subcommand:->subcmd' \
|
|
377
|
+
'*::arg:->args'
|
|
378
|
+
|
|
379
|
+
case $state in
|
|
380
|
+
subcmd)
|
|
381
|
+
_describe 'subcommand' subcommands
|
|
382
|
+
;;
|
|
383
|
+
args)
|
|
384
|
+
case $words[1] in
|
|
385
|
+
list)
|
|
386
|
+
_arguments \
|
|
387
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
388
|
+
'-f[Output format]:format:(table json)' \
|
|
389
|
+
'-l[Limit results]:limit:' \
|
|
390
|
+
'--limit[Limit results]:limit:' \
|
|
391
|
+
'--status[Filter by status]:status:(active archived)'
|
|
392
|
+
;;
|
|
393
|
+
create)
|
|
394
|
+
_arguments \
|
|
395
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
396
|
+
'1:spaceId:' \
|
|
397
|
+
'--name[Space name]:name:' \
|
|
398
|
+
'--type[Space type]:type:(personal team project custom)'
|
|
399
|
+
;;
|
|
400
|
+
get|stats|participants|archive|reactivate)
|
|
401
|
+
_arguments \
|
|
402
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
403
|
+
'-f[Output format]:format:(table json)' \
|
|
404
|
+
'1:spaceId:'
|
|
405
|
+
;;
|
|
406
|
+
delete)
|
|
407
|
+
_arguments \
|
|
408
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
409
|
+
'-y[Skip confirmation]' \
|
|
410
|
+
'--yes[Skip confirmation]' \
|
|
411
|
+
'--cascade[Delete all contents]' \
|
|
412
|
+
'1:spaceId:'
|
|
413
|
+
;;
|
|
414
|
+
add-participant|remove-participant)
|
|
415
|
+
_arguments \
|
|
416
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
417
|
+
'1:spaceId:' \
|
|
418
|
+
'--user[User ID]:userId:'
|
|
419
|
+
;;
|
|
420
|
+
update)
|
|
421
|
+
_arguments \
|
|
422
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
423
|
+
'1:spaceId:' \
|
|
424
|
+
'--name[New name]:name:' \
|
|
425
|
+
'--status[New status]:status:(active archived)'
|
|
426
|
+
;;
|
|
427
|
+
count)
|
|
428
|
+
_arguments \
|
|
429
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
430
|
+
'--status[Filter by status]:status:(active archived)'
|
|
431
|
+
;;
|
|
432
|
+
search)
|
|
433
|
+
_arguments \
|
|
434
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
435
|
+
'-f[Output format]:format:(table json)' \
|
|
436
|
+
'1:query:'
|
|
437
|
+
;;
|
|
438
|
+
esac
|
|
439
|
+
;;
|
|
440
|
+
esac
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
# conversations subcommands
|
|
444
|
+
_cortex_conversations() {
|
|
445
|
+
local -a subcommands=(
|
|
446
|
+
'list:List conversations'
|
|
447
|
+
'get:Get conversation details'
|
|
448
|
+
'delete:Delete a conversation'
|
|
449
|
+
'export:Export a conversation'
|
|
450
|
+
'count:Count conversations'
|
|
451
|
+
'clear:Clear conversations'
|
|
452
|
+
'messages:List messages in a conversation'
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
_arguments -C \
|
|
456
|
+
'1:subcommand:->subcmd' \
|
|
457
|
+
'*::arg:->args'
|
|
458
|
+
|
|
459
|
+
case $state in
|
|
460
|
+
subcmd)
|
|
461
|
+
_describe 'subcommand' subcommands
|
|
462
|
+
;;
|
|
463
|
+
args)
|
|
464
|
+
case $words[1] in
|
|
465
|
+
list)
|
|
466
|
+
_arguments \
|
|
467
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
468
|
+
'-f[Output format]:format:(table json)' \
|
|
469
|
+
'-l[Limit results]:limit:' \
|
|
470
|
+
'--limit[Limit results]:limit:' \
|
|
471
|
+
'-s[Memory space]:space:' \
|
|
472
|
+
'--space[Memory space]:space:'
|
|
473
|
+
;;
|
|
474
|
+
get|messages)
|
|
475
|
+
_arguments \
|
|
476
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
477
|
+
'-f[Output format]:format:(table json)' \
|
|
478
|
+
'1:conversationId:'
|
|
479
|
+
;;
|
|
480
|
+
delete)
|
|
481
|
+
_arguments \
|
|
482
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
483
|
+
'-y[Skip confirmation]' \
|
|
484
|
+
'--yes[Skip confirmation]' \
|
|
485
|
+
'1:conversationId:'
|
|
486
|
+
;;
|
|
487
|
+
export)
|
|
488
|
+
_arguments \
|
|
489
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
490
|
+
'-o[Output file]:file:_files' \
|
|
491
|
+
'--output[Output file]:file:_files' \
|
|
492
|
+
'1:conversationId:'
|
|
493
|
+
;;
|
|
494
|
+
count)
|
|
495
|
+
_arguments \
|
|
496
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
497
|
+
'-s[Memory space]:space:' \
|
|
498
|
+
'--space[Memory space]:space:'
|
|
499
|
+
;;
|
|
500
|
+
clear)
|
|
501
|
+
_arguments \
|
|
502
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
503
|
+
'-y[Skip confirmation]' \
|
|
504
|
+
'--yes[Skip confirmation]' \
|
|
505
|
+
'-s[Memory space]:space:' \
|
|
506
|
+
'--space[Memory space]:space:'
|
|
507
|
+
;;
|
|
508
|
+
esac
|
|
509
|
+
;;
|
|
510
|
+
esac
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
# memory subcommands
|
|
514
|
+
_cortex_memory() {
|
|
515
|
+
local -a subcommands=(
|
|
516
|
+
'list:List memories in a space'
|
|
517
|
+
'search:Search memories by content'
|
|
518
|
+
'get:Get details of a specific memory'
|
|
519
|
+
'delete:Delete a specific memory'
|
|
520
|
+
'clear:Clear multiple memories'
|
|
521
|
+
'export:Export memories to a file'
|
|
522
|
+
'stats:Show memory statistics'
|
|
523
|
+
'archive:Archive a memory'
|
|
524
|
+
'restore:Restore an archived memory'
|
|
525
|
+
)
|
|
526
|
+
|
|
527
|
+
_arguments -C \
|
|
528
|
+
'1:subcommand:->subcmd' \
|
|
529
|
+
'*::arg:->args'
|
|
530
|
+
|
|
531
|
+
case $state in
|
|
532
|
+
subcmd)
|
|
533
|
+
_describe 'subcommand' subcommands
|
|
534
|
+
;;
|
|
535
|
+
args)
|
|
536
|
+
case $words[1] in
|
|
537
|
+
list|stats)
|
|
538
|
+
_arguments \
|
|
539
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
540
|
+
'-f[Output format]:format:(table json)' \
|
|
541
|
+
'-s[Memory space]:space:' \
|
|
542
|
+
'--space[Memory space]:space:' \
|
|
543
|
+
'-l[Limit results]:limit:' \
|
|
544
|
+
'--limit[Limit results]:limit:'
|
|
545
|
+
;;
|
|
546
|
+
search)
|
|
547
|
+
_arguments \
|
|
548
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
549
|
+
'-f[Output format]:format:(table json)' \
|
|
550
|
+
'-s[Memory space]:space:' \
|
|
551
|
+
'--space[Memory space]:space:' \
|
|
552
|
+
'-l[Limit results]:limit:' \
|
|
553
|
+
'--limit[Limit results]:limit:' \
|
|
554
|
+
'1:query:'
|
|
555
|
+
;;
|
|
556
|
+
get|archive|restore)
|
|
557
|
+
_arguments \
|
|
558
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
559
|
+
'-f[Output format]:format:(table json)' \
|
|
560
|
+
'1:memoryId:'
|
|
561
|
+
;;
|
|
562
|
+
delete)
|
|
563
|
+
_arguments \
|
|
564
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
565
|
+
'-y[Skip confirmation]' \
|
|
566
|
+
'--yes[Skip confirmation]' \
|
|
567
|
+
'1:memoryId:'
|
|
568
|
+
;;
|
|
569
|
+
clear)
|
|
570
|
+
_arguments \
|
|
571
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
572
|
+
'-y[Skip confirmation]' \
|
|
573
|
+
'--yes[Skip confirmation]' \
|
|
574
|
+
'-s[Memory space]:space:' \
|
|
575
|
+
'--space[Memory space]:space:'
|
|
576
|
+
;;
|
|
577
|
+
export)
|
|
578
|
+
_arguments \
|
|
579
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
580
|
+
'-s[Memory space]:space:' \
|
|
581
|
+
'--space[Memory space]:space:' \
|
|
582
|
+
'-o[Output file]:file:_files' \
|
|
583
|
+
'--output[Output file]:file:_files'
|
|
584
|
+
;;
|
|
585
|
+
esac
|
|
586
|
+
;;
|
|
587
|
+
esac
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
# facts subcommands
|
|
591
|
+
_cortex_facts() {
|
|
592
|
+
local -a subcommands=(
|
|
593
|
+
'list:List facts in a space'
|
|
594
|
+
'search:Search facts by content'
|
|
595
|
+
'get:Get fact details'
|
|
596
|
+
'delete:Delete a fact'
|
|
597
|
+
'export:Export facts to a file'
|
|
598
|
+
'count:Count facts in a space'
|
|
599
|
+
'clear:Clear all facts in a space'
|
|
600
|
+
)
|
|
601
|
+
|
|
602
|
+
_arguments -C \
|
|
603
|
+
'1:subcommand:->subcmd' \
|
|
604
|
+
'*::arg:->args'
|
|
605
|
+
|
|
606
|
+
case $state in
|
|
607
|
+
subcmd)
|
|
608
|
+
_describe 'subcommand' subcommands
|
|
609
|
+
;;
|
|
610
|
+
args)
|
|
611
|
+
case $words[1] in
|
|
612
|
+
list)
|
|
613
|
+
_arguments \
|
|
614
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
615
|
+
'-f[Output format]:format:(table json)' \
|
|
616
|
+
'-s[Memory space]:space:' \
|
|
617
|
+
'--space[Memory space]:space:' \
|
|
618
|
+
'-l[Limit results]:limit:' \
|
|
619
|
+
'--limit[Limit results]:limit:' \
|
|
620
|
+
'-t[Filter by type]:type:(preference identity knowledge relationship event observation custom)'
|
|
621
|
+
;;
|
|
622
|
+
search)
|
|
623
|
+
_arguments \
|
|
624
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
625
|
+
'-f[Output format]:format:(table json)' \
|
|
626
|
+
'-s[Memory space]:space:' \
|
|
627
|
+
'--space[Memory space]:space:' \
|
|
628
|
+
'1:query:'
|
|
629
|
+
;;
|
|
630
|
+
get)
|
|
631
|
+
_arguments \
|
|
632
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
633
|
+
'-f[Output format]:format:(table json)' \
|
|
634
|
+
'1:factId:'
|
|
635
|
+
;;
|
|
636
|
+
delete)
|
|
637
|
+
_arguments \
|
|
638
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
639
|
+
'-y[Skip confirmation]' \
|
|
640
|
+
'--yes[Skip confirmation]' \
|
|
641
|
+
'1:factId:'
|
|
642
|
+
;;
|
|
643
|
+
export)
|
|
644
|
+
_arguments \
|
|
645
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
646
|
+
'-s[Memory space]:space:' \
|
|
647
|
+
'--space[Memory space]:space:' \
|
|
648
|
+
'-o[Output file]:file:_files' \
|
|
649
|
+
'--output[Output file]:file:_files'
|
|
650
|
+
;;
|
|
651
|
+
count)
|
|
652
|
+
_arguments \
|
|
653
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
654
|
+
'-s[Memory space]:space:' \
|
|
655
|
+
'--space[Memory space]:space:'
|
|
656
|
+
;;
|
|
657
|
+
clear)
|
|
658
|
+
_arguments \
|
|
659
|
+
'-d[Deployment]:deployment:_cortex_deployments' \
|
|
660
|
+
'-y[Skip confirmation]' \
|
|
661
|
+
'--yes[Skip confirmation]' \
|
|
662
|
+
'-s[Memory space]:space:' \
|
|
663
|
+
'--space[Memory space]:space:'
|
|
664
|
+
;;
|
|
665
|
+
esac
|
|
666
|
+
;;
|
|
667
|
+
esac
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
# use command
|
|
671
|
+
_cortex_use() {
|
|
672
|
+
_arguments \
|
|
673
|
+
'--clear[Clear current deployment setting]' \
|
|
674
|
+
'1:deployment:_cortex_deployments'
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
# start command
|
|
678
|
+
_cortex_start() {
|
|
679
|
+
_arguments \
|
|
680
|
+
'-d[Specific deployment to start]:deployment:_cortex_deployments' \
|
|
681
|
+
'--deployment[Specific deployment to start]:deployment:_cortex_deployments' \
|
|
682
|
+
'--deployments-only[Only start deployments, not apps]' \
|
|
683
|
+
'--apps-only[Only start apps, not deployments]'
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
# stop command
|
|
687
|
+
_cortex_stop() {
|
|
688
|
+
_arguments \
|
|
689
|
+
'-d[Specific deployment to stop]:deployment:_cortex_deployments' \
|
|
690
|
+
'--deployment[Specific deployment to stop]:deployment:_cortex_deployments' \
|
|
691
|
+
'--deployments-only[Only stop deployments]' \
|
|
692
|
+
'--apps-only[Only stop apps]'
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
# deploy command
|
|
696
|
+
_cortex_deploy() {
|
|
697
|
+
_arguments \
|
|
698
|
+
'-d[Deployment to deploy]:deployment:_cortex_deployments' \
|
|
699
|
+
'--deployment[Deployment to deploy]:deployment:_cortex_deployments' \
|
|
700
|
+
'-y[Auto-accept prompts]' \
|
|
701
|
+
'--yes[Auto-accept prompts]'
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
# update command
|
|
705
|
+
_cortex_update() {
|
|
706
|
+
_arguments \
|
|
707
|
+
'-d[Specific deployment to update]:deployment:_cortex_deployments' \
|
|
708
|
+
'--deployment[Specific deployment to update]:deployment:_cortex_deployments' \
|
|
709
|
+
'--deployments-only[Only update deployments]' \
|
|
710
|
+
'--apps-only[Only update apps]' \
|
|
711
|
+
'--dev-path[Path to local SDK for dev mode]:path:_files -/' \
|
|
712
|
+
'--sync-template[Sync template files]' \
|
|
713
|
+
'-y[Auto-accept all updates]' \
|
|
714
|
+
'--yes[Auto-accept all updates]'
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
# status command
|
|
718
|
+
_cortex_status() {
|
|
719
|
+
_arguments \
|
|
720
|
+
'-d[Specific deployment to check]:deployment:_cortex_deployments' \
|
|
721
|
+
'--deployment[Specific deployment to check]:deployment:_cortex_deployments' \
|
|
722
|
+
'-f[Output format]:format:(table json)'
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
# init command
|
|
726
|
+
_cortex_init() {
|
|
727
|
+
_arguments \
|
|
728
|
+
'1:directory:_files -/' \
|
|
729
|
+
'-t[Template type]:template:(basic vercel-ai-quickstart)' \
|
|
730
|
+
'--template[Template type]:template:(basic vercel-ai-quickstart)' \
|
|
731
|
+
'-n[Project name]:name:' \
|
|
732
|
+
'--name[Project name]:name:' \
|
|
733
|
+
'--skip-install[Skip npm install]' \
|
|
734
|
+
'-y[Accept defaults]' \
|
|
735
|
+
'--yes[Accept defaults]'
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
# dev command
|
|
739
|
+
_cortex_dev() {
|
|
740
|
+
_arguments \
|
|
741
|
+
'-d[Deployment to use]:deployment:_cortex_deployments' \
|
|
742
|
+
'--deployment[Deployment to use]:deployment:_cortex_deployments'
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
# completion command
|
|
746
|
+
_cortex_completion() {
|
|
747
|
+
_arguments '1:shell:(zsh bash fish)'
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
# Register the completion function
|
|
751
|
+
compdef _cortex cortex
|