itcpr 2.0.9__tar.gz → 2.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.
- {itcpr-2.0.9/itcpr.egg-info → itcpr-2.1.0}/PKG-INFO +78 -57
- {itcpr-2.0.9 → itcpr-2.1.0}/README.md +77 -56
- itcpr-2.1.0/itcpr/__init__.py +4 -0
- {itcpr-2.0.9 → itcpr-2.1.0}/itcpr/auth.py +1 -1
- {itcpr-2.0.9 → itcpr-2.1.0}/itcpr/cli.py +2 -2
- {itcpr-2.0.9 → itcpr-2.1.0}/itcpr/config.py +1 -1
- {itcpr-2.0.9 → itcpr-2.1.0/itcpr.egg-info}/PKG-INFO +78 -57
- {itcpr-2.0.9 → itcpr-2.1.0}/pyproject.toml +1 -1
- {itcpr-2.0.9 → itcpr-2.1.0}/setup.py +1 -1
- itcpr-2.0.9/itcpr/__init__.py +0 -4
- {itcpr-2.0.9 → itcpr-2.1.0}/LICENSE +0 -0
- {itcpr-2.0.9 → itcpr-2.1.0}/MANIFEST.in +0 -0
- {itcpr-2.0.9 → itcpr-2.1.0}/itcpr/api.py +0 -0
- {itcpr-2.0.9 → itcpr-2.1.0}/itcpr/gitops.py +0 -0
- {itcpr-2.0.9 → itcpr-2.1.0}/itcpr/storage.py +0 -0
- {itcpr-2.0.9 → itcpr-2.1.0}/itcpr/sync.py +0 -0
- {itcpr-2.0.9 → itcpr-2.1.0}/itcpr/utils.py +0 -0
- {itcpr-2.0.9 → itcpr-2.1.0}/itcpr.egg-info/SOURCES.txt +0 -0
- {itcpr-2.0.9 → itcpr-2.1.0}/itcpr.egg-info/dependency_links.txt +0 -0
- {itcpr-2.0.9 → itcpr-2.1.0}/itcpr.egg-info/entry_points.txt +0 -0
- {itcpr-2.0.9 → itcpr-2.1.0}/itcpr.egg-info/requires.txt +0 -0
- {itcpr-2.0.9 → itcpr-2.1.0}/itcpr.egg-info/top_level.txt +0 -0
- {itcpr-2.0.9 → itcpr-2.1.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: itcpr
|
|
3
|
-
Version: 2.0
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: CLI tool for syncing GitHub repositories from ITCPR Cloud
|
|
5
5
|
Home-page: https://itcpr.org
|
|
6
6
|
Author: ITCPR
|
|
@@ -32,9 +32,9 @@ Dynamic: home-page
|
|
|
32
32
|
Dynamic: license-file
|
|
33
33
|
Dynamic: requires-python
|
|
34
34
|
|
|
35
|
-
# ITCPR CLI
|
|
35
|
+
# ITCPR Cloud CLI
|
|
36
36
|
|
|
37
|
-
A
|
|
37
|
+
A command-line tool for syncing GitHub repositories from ITCPR Cloud to your local machine. Manage your repositories with secure device-based authentication and automated synchronization.
|
|
38
38
|
|
|
39
39
|
## Features
|
|
40
40
|
|
|
@@ -51,26 +51,22 @@ A production-ready CLI tool for syncing GitHub repositories from ITCPR Cloud to
|
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
53
|
pip install itcpr
|
|
54
|
-
# OR
|
|
55
|
-
pip3 install itcpr
|
|
56
|
-
# OR
|
|
57
|
-
python3 -m pip install itcpr
|
|
58
54
|
```
|
|
59
55
|
|
|
56
|
+
Or use `pip3` or `python3 -m pip` if needed.
|
|
57
|
+
|
|
60
58
|
### From Source
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
To install from source for development or contribution:
|
|
63
61
|
|
|
64
62
|
```bash
|
|
65
|
-
git clone
|
|
63
|
+
git clone https://github.com/ITCPR/cloud-cli
|
|
66
64
|
cd cloud-cli
|
|
67
65
|
pip install -e .
|
|
68
|
-
# OR
|
|
69
|
-
pip3 install -e .
|
|
70
|
-
# OR
|
|
71
|
-
python3 -m pip install -e .
|
|
72
66
|
```
|
|
73
67
|
|
|
68
|
+
Or use `pip3` or `python3 -m pip` if needed.
|
|
69
|
+
|
|
74
70
|
### Uninstall
|
|
75
71
|
|
|
76
72
|
To remove the CLI tool:
|
|
@@ -89,15 +85,11 @@ To completely remove all data:
|
|
|
89
85
|
```bash
|
|
90
86
|
# Uninstall the package
|
|
91
87
|
pip uninstall itcpr
|
|
92
|
-
# OR
|
|
93
|
-
pip3 uninstall itcpr
|
|
94
|
-
# OR
|
|
95
|
-
python3 -m pip uninstall itcpr
|
|
96
88
|
|
|
97
89
|
# Remove configuration and data
|
|
98
90
|
rm -rf ~/.itcpr
|
|
99
91
|
|
|
100
|
-
# Remove stored tokens
|
|
92
|
+
# Remove stored tokens from OS keyring
|
|
101
93
|
# On macOS: Use Keychain Access app to remove "itcpr" entries
|
|
102
94
|
# On Linux: Use your keyring manager (e.g., seahorse, kwallet)
|
|
103
95
|
# On Windows: Use Credential Manager
|
|
@@ -109,6 +101,16 @@ rm -rf ~/.itcpr
|
|
|
109
101
|
- Git (system installation)
|
|
110
102
|
- Access to api.itcpr.org (API) and cloud.itcpr.org (frontend)
|
|
111
103
|
|
|
104
|
+
## Prerequisites
|
|
105
|
+
|
|
106
|
+
**Important:** Before using the CLI, you must:
|
|
107
|
+
|
|
108
|
+
1. Visit [cloud.itcpr.org](https://cloud.itcpr.org)
|
|
109
|
+
2. Connect your GitHub account
|
|
110
|
+
3. Ensure your repositories are assigned to your device
|
|
111
|
+
|
|
112
|
+
Once your GitHub account is connected and repositories are assigned, you can proceed with the CLI login.
|
|
113
|
+
|
|
112
114
|
## Quick Start
|
|
113
115
|
|
|
114
116
|
### 1. Login
|
|
@@ -119,6 +121,8 @@ Authenticate your device with ITCPR Cloud:
|
|
|
119
121
|
itcpr login
|
|
120
122
|
```
|
|
121
123
|
|
|
124
|
+
**Note:** Make sure you've connected your GitHub account at [cloud.itcpr.org](https://cloud.itcpr.org) before logging in.
|
|
125
|
+
|
|
122
126
|
This will:
|
|
123
127
|
- Open your browser to the device login page
|
|
124
128
|
- Display a device code
|
|
@@ -187,7 +191,9 @@ itcpr logout
|
|
|
187
191
|
|
|
188
192
|
### `itcpr login`
|
|
189
193
|
|
|
190
|
-
Starts device authentication flow. Opens browser to `cloud.itcpr.org/device` and polls the API
|
|
194
|
+
Starts the device authentication flow. Opens your browser to the device login page at `cloud.itcpr.org/device` and polls the API for approval.
|
|
195
|
+
|
|
196
|
+
**Prerequisite:** Ensure your GitHub account is connected at [cloud.itcpr.org](https://cloud.itcpr.org) before logging in.
|
|
191
197
|
|
|
192
198
|
### `itcpr logout`
|
|
193
199
|
|
|
@@ -214,13 +220,13 @@ Options:
|
|
|
214
220
|
|
|
215
221
|
### `itcpr sync`
|
|
216
222
|
|
|
217
|
-
|
|
223
|
+
Synchronizes all cloned repositories. By default, performs a one-time sync.
|
|
218
224
|
|
|
219
|
-
Options
|
|
220
|
-
- `--watch, -w`: Run continuous sync loop
|
|
225
|
+
**Options:**
|
|
226
|
+
- `--watch, -w`: Run continuous sync loop (watches for changes)
|
|
221
227
|
- `--interval, -i`: Sync interval in seconds (watch mode only, default: 60)
|
|
222
228
|
|
|
223
|
-
**
|
|
229
|
+
**Per-Repository Configuration (itcpr.yml):**
|
|
224
230
|
|
|
225
231
|
You can configure per-repository sync behavior by creating an `itcpr.yml` file in the repository root:
|
|
226
232
|
|
|
@@ -235,24 +241,32 @@ sync:
|
|
|
235
241
|
- "temp/"
|
|
236
242
|
```
|
|
237
243
|
|
|
238
|
-
**Note:** To use `itcpr.yml
|
|
244
|
+
**Note:** To use `itcpr.yml` configuration files, install the optional YAML dependency:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
pip install itcpr[yaml]
|
|
248
|
+
# OR
|
|
249
|
+
pip install PyYAML
|
|
250
|
+
```
|
|
239
251
|
|
|
240
252
|
## How It Works
|
|
241
253
|
|
|
242
|
-
### Authentication
|
|
254
|
+
### Authentication Flow
|
|
243
255
|
|
|
244
|
-
1. Device requests authentication code from backend
|
|
245
|
-
2. User approves device in browser at `cloud.itcpr.org/device`
|
|
256
|
+
1. Device requests an authentication code from the backend
|
|
257
|
+
2. User approves the device in browser at `cloud.itcpr.org/device`
|
|
246
258
|
3. Device token is stored securely in OS keyring
|
|
247
|
-
4. Token is used for all API requests
|
|
259
|
+
4. Token is used for all subsequent API requests
|
|
260
|
+
|
|
261
|
+
### Repository Synchronization
|
|
248
262
|
|
|
249
|
-
|
|
263
|
+
The sync process follows these steps:
|
|
250
264
|
|
|
251
|
-
1. Fetches latest changes from remote
|
|
265
|
+
1. Fetches latest changes from the remote repository
|
|
252
266
|
2. Detects uncommitted local changes
|
|
253
|
-
3.
|
|
267
|
+
3. Automatically commits local changes (if enabled)
|
|
254
268
|
4. Pulls remote changes with rebase
|
|
255
|
-
5. Pushes local commits if permitted
|
|
269
|
+
5. Pushes local commits (if enabled and permitted)
|
|
256
270
|
6. Aborts on merge conflicts (requires manual resolution)
|
|
257
271
|
|
|
258
272
|
### Security
|
|
@@ -266,9 +280,10 @@ sync:
|
|
|
266
280
|
|
|
267
281
|
### Global Configuration
|
|
268
282
|
|
|
269
|
-
|
|
283
|
+
The CLI stores configuration and data in `~/.itcpr/`:
|
|
270
284
|
|
|
271
|
-
|
|
285
|
+
- **Configuration**: `~/.itcpr/config.toml` - Global settings
|
|
286
|
+
- **Repository Database**: `~/.itcpr/repos.db` - SQLite database for repository metadata
|
|
272
287
|
|
|
273
288
|
### Per-Repository Configuration (itcpr.yml)
|
|
274
289
|
|
|
@@ -297,22 +312,18 @@ sync:
|
|
|
297
312
|
enabled: false
|
|
298
313
|
```
|
|
299
314
|
|
|
300
|
-
|
|
301
|
-
```bash
|
|
302
|
-
pip install itcpr[yaml]
|
|
303
|
-
# OR
|
|
304
|
-
pip install PyYAML
|
|
305
|
-
```
|
|
315
|
+
## Development & Mock Mode
|
|
306
316
|
|
|
307
|
-
|
|
317
|
+
The CLI includes a built-in mock mode for testing and development when the API is unavailable.
|
|
308
318
|
|
|
309
|
-
|
|
319
|
+
### Automatic Mock Mode
|
|
310
320
|
|
|
311
|
-
|
|
321
|
+
When the API at `api.itcpr.org` is unavailable, the CLI automatically falls back to mock API responses:
|
|
312
322
|
- If the backend returns 404 or is unreachable, mock responses are used automatically
|
|
313
323
|
- You'll see a warning: "⚠️ Backend unavailable, using mock mode for testing"
|
|
314
324
|
|
|
315
|
-
|
|
325
|
+
### Manual Mock Mode
|
|
326
|
+
|
|
316
327
|
You can also enable mock mode explicitly:
|
|
317
328
|
|
|
318
329
|
```bash
|
|
@@ -328,35 +339,43 @@ itcpr login
|
|
|
328
339
|
- Auto-approves device login after 2 seconds
|
|
329
340
|
- Provides sample user and repository data
|
|
330
341
|
- Generates mock GitHub tokens
|
|
331
|
-
- All commands work in mock mode for testing
|
|
342
|
+
- All commands work in mock mode for testing purposes
|
|
332
343
|
|
|
333
344
|
## Troubleshooting
|
|
334
345
|
|
|
335
346
|
### "Not logged in" error
|
|
336
347
|
|
|
337
|
-
Run `itcpr login` to authenticate your device. If the backend is unavailable, mock mode will activate automatically.
|
|
348
|
+
Run `itcpr login` to authenticate your device. Make sure you've connected your GitHub account at [cloud.itcpr.org](https://cloud.itcpr.org) first. If the backend is unavailable, mock mode will activate automatically for testing.
|
|
338
349
|
|
|
339
350
|
### "Repository not assigned" error
|
|
340
351
|
|
|
341
|
-
The repository must be assigned to your device in ITCPR Cloud.
|
|
352
|
+
The repository must be assigned to your device in ITCPR Cloud. Make sure you've:
|
|
353
|
+
1. Connected your GitHub account at [cloud.itcpr.org](https://cloud.itcpr.org)
|
|
354
|
+
2. Assigned the repository to your device in the ITCPR Cloud dashboard
|
|
342
355
|
|
|
343
|
-
|
|
356
|
+
If the issue persists, contact an administrator.
|
|
357
|
+
|
|
358
|
+
### Merge Conflicts
|
|
344
359
|
|
|
345
360
|
If a merge conflict is detected during sync:
|
|
346
361
|
1. Resolve conflicts manually in the repository
|
|
347
362
|
2. Commit the resolution
|
|
348
363
|
3. Run `itcpr sync` again
|
|
349
364
|
|
|
350
|
-
### Git
|
|
365
|
+
### Git Command Not Found
|
|
351
366
|
|
|
352
367
|
Ensure Git is installed and available in your PATH:
|
|
368
|
+
|
|
353
369
|
```bash
|
|
354
370
|
git --version
|
|
355
371
|
```
|
|
356
372
|
|
|
357
|
-
|
|
373
|
+
If Git is not installed, install it using your system's package manager.
|
|
374
|
+
|
|
375
|
+
### Token Storage Issues
|
|
358
376
|
|
|
359
377
|
On Linux, you may need to install a keyring backend:
|
|
378
|
+
|
|
360
379
|
```bash
|
|
361
380
|
# For GNOME
|
|
362
381
|
sudo apt-get install python3-keyring
|
|
@@ -365,6 +384,8 @@ sudo apt-get install python3-keyring
|
|
|
365
384
|
sudo apt-get install python3-keyring kdewallet
|
|
366
385
|
```
|
|
367
386
|
|
|
387
|
+
On macOS and Windows, the keyring should work out of the box.
|
|
388
|
+
|
|
368
389
|
## Development
|
|
369
390
|
|
|
370
391
|
### Project Structure
|
|
@@ -386,20 +407,20 @@ cloud-cli/
|
|
|
386
407
|
└── README.md # This file
|
|
387
408
|
```
|
|
388
409
|
|
|
389
|
-
###
|
|
410
|
+
### Development Setup
|
|
390
411
|
|
|
391
412
|
```bash
|
|
392
413
|
# Install in development mode
|
|
393
414
|
pip install -e .
|
|
394
|
-
# OR
|
|
395
|
-
pip3 install -e .
|
|
396
|
-
# OR
|
|
397
|
-
python3 -m pip install -e .
|
|
398
415
|
|
|
399
416
|
# Run CLI
|
|
400
417
|
itcpr --help
|
|
401
418
|
```
|
|
402
419
|
|
|
420
|
+
### Contributing
|
|
421
|
+
|
|
422
|
+
Contributions are welcome! Please ensure your code follows the project's style guidelines and includes appropriate tests.
|
|
423
|
+
|
|
403
424
|
## API Endpoints
|
|
404
425
|
|
|
405
426
|
The CLI communicates with these backend endpoints:
|
|
@@ -413,9 +434,9 @@ The CLI communicates with these backend endpoints:
|
|
|
413
434
|
|
|
414
435
|
## License
|
|
415
436
|
|
|
416
|
-
MIT License
|
|
437
|
+
MIT License - see LICENSE file for details.
|
|
417
438
|
|
|
418
439
|
## Support
|
|
419
440
|
|
|
420
|
-
For issues
|
|
441
|
+
For issues, questions, or feature requests, please contact ITCPR support or open an issue on GitHub.
|
|
421
442
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# ITCPR CLI
|
|
1
|
+
# ITCPR Cloud CLI
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A command-line tool for syncing GitHub repositories from ITCPR Cloud to your local machine. Manage your repositories with secure device-based authentication and automated synchronization.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -17,26 +17,22 @@ A production-ready CLI tool for syncing GitHub repositories from ITCPR Cloud to
|
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
19
|
pip install itcpr
|
|
20
|
-
# OR
|
|
21
|
-
pip3 install itcpr
|
|
22
|
-
# OR
|
|
23
|
-
python3 -m pip install itcpr
|
|
24
20
|
```
|
|
25
21
|
|
|
22
|
+
Or use `pip3` or `python3 -m pip` if needed.
|
|
23
|
+
|
|
26
24
|
### From Source
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
To install from source for development or contribution:
|
|
29
27
|
|
|
30
28
|
```bash
|
|
31
|
-
git clone
|
|
29
|
+
git clone https://github.com/ITCPR/cloud-cli
|
|
32
30
|
cd cloud-cli
|
|
33
31
|
pip install -e .
|
|
34
|
-
# OR
|
|
35
|
-
pip3 install -e .
|
|
36
|
-
# OR
|
|
37
|
-
python3 -m pip install -e .
|
|
38
32
|
```
|
|
39
33
|
|
|
34
|
+
Or use `pip3` or `python3 -m pip` if needed.
|
|
35
|
+
|
|
40
36
|
### Uninstall
|
|
41
37
|
|
|
42
38
|
To remove the CLI tool:
|
|
@@ -55,15 +51,11 @@ To completely remove all data:
|
|
|
55
51
|
```bash
|
|
56
52
|
# Uninstall the package
|
|
57
53
|
pip uninstall itcpr
|
|
58
|
-
# OR
|
|
59
|
-
pip3 uninstall itcpr
|
|
60
|
-
# OR
|
|
61
|
-
python3 -m pip uninstall itcpr
|
|
62
54
|
|
|
63
55
|
# Remove configuration and data
|
|
64
56
|
rm -rf ~/.itcpr
|
|
65
57
|
|
|
66
|
-
# Remove stored tokens
|
|
58
|
+
# Remove stored tokens from OS keyring
|
|
67
59
|
# On macOS: Use Keychain Access app to remove "itcpr" entries
|
|
68
60
|
# On Linux: Use your keyring manager (e.g., seahorse, kwallet)
|
|
69
61
|
# On Windows: Use Credential Manager
|
|
@@ -75,6 +67,16 @@ rm -rf ~/.itcpr
|
|
|
75
67
|
- Git (system installation)
|
|
76
68
|
- Access to api.itcpr.org (API) and cloud.itcpr.org (frontend)
|
|
77
69
|
|
|
70
|
+
## Prerequisites
|
|
71
|
+
|
|
72
|
+
**Important:** Before using the CLI, you must:
|
|
73
|
+
|
|
74
|
+
1. Visit [cloud.itcpr.org](https://cloud.itcpr.org)
|
|
75
|
+
2. Connect your GitHub account
|
|
76
|
+
3. Ensure your repositories are assigned to your device
|
|
77
|
+
|
|
78
|
+
Once your GitHub account is connected and repositories are assigned, you can proceed with the CLI login.
|
|
79
|
+
|
|
78
80
|
## Quick Start
|
|
79
81
|
|
|
80
82
|
### 1. Login
|
|
@@ -85,6 +87,8 @@ Authenticate your device with ITCPR Cloud:
|
|
|
85
87
|
itcpr login
|
|
86
88
|
```
|
|
87
89
|
|
|
90
|
+
**Note:** Make sure you've connected your GitHub account at [cloud.itcpr.org](https://cloud.itcpr.org) before logging in.
|
|
91
|
+
|
|
88
92
|
This will:
|
|
89
93
|
- Open your browser to the device login page
|
|
90
94
|
- Display a device code
|
|
@@ -153,7 +157,9 @@ itcpr logout
|
|
|
153
157
|
|
|
154
158
|
### `itcpr login`
|
|
155
159
|
|
|
156
|
-
Starts device authentication flow. Opens browser to `cloud.itcpr.org/device` and polls the API
|
|
160
|
+
Starts the device authentication flow. Opens your browser to the device login page at `cloud.itcpr.org/device` and polls the API for approval.
|
|
161
|
+
|
|
162
|
+
**Prerequisite:** Ensure your GitHub account is connected at [cloud.itcpr.org](https://cloud.itcpr.org) before logging in.
|
|
157
163
|
|
|
158
164
|
### `itcpr logout`
|
|
159
165
|
|
|
@@ -180,13 +186,13 @@ Options:
|
|
|
180
186
|
|
|
181
187
|
### `itcpr sync`
|
|
182
188
|
|
|
183
|
-
|
|
189
|
+
Synchronizes all cloned repositories. By default, performs a one-time sync.
|
|
184
190
|
|
|
185
|
-
Options
|
|
186
|
-
- `--watch, -w`: Run continuous sync loop
|
|
191
|
+
**Options:**
|
|
192
|
+
- `--watch, -w`: Run continuous sync loop (watches for changes)
|
|
187
193
|
- `--interval, -i`: Sync interval in seconds (watch mode only, default: 60)
|
|
188
194
|
|
|
189
|
-
**
|
|
195
|
+
**Per-Repository Configuration (itcpr.yml):**
|
|
190
196
|
|
|
191
197
|
You can configure per-repository sync behavior by creating an `itcpr.yml` file in the repository root:
|
|
192
198
|
|
|
@@ -201,24 +207,32 @@ sync:
|
|
|
201
207
|
- "temp/"
|
|
202
208
|
```
|
|
203
209
|
|
|
204
|
-
**Note:** To use `itcpr.yml
|
|
210
|
+
**Note:** To use `itcpr.yml` configuration files, install the optional YAML dependency:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
pip install itcpr[yaml]
|
|
214
|
+
# OR
|
|
215
|
+
pip install PyYAML
|
|
216
|
+
```
|
|
205
217
|
|
|
206
218
|
## How It Works
|
|
207
219
|
|
|
208
|
-
### Authentication
|
|
220
|
+
### Authentication Flow
|
|
209
221
|
|
|
210
|
-
1. Device requests authentication code from backend
|
|
211
|
-
2. User approves device in browser at `cloud.itcpr.org/device`
|
|
222
|
+
1. Device requests an authentication code from the backend
|
|
223
|
+
2. User approves the device in browser at `cloud.itcpr.org/device`
|
|
212
224
|
3. Device token is stored securely in OS keyring
|
|
213
|
-
4. Token is used for all API requests
|
|
225
|
+
4. Token is used for all subsequent API requests
|
|
226
|
+
|
|
227
|
+
### Repository Synchronization
|
|
214
228
|
|
|
215
|
-
|
|
229
|
+
The sync process follows these steps:
|
|
216
230
|
|
|
217
|
-
1. Fetches latest changes from remote
|
|
231
|
+
1. Fetches latest changes from the remote repository
|
|
218
232
|
2. Detects uncommitted local changes
|
|
219
|
-
3.
|
|
233
|
+
3. Automatically commits local changes (if enabled)
|
|
220
234
|
4. Pulls remote changes with rebase
|
|
221
|
-
5. Pushes local commits if permitted
|
|
235
|
+
5. Pushes local commits (if enabled and permitted)
|
|
222
236
|
6. Aborts on merge conflicts (requires manual resolution)
|
|
223
237
|
|
|
224
238
|
### Security
|
|
@@ -232,9 +246,10 @@ sync:
|
|
|
232
246
|
|
|
233
247
|
### Global Configuration
|
|
234
248
|
|
|
235
|
-
|
|
249
|
+
The CLI stores configuration and data in `~/.itcpr/`:
|
|
236
250
|
|
|
237
|
-
|
|
251
|
+
- **Configuration**: `~/.itcpr/config.toml` - Global settings
|
|
252
|
+
- **Repository Database**: `~/.itcpr/repos.db` - SQLite database for repository metadata
|
|
238
253
|
|
|
239
254
|
### Per-Repository Configuration (itcpr.yml)
|
|
240
255
|
|
|
@@ -263,22 +278,18 @@ sync:
|
|
|
263
278
|
enabled: false
|
|
264
279
|
```
|
|
265
280
|
|
|
266
|
-
|
|
267
|
-
```bash
|
|
268
|
-
pip install itcpr[yaml]
|
|
269
|
-
# OR
|
|
270
|
-
pip install PyYAML
|
|
271
|
-
```
|
|
281
|
+
## Development & Mock Mode
|
|
272
282
|
|
|
273
|
-
|
|
283
|
+
The CLI includes a built-in mock mode for testing and development when the API is unavailable.
|
|
274
284
|
|
|
275
|
-
|
|
285
|
+
### Automatic Mock Mode
|
|
276
286
|
|
|
277
|
-
|
|
287
|
+
When the API at `api.itcpr.org` is unavailable, the CLI automatically falls back to mock API responses:
|
|
278
288
|
- If the backend returns 404 or is unreachable, mock responses are used automatically
|
|
279
289
|
- You'll see a warning: "⚠️ Backend unavailable, using mock mode for testing"
|
|
280
290
|
|
|
281
|
-
|
|
291
|
+
### Manual Mock Mode
|
|
292
|
+
|
|
282
293
|
You can also enable mock mode explicitly:
|
|
283
294
|
|
|
284
295
|
```bash
|
|
@@ -294,35 +305,43 @@ itcpr login
|
|
|
294
305
|
- Auto-approves device login after 2 seconds
|
|
295
306
|
- Provides sample user and repository data
|
|
296
307
|
- Generates mock GitHub tokens
|
|
297
|
-
- All commands work in mock mode for testing
|
|
308
|
+
- All commands work in mock mode for testing purposes
|
|
298
309
|
|
|
299
310
|
## Troubleshooting
|
|
300
311
|
|
|
301
312
|
### "Not logged in" error
|
|
302
313
|
|
|
303
|
-
Run `itcpr login` to authenticate your device. If the backend is unavailable, mock mode will activate automatically.
|
|
314
|
+
Run `itcpr login` to authenticate your device. Make sure you've connected your GitHub account at [cloud.itcpr.org](https://cloud.itcpr.org) first. If the backend is unavailable, mock mode will activate automatically for testing.
|
|
304
315
|
|
|
305
316
|
### "Repository not assigned" error
|
|
306
317
|
|
|
307
|
-
The repository must be assigned to your device in ITCPR Cloud.
|
|
318
|
+
The repository must be assigned to your device in ITCPR Cloud. Make sure you've:
|
|
319
|
+
1. Connected your GitHub account at [cloud.itcpr.org](https://cloud.itcpr.org)
|
|
320
|
+
2. Assigned the repository to your device in the ITCPR Cloud dashboard
|
|
308
321
|
|
|
309
|
-
|
|
322
|
+
If the issue persists, contact an administrator.
|
|
323
|
+
|
|
324
|
+
### Merge Conflicts
|
|
310
325
|
|
|
311
326
|
If a merge conflict is detected during sync:
|
|
312
327
|
1. Resolve conflicts manually in the repository
|
|
313
328
|
2. Commit the resolution
|
|
314
329
|
3. Run `itcpr sync` again
|
|
315
330
|
|
|
316
|
-
### Git
|
|
331
|
+
### Git Command Not Found
|
|
317
332
|
|
|
318
333
|
Ensure Git is installed and available in your PATH:
|
|
334
|
+
|
|
319
335
|
```bash
|
|
320
336
|
git --version
|
|
321
337
|
```
|
|
322
338
|
|
|
323
|
-
|
|
339
|
+
If Git is not installed, install it using your system's package manager.
|
|
340
|
+
|
|
341
|
+
### Token Storage Issues
|
|
324
342
|
|
|
325
343
|
On Linux, you may need to install a keyring backend:
|
|
344
|
+
|
|
326
345
|
```bash
|
|
327
346
|
# For GNOME
|
|
328
347
|
sudo apt-get install python3-keyring
|
|
@@ -331,6 +350,8 @@ sudo apt-get install python3-keyring
|
|
|
331
350
|
sudo apt-get install python3-keyring kdewallet
|
|
332
351
|
```
|
|
333
352
|
|
|
353
|
+
On macOS and Windows, the keyring should work out of the box.
|
|
354
|
+
|
|
334
355
|
## Development
|
|
335
356
|
|
|
336
357
|
### Project Structure
|
|
@@ -352,20 +373,20 @@ cloud-cli/
|
|
|
352
373
|
└── README.md # This file
|
|
353
374
|
```
|
|
354
375
|
|
|
355
|
-
###
|
|
376
|
+
### Development Setup
|
|
356
377
|
|
|
357
378
|
```bash
|
|
358
379
|
# Install in development mode
|
|
359
380
|
pip install -e .
|
|
360
|
-
# OR
|
|
361
|
-
pip3 install -e .
|
|
362
|
-
# OR
|
|
363
|
-
python3 -m pip install -e .
|
|
364
381
|
|
|
365
382
|
# Run CLI
|
|
366
383
|
itcpr --help
|
|
367
384
|
```
|
|
368
385
|
|
|
386
|
+
### Contributing
|
|
387
|
+
|
|
388
|
+
Contributions are welcome! Please ensure your code follows the project's style guidelines and includes appropriate tests.
|
|
389
|
+
|
|
369
390
|
## API Endpoints
|
|
370
391
|
|
|
371
392
|
The CLI communicates with these backend endpoints:
|
|
@@ -379,9 +400,9 @@ The CLI communicates with these backend endpoints:
|
|
|
379
400
|
|
|
380
401
|
## License
|
|
381
402
|
|
|
382
|
-
MIT License
|
|
403
|
+
MIT License - see LICENSE file for details.
|
|
383
404
|
|
|
384
405
|
## Support
|
|
385
406
|
|
|
386
|
-
For issues
|
|
407
|
+
For issues, questions, or feature requests, please contact ITCPR support or open an issue on GitHub.
|
|
387
408
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""CLI commands for ITCPR
|
|
1
|
+
"""CLI commands for ITCPR Cloud."""
|
|
2
2
|
|
|
3
3
|
import click
|
|
4
4
|
from pathlib import Path
|
|
@@ -10,7 +10,7 @@ logger = get_logger(__name__)
|
|
|
10
10
|
@click.option("--verbose", "-v", is_flag=True, help="Enable verbose logging")
|
|
11
11
|
@click.pass_context
|
|
12
12
|
def cli(ctx, verbose):
|
|
13
|
-
"""ITCPR
|
|
13
|
+
"""ITCPR Cloud - Sync GitHub repositories to your local machine."""
|
|
14
14
|
ctx.ensure_object(dict)
|
|
15
15
|
ctx.obj["verbose"] = verbose
|
|
16
16
|
setup_logging(verbose)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: itcpr
|
|
3
|
-
Version: 2.0
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: CLI tool for syncing GitHub repositories from ITCPR Cloud
|
|
5
5
|
Home-page: https://itcpr.org
|
|
6
6
|
Author: ITCPR
|
|
@@ -32,9 +32,9 @@ Dynamic: home-page
|
|
|
32
32
|
Dynamic: license-file
|
|
33
33
|
Dynamic: requires-python
|
|
34
34
|
|
|
35
|
-
# ITCPR CLI
|
|
35
|
+
# ITCPR Cloud CLI
|
|
36
36
|
|
|
37
|
-
A
|
|
37
|
+
A command-line tool for syncing GitHub repositories from ITCPR Cloud to your local machine. Manage your repositories with secure device-based authentication and automated synchronization.
|
|
38
38
|
|
|
39
39
|
## Features
|
|
40
40
|
|
|
@@ -51,26 +51,22 @@ A production-ready CLI tool for syncing GitHub repositories from ITCPR Cloud to
|
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
53
|
pip install itcpr
|
|
54
|
-
# OR
|
|
55
|
-
pip3 install itcpr
|
|
56
|
-
# OR
|
|
57
|
-
python3 -m pip install itcpr
|
|
58
54
|
```
|
|
59
55
|
|
|
56
|
+
Or use `pip3` or `python3 -m pip` if needed.
|
|
57
|
+
|
|
60
58
|
### From Source
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
To install from source for development or contribution:
|
|
63
61
|
|
|
64
62
|
```bash
|
|
65
|
-
git clone
|
|
63
|
+
git clone https://github.com/ITCPR/cloud-cli
|
|
66
64
|
cd cloud-cli
|
|
67
65
|
pip install -e .
|
|
68
|
-
# OR
|
|
69
|
-
pip3 install -e .
|
|
70
|
-
# OR
|
|
71
|
-
python3 -m pip install -e .
|
|
72
66
|
```
|
|
73
67
|
|
|
68
|
+
Or use `pip3` or `python3 -m pip` if needed.
|
|
69
|
+
|
|
74
70
|
### Uninstall
|
|
75
71
|
|
|
76
72
|
To remove the CLI tool:
|
|
@@ -89,15 +85,11 @@ To completely remove all data:
|
|
|
89
85
|
```bash
|
|
90
86
|
# Uninstall the package
|
|
91
87
|
pip uninstall itcpr
|
|
92
|
-
# OR
|
|
93
|
-
pip3 uninstall itcpr
|
|
94
|
-
# OR
|
|
95
|
-
python3 -m pip uninstall itcpr
|
|
96
88
|
|
|
97
89
|
# Remove configuration and data
|
|
98
90
|
rm -rf ~/.itcpr
|
|
99
91
|
|
|
100
|
-
# Remove stored tokens
|
|
92
|
+
# Remove stored tokens from OS keyring
|
|
101
93
|
# On macOS: Use Keychain Access app to remove "itcpr" entries
|
|
102
94
|
# On Linux: Use your keyring manager (e.g., seahorse, kwallet)
|
|
103
95
|
# On Windows: Use Credential Manager
|
|
@@ -109,6 +101,16 @@ rm -rf ~/.itcpr
|
|
|
109
101
|
- Git (system installation)
|
|
110
102
|
- Access to api.itcpr.org (API) and cloud.itcpr.org (frontend)
|
|
111
103
|
|
|
104
|
+
## Prerequisites
|
|
105
|
+
|
|
106
|
+
**Important:** Before using the CLI, you must:
|
|
107
|
+
|
|
108
|
+
1. Visit [cloud.itcpr.org](https://cloud.itcpr.org)
|
|
109
|
+
2. Connect your GitHub account
|
|
110
|
+
3. Ensure your repositories are assigned to your device
|
|
111
|
+
|
|
112
|
+
Once your GitHub account is connected and repositories are assigned, you can proceed with the CLI login.
|
|
113
|
+
|
|
112
114
|
## Quick Start
|
|
113
115
|
|
|
114
116
|
### 1. Login
|
|
@@ -119,6 +121,8 @@ Authenticate your device with ITCPR Cloud:
|
|
|
119
121
|
itcpr login
|
|
120
122
|
```
|
|
121
123
|
|
|
124
|
+
**Note:** Make sure you've connected your GitHub account at [cloud.itcpr.org](https://cloud.itcpr.org) before logging in.
|
|
125
|
+
|
|
122
126
|
This will:
|
|
123
127
|
- Open your browser to the device login page
|
|
124
128
|
- Display a device code
|
|
@@ -187,7 +191,9 @@ itcpr logout
|
|
|
187
191
|
|
|
188
192
|
### `itcpr login`
|
|
189
193
|
|
|
190
|
-
Starts device authentication flow. Opens browser to `cloud.itcpr.org/device` and polls the API
|
|
194
|
+
Starts the device authentication flow. Opens your browser to the device login page at `cloud.itcpr.org/device` and polls the API for approval.
|
|
195
|
+
|
|
196
|
+
**Prerequisite:** Ensure your GitHub account is connected at [cloud.itcpr.org](https://cloud.itcpr.org) before logging in.
|
|
191
197
|
|
|
192
198
|
### `itcpr logout`
|
|
193
199
|
|
|
@@ -214,13 +220,13 @@ Options:
|
|
|
214
220
|
|
|
215
221
|
### `itcpr sync`
|
|
216
222
|
|
|
217
|
-
|
|
223
|
+
Synchronizes all cloned repositories. By default, performs a one-time sync.
|
|
218
224
|
|
|
219
|
-
Options
|
|
220
|
-
- `--watch, -w`: Run continuous sync loop
|
|
225
|
+
**Options:**
|
|
226
|
+
- `--watch, -w`: Run continuous sync loop (watches for changes)
|
|
221
227
|
- `--interval, -i`: Sync interval in seconds (watch mode only, default: 60)
|
|
222
228
|
|
|
223
|
-
**
|
|
229
|
+
**Per-Repository Configuration (itcpr.yml):**
|
|
224
230
|
|
|
225
231
|
You can configure per-repository sync behavior by creating an `itcpr.yml` file in the repository root:
|
|
226
232
|
|
|
@@ -235,24 +241,32 @@ sync:
|
|
|
235
241
|
- "temp/"
|
|
236
242
|
```
|
|
237
243
|
|
|
238
|
-
**Note:** To use `itcpr.yml
|
|
244
|
+
**Note:** To use `itcpr.yml` configuration files, install the optional YAML dependency:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
pip install itcpr[yaml]
|
|
248
|
+
# OR
|
|
249
|
+
pip install PyYAML
|
|
250
|
+
```
|
|
239
251
|
|
|
240
252
|
## How It Works
|
|
241
253
|
|
|
242
|
-
### Authentication
|
|
254
|
+
### Authentication Flow
|
|
243
255
|
|
|
244
|
-
1. Device requests authentication code from backend
|
|
245
|
-
2. User approves device in browser at `cloud.itcpr.org/device`
|
|
256
|
+
1. Device requests an authentication code from the backend
|
|
257
|
+
2. User approves the device in browser at `cloud.itcpr.org/device`
|
|
246
258
|
3. Device token is stored securely in OS keyring
|
|
247
|
-
4. Token is used for all API requests
|
|
259
|
+
4. Token is used for all subsequent API requests
|
|
260
|
+
|
|
261
|
+
### Repository Synchronization
|
|
248
262
|
|
|
249
|
-
|
|
263
|
+
The sync process follows these steps:
|
|
250
264
|
|
|
251
|
-
1. Fetches latest changes from remote
|
|
265
|
+
1. Fetches latest changes from the remote repository
|
|
252
266
|
2. Detects uncommitted local changes
|
|
253
|
-
3.
|
|
267
|
+
3. Automatically commits local changes (if enabled)
|
|
254
268
|
4. Pulls remote changes with rebase
|
|
255
|
-
5. Pushes local commits if permitted
|
|
269
|
+
5. Pushes local commits (if enabled and permitted)
|
|
256
270
|
6. Aborts on merge conflicts (requires manual resolution)
|
|
257
271
|
|
|
258
272
|
### Security
|
|
@@ -266,9 +280,10 @@ sync:
|
|
|
266
280
|
|
|
267
281
|
### Global Configuration
|
|
268
282
|
|
|
269
|
-
|
|
283
|
+
The CLI stores configuration and data in `~/.itcpr/`:
|
|
270
284
|
|
|
271
|
-
|
|
285
|
+
- **Configuration**: `~/.itcpr/config.toml` - Global settings
|
|
286
|
+
- **Repository Database**: `~/.itcpr/repos.db` - SQLite database for repository metadata
|
|
272
287
|
|
|
273
288
|
### Per-Repository Configuration (itcpr.yml)
|
|
274
289
|
|
|
@@ -297,22 +312,18 @@ sync:
|
|
|
297
312
|
enabled: false
|
|
298
313
|
```
|
|
299
314
|
|
|
300
|
-
|
|
301
|
-
```bash
|
|
302
|
-
pip install itcpr[yaml]
|
|
303
|
-
# OR
|
|
304
|
-
pip install PyYAML
|
|
305
|
-
```
|
|
315
|
+
## Development & Mock Mode
|
|
306
316
|
|
|
307
|
-
|
|
317
|
+
The CLI includes a built-in mock mode for testing and development when the API is unavailable.
|
|
308
318
|
|
|
309
|
-
|
|
319
|
+
### Automatic Mock Mode
|
|
310
320
|
|
|
311
|
-
|
|
321
|
+
When the API at `api.itcpr.org` is unavailable, the CLI automatically falls back to mock API responses:
|
|
312
322
|
- If the backend returns 404 or is unreachable, mock responses are used automatically
|
|
313
323
|
- You'll see a warning: "⚠️ Backend unavailable, using mock mode for testing"
|
|
314
324
|
|
|
315
|
-
|
|
325
|
+
### Manual Mock Mode
|
|
326
|
+
|
|
316
327
|
You can also enable mock mode explicitly:
|
|
317
328
|
|
|
318
329
|
```bash
|
|
@@ -328,35 +339,43 @@ itcpr login
|
|
|
328
339
|
- Auto-approves device login after 2 seconds
|
|
329
340
|
- Provides sample user and repository data
|
|
330
341
|
- Generates mock GitHub tokens
|
|
331
|
-
- All commands work in mock mode for testing
|
|
342
|
+
- All commands work in mock mode for testing purposes
|
|
332
343
|
|
|
333
344
|
## Troubleshooting
|
|
334
345
|
|
|
335
346
|
### "Not logged in" error
|
|
336
347
|
|
|
337
|
-
Run `itcpr login` to authenticate your device. If the backend is unavailable, mock mode will activate automatically.
|
|
348
|
+
Run `itcpr login` to authenticate your device. Make sure you've connected your GitHub account at [cloud.itcpr.org](https://cloud.itcpr.org) first. If the backend is unavailable, mock mode will activate automatically for testing.
|
|
338
349
|
|
|
339
350
|
### "Repository not assigned" error
|
|
340
351
|
|
|
341
|
-
The repository must be assigned to your device in ITCPR Cloud.
|
|
352
|
+
The repository must be assigned to your device in ITCPR Cloud. Make sure you've:
|
|
353
|
+
1. Connected your GitHub account at [cloud.itcpr.org](https://cloud.itcpr.org)
|
|
354
|
+
2. Assigned the repository to your device in the ITCPR Cloud dashboard
|
|
342
355
|
|
|
343
|
-
|
|
356
|
+
If the issue persists, contact an administrator.
|
|
357
|
+
|
|
358
|
+
### Merge Conflicts
|
|
344
359
|
|
|
345
360
|
If a merge conflict is detected during sync:
|
|
346
361
|
1. Resolve conflicts manually in the repository
|
|
347
362
|
2. Commit the resolution
|
|
348
363
|
3. Run `itcpr sync` again
|
|
349
364
|
|
|
350
|
-
### Git
|
|
365
|
+
### Git Command Not Found
|
|
351
366
|
|
|
352
367
|
Ensure Git is installed and available in your PATH:
|
|
368
|
+
|
|
353
369
|
```bash
|
|
354
370
|
git --version
|
|
355
371
|
```
|
|
356
372
|
|
|
357
|
-
|
|
373
|
+
If Git is not installed, install it using your system's package manager.
|
|
374
|
+
|
|
375
|
+
### Token Storage Issues
|
|
358
376
|
|
|
359
377
|
On Linux, you may need to install a keyring backend:
|
|
378
|
+
|
|
360
379
|
```bash
|
|
361
380
|
# For GNOME
|
|
362
381
|
sudo apt-get install python3-keyring
|
|
@@ -365,6 +384,8 @@ sudo apt-get install python3-keyring
|
|
|
365
384
|
sudo apt-get install python3-keyring kdewallet
|
|
366
385
|
```
|
|
367
386
|
|
|
387
|
+
On macOS and Windows, the keyring should work out of the box.
|
|
388
|
+
|
|
368
389
|
## Development
|
|
369
390
|
|
|
370
391
|
### Project Structure
|
|
@@ -386,20 +407,20 @@ cloud-cli/
|
|
|
386
407
|
└── README.md # This file
|
|
387
408
|
```
|
|
388
409
|
|
|
389
|
-
###
|
|
410
|
+
### Development Setup
|
|
390
411
|
|
|
391
412
|
```bash
|
|
392
413
|
# Install in development mode
|
|
393
414
|
pip install -e .
|
|
394
|
-
# OR
|
|
395
|
-
pip3 install -e .
|
|
396
|
-
# OR
|
|
397
|
-
python3 -m pip install -e .
|
|
398
415
|
|
|
399
416
|
# Run CLI
|
|
400
417
|
itcpr --help
|
|
401
418
|
```
|
|
402
419
|
|
|
420
|
+
### Contributing
|
|
421
|
+
|
|
422
|
+
Contributions are welcome! Please ensure your code follows the project's style guidelines and includes appropriate tests.
|
|
423
|
+
|
|
403
424
|
## API Endpoints
|
|
404
425
|
|
|
405
426
|
The CLI communicates with these backend endpoints:
|
|
@@ -413,9 +434,9 @@ The CLI communicates with these backend endpoints:
|
|
|
413
434
|
|
|
414
435
|
## License
|
|
415
436
|
|
|
416
|
-
MIT License
|
|
437
|
+
MIT License - see LICENSE file for details.
|
|
417
438
|
|
|
418
439
|
## Support
|
|
419
440
|
|
|
420
|
-
For issues
|
|
441
|
+
For issues, questions, or feature requests, please contact ITCPR support or open an issue on GitHub.
|
|
421
442
|
|
|
@@ -9,7 +9,7 @@ long_description = readme_file.read_text() if readme_file.exists() else ""
|
|
|
9
9
|
|
|
10
10
|
setup(
|
|
11
11
|
name="itcpr",
|
|
12
|
-
version="2.0
|
|
12
|
+
version="2.1.0",
|
|
13
13
|
description="CLI tool for syncing GitHub repositories from ITCPR Cloud",
|
|
14
14
|
long_description=long_description,
|
|
15
15
|
long_description_content_type="text/markdown",
|
itcpr-2.0.9/itcpr/__init__.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|