@owlmeans/cli-auth 0.1.18-rc.15 → 0.1.18-rc.17
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/README.md +178 -1
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/cli-auth/SKILL.md +18 -16
- package/build/env-file/types.d.ts +45 -0
- package/build/env-file/types.d.ts.map +1 -0
- package/build/env-file/types.js +2 -0
- package/build/env-file/types.js.map +1 -0
- package/build/env-file.d.ts +4 -40
- package/build/env-file.d.ts.map +1 -1
- package/build/env-file.js +71 -99
- package/build/env-file.js.map +1 -1
- package/build/holder.js +19 -19
- package/build/holder.js.map +1 -1
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js.map +1 -1
- package/build/lock/types.d.ts +28 -0
- package/build/lock/types.d.ts.map +1 -0
- package/build/lock/types.js +2 -0
- package/build/lock/types.js.map +1 -0
- package/build/lock.d.ts +2 -18
- package/build/lock.d.ts.map +1 -1
- package/build/lock.js +35 -43
- package/build/lock.js.map +1 -1
- package/package.json +3 -3
- package/src/env-file/types.ts +45 -0
- package/src/env-file.ts +87 -110
- package/src/holder.ts +19 -19
- package/src/index.ts +2 -0
- package/src/lock/types.ts +29 -0
- package/src/lock.ts +32 -40
- package/tests/env-file.spec.ts +18 -18
- package/tests/holder.spec.ts +4 -6
- 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.18-rc.17
|
|
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.
|
|
186
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.52
|
|
10
187
|
```
|
|
11
188
|
|
|
12
189
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/cli-auth",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-10-
|
|
4
|
+
"version": "0.1.18-rc.17",
|
|
5
|
+
"generatedAt": "2026-10-08T21:27:54.324Z",
|
|
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.
|
|
11
|
+
**Install:** `"@owlmeans/cli-auth": "^0.1.18-rc.17"` 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` ·
|
|
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` →
|
|
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 →
|
|
56
|
-
<url> with code <code>")` → open the browser (owner only) →
|
|
57
|
-
`{tokenEnvKey, apiUrlEnvKey}` → resolve. If `waitMs` runs out first it throws
|
|
58
|
-
(`url`, `code`, `expiresAt` from the lock) and **polling continues in the
|
|
59
|
-
`require()` joins it instead of starting over. `denied`/`expired`/`aborted`
|
|
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
|
|
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,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 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/env-file/types.ts"],"names":[],"mappings":""}
|
package/build/env-file.d.ts
CHANGED
|
@@ -1,42 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
package/build/env-file.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-file.d.ts","sourceRoot":"","sources":["../src/env-file.ts"],"names":[],"mappings":"
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
package/build/env-file.js.map
CHANGED
|
@@ -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;AAC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