@salesforce/plugin-agent 1.13.2 → 1.14.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/README.md CHANGED
@@ -63,6 +63,7 @@ sf plugins
63
63
 
64
64
  - [`sf agent create`](#sf-agent-create)
65
65
  - [`sf agent generate agent-spec`](#sf-agent-generate-agent-spec)
66
+ - [`sf agent generate template`](#sf-agent-generate-template)
66
67
  - [`sf agent generate test-spec`](#sf-agent-generate-test-spec)
67
68
  - [`sf agent preview`](#sf-agent-preview)
68
69
  - [`sf agent test cancel`](#sf-agent-test-cancel)
@@ -131,7 +132,7 @@ EXAMPLES
131
132
  $ sf agent create --agent-name "Resort Manager" --spec specs/resortManagerAgent.yaml --preview
132
133
  ```
133
134
 
134
- _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.13.2/src/commands/agent/create.ts)_
135
+ _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.0/src/commands/agent/create.ts)_
135
136
 
136
137
  ## `sf agent generate agent-spec`
137
138
 
@@ -235,7 +236,40 @@ EXAMPLES
235
236
  $ sf agent generate agent-spec --tone formal --agent-user resortmanager@myorg.com
236
237
  ```
237
238
 
238
- _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.13.2/src/commands/agent/generate/agent-spec.ts)_
239
+ _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.0/src/commands/agent/generate/agent-spec.ts)_
240
+
241
+ ## `sf agent generate template`
242
+
243
+ Generate an agent template for packaging.
244
+
245
+ ```
246
+ USAGE
247
+ $ sf agent generate template -o <value> --agent-api-name <value> [--json] [--flags-dir <value>] [--api-version <value>] [-d
248
+ <value>]
249
+
250
+ FLAGS
251
+ -d, --output-dir=<value> Directory to write the agent template.
252
+ -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
253
+ configuration variable is already set.
254
+ --agent-api-name=<value> (required) API name of an existing Bot.
255
+ --api-version=<value> Override the api version used for api requests made by this command
256
+
257
+ GLOBAL FLAGS
258
+ --flags-dir=<value> Import flag values from a directory.
259
+ --json Format output as json.
260
+
261
+ DESCRIPTION
262
+ Generate an agent template for packaging.
263
+
264
+ Generate agent template metadata to for packaging your agent.
265
+
266
+ EXAMPLES
267
+ Generate an agent template from a Bot API name in your default package dir:
268
+
269
+ $ sf agent generate template --agent-api-name My_Packaged_Agent
270
+ ```
271
+
272
+ _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.0/src/commands/agent/generate/template.ts)_
239
273
 
240
274
  ## `sf agent generate test-spec`
241
275
 
@@ -258,7 +292,7 @@ EXAMPLES
258
292
  $ sf agent generate test-spec
259
293
  ```
260
294
 
261
- _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.13.2/src/commands/agent/generate/test-spec.ts)_
295
+ _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.0/src/commands/agent/generate/test-spec.ts)_
262
296
 
263
297
  ## `sf agent preview`
264
298
 
@@ -293,7 +327,7 @@ FLAG DESCRIPTIONS
293
327
  the API name of the agent? (TBD based on agents library)
294
328
  ```
295
329
 
296
- _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.13.2/src/commands/agent/preview.ts)_
330
+ _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.0/src/commands/agent/preview.ts)_
297
331
 
298
332
  ## `sf agent test cancel`
299
333
 
@@ -330,7 +364,7 @@ EXAMPLES
330
364
  $ sf agent test cancel --job-id 4KBfake0000003F4AQ --target-org my-org
331
365
  ```
332
366
 
333
- _See code: [src/commands/agent/test/cancel.ts](https://github.com/salesforcecli/plugin-agent/blob/1.13.2/src/commands/agent/test/cancel.ts)_
367
+ _See code: [src/commands/agent/test/cancel.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.0/src/commands/agent/test/cancel.ts)_
334
368
 
335
369
  ## `sf agent test create`
336
370
 
@@ -366,7 +400,7 @@ FLAG DESCRIPTIONS
366
400
  More information about a flag. Don't repeat the summary.
367
401
  ```
368
402
 
369
- _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.13.2/src/commands/agent/test/create.ts)_
403
+ _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.0/src/commands/agent/test/create.ts)_
370
404
 
371
405
  ## `sf agent test list`
372
406
 
@@ -395,7 +429,7 @@ EXAMPLES
395
429
  $ sf agent test list
396
430
  ```
397
431
 
398
- _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.13.2/src/commands/agent/test/list.ts)_
432
+ _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.0/src/commands/agent/test/list.ts)_
399
433
 
400
434
  ## `sf agent test results`
401
435
 
@@ -451,7 +485,7 @@ FLAG DESCRIPTIONS
451
485
  test results aren't written.
452
486
  ```
453
487
 
454
- _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.13.2/src/commands/agent/test/results.ts)_
488
+ _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.0/src/commands/agent/test/results.ts)_
455
489
 
456
490
  ## `sf agent test resume`
457
491
 
@@ -514,7 +548,7 @@ FLAG DESCRIPTIONS
514
548
  test results aren't written.
515
549
  ```
516
550
 
517
- _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.13.2/src/commands/agent/test/resume.ts)_
551
+ _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.0/src/commands/agent/test/resume.ts)_
518
552
 
519
553
  ## `sf agent test run`
520
554
 
@@ -577,6 +611,6 @@ FLAG DESCRIPTIONS
577
611
  test results aren't written.
578
612
  ```
579
613
 
580
- _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.13.2/src/commands/agent/test/run.ts)_
614
+ _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.14.0/src/commands/agent/test/run.ts)_
581
615
 
582
616
  <!-- commandsstop -->
@@ -0,0 +1,18 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type AgentGenerateTemplateResult = {
3
+ path: string;
4
+ };
5
+ export default class AgentGenerateTemplate extends SfCommand<AgentGenerateTemplateResult> {
6
+ static readonly summary: string;
7
+ static readonly description: string;
8
+ static readonly examples: string[];
9
+ static state: string;
10
+ static readonly requiresProject = true;
11
+ static readonly flags: {
12
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
13
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'agent-api-name': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
+ 'output-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ };
17
+ run(): Promise<AgentGenerateTemplateResult>;
18
+ }
@@ -0,0 +1,48 @@
1
+ /*
2
+ * Copyright (c) 2024, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import { dirname, join, resolve } from 'node:path';
8
+ import { mkdirSync, writeFileSync } from 'node:fs';
9
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
10
+ import { Messages } from '@salesforce/core';
11
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
12
+ const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.generate.template');
13
+ export default class AgentGenerateTemplate extends SfCommand {
14
+ static summary = messages.getMessage('summary');
15
+ static description = messages.getMessage('description');
16
+ static examples = messages.getMessages('examples');
17
+ static state = 'beta';
18
+ static requiresProject = true;
19
+ static flags = {
20
+ 'target-org': Flags.requiredOrg(),
21
+ 'api-version': Flags.orgApiVersion(),
22
+ 'agent-api-name': Flags.string({
23
+ summary: messages.getMessage('flags.agent-api-name.summary'),
24
+ required: true,
25
+ }),
26
+ 'output-dir': Flags.directory({
27
+ char: 'd',
28
+ exists: true,
29
+ summary: messages.getMessage('flags.output-dir.summary'),
30
+ }),
31
+ };
32
+ async run() {
33
+ const { flags } = await this.parse(AgentGenerateTemplate);
34
+ // TODO: look for a Bot with the agent API name
35
+ const botName = flags['agent-api-name'];
36
+ const outputDir = flags['output-dir'] ? resolve(flags['output-dir']) : this.project?.getDefaultPackage().fullPath;
37
+ const agentTemplateFilePath = join(outputDir, 'agentTemplates', `${botName}.agentTemplate-meta.xml`);
38
+ mkdirSync(dirname(agentTemplateFilePath), { recursive: true });
39
+ writeFileSync(agentTemplateFilePath, xmlContent);
40
+ this.log(`\nSaved agent template: ${agentTemplateFilePath}`);
41
+ return { path: agentTemplateFilePath };
42
+ }
43
+ }
44
+ const xmlContent = `<?xml version="1.0" encoding="UTF-8"?>
45
+ <AgentTemplate xmlns="http://soap.sforce.com/2006/04/metadata">
46
+ </AgentTemplate>
47
+ `;
48
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/commands/agent/generate/template.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,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AC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,iBAAiB,EAAE,CAAC,QAAQ,CAAC;QAElH,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAmB,EAAE,gBAAgB,EAAE,GAAG,OAAO,yBAAyB,CAAC,CAAC;QAC/G,SAAS,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE/D,aAAa,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAC;QAEjD,IAAI,CAAC,GAAG,CAAC,2BAA2B,qBAAqB,EAAE,CAAC,CAAC;QAE7D,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;IACzC,CAAC;;AAGH,MAAM,UAAU,GAAG;;;CAGlB,CAAC"}
@@ -0,0 +1,21 @@
1
+ # summary
2
+
3
+ Generate an agent template for packaging.
4
+
5
+ # description
6
+
7
+ Generate agent template metadata to for packaging your agent.
8
+
9
+ # flags.agent-api-name.summary
10
+
11
+ API name of an existing Bot.
12
+
13
+ # flags.output-dir.summary
14
+
15
+ Directory to write the agent template.
16
+
17
+ # examples
18
+
19
+ - Generate an agent template from a Bot API name in your default package dir:
20
+
21
+ <%= config.bin %> <%= command.id %> --agent-api-name My_Packaged_Agent
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@salesforce/plugin-agent",
3
- "version": "1.13.2",
3
+ "version": "1.14.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@salesforce/plugin-agent",
9
- "version": "1.13.2",
9
+ "version": "1.14.0",
10
10
  "license": "BSD-3-Clause",
11
11
  "dependencies": {
12
12
  "@inquirer/figures": "^1.0.7",
@@ -365,6 +365,92 @@
365
365
  "agent-spec:generate:agent"
366
366
  ]
367
367
  },
368
+ "agent:generate:template": {
369
+ "aliases": [],
370
+ "args": {},
371
+ "description": "Generate agent template metadata to for packaging your agent.",
372
+ "examples": [
373
+ "Generate an agent template from a Bot API name in your default package dir:\n<%= config.bin %> <%= command.id %> --agent-api-name My_Packaged_Agent"
374
+ ],
375
+ "flags": {
376
+ "json": {
377
+ "description": "Format output as json.",
378
+ "helpGroup": "GLOBAL",
379
+ "name": "json",
380
+ "allowNo": false,
381
+ "type": "boolean"
382
+ },
383
+ "flags-dir": {
384
+ "helpGroup": "GLOBAL",
385
+ "name": "flags-dir",
386
+ "summary": "Import flag values from a directory.",
387
+ "hasDynamicHelp": false,
388
+ "multiple": false,
389
+ "type": "option"
390
+ },
391
+ "target-org": {
392
+ "char": "o",
393
+ "name": "target-org",
394
+ "noCacheDefault": true,
395
+ "required": true,
396
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
397
+ "hasDynamicHelp": true,
398
+ "multiple": false,
399
+ "type": "option"
400
+ },
401
+ "api-version": {
402
+ "description": "Override the api version used for api requests made by this command",
403
+ "name": "api-version",
404
+ "hasDynamicHelp": false,
405
+ "multiple": false,
406
+ "type": "option"
407
+ },
408
+ "agent-api-name": {
409
+ "name": "agent-api-name",
410
+ "required": true,
411
+ "summary": "API name of an existing Bot.",
412
+ "hasDynamicHelp": false,
413
+ "multiple": false,
414
+ "type": "option"
415
+ },
416
+ "output-dir": {
417
+ "char": "d",
418
+ "name": "output-dir",
419
+ "summary": "Directory to write the agent template.",
420
+ "hasDynamicHelp": false,
421
+ "multiple": false,
422
+ "type": "option"
423
+ }
424
+ },
425
+ "hasDynamicHelp": true,
426
+ "hiddenAliases": [],
427
+ "id": "agent:generate:template",
428
+ "pluginAlias": "@salesforce/plugin-agent",
429
+ "pluginName": "@salesforce/plugin-agent",
430
+ "pluginType": "core",
431
+ "state": "beta",
432
+ "strict": true,
433
+ "summary": "Generate an agent template for packaging.",
434
+ "enableJsonFlag": true,
435
+ "requiresProject": true,
436
+ "isESM": true,
437
+ "relativePath": [
438
+ "lib",
439
+ "commands",
440
+ "agent",
441
+ "generate",
442
+ "template.js"
443
+ ],
444
+ "aliasPermutations": [],
445
+ "permutations": [
446
+ "agent:generate:template",
447
+ "generate:agent:template",
448
+ "generate:template:agent",
449
+ "agent:template:generate",
450
+ "template:agent:generate",
451
+ "template:generate:agent"
452
+ ]
453
+ },
368
454
  "agent:generate:test-spec": {
369
455
  "aliases": [],
370
456
  "args": {},
@@ -988,5 +1074,5 @@
988
1074
  ]
989
1075
  }
990
1076
  },
991
- "version": "1.13.2"
1077
+ "version": "1.14.0"
992
1078
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/plugin-agent",
3
3
  "description": "Commands to interact with Salesforce agents",
4
- "version": "1.13.2",
4
+ "version": "1.14.0",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/forcedotcom/cli/issues",
7
7
  "dependencies": {
@@ -226,7 +226,7 @@
226
226
  "exports": "./lib/index.js",
227
227
  "type": "module",
228
228
  "sfdx": {
229
- "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.13.2.crt",
230
- "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.13.2.sig"
229
+ "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.14.0.crt",
230
+ "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.14.0.sig"
231
231
  }
232
232
  }
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$ref": "#/definitions/AgentGenerateTemplateResult",
4
+ "definitions": {
5
+ "AgentGenerateTemplateResult": {
6
+ "type": "object",
7
+ "properties": {
8
+ "path": {
9
+ "type": "string"
10
+ }
11
+ },
12
+ "required": ["path"],
13
+ "additionalProperties": false
14
+ }
15
+ }
16
+ }