kycli 0.3.0__tar.gz → 0.4.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 (67) hide show
  1. {kycli-0.3.0/kycli.egg-info → kycli-0.4.0}/PKG-INFO +102 -10
  2. {kycli-0.3.0 → kycli-0.4.0}/README.md +101 -9
  3. {kycli-0.3.0 → kycli-0.4.0}/TODO.md +20 -4
  4. {kycli-0.3.0 → kycli-0.4.0}/kycli/cli.py +273 -42
  5. {kycli-0.3.0 → kycli-0.4.0}/kycli/config.py +42 -4
  6. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/audit.c +1417 -1148
  7. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/audit.pyx +10 -2
  8. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/engine.c +2151 -1215
  9. kycli-0.4.0/kycli/core/engine.pyx +152 -0
  10. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/query.c +212 -994
  11. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/security.c +204 -1044
  12. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/storage.c +34782 -17461
  13. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/storage.pyx +633 -184
  14. kycli-0.4.0/kycli/logging_utils.py +29 -0
  15. {kycli-0.3.0 → kycli-0.4.0}/kycli/tui.py +280 -36
  16. kycli-0.4.0/kycli/utils.py +51 -0
  17. {kycli-0.3.0 → kycli-0.4.0/kycli.egg-info}/PKG-INFO +102 -10
  18. {kycli-0.3.0 → kycli-0.4.0}/kycli.egg-info/SOURCES.txt +7 -0
  19. {kycli-0.3.0 → kycli-0.4.0}/kycli.egg-info/entry_points.txt +9 -0
  20. {kycli-0.3.0 → kycli-0.4.0}/pyproject.toml +10 -1
  21. {kycli-0.3.0 → kycli-0.4.0}/setup.py +10 -1
  22. {kycli-0.3.0 → kycli-0.4.0}/tests/core/test_concurrency.py +55 -0
  23. kycli-0.4.0/tests/core/test_roadmap_features.py +92 -0
  24. {kycli-0.3.0 → kycli-0.4.0}/tests/core/test_storage_scaling.py +3 -3
  25. {kycli-0.3.0 → kycli-0.4.0}/tests/interface/test_gap_coverage.py +2 -1
  26. {kycli-0.3.0 → kycli-0.4.0}/tests/test_cli.py +20 -1
  27. kycli-0.4.0/tests/test_cli_coverage_gaps.py +242 -0
  28. kycli-0.4.0/tests/test_cli_legacy.py +70 -0
  29. kycli-0.4.0/tests/test_cli_roadmap.py +100 -0
  30. {kycli-0.3.0 → kycli-0.4.0}/tests/test_tui.py +372 -4
  31. kycli-0.4.0/tests/test_utils.py +23 -0
  32. kycli-0.3.0/kycli/core/engine.pyx +0 -88
  33. {kycli-0.3.0 → kycli-0.4.0}/CHANGELOG.md +0 -0
  34. {kycli-0.3.0 → kycli-0.4.0}/LICENSE +0 -0
  35. {kycli-0.3.0 → kycli-0.4.0}/MANIFEST.in +0 -0
  36. {kycli-0.3.0 → kycli-0.4.0}/kycli/__init__.py +0 -0
  37. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/audit.pxd +0 -0
  38. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/engine.pxd +0 -0
  39. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/query.pxd +0 -0
  40. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/query.pyx +0 -0
  41. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/security.pxd +0 -0
  42. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/security.pyx +0 -0
  43. {kycli-0.3.0 → kycli-0.4.0}/kycli/core/sqlite_defs.pxd +0 -0
  44. {kycli-0.3.0 → kycli-0.4.0}/kycli/kycli.c +0 -0
  45. {kycli-0.3.0 → kycli-0.4.0}/kycli/kyfactory.c +0 -0
  46. {kycli-0.3.0 → kycli-0.4.0}/kycli.egg-info/dependency_links.txt +0 -0
  47. {kycli-0.3.0 → kycli-0.4.0}/kycli.egg-info/requires.txt +0 -0
  48. {kycli-0.3.0 → kycli-0.4.0}/kycli.egg-info/top_level.txt +0 -0
  49. {kycli-0.3.0 → kycli-0.4.0}/setup.cfg +0 -0
  50. {kycli-0.3.0 → kycli-0.4.0}/tests/conftest.py +0 -0
  51. {kycli-0.3.0 → kycli-0.4.0}/tests/core/test_queues_stacks.py +0 -0
  52. {kycli-0.3.0 → kycli-0.4.0}/tests/core/test_security_ops.py +0 -0
  53. {kycli-0.3.0 → kycli-0.4.0}/tests/core/test_storage.py +0 -0
  54. {kycli-0.3.0 → kycli-0.4.0}/tests/core/test_storage_advanced.py +0 -0
  55. {kycli-0.3.0 → kycli-0.4.0}/tests/integration/benchmark.py +0 -0
  56. {kycli-0.3.0 → kycli-0.4.0}/tests/integration/test_performance.py +0 -0
  57. {kycli-0.3.0 → kycli-0.4.0}/tests/interface/test_final.py +0 -0
  58. {kycli-0.3.0 → kycli-0.4.0}/tests/interface/test_full_coverage.py +0 -0
  59. {kycli-0.3.0 → kycli-0.4.0}/tests/interface/test_new_features.py +0 -0
  60. {kycli-0.3.0 → kycli-0.4.0}/tests/interface/verify_encryption.py +0 -0
  61. {kycli-0.3.0 → kycli-0.4.0}/tests/performance/kycli_benchmark.py +0 -0
  62. {kycli-0.3.0 → kycli-0.4.0}/tests/test_cli_coverage.py +0 -0
  63. {kycli-0.3.0 → kycli-0.4.0}/tests/test_cli_env.py +0 -0
  64. {kycli-0.3.0 → kycli-0.4.0}/tests/test_cli_workspaces.py +0 -0
  65. {kycli-0.3.0 → kycli-0.4.0}/tests/test_config.py +0 -0
  66. {kycli-0.3.0 → kycli-0.4.0}/tests/test_final_coverage.py +0 -0
  67. {kycli-0.3.0 → kycli-0.4.0}/tests/test_init.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kycli
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: **kycli** is a high-performance Python CLI toolkit built with Cython for speed.
5
5
  Author: Balakrishna Maduru
6
6
  Author-email: balakrishnamaduru@gmail.com
@@ -62,6 +62,16 @@ Install the latest version from PyPI:
62
62
  pip install kycli
63
63
  ```
64
64
 
65
+ ### Validate The Install
66
+
67
+ Run the end-to-end command matrix from the repo root:
68
+
69
+ ```bash
70
+ bash scripts/validate_install.sh
71
+ ```
72
+
73
+ The validator auto-resolves a usable Python executable, prefers the active `python3` runtime, and runs stateful sections in isolated home directories so queue, profile, and policy checks do not interfere with each other.
74
+
65
75
  ---
66
76
 
67
77
  ## 💻 CLI Command Reference
@@ -86,7 +96,6 @@ pip install kycli
86
96
  | **`kyd`** | Delete Key | `kyd host` |
87
97
  | **`kypush`**| Push to List | `kypush logs "error"` |
88
98
  | **`kyrem`** | Remove from List | `kyrem tags "old"` |
89
- | **`kyrem`** | Remove from List | `kyrem tags "old"` |
90
99
  ### 🧱 Queues & Stacks Operations
91
100
  | Command | Description | Example |
92
101
  | :--- | :--- | :--- |
@@ -96,6 +105,8 @@ pip install kycli
96
105
  | **`kycount`** | Count items | `kycount` |
97
106
  | **`kyclear`** | Clear implementation | `kyclear` |
98
107
  | **`kyws`** | Create Typed WS | `kyws create q --type queue` |
108
+ | **`kyack`** | Ack leased item | `kyack <receipt_id>` |
109
+ | **`kynack`** | Requeue leased item | `kynack <receipt_id> --delay 30s` |
99
110
 
100
111
  ### 🔍 Search & Utility
101
112
  | Command | Description | Example |
@@ -116,6 +127,13 @@ pip install kycli
116
127
  | **`kyc`** | Execute Command | `kyc hello` |
117
128
  | **`kyco`** | Compact DB | `kyco 7` |
118
129
  | **`kyrotate`** | Rotate Master Key | `kyrotate --new-key "newpass" --old-key "oldpass" --backup` |
130
+ | **`kyttl`** | Workspace TTL policy | `kyttl set 1h` |
131
+ | **`kyprofile`** | Manage profiles | `kyprofile save dev` |
132
+ | **`kyacl`** | Workspace ACL/policy | `kyacl readonly on` |
133
+ | **`kyaudit`** | Export audit history | `kyaudit export audit.json json` |
134
+ | **`kystats`** | Show workspace stats | `kystats --json` |
135
+ | **`kybackup`** | Create/restore backup | `kybackup snapshot.db` |
136
+ | **`kymetrics`** | Local metrics endpoint | `kymetrics 8765` |
119
137
 
120
138
  ---
121
139
 
@@ -139,7 +157,6 @@ kyws
139
157
 
140
158
  #### `kymv` — Move Key
141
159
  Moves a key (and its value) from the current workspace to another.
142
- - **Safety**: Asks for confirmation if the key exists in the target.
143
160
  ```bash
144
161
  kymv my_api_key project_beta
145
162
  # Result: ✅ Moved 'my_api_key' to 'project_beta'.
@@ -147,16 +164,87 @@ kymv my_api_key project_beta
147
164
 
148
165
  #### `kydrop` — Delete Workspace
149
166
  Permanently deletes an entire workspace and its database file.
150
- - **Safety**: Requires explicit confirmation (`y/N`) in CLI.
151
- - **Restriction**: You cannot drop the currently active workspace.
152
167
  ```bash
153
168
  kydrop temp_test
154
169
  # Result: ⚠️ DANGER: Are you sure you want to PERMANENTLY delete workspace 'temp_test'? (y/N): y
155
170
  # Result: ✅ Workspace 'temp_test' deleted.
156
171
  ```
157
172
 
158
- ---
159
173
 
174
+ ## 🧭 Advanced Features
175
+
176
+ ### Queue Reliability
177
+ - **Batch Queue Ops**: `kypush --file` and `kypop --n 100` for throughput-oriented flows.
178
+ - **Delayed Jobs**: `kypush --delay 30s` schedules visibility in queue workspaces.
179
+ - **Visibility Timeout**: `kypop --lease 30s` with `kyack` and `kynack` supports retry flows.
180
+ - **Workspace TTL Policies**: `kyttl set/get` applies default TTL behavior per workspace.
181
+
182
+ ### Usability & DX
183
+ - **Config Profiles**: `kyprofile use prod` switches saved CLI defaults.
184
+ - **Output Formatting**: `--json` and `--pretty` are available on structured read paths.
185
+ - **Interactive TUI**: `kyshell` provides an interactive terminal workflow on top of the same engine.
186
+
187
+ ### Security & Compliance
188
+ - **Workspace ACLs**: `kyacl readonly on|off|status` supports write protection.
189
+ - **Workspace Access Keys**: `kyacl key set|get|clear` gates writes with `KYCLI_ACCESS_KEY`.
190
+ - **Audit Export**: `kyaudit export` supports JSON or CSV output with optional time filters.
191
+
192
+ ### Observability
193
+ - **Stats Command**: `kystats` exposes workspace type, counts, TTL usage, archive size, and DB size.
194
+ - **Metrics Endpoint**: `kymetrics` starts a local HTTP endpoint on `127.0.0.1`.
195
+
196
+ ### Data Management
197
+ - **Namespace/Prefix Views**: `kyws view <prefix>` filters large keyspaces.
198
+ - **Backup/Restore**: `kybackup` creates and restores encrypted snapshots.
199
+
200
+ ### Queue Reliability
201
+ ```bash
202
+ # Push from a file
203
+ kypush --file tasks.txt
204
+
205
+ # Delay visibility for 30 seconds
206
+ kypush "email:user_123" --delay 30s
207
+
208
+ # Lease one item for 30 seconds
209
+ kypop --lease 30s --json
210
+
211
+ # Acknowledge or requeue
212
+ kyack <receipt_id>
213
+ kynack <receipt_id> --delay 15s
214
+ ```
215
+
216
+ ### Workspace Policies
217
+ ```bash
218
+ # Set a default TTL for all new values in this workspace
219
+ kyttl set 1h
220
+ kyttl get
221
+
222
+ # Enable read-only mode
223
+ kyacl readonly on
224
+
225
+ # Protect a workspace with an access key
226
+ kyacl key set my-secret
227
+ KYCLI_ACCESS_KEY=my-secret kys protected value
228
+ ```
229
+
230
+ ### Profiles, Stats, and Backups
231
+ ```bash
232
+ kyprofile save dev
233
+ kyprofile list
234
+ kyprofile use dev
235
+
236
+ kystats --json
237
+ kyaudit export audit.json json --since "2026-01-01 00:00:00"
238
+ kybackup snapshot.db
239
+ kybackup restore snapshot.db
240
+ kymetrics 8765
241
+ ```
242
+
243
+ ### Maintenance & Reliability
244
+ - **Lock Management**: Retry with exponential backoff for "Database is locked" in multi-process scenarios.
245
+ - **Activity Logs**: Background logging via Python `logging` module.
246
+ - **Atomic Rename Exports**: Write-to-temp-then-rename for export safety.
247
+ - **Compression**: Optional large-value compression for storage efficiency.
160
248
  ### `kyh` — The Help Center
161
249
  Shows the available commands and basic usage instructions.
162
250
  ```bash
@@ -230,10 +318,13 @@ kyg logs[0:5]
230
318
  ```
231
319
 
232
320
  #### Atomic Patching (Partial Updates):
233
- Instead of rewriting a large JSON object, you can update just one field.
321
+ Instead of rewriting a large JSON object, you can update just one field. Use
322
+ `kypatch` (not `kys`) for this — `kys` always treats dots in a key as a literal
323
+ flat key name (e.g. for namespacing, like `kys ns.alpha 1`), while `kypatch`
324
+ treats them as a path into the nested object.
234
325
  ```bash
235
326
  # Update just the 'age' field inside the 'user' object
236
- kys user.profile.age 25
327
+ kypatch user.profile.age 25
237
328
  ```
238
329
 
239
330
  ### 📦 Collection Operations (Lists & Sets)
@@ -606,8 +697,9 @@ async def fetch_config(key: str, db: Kycore = Depends(get_db)):
606
697
 
607
698
  ## 🏗 Architecture & Internal Safety
608
699
 
609
- - **SQLite Engine**: Running in `WAL` (Write-Ahead Logging) mode for concurrent reads/writes.
610
- - **Atomic Operations**: Exports use a "temp-file then rename" strategy to prevent corruption.
700
+ - **Encrypted Single-File Storage**: Each workspace is a single AES-GCM-encrypted file. `kycli` decrypts it into an in-memory SQLite engine on open and re-serializes the whole workspace back to disk on every write.
701
+ - **Atomic Writes**: Every persist (workspace file, exports, audit export) uses a "temp-file then rename" strategy a concurrent reader always sees a complete file, never a partial/corrupted one.
702
+ - **Cross-Process Write Safety**: Writes from independent `kycli` processes sharing one workspace file are serialized via an OS-level advisory lock (`flock`, POSIX). A process reloads the latest on-disk state immediately before mutating it, so sibling processes' writes are never silently overwritten. *(Windows: atomic writes still prevent corruption, but cross-process mutual exclusion requires POSIX `flock` and is not yet supported.)*
611
703
  - **Data Integrity**: Keys are automatically lowercased and stripped to prevent duplicate-but-slightly-different keys.
612
704
  - **Auto-Purge Policy**: Deleted keys are moved to an **Archive** table and automatically purged after **15 days** to keep the database size optimized.
613
705
  - **Embedded C**: Core operations are written in Cython, binding directly to native library pointers.
@@ -36,6 +36,16 @@ Install the latest version from PyPI:
36
36
  pip install kycli
37
37
  ```
38
38
 
39
+ ### Validate The Install
40
+
41
+ Run the end-to-end command matrix from the repo root:
42
+
43
+ ```bash
44
+ bash scripts/validate_install.sh
45
+ ```
46
+
47
+ The validator auto-resolves a usable Python executable, prefers the active `python3` runtime, and runs stateful sections in isolated home directories so queue, profile, and policy checks do not interfere with each other.
48
+
39
49
  ---
40
50
 
41
51
  ## 💻 CLI Command Reference
@@ -60,7 +70,6 @@ pip install kycli
60
70
  | **`kyd`** | Delete Key | `kyd host` |
61
71
  | **`kypush`**| Push to List | `kypush logs "error"` |
62
72
  | **`kyrem`** | Remove from List | `kyrem tags "old"` |
63
- | **`kyrem`** | Remove from List | `kyrem tags "old"` |
64
73
  ### 🧱 Queues & Stacks Operations
65
74
  | Command | Description | Example |
66
75
  | :--- | :--- | :--- |
@@ -70,6 +79,8 @@ pip install kycli
70
79
  | **`kycount`** | Count items | `kycount` |
71
80
  | **`kyclear`** | Clear implementation | `kyclear` |
72
81
  | **`kyws`** | Create Typed WS | `kyws create q --type queue` |
82
+ | **`kyack`** | Ack leased item | `kyack <receipt_id>` |
83
+ | **`kynack`** | Requeue leased item | `kynack <receipt_id> --delay 30s` |
73
84
 
74
85
  ### 🔍 Search & Utility
75
86
  | Command | Description | Example |
@@ -90,6 +101,13 @@ pip install kycli
90
101
  | **`kyc`** | Execute Command | `kyc hello` |
91
102
  | **`kyco`** | Compact DB | `kyco 7` |
92
103
  | **`kyrotate`** | Rotate Master Key | `kyrotate --new-key "newpass" --old-key "oldpass" --backup` |
104
+ | **`kyttl`** | Workspace TTL policy | `kyttl set 1h` |
105
+ | **`kyprofile`** | Manage profiles | `kyprofile save dev` |
106
+ | **`kyacl`** | Workspace ACL/policy | `kyacl readonly on` |
107
+ | **`kyaudit`** | Export audit history | `kyaudit export audit.json json` |
108
+ | **`kystats`** | Show workspace stats | `kystats --json` |
109
+ | **`kybackup`** | Create/restore backup | `kybackup snapshot.db` |
110
+ | **`kymetrics`** | Local metrics endpoint | `kymetrics 8765` |
93
111
 
94
112
  ---
95
113
 
@@ -113,7 +131,6 @@ kyws
113
131
 
114
132
  #### `kymv` — Move Key
115
133
  Moves a key (and its value) from the current workspace to another.
116
- - **Safety**: Asks for confirmation if the key exists in the target.
117
134
  ```bash
118
135
  kymv my_api_key project_beta
119
136
  # Result: ✅ Moved 'my_api_key' to 'project_beta'.
@@ -121,16 +138,87 @@ kymv my_api_key project_beta
121
138
 
122
139
  #### `kydrop` — Delete Workspace
123
140
  Permanently deletes an entire workspace and its database file.
124
- - **Safety**: Requires explicit confirmation (`y/N`) in CLI.
125
- - **Restriction**: You cannot drop the currently active workspace.
126
141
  ```bash
127
142
  kydrop temp_test
128
143
  # Result: ⚠️ DANGER: Are you sure you want to PERMANENTLY delete workspace 'temp_test'? (y/N): y
129
144
  # Result: ✅ Workspace 'temp_test' deleted.
130
145
  ```
131
146
 
132
- ---
133
147
 
148
+ ## 🧭 Advanced Features
149
+
150
+ ### Queue Reliability
151
+ - **Batch Queue Ops**: `kypush --file` and `kypop --n 100` for throughput-oriented flows.
152
+ - **Delayed Jobs**: `kypush --delay 30s` schedules visibility in queue workspaces.
153
+ - **Visibility Timeout**: `kypop --lease 30s` with `kyack` and `kynack` supports retry flows.
154
+ - **Workspace TTL Policies**: `kyttl set/get` applies default TTL behavior per workspace.
155
+
156
+ ### Usability & DX
157
+ - **Config Profiles**: `kyprofile use prod` switches saved CLI defaults.
158
+ - **Output Formatting**: `--json` and `--pretty` are available on structured read paths.
159
+ - **Interactive TUI**: `kyshell` provides an interactive terminal workflow on top of the same engine.
160
+
161
+ ### Security & Compliance
162
+ - **Workspace ACLs**: `kyacl readonly on|off|status` supports write protection.
163
+ - **Workspace Access Keys**: `kyacl key set|get|clear` gates writes with `KYCLI_ACCESS_KEY`.
164
+ - **Audit Export**: `kyaudit export` supports JSON or CSV output with optional time filters.
165
+
166
+ ### Observability
167
+ - **Stats Command**: `kystats` exposes workspace type, counts, TTL usage, archive size, and DB size.
168
+ - **Metrics Endpoint**: `kymetrics` starts a local HTTP endpoint on `127.0.0.1`.
169
+
170
+ ### Data Management
171
+ - **Namespace/Prefix Views**: `kyws view <prefix>` filters large keyspaces.
172
+ - **Backup/Restore**: `kybackup` creates and restores encrypted snapshots.
173
+
174
+ ### Queue Reliability
175
+ ```bash
176
+ # Push from a file
177
+ kypush --file tasks.txt
178
+
179
+ # Delay visibility for 30 seconds
180
+ kypush "email:user_123" --delay 30s
181
+
182
+ # Lease one item for 30 seconds
183
+ kypop --lease 30s --json
184
+
185
+ # Acknowledge or requeue
186
+ kyack <receipt_id>
187
+ kynack <receipt_id> --delay 15s
188
+ ```
189
+
190
+ ### Workspace Policies
191
+ ```bash
192
+ # Set a default TTL for all new values in this workspace
193
+ kyttl set 1h
194
+ kyttl get
195
+
196
+ # Enable read-only mode
197
+ kyacl readonly on
198
+
199
+ # Protect a workspace with an access key
200
+ kyacl key set my-secret
201
+ KYCLI_ACCESS_KEY=my-secret kys protected value
202
+ ```
203
+
204
+ ### Profiles, Stats, and Backups
205
+ ```bash
206
+ kyprofile save dev
207
+ kyprofile list
208
+ kyprofile use dev
209
+
210
+ kystats --json
211
+ kyaudit export audit.json json --since "2026-01-01 00:00:00"
212
+ kybackup snapshot.db
213
+ kybackup restore snapshot.db
214
+ kymetrics 8765
215
+ ```
216
+
217
+ ### Maintenance & Reliability
218
+ - **Lock Management**: Retry with exponential backoff for "Database is locked" in multi-process scenarios.
219
+ - **Activity Logs**: Background logging via Python `logging` module.
220
+ - **Atomic Rename Exports**: Write-to-temp-then-rename for export safety.
221
+ - **Compression**: Optional large-value compression for storage efficiency.
134
222
  ### `kyh` — The Help Center
135
223
  Shows the available commands and basic usage instructions.
136
224
  ```bash
@@ -204,10 +292,13 @@ kyg logs[0:5]
204
292
  ```
205
293
 
206
294
  #### Atomic Patching (Partial Updates):
207
- Instead of rewriting a large JSON object, you can update just one field.
295
+ Instead of rewriting a large JSON object, you can update just one field. Use
296
+ `kypatch` (not `kys`) for this — `kys` always treats dots in a key as a literal
297
+ flat key name (e.g. for namespacing, like `kys ns.alpha 1`), while `kypatch`
298
+ treats them as a path into the nested object.
208
299
  ```bash
209
300
  # Update just the 'age' field inside the 'user' object
210
- kys user.profile.age 25
301
+ kypatch user.profile.age 25
211
302
  ```
212
303
 
213
304
  ### 📦 Collection Operations (Lists & Sets)
@@ -580,8 +671,9 @@ async def fetch_config(key: str, db: Kycore = Depends(get_db)):
580
671
 
581
672
  ## 🏗 Architecture & Internal Safety
582
673
 
583
- - **SQLite Engine**: Running in `WAL` (Write-Ahead Logging) mode for concurrent reads/writes.
584
- - **Atomic Operations**: Exports use a "temp-file then rename" strategy to prevent corruption.
674
+ - **Encrypted Single-File Storage**: Each workspace is a single AES-GCM-encrypted file. `kycli` decrypts it into an in-memory SQLite engine on open and re-serializes the whole workspace back to disk on every write.
675
+ - **Atomic Writes**: Every persist (workspace file, exports, audit export) uses a "temp-file then rename" strategy a concurrent reader always sees a complete file, never a partial/corrupted one.
676
+ - **Cross-Process Write Safety**: Writes from independent `kycli` processes sharing one workspace file are serialized via an OS-level advisory lock (`flock`, POSIX). A process reloads the latest on-disk state immediately before mutating it, so sibling processes' writes are never silently overwritten. *(Windows: atomic writes still prevent corruption, but cross-process mutual exclusion requires POSIX `flock` and is not yet supported.)*
585
677
  - **Data Integrity**: Keys are automatically lowercased and stripped to prevent duplicate-but-slightly-different keys.
586
678
  - **Auto-Purge Policy**: Deleted keys are moved to an **Archive** table and automatically purged after **15 days** to keep the database size optimized.
587
679
  - **Embedded C**: Core operations are written in Cython, binding directly to native library pointers.
@@ -37,15 +37,31 @@ This list tracks the progress of implementing high-performance and robust enhanc
37
37
  - [x] **100% Code Coverage Maintenance**
38
38
  ## Phase 6: Maintenance & Refinement ⚙️
39
39
  - [x] **Modular Refactoring** (Core engines split)
40
- - [ ] **Lock Management**: Retry with exponential backoff for "Database is locked" in multi-process scenarios.
41
- - [ ] **Activity Logs**: Background logging via Python `logging` module.
42
- - [ ] **Atomic Rename Exports**: Write-to-temp-then-rename for export safety.
43
- - [ ] **Compression**: Optional MsgPack/Zstd for large values.
40
+ - [x] **Lock Management**: Cross-process `flock` mutual exclusion + reload-on-write around every mutating operation, with atomic temp-file+rename persistence (no more lost updates or file corruption from concurrent `kycli` processes sharing a workspace).
41
+ - [x] **Activity Logs**: Background logging via Python `logging` module (`kycli/logging_utils.py`, writes to `~/.kycli/kycli.log`).
42
+ - [x] **Atomic Rename Exports**: Write-to-temp-then-rename for export safety (`kye`/`kyaudit export`, and now the internal workspace persistence itself).
43
+ - [x] **Compression**: Transparent zlib compression for values above a size threshold (workspace-configurable).
44
+
44
45
  ## Phase 7: Community & Branding 🤝
45
46
  - [x] **Community Guidelines** (COC, Contributing, Security)
46
47
  - [x] **Issue Templates**
47
48
  - [x] **Official Branding/Logo**
48
49
  - [x] **GitHub Repository Cleanup**
49
50
 
51
+ ## Phase 8: Roadmap (Planned Features) 🧭
52
+ - [ ] **Batch Queue Ops**: `kypush --file` and `kypop --n 100` for throughput.
53
+ - [ ] **Delayed Jobs**: `kypush --delay 30s` with scheduled dequeue.
54
+ - [ ] **Visibility Timeout**: `kypop --lease 30s` + `kyack`/`kynack` for retry flows.
55
+ - [ ] **Workspace TTL Policies**: Default TTL per workspace + `kyttl set/get`.
56
+ - [ ] **Interactive CLI Prompts**: Fuzzy key search + history in non-TUI mode.
57
+ - [ ] **Config Profiles**: `kyprofile use prod` to switch db path, master key, defaults.
58
+ - [ ] **Output Formatting**: `--json` everywhere; `--pretty` for tables.
59
+ - [ ] **Key ACLs / Scopes**: Read-only mode, write lock, per-workspace access key.
60
+ - [ ] **Audit Export**: `kyaudit export` with time filters.
61
+ - [ ] **Stats Command**: `kystats` for size, counts, TTL expirations, queue depth.
62
+ - [ ] **Metrics Endpoint**: Optional local HTTP for queue depth + ops/sec.
63
+ - [ ] **Namespace/Prefix Views**: `kyws view <prefix>` for large stores.
64
+ - [ ] **Backup/Restore**: `kybackup` with encryption and versioned snapshots.
65
+
50
66
  ---
51
67
  *Optimized for Performance by Antigravity*