The internal servers have no access to outside package repositories and run Python 3.8/3.9, so the UI moves from hand-drawn curses to Textual 6.2.1 (the last release supporting 3.8.1), vendored with its pure-Python dependencies in vendor/. The launcher puts vendor/ first on sys.path, so a plain checkout runs with no pip and no network. - dsflow/: the single script split into a package (pure moves of the backend sections); action rules moved to ops.py, free of Textual - dsflow/ui/: tabs, detail pane, live sanity-run panel, log viewer, modal dialogs, filter, themes, mouse support - tests/test_ui.py: headless UI tests through Textual's pilot - tools/vendor.py (refresh vendor/), tools/screenshots.py (README images) - README, CLAUDE.md, TODO and the feature doc updated for the new layout, the Python 3.8.1 floor and the vendoring rules Verified: 11 tests green on Python 3.12 and 3.8.20; the shipped file set runs under `python -I -S` on both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
199 lines
8.0 KiB
Markdown
199 lines
8.0 KiB
Markdown
# dsflow_tui
|
|
|
|
A terminal UI for the `dsflow` DesignSync check-in flow. Designers see their
|
|
changes and locks, fire a sanity regression that locks the files while it
|
|
runs, and check in or tag the result without typing `dssc`. Mouse and
|
|
keyboard both work.
|
|
|
|

|
|
|
|
**Self-contained.** The UI library ([Textual](https://textual.textualize.io/))
|
|
and everything it needs are vendored in `vendor/`. A plain checkout runs with
|
|
no pip, no virtualenv and no network, which is what the internal servers
|
|
allow.
|
|
|
|
**Needs:** Python 3.8.1 or newer, bash, and a UTF-8 terminal (xterm, VNC,
|
|
SSH from any modern terminal). `status` and the sanity runner work without
|
|
Textual, so they also run on older Python.
|
|
|
|
## Install
|
|
|
|
Clone or copy the whole repository somewhere on the shared filesystem, then
|
|
run the launcher from a workspace root. A symlink on your `PATH` works too:
|
|
|
|
```bash
|
|
git clone [email protected]:lucio/dssc.git /proj/tools/dsflow_tui
|
|
ln -s /proj/tools/dsflow_tui/dsflow_tui.py ~/bin/dsflow_tui
|
|
```
|
|
|
|
## Try it (demo)
|
|
|
|
The demo builds a sandbox workspace driven by a fake `dssc`, so you can try
|
|
every action without a DesignSync vault:
|
|
|
|
```bash
|
|
./dsflow_tui.py --demo --demo-reset
|
|
```
|
|
|
|
It has modified, stale, new, hot and locked-by-someone-else files. Useful
|
|
knobs, all environment variables:
|
|
|
|
```bash
|
|
DEMO_FAIL=jaguar_1x1 ./dsflow_tui.py --demo # make one config fail
|
|
DEMO_STEP_SECS=0.2 ./dsflow_tui.py --demo # faster fake sanity
|
|
```
|
|
|
|
`--demo-reset` rebuilds the sandbox from scratch; without it the sandbox
|
|
keeps its state between runs. `--demo-dir DIR` puts it somewhere else.
|
|
|
|
## Usage
|
|
|
|
Run from the workspace root, the same place you run `dsflow`:
|
|
|
|
```bash
|
|
dsflow_tui.py # interactive TUI
|
|
dsflow_tui.py status # progress of the current sanity run, then exit
|
|
dsflow_tui.py status --json # the same, for scripts
|
|
dsflow_tui.py --sanity-cmd 'sim/regress.sh --cfg {cfg}'
|
|
```
|
|
|
|
| Option | Meaning |
|
|
|---|---|
|
|
| `--ws DIR` | workspace root (default: current directory) |
|
|
| `--conf FILE` | `dsflow.conf` (default: `$DSFLOW_CONF`, else `<ws>/flow/dsflow.conf`) |
|
|
| `--sanity-cmd CMD` | external sanity command; `{cfg}` and `{ws}` are substituted |
|
|
| `--tags T1,T2` | tags offered for batch tagging (default: `DSFLOW_TAGS`) |
|
|
| `--theme NAME` | colour theme (default `tokyo-night`; `ctrl+p` in the app switches live) |
|
|
| `--auto-refresh SEC` | re-query DesignSync every SEC seconds (default: only on `r` and after actions) |
|
|
|
|
### Tabs
|
|
|
|
1. **Changes**: locally modified and newly added files, with base/latest
|
|
version, lock holder and flags (`HOT`, `STALE`, `IN-RUN`, `MISSING`). The
|
|
pane on the right shows everything about the highlighted file.
|
|
2. **Locks**: your locks, plus every hot file and who holds it.
|
|
3. **Checked-out**: writable copies you have not locked.
|
|
4. **Sanity run**: each step of the current or last run, progress bars and a
|
|
live log tail.
|
|
5. **Logs**: full sanity logs per config, the runner log, and this session's
|
|
activity.
|
|
|
|
### Keys
|
|
|
|
The footer shows the keys that apply to the current tab; `?` lists them all.
|
|
|
|
| Key | Action |
|
|
|---|---|
|
|
| `space` / `enter` | mark or unmark the highlighted file. With nothing marked, actions use the highlighted row. |
|
|
| `a` / `esc` | mark everything in the tab / clear marks |
|
|
| `/` | filter the file tables by path |
|
|
| `s` | run sanity on the marked changes |
|
|
| `c` | check in marked files that a passing run already covers |
|
|
| `t` | batch-tag the marked files with a tag from `DSFLOW_TAGS` |
|
|
| `l` / `u` | lock / release a lock |
|
|
| `n` | register brand-new files for check-in (same as `dsflow add`) |
|
|
| `m` | rebase stale files onto `Trunk:Latest` (same as `dsflow rebase`) |
|
|
| `x` | cancel the running sanity, or clean up after a lost runner |
|
|
| `1`-`5` | switch tabs (or click them) |
|
|
| `r` / `?` / `q` | refresh / help / quit |
|
|
| `ctrl+p` | command palette: themes, keys, screenshot |
|
|
|
|
With the mouse: click a tab to switch, click a row to see its details, click
|
|
the ○ column to mark it, and click buttons in dialogs.
|
|
|
|
## How a sanity run works
|
|
|
|
`s` opens the run dialog. Type a comment and press enter to go with the
|
|
defaults, or pick the configs, what to do on pass (check in, or unlock only)
|
|
and an optional tag.
|
|
|
|

|
|
|
|
The TUI then starts a detached runner:
|
|
|
|
1. check the files are not stale on Trunk and not locked by someone else
|
|
2. lock them (files you already held are left as they are)
|
|
3. refresh unmodified files to `Trunk:Latest` (optional)
|
|
4. run sanity on every config, one after another, stopping at the first failure
|
|
5. on pass: confirm the files did not change during the run, check in, tag;
|
|
or just stop there in unlock-only mode
|
|
6. release every lock the run took, whatever happened
|
|
|
|

|
|
|
|
The runner does not depend on the TUI. Quit, lose the SSH session, reopen
|
|
later: the run carries on and `status` shows where it is. If the runner
|
|
itself dies, the TUI notices after 60 s without a heartbeat and `x` stops the
|
|
leftover simulation and releases the locks.
|
|
|
|
A later `c` checks in only if a passing run on all configs covers exactly
|
|
the current file contents and is younger than `MAX_STAMP_AGE`.
|
|
|
|
Sanity runs on the whole workspace. If you mark only some of your changed
|
|
files, the unmarked ones are tested too but not checked in; the run dialog
|
|
warns about this.
|
|
|
|
## Configuration
|
|
|
|
Everything comes from `dsflow.conf`, the file the bash `dsflow` already uses.
|
|
Optional additions:
|
|
|
|
```bash
|
|
DSFLOW_TAGS="wmac_working wmac_rx_drop" # tags offered by batch tag
|
|
SANITY_SCRIPT='$WS_ROOT/sim/run_sanity.sh {cfg}' # instead of run_sanity()
|
|
```
|
|
|
|
All DesignSync access goes through `ds_*` helpers. The TUI adds defaults for
|
|
the ones `dsflow.conf` does not define; **verify these against your `dssc`
|
|
version before rollout** and override any of them in `dsflow.conf`:
|
|
|
|
| Helper | Default | Check |
|
|
|---|---|---|
|
|
| `ds_lock` | `dssc lock` | must take the vault lock without touching the local copy |
|
|
| `ds_list_managed` | `dssc ls -rec -report N .` | one workspace-relative path per line |
|
|
| `ds_list_writable` | managed files that are writable, plus their holder | assumes files are fetched read-only unless checked out |
|
|
| `ds_tag` | `dssc tag -replace` | moves an existing tag |
|
|
| `ds_checkin`, `ds_checkin_new` | `dssc ci`, `dssc ci -new` | whether `ci` releases the lock |
|
|
| `ds_refresh`, `ds_rebase` | `dssc pop` as in `dsflow` | |
|
|
|
|
## Files it writes
|
|
|
|
In `<ws>/.dsflow/`, next to the bash `dsflow` state it shares (`new_files`,
|
|
`sanity.stamp`):
|
|
|
|
| File | Contents |
|
|
|---|---|
|
|
| `tui_job.json` | state of the current or last run |
|
|
| `tui_runner.log` | what the runner did, step by step |
|
|
| `sanity_<cfg>.log` | sanity output per config |
|
|
| `tui_history.json` | last passing duration per config, for progress estimates |
|
|
|
|
A run that covered all your changes on all configs also writes a
|
|
`sanity.stamp` that `dsflow checkin` accepts.
|
|
|
|
## Repository layout
|
|
|
|
| Path | What |
|
|
|---|---|
|
|
| `dsflow_tui.py` | launcher: puts `vendor/` on `sys.path`, then runs `dsflow.cli` |
|
|
| `dsflow/` | the tool: `flow` (dsflow.conf calls), `runner`, `ops` (action rules), `cli`, `demo` |
|
|
| `dsflow/ui/` | the Textual front end: `app`, `widgets`, `dialogs`, `styles.tcss` |
|
|
| `vendor/` | pinned pure-Python dependencies; see `vendor/requirements.txt` |
|
|
| `tests/` | runner tests and headless UI tests, both against the demo sandbox |
|
|
| `tools/` | `guard.py` (test guard), `vendor.py` (refresh `vendor/`), `screenshots.py` |
|
|
| `files.zip` | the original `dsflow` plan scripts this tool builds on |
|
|
|
|
## Development
|
|
|
|
```bash
|
|
tools/guard.py -- python3 -m unittest discover -s tests -v
|
|
```
|
|
|
|
The runner tests run the sanity flow end to end; the UI tests drive the app
|
|
headlessly with Textual's pilot. Both use the demo sandbox. See `CLAUDE.md`
|
|
for the rules and the dev loop.
|
|
|
|
To update the vendored packages, edit the pins in `vendor/requirements.txt`
|
|
and run `tools/vendor.py` on a machine with internet. It fetches wheels for
|
|
Python 3.8 and refuses anything that is not pure Python. Commit the result.
|