shadow-sentinel 1.0.1__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.
@@ -0,0 +1,18 @@
1
+ Creative Commons Attribution-ShareAlike 3.0 Germany (CC BY-SA 3.0 DE)
2
+
3
+ Copyright (c) 2026 automatician (Torsten Frieser), Germany / Saxony / Zittau.
4
+
5
+ You are free to:
6
+ Share — copy and redistribute the material in any medium or format
7
+ Adapt — remix, transform, and build upon the material for any purpose, even commercially.
8
+
9
+ Under the following terms:
10
+ Attribution — You must give appropriate credit, provide a link to the license,
11
+ and indicate if changes were made. You may do so in any reasonable manner, but
12
+ not in any way that suggests the licensor endorses you or your use.
13
+
14
+ ShareAlike — If you remix, transform, or build upon the material, you must
15
+ distribute your contributions under the same license as the original.
16
+
17
+ No additional restrictions — You may not apply legal terms or technological measures
18
+ that legally restrict others from doing anything the license permits.
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: shadow-sentinel
3
+ Version: 1.0.1
4
+ Summary: Autonomous OS-level revision & backup guard with decentralized marker control and loop-coupling
5
+ Author-email: automatician <235166879+automatician@users.noreply.github.com>
6
+ License-Expression: CC-BY-SA-3.0
7
+ Project-URL: Homepage, https://github.com/automatician/shadow-sentinel
8
+ Project-URL: Bug Tracker, https://github.com/automatician/shadow-sentinel/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Topic :: System :: Archiving :: Backup
12
+ Classifier: Topic :: System :: Monitoring
13
+ Classifier: Topic :: Utilities
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Dynamic: license-file
18
+
19
+ # 🛡️ Shadow Sentinel
20
+
21
+ **Autonomous OS-Level Revision & Backup Daemon with Decentralized Marker Control and Loop-Coupling.**
22
+
23
+ Shadow Sentinel monitors directory trees in real-time via the Linux kernel (`inotify`), captures
24
+ atomic `.bak` revisions and unified diffs (`.diff`) on every file modification, and provides
25
+ instant 1-command restores with loop-coupling safety.
26
+
27
+ ---
28
+
29
+ ## 🚀 Key Features
30
+
31
+ 1. **Decentralized Marker Control (`sentinel_marker`)**:
32
+ - No tedious editing of central configuration files.
33
+ - Simply run `sentinel init [MB]` in any directory or place a `sentinel_marker` file.
34
+ - The daemon automatically scans the system on startup and binds all marked roots.
35
+
36
+ 2. **Dynamic File-Size Ceiling (Self-Pruning Vault)**:
37
+ - The value inside `sentinel_marker` sets the protected size ceiling (e.g. `5` for 5 MB).
38
+ - If a file (such as a runaway logfile) exceeds this ceiling, it is automatically ejected
39
+ from the shadow vault. Small scripts, configurations, and source code stay 100% protected.
40
+
41
+ 3. **Loop-Coupling (Undo-Safe Restore)**:
42
+ - Restoring a file with `sentinel restore <ID>` overwrites the target file.
43
+ - The running inotify daemon immediately intercepts this write and seals the overwritten
44
+ version into a brand-new backup revision. Mistaken restores can instantly be undone!
45
+
46
+ 4. **Flapping & Cooldown Debounce**:
47
+ - Rapid consecutive writes are debounced with a 3-second quiet window to prevent spam.
48
+
49
+ 5. **Zero Dependencies**:
50
+ - Pure Python standard library with native `ctypes` bindings directly to `libc.so.6`.
51
+ - No external tools like `inotifywait` or background Git daemons required.
52
+
53
+ ---
54
+
55
+ ## 🧹 Automated Disk Sanitation & Retention Doctrine
56
+
57
+ Sentinel guarantees that it will never exhaust disk space through a 4-tier automated policy:
58
+
59
+ 1. **Version Cap per File (Max 10 Revisions)**:
60
+ Only the 10 most recent `.bak` and `.diff` files per target are kept. Older versions are deleted.
61
+
62
+ 2. **Version Age Expiration (14 Days)**:
63
+ Revisions older than 14 days are automatically pruned.
64
+
65
+ 3. **Log Expiration (30 Days)**:
66
+ Daily audit diff logs (`diff-YYYYMMDD.log`) are removed after 30 days.
67
+
68
+ 4. **Emergency Storage Ceiling (500 MB Cap)**:
69
+ If total backup directory size exceeds 500 MB, an emergency purge trims the oldest backups
70
+ across all files until total disk usage drops back down to 80% (400 MB).
71
+
72
+ 5. **Active Vault Ejection**:
73
+ Files that grow beyond the MB ceiling in `sentinel_marker` are immediately removed from
74
+ the `.shadow_vault` to recover disk space instantly.
75
+
76
+ *The pruning engine runs automatically every 6 hours and immediately upon service startup.*
77
+
78
+ ---
79
+
80
+ ## 📦 Installation
81
+
82
+ ```bash
83
+ pip install shadow-sentinel
84
+ ```
85
+
86
+ Set up and start the systemd background service in one step:
87
+ ```bash
88
+ sudo sentinel service install
89
+ ```
90
+
91
+ ---
92
+
93
+ ## 🛠️ Usage
94
+
95
+ ### Protect a Directory
96
+ Navigate to the directory and run:
97
+ ```bash
98
+ sentinel init 5
99
+ ```
100
+ *(Creates `sentinel_marker` with a 5 MB file size limit).*
101
+
102
+ ### List Backups
103
+ Simply type in any terminal:
104
+ ```bash
105
+ sentinel
106
+ ```
107
+ Automatically detects the nearest marker upwards and lists all protected revisions.
108
+
109
+ ### Restore a File
110
+ ```bash
111
+ sentinel restore 3
112
+ ```
113
+
114
+ ### View Unified Diff
115
+ ```bash
116
+ sentinel diff 3
117
+ ```
118
+
119
+ ### List All Active Markers on System
120
+ ```bash
121
+ sentinel markers
122
+ ```
123
+
124
+ ### Full Interactive Manual
125
+ ```bash
126
+ sentinel help
127
+ ```
128
+
129
+ ---
130
+
131
+ ## ⚙️ Storage & Configuration
132
+
133
+ ### Linux FHS Standard Paths:
134
+ - **Root Daemon:** `/var/lib/shadow-sentinel/`
135
+ - **User Daemon:** `~/.local/share/shadow-sentinel/`
136
+
137
+ ### Custom Storage Redirection (`/etc/shadow-sentinel/config.json`):
138
+ To store backups, vaults, and indices in a custom directory, create:
139
+ `/etc/shadow-sentinel/config.json` (for root) or `~/.config/shadow-sentinel/config.json` (for user):
140
+
141
+ ```json
142
+ {
143
+ "storage_dir": "/custom/path/to/backups"
144
+ }
145
+ ```
146
+
147
+ ### Environment Variable Override:
148
+ ```bash
149
+ export SENTINEL_STORAGE_DIR=/custom/path/to/backups
150
+ ```
@@ -0,0 +1,132 @@
1
+ # 🛡️ Shadow Sentinel
2
+
3
+ **Autonomous OS-Level Revision & Backup Daemon with Decentralized Marker Control and Loop-Coupling.**
4
+
5
+ Shadow Sentinel monitors directory trees in real-time via the Linux kernel (`inotify`), captures
6
+ atomic `.bak` revisions and unified diffs (`.diff`) on every file modification, and provides
7
+ instant 1-command restores with loop-coupling safety.
8
+
9
+ ---
10
+
11
+ ## 🚀 Key Features
12
+
13
+ 1. **Decentralized Marker Control (`sentinel_marker`)**:
14
+ - No tedious editing of central configuration files.
15
+ - Simply run `sentinel init [MB]` in any directory or place a `sentinel_marker` file.
16
+ - The daemon automatically scans the system on startup and binds all marked roots.
17
+
18
+ 2. **Dynamic File-Size Ceiling (Self-Pruning Vault)**:
19
+ - The value inside `sentinel_marker` sets the protected size ceiling (e.g. `5` for 5 MB).
20
+ - If a file (such as a runaway logfile) exceeds this ceiling, it is automatically ejected
21
+ from the shadow vault. Small scripts, configurations, and source code stay 100% protected.
22
+
23
+ 3. **Loop-Coupling (Undo-Safe Restore)**:
24
+ - Restoring a file with `sentinel restore <ID>` overwrites the target file.
25
+ - The running inotify daemon immediately intercepts this write and seals the overwritten
26
+ version into a brand-new backup revision. Mistaken restores can instantly be undone!
27
+
28
+ 4. **Flapping & Cooldown Debounce**:
29
+ - Rapid consecutive writes are debounced with a 3-second quiet window to prevent spam.
30
+
31
+ 5. **Zero Dependencies**:
32
+ - Pure Python standard library with native `ctypes` bindings directly to `libc.so.6`.
33
+ - No external tools like `inotifywait` or background Git daemons required.
34
+
35
+ ---
36
+
37
+ ## 🧹 Automated Disk Sanitation & Retention Doctrine
38
+
39
+ Sentinel guarantees that it will never exhaust disk space through a 4-tier automated policy:
40
+
41
+ 1. **Version Cap per File (Max 10 Revisions)**:
42
+ Only the 10 most recent `.bak` and `.diff` files per target are kept. Older versions are deleted.
43
+
44
+ 2. **Version Age Expiration (14 Days)**:
45
+ Revisions older than 14 days are automatically pruned.
46
+
47
+ 3. **Log Expiration (30 Days)**:
48
+ Daily audit diff logs (`diff-YYYYMMDD.log`) are removed after 30 days.
49
+
50
+ 4. **Emergency Storage Ceiling (500 MB Cap)**:
51
+ If total backup directory size exceeds 500 MB, an emergency purge trims the oldest backups
52
+ across all files until total disk usage drops back down to 80% (400 MB).
53
+
54
+ 5. **Active Vault Ejection**:
55
+ Files that grow beyond the MB ceiling in `sentinel_marker` are immediately removed from
56
+ the `.shadow_vault` to recover disk space instantly.
57
+
58
+ *The pruning engine runs automatically every 6 hours and immediately upon service startup.*
59
+
60
+ ---
61
+
62
+ ## 📦 Installation
63
+
64
+ ```bash
65
+ pip install shadow-sentinel
66
+ ```
67
+
68
+ Set up and start the systemd background service in one step:
69
+ ```bash
70
+ sudo sentinel service install
71
+ ```
72
+
73
+ ---
74
+
75
+ ## 🛠️ Usage
76
+
77
+ ### Protect a Directory
78
+ Navigate to the directory and run:
79
+ ```bash
80
+ sentinel init 5
81
+ ```
82
+ *(Creates `sentinel_marker` with a 5 MB file size limit).*
83
+
84
+ ### List Backups
85
+ Simply type in any terminal:
86
+ ```bash
87
+ sentinel
88
+ ```
89
+ Automatically detects the nearest marker upwards and lists all protected revisions.
90
+
91
+ ### Restore a File
92
+ ```bash
93
+ sentinel restore 3
94
+ ```
95
+
96
+ ### View Unified Diff
97
+ ```bash
98
+ sentinel diff 3
99
+ ```
100
+
101
+ ### List All Active Markers on System
102
+ ```bash
103
+ sentinel markers
104
+ ```
105
+
106
+ ### Full Interactive Manual
107
+ ```bash
108
+ sentinel help
109
+ ```
110
+
111
+ ---
112
+
113
+ ## ⚙️ Storage & Configuration
114
+
115
+ ### Linux FHS Standard Paths:
116
+ - **Root Daemon:** `/var/lib/shadow-sentinel/`
117
+ - **User Daemon:** `~/.local/share/shadow-sentinel/`
118
+
119
+ ### Custom Storage Redirection (`/etc/shadow-sentinel/config.json`):
120
+ To store backups, vaults, and indices in a custom directory, create:
121
+ `/etc/shadow-sentinel/config.json` (for root) or `~/.config/shadow-sentinel/config.json` (for user):
122
+
123
+ ```json
124
+ {
125
+ "storage_dir": "/custom/path/to/backups"
126
+ }
127
+ ```
128
+
129
+ ### Environment Variable Override:
130
+ ```bash
131
+ export SENTINEL_STORAGE_DIR=/custom/path/to/backups
132
+ ```
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "shadow-sentinel"
7
+ version = "1.0.1"
8
+ authors = [
9
+ { name="automatician", email="235166879+automatician@users.noreply.github.com" },
10
+ ]
11
+ description = "Autonomous OS-level revision & backup guard with decentralized marker control and loop-coupling"
12
+ readme = "README.md"
13
+ license = "CC-BY-SA-3.0"
14
+ requires-python = ">=3.9"
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "Operating System :: POSIX :: Linux",
18
+ "Topic :: System :: Archiving :: Backup",
19
+ "Topic :: System :: Monitoring",
20
+ "Topic :: Utilities",
21
+ ]
22
+ dependencies = []
23
+
24
+ [project.urls]
25
+ "Homepage" = "https://github.com/automatician/shadow-sentinel"
26
+ "Bug Tracker" = "https://github.com/automatician/shadow-sentinel/issues"
27
+
28
+ [project.scripts]
29
+ sentinel = "shadow_sentinel.core:cli_main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,7 @@
1
+ """
2
+ Shadow Sentinel - Autonomous OS-Level Revision & Backup Daemon
3
+ """
4
+ __version__ = "1.0.1"
5
+ __author__ = "automatician (Torsten Frieser)"
6
+ __copyright__ = "Copyright (c) 2026 automatician (Torsten Frieser), Germany / Saxony / Zittau"
7
+ __license__ = "CC-BY-SA-3.0"