@nebulr-group/bridge-cli 0.4.3 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -5
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +13 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/auth/logout.command.d.ts +10 -3
- package/dist/commands/auth/logout.command.d.ts.map +1 -1
- package/dist/commands/auth/logout.command.js +58 -18
- package/dist/commands/auth/logout.command.js.map +1 -1
- package/dist/commands/auth/status.command.d.ts +4 -0
- package/dist/commands/auth/status.command.d.ts.map +1 -1
- package/dist/commands/auth/status.command.js +50 -19
- package/dist/commands/auth/status.command.js.map +1 -1
- package/dist/commands/auth/use.command.d.ts +17 -0
- package/dist/commands/auth/use.command.d.ts.map +1 -0
- package/dist/commands/auth/use.command.js +47 -0
- package/dist/commands/auth/use.command.js.map +1 -0
- package/dist/commands/auth.command.d.ts +1 -0
- package/dist/commands/auth.command.d.ts.map +1 -1
- package/dist/commands/auth.command.js +3 -0
- package/dist/commands/auth.command.js.map +1 -1
- package/dist/commands/flag-init.command.d.ts.map +1 -1
- package/dist/commands/flag-init.command.js +9 -8
- package/dist/commands/flag-init.command.js.map +1 -1
- package/dist/config.d.ts +20 -13
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +120 -32
- package/dist/config.js.map +1 -1
- package/dist/credentials.d.ts +68 -5
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +202 -11
- package/dist/credentials.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flag-init.command.js","sourceRoot":"","sources":["../../src/commands/flag-init.command.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,0EAA0E;AAC1E,8DAA8D;AAC9D,sDAAsD;AACtD,6EAA6E;AAC7E,kCAAkC;AAClC,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,+EAA+E;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CAAkC;QAClC,OAAO;YACL,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,oHAAoH;SAC3H,CAAC;IACJ,CAAC;IACD,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC;IAClF,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC;AACnF,CAAC;AAED,SAAS,YAAY,CAAC,SAAyB;IAC7C,MAAM,IAAI,GAAG;QACX,oDAAoD;QACpD,yBAAyB,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,gBAAgB,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,oCAAoC;QAC/H,iIAAiI;QACjI,qEAAqE;KACtE,CAAC;IACF,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO;YACL,sFAAsF;YACtF,GAAG,IAAI;SACR,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,mDAAmD;AACnD,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IAC3C,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
import { BridgeManagement } from '@nebulr-group/bridge-auth-core';
|
|
2
2
|
export declare const DEFAULT_BASE_URL = "https://api.thebridge.dev";
|
|
3
|
+
/** Called once from the CLI entrypoint, before any action runs. */
|
|
4
|
+
export declare function setProfileOverride(profile: string | null | undefined): void;
|
|
3
5
|
/**
|
|
4
6
|
* Resolution order:
|
|
5
|
-
* 1.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* 2.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* 1. `--profile <label|id|name>` / `BRIDGE_PROFILE` — a stored credential,
|
|
8
|
+
* named for this one invocation. Never falls back: naming a profile and
|
|
9
|
+
* silently getting a different app is the exact failure TBP-628 exists to
|
|
10
|
+
* stop, so an unknown or expired profile is an error.
|
|
11
|
+
* 2. The ACTIVE credential in `~/.config/bridge/credentials.json` (or
|
|
12
|
+
* `$XDG_CONFIG_HOME/...`), written by `bridge auth login` and moved by
|
|
13
|
+
* `bridge auth use`.
|
|
14
|
+
* 3. `BRIDGE_API_KEY` env var (CI / service-account fallback). Used when no
|
|
15
|
+
* usable credentials file exists — the typical CI runner shape.
|
|
16
|
+
* 4. Throw `ConfigError("Not logged in. Run `bridge auth login`.")`.
|
|
12
17
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
18
|
+
* The credentials file still wins over `BRIDGE_API_KEY`, unchanged, so
|
|
19
|
+
* `bridge auth login` takes effect immediately and CI is unaffected. What HAS
|
|
20
|
+
* changed is that being ignored is now said out loud: `BRIDGE_API_KEY` and
|
|
21
|
+
* `BRIDGE_APP_ID` look like a way to retarget the CLI and are not, and reading
|
|
22
|
+
* that in the output beats discovering it from a write that went to the wrong
|
|
23
|
+
* app (TBP-628).
|
|
16
24
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* friendly error pointing the user back to `bridge auth login`.
|
|
25
|
+
* Every resolution also prints one line to stderr naming the app that is about
|
|
26
|
+
* to answer. See `writeContextBanner`.
|
|
20
27
|
*/
|
|
21
28
|
export declare function getManagementClient(): BridgeManagement;
|
|
22
29
|
/**
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AASlE,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;AAa5D,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAE3E;AAQD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,CA0EtD;AAoDD;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAQnE;AAED,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM;CAI5B"}
|
package/dist/config.js
CHANGED
|
@@ -1,24 +1,47 @@
|
|
|
1
1
|
import { BridgeManagement } from '@nebulr-group/bridge-auth-core';
|
|
2
|
-
import { isExpired, readCredentials } from './credentials.js';
|
|
2
|
+
import { CredentialSelectorError, findCredential, isExpired, readCredentials, } from './credentials.js';
|
|
3
3
|
export const DEFAULT_BASE_URL = 'https://api.thebridge.dev';
|
|
4
4
|
let _client = null;
|
|
5
|
+
/**
|
|
6
|
+
* The `--profile` value for this invocation, set by the CLI's preAction hook.
|
|
7
|
+
*
|
|
8
|
+
* A per-invocation override rather than a persisted switch, because that is
|
|
9
|
+
* what scripts and long-running agent sessions need: target one app for one
|
|
10
|
+
* command without mutating state another process is reading (TBP-628).
|
|
11
|
+
*/
|
|
12
|
+
let _profileOverride = null;
|
|
13
|
+
/** Called once from the CLI entrypoint, before any action runs. */
|
|
14
|
+
export function setProfileOverride(profile) {
|
|
15
|
+
_profileOverride = profile?.trim() || null;
|
|
16
|
+
}
|
|
17
|
+
/** The profile in force: `--profile` beats `BRIDGE_PROFILE`. */
|
|
18
|
+
function activeProfileSelector() {
|
|
19
|
+
if (_profileOverride)
|
|
20
|
+
return _profileOverride;
|
|
21
|
+
return process.env.BRIDGE_PROFILE?.trim() || null;
|
|
22
|
+
}
|
|
5
23
|
/**
|
|
6
24
|
* Resolution order:
|
|
7
|
-
* 1.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* 2.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
25
|
+
* 1. `--profile <label|id|name>` / `BRIDGE_PROFILE` — a stored credential,
|
|
26
|
+
* named for this one invocation. Never falls back: naming a profile and
|
|
27
|
+
* silently getting a different app is the exact failure TBP-628 exists to
|
|
28
|
+
* stop, so an unknown or expired profile is an error.
|
|
29
|
+
* 2. The ACTIVE credential in `~/.config/bridge/credentials.json` (or
|
|
30
|
+
* `$XDG_CONFIG_HOME/...`), written by `bridge auth login` and moved by
|
|
31
|
+
* `bridge auth use`.
|
|
32
|
+
* 3. `BRIDGE_API_KEY` env var (CI / service-account fallback). Used when no
|
|
33
|
+
* usable credentials file exists — the typical CI runner shape.
|
|
34
|
+
* 4. Throw `ConfigError("Not logged in. Run `bridge auth login`.")`.
|
|
14
35
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
36
|
+
* The credentials file still wins over `BRIDGE_API_KEY`, unchanged, so
|
|
37
|
+
* `bridge auth login` takes effect immediately and CI is unaffected. What HAS
|
|
38
|
+
* changed is that being ignored is now said out loud: `BRIDGE_API_KEY` and
|
|
39
|
+
* `BRIDGE_APP_ID` look like a way to retarget the CLI and are not, and reading
|
|
40
|
+
* that in the output beats discovering it from a write that went to the wrong
|
|
41
|
+
* app (TBP-628).
|
|
18
42
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* friendly error pointing the user back to `bridge auth login`.
|
|
43
|
+
* Every resolution also prints one line to stderr naming the app that is about
|
|
44
|
+
* to answer. See `writeContextBanner`.
|
|
22
45
|
*/
|
|
23
46
|
export function getManagementClient() {
|
|
24
47
|
if (_client)
|
|
@@ -29,29 +52,56 @@ export function getManagementClient() {
|
|
|
29
52
|
let apiKey;
|
|
30
53
|
let baseUrl;
|
|
31
54
|
let source;
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
55
|
+
let creds = null;
|
|
56
|
+
const selector = activeProfileSelector();
|
|
57
|
+
if (selector) {
|
|
58
|
+
// 1. Explicit profile. Resolve it or fail — no fallback of any kind.
|
|
59
|
+
let entry;
|
|
60
|
+
try {
|
|
61
|
+
entry = findCredential(selector);
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
if (err instanceof CredentialSelectorError)
|
|
65
|
+
throw new ConfigError(err.message);
|
|
66
|
+
throw err;
|
|
67
|
+
}
|
|
68
|
+
if (isExpired(entry.creds)) {
|
|
69
|
+
throw new ConfigError(`Credential for "${selector}" (${entry.creds.app.name}) expired ` +
|
|
70
|
+
`${entry.creds.expiresAt}. Run \`bridge auth login\` to re-authenticate it. ` +
|
|
71
|
+
'Refusing to fall back to another app.');
|
|
72
|
+
}
|
|
73
|
+
creds = entry.creds;
|
|
35
74
|
apiKey = creds.apiKey;
|
|
36
|
-
// Env override still wins for baseUrl (useful for hitting a local bridge-api
|
|
37
|
-
// with a token issued by prod, or vice versa during dev).
|
|
38
75
|
baseUrl = envBaseUrl && envBaseUrl.length > 0 ? envBaseUrl : creds.baseUrl;
|
|
39
|
-
source = '
|
|
40
|
-
}
|
|
41
|
-
else if (envApiKey && envApiKey.length > 0) {
|
|
42
|
-
// 2. BRIDGE_API_KEY env var (CI / service-account fallback).
|
|
43
|
-
apiKey = envApiKey;
|
|
44
|
-
baseUrl = envBaseUrl && envBaseUrl.length > 0 ? envBaseUrl : DEFAULT_BASE_URL;
|
|
45
|
-
source = 'env';
|
|
46
|
-
}
|
|
47
|
-
else if (creds && isExpired(creds)) {
|
|
48
|
-
// 3a. Found a credentials file but token expired; no env fallback either.
|
|
49
|
-
throw new ConfigError('Token expired. Run `bridge auth login` to re-authenticate.');
|
|
76
|
+
source = 'profile';
|
|
50
77
|
}
|
|
51
78
|
else {
|
|
52
|
-
//
|
|
53
|
-
|
|
79
|
+
// 2. Active credential from `bridge auth login` / `bridge auth use`.
|
|
80
|
+
const active = safeReadCredentials();
|
|
81
|
+
if (active && !isExpired(active)) {
|
|
82
|
+
creds = active;
|
|
83
|
+
apiKey = active.apiKey;
|
|
84
|
+
// Env override still wins for baseUrl (useful for hitting a local
|
|
85
|
+
// bridge-api with a token issued by prod, or vice versa during dev).
|
|
86
|
+
baseUrl = envBaseUrl && envBaseUrl.length > 0 ? envBaseUrl : active.baseUrl;
|
|
87
|
+
source = 'credentials-file';
|
|
88
|
+
}
|
|
89
|
+
else if (envApiKey && envApiKey.length > 0) {
|
|
90
|
+
// 3. BRIDGE_API_KEY env var (CI / service-account fallback).
|
|
91
|
+
apiKey = envApiKey;
|
|
92
|
+
baseUrl = envBaseUrl && envBaseUrl.length > 0 ? envBaseUrl : DEFAULT_BASE_URL;
|
|
93
|
+
source = 'env';
|
|
94
|
+
}
|
|
95
|
+
else if (active && isExpired(active)) {
|
|
96
|
+
// 4a. Found a credentials file but token expired; no env fallback either.
|
|
97
|
+
throw new ConfigError('Token expired. Run `bridge auth login` to re-authenticate.');
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
// 4b. No credentials at all.
|
|
101
|
+
throw new ConfigError('Not logged in. Run `bridge auth login`.');
|
|
102
|
+
}
|
|
54
103
|
}
|
|
104
|
+
writeContextBanner({ creds, source, baseUrl, selector });
|
|
55
105
|
if (debug) {
|
|
56
106
|
const baseSource = envBaseUrl && envBaseUrl.length > 0
|
|
57
107
|
? 'env'
|
|
@@ -63,6 +113,44 @@ export function getManagementClient() {
|
|
|
63
113
|
_client = new BridgeManagement({ apiKey, baseUrl, debug });
|
|
64
114
|
return _client;
|
|
65
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* One line on stderr naming the app that is about to answer.
|
|
118
|
+
*
|
|
119
|
+
* On EVERY command, not only writes. The incident behind TBP-628 started with a
|
|
120
|
+
* read: `bridge role list` was believed to describe the local app and described
|
|
121
|
+
* production, and nothing in the output said otherwise. A banner that only
|
|
122
|
+
* appears on writes would not have prevented it, because the wrong belief was
|
|
123
|
+
* already formed by then.
|
|
124
|
+
*
|
|
125
|
+
* stderr, so stdout stays pure JSON for the agents and scripts that parse it.
|
|
126
|
+
* Suppress with `BRIDGE_NO_BANNER=true` — for the one caller who is already
|
|
127
|
+
* certain and is merging the two streams.
|
|
128
|
+
*/
|
|
129
|
+
function writeContextBanner(ctx) {
|
|
130
|
+
if (process.env.BRIDGE_NO_BANNER === 'true')
|
|
131
|
+
return;
|
|
132
|
+
const { creds, source, baseUrl, selector } = ctx;
|
|
133
|
+
const who = creds
|
|
134
|
+
? `${creds.label ?? creds.app.name} (${creds.app.id})`
|
|
135
|
+
: 'BRIDGE_API_KEY (app unknown — the key carries it)';
|
|
136
|
+
const via = source === 'profile'
|
|
137
|
+
? `--profile ${selector}`
|
|
138
|
+
: source === 'env'
|
|
139
|
+
? 'BRIDGE_API_KEY'
|
|
140
|
+
: 'saved default';
|
|
141
|
+
process.stderr.write(`bridge: ${who} · ${baseUrl} · via ${via}\n`);
|
|
142
|
+
// The two env vars that look like a way to retarget the CLI and are not.
|
|
143
|
+
// Saying so here, at the moment they are being ignored, is the whole point:
|
|
144
|
+
// the reported incident was a session that set them and believed them.
|
|
145
|
+
if (source !== 'env' && process.env.BRIDGE_API_KEY?.trim()) {
|
|
146
|
+
process.stderr.write('bridge: BRIDGE_API_KEY is set but IGNORED — the credentials file wins. ' +
|
|
147
|
+
'Use `--profile <label>` to pick a stored app, or `bridge auth logout` to use the key.\n');
|
|
148
|
+
}
|
|
149
|
+
if (process.env.BRIDGE_APP_ID?.trim()) {
|
|
150
|
+
process.stderr.write('bridge: BRIDGE_APP_ID has no effect — the app is carried by the credential itself. ' +
|
|
151
|
+
'Use `--profile <label|app id>` or `BRIDGE_PROFILE` to target another app.\n');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
66
154
|
/**
|
|
67
155
|
* For tests and for `bridge auth logout` / `bridge auth status` — they need
|
|
68
156
|
* to reset the cached client between operations.
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,SAAS,EACT,eAAe,GAEhB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,CAAC,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AAE5D,IAAI,OAAO,GAA4B,IAAI,CAAC;AAE5C;;;;;;GAMG;AACH,IAAI,gBAAgB,GAAkB,IAAI,CAAC;AAE3C,mEAAmE;AACnE,MAAM,UAAU,kBAAkB,CAAC,OAAkC;IACnE,gBAAgB,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC;AAC7C,CAAC;AAED,gEAAgE;AAChE,SAAS,qBAAqB;IAC5B,IAAI,gBAAgB;QAAE,OAAO,gBAAgB,CAAC;IAC9C,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,mBAAmB;IACjC,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAE5B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,MAAM,CA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AG,IAAI,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAA2B;IACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAC/D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,WAAW,CACnB,6FAA6F,CAC9F,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED;;;;GAIG;AACH,SAAS,mBAAmB;IAC1B,IAAI,CAAC;QACH,OAAO,eAAe,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,WAAW,CACnB,oCAAoC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI;YACtF,kEAAkE,CACrE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/credentials.d.ts
CHANGED
|
@@ -20,6 +20,21 @@ export interface StoredCredentials {
|
|
|
20
20
|
/** Optional human-friendly label set via `bridge auth login --label`. */
|
|
21
21
|
label?: string;
|
|
22
22
|
}
|
|
23
|
+
/** Current on-disk shape. See the module docstring for why it is a map. */
|
|
24
|
+
export interface CredentialsFile {
|
|
25
|
+
version: 2;
|
|
26
|
+
/** App id of the credential commands use by default. `null` when empty. */
|
|
27
|
+
active: string | null;
|
|
28
|
+
/** All stored credentials, keyed by `app.id`. */
|
|
29
|
+
credentials: Record<string, StoredCredentials>;
|
|
30
|
+
}
|
|
31
|
+
/** One entry, as `bridge auth status` and the selector logic see it. */
|
|
32
|
+
export interface CredentialEntry {
|
|
33
|
+
/** The map key — always `creds.app.id`. */
|
|
34
|
+
key: string;
|
|
35
|
+
creds: StoredCredentials;
|
|
36
|
+
isActive: boolean;
|
|
37
|
+
}
|
|
23
38
|
/**
|
|
24
39
|
* Returns the absolute path to the credentials file based on the current
|
|
25
40
|
* environment. Does not create directories or files — pure path resolution.
|
|
@@ -37,17 +52,65 @@ export interface StoredCredentials {
|
|
|
37
52
|
*/
|
|
38
53
|
export declare function credentialsPath(): string;
|
|
39
54
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
55
|
+
* Read the whole store, migrating a v1 file in memory. `null` if no file.
|
|
56
|
+
*
|
|
57
|
+
* Throws if the file exists but is unreadable or malformed — a corrupt store is
|
|
58
|
+
* not the same as an absent one, and silently treating it as absent would make
|
|
59
|
+
* `bridge auth status` report "not logged in" to somebody who very much is.
|
|
60
|
+
*/
|
|
61
|
+
export declare function readCredentialsFile(): CredentialsFile | null;
|
|
62
|
+
/**
|
|
63
|
+
* The credential commands act on by default: the active one.
|
|
64
|
+
*
|
|
65
|
+
* Kept with its original name and signature because every existing caller wants
|
|
66
|
+
* exactly this, and because "which credential is in force" is a question with
|
|
67
|
+
* one answer whether the file holds one app or ten.
|
|
42
68
|
*/
|
|
43
69
|
export declare function readCredentials(): StoredCredentials | null;
|
|
70
|
+
/** Every stored credential, active one first, then by app name. */
|
|
71
|
+
export declare function listCredentials(): CredentialEntry[];
|
|
72
|
+
/** Raised when a selector matches nothing, or matches more than one entry. */
|
|
73
|
+
export declare class CredentialSelectorError extends Error {
|
|
74
|
+
constructor(message: string);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Find one stored credential by label, app id, or app name.
|
|
78
|
+
*
|
|
79
|
+
* Label first: users think in environments, not in 24-character object ids, and
|
|
80
|
+
* `--label` exists precisely so they can name one. App id is exact and always
|
|
81
|
+
* works. App name is last because two apps may share one.
|
|
82
|
+
*
|
|
83
|
+
* An ambiguous selector is an ERROR, never a first match. Picking one of two
|
|
84
|
+
* candidate apps silently is the whole failure mode this ticket is about.
|
|
85
|
+
*/
|
|
86
|
+
export declare function findCredential(selector: string): CredentialEntry;
|
|
44
87
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
88
|
+
* Upsert a credential by app id and make it active.
|
|
89
|
+
*
|
|
90
|
+
* Same name and signature as before: `bridge auth login` still ends with one
|
|
91
|
+
* call, and still leaves the app it just authorised in force.
|
|
47
92
|
*/
|
|
48
93
|
export declare function writeCredentials(creds: StoredCredentials): void;
|
|
94
|
+
/** Point the persisted default at an already-stored credential. Offline. */
|
|
95
|
+
export declare function setActiveCredential(key: string): void;
|
|
96
|
+
/** Persist the store atomically with mode 0600, dir 0700. */
|
|
97
|
+
export declare function writeCredentialsFile(file: CredentialsFile): void;
|
|
49
98
|
/**
|
|
50
|
-
* Deletes the
|
|
99
|
+
* Remove ONE credential. Deletes the file entirely when it was the last.
|
|
100
|
+
*
|
|
101
|
+
* Returns the remaining count so a caller can tell the user what is left.
|
|
102
|
+
* Removing the active one moves `active` to another entry rather than leaving a
|
|
103
|
+
* dangling pointer — with credentials still stored, "logged out of everything"
|
|
104
|
+
* would be a lie.
|
|
105
|
+
*/
|
|
106
|
+
export declare function removeCredential(key: string): number;
|
|
107
|
+
/** Delete the whole credentials file. No-op if it does not exist. */
|
|
108
|
+
export declare function deleteAllCredentials(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Back-compat alias for the single-app era: remove the active credential.
|
|
111
|
+
*
|
|
112
|
+
* @deprecated Prefer `removeCredential(key)` or `deleteAllCredentials()`, which
|
|
113
|
+
* say which of the two things they do.
|
|
51
114
|
*/
|
|
52
115
|
export declare function deleteCredentials(): void;
|
|
53
116
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AA6CA,MAAM,WAAW,iBAAiB;I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