@contentful/mcp-server 1.4.0 → 1.6.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/build/tools/context/instructions.js +3 -0
- package/build/tools/context/instructions.js.map +1 -1
- package/build/tools/jobs/register.js +5 -0
- package/build/tools/jobs/register.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/exportSpace.js +148 -0
- package/build/tools/jobs/space-to-space-migration/exportSpace.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/importSpace.js +127 -0
- package/build/tools/jobs/space-to-space-migration/importSpace.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/instructions.js +33 -0
- package/build/tools/jobs/space-to-space-migration/instructions.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/migrationHandler.js +45 -0
- package/build/tools/jobs/space-to-space-migration/migrationHandler.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/mockClient.js +156 -0
- package/build/tools/jobs/space-to-space-migration/mockClient.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/paramCollection.js +288 -0
- package/build/tools/jobs/space-to-space-migration/paramCollection.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/register.js +23 -0
- package/build/tools/jobs/space-to-space-migration/register.js.map +1 -0
- package/build/tools/register.js +4 -0
- package/build/tools/register.js.map +1 -1
- package/build/tools/taxonomies/concept-schemes/createConceptScheme.js +78 -0
- package/build/tools/taxonomies/concept-schemes/createConceptScheme.js.map +1 -0
- package/build/tools/taxonomies/concept-schemes/deleteConceptScheme.js +27 -0
- package/build/tools/taxonomies/concept-schemes/deleteConceptScheme.js.map +1 -0
- package/build/tools/taxonomies/concept-schemes/getConceptScheme.js +26 -0
- package/build/tools/taxonomies/concept-schemes/getConceptScheme.js.map +1 -0
- package/build/tools/taxonomies/concept-schemes/listConceptSchemes.js +66 -0
- package/build/tools/taxonomies/concept-schemes/listConceptSchemes.js.map +1 -0
- package/build/tools/taxonomies/concept-schemes/mockClient.js +147 -0
- package/build/tools/taxonomies/concept-schemes/mockClient.js.map +1 -0
- package/build/tools/taxonomies/concept-schemes/register.js +13 -0
- package/build/tools/taxonomies/concept-schemes/register.js.map +1 -0
- package/build/tools/taxonomies/concept-schemes/updateConceptScheme.js +99 -0
- package/build/tools/taxonomies/concept-schemes/updateConceptScheme.js.map +1 -0
- package/build/tools/taxonomies/register.js +5 -0
- package/build/tools/taxonomies/register.js.map +1 -0
- package/build/types/conceptPayloadTypes.js +17 -0
- package/build/types/conceptPayloadTypes.js.map +1 -0
- package/build/types/querySchema.js +36 -0
- package/build/types/querySchema.js.map +1 -0
- package/package.json +5 -2
|
@@ -55,6 +55,9 @@ export const MCP_INSTRUCTIONS = `You are a helpful assistant integrated with Con
|
|
|
55
55
|
- Use transform_image for AI-powered image operations
|
|
56
56
|
- Always verify entry existence before attempting to modify it
|
|
57
57
|
|
|
58
|
+
# Migration Strategies
|
|
59
|
+
- Use the space_to_space migration workflow to help a user when they want to migrate content from one space to another. Start this workflow by calling the start_space_to_space_migration tool.
|
|
60
|
+
- You do not need to fetch content types (ex. list_content_types tool) or entries (ex. search_entries tool) prior to starting the migration workflow. Once the user states they want to start the migration workflow, you simply need to call the start_space_to_space_migration tool.
|
|
58
61
|
|
|
59
62
|
# Error Handling and Debugging
|
|
60
63
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../../src/tools/context/instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG
|
|
1
|
+
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../../src/tools/context/instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mPAiHmN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/tools/jobs/register.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kCAAkC,EAAE,MAAM,wCAAwC,CAAC;AAE5F,MAAM,UAAU,YAAY,CAAC,MAAiB;IAC5C,kCAAkC,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createSuccessResponse, withErrorHandling, } from '../../../utils/response.js';
|
|
3
|
+
import { BaseToolSchema } from '../../../utils/tools.js';
|
|
4
|
+
import { getDefaultClientConfig } from '../../../config/contentful.js';
|
|
5
|
+
import { EntryQuerySchema, AssetQuerySchema, } from '../../../types/querySchema.js';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import { createRequire } from 'module';
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
const contentfulExport = require('contentful-export');
|
|
10
|
+
export const ExportSpaceToolParams = BaseToolSchema.extend({
|
|
11
|
+
exportDir: z
|
|
12
|
+
.string()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe('Directory to save the exported space data (optional, defaults to current directory)'),
|
|
15
|
+
saveFile: z
|
|
16
|
+
.boolean()
|
|
17
|
+
.optional()
|
|
18
|
+
.default(true)
|
|
19
|
+
.describe('Save the exported space data to a file'),
|
|
20
|
+
contentFile: z
|
|
21
|
+
.string()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('Custom filename for the exported space data (optional)'),
|
|
24
|
+
includeDrafts: z
|
|
25
|
+
.boolean()
|
|
26
|
+
.optional()
|
|
27
|
+
.default(false)
|
|
28
|
+
.describe('Include draft entries in the export'),
|
|
29
|
+
includeArchived: z
|
|
30
|
+
.boolean()
|
|
31
|
+
.optional()
|
|
32
|
+
.default(false)
|
|
33
|
+
.describe('Include archived entries in the export'),
|
|
34
|
+
skipContentModel: z
|
|
35
|
+
.boolean()
|
|
36
|
+
.optional()
|
|
37
|
+
.default(false)
|
|
38
|
+
.describe('Skip exporting content types'),
|
|
39
|
+
skipEditorInterfaces: z
|
|
40
|
+
.boolean()
|
|
41
|
+
.optional()
|
|
42
|
+
.default(false)
|
|
43
|
+
.describe('Skip exporting editor interfaces'),
|
|
44
|
+
skipContent: z
|
|
45
|
+
.boolean()
|
|
46
|
+
.optional()
|
|
47
|
+
.default(false)
|
|
48
|
+
.describe('Skip exporting entries and assets'),
|
|
49
|
+
skipRoles: z
|
|
50
|
+
.boolean()
|
|
51
|
+
.optional()
|
|
52
|
+
.default(false)
|
|
53
|
+
.describe('Skip exporting roles and permissions'),
|
|
54
|
+
skipTags: z
|
|
55
|
+
.boolean()
|
|
56
|
+
.optional()
|
|
57
|
+
.default(false)
|
|
58
|
+
.describe('Skip exporting tags'),
|
|
59
|
+
skipWebhooks: z
|
|
60
|
+
.boolean()
|
|
61
|
+
.optional()
|
|
62
|
+
.default(false)
|
|
63
|
+
.describe('Skip exporting webhooks'),
|
|
64
|
+
stripTags: z
|
|
65
|
+
.boolean()
|
|
66
|
+
.optional()
|
|
67
|
+
.default(false)
|
|
68
|
+
.describe('Untag assets and entries'),
|
|
69
|
+
contentOnly: z
|
|
70
|
+
.boolean()
|
|
71
|
+
.optional()
|
|
72
|
+
.default(false)
|
|
73
|
+
.describe('Only export assets and entries'),
|
|
74
|
+
queryEntries: EntryQuerySchema.optional().describe('Export only entries that match query parameters'),
|
|
75
|
+
queryAssets: AssetQuerySchema.optional().describe('Export only assets that match query parameters'),
|
|
76
|
+
downloadAssets: z
|
|
77
|
+
.boolean()
|
|
78
|
+
.optional()
|
|
79
|
+
.default(false)
|
|
80
|
+
.describe('Download actual asset files'),
|
|
81
|
+
maxAllowedLimit: z
|
|
82
|
+
.number()
|
|
83
|
+
.optional()
|
|
84
|
+
.default(1000)
|
|
85
|
+
.describe('Maximum number of items per request'),
|
|
86
|
+
deliveryToken: z
|
|
87
|
+
.string()
|
|
88
|
+
.optional()
|
|
89
|
+
.describe('CDA token to export only published content (excludes tags)'),
|
|
90
|
+
host: z.string().optional().describe('Management API host'),
|
|
91
|
+
hostDelivery: z.string().optional().describe('Delivery API host'),
|
|
92
|
+
proxy: z.string().optional().describe('HTTP/HTTPS proxy config'),
|
|
93
|
+
rawProxy: z
|
|
94
|
+
.boolean()
|
|
95
|
+
.optional()
|
|
96
|
+
.describe('Pass raw proxy config directly to Axios'),
|
|
97
|
+
headers: z
|
|
98
|
+
.record(z.string())
|
|
99
|
+
.optional()
|
|
100
|
+
.describe('Additional headers to include in requests'),
|
|
101
|
+
errorLogFile: z.string().optional().describe('Path to error log output file'),
|
|
102
|
+
useVerboseRenderer: z
|
|
103
|
+
.boolean()
|
|
104
|
+
.optional()
|
|
105
|
+
.describe('Line-by-line logging, useful for CI'),
|
|
106
|
+
config: z
|
|
107
|
+
.string()
|
|
108
|
+
.optional()
|
|
109
|
+
.describe('Path to a JSON config file with all options'),
|
|
110
|
+
});
|
|
111
|
+
async function tool(args) {
|
|
112
|
+
// Get management token from the same config used by other MCP tools
|
|
113
|
+
const clientConfig = getDefaultClientConfig();
|
|
114
|
+
const managementToken = clientConfig.accessToken;
|
|
115
|
+
if (!managementToken) {
|
|
116
|
+
throw new Error('Contentful management token is not configured');
|
|
117
|
+
}
|
|
118
|
+
// Consolidate args with defaults and additional required fields
|
|
119
|
+
const exportOptions = {
|
|
120
|
+
...args,
|
|
121
|
+
managementToken,
|
|
122
|
+
environmentId: args.environmentId || 'master',
|
|
123
|
+
exportDir: args.exportDir || process.cwd(),
|
|
124
|
+
contentFile: args.contentFile || `contentful-export-${args.spaceId}.json`,
|
|
125
|
+
};
|
|
126
|
+
try {
|
|
127
|
+
const result = await contentfulExport(exportOptions);
|
|
128
|
+
const exportPath = path.join(exportOptions.exportDir, exportOptions.contentFile);
|
|
129
|
+
return createSuccessResponse('Space exported successfully', {
|
|
130
|
+
spaceId: args.spaceId,
|
|
131
|
+
environmentId: args.environmentId || 'master',
|
|
132
|
+
exportPath,
|
|
133
|
+
contentTypes: result.contentTypes?.length || 0,
|
|
134
|
+
entries: result.entries?.length || 0,
|
|
135
|
+
assets: result.assets?.length || 0,
|
|
136
|
+
locales: result.locales?.length || 0,
|
|
137
|
+
tags: result.tags?.length || 0,
|
|
138
|
+
webhooks: result.webhooks?.length || 0,
|
|
139
|
+
roles: result.roles?.length || 0,
|
|
140
|
+
editorInterfaces: result.editorInterfaces?.length || 0,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
throw new Error(`Failed to export space: ${error instanceof Error ? error.message : String(error)}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
export const createExportSpaceTool = withErrorHandling(tool, 'Error exporting space');
|
|
148
|
+
//# sourceMappingURL=exportSpace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportSpace.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/exportSpace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC,MAAM,CAAC;IACzD,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,QAA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AAO,EAAE,MAAM,IAAI,CAAC;YACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;YAClC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;YACpC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;YAC9B,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;YACtC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;YAChC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,IAAI,CAAC;SACvD,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACpF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CACpD,IAAI,EACJ,uBAAuB,CACxB,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createSuccessResponse, withErrorHandling, } from '../../../utils/response.js';
|
|
3
|
+
import { BaseToolSchema } from '../../../utils/tools.js';
|
|
4
|
+
import { createRequire } from 'module';
|
|
5
|
+
import { getDefaultClientConfig } from '../../../config/contentful.js';
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
const contentfulImport = require('contentful-import');
|
|
8
|
+
export const ImportSpaceToolParams = BaseToolSchema.extend({
|
|
9
|
+
contentFile: z
|
|
10
|
+
.string()
|
|
11
|
+
.optional()
|
|
12
|
+
.describe('Path to JSON file containing the content to import'),
|
|
13
|
+
content: z
|
|
14
|
+
.record(z.any())
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('JS object containing import content (must match expected structure)'),
|
|
17
|
+
contentModelOnly: z
|
|
18
|
+
.boolean()
|
|
19
|
+
.optional()
|
|
20
|
+
.default(false)
|
|
21
|
+
.describe('Import only content types'),
|
|
22
|
+
skipContentModel: z
|
|
23
|
+
.boolean()
|
|
24
|
+
.optional()
|
|
25
|
+
.default(false)
|
|
26
|
+
.describe('Skip importing content types and locales'),
|
|
27
|
+
skipLocales: z
|
|
28
|
+
.boolean()
|
|
29
|
+
.optional()
|
|
30
|
+
.default(false)
|
|
31
|
+
.describe('Skip importing locales'),
|
|
32
|
+
skipContentUpdates: z
|
|
33
|
+
.boolean()
|
|
34
|
+
.optional()
|
|
35
|
+
.default(false)
|
|
36
|
+
.describe('Do not update existing content'),
|
|
37
|
+
skipContentPublishing: z
|
|
38
|
+
.boolean()
|
|
39
|
+
.optional()
|
|
40
|
+
.default(false)
|
|
41
|
+
.describe('Create but do not publish content'),
|
|
42
|
+
uploadAssets: z
|
|
43
|
+
.boolean()
|
|
44
|
+
.optional()
|
|
45
|
+
.default(false)
|
|
46
|
+
.describe('Upload asset files (requires assetsDirectory)'),
|
|
47
|
+
skipAssetUpdates: z
|
|
48
|
+
.boolean()
|
|
49
|
+
.optional()
|
|
50
|
+
.default(false)
|
|
51
|
+
.describe('Do not update existing assets'),
|
|
52
|
+
assetsDirectory: z
|
|
53
|
+
.string()
|
|
54
|
+
.optional()
|
|
55
|
+
.describe('Path to directory containing exported asset files'),
|
|
56
|
+
timeout: z
|
|
57
|
+
.number()
|
|
58
|
+
.optional()
|
|
59
|
+
.default(3000)
|
|
60
|
+
.describe('Time between retries during asset processing (ms)'),
|
|
61
|
+
retryLimit: z
|
|
62
|
+
.number()
|
|
63
|
+
.optional()
|
|
64
|
+
.default(10)
|
|
65
|
+
.describe('Max retries for asset processing'),
|
|
66
|
+
host: z.string().optional().describe('Management API host'),
|
|
67
|
+
proxy: z
|
|
68
|
+
.string()
|
|
69
|
+
.optional()
|
|
70
|
+
.describe('HTTP/HTTPS proxy string (host:port or user:pass@host:port)'),
|
|
71
|
+
rawProxy: z
|
|
72
|
+
.boolean()
|
|
73
|
+
.optional()
|
|
74
|
+
.describe('Pass proxy config directly to Axios'),
|
|
75
|
+
rateLimit: z
|
|
76
|
+
.number()
|
|
77
|
+
.optional()
|
|
78
|
+
.default(7)
|
|
79
|
+
.describe('Max requests per second to the API'),
|
|
80
|
+
headers: z
|
|
81
|
+
.record(z.any())
|
|
82
|
+
.optional()
|
|
83
|
+
.describe('Additional headers to attach to requests'),
|
|
84
|
+
errorLogFile: z.string().optional().describe('Path to error log file'),
|
|
85
|
+
useVerboseRenderer: z
|
|
86
|
+
.boolean()
|
|
87
|
+
.optional()
|
|
88
|
+
.describe('Line-by-line progress output (good for CI)'),
|
|
89
|
+
config: z
|
|
90
|
+
.string()
|
|
91
|
+
.optional()
|
|
92
|
+
.describe('Path to config JSON file (merged with CLI args)'),
|
|
93
|
+
});
|
|
94
|
+
// Get management token from the same config used by other MCP tools
|
|
95
|
+
const clientConfig = getDefaultClientConfig();
|
|
96
|
+
const managementToken = clientConfig.accessToken;
|
|
97
|
+
if (!managementToken) {
|
|
98
|
+
throw new Error('Contentful management token is not configured');
|
|
99
|
+
}
|
|
100
|
+
async function tool(args) {
|
|
101
|
+
// Consolidate args with defaults and additional required fields
|
|
102
|
+
const importOptions = {
|
|
103
|
+
...args,
|
|
104
|
+
managementToken,
|
|
105
|
+
environmentId: args.environmentId || 'master',
|
|
106
|
+
};
|
|
107
|
+
try {
|
|
108
|
+
const result = await contentfulImport(importOptions);
|
|
109
|
+
return createSuccessResponse('Space imported successfully', {
|
|
110
|
+
spaceId: args.spaceId,
|
|
111
|
+
environmentId: args.environmentId || 'master',
|
|
112
|
+
contentTypes: result.contentTypes?.length || 0,
|
|
113
|
+
entries: result.entries?.length || 0,
|
|
114
|
+
assets: result.assets?.length || 0,
|
|
115
|
+
locales: result.locales?.length || 0,
|
|
116
|
+
tags: result.tags?.length || 0,
|
|
117
|
+
webhooks: result.webhooks?.length || 0,
|
|
118
|
+
roles: result.roles?.length || 0,
|
|
119
|
+
editorInterfaces: result.editorInterfaces?.length || 0,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
throw new Error(`Failed to import space: ${error instanceof Error ? error.message : String(error)}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export const createImportSpaceTool = withErrorHandling(tool, 'Error importing space');
|
|
127
|
+
//# sourceMappingURL=importSpace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importSpace.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/importSpace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC,MAAM,CAAC;IACzD,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,oDAAoD,CAAC;IACjE,OAAO,EAAE,CAAC;SACP,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;SACf,QAAQ,EAAE;SACV,QAAQ,CACP,qEAAqE,CACtE;IACH,gBAAgB,EAAE,CAAC;SAChB,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,2BAA2B,CAAC;IACxC,gBAAgB,EAAE,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YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC;YAC9C,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;YACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;YAClC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;YACpC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;YAC9B,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;YACtC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;YAChC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,IAAI,CAAC;SACvD,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACpF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CACpD,IAAI,EACJ,uBAAuB,CACxB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const S2S_MIGRATION_INSTRUCTIONS = `
|
|
2
|
+
You are a helpful assistant that can help with space to space migration.
|
|
3
|
+
|
|
4
|
+
You will be given a list of tools that can be used to migrate a space to another space.
|
|
5
|
+
|
|
6
|
+
## Workflow Management:
|
|
7
|
+
The space to space migration workflow is managed by a single unified tool: **space_to_space_migration_handler**
|
|
8
|
+
|
|
9
|
+
- To **start** the workflow: Call space_to_space_migration_handler with enableWorkflow=true
|
|
10
|
+
- To **conclude** the workflow: Call space_to_space_migration_handler with enableWorkflow=false
|
|
11
|
+
|
|
12
|
+
Once the workflow is started, you will need to call the tools in the following order:
|
|
13
|
+
|
|
14
|
+
1. space_to_space_migration_handler with enableWorkflow=true (already confirmed by the user)
|
|
15
|
+
2. IMPORTANT: After starting the workflow, you MUST ask the user for confirmation before proceeding to the next step. The enabled tools will not appear until the agent is reprompted by the user.
|
|
16
|
+
3. space_to_space_param_collection (only call after user confirms they are ready to proceed)
|
|
17
|
+
4. export_space
|
|
18
|
+
5. import_space
|
|
19
|
+
6. space_to_space_migration_handler with enableWorkflow=false (to conclude the workflow)
|
|
20
|
+
|
|
21
|
+
## Path Configuration Best Practices:
|
|
22
|
+
- ALWAYS use consistent path formats throughout the workflow
|
|
23
|
+
|
|
24
|
+
### Asset Handling Paths:
|
|
25
|
+
- When downloadAssets=true, the export tool creates an assets directory structure like: exportDir/images.ctfassets.net/
|
|
26
|
+
- The import tool expects assetsDirectory to point to the images.ctfassets.net directory, not the parent export directory
|
|
27
|
+
|
|
28
|
+
Troubleshooting:
|
|
29
|
+
- If the start_space_to_space_migration is not found, try to call it again on behalf of the user.
|
|
30
|
+
- If space_to_space_param_collection or other tools are not found, ask the user to confirm they are ready to proceed, as the tools need to be enabled first.
|
|
31
|
+
- If import fails with path errors, verify that exportDir and assetsDirectory paths are correctly aligned and accessible.
|
|
32
|
+
`;
|
|
33
|
+
//# sourceMappingURL=instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BzC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createSuccessResponse, withErrorHandling, } from '../../../utils/response.js';
|
|
3
|
+
import { BaseToolSchema } from '../../../utils/tools.js';
|
|
4
|
+
import { S2S_MIGRATION_INSTRUCTIONS } from './instructions.js';
|
|
5
|
+
export const S2S_TEARDOWN_INSTRUCTIONS = `
|
|
6
|
+
The space to space migration workflow has been concluded and all related tools have been disabled.
|
|
7
|
+
|
|
8
|
+
The workflow is now complete. You can start a new migration workflow by calling space_to_space_migration_handler with enableWorkflow=true if needed.
|
|
9
|
+
`;
|
|
10
|
+
export const SpaceToSpaceMigrationHandlerToolParams = BaseToolSchema.extend({
|
|
11
|
+
enableWorkflow: z
|
|
12
|
+
.boolean()
|
|
13
|
+
.describe('Set to true to enable the workflow tools, false to disable them and conclude the workflow'),
|
|
14
|
+
});
|
|
15
|
+
export const makeSpaceToSpaceMigrationHandlerTool = (tools) => {
|
|
16
|
+
async function tool(args) {
|
|
17
|
+
const { enableWorkflow } = args;
|
|
18
|
+
if (enableWorkflow) {
|
|
19
|
+
// Enable all workflow tools
|
|
20
|
+
tools.forEach((tool) => {
|
|
21
|
+
if (tool) {
|
|
22
|
+
tool.enable();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return createSuccessResponse('Space to space migration workflow started.', {
|
|
26
|
+
enableWorkflow,
|
|
27
|
+
instructions: S2S_MIGRATION_INSTRUCTIONS,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
// Disable all workflow tools (but not the handler itself)
|
|
32
|
+
tools.forEach((tool) => {
|
|
33
|
+
if (tool) {
|
|
34
|
+
tool.disable();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return createSuccessResponse('Space to space migration workflow concluded.', {
|
|
38
|
+
enableWorkflow,
|
|
39
|
+
instructions: S2S_TEARDOWN_INSTRUCTIONS,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return withErrorHandling(tool, 'Error managing space to space migration workflow');
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=migrationHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrationHandler.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/migrationHandler.ts"],"names":[],"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AAI,EACJ,kDAAkD,CACnD,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
/**
|
|
3
|
+
* Mock client for space-to-space migration tools
|
|
4
|
+
* Provides mocked contentful-export and contentful-import functions
|
|
5
|
+
*/
|
|
6
|
+
// Mock the contentful-export function
|
|
7
|
+
export const mockContentfulExport = vi.fn();
|
|
8
|
+
// Mock the contentful-import function
|
|
9
|
+
export const mockContentfulImport = vi.fn();
|
|
10
|
+
// Mock export result data
|
|
11
|
+
export const mockExportResult = {
|
|
12
|
+
contentTypes: [
|
|
13
|
+
{
|
|
14
|
+
sys: { id: 'test-content-type', type: 'ContentType' },
|
|
15
|
+
name: 'Test Content Type',
|
|
16
|
+
fields: [],
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
entries: [
|
|
20
|
+
{
|
|
21
|
+
sys: { id: 'test-entry', type: 'Entry' },
|
|
22
|
+
fields: { title: { 'en-US': 'Test Entry' } },
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
assets: [
|
|
26
|
+
{
|
|
27
|
+
sys: { id: 'test-asset', type: 'Asset' },
|
|
28
|
+
fields: { title: { 'en-US': 'Test Asset' } },
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
locales: [
|
|
32
|
+
{
|
|
33
|
+
sys: { id: 'en-US', type: 'Locale' },
|
|
34
|
+
code: 'en-US',
|
|
35
|
+
name: 'English (United States)',
|
|
36
|
+
default: true,
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
tags: [
|
|
40
|
+
{
|
|
41
|
+
sys: { id: 'test-tag', type: 'Tag' },
|
|
42
|
+
name: 'Test Tag',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
webhooks: [],
|
|
46
|
+
roles: [],
|
|
47
|
+
editorInterfaces: [],
|
|
48
|
+
};
|
|
49
|
+
// Mock import result data
|
|
50
|
+
export const mockImportResult = {
|
|
51
|
+
contentTypes: [
|
|
52
|
+
{
|
|
53
|
+
sys: { id: 'imported-content-type', type: 'ContentType' },
|
|
54
|
+
name: 'Imported Content Type',
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
entries: [
|
|
58
|
+
{
|
|
59
|
+
sys: { id: 'imported-entry', type: 'Entry' },
|
|
60
|
+
fields: { title: { 'en-US': 'Imported Entry' } },
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
assets: [
|
|
64
|
+
{
|
|
65
|
+
sys: { id: 'imported-asset', type: 'Asset' },
|
|
66
|
+
fields: { title: { 'en-US': 'Imported Asset' } },
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
locales: [
|
|
70
|
+
{
|
|
71
|
+
sys: { id: 'en-US', type: 'Locale' },
|
|
72
|
+
code: 'en-US',
|
|
73
|
+
name: 'English (United States)',
|
|
74
|
+
default: true,
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
tags: [],
|
|
78
|
+
webhooks: [],
|
|
79
|
+
roles: [],
|
|
80
|
+
editorInterfaces: [],
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Standard test arguments for space-to-space migration operations
|
|
84
|
+
*/
|
|
85
|
+
export const mockArgs = {
|
|
86
|
+
spaceId: 'test-space-id',
|
|
87
|
+
environmentId: 'test-environment',
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Helper function to create import test args with defaults
|
|
91
|
+
*/
|
|
92
|
+
export const createImportTestArgs = (overrides = {}) => ({
|
|
93
|
+
spaceId: 'test-space-id',
|
|
94
|
+
environmentId: 'test-environment',
|
|
95
|
+
contentModelOnly: false,
|
|
96
|
+
skipContentModel: false,
|
|
97
|
+
skipLocales: false,
|
|
98
|
+
skipContentUpdates: false,
|
|
99
|
+
skipContentPublishing: false,
|
|
100
|
+
uploadAssets: false,
|
|
101
|
+
skipAssetUpdates: false,
|
|
102
|
+
timeout: 3000,
|
|
103
|
+
retryLimit: 10,
|
|
104
|
+
rateLimit: 7,
|
|
105
|
+
...overrides,
|
|
106
|
+
});
|
|
107
|
+
/**
|
|
108
|
+
* Helper function to create export test args with defaults
|
|
109
|
+
*/
|
|
110
|
+
export const createExportTestArgs = (overrides = {}) => ({
|
|
111
|
+
spaceId: 'test-space-id',
|
|
112
|
+
environmentId: 'test-environment',
|
|
113
|
+
saveFile: true,
|
|
114
|
+
includeDrafts: false,
|
|
115
|
+
includeArchived: false,
|
|
116
|
+
skipContentModel: false,
|
|
117
|
+
skipEditorInterfaces: false,
|
|
118
|
+
skipContent: false,
|
|
119
|
+
skipRoles: false,
|
|
120
|
+
skipTags: false,
|
|
121
|
+
skipWebhooks: false,
|
|
122
|
+
stripTags: false,
|
|
123
|
+
contentOnly: false,
|
|
124
|
+
downloadAssets: false,
|
|
125
|
+
maxAllowedLimit: 1000,
|
|
126
|
+
rawProxy: false,
|
|
127
|
+
useVerboseRenderer: false,
|
|
128
|
+
...overrides,
|
|
129
|
+
});
|
|
130
|
+
/**
|
|
131
|
+
* Mock parameter collection arguments
|
|
132
|
+
*/
|
|
133
|
+
export const mockParamCollectionArgs = {
|
|
134
|
+
...mockArgs,
|
|
135
|
+
confirmation: false,
|
|
136
|
+
export: {
|
|
137
|
+
spaceId: 'source-space-id',
|
|
138
|
+
environmentId: 'master',
|
|
139
|
+
exportDir: '/test/export',
|
|
140
|
+
contentFile: 'export.json',
|
|
141
|
+
},
|
|
142
|
+
import: {
|
|
143
|
+
spaceId: 'target-space-id',
|
|
144
|
+
environmentId: 'master',
|
|
145
|
+
contentFile: '/test/export/export.json',
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Mock migration handler arguments
|
|
150
|
+
*/
|
|
151
|
+
export const mockMigrationHandlerArgs = {
|
|
152
|
+
spaceId: 'test-space-id',
|
|
153
|
+
environmentId: 'test-environment',
|
|
154
|
+
enableWorkflow: true,
|
|
155
|
+
};
|
|
156
|
+
//# sourceMappingURL=mockClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockClient.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/mockClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE5B;;;GAGG;AAEH,sCAAsC;AACtC,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AAE5C,sCAAsC;AACtC,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AAE5C,0BAA0B;AAC1B,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,YAAY,EAAE;QACZ;YACE,GAAG,EAAE,EAAE,EAAE,EAAE,mBAAmB,EAAE,IAAI,EAAE,aAAa,EAAE;YACrD,IAAI,EAAE,mBAAmB;YACzB,MAAM,EAAE,EAAE;SACX;KACF;IACD,OAAO,EAAE;QACP;YACE,GAAG,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE;YACxC,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE;SAC7C;KACF;IACD,MAAM,EAAE;QACN;YACE,GAAG,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE;YACxC,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE;SAC7C;KACF;IACD,OAAO,EAAE;QACP;YACE,GAAG,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE;YACpC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,yBAAyB;YAC/B,OAAO,EAAE,IAAI;SACd;KACF;IACD,IAAI,EAAE;QACJ;YACE,GAAG,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE;YACpC,IAAI,EAAE,UAAU;SACjB;KACF;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