@acquis-consulting/asm 1.0.5
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/README.md +0 -0
- package/dist/apps/gitDiffReview/gitDiffParser.d.ts +6 -0
- package/dist/apps/gitDiffReview/gitDiffParser.js +1 -0
- package/dist/apps/gitDiffReview/packageXml.d.ts +8 -0
- package/dist/apps/gitDiffReview/packageXml.js +1 -0
- package/dist/apps/gitDiffReview/tools.d.ts +42 -0
- package/dist/apps/gitDiffReview/tools.js +1 -0
- package/dist/apps/gitDiffReview/types.d.ts +19 -0
- package/dist/apps/gitDiffReview/types.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +193 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata-diff.html +98 -0
- package/dist/tools/aggregateQuery.d.ts +85 -0
- package/dist/tools/aggregateQuery.js +110 -0
- package/dist/tools/aggregateQuery.js.map +1 -0
- package/dist/tools/bulkExportAbort.d.ts +37 -0
- package/dist/tools/bulkExportAbort.js +44 -0
- package/dist/tools/bulkExportAbort.js.map +1 -0
- package/dist/tools/bulkExportResults.d.ts +51 -0
- package/dist/tools/bulkExportResults.js +76 -0
- package/dist/tools/bulkExportResults.js.map +1 -0
- package/dist/tools/bulkExportStart.d.ts +61 -0
- package/dist/tools/bulkExportStart.js +68 -0
- package/dist/tools/bulkExportStart.js.map +1 -0
- package/dist/tools/bulkExportStatus.d.ts +37 -0
- package/dist/tools/bulkExportStatus.js +54 -0
- package/dist/tools/bulkExportStatus.js.map +1 -0
- package/dist/tools/crossObjectSearch.d.ts +155 -0
- package/dist/tools/crossObjectSearch.js +145 -0
- package/dist/tools/crossObjectSearch.js.map +1 -0
- package/dist/tools/debugLogs.d.ts +106 -0
- package/dist/tools/debugLogs.js +189 -0
- package/dist/tools/debugLogs.js.map +1 -0
- package/dist/tools/deployMetadata.d.ts +60 -0
- package/dist/tools/deployMetadata.js +106 -0
- package/dist/tools/deployMetadata.js.map +1 -0
- package/dist/tools/deployPackage.d.ts +49 -0
- package/dist/tools/deployPackage.js +1 -0
- package/dist/tools/dml.d.ts +70 -0
- package/dist/tools/dml.js +105 -0
- package/dist/tools/dml.js.map +1 -0
- package/dist/tools/dmlDelete.d.ts +51 -0
- package/dist/tools/dmlDelete.js +71 -0
- package/dist/tools/dmlDelete.js.map +1 -0
- package/dist/tools/executeAnonymous.d.ts +63 -0
- package/dist/tools/executeAnonymous.js +77 -0
- package/dist/tools/executeAnonymous.js.map +1 -0
- package/dist/tools/fieldManagement.d.ts +222 -0
- package/dist/tools/fieldManagement.js +234 -0
- package/dist/tools/fieldManagement.js.map +1 -0
- package/dist/tools/fieldPermissions.d.ts +94 -0
- package/dist/tools/fieldPermissions.js +191 -0
- package/dist/tools/fieldPermissions.js.map +1 -0
- package/dist/tools/getDependencies.d.ts +58 -0
- package/dist/tools/getDependencies.js +105 -0
- package/dist/tools/getDependencies.js.map +1 -0
- package/dist/tools/listUserPermissions.d.ts +36 -0
- package/dist/tools/listUserPermissions.js +59 -0
- package/dist/tools/listUserPermissions.js.map +1 -0
- package/dist/tools/metadataDescribe.d.ts +37 -0
- package/dist/tools/metadataDescribe.js +35 -0
- package/dist/tools/metadataDescribe.js.map +1 -0
- package/dist/tools/metadataDiff.d.ts +66 -0
- package/dist/tools/metadataDiff.js +215 -0
- package/dist/tools/metadataDiff.js.map +1 -0
- package/dist/tools/metadataDiffFileDetail.d.ts +44 -0
- package/dist/tools/metadataDiffFileDetail.js +84 -0
- package/dist/tools/metadataDiffFileDetail.js.map +1 -0
- package/dist/tools/metadataDiffFiles.d.ts +37 -0
- package/dist/tools/metadataDiffFiles.js +72 -0
- package/dist/tools/metadataDiffFiles.js.map +1 -0
- package/dist/tools/metadataDiffGeneratePackage.d.ts +73 -0
- package/dist/tools/metadataDiffGeneratePackage.js +122 -0
- package/dist/tools/metadataDiffGeneratePackage.js.map +1 -0
- package/dist/tools/metadataImport.d.ts +63 -0
- package/dist/tools/metadataImport.js +122 -0
- package/dist/tools/metadataImport.js.map +1 -0
- package/dist/tools/metadataJobStatus.d.ts +44 -0
- package/dist/tools/metadataJobStatus.js +101 -0
- package/dist/tools/metadataJobStatus.js.map +1 -0
- package/dist/tools/metadataList.d.ts +44 -0
- package/dist/tools/metadataList.js +49 -0
- package/dist/tools/metadataList.js.map +1 -0
- package/dist/tools/metadataRead.d.ts +47 -0
- package/dist/tools/metadataRead.js +52 -0
- package/dist/tools/metadataRead.js.map +1 -0
- package/dist/tools/metadataTypeSchema.d.ts +44 -0
- package/dist/tools/metadataTypeSchema.js +101 -0
- package/dist/tools/metadataTypeSchema.js.map +1 -0
- package/dist/tools/metadataWsdl.d.ts +19 -0
- package/dist/tools/metadataWsdl.js +1 -0
- package/dist/tools/objectManagement.d.ts +107 -0
- package/dist/tools/objectManagement.js +123 -0
- package/dist/tools/objectManagement.js.map +1 -0
- package/dist/tools/objectPermissions.d.ts +101 -0
- package/dist/tools/objectPermissions.js +157 -0
- package/dist/tools/objectPermissions.js.map +1 -0
- package/dist/tools/objectSchema.d.ts +37 -0
- package/dist/tools/objectSchema.js +66 -0
- package/dist/tools/objectSchema.js.map +1 -0
- package/dist/tools/objectSearch.d.ts +37 -0
- package/dist/tools/objectSearch.js +44 -0
- package/dist/tools/objectSearch.js.map +1 -0
- package/dist/tools/packageStatus.d.ts +24 -0
- package/dist/tools/packageStatus.js +1 -0
- package/dist/tools/permissionSetAssignment.d.ts +39 -0
- package/dist/tools/permissionSetAssignment.js +1 -0
- package/dist/tools/readApexClasses.d.ts +50 -0
- package/dist/tools/readApexClasses.js +83 -0
- package/dist/tools/readApexClasses.js.map +1 -0
- package/dist/tools/readApexTriggers.d.ts +50 -0
- package/dist/tools/readApexTriggers.js +82 -0
- package/dist/tools/readApexTriggers.js.map +1 -0
- package/dist/tools/recordPicker.d.ts +48 -0
- package/dist/tools/recordPicker.js +1 -0
- package/dist/tools/recordQuery.d.ts +68 -0
- package/dist/tools/recordQuery.js +131 -0
- package/dist/tools/recordQuery.js.map +1 -0
- package/dist/tools/retrieveJobStatus.d.ts +51 -0
- package/dist/tools/retrieveJobStatus.js +192 -0
- package/dist/tools/retrieveJobStatus.js.map +1 -0
- package/dist/tools/retrieveMetadata.d.ts +79 -0
- package/dist/tools/retrieveMetadata.js +225 -0
- package/dist/tools/retrieveMetadata.js.map +1 -0
- package/dist/tools/retrievePackage.d.ts +37 -0
- package/dist/tools/retrievePackage.js +1 -0
- package/dist/tools/salesforceLogin.d.ts +36 -0
- package/dist/tools/salesforceLogin.js +75 -0
- package/dist/tools/salesforceLogin.js.map +1 -0
- package/dist/tools/selectOrg.d.ts +25 -0
- package/dist/tools/selectOrg.js +91 -0
- package/dist/tools/selectOrg.js.map +1 -0
- package/dist/tools/toolingQuery.d.ts +37 -0
- package/dist/tools/toolingQuery.js +54 -0
- package/dist/tools/toolingQuery.js.map +1 -0
- package/dist/tools/userPermissions.d.ts +76 -0
- package/dist/tools/userPermissions.js +130 -0
- package/dist/tools/userPermissions.js.map +1 -0
- package/dist/tools/versionMetadataComplete.d.ts +45 -0
- package/dist/tools/versionMetadataComplete.js +1 -0
- package/dist/tools/versionMetadataStart.d.ts +25 -0
- package/dist/tools/versionMetadataStart.js +1 -0
- package/dist/tools/versionMetadataStatus.d.ts +25 -0
- package/dist/tools/versionMetadataStatus.js +1 -0
- package/dist/tools/writeApexClasses.d.ts +64 -0
- package/dist/tools/writeApexClasses.js +79 -0
- package/dist/tools/writeApexClasses.js.map +1 -0
- package/dist/tools/writeApexTriggers.d.ts +71 -0
- package/dist/tools/writeApexTriggers.js +96 -0
- package/dist/tools/writeApexTriggers.js.map +1 -0
- package/dist/types/connection.d.ts +20 -0
- package/dist/types/connection.js +9 -0
- package/dist/types/connection.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/metadata.d.ts +44 -0
- package/dist/types/metadata.js +2 -0
- package/dist/types/metadata.js.map +1 -0
- package/dist/types/salesforce.d.ts +38 -0
- package/dist/types/salesforce.js +2 -0
- package/dist/types/salesforce.js.map +1 -0
- package/dist/utils/apexContainer.d.ts +18 -0
- package/dist/utils/apexContainer.js +79 -0
- package/dist/utils/apexContainer.js.map +1 -0
- package/dist/utils/connection.d.ts +3 -0
- package/dist/utils/connection.js +135 -0
- package/dist/utils/connection.js.map +1 -0
- package/dist/utils/decomposePermissions.d.ts +16 -0
- package/dist/utils/decomposePermissions.js +188 -0
- package/dist/utils/decomposePermissions.js.map +1 -0
- package/dist/utils/dxPathMapper.d.ts +16 -0
- package/dist/utils/dxPathMapper.js +217 -0
- package/dist/utils/dxPathMapper.js.map +1 -0
- package/dist/utils/errors.d.ts +8 -0
- package/dist/utils/errors.js +40 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/oauthWebFlow.d.ts +8 -0
- package/dist/utils/oauthWebFlow.js +172 -0
- package/dist/utils/oauthWebFlow.js.map +1 -0
- package/dist/utils/packageJobs.d.ts +17 -0
- package/dist/utils/packageJobs.js +1 -0
- package/dist/utils/packageXml.d.ts +18 -0
- package/dist/utils/packageXml.js +1 -0
- package/dist/utils/permissionSetResolver.d.ts +14 -0
- package/dist/utils/permissionSetResolver.js +1 -0
- package/dist/utils/preSelectMatcher.d.ts +18 -0
- package/dist/utils/preSelectMatcher.js +1 -0
- package/dist/utils/profileCleanup.d.ts +18 -0
- package/dist/utils/profileCleanup.js +1 -0
- package/dist/utils/retrieveStore.d.ts +12 -0
- package/dist/utils/retrieveStore.js +1 -0
- package/dist/utils/sfCli.d.ts +18 -0
- package/dist/utils/sfCli.js +130 -0
- package/dist/utils/sfCli.js.map +1 -0
- package/dist/utils/tokenBroker.d.ts +13 -0
- package/dist/utils/tokenBroker.js +73 -0
- package/dist/utils/tokenBroker.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Connection } from 'jsforce';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export declare const retrieveMetadataTool: {
|
|
4
|
+
name: "salesforce_retrieve_metadata";
|
|
5
|
+
description: string;
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: "object";
|
|
8
|
+
properties: {
|
|
9
|
+
metadata: {
|
|
10
|
+
type: string;
|
|
11
|
+
items: {
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
packageNames: {
|
|
17
|
+
type: string;
|
|
18
|
+
items: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
outputDir: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
targetFolderId: {
|
|
28
|
+
type: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
tag: {
|
|
32
|
+
type: string;
|
|
33
|
+
enum: string[];
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
required: never[];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export interface RetrieveMetadataArgs {
|
|
41
|
+
metadata?: string[];
|
|
42
|
+
packageNames?: string[];
|
|
43
|
+
outputDir?: string;
|
|
44
|
+
targetFolderId?: string;
|
|
45
|
+
tag?: 'source' | 'target';
|
|
46
|
+
}
|
|
47
|
+
export declare function walkDir(dir: string): string[];
|
|
48
|
+
export declare function handleRetrieveMetadata(conn: Connection, args: RetrieveMetadataArgs): Promise<{
|
|
49
|
+
content: {
|
|
50
|
+
type: "text";
|
|
51
|
+
text: string;
|
|
52
|
+
}[];
|
|
53
|
+
isError: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
export declare const retrieveMetadataSchema: {
|
|
56
|
+
metadata: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
|
+
packageNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
|
+
outputDir: z.ZodOptional<z.ZodString>;
|
|
59
|
+
targetFolderId: z.ZodOptional<z.ZodString>;
|
|
60
|
+
tag: z.ZodDefault<z.ZodEnum<{
|
|
61
|
+
source: "source";
|
|
62
|
+
target: "target";
|
|
63
|
+
}>>;
|
|
64
|
+
};
|
|
65
|
+
export declare const retrieveMetadataDescriptor: {
|
|
66
|
+
name: string;
|
|
67
|
+
description: string;
|
|
68
|
+
schema: {
|
|
69
|
+
metadata: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
|
+
packageNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
71
|
+
outputDir: z.ZodOptional<z.ZodString>;
|
|
72
|
+
targetFolderId: z.ZodOptional<z.ZodString>;
|
|
73
|
+
tag: z.ZodDefault<z.ZodEnum<{
|
|
74
|
+
source: "source";
|
|
75
|
+
target: "target";
|
|
76
|
+
}>>;
|
|
77
|
+
};
|
|
78
|
+
handler: typeof handleRetrieveMetadata;
|
|
79
|
+
};
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { readdirSync, openSync, readFileSync, existsSync, writeFileSync } from 'fs';
|
|
3
|
+
import { mkdirSync } from 'fs';
|
|
4
|
+
import { spawn } from 'child_process';
|
|
5
|
+
import { join, isAbsolute } from 'path';
|
|
6
|
+
import { toolResponse } from '../utils/index.js';
|
|
7
|
+
import { resolveBaseOutputDir, createJobDir, createSfdxProjectJson, authenticateOrg, ensureSfCli, runSfCli, } from '../utils/sfCli.js';
|
|
8
|
+
export const retrieveMetadataTool = {
|
|
9
|
+
name: 'salesforce_retrieve_metadata',
|
|
10
|
+
description: 'Retrieve Salesforce metadata in DX source format using the sf CLI (async background process). ' +
|
|
11
|
+
'Returns immediately with an output directory path — use salesforce_retrieve_job_status to poll progress. ' +
|
|
12
|
+
'Ideal for Profiles, Permission Sets, Custom Objects, etc. ' +
|
|
13
|
+
'Use tag="target" for the baseline org and tag="source" for the org to compare against. ' +
|
|
14
|
+
'To refresh metadata already in an existing directory, pass only targetFolderId (no metadata or packageNames) — only the exact components tracked locally will be retrieved. ' +
|
|
15
|
+
'Requires the Salesforce CLI (sf) to be installed.',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
metadata: {
|
|
20
|
+
type: 'array',
|
|
21
|
+
items: { type: 'string' },
|
|
22
|
+
description: 'Metadata components to retrieve, e.g. ["Profile:Admin", "PermissionSet:*", "CustomObject:Account"]',
|
|
23
|
+
},
|
|
24
|
+
packageNames: {
|
|
25
|
+
type: 'array',
|
|
26
|
+
items: { type: 'string' },
|
|
27
|
+
description: 'Named packages to retrieve',
|
|
28
|
+
},
|
|
29
|
+
outputDir: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'Override output directory (defaults to SALESFORCE_EXPORT_DIR or system temp)',
|
|
32
|
+
},
|
|
33
|
+
targetFolderId: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: 'The output directory path from a previous retrieve (the "Output directory" value). When provided, files are written to the same directory instead of creating a new one. Pass targetFolderId alone (without metadata or packageNames) to refresh all metadata already in that directory.',
|
|
36
|
+
},
|
|
37
|
+
tag: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
enum: ['source', 'target'],
|
|
40
|
+
description: 'Tag for the retrieve subfolder. Use "target" for baseline org, "source" for comparison org. Defaults to "source".',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
required: [],
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
export function walkDir(dir) {
|
|
47
|
+
const files = [];
|
|
48
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
49
|
+
const full = join(dir, entry.name);
|
|
50
|
+
if (entry.isDirectory()) {
|
|
51
|
+
files.push(...walkDir(full));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
files.push(full);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return files;
|
|
58
|
+
}
|
|
59
|
+
export async function handleRetrieveMetadata(conn, args) {
|
|
60
|
+
try {
|
|
61
|
+
await ensureSfCli();
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
return toolResponse(err.message, true);
|
|
65
|
+
}
|
|
66
|
+
const { metadata, packageNames, outputDir, targetFolderId, tag = 'source' } = args;
|
|
67
|
+
const isRefresh = !!targetFolderId &&
|
|
68
|
+
(!metadata || metadata.length === 0) &&
|
|
69
|
+
(!packageNames || packageNames.length === 0);
|
|
70
|
+
if (!isRefresh && (!metadata || metadata.length === 0) && (!packageNames || packageNames.length === 0)) {
|
|
71
|
+
return toolResponse('At least one of "metadata" or "packageNames" must be provided.', true);
|
|
72
|
+
}
|
|
73
|
+
// Set up job directory (UUID-level) and tagged subfolder
|
|
74
|
+
const baseDir = outputDir || resolveBaseOutputDir();
|
|
75
|
+
let jobDir;
|
|
76
|
+
try {
|
|
77
|
+
if (targetFolderId) {
|
|
78
|
+
jobDir = isAbsolute(targetFolderId) ? targetFolderId : join(baseDir, targetFolderId);
|
|
79
|
+
mkdirSync(jobDir, { recursive: true });
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
jobDir = createJobDir(baseDir);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
return toolResponse(`Failed to create output directory: ${err.message}`, true);
|
|
87
|
+
}
|
|
88
|
+
// Create the tagged subfolder (source/ or target/) and its .metadata-diff/ subdir
|
|
89
|
+
const taggedDir = join(jobDir, tag);
|
|
90
|
+
try {
|
|
91
|
+
mkdirSync(taggedDir, { recursive: true });
|
|
92
|
+
mkdirSync(join(taggedDir, '.metadata-diff'), { recursive: true });
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
return toolResponse(`Failed to create tagged subfolder: ${err.message}`, true);
|
|
96
|
+
}
|
|
97
|
+
// Write .gitignore so the per-tag git repo ignores operational files
|
|
98
|
+
try {
|
|
99
|
+
const gitignorePath = join(taggedDir, '.gitignore');
|
|
100
|
+
if (!existsSync(gitignorePath)) {
|
|
101
|
+
writeFileSync(gitignorePath, '.metadata-diff/\n', 'utf-8');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch { /* best-effort */ }
|
|
105
|
+
// For refresh, verify sfdx-project.json already exists in tagged subfolder; otherwise create it
|
|
106
|
+
if (isRefresh) {
|
|
107
|
+
if (!existsSync(join(taggedDir, 'sfdx-project.json'))) {
|
|
108
|
+
return toolResponse('Cannot refresh: no sfdx-project.json found in the target directory. ' +
|
|
109
|
+
'This directory does not appear to contain a previous retrieve.', true);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// sf requires a project context
|
|
114
|
+
createSfdxProjectJson(taggedDir);
|
|
115
|
+
}
|
|
116
|
+
// Authenticate the org
|
|
117
|
+
let alias;
|
|
118
|
+
try {
|
|
119
|
+
alias = await authenticateOrg(conn);
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
return toolResponse(`Authentication failed: ${err.message}`, true);
|
|
123
|
+
}
|
|
124
|
+
// Persist org identity info (best-effort)
|
|
125
|
+
try {
|
|
126
|
+
const identity = await conn.identity();
|
|
127
|
+
const orgInfo = {
|
|
128
|
+
instanceUrl: conn.instanceUrl,
|
|
129
|
+
orgId: identity.organization_id,
|
|
130
|
+
username: identity.username,
|
|
131
|
+
apiVersion: conn.version,
|
|
132
|
+
retrievedAt: new Date().toISOString(),
|
|
133
|
+
};
|
|
134
|
+
writeFileSync(join(taggedDir, '.metadata-diff', 'org-info.json'), JSON.stringify(orgInfo, null, 2), 'utf-8');
|
|
135
|
+
}
|
|
136
|
+
catch { /* best-effort — don't fail the retrieve */ }
|
|
137
|
+
// Build retrieve command
|
|
138
|
+
const cliArgs = [
|
|
139
|
+
'project', 'retrieve', 'start',
|
|
140
|
+
'--target-org', alias,
|
|
141
|
+
'--json',
|
|
142
|
+
];
|
|
143
|
+
if (isRefresh) {
|
|
144
|
+
const projectJson = JSON.parse(readFileSync(join(taggedDir, 'sfdx-project.json'), 'utf-8'));
|
|
145
|
+
const srcPath = projectJson?.packageDirectories?.[0]?.path || '.';
|
|
146
|
+
const resolvedSourceDir = join(taggedDir, srcPath);
|
|
147
|
+
// Generate manifest scoped to only local components
|
|
148
|
+
const manifestResult = await runSfCli([
|
|
149
|
+
'project', 'generate', 'manifest',
|
|
150
|
+
'--source-dir', resolvedSourceDir,
|
|
151
|
+
'--name', 'package.xml',
|
|
152
|
+
'--output-dir', taggedDir,
|
|
153
|
+
], { cwd: taggedDir });
|
|
154
|
+
if (manifestResult.exitCode !== 0) {
|
|
155
|
+
const msg = manifestResult.jsonOutput?.message || manifestResult.stderr || 'Unknown error';
|
|
156
|
+
return toolResponse(`Failed to generate manifest for refresh: ${msg}`, true);
|
|
157
|
+
}
|
|
158
|
+
const manifestPath = join(taggedDir, 'package.xml');
|
|
159
|
+
if (!existsSync(manifestPath)) {
|
|
160
|
+
return toolResponse('Failed to generate package.xml manifest from local source.', true);
|
|
161
|
+
}
|
|
162
|
+
cliArgs.push('--manifest', manifestPath);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
if (metadata && metadata.length > 0) {
|
|
166
|
+
for (const m of metadata) {
|
|
167
|
+
cliArgs.push('--metadata', m);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (packageNames && packageNames.length > 0) {
|
|
171
|
+
for (const pkg of packageNames) {
|
|
172
|
+
cliArgs.push('--package-name', pkg);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// Spawn detached — writes results to files in tagged subfolder, returns immediately
|
|
177
|
+
const ts = Date.now();
|
|
178
|
+
const stdoutFd = openSync(join(taggedDir, '.metadata-diff', `.retrieve-result-${ts}.json`), 'w');
|
|
179
|
+
const stderrFd = openSync(join(taggedDir, '.metadata-diff', `.retrieve-log-${ts}.txt`), 'w');
|
|
180
|
+
const child = spawn('sf', cliArgs, {
|
|
181
|
+
stdio: ['ignore', stdoutFd, stderrFd],
|
|
182
|
+
detached: true,
|
|
183
|
+
cwd: taggedDir,
|
|
184
|
+
});
|
|
185
|
+
child.unref();
|
|
186
|
+
// Return immediately
|
|
187
|
+
const nextStep = tag === 'target'
|
|
188
|
+
? [
|
|
189
|
+
`Next: retrieve source org metadata with:`,
|
|
190
|
+
` salesforce_retrieve_metadata with tag: "source", targetFolderId: "${jobDir}"`,
|
|
191
|
+
]
|
|
192
|
+
: [
|
|
193
|
+
`Next: run salesforce_metadata_diff with:`,
|
|
194
|
+
` workingDir: "${jobDir}"`,
|
|
195
|
+
];
|
|
196
|
+
const summary = [
|
|
197
|
+
`Retrieve started (background) into ${tag}/ subfolder.`,
|
|
198
|
+
`Output directory: ${jobDir}`,
|
|
199
|
+
`Tagged subfolder: ${taggedDir}`,
|
|
200
|
+
'',
|
|
201
|
+
'Use salesforce_retrieve_job_status every 5-10 seconds with:',
|
|
202
|
+
` jobDir: "${jobDir}"`,
|
|
203
|
+
` tag: "${tag}"`,
|
|
204
|
+
'',
|
|
205
|
+
...nextStep,
|
|
206
|
+
'',
|
|
207
|
+
`To refresh later, call salesforce_retrieve_metadata with:`,
|
|
208
|
+
` targetFolderId: "${jobDir}", tag: "${tag}"`,
|
|
209
|
+
].join('\n');
|
|
210
|
+
return toolResponse(summary);
|
|
211
|
+
}
|
|
212
|
+
export const retrieveMetadataSchema = {
|
|
213
|
+
metadata: z.array(z.string()).describe('Metadata components to retrieve, e.g. ["Profile:Admin", "PermissionSet:*", "CustomObject:Account"]').optional(),
|
|
214
|
+
packageNames: z.array(z.string()).describe('Named packages to retrieve').optional(),
|
|
215
|
+
outputDir: z.string().describe('Override output directory (defaults to SALESFORCE_EXPORT_DIR or system temp)').optional(),
|
|
216
|
+
targetFolderId: z.string().describe('The output directory path from a previous retrieve (the "Output directory" value). When provided, files are written to the same directory instead of creating a new one. Pass targetFolderId alone (without metadata or packageNames) to refresh all metadata already in that directory.').optional(),
|
|
217
|
+
tag: z.enum(['source', 'target']).describe('Tag for the retrieve subfolder. Use "target" for baseline org, "source" for comparison org.').default('source'),
|
|
218
|
+
};
|
|
219
|
+
export const retrieveMetadataDescriptor = {
|
|
220
|
+
name: 'salesforce_retrieve_metadata',
|
|
221
|
+
description: retrieveMetadataTool.description,
|
|
222
|
+
schema: retrieveMetadataSchema,
|
|
223
|
+
handler: handleRetrieveMetadata,
|
|
224
|
+
};
|
|
225
|
+
//# sourceMappingURL=retrieveMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieveMetadata.js","sourceRoot":"","sources":["../../src/tools/retrieveMetadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,8BAAuC;IAC7C,WAAW,EACT,gGAAgG;QAChG,2GAA2G;QAC3G,4DAA4D;QAC5D,yFAAyF;QACzF,8KAA8K;QAC9K,mDAAmD;IACrD,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,WAAW,E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,CAAC,OAAO,CAAC,QAAQ,CAAC;CAC5J,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE,oBAAoB,CAAC,WAAW;IAC7C,MAAM,EAAE,sBAAsB;IAC9B,OAAO,EAAE,sBAAsB;CAChC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Connection } from 'jsforce';
|
|
2
|
+
import { type ComponentMap } from '../utils/packageXml.js';
|
|
3
|
+
export declare const retrievePackageTool: {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: "object";
|
|
8
|
+
properties: {
|
|
9
|
+
componentMap: {
|
|
10
|
+
type: string;
|
|
11
|
+
description: string;
|
|
12
|
+
additionalProperties: {
|
|
13
|
+
type: string;
|
|
14
|
+
items: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
apiVersion: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
required: string[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export interface RetrievePackageArgs {
|
|
28
|
+
componentMap: ComponentMap;
|
|
29
|
+
apiVersion?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function handleRetrievePackage(conn: Connection, args: RetrievePackageArgs): Promise<{
|
|
32
|
+
content: {
|
|
33
|
+
type: "text";
|
|
34
|
+
text: string;
|
|
35
|
+
}[];
|
|
36
|
+
isError: boolean;
|
|
37
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{constants as e}from"node:fs";import{mkdir as t,access as a}from"node:fs/promises";import{tmpdir as o}from"node:os";import{join as r}from"node:path";import{toolResponse as s}from"../utils/index.js";import{componentMapToPackageTypes as n}from"../utils/packageXml.js";import{registerJob as i}from"../utils/packageJobs.js";export const retrievePackageTool={name:"salesforce_retrieve_package",description:"Start an asynchronous metadata retrieve using a component map. Returns a job ID immediately — use salesforce_package_status to poll for completion. When done, files are extracted to disk (bypassing the conversation context). Output directory is controlled by the SALESFORCE_EXPORT_DIR env var, falling back to a temp directory. Ideal for bulk metadata operations like reviewing many Apex classes or org-to-org migrations.",inputSchema:{type:"object",properties:{componentMap:{type:"object",description:'JSON map of metadata type to member names. Example: { "ApexClass": ["MyClass", "*"], "CustomObject": ["Account"] }. Use "*" to retrieve all members of a type.',additionalProperties:{type:"array",items:{type:"string"}}},apiVersion:{type:"string",description:'Salesforce API version. Default: "62.0".'}},required:["componentMap"]}};export async function handleRetrievePackage(p,c){const{componentMap:m,apiVersion:d}=c,l=process.env.SALESFORCE_EXPORT_DIR||r(o(),"salesforce-retrieve");try{const o=n(m),c=(await p.metadata.retrieve({singlePackage:!0,unpackaged:{types:o,version:d||"62.0"}})).id;if(!c)return s("Retrieve request did not return a job ID.",!0);const u=r(l,c);try{await t(u,{recursive:!0}),await a(u,e.W_OK)}catch(e){return s(`Output directory "${u}" cannot be created or is not writable: ${e.message}`,!0)}i({type:"retrieve",id:c,conn:p,startedAt:Date.now(),outputDirectory:u,componentMap:m});const g=Object.entries(m).map(([e,t])=>` ${e}: ${t.join(", ")}`).join("\n");return s(`Metadata retrieve started.\n\nJob ID: ${c}\nOutput: ${u}\nComponents:\n${g}\n\nNext step: Use salesforce_package_status with jobId "${c}" to check progress.`)}catch(e){return s(`Failed to start metadata retrieve: ${e.message}`,!0)}}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export declare const salesforceLoginTool: Tool;
|
|
4
|
+
export interface SalesforceLoginArgs {
|
|
5
|
+
environment: 'production' | 'sandbox' | 'custom';
|
|
6
|
+
custom_domain?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function handleSalesforceLogin(args: SalesforceLoginArgs): Promise<{
|
|
9
|
+
content: {
|
|
10
|
+
type: "text";
|
|
11
|
+
text: string;
|
|
12
|
+
}[];
|
|
13
|
+
isError: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const salesforceLoginSchema: {
|
|
16
|
+
environment: z.ZodEnum<{
|
|
17
|
+
custom: "custom";
|
|
18
|
+
production: "production";
|
|
19
|
+
sandbox: "sandbox";
|
|
20
|
+
}>;
|
|
21
|
+
custom_domain: z.ZodOptional<z.ZodString>;
|
|
22
|
+
};
|
|
23
|
+
export declare const salesforceLoginDescriptor: {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string | undefined;
|
|
26
|
+
schema: {
|
|
27
|
+
environment: z.ZodEnum<{
|
|
28
|
+
custom: "custom";
|
|
29
|
+
production: "production";
|
|
30
|
+
sandbox: "sandbox";
|
|
31
|
+
}>;
|
|
32
|
+
custom_domain: z.ZodOptional<z.ZodString>;
|
|
33
|
+
};
|
|
34
|
+
handler: typeof handleSalesforceLogin;
|
|
35
|
+
noConnection: boolean;
|
|
36
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { startOAuthWebFlow } from '../utils/oauthWebFlow.js';
|
|
3
|
+
import { toolResponse } from '../utils/errors.js';
|
|
4
|
+
const ACQUIS_CONNECTED_APP_CLIENT_ID = '3MVG9p1Q1BCe9GmCr_ATVWfyCxRkeY5yCTFwBifYdiG5GzP5VK7BPNK5d0QxAhZJVhyqV7I3vVwpXHo.87Rpv';
|
|
5
|
+
export const salesforceLoginTool = {
|
|
6
|
+
name: 'salesforce_login',
|
|
7
|
+
description: 'REQUIRED FIRST STEP — call this before any other Salesforce tool when starting a new session. ' +
|
|
8
|
+
'Authenticates to Salesforce via browser OAuth2 web flow. ' +
|
|
9
|
+
'Opens a browser tab where the user logs in and authorizes the Acquis MCP Connected App. ' +
|
|
10
|
+
'Select the environment (production, sandbox, or custom domain) to target the correct Salesforce login page. ',
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
environment: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
enum: ['production', 'sandbox', 'custom'],
|
|
17
|
+
description: 'The Salesforce environment to log in to.',
|
|
18
|
+
},
|
|
19
|
+
custom_domain: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'Required when environment is "custom". Your org\'s My Domain, e.g. mycompany.my.salesforce.com',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
required: ['environment'],
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export async function handleSalesforceLogin(args) {
|
|
28
|
+
try {
|
|
29
|
+
let loginUrl;
|
|
30
|
+
let environmentDomain;
|
|
31
|
+
if (args.environment === 'production') {
|
|
32
|
+
loginUrl = 'https://login.salesforce.com';
|
|
33
|
+
environmentDomain = 'login.salesforce.com';
|
|
34
|
+
}
|
|
35
|
+
else if (args.environment === 'sandbox') {
|
|
36
|
+
loginUrl = 'https://test.salesforce.com';
|
|
37
|
+
environmentDomain = 'test.salesforce.com';
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
if (!args.custom_domain) {
|
|
41
|
+
return toolResponse('custom_domain is required when environment is "custom". ' +
|
|
42
|
+
'Provide your org\'s My Domain, e.g. mycompany.my.salesforce.com', true);
|
|
43
|
+
}
|
|
44
|
+
const domain = args.custom_domain.replace(/^https?:\/\//, '').replace(/\/$/, '');
|
|
45
|
+
loginUrl = `https://${domain}`;
|
|
46
|
+
environmentDomain = domain;
|
|
47
|
+
}
|
|
48
|
+
const clientId = process.env.SALESFORCE_CLIENT_ID ?? ACQUIS_CONNECTED_APP_CLIENT_ID;
|
|
49
|
+
const callbackPort = parseInt(process.env.SALESFORCE_OAUTH_CALLBACK_PORT ?? '7654', 10);
|
|
50
|
+
const { instanceUrl } = await startOAuthWebFlow(loginUrl, clientId, callbackPort);
|
|
51
|
+
return toolResponse(`Successfully authenticated to Salesforce.\n` +
|
|
52
|
+
` Instance URL: ${instanceUrl}\n\n` +
|
|
53
|
+
`You can now use all Salesforce tools.`);
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
return toolResponse(`salesforce_login failed: ${err.message}`, true);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export const salesforceLoginSchema = {
|
|
60
|
+
environment: z
|
|
61
|
+
.enum(['production', 'sandbox', 'custom'])
|
|
62
|
+
.describe('The Salesforce environment to log in to.'),
|
|
63
|
+
custom_domain: z
|
|
64
|
+
.string()
|
|
65
|
+
.describe('Required when environment is "custom". Your org\'s My Domain, e.g. mycompany.my.salesforce.com')
|
|
66
|
+
.optional(),
|
|
67
|
+
};
|
|
68
|
+
export const salesforceLoginDescriptor = {
|
|
69
|
+
name: 'salesforce_login',
|
|
70
|
+
description: salesforceLoginTool.description,
|
|
71
|
+
schema: salesforceLoginSchema,
|
|
72
|
+
handler: handleSalesforceLogin,
|
|
73
|
+
noConnection: true,
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=salesforceLogin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"salesforceLogin.js","sourceRoot":"","sources":["../../src/tools/salesforceLogin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,8BAA8B,GAAG,uFAAuF,CAAC;AAC/H,MAAM,CAAC,MAAM,mBAAmB,GAAS;IACvC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACT,gGAAgG;QAChG,2DAA2D;QAC3D,0FAA0F;QAC1F,8GAA8G;IAChH,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,YAAY,EA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CAAC,CAAC;QAElF,OAAO,YAAY,CACjB,6CAA6C;YAC7C,mBAAmB,WAAW,MAAM;YACpC,uCAAuC,CACxC,CAAC;IACJ,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,OAAO,YAAY,CAAC,4BAA4B,GAAG,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;IACvE,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,WAAW,EAAE,CAAC;SACX,IAAI,CAAC,CAAC,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;SACzC,QAAQ,CAAC,0CAA0C,CAAC;IACvD,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,QAAQ,CAAC,gGAAgG,CAAC;SAC1G,QAAQ,EAAE;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,mBAAmB,CAAC,WAAW;IAC5C,MAAM,EAAE,qBAAqB;IAC7B,OAAO,EAAE,qBAAqB;IAC9B,YAAY,EAAE,IAAI;CACnB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export declare const selectOrgTool: Tool;
|
|
4
|
+
export interface SelectOrgArgs {
|
|
5
|
+
org_id?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function handleSelectOrg(args: SelectOrgArgs): Promise<{
|
|
8
|
+
content: {
|
|
9
|
+
type: "text";
|
|
10
|
+
text: string;
|
|
11
|
+
}[];
|
|
12
|
+
isError: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const selectOrgSchema: {
|
|
15
|
+
org_id: z.ZodOptional<z.ZodString>;
|
|
16
|
+
};
|
|
17
|
+
export declare const selectOrgDescriptor: {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string | undefined;
|
|
20
|
+
schema: {
|
|
21
|
+
org_id: z.ZodOptional<z.ZodString>;
|
|
22
|
+
};
|
|
23
|
+
handler: typeof handleSelectOrg;
|
|
24
|
+
noConnection: boolean;
|
|
25
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { listOrgs, getSelectedOrgId, setSelectedOrgId } from '../utils/tokenBroker.js';
|
|
3
|
+
import { toolResponse } from '../utils/errors.js';
|
|
4
|
+
export const selectOrgTool = {
|
|
5
|
+
name: 'salesforce_select_org',
|
|
6
|
+
description: 'DEPRECATED — do not use. Use salesforce_login instead to authenticate. ' +
|
|
7
|
+
'This tool is for legacy access_token (broker) authentication only and will be removed in a future version.',
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
org_id: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
description: 'The ID of the org to select. Omit to list all available orgs.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
required: [],
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
export async function handleSelectOrg(args) {
|
|
20
|
+
try {
|
|
21
|
+
const currentOrgId = getSelectedOrgId();
|
|
22
|
+
// No org_id provided — list available orgs and show current selection if any
|
|
23
|
+
if (!args.org_id) {
|
|
24
|
+
let orgs;
|
|
25
|
+
try {
|
|
26
|
+
orgs = await listOrgs();
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
return toolResponse(`Failed to list orgs: ${err.message}`, true);
|
|
30
|
+
}
|
|
31
|
+
if (orgs.length === 0) {
|
|
32
|
+
return toolResponse('No orgs available for this API key.', true);
|
|
33
|
+
}
|
|
34
|
+
const lines = [];
|
|
35
|
+
if (currentOrgId) {
|
|
36
|
+
lines.push(`Current session org: ${currentOrgId}\n`);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
lines.push('No org selected yet for this session.\n');
|
|
40
|
+
}
|
|
41
|
+
lines.push('Available orgs:');
|
|
42
|
+
for (const org of orgs) {
|
|
43
|
+
lines.push(` id: ${org.id}`);
|
|
44
|
+
lines.push(` name: ${org.name}`);
|
|
45
|
+
lines.push(` environment: ${org.environment}`);
|
|
46
|
+
lines.push(` instance_url: ${org.instance_url}`);
|
|
47
|
+
lines.push('');
|
|
48
|
+
}
|
|
49
|
+
if (!currentOrgId) {
|
|
50
|
+
lines.push('Call salesforce_select_org with org_id to select an org for this session.');
|
|
51
|
+
}
|
|
52
|
+
return toolResponse(lines.join('\n').trimEnd());
|
|
53
|
+
}
|
|
54
|
+
// org_id provided — attempt to select it
|
|
55
|
+
const requestedOrgId = args.org_id.trim();
|
|
56
|
+
// Validate the requested org exists
|
|
57
|
+
let orgs;
|
|
58
|
+
try {
|
|
59
|
+
orgs = await listOrgs();
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
return toolResponse(`Failed to validate org: ${err.message}`, true);
|
|
63
|
+
}
|
|
64
|
+
const org = orgs.find((o) => o.id === requestedOrgId);
|
|
65
|
+
if (!org) {
|
|
66
|
+
const available = orgs.map((o) => ` ${o.id} (${o.name})`).join('\n');
|
|
67
|
+
return toolResponse(`Org "${requestedOrgId}" not found. Available orgs:\n${available}`, true);
|
|
68
|
+
}
|
|
69
|
+
const switched = currentOrgId !== null && currentOrgId !== requestedOrgId;
|
|
70
|
+
setSelectedOrgId(requestedOrgId);
|
|
71
|
+
return toolResponse(`Org ${switched ? 'switched' : 'selected'}:\n` +
|
|
72
|
+
` id: ${org.id}\n` +
|
|
73
|
+
` name: ${org.name}\n` +
|
|
74
|
+
` environment: ${org.environment}\n` +
|
|
75
|
+
` instance_url: ${org.instance_url}`);
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
return toolResponse(`salesforce_select_org failed: ${err.message}`, true);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export const selectOrgSchema = {
|
|
82
|
+
org_id: z.string().describe('The ID of the org to select. Omit to list all available orgs.').optional(),
|
|
83
|
+
};
|
|
84
|
+
export const selectOrgDescriptor = {
|
|
85
|
+
name: 'salesforce_select_org',
|
|
86
|
+
description: selectOrgTool.description,
|
|
87
|
+
schema: selectOrgSchema,
|
|
88
|
+
handler: handleSelectOrg,
|
|
89
|
+
noConnection: true,
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=selectOrg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectOrg.js","sourceRoot":"","sources":["../../src/tools/selectOrg.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAgB,MAAM,yBAAyB,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,MAAM,aAAa,GAAS;IACjC,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EACT,yEAAyE;QACzE,4GAA4G;IAC9G,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+DAA+D;aAC7E;SACF;QACD,QAAQ,EAAE,EAAE;KACb;CACF,CAAC;AAMF,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAmB;IACvD,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,gBAAgB,EAAE,CAAC;QAExC,6EAA6E;QAC7E,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,IAAI,IAAe,CAAC;YACpB,IAAI,CAAC;gBACH,IAAI,GAAG,MAAM,QAAQ,EAAE,CAAC;YAC1B,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;gBAClB,OAAO,YAAY,CAAC,wBAAwB,GAAG,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;YACnE,CAAC;YAED,IAAI,IAAI,CA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AW,EAAE,aAAa,CAAC,WAAW;IACtC,MAAM,EAAE,eAAe;IACvB,OAAO,EAAE,eAAe;IACxB,YAAY,EAAE,IAAI;CACnB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Connection } from 'jsforce';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export declare const toolingQueryTool: {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: "object";
|
|
8
|
+
properties: {
|
|
9
|
+
soqlQuery: {
|
|
10
|
+
type: string;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
required: string[];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export interface ToolingQueryArgs {
|
|
18
|
+
soqlQuery: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function handleToolingQuery(conn: Connection, args: ToolingQueryArgs): Promise<{
|
|
21
|
+
content: {
|
|
22
|
+
type: "text";
|
|
23
|
+
text: string;
|
|
24
|
+
}[];
|
|
25
|
+
isError: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const toolingQuerySchema: {
|
|
28
|
+
soqlQuery: z.ZodString;
|
|
29
|
+
};
|
|
30
|
+
export declare const toolingQueryDescriptor: {
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
schema: {
|
|
34
|
+
soqlQuery: z.ZodString;
|
|
35
|
+
};
|
|
36
|
+
handler: typeof handleToolingQuery;
|
|
37
|
+
};
|