@constructive-io/graphql-codegen 4.24.5 → 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
package/esm/core/generate.js
CHANGED
|
@@ -15,13 +15,13 @@ import { getConfigOptions } from '../types/config';
|
|
|
15
15
|
import { generate as generateReactQueryFiles } from './codegen';
|
|
16
16
|
import { generateRootBarrel, generateMultiTargetBarrel } from './codegen/barrel';
|
|
17
17
|
import { generateCli as generateCliFiles, generateMultiTargetCli } from './codegen/cli';
|
|
18
|
-
import { generateReadme as generateCliReadme, generateAgentsDocs as generateCliAgentsDocs,
|
|
18
|
+
import { generateReadme as generateCliReadme, generateAgentsDocs as generateCliAgentsDocs, generateSkills as generateCliSkills, generateMultiTargetReadme, generateMultiTargetAgentsDocs, generateMultiTargetSkills, } from './codegen/cli/docs-generator';
|
|
19
19
|
import { resolveDocsConfig } from './codegen/docs-utils';
|
|
20
|
-
import { generateHooksReadme, generateHooksAgentsDocs,
|
|
20
|
+
import { generateHooksReadme, generateHooksAgentsDocs, generateHooksSkills, } from './codegen/hooks-docs-generator';
|
|
21
21
|
import { generateOrm as generateOrmFiles } from './codegen/orm';
|
|
22
|
-
import { generateOrmReadme, generateOrmAgentsDocs,
|
|
22
|
+
import { generateOrmReadme, generateOrmAgentsDocs, generateOrmSkills, } from './codegen/orm/docs-generator';
|
|
23
23
|
import { generateSharedTypes } from './codegen/shared';
|
|
24
|
-
import { generateTargetReadme,
|
|
24
|
+
import { generateTargetReadme, generateRootRootReadme, } from './codegen/target-docs-generator';
|
|
25
25
|
import { createSchemaSource, validateSourceOptions } from './introspect';
|
|
26
26
|
import { writeGeneratedFiles } from './output';
|
|
27
27
|
import { runCodegenPipeline, validateTablesFound } from './pipeline';
|
|
@@ -232,7 +232,6 @@ export async function generate(options = {}, internalOptions) {
|
|
|
232
232
|
...(customOperations.queries ?? []),
|
|
233
233
|
...(customOperations.mutations ?? []),
|
|
234
234
|
];
|
|
235
|
-
const allMcpTools = [];
|
|
236
235
|
const targetName = internalOptions?.targetName ?? 'default';
|
|
237
236
|
const skillsToWrite = [];
|
|
238
237
|
if (runOrm) {
|
|
@@ -244,9 +243,6 @@ export async function generate(options = {}, internalOptions) {
|
|
|
244
243
|
const agents = generateOrmAgentsDocs(tables, allCustomOps);
|
|
245
244
|
filesToWrite.push({ path: path.posix.join('orm', agents.fileName), content: agents.content });
|
|
246
245
|
}
|
|
247
|
-
if (docsConfig.mcp) {
|
|
248
|
-
allMcpTools.push(...getOrmMcpTools(tables, allCustomOps));
|
|
249
|
-
}
|
|
250
246
|
if (docsConfig.skills) {
|
|
251
247
|
for (const skill of generateOrmSkills(tables, allCustomOps, targetName, customOperations.typeRegistry)) {
|
|
252
248
|
skillsToWrite.push({ path: skill.fileName, content: skill.content });
|
|
@@ -262,9 +258,6 @@ export async function generate(options = {}, internalOptions) {
|
|
|
262
258
|
const agents = generateHooksAgentsDocs(tables, allCustomOps);
|
|
263
259
|
filesToWrite.push({ path: path.posix.join('hooks', agents.fileName), content: agents.content });
|
|
264
260
|
}
|
|
265
|
-
if (docsConfig.mcp) {
|
|
266
|
-
allMcpTools.push(...getHooksMcpTools(tables, allCustomOps));
|
|
267
|
-
}
|
|
268
261
|
if (docsConfig.skills) {
|
|
269
262
|
for (const skill of generateHooksSkills(tables, allCustomOps, targetName, customOperations.typeRegistry)) {
|
|
270
263
|
skillsToWrite.push({ path: skill.fileName, content: skill.content });
|
|
@@ -283,23 +276,12 @@ export async function generate(options = {}, internalOptions) {
|
|
|
283
276
|
const agents = generateCliAgentsDocs(tables, allCustomOps, toolName, customOperations.typeRegistry);
|
|
284
277
|
filesToWrite.push({ path: path.posix.join('cli', agents.fileName), content: agents.content });
|
|
285
278
|
}
|
|
286
|
-
if (docsConfig.mcp) {
|
|
287
|
-
allMcpTools.push(...getCliMcpTools(tables, allCustomOps, toolName, customOperations.typeRegistry));
|
|
288
|
-
}
|
|
289
279
|
if (docsConfig.skills) {
|
|
290
280
|
for (const skill of generateCliSkills(tables, allCustomOps, toolName, targetName, customOperations.typeRegistry)) {
|
|
291
281
|
skillsToWrite.push({ path: skill.fileName, content: skill.content });
|
|
292
282
|
}
|
|
293
283
|
}
|
|
294
284
|
}
|
|
295
|
-
// Generate combined mcp.json at output root
|
|
296
|
-
if (docsConfig.mcp && allMcpTools.length > 0) {
|
|
297
|
-
const mcpName = typeof config.cli === 'object' && config.cli?.toolName
|
|
298
|
-
? config.cli.toolName
|
|
299
|
-
: 'graphql-sdk';
|
|
300
|
-
const mcpFile = generateCombinedMcpConfig(allMcpTools, mcpName);
|
|
301
|
-
filesToWrite.push({ path: mcpFile.fileName, content: mcpFile.content });
|
|
302
|
-
}
|
|
303
285
|
// Generate per-target README at output root
|
|
304
286
|
if (docsConfig.readme) {
|
|
305
287
|
const targetReadme = generateTargetReadme({
|
|
@@ -602,7 +584,6 @@ export async function generateMulti(options) {
|
|
|
602
584
|
isAuthTarget: t.isAuthTarget,
|
|
603
585
|
})),
|
|
604
586
|
};
|
|
605
|
-
const allMcpTools = [];
|
|
606
587
|
if (docsConfig.readme) {
|
|
607
588
|
const readme = generateMultiTargetReadme(docsInput);
|
|
608
589
|
cliFilesToWrite.push({ path: path.posix.join('cli', readme.fileName), content: readme.content });
|
|
@@ -611,13 +592,6 @@ export async function generateMulti(options) {
|
|
|
611
592
|
const agents = generateMultiTargetAgentsDocs(docsInput);
|
|
612
593
|
cliFilesToWrite.push({ path: path.posix.join('cli', agents.fileName), content: agents.content });
|
|
613
594
|
}
|
|
614
|
-
if (docsConfig.mcp) {
|
|
615
|
-
allMcpTools.push(...getMultiTargetCliMcpTools(docsInput));
|
|
616
|
-
}
|
|
617
|
-
if (docsConfig.mcp && allMcpTools.length > 0) {
|
|
618
|
-
const mcpFile = generateCombinedMcpConfig(allMcpTools, toolName);
|
|
619
|
-
cliFilesToWrite.push({ path: path.posix.join('cli', mcpFile.fileName), content: mcpFile.content });
|
|
620
|
-
}
|
|
621
595
|
const { writeGeneratedFiles: writeFiles } = await import('./output');
|
|
622
596
|
await writeFiles(cliFilesToWrite, '.', [], { pruneStaleFiles: false });
|
|
623
597
|
if (docsConfig.skills) {
|
package/esm/types/config.d.ts
CHANGED
|
@@ -130,13 +130,6 @@ export interface DocsConfig {
|
|
|
130
130
|
* @default true
|
|
131
131
|
*/
|
|
132
132
|
agents?: boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Generate mcp.json — MCP (Model Context Protocol) tool definitions
|
|
135
|
-
* Each CLI command becomes a tool with typed inputSchema (JSON Schema)
|
|
136
|
-
* Ready to plug into any MCP-compatible agent
|
|
137
|
-
* @default false
|
|
138
|
-
*/
|
|
139
|
-
mcp?: boolean;
|
|
140
133
|
/**
|
|
141
134
|
* Generate .agents/skills/ directory — per-entity SKILL.md files with YAML frontmatter.
|
|
142
135
|
* Skills are written to {workspaceRoot}/.agents/skills/ (not nested in output).
|
|
@@ -360,7 +353,7 @@ export interface GraphQLSDKConfigTarget {
|
|
|
360
353
|
* Controls which doc formats are generated alongside code for each generator target.
|
|
361
354
|
* Applied globally to all enabled generators (ORM, React Query, CLI).
|
|
362
355
|
* Set to `true` to enable all formats, or configure individually.
|
|
363
|
-
* @default { readme: true, agents: true
|
|
356
|
+
* @default { readme: true, agents: true }
|
|
364
357
|
*/
|
|
365
358
|
docs?: DocsConfig | boolean;
|
|
366
359
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/graphql-codegen",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.25.0",
|
|
4
4
|
"description": "GraphQL SDK generator for Constructive databases with React Query hooks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphql",
|
|
@@ -56,25 +56,25 @@
|
|
|
56
56
|
"@0no-co/graphql.web": "^1.1.2",
|
|
57
57
|
"@babel/generator": "^7.29.1",
|
|
58
58
|
"@babel/types": "^7.29.0",
|
|
59
|
-
"@constructive-io/graphql-query": "^3.12.
|
|
59
|
+
"@constructive-io/graphql-query": "^3.12.4",
|
|
60
60
|
"@constructive-io/graphql-types": "^3.4.1",
|
|
61
61
|
"@inquirerer/utils": "^3.3.4",
|
|
62
|
-
"@pgpmjs/core": "^6.10.
|
|
62
|
+
"@pgpmjs/core": "^6.10.2",
|
|
63
63
|
"ajv": "^8.18.0",
|
|
64
64
|
"deepmerge": "^4.3.1",
|
|
65
65
|
"find-and-require-package-json": "^0.9.1",
|
|
66
66
|
"gql-ast": "^3.4.1",
|
|
67
|
-
"graphile-schema": "^1.11.
|
|
67
|
+
"graphile-schema": "^1.11.1",
|
|
68
68
|
"graphql": "16.13.0",
|
|
69
|
-
"inflekt": "^0.
|
|
69
|
+
"inflekt": "^0.6.0",
|
|
70
70
|
"inquirerer": "^4.7.0",
|
|
71
71
|
"jiti": "^2.6.1",
|
|
72
|
-
"komoji": "^0.
|
|
72
|
+
"komoji": "^0.9.0",
|
|
73
73
|
"oxfmt": "^0.40.0",
|
|
74
74
|
"pg-cache": "^3.4.1",
|
|
75
75
|
"pg-env": "^1.8.1",
|
|
76
|
-
"pgsql-client": "^3.7.
|
|
77
|
-
"pgsql-seed": "^2.7.
|
|
76
|
+
"pgsql-client": "^3.7.2",
|
|
77
|
+
"pgsql-seed": "^2.7.2",
|
|
78
78
|
"undici": "^7.24.3"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"tsx": "^4.21.0",
|
|
102
102
|
"typescript": "^5.9.3"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "93deca687ce109bf90d2a0a73ea6b05b22724160"
|
|
105
105
|
}
|
package/types/config.d.ts
CHANGED
|
@@ -130,13 +130,6 @@ export interface DocsConfig {
|
|
|
130
130
|
* @default true
|
|
131
131
|
*/
|
|
132
132
|
agents?: boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Generate mcp.json — MCP (Model Context Protocol) tool definitions
|
|
135
|
-
* Each CLI command becomes a tool with typed inputSchema (JSON Schema)
|
|
136
|
-
* Ready to plug into any MCP-compatible agent
|
|
137
|
-
* @default false
|
|
138
|
-
*/
|
|
139
|
-
mcp?: boolean;
|
|
140
133
|
/**
|
|
141
134
|
* Generate .agents/skills/ directory — per-entity SKILL.md files with YAML frontmatter.
|
|
142
135
|
* Skills are written to {workspaceRoot}/.agents/skills/ (not nested in output).
|
|
@@ -360,7 +353,7 @@ export interface GraphQLSDKConfigTarget {
|
|
|
360
353
|
* Controls which doc formats are generated alongside code for each generator target.
|
|
361
354
|
* Applied globally to all enabled generators (ORM, React Query, CLI).
|
|
362
355
|
* Set to `true` to enable all formats, or configure individually.
|
|
363
|
-
* @default { readme: true, agents: true
|
|
356
|
+
* @default { readme: true, agents: true }
|
|
364
357
|
*/
|
|
365
358
|
docs?: DocsConfig | boolean;
|
|
366
359
|
/**
|