@ora-ai/cli 0.23.0 → 0.25.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/CHANGELOG.md +77 -0
- package/README.md +44 -13
- package/dist/agent-skills/skills-command.d.ts.map +1 -1
- package/dist/agent-skills/skills-command.js +2 -2
- package/dist/agent-skills/skills-command.js.map +1 -1
- package/dist/auth-commands.d.ts +25 -9
- package/dist/auth-commands.d.ts.map +1 -1
- package/dist/auth-commands.js +59 -49
- package/dist/auth-commands.js.map +1 -1
- package/dist/core/auth.d.ts +2 -2
- package/dist/core/auth.d.ts.map +1 -1
- package/dist/core/auth.js +5 -4
- package/dist/core/auth.js.map +1 -1
- package/dist/core/cli-arguments.d.ts +21 -0
- package/dist/core/cli-arguments.d.ts.map +1 -0
- package/dist/core/cli-arguments.js +53 -0
- package/dist/core/cli-arguments.js.map +1 -0
- package/dist/core/config.d.ts +10 -5
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +10 -7
- package/dist/core/config.js.map +1 -1
- package/dist/core/credentials/api-key-credential.d.ts +29 -0
- package/dist/core/credentials/api-key-credential.d.ts.map +1 -0
- package/dist/core/credentials/api-key-credential.js +58 -0
- package/dist/core/credentials/api-key-credential.js.map +1 -0
- package/dist/core/credentials/ci-oidc-credential.d.ts +44 -0
- package/dist/core/credentials/ci-oidc-credential.d.ts.map +1 -0
- package/dist/core/credentials/ci-oidc-credential.js +82 -0
- package/dist/core/credentials/ci-oidc-credential.js.map +1 -0
- package/dist/core/credentials/credential-chain.d.ts +25 -0
- package/dist/core/credentials/credential-chain.d.ts.map +1 -0
- package/dist/core/credentials/credential-chain.js +39 -0
- package/dist/core/credentials/credential-chain.js.map +1 -0
- package/dist/core/credentials/credential.d.ts +73 -0
- package/dist/core/credentials/credential.d.ts.map +1 -0
- package/dist/core/credentials/credential.js +9 -0
- package/dist/core/credentials/credential.js.map +1 -0
- package/dist/core/credentials/device-session-credential.d.ts +27 -0
- package/dist/core/credentials/device-session-credential.d.ts.map +1 -0
- package/dist/core/credentials/device-session-credential.js +78 -0
- package/dist/core/credentials/device-session-credential.js.map +1 -0
- package/dist/core/credentials/identity-lines.d.ts +14 -0
- package/dist/core/credentials/identity-lines.d.ts.map +1 -0
- package/dist/core/credentials/identity-lines.js +45 -0
- package/dist/core/credentials/identity-lines.js.map +1 -0
- package/dist/core/credentials/refusal-words.d.ts +15 -0
- package/dist/core/credentials/refusal-words.d.ts.map +1 -0
- package/dist/core/credentials/refusal-words.js +56 -0
- package/dist/core/credentials/refusal-words.js.map +1 -0
- package/dist/core/credentials/sign-in-areas.d.ts +18 -0
- package/dist/core/credentials/sign-in-areas.d.ts.map +1 -0
- package/dist/core/credentials/sign-in-areas.js +22 -0
- package/dist/core/credentials/sign-in-areas.js.map +1 -0
- package/dist/core/http.d.ts +10 -4
- package/dist/core/http.d.ts.map +1 -1
- package/dist/core/http.js +7 -5
- package/dist/core/http.js.map +1 -1
- package/dist/core/identity.d.ts +11 -0
- package/dist/core/identity.d.ts.map +1 -0
- package/dist/core/identity.js +21 -0
- package/dist/core/identity.js.map +1 -0
- package/dist/core/limit-story.d.ts +11 -0
- package/dist/core/limit-story.d.ts.map +1 -0
- package/dist/core/limit-story.js +16 -0
- package/dist/core/limit-story.js.map +1 -0
- package/dist/core/login.d.ts +5 -3
- package/dist/core/login.d.ts.map +1 -1
- package/dist/core/login.js +5 -3
- package/dist/core/login.js.map +1 -1
- package/dist/core/oauth/metadata.d.ts +24 -0
- package/dist/core/oauth/metadata.d.ts.map +1 -0
- package/dist/core/oauth/metadata.js +99 -0
- package/dist/core/oauth/metadata.js.map +1 -0
- package/dist/core/oauth/oauth-client.d.ts +70 -0
- package/dist/core/oauth/oauth-client.d.ts.map +1 -0
- package/dist/core/oauth/oauth-client.js +136 -0
- package/dist/core/oauth/oauth-client.js.map +1 -0
- package/dist/core/oauth/oauth-error.d.ts +18 -0
- package/dist/core/oauth/oauth-error.d.ts.map +1 -0
- package/dist/core/oauth/oauth-error.js +31 -0
- package/dist/core/oauth/oauth-error.js.map +1 -0
- package/dist/core/oauth/sign-in-error.d.ts +15 -0
- package/dist/core/oauth/sign-in-error.d.ts.map +1 -0
- package/dist/core/oauth/sign-in-error.js +21 -0
- package/dist/core/oauth/sign-in-error.js.map +1 -0
- package/dist/core/oauth/sign-in-target.d.ts +31 -0
- package/dist/core/oauth/sign-in-target.d.ts.map +1 -0
- package/dist/core/oauth/sign-in-target.js +44 -0
- package/dist/core/oauth/sign-in-target.js.map +1 -0
- package/dist/core/output.d.ts +14 -3
- package/dist/core/output.d.ts.map +1 -1
- package/dist/core/output.js +38 -38
- package/dist/core/output.js.map +1 -1
- package/dist/core/retry-after.d.ts +8 -0
- package/dist/core/retry-after.d.ts.map +1 -0
- package/dist/core/retry-after.js +18 -0
- package/dist/core/retry-after.js.map +1 -0
- package/dist/core/run-operation.d.ts +26 -10
- package/dist/core/run-operation.d.ts.map +1 -1
- package/dist/core/run-operation.js +40 -21
- package/dist/core/run-operation.js.map +1 -1
- package/dist/core/session/device-session-auth.d.ts +29 -0
- package/dist/core/session/device-session-auth.d.ts.map +1 -0
- package/dist/core/session/device-session-auth.js +92 -0
- package/dist/core/session/device-session-auth.js.map +1 -0
- package/dist/core/session/file-lock.d.ts +33 -0
- package/dist/core/session/file-lock.d.ts.map +1 -0
- package/dist/core/session/file-lock.js +145 -0
- package/dist/core/session/file-lock.js.map +1 -0
- package/dist/core/session/session-refusals.d.ts +22 -0
- package/dist/core/session/session-refusals.d.ts.map +1 -0
- package/dist/core/session/session-refusals.js +23 -0
- package/dist/core/session/session-refusals.js.map +1 -0
- package/dist/core/session/session-store.d.ts +53 -0
- package/dist/core/session/session-store.d.ts.map +1 -0
- package/dist/core/session/session-store.js +71 -0
- package/dist/core/session/session-store.js.map +1 -0
- package/dist/core/sign-in.d.ts +2 -2
- package/dist/core/sign-in.js +2 -2
- package/dist/core/token-expiry.d.ts +9 -0
- package/dist/core/token-expiry.d.ts.map +1 -0
- package/dist/core/token-expiry.js +11 -0
- package/dist/core/token-expiry.js.map +1 -0
- package/dist/core/url.d.ts +5 -0
- package/dist/core/url.d.ts.map +1 -0
- package/dist/core/url.js +17 -0
- package/dist/core/url.js.map +1 -0
- package/dist/generated/operations.d.ts +2 -1
- package/dist/generated/operations.d.ts.map +1 -1
- package/dist/generated/operations.js +32 -5
- package/dist/generated/operations.js.map +1 -1
- package/dist/generated/types.d.ts +584 -0
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/generated/types.js +1 -1
- package/dist/interactive/menu.d.ts.map +1 -1
- package/dist/interactive/menu.js +4 -2
- package/dist/interactive/menu.js.map +1 -1
- package/dist/interactive/session.d.ts.map +1 -1
- package/dist/interactive/session.js +17 -8
- package/dist/interactive/session.js.map +1 -1
- package/dist/login/browser-opener.d.ts +20 -0
- package/dist/login/browser-opener.d.ts.map +1 -0
- package/dist/login/browser-opener.js +43 -0
- package/dist/login/browser-opener.js.map +1 -0
- package/dist/login/device-flow.d.ts +60 -0
- package/dist/login/device-flow.d.ts.map +1 -0
- package/dist/login/device-flow.js +98 -0
- package/dist/login/device-flow.js.map +1 -0
- package/dist/login/device-login.d.ts +27 -0
- package/dist/login/device-login.d.ts.map +1 -0
- package/dist/login/device-login.js +148 -0
- package/dist/login/device-login.js.map +1 -0
- package/dist/login/device-presenter.d.ts +24 -0
- package/dist/login/device-presenter.d.ts.map +1 -0
- package/dist/login/device-presenter.js +69 -0
- package/dist/login/device-presenter.js.map +1 -0
- package/dist/login/login-command.d.ts +14 -0
- package/dist/login/login-command.d.ts.map +1 -0
- package/dist/login/login-command.js +73 -0
- package/dist/login/login-command.js.map +1 -0
- package/dist/login/login-deps.d.ts +17 -0
- package/dist/login/login-deps.d.ts.map +1 -0
- package/dist/login/login-deps.js +18 -0
- package/dist/login/login-deps.js.map +1 -0
- package/dist/login/piped-input.d.ts +23 -0
- package/dist/login/piped-input.d.ts.map +1 -0
- package/dist/login/piped-input.js +36 -0
- package/dist/login/piped-input.js.map +1 -0
- package/dist/login/requested-scopes.d.ts +22 -0
- package/dist/login/requested-scopes.d.ts.map +1 -0
- package/dist/login/requested-scopes.js +43 -0
- package/dist/login/requested-scopes.js.map +1 -0
- package/dist/program.d.ts +16 -5
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +35 -10
- package/dist/program.js.map +1 -1
- package/dist/study-ci/ci-command.d.ts.map +1 -1
- package/dist/study-ci/ci-command.js +2 -2
- package/dist/study-ci/ci-command.js.map +1 -1
- package/dist/study-ci/ci-rehearse-command.d.ts.map +1 -1
- package/dist/study-ci/ci-rehearse-command.js +2 -2
- package/dist/study-ci/ci-rehearse-command.js.map +1 -1
- package/dist/tunnel/connection-end.d.ts +30 -0
- package/dist/tunnel/connection-end.d.ts.map +1 -0
- package/dist/tunnel/connection-end.js +29 -0
- package/dist/tunnel/connection-end.js.map +1 -0
- package/dist/tunnel-command.d.ts.map +1 -1
- package/dist/tunnel-command.js +24 -8
- package/dist/tunnel-command.js.map +1 -1
- package/package.json +3 -2
- package/dist/core/credential-sources.d.ts +0 -45
- package/dist/core/credential-sources.d.ts.map +0 -1
- package/dist/core/credential-sources.js +0 -65
- package/dist/core/credential-sources.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Changelog — `@ora-ai/cli`
|
|
2
|
+
|
|
3
|
+
The version of a release is its `cli-v*` tag (package.json stays `0.0.0-dev` in the repo;
|
|
4
|
+
`publish-oss.yaml` stamps the version at release time). Newest first.
|
|
5
|
+
|
|
6
|
+
## Unreleased
|
|
7
|
+
|
|
8
|
+
Publish this only once the environment people use serves browser sign-in. Until then `ora login`
|
|
9
|
+
says the server does not offer it yet and points at `ora login --api-key`; api keys work either way.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **`ora audit run <domain>`.** `ora audit run example.com --watch` audits a site with no JSON body.
|
|
14
|
+
`--domain example.com` works too. `--file` still works for the other fields (`mcpUrl`, `fresh`); a
|
|
15
|
+
domain given as an argument wins over one in the file. A second domain is refused rather than
|
|
16
|
+
dropped, and a missing one is named with an example.
|
|
17
|
+
- **Browser sign-in.** `ora login` signs you in through your browser (the device flow, RFC 8628): it
|
|
18
|
+
prints a link and a code, opens the browser when it can, and waits for your approval. A new person
|
|
19
|
+
signs up on the same page. Approve only a sign-in you started yourself — the CLI says so with
|
|
20
|
+
every code. If a code expires first, a fresh one is shown; nothing to restart. Flags:
|
|
21
|
+
`--no-browser` (also implied in CI and over SSH), `--read-only` (ask for read permissions only),
|
|
22
|
+
`--json` (JSON lines for an agent driving the CLI), `--auth-url` (the sign-in server, when it is
|
|
23
|
+
not `account.<domain>` of the API URL; `ORA_AUTH_URL` does the same).
|
|
24
|
+
- The sign-in is stored at `~/.config/ora/session.json` (0600) and refreshed on its own; several
|
|
25
|
+
`ora` commands running at once take turns to refresh it. It asks for the permissions this CLI's
|
|
26
|
+
commands use, and the approval page decides which of them you grant.
|
|
27
|
+
- **A sign-in ends when your own access does.** "Log out everywhere" in ora, a changed or reset
|
|
28
|
+
password, and removal from the organization end it: the next command says to run `ora login`
|
|
29
|
+
again. Signing out of one browser does not. If your organization starts requiring two-factor
|
|
30
|
+
authentication and you have not set it up, commands are refused until you do.
|
|
31
|
+
- **`ora tunnel` works with a sign-in, and ends with it.** The server keeps asking whether the
|
|
32
|
+
sign-in still stands for as long as the tunnel is connected, and closes the tunnel within about
|
|
33
|
+
half a minute once it does not (disconnected in Connected apps, `ora logout` on another machine,
|
|
34
|
+
log out everywhere, removal from the organization). The CLI then says the sign-in no longer works
|
|
35
|
+
and to run `ora login` again, and exits with an error. A tunnel opened with an api key is as before.
|
|
36
|
+
- **`ora autopilot …` does not take a browser sign-in yet.** With a sign-in those commands say so
|
|
37
|
+
and point at an api key (`ora login --api-key`), and `ora login` does not ask for their
|
|
38
|
+
permissions. Everything else works with either.
|
|
39
|
+
- `ora whoami` for a sign-in shows your organization and its name, your email, the permissions you
|
|
40
|
+
granted, and `via: device sign-in`. `ora whoami --json` prints that identity as the API returns it.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- **A plan limit says what happened and points to billing.** With no allowance (a plan without it,
|
|
45
|
+
or a paused subscription) it reads "No Ora Score scans are available on your plan right now."; a
|
|
46
|
+
used-up limit reads "You've used all 10,000 Ora Score scans on your plan." (agent runs and Ora
|
|
47
|
+
Score scans add "ora usage shows when they reset."); a request bigger than what is left keeps
|
|
48
|
+
"Used 440 of 450.". All end with "Upgrade in Studio → Settings → Plan & billing."
|
|
49
|
+
- **`ora usage` needs the `usage:read` scope**, where it needed `intents:read`. Every api key that
|
|
50
|
+
held `intents:read` when this shipped was given `usage:read`, so it keeps working (for up to 15
|
|
51
|
+
minutes after the change it may still be refused, until its cached token renews); a new key needs
|
|
52
|
+
`usage:read` for `ora usage`. A browser sign-in made before this asks for it on the next `ora login`.
|
|
53
|
+
- **`ora login` with no key now signs in through the browser**, where it used to ask you to paste
|
|
54
|
+
one. Every way of giving it a key works as before: `ora login --api-key ora_sk_…`,
|
|
55
|
+
`ORA_API_KEY`, and a key piped on stdin (`echo "$KEY" | ora login`). To paste a key at the
|
|
56
|
+
prompt, run `ora login --api-key`.
|
|
57
|
+
- In a script, CI job or agent harness (stdin is not a terminal), a bare `ora login` reads stdin to
|
|
58
|
+
its end first, as it always has, and starts the browser sign-in only when stdin held nothing.
|
|
59
|
+
`ora login --no-browser` (or `--json`) skips that read and goes straight to the link and code.
|
|
60
|
+
With no key and nobody to approve, the sign-in waits for its codes to expire (up to an hour)
|
|
61
|
+
and exits 1, where the old CLI failed at once: set `ORA_API_KEY` in CI.
|
|
62
|
+
- **`ora logout` revokes a browser sign-in** at the sign-in server, then removes what is stored
|
|
63
|
+
locally (the session, a stored api key and its cached token). If the server cannot be reached the
|
|
64
|
+
local sign-in is removed anyway.
|
|
65
|
+
- One stored credential at a time: signing in through the browser removes a stored api key (and
|
|
66
|
+
its cached token), and `ora login --api-key` revokes and removes a browser sign-in. `ORA_API_KEY`
|
|
67
|
+
still wins over anything stored, then a stored key, then a browser sign-in.
|
|
68
|
+
- A command the API refuses for a missing permission tells a browser sign-in to run `ora login`
|
|
69
|
+
again and allow that permission, naming it. An api key is told what it always was.
|
|
70
|
+
- "No api key configured" is now "Not signed in. Run `ora login` (or set ORA_API_KEY for CI)."
|
|
71
|
+
|
|
72
|
+
### Unchanged
|
|
73
|
+
|
|
74
|
+
- **Api keys work exactly as before**, against any Ora server: the key is traded for a short-lived
|
|
75
|
+
token at `POST /auth/token`, the token is cached in `~/.config/ora/token.json`, and
|
|
76
|
+
`ora whoami` with a key prints the same lines. Nothing to change in CI or scripts that use
|
|
77
|
+
`ORA_API_KEY`, `ora login --api-key`, or a key piped into `ora login`.
|
package/README.md
CHANGED
|
@@ -29,16 +29,42 @@ prints `--help` instead — nothing changes for existing scripts.
|
|
|
29
29
|
|
|
30
30
|
## Authenticate
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Sign in with your browser (a new person signs up on the same page):
|
|
33
33
|
|
|
34
|
-
ora login #
|
|
35
|
-
ora login --api-key ora_sk_...
|
|
34
|
+
ora login # prints a link and a code, opens your browser
|
|
36
35
|
ora whoami
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
`ora login` is device sign-in (RFC 8628): approve the CLI in the browser and it
|
|
38
|
+
stays signed in on this machine — `~/.config/ora/session.json` (0600), refreshed
|
|
39
|
+
on its own — until `ora logout`, which also revokes it. Approve only a sign-in
|
|
40
|
+
you started yourself: a link and code someone sends you would sign *their*
|
|
41
|
+
terminal in as you. If a code expires before you approve it, the CLI shows a
|
|
42
|
+
fresh one; nothing to restart. Over SSH, in CI, or with `--no-browser` it only
|
|
43
|
+
prints the link. `ora login --read-only` asks for read permissions only, and
|
|
44
|
+
`ora login --json` prints JSON lines (the code to show, then who signed in) for
|
|
45
|
+
an agent driving the CLI.
|
|
46
|
+
|
|
47
|
+
The sign-in asks for the permissions this CLI's commands use; the approval page
|
|
48
|
+
shows them and you decide which to grant. A command that needs one you did not
|
|
49
|
+
grant says which, and `ora login` again lets you allow it. One exception:
|
|
50
|
+
`ora autopilot …` does not take a browser sign-in yet and needs an API key.
|
|
51
|
+
|
|
52
|
+
API keys are for CI and scripts. Mint one in the ora dashboard (Settings → API
|
|
53
|
+
keys), then:
|
|
54
|
+
|
|
55
|
+
ora login --api-key ora_sk_... # or `ora login --api-key` to paste it (masked)
|
|
56
|
+
echo "$KEY" | ora login # a key piped on stdin
|
|
57
|
+
ORA_API_KEY=ora_sk_... ora whoami
|
|
58
|
+
|
|
59
|
+
In CI, skip login and export `ORA_API_KEY` (prefer short-expiry keys); it wins
|
|
60
|
+
over anything stored. A stored key lives in `~/.config/ora/config.json` (0600)
|
|
61
|
+
and is exchanged for a short-lived token on every call — the key itself never
|
|
62
|
+
travels beyond the token exchange. Keys work exactly as they always have, also
|
|
63
|
+
against a server that does not offer browser sign-in yet (there, `ora login`
|
|
64
|
+
says so and points here).
|
|
65
|
+
|
|
66
|
+
One credential is stored at a time: signing in through the browser removes a
|
|
67
|
+
stored key, and `ora login --api-key` revokes and removes a browser sign-in.
|
|
42
68
|
|
|
43
69
|
### Keyless sign-in from GitHub Actions
|
|
44
70
|
|
|
@@ -78,7 +104,11 @@ self-hosted ora, set the API base **once at login** — it's remembered in
|
|
|
78
104
|
`~/.config/ora/config.json`:
|
|
79
105
|
|
|
80
106
|
ora login --api-url https://api.staging.agentfront.sh # staging
|
|
81
|
-
ora login --api-url http://api.localhost:8081
|
|
107
|
+
ora login --api-url http://api.ora.localhost:8081 # local k3d dev
|
|
108
|
+
|
|
109
|
+
Browser sign-in finds its sign-in server from that URL (`api.<domain>` →
|
|
110
|
+
`account.<domain>`); when yours lives elsewhere, name it with `--auth-url`
|
|
111
|
+
(or `ORA_AUTH_URL`).
|
|
82
112
|
|
|
83
113
|
Precedence for every command: `--api-url` flag > `ORA_API_URL` env >
|
|
84
114
|
`config.json` > the spec's default. So one-off calls can override without
|
|
@@ -221,7 +251,7 @@ After a run completes, read its artifacts:
|
|
|
221
251
|
`ora-studio` is the Studio playbook: define the objective, create the intent, define the win, measure,
|
|
222
252
|
read the results, improve, schedule, with a recipe per objective (be recommended, don't get steered
|
|
223
253
|
away, book a demo, MCP discovery, MCP usage). It comes from your Studio account, so it needs the same
|
|
224
|
-
API key as the other commands (scope `intents:read`).
|
|
254
|
+
sign-in or API key as the other commands (scope `intents:read`).
|
|
225
255
|
|
|
226
256
|
### MCP — give your coding agent the CLI's commands as tools
|
|
227
257
|
|
|
@@ -442,8 +472,8 @@ error, 2 usage error.
|
|
|
442
472
|
With `--json`, a failure is JSON too: the API's error body, as sent, on one
|
|
443
473
|
stderr line — `{error, code, details}`, the fields a client generated from the
|
|
444
474
|
public API reads. An Autopilot refusal names its wave and blocker there. A
|
|
445
|
-
failure the API did not answer in JSON (
|
|
446
|
-
refused key exchange) prints `{error, code}`:
|
|
475
|
+
failure the API did not answer in JSON (not signed in, an unreadable `--file`,
|
|
476
|
+
a refused key exchange, a sign-in that did not complete) prints `{error, code}`:
|
|
447
477
|
|
|
448
478
|
ora autopilot members add billing-crew --file member.json --json 2> err.json \
|
|
449
479
|
|| jq -r '.code, .details.issues[0].refusal.wave' err.json
|
|
@@ -463,5 +493,6 @@ the terminal's `COLORFGBG`. Set `ORA_THEME=light` or `ORA_THEME=dark` when your
|
|
|
463
493
|
## Errors that explain themselves
|
|
464
494
|
|
|
465
495
|
- **402** — a plan limit was hit; the message names the dimension and where to upgrade.
|
|
466
|
-
- **403 INSUFFICIENT_SCOPE** — the
|
|
467
|
-
|
|
496
|
+
- **403 INSUFFICIENT_SCOPE** — the credential lacks a scope; the message names
|
|
497
|
+
it. With a browser sign-in, run `ora login` again and allow that permission.
|
|
498
|
+
With an api key, mint a key with that scope and `ora login --api-key` again.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills-command.d.ts","sourceRoot":"","sources":["../../src/agent-skills/skills-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"skills-command.d.ts","sourceRoot":"","sources":["../../src/agent-skills/skills-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAUhF,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,CAAC,MAAM,EAAE,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,KAAK,YAAwD,GACrH,IAAI,CA6BN"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
|
-
import { renderError } from "../core/output.js";
|
|
3
2
|
import { credentials } from "../core/run-operation.js";
|
|
4
3
|
import { olderThan } from "./cli-version.js";
|
|
5
4
|
import { DEFAULT_TARGET_KEYS, resolveTargets } from "./install-targets.js";
|
|
@@ -31,7 +30,8 @@ export function attachSkillsAdd(program, deps, version, sourceOf = (client) => n
|
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
catch (err) {
|
|
34
|
-
|
|
33
|
+
// A refusal is told in the credential's own words: a browser sign-in is not told to mint an api key.
|
|
34
|
+
deps.errOut(creds.renderError(err));
|
|
35
35
|
process.exitCode = 1;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills-command.js","sourceRoot":"","sources":["../../src/agent-skills/skills-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"skills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AAC;YACb,qGAAqG;YACrG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;YACpC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/auth-commands.d.ts
CHANGED
|
@@ -1,27 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* The handwritten identity commands' cores: api-key login, whoami, logout —
|
|
3
|
+
* shared verbatim with the interactive session (interactive/session.ts
|
|
4
|
+
* imports performLogin, performWhoami and forgetStoredCredentials). `ora
|
|
5
|
+
* login` itself, which also runs the browser sign-in, is wired in
|
|
6
|
+
* login/login-command.ts.
|
|
5
7
|
*
|
|
6
8
|
* ResolvedDeps is imported type-only from program.ts — no runtime edge back
|
|
7
9
|
* to program.ts (program.ts imports these attach* functions by value; see
|
|
8
10
|
* that file's session-cycle doc comment for the same pattern).
|
|
9
11
|
*/
|
|
10
12
|
import type { Command } from "commander";
|
|
13
|
+
import { type CallerCredentials } from "./core/run-operation.js";
|
|
11
14
|
import type { ResolvedDeps } from "./program.js";
|
|
12
15
|
/**
|
|
13
|
-
*
|
|
16
|
+
* Who a caller is, asked of the server now, the way its credential is verified: an api key by trading it for a token
|
|
17
|
+
* (the program's `makeAuth`), a browser sign-in by asking the API (the program's `makeClient`). The credential picks
|
|
18
|
+
* its door (credentials/credential.ts); this only hands it the program's own, so tests fake them in one place.
|
|
19
|
+
*/
|
|
20
|
+
export declare function callerIdentity(deps: Pick<ResolvedDeps, "makeAuth" | "makeClient">, creds: CallerCredentials): Promise<Record<string, unknown>>;
|
|
21
|
+
/**
|
|
22
|
+
* The api-key login core: validate the `ora_sk_` prefix → store → verify by
|
|
14
23
|
* exchanging for a token → roll back the stored key on verification failure.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* and
|
|
24
|
+
* The key becomes THE stored credential: a browser sign-in it replaces is
|
|
25
|
+
* revoked and removed once the key is verified. Shared verbatim by the
|
|
26
|
+
* scripted `login --api-key` action and the interactive session — prints
|
|
27
|
+
* exactly the lines the action always printed and returns whether login
|
|
28
|
+
* succeeded.
|
|
18
29
|
*/
|
|
19
30
|
export declare function performLogin(deps: ResolvedDeps, opts: {
|
|
20
31
|
apiKey?: string;
|
|
21
32
|
apiUrl?: string;
|
|
22
33
|
}): Promise<boolean>;
|
|
23
34
|
/**
|
|
24
|
-
* The whoami core: verify the configured
|
|
35
|
+
* The whoami core: verify the configured credential and print its identity. THE one
|
|
25
36
|
* implementation — shared verbatim by the scripted `whoami` action and the
|
|
26
37
|
* interactive session's whoami menu entry (interactive/session.ts) so the two
|
|
27
38
|
* doors never drift apart. Returns whether it succeeded and never throws;
|
|
@@ -33,7 +44,12 @@ export declare function performWhoami(deps: ResolvedDeps, opts: {
|
|
|
33
44
|
json?: boolean;
|
|
34
45
|
apiUrlFlag?: string;
|
|
35
46
|
}): Promise<boolean>;
|
|
36
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Every stored credential forgotten — a browser sign-in's grant revoked (best effort), an api key's cached token
|
|
49
|
+
* dropped — then the config dir's credential files removed. An `ORA_API_KEY` in the environment is not stored, so
|
|
50
|
+
* it is not touched.
|
|
51
|
+
*/
|
|
52
|
+
export declare function forgetStoredCredentials(deps: ResolvedDeps): Promise<void>;
|
|
37
53
|
export declare function attachLogout(program: Command, deps: ResolvedDeps): void;
|
|
38
54
|
export declare function attachWhoami(program: Command, deps: ResolvedDeps): void;
|
|
39
55
|
//# sourceMappingURL=auth-commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-commands.d.ts","sourceRoot":"","sources":["../src/auth-commands.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"auth-commands.d.ts","sourceRoot":"","sources":["../src/auth-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,YAAY,CAAC,EACnD,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAElC;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CA2BnH;AAWD;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAoBvH;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAK/E;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CASvE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAUvE"}
|
package/dist/auth-commands.js
CHANGED
|
@@ -1,25 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* The handwritten identity commands' cores: api-key login, whoami, logout —
|
|
3
|
+
* shared verbatim with the interactive session (interactive/session.ts
|
|
4
|
+
* imports performLogin, performWhoami and forgetStoredCredentials). `ora
|
|
5
|
+
* login` itself, which also runs the browser sign-in, is wired in
|
|
6
|
+
* login/login-command.ts.
|
|
5
7
|
*
|
|
6
8
|
* ResolvedDeps is imported type-only from program.ts — no runtime edge back
|
|
7
9
|
* to program.ts (program.ts imports these attach* functions by value; see
|
|
8
10
|
* that file's session-cycle doc comment for the same pattern).
|
|
9
11
|
*/
|
|
10
|
-
import { decodeClaims } from "./core/auth.js";
|
|
11
12
|
import { clearCredentials, readConfig, resolveApiUrl, writeConfig } from "./core/config.js";
|
|
12
|
-
import {
|
|
13
|
+
import { ApiKeyCredential } from "./core/credentials/api-key-credential.js";
|
|
14
|
+
import { storedCredentials } from "./core/credentials/credential-chain.js";
|
|
15
|
+
import { revokeSession } from "./core/credentials/device-session-credential.js";
|
|
13
16
|
import { renderError } from "./core/output.js";
|
|
14
|
-
import { credentials } from "./core/run-operation.js";
|
|
15
|
-
import {
|
|
17
|
+
import { callerOf, credentials } from "./core/run-operation.js";
|
|
18
|
+
import { SessionStore } from "./core/session/session-store.js";
|
|
16
19
|
import { SPEC } from "./generated/operations.js";
|
|
17
20
|
/**
|
|
18
|
-
*
|
|
21
|
+
* Who a caller is, asked of the server now, the way its credential is verified: an api key by trading it for a token
|
|
22
|
+
* (the program's `makeAuth`), a browser sign-in by asking the API (the program's `makeClient`). The credential picks
|
|
23
|
+
* its door (credentials/credential.ts); this only hands it the program's own, so tests fake them in one place.
|
|
24
|
+
*/
|
|
25
|
+
export function callerIdentity(deps, creds) {
|
|
26
|
+
return creds.credential.readIdentity({ auth: () => deps.makeAuth(creds), client: () => deps.makeClient(creds) });
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The api-key login core: validate the `ora_sk_` prefix → store → verify by
|
|
19
30
|
* exchanging for a token → roll back the stored key on verification failure.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* and
|
|
31
|
+
* The key becomes THE stored credential: a browser sign-in it replaces is
|
|
32
|
+
* revoked and removed once the key is verified. Shared verbatim by the
|
|
33
|
+
* scripted `login --api-key` action and the interactive session — prints
|
|
34
|
+
* exactly the lines the action always printed and returns whether login
|
|
35
|
+
* succeeded.
|
|
23
36
|
*/
|
|
24
37
|
export async function performLogin(deps, opts) {
|
|
25
38
|
const key = opts.apiKey ?? "";
|
|
@@ -34,30 +47,31 @@ export async function performLogin(deps, opts) {
|
|
|
34
47
|
// failing against another must be self-diagnosing, never a mystery.
|
|
35
48
|
deps.out(`Verifying against ${apiUrl}`);
|
|
36
49
|
writeConfig({ ...previous, apiKey: key, ...(opts.apiUrl ? { apiUrl } : {}) }, deps.dir);
|
|
50
|
+
const caller = callerOf(apiUrl, new ApiKeyCredential(key, "config.json"));
|
|
37
51
|
try {
|
|
38
|
-
const
|
|
39
|
-
|
|
52
|
+
const claims = await callerIdentity(deps, caller);
|
|
53
|
+
await dropDeviceSession(deps);
|
|
40
54
|
deps.out(`Logged in. org=${String(claims.org ?? claims.organizationId ?? "?")} subject=${String(claims.sub ?? "?")}`);
|
|
41
55
|
return true;
|
|
42
56
|
}
|
|
43
57
|
catch (err) {
|
|
44
58
|
writeConfig(previous, deps.dir); // verification failed — roll back
|
|
45
|
-
deps.errOut(renderError(err));
|
|
59
|
+
deps.errOut(caller.renderError(err));
|
|
46
60
|
process.exitCode = 1;
|
|
47
61
|
return false;
|
|
48
62
|
}
|
|
49
63
|
}
|
|
50
|
-
/**
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
/** A browser sign-in replaced by an api key: its grant revoked (best effort) and its session removed. */
|
|
65
|
+
async function dropDeviceSession(deps) {
|
|
66
|
+
const store = new SessionStore(deps.dir);
|
|
67
|
+
const session = store.read();
|
|
68
|
+
if (!session)
|
|
69
|
+
return;
|
|
70
|
+
await revokeSession(session, { fetchFn: deps.login.fetchFn, now: deps.login.now });
|
|
71
|
+
store.clear();
|
|
58
72
|
}
|
|
59
73
|
/**
|
|
60
|
-
* The whoami core: verify the configured
|
|
74
|
+
* The whoami core: verify the configured credential and print its identity. THE one
|
|
61
75
|
* implementation — shared verbatim by the scripted `whoami` action and the
|
|
62
76
|
* interactive session's whoami menu entry (interactive/session.ts) so the two
|
|
63
77
|
* doors never drift apart. Returns whether it succeeded and never throws;
|
|
@@ -71,54 +85,50 @@ export async function performWhoami(deps, opts) {
|
|
|
71
85
|
if (!creds)
|
|
72
86
|
return false;
|
|
73
87
|
try {
|
|
74
|
-
const
|
|
75
|
-
const claims = decodeClaims(token);
|
|
88
|
+
const claims = await callerIdentity(deps, creds);
|
|
76
89
|
if (opts.json) {
|
|
77
90
|
deps.out(JSON.stringify(claims, null, 2));
|
|
78
91
|
return true;
|
|
79
92
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
...federationLine(claims.federation),
|
|
85
|
-
`api: ${creds.apiUrl}`,
|
|
86
|
-
].join("\n"));
|
|
93
|
+
// Each credential words its own identity (credentials/identity-lines.ts): an api key's lines are the ones this
|
|
94
|
+
// command has always printed (a keyless CI job's add the job), a browser sign-in's also name the person and how
|
|
95
|
+
// they signed in.
|
|
96
|
+
deps.out(creds.credential.identityLines(claims, creds.apiUrl).join("\n"));
|
|
87
97
|
return true;
|
|
88
98
|
}
|
|
89
99
|
catch (err) {
|
|
90
|
-
deps.errOut(renderError(err, { mode }));
|
|
100
|
+
deps.errOut(creds.renderError(err, { mode }));
|
|
91
101
|
process.exitCode = 1;
|
|
92
102
|
return false;
|
|
93
103
|
}
|
|
94
104
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
await
|
|
105
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Every stored credential forgotten — a browser sign-in's grant revoked (best effort), an api key's cached token
|
|
107
|
+
* dropped — then the config dir's credential files removed. An `ORA_API_KEY` in the environment is not stored, so
|
|
108
|
+
* it is not touched.
|
|
109
|
+
*/
|
|
110
|
+
export async function forgetStoredCredentials(deps) {
|
|
111
|
+
const apiUrl = resolveApiUrl(readConfig(deps.dir), undefined, SPEC.server, deps.env);
|
|
112
|
+
const rt = { apiUrl, dir: deps.dir, env: deps.env, fetchFn: deps.login.fetchFn, now: deps.login.now };
|
|
113
|
+
for (const credential of storedCredentials({ env: deps.env, dir: deps.dir }))
|
|
114
|
+
await credential.forget(rt);
|
|
115
|
+
clearCredentials(deps.dir);
|
|
106
116
|
}
|
|
107
117
|
export function attachLogout(program, deps) {
|
|
108
118
|
program
|
|
109
119
|
.command("logout")
|
|
110
|
-
.description("
|
|
120
|
+
.description("Sign out: revoke a browser sign-in, delete the stored credentials and cached token")
|
|
111
121
|
.addHelpText("after", "\nExamples:\n ora logout")
|
|
112
|
-
.action(() => {
|
|
113
|
-
|
|
122
|
+
.action(async () => {
|
|
123
|
+
await forgetStoredCredentials(deps);
|
|
114
124
|
deps.out("Logged out — credentials removed.");
|
|
115
125
|
});
|
|
116
126
|
}
|
|
117
127
|
export function attachWhoami(program, deps) {
|
|
118
128
|
program
|
|
119
129
|
.command("whoami")
|
|
120
|
-
.description("Verify the configured key against the API and print its identity")
|
|
121
|
-
.option("--json", "print the
|
|
130
|
+
.description("Verify the configured sign-in or api key against the API and print its identity")
|
|
131
|
+
.option("--json", "print the identity as JSON (an api key's token claims, a sign-in's verified identity)")
|
|
122
132
|
.option("--api-url <url>", "override the API base URL")
|
|
123
133
|
.addHelpText("after", "\nExamples:\n ora whoami\n ora whoami --json")
|
|
124
134
|
.action(async (opts) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-commands.js","sourceRoot":"","sources":["../src/auth-commands.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"auth-commands.js","sourceRoot":"","sources":["../src/auth-commands.ts"],"names":[],"mappings":"AAAA;;;;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;SACjB,WAAW,CAAC,iFAAiF,CAAC;SAC9F,MAAM,CAAC,QAAQ,EAAE,uFAAuF,CAAC;SACzG,MAAM,CAAC,iBAAiB,EAAE,2BAA2B,CAAC;SACtD,WAAW,CAAC,OAAO,EAAE,gDAAgD,CAAC;SACtE,MAAM,CAAC,KAAK,EAAE,IAAyC,EAAE,EAAE;QAC1D,MAAM,aAAa,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/core/auth.d.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* or a CI job's identity token. Either way the credential travels ONLY as
|
|
6
6
|
* "Authorization: Bearer <credential>" to POST /auth/token (the doc's own
|
|
7
7
|
* rule: never in the request body). The response {token, expiresIn} is cached
|
|
8
|
-
* on disk (0600) and reused
|
|
9
|
-
* die between "checked" and "used".
|
|
8
|
+
* on disk (0600) and reused while it is still fresh (token-expiry.ts: a skew
|
|
9
|
+
* before expiry), so a token can't die between "checked" and "used".
|
|
10
10
|
*
|
|
11
11
|
* The cache is keyed to (apiUrl, the sign-in's cache key) — pointing the CLI
|
|
12
12
|
* at staging or switching credentials can never replay a token minted
|
package/dist/core/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/core/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/core/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAMzD,qBAAa,SAAU,SAAQ,KAAK;IAGhC,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ONLY as
|
|
6
6
|
* "Authorization: Bearer <credential>" to POST /auth/token (the doc's own
|
|
7
7
|
* rule: never in the request body). The response {token, expiresIn} is cached
|
|
8
|
-
* on disk (0600) and reused
|
|
9
|
-
* die between "checked" and "used".
|
|
8
|
+
* on disk (0600) and reused while it is still fresh (token-expiry.ts: a skew
|
|
9
|
+
* before expiry), so a token can't die between "checked" and "used".
|
|
10
10
|
*
|
|
11
11
|
* The cache is keyed to (apiUrl, the sign-in's cache key) — pointing the CLI
|
|
12
12
|
* at staging or switching credentials can never replay a token minted
|
|
@@ -17,7 +17,8 @@ import { chmodSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:
|
|
|
17
17
|
import { join } from "node:path";
|
|
18
18
|
import { configDir } from "./config.js";
|
|
19
19
|
import { apiKeySignIn } from "./sign-in.js";
|
|
20
|
-
|
|
20
|
+
import { stillFresh } from "./token-expiry.js";
|
|
21
|
+
/** A token response that names no lifetime is taken to last this long: the platform's own token lifetime. */
|
|
21
22
|
const DEFAULT_EXPIRES_IN_S = 900;
|
|
22
23
|
export class AuthError extends Error {
|
|
23
24
|
status;
|
|
@@ -44,7 +45,7 @@ export class TokenExchangeAuth {
|
|
|
44
45
|
}
|
|
45
46
|
async getToken() {
|
|
46
47
|
const cached = this.readCache();
|
|
47
|
-
if (cached && cached.expiresAt
|
|
48
|
+
if (cached && stillFresh(cached.expiresAt, this.now()))
|
|
48
49
|
return cached.token;
|
|
49
50
|
return this.forceRefresh();
|
|
50
51
|
}
|
package/dist/core/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/core/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO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K,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC;YAC1F,OAAO,MAAqB,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAMD,qGAAqG;AACrG,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAC/C,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI,EAAkB;QAC7C,KAAK,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACnD,CAAC;CACF;AAED,kFAAkF;AAClF,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAA4B,CAAC;IACnG,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OperationMeta } from "../generated/operations.js";
|
|
2
|
+
type ArgumentsMeta = Pick<OperationMeta, "cliArguments">;
|
|
3
|
+
type MessageMeta = Pick<OperationMeta, "cliArguments" | "bodyFields"> & {
|
|
4
|
+
commandPath?: readonly string[];
|
|
5
|
+
};
|
|
6
|
+
export declare function argumentFlag(name: string): string;
|
|
7
|
+
export declare function argumentValues(meta: ArgumentsMeta, values: readonly unknown[], flags?: Readonly<Record<string, unknown>>): Record<string, string>;
|
|
8
|
+
export declare function combineBody(fileBody: unknown, given: Record<string, string>): {
|
|
9
|
+
ok: true;
|
|
10
|
+
body: unknown;
|
|
11
|
+
} | {
|
|
12
|
+
ok: false;
|
|
13
|
+
};
|
|
14
|
+
export declare function missingBodyMessage(meta: MessageMeta, fallback: string): string;
|
|
15
|
+
export declare function excessArgumentsMessage(meta: MessageMeta): string;
|
|
16
|
+
export declare function bodyOnCommandLine(meta: ArgumentsMeta, body: unknown): {
|
|
17
|
+
args: string[];
|
|
18
|
+
needsFile: boolean;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=cli-arguments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-arguments.d.ts","sourceRoot":"","sources":["../../src/core/cli-arguments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,KAAK,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AACzD,KAAK,WAAW,GAAG,IAAI,CAAC,aAAa,EAAE,cAAc,GAAG,YAAY,CAAC,GAAG;IAAE,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAE5G,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,SAAS,OAAO,EAAE,EAC1B,KAAK,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GAC5C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxB;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,CAIzH;AAYD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,W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