@kodycodes/cli 3.11.0 → 3.12.1

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 (80) hide show
  1. package/README.md +34 -8
  2. package/dist/api-token.d.ts +3 -0
  3. package/dist/{auth-YYGBFLBJ.js → auth-2ZIZDLPY.js} +5 -4
  4. package/dist/bin.js +7 -6
  5. package/dist/bin.js.map +1 -1
  6. package/dist/{chunk-CASZNLFR.js → chunk-2ATDBLEX.js} +136 -159
  7. package/dist/chunk-2ATDBLEX.js.map +6 -0
  8. package/dist/{chunk-7YASVU4K.js → chunk-3KNFRULE.js} +2 -2
  9. package/dist/{chunk-6XTF3YD5.js → chunk-3NV6G54V.js} +6 -6
  10. package/dist/{chunk-GY3OE2RC.js → chunk-6N43NCYD.js} +4 -4
  11. package/dist/{chunk-L225BIT7.js → chunk-CDFCKKEC.js} +1 -1
  12. package/dist/{chunk-L225BIT7.js.map → chunk-CDFCKKEC.js.map} +1 -1
  13. package/dist/{chunk-TVDOUKXV.js → chunk-DINK4SRI.js} +3 -3
  14. package/dist/{chunk-LD6ND6Z3.js → chunk-EGN6A45D.js} +3 -3
  15. package/dist/{chunk-VZ5Q5FIR.js → chunk-PQBZATM7.js} +3 -3
  16. package/dist/{chunk-T2UI7XR3.js → chunk-R62L6MWH.js} +6 -4
  17. package/dist/chunk-R62L6MWH.js.map +6 -0
  18. package/dist/{chunk-AZ6UXLP6.js → chunk-SUR4SJXS.js} +31 -125
  19. package/dist/chunk-SUR4SJXS.js.map +6 -0
  20. package/dist/{chunk-HTMEGJAJ.js → chunk-TJRNKHE6.js} +21 -7
  21. package/dist/chunk-TJRNKHE6.js.map +6 -0
  22. package/dist/chunk-UHBPB4VH.js +255 -0
  23. package/dist/chunk-UHBPB4VH.js.map +6 -0
  24. package/dist/{chunk-PMHSFJLB.js → chunk-VUUVCVAG.js} +2 -2
  25. package/dist/cli-credential.d.ts +86 -0
  26. package/dist/cli.d.ts +11 -24
  27. package/dist/cli.js +9 -8
  28. package/dist/commands-PVXABMWK.js +2524 -0
  29. package/dist/commands-PVXABMWK.js.map +6 -0
  30. package/dist/{dev-command-W4EXL7SE.js → dev-command-BTJ4WJEQ.js} +8 -7
  31. package/dist/dev-command-BTJ4WJEQ.js.map +6 -0
  32. package/dist/execution-context/client.d.ts +4 -1
  33. package/dist/execution-context/commands.d.ts +11 -1
  34. package/dist/execution-context/daemon.d.ts +12 -2
  35. package/dist/execution-context/keystore.d.ts +32 -2
  36. package/dist/execution-context/service-commands.d.ts +75 -0
  37. package/dist/execution-context/service.d.ts +157 -0
  38. package/dist/{git-credential-M4RC3D5E.js → git-credential-AGHABRZZ.js} +6 -5
  39. package/dist/git-credential-AGHABRZZ.js.map +6 -0
  40. package/dist/{local-execute-ALYHHP6M.js → local-execute-NLJGGADH.js} +6 -5
  41. package/dist/{local-package-graph-GREJNPV5.js → local-package-graph-M7U7DQ2N.js} +4 -3
  42. package/dist/{local-package-run-LMJ5XYA5.js → local-package-run-Z2ITZ6KO.js} +8 -7
  43. package/dist/{mock-dep-resolve-ZSTZP6F7.js → mock-dep-resolve-DANXDGZU.js} +6 -5
  44. package/dist/mock-dep-resolve-DANXDGZU.js.map +6 -0
  45. package/dist/{mock-local-deps-WZDGHV7Z.js → mock-local-deps-CNFLGJSA.js} +5 -4
  46. package/dist/{open-api-client-CFFUM66I.js → open-api-client-ZK5T7PIZ.js} +4 -3
  47. package/dist/{remote-execute-3VJIHSVF.js → remote-execute-7KZCU5FK.js} +4 -3
  48. package/dist/remote-execute-7KZCU5FK.js.map +6 -0
  49. package/dist/{run-executor-NNH65ODC.js → run-executor-RHSAGN2Z.js} +8 -7
  50. package/dist/run-executor-RHSAGN2Z.js.map +6 -0
  51. package/dist/{setup-git-RAWSZAB2.js → setup-git-67N7Q2BR.js} +5 -4
  52. package/dist/whoami-SMZ4U5QQ.js +114 -0
  53. package/dist/whoami-SMZ4U5QQ.js.map +6 -0
  54. package/dist/whoami.d.ts +22 -0
  55. package/package.json +1 -1
  56. package/dist/chunk-AZ6UXLP6.js.map +0 -6
  57. package/dist/chunk-CASZNLFR.js.map +0 -6
  58. package/dist/chunk-HTMEGJAJ.js.map +0 -6
  59. package/dist/chunk-T2UI7XR3.js.map +0 -6
  60. package/dist/commands-DOND3A3A.js +0 -1217
  61. package/dist/commands-DOND3A3A.js.map +0 -6
  62. package/dist/dev-command-W4EXL7SE.js.map +0 -6
  63. package/dist/git-credential-M4RC3D5E.js.map +0 -6
  64. package/dist/mock-dep-resolve-ZSTZP6F7.js.map +0 -6
  65. package/dist/remote-execute-3VJIHSVF.js.map +0 -6
  66. package/dist/run-executor-NNH65ODC.js.map +0 -6
  67. /package/dist/{auth-YYGBFLBJ.js.map → auth-2ZIZDLPY.js.map} +0 -0
  68. /package/dist/{chunk-7YASVU4K.js.map → chunk-3KNFRULE.js.map} +0 -0
  69. /package/dist/{chunk-6XTF3YD5.js.map → chunk-3NV6G54V.js.map} +0 -0
  70. /package/dist/{chunk-GY3OE2RC.js.map → chunk-6N43NCYD.js.map} +0 -0
  71. /package/dist/{chunk-TVDOUKXV.js.map → chunk-DINK4SRI.js.map} +0 -0
  72. /package/dist/{chunk-LD6ND6Z3.js.map → chunk-EGN6A45D.js.map} +0 -0
  73. /package/dist/{chunk-VZ5Q5FIR.js.map → chunk-PQBZATM7.js.map} +0 -0
  74. /package/dist/{chunk-PMHSFJLB.js.map → chunk-VUUVCVAG.js.map} +0 -0
  75. /package/dist/{local-execute-ALYHHP6M.js.map → local-execute-NLJGGADH.js.map} +0 -0
  76. /package/dist/{local-package-graph-GREJNPV5.js.map → local-package-graph-M7U7DQ2N.js.map} +0 -0
  77. /package/dist/{local-package-run-LMJ5XYA5.js.map → local-package-run-Z2ITZ6KO.js.map} +0 -0
  78. /package/dist/{mock-local-deps-WZDGHV7Z.js.map → mock-local-deps-CNFLGJSA.js.map} +0 -0
  79. /package/dist/{open-api-client-CFFUM66I.js.map → open-api-client-ZK5T7PIZ.js.map} +0 -0
  80. /package/dist/{setup-git-RAWSZAB2.js.map → setup-git-67N7Q2BR.js.map} +0 -0
package/README.md CHANGED
@@ -110,9 +110,9 @@ flow stays the default.
110
110
  | `kody auth setup-git` | Installs a Git credential helper for `https://kody.codes/@owner/name.git` (persistent `kody_at_…`, user-owned token with `package:read`/`package:write`). See [Git HTTPS](#git-https-setup-git). |
111
111
  | `kody auth remove-git` | Inverse of `setup-git`: clears Kody HTTPS git helpers, revokes the stored API token, deletes it from the keychain. Leaves `kody login` alone. |
112
112
  | `kody git-credential` | Credential helper invoked by Git after `setup-git` (`get` / `store` / `erase`). |
113
- | `kody whoami` | Confirms the CLI MCP connection and lists tools. With a scoped API token (and no login), shows token identity via the Open API. |
113
+ | `kody whoami` | Shows the credential commands will use (`--token`, `KODY_API_TOKEN`, stored API token, or `kody login`), its token id and scopes, and any other stored credential it outranks. See [Which credential a command uses](#which-credential-a-command-uses). |
114
114
  | `kody search [query]` | Calls Kody `search` from the CLI (prefer the host MCP tool). Token-only auth uses Open API `GET /v1/search`. |
115
- | `kody api <operationId>` | Thin Open API wrapper matching the MCP `api` tool: `operationId` + flat `--params` JSON. Auth: `--token` / `KODY_API_TOKEN` / stored `auth bootstrap` token. The parsed `/openapi.json` route map is cached under the Kody cache dir keyed by the document's `ETag` and revalidated with `If-None-Match` on each run. |
115
+ | `kody api <operationId>` | Thin Open API wrapper matching the MCP `api` tool: `operationId` + flat `--params` JSON. Auth: `--token`, `KODY_API_TOKEN`, the stored API token, then `kody login` (same credential `kody whoami` reports). The parsed `/openapi.json` route map is cached under the Kody cache dir keyed by the document's `ETag` and revalidated with `If-None-Match` on each run. |
116
116
  | `kody package publish` | Thin wrapper for `packagePublishExternalPush`. Optional positional `@owner/leaf`, bare leaf name, or package UUID (names are resolved to the package UUID via `packageList`); extra fields via `--params`. Same auth as `kody api`. Prints the API JSON. Exit **0** for `published`, `already_published` (including `artifacts_rebuilt: true`), and `dispatched` (poll `workflowRunList({ workflow_id })`). Exit **1** for refusal/rejection statuses (`checks_failed`, `locked`, `approval_required`, `not_fast_forward`) with the API `message` (or a checks summary) on stderr, like npm. Auth / permission / network failures also exit 1; `--json` adds `{ error, message, sent }` on stdout for network errors (`sent: false` = not sent; `sent: "unknown"` = maybe sent — prefer `kody api workflowRunList` with `workflow_id` when known, otherwise a recent list, before retry). Re-publishing the same commit is safe (durable dedupe / `already_published`). |
117
117
  | `kody package collaborators` / `grant` / `revoke` | Who can use one package, and add or remove teams and members of the org (`--org`). `<package>` is `@owner/leaf`, the name leaf, or the package id. `grant <package> --team <slug>\|--user <username> [--preset use\|contribute\|manage]` (default `use`) adds or changes a collaborator via `packageCollaboratorSet`; people outside the org are refused. `revoke <package> --team\|--user\|--grant <grant_id>` removes one via `packageCollaboratorRemove`. Needs Manage on the package and a token with `package:manage_access` (`auth bootstrap --scopes …,package:manage_access`). Prints a summary, or JSON with `--json`. |
118
118
  | `kody execute` | Calls Kody `execute` from the CLI (`--invoke`, `--code`, `--file`, or stdin via `--file -`). `--invoke` is client-side sugar: the CLI writes the one-export import passthrough and sends it as `code`, the only module field hosted execute accepts. With a scoped API token and no login (or with `--token`), cloud execute goes through CapabilityProxy → `kody.execute` — no `kody login`. Add `--local` to run the module (and static `kody:@…` package modules) on this machine instead. `--credential key=name` (repeatable; `org:name` / `personal:name` / empty `=` for none) picks ADR 0068 credentials for `--local` or a `kody login` MCP session. `--allow-private-network` opts local execution into private and local network access. `--target prod\|mock` (default `prod`) sends CapabilityProxy / search hops to prod or the built-in CLI mock; `--target mock` implies local workerd. |
@@ -129,9 +129,9 @@ Agents already on Kody MCP should prefer `cliCredentialBootstrap` →
129
129
  CLI store without pasting `kody_at_…` into chat. Interactive humans can use
130
130
  `kody login`. Scoped API tokens (`kody_at_…`, from bootstrap redeem,
131
131
  `tokenCreate`, or `POST /v1/tokens`) authenticate the Open API and
132
- CapabilityProxy. They never replace MCP OAuth on `/mcp`. The CLI uses that token
133
- path when you pass `--token` / `KODY_API_TOKEN` and are not logged in (or when
134
- you pass `--token` explicitly):
132
+ CapabilityProxy. They never replace MCP OAuth on `/mcp`. See
133
+ [Which credential a command uses](#which-credential-a-command-uses) for the
134
+ order the CLI picks them in:
135
135
 
136
136
  ```bash
137
137
  # Preferred for agents on MCP (no tokenCreate, no second OAuth):
@@ -174,6 +174,32 @@ npx @kodycodes/cli api usageGet --params '{}'
174
174
  - Prefer the env var so the token stays out of shell history and `ps`.
175
175
  - Never scavenge host MCP OAuth tokens from disk (ADR 0053).
176
176
 
177
+ ## Which credential a command uses
178
+
179
+ One resolver picks the credential for every command, and `kody whoami` reports
180
+ the same pick:
181
+
182
+ | Commands | Order |
183
+ | ------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
184
+ | `whoami`, `api`, `package`, `execute --local`, `context`, `daemon`, `dev` | `--token`, `KODY_API_TOKEN`, stored API token, `kody login` |
185
+ | `search`, cloud `execute` (no `--local`) | `--token`, `kody login` (over MCP), `KODY_API_TOKEN`, stored API token |
186
+ | `auth bootstrap --scopes` (minting) | `--token`, `kody login`, `KODY_API_TOKEN`, stored API token |
187
+
188
+ - The stored API token comes from `kody auth bootstrap` or
189
+ `kody auth setup-git`. `kody login` stores a login session next to it and does
190
+ not replace it, so a stored token keeps winning for `api` and the other
191
+ first-row commands after you log in again. `kody login` prints a note when
192
+ that happens.
193
+ - To change the stored token's scopes, run
194
+ `npx @kodycodes/cli auth bootstrap --lifetime short --scopes <every scope you need>`
195
+ (mints with your login and replaces the stored token). `kody logout` clears
196
+ both.
197
+ - `kody whoami` prints `credential:` (which one is in use, with its token id),
198
+ its `scopes:`, and `also stored:` lines for credentials it outranks. With
199
+ `--json` the same data is under `credential` and `otherCredentials`.
200
+ - `insufficient_scope` errors end with `Credential used: …` and, for a stored
201
+ token, the exact `auth bootstrap` command that replaces it.
202
+
177
203
  ## Opt-in scopes
178
204
 
179
205
  Bootstrap tokens default to local-execute use scopes plus `package:write`,
@@ -534,9 +560,9 @@ is always printed too, so you can paste it into a browser if no window appears.
534
560
 
535
561
  Access tokens refresh automatically on expiry or HTTP 401.
536
562
 
537
- `execute --local` prefers `--token` / `KODY_API_TOKEN` when set; otherwise it
538
- uses stored CLI credentials from `kody login`. Token-only cloud execute still
539
- only reads `--token` / `KODY_API_TOKEN`.
563
+ `execute --local` prefers `--token` / `KODY_API_TOKEN` when set, then a stored
564
+ API token, then the `kody login` session. See
565
+ [Which credential a command uses](#which-credential-a-command-uses).
540
566
 
541
567
  ## Execution context daemon performance
542
568
 
@@ -1,4 +1,5 @@
1
1
  import { loadStoredApiToken, type StoredApiToken } from './api-token-store.js';
2
+ import { type CliCredential } from './cli-credential.js';
2
3
  import { type SecretBackend, type StoreResolution } from './store.js';
3
4
  /** Mirrors `cliTokenLifetimeAliases` in auth-bootstrap (keep in sync; avoid import cycle). */
4
5
  export type CliTokenLifetimeAlias = 'short' | 'long';
@@ -97,6 +98,8 @@ export declare function insufficientScopeMessage(input: Partial<InsufficientScop
97
98
  * when unknown — pass the current token's inferred alias when available.
98
99
  */
99
100
  currentLifetime?: CliTokenLifetimeAlias | null;
101
+ /** Credential that was sent; defaults to the one this process resolved. */
102
+ credential?: CliCredential | null;
100
103
  }): string;
101
104
  export declare function featureDisabledMessage(): string;
102
105
  export declare function requireApiToken(values?: {
@@ -8,13 +8,14 @@ import {
8
8
  loginWithDevice,
9
9
  refreshStoredCredentials,
10
10
  resolvePendingOrgSlug
11
- } from "./chunk-VZ5Q5FIR.js";
11
+ } from "./chunk-PQBZATM7.js";
12
12
  import "./chunk-GVSGNTG6.js";
13
13
  import "./chunk-CWWHR4FH.js";
14
14
  import "./chunk-CASGRYOF.js";
15
- import "./chunk-7YASVU4K.js";
15
+ import "./chunk-3KNFRULE.js";
16
16
  import "./chunk-46IJPEID.js";
17
- import "./chunk-AZ6UXLP6.js";
17
+ import "./chunk-SUR4SJXS.js";
18
+ import "./chunk-UHBPB4VH.js";
18
19
  import "./chunk-KWAUPCKM.js";
19
20
  import "./chunk-NHRYNRXG.js";
20
21
  import "./chunk-D6XME4RY.js";
@@ -30,4 +31,4 @@ export {
30
31
  refreshStoredCredentials,
31
32
  resolvePendingOrgSlug
32
33
  };
33
- //# sourceMappingURL=auth-YYGBFLBJ.js.map
34
+ //# sourceMappingURL=auth-2ZIZDLPY.js.map
package/dist/bin.js CHANGED
@@ -2,21 +2,22 @@
2
2
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
3
3
  import {
4
4
  runCli
5
- } from "./chunk-CASZNLFR.js";
5
+ } from "./chunk-2ATDBLEX.js";
6
6
  import "./chunk-M7PRSUCC.js";
7
7
  import "./chunk-7PRJ36I5.js";
8
8
  import "./chunk-SLNAWWQK.js";
9
- import "./chunk-HTMEGJAJ.js";
9
+ import "./chunk-TJRNKHE6.js";
10
10
  import "./chunk-2XPH7L2P.js";
11
- import "./chunk-T2UI7XR3.js";
11
+ import "./chunk-R62L6MWH.js";
12
12
  import "./chunk-6ZYUGXVW.js";
13
- import "./chunk-VZ5Q5FIR.js";
13
+ import "./chunk-PQBZATM7.js";
14
14
  import "./chunk-GVSGNTG6.js";
15
15
  import "./chunk-CWWHR4FH.js";
16
16
  import "./chunk-CASGRYOF.js";
17
- import "./chunk-7YASVU4K.js";
17
+ import "./chunk-3KNFRULE.js";
18
18
  import "./chunk-46IJPEID.js";
19
- import "./chunk-AZ6UXLP6.js";
19
+ import "./chunk-SUR4SJXS.js";
20
+ import "./chunk-UHBPB4VH.js";
20
21
  import "./chunk-KWAUPCKM.js";
21
22
  import "./chunk-NHRYNRXG.js";
22
23
  import "./chunk-D6XME4RY.js";
package/dist/bin.js.map CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/bin.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAM,OAAO,MAAM,OAAO;AAC1B,QAAQ,WAAW;",
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAM,OAAO,MAAM,OAAO;AAC1B,QAAQ,WAAW;",
5
5
  "names": []
6
6
  }