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:
| Command | Purpose |
|---|---|
optimal finance template --output ./tpl.xlsx | Generate 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 oracle | Upsert confirmed GL data into confirmed_income_statements on (account_code, period). |
optimal finance audit --months 2026-03 | Compare staging vs confirmed for the month(s). |
optimal finance diagnose --months 2026-03 | Check FK resolution, data gaps, sign-multiplier sanity. |
optimal finance month-close --month 2026-03 | Run the whole flow end-to-end with --from <step> resume support. |
See NetSuite Template Flow for the full narrative.
R1 volumes
# 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_completeINSERT-only — delete the old batch first if you need to re-run.
Anomalies + KPIs + preflight
| Command | Purpose |
|---|---|
optimal finance anomalies --from 2026-01 --to 2026-03 --threshold 0.05 | Detect rate anomalies across a date range. |
optimal finance kpis --months 2026-03 --programs "..." --format csv | Export KPI data. |
optimal finance preflight --month 2026-03 --income-statement ./is.csv | Pre-template validation. |
Dim sync (deactivate-only)
# Preview changes
optimal finance sync-dims --file ./dim-accounts.csv
# Apply
optimal finance sync-dims --file ./dim-accounts.csv --executesync-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:
- Upsert any new IS GL codes into
dim_accountwith the correctsign_multiplier(+1revenue,−1refunds,−1cost/opex). - 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
# 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 --pollThe 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:
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-benchmarkoptimal finance upload-income-mpoptimal finance budgetoptimal finance export-budget
If equivalent functionality is needed, surface the requirement against the appropriate workflow in NetSuite Template Flow or open a kanban story.