term-chameleon 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.
- term_chameleon-0.1.0/.github/workflows/ci.yml +32 -0
- term_chameleon-0.1.0/.github/workflows/publish.yml +31 -0
- term_chameleon-0.1.0/.gitignore +9 -0
- term_chameleon-0.1.0/CHANGELOG.md +128 -0
- term_chameleon-0.1.0/LICENSE +21 -0
- term_chameleon-0.1.0/PKG-INFO +289 -0
- term_chameleon-0.1.0/README.md +261 -0
- term_chameleon-0.1.0/docs/implementation-plan.md +148 -0
- term_chameleon-0.1.0/docs/product-spec.md +126 -0
- term_chameleon-0.1.0/docs/research/iterm2-integration.md +79 -0
- term_chameleon-0.1.0/docs/research/prior-art.md +59 -0
- term_chameleon-0.1.0/docs/research/terminal-osc-compatibility.md +87 -0
- term_chameleon-0.1.0/docs/testing-strategy.md +105 -0
- term_chameleon-0.1.0/pyproject.toml +52 -0
- term_chameleon-0.1.0/scripts/live-iterm-smoke.sh +25 -0
- term_chameleon-0.1.0/src/term_chameleon/__init__.py +3 -0
- term_chameleon-0.1.0/src/term_chameleon/adapt.py +111 -0
- term_chameleon-0.1.0/src/term_chameleon/background_html.py +95 -0
- term_chameleon-0.1.0/src/term_chameleon/cli.py +1488 -0
- term_chameleon-0.1.0/src/term_chameleon/color.py +67 -0
- term_chameleon-0.1.0/src/term_chameleon/config.py +345 -0
- term_chameleon-0.1.0/src/term_chameleon/contrast.py +18 -0
- term_chameleon-0.1.0/src/term_chameleon/deterministic_check.py +188 -0
- term_chameleon-0.1.0/src/term_chameleon/diagnostics.py +188 -0
- term_chameleon-0.1.0/src/term_chameleon/e2e_stage.py +88 -0
- term_chameleon-0.1.0/src/term_chameleon/fixes.py +96 -0
- term_chameleon-0.1.0/src/term_chameleon/images.py +204 -0
- term_chameleon-0.1.0/src/term_chameleon/install.py +110 -0
- term_chameleon-0.1.0/src/term_chameleon/iterm_api.py +135 -0
- term_chameleon-0.1.0/src/term_chameleon/iterm_connection.py +31 -0
- term_chameleon-0.1.0/src/term_chameleon/iterm_profile.py +102 -0
- term_chameleon-0.1.0/src/term_chameleon/iterm_window.py +115 -0
- term_chameleon-0.1.0/src/term_chameleon/live_iterm.py +73 -0
- term_chameleon-0.1.0/src/term_chameleon/live_stage.py +264 -0
- term_chameleon-0.1.0/src/term_chameleon/modes.py +54 -0
- term_chameleon-0.1.0/src/term_chameleon/osc.py +72 -0
- term_chameleon-0.1.0/src/term_chameleon/pixel_contrast.py +124 -0
- term_chameleon-0.1.0/src/term_chameleon/png.py +141 -0
- term_chameleon-0.1.0/src/term_chameleon/presets.py +183 -0
- term_chameleon-0.1.0/src/term_chameleon/release_check.py +280 -0
- term_chameleon-0.1.0/src/term_chameleon/safe_io.py +44 -0
- term_chameleon-0.1.0/src/term_chameleon/screenshot.py +54 -0
- term_chameleon-0.1.0/src/term_chameleon/screenshot_test.py +204 -0
- term_chameleon-0.1.0/src/term_chameleon/setup.py +99 -0
- term_chameleon-0.1.0/src/term_chameleon/status.py +190 -0
- term_chameleon-0.1.0/src/term_chameleon/terminal.py +83 -0
- term_chameleon-0.1.0/src/term_chameleon/terminal_pattern.py +36 -0
- term_chameleon-0.1.0/src/term_chameleon/text_contrast.py +285 -0
- term_chameleon-0.1.0/src/term_chameleon/visual.py +118 -0
- term_chameleon-0.1.0/src/term_chameleon/watch.py +108 -0
- term_chameleon-0.1.0/src/term_chameleon/watch_daemon.py +232 -0
- term_chameleon-0.1.0/src/term_chameleon/watch_live.py +225 -0
- term_chameleon-0.1.0/tests/fixtures/iterm/bad-ansi-black.json +224 -0
- term_chameleon-0.1.0/tests/fixtures/iterm/bad-light-variant.json +224 -0
- term_chameleon-0.1.0/tests/fixtures/iterm/good-dark-glass.json +224 -0
- term_chameleon-0.1.0/tests/test_adapt.py +86 -0
- term_chameleon-0.1.0/tests/test_background_html.py +29 -0
- term_chameleon-0.1.0/tests/test_cli.py +55 -0
- term_chameleon-0.1.0/tests/test_color.py +18 -0
- term_chameleon-0.1.0/tests/test_config.py +314 -0
- term_chameleon-0.1.0/tests/test_deterministic_check.py +52 -0
- term_chameleon-0.1.0/tests/test_diagnostics.py +45 -0
- term_chameleon-0.1.0/tests/test_e2e_stage.py +41 -0
- term_chameleon-0.1.0/tests/test_images.py +113 -0
- term_chameleon-0.1.0/tests/test_install_visual.py +160 -0
- term_chameleon-0.1.0/tests/test_iterm_api.py +70 -0
- term_chameleon-0.1.0/tests/test_iterm_connection.py +20 -0
- term_chameleon-0.1.0/tests/test_iterm_window.py +76 -0
- term_chameleon-0.1.0/tests/test_live_stage.py +192 -0
- term_chameleon-0.1.0/tests/test_osc.py +71 -0
- term_chameleon-0.1.0/tests/test_pixel_contrast.py +70 -0
- term_chameleon-0.1.0/tests/test_png.py +44 -0
- term_chameleon-0.1.0/tests/test_release_check.py +129 -0
- term_chameleon-0.1.0/tests/test_safe_io.py +66 -0
- term_chameleon-0.1.0/tests/test_screenshot.py +56 -0
- term_chameleon-0.1.0/tests/test_screenshot_test.py +66 -0
- term_chameleon-0.1.0/tests/test_setup.py +95 -0
- term_chameleon-0.1.0/tests/test_status.py +121 -0
- term_chameleon-0.1.0/tests/test_terminal.py +61 -0
- term_chameleon-0.1.0/tests/test_terminal_pattern.py +33 -0
- term_chameleon-0.1.0/tests/test_text_contrast.py +112 -0
- term_chameleon-0.1.0/tests/test_watch.py +42 -0
- term_chameleon-0.1.0/tests/test_watch_daemon.py +217 -0
- term_chameleon-0.1.0/tests/test_watch_live.py +273 -0
- term_chameleon-0.1.0/tests/test_watch_live_cli.py +35 -0
- term_chameleon-0.1.0/uv.lock +289 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: astral-sh/setup-uv@v3
|
|
15
|
+
- run: uv sync --extra dev
|
|
16
|
+
- run: uv run --extra dev ruff check .
|
|
17
|
+
- run: uv run --extra dev ruff format --check .
|
|
18
|
+
|
|
19
|
+
test:
|
|
20
|
+
runs-on: ${{ matrix.os }}
|
|
21
|
+
strategy:
|
|
22
|
+
fail-fast: false
|
|
23
|
+
matrix:
|
|
24
|
+
os: [ubuntu-latest, macos-latest]
|
|
25
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
- uses: astral-sh/setup-uv@v3
|
|
29
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
30
|
+
run: uv python install ${{ matrix.python-version }}
|
|
31
|
+
- run: uv sync --extra dev
|
|
32
|
+
- run: uv run --extra dev pytest -q
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: astral-sh/setup-uv@v3
|
|
14
|
+
- run: uv build
|
|
15
|
+
- uses: actions/upload-artifact@v4
|
|
16
|
+
with:
|
|
17
|
+
name: dist
|
|
18
|
+
path: dist/
|
|
19
|
+
|
|
20
|
+
publish-pypi:
|
|
21
|
+
needs: build
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
environment: pypi
|
|
24
|
+
permissions:
|
|
25
|
+
id-token: write
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/download-artifact@v4
|
|
28
|
+
with:
|
|
29
|
+
name: dist
|
|
30
|
+
path: dist/
|
|
31
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 - 2026-06-27
|
|
4
|
+
|
|
5
|
+
### Stable release
|
|
6
|
+
|
|
7
|
+
- Promoted from beta to stable after sustained daemon dogfood (35+ hours at 0% CPU, bounded disk, no crashes).
|
|
8
|
+
- Removed dead code (`query_dynamic_color`, `supported_color_fields`).
|
|
9
|
+
- Replaced runtime `assert` with explicit `ConfigError` raises for daemon path resolution and region validation.
|
|
10
|
+
- Added `__all__` to package `__init__`.
|
|
11
|
+
- Added `help=` text to all key CLI arguments.
|
|
12
|
+
- Added README Troubleshooting section.
|
|
13
|
+
- Promoted classifier to `Development Status :: 5 - Production/Stable`.
|
|
14
|
+
|
|
15
|
+
## 0.1.0b4 - 2026-06-27
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- `sample` and `adapt-once` now validate `--iterm-window requires --screen` before attempting to contact iTerm2.
|
|
20
|
+
- Long-running watcher now prunes old screenshot artifacts to prevent unbounded disk growth (keeps the 200 most recent).
|
|
21
|
+
|
|
22
|
+
## 0.1.0b3 - 2026-06-25
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Reduced long-running watcher CPU usage by downsampling screenshots before luminance/variance analysis and raising the AutoLaunch daemon's default interval to 10 seconds.
|
|
27
|
+
|
|
28
|
+
### Verified
|
|
29
|
+
|
|
30
|
+
- Durable AutoLaunch watcher from the installed wheel stayed running with sample artifacts and live release gate after optimization.
|
|
31
|
+
|
|
32
|
+
## 0.1.0b2 - 2026-06-25
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- `watch-live` now treats live iTerm2 apply failures as recoverable watcher events instead of exiting the long-running daemon. This keeps AutoLaunch watchers alive when iTerm2 temporarily has no current session.
|
|
37
|
+
|
|
38
|
+
### Verified
|
|
39
|
+
|
|
40
|
+
- Durable local install under `~/.local/share/term-chameleon/venv`.
|
|
41
|
+
- Real iTerm2 AutoLaunch restart with default pid/log paths and sample artifacts.
|
|
42
|
+
|
|
43
|
+
## 0.1.0b1 - 2026-06-25
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- AutoLaunch-launched `watch-live --iterm-window` now waits briefly for iTerm2 to create a window instead of exiting immediately during app startup.
|
|
48
|
+
- `install-watch-daemon` now defaults to whole-screen sampling for startup robustness and exposes `--iterm-window` as an explicit opt-in.
|
|
49
|
+
- Promoted package metadata to beta after real AutoLaunch daemon dogfood.
|
|
50
|
+
- Updated README with beta install/use path and daemon restart guidance.
|
|
51
|
+
|
|
52
|
+
### Verified
|
|
53
|
+
|
|
54
|
+
- Installed the wheel into a fresh venv, ran `setup --yes`, `release-check --live --live-stage`, and installed the real iTerm2 AutoLaunch watcher.
|
|
55
|
+
- Restarted iTerm2 and verified exactly one long-running watcher process from the AutoLaunch script.
|
|
56
|
+
- Confirmed daemon status stayed healthy and watcher screenshot sample artifacts were written.
|
|
57
|
+
|
|
58
|
+
## 0.1.0a7 - 2026-06-25
|
|
59
|
+
|
|
60
|
+
### Added
|
|
61
|
+
|
|
62
|
+
- `term-chameleon release-check` top-level release-readiness gate.
|
|
63
|
+
- Release-check JSON/Markdown reports that compose deterministic checks, optional config validation, readiness status, daemon status, and live-stage screenshot QA.
|
|
64
|
+
- Tests for release-check success/failure behavior.
|
|
65
|
+
|
|
66
|
+
## 0.1.0a6 - 2026-06-25
|
|
67
|
+
|
|
68
|
+
### Added
|
|
69
|
+
|
|
70
|
+
- `term-chameleon config-check` for validating TOML configs before setup/watch/daemon use.
|
|
71
|
+
- Config validation for value types, preset names, region shape, and unknown sections/keys.
|
|
72
|
+
- JSON output for config validation reports.
|
|
73
|
+
|
|
74
|
+
## 0.1.0a5 - 2026-06-25
|
|
75
|
+
|
|
76
|
+
### Added
|
|
77
|
+
|
|
78
|
+
- `term-chameleon watch-daemon-status` to inspect the AutoLaunch script, log path, pid file, and running pid state.
|
|
79
|
+
- `term-chameleon uninstall-watch-daemon` with dry-run and backup support.
|
|
80
|
+
- Tests for watch daemon install/status/uninstall lifecycle behavior.
|
|
81
|
+
|
|
82
|
+
## 0.1.0a4 - 2026-06-25
|
|
83
|
+
|
|
84
|
+
### Added
|
|
85
|
+
|
|
86
|
+
- `term-chameleon config-example` for generating a documented TOML config.
|
|
87
|
+
- `--config` support for `setup`, `watch-live`, and `install-watch-daemon`.
|
|
88
|
+
- Config-driven watcher, daemon, and setup defaults with explicit CLI flags taking precedence.
|
|
89
|
+
|
|
90
|
+
## 0.1.0a3 - 2026-06-25
|
|
91
|
+
|
|
92
|
+
### Added
|
|
93
|
+
|
|
94
|
+
- `term-chameleon setup` guided setup flow.
|
|
95
|
+
- Setup flow runs deterministic self-checks, summarizes readiness, and optionally installs the generated profile with `--yes`.
|
|
96
|
+
- `setup --live` includes live iTerm2 API/window readiness in the final setup result.
|
|
97
|
+
|
|
98
|
+
## 0.1.0a2 - 2026-06-25
|
|
99
|
+
|
|
100
|
+
### Added
|
|
101
|
+
|
|
102
|
+
- `term-chameleon status` readiness summary for local setup/dogfooding.
|
|
103
|
+
- `term-chameleon status --json` machine-readable readiness output.
|
|
104
|
+
- Optional `--live` status probes for iTerm2 Python API connectivity and front-window bounds.
|
|
105
|
+
|
|
106
|
+
## 0.1.0a1 - 2026-06-25
|
|
107
|
+
|
|
108
|
+
Initial alpha release candidate for Term Chameleon.
|
|
109
|
+
|
|
110
|
+
### Added
|
|
111
|
+
|
|
112
|
+
- iTerm2 Dynamic Profile parsing, diagnostics, and conservative safe fixes.
|
|
113
|
+
- Machine-readable `doctor --json` diagnostics with preserved exit-code semantics.
|
|
114
|
+
- Generated iTerm2 Dynamic Profile preset install flow and optional AutoLaunch default-profile script.
|
|
115
|
+
- Manual profile mode switching and OSC/tmux color sequence generation.
|
|
116
|
+
- Screen/image sampling with one-shot profile adaptation.
|
|
117
|
+
- Live adaptive watcher with dry-run, stability, cooldown, duration, and iTerm2 session-local apply modes.
|
|
118
|
+
- iTerm2 Python API readiness checks, connection probe, window bounds probe, and live-adapter script generation.
|
|
119
|
+
- AutoLaunch watcher daemon packaging for continuous adaptation.
|
|
120
|
+
- Deterministic visual simulation, E2E staging artifacts, screenshot probes, pixel contrast, and text-row contrast reports.
|
|
121
|
+
- Controlled Safari+iTerm2 live GUI staging with explicit `--yes` gate and text-row contrast with pixel-cluster fallback.
|
|
122
|
+
- Permission-free `term-chameleon check` deterministic self-check for post-install validation.
|
|
123
|
+
|
|
124
|
+
### Notes
|
|
125
|
+
|
|
126
|
+
- Live GUI and live watcher flows may require macOS Screen Recording, Automation, Accessibility, and iTerm2 Python API permissions.
|
|
127
|
+
- Text-row contrast is heuristic; future releases may add OCR or terminal-cell-aware glyph segmentation.
|
|
128
|
+
- iTerm2 on macOS is the supported terminal target for this alpha.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Term Chameleon contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: term-chameleon
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Adaptive contrast/readability toolkit for translucent terminals, starting with iTerm2.
|
|
5
|
+
Project-URL: Homepage, https://github.com/bodhi/term-chameleon
|
|
6
|
+
Project-URL: Repository, https://github.com/bodhi/term-chameleon
|
|
7
|
+
Project-URL: Issues, https://github.com/bodhi/term-chameleon/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/bodhi/term-chameleon/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Term Chameleon contributors
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: accessibility,contrast,iterm2,osc,terminal,transparency
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Topic :: Terminals
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
22
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
23
|
+
Provides-Extra: iterm
|
|
24
|
+
Requires-Dist: iterm2>=2.9; extra == 'iterm'
|
|
25
|
+
Provides-Extra: visual
|
|
26
|
+
Requires-Dist: pillow>=10.0; extra == 'visual'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# Term Chameleon
|
|
30
|
+
|
|
31
|
+
Term Chameleon is an adaptive contrast/readability toolkit for translucent terminals, starting with iTerm2 on macOS.
|
|
32
|
+
|
|
33
|
+
Glassy terminal themes look good until white text disappears over a bright window, black/dim text vanishes over dark blur, or iTerm2 Light/Dark profile variants silently override the intended palette. Term Chameleon provides static profile diagnostics/fixes plus live background-aware sampling, staging, and adaptation for iTerm2.
|
|
34
|
+
|
|
35
|
+
## Current status
|
|
36
|
+
|
|
37
|
+
This repository is prepared as `v0.1.0` / Python package version `0.1.0`: a dogfooded beta for static profile diagnostics, safe profile mutation, deterministic visual artifacts, live iTerm2 adaptation, controlled macOS GUI/screenshot QA, and real iTerm2 AutoLaunch watcher operation. Implemented:
|
|
38
|
+
|
|
39
|
+
- iTerm2 Dynamic Profile JSON parsing.
|
|
40
|
+
- Color conversion between hex and iTerm2 color dictionaries.
|
|
41
|
+
- WCAG contrast calculations.
|
|
42
|
+
- Static diagnostics for common glass-terminal readability failures.
|
|
43
|
+
- Conservative static fixer with dry-run, backups, deterministic JSON, and explainable changes.
|
|
44
|
+
- iTerm2 Dynamic Profile preset install flow, including optional AutoLaunch default-profile script.
|
|
45
|
+
- Manual readability mode switching for profile JSON files.
|
|
46
|
+
- OSC color sequence generation, including tmux passthrough wrapping.
|
|
47
|
+
- Dynamic watcher foundation via `watch-sim` risk classifier and hysteresis mode selector.
|
|
48
|
+
- iTerm2 live-adapter script generation/probe foundation for session-local Python API validation.
|
|
49
|
+
- Screen/image sampling one-shot adaptation via `sample` and `adapt-once`.
|
|
50
|
+
- Live adaptive watcher via `watch-live`, with dry-run, stable-sample, cooldown, duration, and real iTerm2 session-local apply modes.
|
|
51
|
+
- Deterministic E2E staging bundle that combines controlled backgrounds, ANSI pattern artifacts, visual simulation, screenshot capture, and screenshot pixel analysis.
|
|
52
|
+
- Screenshot contrast estimation for captured PNG/PPM artifacts.
|
|
53
|
+
- Text-row/glyph-aware screenshot contrast estimation for rendered terminal pattern captures.
|
|
54
|
+
- Live GUI staging that arranges controlled Safari background + iTerm2 ANSI pattern windows and can optionally capture/analyze the result with text-row contrast and pixel-cluster fallback.
|
|
55
|
+
- macOS `screencapture` probe and screenshot-test artifact foundation for screenshot-based visual tests.
|
|
56
|
+
- Long-running daemon packaging for continuous adaptation.
|
|
57
|
+
- Permission-free deterministic self-check command for post-install validation.
|
|
58
|
+
- Local readiness status command with human and JSON output.
|
|
59
|
+
- Guided setup command that runs deterministic checks and optionally installs the default profile.
|
|
60
|
+
- TOML config example, validation, and `--config` support for setup/watch-live/watch daemon flows.
|
|
61
|
+
- Watch daemon status and uninstall commands for AutoLaunch lifecycle management.
|
|
62
|
+
- Top-level release-readiness gate that composes deterministic checks, config validation, readiness, daemon, and live-stage checks.
|
|
63
|
+
- Fixture tests for good and bad iTerm2 profiles.
|
|
64
|
+
|
|
65
|
+
Optional future refinements:
|
|
66
|
+
|
|
67
|
+
- Replace heuristic text-row detection with OCR/terminal-cell-aware glyph segmentation.
|
|
68
|
+
- Add broader terminal emulator support beyond iTerm2.
|
|
69
|
+
|
|
70
|
+
## Beta release verification
|
|
71
|
+
|
|
72
|
+
Build and install the beta wheel locally:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
uv build
|
|
76
|
+
python3 -m venv /tmp/term-chameleon-beta-venv
|
|
77
|
+
/tmp/term-chameleon-beta-venv/bin/pip install 'dist/term_chameleon-0.1.0-py3-none-any.whl[iterm]'
|
|
78
|
+
/tmp/term-chameleon-beta-venv/bin/term-chameleon setup --yes
|
|
79
|
+
/tmp/term-chameleon-beta-venv/bin/term-chameleon release-check --output-dir /tmp/term-chameleon-beta-release-check
|
|
80
|
+
/tmp/term-chameleon-beta-venv/bin/term-chameleon release-check --output-dir /tmp/term-chameleon-beta-live-check --live --live-stage --threshold 1.0
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The real iTerm2 AutoLaunch watcher was dogfooded for this beta by installing the daemon, restarting iTerm2, verifying a single running watcher process, checking daemon status, and confirming screenshot sample artifacts were written.
|
|
84
|
+
|
|
85
|
+
See [CHANGELOG.md](CHANGELOG.md) for release notes.
|
|
86
|
+
|
|
87
|
+
## Use it
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
python3 -m venv ~/.local/share/term-chameleon/venv
|
|
91
|
+
~/.local/share/term-chameleon/venv/bin/pip install 'term-chameleon[iterm]'
|
|
92
|
+
~/.local/share/term-chameleon/venv/bin/term-chameleon setup --yes
|
|
93
|
+
~/.local/share/term-chameleon/venv/bin/term-chameleon release-check --live --live-stage --threshold 1.0
|
|
94
|
+
~/.local/share/term-chameleon/venv/bin/term-chameleon install-watch-daemon
|
|
95
|
+
~/.local/share/term-chameleon/venv/bin/term-chameleon watch-daemon-status
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Restart iTerm2 after installing the daemon. The AutoLaunch script starts one long-running `watch-live` process and records its pid/log paths; use `watch-daemon-status` to inspect it and `uninstall-watch-daemon` to remove the AutoLaunch script. The daemon samples the whole screen by default for startup robustness; pass `install-watch-daemon --iterm-window` if you prefer front-iTerm-window sampling after confirming Accessibility/iTerm2 API startup behavior on your machine.
|
|
99
|
+
|
|
100
|
+
## CLI examples
|
|
101
|
+
|
|
102
|
+
Run a permission-free deterministic self-check after installation or inspect local readiness:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
term-chameleon check --output-dir artifacts/check
|
|
106
|
+
term-chameleon release-check --output-dir artifacts/release-check
|
|
107
|
+
term-chameleon setup
|
|
108
|
+
term-chameleon setup --yes
|
|
109
|
+
term-chameleon setup --live
|
|
110
|
+
term-chameleon config-example --output ~/.config/term-chameleon/config.toml
|
|
111
|
+
term-chameleon config-check --config ~/.config/term-chameleon/config.toml
|
|
112
|
+
term-chameleon watch-live --config ~/.config/term-chameleon/config.toml --dry-run
|
|
113
|
+
term-chameleon status
|
|
114
|
+
term-chameleon status --live
|
|
115
|
+
term-chameleon status --json
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`setup` is a guided flow: it runs deterministic checks and reports status. On first run, bare `setup` exits nonzero until a healthy profile exists; use `setup --yes` to install the generated profile, and `setup --live` to include live iTerm2 API/window readiness.
|
|
119
|
+
|
|
120
|
+
`release-check` is the top-level local gate. By default it is permission-free and writes JSON/Markdown reports; add `--config`, `--live`, `--daemon`, or `--live-stage` to include config validation, live iTerm2 probes, AutoLaunch health, or controlled Safari+iTerm2 screenshot QA.
|
|
121
|
+
|
|
122
|
+
`config-example` prints a commented TOML file. `config-check` validates value types, preset names, region shape, and unknown sections/keys. `watch-live`, `install-watch-daemon`, and `setup` accept `--config`; explicit CLI flags override config values.
|
|
123
|
+
|
|
124
|
+
Install a balanced preset into a target directory:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
term-chameleon install --target-dir /tmp/iterm-dynamic-profiles --name "Adaptive Glass"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Install an iTerm2 AutoLaunch script that starts the live watcher whenever iTerm2 launches:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
term-chameleon install-watch-daemon --dry-run
|
|
134
|
+
term-chameleon watch-daemon-status
|
|
135
|
+
term-chameleon install-watch-daemon
|
|
136
|
+
term-chameleon watch-daemon-status --json
|
|
137
|
+
term-chameleon uninstall-watch-daemon --dry-run
|
|
138
|
+
term-chameleon uninstall-watch-daemon
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`uninstall-watch-daemon` removes the iTerm2 AutoLaunch script only; it does not stop an already-running watcher process or remove logs/pid files. It creates a backup by default unless `--no-backup` is passed.
|
|
142
|
+
|
|
143
|
+
Apply a manual readability mode to a profile JSON file:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
term-chameleon mode bright-safe ~/Library/Application\ Support/iTerm2/DynamicProfiles/adaptive-glass.json --dry-run
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Check iTerm2 Python API readiness and generate a conservative session-local adapter script:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
term-chameleon iterm-api-check
|
|
153
|
+
term-chameleon iterm-connect-probe
|
|
154
|
+
term-chameleon iterm-window-bounds
|
|
155
|
+
term-chameleon iterm-live-script --preset balanced --output /tmp/term-chameleon-live.py
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Probe macOS screenshot availability and generate controlled screenshot-test artifacts:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
term-chameleon screenshot-probe
|
|
162
|
+
term-chameleon screenshot-probe --capture --output artifacts/screenshot-probe/screen.png
|
|
163
|
+
term-chameleon screenshot-contrast artifacts/screenshot-probe/screen.png --output-dir artifacts/screenshot-contrast
|
|
164
|
+
term-chameleon screenshot-text-contrast artifacts/screenshot-probe/screen.png --output-dir artifacts/screenshot-text-contrast
|
|
165
|
+
term-chameleon screenshot-test --output-dir artifacts/screenshot-test
|
|
166
|
+
term-chameleon screenshot-test --capture --output-dir artifacts/screenshot-test
|
|
167
|
+
term-chameleon background-html --output-dir artifacts/background-html
|
|
168
|
+
term-chameleon pattern-script --output-dir artifacts/pattern-script
|
|
169
|
+
term-chameleon e2e-stage tests/fixtures/iterm/good-dark-glass.json --output-dir artifacts/e2e-stage
|
|
170
|
+
term-chameleon live-stage --dry-run --output-dir artifacts/live-stage
|
|
171
|
+
term-chameleon live-stage --yes --capture --output-dir artifacts/live-stage
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
`live-stage --yes` is intentionally explicit because it activates Safari, opens the controlled background page, creates/resizes an iTerm2 window, writes the ANSI pattern command into that session, and may require macOS Automation/Accessibility/Screen Recording permissions. It leaves the staged windows open for inspection.
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
term-chameleon sample --screen --output artifacts/adapt/screen.png
|
|
178
|
+
term-chameleon sample --screen --iterm-window --output artifacts/adapt/iterm-window.png
|
|
179
|
+
term-chameleon sample --screen --region 0,0,800,600 --output artifacts/adapt/region.png
|
|
180
|
+
term-chameleon adapt-once tests/fixtures/iterm/good-dark-glass.json --screen --dry-run
|
|
181
|
+
term-chameleon watch-live --dry-run --duration 10 --interval 1 --stable 2
|
|
182
|
+
term-chameleon watch-live --dry-run --iterm-window --duration 10 --interval 1 --stable 2
|
|
183
|
+
term-chameleon watch-live --yes --iterm-window --duration 30 --interval 2 --stable 3 --cooldown 10
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Manual live smoke test, once iTerm2 is running and the Python API is enabled:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
scripts/live-iterm-smoke.sh
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Run deterministic visual simulation:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
term-chameleon visual-test tests/fixtures/iterm/good-dark-glass.json
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Doctor a profile:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
term-chameleon doctor tests/fixtures/iterm/bad-light-variant.json
|
|
202
|
+
term-chameleon doctor tests/fixtures/iterm/bad-light-variant.json --json
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
`doctor --json` emits machine-readable diagnostics after a profile loads successfully; profile load/parse errors still use the standard nonzero exit code with an error on stderr.
|
|
206
|
+
|
|
207
|
+
Preview fixes:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
term-chameleon fix tests/fixtures/iterm/bad-light-variant.json --dry-run
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Apply fixes to a copy:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
cp tests/fixtures/iterm/bad-light-variant.json /tmp/profile.json
|
|
217
|
+
term-chameleon fix /tmp/profile.json --yes
|
|
218
|
+
term-chameleon doctor /tmp/profile.json
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Troubleshooting
|
|
222
|
+
|
|
223
|
+
**iTerm2 Python API not connected:**
|
|
224
|
+
|
|
225
|
+
Ensure iTerm2 is running and Python API support is enabled: iTerm2 → Settings → General → Magic → check "Enable Python API". Run `term-chameleon iterm-api-check` to verify.
|
|
226
|
+
|
|
227
|
+
**Screen Recording permission denied:**
|
|
228
|
+
|
|
229
|
+
macOS requires Screen Recording permission for `screencapture`. Grant it in System Settings → Privacy & Security → Screen Recording for the terminal running Term Chameleon.
|
|
230
|
+
|
|
231
|
+
**AutoLaunch daemon not starting:**
|
|
232
|
+
|
|
233
|
+
Verify the script exists and is executable:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
term-chameleon watch-daemon-status
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
If the PID file is stale (process not running), remove it and restart iTerm2:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
rm ~/Library/Application\ Support/term-chameleon/watch-live.pid
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Stale watcher process after uninstall:**
|
|
246
|
+
|
|
247
|
+
`uninstall-watch-daemon` removes the AutoLaunch script but does not kill a running watcher. Stop it manually:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
kill "$(cat ~/Library/Application\ Support/term-chameleon/watch-live.pid)"
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Daemon CPU or disk usage:**
|
|
254
|
+
|
|
255
|
+
The daemon defaults to a 10-second sampling interval and prunes artifacts to the 200 most recent. To reduce overhead further, increase the interval via config or `--interval`.
|
|
256
|
+
|
|
257
|
+
**iTerm2 window bounds unavailable on startup:**
|
|
258
|
+
|
|
259
|
+
The daemon defaults to whole-screen sampling for startup robustness. If using `--iterm-window`, the watcher waits up to 60 seconds for iTerm2 to create a window before failing.
|
|
260
|
+
|
|
261
|
+
## Development
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
uv sync --extra dev
|
|
265
|
+
uv run pytest
|
|
266
|
+
uv run ruff check .
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
If you do not use `uv`:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
python3 -m pytest
|
|
273
|
+
python3 -m term_chameleon.cli doctor tests/fixtures/iterm/bad-light-variant.json
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Safety principles
|
|
277
|
+
|
|
278
|
+
- Static analysis before mutation.
|
|
279
|
+
- `--dry-run` support for fixes.
|
|
280
|
+
- Timestamped backups before writing.
|
|
281
|
+
- Deterministic JSON output.
|
|
282
|
+
- Explainable diagnostics and fixes.
|
|
283
|
+
- No direct mutation of `~/Library/Preferences/com.googlecode.iterm2.plist` as the primary mechanism.
|
|
284
|
+
|
|
285
|
+
## Positioning
|
|
286
|
+
|
|
287
|
+
Term Chameleon is not just another terminal theme and does not claim to invent automatic contrast. Prior art includes iTerm2 Minimum Contrast, Apple Terminal contrast tweaking, Ghostty minimum contrast, terminal opacity/blur settings, CSS blend-mode/backdrop approaches, and WCAG/APCA contrast engines.
|
|
288
|
+
|
|
289
|
+
The intended differentiated direction is a live contrast controller for translucent terminal windows: sample or infer the actual visual environment behind the terminal, then adapt palette, opacity, blur, and contrast to keep text readable without giving up the glass effect.
|