SubFT

Automation response reference

JSON envelopes, streams, exit codes and conditional result fields for the SubFT CLI.

Versioned envelopes

With --json, an ordinary command invocation emits one schema_version 1 document on stdout. Help/version output is Click output, so do not parse those invocations as command envelopes. Prompts and diagnostics use stderr; progress is suppressed. --json can still prompt. The complete unattended script also supplies --yes and explicit nondeterministic choices.

Success has schema_version (integer), ok (true), command (string) and result (object). Failure has schema_version, ok (false), command and error; error contains code (machine-readable string), message (technical text) and details (object). Unknown codes need generic translated feedback in a public interface. Automation branches on code/details and exit status, not message wording. This envelope is independent of SRT/VTT/ASS subtitle serialization.

Example output
{
  "schema_version": 1,
  "ok": true,
  "command": "project.bindings",
  "result": {
    "bindings": []
  }
}
Example output
{
  "schema_version": 1,
  "ok": false,
  "command": "operation.start",
  "error": {
    "code": "input_required",
    "message": "",
    "details": {}
  }
}

The empty message above intentionally omits technical diagnostic wording; it is a shape example. Successful commands may be cancelled with exit 0 and result.cancelled=true. Error details are command/branch-specific.

Envelope field inventory

Fields are required in their stated success/failure branch. result and error.details are command-specific open objects; error.message is technical diagnostic text. The schema version in both examples is checked against the serializer.

BranchFieldMeaning
successschema_versionRequired envelope field; see the typed explanation above.
successokRequired envelope field; see the typed explanation above.
successcommandRequired envelope field; see the typed explanation above.
successresultRequired envelope field; see the typed explanation above.
failureschema_versionRequired envelope field; see the typed explanation above.
failureokRequired envelope field; see the typed explanation above.
failurecommandRequired envelope field; see the typed explanation above.
failureerrorRequired envelope field; see the typed explanation above.
failureerror.codeRequired envelope field; see the typed explanation above.
failureerror.messageRequired envelope field; see the typed explanation above.
failureerror.detailsRequired envelope field; see the typed explanation above.

Exit codes

Use the process status for broad handling and the stable error code for scoped recovery. Nonzero does not imply that no operation was committed or no file was written.

ExitConstantMeaning
0SUCCESSSuccess or interactive cancellation; inspect result.cancelled before using an operation ID.
1EXIT_INTERNALinternal_failure or command_failed: inspect internal diagnostics, do not assume accepted work was undone.
2EXIT_USAGEinvalid_usage: fix command/flag syntax; no automatic retry.
3EXIT_AUTHauthentication_failed: check effective token, gateway and protected configuration.
4EXIT_INPUT_REQUIREDinput_required: provide the missing choice or approval; --yes cannot invent a selection.
5EXIT_LOCALlocal_failure: inspect local files, FFmpeg availability or advisory lock.
6EXIT_GATEWAYgateway_failure: transport or gateway protocol failed; reconcile any possibly accepted commit before retry.
7EXIT_REMOTEremote_rejection: stale state or remote action required. preparation_incomplete identifies recoverable source supply.
8EXIT_OPERATIONoperation_failed: failed/aborted terminal work, including explicitly applied successful partial output.
130EXIT_INTERRUPTEDinterrupted: the caller detached; accepted server work continues unless separately aborted.

Stable error mappings

These machine codes map to the process exits above. Handle unknown codes with a translated generic error; details may retain accepted operation IDs or written partial results.

CodeExitMeaning
authentication_failed3authentication_failed: check effective token, gateway and protected configuration.
command_failed1internal_failure or command_failed: inspect internal diagnostics, do not assume accepted work was undone.
gateway_failure6gateway_failure: transport or gateway protocol failed; reconcile any possibly accepted commit before retry.
input_required4input_required: provide the missing choice or approval; --yes cannot invent a selection.
internal_failure1internal_failure or command_failed: inspect internal diagnostics, do not assume accepted work was undone.
interrupted130interrupted: the caller detached; accepted server work continues unless separately aborted.
invalid_usage2invalid_usage: fix command/flag syntax; no automatic retry.
local_failure5local_failure: inspect local files, FFmpeg availability or advisory lock.
operation_failed8operation_failed: failed/aborted terminal work, including explicitly applied successful partial output.
remote_rejection7remote_rejection: stale state or remote action required. preparation_incomplete identifies recoverable source supply.

Command result fields

These inventories are unions of actual result branches, not a list of fields required on every response. Types describe the documented serialized values; dictionaries remain open where source declares Any. The default successful final stage is used for export unless explicit artifact selectors change it.

login

Verify and store an API token for its gateway. Use the hidden prompt or protected environment.

FieldSerialized typeMeaning
api_urlstringVerified gateway/account or credential origin; no token secret is returned.
credential_sourcestringVerified gateway/account or credential origin; no token secret is returned.
user_idstringVerified gateway/account or credential origin; no token secret is returned.

logout

Remove only the locally stored token. Environment authentication remains active; server revocation is separate.

FieldSerialized typeMeaning
api_urlstringVerified gateway/account or credential origin; no token secret is returned.
environment_authentication_activebooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
stored_token_removedbooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.

operation.apply

Wait if needed, select saved successful artifacts, and write/register local outputs. Failed inputs are unavailable; partial export needs explicit approval.

FieldSerialized typeMeaning
allowed_actionsarray<string>Actions allowed by the current canonical operation state.
cancelledbooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
content_countsobjectNamed canonical counters for content, phases or preparation. Counts are not independent lifecycle statuses.
display_statusstring | nullCanonical execution/display/terminal outcome; terminal outcome may be absent while active.
event_sequenceintegerMonotonic event sequence or canonical state revision.
execution_statestring | nullCanonical execution/display/terminal outcome; terminal outcome may be absent while active.
finished_atstring | nullCanonical timestamps; null means no recorded timestamp for that event.
operation_idstring | nullResource ID supplied by this branch. Save the operation ID before resuming preparation or watching.
outcomestring | nullCanonical execution/display/terminal outcome; terminal outcome may be absent while active.
output_targetstringSubtitle output selector, never the --json envelope format.
outputsarray<string>Local output paths; on partial failure inspect error.details.result.outputs.
partialbooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
pathstringNormalized local path for this binding/synchronization.
phase_countsobjectNamed canonical counters for content, phases or preparation. Counts are not independent lifecycle statuses.
preparation_countsobjectNamed canonical counters for content, phases or preparation. Counts are not independent lifecycle statuses.
project_idstring | nullResource ID supplied by this branch. Save the operation ID before resuming preparation or watching.
selected_artifact_idsarray<string>Immutable successful stage IDs selected for this export.
started_atstring | nullCanonical timestamps; null means no recorded timestamp for that event.
state_versionintegerMonotonic event sequence or canonical state revision.
unchanged_outputsintegerAccepted supplies, identical unchanged outputs or newly written outputs; retain counts after partial failure.
updated_atstring | nullCanonical timestamps; null means no recorded timestamp for that event.
written_outputsintegerAccepted supplies, identical unchanged outputs or newly written outputs; retain counts after partial failure.

operation.start

Preflight synchronized media, prepare selected sources, estimate, confirm charges, commit and supply. Wait or detach after acceptance; export is separate.

FieldSerialized typeMeaning
allowed_actionsarray<string>Actions allowed by the current canonical operation state.
available_creditsintegerAccount balance or quoted charge before commit; compare with approval, not processing duration.
cancelledbooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
content_countsobjectNamed canonical counters for content, phases or preparation. Counts are not independent lifecycle statuses.
detachedbooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
display_statusstring | nullCanonical execution/display/terminal outcome; terminal outcome may be absent while active.
event_sequenceintegerMonotonic event sequence or canonical state revision.
execution_statestring | nullCanonical execution/display/terminal outcome; terminal outcome may be absent while active.
finished_atstring | nullCanonical timestamps; null means no recorded timestamp for that event.
operation_idstring | nullResource ID supplied by this branch. Save the operation ID before resuming preparation or watching.
outcomestring | nullCanonical execution/display/terminal outcome; terminal outcome may be absent while active.
pathstringNormalized local path for this binding/synchronization.
phase_countsobjectNamed canonical counters for content, phases or preparation. Counts are not independent lifecycle statuses.
preparation_countsobjectNamed canonical counters for content, phases or preparation. Counts are not independent lifecycle statuses.
preparation_failuresarray<object>Source failures with media_path, content_id and failure_code; resupply only eligible preparations.
preparation_incompletebooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
project_idstring | nullResource ID supplied by this branch. Save the operation ID before resuming preparation or watching.
required_creditsintegerAccount balance or quoted charge before commit; compare with approval, not processing duration.
sources_acceptedbooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
started_atstring | nullCanonical timestamps; null means no recorded timestamp for that event.
state_versionintegerMonotonic event sequence or canonical state revision.
updated_atstring | nullCanonical timestamps; null means no recorded timestamp for that event.

operation.supply

Resume eligible awaiting_client/awaiting_retry sources on the existing committed operation. Terminal processing recovery starts a new operation instead.

FieldSerialized typeMeaning
allowed_actionsarray<string>Actions allowed by the current canonical operation state.
content_countsobjectNamed canonical counters for content, phases or preparation. Counts are not independent lifecycle statuses.
display_statusstring | nullCanonical execution/display/terminal outcome; terminal outcome may be absent while active.
event_sequenceintegerMonotonic event sequence or canonical state revision.
execution_statestring | nullCanonical execution/display/terminal outcome; terminal outcome may be absent while active.
finished_atstring | nullCanonical timestamps; null means no recorded timestamp for that event.
operation_idstring | nullResource ID supplied by this branch. Save the operation ID before resuming preparation or watching.
outcomestring | nullCanonical execution/display/terminal outcome; terminal outcome may be absent while active.
phase_countsobjectNamed canonical counters for content, phases or preparation. Counts are not independent lifecycle statuses.
preparation_countsobjectNamed canonical counters for content, phases or preparation. Counts are not independent lifecycle statuses.
preparation_failuresarray<object>Source failures with media_path, content_id and failure_code; resupply only eligible preparations.
preparation_incompletebooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
project_idstring | nullResource ID supplied by this branch. Save the operation ID before resuming preparation or watching.
sources_suppliedintegerAccepted supplies, identical unchanged outputs or newly written outputs; retain counts after partial failure.
started_atstring | nullCanonical timestamps; null means no recorded timestamp for that event.
state_versionintegerMonotonic event sequence or canonical state revision.
updated_atstring | nullCanonical timestamps; null means no recorded timestamp for that event.

The following checked inventory lists fields inside object/array branches. It is an inventory, not a response envelope. Array items use []. Cancellation may omit the entire object. Types and meanings follow the field descriptions above; counters use the nested lifecycle schemas.

JSON
{
  "preparation_failures[]": [
    "content_id",
    "failure_code",
    "path"
  ]
}

operation.watch

Reattach to canonical operation state with realtime hints and HTTP polling. Ctrl-C detaches without aborting accepted work.

FieldSerialized typeMeaning
allowed_actionsarray<string>Actions allowed by the current canonical operation state.
content_countsobjectNamed canonical counters for content, phases or preparation. Counts are not independent lifecycle statuses.
display_statusstring | nullCanonical execution/display/terminal outcome; terminal outcome may be absent while active.
event_sequenceintegerMonotonic event sequence or canonical state revision.
execution_statestring | nullCanonical execution/display/terminal outcome; terminal outcome may be absent while active.
failuresarray<object>Unavailable contents with media_path, content_id and technical reason; do not export failed inputs.
finished_atstring | nullCanonical timestamps; null means no recorded timestamp for that event.
operation_idstring | nullResource ID supplied by this branch. Save the operation ID before resuming preparation or watching.
outcomestring | nullCanonical execution/display/terminal outcome; terminal outcome may be absent while active.
phase_countsobjectNamed canonical counters for content, phases or preparation. Counts are not independent lifecycle statuses.
preparation_countsobjectNamed canonical counters for content, phases or preparation. Counts are not independent lifecycle statuses.
project_idstring | nullResource ID supplied by this branch. Save the operation ID before resuming preparation or watching.
started_atstring | nullCanonical timestamps; null means no recorded timestamp for that event.
state_versionintegerMonotonic event sequence or canonical state revision.
updated_atstring | nullCanonical timestamps; null means no recorded timestamp for that event.

The following checked inventory lists fields inside object/array branches. It is an inventory, not a response envelope. Array items use []. Cancellation may omit the entire object. Types and meanings follow the field descriptions above; counters use the nested lifecycle schemas.

JSON
{
  "failures[]": [
    "content_id",
    "media_path",
    "reason"
  ]
}

project.bind

Bind a local file or directory to a matching durable project. Bindings are a disposable cache, not inventory synchronization.

FieldSerialized typeMeaning
bindingobjectSelected association: api_url, user_id, path, path_kind, project_id, project_name and project_mode. The bindings-list branch additionally includes bound_at and validated_at.
cancelledbooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
pathstringNormalized local path for this binding/synchronization.

The following checked inventory lists fields inside object/array branches. It is an inventory, not a response envelope. Array items use []. Cancellation may omit the entire object. Types and meanings follow the field descriptions above; counters use the nested lifecycle schemas.

JSON
{
  "binding": [
    "api_url",
    "path",
    "path_kind",
    "project_id",
    "project_mode",
    "project_name",
    "user_id"
  ]
}

project.bindings

Read cached associations without backend validation or authentication. Optional PATH filters the local list.

FieldSerialized typeMeaning
bindingsarray<object>Cached associations read/removed in this local scope; removing them changes no backend project.

The following checked inventory lists fields inside object/array branches. It is an inventory, not a response envelope. Array items use []. Cancellation may omit the entire object. Types and meanings follow the field descriptions above; counters use the nested lifecycle schemas.

JSON
{
  "bindings[]": [
    "api_url",
    "bound_at",
    "path",
    "path_kind",
    "project_id",
    "project_mode",
    "project_name",
    "user_id",
    "validated_at"
  ]
}

project.forget

Remove local associations scoped to gateway/account; accept missing paths and never archive/delete backend projects.

FieldSerialized typeMeaning
cancelledbooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
pathstringNormalized local path for this binding/synchronization.
removedarray<object>Cached associations read/removed in this local scope; removing them changes no backend project.

The following checked inventory lists fields inside object/array branches. It is an inventory, not a response envelope. Array items use []. Cancellation may omit the entire object. Types and meanings follow the field descriptions above; counters use the nested lifecycle schemas.

JSON
{
  "removed[]": [
    "api_url",
    "project_id",
    "project_name",
    "user_id"
  ]
}

project.sync

Inspect the entire local input and reconcile project inventory. Local scan/probe failures prevent partial submission; stale apply needs a fresh preview.

FieldSerialized typeMeaning
actionstringFile-sync action such as add, replace or up_to_date.
appliedbooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
auto_apply_safebooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
bindingobjectSelected association: api_url, user_id, path, path_kind, project_id, project_name and project_mode. The bindings-list branch additionally includes bound_at and validated_at.
cancelledbooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
confirmed_movesarray<object>Reviewed from/to media-path mappings; preserve the preview’s IDs and evidence.
mediaobjectSynchronized media summary with id, path and status; present on applicable file-sync branches.
media_idstring | nullResource ID supplied by this branch. Save the operation ID before resuming preparation or watching.
modestringfile or directory project mode selected from the local input.
pathstringNormalized local path for this binding/synchronization.
previewbooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.
summaryobjectDirectory-change counts and preview summary; inspect reviewed changes before approving.
up_to_datebooleanBranch-specific decision/status flag; absence does not mean False. Cancellation can succeed without creating work.

The following checked inventory lists fields inside object/array branches. It is an inventory, not a response envelope. Array items use []. Cancellation may omit the entire object. Types and meanings follow the field descriptions above; counters use the nested lifecycle schemas.

JSON
{
  "binding": [
    "api_url",
    "path",
    "path_kind",
    "project_id",
    "project_mode",
    "project_name",
    "user_id"
  ],
  "confirmed_moves[]": [
    "new_path",
    "old_path"
  ],
  "media": [
    "id",
    "path",
    "status"
  ],
  "media[]": [
    "id",
    "path",
    "status"
  ]
}

status

Verify the effective credential and gateway; environment overrides are not persisted.

FieldSerialized typeMeaning
api_urlstringVerified gateway/account or credential origin; no token secret is returned.
credential_sourcestringVerified gateway/account or credential origin; no token secret is returned.
user_idstringVerified gateway/account or credential origin; no token secret is returned.

Preparation and partial-output branches

Incomplete start/supply uses exit 7, error.code=remote_rejection and error.details with operation_id, preparation_incomplete=true and preparation_failures. Each preparation failure names path, content_id and failure_code; watch failures instead use media_path, content_id and reason. Keep that operation ID and use eligible source preparation recovery.

Watch failures use exit 8 and details.operation_id, status and failures. Partial apply can write successful files and still return exit 8; details.result retains outputs, written_outputs, unchanged_outputs and selected_artifact_ids plus lifecycle fields. Preserve that nested result before reporting failure. Failed source items themselves cannot be exported. --yes --allow-partial explicitly approves this branch; --allow-partial alone does not grant unattended approval.

Terminal failed work requires a new independently estimated operation. Do not replay operation start as a generic response to every nonzero exit.