git-workspace-tui 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 (45) hide show
  1. git_workspace_tui-0.1.0/.github/workflows/ci.yml +25 -0
  2. git_workspace_tui-0.1.0/.github/workflows/publish.yml +29 -0
  3. git_workspace_tui-0.1.0/.gitignore +10 -0
  4. git_workspace_tui-0.1.0/CHANGELOG.md +9 -0
  5. git_workspace_tui-0.1.0/CONTRIBUTING.md +23 -0
  6. git_workspace_tui-0.1.0/LICENSE +21 -0
  7. git_workspace_tui-0.1.0/PKG-INFO +265 -0
  8. git_workspace_tui-0.1.0/README.md +239 -0
  9. git_workspace_tui-0.1.0/README.zh-CN.md +239 -0
  10. git_workspace_tui-0.1.0/docs/cli-safety.svg +27 -0
  11. git_workspace_tui-0.1.0/docs/cli-safety.zh-CN.svg +27 -0
  12. git_workspace_tui-0.1.0/docs/command-flow.svg +39 -0
  13. git_workspace_tui-0.1.0/docs/command-flow.zh-CN.svg +37 -0
  14. git_workspace_tui-0.1.0/docs/config-model.svg +38 -0
  15. git_workspace_tui-0.1.0/docs/config-model.zh-CN.svg +38 -0
  16. git_workspace_tui-0.1.0/docs/target-model.svg +31 -0
  17. git_workspace_tui-0.1.0/docs/target-model.zh-CN.svg +29 -0
  18. git_workspace_tui-0.1.0/docs/tui-preview.svg +107 -0
  19. git_workspace_tui-0.1.0/docs/tui-preview.zh-CN.svg +38 -0
  20. git_workspace_tui-0.1.0/docs/workspace-problem.svg +36 -0
  21. git_workspace_tui-0.1.0/docs/workspace-problem.zh-CN.svg +36 -0
  22. git_workspace_tui-0.1.0/examples/workspace.example.yml +36 -0
  23. git_workspace_tui-0.1.0/pyproject.toml +62 -0
  24. git_workspace_tui-0.1.0/src/git_workspace/__init__.py +6 -0
  25. git_workspace_tui-0.1.0/src/git_workspace/__main__.py +7 -0
  26. git_workspace_tui-0.1.0/src/git_workspace/cli.py +168 -0
  27. git_workspace_tui-0.1.0/src/git_workspace/config.py +128 -0
  28. git_workspace_tui-0.1.0/src/git_workspace/executor.py +208 -0
  29. git_workspace_tui-0.1.0/src/git_workspace/git.py +106 -0
  30. git_workspace_tui-0.1.0/src/git_workspace/models.py +81 -0
  31. git_workspace_tui-0.1.0/src/git_workspace/output.py +55 -0
  32. git_workspace_tui-0.1.0/src/git_workspace/planner.py +45 -0
  33. git_workspace_tui-0.1.0/src/git_workspace/styles.py +45 -0
  34. git_workspace_tui-0.1.0/src/git_workspace/terminal.py +246 -0
  35. git_workspace_tui-0.1.0/src/git_workspace/tui.py +1000 -0
  36. git_workspace_tui-0.1.0/src/git_workspace/workspace.py +51 -0
  37. git_workspace_tui-0.1.0/tests/conftest.py +20 -0
  38. git_workspace_tui-0.1.0/tests/test_cli.py +33 -0
  39. git_workspace_tui-0.1.0/tests/test_config.py +63 -0
  40. git_workspace_tui-0.1.0/tests/test_executor.py +89 -0
  41. git_workspace_tui-0.1.0/tests/test_planner.py +27 -0
  42. git_workspace_tui-0.1.0/tests/test_terminal.py +177 -0
  43. git_workspace_tui-0.1.0/tests/test_tui.py +443 -0
  44. git_workspace_tui-0.1.0/tests/test_workspace.py +36 -0
  45. git_workspace_tui-0.1.0/uv.lock +305 -0
@@ -0,0 +1,25 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ os: [ubuntu-latest, macos-latest]
13
+ python-version: ["3.11", "3.12"]
14
+ runs-on: ${{ matrix.os }}
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: astral-sh/setup-uv@v4
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: ${{ matrix.python-version }}
21
+ - run: uv sync --dev
22
+ - run: uv run ruff check .
23
+ - run: uv run pytest
24
+ - run: uv run python -m build
25
+
@@ -0,0 +1,29 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ publish:
13
+ name: Publish to PyPI
14
+ runs-on: ubuntu-latest
15
+ environment: pypi
16
+ permissions:
17
+ contents: read
18
+ id-token: write
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: astral-sh/setup-uv@v4
22
+ - uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.12"
25
+ - run: uv sync --dev
26
+ - run: uv run ruff check .
27
+ - run: uv run pytest
28
+ - run: uv run python -m build
29
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,10 @@
1
+ .DS_Store
2
+ .pytest_cache/
3
+ .ruff_cache/
4
+ .venv/
5
+ __pycache__/
6
+ *.egg-info/
7
+ build/
8
+ dist/
9
+ workspace.local.yml
10
+
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Initial Git-aware multi-repo terminal implementation.
6
+ - Adds `gws` and `g` command entry points.
7
+ - Adds shell-first TUI execution with optional Git shortcut mode.
8
+ - Adds workspace configuration, status, plan, switch, pull, sync, and exec commands.
9
+
@@ -0,0 +1,23 @@
1
+ # Contributing
2
+
3
+ Thanks for helping improve Git Workspace.
4
+
5
+ ## Development Setup
6
+
7
+ ```bash
8
+ uv sync --dev
9
+ uv run pytest
10
+ uv run ruff check .
11
+ ```
12
+
13
+ ## Pull Requests
14
+
15
+ - Keep behavior changes covered by tests.
16
+ - Preserve the shell-first execution model unless the change explicitly targets Git mode.
17
+ - Avoid adding dependencies unless they materially improve reliability or portability.
18
+ - Do not rely on a specific user's shell configuration in tests.
19
+
20
+ ## TUI Changes
21
+
22
+ For TUI changes, add or update headless Textual tests where possible. Important interactions include input focus, repository switching, command cancellation, and mode switching.
23
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 liusheng22
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,265 @@
1
+ Metadata-Version: 2.4
2
+ Name: git-workspace-tui
3
+ Version: 0.1.0
4
+ Summary: Git-aware multi-repo terminal workspace
5
+ Project-URL: Homepage, https://github.com/liusheng22/git-workspace
6
+ Project-URL: Repository, https://github.com/liusheng22/git-workspace
7
+ Project-URL: Issues, https://github.com/liusheng22/git-workspace/issues
8
+ Author: liusheng22
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: git,multi-repo,terminal,tui,workspace
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Version Control :: Git
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: pyyaml>=6.0.2
23
+ Requires-Dist: rich>=13.7
24
+ Requires-Dist: textual>=0.86
25
+ Description-Content-Type: text/markdown
26
+
27
+ # Git Workspace
28
+
29
+ [中文文档](README.zh-CN.md)
30
+
31
+ Git Workspace (`gws`) is a Git-aware multi-repo terminal. It is built for one common developer setup: a single directory that contains many Git repositories.
32
+
33
+ ![Why Git Workspace exists](docs/workspace-problem.svg)
34
+
35
+ ## 60-Second Start
36
+
37
+ Install from PyPI:
38
+
39
+ ```bash
40
+ uv tool install git-workspace-tui
41
+ ```
42
+
43
+ Open the directory that contains your repos:
44
+
45
+ ```bash
46
+ cd ~/Projects/workspace
47
+ gws
48
+ ```
49
+
50
+ Inside the TUI, the first row is `ALL REPOS`. Type once there to run in every repo:
51
+
52
+ ```text
53
+ ALL shell > git status -sb
54
+ ```
55
+
56
+ Press `Tab` to move to one repo and run a focused command:
57
+
58
+ ```text
59
+ api@main shell > pnpm test
60
+ ```
61
+
62
+ ## TUI Map
63
+
64
+ ![TUI guide](docs/tui-preview.svg)
65
+
66
+ The TUI has only two concepts:
67
+
68
+ | Area | Meaning |
69
+ | --- | --- |
70
+ | Left panel | Choose the target: `ALL REPOS` or one repository. |
71
+ | Right panel | Continuous command log and one command input. |
72
+
73
+ Useful keys:
74
+
75
+ | Key | Action |
76
+ | --- | --- |
77
+ | `Tab` / `Shift+Tab` | Move through `ALL REPOS` and repository rows. |
78
+ | `Enter` | Run the input in the selected target. |
79
+ | `Up` / `Down` | Command history. |
80
+ | `Ctrl+C` | Cancel running command, or quit when idle. |
81
+ | `Ctrl+Q` | Quit. |
82
+ | `:git` / `:shell` | Switch execution mode. |
83
+ | `:clear` / `:refresh` | Clear log / refresh repos. |
84
+
85
+ ## ALL REPOS vs One Repo
86
+
87
+ ![Target model](docs/target-model.svg)
88
+
89
+ `ALL REPOS` is a real operating target, not a hidden mode.
90
+
91
+ ```text
92
+ ALL shell > git status -sb
93
+ ALL shell > git pull --ff-only
94
+ ALL shell > git push
95
+ ```
96
+
97
+ Repository rows are for focused work:
98
+
99
+ ```text
100
+ api@main shell > pnpm test
101
+ api@main shell > git checkout dev
102
+ api@dev shell > git pull --ff-only
103
+ ```
104
+
105
+ ## Command Flow
106
+
107
+ ![Command flow](docs/command-flow.svg)
108
+
109
+ Default mode is `shell`, so Git Workspace runs commands through your configured shell in the target repo directory.
110
+
111
+ ```text
112
+ ALL shell > git status -sb
113
+ web@dev shell > npm run build
114
+ ```
115
+
116
+ Use Git mode when you want shorter Git subcommands and Git aliases:
117
+
118
+ ```text
119
+ :git
120
+ ALL git > status -sb
121
+ api@main git > gco dev
122
+ :shell
123
+ ```
124
+
125
+ Shell aliases and functions are loaded best-effort. Portable team shortcuts should go in `workspace.yml` or Git's own `alias.*` config.
126
+
127
+ ## CLI Safety Flow
128
+
129
+ ![CLI safety flow](docs/cli-safety.svg)
130
+
131
+ The TUI `ALL REPOS` target is terminal-like: it runs the command you type in every repo.
132
+
133
+ For safer branch / pull workflows, use the plan-aware CLI commands:
134
+
135
+ ```bash
136
+ gws status
137
+ gws plan daily
138
+ gws switch daily
139
+ gws pull daily
140
+ gws sync daily
141
+ ```
142
+
143
+ Command meanings:
144
+
145
+ | Command | Purpose |
146
+ | --- | --- |
147
+ | `status` | Show branch, target, dirty state, upstream, ahead / behind. |
148
+ | `plan` | Explain actions before changing anything. |
149
+ | `switch` | Checkout target branches when safe. |
150
+ | `pull` | Pull clean repos already on target branch. |
151
+ | `sync` | Switch to target branches, then pull safe repos. |
152
+ | `exec` | Run a shell command across repos. |
153
+
154
+ Run any command across repos from the CLI:
155
+
156
+ ```bash
157
+ gws exec -- pwd
158
+ gws exec -- git status -sb
159
+ gws exec daily -- pnpm test
160
+ ```
161
+
162
+ ## Configuration Model
163
+
164
+ ![Configuration model](docs/config-model.svg)
165
+
166
+ Git Workspace works without a config by discovering Git repositories directly under the current directory. Add `workspace.yml` when you want shared defaults.
167
+
168
+ ```yaml
169
+ workspace:
170
+ root: .
171
+ ignore:
172
+ - node_modules
173
+ - .cache
174
+ - dist
175
+
176
+ repos:
177
+ api:
178
+ path: ./api
179
+ default: main
180
+ web:
181
+ path: ./web
182
+ default: dev
183
+
184
+ profiles:
185
+ daily:
186
+ api: main
187
+ web: dev
188
+ "*": main
189
+
190
+ aliases:
191
+ gco: checkout
192
+ gcb: checkout -b
193
+ gl: pull
194
+ gp: push
195
+
196
+ exec:
197
+ defaultMode: shell
198
+ gitShortcuts: true
199
+ shell:
200
+ interactive: true
201
+ ```
202
+
203
+ Use `workspace.local.yml` for machine-specific overrides. It should usually stay uncommitted.
204
+
205
+ ## Install Options
206
+
207
+ With `uv`:
208
+
209
+ ```bash
210
+ uv tool install git-workspace-tui
211
+ ```
212
+
213
+ With `pipx`:
214
+
215
+ ```bash
216
+ pipx install git-workspace-tui
217
+ ```
218
+
219
+ Install a fixed version from GitHub:
220
+
221
+ ```bash
222
+ uv tool install git+https://github.com/liusheng22/git-workspace.git@v0.1.0
223
+ ```
224
+
225
+ From a local clone:
226
+
227
+ ```bash
228
+ git clone https://github.com/liusheng22/git-workspace.git
229
+ cd git-workspace
230
+ uv sync --dev
231
+ uv run gws --help
232
+ ```
233
+
234
+ `g` is also installed as a short alias for `gws`:
235
+
236
+ ```bash
237
+ g
238
+ g status
239
+ g plan
240
+ ```
241
+
242
+ ## Safety Notes
243
+
244
+ - `ALL REPOS` runs your command in every repo. It intentionally behaves like a multi-repo terminal.
245
+ - `plan`, `pull`, and `sync` inspect branch and dirty state before changing repositories.
246
+ - Dirty worktrees are not auto-fixed.
247
+ - Unsafe branch switching is skipped.
248
+
249
+ When in doubt:
250
+
251
+ ```bash
252
+ gws status
253
+ gws plan
254
+ ```
255
+
256
+ ## Development
257
+
258
+ ```bash
259
+ uv sync --dev
260
+ uv run pytest
261
+ uv run ruff check .
262
+ uv run python -m build
263
+ ```
264
+
265
+ Git Workspace currently targets macOS and Linux.
@@ -0,0 +1,239 @@
1
+ # Git Workspace
2
+
3
+ [中文文档](README.zh-CN.md)
4
+
5
+ Git Workspace (`gws`) is a Git-aware multi-repo terminal. It is built for one common developer setup: a single directory that contains many Git repositories.
6
+
7
+ ![Why Git Workspace exists](docs/workspace-problem.svg)
8
+
9
+ ## 60-Second Start
10
+
11
+ Install from PyPI:
12
+
13
+ ```bash
14
+ uv tool install git-workspace-tui
15
+ ```
16
+
17
+ Open the directory that contains your repos:
18
+
19
+ ```bash
20
+ cd ~/Projects/workspace
21
+ gws
22
+ ```
23
+
24
+ Inside the TUI, the first row is `ALL REPOS`. Type once there to run in every repo:
25
+
26
+ ```text
27
+ ALL shell > git status -sb
28
+ ```
29
+
30
+ Press `Tab` to move to one repo and run a focused command:
31
+
32
+ ```text
33
+ api@main shell > pnpm test
34
+ ```
35
+
36
+ ## TUI Map
37
+
38
+ ![TUI guide](docs/tui-preview.svg)
39
+
40
+ The TUI has only two concepts:
41
+
42
+ | Area | Meaning |
43
+ | --- | --- |
44
+ | Left panel | Choose the target: `ALL REPOS` or one repository. |
45
+ | Right panel | Continuous command log and one command input. |
46
+
47
+ Useful keys:
48
+
49
+ | Key | Action |
50
+ | --- | --- |
51
+ | `Tab` / `Shift+Tab` | Move through `ALL REPOS` and repository rows. |
52
+ | `Enter` | Run the input in the selected target. |
53
+ | `Up` / `Down` | Command history. |
54
+ | `Ctrl+C` | Cancel running command, or quit when idle. |
55
+ | `Ctrl+Q` | Quit. |
56
+ | `:git` / `:shell` | Switch execution mode. |
57
+ | `:clear` / `:refresh` | Clear log / refresh repos. |
58
+
59
+ ## ALL REPOS vs One Repo
60
+
61
+ ![Target model](docs/target-model.svg)
62
+
63
+ `ALL REPOS` is a real operating target, not a hidden mode.
64
+
65
+ ```text
66
+ ALL shell > git status -sb
67
+ ALL shell > git pull --ff-only
68
+ ALL shell > git push
69
+ ```
70
+
71
+ Repository rows are for focused work:
72
+
73
+ ```text
74
+ api@main shell > pnpm test
75
+ api@main shell > git checkout dev
76
+ api@dev shell > git pull --ff-only
77
+ ```
78
+
79
+ ## Command Flow
80
+
81
+ ![Command flow](docs/command-flow.svg)
82
+
83
+ Default mode is `shell`, so Git Workspace runs commands through your configured shell in the target repo directory.
84
+
85
+ ```text
86
+ ALL shell > git status -sb
87
+ web@dev shell > npm run build
88
+ ```
89
+
90
+ Use Git mode when you want shorter Git subcommands and Git aliases:
91
+
92
+ ```text
93
+ :git
94
+ ALL git > status -sb
95
+ api@main git > gco dev
96
+ :shell
97
+ ```
98
+
99
+ Shell aliases and functions are loaded best-effort. Portable team shortcuts should go in `workspace.yml` or Git's own `alias.*` config.
100
+
101
+ ## CLI Safety Flow
102
+
103
+ ![CLI safety flow](docs/cli-safety.svg)
104
+
105
+ The TUI `ALL REPOS` target is terminal-like: it runs the command you type in every repo.
106
+
107
+ For safer branch / pull workflows, use the plan-aware CLI commands:
108
+
109
+ ```bash
110
+ gws status
111
+ gws plan daily
112
+ gws switch daily
113
+ gws pull daily
114
+ gws sync daily
115
+ ```
116
+
117
+ Command meanings:
118
+
119
+ | Command | Purpose |
120
+ | --- | --- |
121
+ | `status` | Show branch, target, dirty state, upstream, ahead / behind. |
122
+ | `plan` | Explain actions before changing anything. |
123
+ | `switch` | Checkout target branches when safe. |
124
+ | `pull` | Pull clean repos already on target branch. |
125
+ | `sync` | Switch to target branches, then pull safe repos. |
126
+ | `exec` | Run a shell command across repos. |
127
+
128
+ Run any command across repos from the CLI:
129
+
130
+ ```bash
131
+ gws exec -- pwd
132
+ gws exec -- git status -sb
133
+ gws exec daily -- pnpm test
134
+ ```
135
+
136
+ ## Configuration Model
137
+
138
+ ![Configuration model](docs/config-model.svg)
139
+
140
+ Git Workspace works without a config by discovering Git repositories directly under the current directory. Add `workspace.yml` when you want shared defaults.
141
+
142
+ ```yaml
143
+ workspace:
144
+ root: .
145
+ ignore:
146
+ - node_modules
147
+ - .cache
148
+ - dist
149
+
150
+ repos:
151
+ api:
152
+ path: ./api
153
+ default: main
154
+ web:
155
+ path: ./web
156
+ default: dev
157
+
158
+ profiles:
159
+ daily:
160
+ api: main
161
+ web: dev
162
+ "*": main
163
+
164
+ aliases:
165
+ gco: checkout
166
+ gcb: checkout -b
167
+ gl: pull
168
+ gp: push
169
+
170
+ exec:
171
+ defaultMode: shell
172
+ gitShortcuts: true
173
+ shell:
174
+ interactive: true
175
+ ```
176
+
177
+ Use `workspace.local.yml` for machine-specific overrides. It should usually stay uncommitted.
178
+
179
+ ## Install Options
180
+
181
+ With `uv`:
182
+
183
+ ```bash
184
+ uv tool install git-workspace-tui
185
+ ```
186
+
187
+ With `pipx`:
188
+
189
+ ```bash
190
+ pipx install git-workspace-tui
191
+ ```
192
+
193
+ Install a fixed version from GitHub:
194
+
195
+ ```bash
196
+ uv tool install git+https://github.com/liusheng22/git-workspace.git@v0.1.0
197
+ ```
198
+
199
+ From a local clone:
200
+
201
+ ```bash
202
+ git clone https://github.com/liusheng22/git-workspace.git
203
+ cd git-workspace
204
+ uv sync --dev
205
+ uv run gws --help
206
+ ```
207
+
208
+ `g` is also installed as a short alias for `gws`:
209
+
210
+ ```bash
211
+ g
212
+ g status
213
+ g plan
214
+ ```
215
+
216
+ ## Safety Notes
217
+
218
+ - `ALL REPOS` runs your command in every repo. It intentionally behaves like a multi-repo terminal.
219
+ - `plan`, `pull`, and `sync` inspect branch and dirty state before changing repositories.
220
+ - Dirty worktrees are not auto-fixed.
221
+ - Unsafe branch switching is skipped.
222
+
223
+ When in doubt:
224
+
225
+ ```bash
226
+ gws status
227
+ gws plan
228
+ ```
229
+
230
+ ## Development
231
+
232
+ ```bash
233
+ uv sync --dev
234
+ uv run pytest
235
+ uv run ruff check .
236
+ uv run python -m build
237
+ ```
238
+
239
+ Git Workspace currently targets macOS and Linux.