itcpr 2.1.4__tar.gz → 2.1.7__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.4
2
2
  Name: itcpr
3
- Version: 2.1.4
3
+ Version: 2.1.7
4
4
  Summary: CLI tool for syncing GitHub repositories from ITCPR Cloud
5
5
  Home-page: https://itcpr.org
6
6
  Author: ITCPR
@@ -41,6 +41,7 @@ A command-line tool for syncing GitHub repositories from ITCPR Cloud to your loc
41
41
  - 🆕 Create new repositories in the organization
42
42
  - 📦 Automatic repository synchronization
43
43
  - 🔄 Manual or continuous sync modes
44
+ - 🚀 Background service daemon (auto-start on boot)
44
45
  - 💾 Local SQLite database for metadata tracking
45
46
  - 🔒 Secure token storage using OS keyring
46
47
  - 🛡️ Safe git operations with conflict detection
@@ -161,7 +162,7 @@ itcpr clone paperport-itcpr --path ~/projects/paperport
161
162
 
162
163
  ### 5. Initialize a New Repository
163
164
 
164
- Create a new repository in the current folder:
165
+ Create a new repository in the current folder using the project template:
165
166
 
166
167
  ```bash
167
168
  itcpr init
@@ -169,10 +170,12 @@ itcpr init
169
170
 
170
171
  This will:
171
172
  - Create a new repository in the organization (using current directory name)
173
+ - Use `ITCPR/project-template` as the template
174
+ - Fetch and copy template files to current directory
172
175
  - Add you as an admin collaborator
173
176
  - Initialize git repository
174
177
  - Set up remote origin
175
- - Create an initial commit
178
+ - Create an initial commit with template files
176
179
 
177
180
  With options:
178
181
 
@@ -190,7 +193,9 @@ itcpr init --public
190
193
  itcpr init --push
191
194
  ```
192
195
 
193
- **Note:** If the repository name already exists in the organization, you'll be prompted to choose a different name.
196
+ **Note:**
197
+ - If the repository name already exists in the organization, you'll be prompted to choose a different name.
198
+ - Template files from `ITCPR/project-template` are automatically copied to your directory. Existing files are preserved (not overwritten).
194
199
 
195
200
  ### 6. Sync Repositories
196
201
 
@@ -212,17 +217,53 @@ With custom interval:
212
217
  itcpr sync --watch --interval 120 # Sync every 2 minutes
213
218
  ```
214
219
 
215
- **Note:** Watch mode runs in the foreground and will block your terminal. Press `Ctrl+C` to stop. To run it in the background, you can use:
220
+ **Note:** Watch mode runs in the foreground and will block your terminal. Press `Ctrl+C` to stop.
221
+
222
+ For background operation, use the **service** commands (see below).
223
+
224
+ ### 7. Run as Background Service
225
+
226
+ Run sync as a background service that starts automatically:
227
+
228
+ ```bash
229
+ # Start service in background
230
+ itcpr service start
231
+
232
+ # Start with custom interval
233
+ itcpr service start --interval 120 # Sync every 2 minutes
234
+
235
+ # Check service status
236
+ itcpr service status
237
+
238
+ # View service logs
239
+ itcpr service logs
240
+
241
+ # Stop service
242
+ itcpr service stop
243
+ ```
244
+
245
+ **Install as System Service (Auto-start on boot):**
216
246
 
217
247
  ```bash
218
- # Run in background (Linux/macOS)
219
- itcpr sync --watch &
248
+ # Install service (Linux - requires sudo)
249
+ sudo itcpr service install
250
+
251
+ # Install with custom interval
252
+ sudo itcpr service install --interval 120
220
253
 
221
- # Or use nohup to keep it running after closing terminal
222
- nohup itcpr sync --watch > itcpr.log 2>&1 &
254
+ # On macOS (no sudo needed)
255
+ itcpr service install
256
+
257
+ # On Windows (may require admin)
258
+ itcpr service install
223
259
  ```
224
260
 
225
- ### 7. Logout
261
+ After installation:
262
+ - **Linux (systemd):** `sudo systemctl enable itcpr && sudo systemctl start itcpr`
263
+ - **macOS (launchd):** `launchctl load ~/Library/LaunchAgents/org.itcpr.sync.plist`
264
+ - **Windows (Task Scheduler):** The service will start automatically on user logon. To start immediately: `schtasks /Run /TN "ITCPR Sync Service"`
265
+
266
+ ### 8. Logout
226
267
 
227
268
  Clear stored credentials:
228
269
 
@@ -263,7 +304,7 @@ Options:
263
304
 
264
305
  ### `itcpr init`
265
306
 
266
- Creates a new repository in the organization and initializes it in the current folder. The repository name defaults to the current directory name, or you can specify a custom name.
307
+ Creates a new repository in the organization and initializes it in the current folder using the `ITCPR/project-template` template. The repository name defaults to the current directory name, or you can specify a custom name.
267
308
 
268
309
  **Options:**
269
310
  - `--name, -n`: Repository name (defaults to current directory name)
@@ -272,12 +313,20 @@ Creates a new repository in the organization and initializes it in the current f
272
313
  - `--push`: Push initial commit to remote immediately
273
314
 
274
315
  **What it does:**
275
- 1. Creates a new repository in the organization via GitHub API
276
- 2. Adds you (the device owner) as an admin collaborator
277
- 3. Initializes git repository if not already initialized
278
- 4. Sets up remote origin with authentication
279
- 5. Creates an initial commit (creates README.md if no files exist)
280
- 6. Optionally pushes to remote if `--push` is used
316
+ 1. Creates a new repository in the organization from `ITCPR/project-template` template via GitHub API
317
+ 2. Fetches the template repository (`ITCPR/project-template`)
318
+ 3. Copies template files to current directory (preserves existing files)
319
+ 4. Adds you (the device owner) as an admin collaborator
320
+ 5. Initializes git repository if not already initialized
321
+ 6. Sets up remote origin with authentication
322
+ 7. Creates an initial commit with template files
323
+ 8. Optionally pushes to remote if `--push` is used
324
+
325
+ **Template Behavior:**
326
+ - The repository is created from the `ITCPR/project-template` template repository
327
+ - Template files are automatically copied to your current directory
328
+ - Existing files in the directory are preserved (not overwritten)
329
+ - The `.git` directory from the template is excluded
281
330
 
282
331
  **Example:**
283
332
 
@@ -327,6 +376,61 @@ sync:
327
376
  - You can set `auto_commit: true, auto_push: false` to commit locally without pushing
328
377
  - If `itcpr.yml` doesn't exist, the tool uses default values (all enabled). The configuration file is optional.
329
378
 
379
+ ### `itcpr service`
380
+
381
+ Manage the sync service as a background daemon.
382
+
383
+ **Commands:**
384
+ - `start`: Start the service in background
385
+ - `stop`: Stop the running service
386
+ - `status`: Show service status and information
387
+ - `logs`: View service logs
388
+ - `install`: Install as system service (auto-start on boot)
389
+ - `uninstall`: Remove system service
390
+
391
+ **Options:**
392
+ - `--interval, -i`: Sync interval in seconds (default: 60)
393
+ - `--foreground, -f`: Run in foreground (don't daemonize)
394
+ - `--user`: User to run service as (for system service installation)
395
+
396
+ **Examples:**
397
+
398
+ ```bash
399
+ # Start service in background
400
+ itcpr service start
401
+
402
+ # Start with custom interval
403
+ itcpr service start --interval 300 # 5 minutes
404
+
405
+ # Check if service is running
406
+ itcpr service status
407
+
408
+ # View recent logs
409
+ itcpr service logs
410
+
411
+ # Install to start on boot (Linux)
412
+ sudo itcpr service install
413
+
414
+ # Install to start on boot (macOS)
415
+ itcpr service install
416
+
417
+ # Install to start on boot (Windows - may require admin)
418
+ itcpr service install
419
+
420
+ # Uninstall system service
421
+ itcpr service uninstall
422
+ ```
423
+
424
+ **Service Features:**
425
+ - Runs as background daemon (cross-platform)
426
+ - Automatic restart on failure (when installed as system service)
427
+ - Logs to `~/.itcpr/itcpr-service.log` (or `%USERPROFILE%\.itcpr\itcpr-service.log` on Windows)
428
+ - PID file management
429
+ - System service support:
430
+ - **Linux**: systemd service
431
+ - **macOS**: launchd agent
432
+ - **Windows**: Task Scheduler task
433
+
330
434
  ## How It Works
331
435
 
332
436
  ### Authentication Flow
@@ -8,6 +8,7 @@ A command-line tool for syncing GitHub repositories from ITCPR Cloud to your loc
8
8
  - 🆕 Create new repositories in the organization
9
9
  - 📦 Automatic repository synchronization
10
10
  - 🔄 Manual or continuous sync modes
11
+ - 🚀 Background service daemon (auto-start on boot)
11
12
  - 💾 Local SQLite database for metadata tracking
12
13
  - 🔒 Secure token storage using OS keyring
13
14
  - 🛡️ Safe git operations with conflict detection
@@ -128,7 +129,7 @@ itcpr clone paperport-itcpr --path ~/projects/paperport
128
129
 
129
130
  ### 5. Initialize a New Repository
130
131
 
131
- Create a new repository in the current folder:
132
+ Create a new repository in the current folder using the project template:
132
133
 
133
134
  ```bash
134
135
  itcpr init
@@ -136,10 +137,12 @@ itcpr init
136
137
 
137
138
  This will:
138
139
  - Create a new repository in the organization (using current directory name)
140
+ - Use `ITCPR/project-template` as the template
141
+ - Fetch and copy template files to current directory
139
142
  - Add you as an admin collaborator
140
143
  - Initialize git repository
141
144
  - Set up remote origin
142
- - Create an initial commit
145
+ - Create an initial commit with template files
143
146
 
144
147
  With options:
145
148
 
@@ -157,7 +160,9 @@ itcpr init --public
157
160
  itcpr init --push
158
161
  ```
159
162
 
160
- **Note:** If the repository name already exists in the organization, you'll be prompted to choose a different name.
163
+ **Note:**
164
+ - If the repository name already exists in the organization, you'll be prompted to choose a different name.
165
+ - Template files from `ITCPR/project-template` are automatically copied to your directory. Existing files are preserved (not overwritten).
161
166
 
162
167
  ### 6. Sync Repositories
163
168
 
@@ -179,17 +184,53 @@ With custom interval:
179
184
  itcpr sync --watch --interval 120 # Sync every 2 minutes
180
185
  ```
181
186
 
182
- **Note:** Watch mode runs in the foreground and will block your terminal. Press `Ctrl+C` to stop. To run it in the background, you can use:
187
+ **Note:** Watch mode runs in the foreground and will block your terminal. Press `Ctrl+C` to stop.
188
+
189
+ For background operation, use the **service** commands (see below).
190
+
191
+ ### 7. Run as Background Service
192
+
193
+ Run sync as a background service that starts automatically:
194
+
195
+ ```bash
196
+ # Start service in background
197
+ itcpr service start
198
+
199
+ # Start with custom interval
200
+ itcpr service start --interval 120 # Sync every 2 minutes
201
+
202
+ # Check service status
203
+ itcpr service status
204
+
205
+ # View service logs
206
+ itcpr service logs
207
+
208
+ # Stop service
209
+ itcpr service stop
210
+ ```
211
+
212
+ **Install as System Service (Auto-start on boot):**
183
213
 
184
214
  ```bash
185
- # Run in background (Linux/macOS)
186
- itcpr sync --watch &
215
+ # Install service (Linux - requires sudo)
216
+ sudo itcpr service install
217
+
218
+ # Install with custom interval
219
+ sudo itcpr service install --interval 120
187
220
 
188
- # Or use nohup to keep it running after closing terminal
189
- nohup itcpr sync --watch > itcpr.log 2>&1 &
221
+ # On macOS (no sudo needed)
222
+ itcpr service install
223
+
224
+ # On Windows (may require admin)
225
+ itcpr service install
190
226
  ```
191
227
 
192
- ### 7. Logout
228
+ After installation:
229
+ - **Linux (systemd):** `sudo systemctl enable itcpr && sudo systemctl start itcpr`
230
+ - **macOS (launchd):** `launchctl load ~/Library/LaunchAgents/org.itcpr.sync.plist`
231
+ - **Windows (Task Scheduler):** The service will start automatically on user logon. To start immediately: `schtasks /Run /TN "ITCPR Sync Service"`
232
+
233
+ ### 8. Logout
193
234
 
194
235
  Clear stored credentials:
195
236
 
@@ -230,7 +271,7 @@ Options:
230
271
 
231
272
  ### `itcpr init`
232
273
 
233
- Creates a new repository in the organization and initializes it in the current folder. The repository name defaults to the current directory name, or you can specify a custom name.
274
+ Creates a new repository in the organization and initializes it in the current folder using the `ITCPR/project-template` template. The repository name defaults to the current directory name, or you can specify a custom name.
234
275
 
235
276
  **Options:**
236
277
  - `--name, -n`: Repository name (defaults to current directory name)
@@ -239,12 +280,20 @@ Creates a new repository in the organization and initializes it in the current f
239
280
  - `--push`: Push initial commit to remote immediately
240
281
 
241
282
  **What it does:**
242
- 1. Creates a new repository in the organization via GitHub API
243
- 2. Adds you (the device owner) as an admin collaborator
244
- 3. Initializes git repository if not already initialized
245
- 4. Sets up remote origin with authentication
246
- 5. Creates an initial commit (creates README.md if no files exist)
247
- 6. Optionally pushes to remote if `--push` is used
283
+ 1. Creates a new repository in the organization from `ITCPR/project-template` template via GitHub API
284
+ 2. Fetches the template repository (`ITCPR/project-template`)
285
+ 3. Copies template files to current directory (preserves existing files)
286
+ 4. Adds you (the device owner) as an admin collaborator
287
+ 5. Initializes git repository if not already initialized
288
+ 6. Sets up remote origin with authentication
289
+ 7. Creates an initial commit with template files
290
+ 8. Optionally pushes to remote if `--push` is used
291
+
292
+ **Template Behavior:**
293
+ - The repository is created from the `ITCPR/project-template` template repository
294
+ - Template files are automatically copied to your current directory
295
+ - Existing files in the directory are preserved (not overwritten)
296
+ - The `.git` directory from the template is excluded
248
297
 
249
298
  **Example:**
250
299
 
@@ -294,6 +343,61 @@ sync:
294
343
  - You can set `auto_commit: true, auto_push: false` to commit locally without pushing
295
344
  - If `itcpr.yml` doesn't exist, the tool uses default values (all enabled). The configuration file is optional.
296
345
 
346
+ ### `itcpr service`
347
+
348
+ Manage the sync service as a background daemon.
349
+
350
+ **Commands:**
351
+ - `start`: Start the service in background
352
+ - `stop`: Stop the running service
353
+ - `status`: Show service status and information
354
+ - `logs`: View service logs
355
+ - `install`: Install as system service (auto-start on boot)
356
+ - `uninstall`: Remove system service
357
+
358
+ **Options:**
359
+ - `--interval, -i`: Sync interval in seconds (default: 60)
360
+ - `--foreground, -f`: Run in foreground (don't daemonize)
361
+ - `--user`: User to run service as (for system service installation)
362
+
363
+ **Examples:**
364
+
365
+ ```bash
366
+ # Start service in background
367
+ itcpr service start
368
+
369
+ # Start with custom interval
370
+ itcpr service start --interval 300 # 5 minutes
371
+
372
+ # Check if service is running
373
+ itcpr service status
374
+
375
+ # View recent logs
376
+ itcpr service logs
377
+
378
+ # Install to start on boot (Linux)
379
+ sudo itcpr service install
380
+
381
+ # Install to start on boot (macOS)
382
+ itcpr service install
383
+
384
+ # Install to start on boot (Windows - may require admin)
385
+ itcpr service install
386
+
387
+ # Uninstall system service
388
+ itcpr service uninstall
389
+ ```
390
+
391
+ **Service Features:**
392
+ - Runs as background daemon (cross-platform)
393
+ - Automatic restart on failure (when installed as system service)
394
+ - Logs to `~/.itcpr/itcpr-service.log` (or `%USERPROFILE%\.itcpr\itcpr-service.log` on Windows)
395
+ - PID file management
396
+ - System service support:
397
+ - **Linux**: systemd service
398
+ - **macOS**: launchd agent
399
+ - **Windows**: Task Scheduler task
400
+
297
401
  ## How It Works
298
402
 
299
403
  ### Authentication Flow
@@ -1,4 +1,4 @@
1
1
  """ITCPR Cloud CLI - CLI tool for syncing GitHub repositories."""
2
2
 
3
- __version__ = "2.1.4"
3
+ __version__ = "2.1.7"
4
4
 
@@ -113,7 +113,7 @@ class APIClient:
113
113
  except Exception:
114
114
  return False
115
115
 
116
- def create_repo(self, name: str, description: str = "", private: bool = False) -> Dict[str, Any]:
116
+ def create_repo(self, name: str, description: str = "", private: bool = False, template: Optional[str] = "project-template") -> Dict[str, Any]:
117
117
  """Create a new repository in the organization."""
118
118
  use_mock = config.mock_mode or (MOCK_AVAILABLE and _mock_api is not None)
119
119
 
@@ -123,6 +123,9 @@ class APIClient:
123
123
  "visibility": "private" if private else "public"
124
124
  }
125
125
 
126
+ if template:
127
+ payload["template"] = template
128
+
126
129
  try:
127
130
  response = self._request("POST", "/cloud/app/org/repos", json=payload)
128
131
  response.raise_for_status()