Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions command-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,21 @@
"flagChars": ["v"],
"flags": ["flags-dir", "hook", "json", "loglevel", "version"],
"plugin": "@salesforce/plugin-info"
},
{
"alias": [],
"command": "schema",
"flagAliases": [],
"flagChars": [],
"flags": ["command", "flags-dir", "json"],
"plugin": "@salesforce/plugin-info"
},
{
"alias": [],
"command": "status",
"flagAliases": [],
"flagChars": [],
"flags": ["flags-dir", "json"],
"plugin": "@salesforce/plugin-info"
}
]
27 changes: 27 additions & 0 deletions messages/schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# summary

Display the schema for a CLI command, including its flags, args, and requirements.

# description

Outputs a JSON schema describing a command's input interface: flags with types and validation constraints, args, org/project requirements, and error codes. Designed for programmatic consumption by agents and tools.

When run without the --command flag, outputs a compact index of all available commands with their requirements.

# flags.command.summary

The command to describe (e.g. "org list" or "org:list").

# examples

- Display the schema for the "org list" command:

<%= config.bin %> <%= command.id %> --command "org list"

- Display an index of all available commands:

<%= config.bin %> <%= command.id %>

# error.commandNotFound

Command "%s" not found. Run "sf schema" to list all available commands.
11 changes: 11 additions & 0 deletions messages/status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# summary

Display the current CLI environment context.

# description

Show the active target org, dev hub, API version, project information, authenticated orgs, and CLI version. Always outputs JSON for programmatic consumption.

# examples

- <%= config.bin %> <%= command.id %>
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
},
"doctor": {
"description": "Tools for diagnosing problems with Salesforce CLI."
},
"schema": {
"description": "Display the schema for CLI commands."
},
"status": {
"description": "Display the current CLI environment context."
}
},
"flexibleTaxonomy": true,
Expand Down
230 changes: 230 additions & 0 deletions schemas/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/SchemaResult",
"definitions": {
"SchemaResult": {
"anyOf": [
{
"$ref": "#/definitions/CommandSchema"
},
{
"$ref": "#/definitions/CommandIndex"
}
]
},
"CommandSchema": {
"type": "object",
"properties": {
"command": {
"type": "string"
},
"summary": {
"type": "string"
},
"requiresProject": {
"type": "boolean"
},
"requiresOrg": {
"type": "boolean"
},
"acceptsOrg": {
"type": "boolean"
},
"requiresDevHub": {
"type": "boolean"
},
"acceptsDevHub": {
"type": "boolean"
},
"enableJsonFlag": {
"type": "boolean"
},
"flags": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["boolean", "option"]
},
"summary": {
"type": "string"
},
"char": {
"type": "string"
},
"required": {
"type": "boolean"
},
"multiple": {
"type": "boolean"
},
"helpValue": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"options": {
"type": "array",
"items": {
"type": "string"
}
},
"delimiter": {
"type": "string"
},
"exclusive": {
"type": "array",
"items": {
"type": "string"
}
},
"dependsOn": {
"type": "array",
"items": {
"type": "string"
}
},
"exactlyOne": {
"type": "array",
"items": {
"type": "string"
}
},
"atLeastOne": {
"type": "array",
"items": {
"type": "string"
}
},
"deprecated": {
"anyOf": [
{
"type": "boolean",
"const": true
},
{
"type": "object",
"properties": {
"to": {
"type": "string"
},
"message": {
"type": "string"
},
"version": {
"type": ["string", "number"]
}
},
"additionalProperties": false
}
]
}
},
"required": ["type"],
"additionalProperties": false
}
},
"args": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"summary": {
"type": "string"
},
"required": {
"type": "boolean"
},
"options": {
"type": "array",
"items": {
"type": "string"
}
},
"multiple": {
"type": "boolean"
}
},
"additionalProperties": false
}
},
"errorCodes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": ["name", "description"],
"additionalProperties": false
}
}
},
"required": [
"command",
"requiresProject",
"requiresOrg",
"acceptsOrg",
"requiresDevHub",
"acceptsDevHub",
"enableJsonFlag",
"flags",
"args"
],
"additionalProperties": false
},
"CommandIndex": {
"type": "object",
"properties": {
"commands": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"summary": {
"type": "string"
},
"requiresProject": {
"type": "boolean"
},
"requiresOrg": {
"type": "boolean"
},
"acceptsOrg": {
"type": "boolean"
},
"requiresDevHub": {
"type": "boolean"
},
"acceptsDevHub": {
"type": "boolean"
}
},
"required": ["id", "requiresProject", "requiresOrg", "acceptsOrg", "requiresDevHub", "acceptsDevHub"],
"additionalProperties": false
}
}
},
"required": ["commands"],
"additionalProperties": false
}
}
}
Loading
Loading