-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add command stub for agent run test
- Loading branch information
Showing
4 changed files
with
98 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# summary | ||
|
||
Start a test for an Agent. | ||
|
||
# description | ||
|
||
Start a test for an Agent, providing the AiEvalDefinitionVersion ID. Returns the job ID. | ||
|
||
# flags.id.summary | ||
|
||
The AiEvalDefinitionVersion ID. | ||
|
||
# flags.id.description | ||
|
||
The AiEvalDefinitionVersion ID. | ||
|
||
# flags.wait.summary | ||
|
||
Number of minutes to wait for the command to complete and display results to the terminal window. | ||
|
||
# flags.wait.description | ||
|
||
If the command continues to run after the wait period, the CLI returns control of the terminal window to you. | ||
|
||
# flags.output-dir.summary | ||
|
||
Directory in which to store test run files. | ||
|
||
# examples | ||
|
||
- Start a test for an Agent: | ||
|
||
<%= config.bin %> <%= command.id %> --id AiEvalDefVerId |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (c) 2024, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
|
||
import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; | ||
import { Messages } from '@salesforce/core'; | ||
|
||
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); | ||
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.test.start'); | ||
|
||
export type AgentRunTestResult = { | ||
buildVersion: number; | ||
jobId: string; | ||
errorRepresentation?: string; | ||
}; | ||
|
||
export default class AgentRunTest extends SfCommand<AgentRunTestResult> { | ||
public static readonly summary = messages.getMessage('summary'); | ||
public static readonly description = messages.getMessage('description'); | ||
public static readonly examples = messages.getMessages('examples'); | ||
|
||
public static readonly flags = { | ||
'target-org': Flags.requiredOrg(), | ||
// AiEvalDefinitionVersion.Id -- This should really be "test-name" | ||
id: Flags.string({ | ||
char: 'i', | ||
required: true, | ||
summary: messages.getMessage('flags.id.summary'), | ||
description: messages.getMessage('flags.id.description'), | ||
}), | ||
wait: Flags.duration({ | ||
char: 'w', | ||
unit: 'minutes', | ||
min: 1, | ||
summary: messages.getMessage('flags.wait.summary'), | ||
description: messages.getMessage('flags.wait.description'), | ||
}), | ||
'output-dir': Flags.directory({ | ||
char: 'd', | ||
summary: messages.getMessage('flags.output-dir.summary'), | ||
}), | ||
// | ||
// Future flags: | ||
// result-format [csv, json, table, junit, TAP] | ||
// suites [array of suite names] | ||
// verbose [boolean] | ||
// ??? api-version or build-version ??? | ||
}; | ||
|
||
public async run(): Promise<AgentRunTestResult> { | ||
const { flags } = await this.parse(AgentRunTest); | ||
|
||
this.log(`Starting tests for AiEvalDefinitionVersion: ${flags.id}`); | ||
|
||
// Call SF Eval Connect API passing AiEvalDefinitionVersion.Id | ||
|
||
return { | ||
buildVersion: 62.0, // looks like API version | ||
jobId: '4KBSM000000003F4AQ', // evaluationJobId; needed for getting status and stopping | ||
}; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.