Output contract
Output contract
This page is for people who script Warden or read its output in CI. It describes the output formats, where output goes, the CSV columns, and the exit codes.
The eight operational commands (access, diff, freeze, provision, restore, snapshot, strip, and unfreeze) accept --output human|csv|json and --output-file <path>. Human output is the default. The persona commands are different: persona export --output takes a file path, not a format. The flag reference is in the CLI reference.
Formats and destinations
--output csv or --output json writes the machine-readable payload to stdout. Add --output-file <path> to write it to a file instead. Progress, warnings, and confirmations still print to the console as usual. With the default human format, --output-file does nothing unless global --json is on.
The Salesforce CLI’s global --json flag is not the same as Warden’s --output json:
--jsonalone writes the Salesforce CLI{status,result,warnings}envelope to stdout and suppresses confirmation prompts.--json --output csv --output-file <path>(or--output json) writes the Warden payload to the file, and the envelope stays on stdout.--json --output-file <path>with no non-human--outputwrites the envelope to both stdout and the file.--jsonwith--output csvor--output jsonand no--output-fileis an error.
Direct machine output does not suppress confirmations on commands that change data. For an unattended run, use global --json.
-i/--interactive is a separate guided mode. It needs a TTY on standard input and can’t be combined with global --json. Warden rejects that combination before prompting. In interactive mode, the summary confirmation is the only confirmation, even for commands that change data. See Interactive mode.
Exit codes
0: the command finished with no per-user failures.1: one or more users failed inprovisionor a lifecycle command, or the command itself errored (oclif also uses1).accesshas no per-row failure, so it returns0unless it can’t run.diffreturns1for per-user failures.--fail-on-drift(off by default) also returns1when any user has drift.diff --verifyreturns1when any user is non-conformant, by settingprocess.exitCode = 1after it renders the verdicts.
Exit codes don’t change the result payload. With global --json, a partial failure or non-conformant verify result keeps status: 0 in the Salesforce CLI envelope while the process exits with 1. Verify mode’s result is still the full verdict array.
CSV shape
CSV rows are the same on every run and share one escaping rule.
accesskeeps its first eight columns (userId,userName,username,assignmentType,sourceId,sourceName,viaPermissionSetId,viaPermissionSetName). It addstargetType,targetName,sourceApiName, andsourceLabel, then target-specific access columns.diffaddsuserName,username,valueApiName,valueLabel,valueType,valueBefore,valueAfterafter its original six columns.diff --verifyuseskey,conformant,violationsinstead. Indiff,valuekeeps its position and still holds the record Id. Profile and role rows also fillvalueBeforeandvalueAfter, whilevaluestays the readablebefore -> afterstring.provisionwrites one row per action, related-record result, or error, withuserKey,userId,userName,username,personas,matchedBy,status,action,detail,error. Details are below.freezeandunfreezewrite one row per user:userKey,userId,userName,username,wasFrozen,status,action,error.restorewrites one row per action or action item:userKey,userId,userName,username,status,action,category,name,error.stripwrites one row per action or removed item:userKey,userId,userName,username,status,action,category,itemId,itemApiName,error.snapshotwriteskey,id,status,actions,skipped,warnings,errors, one row per selected user. This report is separate from the snapshot file that--outwrites.
For lifecycle commands, a user with no actions still gets a row, and each error gets its own row. On CSV write, cells that start with =, +, -, @, a tab, or a carriage return get an apostrophe prefix. This protects spreadsheet viewers. It isn’t applied to JSON or human output. When Warden reads a snapshot CSV, it strips that prefix, so names survive a write/read round trip.
When CSV goes to stdout, access statistics and warnings stay out of it. When CSV goes to a file, the file holds only the CSV.
Provision details
Related records. Related rows use the same ten columns. action is related, detail is <relationship> <phase> <sobject> <related-action>, and error holds any related-record failure. In JSON, user actions are unchanged, and users[].relatedRecords[] is added for selected relationships. Each entry has relationship, phase (before or after), sobject, action, status, and, when available, recordId, detail, and error. createdInThisRun is internal and never appears in public output. Before-phase entries use the same action/status values and CSV columns as after-phase entries. Dry runs report planned entries for both phases. A before-phase failure reports its real related-record error and prevents the User save. If the related record succeeds but the User save fails, the result retains the applied before entry and its record Id; that record remains in the org and may be orphaned unless --cleanup-on-failure is enabled. Cleanup appends deleted (status applied) or deleteFailed (status failed, with the deletion error) entries to the same array. A before record retained because a successfully saved User links to it is reported as skipped with an explanatory detail. CSV uses the same header and includes the new actions in detail; users[].actions and the summary fields are unchanged.
- Dry-run actions are
wouldCreate,wouldUpdate, orwouldSkip. An unchanged matched row ismatched. - Live actions are
created,updated,matched, orskipped, plusdeletedanddeleteFailedwhen cleanup is enabled.
Match fields. Provision JSON also carries:
users[].matchValue, the value looked up undermatchedBy. It isnullwhen no lookup was made, because the value was absent, empty, or not a string.users[].matched, whether an existing user was found.
matchedBy only says a match field was configured, so it can’t tell you whether an existing user was found. Use matched for that. Human output combines the two as matched <field> = <value> or unmatched <field> = <value>, and prints bare unmatched when no match field was set. CSV still carries only matchedBy.