setup-agents

CLI reference

Commands

All commands live under the sf setup-agents topic.

sf setup-agents local

MAIN

Configures AI agent rule files for the current project directory. Auto-detects installed tools and prompts for role profile selection.

sf setup-agents local [--rules cursor|vscode|codex|claude|agentforce]
                      [--profile <value>] [-f]

Flags

Flag Type Description
--rules string Target AI tool. Options: cursor · vscode · codex · claude · agentforce. Omit to auto-detect.
--profile string Comma-separated role profiles. Omit for interactive multi-select. Non-TTY defaults to developer.
-f, --force boolean Overwrite existing rule files.

Tool Detection

When --rules is omitted, the command checks for:

IndicatorTool Configured
.cursor/ directorycursor
.vscode/ directoryvscode
AGENTS.md filecodex
CLAUDE.md fileclaude
.a4drules/ directoryagentforce
none detectedall 5 tools

Examples

# Auto-detect tools, interactive profile selection
sf setup-agents local

# Configure only Cursor
sf setup-agents local --rules cursor

# Configure Claude Code
sf setup-agents local --rules claude

# Configure with multiple combined profiles
sf setup-agents local --profile developer,architect,cgcloud

# Full Agentforce setup for a QA engineer
sf setup-agents local --rules agentforce --profile qa

# Force overwrite existing files
sf setup-agents local --force

sf setup-agents mcp

MCP

Writes a @salesforce/mcp server entry into .cursor/mcp.json (or ~/.cursor/mcp.json with --global), enabling Cursor AI to call Salesforce org tools directly.

sf setup-agents mcp [--target-org <alias>] [--profile <value>]
                    [--all-toolsets] [-g]

Flags

Flag Type Description
--target-org string Org alias or username. Omit for interactive org picker (requires TTY).
--profile string Determines which MCP toolsets to activate. See toolset map below.
--all-toolsets boolean Force-enable all available Salesforce MCP toolsets.
-g, --global boolean Write to ~/.cursor/mcp.json (user-level) instead of project.

Toolsets by Profile

ProfileToolsets
developer · architect · qa · cgcloudmetadata · data · testing · users
ba · pm · ux · crma · data360metadata · data
devopsmetadata · orgs · users
mulesoftmetadata · orgs

Interactive Login

If no authenticated Salesforce orgs are found, the command offers to start a sf org login web flow — prompts for an alias, opens the browser for OAuth, and waits for the login to complete before proceeding with MCP configuration.

Examples

# Configure for a specific org
sf setup-agents mcp --target-org myOrgAlias

# Write to global ~/.cursor/mcp.json
sf setup-agents mcp --target-org myOrg --global

# Enable all toolsets
sf setup-agents mcp --target-org myOrg --all-toolsets

# Profile-aware toolset selection
sf setup-agents mcp --target-org myOrg --profile developer

sf setup-agents update

MAINTENANCE

Scans the project for rule files generated by an older version of the plugin and regenerates only the stale ones. Active profiles are inferred from existing .cursor/rules/ profile files.

sf setup-agents update [--dry-run] [-y]

Flags

Flag Type Description
--dry-run boolean List stale files without modifying them.
-y, --yes boolean Skip confirmation prompt. Useful in CI.

Scanned Locations

LocationVersion Token
.cursor/rules/*.mdcpluginVersion: "x.y.z" in frontmatter
.github/copilot-instructions.md<!-- setup-agents: x.y.z -->
AGENTS.md<!-- setup-agents: x.y.z -->
CLAUDE.md<!-- setup-agents: x.y.z -->
.a4drules/*.md<!-- setup-agents: x.y.z -->
.a4drules/workflows/*.md<!-- setup-agents: x.y.z -->

Examples

# Preview what would be updated
sf setup-agents update --dry-run

# Update with confirmation
sf setup-agents update

# Update without prompting (CI)
sf setup-agents update --yes

Explore role profiles

Each profile tailors the rules to the specific role — from Developer to Data Cloud Engineer.