@owlmeans/cli-auth 0.1.18-rc.9 → 0.1.19-rc.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.
Files changed (50) hide show
  1. package/README.md +178 -1
  2. package/agent-meta/manifest.json +3 -3
  3. package/agent-meta/skills/cli-auth/SKILL.md +18 -16
  4. package/build/consts.local.d.ts +2 -0
  5. package/build/consts.local.d.ts.map +1 -0
  6. package/build/consts.local.js +6 -0
  7. package/build/consts.local.js.map +1 -0
  8. package/build/env-file/types.d.ts +45 -0
  9. package/build/env-file/types.d.ts.map +1 -0
  10. package/build/env-file/types.js +2 -0
  11. package/build/env-file/types.js.map +1 -0
  12. package/build/env-file.d.ts +4 -40
  13. package/build/env-file.d.ts.map +1 -1
  14. package/build/env-file.js +71 -99
  15. package/build/env-file.js.map +1 -1
  16. package/build/holder.d.ts +1 -36
  17. package/build/holder.d.ts.map +1 -1
  18. package/build/holder.js +19 -19
  19. package/build/holder.js.map +1 -1
  20. package/build/index.d.ts +3 -0
  21. package/build/index.d.ts.map +1 -1
  22. package/build/index.js.map +1 -1
  23. package/build/lock/types.d.ts +28 -0
  24. package/build/lock/types.d.ts.map +1 -0
  25. package/build/lock/types.js +2 -0
  26. package/build/lock/types.js.map +1 -0
  27. package/build/lock.d.ts +2 -37
  28. package/build/lock.d.ts.map +1 -1
  29. package/build/lock.js +35 -43
  30. package/build/lock.js.map +1 -1
  31. package/build/open-browser.d.ts.map +1 -1
  32. package/build/open-browser.js +1 -5
  33. package/build/open-browser.js.map +1 -1
  34. package/build/types.d.ts +57 -0
  35. package/build/types.d.ts.map +1 -0
  36. package/build/types.js +2 -0
  37. package/build/types.js.map +1 -0
  38. package/package.json +5 -5
  39. package/src/consts.local.ts +5 -0
  40. package/src/env-file/types.ts +45 -0
  41. package/src/env-file.ts +87 -110
  42. package/src/holder.ts +20 -62
  43. package/src/index.ts +3 -0
  44. package/src/lock/types.ts +29 -0
  45. package/src/lock.ts +33 -61
  46. package/src/open-browser.ts +1 -6
  47. package/src/types.ts +58 -0
  48. package/tests/env-file.spec.ts +18 -18
  49. package/tests/holder.spec.ts +4 -6
  50. package/tests/lock.spec.ts +22 -19
package/README.md CHANGED
@@ -1,3 +1,180 @@
1
+ # @owlmeans/cli-auth
2
+
3
+ Browser sign-in for a command-line tool or a stdio MCP server, over the OAuth 2.1 device
4
+ authorization grant. It provides a dotenv-style `~/.owlmeans` credentials file (overridable, the
5
+ environment always wins), atomic `0600` writes, a cross-process sign-in lock so several invocations
6
+ converge on one browser round trip, a best-effort browser opener, and `makeCliCredentials` — a small
7
+ credential holder a CLI wraps its API calls with. It is a generic public utility for Node/Bun: no
8
+ React, no DOM, no OwlMeans context. Its current consumer is the closed-source `@owlmeans/viable-mcp`
9
+ connector, built outside this repository. A browser app signs in through `@owlmeans/client-auth`
10
+ instead; the protocol calls themselves (discovery, device authorization, polling, revoke) live in
11
+ `@owlmeans/oauth`, and the server side is any API built on `@owlmeans/server-oauth`.
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ bun add @owlmeans/cli-auth@^0.1.19-rc.0
17
+ ```
18
+
19
+ ## Concepts
20
+
21
+ - **Credentials file** — `KEY=VALUE` lines at `OWLMEANS_CREDENTIALS`, else `~/.owlmeans`. One file
22
+ per deployment; files are never merged.
23
+ - **Precedence** — the process environment wins over the file, but an environment value that is the
24
+ empty string counts as unset.
25
+ - **Bound token** — a file token belongs to the API URL recorded under `apiUrlEnvKey`. A file naming
26
+ a different URL yields no token; a file naming none belongs to whatever URL is asked for.
27
+ - **Holder** — `makeCliCredentials(opts)` → `token()`, `require(waitMs?)`, `invalidate(rejected)`,
28
+ `signOut()`.
29
+ - **Single flight** — one device sign-in per API URL per process (module-level map), and across
30
+ processes a `<credentials file>.lock` that a second process joins instead of opening a second
31
+ browser tab. The lock is best-effort, not mutual exclusion.
32
+ - **Background sign-in** — when `require()` gives up waiting it throws `SignInRequired`; polling
33
+ continues and the next `require()` joins it.
34
+
35
+ ## Usage
36
+
37
+ ### Wrap API calls with the holder
38
+
39
+ ```typescript
40
+ import { makeCliCredentials } from '@owlmeans/cli-auth'
41
+
42
+ const credentials = makeCliCredentials({
43
+ apiUrl: 'https://api.example.com',
44
+ clientId: 'https://example.com/oauth/cli.json', // a static client id or a CIMD URL
45
+ tokenEnvKey: 'EXAMPLE_API_TOKEN',
46
+ apiUrlEnvKey: 'EXAMPLE_API_URL',
47
+ onNotify: message => process.stderr.write(`${message}\n`),
48
+ })
49
+
50
+ const token = await credentials.require() // starts or joins a device sign-in when needed
51
+
52
+ const res = await fetch(`${apiUrl}/projects`, { headers: { Authorization: `Bearer ${token}` } })
53
+ if (res.status === 401) {
54
+ await credentials.invalidate(token) // forget a file token; throw TokenRejected for an env token
55
+ }
56
+
57
+ await credentials.signOut() // revoke at the server (best effort) and clear the file token
58
+ ```
59
+
60
+ `require()` throws `SignInRequired` (from `@owlmeans/oauth`, carrying `url`, `code`, `expiresAt`)
61
+ when nobody approves within `waitMs` (default 20 s), `OAuthAccessDenied` when the person denies, and
62
+ `OAuthError` when the authorization expires or is aborted.
63
+
64
+ ### Present the token to OwlMeans routes
65
+
66
+ The holder's `token()` fits the thunk form of the `@owlmeans/auth-token` carrier guard, with
67
+ `invalidate` wired to the guard's `onRejected`.
68
+
69
+ ```typescript
70
+ import { DEFAULT_GUARD } from '@owlmeans/auth-common'
71
+ import { makeTokenCarrierGuard } from '@owlmeans/auth-token'
72
+
73
+ let current = ''
74
+ context.registerService(makeTokenCarrierGuard(DEFAULT_GUARD, {
75
+ token: async () => (current = await credentials.require()),
76
+ scheme: 'bearer',
77
+ onRejected: async () => { await credentials.invalidate(current) },
78
+ }))
79
+ ```
80
+
81
+ ### Read and write the credentials file directly
82
+
83
+ ```typescript
84
+ import { envFileHelper } from '@owlmeans/cli-auth'
85
+
86
+ const path = envFileHelper.resolveEnvFile()
87
+ const values = await envFileHelper.loadOwlmeansEnv() // file overlaid by non-empty env values
88
+
89
+ const { insecurePermissions } = await envFileHelper.setEnvValues(path, {
90
+ EXAMPLE_API_URL: 'https://api.example.com',
91
+ EXAMPLE_API_TOKEN: undefined, // undefined removes the key
92
+ })
93
+ if (insecurePermissions) {
94
+ console.warn(`${path} is readable by other users`)
95
+ }
96
+ ```
97
+
98
+ ### Open a browser
99
+
100
+ ```typescript
101
+ import { openBrowser } from '@owlmeans/cli-auth'
102
+
103
+ if (!openBrowser(verificationUri)) {
104
+ console.error(`Open ${verificationUri} in a browser`)
105
+ }
106
+ ```
107
+
108
+ ## API
109
+
110
+ ### Functions and helpers
111
+
112
+ | Symbol | Kind | Purpose |
113
+ |---|---|---|
114
+ | `makeCliCredentials(opts)` | function | the credential holder (`CliCredentials`) |
115
+ | `envFileHelper`, `createEnvFileHelper()` | helper | `resolveEnvFile`, `parseEnv`, `readCredentialsFile`, `loadOwlmeansEnv`, `setEnvValues` |
116
+ | `openBrowser(url, env?)` | function | detached `open` / `xdg-open` / `cmd /c start` with ignored stdio; `false` on any refusal |
117
+ | `lockPathFor(credentialsPath)` | function | `<credentialsPath>.lock` |
118
+ | `makeSignInLockHelper(path)` | function | `readLock`, `claimOrJoinLock(apiUrl, draft)`, `releaseLock(nonce)` |
119
+ | `loadOwlmeansEnv(env?)` | deprecated function | `compat:factory-refactor` wrapper — use `envFileHelper.loadOwlmeansEnv` |
120
+
121
+ ### `CliCredentialsOptions`
122
+
123
+ | Field | Purpose |
124
+ |---|---|
125
+ | `apiUrl` | the API origin; also the OAuth `resource` unless `resource` is set |
126
+ | `clientId` | the CLI's OAuth `client_id` — static, or a Client ID Metadata Document URL |
127
+ | `tokenEnvKey`, `apiUrlEnvKey` | key names for the token and its bound URL, in the file and the environment |
128
+ | `deviceName?` | defaults to `<hostname> · <user>` |
129
+ | `resource?`, `scope?` | OAuth request parameters |
130
+ | `env?` | defaults to `process.env` |
131
+ | `onNotify?` | progress messages ("Sign in at … with code …", "Signed in.") |
132
+
133
+ ### Constants
134
+
135
+ | Symbol | Value |
136
+ |---|---|
137
+ | `ENV_CREDENTIALS_FILE` | `'OWLMEANS_CREDENTIALS'` |
138
+ | `DEFAULT_CREDENTIALS_FILENAME` | `'.owlmeans'` |
139
+ | `DEFAULT_WAIT_MS` | `20_000` — `require()` wait before `SignInRequired` |
140
+ | `MAX_SIGN_IN_WAIT_MS` | 15 minutes — the poller's own ceiling |
141
+
142
+ ### Types
143
+
144
+ `CliCredentials`, `CliCredentialsOptions`, `SignInLockInfo`, `SignInLockDraft`, `SignInLockClaim`,
145
+ `SignInLockHelper`, `EnvFileHelper`, `SetEnvValuesResult`.
146
+
147
+ ## Browser suppression
148
+
149
+ `openBrowser` returns `false` without spawning when `OWLMEANS_NO_BROWSER=1` or `BROWSER=none`, on
150
+ Linux with neither `DISPLAY` nor `WAYLAND_DISPLAY`, and on an unknown platform. The printed
151
+ "Sign in at … with code …" line is the real interface; the browser is a convenience. Only the lock
152
+ owner opens a browser.
153
+
154
+ ## Common pitfalls
155
+
156
+ - Never read the token from argv or write it into a harness or config file; it lives in the
157
+ environment or the credentials file.
158
+ - An environment token that the server rejects is reported (`TokenRejected`), never silently
159
+ replaced by a new sign-in.
160
+ - A token stored for one API URL is not sent to another; point `OWLMEANS_CREDENTIALS` at a separate
161
+ file per deployment.
162
+ - Loose permissions on an existing file are reported, not tightened.
163
+ - In tests, point `OWLMEANS_CREDENTIALS` at a temp path, use a distinct `apiUrl` per test (the
164
+ in-flight map is module-level), and set `OWLMEANS_NO_BROWSER=1`.
165
+ - Any timer added around `require()` must be cleared; a pending timer keeps the process alive after
166
+ sign-in.
167
+
168
+ The `cli-auth` skill covers file precedence, the holder's single-flight rules, the lock and test
169
+ isolation; the `oauth` skill covers the device grant itself.
170
+
171
+ ## Related packages
172
+
173
+ - [`@owlmeans/oauth`](../oauth) — discovery, device authorization, polling, revoke and `SignInRequired`
174
+ - [`@owlmeans/server-oauth`](../server-oauth) — the authorization server a CLI signs in against
175
+ - [`@owlmeans/auth-token`](../auth-token) — the carrier guard that presents the resulting token
176
+ - [`@owlmeans/error`](../error) — `ResilientError`, the base of the thrown OAuth errors
177
+
1
178
  <!-- owlmeans:agent-guidance:start -->
2
179
  ## Agent guidance
3
180
 
@@ -6,7 +183,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
6
183
  your project's skill store (`.agents/skills/`):
7
184
 
8
185
  ```sh
9
- npx @owlmeans/agent-skills@^0.1.18-rc.38
186
+ npx @owlmeans/agent-skills@^0.1.19-rc.0
10
187
  ```
11
188
 
12
189
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
- "schemaVersion": 2,
2
+ "schemaVersion": 3,
3
3
  "package": "@owlmeans/cli-auth",
4
- "version": "0.1.18-rc.9",
5
- "generatedAt": "2026-09-23T19:57:40.713Z",
4
+ "version": "0.1.19-rc.0",
5
+ "generatedAt": "2026-10-31T12:13:02.412Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,22 +8,22 @@ user-invocable: false
8
8
  # @owlmeans/cli-auth
9
9
 
10
10
  **Layer:** Tooling (Node/Bun — no React, no DOM, no framework runtime)
11
- **Install:** `"@owlmeans/cli-auth": "^0.1.18-rc.9"` in `dependencies`
11
+ **Install:** `"@owlmeans/cli-auth": "^0.1.19-rc.0"` in `dependencies`
12
12
  **Contracts:** `@owlmeans/oauth` (discovery, device authorization, polling, revoke, `SignInRequired`)
13
- **Server half:** any API built on `@owlmeans/server-oauth`; **consumers:** `@owlmeans/viable-mcp`
13
+ **Server half:** any API built on `@owlmeans/server-oauth`; **consumers:** `@owlmeans/viable-mcp` (closed-source, built outside this repository)
14
14
 
15
15
  ## Key Exports
16
16
 
17
17
  | Export | Description |
18
18
  |--------|-------------|
19
19
  | `makeCliCredentials(opts)` | The holder: `token()` · `require(waitMs?)` · `invalidate(rejected)` · `signOut()` |
20
- | `resolveEnvFile(env?)` | `OWLMEANS_CREDENTIALS`, else `~/.owlmeans` |
21
- | `parseEnv(content)` | `KEY=value`, optional `export `, `#` comments, one level of quotes |
22
- | `readCredentialsFile(env?)` | The file's values alone — what a token is *bound* to |
23
- | `loadOwlmeansEnv(env?)` | File overlaid by the process environment (below) |
24
- | `setEnvValues(path, values)` | Replace named keys, keep every other line; atomic, `0600`; returns `{ insecurePermissions }` |
20
+ | `envFileHelper.resolveEnvFile(env?)` | `OWLMEANS_CREDENTIALS`, else `~/.owlmeans` |
21
+ | `envFileHelper.parseEnv(content)` | `KEY=value`, optional `export `, `#` comments, one level of quotes |
22
+ | `envFileHelper.readCredentialsFile(env?)` | The file's values alone — what a token is *bound* to |
23
+ | `envFileHelper.loadOwlmeansEnv(env?)` | File overlaid by the process environment (below) |
24
+ | `envFileHelper.setEnvValues(path, values)` | Replace named keys, keep every other line; atomic, `0600`; returns `{ insecurePermissions }` |
25
25
  | `openBrowser(url, env?)` | Best-effort detached opener; `false` on any refusal |
26
- | `claimOrJoinLock` · `readLock` · `releaseLock` · `lockPathFor` · `SignInLockInfo` | The sign-in lock |
26
+ | `makeSignInLockHelper(lockPathFor(file))` → `.claimOrJoinLock` · `.readLock` · `.releaseLock`; `SignInLockInfo` | The sign-in lock |
27
27
  | `ENV_CREDENTIALS_FILE` · `DEFAULT_CREDENTIALS_FILENAME` · `DEFAULT_WAIT_MS` (20 s) · `MAX_SIGN_IN_WAIT_MS` (15 min) | Constants |
28
28
 
29
29
  `CliCredentialsOptions`: `apiUrl`, `clientId` (a static client the server declared, or a CIMD URL),
@@ -36,7 +36,8 @@ names), `deviceName?` (defaults to `host · user`), `resource?` (defaults to `ap
36
36
  Dotenv-style `KEY=VALUE`, e.g. `VIABLE_API_URL=…` and `VIABLE_API_TOKEN=…`. Never merged with another
37
37
  file; a CLI that serves several deployments points `OWLMEANS_CREDENTIALS` at one file each.
38
38
 
39
- - **The environment wins over the file** (`loadOwlmeansEnv` → `{ ...file, ...envWithoutEmpty }`).
39
+ - **The environment wins over the file** (`envFileHelper.loadOwlmeansEnv` →
40
+ `{ ...file, ...envWithoutEmpty }`).
40
41
  - **An empty environment value counts as unset.** A harness config that expands an unset variable
41
42
  (`${VIABLE_API_TOKEN:-}`) produces `''`, which must not shadow the file — "I did not set it" and
42
43
  "set it to nothing" are not the same, and the file is the more deliberate of the two.
@@ -52,12 +53,12 @@ file; a CLI that serves several deployments points `OWLMEANS_CREDENTIALS` at one
52
53
 
53
54
  - **`token()`** — the environment value, else the bound file value, else `null`.
54
55
  - **`require(waitMs = DEFAULT_WAIT_MS)`** — returns a token, starting or joining ONE device sign-in
55
- per API URL: discover → `requestDeviceAuthorization` → claim/join the lock → `notify("Sign in at
56
- <url> with code <code>")` → open the browser (owner only) → `pollDeviceToken` → persist
57
- `{tokenEnvKey, apiUrlEnvKey}` → resolve. If `waitMs` runs out first it throws `signInRequired`
58
- (`url`, `code`, `expiresAt` from the lock) and **polling continues in the background**; the next
59
- `require()` joins it instead of starting over. `denied`/`expired`/`aborted` become
60
- `OAuthAccessDenied` / `OAuthError`.
56
+ per API URL: discover → `oauthClientHelper.requestDeviceAuthorization` → claim/join the lock →
57
+ `notify("Sign in at <url> with code <code>")` → open the browser (owner only) → `.pollDeviceToken`
58
+ → persist `{tokenEnvKey, apiUrlEnvKey}` → resolve. If `waitMs` runs out first it throws
59
+ `signInRequired` (`url`, `code`, `expiresAt` from the lock) and **polling continues in the
60
+ background**; the next `require()` joins it instead of starting over. `denied`/`expired`/`aborted`
61
+ become `OAuthAccessDenied` / `OAuthError`.
61
62
  - **The `waitMs` ceiling is a timer that is cleared** when the race is decided. A pending timer keeps
62
63
  a Node process alive, so an uncleared one made `viable-mcp login` (ceiling 15 minutes) hang after
63
64
  it had signed in. Any new timeout in this package clears its timer the same way.
@@ -74,7 +75,8 @@ file; a CLI that serves several deployments points `OWLMEANS_CREDENTIALS` at one
74
75
  (next `require()` signs in); an **environment** token is never silently replaced — it throws
75
76
  `TokenRejected(tokenEnvKey)` so the operator hears "VIABLE_API_TOKEN was refused" instead of the
76
77
  tool quietly becoming another identity.
77
- - **`signOut()`** — best-effort `revokeToken` at the server, then remove the file token.
78
+ - **`signOut()`** — best-effort `oauthClientHelper.revokeToken` at the server, then remove the file
79
+ token.
78
80
 
79
81
  ## Opening the browser
80
82
 
@@ -0,0 +1,2 @@
1
+ export declare const COMMAND_BY_PLATFORM: Record<string, string>;
2
+ //# sourceMappingURL=consts.local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.local.d.ts","sourceRoot":"","sources":["../src/consts.local.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAItD,CAAA"}
@@ -0,0 +1,6 @@
1
+ export const COMMAND_BY_PLATFORM = {
2
+ darwin: 'open',
3
+ win32: 'start',
4
+ linux: 'xdg-open',
5
+ };
6
+ //# sourceMappingURL=consts.local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../src/consts.local.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,UAAU;CAClB,CAAA"}
@@ -0,0 +1,45 @@
1
+ export interface SetEnvValuesResult {
2
+ /** The file is readable by somebody other than its owner — reported, never silently tightened. */
3
+ insecurePermissions: boolean;
4
+ }
5
+ /** The dotenv-style `~/.owlmeans` credentials file, with the process environment layered over it. */
6
+ export interface EnvFileHelper {
7
+ /**
8
+ * Where the credentials file lives: `OWLMEANS_CREDENTIALS`, or `~/.owlmeans`.
9
+ *
10
+ * A CLI that talks to more than one deployment (a staging environment, a self-hosted instance)
11
+ * points this at a different file per deployment — the file is never merged with another one, and
12
+ * a token it holds is meaningless anywhere but the API URL it was signed in against.
13
+ */
14
+ resolveEnvFile: (env?: NodeJS.ProcessEnv) => string;
15
+ /**
16
+ * Parse a dotenv-shaped body: `KEY=value`, an optional `export ` prefix, `#` comments, one level
17
+ * of quoting. Deliberately small — a dotenv library would add a dependency for a format this
18
+ * package itself writes, and this is the one shape it ever needs to read back.
19
+ */
20
+ parseEnv: (content: string) => Record<string, string>;
21
+ /** The credentials file's values alone, with no environment overlay — what a token is bound to. */
22
+ readCredentialsFile: (env?: NodeJS.ProcessEnv) => Promise<Record<string, string>>;
23
+ /**
24
+ * The file, with the process environment layered over it — environment wins, but an environment
25
+ * value that is the EMPTY STRING is treated as unset.
26
+ *
27
+ * The empty-string rule exists because a harness config commonly expands an unset shell variable
28
+ * to `''` (`${VIABLE_API_TOKEN:-}`), and a literal empty override must not shadow a real value the
29
+ * file holds — that would make "I have not set this" indistinguishable from "I am overriding this
30
+ * to nothing", and the file is always the more deliberate of the two.
31
+ */
32
+ loadOwlmeansEnv: (env?: NodeJS.ProcessEnv) => Promise<Record<string, string>>;
33
+ /**
34
+ * Replace the named keys in the credentials file, keeping every other line — comments, a key this
35
+ * call did not touch, blank lines — exactly where they were. An `undefined` value removes the key.
36
+ *
37
+ * Written atomically (a temp file in the same directory, then a rename) so a process killed
38
+ * mid-write never leaves a half-written credentials file behind, and created with mode `0600`
39
+ * because this file can hold a live access token. An existing file that is readable by anyone but
40
+ * its owner is reported back rather than silently tightened — permissions someone else set on
41
+ * purpose are theirs to change.
42
+ */
43
+ setEnvValues: (path: string, values: Record<string, string | undefined>) => Promise<SetEnvValuesResult>;
44
+ }
45
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/env-file/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,kGAAkG;IAClG,mBAAmB,EAAE,OAAO,CAAA;CAC7B;AAED,qGAAqG;AACrG,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,cAAc,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,KAAK,MAAM,CAAA;IACnD;;;;OAIG;IACH,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrD,mGAAmG;IACnG,mBAAmB,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACjF;;;;;;;;OAQG;IACH,eAAe,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC7E;;;;;;;;;OASG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAA;CACxG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/env-file/types.ts"],"names":[],"mappings":""}
@@ -1,42 +1,6 @@
1
- /**
2
- * Where the credentials file lives: `OWLMEANS_CREDENTIALS`, or `~/.owlmeans`.
3
- *
4
- * A CLI that talks to more than one deployment (a staging environment, a self-hosted instance)
5
- * points this at a different file per deployment — the file is never merged with another one, and
6
- * a token it holds is meaningless anywhere but the API URL it was signed in against.
7
- */
8
- export declare const resolveEnvFile: (env?: NodeJS.ProcessEnv) => string;
9
- /**
10
- * Parse a dotenv-shaped body: `KEY=value`, an optional `export ` prefix, `#` comments, one level
11
- * of quoting. Deliberately small — a dotenv library would add a dependency for a format this
12
- * package itself writes, and this is the one shape it ever needs to read back.
13
- */
14
- export declare const parseEnv: (content: string) => Record<string, string>;
15
- /**
16
- * The credentials file's values alone, with no environment overlay — what a token is bound to.
17
- */
18
- export declare const readCredentialsFile: (env?: NodeJS.ProcessEnv) => Promise<Record<string, string>>;
19
- /**
20
- * The file, with the process environment layered over it — environment wins, but an environment
21
- * value that is the EMPTY STRING is treated as unset.
22
- *
23
- * The empty-string rule exists because a harness config commonly expands an unset shell variable
24
- * to `''` (`${VIABLE_API_TOKEN:-}`), and a literal empty override must not shadow a real value the
25
- * file holds — that would make "I have not set this" indistinguishable from "I am overriding this
26
- * to nothing", and the file is always the more deliberate of the two.
27
- */
1
+ import type { EnvFileHelper } from './env-file/types.js';
2
+ export declare const createEnvFileHelper: () => EnvFileHelper;
3
+ export declare const envFileHelper: EnvFileHelper;
4
+ /** @deprecated compat:factory-refactor — use `envFileHelper.loadOwlmeansEnv(…)` */
28
5
  export declare const loadOwlmeansEnv: (env?: NodeJS.ProcessEnv) => Promise<Record<string, string>>;
29
- /**
30
- * Replace the named keys in the credentials file, keeping every other line — comments, a key this
31
- * call did not touch, blank lines — exactly where they were.
32
- *
33
- * Written atomically (a temp file in the same directory, then a rename) so a process killed
34
- * mid-write never leaves a half-written credentials file behind, and created with mode `0600`
35
- * because this file can hold a live access token. An existing file that is readable by anyone but
36
- * its owner is reported back rather than silently tightened — permissions someone else set on
37
- * purpose are theirs to change.
38
- */
39
- export declare const setEnvValues: (path: string, values: Record<string, string | undefined>) => Promise<{
40
- insecurePermissions: boolean;
41
- }>;
42
6
  //# sourceMappingURL=env-file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"env-file.d.ts","sourceRoot":"","sources":["../src/env-file.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,SAAS,MAAM,CAAC,UAAU,KAAiB,MAGnB,CAAA;AAEnD;;;;GAIG;AACH,eAAO,MAAM,QAAQ,YAAa,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAkB/D,CAAA;AAKD;;GAEG;AACH,eAAO,MAAM,mBAAmB,SAAe,MAAM,CAAC,UAAU,KAAiB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CACvD,CAAA;AAExD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,SAAe,MAAM,CAAC,UAAU,KAAiB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQ1G,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,SACjB,MAAM,UAAU,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KACvD,OAAO,CAAC;IAAE,mBAAmB,EAAE,OAAO,CAAA;CAAE,CAuC1C,CAAA"}
1
+ {"version":3,"file":"env-file.d.ts","sourceRoot":"","sources":["../src/env-file.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,qBAAqB,CAAA;AAE5E,eAAO,MAAM,mBAAmB,QAAO,aAsFtC,CAAA;AAED,eAAO,MAAM,aAAa,eAAwB,CAAA;AAElD,mFAAmF;AACnF,eAAO,MAAM,eAAe,SAAe,MAAM,CAAC,UAAU,KAAiB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CACjE,CAAA"}
package/build/env-file.js CHANGED
@@ -3,105 +3,77 @@ import { chmod, mkdir, readFile, rename, stat, writeFile } from 'node:fs/promise
3
3
  import { homedir } from 'node:os';
4
4
  import { dirname, join } from 'node:path';
5
5
  import { DEFAULT_CREDENTIALS_FILENAME, ENV_CREDENTIALS_FILE } from './consts.js';
6
- /**
7
- * Where the credentials file lives: `OWLMEANS_CREDENTIALS`, or `~/.owlmeans`.
8
- *
9
- * A CLI that talks to more than one deployment (a staging environment, a self-hosted instance)
10
- * points this at a different file per deployment — the file is never merged with another one, and
11
- * a token it holds is meaningless anywhere but the API URL it was signed in against.
12
- */
13
- export const resolveEnvFile = (env = process.env) => env[ENV_CREDENTIALS_FILE] != null && env[ENV_CREDENTIALS_FILE] !== ''
14
- ? env[ENV_CREDENTIALS_FILE]
15
- : join(homedir(), DEFAULT_CREDENTIALS_FILENAME);
16
- /**
17
- * Parse a dotenv-shaped body: `KEY=value`, an optional `export ` prefix, `#` comments, one level
18
- * of quoting. Deliberately small — a dotenv library would add a dependency for a format this
19
- * package itself writes, and this is the one shape it ever needs to read back.
20
- */
21
- export const parseEnv = (content) => {
22
- const values = {};
23
- for (const raw of content.split('\n')) {
24
- const line = raw.trim();
25
- if (line === '' || line.startsWith('#'))
26
- continue;
27
- const match = /^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(line);
28
- if (match == null)
29
- continue;
30
- let value = match[2].trim();
31
- if ((value.startsWith('"') && value.endsWith('"') && value.length > 1)
32
- || (value.startsWith("'") && value.endsWith("'") && value.length > 1)) {
33
- value = value.slice(1, -1);
6
+ export const createEnvFileHelper = () => {
7
+ const resolveEnvFile = (env = process.env) => env[ENV_CREDENTIALS_FILE] != null && env[ENV_CREDENTIALS_FILE] !== ''
8
+ ? env[ENV_CREDENTIALS_FILE]
9
+ : join(homedir(), DEFAULT_CREDENTIALS_FILENAME);
10
+ const parseEnv = (content) => {
11
+ const values = {};
12
+ for (const raw of content.split('\n')) {
13
+ const line = raw.trim();
14
+ if (line === '' || line.startsWith('#'))
15
+ continue;
16
+ const match = /^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(line);
17
+ if (match == null)
18
+ continue;
19
+ let value = match[2].trim();
20
+ if ((value.startsWith('"') && value.endsWith('"') && value.length > 1)
21
+ || (value.startsWith("'") && value.endsWith("'") && value.length > 1)) {
22
+ value = value.slice(1, -1);
23
+ }
24
+ values[match[1]] = value;
34
25
  }
35
- values[match[1]] = value;
36
- }
37
- return values;
38
- };
39
- const readFileIfPresent = async (path) => await readFile(path, 'utf-8').catch(() => '');
40
- /**
41
- * The credentials file's values alone, with no environment overlay — what a token is bound to.
42
- */
43
- export const readCredentialsFile = async (env = process.env) => parseEnv(await readFileIfPresent(resolveEnvFile(env)));
44
- /**
45
- * The file, with the process environment layered over it — environment wins, but an environment
46
- * value that is the EMPTY STRING is treated as unset.
47
- *
48
- * The empty-string rule exists because a harness config commonly expands an unset shell variable
49
- * to `''` (`${VIABLE_API_TOKEN:-}`), and a literal empty override must not shadow a real value the
50
- * file holds — that would make "I have not set this" indistinguishable from "I am overriding this
51
- * to nothing", and the file is always the more deliberate of the two.
52
- */
53
- export const loadOwlmeansEnv = async (env = process.env) => {
54
- const file = await readCredentialsFile(env);
55
- const fromEnv = {};
56
- Object.entries(env).forEach(([key, value]) => {
57
- if (value != null && value !== '')
58
- fromEnv[key] = value;
59
- });
60
- return { ...file, ...fromEnv };
61
- };
62
- /**
63
- * Replace the named keys in the credentials file, keeping every other line — comments, a key this
64
- * call did not touch, blank lines — exactly where they were.
65
- *
66
- * Written atomically (a temp file in the same directory, then a rename) so a process killed
67
- * mid-write never leaves a half-written credentials file behind, and created with mode `0600`
68
- * because this file can hold a live access token. An existing file that is readable by anyone but
69
- * its owner is reported back rather than silently tightened — permissions someone else set on
70
- * purpose are theirs to change.
71
- */
72
- export const setEnvValues = async (path, values) => {
73
- const existing = await readFileIfPresent(path);
74
- const lines = existing === '' ? [] : existing.split('\n');
75
- const claimed = new Set();
76
- const rewritten = lines.map(line => {
77
- const trimmed = line.trim();
78
- const match = /^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=/.exec(trimmed);
79
- if (match == null || !(match[1] in values))
80
- return line;
81
- claimed.add(match[1]);
82
- const value = values[match[1]];
83
- return value == null ? null : `${match[1]}=${value}`;
84
- }).filter((line) => line != null);
85
- Object.entries(values).forEach(([key, value]) => {
86
- if (claimed.has(key) || value == null)
87
- return;
88
- rewritten.push(`${key}=${value}`);
89
- });
90
- const body = `${rewritten.join('\n').replace(/\n+$/, '')}\n`;
91
- await mkdir(dirname(path), { recursive: true });
92
- const tmp = join(dirname(path), `.${DEFAULT_CREDENTIALS_FILENAME}.${randomBytes(6).toString('hex')}.tmp`);
93
- await writeFile(tmp, body, { mode: 0o600 });
94
- await rename(tmp, path);
95
- await chmod(path, 0o600).catch(() => undefined);
96
- let insecurePermissions = false;
97
- try {
98
- const info = await stat(path);
99
- insecurePermissions = (info.mode & 0o077) !== 0;
100
- }
101
- catch {
102
- // Nothing to report if the stat itself fails right after a successful write — unusual enough
103
- // that guessing at a permission problem would be noise.
104
- }
105
- return { insecurePermissions };
26
+ return values;
27
+ };
28
+ const readFileIfPresent = async (path) => await readFile(path, 'utf-8').catch(() => '');
29
+ const readCredentialsFile = async (env = process.env) => parseEnv(await readFileIfPresent(resolveEnvFile(env)));
30
+ const loadOwlmeansEnv = async (env = process.env) => {
31
+ const file = await readCredentialsFile(env);
32
+ const fromEnv = {};
33
+ Object.entries(env).forEach(([key, value]) => {
34
+ if (value != null && value !== '')
35
+ fromEnv[key] = value;
36
+ });
37
+ return { ...file, ...fromEnv };
38
+ };
39
+ const setEnvValues = async (path, values) => {
40
+ const existing = await readFileIfPresent(path);
41
+ const lines = existing === '' ? [] : existing.split('\n');
42
+ const claimed = new Set();
43
+ const rewritten = lines.map(line => {
44
+ const trimmed = line.trim();
45
+ const match = /^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=/.exec(trimmed);
46
+ if (match == null || !(match[1] in values))
47
+ return line;
48
+ claimed.add(match[1]);
49
+ const value = values[match[1]];
50
+ return value == null ? null : `${match[1]}=${value}`;
51
+ }).filter((line) => line != null);
52
+ Object.entries(values).forEach(([key, value]) => {
53
+ if (claimed.has(key) || value == null)
54
+ return;
55
+ rewritten.push(`${key}=${value}`);
56
+ });
57
+ const body = `${rewritten.join('\n').replace(/\n+$/, '')}\n`;
58
+ await mkdir(dirname(path), { recursive: true });
59
+ const tmp = join(dirname(path), `.${DEFAULT_CREDENTIALS_FILENAME}.${randomBytes(6).toString('hex')}.tmp`);
60
+ await writeFile(tmp, body, { mode: 0o600 });
61
+ await rename(tmp, path);
62
+ await chmod(path, 0o600).catch(() => undefined);
63
+ let insecurePermissions = false;
64
+ try {
65
+ const info = await stat(path);
66
+ insecurePermissions = (info.mode & 0o077) !== 0;
67
+ }
68
+ catch {
69
+ // Nothing to report if the stat itself fails right after a successful write — unusual enough
70
+ // that guessing at a permission problem would be noise.
71
+ }
72
+ return { insecurePermissions };
73
+ };
74
+ return { resolveEnvFile, parseEnv, readCredentialsFile, loadOwlmeansEnv, setEnvValues };
106
75
  };
76
+ export const envFileHelper = createEnvFileHelper();
77
+ /** @deprecated compat:factory-refactor — use `envFileHelper.loadOwlmeansEnv(…)` */
78
+ export const loadOwlmeansEnv = async (env = process.env) => await envFileHelper.loadOwlmeansEnv(env);
107
79
  //# sourceMappingURL=env-file.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"env-file.js","sourceRoot":"","sources":["../src/env-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAClF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG,EAAU,EAAE,CAC7E,GAAG,CAAC,oBAAoB,CAAC,IAAI,IAAI,IAAI,GAAG,CAAC,oBAAoB,CAAC,KAAK,EAAE;IACnE,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAC3B,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,4BAA4B,CAAC,CAAA;AAEnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAe,EAA0B,EAAE;IAClE,MAAM,MAAM,GAA2B,EAAE,CAAA;IACzC,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,GAAG,CAAC,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