hardis:project:clean:agents-deployment-actions
Description
Command Behavior
Writes in the Pull Request the deployment actions that deliver Agentforce agents, before the Pull Request jobs run.
The project holds the authoring bundle of each agent (aiAuthoringBundles/<Agent>/), not its versions: a version is created in each org when the bundle is published there. hardis:project:deploy:smart never adds actions during the job: this cleaning records them in the project, so they show in the Pull Request.
- Publication: for each agent whose bundle changed in the User Story, an
agent-publishpost-deployment action of the Pull Request publishes the bundle in the target org and activates the version it created. It runs once by org: each publication creates a new version, even when nothing changed. - Running user: for each of these agents that runs as a user (
default_agent_user), anagent-running-userpre-deployment action creates that user withsf org create agent-userin an org that has none. The built-in replacement rulebuiltin-agent-running-userthen writes the user of the target org in the bundle while it is published, and never creates one. - Automatic cleaning: Add
autoAddAgentsDeploymentActionstoautoCleanTypesin.sfdx-hardis.ymlto run it each time a User Story is saved with hardis:work:save.
See Agentforce agents in CI/CD.
Technical explanations
- Changed agents: the agents with a file under
aiAuthoringBundles/<Agent>/ingit diff --name-only <commit>or not tracked yet. The bundles of versions (<Agent>_<n>) are ignored.<commit>is--delta-from(passed by hardis:work:save), elseHEAD: run by hand, the cleaning only handles the changes not committed yet. - Actions file: the Pull Request of the current branch is found with the git provider (
scripts/actions/.sfdx-hardis.<id>.yml), else the actions go toscripts/actions/.sfdx-hardis.draft.yml, to link with hardis:project:action:link-pull-request. - Actions:
agent-publish, contextprocess-deployment-only,runOnlyOnceByOrg: true, andagent-running-user, contextall,runOnlyOnceByOrg: false: an existing user is found again. An action already there for the agent is kept as it is, and a file with nothing to add is not written again. The labels are in English, as they are committed.
Agent Mode
Supports non-interactive execution with --agent:
sf hardis:project:clean:agents-deployment-actions --agent
The command has no prompt: --agent only exists for consistency with the other cleanings.
Parameters
| Name | Type | Description | Default | Required | Options |
|---|---|---|---|---|---|
| agent | boolean | Run in non-interactive mode for agents and automation | |||
| debug -d |
boolean | Activate debug mode (more logs) | |||
| delta-from | option | Git commit or ref the User Story starts from: only the agents changed since are handled (default: HEAD, the changes not committed yet) | |||
| flags-dir | option | Import flag values from a directory. | |||
| json | boolean | Format output as json. | |||
| skipauth | boolean | Skip authentication check when a default username is required | |||
| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration |
Examples
$ sf hardis:project:clean:agents-deployment-actions
$ sf hardis:project:clean:agents-deployment-actions --delta-from origin/integration
$ sf hardis:project:clean:agents-deployment-actions --agent