salesforcecli/cli(新しいタブで開きます)
主要言語: TypeScript
The `sf` cli.
- star 数
- 186
- watcher 数
- 9
- fork 数
- 38
- issue 数
- 2
- 最終更新
- 2026/10/31
主要言語: TypeScript
The `sf` cli.
sf plugin.sfdx plugin to sf? Then check out the migration section of the developer guide.sfdx (v7) installation to sf (v2).To provide feedback, use create a new issue here.
$ npm install -g @salesforce/cli $ sf COMMAND running command... $ sf (--version|-v) @salesforce/cli/2.158.1 linux-x64 node-v24.22.2 $ sf --help [COMMAND] USAGE $ sf COMMAND ...
See architecture page for diagrams of the Salesforce CLI.
sf agent activatesf agent adl createsf agent adl deletesf agent adl file addsf agent adl file deletesf agent adl file listsf agent adl getsf agent adl listsf agent adl statussf agent adl updatesf agent adl uploadsf agent createsf agent deactivatesf agent generate agent-specsf agent generate authoring-bundlesf agent generate templatesf agent generate test-specsf agent mcp asset listsf agent mcp asset replacesf agent mcp createsf agent mcp deletesf agent mcp fetchsf agent mcp getsf agent mcp listsf agent mcp updatesf agent previewsf agent preview endsf agent preview sendsf agent preview sessionssf agent preview startsf agent publish authoring-bundlesf agent test createsf agent test listsf agent test resultssf agent test resumesf agent test runsf agent test run-evalsf agent trace deletesf agent trace listsf agent trace readsf agent validate authoring-bundlesf alias listsf alias setsf alias unsetsf apex get compile-statussf apex get logsf apex get testsf apex list logsf apex runsf apex run testsf apex tail logsf apex trace createsf apex trace deletesf apex trace listsf api request graphqlsf api request rest [URL]sf autocomplete [SHELL]sf commandssf config getsf config listsf config setsf config unsetsf data bulk resultssf data create filesf data create recordsf data delete bulksf data delete recordsf data delete resumesf data export bulksf data export resumesf data export treesf data get recordsf data import bulksf data import resumesf data import treesf data querysf data resumesf data searchsf data update bulksf data update recordsf data update resumesf data upsert bulksf data upsert resumesf doctorsf force data bulk deletesf force data bulk statussf force data bulk upsertsf help [COMMAND]sf info releasenotes displaysf logic get testsf logic run testsf org assign permsetsf org assign permsetlicensesf org auth show-access-tokensf org auth show-sfdx-auth-urlsf org auth show-user-passwordsf org create agent-usersf org create sandboxsf org create scratchsf org create usersf org delete sandboxsf org delete scratchsf org disable trackingsf org displaysf org display usersf org enable trackingsf org generate passwordsf org listsf org list authsf org list limitssf org list metadatasf org list metadata-typessf org list sobject record-countssf org list userssf org login access-tokensf org login jwtsf org login sfdx-urlsf org login websf org logoutsf org opensf org open agentsf org open authoring-bundlesf org refresh sandboxsf org resume sandboxsf org resume scratchsf package convertsf package createsf package deletesf package installsf package install reportsf package installed listsf package listsf package push-upgrade abortsf package push-upgrade listsf package push-upgrade reportsf package push-upgrade schedulesf package uninstallsf package uninstall reportsf package updatesf package version createsf package version create listsf package version create reportsf package version deletesf package version displayancestrysf package version displaydependenciessf package version listsf package version promotesf package version reportsf package version retrievesf package version updatesf package1 version createsf package1 version create getsf package1 version displaysf package1 version listsf pluginssf plugins discoversf plugins:inspect PLUGIN...sf plugins install PLUGINsf plugins link PATHsf plugins resetsf plugins trust allowlist addsf plugins trust allowlist listsf plugins trust allowlist removesf plugins trust verifysf plugins uninstall [PLUGIN]sf plugins updatesf project convert mdapisf project convert sourcesf project convert source-behaviorsf project delete sourcesf project delete trackingsf project deploy cancelsf project deploy previewsf project deploy quicksf project deploy reportsf project deploy resumesf project deploy startsf project deploy validatesf project generate manifestsf project list ignoredsf project reset trackingsf project retrieve previewsf project retrieve startsf schema generate fieldsf schema generate platformeventsf schema generate sobjectsf schema generate tabsf searchsf sobject describesf sobject listsf template generate analytics templatesf template generate apex classsf template generate apex triggersf template generate digital-experience sitesf template generate flexipagesf template generate lightning-outsf template generate lightning appsf template generate lightning componentsf template generate lightning eventsf template generate lightning interfacesf template generate lightning testsf template generate projectsf template generate static-resourcesf template generate ui-bundlesf template generate ui-embeddingsf template generate visualforce componentsf template generate visualforce pagesf update [CHANNEL]sf versionsf whichActivate an agent in an org.
USAGE
$ sf agent activate -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value>] [--version
<value>]
FLAGS
-n, --api-name=<value> API name of the agent to activate; if not specified, the command provides a list that you
choose from.
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
--api-version=<value> Override the api version used for api requests made by this command
--version=<value> Version number of the agent to activate; if not specified, the command provides a list that
you choose from.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Activate an agent in an org.
Activating an agent makes it immediately available to your users. A published agent must be active before you can
preview it with the "agent preview" CLI command or VS Code. Agents can have multiple versions; only one version can be
active at a time.
If you run the command without the --api-name or --version flags, the command provides a list of agent API names and
versions for you to choose from. Use the flags to specify the exact agent and version without being prompted. If you
use the --json flag and not --version, then the latest agent version is automatically activated.
The value of the --version flag is always a number, corresponding to the "vX" part of the "BotVersion" metadata in
your project. For example, if you have a force-app/main/default/bots/My_Agent/v4.botVersion-meta.xml file in your
project, then you activate this version with the "--version 4" flag.
EXAMPLES
Activate an agent in your default target org by being prompted for both its API name and version:
$ sf agent activate
Activate version 2 of an agent with API name Resort_Manager in the org with alias "my-org":
$ sf agent activate --api-name Resort_Manager --version 2 --target-org my-org
ENVIRONMENT VARIABLES
SF_TARGET_ORG Username or alias of your default org. Overrides the target-org configuration variable.
ERROR CODES
Succeeded (0) Agent activated successfully.
NotFound (2) Agent not found in the org.
ActivationFailed (4) Failed to activate the agent due to API or network errors.
See code: @salesforce/plugin-agent
Create an Agentforce Data Library.
USAGE
$ sf agent adl create -o <value> -n <value> --developer-name <value> --source-type sfdrive|knowledge|retriever
[--json] [--flags-dir <value>] [--api-version <value>] [--description <value>] [--index-mode basic|enhanced]
[--retriever-id <value>] [--primary-index-field1 <value>] [--primary-index-field2 <value>] [--content-fields
<value>] [--data-category-ids <value>] [--data-category-names <value>] [-w <value>]
FLAGS
-n, --name=<value> (required) Display name for the data library (max 80 characters).
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
-w, --wait=<value> Wait N minutes for indexing to complete (KNOWLEDGE libraries). SFDRIVE libraries
require upload before indexing; RETRIEVER libraries are ready immediately.
--api-version=<value> Override the api version used for api requests made by this command
--content-fields=<value> Comma-separated list of content fields for KNOWLEDGE libraries (optional, mutable
after creation).
--data-category-ids=<value> Comma-separated list of data category selection IDs for KNOWLEDGE libraries.
Mutually exclusive with --data-category-names (provide one or the other, not
both).
--data-category-names=<value> Comma-separated list of data category names in qualified format (e.g.,
"Group_API_Name.Category"). Mutually exclusive with --data-category-ids (provide
one or the other, not both).
--description=<value> Description of the data library (max 255 characters).
--developer-name=<value> (required) API name for the data library (max 80 characters, alphanumeric and
underscores only, must start with a letter).
--index-mode=<option> Index mode for SFDRIVE libraries: basic or enhanced.
<options: basic|enhanced>
--primary-index-field1=<value> Primary index field 1 for KNOWLEDGE libraries (required, immutable after
creation).
--primary-index-field2=<value> Primary index field 2 for KNOWLEDGE libraries (required, immutable after
creation).
--retriever-id=<value> ID of an active Custom Retriever (required for RETRIEVER source type; retriever
must be active).
--source-type=<option> (required) Type of grounding source: sfdrive (file upload), knowledge (Salesforce
Knowledge articles), or retriever (existing active Custom Retriever).
<options: sfdrive|knowledge|retriever>
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Create an Agentforce Data Library.
Creates a new data library in the target org. The --source-type flag determines the type of library: SFDRIVE (file
upload), KNOWLEDGE (Salesforce Knowledge articles), or RETRIEVER (existing active Custom Retriever).
For SFDRIVE libraries, creation provisions the full Data Cloud pipeline (DLO → DMO → SearchIndex → Retriever). Upload
files with `sf agent adl upload` after creation.
EXAMPLES
Create an SFDRIVE library:
$ sf agent adl create --target-org myOrg --name "My Docs" --developer-name My_Docs --source-type sfdrive
Create a KNOWLEDGE library with index fields:
$ sf agent adl create --target-org myOrg --name "KB Library" --developer-name KB_Library --source-type knowledge \
--primary-index-field1 Title --primary-index-field2 Summary
Create a RETRIEVER library:
$ sf agent adl create --target-org myOrg --name "Existing Retriever" --developer-name Existing_Retriever \
--source-type retriever --retriever-id 0ppXX0000000001
See code: @salesforce/plugin-agent
Delete an Agentforce Data Library.
USAGE
$ sf agent adl delete -o <value> -i <value> [--json] [--flags-dir <value>] [--api-version <value>]
FLAGS
-i, --library-id=<value> (required) Agentforce Data Library ID (18-char Salesforce ID with prefix 1JD).
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
--api-version=<value> Override the api version used for api requests made by this command
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Delete an Agentforce Data Library.
Permanently deletes a data library and all associated files and indexing data.
EXAMPLES
Delete a data library:
$ sf agent adl delete --library-id 1JDSG000007IbWX4A0 --target-org myOrg
See code: @salesforce/plugin-agent
Add files to an existing Agentforce Data Library.
USAGE
$ sf agent adl file add -o <value> -i <value> -f <value>... [--json] [--flags-dir <value>] [--api-version <value>]
FLAGS
-f, --path=<value>... (required) Path to file(s) to add. Specify multiple times for batch upload.
-i, --library-id=<value> (required) Agentforce Data Library ID (18-char Salesforce ID with prefix 1JD).
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
--api-version=<value> Override the api version used for api requests made by this command
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Add files to an existing Agentforce Data Library.
Adds one or more files to an existing SFDRIVE data library and triggers SearchIndex re-hydration. This is the day-2
operation for adding files to an already-provisioned library.
Adds files to an existing READY library. Unlike `sf agent adl upload`, this does NOT create new downstream Data Cloud
assets — it appends files to the existing SearchIndex and triggers re-indexing.
Constraints: at least 1 file required, no duplicate file names in a batch, maximum 1000 files per library.
EXAMPLES
Add a file to an existing library:
$ sf agent adl file add -i 1JDSG000007IbWX4A0 --path ./docs/new-guide.pdf --target-org myOrg
Add multiple files:
$ sf agent adl file add -i 1JDSG000007IbWX4A0 --path ./docs/guide.pdf --path ./docs/faq.txt --target-org myOrg
See code: @salesforce/plugin-agent
Delete a file from an Agentforce Data Library.
USAGE
$ sf agent adl file delete -o <value> -i <value> --file-id <value> [--json] [--flags-dir <value>] [--api-version
<value>]
FLAGS
-i, --library-id=<value> (required) Agentforce Data Library ID (18-char Salesforce ID with prefix 1JD).
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
--api-version=<value> Override the api version used for api requests made by this command
--file-id=<value> (required) ID of the file to delete (AiGroundingFileRef record ID).
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Delete a file from an Agentforce Data Library.
Permanently removes a file from an SFDRIVE data library and triggers re-indexing of the search index.
EXAMPLES
Delete a file from a data library:
$ sf agent adl file delete --library-id 1JDSG000007IbWX4A0 --file-id a1B2C3D4E5F6G7H8I9 --target-org myOrg
See code: @salesforce/plugin-agent
List files in an Agentforce Data Library.
USAGE
$ sf agent adl file list -o <value> -i <value> [--json] [--flags-dir <value>] [--api-version <value>] [--page-size
<value>] [--offset <value>] [--status uploaded|indexing|indexed|index_failed|deleting|delete_failed]
FLAGS
-i, --library-id=<value> (required) Agentforce Data Library ID (18-char Salesforce ID with prefix 1JD).
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
--api-version=<value> Override the api version used for api requests made by this command
--offset=<value> Number of files to skip before returning results (for pagination).
--page-size=<value> [default: 50] Number of files to return per page (1-200, default 50).
--status=<option> Filter files by indexing status.
<options: uploaded|indexing|indexed|index_failed|deleting|delete_failed>
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
List files in an Agentforce Data Library.
Returns the list of files in an SFDRIVE library including file name, size, and creation date.
EXAMPLES
List files in a data library:
$ sf agent adl file list --library-id 1JDSG000007IbWX4A0 --target-org myOrg
List files and output as JSON:
$ sf agent adl file list --library-id 1JDSG000007IbWX4A0 --target-org myOrg --json
See code: @salesforce/plugin-agent
Get details of an Agentforce Data Library.
USAGE
$ sf agent adl get -o <value> -i <value> [--json] [--flags-dir <value>] [--api-version <value>]
FLAGS
-i, --library-id=<value> (required) Agentforce Data Library ID (18-char Salesforce ID with prefix 1JD).
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
--api-version=<value> Override the api version used for api requests made by this command
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Get details of an Agentforce Data Library.
Returns the full detail of a data library including its grounding source configuration, status, and retriever ID.
EXAMPLES
Get details of a data library:
$ sf agent adl get --library-id 1JDSG000007IbWX4A0 --target-org myOrg
See code: @salesforce/plugin-agent
List Agentforce Data Libraries in an org.
USAGE
$ sf agent adl list -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [--source-type
sfdrive|knowledge|retriever]
FLAGS
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
--api-version=<value> Override the api version used for api requests made by this command
--source-type=<option> Filter by source type: sfdrive, knowledge, or retriever.
<options: sfdrive|knowledge|retriever>
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
List Agentforce Data Libraries in an org.
Returns all data libraries in the target org, including their source type, status, and library ID.
EXAMPLES
List all data libraries in the default target org:
$ sf agent adl list --target-org myOrg
List data libraries and output as JSON:
$ sf agent adl list --target-org myOrg --json
See code: @salesforce/plugin-agent
Get indexing status of an Agentforce Data Library.
USAGE
$ sf agent adl status -o <value> -i <value> [--json] [--flags-dir <value>] [--api-version <value>]
[--include-artifacts]
FLAGS
-i, --library-id=<value> (required) Agentforce Data Library ID (18-char Salesforce ID with prefix 1JD).
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
--api-version=<value> Override the api version used for api requests made by this command
--include-artifacts Resolve DC asset artifacts (DataStream, DLO, DMO, SearchIndex, Retriever) with entity IDs
and names on each stage. Slower — requires additional queries.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Get indexing status of an Agentforce Data Library.
Returns the current indexing status including stage details (DATA_STREAM, DATA_LAKE_OBJECT, DATA_MODEL_OBJECT,
SEARCH_INDEX, RETRIEVER) and any errors.
EXAMPLES
Get status of a data library:
$ sf agent adl status --library-id 1JDSG000007IbWX4A0 --target-org myOrg
See code: @salesforce/plugin-agent
Update an Agentforce Data Library.
USAGE
$ sf agent adl update -o <value> -i <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value>]
[--description <value>] [--content-fields <value>] [--restrict-to-public-articles] [--data-category-rule]
[--retriever-id <value>]
FLAGS
-i, --library-id=<value> (required) Agentforce Data Library ID (18-char Salesforce ID with prefix 1JD).
-n, --name=<value> New display name for the data library (max 80 characters).
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the
`target-org` configuration variable is already set.
--api-version=<value> Override the api version used for api requests made by this command
--content-fields=<value> Comma-separated list of content fields for KNOWLEDGE libraries (triggers
re-indexing).
--[no-]data-category-rule Enable or disable data category filtering for KNOWLEDGE libraries. Use
--no-data-category-rule to disable.
--description=<value> New description for the data library (max 255 characters).
--[no-]restrict-to-public-articles Restrict to public Knowledge articles only (KNOWLEDGE libraries, triggers
re-indexing).
--retriever-id=<value> Swap the retriever for a RETRIEVER library (must be an active Custom Retriever
ID).
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Update an Agentforce Data Library.
Updates the label, description, or other mutable properties of an existing data library.
EXAMPLES
Update the label of a data library:
$ sf agent adl update --library-id 1JDSG000007IbWX4A0 --name "New Name" --target-org myOrg
Update the description:
$ sf agent adl update --library-id 1JDSG000007IbWX4A0 --description "Updated description" --target-org myOrg
Update Knowledge library content fields (triggers re-indexing):
$ sf agent adl update --library-id 1JDSG000007IbWX4A0 --content-fields "Answer**c,Summary**c" --target-org myOrg
Restrict Knowledge library to public articles:
$ sf agent adl update --library-id 1JDSG000007IbWX4A0 --restrict-to-public-articles --target-org myOrg
See code: @salesforce/plugin-agent
Upload a file to an SFDRIVE Agentforce Data Library.
USAGE
$ sf agent adl upload -o <value> -i <value> -f <value>... [--json] [--flags-dir <value>] [--api-version <value>] [-w
<value>]
FLAGS
-f, --file=<value>... (required) Path to the file to upload.
-i, --library-id=<value> (required) Agentforce Data Library ID (18-char Salesforce ID with prefix 1JD).
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
-w, --wait=<value> Number of minutes to wait for indexing to complete. If not specified, returns after
triggering indexing.
--api-version=<value> Override the api version used for api requests made by this command
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Upload a file to an SFDRIVE Agentforce Data Library.
Performs the multi-step upload workflow: checks upload readiness, obtains a pre-signed S3 URL, uploads the file,
triggers indexing, and optionally polls until the library is ready (retrieverId is populated).
Upload triggers the full Data Cloud provisioning pipeline, creating all downstream assets (DLO, DMO, SearchIndex,
Retriever). Use `sf agent adl status` to monitor progress. For adding files to an already-provisioned library, use `sf
agent adl file add` instead.
This command only works with SFDRIVE libraries. KNOWLEDGE libraries index automatically after creation, and RETRIEVER
libraries require no file upload.
EXAMPLES
Upload a file and wait for indexing to complete:
$ sf agent adl upload --library-id 1JDSG000007IbWX4A0 --file ./docs/guide.pdf --target-org myOrg --wait 10
Upload a file without waiting:
$ sf agent adl upload --library-id 1JDSG000007IbWX4A0 --file ./docs/guide.pdf --target-org myOrg
See code: @salesforce/plugin-agent
Create an agent in your org using a local agent spec file.
USAGE
$ sf agent create -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [--name <value>] [--api-name
<value>] [--spec <value>] [--preview]
FLAGS
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
--api-name=<value> API name of the new agent; if not specified, the API name is derived from the agent name
(label); the API name must not exist in the org.
--api-version=<value> Override the api version used for api requests made by this command
--name=<value> Name (label) of the new agent.
--preview Preview the agent without saving it in your org.
--spec=<value> Path to an agent spec file.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Create an agent in your org using a local agent spec file.
NOTE: This command creates an agent that doesn't use Agent Script as its blueprint. We generally don't recommend you
use this workflow to create an agent. Rather, use the "agent generate|validate|publish authoring-bundle" commands to
author agents that use the Agent Script language. See "Author an Agent"
(https://developer.salesforce.com/docs/einstein/genai/guide/agent-dx-nga-author-agent.html) for details.
To run this command, you must have an agent spec file, which is a YAML file that define the agent properties and
contains a list of AI-generated topics. Topics define the range of jobs the agent can handle. Use the "agent generate
agent-spec" CLI command to generate an agent spec file. Then specify the file to this command using the --spec flag,
along with the name (label) of the new agent with the --name flag. If you don't specify any of the required flags, the
command prompts you.
When this command completes, your org contains the new agent, which you can then edit and customize in the Agent
Builder UI. The new agent's topics are the same as the ones listed in the agent spec file. The agent might also have
some AI-generated actions, or you can add them. This command also retrieves all the metadata files associated with the
new agent to your local Salesforce DX project.
Use the --preview flag to review what the agent looks like without actually saving it in your org. When previewing,
the command creates a JSON file in the current directory with all the agent details. The name of the JSON file is the
agent's API name and a timestamp.
To open the new agent in your org's Agent Builder UI, run this command: "sf org open agent --api-name <api-name>".
EXAMPLES
Create an agent by being prompted for the required information, such as the agent spec file and agent name, and then
create it in your default org:
$ sf agent create
Create an agent by specifying the agent name, API name, and spec file with flags; use the org with alias "my-org";
the command fails if the API name is already being used in your org: