@levr-one/auth 1.1.7 → 1.1.9

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.
@@ -21,6 +21,7 @@ beforeEach(async () => {
21
21
  ConfigWatcher = watcherMod.ConfigWatcher;
22
22
  });
23
23
  afterEach(() => {
24
+ vi.restoreAllMocks();
24
25
  fs.rmSync(state.tmpDir, { recursive: true, force: true });
25
26
  });
26
27
  describe('ConfigWatcher', () => {
@@ -39,6 +40,9 @@ describe('ConfigWatcher', () => {
39
40
  watcher.stop();
40
41
  });
41
42
  it('notifies when config changes via forceCheck', () => {
43
+ // Outside any checkout, so `local` keeps the written URLs instead of
44
+ // resolving to whichever checkout the suite runs in (internal).
45
+ vi.spyOn(process, 'cwd').mockReturnValue(state.tmpDir);
42
46
  withNonTestEnv(() => {
43
47
  writeConfig(PRESETS.staging);
44
48
  const watcher = new ConfigWatcher();
@@ -1 +1 @@
1
- {"version":3,"file":"config-watcher.test.js","sourceRoot":"","sources":["../src/config-watcher.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,MAAM,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AAEjD,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;IACrC,MAAM,QAAQ,GAAG,MAAM,cAAc,EAAuB,CAAC;IAC7D,OAAO,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM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,CAAC,gBAAgB,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YACvB,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC9B,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAC/B,OAAO,CAAC,KAAK,EAAE,CAAC;YAEhB,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC3B,OAAO,CAAC,UAAU,EAAE,CAAC;YAErB,MAAM,CAAC,KAAK,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;YACvC,MAAM,CAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;YACxC,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/dist/config.d.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  * skipped so that tests stay deterministic and never depend on the
9
9
  * developer's local config file.
10
10
  */
11
+ export { extractEnvValue, parseDevTls, parseLocalBackenderOrigin, resolveOriginFromEnvFiles, } from './local-env.js';
11
12
  export interface TqConfig {
12
13
  environment: 'local' | 'staging' | 'production' | 'custom';
13
14
  apiUrl: string;
@@ -15,84 +16,6 @@ export interface TqConfig {
15
16
  clientUrl: string;
16
17
  oauthClientId: string;
17
18
  }
18
- /**
19
- * `parseDevTls` reproduces three dotenv behaviours the obvious regex gets
20
- * wrong. Each failed CLOSED — it missed a real `DEV_TLS=true` and so dialled
21
- * http:// at a TLS backender, the exact bug this file exists to fix, mirrored:
22
- * - `export DEV_TLS=true` — the form docs/guides/dev-tls-setup.md prints
23
- * - `DEV_TLS=true # note` — trailing comment on an unquoted value
24
- * - the key repeated — dotenv takes the LAST occurrence, not the first
25
- *
26
- * dotenv itself is not used: `packages/auth` does not depend on it, and this
27
- * helper is duplicated verbatim between the two files (see the note above).
28
- */
29
- export declare function parseDevTls(contents: string): boolean | undefined;
30
- /**
31
- * Accept an env value ONLY if it is a bare `http(s)` origin — scheme, host,
32
- * optional port, and nothing else. Returns the normalised origin, or
33
- * `undefined` for anything that is not one.
34
- *
35
- * This exists because `API_BASE_URL` does not mean the same thing in every
36
- * env file. In a worktree's `apps/backender/.env` it is that backender's own
37
- * origin (`http://localhost:8580`) — the value `tq:env local` wants. In the
38
- * main checkout under DEV_TLS it is `https://ai.levr.test:3020/api`, the URL
39
- * the BROWSER should call: the client SPA's `/api` proxy. Accepting the
40
- * second overwrote a correctly-computed `LOCAL_HTTPS` preset with a value
41
- * that was wrong twice over — wrong host role, and a client dev-server port
42
- * that is usually not listening — so every stdio MCP server dialled a dead
43
- * host and reported an opaque `fetch failed`.
44
- *
45
- * The path is the discriminator **for the local checkout specifically** — the
46
- * name says `Local` for that reason. It is NOT a universal truth that a
47
- * backend base URL has no path: this repo's own deploys set
48
- * `API_BASE_URL=https://ai.levr.now/api` (`apps/backender/chart/stage.yaml:35`)
49
- * and `https://ai.levr.one/api` (`chart/prod.yaml:74`), and `setup-mcp.ts`
50
- * deliberately accepts that shape because the levr MCP endpoint IS reached
51
- * through the SPA proxy. Do not reuse this helper where deployed values are
52
- * in scope — it would reject a valid production URL. internal.
53
- *
54
- * It fails SAFE — anything ambiguous declines to override the preset instead
55
- * of silently replacing it. Do NOT weaken this back to a `^https?://` prefix
56
- * test; that is precisely the check the proxy URL passed.
57
- *
58
- * Kept here rather than in `cli.ts` because that module is a self-executing
59
- * CLI (importing it runs the command switch), so a pure helper there cannot
60
- * be unit-tested — the same reason `parseDevTls` lives in this file.
61
- *
62
- * internal.
63
- */
64
- export declare function parseLocalBackenderOrigin(raw: string | undefined): string | undefined;
65
- /**
66
- * Read one key out of dotenv file contents, reproducing the behaviours
67
- * `parseDevTls` documents twenty lines above: an `export ` prefix, a trailing
68
- * `#` comment on an unquoted value, and the LAST assignment winning when the
69
- * key repeats. Quotes are stripped only when they PAIR, so an unbalanced
70
- * quote is left intact rather than half-removed.
71
- *
72
- * The first cut of this reader hand-rolled a narrower regex and inherited
73
- * none of that, even though the repo had already been bitten by the `export `
74
- * form on this very key — see `scripts/worktree-delete.test.ts:319`.
75
- * internal / internal.
76
- *
77
- * `key` is always a literal from the call sites, never user input, so
78
- * interpolating it into the pattern is safe.
79
- */
80
- export declare function extractEnvValue(contents: string, key: string): string | undefined;
81
- /**
82
- * Resolve a backender origin across the env files in precedence order, given
83
- * their CONTENTS (`undefined` for a file that does not exist). Pure, so the
84
- * precedence rule is unit-testable — the file I/O stays in `cli.ts`.
85
- *
86
- * **The first file that CONTAINS the key decides, even if its value is
87
- * unusable.** That matches dotenv and `devTlsFromBackenderEnv`, which both
88
- * fall through only on an ABSENT key. The first cut fell through on absent
89
- * OR unusable, which let `.env.worktree` and `.env` disagree: the backender
90
- * would use the higher-precedence value while the CLI silently resolved the
91
- * lower one. Two answers for one key is exactly what reading these files in
92
- * a shared order exists to prevent. Falling back to the preset is the safe
93
- * direction; falling back to a different file is not. internal.
94
- */
95
- export declare function resolveOriginFromEnvFiles(key: string, files: readonly (string | undefined)[]): string | undefined;
96
19
  /**
97
20
  * Environment presets. Staging is the default.
98
21
  *
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AA2CD;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAiBjE;AA2BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,yBAAyB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G,YAAY,EAAE,QAAQ,CAqBxE,CAAC;AAeF;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAqBvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,IAAI,QAAQ,CAyErC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAclD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
package/dist/config.js CHANGED
@@ -11,253 +11,10 @@
11
11
  import * as fs from 'fs';
12
12
  import * as path from 'path';
13
13
  import { getTqDir, loadTokens } from './token-store.js';
14
- /**
15
- * Returns true when running inside a test runner (Vitest, Jest, etc.).
16
- */
17
- function isTestEnv() {
18
- return (process.env.VITEST !== undefined ||
19
- process.env.NODE_ENV === 'test' ||
20
- process.env.JEST_WORKER_ID !== undefined);
21
- }
22
- /**
23
- * Detect whether the developer is running in TLS dev mode (mkcert + DEV_TLS).
24
- *
25
- * Resolution order:
26
- * 1. Tests (Vitest/Jest/NODE_ENV=test) → always false (deterministic).
27
- * 2. Explicit `DEV_TLS` env var → 'true'/'false' wins.
28
- * 3. `DEV_TLS` in the backender's env → the setting that actually decides
29
- * whether the backender serves TLS.
30
- *
31
- * Step 3 used to probe for `apps/backender/certs/dev.crt` and treat its
32
- * PRESENCE as "TLS is on". That tested a proxy for the real question: the cert
33
- * is written once by scripts/dev-setup-tls.sh and never removed when TLS is
34
- * turned off, so any machine that had ever run it resolved TLS mode forever.
35
- *
36
- * The walk-up from cwd is retained, so this still works from the repo root, an
37
- * app subdirectory, or a worktree.
38
- *
39
- * Keep in sync with `apps/sync-server/src/auth.ts:isLocalTlsMode()` — the two
40
- * are duplicated verbatim (sync-server does not depend on this package). The
41
- * bodies are kept byte-identical so a plain `diff` verifies the claim; that is
42
- * also why the quote check below is split across lines, since this package
43
- * formats at printWidth 80 and sync-server at 100.
44
- */
45
- function isLocalTlsMode() {
46
- if (isTestEnv())
47
- return false;
48
- if (process.env.DEV_TLS === 'true')
49
- return true;
50
- if (process.env.DEV_TLS === 'false')
51
- return false;
52
- return devTlsFromBackenderEnv();
53
- }
54
- /**
55
- * `parseDevTls` reproduces three dotenv behaviours the obvious regex gets
56
- * wrong. Each failed CLOSED — it missed a real `DEV_TLS=true` and so dialled
57
- * http:// at a TLS backender, the exact bug this file exists to fix, mirrored:
58
- * - `export DEV_TLS=true` — the form docs/guides/dev-tls-setup.md prints
59
- * - `DEV_TLS=true # note` — trailing comment on an unquoted value
60
- * - the key repeated — dotenv takes the LAST occurrence, not the first
61
- *
62
- * dotenv itself is not used: `packages/auth` does not depend on it, and this
63
- * helper is duplicated verbatim between the two files (see the note above).
64
- */
65
- export function parseDevTls(contents) {
66
- // Global: the LAST assignment wins, matching dotenv.
67
- const re = /^[ \t]*(?:export[ \t]+)?DEV_TLS[ \t]*=[ \t]*(.*)$/gm;
68
- let raw;
69
- for (const m of contents.matchAll(re))
70
- raw = m[1];
71
- if (raw === undefined)
72
- return undefined;
73
- let value = raw.trim();
74
- const quote = value[0];
75
- const isQuote = quote === '"' || quote === "'";
76
- if (isQuote && value.length > 1 && value.endsWith(quote)) {
77
- value = value.slice(1, -1);
78
- }
79
- else {
80
- // Unquoted only: everything from `#` onward is a comment.
81
- value = (value.split('#')[0] ?? '').trim();
82
- }
83
- return value === 'true';
84
- }
85
- function devTlsFromBackenderEnv() {
86
- let dir = process.cwd();
87
- for (let i = 0; i < 10; i++) {
88
- // `.env.worktree` FIRST — it outranks `.env` for the backender, because
89
- // apps/backender/src/env.ts loads it first and dotenv does not overwrite
90
- // an already-set key. Reading only `.env` resolves the wrong protocol in a
91
- // worktree that overrides DEV_TLS.
92
- for (const name of ['.env.worktree', '.env']) {
93
- const envPath = path.join(dir, 'apps/backender', name);
94
- if (!fs.existsSync(envPath))
95
- continue;
96
- try {
97
- const parsed = parseDevTls(fs.readFileSync(envPath, 'utf8'));
98
- if (parsed !== undefined)
99
- return parsed;
100
- }
101
- catch {
102
- // Unreadable env file must not silently select TLS — fail safe.
103
- return false;
104
- }
105
- }
106
- const parent = path.dirname(dir);
107
- if (parent === dir)
108
- break;
109
- dir = parent;
110
- }
111
- return false;
112
- }
113
- /**
114
- * Accept an env value ONLY if it is a bare `http(s)` origin — scheme, host,
115
- * optional port, and nothing else. Returns the normalised origin, or
116
- * `undefined` for anything that is not one.
117
- *
118
- * This exists because `API_BASE_URL` does not mean the same thing in every
119
- * env file. In a worktree's `apps/backender/.env` it is that backender's own
120
- * origin (`http://localhost:8580`) — the value `tq:env local` wants. In the
121
- * main checkout under DEV_TLS it is `https://ai.levr.test:3020/api`, the URL
122
- * the BROWSER should call: the client SPA's `/api` proxy. Accepting the
123
- * second overwrote a correctly-computed `LOCAL_HTTPS` preset with a value
124
- * that was wrong twice over — wrong host role, and a client dev-server port
125
- * that is usually not listening — so every stdio MCP server dialled a dead
126
- * host and reported an opaque `fetch failed`.
127
- *
128
- * The path is the discriminator **for the local checkout specifically** — the
129
- * name says `Local` for that reason. It is NOT a universal truth that a
130
- * backend base URL has no path: this repo's own deploys set
131
- * `API_BASE_URL=https://ai.levr.now/api` (`apps/backender/chart/stage.yaml:35`)
132
- * and `https://ai.levr.one/api` (`chart/prod.yaml:74`), and `setup-mcp.ts`
133
- * deliberately accepts that shape because the levr MCP endpoint IS reached
134
- * through the SPA proxy. Do not reuse this helper where deployed values are
135
- * in scope — it would reject a valid production URL. internal.
136
- *
137
- * It fails SAFE — anything ambiguous declines to override the preset instead
138
- * of silently replacing it. Do NOT weaken this back to a `^https?://` prefix
139
- * test; that is precisely the check the proxy URL passed.
140
- *
141
- * Kept here rather than in `cli.ts` because that module is a self-executing
142
- * CLI (importing it runs the command switch), so a pure helper there cannot
143
- * be unit-tested — the same reason `parseDevTls` lives in this file.
144
- *
145
- * internal.
146
- */
147
- export function parseLocalBackenderOrigin(raw) {
148
- if (raw === undefined)
149
- return undefined;
150
- const trimmed = raw.trim().replace(/\/+$/, '');
151
- if (!trimmed)
152
- return undefined;
153
- // Reject on the RAW text, BEFORE parsing. WHATWG normalises during parse:
154
- // `/foo/..` collapses to `/`, and a bare trailing `?` or `#` reports an
155
- // EMPTY `search`/`hash`. A guard that reads only the parsed URL therefore
156
- // cannot see the two shapes it most needs to reject — which is precisely
157
- // the bug the first cut of this function shipped (internal): it validated
158
- // `parsed` and then returned the raw string.
159
- if (/[?#]/.test(trimmed))
160
- return undefined;
161
- const afterScheme = trimmed.replace(/^https?:\/\//i, '');
162
- if (afterScheme.includes('/'))
163
- return undefined;
164
- let parsed;
165
- try {
166
- parsed = new URL(trimmed);
167
- }
168
- catch {
169
- return undefined;
170
- }
171
- if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
172
- return undefined;
173
- }
174
- // Credentials never belong in a backend base URL, and silently stripping
175
- // them would write a different URL than the author wrote.
176
- if (parsed.username || parsed.password)
177
- return undefined;
178
- // Return the PARSED origin, never the raw text — that pairing is what makes
179
- // the guards above load-bearing rather than decorative.
180
- return parsed.origin;
181
- }
182
- /**
183
- * Read one key out of dotenv file contents, reproducing the behaviours
184
- * `parseDevTls` documents twenty lines above: an `export ` prefix, a trailing
185
- * `#` comment on an unquoted value, and the LAST assignment winning when the
186
- * key repeats. Quotes are stripped only when they PAIR, so an unbalanced
187
- * quote is left intact rather than half-removed.
188
- *
189
- * The first cut of this reader hand-rolled a narrower regex and inherited
190
- * none of that, even though the repo had already been bitten by the `export `
191
- * form on this very key — see `scripts/worktree-delete.test.ts:319`.
192
- * internal / internal.
193
- *
194
- * `key` is always a literal from the call sites, never user input, so
195
- * interpolating it into the pattern is safe.
196
- */
197
- export function extractEnvValue(contents, key) {
198
- const re = new RegExp(`^[ \\t]*(?:export[ \\t]+)?${key}[ \\t]*=[ \\t]*(.*)$`, 'gm');
199
- let raw;
200
- for (const m of contents.matchAll(re))
201
- raw = m[1];
202
- if (raw === undefined)
203
- return undefined;
204
- let value = raw.trim();
205
- const quote = value[0];
206
- const isQuote = quote === '"' || quote === "'";
207
- if (isQuote && value.length > 1 && value.endsWith(quote)) {
208
- value = value.slice(1, -1);
209
- }
210
- else {
211
- value = (value.split('#')[0] ?? '').trim();
212
- }
213
- return value;
214
- }
215
- /**
216
- * Resolve a backender origin across the env files in precedence order, given
217
- * their CONTENTS (`undefined` for a file that does not exist). Pure, so the
218
- * precedence rule is unit-testable — the file I/O stays in `cli.ts`.
219
- *
220
- * **The first file that CONTAINS the key decides, even if its value is
221
- * unusable.** That matches dotenv and `devTlsFromBackenderEnv`, which both
222
- * fall through only on an ABSENT key. The first cut fell through on absent
223
- * OR unusable, which let `.env.worktree` and `.env` disagree: the backender
224
- * would use the higher-precedence value while the CLI silently resolved the
225
- * lower one. Two answers for one key is exactly what reading these files in
226
- * a shared order exists to prevent. Falling back to the preset is the safe
227
- * direction; falling back to a different file is not. internal.
228
- */
229
- export function resolveOriginFromEnvFiles(key, files) {
230
- for (const contents of files) {
231
- if (contents === undefined)
232
- continue;
233
- const raw = extractEnvValue(contents, key);
234
- if (raw === undefined)
235
- continue;
236
- return parseLocalBackenderOrigin(raw);
237
- }
238
- return undefined;
239
- }
240
- const LOCAL_HTTP = {
241
- environment: 'local',
242
- apiUrl: 'http://localhost:8080',
243
- authUrl: 'http://localhost:3021',
244
- clientUrl: 'http://localhost:3020',
245
- oauthClientId: '2',
246
- };
247
- const LOCAL_HTTPS = {
248
- environment: 'local',
249
- // internal D14: TLS dev mode mirrors the prod parent-domain topology
250
- // (`*.levr.test` is the dev counterpart of `*.levr.now` / `*.levr.one`).
251
- // The mkcert cert generated by scripts/dev-setup-tls.sh covers these
252
- // hostnames, /etc/hosts entries are written by the same script, and the
253
- // SPA's `runtime-config.ts` falls back to the same triple. Keeping the
254
- // names consistent end-to-end means cookies set with `Domain=.levr.test`
255
- // travel to all three subdomains the same way they do in prod.
256
- apiUrl: 'https://api.levr.test:8080',
257
- authUrl: 'https://auth.levr.test:3021',
258
- clientUrl: 'https://ai.levr.test:3020',
259
- oauthClientId: '2',
260
- };
14
+ import { isLocalTlsMode, isTestEnv, LOCAL_HTTP, LOCAL_HTTPS, resolveLocalCheckout, } from './local-env.js';
15
+ // Moved to `local-env.ts` (internal); re-exported so the public surface and
16
+ // every existing import keep working.
17
+ export { extractEnvValue, parseDevTls, parseLocalBackenderOrigin, resolveOriginFromEnvFiles, } from './local-env.js';
261
18
  /**
262
19
  * Environment presets. Staging is the default.
263
20
  *
@@ -366,6 +123,16 @@ export function loadConfig() {
366
123
  clientUrl: raw.clientUrl ?? PRESETS.staging.clientUrl,
367
124
  oauthClientId: raw.oauthClientId ?? '2',
368
125
  };
126
+ // `local` is "this checkout's backend", not the URL whichever
127
+ // checkout last ran `tq:env local` stored (internal).
128
+ if (config.environment === 'local') {
129
+ const local = resolveLocalCheckout();
130
+ if (local) {
131
+ config.apiUrl = local.apiUrl;
132
+ config.authUrl = local.authUrl;
133
+ config.clientUrl = local.clientUrl;
134
+ }
135
+ }
369
136
  // Apply TQ_OAUTH_CLIENT_ID override
370
137
  if (process.env.TQ_OAUTH_CLIENT_ID) {
371
138
  config.oauthClientId = process.env.TQ_OAUTH_CLIENT_ID;
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAUxD;;GAEG;AACH,SAAS,SAAS;IAChB,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS;QAChC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM;QAC/B,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,SAAS,CACzC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAS,cAAc;IACrB,IAAI,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;IACxD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAAgB;IAC1C,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAC;IACvC,MAAM,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IAErC,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE;QACjE,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;IACH,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,aAAa,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Local-checkout environment resolution: which backend, auth-web and client a
3
+ * checkout of this monorepo serves, read from its own `apps/backender` env.
4
+ *
5
+ * A LEAF module on purpose: it imports nothing else from this package (the
6
+ * `TqConfig` import is type-only and erased), so both `config.ts` and
7
+ * `token-store.ts` can use it without the import cycle `token-store.ts` exists
8
+ * to avoid (`config.ts` imports `token-store.ts`). internal moved these
9
+ * helpers here from `config.ts`, which still re-exports the public ones.
10
+ */
11
+ import type { TqConfig } from './config.js';
12
+ /**
13
+ * Returns true when running inside a test runner (Vitest, Jest, etc.).
14
+ */
15
+ export declare function isTestEnv(): boolean;
16
+ /**
17
+ * Detect whether the developer is running in TLS dev mode (mkcert + DEV_TLS).
18
+ *
19
+ * Resolution order:
20
+ * 1. Tests (Vitest/Jest/NODE_ENV=test) → always false (deterministic).
21
+ * 2. Explicit `DEV_TLS` env var → 'true'/'false' wins.
22
+ * 3. `DEV_TLS` in the backender's env → the setting that actually decides
23
+ * whether the backender serves TLS.
24
+ *
25
+ * Step 3 used to probe for `apps/backender/certs/dev.crt` and treat its
26
+ * PRESENCE as "TLS is on". That tested a proxy for the real question: the cert
27
+ * is written once by scripts/dev-setup-tls.sh and never removed when TLS is
28
+ * turned off, so any machine that had ever run it resolved TLS mode forever.
29
+ *
30
+ * The walk-up from cwd is retained, so this still works from the repo root, an
31
+ * app subdirectory, or a worktree.
32
+ *
33
+ * Keep in sync with `apps/sync-server/src/auth.ts:isLocalTlsMode()` — the two
34
+ * are duplicated verbatim (sync-server does not depend on this package). The
35
+ * bodies are kept byte-identical so a plain `diff` verifies the claim; that is
36
+ * also why the quote check below is split across lines, since this package
37
+ * formats at printWidth 80 and sync-server at 100.
38
+ */
39
+ export declare function isLocalTlsMode(): boolean;
40
+ /**
41
+ * `parseDevTls` reproduces three dotenv behaviours the obvious regex gets
42
+ * wrong. Each failed CLOSED — it missed a real `DEV_TLS=true` and so dialled
43
+ * http:// at a TLS backender, the exact bug this file exists to fix, mirrored:
44
+ * - `export DEV_TLS=true` — the form docs/guides/dev-tls-setup.md prints
45
+ * - `DEV_TLS=true # note` — trailing comment on an unquoted value
46
+ * - the key repeated — dotenv takes the LAST occurrence, not the first
47
+ *
48
+ * dotenv itself is not used: `packages/auth` does not depend on it, and this
49
+ * helper is duplicated verbatim between the two files (see the note above).
50
+ */
51
+ export declare function parseDevTls(contents: string): boolean | undefined;
52
+ /**
53
+ * Accept an env value ONLY if it is a bare `http(s)` origin — scheme, host,
54
+ * optional port, and nothing else. Returns the normalised origin, or
55
+ * `undefined` for anything that is not one.
56
+ *
57
+ * This exists because `API_BASE_URL` does not mean the same thing in every
58
+ * env file. In a worktree's `apps/backender/.env` it is that backender's own
59
+ * origin (`http://localhost:8580`) — the value `tq:env local` wants. In the
60
+ * main checkout under DEV_TLS it is `https://ai.levr.test:3020/api`, the URL
61
+ * the BROWSER should call: the client SPA's `/api` proxy. Accepting the
62
+ * second overwrote a correctly-computed `LOCAL_HTTPS` preset with a value
63
+ * that was wrong twice over — wrong host role, and a client dev-server port
64
+ * that is usually not listening — so every stdio MCP server dialled a dead
65
+ * host and reported an opaque `fetch failed`.
66
+ *
67
+ * The path is the discriminator **for the local checkout specifically** — the
68
+ * name says `Local` for that reason. It is NOT a universal truth that a
69
+ * backend base URL has no path: this repo's own deploys set
70
+ * `API_BASE_URL=https://ai.levr.now/api` (`apps/backender/chart/stage.yaml:35`)
71
+ * and `https://ai.levr.one/api` (`chart/prod.yaml:74`), and `setup-mcp.ts`
72
+ * deliberately accepts that shape because the levr MCP endpoint IS reached
73
+ * through the SPA proxy. Do not reuse this helper where deployed values are
74
+ * in scope — it would reject a valid production URL. internal.
75
+ *
76
+ * It fails SAFE — anything ambiguous declines to override the preset instead
77
+ * of silently replacing it. Do NOT weaken this back to a `^https?://` prefix
78
+ * test; that is precisely the check the proxy URL passed.
79
+ *
80
+ * Kept here rather than in `cli.ts` because that module is a self-executing
81
+ * CLI (importing it runs the command switch), so a pure helper there cannot
82
+ * be unit-tested — the same reason `parseDevTls` lives in this file.
83
+ *
84
+ * internal.
85
+ */
86
+ export declare function parseLocalBackenderOrigin(raw: string | undefined): string | undefined;
87
+ /**
88
+ * Read one key out of dotenv file contents, reproducing the behaviours
89
+ * `parseDevTls` documents twenty lines above: an `export ` prefix, a trailing
90
+ * `#` comment on an unquoted value, and the LAST assignment winning when the
91
+ * key repeats. Quotes are stripped only when they PAIR, so an unbalanced
92
+ * quote is left intact rather than half-removed.
93
+ *
94
+ * The first cut of this reader hand-rolled a narrower regex and inherited
95
+ * none of that, even though the repo had already been bitten by the `export `
96
+ * form on this very key — see `scripts/worktree-delete.test.ts:319`.
97
+ * internal / internal.
98
+ *
99
+ * `key` is always a literal from the call sites, never user input, so
100
+ * interpolating it into the pattern is safe.
101
+ */
102
+ export declare function extractEnvValue(contents: string, key: string): string | undefined;
103
+ /**
104
+ * Resolve a backender origin across the env files in precedence order, given
105
+ * their CONTENTS (`undefined` for a file that does not exist). Pure, so the
106
+ * precedence rule is unit-testable — the file I/O stays in `cli.ts`.
107
+ *
108
+ * **The first file that CONTAINS the key decides, even if its value is
109
+ * unusable.** That matches dotenv and `devTlsFromBackenderEnv`, which both
110
+ * fall through only on an ABSENT key. The first cut fell through on absent
111
+ * OR unusable, which let `.env.worktree` and `.env` disagree: the backender
112
+ * would use the higher-precedence value while the CLI silently resolved the
113
+ * lower one. Two answers for one key is exactly what reading these files in
114
+ * a shared order exists to prevent. Falling back to the preset is the safe
115
+ * direction; falling back to a different file is not. internal.
116
+ */
117
+ export declare function resolveOriginFromEnvFiles(key: string, files: readonly (string | undefined)[]): string | undefined;
118
+ export declare const LOCAL_HTTP: TqConfig;
119
+ export declare const LOCAL_HTTPS: TqConfig;
120
+ /**
121
+ * The checkout a reader belongs to: the nearest ancestor of `start` with an
122
+ * `apps/backender` env file, or undefined outside any checkout (e.g. the
123
+ * published CLI run in an unrelated project).
124
+ *
125
+ * Walks up like `devTlsFromBackenderEnv`, so a reader started from an app
126
+ * subdirectory still finds its checkout. The stdio MCP servers are started
127
+ * from the checkout root (`./plugins/...` in `.mcp.json`) and the hooks from
128
+ * `$CLAUDE_PROJECT_DIR`, so for them `start` IS the session's checkout.
129
+ */
130
+ export declare function findLocalCheckoutRoot(start: string): string | undefined;
131
+ /** The backend, auth-web and client URLs one checkout serves. */
132
+ export interface LocalCheckoutUrls {
133
+ root: string;
134
+ apiUrl: string;
135
+ authUrl: string;
136
+ clientUrl: string;
137
+ }
138
+ /**
139
+ * Resolve the `local` environment for the checkout containing `start`.
140
+ *
141
+ * `local` means "the backend of the checkout I am working in". `tq:env local`
142
+ * still writes the URLs it resolved into the machine-global
143
+ * `~/.tq/config.json` (older readers and the published CLI read them), but
144
+ * every reader in this package re-resolves `local` HERE, against its own
145
+ * checkout, so running `tq:env local` in one worktree no longer re-points the
146
+ * sessions of every other checkout on the machine. internal.
147
+ *
148
+ * Per checkout:
149
+ * - all three URLs come from `apps/backender`'s env (`API_BASE_URL`,
150
+ * `AUTH_URL`, `CLIENT_APP_URL`), which `worktree-add.sh` writes together
151
+ * when it allocates a worktree's port block — resolving only the API left
152
+ * `tq:login` opening another checkout's auth-web;
153
+ * - `.env.worktree` before `.env`, the order `apps/backender/src/env.ts`
154
+ * loads them, and the first file that HAS a key decides
155
+ * (`resolveOriginFromEnvFiles`);
156
+ * - only a bare origin is accepted (`parseLocalBackenderOrigin`): the main
157
+ * checkout under DEV_TLS carries the SPA's `/api` proxy URL there, which
158
+ * must fall back to the preset, not be dialled (internal);
159
+ * - otherwise the local preset, HTTPS when this checkout runs DEV_TLS.
160
+ *
161
+ * This is deliberately STRICTER than `scripts/setup-mcp.ts`'s
162
+ * `resolveLocalLevrUrl`, which takes any `https?://` value: the levr MCP
163
+ * endpoint is legitimately reached THROUGH the SPA proxy, so it wants the
164
+ * `/api` suffix this must reject. Not drift to reconcile — "fixing" it
165
+ * reintroduces internal. internal.
166
+ *
167
+ * Returns undefined outside a checkout, so the caller keeps the stored URLs.
168
+ */
169
+ export declare function resolveLocalCheckout(start?: string): LocalCheckoutUrls | undefined;
170
+ //# sourceMappingURL=local-env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-env.d.ts","sourceRoot":"","sources":["../src/local-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAKxC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,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