keel-visual 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .coverage
4
+ .ruff_cache/
5
+ dist/
6
+ build/
7
+ *.egg-info/
@@ -0,0 +1,186 @@
1
+ Metadata-Version: 2.4
2
+ Name: keel-visual
3
+ Version: 0.1.0
4
+ Summary: Optional animated 2D/3D run visualizer for keel core
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: keel-workflow>=1.3.0
7
+ Description-Content-Type: text/markdown
8
+
9
+ # keel-visual
10
+
11
+ An **optional** animated run visualizer for [keel](../README.md). It *renders* a
12
+ keel run — it never drives one. keel-visual depends on keel core; core never
13
+ depends on keel-visual, so installing it is purely additive.
14
+
15
+ > Think of it as `keel`'s window: the same ship_run records keel already writes,
16
+ > shown as a "where are we" animation — in your terminal or as a web page.
17
+
18
+ ## Two surfaces, one source of truth
19
+
20
+ Both outputs are fed by a single **pure** adapter,
21
+ `runstate.build_run_state(record, …)`, which projects a keel run onto its
22
+ **command flow** — the canonical phase list each command has in keel core
23
+ (`keel.flows.flow_for`). No parallel data model, no second source of truth.
24
+
25
+ ## Every command, not just ship
26
+
27
+ `--command` accepts **all 16 keel commands** (ci-check, coverage, deps-audit,
28
+ flake-audit, implement, morning, overnight, pr-loop, regression, review-all-day,
29
+ review-cycle, ship, stale-prs, triage, work-block, wrap). Each renders its own
30
+ flow — e.g. `overnight` shows `config → preflight → queue → work-block loop →
31
+ report`; `triage` shows `find → tier → classify → rank → apply → summary`.
32
+
33
+ `ship` is the full s0–s12 backbone with live merge/test-gate and regression
34
+ detail. The other commands render their phase structure (animatable via
35
+ `--step`/`play`); live `--follow`/`dash` position stays accurate for the
36
+ checkpoint-writing commands (ship / work-block / overnight).
37
+
38
+ ### Parallel runs — `keel-visual dash`
39
+
40
+ Running 2-3 `keel ship` (or other) commands at once? Each runs in its own git
41
+ worktree with its own `.keel/state/`, so `dash` discovers them all via
42
+ `git worktree list` and shows one live board:
43
+
44
+ ```
45
+ keel-visual dash .keel/project.yaml # live board of every active run
46
+ keel-visual dash .keel/project.yaml --once # one snapshot
47
+ ```
48
+
49
+ ```
50
+ keel · 3 active runs
51
+ #351 ████████░░░░ s8 test gate
52
+ #352 ██████████░░ s10 merge gate
53
+ #360 ████████████ s12 close merged
54
+ ```
55
+
56
+ A worktree with no live checkpoint is skipped; all per-run reads are fail-soft so
57
+ one bad run never blanks the board. See
58
+ [`screenshots/dash-board.png`](screenshots/dash-board.png).
59
+
60
+ ### 1. Terminal — `keel-visual play` (runs in the CLI)
61
+
62
+ The flow animates right in the terminal while a command runs:
63
+
64
+ ```
65
+ keel-visual play .keel/project.yaml --pr 361 # animate the run once
66
+ keel-visual play .keel/project.yaml --pr 361 --loop # replay continuously (demo / wall display)
67
+ keel-visual play .keel/project.yaml --follow # LIVE: show where the run is right now
68
+ keel-visual play .keel/project.yaml --pr 361 --style wave # sine "ribbon" with a light trail
69
+ keel-visual play .keel/project.yaml --pr 361 --step 8 # a single frame (e.g. the test gate)
70
+ ```
71
+
72
+ - `flow` — a pipeline of `s0…s12` with a playhead, gate colours (amber gate,
73
+ red when blocked), a regression bar, and a "where are we" pointer.
74
+ - `wave` — the run drawn on a sine ribbon with a light trail up to the active
75
+ step (the terminal's take on the 3D `line` style).
76
+ - **`--follow`** — live mode: every `--interval` seconds it re-reads the run's
77
+ ledger + checkpoint (`position.current_step` *and* the `state` block, so merge
78
+ progress shows live — pending / merged / failed — not just position) and
79
+ redraws where the run *actually* is now. Point it at a running keel command and
80
+ watch the playhead move in real time. Ctrl-C to stop.
81
+ - **`--loop`** — replay the animation continuously (demo / always-on display).
82
+
83
+ `render` and `play` both pick up the live checkpoint automatically when you
84
+ don't pass `--checkpoint-step`. Colour is `--color auto` (only on a tty),
85
+ `always`, or `never`. See
86
+ [`screenshots/keel-visual-play.gif`](screenshots/keel-visual-play.gif) for the
87
+ animation in motion.
88
+
89
+ ### 2. Web — `keel-visual render` (the alternative)
90
+
91
+ The same run as a single self-contained HTML page with a **2D flow** view and a
92
+ **3D scene** (Three.js): the light runs to where the run is, gates glow, the
93
+ cross-vendor jury orbits the review step, and reaching merge turns everything
94
+ green.
95
+
96
+ ```
97
+ keel-visual render .keel/project.yaml --pr 361 --out keel-run.html
98
+ open keel-run.html
99
+ ```
100
+
101
+ The page reads its run-state from `window.KEEL_RUN`, and honours
102
+ `?mode=2d|3d`, `?step=N`, `?play=1`, and `?s3d=<style>` URL params.
103
+
104
+ #### Selectable 3D styles
105
+
106
+ The 3D view offers a **style selector** (top-left of the scene). All styles share
107
+ one run-semantics layer — progress colours, the s7 jury, the light running to the
108
+ head, merged→green — and differ only in how the run is drawn:
109
+
110
+ | style | look | how it reads the run |
111
+ | --- | --- | --- |
112
+ | `plexus` *(default)* | an interweaving web of drifting points + fading links | the web breathes; nodes track each step, colours follow progress |
113
+ | `comet` | three interweaving particle streams with fading tails | streams flow to the running head, then dissolve |
114
+ | `aurora` | interweaving translucent ribbons with a soft fade | a wash that fades past the head |
115
+ | `combined` | the `plexus` web **and** the `comet` streams together | the richest variant |
116
+ | `line` | the original flowing-light ribbon | a single tube; the light runs along it |
117
+
118
+ **Configure the style two ways:**
119
+
120
+ - **In the page** — click `plexus · comet · aurora · combo · line` in the
121
+ selector at the top-left of the 3D scene.
122
+ - **By URL** — append `?mode=3d&s3d=<style>` (e.g.
123
+ `keel-run.html?mode=3d&s3d=combined`). Unknown values fall back to `plexus`.
124
+ This is also how the screenshot harness pins a style.
125
+
126
+ Every style honours the same [colour language](#colour-language); switching
127
+ styles never changes what a colour means, only the geometry it is painted on.
128
+
129
+ ## Colour language
130
+
131
+ | colour | meaning |
132
+ | --- | --- |
133
+ | green | step done · gate passed · merged (run is green) |
134
+ | cyan | the active step (where the run is) |
135
+ | amber | a gate being evaluated · regression `major` |
136
+ | yellow | regression `minor` finding |
137
+ | red | a blocked gate · regression `critical` finding |
138
+ | dim | a step the run has not reached yet |
139
+
140
+ ## Install
141
+
142
+ keel-visual needs **keel core ≥ 1.3.0** (it reads `keel.flows`, the ledger, and
143
+ the checkpoint). Until both packages are published to PyPI, install from this
144
+ repo — installing the repo's core first guarantees a matching version:
145
+
146
+ ```
147
+ # from the repo root
148
+ pip install ./ # keel-workflow (core), ≥ 1.3.0
149
+ pip install ./keel-visual # keel-visual
150
+ keel-visual --help
151
+ ```
152
+
153
+ Editable (development):
154
+
155
+ ```
156
+ pip install -e ./ -e ./keel-visual
157
+ ```
158
+
159
+ Once both are on PyPI, this becomes a one-liner:
160
+
161
+ ```
162
+ pipx install keel-visual # pulls in keel-workflow (core) automatically
163
+ ```
164
+
165
+ See [`RELEASING.md`](RELEASING.md) for building and publishing keel-visual.
166
+
167
+ ## Develop
168
+
169
+ ```
170
+ python -m pytest # or: python -m unittest discover -s tests -t .
171
+ python -m coverage run --branch --source=keel_visual -m unittest discover -s tests -t .
172
+ python -m coverage report --fail-under=100 --omit="*/templates/*"
173
+ ruff check src/keel_visual tests
174
+ ```
175
+
176
+ The Python core (`runstate`, `render`, `terminal`, the CLI's pure paths) is held
177
+ to **100% line + branch coverage**, matching keel core's bar. The HTML/JS
178
+ template is excluded from coverage (it is exercised by the screenshot harness).
179
+
180
+ ## Screenshots
181
+
182
+ See [`screenshots/`](screenshots/): `terminal-cli.png` (the `play` output),
183
+ `2d-s8-test.png` (a blocked test gate), `3d-s6-run.png` (the default `plexus` 3D
184
+ style mid-run), `3d-styles.png` (the `combined` style with the style selector and
185
+ the s7 jury), `3d-s10-merge.png` (the `line` style, merged and all-green), and
186
+ `2d-s12-merged.png` (a merged, all-green 2D run).
@@ -0,0 +1,178 @@
1
+ # keel-visual
2
+
3
+ An **optional** animated run visualizer for [keel](../README.md). It *renders* a
4
+ keel run — it never drives one. keel-visual depends on keel core; core never
5
+ depends on keel-visual, so installing it is purely additive.
6
+
7
+ > Think of it as `keel`'s window: the same ship_run records keel already writes,
8
+ > shown as a "where are we" animation — in your terminal or as a web page.
9
+
10
+ ## Two surfaces, one source of truth
11
+
12
+ Both outputs are fed by a single **pure** adapter,
13
+ `runstate.build_run_state(record, …)`, which projects a keel run onto its
14
+ **command flow** — the canonical phase list each command has in keel core
15
+ (`keel.flows.flow_for`). No parallel data model, no second source of truth.
16
+
17
+ ## Every command, not just ship
18
+
19
+ `--command` accepts **all 16 keel commands** (ci-check, coverage, deps-audit,
20
+ flake-audit, implement, morning, overnight, pr-loop, regression, review-all-day,
21
+ review-cycle, ship, stale-prs, triage, work-block, wrap). Each renders its own
22
+ flow — e.g. `overnight` shows `config → preflight → queue → work-block loop →
23
+ report`; `triage` shows `find → tier → classify → rank → apply → summary`.
24
+
25
+ `ship` is the full s0–s12 backbone with live merge/test-gate and regression
26
+ detail. The other commands render their phase structure (animatable via
27
+ `--step`/`play`); live `--follow`/`dash` position stays accurate for the
28
+ checkpoint-writing commands (ship / work-block / overnight).
29
+
30
+ ### Parallel runs — `keel-visual dash`
31
+
32
+ Running 2-3 `keel ship` (or other) commands at once? Each runs in its own git
33
+ worktree with its own `.keel/state/`, so `dash` discovers them all via
34
+ `git worktree list` and shows one live board:
35
+
36
+ ```
37
+ keel-visual dash .keel/project.yaml # live board of every active run
38
+ keel-visual dash .keel/project.yaml --once # one snapshot
39
+ ```
40
+
41
+ ```
42
+ keel · 3 active runs
43
+ #351 ████████░░░░ s8 test gate
44
+ #352 ██████████░░ s10 merge gate
45
+ #360 ████████████ s12 close merged
46
+ ```
47
+
48
+ A worktree with no live checkpoint is skipped; all per-run reads are fail-soft so
49
+ one bad run never blanks the board. See
50
+ [`screenshots/dash-board.png`](screenshots/dash-board.png).
51
+
52
+ ### 1. Terminal — `keel-visual play` (runs in the CLI)
53
+
54
+ The flow animates right in the terminal while a command runs:
55
+
56
+ ```
57
+ keel-visual play .keel/project.yaml --pr 361 # animate the run once
58
+ keel-visual play .keel/project.yaml --pr 361 --loop # replay continuously (demo / wall display)
59
+ keel-visual play .keel/project.yaml --follow # LIVE: show where the run is right now
60
+ keel-visual play .keel/project.yaml --pr 361 --style wave # sine "ribbon" with a light trail
61
+ keel-visual play .keel/project.yaml --pr 361 --step 8 # a single frame (e.g. the test gate)
62
+ ```
63
+
64
+ - `flow` — a pipeline of `s0…s12` with a playhead, gate colours (amber gate,
65
+ red when blocked), a regression bar, and a "where are we" pointer.
66
+ - `wave` — the run drawn on a sine ribbon with a light trail up to the active
67
+ step (the terminal's take on the 3D `line` style).
68
+ - **`--follow`** — live mode: every `--interval` seconds it re-reads the run's
69
+ ledger + checkpoint (`position.current_step` *and* the `state` block, so merge
70
+ progress shows live — pending / merged / failed — not just position) and
71
+ redraws where the run *actually* is now. Point it at a running keel command and
72
+ watch the playhead move in real time. Ctrl-C to stop.
73
+ - **`--loop`** — replay the animation continuously (demo / always-on display).
74
+
75
+ `render` and `play` both pick up the live checkpoint automatically when you
76
+ don't pass `--checkpoint-step`. Colour is `--color auto` (only on a tty),
77
+ `always`, or `never`. See
78
+ [`screenshots/keel-visual-play.gif`](screenshots/keel-visual-play.gif) for the
79
+ animation in motion.
80
+
81
+ ### 2. Web — `keel-visual render` (the alternative)
82
+
83
+ The same run as a single self-contained HTML page with a **2D flow** view and a
84
+ **3D scene** (Three.js): the light runs to where the run is, gates glow, the
85
+ cross-vendor jury orbits the review step, and reaching merge turns everything
86
+ green.
87
+
88
+ ```
89
+ keel-visual render .keel/project.yaml --pr 361 --out keel-run.html
90
+ open keel-run.html
91
+ ```
92
+
93
+ The page reads its run-state from `window.KEEL_RUN`, and honours
94
+ `?mode=2d|3d`, `?step=N`, `?play=1`, and `?s3d=<style>` URL params.
95
+
96
+ #### Selectable 3D styles
97
+
98
+ The 3D view offers a **style selector** (top-left of the scene). All styles share
99
+ one run-semantics layer — progress colours, the s7 jury, the light running to the
100
+ head, merged→green — and differ only in how the run is drawn:
101
+
102
+ | style | look | how it reads the run |
103
+ | --- | --- | --- |
104
+ | `plexus` *(default)* | an interweaving web of drifting points + fading links | the web breathes; nodes track each step, colours follow progress |
105
+ | `comet` | three interweaving particle streams with fading tails | streams flow to the running head, then dissolve |
106
+ | `aurora` | interweaving translucent ribbons with a soft fade | a wash that fades past the head |
107
+ | `combined` | the `plexus` web **and** the `comet` streams together | the richest variant |
108
+ | `line` | the original flowing-light ribbon | a single tube; the light runs along it |
109
+
110
+ **Configure the style two ways:**
111
+
112
+ - **In the page** — click `plexus · comet · aurora · combo · line` in the
113
+ selector at the top-left of the 3D scene.
114
+ - **By URL** — append `?mode=3d&s3d=<style>` (e.g.
115
+ `keel-run.html?mode=3d&s3d=combined`). Unknown values fall back to `plexus`.
116
+ This is also how the screenshot harness pins a style.
117
+
118
+ Every style honours the same [colour language](#colour-language); switching
119
+ styles never changes what a colour means, only the geometry it is painted on.
120
+
121
+ ## Colour language
122
+
123
+ | colour | meaning |
124
+ | --- | --- |
125
+ | green | step done · gate passed · merged (run is green) |
126
+ | cyan | the active step (where the run is) |
127
+ | amber | a gate being evaluated · regression `major` |
128
+ | yellow | regression `minor` finding |
129
+ | red | a blocked gate · regression `critical` finding |
130
+ | dim | a step the run has not reached yet |
131
+
132
+ ## Install
133
+
134
+ keel-visual needs **keel core ≥ 1.3.0** (it reads `keel.flows`, the ledger, and
135
+ the checkpoint). Until both packages are published to PyPI, install from this
136
+ repo — installing the repo's core first guarantees a matching version:
137
+
138
+ ```
139
+ # from the repo root
140
+ pip install ./ # keel-workflow (core), ≥ 1.3.0
141
+ pip install ./keel-visual # keel-visual
142
+ keel-visual --help
143
+ ```
144
+
145
+ Editable (development):
146
+
147
+ ```
148
+ pip install -e ./ -e ./keel-visual
149
+ ```
150
+
151
+ Once both are on PyPI, this becomes a one-liner:
152
+
153
+ ```
154
+ pipx install keel-visual # pulls in keel-workflow (core) automatically
155
+ ```
156
+
157
+ See [`RELEASING.md`](RELEASING.md) for building and publishing keel-visual.
158
+
159
+ ## Develop
160
+
161
+ ```
162
+ python -m pytest # or: python -m unittest discover -s tests -t .
163
+ python -m coverage run --branch --source=keel_visual -m unittest discover -s tests -t .
164
+ python -m coverage report --fail-under=100 --omit="*/templates/*"
165
+ ruff check src/keel_visual tests
166
+ ```
167
+
168
+ The Python core (`runstate`, `render`, `terminal`, the CLI's pure paths) is held
169
+ to **100% line + branch coverage**, matching keel core's bar. The HTML/JS
170
+ template is excluded from coverage (it is exercised by the screenshot harness).
171
+
172
+ ## Screenshots
173
+
174
+ See [`screenshots/`](screenshots/): `terminal-cli.png` (the `play` output),
175
+ `2d-s8-test.png` (a blocked test gate), `3d-s6-run.png` (the default `plexus` 3D
176
+ style mid-run), `3d-styles.png` (the `combined` style with the style selector and
177
+ the s7 jury), `3d-s10-merge.png` (the `line` style, merged and all-green), and
178
+ `2d-s12-merged.png` (a merged, all-green 2D run).
@@ -0,0 +1,97 @@
1
+ # Releasing keel-visual
2
+
3
+ keel-visual is a separate distribution from keel core (`keel-workflow`). It
4
+ depends on `keel-workflow >= 1.3.0`, so **release a matching core first**.
5
+
6
+ ## Recommended: automated trusted publishing (tag → CI)
7
+
8
+ The [`publish-visual.yml`](../.github/workflows/publish-visual.yml) workflow builds
9
+ and publishes keel-visual on a `keel-visual-v*` tag, using **OIDC trusted
10
+ publishing** — no API token in CI. It mirrors the core's `publish.yml` posture:
11
+ hash-locked build tools, a template-presence check, build-provenance attestation,
12
+ SBOM + checksums, and a GitHub Release.
13
+
14
+ **One-time PyPI setup (operator):**
15
+
16
+ 1. Create the `keel-visual` project on PyPI (and TestPyPI for rehearsals).
17
+ 2. Add a **trusted publisher** to it:
18
+ - Owner: `berkayturanci`, Repository: `keel`
19
+ - Workflow filename: `publish-visual.yml`
20
+ - Environment: leave blank (none configured)
21
+ 3. (Optional) Rehearse against TestPyPI: run the workflow via **workflow_dispatch**
22
+ (it publishes to TestPyPI on manual runs).
23
+
24
+ **Each release (operator):**
25
+
26
+ 1. Bump `keel-visual/pyproject.toml` `[project] version` and merge through the
27
+ normal flow.
28
+ 2. Ensure the matching core (`keel-workflow >= 1.3.0`) is already on PyPI.
29
+ 3. Tag and push:
30
+
31
+ ```
32
+ git tag keel-visual-v0.1.0 && git push origin keel-visual-v0.1.0
33
+ ```
34
+
35
+ CI builds, attests, publishes to PyPI via OIDC, and cuts the GitHub Release.
36
+
37
+ The manual build/upload below is the **fallback** (e.g. before trusted publishing
38
+ is configured).
39
+
40
+ ---
41
+
42
+ ## Manual fallback
43
+
44
+ ### Prerequisites
45
+
46
+ - keel core `1.3.0` (or newer) is published to PyPI, so `pip install keel-visual`
47
+ can resolve its dependency.
48
+ - A PyPI account with upload rights and an API token. **The upload step requires
49
+ your credentials — run it yourself; never paste a token into automation you
50
+ do not control.**
51
+
52
+ ### 1. Bump the version
53
+
54
+ Edit `keel-visual/pyproject.toml` → `[project] version`. Update this repo's
55
+ `CHANGELOG.md` companion note if the surface changed. Commit on a branch and
56
+ merge through the normal flow.
57
+
58
+ ### 2. Build the distributions
59
+
60
+ From `keel-visual/`:
61
+
62
+ ```
63
+ python -m pip install --upgrade build twine
64
+ python -m build # writes dist/keel_visual-<version>-py3-none-any.whl + .tar.gz
65
+ python -m twine check dist/*
66
+ ```
67
+
68
+ `build` uses the `hatchling` backend declared in `pyproject.toml`; the
69
+ `force-include` there ships the HTML template (`runviz.html`) inside the wheel.
70
+ Verify it is present:
71
+
72
+ ```
73
+ python -c "import zipfile,glob; w=glob.glob('dist/*.whl')[0]; \
74
+ print('template:', 'keel_visual/templates/runviz.html' in zipfile.ZipFile(w).namelist())"
75
+ ```
76
+
77
+ ### 3. Smoke-test the wheel in a clean venv
78
+
79
+ ```
80
+ python -m venv /tmp/kv-rel && /tmp/kv-rel/bin/pip install dist/*.whl
81
+ /tmp/kv-rel/bin/keel-visual --help
82
+ ```
83
+
84
+ (If core is not yet on PyPI, install it from source into the same venv first.)
85
+
86
+ ### 4. Upload (operator-run)
87
+
88
+ ```
89
+ python -m twine upload dist/* # prompts for your PyPI token
90
+ ```
91
+
92
+ Use TestPyPI first if you want a dry run: `twine upload --repository testpypi dist/*`.
93
+
94
+ ### 5. Tag
95
+
96
+ Tag the release (e.g. `keel-visual-v0.1.0`) so the published artifact is
97
+ traceable to the commit.
@@ -0,0 +1,36 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "keel-visual"
7
+ version = "0.1.0"
8
+ description = "Optional animated 2D/3D run visualizer for keel core"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ dependencies = ["keel-workflow>=1.3.0"]
12
+
13
+ [project.scripts]
14
+ keel-visual = "keel_visual.cli:main"
15
+
16
+ [tool.hatch.build.targets.wheel]
17
+ packages = ["src/keel_visual"]
18
+
19
+ [tool.hatch.build.targets.wheel.force-include]
20
+ "src/keel_visual/templates/runviz.html" = "keel_visual/templates/runviz.html"
21
+
22
+ [tool.coverage.run]
23
+ branch = true
24
+ source = ["keel_visual"]
25
+ omit = ["*/templates/*"]
26
+
27
+ [tool.coverage.report]
28
+ fail_under = 100
29
+ show_missing = true
30
+ exclude_lines = ["if __name__ == .__main__.:", "raise SystemExit"]
31
+
32
+ [tool.ruff]
33
+ line-length = 100
34
+
35
+ [tool.ruff.lint]
36
+ select = ["E", "F", "I", "W", "UP", "B"]
@@ -0,0 +1,8 @@
1
+ """keel-visual — optional animated 2D/3D run visualizer for keel core.
2
+
3
+ A companion package: it *renders* a keel run, it never drives one. Depends on
4
+ keel core (reads its ledger records and the fixed backbone); core never depends
5
+ on this.
6
+ """
7
+
8
+ __version__ = "0.1.0"