@dereekb/dbx-cli 13.12.0 → 13.12.1
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/firebase-api-manifest/package.json +1 -1
- package/generate-firestore-indexes/main.js +1 -1
- package/generate-firestore-indexes/package.json +1 -1
- package/generate-mcp-manifest/main.js +1314 -0
- package/generate-mcp-manifest/package.json +6 -0
- package/index.cjs.js +655 -275
- package/index.esm.js +655 -275
- package/lint-cache/main.js +13 -9
- package/lint-cache/package.json +2 -2
- package/manifest-extract/package.json +1 -1
- package/package.json +5 -5
- package/src/lib/mcp-scan/scan/auth-extract.d.ts +12 -5
- package/test/package.json +9 -9
- package/generate-mcp-manifest/src/generate-mcp-manifest/main.d.ts +0 -26
- package/generate-mcp-manifest/src/generate-mcp-manifest/render.d.ts +0 -38
package/lint-cache/main.js
CHANGED
|
@@ -20,15 +20,21 @@ import { join as join2 } from "node:path";
|
|
|
20
20
|
// packages/dbx-cli/lint-cache/src/project-lookup.ts
|
|
21
21
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
22
22
|
import { join, relative } from "node:path";
|
|
23
|
-
var TOP_LEVEL_DIRS = ["apps", "packages", "tools"];
|
|
24
23
|
var SKIP_DIR_NAMES = /* @__PURE__ */ new Set(["node_modules", "dist", "coverage", ".nx", ".angular", ".next"]);
|
|
24
|
+
function discoverTopLevelDirs(workspaceRoot) {
|
|
25
|
+
let dirs;
|
|
26
|
+
try {
|
|
27
|
+
dirs = readdirSync(workspaceRoot, { withFileTypes: true }).filter((e) => e.isDirectory() && !SKIP_DIR_NAMES.has(e.name) && !e.name.startsWith(".")).map((e) => e.name).sort((a, b) => a.localeCompare(b));
|
|
28
|
+
} catch {
|
|
29
|
+
dirs = [];
|
|
30
|
+
}
|
|
31
|
+
return dirs;
|
|
32
|
+
}
|
|
25
33
|
function findProject(workspaceRoot, projectName) {
|
|
26
34
|
let result = null;
|
|
27
|
-
for (const dir of
|
|
35
|
+
for (const dir of discoverTopLevelDirs(workspaceRoot)) {
|
|
28
36
|
if (result) break;
|
|
29
|
-
|
|
30
|
-
if (!existsSync(base)) continue;
|
|
31
|
-
result = walkForProject(workspaceRoot, base, projectName);
|
|
37
|
+
result = walkForProject(workspaceRoot, join(workspaceRoot, dir), projectName);
|
|
32
38
|
}
|
|
33
39
|
if (!result) {
|
|
34
40
|
const rootProject = readProjectJson(join(workspaceRoot, "project.json"));
|
|
@@ -60,10 +66,8 @@ function walkForProject(workspaceRoot, dir, projectName) {
|
|
|
60
66
|
}
|
|
61
67
|
function listProjects(workspaceRoot) {
|
|
62
68
|
const out = [];
|
|
63
|
-
for (const dir of
|
|
64
|
-
|
|
65
|
-
if (!existsSync(base)) continue;
|
|
66
|
-
collectProjects(workspaceRoot, base, out);
|
|
69
|
+
for (const dir of discoverTopLevelDirs(workspaceRoot)) {
|
|
70
|
+
collectProjects(workspaceRoot, join(workspaceRoot, dir), out);
|
|
67
71
|
}
|
|
68
72
|
const rootProject = readProjectJson(join(workspaceRoot, "project.json"));
|
|
69
73
|
if (rootProject) out.push(toProjectInfo(workspaceRoot, workspaceRoot, rootProject));
|
package/lint-cache/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli-lint-cache",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"@dereekb/util": "13.12.
|
|
7
|
+
"@dereekb/util": "13.12.1",
|
|
8
8
|
"eslint": "10.4.0",
|
|
9
9
|
"yargs": "^18.0.0",
|
|
10
10
|
"@types/yargs": "^17.0.35"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"bin": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@dereekb/date": "13.12.
|
|
45
|
-
"@dereekb/firebase": "13.12.
|
|
46
|
-
"@dereekb/nestjs": "13.12.
|
|
47
|
-
"@dereekb/util": "13.12.
|
|
44
|
+
"@dereekb/date": "13.12.1",
|
|
45
|
+
"@dereekb/firebase": "13.12.1",
|
|
46
|
+
"@dereekb/nestjs": "13.12.1",
|
|
47
|
+
"@dereekb/util": "13.12.1",
|
|
48
48
|
"arktype": "^2.2.0",
|
|
49
49
|
"ts-morph": "^21.0.0",
|
|
50
50
|
"yargs": "^18.0.0"
|
|
@@ -15,8 +15,13 @@
|
|
|
15
15
|
* The extractor is intentionally syntactic — no type checker calls — so it
|
|
16
16
|
* runs cheaply on in-memory fixtures and the demo's `claims.ts`. Role
|
|
17
17
|
* constants like `AUTH_ADMIN_ROLE` are resolved through the supplied
|
|
18
|
-
* {@link AuthExtractKnownRoles} map
|
|
19
|
-
* the
|
|
18
|
+
* {@link AuthExtractKnownRoles} map. In addition, role constants declared in
|
|
19
|
+
* the scanned source itself (an `export const WORKER_ROLE = 'worker'`, or an
|
|
20
|
+
* `export const ALL_ADMIN_ROLES = [...]` aggregate) are resolved by reading
|
|
21
|
+
* their `StringLiteral` / `ArrayLiteralExpression` initializers — built-ins
|
|
22
|
+
* always win on conflict. Identifiers that still can't be resolved fall
|
|
23
|
+
* through as the identifier text so callers can still see them in registry
|
|
24
|
+
* output (and emit an `unresolved-role-const` warning).
|
|
20
25
|
*/
|
|
21
26
|
import { type Project } from 'ts-morph';
|
|
22
27
|
import type { AuthClaimRoleMappingInfo } from '../registry/auth-runtime.js';
|
|
@@ -86,9 +91,11 @@ export type AuthExtractWarning = {
|
|
|
86
91
|
};
|
|
87
92
|
/**
|
|
88
93
|
* Map from role-constant name (e.g. `AUTH_ADMIN_ROLE`) to its resolved
|
|
89
|
-
* role string (`'admin'`). The built-in roles populate this
|
|
90
|
-
*
|
|
91
|
-
*
|
|
94
|
+
* role string (`'admin'`). The built-in roles populate this. Role consts an
|
|
95
|
+
* app declares in its own scanned source are resolved automatically by
|
|
96
|
+
* {@link extractAuthEntries} (string-literal consts are merged into this map,
|
|
97
|
+
* array-aggregate consts are flattened on demand) — built-ins always win on
|
|
98
|
+
* conflict so a downstream file can never shadow a `@dereekb/util` role.
|
|
92
99
|
*/
|
|
93
100
|
export type AuthExtractKnownRoles = ReadonlyMap<string, string>;
|
|
94
101
|
/**
|
package/test/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli/test",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/date": "13.12.
|
|
6
|
-
"@dereekb/dbx-cli": "13.12.
|
|
7
|
-
"@dereekb/firebase": "13.12.
|
|
8
|
-
"@dereekb/firebase-server/test": "13.12.
|
|
9
|
-
"@dereekb/model": "13.12.
|
|
10
|
-
"@dereekb/nestjs": "13.12.
|
|
11
|
-
"@dereekb/rxjs": "13.12.
|
|
12
|
-
"@dereekb/util": "13.12.
|
|
5
|
+
"@dereekb/date": "13.12.1",
|
|
6
|
+
"@dereekb/dbx-cli": "13.12.1",
|
|
7
|
+
"@dereekb/firebase": "13.12.1",
|
|
8
|
+
"@dereekb/firebase-server/test": "13.12.1",
|
|
9
|
+
"@dereekb/model": "13.12.1",
|
|
10
|
+
"@dereekb/nestjs": "13.12.1",
|
|
11
|
+
"@dereekb/rxjs": "13.12.1",
|
|
12
|
+
"@dereekb/util": "13.12.1",
|
|
13
13
|
"@nestjs/common": "^11.1.19",
|
|
14
14
|
"arktype": "^2.2.0",
|
|
15
15
|
"yargs": "^18.0.0"
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a pre-rendered MCP manifest JSON file from a generated CliApiManifest.
|
|
3
|
-
*
|
|
4
|
-
* Pipeline (build-time, run via `nx run <demo-api>:generate-mcp-manifest`):
|
|
5
|
-
*
|
|
6
|
-
* 1. Load the TS module passed via `--input`, expecting either an `<X>_API_MANIFEST`
|
|
7
|
-
* named export or a default export typed as `CliApiManifest`. The file is loaded
|
|
8
|
-
* via dynamic `import()` so it must compile under ESM — same as the demo-cli
|
|
9
|
-
* manifests written by `dbx-cli-generate-firebase-api-manifest`.
|
|
10
|
-
* 2. Run the pure {@link renderMcpManifest} renderer to pre-merge descriptions,
|
|
11
|
-
* enrich the input JSON Schema with `paramsFields[]` descriptions, and
|
|
12
|
-
* synthesize an `outputSchema` from `resultFields[]`.
|
|
13
|
-
* 3. Write the result to `<output>.tmp`, then `fs.renameSync` to `<output>` so
|
|
14
|
-
* partial files never land on disk.
|
|
15
|
-
*
|
|
16
|
-
* Flags:
|
|
17
|
-
* --input=<path> (required) path to the *.api.manifest.generated.ts file.
|
|
18
|
-
* Absolute or workspace-relative.
|
|
19
|
-
* --output=<path> (required) destination JSON path (workspace-relative ok).
|
|
20
|
-
* --regenerate-input Reserved for a future revision that will invoke
|
|
21
|
-
* `dbx-cli-generate-firebase-api-manifest` first when the
|
|
22
|
-
* input file is missing. Today this flag is accepted but
|
|
23
|
-
* not honored; missing inputs still fail with a clear
|
|
24
|
-
* pointer to the right manifest target.
|
|
25
|
-
*/
|
|
26
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type AuthRegistry, type CliApiManifest, type CliModelManifest, type McpManifest } from '@dereekb/dbx-cli';
|
|
2
|
-
/**
|
|
3
|
-
* Inputs to {@link renderMcpManifest}.
|
|
4
|
-
*/
|
|
5
|
-
export interface RenderMcpManifestInput {
|
|
6
|
-
/**
|
|
7
|
-
* Generated API manifest used to render tool entries.
|
|
8
|
-
*/
|
|
9
|
-
readonly apiManifest: CliApiManifest;
|
|
10
|
-
/**
|
|
11
|
-
* Optional generated model manifest. When present, projects each entry into
|
|
12
|
-
* the runtime {@link McpManifestModelEntry} shape and emits a `models` array
|
|
13
|
-
* on the output JSON for the runtime's built-in catalog tools.
|
|
14
|
-
*/
|
|
15
|
-
readonly modelManifest?: CliModelManifest;
|
|
16
|
-
/**
|
|
17
|
-
* Optional auth registry + primary-app slug used to project the runtime
|
|
18
|
-
* `auth` section on the manifest. The renderer filters entries to the
|
|
19
|
-
* primary app's claim catalog (inherited claims like `fr` are included
|
|
20
|
-
* via the app's `claimKeys` list).
|
|
21
|
-
*/
|
|
22
|
-
readonly auth?: {
|
|
23
|
-
readonly registry: AuthRegistry;
|
|
24
|
-
readonly app: string;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Pure renderer: turns a {@link CliApiManifest} (and optional {@link CliModelManifest})
|
|
29
|
-
* into the {@link McpManifest} JSON shape.
|
|
30
|
-
*
|
|
31
|
-
* No file I/O — the main entry handles writing. Skips `verb === 'standalone'` entries
|
|
32
|
-
* (they aren't dispatched through callModel and have no MCP tool counterpart).
|
|
33
|
-
*
|
|
34
|
-
* @param input - The render config carrying the API manifest and optional model manifest.
|
|
35
|
-
* @param now - Override for the `generatedAt` timestamp. Tests pass a fixed value.
|
|
36
|
-
* @returns The rendered MCP manifest with tools keyed by {@link mcpManifestKey} and an optional models array.
|
|
37
|
-
*/
|
|
38
|
-
export declare function renderMcpManifest(input: RenderMcpManifestInput, now?: Date): McpManifest;
|