cc-ghostty 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.
Files changed (79) hide show
  1. cc_ghostty-0.1.0/.claude/skills/demo-video/SKILL.md +107 -0
  2. cc_ghostty-0.1.0/.claude-plugin/marketplace.json +21 -0
  3. cc_ghostty-0.1.0/.claude-plugin/plugin.json +21 -0
  4. cc_ghostty-0.1.0/.github/scripts/macos-allow-ghostty-automation.sh +23 -0
  5. cc_ghostty-0.1.0/.github/workflows/ci.yml +207 -0
  6. cc_ghostty-0.1.0/.github/workflows/integration.yml +144 -0
  7. cc_ghostty-0.1.0/.gitignore +222 -0
  8. cc_ghostty-0.1.0/.pre-commit-config.yaml +33 -0
  9. cc_ghostty-0.1.0/CHANGELOG.md +7 -0
  10. cc_ghostty-0.1.0/CLAUDE.md +183 -0
  11. cc_ghostty-0.1.0/LICENSE +21 -0
  12. cc_ghostty-0.1.0/PKG-INFO +167 -0
  13. cc_ghostty-0.1.0/README.md +143 -0
  14. cc_ghostty-0.1.0/bin/cc-ghostty +19 -0
  15. cc_ghostty-0.1.0/docs/cli.md +114 -0
  16. cc_ghostty-0.1.0/docs/development.md +101 -0
  17. cc_ghostty-0.1.0/docs/how-it-works.md +188 -0
  18. cc_ghostty-0.1.0/hooks/hooks.json +39 -0
  19. cc_ghostty-0.1.0/hooks/register.ts +357 -0
  20. cc_ghostty-0.1.0/pyproject.toml +147 -0
  21. cc_ghostty-0.1.0/skills/doctor/SKILL.md +26 -0
  22. cc_ghostty-0.1.0/skills/restore/SKILL.md +57 -0
  23. cc_ghostty-0.1.0/skills/sessions/SKILL.md +44 -0
  24. cc_ghostty-0.1.0/skills/split/SKILL.md +44 -0
  25. cc_ghostty-0.1.0/skills/tab/SKILL.md +80 -0
  26. cc_ghostty-0.1.0/skills/window/SKILL.md +21 -0
  27. cc_ghostty-0.1.0/src/cc_ghostty/__init__.py +1 -0
  28. cc_ghostty-0.1.0/src/cc_ghostty/__main__.py +3 -0
  29. cc_ghostty-0.1.0/src/cc_ghostty/claude.py +215 -0
  30. cc_ghostty-0.1.0/src/cc_ghostty/cli.py +253 -0
  31. cc_ghostty-0.1.0/src/cc_ghostty/commands/__init__.py +0 -0
  32. cc_ghostty-0.1.0/src/cc_ghostty/commands/_pick.py +39 -0
  33. cc_ghostty-0.1.0/src/cc_ghostty/commands/_selection.py +70 -0
  34. cc_ghostty-0.1.0/src/cc_ghostty/commands/auto_name.py +38 -0
  35. cc_ghostty-0.1.0/src/cc_ghostty/commands/close.py +38 -0
  36. cc_ghostty-0.1.0/src/cc_ghostty/commands/doctor.py +163 -0
  37. cc_ghostty-0.1.0/src/cc_ghostty/commands/exec_run.py +104 -0
  38. cc_ghostty-0.1.0/src/cc_ghostty/commands/focus.py +18 -0
  39. cc_ghostty-0.1.0/src/cc_ghostty/commands/hook.py +33 -0
  40. cc_ghostty-0.1.0/src/cc_ghostty/commands/interrupted.py +37 -0
  41. cc_ghostty-0.1.0/src/cc_ghostty/commands/open_tab.py +221 -0
  42. cc_ghostty-0.1.0/src/cc_ghostty/commands/open_tabs.py +147 -0
  43. cc_ghostty-0.1.0/src/cc_ghostty/commands/ps.py +53 -0
  44. cc_ghostty-0.1.0/src/cc_ghostty/commands/restore.py +71 -0
  45. cc_ghostty-0.1.0/src/cc_ghostty/commands/route.py +10 -0
  46. cc_ghostty-0.1.0/src/cc_ghostty/commands/settle.py +12 -0
  47. cc_ghostty-0.1.0/src/cc_ghostty/commands/setup.py +20 -0
  48. cc_ghostty-0.1.0/src/cc_ghostty/commands/snapshot.py +18 -0
  49. cc_ghostty-0.1.0/src/cc_ghostty/commands/split.py +24 -0
  50. cc_ghostty-0.1.0/src/cc_ghostty/delegate.py +68 -0
  51. cc_ghostty-0.1.0/src/cc_ghostty/ghostty/__init__.py +72 -0
  52. cc_ghostty-0.1.0/src/cc_ghostty/ghostty/atspi.py +54 -0
  53. cc_ghostty-0.1.0/src/cc_ghostty/ghostty/linux.py +348 -0
  54. cc_ghostty-0.1.0/src/cc_ghostty/ghostty/macos.py +277 -0
  55. cc_ghostty-0.1.0/src/cc_ghostty/layout.py +177 -0
  56. cc_ghostty-0.1.0/src/cc_ghostty/procs.py +169 -0
  57. cc_ghostty-0.1.0/src/cc_ghostty/registry.py +239 -0
  58. cc_ghostty-0.1.0/src/cc_ghostty/repos.py +37 -0
  59. cc_ghostty-0.1.0/src/cc_ghostty/restore.py +197 -0
  60. cc_ghostty-0.1.0/src/cc_ghostty/runs.py +216 -0
  61. cc_ghostty-0.1.0/src/cc_ghostty/selfcmd.py +15 -0
  62. cc_ghostty-0.1.0/src/cc_ghostty/sessions.py +62 -0
  63. cc_ghostty-0.1.0/tests/__init__.py +0 -0
  64. cc_ghostty-0.1.0/tests/conftest.py +67 -0
  65. cc_ghostty-0.1.0/tests/integration/__init__.py +0 -0
  66. cc_ghostty-0.1.0/tests/integration/conftest.py +316 -0
  67. cc_ghostty-0.1.0/tests/integration/fake_claude.py +82 -0
  68. cc_ghostty-0.1.0/tests/integration/test_ghostty.py +299 -0
  69. cc_ghostty-0.1.0/tests/test_cli.py +112 -0
  70. cc_ghostty-0.1.0/tests/test_commands.py +455 -0
  71. cc_ghostty-0.1.0/tests/test_delegate.py +221 -0
  72. cc_ghostty-0.1.0/tests/test_ghostty.py +31 -0
  73. cc_ghostty-0.1.0/tests/test_layout.py +141 -0
  74. cc_ghostty-0.1.0/tests/test_linux_split.py +149 -0
  75. cc_ghostty-0.1.0/tests/test_macos.py +103 -0
  76. cc_ghostty-0.1.0/tests/test_registry.py +58 -0
  77. cc_ghostty-0.1.0/tests/test_restore.py +265 -0
  78. cc_ghostty-0.1.0/tests/test_runs.py +173 -0
  79. cc_ghostty-0.1.0/uv.lock +1338 -0
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: demo-video
3
+ description: "Edit a screen recording of the cc-ghostty demo into the README promo video (MP4 and GIF), or update that edit for a new take or a new feature. Use when the user gives a new recording of the demo, asks to (re)do the demo video's montage, to change its captions, highlights or speed, or to show a new feature in it: 'refais le montage', 'nouvelle capture de la démo', 'mets à jour la vidéo', 'ajoute un encadré sur…', 'redo the demo video'."
4
+ allowed-tools: ["Bash(python3 demo/video/build.py:*)", "Bash(python3 demo/video/measure.py:*)", "Bash(ffmpeg:*)", "Bash(ffprobe:*)", "Read", "Edit", "Write"]
5
+ ---
6
+
7
+ # The demo video's montage
8
+
9
+ `demo/video/` turns a recording of the demo (step 1 of `demo/README.md`) into the
10
+ promo video: an intro card, the recording sped up where nothing happens, captions on
11
+ the right, orange frames with notes on what cc-ghostty does, an outro card.
12
+
13
+ - `build.py` — the look (cards, captions, notes, layout) and the ffmpeg pipeline.
14
+ - `capture.json` — everything tied to one take, in seconds and pixels **of the
15
+ recording**; its keys are described in `demo/video/README.md`. A new take means a
16
+ new `capture.json`, not a new `build.py`.
17
+ - `measure.py` — the measurements `capture.json` needs, read off the recording.
18
+
19
+ Run everything with `LC_ALL=C` (a French locale breaks ffmpeg's decimals) and Python
20
+ with Pillow and numpy; `ffmpeg` and the Ubuntu fonts (`fonts-ubuntu`) are needed.
21
+ - `redact.py` — finds personal text in every frame, for `build.py` to blur.
22
+
23
+ ## 1. Find the take
24
+
25
+ Recordings land in `~/Vidéos/Captures vidéo/` (`Capture vidéo du <date>.mp4`): take the
26
+ newest, unless the user names one. `ffprobe` it: the window size and the duration.
27
+
28
+ ## 2. See what happens
29
+
30
+ ```sh
31
+ python3 demo/video/build.py RECORDING --sheets --out OUT # sheet_NN.png, 1 frame/s
32
+ python3 demo/video/measure.py RECORDING --out OUT # edges, rows, tab changes
33
+ python3 demo/video/measure.py RECORDING --frames 23,33.5 --out OUT # frames.png
34
+ ```
35
+
36
+ Read the sheets to write down the story (prompt sent, Claude thinking, each tab, each
37
+ pane, long waits, the end), then `measure.py`'s output for the exact times:
38
+
39
+ - **title / tab bar changes**: each new tab, pane (a pane first shows as `Ghostty`,
40
+ then `▶ NAME` once its command runs) and tab switch, to the frame. Screen
41
+ recordings have a variable frame rate: use these times, never `frame / fps`.
42
+ - **edges** and its `crop` suggestion: the shadow is lopsided (wider left and top).
43
+ - **highlighted conversation rows**: the `/clear` row is the first band, the prompt the
44
+ next. Each time they jump (the conversation scrolls), that is a new `clear_row`
45
+ phase: `row_top` is the `/clear` band's top, `content_top` the prompt's, `until`
46
+ the last time before the jump. Stop once `/clear` leaves the screen or tabs open.
47
+ - **input box lines**: `content_bottom` sits a few pixels above the highest first line
48
+ (the input box is taller while the prompt is typed).
49
+
50
+ Get positions for frames and notes from `--frames` at full size. With the window
51
+ unchanged (800 px wide inside), the tab bar is y 62–97 and tabs share its width:
52
+ 2 tabs → second at x 418–808, 3 tabs → third at 550–808, 4 tabs → first at 26–220,
53
+ fourth at 614–808; a pane on the right is `[418, 102, 815, 614]`. Re-measure when the
54
+ window size changes.
55
+
56
+ ## 3. Write capture.json
57
+
58
+ - `redact`: **no personal data may show**: the home directory and user name
59
+ (`/home/<user>/`), the folders above the demo (`~/projects/…/cc-ghostty/`), account
60
+ names (`.claude-switch/accounts/<name>/`), emails. List each text once as a template:
61
+ its length `chars`, a `what` that describes it without quoting it (the repository is
62
+ public: never write the personal text itself, here or in a commit), a time `at` at
63
+ which it shows on one line, and the top-left `x`, `y` of its first character (`cell` is a character's size, 10 × 21 here: cells start at x 19 +
64
+ 10 n). Crop a `--frames` image around it to place it to the pixel. Matching is by
65
+ pixels, so a text in another color, or cut by a line wrap, needs its own template.
66
+ Blur what makes a path personal, keep what tells the story (`demo/workspace/api`,
67
+ `skills/cc-ghostty/bin/cc-ghostty`).
68
+ - `segments` (`start, end, speed`) cover the whole take in order: speed 1 when
69
+ cc-ghostty acts (prompt sent, a tab or pane appearing, a tab switch), 2–2.5 while a
70
+ pane starts, 4–6 while Claude thinks, up to 30 across a long idle wait. Aim at
71
+ 35–45 s between the cards.
72
+ - `captions`: 4 or 5, each starting where its step starts; English, short, about what
73
+ the user gets (not how).
74
+ - `highlights`: one per thing cc-ghostty did, from when it appears to just before the
75
+ next thing; the `chip` (note) sits below or inside the box, not over what it points
76
+ at. Name the command or port in `note` when it helps (`python3 -m http.server 6006`).
77
+ - Keep the prompts and on-screen text in English.
78
+
79
+ ## 4. Build and check
80
+
81
+ ```sh
82
+ python3 demo/video/build.py RECORDING --out OUT
83
+ ffmpeg -v error -i OUT/cc-ghostty-demo.mp4 -vf "fps=1,scale=480:-1,drawtext=text='%{pts\:hms}':fontcolor=yellow:fontsize=20:box=1:boxcolor=black" OUT/t%02d.png
84
+ ffmpeg -v error -i OUT/t%02d.png -vf tile=5x8 -frames:v 1 OUT/check.png
85
+ ```
86
+
87
+ Read `check.png` and look for: personal text left readable (check full-size frames
88
+ where commands and session headers show: `ffmpeg -ss T -i OUT/cc-ghostty-demo.mp4
89
+ -frames:v 1 frame.png`), the `/clear` row or a gap showing, a frame off its tab
90
+ or pane, a note covering what it explains, a caption out of step, a stretch too fast to
91
+ follow or too slow. Fix `capture.json`, rebuild.
92
+
93
+ ## 5. Deliver
94
+
95
+ Copy `cc-ghostty-demo.mp4` and `.gif` next to the recording (replacing the previous
96
+ ones) and into `docs/media/`, which the README shows (the GIF, linking to the MP4).
97
+ Say how long it lasts and what it shows.
98
+ Commit `docs/media/` and `capture.json` (and `build.py` if the look changed) on
99
+ `develop`, never the
100
+ recording or `out/`.
101
+
102
+ ## Changing the look or the story
103
+
104
+ The cards' text (`FEATURES`, install lines), colors and layout are in `build.py`: keep
105
+ `FEATURES` in step with the README's features. The outro stays `OUTRO` seconds (14):
106
+ long enough to read every line; lengthen it with the text. When the demo itself changes, update
107
+ `demo/README.md`'s script and the captions together.
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
3
+ "name": "cc-ghostty",
4
+ "description": "Claude Code integration for the Ghostty terminal.",
5
+ "owner": {
6
+ "name": "Toilal",
7
+ "url": "https://github.com/Toilal"
8
+ },
9
+ "plugins": [
10
+ {
11
+ "name": "ghostty",
12
+ "description": "Your Claude Code sessions, at home in Ghostty: bring them back after a crash, the next morning or on Monday, in their tabs and windows; one session per repository; tabs, panes and dev servers from one prompt.",
13
+ "source": {
14
+ "source": "github",
15
+ "repo": "Toilal/cc-ghostty",
16
+ "ref": "main"
17
+ },
18
+ "category": "productivity"
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "ghostty",
3
+ "version": "0.1.0",
4
+ "description": "Your Claude Code sessions, at home in Ghostty: bring them back after a crash, the next morning or on Monday, in their tabs and windows; one session per repository; tabs, panes and dev servers from one prompt.",
5
+ "author": {
6
+ "name": "Toilal",
7
+ "url": "https://github.com/Toilal"
8
+ },
9
+ "homepage": "https://github.com/Toilal/cc-ghostty",
10
+ "repository": "https://github.com/Toilal/cc-ghostty",
11
+ "license": "MIT",
12
+ "keywords": ["ghostty", "terminal", "session", "restore", "tabs"],
13
+ "userConfig": {
14
+ "same_account": {
15
+ "type": "boolean",
16
+ "title": "Open new sessions on this session's account",
17
+ "description": "Claude sessions that cc-ghostty opens (tabs, windows, panes, hand-over) start on the account of the session opening them. Off: claude picks the account as in a new terminal (claude-switch: from the directory). Restoring always reopens a session on its own account.",
18
+ "default": false
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,23 @@
1
+ #!/bin/bash
2
+ # Lets the CI runner's processes drive Ghostty through AppleScript without macOS's
3
+ # Automation prompt, which nobody can answer on a runner: Apple Events grants for
4
+ # com.mitchellh.ghostty, written to both TCC databases the way GitHub's runner
5
+ # images pre-approve osascript for Finder and System Events (SIP is off there).
6
+ set -euo pipefail
7
+
8
+ now=$(date +%s)
9
+ clients=(
10
+ /usr/bin/osascript
11
+ /bin/bash
12
+ /bin/zsh
13
+ /opt/hca/hosted-compute-agent
14
+ /usr/local/opt/runner/provisioner/provisioner
15
+ )
16
+ for db in "$HOME/Library/Application Support/com.apple.TCC/TCC.db" \
17
+ "/Library/Application Support/com.apple.TCC/TCC.db"; do
18
+ for client in "${clients[@]}"; do
19
+ values="'kTCCServiceAppleEvents','$client',1,2,0,1,NULL,NULL,0,'com.mitchellh.ghostty',NULL,NULL,$now,NULL,NULL,'UNUSED',$now"
20
+ sudo sqlite3 "$db" "INSERT OR REPLACE INTO access VALUES($values);"
21
+ done
22
+ done
23
+ echo "Apple Events to Ghostty allowed for: ${clients[*]}"
@@ -0,0 +1,207 @@
1
+ name: ci
2
+ on:
3
+ push:
4
+ branches: ['**']
5
+ pull_request: ~
6
+ jobs:
7
+ main-guard:
8
+ # Required by the `main` ruleset: main only takes the owner's release pull requests,
9
+ # from this repository's develop branch.
10
+ if: github.event_name == 'pull_request' && github.base_ref == 'main'
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Check the pull request's author and branch
14
+ env:
15
+ AUTHOR: ${{ github.event.pull_request.user.login }}
16
+ HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
17
+ HEAD_REF: ${{ github.head_ref }}
18
+ OWNER: ${{ github.repository_owner }}
19
+ run: |
20
+ if [ "$AUTHOR" != "$OWNER" ] || [ "$HEAD_REPO" != "$GITHUB_REPOSITORY" ] \
21
+ || [ "$HEAD_REF" != "develop" ]; then
22
+ echo "::error::main only takes $OWNER's pull requests from develop" \
23
+ "(got $AUTHOR from $HEAD_REPO:$HEAD_REF); target develop instead."
24
+ exit 1
25
+ fi
26
+
27
+ lint:
28
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
29
+ runs-on: ubuntu-latest
30
+ steps:
31
+ - name: Checkout
32
+ uses: actions/checkout@v7
33
+
34
+ - name: Install uv
35
+ uses: astral-sh/setup-uv@v8.2.0
36
+ with:
37
+ enable-cache: true
38
+
39
+ - name: Install Dependencies
40
+ run: uv sync --locked --no-dev --group lint --group test
41
+
42
+ - name: Ruff
43
+ run: |
44
+ uv run --no-sync ruff check
45
+ uv run --no-sync ruff format --check
46
+
47
+ - name: Mypy
48
+ run: |
49
+ uv run --no-sync mypy
50
+ uv run --no-sync mypy --platform darwin
51
+
52
+ test:
53
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
54
+ runs-on: ${{ matrix.os }}
55
+
56
+ name: Python ${{ matrix.python-version }}${{ matrix.os == 'macos-latest' && ' (macOS)' || '' }}
57
+
58
+ strategy:
59
+ fail-fast: false
60
+ matrix:
61
+ os: [ ubuntu-latest ]
62
+ python-version: [ "3.11", "3.12", "3.13", "3.14" ]
63
+ include:
64
+ - os: macos-latest
65
+ python-version: "3.11"
66
+ - os: macos-latest
67
+ python-version: "3.14"
68
+
69
+ steps:
70
+ - name: Checkout
71
+ uses: actions/checkout@v7
72
+
73
+ - name: Install uv
74
+ uses: astral-sh/setup-uv@v8.2.0
75
+ with:
76
+ python-version: ${{ matrix.python-version }}
77
+ enable-cache: true
78
+
79
+ - name: Install Dependencies
80
+ run: uv sync --locked --no-dev --group test
81
+
82
+ - name: Test
83
+ run: uv run --no-sync pytest --cov=cc_ghostty --cov-report=term-missing
84
+
85
+ commitizen:
86
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
87
+ runs-on: ubuntu-latest
88
+ steps:
89
+ - uses: actions/checkout@v7
90
+ with:
91
+ fetch-depth: 0
92
+
93
+ - name: Install uv
94
+ uses: astral-sh/setup-uv@v8.2.0
95
+ with:
96
+ python-version: "3.14"
97
+
98
+ - name: Check commit messages
99
+ # Push: the pushed range, or the last commit when "before" is unusable (a new
100
+ # branch, or a force-push whose "before" commit is unreachable).
101
+ run: |
102
+ if [ "${{ github.event_name }}" = "pull_request" ]; then
103
+ RANGE="${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"
104
+ elif [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ] \
105
+ || ! git cat-file -e "${{ github.event.before }}^{commit}" 2>/dev/null; then
106
+ RANGE="HEAD~1..HEAD"
107
+ else
108
+ RANGE="${{ github.event.before }}..${{ github.event.after }}"
109
+ fi
110
+ echo "Checking commit range: ${RANGE}"
111
+ uv run cz check --rev-range "${RANGE}"
112
+
113
+ build:
114
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
115
+ needs: [ lint, test ]
116
+ runs-on: ubuntu-latest
117
+ steps:
118
+ - name: Checkout
119
+ uses: actions/checkout@v7
120
+ with:
121
+ fetch-depth: 0
122
+
123
+ - name: Install uv
124
+ uses: astral-sh/setup-uv@v8.2.0
125
+ with:
126
+ python-version: "3.14"
127
+ enable-cache: true
128
+
129
+ - name: Git User config
130
+ run: |
131
+ git config --global user.email "action@github.com"
132
+ git config --global user.name "github-actions"
133
+
134
+ - name: Bump version
135
+ # python-semantic-release refuses a pull request's detached merge commit;
136
+ # artifacts built from a pull request are never published.
137
+ if: github.event_name != 'pull_request'
138
+ run: uvx --from python-semantic-release semantic-release version --no-commit --no-tag --no-push
139
+ env:
140
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141
+
142
+ - name: Build
143
+ run: uv build
144
+
145
+ - uses: actions/upload-artifact@v7
146
+ with:
147
+ name: cc-ghostty-python
148
+ path: ./dist
149
+
150
+ release:
151
+ # The release commit, pushed with the deploy key, triggers a run of its own: skip it.
152
+ if: >-
153
+ github.ref == 'refs/heads/main' && github.event_name == 'push'
154
+ && !startsWith(github.event.head_commit.message, 'chore(release):')
155
+ needs: [ lint, test, commitizen, build ]
156
+ runs-on: ubuntu-latest
157
+ environment: pypi
158
+ permissions:
159
+ contents: write # semantic-release creates the GitHub release
160
+ id-token: write # OIDC token for PyPI Trusted Publishing (no API token needed)
161
+ steps:
162
+ - name: Checkout
163
+ uses: actions/checkout@v7
164
+ with:
165
+ fetch-depth: 0
166
+ # The deploy key is the only bypass of the `main` ruleset: semantic-release
167
+ # pushes the release commit and tag over SSH with it.
168
+ ssh-key: ${{ secrets.RELEASE_DEPLOY_KEY }}
169
+
170
+ - name: Install uv
171
+ uses: astral-sh/setup-uv@v8.2.0
172
+ with:
173
+ python-version: "3.14"
174
+ enable-cache: true
175
+
176
+ - name: Git User config
177
+ run: |
178
+ git config --global user.email "action@github.com"
179
+ git config --global user.name "github-actions"
180
+
181
+ - name: Bump version
182
+ run: uvx --from python-semantic-release semantic-release version
183
+ env:
184
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185
+
186
+ - name: Build
187
+ run: uv build
188
+
189
+ - name: Upload to PyPI
190
+ # Trusted Publishing via the job's OIDC token: needs a trusted publisher on PyPI
191
+ # for this repository, ci.yml and the `pypi` environment.
192
+ run: uv publish --trusted-publishing always dist/*.tar.gz dist/*.whl
193
+
194
+ - name: Publish release
195
+ run: uvx --from python-semantic-release semantic-release publish
196
+ env:
197
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198
+
199
+ - name: Merge main to develop
200
+ uses: robotology/gh-action-nightly-merge@v1.5.2
201
+ with:
202
+ stable_branch: 'main'
203
+ development_branch: 'develop'
204
+ allow_ff: true
205
+ user_name: github-actions
206
+ env:
207
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,144 @@
1
+ name: integration
2
+ on:
3
+ push:
4
+ branches: ['**']
5
+ pull_request: ~
6
+ schedule:
7
+ - cron: '0 4 * * *'
8
+ workflow_dispatch: ~
9
+
10
+ concurrency:
11
+ group: integration-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ linux:
16
+ if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
17
+ name: Ghostty on Linux
18
+ runs-on: ubuntu-latest
19
+ timeout-minutes: 20
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@v7
23
+
24
+ - name: Resolve the latest Ghostty release
25
+ id: ghostty
26
+ # Only the latest release is tested. It is built from source: the snap cannot
27
+ # run on GitHub's runners and the AppImage's own Mesa cannot draw on Xvfb.
28
+ run: |
29
+ version=$(git ls-remote --tags https://github.com/ghostty-org/ghostty 'v*' \
30
+ | awk -F/ '{print $3}' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \
31
+ | sort -V | tail -1 | sed 's/^v//')
32
+ echo "version=$version" >> "$GITHUB_OUTPUT"
33
+ echo "Ghostty $version"
34
+
35
+ - name: Install a headless desktop and Ghostty's build dependencies
36
+ # Xvfb and Mesa's software OpenGL to draw Ghostty; AT-SPI and PyGObject to
37
+ # read its tabs; GTK 4 and libadwaita to build and run it.
38
+ run: |
39
+ sudo apt-get update
40
+ sudo apt-get install -y --no-install-recommends \
41
+ xvfb dbus dbus-x11 at-spi2-core libgl1-mesa-dri \
42
+ python3-gi gir1.2-atspi-2.0 fonts-dejavu-core \
43
+ libgtk-4-dev libadwaita-1-dev libgtk4-layer-shell-dev gettext libxml2-utils
44
+
45
+ - name: Cache Ghostty
46
+ id: cache
47
+ uses: actions/cache@v5
48
+ with:
49
+ path: ~/ghostty
50
+ # Bump the suffix when the build command changes.
51
+ key: ghostty-${{ steps.ghostty.outputs.version }}-${{ runner.os }}-${{ runner.arch }}-3
52
+
53
+ - name: Build Ghostty
54
+ if: steps.cache.outputs.cache-hit != 'true'
55
+ env:
56
+ VERSION: ${{ steps.ghostty.outputs.version }}
57
+ run: |
58
+ cd "$RUNNER_TEMP"
59
+ curl -fsSL "https://release.files.ghostty.org/$VERSION/ghostty-$VERSION.tar.gz" | tar xz
60
+ cd "ghostty-$VERSION"
61
+ zig_version=$(sed -n 's/.*minimum_zig_version = "\(.*\)".*/\1/p' build.zig.zon)
62
+ zig_url=$(curl -fsSL https://ziglang.org/download/index.json \
63
+ | jq -r --arg v "$zig_version" '.[$v]["x86_64-linux"].tarball')
64
+ mkdir -p "$RUNNER_TEMP/zig"
65
+ curl -fsSL "$zig_url" | tar xJ -C "$RUNNER_TEMP/zig" --strip-components=1
66
+ # A baseline CPU: the cached build runs on runners with other CPUs (a native
67
+ # build dies there with SIGILL).
68
+ "$RUNNER_TEMP/zig/zig" build -Doptimize=ReleaseFast -Dcpu=baseline \
69
+ -Dversion-string="$VERSION" -p "$HOME/ghostty"
70
+
71
+ - name: Put Ghostty on PATH
72
+ run: |
73
+ echo "$HOME/ghostty/bin" >> "$GITHUB_PATH"
74
+ "$HOME/ghostty/bin/ghostty" --version
75
+
76
+ - name: Install uv
77
+ uses: astral-sh/setup-uv@v8.2.0
78
+ with:
79
+ python-version: "3.14"
80
+ enable-cache: true
81
+
82
+ - name: Install Dependencies
83
+ run: uv sync --locked --no-dev --group test --group integration
84
+
85
+ - name: Integration tests
86
+ env:
87
+ CC_GHOSTTY_INTEGRATION: "1"
88
+ CC_GHOSTTY_IT_ARTIFACTS: ${{ github.workspace }}/integration-artifacts
89
+ run: dbus-run-session -- uv run --no-sync pytest tests/integration -v
90
+
91
+ - name: Upload screenshots and logs
92
+ if: always()
93
+ uses: actions/upload-artifact@v7
94
+ with:
95
+ name: integration-linux
96
+ path: integration-artifacts
97
+ if-no-files-found: ignore
98
+
99
+ macos:
100
+ if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
101
+ name: Ghostty on macOS
102
+ runs-on: macos-latest
103
+ timeout-minutes: 20
104
+ steps:
105
+ - name: Checkout
106
+ uses: actions/checkout@v7
107
+
108
+ - name: Install the latest Ghostty
109
+ run: |
110
+ brew install --cask ghostty
111
+ xattr -dr com.apple.quarantine /Applications/Ghostty.app || true
112
+ defaults read /Applications/Ghostty.app/Contents/Info CFBundleShortVersionString
113
+
114
+ - name: Allow AppleScript to drive Ghostty
115
+ run: .github/scripts/macos-allow-ghostty-automation.sh
116
+
117
+ - name: Install uv
118
+ uses: astral-sh/setup-uv@v8.2.0
119
+ with:
120
+ python-version: "3.14"
121
+ enable-cache: true
122
+
123
+ - name: Install Dependencies
124
+ run: uv sync --locked --no-dev --group test --group integration
125
+
126
+ - name: Integration tests
127
+ env:
128
+ CC_GHOSTTY_INTEGRATION: "1"
129
+ CC_GHOSTTY_IT_ARTIFACTS: ${{ github.workspace }}/integration-artifacts
130
+ run: uv run --no-sync pytest tests/integration -v
131
+
132
+ - name: Screenshot of the desktop
133
+ if: always()
134
+ run: |
135
+ mkdir -p integration-artifacts
136
+ screencapture -x integration-artifacts/desktop-at-end.png || true
137
+
138
+ - name: Upload screenshots and logs
139
+ if: always()
140
+ uses: actions/upload-artifact@v7
141
+ with:
142
+ name: integration-macos
143
+ path: integration-artifacts
144
+ if-no-files-found: ignore