@nebulr-group/bridge-cli 0.4.0 → 0.4.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.md +60 -12
- package/dist/auth/scopes.d.ts +30 -0
- package/dist/auth/scopes.d.ts.map +1 -0
- package/dist/auth/scopes.js +39 -0
- package/dist/auth/scopes.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/auth/login.command.d.ts +2 -0
- package/dist/commands/auth/login.command.d.ts.map +1 -1
- package/dist/commands/auth/login.command.js +4 -1
- package/dist/commands/auth/login.command.js.map +1 -1
- package/dist/commands/flag.command.d.ts.map +1 -1
- package/dist/commands/flag.command.js +32 -21
- package/dist/commands/flag.command.js.map +1 -1
- package/dist/commands/guide.command.js +4 -5
- package/dist/commands/guide.command.js.map +1 -1
- package/dist/commands/integrate.command.d.ts.map +1 -1
- package/dist/commands/integrate.command.js +4 -4
- package/dist/commands/integrate.command.js.map +1 -1
- package/dist/commands/privilege.command.d.ts +16 -0
- package/dist/commands/privilege.command.d.ts.map +1 -0
- package/dist/commands/privilege.command.js +86 -0
- package/dist/commands/privilege.command.js.map +1 -0
- package/dist/commands/role.command.d.ts.map +1 -1
- package/dist/commands/role.command.js +28 -11
- package/dist/commands/role.command.js.map +1 -1
- package/dist/commands/tenant.command.d.ts.map +1 -1
- package/dist/commands/tenant.command.js +30 -11
- package/dist/commands/tenant.command.js.map +1 -1
- package/dist/commands/token.command.d.ts.map +1 -1
- package/dist/commands/token.command.js +7 -4
- package/dist/commands/token.command.js.map +1 -1
- package/dist/commands/user.command.d.ts.map +1 -1
- package/dist/commands/user.command.js +17 -10
- package/dist/commands/user.command.js.map +1 -1
- package/dist/output.d.ts +6 -0
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +41 -1
- package/dist/output.js.map +1 -1
- package/dist/prompt-urls.d.ts +31 -0
- package/dist/prompt-urls.d.ts.map +1 -0
- package/dist/prompt-urls.js +35 -0
- package/dist/prompt-urls.js.map +1 -0
- package/dist/resolve.d.ts +97 -0
- package/dist/resolve.d.ts.map +1 -0
- package/dist/resolve.js +233 -0
- package/dist/resolve.js.map +1 -0
- package/package.json +2 -2
package/dist/output.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HttpError } from '@nebulr-group/bridge-auth-core';
|
|
2
2
|
import { ConfigError } from './config.js';
|
|
3
|
+
import { ADMIN_SCOPE_PRIVILEGES } from './auth/scopes.js';
|
|
3
4
|
export function outputSuccess(data) {
|
|
4
5
|
const output = { success: true, data };
|
|
5
6
|
process.stdout.write(JSON.stringify(output, null, 2) + '\n');
|
|
@@ -14,10 +15,26 @@ export function outputSuccess(data) {
|
|
|
14
15
|
export function outputPrompt(content) {
|
|
15
16
|
process.stdout.write(content.endsWith('\n') ? content : content + '\n');
|
|
16
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Turn "Privilege 'TOKEN_WRITE' required" into something the reader can act
|
|
20
|
+
* on. Without this the message is a dead end: it names a privilege but not how
|
|
21
|
+
* to obtain one, and the answer ("log in again, differently") is not guessable.
|
|
22
|
+
*/
|
|
23
|
+
export function privilegeHint(message) {
|
|
24
|
+
const match = /Privilege '([A-Z_]+)' required/.exec(message);
|
|
25
|
+
const privilege = match?.[1];
|
|
26
|
+
if (!privilege || !ADMIN_SCOPE_PRIVILEGES.has(privilege))
|
|
27
|
+
return undefined;
|
|
28
|
+
return (`Your login token does not carry ${privilege}. ` +
|
|
29
|
+
'Re-authenticate with `bridge auth login --admin` to request delete authority ' +
|
|
30
|
+
'and the ability to create API tokens. The default login deliberately omits ' +
|
|
31
|
+
'them — the token is stored on disk and lives for 10 days.');
|
|
32
|
+
}
|
|
17
33
|
export function outputError(error) {
|
|
18
34
|
let code = 'UNKNOWN_ERROR';
|
|
19
35
|
let message = 'An unknown error occurred';
|
|
20
36
|
let details = undefined;
|
|
37
|
+
let hint;
|
|
21
38
|
let exitCode = 1;
|
|
22
39
|
if (error instanceof ConfigError) {
|
|
23
40
|
code = 'CONFIG_ERROR';
|
|
@@ -33,11 +50,34 @@ export function outputError(error) {
|
|
|
33
50
|
if (typeof error.body === 'object' && error.body && 'nblocksCode' in error.body) {
|
|
34
51
|
code = error.body.nblocksCode;
|
|
35
52
|
}
|
|
53
|
+
if (error.status === 403) {
|
|
54
|
+
// The server's message is the authoritative one; check the body too,
|
|
55
|
+
// since the privilege name sometimes only appears there.
|
|
56
|
+
const bodyMessage = typeof error.body === 'object' && error.body && 'message' in error.body
|
|
57
|
+
? String(error.body.message)
|
|
58
|
+
: '';
|
|
59
|
+
hint = privilegeHint(message) ?? privilegeHint(bodyMessage);
|
|
60
|
+
}
|
|
36
61
|
}
|
|
37
62
|
else if (error instanceof Error) {
|
|
38
63
|
message = error.message;
|
|
64
|
+
// TBP-586: errors that carry their own machine-readable `code` (e.g.
|
|
65
|
+
// ResolveError's FLAG_NOT_FOUND / TENANT_AMBIGUOUS / INVALID_OPTIONS)
|
|
66
|
+
// report it instead of collapsing to UNKNOWN_ERROR.
|
|
67
|
+
const carried = error.code;
|
|
68
|
+
if (typeof carried === 'string' && carried.length > 0) {
|
|
69
|
+
code = carried;
|
|
70
|
+
}
|
|
39
71
|
}
|
|
40
|
-
const output = {
|
|
72
|
+
const output = {
|
|
73
|
+
success: false,
|
|
74
|
+
error: {
|
|
75
|
+
code,
|
|
76
|
+
message,
|
|
77
|
+
...(hint !== undefined ? { hint } : {}),
|
|
78
|
+
...(details !== undefined ? { details } : {}),
|
|
79
|
+
},
|
|
80
|
+
};
|
|
41
81
|
process.stderr.write(JSON.stringify(output, null, 2) + '\n');
|
|
42
82
|
process.exitCode = exitCode;
|
|
43
83
|
}
|
package/dist/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gC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AG,KAAK,CAAC,OAAO,CAAC;QACxB,qEAAqE;QACrE,sEAAsE;QACtE,oDAAoD;QACpD,MAAM,OAAO,GAAI,KAA4B,CAAC,IAAI,CAAC;QACnD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtD,IAAI,GAAG,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE;YACL,IAAI;YACJ,OAAO;YACP,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvC,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9C;KACF,CAAC;IACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC7D,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for every raw.githubusercontent.com URL the CLI builds.
|
|
3
|
+
*
|
|
4
|
+
* TBP-585: `bridge integrate` and `bridge guide` each hardcoded their own copy
|
|
5
|
+
* of the base URL and drifted — integrate pointed at the wrong GitHub org
|
|
6
|
+
* (`nebulr-group`) *and* the wrong path (missing the nested package dir), so its
|
|
7
|
+
* remote fallback was a permanent 404. The fallback is invisible in normal use
|
|
8
|
+
* (an installed CLI reads the bundled prompt first), which is exactly why it
|
|
9
|
+
* must be derived rather than retyped.
|
|
10
|
+
*
|
|
11
|
+
* Nothing outside this module should contain a raw.githubusercontent literal;
|
|
12
|
+
* `src/__tests__/prompt-urls.test.ts` enforces that.
|
|
13
|
+
*/
|
|
14
|
+
/** GitHub org that owns every Bridge repo the CLI reads content from. */
|
|
15
|
+
export declare const GITHUB_RAW_BASE_URL = "https://raw.githubusercontent.com/thebridgedev";
|
|
16
|
+
/**
|
|
17
|
+
* The published npm package lives in a `bridge-cli/` subdirectory of the
|
|
18
|
+
* `bridge-cli` repo — hence the doubled segment. Dropping it yields a 404.
|
|
19
|
+
*/
|
|
20
|
+
export declare const CLI_PROMPTS_BASE_URL = "https://raw.githubusercontent.com/thebridgedev/bridge-cli/main/bridge-cli/prompts";
|
|
21
|
+
/** URL of a prompt bundled in this repo, e.g. cliPromptUrl('flags', 'master.md'). */
|
|
22
|
+
export declare function cliPromptUrl(...segments: string[]): string;
|
|
23
|
+
/**
|
|
24
|
+
* URL of a per-framework prompt owned by a plugin repo. `repoPrefix` is the
|
|
25
|
+
* `<repo>/<ref>` pair from GUIDE_REPOS, e.g. `bridge-svelte/main`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function pluginGuideUrl(repoPrefix: string, filename: string): string;
|
|
28
|
+
/** Master auth integration prompt — shared by `bridge integrate` and `bridge guide`. */
|
|
29
|
+
export declare const AUTH_MASTER_PROMPT_FILENAME = "auth-master-integration-prompt.md";
|
|
30
|
+
export declare const AUTH_MASTER_PROMPT_URL: string;
|
|
31
|
+
//# sourceMappingURL=prompt-urls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-urls.d.ts","sourceRoot":"","sources":["../src/prompt-urls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,yEAAyE;AACzE,eAAO,MAAM,mBAAmB,mDAAmD,CAAC;AAEpF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,sFAA8D,CAAC;AAEhG,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAE1D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED,wFAAwF;AACxF,eAAO,MAAM,2BAA2B,sCAAsC,CAAC;AAC/E,eAAO,MAAM,sBAAsB,QAA4C,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for every raw.githubusercontent.com URL the CLI builds.
|
|
3
|
+
*
|
|
4
|
+
* TBP-585: `bridge integrate` and `bridge guide` each hardcoded their own copy
|
|
5
|
+
* of the base URL and drifted — integrate pointed at the wrong GitHub org
|
|
6
|
+
* (`nebulr-group`) *and* the wrong path (missing the nested package dir), so its
|
|
7
|
+
* remote fallback was a permanent 404. The fallback is invisible in normal use
|
|
8
|
+
* (an installed CLI reads the bundled prompt first), which is exactly why it
|
|
9
|
+
* must be derived rather than retyped.
|
|
10
|
+
*
|
|
11
|
+
* Nothing outside this module should contain a raw.githubusercontent literal;
|
|
12
|
+
* `src/__tests__/prompt-urls.test.ts` enforces that.
|
|
13
|
+
*/
|
|
14
|
+
/** GitHub org that owns every Bridge repo the CLI reads content from. */
|
|
15
|
+
export const GITHUB_RAW_BASE_URL = 'https://raw.githubusercontent.com/thebridgedev';
|
|
16
|
+
/**
|
|
17
|
+
* The published npm package lives in a `bridge-cli/` subdirectory of the
|
|
18
|
+
* `bridge-cli` repo — hence the doubled segment. Dropping it yields a 404.
|
|
19
|
+
*/
|
|
20
|
+
export const CLI_PROMPTS_BASE_URL = `${GITHUB_RAW_BASE_URL}/bridge-cli/main/bridge-cli/prompts`;
|
|
21
|
+
/** URL of a prompt bundled in this repo, e.g. cliPromptUrl('flags', 'master.md'). */
|
|
22
|
+
export function cliPromptUrl(...segments) {
|
|
23
|
+
return [CLI_PROMPTS_BASE_URL, ...segments].join('/');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* URL of a per-framework prompt owned by a plugin repo. `repoPrefix` is the
|
|
27
|
+
* `<repo>/<ref>` pair from GUIDE_REPOS, e.g. `bridge-svelte/main`.
|
|
28
|
+
*/
|
|
29
|
+
export function pluginGuideUrl(repoPrefix, filename) {
|
|
30
|
+
return `${GITHUB_RAW_BASE_URL}/${repoPrefix}/mcp/${filename}`;
|
|
31
|
+
}
|
|
32
|
+
/** Master auth integration prompt — shared by `bridge integrate` and `bridge guide`. */
|
|
33
|
+
export const AUTH_MASTER_PROMPT_FILENAME = 'auth-master-integration-prompt.md';
|
|
34
|
+
export const AUTH_MASTER_PROMPT_URL = cliPromptUrl(AUTH_MASTER_PROMPT_FILENAME);
|
|
35
|
+
//# sourceMappingURL=prompt-urls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-urls.js","sourceRoot":"","sources":["../src/prompt-urls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,mBAAmB,GAAG,gDAAgD,CAAC;AAEpF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,mBAAmB,qCAAqC,CAAC;AAEhG,qFAAqF;AACrF,MAAM,UAAU,YAAY,CAAC,GAAG,QAAkB;IAChD,OAAO,CAAC,oBAAoB,EAAE,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,UAAkB,EAAE,QAAgB;IACjE,OAAO,GAAG,mBAAmB,IAAI,UAAU,QAAQ,QAAQ,EAAE,CAAC;AAChE,CAAC;AAED,wFAAwF;AACxF,MAAM,CAAC,MAAM,2BAA2B,GAAG,mCAAmC,CAAC;AAC/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,YAAY,CAAC,2BAA2B,CAAC,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error carrying a stable machine-readable `code`, so `outputError` can emit
|
|
3
|
+
* something better than UNKNOWN_ERROR for resolution failures.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ResolveError extends Error {
|
|
6
|
+
readonly code: string;
|
|
7
|
+
constructor(code: string, message: string);
|
|
8
|
+
}
|
|
9
|
+
export interface ResolveSpec<T> {
|
|
10
|
+
/** Capitalised singular noun used in messages, e.g. `'Flag'`. */
|
|
11
|
+
noun: string;
|
|
12
|
+
/** Flag the user types to address by id, e.g. `'--id'` or `'--user-id'`. */
|
|
13
|
+
idOption: string;
|
|
14
|
+
/** Flag the user types to address by key, e.g. `'--key'`, `'--email'`. */
|
|
15
|
+
keyOption: string;
|
|
16
|
+
/** What the key option holds, in prose: `'key'`, `'name'`, `'email'`. */
|
|
17
|
+
keyLabel: string;
|
|
18
|
+
/** Command that lists the candidates, e.g. `'bridge flag list'`. */
|
|
19
|
+
listCommand: string;
|
|
20
|
+
/** Fetches every candidate. Only called when resolving by key. */
|
|
21
|
+
list: () => Promise<T[]>;
|
|
22
|
+
idOf: (item: T) => string;
|
|
23
|
+
/** The item's key; `undefined` when the item has none (skipped in matching). */
|
|
24
|
+
keyOf: (item: T) => string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Comparison normaliser. Defaults to identity (exact, case-sensitive).
|
|
27
|
+
* Emails pass `(s) => s.toLowerCase()`.
|
|
28
|
+
*/
|
|
29
|
+
normalize?: (value: string) => string;
|
|
30
|
+
/** One-line rendering of a candidate, used in the ambiguity error. */
|
|
31
|
+
describe?: (item: T) => string;
|
|
32
|
+
}
|
|
33
|
+
export interface ResolveTarget {
|
|
34
|
+
id?: string;
|
|
35
|
+
key?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Turn `{ id }` or `{ key }` into an id.
|
|
39
|
+
*
|
|
40
|
+
* - both supplied → INVALID_OPTIONS
|
|
41
|
+
* - neither → INVALID_OPTIONS, naming both options
|
|
42
|
+
* - id supplied → returned as-is (no network call)
|
|
43
|
+
* - key supplied → one `list()` call, then exact-match on the key
|
|
44
|
+
* - 0 matches → `<NOUN>_NOT_FOUND`, naming the list command
|
|
45
|
+
* - >1 matches → `<NOUN>_AMBIGUOUS`, listing every candidate. Nothing acts.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveResourceId<T>(target: ResolveTarget, spec: ResolveSpec<T>): Promise<string>;
|
|
48
|
+
/** `bridge flag …` — flag keys are unique. */
|
|
49
|
+
export declare function resolveFlagId(target: ResolveTarget): Promise<string>;
|
|
50
|
+
/** `bridge role …` — role keys are unique (e.g. ADMIN). */
|
|
51
|
+
export declare function resolveRoleId(target: ResolveTarget): Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* `bridge tenant …` — tenants have NO key field. `name` is optional and the
|
|
54
|
+
* platform does not enforce uniqueness on it, so a duplicate name is a real
|
|
55
|
+
* possibility and always fails loudly rather than picking one.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveTenantIdByName(target: ResolveTarget): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* `bridge user …` — users have no key either; email is the natural
|
|
60
|
+
* human-readable identifier and is unique within a tenant. Matched
|
|
61
|
+
* case-insensitively, as email addresses are.
|
|
62
|
+
*/
|
|
63
|
+
export declare function resolveUserId(target: ResolveTarget, tenantId: string): Promise<string>;
|
|
64
|
+
/**
|
|
65
|
+
* TBP-592 — turn privilege KEYS into the ids `POST/PUT /account/role` stores.
|
|
66
|
+
*
|
|
67
|
+
* `--privileges` is documented as taking keys, and keys are the only form a
|
|
68
|
+
* human or agent has: they are what `bridge role list` prints and what the app
|
|
69
|
+
* is designed around. But `role.model.ts` types `privileges` as
|
|
70
|
+
* `Types.ObjectId[]` and resolves them with `findByIdsAndApp`, so a key
|
|
71
|
+
* resolved to nothing, the array came back empty, and the model's pre-save
|
|
72
|
+
* hook threw "A role needs at least one privilege".
|
|
73
|
+
*
|
|
74
|
+
* That error is the real cost. It reads as "you passed none" when the truth is
|
|
75
|
+
* "the ones you passed were dropped", and nothing in it points at keys-vs-ids —
|
|
76
|
+
* the only way to find out was to read the model.
|
|
77
|
+
*
|
|
78
|
+
* So: resolve here, and make an unknown identifier a hard failure that NAMES
|
|
79
|
+
* the offenders. Silently dropping one privilege out of ten would create a role
|
|
80
|
+
* that looks right and under-permits, which is worse than any error.
|
|
81
|
+
*
|
|
82
|
+
* Ids are still accepted and passed through untouched. Mixed input works. That
|
|
83
|
+
* keeps `--privileges` honest for scripts that already pass ids, and means no
|
|
84
|
+
* caller has to know which form the API wants.
|
|
85
|
+
*/
|
|
86
|
+
export declare function resolvePrivilegeIds(identifiers: string[]): Promise<string[]>;
|
|
87
|
+
/**
|
|
88
|
+
* `bridge privilege …` — privilege keys are unique within an app, so a key
|
|
89
|
+
* addresses exactly one. Same shape as `resolveRoleId`.
|
|
90
|
+
*/
|
|
91
|
+
export declare function resolvePrivilegeId(target: ResolveTarget): Promise<string>;
|
|
92
|
+
/**
|
|
93
|
+
* `bridge token …` — API tokens have no key; `name` is free text and is NOT
|
|
94
|
+
* enforced unique, so two tokens can legitimately share one.
|
|
95
|
+
*/
|
|
96
|
+
export declare function resolveTokenIdByName(target: ResolveTarget): Promise<string>;
|
|
97
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAkBA;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK1C;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,IAAI,EAAE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AC,MAAM,CAAC,CAYzE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAa3E"}
|
package/dist/resolve.js
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
// TBP-586 — Address resources by their human-readable key, not just by id.
|
|
2
|
+
//
|
|
3
|
+
// Most write commands used to take an opaque `--id` only, which forced every
|
|
4
|
+
// caller (agent or human) to run a `list` first and pair the right id with the
|
|
5
|
+
// right name by hand. This module is the single place that turns a
|
|
6
|
+
// human-readable identifier into an id, so every noun behaves the same way.
|
|
7
|
+
//
|
|
8
|
+
// Semantics mirror the MCP layer's `toggle_feature_flag`
|
|
9
|
+
// (bridge-api/microservices/account/nebulr-api/mcp/tools/flags.ts): list, find
|
|
10
|
+
// by key, act — with two additions the CLI needs:
|
|
11
|
+
//
|
|
12
|
+
// * exactly one of the id option / key option must be supplied, and
|
|
13
|
+
// * a key that matches MORE THAN ONE resource is a hard failure that lists
|
|
14
|
+
// the candidates. Never guess. Silently deleting the wrong tenant because
|
|
15
|
+
// two of them share a name is the worst outcome this module can produce.
|
|
16
|
+
import { getManagementClient } from './config.js';
|
|
17
|
+
/**
|
|
18
|
+
* Error carrying a stable machine-readable `code`, so `outputError` can emit
|
|
19
|
+
* something better than UNKNOWN_ERROR for resolution failures.
|
|
20
|
+
*/
|
|
21
|
+
export class ResolveError extends Error {
|
|
22
|
+
code;
|
|
23
|
+
constructor(code, message) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.name = 'ResolveError';
|
|
26
|
+
this.code = code;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const CODE_SAFE = /[^A-Z0-9]+/g;
|
|
30
|
+
function codeFor(noun, suffix) {
|
|
31
|
+
return `${noun.toUpperCase().replace(CODE_SAFE, '_')}_${suffix}`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Turn `{ id }` or `{ key }` into an id.
|
|
35
|
+
*
|
|
36
|
+
* - both supplied → INVALID_OPTIONS
|
|
37
|
+
* - neither → INVALID_OPTIONS, naming both options
|
|
38
|
+
* - id supplied → returned as-is (no network call)
|
|
39
|
+
* - key supplied → one `list()` call, then exact-match on the key
|
|
40
|
+
* - 0 matches → `<NOUN>_NOT_FOUND`, naming the list command
|
|
41
|
+
* - >1 matches → `<NOUN>_AMBIGUOUS`, listing every candidate. Nothing acts.
|
|
42
|
+
*/
|
|
43
|
+
export async function resolveResourceId(target, spec) {
|
|
44
|
+
const { id, key } = target;
|
|
45
|
+
const hasId = id !== undefined && id !== '';
|
|
46
|
+
const hasKey = key !== undefined && key !== '';
|
|
47
|
+
if (hasId && hasKey) {
|
|
48
|
+
throw new ResolveError('INVALID_OPTIONS', `Pass either ${spec.idOption} or ${spec.keyOption}, not both.`);
|
|
49
|
+
}
|
|
50
|
+
if (!hasId && !hasKey) {
|
|
51
|
+
throw new ResolveError('INVALID_OPTIONS', `Missing target: pass ${spec.idOption} <id> or ${spec.keyOption} <${spec.keyLabel}>. ` +
|
|
52
|
+
`Run \`${spec.listCommand}\` to see existing ${spec.keyLabel}s.`);
|
|
53
|
+
}
|
|
54
|
+
if (hasId)
|
|
55
|
+
return id;
|
|
56
|
+
const normalize = spec.normalize ?? ((v) => v);
|
|
57
|
+
const wanted = normalize(key);
|
|
58
|
+
const items = await spec.list();
|
|
59
|
+
const matches = items.filter((item) => {
|
|
60
|
+
const candidate = spec.keyOf(item);
|
|
61
|
+
return candidate !== undefined && candidate !== null && normalize(candidate) === wanted;
|
|
62
|
+
});
|
|
63
|
+
if (matches.length === 0) {
|
|
64
|
+
throw new ResolveError(codeFor(spec.noun, 'NOT_FOUND'), `${spec.noun} not found: ${key}. Run \`${spec.listCommand}\` to see existing ${spec.keyLabel}s.`);
|
|
65
|
+
}
|
|
66
|
+
if (matches.length > 1) {
|
|
67
|
+
const describe = spec.describe ?? ((item) => `${spec.idOf(item)}`);
|
|
68
|
+
const candidates = matches.map((m) => ` - ${describe(m)}`).join('\n');
|
|
69
|
+
throw new ResolveError(codeFor(spec.noun, 'AMBIGUOUS'), `Ambiguous ${spec.keyLabel} "${key}" — it matches ${matches.length} ` +
|
|
70
|
+
`${spec.noun.toLowerCase()}s:\n${candidates}\n` +
|
|
71
|
+
`Nothing was changed. Re-run with ${spec.idOption} <id> to pick one.`);
|
|
72
|
+
}
|
|
73
|
+
return spec.idOf(matches[0]);
|
|
74
|
+
}
|
|
75
|
+
// ── per-noun resolvers ──────────────────────────────────────────────────────
|
|
76
|
+
//
|
|
77
|
+
// One function per noun so no command hand-rolls a `list().find()`. Each is a
|
|
78
|
+
// thin `resolveResourceId` call describing where that noun's key lives.
|
|
79
|
+
/** `bridge flag …` — flag keys are unique. */
|
|
80
|
+
export function resolveFlagId(target) {
|
|
81
|
+
return resolveResourceId(target, {
|
|
82
|
+
noun: 'Flag',
|
|
83
|
+
idOption: '--id',
|
|
84
|
+
keyOption: '--key',
|
|
85
|
+
keyLabel: 'key',
|
|
86
|
+
listCommand: 'bridge flag list',
|
|
87
|
+
list: () => getManagementClient().flags.list(),
|
|
88
|
+
idOf: (f) => f.id,
|
|
89
|
+
keyOf: (f) => f.key,
|
|
90
|
+
describe: (f) => `${f.key} (id ${f.id})`,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/** `bridge role …` — role keys are unique (e.g. ADMIN). */
|
|
94
|
+
export function resolveRoleId(target) {
|
|
95
|
+
return resolveResourceId(target, {
|
|
96
|
+
noun: 'Role',
|
|
97
|
+
idOption: '--id',
|
|
98
|
+
keyOption: '--key',
|
|
99
|
+
keyLabel: 'key',
|
|
100
|
+
listCommand: 'bridge role list',
|
|
101
|
+
list: () => getManagementClient().roles.list(),
|
|
102
|
+
idOf: (r) => r.id,
|
|
103
|
+
keyOf: (r) => r.key,
|
|
104
|
+
describe: (r) => `${r.key} — ${r.name} (id ${r.id})`,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* `bridge tenant …` — tenants have NO key field. `name` is optional and the
|
|
109
|
+
* platform does not enforce uniqueness on it, so a duplicate name is a real
|
|
110
|
+
* possibility and always fails loudly rather than picking one.
|
|
111
|
+
*/
|
|
112
|
+
export function resolveTenantIdByName(target) {
|
|
113
|
+
return resolveResourceId(target, {
|
|
114
|
+
noun: 'Tenant',
|
|
115
|
+
idOption: '--id',
|
|
116
|
+
keyOption: '--name',
|
|
117
|
+
keyLabel: 'name',
|
|
118
|
+
listCommand: 'bridge tenant list',
|
|
119
|
+
list: () => getManagementClient().tenants.list(),
|
|
120
|
+
idOf: (t) => t.id,
|
|
121
|
+
keyOf: (t) => t.name,
|
|
122
|
+
describe: (t) => `${t.name ?? '(unnamed)'} — id ${t.id}` +
|
|
123
|
+
(t.signupBy?.email ? `, owner ${t.signupBy.email}` : '') +
|
|
124
|
+
(t.createdAt ? `, created ${t.createdAt}` : ''),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* `bridge user …` — users have no key either; email is the natural
|
|
129
|
+
* human-readable identifier and is unique within a tenant. Matched
|
|
130
|
+
* case-insensitively, as email addresses are.
|
|
131
|
+
*/
|
|
132
|
+
export function resolveUserId(target, tenantId) {
|
|
133
|
+
return resolveResourceId(target, {
|
|
134
|
+
noun: 'User',
|
|
135
|
+
idOption: '--user-id',
|
|
136
|
+
keyOption: '--email',
|
|
137
|
+
keyLabel: 'email',
|
|
138
|
+
listCommand: 'bridge user list',
|
|
139
|
+
list: () => getManagementClient().users.list(tenantId),
|
|
140
|
+
idOf: (u) => u.id,
|
|
141
|
+
keyOf: (u) => u.email ?? u.username,
|
|
142
|
+
normalize: (v) => v.toLowerCase(),
|
|
143
|
+
describe: (u) => `${u.email ?? u.username}${u.fullName ? ` — ${u.fullName}` : ''} (id ${u.id})`,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* TBP-592 — turn privilege KEYS into the ids `POST/PUT /account/role` stores.
|
|
148
|
+
*
|
|
149
|
+
* `--privileges` is documented as taking keys, and keys are the only form a
|
|
150
|
+
* human or agent has: they are what `bridge role list` prints and what the app
|
|
151
|
+
* is designed around. But `role.model.ts` types `privileges` as
|
|
152
|
+
* `Types.ObjectId[]` and resolves them with `findByIdsAndApp`, so a key
|
|
153
|
+
* resolved to nothing, the array came back empty, and the model's pre-save
|
|
154
|
+
* hook threw "A role needs at least one privilege".
|
|
155
|
+
*
|
|
156
|
+
* That error is the real cost. It reads as "you passed none" when the truth is
|
|
157
|
+
* "the ones you passed were dropped", and nothing in it points at keys-vs-ids —
|
|
158
|
+
* the only way to find out was to read the model.
|
|
159
|
+
*
|
|
160
|
+
* So: resolve here, and make an unknown identifier a hard failure that NAMES
|
|
161
|
+
* the offenders. Silently dropping one privilege out of ten would create a role
|
|
162
|
+
* that looks right and under-permits, which is worse than any error.
|
|
163
|
+
*
|
|
164
|
+
* Ids are still accepted and passed through untouched. Mixed input works. That
|
|
165
|
+
* keeps `--privileges` honest for scripts that already pass ids, and means no
|
|
166
|
+
* caller has to know which form the API wants.
|
|
167
|
+
*/
|
|
168
|
+
export async function resolvePrivilegeIds(identifiers) {
|
|
169
|
+
const wanted = identifiers.map((v) => v.trim()).filter((v) => v !== '');
|
|
170
|
+
if (wanted.length === 0)
|
|
171
|
+
return [];
|
|
172
|
+
const privileges = await getManagementClient().roles.listPrivileges();
|
|
173
|
+
const byKey = new Map(privileges.map((p) => [p.key, p.id]));
|
|
174
|
+
const knownIds = new Set(privileges.map((p) => p.id));
|
|
175
|
+
const resolved = [];
|
|
176
|
+
const unknown = [];
|
|
177
|
+
for (const identifier of wanted) {
|
|
178
|
+
const id = byKey.get(identifier);
|
|
179
|
+
if (id !== undefined) {
|
|
180
|
+
resolved.push(id);
|
|
181
|
+
}
|
|
182
|
+
else if (knownIds.has(identifier)) {
|
|
183
|
+
resolved.push(identifier); // already an id
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
unknown.push(identifier);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (unknown.length > 0) {
|
|
190
|
+
const available = privileges.map((p) => p.key).sort();
|
|
191
|
+
throw new ResolveError('PRIVILEGE_NOT_FOUND', `Unknown privilege${unknown.length > 1 ? 's' : ''}: ${unknown.join(', ')}.\n` +
|
|
192
|
+
`Nothing was changed. Available privileges: ${available.join(', ') || '(none defined)'}.\n` +
|
|
193
|
+
`Run \`bridge role list\` to see which roles use them.`);
|
|
194
|
+
}
|
|
195
|
+
// De-duplicate: two spellings of the same privilege (its key and its id) must
|
|
196
|
+
// not produce a doubled entry in the stored array.
|
|
197
|
+
return [...new Set(resolved)];
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* `bridge privilege …` — privilege keys are unique within an app, so a key
|
|
201
|
+
* addresses exactly one. Same shape as `resolveRoleId`.
|
|
202
|
+
*/
|
|
203
|
+
export function resolvePrivilegeId(target) {
|
|
204
|
+
return resolveResourceId(target, {
|
|
205
|
+
noun: 'Privilege',
|
|
206
|
+
idOption: '--id',
|
|
207
|
+
keyOption: '--key',
|
|
208
|
+
keyLabel: 'key',
|
|
209
|
+
listCommand: 'bridge privilege list',
|
|
210
|
+
list: () => getManagementClient().roles.listPrivileges(),
|
|
211
|
+
idOf: (p) => p.id,
|
|
212
|
+
keyOf: (p) => p.key,
|
|
213
|
+
describe: (p) => `${p.key}${p.description ? ` — ${p.description}` : ''} (id ${p.id})`,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* `bridge token …` — API tokens have no key; `name` is free text and is NOT
|
|
218
|
+
* enforced unique, so two tokens can legitimately share one.
|
|
219
|
+
*/
|
|
220
|
+
export function resolveTokenIdByName(target) {
|
|
221
|
+
return resolveResourceId(target, {
|
|
222
|
+
noun: 'Token',
|
|
223
|
+
idOption: '--id',
|
|
224
|
+
keyOption: '--name',
|
|
225
|
+
keyLabel: 'name',
|
|
226
|
+
listCommand: 'bridge token list',
|
|
227
|
+
list: () => getManagementClient().tokens.list(),
|
|
228
|
+
idOf: (t) => t.id,
|
|
229
|
+
keyOf: (t) => t.name,
|
|
230
|
+
describe: (t) => `${t.name} — id ${t.id}` + (t.createdAt ? `, created ${t.createdAt}` : ''),
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,mEAAmE;AACnE,4EAA4E;AAC5E,EAAE;AACF,yDAAyD;AACzD,+EAA+E;AAC/E,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAE7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,IAAI,CAAS;IAEtB,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAgCD,MAAM,SAAS,GAAG,aAAa,CAAC;AAEhC,SAAS,OAAO,CAAC,IAAY,EAAE,MAAc;IAC3C,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,MAAM,EAAE,CAAC;AACnE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAqB,EACrB,IAAoB;IAEpB,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAC3B,MAAM,KAAK,GAAG,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;IAC5C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AAO,iBAAiB,CAAC,MAAM,EAAE;QAC/B,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,QAAQ;QACnB,QAAQ,EAAE,MAAM;QAChB,WAAW,EAAE,mBAAmB;QAChC,IAAI,EAAE,GAAG,EAAE,CAAC,mBAAmB,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE;QAC/C,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE;QACjB,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI;QACpB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CACd,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7E,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nebulr-group/bridge-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Bridge platform CLI for AI coding agents and developers",
|
|
5
5
|
"author": "Nebulr Group",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"publish:local": "npm run build && node -e \"const fs=require('fs'),p=JSON.parse(fs.readFileSync('package.json','utf8')),v=p.version.match(/^(\\d+\\.\\d+\\.\\d+)-alpha\\.(\\d+)$/);if(v){p.version=v[1]+'-alpha.'+(+v[2]+1);}else{p.version=p.version+'-alpha.0';}fs.writeFileSync('package.json',JSON.stringify(p,null,' ')+'\\n');console.log('Version bumped to '+p.version);\" && npm publish --registry http://host.docker.internal:4873 --no-git-checks --ignore-scripts && npm dist-tag add @nebulr-group/bridge-cli@$(node -p \"require('./package.json').version\") alpha --registry http://host.docker.internal:4873"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@nebulr-group/bridge-auth-core": "0.4.
|
|
27
|
+
"@nebulr-group/bridge-auth-core": "0.4.4",
|
|
28
28
|
"commander": "^12.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|