Skip to content

ReturnPro CLI Commands

Workflow-oriented index of the ReturnPro-specific CLI commands. For canonical flag reference see Finance and Transactions.

Monthly close

The six commands that drive a typical close, in order:

CommandPurpose
optimal finance template --output ./tpl.xlsxGenerate the NetSuite template pre-filled with dim_account + dim_program_id.
optimal finance upload --file ./netsuite-march.xlsm --user-id <uuid>Parse Solution7 cached results, resolve FKs, INSERT to stg_financials_raw.
optimal finance upload-confirmed --file ./income-stmt-march.csv --user-id oracleUpsert confirmed GL data into confirmed_income_statements on (account_code, period).
optimal finance audit --months 2026-03Compare staging vs confirmed for the month(s).
optimal finance diagnose --months 2026-03Check FK resolution, data gaps, sign-multiplier sanity.
optimal finance month-close --month 2026-03Run the whole flow end-to-end with --from <step> resume support.

See NetSuite Template Flow for the full narrative.

R1 volumes

bash
# Each volume type is uploaded separately
optimal finance upload-r1 --file ./check-in-march.xlsx   --user-id <uuid> --month 2026-03 --volume-type checked_in
optimal finance upload-r1 --file ./orders-closed.xlsx    --user-id <uuid> --month 2026-03 --volume-type order_closed
optimal finance upload-r1 --file ./ops-complete.xlsx     --user-id <uuid> --month 2026-03 --volume-type ops_complete

INSERT-only — delete the old batch first if you need to re-run.

Anomalies + KPIs + preflight

CommandPurpose
optimal finance anomalies --from 2026-01 --to 2026-03 --threshold 0.05Detect rate anomalies across a date range.
optimal finance kpis --months 2026-03 --programs "..." --format csvExport KPI data.
optimal finance preflight --month 2026-03 --income-statement ./is.csvPre-template validation.

Dim sync (deactivate-only)

bash
# Preview changes
optimal finance sync-dims --file ./dim-accounts.csv

# Apply
optimal finance sync-dims --file ./dim-accounts.csv --execute

sync-dims is deactivate-only

The CLI's dim sync deactivates outdated dim rows but does not add new ones or reactivate stale ones. Each close must also:

  1. Upsert any new IS GL codes into dim_account with the correct sign_multiplier (+1 revenue, −1 refunds, −1 cost/opex).
  2. Reactivate NetSuite-export programids stuck inactive in dim_program_id.

Reference scripts (one-off, not in the CLI): optimal-cli/scripts/march-dim-fix.ts and optimal-cli/scripts/fix-signs-from-audit.ts.

Pipeline trigger

bash
# Run all pipeline steps for a month
optimal finance pipeline --month 2026-03

# Run specific steps and poll for completion
optimal finance pipeline --month 2026-03 --steps upload,audit --poll

The pipeline command triggers the n8n workflow that wraps the close steps with notifications. For interactive close work, prefer optimal finance month-close.

Scenarios (replaces the old finance budget)

Budget projections moved to the dedicated scenario group:

bash
optimal scenario list
optimal scenario save --name "baseline-plus-5" --adjustment-type percentage --adjustment-value 5
optimal scenario compare --names "baseline,baseline-plus-5"
optimal scenario delete --name "old-scenario"

See Scenarios for the full reference.

Removed commands

These commands appeared in earlier docs as planned but were never built. They are not implemented in the current CLI:

  • optimal finance set-benchmark
  • optimal finance upload-income-mp
  • optimal finance budget
  • optimal finance export-budget

If equivalent functionality is needed, surface the requirement against the appropriate workflow in NetSuite Template Flow or open a kanban story.

Built by Carlos Lenis in Miami