Socotra
CLI reference

Overview

Options, exit codes, and output formats shared by every Socotra command.


Global options apply to every command and must appear before the command name.

Global options

OptionAliasTypeDefaultDescription
--working-dir-dstringcwdWorking directory for YAML discovery and all operations
--config-cstringnullExplicit path to socotra.yaml (auto-searches upward)
--verbose-vboolfalseEnable verbose output
--log-filestringnullPath to JSON Lines debug log file
--detailed-exit-codesboolfalseDistinguish success-with-changes from success-no-changes
--version-VflagPrint version and exit immediately
--help-hflagDisplay Spectre.Console help page

Output formats

FormatBehavior
textColoured Spectre.Console output with prompts, spinners, progress bars, and risk indicators
jsonStructured JSON to stdout; info to stderr; --output json implies --auto-approve for apply

Exit code summary

CodeMeaningNotes
0Success (no changes)Default when no work was needed
1ErrorValidation, network, filesystem, missing template
2Success with changesOnly with --detailed-exit-codes

Change types and risk levels

ChangeRiskIndicator
CreateSolutionLow+ green
AddProjectLow+ green
AddToSolutionLow+ green
AddPackageLow+ green
AddSolutionFolderLow+ green
ApplyTemplateLow+ green
AddProjectReferenceMedium~ yellow
UpdatePackageMedium~ yellow
UpdateTargetFrameworkMedium~ yellow
UpdatePropertyMedium~ yellow
RemoveProjectReferenceHigh− red
RemovePackageHigh− red
RemoveSolutionFolderHigh− red
RemoveTemplateHigh− red

Detailed exit codes in CI

When --detailed-exit-codes is used, scripts can distinguish "nothing to do" (exit 0) from "changes applied" (exit 2). Useful for gating follow-up steps.

ci.ps1
dotnet socotra plan --detailed-exit-codes
if ($LASTEXITCODE -eq 2) {
    dotnet socotra apply --auto-approve
    git add .
    git commit -m "Apply socotra changes"
}
Schema 1.1 · CLI 1.0