@swttch/extend-kit 0.7.0 → 0.7.2
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.ko.md +23 -0
- package/README.md +23 -0
- package/dist/battery/auth/index.js +35 -0
- package/dist/battery/auth/index.js.map +1 -1
- package/dist/cli/index.js +41 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/settings-env.d.ts +50 -0
- package/dist/settings-env.js +148 -0
- package/dist/settings-env.js.map +1 -0
- package/dist/stt/stream.js +9 -3
- package/dist/stt/stream.js.map +1 -1
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -393,9 +393,32 @@ ccb oauth profile
|
|
|
393
393
|
### 옵션
|
|
394
394
|
|
|
395
395
|
- `--json`: JSON 형식으로 출력
|
|
396
|
+
- `--env=NAME=VALUE`: 이번 실행에만 환경변수 하나를 강제로 지정 (여러 번 사용 가능)
|
|
396
397
|
- `-h, --help`: 도움말 표시
|
|
397
398
|
- `-v, --version`: 버전 정보 표시
|
|
398
399
|
|
|
400
|
+
### 환경변수
|
|
401
|
+
|
|
402
|
+
`ccb`는 Claude Code의 설정 파일을 직접 읽어 `env` 블록을 적용합니다. `claude` 명령과 같은 동작이라,
|
|
403
|
+
`~/.claude/settings.json`에만 적어 둔 프록시나 `CLAUDE_CODE_OAUTH_TOKEN` 값이 `ccb`에도 닿습니다.
|
|
404
|
+
네 개 파일을 겹쳐 읽으며 뒤에 오는 파일이 앞의 파일을 덮습니다.
|
|
405
|
+
|
|
406
|
+
```
|
|
407
|
+
~/.claude/settings.json
|
|
408
|
+
~/.claude/settings.local.json
|
|
409
|
+
<프로젝트>/.claude/settings.json # <프로젝트>는 실행한 작업 디렉토리
|
|
410
|
+
<프로젝트>/.claude/settings.local.json
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
우선순위는 다음과 같습니다. 위에 있는 것이 이깁니다.
|
|
414
|
+
|
|
415
|
+
1. 명령줄의 `--env=NAME=VALUE`
|
|
416
|
+
2. 위 설정 파일들의 `env` 블록
|
|
417
|
+
3. `ccb`가 실행될 때 물려받은 환경변수
|
|
418
|
+
|
|
419
|
+
`CLAUDE_CONFIG_DIR` 하나만은 설정 파일에서 읽지 않습니다. 그 값이 설정 파일의 위치를 정하기 때문이며,
|
|
420
|
+
환경변수로 지정해야 합니다.
|
|
421
|
+
|
|
399
422
|
```bash
|
|
400
423
|
ccb oauth usage --json
|
|
401
424
|
ccb oauth profile --json
|
package/README.md
CHANGED
|
@@ -401,9 +401,32 @@ ccb oauth profile
|
|
|
401
401
|
### Options
|
|
402
402
|
|
|
403
403
|
- `--json`: Output in JSON format
|
|
404
|
+
- `--env=NAME=VALUE`: Force one environment variable for this run (repeatable)
|
|
404
405
|
- `-h, --help`: Show help
|
|
405
406
|
- `-v, --version`: Show version information
|
|
406
407
|
|
|
408
|
+
### Environment
|
|
409
|
+
|
|
410
|
+
`ccb` reads Claude Code's own settings files and applies their `env` block, the same way the
|
|
411
|
+
`claude` CLI does — so a proxy or a `CLAUDE_CODE_OAUTH_TOKEN` written only into
|
|
412
|
+
`~/.claude/settings.json` reaches `ccb` too. Four files are layered, later winning over earlier:
|
|
413
|
+
|
|
414
|
+
```
|
|
415
|
+
~/.claude/settings.json
|
|
416
|
+
~/.claude/settings.local.json
|
|
417
|
+
<project>/.claude/settings.json # <project> is the working directory
|
|
418
|
+
<project>/.claude/settings.local.json
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Resolution order, highest first:
|
|
422
|
+
|
|
423
|
+
1. `--env=NAME=VALUE` on the command line
|
|
424
|
+
2. the `env` block of the settings files above
|
|
425
|
+
3. the environment `ccb` was started with
|
|
426
|
+
|
|
427
|
+
`CLAUDE_CONFIG_DIR` is the one variable never read from a settings file, since it decides where
|
|
428
|
+
those files are; set it in the environment instead.
|
|
429
|
+
|
|
407
430
|
```bash
|
|
408
431
|
ccb oauth usage --json
|
|
409
432
|
ccb oauth profile --json
|
|
@@ -4,7 +4,42 @@ import { CcbError } from '../errors.js';
|
|
|
4
4
|
export function isApiKeyAuth(auth) {
|
|
5
5
|
return typeof auth === 'object' && 'apiKey' in auth;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* A token handed to us through the environment, wrapped as credentials.
|
|
9
|
+
*
|
|
10
|
+
* `claude setup-token` issues a long-lived token for people who cannot run an interactive
|
|
11
|
+
* login — CI, containers, a workstation where the browser flow is blocked — and the way to
|
|
12
|
+
* use it is `CLAUDE_CODE_OAUTH_TOKEN`. The `claude` CLI reads that variable BEFORE it looks
|
|
13
|
+
* at the keychain: on a machine with a perfectly good login in the keychain, one bad value
|
|
14
|
+
* in that variable makes `claude` fail with 401, which is only possible if the variable is
|
|
15
|
+
* consulted first. So it is consulted first here too.
|
|
16
|
+
*
|
|
17
|
+
* The fields beside the token are filled with blanks because the variable carries a token and
|
|
18
|
+
* nothing else. That is honest rather than lossy: `accessToken` is the only field any caller
|
|
19
|
+
* in this package reads.
|
|
20
|
+
*
|
|
21
|
+
* `expiresAt` is the one that needs saying out loud. A token handed over this way comes with
|
|
22
|
+
* no expiry, and there is no refresh token to renew it with, so treating it as expired would
|
|
23
|
+
* make the feature unusable while treating it as fresh costs nothing: an expired one is
|
|
24
|
+
* refused by the server, which is the same answer, arriving from the side that actually knows.
|
|
25
|
+
*/
|
|
26
|
+
function environmentCredentials(token) {
|
|
27
|
+
return {
|
|
28
|
+
claudeAiOauth: {
|
|
29
|
+
accessToken: token,
|
|
30
|
+
refreshToken: '',
|
|
31
|
+
expiresAt: Number.MAX_SAFE_INTEGER,
|
|
32
|
+
scopes: [],
|
|
33
|
+
subscriptionType: '',
|
|
34
|
+
rateLimitTier: '',
|
|
35
|
+
},
|
|
36
|
+
organizationUuid: '',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
7
39
|
export async function getCredentials() {
|
|
40
|
+
const envToken = process.env['CLAUDE_CODE_OAUTH_TOKEN'];
|
|
41
|
+
if (envToken)
|
|
42
|
+
return environmentCredentials(envToken);
|
|
8
43
|
const platform = process.platform;
|
|
9
44
|
if (platform === 'darwin') {
|
|
10
45
|
return readKeychainCredentials();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/battery/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAIxC,MAAM,UAAU,YAAY,CAAC,IAAgB;IAC3C,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,QAAQ,IAAI,IAAI,CAAC;AACtD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAElC,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,uBAAuB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjD,OAAO,mBAAmB,EAAE,CAAC;IAC/B,CAAC;IAED,MAAM,IAAI,QAAQ,CAAC,yBAAyB,QAAQ,GAAG,EAAE,sBAAsB,CAAC,CAAC;AACnF,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,WAA8B;IAC3D,OAAO,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,WAA8B;IAC3D,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,WAAW,CAAC,aAAa,CAAC,SAAS,CAAC;AAC3D,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/battery/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,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AC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { oauthCommand } from './oauth.js';
|
|
|
5
5
|
import { sttCommand } from './stt.js';
|
|
6
6
|
import { getAccountCredentials } from './account-credentials.js';
|
|
7
7
|
import { CcbError } from '../battery/errors.js';
|
|
8
|
+
import { applySettingsEnv } from '../settings-env.js';
|
|
8
9
|
import { readFileSync } from 'node:fs';
|
|
9
10
|
import { fileURLToPath } from 'node:url';
|
|
10
11
|
import { dirname, resolve } from 'node:path';
|
|
@@ -16,12 +17,50 @@ const command = args.filter((a) => !a.startsWith('-'));
|
|
|
16
17
|
const flags = new Set(args.filter((a) => a.startsWith('-')));
|
|
17
18
|
const jsonOutput = flags.has('--json');
|
|
18
19
|
const accountFile = args.find(arg => arg.startsWith('--account-file='))?.slice('--account-file='.length);
|
|
20
|
+
/**
|
|
21
|
+
* `--env NAME=VALUE`, repeatable: a variable the caller is forcing for this run.
|
|
22
|
+
*
|
|
23
|
+
* An assignment written in front of a command (`FOO=bar ccb ...`) cannot be told apart from
|
|
24
|
+
* one exported in a startup file — both arrive as plain entries in the environment, carrying
|
|
25
|
+
* no record of how they got there. So a caller who means "use THIS one, whatever the settings
|
|
26
|
+
* files say" has no way to say it through the environment, and says it through this flag
|
|
27
|
+
* instead. Values given here outrank the settings files; nothing outranks them.
|
|
28
|
+
*/
|
|
29
|
+
function forcedEnv() {
|
|
30
|
+
return args
|
|
31
|
+
.filter(arg => arg.startsWith('--env='))
|
|
32
|
+
.map(arg => arg.slice('--env='.length))
|
|
33
|
+
.map((assignment) => {
|
|
34
|
+
const eq = assignment.indexOf('=');
|
|
35
|
+
// A value may itself contain "=" (a proxy URL with a query string does), so only the
|
|
36
|
+
// FIRST separator splits. A name may not be empty; a value may.
|
|
37
|
+
if (eq <= 0)
|
|
38
|
+
return null;
|
|
39
|
+
return [assignment.slice(0, eq), assignment.slice(eq + 1)];
|
|
40
|
+
})
|
|
41
|
+
.filter((pair) => pair !== null);
|
|
42
|
+
}
|
|
19
43
|
async function createClient() {
|
|
20
44
|
const credentials = accountFile ? await getAccountCredentials(accountFile) : await getCredentials();
|
|
21
45
|
const token = getAccessToken(credentials);
|
|
22
46
|
return new ClaudeCodeClient(token);
|
|
23
47
|
}
|
|
24
48
|
async function run() {
|
|
49
|
+
// Before anything reads the environment. `claude` applies its settings files' `env` block
|
|
50
|
+
// to itself this way, and every read below — the proxy, the OAuth token, the config dir —
|
|
51
|
+
// has to see the same environment `claude` would see on this machine.
|
|
52
|
+
//
|
|
53
|
+
// The project whose settings apply is the directory this process was started in, which is
|
|
54
|
+
// how the spawning plugin names one: it sets the child's working directory.
|
|
55
|
+
//
|
|
56
|
+
// Forced values go in FIRST and are then skipped by the settings pass, rather than being
|
|
57
|
+
// applied on top afterwards. The order is what makes `--env=CLAUDE_CONFIG_DIR=...` work:
|
|
58
|
+
// that variable decides WHICH settings files get read, so a value arriving after the read
|
|
59
|
+
// would be too late to have any effect on it.
|
|
60
|
+
const forced = forcedEnv();
|
|
61
|
+
for (const [name, value] of forced)
|
|
62
|
+
process.env[name] = value;
|
|
63
|
+
await applySettingsEnv(process.cwd(), new Set(forced.map(([name]) => name)));
|
|
25
64
|
const [module, ...subcommand] = command;
|
|
26
65
|
if (flags.has('--capabilities')) {
|
|
27
66
|
// A caller checks this before using a command: the plugin has to know
|
|
@@ -49,6 +88,8 @@ Commands:
|
|
|
49
88
|
stt --check Report whether this machine can dictate
|
|
50
89
|
|
|
51
90
|
Options:
|
|
91
|
+
--env=NAME=VALUE Force one environment variable for this run (repeatable).
|
|
92
|
+
Outranks the env block of Claude Code's settings files.
|
|
52
93
|
--account-file=<path> Read usage for a CCG saved-account snapshot (no account switch)
|
|
53
94
|
--language=<code> BCP-47 language for stt (default: en)
|
|
54
95
|
--keyterms=<a,b,c> Extra vocabulary to bias stt toward
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index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CAAC,CAAC,GAAG,EAAE,EAAE;IAClB,IAAI,UAAU,EAAE,CAAC;QACf,IAAI,GAAG,YAAY,QAAQ,EAAE,CAAC;YAC5B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACvD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;gBAC3B,KAAK,EAAE;oBACL,IAAI,EAAE,eAAe;oBACrB,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;iBAC1D;aACF,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACf,CAAC;IACH,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,YAAY,QAAQ,EAAE,CAAC;YAC5B,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACvC,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `env` block of Claude Code's settings files, applied the way `claude` applies it.
|
|
3
|
+
*
|
|
4
|
+
* `claude` reads its own settings files and puts their `env` block into the environment
|
|
5
|
+
* before it talks to anything. Nothing else on the machine does that — a variable written
|
|
6
|
+
* only into settings.json never becomes a real environment variable — so a tool that reads
|
|
7
|
+
* `process.env` alone sees a different configuration than `claude` does on the same machine.
|
|
8
|
+
*
|
|
9
|
+
* That difference is not hypothetical. It broke the usage panel twice: once for a proxy set
|
|
10
|
+
* only in settings.json, and again for the lower-case spelling of the same variable. Both
|
|
11
|
+
* times the fix was to name one more variable somewhere. This module reads the block whole
|
|
12
|
+
* instead, so the next variable needs no fix at all.
|
|
13
|
+
*
|
|
14
|
+
* The rules below were measured against `claude` 2.1.261 by writing six shapes of value into
|
|
15
|
+
* a project's settings.json and reading back what its child process received:
|
|
16
|
+
*
|
|
17
|
+
* "PLAIN": "value" → value (passed through)
|
|
18
|
+
* "BRACE": "pre-${HOME}-post" → pre-${HOME}-post (NOT expanded)
|
|
19
|
+
* "FALL": "${UNSET:-fb}" → ${UNSET:-fb} (NOT expanded)
|
|
20
|
+
* "EMPTY": "" → empty, still set (not a deletion)
|
|
21
|
+
* "NUMBER": 1234 → "1234" (stringified)
|
|
22
|
+
* "BOOL": true → "true" (stringified)
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Where Claude Code keeps its settings and credentials.
|
|
26
|
+
*
|
|
27
|
+
* Read from the environment, never from a settings file — see {@link EXCLUDED_NAMES}.
|
|
28
|
+
*/
|
|
29
|
+
export declare function claudeConfigDir(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Every variable the settings files set, merged global-to-project.
|
|
32
|
+
*
|
|
33
|
+
* Returned rather than applied so a caller can see the block without changing the process,
|
|
34
|
+
* which is how the tests read it.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readSettingsEnv(projectDir?: string): Promise<Record<string, string>>;
|
|
37
|
+
/**
|
|
38
|
+
* Put the settings files' `env` block into this process's environment.
|
|
39
|
+
*
|
|
40
|
+
* The settings value wins over whatever this process inherited, because that is what `claude`
|
|
41
|
+
* does: with the same name exported in the shell and written into settings.json, the value its
|
|
42
|
+
* child received was the settings one. Matching that is the whole point — the user edits that
|
|
43
|
+
* file for `claude`, so `claude` is the behaviour to agree with.
|
|
44
|
+
*
|
|
45
|
+
* A value forced on the command line is the one thing that outranks this, and it is read from
|
|
46
|
+
* the flag that carries it rather than from here: an assignment written in front of a command
|
|
47
|
+
* is indistinguishable from an inherited variable by the time it arrives, so a flag is the only
|
|
48
|
+
* way a caller can say "this one, whatever the files say".
|
|
49
|
+
*/
|
|
50
|
+
export declare function applySettingsEnv(projectDir?: string, forcedNames?: ReadonlySet<string>): Promise<void>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `env` block of Claude Code's settings files, applied the way `claude` applies it.
|
|
3
|
+
*
|
|
4
|
+
* `claude` reads its own settings files and puts their `env` block into the environment
|
|
5
|
+
* before it talks to anything. Nothing else on the machine does that — a variable written
|
|
6
|
+
* only into settings.json never becomes a real environment variable — so a tool that reads
|
|
7
|
+
* `process.env` alone sees a different configuration than `claude` does on the same machine.
|
|
8
|
+
*
|
|
9
|
+
* That difference is not hypothetical. It broke the usage panel twice: once for a proxy set
|
|
10
|
+
* only in settings.json, and again for the lower-case spelling of the same variable. Both
|
|
11
|
+
* times the fix was to name one more variable somewhere. This module reads the block whole
|
|
12
|
+
* instead, so the next variable needs no fix at all.
|
|
13
|
+
*
|
|
14
|
+
* The rules below were measured against `claude` 2.1.261 by writing six shapes of value into
|
|
15
|
+
* a project's settings.json and reading back what its child process received:
|
|
16
|
+
*
|
|
17
|
+
* "PLAIN": "value" → value (passed through)
|
|
18
|
+
* "BRACE": "pre-${HOME}-post" → pre-${HOME}-post (NOT expanded)
|
|
19
|
+
* "FALL": "${UNSET:-fb}" → ${UNSET:-fb} (NOT expanded)
|
|
20
|
+
* "EMPTY": "" → empty, still set (not a deletion)
|
|
21
|
+
* "NUMBER": 1234 → "1234" (stringified)
|
|
22
|
+
* "BOOL": true → "true" (stringified)
|
|
23
|
+
*/
|
|
24
|
+
import { readFile } from 'node:fs/promises';
|
|
25
|
+
import { homedir } from 'node:os';
|
|
26
|
+
import { join } from 'node:path';
|
|
27
|
+
/**
|
|
28
|
+
* Where Claude Code keeps its settings and credentials.
|
|
29
|
+
*
|
|
30
|
+
* Read from the environment, never from a settings file — see {@link EXCLUDED_NAMES}.
|
|
31
|
+
*/
|
|
32
|
+
export function claudeConfigDir() {
|
|
33
|
+
return process.env['CLAUDE_CONFIG_DIR'] ?? join(homedir(), '.claude');
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Names this module refuses to take from a settings file.
|
|
37
|
+
*
|
|
38
|
+
* `CLAUDE_CONFIG_DIR` decides WHERE the settings file is. Reading it back out of that file
|
|
39
|
+
* would mean the file's location depends on a value only readable after the file is found,
|
|
40
|
+
* so the value is honoured from the environment only. The plugin that spawns this CLI settles
|
|
41
|
+
* it the same way: it keeps that one variable in its own settings and passes it in.
|
|
42
|
+
*/
|
|
43
|
+
const EXCLUDED_NAMES = new Set(['CLAUDE_CONFIG_DIR']);
|
|
44
|
+
/**
|
|
45
|
+
* The settings files, in the order `claude` layers them — later wins.
|
|
46
|
+
*
|
|
47
|
+
* The project pair is dropped when no project directory is known, which is what a bare
|
|
48
|
+
* `ccb` in a directory with no `.claude` folder amounts to anyway.
|
|
49
|
+
*/
|
|
50
|
+
function settingsFiles(projectDir) {
|
|
51
|
+
const configDir = claudeConfigDir();
|
|
52
|
+
const files = [
|
|
53
|
+
join(configDir, 'settings.json'),
|
|
54
|
+
join(configDir, 'settings.local.json'),
|
|
55
|
+
];
|
|
56
|
+
if (projectDir) {
|
|
57
|
+
files.push(join(projectDir, '.claude', 'settings.json'), join(projectDir, '.claude', 'settings.local.json'));
|
|
58
|
+
}
|
|
59
|
+
return files;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* One value as an environment variable, or null when it cannot be one.
|
|
63
|
+
*
|
|
64
|
+
* Numbers and booleans are stringified because `claude` passes them on stringified. An empty
|
|
65
|
+
* string is a value, not a removal — also measured.
|
|
66
|
+
*
|
|
67
|
+
* Objects, arrays and null are skipped. `claude`'s handling of those was NOT measured, and
|
|
68
|
+
* the alternatives are worse than skipping: `String({})` is the literal "[object Object]",
|
|
69
|
+
* which is a value no one meant to set.
|
|
70
|
+
*/
|
|
71
|
+
function asEnvValue(value) {
|
|
72
|
+
if (typeof value === 'string')
|
|
73
|
+
return value;
|
|
74
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
75
|
+
return String(value);
|
|
76
|
+
if (typeof value === 'boolean')
|
|
77
|
+
return String(value);
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
/** The `env` object of one settings file, or an empty object when there is not one. */
|
|
81
|
+
async function readEnvBlock(filePath) {
|
|
82
|
+
let raw;
|
|
83
|
+
try {
|
|
84
|
+
raw = await readFile(filePath, 'utf-8');
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
// A settings file that does not exist is the normal case, not a failure.
|
|
88
|
+
return {};
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const parsed = JSON.parse(raw);
|
|
92
|
+
const env = parsed.env;
|
|
93
|
+
if (!env || typeof env !== 'object' || Array.isArray(env))
|
|
94
|
+
return {};
|
|
95
|
+
return env;
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// A settings file we cannot parse is the user's to fix. Failing the whole command over
|
|
99
|
+
// it would take away the usage panel and dictation for a stray comma.
|
|
100
|
+
return {};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Every variable the settings files set, merged global-to-project.
|
|
105
|
+
*
|
|
106
|
+
* Returned rather than applied so a caller can see the block without changing the process,
|
|
107
|
+
* which is how the tests read it.
|
|
108
|
+
*/
|
|
109
|
+
export async function readSettingsEnv(projectDir) {
|
|
110
|
+
const merged = {};
|
|
111
|
+
for (const filePath of settingsFiles(projectDir)) {
|
|
112
|
+
const block = await readEnvBlock(filePath);
|
|
113
|
+
for (const [name, value] of Object.entries(block)) {
|
|
114
|
+
if (EXCLUDED_NAMES.has(name))
|
|
115
|
+
continue;
|
|
116
|
+
const asValue = asEnvValue(value);
|
|
117
|
+
if (asValue !== null)
|
|
118
|
+
merged[name] = asValue;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return merged;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Put the settings files' `env` block into this process's environment.
|
|
125
|
+
*
|
|
126
|
+
* The settings value wins over whatever this process inherited, because that is what `claude`
|
|
127
|
+
* does: with the same name exported in the shell and written into settings.json, the value its
|
|
128
|
+
* child received was the settings one. Matching that is the whole point — the user edits that
|
|
129
|
+
* file for `claude`, so `claude` is the behaviour to agree with.
|
|
130
|
+
*
|
|
131
|
+
* A value forced on the command line is the one thing that outranks this, and it is read from
|
|
132
|
+
* the flag that carries it rather than from here: an assignment written in front of a command
|
|
133
|
+
* is indistinguishable from an inherited variable by the time it arrives, so a flag is the only
|
|
134
|
+
* way a caller can say "this one, whatever the files say".
|
|
135
|
+
*/
|
|
136
|
+
export async function applySettingsEnv(projectDir = process.cwd(), forcedNames = new Set()) {
|
|
137
|
+
const settingsEnv = await readSettingsEnv(projectDir);
|
|
138
|
+
for (const [name, value] of Object.entries(settingsEnv)) {
|
|
139
|
+
// A forced name is already in place and must survive: the caller put it there to
|
|
140
|
+
// outrank exactly this. Skipping is how that ordering is kept in one pass, and it
|
|
141
|
+
// matters most for CLAUDE_CONFIG_DIR, which has to be in place BEFORE this function
|
|
142
|
+
// runs because it is what decides which settings files it reads.
|
|
143
|
+
if (forcedNames.has(name))
|
|
144
|
+
continue;
|
|
145
|
+
process.env[name] = value;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=settings-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-env.js","sourceRoot":"","sources":["../src/settings-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM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mC,IAAI,GAAG,EAAE;IAE5C,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,CAAC;IACtD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QACxD,iFAAiF;QACjF,kFAAkF;QAClF,oFAAoF;QACpF,iEAAiE;QACjE,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,SAAS;QACpC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IAC5B,CAAC;AACH,CAAC"}
|
package/dist/stt/stream.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import WebSocket from 'ws';
|
|
2
|
-
import { getCredentials, getAccessToken } from '../battery/auth/index.js';
|
|
2
|
+
import { getCredentials, getAccessToken, isTokenExpired } from '../battery/auth/index.js';
|
|
3
3
|
import { CcbError } from '../battery/errors.js';
|
|
4
4
|
import { proxyAgentFor } from '../proxy.js';
|
|
5
5
|
import { DEFAULT_KEYTERMS, packKeyterms } from './keyterms.js';
|
|
@@ -222,8 +222,14 @@ export async function openSpeechToTextStream(handlers, options = {}, token) {
|
|
|
222
222
|
*/
|
|
223
223
|
export async function isSpeechToTextAvailable() {
|
|
224
224
|
try {
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
const credentials = await getCredentials();
|
|
226
|
+
getAccessToken(credentials);
|
|
227
|
+
// An expired login answers "yes, you can dictate" and then fails the handshake with a
|
|
228
|
+
// 401 the caller has no way to explain. Somebody who signed in months ago and stopped
|
|
229
|
+
// has exactly that on disk: a credentials file, holding a token the server will refuse.
|
|
230
|
+
// Reading the expiry here turns that into "sign in first", which is the truth and is
|
|
231
|
+
// also something the user can act on.
|
|
232
|
+
return !isTokenExpired(credentials);
|
|
227
233
|
}
|
|
228
234
|
catch (err) {
|
|
229
235
|
if (err instanceof CcbError)
|
package/dist/stt/stream.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/stt/stream.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/stt/stream.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EACL,YAAY,EACZ,qBAAqB,GAKtB,MAAM,YAAY,CAAC;AAEpB,MAAM,gBAAgB,GAAG,4DAA4D,CAAC;AAEtF,sEAAsE;AACtE,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,4EAA4E;AAC5E,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;AACxD,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;AAE7D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,QAA8B,EAC9B,UAA+B,EAAE,EACjC,KAAc;IAEd,MAAM,WAAW,GAAG,KAAK,IAAI,cAAc,CAAC,MAAM,cAAc,EAAE,CAAC,CAAC;IAEpE,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC;QAChC,QAAQ,EAAE,YAAY,CAAC,QAAQ;QAC/B,WAAW,EAA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AAC,UAAU,KAAK,SAAS,CAAC,MAAM;wBAAE,MAAM,CAAC,KAAK,EAAE,CAAC;oBAC3D,OAAO,EAAE,CAAC;gBACZ,CAAC,EAAE,cAAc,CAAC,CAAC;gBAEnB,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,CAAC,IAAI;oBAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBAEpE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;oBACxB,YAAY,CAAC,MAAM,CAAC,CAAC;oBACrB,aAAa,EAAE,CAAC;oBAChB,OAAO,EAAE,CAAC;gBACZ,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;QAC3C,cAAc,CAAC,WAAW,CAAC,CAAC;QAC5B,sFAAsF;QACtF,sFAAsF;QACtF,wFAAwF;QACxF,qFAAqF;QACrF,sCAAsC;QACtC,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC1C,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swttch/extend-kit",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Companion tools for Swttch that live outside the plugin bundle: Claude Code account/usage SDK, the ccb CLI, and speech-to-text.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|