@kodycodes/cli 3.28.1 → 3.28.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/{chunk-NINSI6RV.js → chunk-4NMUNDYR.js} +14 -6
  3. package/dist/{chunk-NINSI6RV.js.map → chunk-4NMUNDYR.js.map} +1 -1
  4. package/dist/{chunk-AUY7E5W4.js → chunk-A3EJ5CXG.js} +4 -4
  5. package/dist/{chunk-4SE2AT5A.js → chunk-AO7JQ7QO.js} +2 -2
  6. package/dist/{chunk-MO2QBCJE.js → chunk-C56EW2UR.js} +130 -36
  7. package/dist/chunk-C56EW2UR.js.map +6 -0
  8. package/dist/{chunk-CPOQG27Q.js → chunk-FEVH7L22.js} +3 -3
  9. package/dist/{chunk-HYDKOHOG.js → chunk-GOBGKXEU.js} +2 -2
  10. package/dist/{chunk-JXUNYHCE.js → chunk-PMRDVBMB.js} +827 -21
  11. package/dist/chunk-PMRDVBMB.js.map +6 -0
  12. package/dist/{chunk-SLHFID52.js → chunk-TJKEADTR.js} +2 -2
  13. package/dist/cli.d.ts +1 -0
  14. package/dist/cli.js +3 -1
  15. package/dist/command-help.d.ts +10 -0
  16. package/dist/{commands-KJ2LKZPN.js → commands-KSLL3FBI.js} +305 -24
  17. package/dist/commands-KSLL3FBI.js.map +6 -0
  18. package/dist/{dev-command-MPBKGNZW.js → dev-command-SAN55YUO.js} +7 -7
  19. package/dist/execution-context/fs-access.d.ts +2 -0
  20. package/dist/execution-context/host-access.d.ts +80 -0
  21. package/dist/{local-execute-DESLSJIM.js → local-execute-YWYSSSX4.js} +5 -5
  22. package/dist/{local-package-graph-T2PWPQDN.js → local-package-graph-BOT5WG6P.js} +3 -3
  23. package/dist/{local-package-run-PUB3K7FH.js → local-package-run-TWSCJ5OP.js} +6 -6
  24. package/dist/mock/mock-server.d.ts +2 -1
  25. package/dist/mock/mock-storage.d.ts +21 -1
  26. package/dist/{mock-local-deps-5G7GBK7X.js → mock-local-deps-BSIIIPOE.js} +4 -4
  27. package/dist/{mock-server-AVHUTXAL.js → mock-server-TDKUEG5W.js} +2 -2
  28. package/dist/{run-executor-MJXLTKYY.js → run-executor-RY226HUI.js} +3 -3
  29. package/package.json +1 -1
  30. package/dist/chunk-JXUNYHCE.js.map +0 -6
  31. package/dist/chunk-MO2QBCJE.js.map +0 -6
  32. package/dist/commands-KJ2LKZPN.js.map +0 -6
  33. /package/dist/{chunk-AUY7E5W4.js.map → chunk-A3EJ5CXG.js.map} +0 -0
  34. /package/dist/{chunk-4SE2AT5A.js.map → chunk-AO7JQ7QO.js.map} +0 -0
  35. /package/dist/{chunk-CPOQG27Q.js.map → chunk-FEVH7L22.js.map} +0 -0
  36. /package/dist/{chunk-HYDKOHOG.js.map → chunk-GOBGKXEU.js.map} +0 -0
  37. /package/dist/{chunk-SLHFID52.js.map → chunk-TJKEADTR.js.map} +0 -0
  38. /package/dist/{dev-command-MPBKGNZW.js.map → dev-command-SAN55YUO.js.map} +0 -0
  39. /package/dist/{local-execute-DESLSJIM.js.map → local-execute-YWYSSSX4.js.map} +0 -0
  40. /package/dist/{local-package-graph-T2PWPQDN.js.map → local-package-graph-BOT5WG6P.js.map} +0 -0
  41. /package/dist/{local-package-run-PUB3K7FH.js.map → local-package-run-TWSCJ5OP.js.map} +0 -0
  42. /package/dist/{mock-local-deps-5G7GBK7X.js.map → mock-local-deps-BSIIIPOE.js.map} +0 -0
  43. /package/dist/{mock-server-AVHUTXAL.js.map → mock-server-TDKUEG5W.js.map} +0 -0
  44. /package/dist/{run-executor-MJXLTKYY.js.map → run-executor-RY226HUI.js.map} +0 -0
@@ -75,6 +75,800 @@ import { parseArgs } from "node:util";
75
75
  import { statSync } from "node:fs";
76
76
  import { readFile } from "node:fs/promises";
77
77
 
78
+ // src/command-help.ts
79
+ var jsonFlag = ["--json", "Print JSON for agents"];
80
+ var orgFlag = [
81
+ "--org <slug>",
82
+ "Run as this org for one call (else KODY_ORG, then the active org)"
83
+ ];
84
+ var mcpUrlFlag = [
85
+ "--mcp-url <url>",
86
+ "Kody MCP URL (default from KODY_MCP_URL)"
87
+ ];
88
+ var apiUrlFlag = [
89
+ "--api-url <url>",
90
+ "Kody API URL (default from KODY_API_URL)"
91
+ ];
92
+ var tokenFlag = [
93
+ "--token <token>",
94
+ "Scoped API token (prefer the KODY_API_TOKEN env var)"
95
+ ];
96
+ var targetFlag = [
97
+ "--target prod|mock",
98
+ "Where API hops go: real Kody or the built-in local mock"
99
+ ];
100
+ var ecContextFlag = [
101
+ "--context <ec id>",
102
+ "Execution context on this machine (default: the only one registered)"
103
+ ];
104
+ var devTargetFlag = [
105
+ "--target prod|mock",
106
+ "Where API hops go (default mock for kody dev)"
107
+ ];
108
+ var dryRunFlag = [
109
+ "--dry-run",
110
+ "Print the module path and params without invoking"
111
+ ];
112
+ var commandHelpTree = [
113
+ {
114
+ name: "login",
115
+ summary: "Sign in to Kody in the browser (or with a device code)",
116
+ usage: [
117
+ "kody login [--mcp-url <url>] [--org <slug>] [--no-browser | --device]"
118
+ ],
119
+ flags: [
120
+ [
121
+ "--org <slug>",
122
+ "Bind the login to this org (adds or replaces that org login)"
123
+ ],
124
+ ["--no-browser", "Print the sign-in URL instead of opening a browser"],
125
+ ["--device", "Sign in with a device code (headless machines)"],
126
+ mcpUrlFlag
127
+ ]
128
+ },
129
+ {
130
+ name: "logout",
131
+ summary: "Remove the active org login (or one org with --org)",
132
+ usage: ["kody logout [--org <slug>] [--mcp-url <url>] [--api-url <url>]"],
133
+ flags: [
134
+ ["--org <slug>", "Remove only this org login"],
135
+ mcpUrlFlag,
136
+ apiUrlFlag
137
+ ]
138
+ },
139
+ {
140
+ name: "org",
141
+ summary: "List logged-in orgs or switch the active org",
142
+ usage: ["kody org <command> [flags]"],
143
+ subcommands: [
144
+ {
145
+ name: "list",
146
+ summary: "Show logged-in orgs and mark the active one",
147
+ usage: ["kody org list [--json] [--mcp-url <url>]"],
148
+ flags: [jsonFlag, mcpUrlFlag]
149
+ },
150
+ {
151
+ name: "use",
152
+ summary: "Switch the active org (interactive chooser without a slug on a TTY)",
153
+ usage: ["kody org use [<slug>] [--mcp-url <url>]"],
154
+ flags: [mcpUrlFlag]
155
+ }
156
+ ]
157
+ },
158
+ {
159
+ name: "status",
160
+ summary: "Show login, token, and server status",
161
+ usage: ["kody status [--mcp-url <url>] [--api-url <url>]"],
162
+ flags: [mcpUrlFlag, apiUrlFlag]
163
+ },
164
+ {
165
+ name: "auth",
166
+ summary: "Store scoped API tokens and set up Git credentials",
167
+ usage: ["kody auth <command> [flags]"],
168
+ subcommands: [
169
+ {
170
+ name: "bootstrap",
171
+ summary: "Redeem a kody_bc_\u2026 code (or mint one with --scopes) and store the token",
172
+ usage: [
173
+ "kody auth bootstrap (--code <kody_bc_\u2026> | --scopes <list>) (--lifetime short|long | --idle-ttl-seconds <n> --max-lifetime-seconds <n>)",
174
+ " [--token <token>] [--mcp-url <url>] [--api-url <url>]"
175
+ ],
176
+ flags: [
177
+ [
178
+ "--code <kody_bc_\u2026>",
179
+ "One-shot bootstrap code from cliCredentialBootstrap"
180
+ ],
181
+ [
182
+ "--scopes <list>",
183
+ "Mint a code with exactly these scopes (replaces the defaults)"
184
+ ],
185
+ [
186
+ "--lifetime short|long",
187
+ "short = 1h idle / 24h max; long = 14d idle / 3mo max"
188
+ ],
189
+ [
190
+ "--idle-ttl-seconds <n>",
191
+ "Custom idle lifetime (with --max-lifetime-seconds)"
192
+ ],
193
+ [
194
+ "--max-lifetime-seconds <n>",
195
+ "Custom max lifetime (with --idle-ttl-seconds)"
196
+ ],
197
+ tokenFlag,
198
+ mcpUrlFlag,
199
+ apiUrlFlag
200
+ ]
201
+ },
202
+ {
203
+ name: "setup-git",
204
+ summary: "Install a Git credential helper for https://kody.codes/@owner/name.git",
205
+ usage: [
206
+ "kody auth setup-git [--lifetime long|short] [--scopes <list>] [--token <token>] [--mcp-url <url>] [--api-url <url>]"
207
+ ],
208
+ flags: [
209
+ [
210
+ "--lifetime long|short",
211
+ "Lifetime of the minted token (default long)"
212
+ ],
213
+ [
214
+ "--scopes <list>",
215
+ "Extra scopes beyond package:read and package:write"
216
+ ],
217
+ tokenFlag,
218
+ mcpUrlFlag,
219
+ apiUrlFlag
220
+ ]
221
+ },
222
+ {
223
+ name: "remove-git",
224
+ summary: "Remove the Git credential helper and revoke its stored token",
225
+ usage: ["kody auth remove-git [--mcp-url <url>] [--api-url <url>]"],
226
+ flags: [mcpUrlFlag, apiUrlFlag]
227
+ }
228
+ ]
229
+ },
230
+ {
231
+ name: "git-credential",
232
+ summary: "Git credential helper invoked by git after `kody auth setup-git`",
233
+ usage: ["kody git-credential <get|store|erase>"],
234
+ notes: [
235
+ "Not meant for interactive use; git calls it with get, store, or erase."
236
+ ]
237
+ },
238
+ {
239
+ name: "whoami",
240
+ summary: "Show who the CLI acts as and which credential it picked",
241
+ usage: [
242
+ "kody whoami [--org <slug>] [--target prod|mock] [--mcp-url <url>] [--token <token>] [--api-url <url>] [--json]"
243
+ ],
244
+ flags: [orgFlag, targetFlag, mcpUrlFlag, tokenFlag, apiUrlFlag, jsonFlag]
245
+ },
246
+ {
247
+ name: "search",
248
+ summary: "Search capabilities, packages, and docs",
249
+ usage: [
250
+ "kody search [query] [--org <slug>] [--entity <ref>] [--domain <id>] [--limit <n>] [--target prod|mock] [--token <token>] [--api-url <url>] [--json]"
251
+ ],
252
+ flags: [
253
+ orgFlag,
254
+ ["--entity <ref>", "Look up one entity by ref"],
255
+ ["--domain <id>", "Limit results to one capability domain"],
256
+ ["--limit <n>", "Maximum results"],
257
+ targetFlag,
258
+ tokenFlag,
259
+ apiUrlFlag,
260
+ jsonFlag
261
+ ]
262
+ },
263
+ {
264
+ name: "api",
265
+ summary: "Call one Open API operation by operationId",
266
+ usage: [
267
+ "kody api <operationId> [--org <slug>] [--params <json>] [--token <token>] [--api-url <url>] [--json]"
268
+ ],
269
+ flags: [
270
+ orgFlag,
271
+ ["--params <json>", "Flat JSON params (same shape as the MCP api tool)"],
272
+ tokenFlag,
273
+ apiUrlFlag,
274
+ jsonFlag
275
+ ],
276
+ notes: ["Example: kody api usageGet --params '{}'"]
277
+ },
278
+ {
279
+ name: "package",
280
+ summary: "Publish packages and manage who can use them",
281
+ usage: ["kody package <command> [flags]"],
282
+ subcommands: [
283
+ {
284
+ name: "publish",
285
+ summary: "Publish the package in this git repo (packagePublishExternalPush)",
286
+ usage: [
287
+ "kody package publish [<@owner/leaf|package_id>] [--build local|context] [--context <name|cloud>] [--org <slug>] [--params <json>] [--token <token>] [--api-url <url>] [--json]"
288
+ ],
289
+ flags: [
290
+ [
291
+ "--build local|context",
292
+ "Build on this machine or on an execution context"
293
+ ],
294
+ [
295
+ "--context <name|cloud>",
296
+ "Execution context that builds it (with --build context)"
297
+ ],
298
+ orgFlag,
299
+ ["--params <json>", "Extra publish fields, e.g. allow_force"],
300
+ tokenFlag,
301
+ apiUrlFlag,
302
+ jsonFlag
303
+ ]
304
+ },
305
+ {
306
+ name: "collaborators",
307
+ summary: "List the teams and people who can use a package",
308
+ usage: [
309
+ "kody package collaborators <package> [--org <slug>] [--json] [--token <token>] [--api-url <url>]"
310
+ ],
311
+ flags: [orgFlag, jsonFlag, tokenFlag, apiUrlFlag]
312
+ },
313
+ {
314
+ name: "grant",
315
+ summary: "Share a package with a team or user, or change their preset",
316
+ usage: [
317
+ "kody package grant <package> (--team <slug> | --user <username>) [--preset read|use|contribute|manage] [--allow-changes-despite-unmappable-credentials | --disallow-changes-despite-unmappable-credentials] [--org <slug>] [--json]"
318
+ ],
319
+ flags: [
320
+ ["--team <slug>", "Team to share with"],
321
+ [
322
+ "--user <username>",
323
+ "Person to share with (outside the org adds an outside collaborator)"
324
+ ],
325
+ [
326
+ "--preset read|use|contribute|manage",
327
+ "What they can do (default use)"
328
+ ],
329
+ [
330
+ "--allow-changes-despite-unmappable-credentials",
331
+ "Let them change it even if credentials cannot be mapped"
332
+ ],
333
+ [
334
+ "--disallow-changes-despite-unmappable-credentials",
335
+ "Turn that back off"
336
+ ],
337
+ orgFlag,
338
+ jsonFlag
339
+ ]
340
+ },
341
+ {
342
+ name: "revoke",
343
+ summary: "Remove a team, user, or grant from a package",
344
+ usage: [
345
+ "kody package revoke <package> (--team <slug> | --user <username> | --grant <grant_id>) [--org <slug>] [--json]"
346
+ ],
347
+ flags: [
348
+ ["--team <slug>", "Team to remove"],
349
+ ["--user <username>", "Person to remove"],
350
+ ["--grant <grant_id>", "Grant to remove"],
351
+ orgFlag,
352
+ jsonFlag
353
+ ]
354
+ }
355
+ ]
356
+ },
357
+ {
358
+ name: "execute",
359
+ summary: "Run a module on Kody cloud, an execution context, or this machine",
360
+ usage: [
361
+ "kody execute [--org <slug>] [--invoke <ref> | --code <esm> | --file <path>] [--params <json>] [--conversation-id <id>] [--json]",
362
+ " [--credential <key=name>]\u2026 [--context <id|name>] [--fallback chain] [--requires fs,lan] [--chain <a,b,cloud>] [--target prod|mock] [--token <token>] [--api-url <url>] [--local] [--allow-private-network]"
363
+ ],
364
+ flags: [
365
+ orgFlag,
366
+ [
367
+ "--invoke <ref>",
368
+ "Run a package export (kody:@scope/pkg/export, or ./export in a package dir)"
369
+ ],
370
+ ["--code <esm>", "Run this module source"],
371
+ ["--file <path>", "Bundle and run this file"],
372
+ ["--params <json>", "Params passed to the module"],
373
+ ["--conversation-id <id>", "Conversation to attach the run to"],
374
+ [
375
+ "--credential <key=name>",
376
+ "Pick the credential for credential(key) calls (repeatable)"
377
+ ],
378
+ ["--context <id|name>", "Run on one execution context"],
379
+ [
380
+ "--fallback chain",
381
+ "With --context, fall back to the chain when it cannot run"
382
+ ],
383
+ [
384
+ "--requires fs,lan",
385
+ "Skip targets without local files or the local network"
386
+ ],
387
+ ["--chain <a,b,cloud>", "This run's own ordered chain"],
388
+ targetFlag,
389
+ tokenFlag,
390
+ apiUrlFlag,
391
+ ["--local", "Run in local workerd on this machine (Node.js 22+)"],
392
+ [
393
+ "--allow-private-network",
394
+ "Let --local code fetch private and local addresses"
395
+ ],
396
+ [
397
+ "--reset-storage",
398
+ "With --target mock, wipe mock scratch storage first"
399
+ ],
400
+ jsonFlag
401
+ ]
402
+ },
403
+ {
404
+ name: "dev",
405
+ summary: "Serve and test an unpublished package locally",
406
+ usage: ["kody dev [serve] [flags]", "kody dev <command> [flags]"],
407
+ notes: ["With no command, `kody dev` runs `kody dev serve`."],
408
+ subcommands: [
409
+ {
410
+ name: "serve",
411
+ summary: "Serve kody.app.entry on localhost with hot reload (the default)",
412
+ usage: [
413
+ "kody dev serve [--org <slug>] [--target prod|mock] [--reset-storage] [--passthrough <host,\u2026>] [--port <n>] [--app-base-path <path>] [--allow-private-network] [--no-live-reload] [--json] [--ready-file <path>]"
414
+ ],
415
+ flags: [
416
+ orgFlag,
417
+ devTargetFlag,
418
+ [
419
+ "--reset-storage",
420
+ "With --target mock, wipe mock scratch storage first"
421
+ ],
422
+ ["--port <n>", "Exact port (0 = any; default is stable per package)"],
423
+ [
424
+ "--app-base-path <path>",
425
+ "Public mount path stripped before workerd"
426
+ ],
427
+ [
428
+ "--allow-private-network",
429
+ "Let app code fetch private and local addresses"
430
+ ],
431
+ [
432
+ "--no-live-reload",
433
+ "Turn off HTML live reload and the error overlay"
434
+ ],
435
+ [
436
+ "--passthrough <host,\u2026>",
437
+ "With .kody/mocks.ts on mock, let these hosts use the real network"
438
+ ],
439
+ [
440
+ "--json",
441
+ "Stream NDJSON events (ready, rebuild_ok, build_error, \u2026)"
442
+ ],
443
+ [
444
+ "--ready-file <path>",
445
+ "Write { url, port, basePath, pid } once ready"
446
+ ]
447
+ ]
448
+ },
449
+ {
450
+ name: "fetch",
451
+ summary: "Request a path from the running dev server (or a one-shot server)",
452
+ usage: [
453
+ "kody dev fetch <path> [--method <verb>] [--body <file>] [--target prod|mock] [--json] [--no-attach]"
454
+ ],
455
+ flags: [
456
+ ["--method <verb>", "HTTP method (default GET)"],
457
+ ["--body <file>", "Request body file"],
458
+ devTargetFlag,
459
+ jsonFlag,
460
+ [
461
+ "--no-attach",
462
+ "Boot a one-shot server instead of using a running kody dev"
463
+ ]
464
+ ]
465
+ },
466
+ {
467
+ name: "job",
468
+ summary: "Run a job once (never schedules locally)",
469
+ usage: [
470
+ "kody dev job <name> [--target prod|mock] [--dry-run] [--json]"
471
+ ],
472
+ flags: [devTargetFlag, dryRunFlag, jsonFlag]
473
+ },
474
+ {
475
+ name: "webhook",
476
+ summary: "Deliver a webhook payload to the package",
477
+ usage: [
478
+ "kody dev webhook <name> --body <file.json> [--target prod|mock] [--dry-run] [--json]"
479
+ ],
480
+ flags: [
481
+ ["--body <file.json>", "Webhook payload"],
482
+ devTargetFlag,
483
+ dryRunFlag,
484
+ jsonFlag
485
+ ]
486
+ },
487
+ {
488
+ name: "emit",
489
+ summary: "Emit an event to the package's subscriptions",
490
+ usage: [
491
+ "kody dev emit <event> --body <event.json> [--target prod|mock] [--dry-run] [--json]"
492
+ ],
493
+ flags: [
494
+ ["--body <event.json>", "Event payload"],
495
+ devTargetFlag,
496
+ dryRunFlag,
497
+ jsonFlag
498
+ ]
499
+ },
500
+ {
501
+ name: "check",
502
+ summary: "Bundle and run the publish checks without running the package",
503
+ usage: [
504
+ "kody dev check [--target prod|mock] [--offline] [--debug] [--json]"
505
+ ],
506
+ flags: [
507
+ devTargetFlag,
508
+ ["--offline", "Skip the server publish checks"],
509
+ ["--debug", "Print the publish checks call to stderr"],
510
+ jsonFlag
511
+ ]
512
+ }
513
+ ]
514
+ },
515
+ {
516
+ name: "install",
517
+ summary: "Add Kody as an MCP server to local agent clients",
518
+ usage: [
519
+ "kody install [--mcp-url <url>] [--clients <ids>] [--yes] [--project] [--json]"
520
+ ],
521
+ flags: [
522
+ mcpUrlFlag,
523
+ ["--clients <ids>", "Comma-separated client ids"],
524
+ ["--yes", "Skip the confirmation prompt"],
525
+ ["--project", "Write project-level config instead of user-level"],
526
+ jsonFlag
527
+ ]
528
+ },
529
+ {
530
+ name: "skill",
531
+ summary: "Install the Kody agent skill",
532
+ usage: ["kody skill <command> [flags]"],
533
+ subcommands: [
534
+ {
535
+ name: "install",
536
+ summary: "Install the Kody skill for local agents",
537
+ usage: ["kody skill install [--project]"],
538
+ flags: [
539
+ ["--project", "Install into this project instead of your user dir"]
540
+ ]
541
+ }
542
+ ]
543
+ },
544
+ {
545
+ name: "version",
546
+ summary: "Print the CLI version",
547
+ usage: ["kody version"]
548
+ },
549
+ {
550
+ name: "context",
551
+ summary: "Register and manage execution contexts (machines that run your code)",
552
+ usage: ["kody context <command> [flags]"],
553
+ notes: [
554
+ "Execution contexts are an experiment. Turn it on at https://kody.codes/account/experiments."
555
+ ],
556
+ subcommands: [
557
+ {
558
+ name: "register",
559
+ summary: "Register this machine as an execution context",
560
+ usage: ["kody context register --name <name> [--org <slug>] [--json]"],
561
+ flags: [["--name <name>", "Name for this machine"], orgFlag, jsonFlag]
562
+ },
563
+ {
564
+ name: "list",
565
+ summary: "List your execution contexts",
566
+ usage: ["kody context list [--org <slug>] [--json]"],
567
+ flags: [orgFlag, jsonFlag]
568
+ },
569
+ {
570
+ name: "revoke",
571
+ summary: "Revoke a context: kill its key, disconnect it, cancel its runs",
572
+ usage: ["kody context revoke <name|ec id> [--org <slug>] [--json]"],
573
+ flags: [orgFlag, jsonFlag]
574
+ },
575
+ {
576
+ name: "delete",
577
+ summary: "Permanently delete a revoked context",
578
+ usage: ["kody context delete <name|ec id> [--org <slug>] [--json]"],
579
+ flags: [orgFlag, jsonFlag]
580
+ },
581
+ {
582
+ name: "cancel-run",
583
+ summary: "Cancel one run on a context",
584
+ usage: [
585
+ "kody context cancel-run <name|ec id> <run id> [--org <slug>] [--json]"
586
+ ],
587
+ flags: [orgFlag, jsonFlag]
588
+ },
589
+ {
590
+ name: "policy",
591
+ summary: "Show or change which host folders runs on this machine can use",
592
+ usage: ["kody context policy [<command>] [flags]"],
593
+ notes: ["With no command, shows the policy."],
594
+ subcommands: [
595
+ {
596
+ name: "show",
597
+ summary: "Show the host folder policy",
598
+ usage: ["kody context policy show [--json]"],
599
+ flags: [jsonFlag]
600
+ },
601
+ {
602
+ name: "allow",
603
+ summary: "Allow runs to use a host folder",
604
+ usage: ["kody context policy allow <path> [--mode ro|rw] [--json]"],
605
+ flags: [
606
+ ["--mode ro|rw", "Read-only or read-write (default ro)"],
607
+ jsonFlag
608
+ ]
609
+ },
610
+ {
611
+ name: "remove",
612
+ summary: "Remove a host folder from the policy",
613
+ usage: ["kody context policy remove <path> [--json]"],
614
+ flags: [jsonFlag]
615
+ }
616
+ ]
617
+ },
618
+ {
619
+ name: "commands",
620
+ summary: "Turn host commands (your own runs on this machine) on or off",
621
+ usage: [
622
+ "kody context commands [<command>] [--context <name>] [--json]"
623
+ ],
624
+ flags: [["--context <name>", "Context to check or turn off"], jsonFlag],
625
+ notes: ["With no command, shows the status."],
626
+ subcommands: [
627
+ {
628
+ name: "status",
629
+ summary: "Show whether host commands are on",
630
+ usage: ["kody context commands status [--context <name>] [--json]"],
631
+ flags: [["--context <name>", "Context to check"], jsonFlag]
632
+ },
633
+ {
634
+ name: "on",
635
+ summary: "Turn host commands on (only on this machine)",
636
+ usage: ["kody context commands on [--json]"],
637
+ flags: [jsonFlag]
638
+ },
639
+ {
640
+ name: "off",
641
+ summary: "Turn host commands off",
642
+ usage: ["kody context commands off [--context <name>] [--json]"],
643
+ flags: [
644
+ [
645
+ "--context <name>",
646
+ "Context to turn off (works from any machine)"
647
+ ],
648
+ jsonFlag
649
+ ]
650
+ }
651
+ ]
652
+ }
653
+ ]
654
+ },
655
+ {
656
+ name: "chain",
657
+ summary: "Show or change your default execution chain",
658
+ usage: ["kody chain [<command>] [--org <slug>] [--json]"],
659
+ flags: [orgFlag, jsonFlag],
660
+ notes: ["With no command, shows the chain. Offline contexts are skipped."],
661
+ subcommands: [
662
+ {
663
+ name: "show",
664
+ summary: "Show your default chain",
665
+ usage: ["kody chain show [--org <slug>] [--json]"],
666
+ flags: [orgFlag, jsonFlag]
667
+ },
668
+ {
669
+ name: "add",
670
+ summary: "Add a context to your chain (before cloud)",
671
+ usage: ["kody chain add <name> [--org <slug>] [--json]"],
672
+ flags: [orgFlag, jsonFlag]
673
+ },
674
+ {
675
+ name: "remove",
676
+ summary: "Remove a context from your chain",
677
+ usage: ["kody chain remove <name> [--org <slug>] [--json]"],
678
+ flags: [orgFlag, jsonFlag]
679
+ }
680
+ ]
681
+ },
682
+ {
683
+ name: "connect",
684
+ summary: "Register this machine and install the daemon as a background service",
685
+ usage: [
686
+ "kody connect --name <name> [--org <slug>] [--no-install] [--key-storage keyring|file] [--yes]"
687
+ ],
688
+ flags: [
689
+ ["--name <name>", "Name for this machine"],
690
+ orgFlag,
691
+ ["--no-install", "Register only; do not install the background service"],
692
+ ["--key-storage keyring|file", "Where the service reads the machine key"],
693
+ ["--yes", "Skip confirmation prompts"]
694
+ ]
695
+ },
696
+ {
697
+ name: "daemon",
698
+ summary: "Run the execution-context daemon, or manage its background service",
699
+ usage: [
700
+ "kody daemon [--context <ec id>] [--max-concurrent <n>]",
701
+ "kody daemon <command> [flags]"
702
+ ],
703
+ flags: [
704
+ ecContextFlag,
705
+ ["--max-concurrent <n>", "Runs at once (foreground daemon)"]
706
+ ],
707
+ notes: [
708
+ "With no command, runs the daemon in the foreground until Ctrl-C.",
709
+ "The service is systemd --user on Linux (and WSL with systemd), a LaunchAgent on macOS, and a Task Scheduler logon task on Windows."
710
+ ],
711
+ subcommands: [
712
+ {
713
+ name: "install",
714
+ summary: "Install the daemon as a per-user background service",
715
+ usage: [
716
+ "kody daemon install [--context <ec id>] [--max-concurrent <n>] [--key-storage keyring|file] [--yes]"
717
+ ],
718
+ flags: [
719
+ ecContextFlag,
720
+ ["--max-concurrent <n>", "Runs at once"],
721
+ [
722
+ "--key-storage keyring|file",
723
+ "Where the service reads the machine key"
724
+ ],
725
+ ["--yes", "Skip confirmation prompts"]
726
+ ]
727
+ },
728
+ {
729
+ name: "status",
730
+ summary: "Show the service state and each problem with its fix",
731
+ usage: ["kody daemon status [--context <ec id>] [--json]"],
732
+ flags: [ecContextFlag, jsonFlag]
733
+ },
734
+ {
735
+ name: "logs",
736
+ summary: "Print the daemon log",
737
+ usage: [
738
+ "kody daemon logs [--context <ec id>] [--lines <n>] [--follow]"
739
+ ],
740
+ flags: [
741
+ ecContextFlag,
742
+ ["--lines <n>", "Lines from the end (default 100)"],
743
+ ["--follow", "Keep printing new lines"]
744
+ ]
745
+ },
746
+ {
747
+ name: "restart",
748
+ summary: "Restart the service after runs in flight finish",
749
+ usage: ["kody daemon restart [--context <ec id>]"],
750
+ flags: [ecContextFlag]
751
+ },
752
+ {
753
+ name: "start",
754
+ summary: "Start the stopped service",
755
+ usage: ["kody daemon start [--context <ec id>]"],
756
+ flags: [ecContextFlag]
757
+ },
758
+ {
759
+ name: "stop",
760
+ summary: "Stop the service after runs in flight finish, without unregistering",
761
+ usage: ["kody daemon stop [--context <ec id>]"],
762
+ flags: [ecContextFlag],
763
+ notes: [
764
+ "The context shows offline, so chains skip it. It stays stopped until `kody daemon start` or the next login or boot."
765
+ ]
766
+ },
767
+ {
768
+ name: "uninstall",
769
+ summary: "Remove the background service",
770
+ usage: [
771
+ "kody daemon uninstall [--context <ec id>] [--unregister | --no-unregister]"
772
+ ],
773
+ flags: [
774
+ ecContextFlag,
775
+ ["--unregister", "Also revoke the execution context"],
776
+ ["--no-unregister", "Keep the execution context registered"]
777
+ ]
778
+ },
779
+ {
780
+ name: "auto-update",
781
+ summary: "Show or change daemon auto-update on this machine",
782
+ usage: ["kody daemon auto-update [<command>] [--json]"],
783
+ flags: [jsonFlag],
784
+ notes: ["With no command, shows the status."],
785
+ subcommands: [
786
+ {
787
+ name: "status",
788
+ summary: "Show whether auto-update is on",
789
+ usage: ["kody daemon auto-update status [--json]"],
790
+ flags: [jsonFlag]
791
+ },
792
+ {
793
+ name: "on",
794
+ summary: "Turn auto-update on",
795
+ usage: ["kody daemon auto-update on [--json]"],
796
+ flags: [jsonFlag]
797
+ },
798
+ {
799
+ name: "off",
800
+ summary: "Turn auto-update off",
801
+ usage: ["kody daemon auto-update off [--json]"],
802
+ flags: [jsonFlag]
803
+ }
804
+ ]
805
+ }
806
+ ]
807
+ },
808
+ {
809
+ name: "update",
810
+ summary: "Install the latest CLI and restart daemon services after runs finish",
811
+ usage: ["kody update"]
812
+ },
813
+ {
814
+ name: "help",
815
+ summary: "Show help for kody or one command",
816
+ usage: ["kody help [<command> \u2026]"]
817
+ }
818
+ ];
819
+ function findCommandHelp(path) {
820
+ let nodes = commandHelpTree;
821
+ let deepest = null;
822
+ const matched = [];
823
+ for (const segment of path) {
824
+ const node = nodes.find((candidate) => candidate.name === segment);
825
+ if (!node) break;
826
+ deepest = node;
827
+ matched.push(segment);
828
+ nodes = node.subcommands ?? [];
829
+ }
830
+ return deepest ? { node: deepest, path: matched } : null;
831
+ }
832
+ function formatRows(rows) {
833
+ const width = Math.min(Math.max(...rows.map(([left]) => left.length)) + 2, 34);
834
+ return rows.map(
835
+ ([left, right]) => left.length + 2 > width ? ` ${left}
836
+ ${" ".repeat(width)}${right}` : ` ${left.padEnd(width)}${right}`
837
+ ).join("\n");
838
+ }
839
+ function buildCommandHelp(path) {
840
+ const found = findCommandHelp(path);
841
+ if (!found) return null;
842
+ const { node } = found;
843
+ const full = `kody ${found.path.join(" ")}`;
844
+ const sections = [
845
+ `${full}: ${node.summary} (Kody CLI ${readPackageVersion()})`,
846
+ `Usage:
847
+ ${node.usage.map((line) => ` ${line}`).join("\n")}`
848
+ ];
849
+ if (node.subcommands?.length) {
850
+ sections.push(
851
+ `Commands:
852
+ ${formatRows(
853
+ node.subcommands.map((sub) => [sub.name, sub.summary])
854
+ )}`
855
+ );
856
+ }
857
+ sections.push(
858
+ `Flags:
859
+ ${formatRows([
860
+ ...node.flags ?? [],
861
+ ["-h, --help", "Show help for this command"]
862
+ ])}`
863
+ );
864
+ if (node.notes?.length) sections.push(node.notes.join("\n"));
865
+ if (node.subcommands?.length) {
866
+ sections.push(`Run \`${full} <command> --help\` for a command's flags.`);
867
+ }
868
+ return `${sections.join("\n\n")}
869
+ `;
870
+ }
871
+
78
872
  // src/help.ts
79
873
  function formatOrgsHelpBlock(orgs, indent = " ") {
80
874
  if (orgs.length === 0) {
@@ -130,11 +924,12 @@ Usage:
130
924
  kody context revoke <name|ec id> | kody context delete <name|ec id> [--org <slug>] [--json]
131
925
  kody context cancel-run <name|ec id> <run id> [--org <slug>] [--json]
132
926
  kody context policy [show] | allow <path> [--mode ro|rw] | remove <path> [--json]
927
+ kody context grant [show] | allow <path> [--mode ro|rw] | remove <path> | lan on|off [--context <name|ec id>] [--json]
133
928
  kody chain show | add <name> | remove <name> [--org <slug>] [--json]
134
929
  kody connect --name <name> [--org <slug>] [--no-install] [--key-storage keyring|file] [--yes]
135
930
  kody daemon [--context <ec id>] [--max-concurrent <n>]
136
931
  kody daemon install [--context <ec id>] [--max-concurrent <n>] [--key-storage keyring|file] [--yes]
137
- kody daemon status [--context <ec id>] [--json] | logs [--lines <n>] [--follow] | restart
932
+ kody daemon status [--context <ec id>] [--json] | logs [--lines <n>] [--follow] | restart | start | stop
138
933
  kody daemon uninstall [--context <ec id>] [--unregister | --no-unregister]
139
934
  kody daemon auto-update [on | off | status] [--json]
140
935
  kody update
@@ -148,13 +943,20 @@ Usage:
148
943
  kody install [--mcp-url <url>] [--clients <ids>] [--yes] [--project] [--json]
149
944
  kody skill install [--project]
150
945
 
946
+ Run \`kody <command> --help\` (or \`kody help <command>\`) for one command's
947
+ usage, flags, and subcommands.
948
+
151
949
  kody connect registers this machine as an execution context and installs
152
950
  \`kody daemon\` as a per-user background service (systemd --user on Linux,
153
951
  a LaunchAgent on macOS, a Task Scheduler logon task on Windows, no admin
154
952
  needed) so it starts at login and restarts after crashes.
155
953
  \`kody daemon status\` names each problem with the command that fixes it;
156
954
  re-running \`kody daemon install\` repairs the service. Host folders use
157
- native paths (C:\\Users\\you\\project on Windows). \`kody update\`
955
+ native paths (C:\\Users\\you\\project on Windows). A run can use a host
956
+ folder only when both layers allow it: this machine's local policy
957
+ (\`kody context policy allow\`, the machine owner's call) and the
958
+ context's server grant (\`kody context grant allow\`, needs Contribute
959
+ or Manage on the context, same as executionContextUpdate). \`kody update\`
158
960
  installs the latest CLI and restarts services after runs in flight finish.
159
961
  Every daemon also auto-updates: it checks npm on start and every ~4h,
160
962
  installs the verified new version, and relaunches once runs and background
@@ -988,21 +1790,22 @@ async function runCli(argv = process.argv.slice(2), io = {}) {
988
1790
  }).catch(() => {
989
1791
  });
990
1792
  }
991
- const jsonFlag = argvIncludesJsonFlag(argv);
1793
+ const jsonFlag2 = argvIncludesJsonFlag(argv);
992
1794
  resetActiveCliCredential();
993
1795
  try {
994
1796
  const parsed = resolveCommand(argv);
995
1797
  const helpMcpUrl = mcpUrlFrom({
996
1798
  mcpUrl: typeof parsed.values["mcp-url"] === "string" ? parsed.values["mcp-url"] : void 0
997
1799
  });
998
- if (parsed.values.help && parsed.command !== "help") {
999
- write(buildUsage({ mcpUrl: helpMcpUrl }));
1800
+ if (parsed.values.help && (parsed.command !== "help" || argv[0] === "help")) {
1801
+ const helpPath = parsed.command === "help" ? parsed.positionals.length > 0 ? parsed.positionals : ["help"] : [parsed.command, ...parsed.positionals];
1802
+ write(buildCommandHelp(helpPath) ?? buildUsage({ mcpUrl: helpMcpUrl }));
1000
1803
  return 0;
1001
1804
  }
1002
1805
  return await dispatch(parsed, write, writeErr);
1003
1806
  } catch (error) {
1004
1807
  const redacted = redactError(error);
1005
- if (jsonFlag) {
1808
+ if (jsonFlag2) {
1006
1809
  write(`${JSON.stringify(formatCliErrorJson(redacted))}
1007
1810
  `);
1008
1811
  }
@@ -1072,8 +1875,8 @@ async function dispatch(parsed, write, writeErr) {
1072
1875
  "`--passthrough` is only used with `execute --target mock` or `kody dev` when `.kody/mocks.ts` is active."
1073
1876
  );
1074
1877
  }
1075
- const orgFlag = typeof parsed.values.org === "string" ? parsed.values.org : void 0;
1076
- if (orgFlag !== void 0 && !orgScopedCommands.has(parsed.command)) {
1878
+ const orgFlag2 = typeof parsed.values.org === "string" ? parsed.values.org : void 0;
1879
+ if (orgFlag2 !== void 0 && !orgScopedCommands.has(parsed.command)) {
1077
1880
  throw new Error(
1078
1881
  `\`--org\` is not used with \`kody ${parsed.command}\`. Use it with login, logout, whoami, search, api, package, execute, or auth.`
1079
1882
  );
@@ -1083,14 +1886,16 @@ async function dispatch(parsed, write, writeErr) {
1083
1886
  `);
1084
1887
  return 0;
1085
1888
  }
1086
- const orgFlagOnly = orgFlag !== void 0 ? orgSlugFromFlag(orgFlag) : void 0;
1889
+ const orgFlagOnly = orgFlag2 !== void 0 ? orgSlugFromFlag(orgFlag2) : void 0;
1087
1890
  const org = resolveOrgSlug({
1088
- flag: orgFlag,
1891
+ flag: orgFlag2,
1089
1892
  activeOrg: loadCredentialStore(mcpUrl)?.activeOrg
1090
1893
  });
1091
1894
  switch (parsed.command) {
1092
1895
  case "help":
1093
- write(buildUsage({ mcpUrl }));
1896
+ write(
1897
+ (parsed.positionals.length > 0 ? buildCommandHelp(parsed.positionals) : null) ?? buildUsage({ mcpUrl })
1898
+ );
1094
1899
  return 0;
1095
1900
  case "context":
1096
1901
  case "chain":
@@ -1100,7 +1905,7 @@ async function dispatch(parsed, write, writeErr) {
1100
1905
  const apiUrl = apiUrlFrom({
1101
1906
  apiUrl: typeof parsed.values["api-url"] === "string" ? parsed.values["api-url"] : void 0
1102
1907
  });
1103
- const { runExecutionContextCommand } = await import("./commands-KJ2LKZPN.js");
1908
+ const { runExecutionContextCommand } = await import("./commands-KSLL3FBI.js");
1104
1909
  return await runExecutionContextCommand({
1105
1910
  command: parsed.command,
1106
1911
  positionals: parsed.positionals,
@@ -1405,7 +2210,7 @@ async function dispatch(parsed, write, writeErr) {
1405
2210
  apiUrl: typeof parsed.values["api-url"] === "string" ? parsed.values["api-url"] : void 0
1406
2211
  });
1407
2212
  if (target === "mock") {
1408
- const { ensureMockTarget } = await import("./mock-server-AVHUTXAL.js");
2213
+ const { ensureMockTarget } = await import("./mock-server-TDKUEG5W.js");
1409
2214
  const mock = await ensureMockTarget({
1410
2215
  resetStorage: parsed.values["reset-storage"] === true,
1411
2216
  ...org ? { orgSlug: org } : {}
@@ -1464,7 +2269,7 @@ async function dispatch(parsed, write, writeErr) {
1464
2269
  let closeMock;
1465
2270
  try {
1466
2271
  if (target === "mock") {
1467
- const { ensureMockTarget } = await import("./mock-server-AVHUTXAL.js");
2272
+ const { ensureMockTarget } = await import("./mock-server-TDKUEG5W.js");
1468
2273
  const mock = await ensureMockTarget({
1469
2274
  resetStorage: parsed.values["reset-storage"] === true
1470
2275
  });
@@ -1616,7 +2421,7 @@ async function dispatch(parsed, write, writeErr) {
1616
2421
  }
1617
2422
  try {
1618
2423
  if (target === "mock") {
1619
- const { ensureMockTarget } = await import("./mock-server-AVHUTXAL.js");
2424
+ const { ensureMockTarget } = await import("./mock-server-TDKUEG5W.js");
1620
2425
  const mock = await ensureMockTarget({
1621
2426
  resetStorage: parsed.values["reset-storage"] === true,
1622
2427
  packageId: localPackageRun ? `local:${localPackageRun.kodyId}` : void 0,
@@ -1634,7 +2439,7 @@ async function dispatch(parsed, write, writeErr) {
1634
2439
  });
1635
2440
  }
1636
2441
  if (localPackageRun) {
1637
- const { buildLocalPackageContext, runLocalPackageModule } = await import("./local-package-run-PUB3K7FH.js");
2442
+ const { buildLocalPackageContext, runLocalPackageModule } = await import("./local-package-run-TWSCJ5OP.js");
1638
2443
  const result2 = await runLocalPackageModule({
1639
2444
  modulePath: localPackageRun.modulePath,
1640
2445
  params: args.params,
@@ -1679,7 +2484,7 @@ async function dispatch(parsed, write, writeErr) {
1679
2484
  packageRootForMocks = void 0;
1680
2485
  }
1681
2486
  }
1682
- const result = local ? await (await import("./local-execute-DESLSJIM.js")).runLocalExecute({
2487
+ const result = local ? await (await import("./local-execute-YWYSSSX4.js")).runLocalExecute({
1683
2488
  code: args.code,
1684
2489
  ...modulePath !== void 0 ? { modulePath } : {},
1685
2490
  params: args.params,
@@ -1736,7 +2541,7 @@ async function dispatch(parsed, write, writeErr) {
1736
2541
  return result.isError ? 1 : 0;
1737
2542
  } catch (error) {
1738
2543
  if (json && local) {
1739
- const { LocalPackageGraphError, packageGraphErrorToolResult } = await import("./local-package-graph-T2PWPQDN.js");
2544
+ const { LocalPackageGraphError, packageGraphErrorToolResult } = await import("./local-package-graph-BOT5WG6P.js");
1740
2545
  if (error instanceof LocalPackageGraphError) {
1741
2546
  const redacted = redactError(error).message;
1742
2547
  const result = packageGraphErrorToolResult(error);
@@ -1766,7 +2571,7 @@ async function dispatch(parsed, write, writeErr) {
1766
2571
  runDevServe,
1767
2572
  runDevWebhook,
1768
2573
  tryAttachedDevFetch
1769
- } = await import("./dev-command-MPBKGNZW.js");
2574
+ } = await import("./dev-command-SAN55YUO.js");
1770
2575
  const target = resolveTarget({
1771
2576
  command: "dev",
1772
2577
  flag: typeof parsed.values.target === "string" ? parsed.values.target : void 0
@@ -1794,7 +2599,7 @@ async function dispatch(parsed, write, writeErr) {
1794
2599
  { parsePackageCheckResult, PublishChecksAuthError }
1795
2600
  ] = await Promise.all([
1796
2601
  import("./open-api-client-5BVEGHDF.js"),
1797
- import("./dev-command-MPBKGNZW.js")
2602
+ import("./dev-command-SAN55YUO.js")
1798
2603
  ]);
1799
2604
  let token2;
1800
2605
  try {
@@ -2491,6 +3296,7 @@ export {
2491
3296
  publishCliExitCode,
2492
3297
  publishRefusalMessage,
2493
3298
  apiUrlFrom,
3299
+ cliFlagNames,
2494
3300
  resolveCommand,
2495
3301
  runCli,
2496
3302
  argvIncludesJsonFlag,
@@ -2503,4 +3309,4 @@ export {
2503
3309
  resolvePackagePublishTarget,
2504
3310
  storedApiTokenAfterLoginNotice
2505
3311
  };
2506
- //# sourceMappingURL=chunk-JXUNYHCE.js.map
3312
+ //# sourceMappingURL=chunk-PMRDVBMB.js.map