@dereekb/dbx-cli 13.12.0 → 13.12.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.
@@ -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 TOP_LEVEL_DIRS) {
35
+ for (const dir of discoverTopLevelDirs(workspaceRoot)) {
28
36
  if (result) break;
29
- const base = join(workspaceRoot, dir);
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 TOP_LEVEL_DIRS) {
64
- const base = join(workspaceRoot, dir);
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));
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-cli-lint-cache",
3
- "version": "13.12.0",
3
+ "version": "13.12.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "devDependencies": {
7
- "@dereekb/util": "13.12.0",
7
+ "@dereekb/util": "13.12.2",
8
8
  "eslint": "10.4.0",
9
9
  "yargs": "^18.0.0",
10
10
  "@types/yargs": "^17.0.35"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-cli/manifest-extract",
3
- "version": "13.12.0",
3
+ "version": "13.12.2",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "ts-morph": "^21.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-cli",
3
- "version": "13.12.0",
3
+ "version": "13.12.2",
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.0",
45
- "@dereekb/firebase": "13.12.0",
46
- "@dereekb/nestjs": "13.12.0",
47
- "@dereekb/util": "13.12.0",
44
+ "@dereekb/date": "13.12.2",
45
+ "@dereekb/firebase": "13.12.2",
46
+ "@dereekb/nestjs": "13.12.2",
47
+ "@dereekb/util": "13.12.2",
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; unresolved identifiers fall through as
19
- * the identifier text so callers can still see them in registry output.
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; downstream
90
- * apps that introduce their own role constants can extend the map at the
91
- * loader layer once that becomes a workflow.
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.0",
3
+ "version": "13.12.2",
4
4
  "peerDependencies": {
5
- "@dereekb/date": "13.12.0",
6
- "@dereekb/dbx-cli": "13.12.0",
7
- "@dereekb/firebase": "13.12.0",
8
- "@dereekb/firebase-server/test": "13.12.0",
9
- "@dereekb/model": "13.12.0",
10
- "@dereekb/nestjs": "13.12.0",
11
- "@dereekb/rxjs": "13.12.0",
12
- "@dereekb/util": "13.12.0",
5
+ "@dereekb/date": "13.12.2",
6
+ "@dereekb/dbx-cli": "13.12.2",
7
+ "@dereekb/firebase": "13.12.2",
8
+ "@dereekb/firebase-server/test": "13.12.2",
9
+ "@dereekb/model": "13.12.2",
10
+ "@dereekb/nestjs": "13.12.2",
11
+ "@dereekb/rxjs": "13.12.2",
12
+ "@dereekb/util": "13.12.2",
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;