git-ssh-sync 0.2.0__tar.gz → 0.3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: git-ssh-sync
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Sync Git commits through a local machine for development environments without direct GitHub or GitLab access.
5
5
  Requires-Dist: pydantic>=2.13.4
6
6
  Requires-Dist: pyyaml>=6.0.3
@@ -90,8 +90,21 @@ Key parameters:
90
90
  - `--origin`: Repository URL on the GitHub / GitLab side
91
91
  - `--dev-host`: SSH host of the development environment
92
92
  - `--dev-user`: SSH user of the development environment
93
+ - `--dev-os`: Development environment OS, either `posix` or `windows` (default: `posix`)
93
94
  - `--dev-path`: Path to the work repository on the development environment
94
95
 
96
+ For a Windows development environment, specify `--dev-os windows` and use Windows
97
+ paths. Windows SSH commands are executed through PowerShell.
98
+
99
+ ```powershell
100
+ git-ssh-sync init myproject `
101
+ --origin git@github.com:example/myproject.git `
102
+ --dev-host devserver `
103
+ --dev-user user `
104
+ --dev-os windows `
105
+ --dev-path C:\Users\user\work\myproject
106
+ ```
107
+
95
108
  For `--origin`, specify a remote URL that can be used with `git clone` or `git fetch`. Main formats are:
96
109
 
97
110
  ```text
@@ -128,6 +141,7 @@ git-ssh-sync config show myproject
128
141
  git-ssh-sync config set myproject \
129
142
  --origin git@github.com:example/myproject.git \
130
143
  --dev-host devserver \
144
+ --dev-os posix \
131
145
  --dev-path /home/user/work/myproject
132
146
 
133
147
  # Remove a project after confirmation
@@ -161,6 +175,54 @@ Afterward, the work repository on the development environment can be used as a n
161
175
 
162
176
  `doctor` checks the local environment, SSH connection, fetch/push permissions to origin, and repository deployment on the development environment. Run this not only for the first time but also when synchronization is not working properly.
163
177
 
178
+ ## Attaching Existing Repositories
179
+
180
+ If the gateway repository, development work repository, or cache repository already
181
+ exists, use `attach` instead of `clone`.
182
+
183
+ ```bash
184
+ git-ssh-sync init myproject \
185
+ --origin git@github.com:example/myproject.git \
186
+ --dev-host devserver \
187
+ --dev-user user \
188
+ --dev-path /home/user/work/myproject
189
+ git-ssh-sync attach myproject --dry-run
190
+ git-ssh-sync attach myproject
191
+ git-ssh-sync doctor myproject
192
+ ```
193
+
194
+ `attach` inspects the configured origin URL, current branch, development work
195
+ tree state, bare cache repository, and `gitsync` remote. Before changing
196
+ anything, it prints the operations it will apply. Use `--yes` for non-interactive
197
+ execution after reviewing the plan.
198
+
199
+ ```bash
200
+ git-ssh-sync attach myproject --yes
201
+ ```
202
+
203
+ If only the `gitsync` remote or cache wiring is missing or mismatched, run
204
+ `doctor --repair` to inspect and repair it through the same preflight checks.
205
+
206
+ ```bash
207
+ git-ssh-sync doctor myproject --repair
208
+ git-ssh-sync doctor myproject --repair --yes
209
+ ```
210
+
211
+ After an interrupted `pull` or `push`, use `recover` as the recovery-oriented
212
+ entry point. Without `--yes`, it diagnoses origin, gateway, cache, and work
213
+ repository state and prints concrete next actions. With `--yes`, it applies only
214
+ safe wiring repairs such as creating the cache repository, seeding the cache
215
+ branch, or fixing the `gitsync` remote.
216
+
217
+ ```bash
218
+ git-ssh-sync recover myproject
219
+ git-ssh-sync recover myproject --yes
220
+ ```
221
+
222
+ `attach` and `doctor --repair` do not commit, stash, merge, or rebase existing
223
+ work. If the development work tree is dirty, or if a path is not a compatible Git
224
+ repository, the command stops and prints the manual recovery action.
225
+
164
226
  ## Daily Development Workflow
165
227
 
166
228
  For daily development, `pull` from the local machine before starting work, commit normally in the development environment, and finally `push` from the local machine.
@@ -188,6 +250,13 @@ git-ssh-sync push myproject
188
250
 
189
251
  `pull` and `push` target the current branch of the work repository on the development environment. To synchronize a different branch, switch the work repository branch with `checkout` first.
190
252
 
253
+ Use `--dry-run` to inspect the planned operations and preflight checks before changing refs:
254
+
255
+ ```bash
256
+ git-ssh-sync pull myproject --dry-run
257
+ git-ssh-sync push myproject --dry-run
258
+ ```
259
+
191
260
  ## Branch Switching Workflow
192
261
 
193
262
  To switch to an existing branch, execute `checkout` from the local machine.
@@ -204,6 +273,13 @@ To create a new branch, use `-b`. Use `--base` together to explicitly specify th
204
273
  git-ssh-sync checkout myproject -b feature/foo --base develop
205
274
  ```
206
275
 
276
+ To preview a branch switch or branch creation without changing origin, cache, or work repo refs:
277
+
278
+ ```bash
279
+ git-ssh-sync checkout myproject feature/foo --dry-run
280
+ git-ssh-sync checkout myproject -b feature/foo --base develop --dry-run
281
+ ```
282
+
207
283
  Development environment:
208
284
 
209
285
  ```bash
@@ -237,6 +313,20 @@ To list existence status and ahead/behind for each branch, use `branch`.
237
313
  git-ssh-sync branch myproject
238
314
  ```
239
315
 
316
+ To inspect the development work repo directly from the local machine, use the
317
+ read-only `dev` commands.
318
+
319
+ ```bash
320
+ git-ssh-sync dev status myproject
321
+ git-ssh-sync dev diff myproject
322
+ git-ssh-sync dev diff myproject --stat
323
+ git-ssh-sync dev log myproject --max-count 5
324
+ ```
325
+
326
+ These commands run `git status`, `git diff`, or `git log` on the development
327
+ work repo over SSH. They do not update origin, the local gateway repo, the
328
+ development cache repo, or the development work repo refs.
329
+
240
330
  ## Operational Rules
241
331
 
242
332
  When using `git-ssh-sync`, following these rules makes it easier to understand the state:
@@ -283,6 +373,12 @@ git-ssh-sync status myproject
283
373
  # Check branch status
284
374
  git-ssh-sync branch myproject
285
375
 
376
+ # Inspect development work repo status
377
+ git-ssh-sync dev status myproject
378
+
379
+ # Inspect development work repo diff
380
+ git-ssh-sync dev diff myproject --stat
381
+
286
382
  # Reflect changes from origin to development environment
287
383
  git-ssh-sync pull myproject
288
384
 
@@ -297,8 +393,61 @@ git-ssh-sync checkout myproject -b feature/foo --base develop
297
393
 
298
394
  # Diagnostics
299
395
  git-ssh-sync doctor myproject
396
+
397
+ # Diagnose and optionally repair after an interrupted sync
398
+ git-ssh-sync recover myproject
399
+ git-ssh-sync recover myproject --yes
300
400
  ```
301
401
 
402
+ ## Logging
403
+
404
+ `git-ssh-sync` supports detailed logging for troubleshooting and monitoring synchronization operations.
405
+
406
+ ### Log Levels
407
+
408
+ By default, only warnings and errors are displayed. You can increase verbosity using the following options:
409
+
410
+ - `--verbose`, `-v`: Enable INFO level logging (operation progress, Git/SSH commands)
411
+ - `--debug`, `-d`: Enable DEBUG level logging (all debug information, command output, stack traces)
412
+
413
+ ### Log File Output
414
+
415
+ Logs are automatically saved to `~/.cache/git-ssh-sync/logs/git-ssh-sync.log`. The log file contains all log levels (DEBUG and above) regardless of console output settings.
416
+
417
+ You can specify a custom log file path using `--log-file`:
418
+
419
+ ```bash
420
+ git-ssh-sync pull myproject --log-file /tmp/my-sync.log
421
+ ```
422
+
423
+ ### Usage Examples
424
+
425
+ ```bash
426
+ # Default (warnings and errors only)
427
+ git-ssh-sync pull myproject
428
+
429
+ # Verbose output (operation progress)
430
+ git-ssh-sync pull myproject --verbose
431
+
432
+ # Debug output (all details including command execution)
433
+ git-ssh-sync pull myproject --debug
434
+
435
+ # Verbose with custom log file
436
+ git-ssh-sync push myproject --verbose --log-file /tmp/sync.log
437
+
438
+ # Debug output for diagnostics
439
+ git-ssh-sync doctor myproject --debug
440
+ ```
441
+
442
+ ### Log Content
443
+
444
+ - **INFO**: Operation progress (pull/push/checkout), success messages
445
+ - **DEBUG**: Git/SSH commands executed, return codes, stdout/stderr, working directories
446
+ - **WARNING**: Recoverable issues (LFS, submodules detected)
447
+ - **ERROR**: Failures, execution errors
448
+
449
+ Logs are particularly useful when troubleshooting SSH connection issues, Git command failures, or understanding the synchronization flow.
450
+
302
451
  ## For Developers
303
452
 
304
453
  To develop this repository itself, install dependencies using `uv sync`.
@@ -79,8 +79,21 @@ Key parameters:
79
79
  - `--origin`: Repository URL on the GitHub / GitLab side
80
80
  - `--dev-host`: SSH host of the development environment
81
81
  - `--dev-user`: SSH user of the development environment
82
+ - `--dev-os`: Development environment OS, either `posix` or `windows` (default: `posix`)
82
83
  - `--dev-path`: Path to the work repository on the development environment
83
84
 
85
+ For a Windows development environment, specify `--dev-os windows` and use Windows
86
+ paths. Windows SSH commands are executed through PowerShell.
87
+
88
+ ```powershell
89
+ git-ssh-sync init myproject `
90
+ --origin git@github.com:example/myproject.git `
91
+ --dev-host devserver `
92
+ --dev-user user `
93
+ --dev-os windows `
94
+ --dev-path C:\Users\user\work\myproject
95
+ ```
96
+
84
97
  For `--origin`, specify a remote URL that can be used with `git clone` or `git fetch`. Main formats are:
85
98
 
86
99
  ```text
@@ -117,6 +130,7 @@ git-ssh-sync config show myproject
117
130
  git-ssh-sync config set myproject \
118
131
  --origin git@github.com:example/myproject.git \
119
132
  --dev-host devserver \
133
+ --dev-os posix \
120
134
  --dev-path /home/user/work/myproject
121
135
 
122
136
  # Remove a project after confirmation
@@ -150,6 +164,54 @@ Afterward, the work repository on the development environment can be used as a n
150
164
 
151
165
  `doctor` checks the local environment, SSH connection, fetch/push permissions to origin, and repository deployment on the development environment. Run this not only for the first time but also when synchronization is not working properly.
152
166
 
167
+ ## Attaching Existing Repositories
168
+
169
+ If the gateway repository, development work repository, or cache repository already
170
+ exists, use `attach` instead of `clone`.
171
+
172
+ ```bash
173
+ git-ssh-sync init myproject \
174
+ --origin git@github.com:example/myproject.git \
175
+ --dev-host devserver \
176
+ --dev-user user \
177
+ --dev-path /home/user/work/myproject
178
+ git-ssh-sync attach myproject --dry-run
179
+ git-ssh-sync attach myproject
180
+ git-ssh-sync doctor myproject
181
+ ```
182
+
183
+ `attach` inspects the configured origin URL, current branch, development work
184
+ tree state, bare cache repository, and `gitsync` remote. Before changing
185
+ anything, it prints the operations it will apply. Use `--yes` for non-interactive
186
+ execution after reviewing the plan.
187
+
188
+ ```bash
189
+ git-ssh-sync attach myproject --yes
190
+ ```
191
+
192
+ If only the `gitsync` remote or cache wiring is missing or mismatched, run
193
+ `doctor --repair` to inspect and repair it through the same preflight checks.
194
+
195
+ ```bash
196
+ git-ssh-sync doctor myproject --repair
197
+ git-ssh-sync doctor myproject --repair --yes
198
+ ```
199
+
200
+ After an interrupted `pull` or `push`, use `recover` as the recovery-oriented
201
+ entry point. Without `--yes`, it diagnoses origin, gateway, cache, and work
202
+ repository state and prints concrete next actions. With `--yes`, it applies only
203
+ safe wiring repairs such as creating the cache repository, seeding the cache
204
+ branch, or fixing the `gitsync` remote.
205
+
206
+ ```bash
207
+ git-ssh-sync recover myproject
208
+ git-ssh-sync recover myproject --yes
209
+ ```
210
+
211
+ `attach` and `doctor --repair` do not commit, stash, merge, or rebase existing
212
+ work. If the development work tree is dirty, or if a path is not a compatible Git
213
+ repository, the command stops and prints the manual recovery action.
214
+
153
215
  ## Daily Development Workflow
154
216
 
155
217
  For daily development, `pull` from the local machine before starting work, commit normally in the development environment, and finally `push` from the local machine.
@@ -177,6 +239,13 @@ git-ssh-sync push myproject
177
239
 
178
240
  `pull` and `push` target the current branch of the work repository on the development environment. To synchronize a different branch, switch the work repository branch with `checkout` first.
179
241
 
242
+ Use `--dry-run` to inspect the planned operations and preflight checks before changing refs:
243
+
244
+ ```bash
245
+ git-ssh-sync pull myproject --dry-run
246
+ git-ssh-sync push myproject --dry-run
247
+ ```
248
+
180
249
  ## Branch Switching Workflow
181
250
 
182
251
  To switch to an existing branch, execute `checkout` from the local machine.
@@ -193,6 +262,13 @@ To create a new branch, use `-b`. Use `--base` together to explicitly specify th
193
262
  git-ssh-sync checkout myproject -b feature/foo --base develop
194
263
  ```
195
264
 
265
+ To preview a branch switch or branch creation without changing origin, cache, or work repo refs:
266
+
267
+ ```bash
268
+ git-ssh-sync checkout myproject feature/foo --dry-run
269
+ git-ssh-sync checkout myproject -b feature/foo --base develop --dry-run
270
+ ```
271
+
196
272
  Development environment:
197
273
 
198
274
  ```bash
@@ -226,6 +302,20 @@ To list existence status and ahead/behind for each branch, use `branch`.
226
302
  git-ssh-sync branch myproject
227
303
  ```
228
304
 
305
+ To inspect the development work repo directly from the local machine, use the
306
+ read-only `dev` commands.
307
+
308
+ ```bash
309
+ git-ssh-sync dev status myproject
310
+ git-ssh-sync dev diff myproject
311
+ git-ssh-sync dev diff myproject --stat
312
+ git-ssh-sync dev log myproject --max-count 5
313
+ ```
314
+
315
+ These commands run `git status`, `git diff`, or `git log` on the development
316
+ work repo over SSH. They do not update origin, the local gateway repo, the
317
+ development cache repo, or the development work repo refs.
318
+
229
319
  ## Operational Rules
230
320
 
231
321
  When using `git-ssh-sync`, following these rules makes it easier to understand the state:
@@ -272,6 +362,12 @@ git-ssh-sync status myproject
272
362
  # Check branch status
273
363
  git-ssh-sync branch myproject
274
364
 
365
+ # Inspect development work repo status
366
+ git-ssh-sync dev status myproject
367
+
368
+ # Inspect development work repo diff
369
+ git-ssh-sync dev diff myproject --stat
370
+
275
371
  # Reflect changes from origin to development environment
276
372
  git-ssh-sync pull myproject
277
373
 
@@ -286,8 +382,61 @@ git-ssh-sync checkout myproject -b feature/foo --base develop
286
382
 
287
383
  # Diagnostics
288
384
  git-ssh-sync doctor myproject
385
+
386
+ # Diagnose and optionally repair after an interrupted sync
387
+ git-ssh-sync recover myproject
388
+ git-ssh-sync recover myproject --yes
289
389
  ```
290
390
 
391
+ ## Logging
392
+
393
+ `git-ssh-sync` supports detailed logging for troubleshooting and monitoring synchronization operations.
394
+
395
+ ### Log Levels
396
+
397
+ By default, only warnings and errors are displayed. You can increase verbosity using the following options:
398
+
399
+ - `--verbose`, `-v`: Enable INFO level logging (operation progress, Git/SSH commands)
400
+ - `--debug`, `-d`: Enable DEBUG level logging (all debug information, command output, stack traces)
401
+
402
+ ### Log File Output
403
+
404
+ Logs are automatically saved to `~/.cache/git-ssh-sync/logs/git-ssh-sync.log`. The log file contains all log levels (DEBUG and above) regardless of console output settings.
405
+
406
+ You can specify a custom log file path using `--log-file`:
407
+
408
+ ```bash
409
+ git-ssh-sync pull myproject --log-file /tmp/my-sync.log
410
+ ```
411
+
412
+ ### Usage Examples
413
+
414
+ ```bash
415
+ # Default (warnings and errors only)
416
+ git-ssh-sync pull myproject
417
+
418
+ # Verbose output (operation progress)
419
+ git-ssh-sync pull myproject --verbose
420
+
421
+ # Debug output (all details including command execution)
422
+ git-ssh-sync pull myproject --debug
423
+
424
+ # Verbose with custom log file
425
+ git-ssh-sync push myproject --verbose --log-file /tmp/sync.log
426
+
427
+ # Debug output for diagnostics
428
+ git-ssh-sync doctor myproject --debug
429
+ ```
430
+
431
+ ### Log Content
432
+
433
+ - **INFO**: Operation progress (pull/push/checkout), success messages
434
+ - **DEBUG**: Git/SSH commands executed, return codes, stdout/stderr, working directories
435
+ - **WARNING**: Recoverable issues (LFS, submodules detected)
436
+ - **ERROR**: Failures, execution errors
437
+
438
+ Logs are particularly useful when troubleshooting SSH connection issues, Git command failures, or understanding the synchronization flow.
439
+
291
440
  ## For Developers
292
441
 
293
442
  To develop this repository itself, install dependencies using `uv sync`.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "git-ssh-sync"
3
- version = "0.2.0"
3
+ version = "0.3.0"
4
4
  description = "Sync Git commits through a local machine for development environments without direct GitHub or GitLab access."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,3 +1,3 @@
1
1
  """git-ssh-sync package."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.3.0"