dotctl 1.0.9__tar.gz → 1.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 (48) hide show
  1. {dotctl-1.0.9/src/dotctl.egg-info → dotctl-1.1.0}/PKG-INFO +91 -19
  2. {dotctl-1.0.9 → dotctl-1.1.0}/README.md +88 -18
  3. {dotctl-1.0.9 → dotctl-1.1.0}/pyproject.toml +3 -3
  4. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/__init__.py +1 -1
  5. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/actions/activator.py +5 -2
  6. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/actions/creator.py +16 -24
  7. dotctl-1.1.0/src/dotctl/actions/differ.py +108 -0
  8. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/actions/exporter.py +12 -1
  9. dotctl-1.1.0/src/dotctl/actions/importer.py +180 -0
  10. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/actions/remover.py +2 -1
  11. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/actions/saver.py +80 -25
  12. dotctl-1.1.0/src/dotctl/actions/status.py +442 -0
  13. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/arg_manager.py +37 -1
  14. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/exception.py +3 -1
  15. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/handlers/config_handler.py +26 -4
  16. dotctl-1.1.0/src/dotctl/handlers/data_handler.py +245 -0
  17. dotctl-1.1.0/src/dotctl/handlers/diff_handler.py +242 -0
  18. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/handlers/git_handler.py +3 -9
  19. dotctl-1.1.0/src/dotctl/handlers/status_handler.py +205 -0
  20. dotctl-1.1.0/src/dotctl/handlers/sudo_handler.py +283 -0
  21. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/main.py +36 -2
  22. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/templates/kde.yaml +3 -0
  23. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/utils.py +1 -1
  24. {dotctl-1.0.9 → dotctl-1.1.0/src/dotctl.egg-info}/PKG-INFO +91 -19
  25. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl.egg-info/SOURCES.txt +5 -0
  26. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl.egg-info/requires.txt +1 -0
  27. dotctl-1.0.9/src/dotctl/actions/importer.py +0 -133
  28. dotctl-1.0.9/src/dotctl/handlers/data_handler.py +0 -198
  29. {dotctl-1.0.9 → dotctl-1.1.0}/LICENSE +0 -0
  30. {dotctl-1.0.9 → dotctl-1.1.0}/setup.cfg +0 -0
  31. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/actions/__init__.py +0 -0
  32. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/actions/initializer.py +0 -0
  33. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/actions/lister.py +0 -0
  34. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/actions/puller.py +0 -0
  35. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/actions/switcher.py +0 -0
  36. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/actions/wiper.py +0 -0
  37. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/handlers/__init__.py +0 -0
  38. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/handlers/hooks_handler.py +0 -0
  39. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/hooks/post_apply.sh +0 -0
  40. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/hooks/pre_apply.sh +0 -0
  41. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/paths.py +0 -0
  42. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/templates/__init__.py +0 -0
  43. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/templates/dev.yaml +0 -0
  44. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/templates/other.yaml +0 -0
  45. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl/validators.py +0 -0
  46. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl.egg-info/dependency_links.txt +0 -0
  47. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl.egg-info/entry_points.txt +0 -0
  48. {dotctl-1.0.9 → dotctl-1.1.0}/src/dotctl.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dotctl
3
- Version: 1.0.9
3
+ Version: 1.1.0
4
4
  Summary: A powerful CLI tool to profile your OS by saving, applying, exporting, and importing system configurations as named profiles. Designed to manage dot files and service configurations in a centralized Git repository (local or remote), dotctl enables seamless system replication across machines. Supports pre/post hook scripts, making it ideal for setting up servers or desktops with consistent environments.
5
5
  Author-email: Pankaj Jackson <pankajackson@live.co.uk>
6
6
  License-Expression: MIT
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
15
  Classifier: Development Status :: 4 - Beta
16
16
  Classifier: Intended Audience :: End Users/Desktop
17
+ Classifier: Operating System :: MacOS
17
18
  Classifier: Operating System :: POSIX :: Linux
18
19
  Classifier: Topic :: System :: Archiving :: Backup
19
20
  Classifier: Topic :: Utilities
@@ -22,6 +23,7 @@ Description-Content-Type: text/markdown
22
23
  License-File: LICENSE
23
24
  Requires-Dist: PyYAML
24
25
  Requires-Dist: gitpython
26
+ Requires-Dist: rich
25
27
  Dynamic: license-file
26
28
 
27
29
  # DotCtl
@@ -58,9 +60,12 @@ Designed for developers and sysadmins, it supports pre/post hook scripts and is
58
60
  - [❌ `remove` / `rm` / `delete` / `del`](#-remove--rm--delete--del)
59
61
  - [🧪 `apply`](#-apply)
60
62
  - [🔄 `pull`](#-pull)
63
+ - [🔍 `status`](#-status)
64
+ - [🔎 `diff`](#-diff)
61
65
  - [📤 `export`](#-export)
62
66
  - [📥 `import`](#-import)
63
67
  - [🔥 `wipe`](#-wipe)
68
+ - [⚠️ Limitations \& Notes](#️-limitations--notes)
64
69
  - [🧑‍💻 Development \& Publishing](#-development--publishing)
65
70
  - [Setup Development Environment](#setup-development-environment)
66
71
  - [Test the new code](#test-the-new-code)
@@ -84,7 +89,7 @@ Designed for developers and sysadmins, it supports pre/post hook scripts and is
84
89
 
85
90
  ## 📁 Profile Config Structure (`dotctl.yaml`)
86
91
 
87
- The `dotctl.yml` config file defines what files and directories to **track**, **save**, and **export** as part of a system profile. This enables seamless migration, sharing, and restoration of system configs and personalizations—perfect for dotfiles, apps, or entire setups like KDE.
92
+ The `dotctl.yaml` config file defines what files and directories to **track**, **save**, and **export** as part of a system profile. This enables seamless migration, sharing, and restoration of system configs and personalizations—perfect for dotfiles, apps, or entire setups like KDE.
88
93
 
89
94
  ### 🧠 Concept Overview
90
95
 
@@ -118,6 +123,11 @@ To simplify path definitions, these keys can be used in `location`:
118
123
 
119
124
  Use them to make profiles portable across systems.
120
125
 
126
+ Each `save` or `export` section may set `required_sudo: true` when its configured
127
+ location should be accessed through sudo. If `sudo` is omitted or `false`,
128
+ dotctl first uses normal access and asks for sudo only if the path is restricted.
129
+ At the prompt, you can provide a password or skip the current path/all paths.
130
+
121
131
  ---
122
132
 
123
133
  ### ✅ Example: Minimal Config
@@ -236,6 +246,7 @@ export:
236
246
 
237
247
  sddm:
238
248
  location: $SYS_SHARE_DIR/sddm
249
+ required_sudo: true
239
250
  entries:
240
251
  - themes
241
252
  ```
@@ -260,7 +271,7 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
260
271
 
261
272
  ```js
262
273
  ┌──────────────┐
263
- │ dotctl.yml │
274
+ │ dotctl.yaml │
264
275
  └──────┬───────┘
265
276
  │
266
277
  ┌─────────▼──────────┐
@@ -312,12 +323,14 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
312
323
 
313
324
  ## 📊 Profile Block Table
314
325
 
315
- | Section | Field | Description |
316
- | -------- | ---------- | ----------------------------------------------------------------- |
317
- | `save` | `location` | Base path of the tracked files (can use key like `$CONFIG_DIR`) |
318
- | | `entries` | List of files/folders to track under that location |
319
- | `export` | `location` | Base path of export files (e.g., large assets not suited for Git) |
320
- | | `entries` | List of assets or binaries to package in `.dtsv` |
326
+ | Section | Field | Description |
327
+ | -------- | --------------- | ----------------------------------------------------------------- |
328
+ | `save` | `location` | Base path of tracked files (can use a key like `$CONFIG_DIR`) |
329
+ | | `entries` | Files/folders to track under that location |
330
+ | | `required_sudo` | Whether restricted paths in this section require sudo |
331
+ | `export` | `location` | Base path of export files (e.g., large assets not suited for Git) |
332
+ | | `entries` | Assets or binaries to package in `.dtsv` |
333
+ | | `required_sudo` | Whether restricted paths in this section require sudo |
321
334
 
322
335
  ---
323
336
 
@@ -325,7 +338,7 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
325
338
 
326
339
  | Action | Command | Description |
327
340
  | --------------- | ---------------------- | ----------------------------------------------------------- |
328
- | Save configs | `dotctl save` | Pulls files defined in `save` and stores in repo |
341
+ | Save configs | `dotctl save` | Saves configured files to the active profile and syncs Git |
329
342
  | Export assets | `dotctl export` | Package large, non-Git assets into `.dtsv` file |
330
343
  | Transfer assets | `scp profile.dtsv ...` | Manually copy to another machine |
331
344
  | Import assets | `dotctl import` | Unpack `.dtsv` on another system |
@@ -339,6 +352,9 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
339
352
  pip install dotctl
340
353
  ```
341
354
 
355
+ Profile operations require the `git` command. Commands that copy files also require
356
+ `rsync`. Restricted paths prompt for a sudo password when needed.
357
+
342
358
  ---
343
359
 
344
360
  ## 📘 Usage
@@ -380,7 +396,7 @@ dotctl init -c ./my_custom_config.yaml
380
396
 
381
397
  ### 💾 `save`
382
398
 
383
- Save current system state to the active profile.
399
+ Save current system state to a profile.
384
400
 
385
401
  ```sh
386
402
  dotctl save [-h] [-p <password>] [--skip-sudo] [--prune] [profile]
@@ -391,10 +407,20 @@ dotctl save [-h] [-p <password>] [--skip-sudo] [--prune] [profile]
391
407
  ```sh
392
408
  dotctl save
393
409
  dotctl save my_web_server --skip-sudo
394
- dotctl save my_web_server -p mYsecretp@ssw0rd
395
410
  dotctl save --prune
411
+ dotctl save a_new_profile
396
412
  ```
397
413
 
414
+ Without a profile name, `save` targets the active profile. If the named profile
415
+ already exists, dotctl saves to it and then returns to the previously active
416
+ profile. If it does not exist, dotctl creates it from the active profile, saves
417
+ the current system state there, and returns to the previous profile. When a
418
+ remote is configured, dotctl pushes a target branch that is not on the remote,
419
+ even if the save produced no file changes.
420
+
421
+ Prefer the interactive sudo prompt over passing a password with `-p`, since command-line
422
+ arguments can be recorded in shell history or visible to other local processes.
423
+
398
424
  > Tip: Use --prune to clean files that were saved before but are no longer listed in the config.
399
425
 
400
426
  **Options:**
@@ -402,7 +428,7 @@ dotctl save --prune
402
428
  - `--skip-sudo` – Ignore restricted resources.
403
429
  - `-p, --password` – Password for restricted resources.
404
430
  - `--prune` – Remove stale files from the dot repo that are no longer listed in the current `dotctl.yaml` config.
405
- - `profile` – Target profile to save into (defaults to the active one if not provided)
431
+ - `profile` – Target profile. A new name starts as a copy of the active profile; omitted means the active profile.
406
432
 
407
433
  ---
408
434
 
@@ -452,7 +478,8 @@ dotctl sw MyProfile --fetch
452
478
 
453
479
  ### 🆕 `create` / `new`
454
480
 
455
- Create a new, empty profile.
481
+ Create a new, empty profile and initialize its config and hooks. The new profile
482
+ becomes active.
456
483
 
457
484
  ```sh
458
485
  dotctl create [-h] [--fetch] [-c <path>] [-e <env>] profile
@@ -461,14 +488,14 @@ dotctl create [-h] [--fetch] [-c <path>] [-e <env>] profile
461
488
  **Examples:**
462
489
 
463
490
  ```sh
464
- # Create a new profile from current active profile.
491
+ # Create a fresh profile using the detected environment or default config.
465
492
  dotctl create myserver
466
493
 
467
- # Create a empty new profile from a specific environment.
468
- dotctl create -e kde
494
+ # Create a fresh profile from a specific environment.
495
+ dotctl create -e kde kde_desktop
469
496
 
470
- # Create a empty new profile from a custom config.
471
- dotctl create -c ./my_custom_config.yaml
497
+ # Create a fresh profile from a custom config.
498
+ dotctl create -c ./my_custom_config.yaml my_custom_profile
472
499
  ```
473
500
 
474
501
  **Options:**
@@ -547,6 +574,42 @@ dotctl pull
547
574
 
548
575
  ---
549
576
 
577
+ ### 🔍 `status`
578
+
579
+ Inspect the current profile health and detect configuration drift between the repository and local system.
580
+
581
+ ```sh
582
+ dotctl status [--json] [--short]
583
+ ```
584
+
585
+ **Examples:**
586
+
587
+ ```sh
588
+ dotctl status
589
+ dotctl status --short
590
+ dotctl status --json
591
+ ```
592
+
593
+ ---
594
+
595
+ ### 🔎 `diff`
596
+
597
+ Compare tracked files between the repository and local system.
598
+
599
+ ```sh
600
+ dotctl diff [--color] [--side-by-side]
601
+ ```
602
+
603
+ **Examples:**
604
+
605
+ ```sh
606
+ dotctl diff
607
+ dotctl diff --color
608
+ dotctl diff --side-by-side
609
+ ```
610
+
611
+ ---
612
+
550
613
  ### 📤 `export`
551
614
 
552
615
  Export a profile to `.dtsv`.
@@ -611,6 +674,15 @@ dotctl wipe -y
611
674
 
612
675
  ---
613
676
 
677
+ ## ⚠️ Limitations & Notes
678
+
679
+ - Configured filesystem operations (`save`, `apply`, `export`, `import`, `status`, and `diff`) support sudo access for restricted paths. Set `required_sudo: true` on the relevant config section when sudo access is expected; otherwise dotctl tries normal access and requests sudo if needed.
680
+ - `status` and `diff` can report paths as inaccessible when access is denied or the user skips the sudo request.
681
+ - Ensure tracked files/directories have proper read permissions before adding them to `dotctl.yaml`.
682
+ - Missing or inaccessible files may appear as drift during `status` or `diff` operations.
683
+
684
+ ---
685
+
614
686
  ## 🧑‍💻 Development & Publishing
615
687
 
616
688
  ### Setup Development Environment
@@ -32,9 +32,12 @@ Designed for developers and sysadmins, it supports pre/post hook scripts and is
32
32
  - [❌ `remove` / `rm` / `delete` / `del`](#-remove--rm--delete--del)
33
33
  - [🧪 `apply`](#-apply)
34
34
  - [🔄 `pull`](#-pull)
35
+ - [🔍 `status`](#-status)
36
+ - [🔎 `diff`](#-diff)
35
37
  - [📤 `export`](#-export)
36
38
  - [📥 `import`](#-import)
37
39
  - [🔥 `wipe`](#-wipe)
40
+ - [⚠️ Limitations \& Notes](#️-limitations--notes)
38
41
  - [🧑‍💻 Development \& Publishing](#-development--publishing)
39
42
  - [Setup Development Environment](#setup-development-environment)
40
43
  - [Test the new code](#test-the-new-code)
@@ -58,7 +61,7 @@ Designed for developers and sysadmins, it supports pre/post hook scripts and is
58
61
 
59
62
  ## 📁 Profile Config Structure (`dotctl.yaml`)
60
63
 
61
- The `dotctl.yml` config file defines what files and directories to **track**, **save**, and **export** as part of a system profile. This enables seamless migration, sharing, and restoration of system configs and personalizations—perfect for dotfiles, apps, or entire setups like KDE.
64
+ The `dotctl.yaml` config file defines what files and directories to **track**, **save**, and **export** as part of a system profile. This enables seamless migration, sharing, and restoration of system configs and personalizations—perfect for dotfiles, apps, or entire setups like KDE.
62
65
 
63
66
  ### 🧠 Concept Overview
64
67
 
@@ -92,6 +95,11 @@ To simplify path definitions, these keys can be used in `location`:
92
95
 
93
96
  Use them to make profiles portable across systems.
94
97
 
98
+ Each `save` or `export` section may set `required_sudo: true` when its configured
99
+ location should be accessed through sudo. If `sudo` is omitted or `false`,
100
+ dotctl first uses normal access and asks for sudo only if the path is restricted.
101
+ At the prompt, you can provide a password or skip the current path/all paths.
102
+
95
103
  ---
96
104
 
97
105
  ### ✅ Example: Minimal Config
@@ -210,6 +218,7 @@ export:
210
218
 
211
219
  sddm:
212
220
  location: $SYS_SHARE_DIR/sddm
221
+ required_sudo: true
213
222
  entries:
214
223
  - themes
215
224
  ```
@@ -234,7 +243,7 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
234
243
 
235
244
  ```js
236
245
  ┌──────────────┐
237
- │ dotctl.yml │
246
+ │ dotctl.yaml │
238
247
  └──────┬───────┘
239
248
  │
240
249
  ┌─────────▼──────────┐
@@ -286,12 +295,14 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
286
295
 
287
296
  ## 📊 Profile Block Table
288
297
 
289
- | Section | Field | Description |
290
- | -------- | ---------- | ----------------------------------------------------------------- |
291
- | `save` | `location` | Base path of the tracked files (can use key like `$CONFIG_DIR`) |
292
- | | `entries` | List of files/folders to track under that location |
293
- | `export` | `location` | Base path of export files (e.g., large assets not suited for Git) |
294
- | | `entries` | List of assets or binaries to package in `.dtsv` |
298
+ | Section | Field | Description |
299
+ | -------- | --------------- | ----------------------------------------------------------------- |
300
+ | `save` | `location` | Base path of tracked files (can use a key like `$CONFIG_DIR`) |
301
+ | | `entries` | Files/folders to track under that location |
302
+ | | `required_sudo` | Whether restricted paths in this section require sudo |
303
+ | `export` | `location` | Base path of export files (e.g., large assets not suited for Git) |
304
+ | | `entries` | Assets or binaries to package in `.dtsv` |
305
+ | | `required_sudo` | Whether restricted paths in this section require sudo |
295
306
 
296
307
  ---
297
308
 
@@ -299,7 +310,7 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
299
310
 
300
311
  | Action | Command | Description |
301
312
  | --------------- | ---------------------- | ----------------------------------------------------------- |
302
- | Save configs | `dotctl save` | Pulls files defined in `save` and stores in repo |
313
+ | Save configs | `dotctl save` | Saves configured files to the active profile and syncs Git |
303
314
  | Export assets | `dotctl export` | Package large, non-Git assets into `.dtsv` file |
304
315
  | Transfer assets | `scp profile.dtsv ...` | Manually copy to another machine |
305
316
  | Import assets | `dotctl import` | Unpack `.dtsv` on another system |
@@ -313,6 +324,9 @@ This diagram shows the typical lifecycle of using a `dotctl` profile, from savin
313
324
  pip install dotctl
314
325
  ```
315
326
 
327
+ Profile operations require the `git` command. Commands that copy files also require
328
+ `rsync`. Restricted paths prompt for a sudo password when needed.
329
+
316
330
  ---
317
331
 
318
332
  ## 📘 Usage
@@ -354,7 +368,7 @@ dotctl init -c ./my_custom_config.yaml
354
368
 
355
369
  ### 💾 `save`
356
370
 
357
- Save current system state to the active profile.
371
+ Save current system state to a profile.
358
372
 
359
373
  ```sh
360
374
  dotctl save [-h] [-p <password>] [--skip-sudo] [--prune] [profile]
@@ -365,10 +379,20 @@ dotctl save [-h] [-p <password>] [--skip-sudo] [--prune] [profile]
365
379
  ```sh
366
380
  dotctl save
367
381
  dotctl save my_web_server --skip-sudo
368
- dotctl save my_web_server -p mYsecretp@ssw0rd
369
382
  dotctl save --prune
383
+ dotctl save a_new_profile
370
384
  ```
371
385
 
386
+ Without a profile name, `save` targets the active profile. If the named profile
387
+ already exists, dotctl saves to it and then returns to the previously active
388
+ profile. If it does not exist, dotctl creates it from the active profile, saves
389
+ the current system state there, and returns to the previous profile. When a
390
+ remote is configured, dotctl pushes a target branch that is not on the remote,
391
+ even if the save produced no file changes.
392
+
393
+ Prefer the interactive sudo prompt over passing a password with `-p`, since command-line
394
+ arguments can be recorded in shell history or visible to other local processes.
395
+
372
396
  > Tip: Use --prune to clean files that were saved before but are no longer listed in the config.
373
397
 
374
398
  **Options:**
@@ -376,7 +400,7 @@ dotctl save --prune
376
400
  - `--skip-sudo` – Ignore restricted resources.
377
401
  - `-p, --password` – Password for restricted resources.
378
402
  - `--prune` – Remove stale files from the dot repo that are no longer listed in the current `dotctl.yaml` config.
379
- - `profile` – Target profile to save into (defaults to the active one if not provided)
403
+ - `profile` – Target profile. A new name starts as a copy of the active profile; omitted means the active profile.
380
404
 
381
405
  ---
382
406
 
@@ -426,7 +450,8 @@ dotctl sw MyProfile --fetch
426
450
 
427
451
  ### 🆕 `create` / `new`
428
452
 
429
- Create a new, empty profile.
453
+ Create a new, empty profile and initialize its config and hooks. The new profile
454
+ becomes active.
430
455
 
431
456
  ```sh
432
457
  dotctl create [-h] [--fetch] [-c <path>] [-e <env>] profile
@@ -435,14 +460,14 @@ dotctl create [-h] [--fetch] [-c <path>] [-e <env>] profile
435
460
  **Examples:**
436
461
 
437
462
  ```sh
438
- # Create a new profile from current active profile.
463
+ # Create a fresh profile using the detected environment or default config.
439
464
  dotctl create myserver
440
465
 
441
- # Create a empty new profile from a specific environment.
442
- dotctl create -e kde
466
+ # Create a fresh profile from a specific environment.
467
+ dotctl create -e kde kde_desktop
443
468
 
444
- # Create a empty new profile from a custom config.
445
- dotctl create -c ./my_custom_config.yaml
469
+ # Create a fresh profile from a custom config.
470
+ dotctl create -c ./my_custom_config.yaml my_custom_profile
446
471
  ```
447
472
 
448
473
  **Options:**
@@ -521,6 +546,42 @@ dotctl pull
521
546
 
522
547
  ---
523
548
 
549
+ ### 🔍 `status`
550
+
551
+ Inspect the current profile health and detect configuration drift between the repository and local system.
552
+
553
+ ```sh
554
+ dotctl status [--json] [--short]
555
+ ```
556
+
557
+ **Examples:**
558
+
559
+ ```sh
560
+ dotctl status
561
+ dotctl status --short
562
+ dotctl status --json
563
+ ```
564
+
565
+ ---
566
+
567
+ ### 🔎 `diff`
568
+
569
+ Compare tracked files between the repository and local system.
570
+
571
+ ```sh
572
+ dotctl diff [--color] [--side-by-side]
573
+ ```
574
+
575
+ **Examples:**
576
+
577
+ ```sh
578
+ dotctl diff
579
+ dotctl diff --color
580
+ dotctl diff --side-by-side
581
+ ```
582
+
583
+ ---
584
+
524
585
  ### 📤 `export`
525
586
 
526
587
  Export a profile to `.dtsv`.
@@ -585,6 +646,15 @@ dotctl wipe -y
585
646
 
586
647
  ---
587
648
 
649
+ ## ⚠️ Limitations & Notes
650
+
651
+ - Configured filesystem operations (`save`, `apply`, `export`, `import`, `status`, and `diff`) support sudo access for restricted paths. Set `required_sudo: true` on the relevant config section when sudo access is expected; otherwise dotctl tries normal access and requests sudo if needed.
652
+ - `status` and `diff` can report paths as inaccessible when access is denied or the user skips the sudo request.
653
+ - Ensure tracked files/directories have proper read permissions before adding them to `dotctl.yaml`.
654
+ - Missing or inaccessible files may appear as drift during `status` or `diff` operations.
655
+
656
+ ---
657
+
588
658
  ## 🧑‍💻 Development & Publishing
589
659
 
590
660
  ### Setup Development Environment
@@ -4,15 +4,15 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dotctl"
7
- version = "v1.0.9"
7
+ version = "v1.1.0"
8
8
  description = "A powerful CLI tool to profile your OS by saving, applying, exporting, and importing system configurations as named profiles. Designed to manage dot files and service configurations in a centralized Git repository (local or remote), dotctl enables seamless system replication across machines. Supports pre/post hook scripts, making it ideal for setting up servers or desktops with consistent environments."
9
9
  readme = "README.md"
10
10
  license = "MIT"
11
11
  license-files = [ "LICENSE",]
12
12
  requires-python = ">=3.10"
13
- dependencies = [ "PyYAML", "gitpython",]
13
+ dependencies = [ "PyYAML", "gitpython", "rich",]
14
14
  keywords = [ "dotfiles", "config", "settings", "backup", "dotfile-manager",]
15
- classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Development Status :: 4 - Beta", "Intended Audience :: End Users/Desktop", "Operating System :: POSIX :: Linux", "Topic :: System :: Archiving :: Backup", "Topic :: Utilities",]
15
+ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Development Status :: 4 - Beta", "Intended Audience :: End Users/Desktop", "Operating System :: MacOS", "Operating System :: POSIX :: Linux", "Topic :: System :: Archiving :: Backup", "Topic :: Utilities",]
16
16
  [[project.authors]]
17
17
  name = "Pankaj Jackson"
18
18
  email = "pankajackson@live.co.uk"
@@ -10,4 +10,4 @@ __BASE_DIR__ = os.path.dirname(os.path.abspath(__file__))
10
10
  __DEFAULT_PROFILE__ = "default"
11
11
  __EXPORT_EXTENSION__ = ".dtsv"
12
12
  __EXPORT_DATA_DIR__ = "._export_"
13
- __COMMANDS_REQ__ = ["sshpass", "rsync", "git"]
13
+ __COMMANDS_REQ__ = ["git"]
@@ -72,13 +72,16 @@ def apply(props: ActivatorProps) -> None:
72
72
  for name, section in config.save.items():
73
73
  source_base_dir = profile_dir / name
74
74
  dest_base_dir = Path(section.location)
75
- dest_base_dir.mkdir(exist_ok=True)
76
75
  log(f'Applying "{name}"...')
77
76
  for entry in section.entries:
78
77
  source = source_base_dir / entry
79
78
  dest = dest_base_dir / entry
80
79
  result = copy(
81
- source, dest, skip_sudo=props.skip_sudo, sudo_pass=props.password
80
+ source,
81
+ dest,
82
+ skip_sudo=props.skip_sudo,
83
+ sudo_pass=props.password,
84
+ required_sudo=section.required_sudo,
82
85
  )
83
86
 
84
87
  # Updated props
@@ -15,7 +15,6 @@ from dotctl.handlers.git_handler import (
15
15
  get_repo,
16
16
  get_repo_branches,
17
17
  git_fetch,
18
- create_branch,
19
18
  create_empty_branch,
20
19
  is_remote_repo,
21
20
  is_repo_changed,
@@ -55,17 +54,13 @@ def create(props: CreatorProps):
55
54
  if props.profile in all_profiles:
56
55
  log(f"❌ Profile '{props.profile}' already exists.")
57
56
  return
58
- if props.env or props.config:
59
- if props.config is not None and isinstance(props.config, str):
60
- props.config = Path(props.config)
61
- create_empty_branch(repo, props.profile)
62
- conf_initializer(
63
- env=props.env,
64
- custom_config=props.config,
65
- )
66
- hooks_initializer()
67
- else:
68
- create_branch(repo, props.profile)
57
+
58
+ create_empty_branch(repo, props.profile)
59
+
60
+ if isinstance(props.config, str):
61
+ props.config = Path(props.config)
62
+ conf_initializer(env=props.env, custom_config=props.config)
63
+ hooks_initializer()
69
64
 
70
65
  add_changes(repo=repo)
71
66
  if is_repo_changed(repo=repo):
@@ -73,17 +68,14 @@ def create(props: CreatorProps):
73
68
  timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
74
69
  full_message = f"{hostname} | Profile Initialized | {timestamp}"
75
70
  commit_changes(repo=repo, message=full_message)
76
- is_remote, _ = is_remote_repo(repo=repo)
77
- _, remote_profiles, active_profile, all_profiles = get_repo_branches(repo)
78
- if is_remote:
79
- if props.profile not in remote_profiles:
80
- git_fetch(repo=repo)
81
- _, remote_profiles, active_profile, all_profiles = get_repo_branches(
82
- repo
83
- )
84
- if not props.profile in remote_profiles:
85
- push_new_branch(repo=repo)
86
- else:
87
- push_existing_branch(repo=repo)
71
+
72
+ is_remote, _ = is_remote_repo(repo=repo)
73
+ if is_remote:
74
+ git_fetch(repo=repo)
75
+ _, remote_profiles, _, _ = get_repo_branches(repo)
76
+ if props.profile not in remote_profiles:
77
+ push_new_branch(repo=repo)
78
+ else:
79
+ push_existing_branch(repo=repo)
88
80
 
89
81
  log(f"✅ Profile '{props.profile}' created and activated successfully.")
@@ -0,0 +1,108 @@
1
+ from dataclasses import dataclass
2
+ from pathlib import Path
3
+ import subprocess
4
+ import sys
5
+
6
+ from dotctl.paths import app_profile_directory, app_config_file
7
+ from dotctl.handlers.config_handler import conf_reader
8
+ from dotctl.handlers.diff_handler import (
9
+ get_file_diff,
10
+ render_side_by_side,
11
+ render_colored_diff,
12
+ is_target_match,
13
+ )
14
+ from dotctl.handlers.git_handler import get_repo
15
+ from dotctl.utils import log
16
+
17
+
18
+ @dataclass
19
+ class DiffProps:
20
+ profile_dir: Path
21
+ target: str | None
22
+ color: bool
23
+ side_by_side: bool
24
+
25
+
26
+ differ_default_props = DiffProps(
27
+ profile_dir=Path(app_profile_directory),
28
+ target=None,
29
+ color=False,
30
+ side_by_side=False,
31
+ )
32
+
33
+
34
+ def diff(props: DiffProps) -> None:
35
+ log("Fetching diffs...")
36
+ repo = get_repo(props.profile_dir)
37
+
38
+ if repo.bare:
39
+ log("❌ The repository is bare. No Profile available.")
40
+ sys.exit(1)
41
+
42
+ config = conf_reader(config_file=Path(app_config_file))
43
+
44
+ changes_found = False
45
+ inaccessible_paths: list[Path] = []
46
+
47
+ target_path = Path(props.target).expanduser().resolve() if props.target else None
48
+
49
+ for name, section in config.save.items():
50
+
51
+ source_base_dir = Path(section.location)
52
+ repo_base_dir = props.profile_dir / name
53
+
54
+ for entry in section.entries:
55
+
56
+ source_root = source_base_dir / entry
57
+ repo_root = repo_base_dir / entry
58
+ source = source_root
59
+ repo_file = repo_root
60
+ if target_path is not None:
61
+ if not is_target_match(
62
+ target=target_path,
63
+ source=source_root,
64
+ repo_file=repo_root,
65
+ ):
66
+ continue
67
+ resolved_source = source_root.resolve()
68
+ resolved_repo = repo_root.resolve()
69
+ if target_path != resolved_source and resolved_source in target_path.parents:
70
+ relative_target = target_path.relative_to(resolved_source)
71
+ source = source_root / relative_target
72
+ repo_file = repo_root / relative_target
73
+ elif target_path != resolved_repo and resolved_repo in target_path.parents:
74
+ relative_target = target_path.relative_to(resolved_repo)
75
+ source = source_root / relative_target
76
+ repo_file = repo_root / relative_target
77
+ try:
78
+ diff_lines = get_file_diff(
79
+ source, repo_file, required_sudo=section.required_sudo
80
+ )
81
+ except (PermissionError, subprocess.CalledProcessError):
82
+ inaccessible_paths.append(source)
83
+ log(f"⚠ Cannot read {source}; permission denied. Skipping this entry.")
84
+ continue
85
+
86
+ if diff_lines:
87
+ changes_found = True
88
+
89
+ print(f"\n🔍 Diff: {name}/{entry}")
90
+ if props.side_by_side:
91
+ try:
92
+ render_side_by_side(
93
+ source,
94
+ repo_file,
95
+ required_sudo=section.required_sudo,
96
+ )
97
+ except (PermissionError, subprocess.CalledProcessError):
98
+ inaccessible_paths.append(source)
99
+ log(f"⚠ Cannot read {source}; permission denied.")
100
+
101
+ elif props.color:
102
+ render_colored_diff(diff_lines)
103
+
104
+ else:
105
+ print("".join(diff_lines))
106
+
107
+ if not changes_found and not inaccessible_paths:
108
+ log("✅ No differences detected.")