@dereekb/dbx-cli 13.13.0 → 13.15.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.
@@ -123,6 +123,12 @@ export interface CliModelManifestEntry {
123
123
  * Persisted-field metadata in source order.
124
124
  */
125
125
  readonly fields: readonly CliModelField[];
126
+ /**
127
+ * Per-model override of the MCP tool-name model segment, from `@dbxModelMcpToolNameSegment
128
+ * <segment>` on the model interface. When present it replaces the model type in generated tool
129
+ * names (e.g. the collection prefix). Absent when the model omits the tag.
130
+ */
131
+ readonly mcpToolNameSegment?: string;
126
132
  /**
127
133
  * Read posture declared by `@dbxModelRead <level>` on the model interface. Closed enum:
128
134
  * `system` / `owner` / `admin-only` / `permissions`. Absent when the model interface omits the tag.
@@ -181,6 +187,21 @@ export interface CliApiManifestEntry {
181
187
  * Per-field result descriptions read from the result interface's property JSDocs.
182
188
  */
183
189
  readonly resultFields?: readonly CliApiManifestField[];
190
+ /**
191
+ * Name of the MCP-mapped result interface declared via the `@dbxModelApiMcpResult <TypeName>`
192
+ * JSDoc tag on the CRUD leaf. Present only when a handler remaps its success result for MCP.
193
+ */
194
+ readonly mcpResultTypeName?: string;
195
+ /**
196
+ * Description from the MCP-mapped result interface's own JSDoc. The MCP manifest renderer prefers
197
+ * this over {@link resultTypeDescription} when building the tool output schema.
198
+ */
199
+ readonly mcpResultTypeDescription?: string;
200
+ /**
201
+ * Per-field descriptions read from the MCP-mapped result interface's property JSDocs. The MCP
202
+ * manifest renderer prefers these over {@link resultFields} when building the tool output schema.
203
+ */
204
+ readonly mcpResultFields?: readonly CliApiManifestField[];
184
205
  }
185
206
  export type CliApiManifest = readonly CliApiManifestEntry[];
186
207
  /**
@@ -210,6 +231,12 @@ export interface McpManifestToolEntry {
210
231
  * JSON Schema synthesized from `resultFields[]` / `resultTypeDescription`. Omitted when both absent.
211
232
  */
212
233
  readonly outputSchema?: object;
234
+ /**
235
+ * Name of the MCP-mapped result interface (from `@dbxModelApiMcpResult`) when the output schema was
236
+ * built from a mapped type. Present iff the source leaf was annotated — the runtime tool generator
237
+ * uses it to detect handlers whose `mapSuccessfulResult` lacks the matching `.api.ts` annotation.
238
+ */
239
+ readonly mcpResultTypeName?: string;
213
240
  }
214
241
  /**
215
242
  * One persisted field on a {@link McpManifestModelEntry}.
@@ -245,6 +272,12 @@ export interface McpManifestModelEntry {
245
272
  readonly sourcePackage: string;
246
273
  readonly sourceFile: string;
247
274
  readonly fields: readonly McpManifestModelField[];
275
+ /**
276
+ * Per-model override of the model segment used in generated MCP tool names (mirror of
277
+ * {@link CliModelManifestEntry.mcpToolNameSegment}). Consumed by the runtime generator and the
278
+ * build-time name validation so both compose the same names.
279
+ */
280
+ readonly mcpToolNameSegment?: string;
248
281
  }
249
282
  /**
250
283
  * One auth claim entry in the pre-rendered MCP manifest JSON. Powers the
@@ -323,3 +356,106 @@ export interface McpManifest {
323
356
  * @returns The canonical `modelType.call.specifier` lookup key, with the default specifier normalized to `_`.
324
357
  */
325
358
  export declare function mcpManifestKey(modelType: string, call: string, specifier?: Maybe<string>): string;
359
+ /**
360
+ * Default specifier key used when a handler is not behind a specifier router.
361
+ *
362
+ * Mirrors `DEFAULT_SPECIFIER_KEY` in `@dereekb/firebase-server/mcp` — kept in sync so the
363
+ * build-time renderer composes the same tool names as the runtime generator.
364
+ */
365
+ export declare const DEFAULT_SPECIFIER_KEY = "_";
366
+ /**
367
+ * Soft limit for an MCP tool name. Mirrors `MCP_TOOL_NAME_WARN_LENGTH` in
368
+ * `@dereekb/firebase-server/mcp`. Names over this are flagged at manifest-generation time.
369
+ */
370
+ export declare const MCP_TOOL_NAME_WARN_LENGTH = 55;
371
+ /**
372
+ * Hard limit for an MCP tool name. Mirrors `MCP_TOOL_NAME_MAX_LENGTH` in
373
+ * `@dereekb/firebase-server/mcp`. Remote MCP clients reject a `tools/list` payload containing any
374
+ * tool whose `name` exceeds this, so manifest generation fails when a name is over the cap.
375
+ */
376
+ export declare const MCP_TOOL_NAME_MAX_LENGTH = 64;
377
+ /**
378
+ * Severity of a tool name's length relative to the soft / hard limits.
379
+ */
380
+ export type McpToolNameLengthLevel = 'ok' | 'warn' | 'error';
381
+ /**
382
+ * The outcome of validating a tool name's length.
383
+ */
384
+ export interface McpToolNameValidation {
385
+ readonly name: string;
386
+ readonly length: number;
387
+ readonly level: McpToolNameLengthLevel;
388
+ }
389
+ /**
390
+ * Builds the MCP tool name for a (modelSegment, callType, specifier) triple.
391
+ *
392
+ * Mirrors `buildMcpToolName` in `@dereekb/firebase-server/mcp` so the build-time manifest validation
393
+ * sees the same names the runtime advertises. The call-type segment is only emitted for the default
394
+ * (`_`) specifier; named specifiers drop it (`worker-syncCheckHqEmployee`).
395
+ *
396
+ * @param modelSegment - The model segment of the name (model type, or a per-model override).
397
+ * @param callType - The call type / verb.
398
+ * @param specifier - The specifier key, or `_` / undefined for the default entry.
399
+ * @returns The hyphen-joined tool name.
400
+ *
401
+ * @example
402
+ * ```ts
403
+ * buildMcpToolName('worker', 'update', 'syncCheckHqEmployee'); // 'worker-syncCheckHqEmployee'
404
+ * ```
405
+ */
406
+ export declare function buildMcpToolName(modelSegment: string, callType: string, specifier?: Maybe<string>): string;
407
+ /**
408
+ * Classifies a tool name's length against the soft/hard MCP name-length limits.
409
+ *
410
+ * Mirrors `validateMcpToolName` in `@dereekb/firebase-server/mcp`.
411
+ *
412
+ * @param name - The fully-resolved tool name.
413
+ * @returns The length classification — `error` over {@link MCP_TOOL_NAME_MAX_LENGTH}, `warn` over
414
+ * {@link MCP_TOOL_NAME_WARN_LENGTH}, otherwise `ok`.
415
+ *
416
+ * @example
417
+ * ```ts
418
+ * validateMcpToolName('worker-create').level; // 'ok'
419
+ * ```
420
+ */
421
+ export declare function validateMcpToolName(name: string): McpToolNameValidation;
422
+ /**
423
+ * Single-character abbreviations for the standard CRUDQ + invoke call types.
424
+ *
425
+ * Mirrors `MCP_CALL_TYPE_ABBREVIATIONS` in `@dereekb/firebase-server/mcp` so the build-time renderer
426
+ * disambiguates colliding names exactly like the runtime generator.
427
+ */
428
+ export declare const MCP_CALL_TYPE_ABBREVIATIONS: Readonly<Record<string, string>>;
429
+ /**
430
+ * Abbreviates a call type for a disambiguated tool name; a custom call type is returned unchanged.
431
+ *
432
+ * Mirrors `abbreviateMcpCallType` in `@dereekb/firebase-server/mcp`.
433
+ *
434
+ * @param callType - The call type / verb.
435
+ * @returns The single-character abbreviation, or the original string for a custom call type.
436
+ *
437
+ * @example
438
+ * ```ts
439
+ * abbreviateMcpCallType('update'); // 'u'
440
+ * ```
441
+ */
442
+ export declare function abbreviateMcpCallType(callType: string): string;
443
+ /**
444
+ * Builds the disambiguated MCP tool name — the form used only when {@link buildMcpToolName} collides
445
+ * with another visible tool. Named specifiers re-insert the abbreviated call type
446
+ * (`worker-u-syncCheckHqEmployee`); default (`_`) specifiers already carry the full call type and are
447
+ * returned unchanged.
448
+ *
449
+ * Mirrors `buildDisambiguatedMcpToolName` in `@dereekb/firebase-server/mcp`.
450
+ *
451
+ * @param modelSegment - The model segment of the name (model type, or a per-model override).
452
+ * @param callType - The call type / verb.
453
+ * @param specifier - The specifier key, or `_` / undefined for the default entry.
454
+ * @returns The hyphen-joined disambiguated tool name.
455
+ *
456
+ * @example
457
+ * ```ts
458
+ * buildDisambiguatedMcpToolName('worker', 'update', 'syncCheckHqEmployee'); // 'worker-u-syncCheckHqEmployee'
459
+ * ```
460
+ */
461
+ export declare function buildDisambiguatedMcpToolName(modelSegment: string, callType: string, specifier?: Maybe<string>): string;
@@ -55,6 +55,13 @@ export declare const DEFAULT_CLI_SECRET_PATTERNS: CliSecretPattern[];
55
55
  * back to the built-in `CliError` / `Error` / unknown branches. Returning `undefined` defers to the defaults.
56
56
  */
57
57
  export type CliErrorMapper = (error: unknown) => Maybe<CliErrorOutput>;
58
+ /**
59
+ * Default per-request HTTP timeout in milliseconds, applied when no explicit `--timeout` is set.
60
+ *
61
+ * Without a default, the HTTP layer's `fetch` waits indefinitely on an unresponsive server, which
62
+ * surfaces as a CLI (or CI test) that hangs forever rather than failing with a clear error.
63
+ */
64
+ export declare const DEFAULT_CLI_HTTP_TIMEOUT_MS = 60000;
58
65
  /**
59
66
  * Configures output options from parsed CLI arguments.
60
67
  *
@@ -105,10 +112,11 @@ export declare function tracedFetch(fetcher: typeof fetch | undefined, input: st
105
112
  /**
106
113
  * Sets the process-wide HTTP timeout (in milliseconds) honored by the HTTP layer.
107
114
  *
108
- * Pass `undefined` to clear. The HTTP helpers thread this into an `AbortController`
109
- * so individual `fetch` calls cancel after the configured duration.
115
+ * The HTTP helpers thread a positive value into an `AbortController` so individual `fetch` calls
116
+ * cancel after the configured duration. `undefined` falls back to {@link DEFAULT_CLI_HTTP_TIMEOUT_MS};
117
+ * `0` (or a negative value) disables the timeout entirely (the request waits indefinitely).
110
118
  *
111
- * @param ms - Timeout in ms, or `undefined` to clear.
119
+ * @param ms - Timeout in ms, `0`/negative to disable, or `undefined` to fall back to the default.
112
120
  */
113
121
  export declare function setCliTimeoutMs(ms: Maybe<number>): void;
114
122
  /**
package/test/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-cli/test",
3
- "version": "13.13.0",
3
+ "version": "13.15.0",
4
4
  "peerDependencies": {
5
- "@dereekb/date": "13.13.0",
6
- "@dereekb/dbx-cli": "13.13.0",
7
- "@dereekb/firebase": "13.13.0",
8
- "@dereekb/firebase-server/test": "13.13.0",
9
- "@dereekb/model": "13.13.0",
10
- "@dereekb/nestjs": "13.13.0",
11
- "@dereekb/rxjs": "13.13.0",
12
- "@dereekb/util": "13.13.0",
5
+ "@dereekb/date": "13.15.0",
6
+ "@dereekb/dbx-cli": "13.15.0",
7
+ "@dereekb/firebase": "13.15.0",
8
+ "@dereekb/firebase-server/test": "13.15.0",
9
+ "@dereekb/model": "13.15.0",
10
+ "@dereekb/nestjs": "13.15.0",
11
+ "@dereekb/rxjs": "13.15.0",
12
+ "@dereekb/util": "13.15.0",
13
13
  "@nestjs/common": "^11.1.19",
14
14
  "arktype": "^2.2.0",
15
15
  "vitest": "4.1.5",