@constructive-io/graphql-codegen 4.24.4 → 4.25.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/core/codegen/cli/docs-generator.d.ts +2 -4
- package/core/codegen/cli/docs-generator.js +74 -472
- package/core/codegen/cli/index.d.ts +2 -2
- package/core/codegen/cli/index.js +1 -3
- package/core/codegen/cli/table-command-generator.js +165 -16
- package/core/codegen/docs-utils.d.ts +0 -6
- package/core/codegen/docs-utils.js +3 -4
- package/core/codegen/hooks-docs-generator.d.ts +1 -2
- package/core/codegen/hooks-docs-generator.js +0 -113
- package/core/codegen/orm/docs-generator.d.ts +1 -2
- package/core/codegen/orm/docs-generator.js +0 -126
- package/core/codegen/target-docs-generator.d.ts +1 -2
- package/core/codegen/target-docs-generator.js +0 -13
- package/core/codegen/templates/cli-utils.ts +117 -0
- package/core/codegen/utils.d.ts +2 -2
- package/core/codegen/utils.js +2 -2
- package/core/generate.js +0 -26
- package/esm/core/codegen/cli/docs-generator.d.ts +2 -4
- package/esm/core/codegen/cli/docs-generator.js +75 -471
- package/esm/core/codegen/cli/index.d.ts +2 -2
- package/esm/core/codegen/cli/index.js +1 -1
- package/esm/core/codegen/cli/table-command-generator.js +166 -17
- package/esm/core/codegen/docs-utils.d.ts +0 -6
- package/esm/core/codegen/docs-utils.js +3 -4
- package/esm/core/codegen/hooks-docs-generator.d.ts +1 -2
- package/esm/core/codegen/hooks-docs-generator.js +2 -114
- package/esm/core/codegen/orm/docs-generator.d.ts +1 -2
- package/esm/core/codegen/orm/docs-generator.js +1 -126
- package/esm/core/codegen/target-docs-generator.d.ts +1 -2
- package/esm/core/codegen/target-docs-generator.js +0 -12
- package/esm/core/codegen/utils.d.ts +2 -2
- package/esm/core/codegen/utils.js +2 -2
- package/esm/core/generate.js +4 -30
- package/esm/types/config.d.ts +1 -8
- package/package.json +9 -9
- package/types/config.d.ts +1 -8
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Table, Operation, TypeRegistry } from '../../../types/schema';
|
|
2
|
-
import type { GeneratedDocFile
|
|
2
|
+
import type { GeneratedDocFile } from '../docs-utils';
|
|
3
3
|
export { resolveDocsConfig } from '../docs-utils';
|
|
4
|
-
export type { GeneratedDocFile
|
|
4
|
+
export type { GeneratedDocFile } from '../docs-utils';
|
|
5
5
|
export declare function generateReadme(tables: Table[], customOperations: Operation[], toolName: string, registry?: TypeRegistry): GeneratedDocFile;
|
|
6
6
|
export declare function generateAgentsDocs(tables: Table[], customOperations: Operation[], toolName: string, _registry?: TypeRegistry): GeneratedDocFile;
|
|
7
|
-
export declare function getCliMcpTools(tables: Table[], customOperations: Operation[], toolName: string, registry?: TypeRegistry): McpTool[];
|
|
8
7
|
export declare function generateSkills(tables: Table[], customOperations: Operation[], toolName: string, targetName: string, registry?: TypeRegistry): GeneratedDocFile[];
|
|
9
8
|
export interface MultiTargetDocsInput {
|
|
10
9
|
toolName: string;
|
|
@@ -24,5 +23,4 @@ export interface MultiTargetDocsInput {
|
|
|
24
23
|
}
|
|
25
24
|
export declare function generateMultiTargetReadme(input: MultiTargetDocsInput): GeneratedDocFile;
|
|
26
25
|
export declare function generateMultiTargetAgentsDocs(input: MultiTargetDocsInput): GeneratedDocFile;
|
|
27
|
-
export declare function getMultiTargetCliMcpTools(input: MultiTargetDocsInput): McpTool[];
|
|
28
26
|
export declare function generateMultiTargetSkills(input: MultiTargetDocsInput): GeneratedDocFile[];
|
|
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.resolveDocsConfig = void 0;
|
|
4
4
|
exports.generateReadme = generateReadme;
|
|
5
5
|
exports.generateAgentsDocs = generateAgentsDocs;
|
|
6
|
-
exports.getCliMcpTools = getCliMcpTools;
|
|
7
6
|
exports.generateSkills = generateSkills;
|
|
8
7
|
exports.generateMultiTargetReadme = generateMultiTargetReadme;
|
|
9
8
|
exports.generateMultiTargetAgentsDocs = generateMultiTargetAgentsDocs;
|
|
10
|
-
exports.getMultiTargetCliMcpTools = getMultiTargetCliMcpTools;
|
|
11
9
|
exports.generateMultiTargetSkills = generateMultiTargetSkills;
|
|
12
10
|
const komoji_1 = require("komoji");
|
|
13
11
|
const docs_utils_1 = require("../docs-utils");
|
|
@@ -103,6 +101,12 @@ function generateReadme(tables, customOperations, toolName, registry) {
|
|
|
103
101
|
lines.push('| Subcommand | Description |');
|
|
104
102
|
lines.push('|------------|-------------|');
|
|
105
103
|
lines.push(`| \`list\` | List all ${singularName} records |`);
|
|
104
|
+
lines.push(`| \`find-first\` | Find first matching ${singularName} record |`);
|
|
105
|
+
const readmeSpecialGroups = (0, docs_utils_1.categorizeSpecialFields)(table, registry);
|
|
106
|
+
const readmeHasSearch = readmeSpecialGroups.some((g) => g.category === 'search' || g.category === 'embedding');
|
|
107
|
+
if (readmeHasSearch) {
|
|
108
|
+
lines.push(`| \`search <query>\` | Search ${singularName} records |`);
|
|
109
|
+
}
|
|
106
110
|
lines.push(`| \`get\` | Get a ${singularName} by ${pk.name} |`);
|
|
107
111
|
lines.push(`| \`create\` | Create a new ${singularName} |`);
|
|
108
112
|
lines.push(`| \`update\` | Update an existing ${singularName} |`);
|
|
@@ -225,232 +229,6 @@ function generateAgentsDocs(tables, customOperations, toolName, _registry) {
|
|
|
225
229
|
content: lines.join('\n'),
|
|
226
230
|
};
|
|
227
231
|
}
|
|
228
|
-
function getCliMcpTools(tables, customOperations, toolName, registry) {
|
|
229
|
-
const tools = [];
|
|
230
|
-
tools.push({
|
|
231
|
-
name: `${toolName}_context_create`,
|
|
232
|
-
description: 'Create a named API context pointing at a GraphQL endpoint',
|
|
233
|
-
inputSchema: {
|
|
234
|
-
type: 'object',
|
|
235
|
-
properties: {
|
|
236
|
-
name: { type: 'string', description: 'Context name' },
|
|
237
|
-
endpoint: { type: 'string', description: 'GraphQL endpoint URL' },
|
|
238
|
-
},
|
|
239
|
-
required: ['name', 'endpoint'],
|
|
240
|
-
},
|
|
241
|
-
});
|
|
242
|
-
tools.push({
|
|
243
|
-
name: `${toolName}_context_list`,
|
|
244
|
-
description: 'List all configured API contexts',
|
|
245
|
-
inputSchema: { type: 'object', properties: {} },
|
|
246
|
-
});
|
|
247
|
-
tools.push({
|
|
248
|
-
name: `${toolName}_context_use`,
|
|
249
|
-
description: 'Set the active API context',
|
|
250
|
-
inputSchema: {
|
|
251
|
-
type: 'object',
|
|
252
|
-
properties: {
|
|
253
|
-
name: { type: 'string', description: 'Context name to activate' },
|
|
254
|
-
},
|
|
255
|
-
required: ['name'],
|
|
256
|
-
},
|
|
257
|
-
});
|
|
258
|
-
tools.push({
|
|
259
|
-
name: `${toolName}_context_current`,
|
|
260
|
-
description: 'Show the currently active API context',
|
|
261
|
-
inputSchema: { type: 'object', properties: {} },
|
|
262
|
-
});
|
|
263
|
-
tools.push({
|
|
264
|
-
name: `${toolName}_context_delete`,
|
|
265
|
-
description: 'Delete an API context',
|
|
266
|
-
inputSchema: {
|
|
267
|
-
type: 'object',
|
|
268
|
-
properties: {
|
|
269
|
-
name: { type: 'string', description: 'Context name to delete' },
|
|
270
|
-
},
|
|
271
|
-
required: ['name'],
|
|
272
|
-
},
|
|
273
|
-
});
|
|
274
|
-
tools.push({
|
|
275
|
-
name: `${toolName}_auth_set_token`,
|
|
276
|
-
description: 'Store a bearer token for the current context',
|
|
277
|
-
inputSchema: {
|
|
278
|
-
type: 'object',
|
|
279
|
-
properties: {
|
|
280
|
-
token: { type: 'string', description: 'Bearer token value' },
|
|
281
|
-
},
|
|
282
|
-
required: ['token'],
|
|
283
|
-
},
|
|
284
|
-
});
|
|
285
|
-
tools.push({
|
|
286
|
-
name: `${toolName}_auth_status`,
|
|
287
|
-
description: 'Show authentication status for all contexts',
|
|
288
|
-
inputSchema: { type: 'object', properties: {} },
|
|
289
|
-
});
|
|
290
|
-
tools.push({
|
|
291
|
-
name: `${toolName}_auth_logout`,
|
|
292
|
-
description: 'Remove credentials for the current context',
|
|
293
|
-
inputSchema: { type: 'object', properties: {} },
|
|
294
|
-
});
|
|
295
|
-
tools.push({
|
|
296
|
-
name: `${toolName}_config_get`,
|
|
297
|
-
description: 'Get a config variable value for the current context',
|
|
298
|
-
inputSchema: {
|
|
299
|
-
type: 'object',
|
|
300
|
-
properties: {
|
|
301
|
-
key: { type: 'string', description: 'Variable name' },
|
|
302
|
-
},
|
|
303
|
-
required: ['key'],
|
|
304
|
-
},
|
|
305
|
-
});
|
|
306
|
-
tools.push({
|
|
307
|
-
name: `${toolName}_config_set`,
|
|
308
|
-
description: 'Set a config variable value for the current context',
|
|
309
|
-
inputSchema: {
|
|
310
|
-
type: 'object',
|
|
311
|
-
properties: {
|
|
312
|
-
key: { type: 'string', description: 'Variable name' },
|
|
313
|
-
value: { type: 'string', description: 'Variable value' },
|
|
314
|
-
},
|
|
315
|
-
required: ['key', 'value'],
|
|
316
|
-
},
|
|
317
|
-
});
|
|
318
|
-
tools.push({
|
|
319
|
-
name: `${toolName}_config_list`,
|
|
320
|
-
description: 'List all config variables for the current context',
|
|
321
|
-
inputSchema: { type: 'object', properties: {} },
|
|
322
|
-
});
|
|
323
|
-
tools.push({
|
|
324
|
-
name: `${toolName}_config_delete`,
|
|
325
|
-
description: 'Delete a config variable for the current context',
|
|
326
|
-
inputSchema: {
|
|
327
|
-
type: 'object',
|
|
328
|
-
properties: {
|
|
329
|
-
key: { type: 'string', description: 'Variable name to delete' },
|
|
330
|
-
},
|
|
331
|
-
required: ['key'],
|
|
332
|
-
},
|
|
333
|
-
});
|
|
334
|
-
for (const table of tables) {
|
|
335
|
-
const { singularName } = (0, utils_1.getTableNames)(table);
|
|
336
|
-
const kebab = (0, komoji_1.toKebabCase)(singularName);
|
|
337
|
-
const pk = (0, utils_1.getPrimaryKeyInfo)(table)[0];
|
|
338
|
-
const scalarFields = (0, utils_1.getScalarFields)(table);
|
|
339
|
-
const editableFields = (0, docs_utils_1.getEditableFields)(table, registry);
|
|
340
|
-
const defaultFields = (0, table_command_generator_1.getFieldsWithDefaults)(table, registry);
|
|
341
|
-
const requiredCreateFieldNames = editableFields
|
|
342
|
-
.filter((f) => !defaultFields.has(f.name))
|
|
343
|
-
.map((f) => f.name);
|
|
344
|
-
tools.push({
|
|
345
|
-
name: `${toolName}_${kebab}_list`,
|
|
346
|
-
description: `List all ${table.name} records`,
|
|
347
|
-
inputSchema: { type: 'object', properties: {} },
|
|
348
|
-
});
|
|
349
|
-
tools.push({
|
|
350
|
-
name: `${toolName}_${kebab}_get`,
|
|
351
|
-
description: `Get a single ${table.name} record by ${pk.name}`,
|
|
352
|
-
inputSchema: {
|
|
353
|
-
type: 'object',
|
|
354
|
-
properties: {
|
|
355
|
-
[pk.name]: {
|
|
356
|
-
type: (0, docs_utils_1.gqlTypeToJsonSchemaType)(pk.gqlType),
|
|
357
|
-
description: `${table.name} ${pk.name}`,
|
|
358
|
-
},
|
|
359
|
-
},
|
|
360
|
-
required: [pk.name],
|
|
361
|
-
},
|
|
362
|
-
});
|
|
363
|
-
const createProps = {};
|
|
364
|
-
for (const f of editableFields) {
|
|
365
|
-
createProps[f.name] = {
|
|
366
|
-
type: (0, docs_utils_1.gqlTypeToJsonSchemaType)((0, docs_utils_1.cleanTypeName)(f.type.gqlType)),
|
|
367
|
-
description: `${table.name} ${f.name}`,
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
tools.push({
|
|
371
|
-
name: `${toolName}_${kebab}_create`,
|
|
372
|
-
description: `Create a new ${table.name} record`,
|
|
373
|
-
inputSchema: {
|
|
374
|
-
type: 'object',
|
|
375
|
-
properties: createProps,
|
|
376
|
-
...(requiredCreateFieldNames.length > 0 ? { required: requiredCreateFieldNames } : {}),
|
|
377
|
-
},
|
|
378
|
-
});
|
|
379
|
-
const updateProps = {
|
|
380
|
-
[pk.name]: {
|
|
381
|
-
type: (0, docs_utils_1.gqlTypeToJsonSchemaType)(pk.gqlType),
|
|
382
|
-
description: `${table.name} ${pk.name}`,
|
|
383
|
-
},
|
|
384
|
-
};
|
|
385
|
-
for (const f of editableFields) {
|
|
386
|
-
updateProps[f.name] = {
|
|
387
|
-
type: (0, docs_utils_1.gqlTypeToJsonSchemaType)((0, docs_utils_1.cleanTypeName)(f.type.gqlType)),
|
|
388
|
-
description: `${table.name} ${f.name}`,
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
tools.push({
|
|
392
|
-
name: `${toolName}_${kebab}_update`,
|
|
393
|
-
description: `Update an existing ${table.name} record`,
|
|
394
|
-
inputSchema: {
|
|
395
|
-
type: 'object',
|
|
396
|
-
properties: updateProps,
|
|
397
|
-
required: [pk.name],
|
|
398
|
-
},
|
|
399
|
-
});
|
|
400
|
-
tools.push({
|
|
401
|
-
name: `${toolName}_${kebab}_delete`,
|
|
402
|
-
description: `Delete a ${table.name} record by ${pk.name}`,
|
|
403
|
-
inputSchema: {
|
|
404
|
-
type: 'object',
|
|
405
|
-
properties: {
|
|
406
|
-
[pk.name]: {
|
|
407
|
-
type: (0, docs_utils_1.gqlTypeToJsonSchemaType)(pk.gqlType),
|
|
408
|
-
description: `${table.name} ${pk.name}`,
|
|
409
|
-
},
|
|
410
|
-
},
|
|
411
|
-
required: [pk.name],
|
|
412
|
-
},
|
|
413
|
-
});
|
|
414
|
-
tools.push({
|
|
415
|
-
name: `${toolName}_${kebab}_fields`,
|
|
416
|
-
description: `List available fields for ${table.name}`,
|
|
417
|
-
inputSchema: { type: 'object', properties: {} },
|
|
418
|
-
_meta: {
|
|
419
|
-
fields: scalarFields.map((f) => ({
|
|
420
|
-
name: f.name,
|
|
421
|
-
type: (0, docs_utils_1.cleanTypeName)(f.type.gqlType),
|
|
422
|
-
editable: editableFields.some((ef) => ef.name === f.name),
|
|
423
|
-
primaryKey: f.name === pk.name,
|
|
424
|
-
})),
|
|
425
|
-
},
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
for (const op of customOperations) {
|
|
429
|
-
const kebab = (0, komoji_1.toKebabCase)(op.name);
|
|
430
|
-
const flat = (0, docs_utils_1.flattenArgs)(op.args, registry);
|
|
431
|
-
const props = {};
|
|
432
|
-
const required = [];
|
|
433
|
-
for (const a of flat) {
|
|
434
|
-
props[a.flag] = {
|
|
435
|
-
type: (0, docs_utils_1.gqlTypeToJsonSchemaType)(a.type),
|
|
436
|
-
description: a.description || a.flag,
|
|
437
|
-
};
|
|
438
|
-
if (a.required) {
|
|
439
|
-
required.push(a.flag);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
tools.push({
|
|
443
|
-
name: `${toolName}_${kebab}`,
|
|
444
|
-
description: op.description || op.name,
|
|
445
|
-
inputSchema: {
|
|
446
|
-
type: 'object',
|
|
447
|
-
properties: props,
|
|
448
|
-
...(required.length > 0 ? { required } : {}),
|
|
449
|
-
},
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
return tools;
|
|
453
|
-
}
|
|
454
232
|
function generateSkills(tables, customOperations, toolName, targetName, registry) {
|
|
455
233
|
const files = [];
|
|
456
234
|
const skillName = `cli-${targetName}`;
|
|
@@ -560,6 +338,12 @@ function generateSkills(tables, customOperations, toolName, targetName, registry
|
|
|
560
338
|
description: skillSpecialDesc,
|
|
561
339
|
usage: [
|
|
562
340
|
`${toolName} ${kebab} list`,
|
|
341
|
+
`${toolName} ${kebab} list --where.<field>.<op> <value> --orderBy <values>`,
|
|
342
|
+
`${toolName} ${kebab} list --limit 10 --after <cursor>`,
|
|
343
|
+
`${toolName} ${kebab} find-first --where.<field>.<op> <value>`,
|
|
344
|
+
...(skillSpecialGroups.some((g) => g.category === 'search' || g.category === 'embedding')
|
|
345
|
+
? [`${toolName} ${kebab} search <query>`]
|
|
346
|
+
: []),
|
|
563
347
|
`${toolName} ${kebab} get --${pk.name} <${(0, docs_utils_1.cleanTypeName)(pk.gqlType)}>`,
|
|
564
348
|
`${toolName} ${kebab} create ${createFlags}`,
|
|
565
349
|
`${toolName} ${kebab} update --${pk.name} <${(0, docs_utils_1.cleanTypeName)(pk.gqlType)}> ${editableFields.map((f) => `[--${f.name} <${(0, docs_utils_1.cleanTypeName)(f.type.gqlType)}>]`).join(' ')}`,
|
|
@@ -567,9 +351,35 @@ function generateSkills(tables, customOperations, toolName, targetName, registry
|
|
|
567
351
|
],
|
|
568
352
|
examples: [
|
|
569
353
|
{
|
|
570
|
-
description: `List
|
|
354
|
+
description: `List ${singularName} records`,
|
|
571
355
|
code: [`${toolName} ${kebab} list`],
|
|
572
356
|
},
|
|
357
|
+
{
|
|
358
|
+
description: `List ${singularName} records with pagination`,
|
|
359
|
+
code: [`${toolName} ${kebab} list --limit 10 --offset 0`],
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
description: `List ${singularName} records with cursor pagination`,
|
|
363
|
+
code: [`${toolName} ${kebab} list --limit 10 --after <cursor>`],
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
description: `Find first matching ${singularName}`,
|
|
367
|
+
code: [`${toolName} ${kebab} find-first --where.${pk.name}.equalTo <value>`],
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
description: `List ${singularName} records with field selection`,
|
|
371
|
+
code: [`${toolName} ${kebab} list --fields id,${pk.name}`],
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
description: `List ${singularName} records with filtering and ordering`,
|
|
375
|
+
code: [`${toolName} ${kebab} list --where.${pk.name}.equalTo <value> --orderBy ${pk.name.replace(/([A-Z])/g, '_$1').toUpperCase()}_ASC`],
|
|
376
|
+
},
|
|
377
|
+
...(skillSpecialGroups.some((g) => g.category === 'search' || g.category === 'embedding')
|
|
378
|
+
? [{
|
|
379
|
+
description: `Search ${singularName} records`,
|
|
380
|
+
code: [`${toolName} ${kebab} search "query text" --limit 10 --fields id,searchScore`],
|
|
381
|
+
}]
|
|
382
|
+
: []),
|
|
573
383
|
{
|
|
574
384
|
description: `Create a ${singularName}`,
|
|
575
385
|
code: [
|
|
@@ -824,6 +634,12 @@ function generateMultiTargetReadme(input) {
|
|
|
824
634
|
lines.push('| Subcommand | Description |');
|
|
825
635
|
lines.push('|------------|-------------|');
|
|
826
636
|
lines.push(`| \`list\` | List all ${singularName} records |`);
|
|
637
|
+
lines.push(`| \`find-first\` | Find first matching ${singularName} record |`);
|
|
638
|
+
const mtReadmeSpecialGroups = (0, docs_utils_1.categorizeSpecialFields)(table, registry);
|
|
639
|
+
const mtReadmeHasSearch = mtReadmeSpecialGroups.some((g) => g.category === 'search' || g.category === 'embedding');
|
|
640
|
+
if (mtReadmeHasSearch) {
|
|
641
|
+
lines.push(`| \`search <query>\` | Search ${singularName} records |`);
|
|
642
|
+
}
|
|
827
643
|
lines.push(`| \`get\` | Get a ${singularName} by ${pk.name} |`);
|
|
828
644
|
lines.push(`| \`create\` | Create a new ${singularName} |`);
|
|
829
645
|
lines.push(`| \`update\` | Update an existing ${singularName} |`);
|
|
@@ -961,248 +777,6 @@ function generateMultiTargetAgentsDocs(input) {
|
|
|
961
777
|
content: lines.join('\n'),
|
|
962
778
|
};
|
|
963
779
|
}
|
|
964
|
-
function getMultiTargetCliMcpTools(input) {
|
|
965
|
-
const { toolName, builtinNames, targets, registry } = input;
|
|
966
|
-
const tools = [];
|
|
967
|
-
const contextEndpointProps = {
|
|
968
|
-
name: { type: 'string', description: 'Context name' },
|
|
969
|
-
};
|
|
970
|
-
for (const tgt of targets) {
|
|
971
|
-
contextEndpointProps[`${tgt.name}_endpoint`] = {
|
|
972
|
-
type: 'string',
|
|
973
|
-
description: `${tgt.name} GraphQL endpoint (default: ${tgt.endpoint})`,
|
|
974
|
-
};
|
|
975
|
-
}
|
|
976
|
-
tools.push({
|
|
977
|
-
name: `${toolName}_${builtinNames.context}_create`,
|
|
978
|
-
description: 'Create a named API context with per-target endpoint overrides',
|
|
979
|
-
inputSchema: {
|
|
980
|
-
type: 'object',
|
|
981
|
-
properties: contextEndpointProps,
|
|
982
|
-
required: ['name'],
|
|
983
|
-
},
|
|
984
|
-
});
|
|
985
|
-
tools.push({
|
|
986
|
-
name: `${toolName}_${builtinNames.context}_list`,
|
|
987
|
-
description: 'List all configured API contexts',
|
|
988
|
-
inputSchema: { type: 'object', properties: {} },
|
|
989
|
-
});
|
|
990
|
-
tools.push({
|
|
991
|
-
name: `${toolName}_${builtinNames.context}_use`,
|
|
992
|
-
description: 'Set the active API context (switches all targets at once)',
|
|
993
|
-
inputSchema: {
|
|
994
|
-
type: 'object',
|
|
995
|
-
properties: {
|
|
996
|
-
name: { type: 'string', description: 'Context name to activate' },
|
|
997
|
-
},
|
|
998
|
-
required: ['name'],
|
|
999
|
-
},
|
|
1000
|
-
});
|
|
1001
|
-
tools.push({
|
|
1002
|
-
name: `${toolName}_${builtinNames.context}_current`,
|
|
1003
|
-
description: 'Show the currently active API context',
|
|
1004
|
-
inputSchema: { type: 'object', properties: {} },
|
|
1005
|
-
});
|
|
1006
|
-
tools.push({
|
|
1007
|
-
name: `${toolName}_${builtinNames.context}_delete`,
|
|
1008
|
-
description: 'Delete an API context',
|
|
1009
|
-
inputSchema: {
|
|
1010
|
-
type: 'object',
|
|
1011
|
-
properties: {
|
|
1012
|
-
name: { type: 'string', description: 'Context name to delete' },
|
|
1013
|
-
},
|
|
1014
|
-
required: ['name'],
|
|
1015
|
-
},
|
|
1016
|
-
});
|
|
1017
|
-
tools.push({
|
|
1018
|
-
name: `${toolName}_${builtinNames.auth}_set_token`,
|
|
1019
|
-
description: 'Store a bearer token for the current context (shared across all targets)',
|
|
1020
|
-
inputSchema: {
|
|
1021
|
-
type: 'object',
|
|
1022
|
-
properties: {
|
|
1023
|
-
token: { type: 'string', description: 'Bearer token value' },
|
|
1024
|
-
},
|
|
1025
|
-
required: ['token'],
|
|
1026
|
-
},
|
|
1027
|
-
});
|
|
1028
|
-
tools.push({
|
|
1029
|
-
name: `${toolName}_${builtinNames.auth}_status`,
|
|
1030
|
-
description: 'Show authentication status for all contexts',
|
|
1031
|
-
inputSchema: { type: 'object', properties: {} },
|
|
1032
|
-
});
|
|
1033
|
-
tools.push({
|
|
1034
|
-
name: `${toolName}_${builtinNames.auth}_logout`,
|
|
1035
|
-
description: 'Remove credentials for the current context',
|
|
1036
|
-
inputSchema: { type: 'object', properties: {} },
|
|
1037
|
-
});
|
|
1038
|
-
tools.push({
|
|
1039
|
-
name: `${toolName}_${builtinNames.config}_get`,
|
|
1040
|
-
description: 'Get a config variable value for the current context',
|
|
1041
|
-
inputSchema: {
|
|
1042
|
-
type: 'object',
|
|
1043
|
-
properties: {
|
|
1044
|
-
key: { type: 'string', description: 'Variable name' },
|
|
1045
|
-
},
|
|
1046
|
-
required: ['key'],
|
|
1047
|
-
},
|
|
1048
|
-
});
|
|
1049
|
-
tools.push({
|
|
1050
|
-
name: `${toolName}_${builtinNames.config}_set`,
|
|
1051
|
-
description: 'Set a config variable value for the current context',
|
|
1052
|
-
inputSchema: {
|
|
1053
|
-
type: 'object',
|
|
1054
|
-
properties: {
|
|
1055
|
-
key: { type: 'string', description: 'Variable name' },
|
|
1056
|
-
value: { type: 'string', description: 'Variable value' },
|
|
1057
|
-
},
|
|
1058
|
-
required: ['key', 'value'],
|
|
1059
|
-
},
|
|
1060
|
-
});
|
|
1061
|
-
tools.push({
|
|
1062
|
-
name: `${toolName}_${builtinNames.config}_list`,
|
|
1063
|
-
description: 'List all config variables for the current context',
|
|
1064
|
-
inputSchema: { type: 'object', properties: {} },
|
|
1065
|
-
});
|
|
1066
|
-
tools.push({
|
|
1067
|
-
name: `${toolName}_${builtinNames.config}_delete`,
|
|
1068
|
-
description: 'Delete a config variable for the current context',
|
|
1069
|
-
inputSchema: {
|
|
1070
|
-
type: 'object',
|
|
1071
|
-
properties: {
|
|
1072
|
-
key: { type: 'string', description: 'Variable name to delete' },
|
|
1073
|
-
},
|
|
1074
|
-
required: ['key'],
|
|
1075
|
-
},
|
|
1076
|
-
});
|
|
1077
|
-
for (const tgt of targets) {
|
|
1078
|
-
for (const table of tgt.tables) {
|
|
1079
|
-
const { singularName } = (0, utils_1.getTableNames)(table);
|
|
1080
|
-
const kebab = (0, komoji_1.toKebabCase)(singularName);
|
|
1081
|
-
const pk = (0, utils_1.getPrimaryKeyInfo)(table)[0];
|
|
1082
|
-
const scalarFields = (0, utils_1.getScalarFields)(table);
|
|
1083
|
-
const editableFields = (0, docs_utils_1.getEditableFields)(table, registry);
|
|
1084
|
-
const defaultFields = (0, table_command_generator_1.getFieldsWithDefaults)(table, registry);
|
|
1085
|
-
const requiredCreateFieldNames = editableFields
|
|
1086
|
-
.filter((f) => !defaultFields.has(f.name))
|
|
1087
|
-
.map((f) => f.name);
|
|
1088
|
-
const prefix = `${toolName}_${tgt.name}_${kebab}`;
|
|
1089
|
-
tools.push({
|
|
1090
|
-
name: `${prefix}_list`,
|
|
1091
|
-
description: `List all ${table.name} records (${tgt.name} target)`,
|
|
1092
|
-
inputSchema: { type: 'object', properties: {} },
|
|
1093
|
-
});
|
|
1094
|
-
tools.push({
|
|
1095
|
-
name: `${prefix}_get`,
|
|
1096
|
-
description: `Get a single ${table.name} record by ${pk.name} (${tgt.name} target)`,
|
|
1097
|
-
inputSchema: {
|
|
1098
|
-
type: 'object',
|
|
1099
|
-
properties: {
|
|
1100
|
-
[pk.name]: {
|
|
1101
|
-
type: (0, docs_utils_1.gqlTypeToJsonSchemaType)(pk.gqlType),
|
|
1102
|
-
description: `${table.name} ${pk.name}`,
|
|
1103
|
-
},
|
|
1104
|
-
},
|
|
1105
|
-
required: [pk.name],
|
|
1106
|
-
},
|
|
1107
|
-
});
|
|
1108
|
-
const createProps = {};
|
|
1109
|
-
for (const f of editableFields) {
|
|
1110
|
-
createProps[f.name] = {
|
|
1111
|
-
type: (0, docs_utils_1.gqlTypeToJsonSchemaType)((0, docs_utils_1.cleanTypeName)(f.type.gqlType)),
|
|
1112
|
-
description: `${table.name} ${f.name}`,
|
|
1113
|
-
};
|
|
1114
|
-
}
|
|
1115
|
-
tools.push({
|
|
1116
|
-
name: `${prefix}_create`,
|
|
1117
|
-
description: `Create a new ${table.name} record (${tgt.name} target)`,
|
|
1118
|
-
inputSchema: {
|
|
1119
|
-
type: 'object',
|
|
1120
|
-
properties: createProps,
|
|
1121
|
-
...(requiredCreateFieldNames.length > 0 ? { required: requiredCreateFieldNames } : {}),
|
|
1122
|
-
},
|
|
1123
|
-
});
|
|
1124
|
-
const updateProps = {
|
|
1125
|
-
[pk.name]: {
|
|
1126
|
-
type: (0, docs_utils_1.gqlTypeToJsonSchemaType)(pk.gqlType),
|
|
1127
|
-
description: `${table.name} ${pk.name}`,
|
|
1128
|
-
},
|
|
1129
|
-
};
|
|
1130
|
-
for (const f of editableFields) {
|
|
1131
|
-
updateProps[f.name] = {
|
|
1132
|
-
type: (0, docs_utils_1.gqlTypeToJsonSchemaType)((0, docs_utils_1.cleanTypeName)(f.type.gqlType)),
|
|
1133
|
-
description: `${table.name} ${f.name}`,
|
|
1134
|
-
};
|
|
1135
|
-
}
|
|
1136
|
-
tools.push({
|
|
1137
|
-
name: `${prefix}_update`,
|
|
1138
|
-
description: `Update an existing ${table.name} record (${tgt.name} target)`,
|
|
1139
|
-
inputSchema: {
|
|
1140
|
-
type: 'object',
|
|
1141
|
-
properties: updateProps,
|
|
1142
|
-
required: [pk.name],
|
|
1143
|
-
},
|
|
1144
|
-
});
|
|
1145
|
-
tools.push({
|
|
1146
|
-
name: `${prefix}_delete`,
|
|
1147
|
-
description: `Delete a ${table.name} record by ${pk.name} (${tgt.name} target)`,
|
|
1148
|
-
inputSchema: {
|
|
1149
|
-
type: 'object',
|
|
1150
|
-
properties: {
|
|
1151
|
-
[pk.name]: {
|
|
1152
|
-
type: (0, docs_utils_1.gqlTypeToJsonSchemaType)(pk.gqlType),
|
|
1153
|
-
description: `${table.name} ${pk.name}`,
|
|
1154
|
-
},
|
|
1155
|
-
},
|
|
1156
|
-
required: [pk.name],
|
|
1157
|
-
},
|
|
1158
|
-
});
|
|
1159
|
-
tools.push({
|
|
1160
|
-
name: `${prefix}_fields`,
|
|
1161
|
-
description: `List available fields for ${table.name} (${tgt.name} target)`,
|
|
1162
|
-
inputSchema: { type: 'object', properties: {} },
|
|
1163
|
-
_meta: {
|
|
1164
|
-
fields: scalarFields.map((f) => ({
|
|
1165
|
-
name: f.name,
|
|
1166
|
-
type: (0, docs_utils_1.cleanTypeName)(f.type.gqlType),
|
|
1167
|
-
editable: editableFields.some((ef) => ef.name === f.name),
|
|
1168
|
-
primaryKey: f.name === pk.name,
|
|
1169
|
-
})),
|
|
1170
|
-
},
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
for (const op of tgt.customOperations) {
|
|
1174
|
-
const kebab = (0, komoji_1.toKebabCase)(op.name);
|
|
1175
|
-
const flat = (0, docs_utils_1.flattenArgs)(op.args, registry);
|
|
1176
|
-
const props = {};
|
|
1177
|
-
const required = [];
|
|
1178
|
-
for (const a of flat) {
|
|
1179
|
-
props[a.flag] = {
|
|
1180
|
-
type: (0, docs_utils_1.gqlTypeToJsonSchemaType)(a.type),
|
|
1181
|
-
description: a.description || a.flag,
|
|
1182
|
-
};
|
|
1183
|
-
if (a.required) {
|
|
1184
|
-
required.push(a.flag);
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
if (tgt.isAuthTarget && op.kind === 'mutation') {
|
|
1188
|
-
props['save_token'] = {
|
|
1189
|
-
type: 'boolean',
|
|
1190
|
-
description: 'Auto-save returned token to credentials',
|
|
1191
|
-
};
|
|
1192
|
-
}
|
|
1193
|
-
tools.push({
|
|
1194
|
-
name: `${toolName}_${tgt.name}_${kebab}`,
|
|
1195
|
-
description: `${op.description || op.name} (${tgt.name} target)`,
|
|
1196
|
-
inputSchema: {
|
|
1197
|
-
type: 'object',
|
|
1198
|
-
properties: props,
|
|
1199
|
-
...(required.length > 0 ? { required } : {}),
|
|
1200
|
-
},
|
|
1201
|
-
});
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
return tools;
|
|
1205
|
-
}
|
|
1206
780
|
function generateMultiTargetSkills(input) {
|
|
1207
781
|
const { toolName, builtinNames, targets, registry } = input;
|
|
1208
782
|
const files = [];
|
|
@@ -1362,6 +936,12 @@ function generateMultiTargetSkills(input) {
|
|
|
1362
936
|
description: mtSkillSpecialDesc,
|
|
1363
937
|
usage: [
|
|
1364
938
|
`${toolName} ${cmd} list`,
|
|
939
|
+
`${toolName} ${cmd} list --where.<field>.<op> <value> --orderBy <values>`,
|
|
940
|
+
`${toolName} ${cmd} list --limit 10 --after <cursor>`,
|
|
941
|
+
`${toolName} ${cmd} find-first --where.<field>.<op> <value>`,
|
|
942
|
+
...(mtSkillSpecialGroups.some((g) => g.category === 'search' || g.category === 'embedding')
|
|
943
|
+
? [`${toolName} ${cmd} search <query>`]
|
|
944
|
+
: []),
|
|
1365
945
|
`${toolName} ${cmd} get --${pk.name} <${(0, docs_utils_1.cleanTypeName)(pk.gqlType)}>`,
|
|
1366
946
|
`${toolName} ${cmd} create ${createFlags}`,
|
|
1367
947
|
`${toolName} ${cmd} update --${pk.name} <${(0, docs_utils_1.cleanTypeName)(pk.gqlType)}> ${editableFields.map((f) => `[--${f.name} <${(0, docs_utils_1.cleanTypeName)(f.type.gqlType)}>]`).join(' ')}`,
|
|
@@ -1369,9 +949,31 @@ function generateMultiTargetSkills(input) {
|
|
|
1369
949
|
],
|
|
1370
950
|
examples: [
|
|
1371
951
|
{
|
|
1372
|
-
description: `List
|
|
952
|
+
description: `List ${singularName} records`,
|
|
1373
953
|
code: [`${toolName} ${cmd} list`],
|
|
1374
954
|
},
|
|
955
|
+
{
|
|
956
|
+
description: `List ${singularName} records with pagination`,
|
|
957
|
+
code: [`${toolName} ${cmd} list --limit 10 --offset 0`],
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
description: `List ${singularName} records with cursor pagination`,
|
|
961
|
+
code: [`${toolName} ${cmd} list --limit 10 --after <cursor>`],
|
|
962
|
+
},
|
|
963
|
+
{
|
|
964
|
+
description: `Find first matching ${singularName}`,
|
|
965
|
+
code: [`${toolName} ${cmd} find-first --where.${pk.name}.equalTo <value>`],
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
description: `List ${singularName} records with filtering and ordering`,
|
|
969
|
+
code: [`${toolName} ${cmd} list --where.${pk.name}.equalTo <value> --orderBy ${pk.name.replace(/([A-Z])/g, '_$1').toUpperCase()}_ASC`],
|
|
970
|
+
},
|
|
971
|
+
...(mtSkillSpecialGroups.some((g) => g.category === 'search' || g.category === 'embedding')
|
|
972
|
+
? [{
|
|
973
|
+
description: `Search ${singularName} records`,
|
|
974
|
+
code: [`${toolName} ${cmd} search "query text" --limit 10 --fields id,searchScore`],
|
|
975
|
+
}]
|
|
976
|
+
: []),
|
|
1375
977
|
{
|
|
1376
978
|
description: `Create a ${singularName}`,
|
|
1377
979
|
code: [
|
|
@@ -58,9 +58,9 @@ export { generateConfigCommand } from './config-command-generator';
|
|
|
58
58
|
export { generateHelpersFile } from './helpers-generator';
|
|
59
59
|
export type { HelpersGeneratorInput } from './helpers-generator';
|
|
60
60
|
export { generateContextCommand, generateAuthCommand, generateMultiTargetContextCommand, generateAuthCommandWithName, } from './infra-generator';
|
|
61
|
-
export { generateReadme, generateAgentsDocs,
|
|
61
|
+
export { generateReadme, generateAgentsDocs, generateSkills, generateMultiTargetReadme, generateMultiTargetAgentsDocs, generateMultiTargetSkills, } from './docs-generator';
|
|
62
62
|
export type { MultiTargetDocsInput } from './docs-generator';
|
|
63
63
|
export { resolveDocsConfig } from '../docs-utils';
|
|
64
|
-
export type { GeneratedDocFile
|
|
64
|
+
export type { GeneratedDocFile } from '../docs-utils';
|
|
65
65
|
export { generateUtilsFile, generateEntryPointFile } from './utils-generator';
|
|
66
66
|
export type { GeneratedFile, MultiTargetExecutorInput } from './executor-generator';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateEntryPointFile = exports.generateUtilsFile = exports.resolveDocsConfig = exports.generateMultiTargetSkills = exports.
|
|
3
|
+
exports.generateEntryPointFile = exports.generateUtilsFile = exports.resolveDocsConfig = exports.generateMultiTargetSkills = exports.generateMultiTargetAgentsDocs = exports.generateMultiTargetReadme = exports.generateSkills = exports.generateAgentsDocs = exports.generateReadme = exports.generateAuthCommandWithName = exports.generateMultiTargetContextCommand = exports.generateAuthCommand = exports.generateContextCommand = exports.generateHelpersFile = exports.generateConfigCommand = exports.generateMultiTargetCommandMap = exports.generateCommandMap = exports.generateCustomCommand = exports.generateTableCommand = exports.generateMultiTargetExecutorFile = exports.generateExecutorFile = void 0;
|
|
4
4
|
exports.generateCli = generateCli;
|
|
5
5
|
exports.resolveBuiltinNames = resolveBuiltinNames;
|
|
6
6
|
exports.generateMultiTargetCli = generateMultiTargetCli;
|
|
@@ -192,11 +192,9 @@ Object.defineProperty(exports, "generateAuthCommandWithName", { enumerable: true
|
|
|
192
192
|
var docs_generator_1 = require("./docs-generator");
|
|
193
193
|
Object.defineProperty(exports, "generateReadme", { enumerable: true, get: function () { return docs_generator_1.generateReadme; } });
|
|
194
194
|
Object.defineProperty(exports, "generateAgentsDocs", { enumerable: true, get: function () { return docs_generator_1.generateAgentsDocs; } });
|
|
195
|
-
Object.defineProperty(exports, "getCliMcpTools", { enumerable: true, get: function () { return docs_generator_1.getCliMcpTools; } });
|
|
196
195
|
Object.defineProperty(exports, "generateSkills", { enumerable: true, get: function () { return docs_generator_1.generateSkills; } });
|
|
197
196
|
Object.defineProperty(exports, "generateMultiTargetReadme", { enumerable: true, get: function () { return docs_generator_1.generateMultiTargetReadme; } });
|
|
198
197
|
Object.defineProperty(exports, "generateMultiTargetAgentsDocs", { enumerable: true, get: function () { return docs_generator_1.generateMultiTargetAgentsDocs; } });
|
|
199
|
-
Object.defineProperty(exports, "getMultiTargetCliMcpTools", { enumerable: true, get: function () { return docs_generator_1.getMultiTargetCliMcpTools; } });
|
|
200
198
|
Object.defineProperty(exports, "generateMultiTargetSkills", { enumerable: true, get: function () { return docs_generator_1.generateMultiTargetSkills; } });
|
|
201
199
|
var docs_utils_1 = require("../docs-utils");
|
|
202
200
|
Object.defineProperty(exports, "resolveDocsConfig", { enumerable: true, get: function () { return docs_utils_1.resolveDocsConfig; } });
|