# WINC machine-adoption import (CLI) Adopts machines from a Maximo asset export (validated against the WINC / West Manufacturing site). It only updates machines that already exist; it never creates canonical per-table rows. Every commit is journaled so it can be undone as one batch. Run all commands from the repo root. Each reads `.env` and connects to the configured database. ## 1. Preview (read-only) ``` python -m scripts.site_imports.winc.dry_run --export EXPORT.csv ``` | switch | what it does | | --- | --- | | `--export PATH` | the Maximo ASSET export CSV to analyze (required) | | `--rows` | print the per-row plan, not just the summary | | `--csv PATH` | write the full plan to a CSV so runs can be diffed | Nothing is written. Use this to see what would change and which values are unresolved before committing. ## 2. Commit (writes, reversibly) ``` python -m scripts.site_imports.winc.writer --export EXPORT.csv --commit --acknowledge businessunit ``` | switch | what it does | | --- | --- | | `--export PATH` | the same export CSV (required) | | `--commit` | actually write; without it this is a dry run | | `--acknowledge GROUP` | approve a needs-create group (repeatable), e.g. `businessunit` | | `--createdby NAME` | who approved the import; stamped on the batch | On success it prints the new `batchid` and the exact undo command. ## 3. List batches ``` python -m scripts.site_imports.winc.batches ``` | switch | what it does | | --- | --- | | `--limit N` | show at most N batches, newest first (default 50) | | `--json` | emit JSON instead of a table | Read-only. Use it to find the `batchid` to undo. ## 4. Undo a batch ``` python -m scripts.site_imports.winc.undo --batch BATCHID --commit ``` | switch | what it does | | --- | --- | | `--batch BATCHID` | the batch to reverse (required) | | `--commit` | actually reverse; without it this is a no-op | Reversal is conservative: a cell a human changed since the import is left as-is and reported, and a created business unit is deleted only when nothing outside the batch still references it.