@smartkomm/plexus-cli 0.1.70 → 0.1.72

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 +1 @@
1
- d59305ab45eee46eba354052349d895f5540b27626de54845b9b9902af734747
1
+ 8eaf19f05fc4f03783e495a998da45f004ddc721778c491a44260ba4f7f30539
@@ -228,6 +228,7 @@ whole is the operator's (ask them; do not try).
228
228
  | [persons/import-persons-from-csv.md](references/persons/import-persons-from-csv.md) | Mandant | Import pupils, their guardians and class enrollments from a person list (CSV + mapping file). |
229
229
  | [persons/purge-deleted-person.md](references/persons/purge-deleted-person.md) | Plattform | Delete a soft-deleted person for good. |
230
230
  | [platform/rename-tenant.md](references/platform/rename-tenant.md) | Plattform | Change a tenant's slug and display name in place, then its accounts' addresses. |
231
+ | [platform/sweep-storage-orphans.md](references/platform/sweep-storage-orphans.md) | Plattform | List the stored files no record names, then delete exactly the reviewed ones. |
231
232
  | [resolver/manage-contract-package.md](references/resolver/manage-contract-package.md) | Mandant + Plattform | Create, review and seal a contract package from one file by key. |
232
233
  | [resolver/manage-contract-resolver.md](references/resolver/manage-contract-resolver.md) | Mandant | Create, test, seal, assign and revise a contract resolver. |
233
234
  | [resolver/register-input-keys.md](references/resolver/register-input-keys.md) | Plattform | Register the platform-wide contract input keys a generator's fields need. |
@@ -1,7 +1,7 @@
1
1
  # plexus-cli command reference
2
2
 
3
3
  Generated from the commands the CLI registers — do not edit; `plexus-cli <command> --help` prints the same.
4
- 288 commands. Every network command also takes `--env <local|staging|prod>`, `--tenant <slug>`,
4
+ 290 commands. Every network command also takes `--env <local|staging|prod>`, `--tenant <slug>`,
5
5
  `--json` (raw JSON instead of a table) and `--allow-prod` (required for a writing run against production).
6
6
 
7
7
  - [Admission (offline)](#admission-offline) (1)
@@ -31,7 +31,7 @@ Generated from the commands the CLI registers — do not edit; `plexus-cli <comm
31
31
  - [Organisation (school token)](#organisation-school-token) (8)
32
32
  - [Persons (platform operator)](#persons-platform-operator) (1)
33
33
  - [Persons (school token)](#persons-school-token) (2)
34
- - [Platform (platform operator)](#platform-platform-operator) (6)
34
+ - [Platform (platform operator)](#platform-platform-operator) (8)
35
35
  - [Setup (platform operator)](#setup-platform-operator) (5)
36
36
  - [Signing (platform operator)](#signing-platform-operator) (5)
37
37
  - [Signing (school token)](#signing-school-token) (8)
@@ -3095,6 +3095,30 @@ Read the privileged-access log (platform-admin)
3095
3095
  | `--actor <value>` | Employee email to report accesses BY (tenant-scoped) |
3096
3096
  | `--with-actor` | Include the employee identity (needs _platform.audit.readActor) |
3097
3097
 
3098
+ ### `platform storage orphans apply`
3099
+
3100
+ Delete the stored objects that are BOTH in --list and orphaned in a fresh run (each asked once more before its delete); both differences are reported, never deleted. Dry run unless --confirm.
3101
+
3102
+ - **Right:** platform operator — needs a `_platform.*` right; a school's token is refused
3103
+ - **Effect:** plan by default — writes only with `--confirm` (and `--env`; on production also `--allow-prod`)
3104
+
3105
+ | Option | Description |
3106
+ |---|---|
3107
+ | `--list <value>` (required) | The file `platform storage orphans plan --out` wrote (or one storage id per line) |
3108
+ | `--confirm` | Actually delete (default: dry run — a fresh plan compared with the list) |
3109
+
3110
+ ### `platform storage orphans plan`
3111
+
3112
+ Read-only: every stored object no row names, at least 7 days old and not pinned by a setup export — count, volume, type, month, copy or single. --out writes the list `apply --list` takes.
3113
+
3114
+ - **Right:** platform operator — needs a `_platform.*` right; a school's token is refused
3115
+ - **Effect:** read — changes nothing on the deployment
3116
+
3117
+ | Option | Description |
3118
+ |---|---|
3119
+ | `--out <value>` | Write the full plan (with every orphan's id) as JSON (refused when it exists, unless --force) |
3120
+ | `--force` | Overwrite an existing --out file. |
3121
+
3098
3122
  ### `platform tenant rename`
3099
3123
 
3100
3124
  Change a tenant's slug and name in place (plan unless --confirm)
@@ -0,0 +1,59 @@
1
+ # Sweep storage orphans
2
+
3
+ **When to use:** stored files pile up that no record names any more — uploads
4
+ whose flow was abandoned, copies left by test runs, files of deleted records.
5
+ The nightly report (a GlitchTip warning "storage orphans found") says how many;
6
+ this recipe lists them and deletes exactly the ones you reviewed.
7
+
8
+ ## Prerequisites
9
+ - A platform token: `_platform.config.read` for the plan,
10
+ `_platform.config.manage` for the apply.
11
+ - Any planned deletion of whole records (applications, contracts, persons) has
12
+ run first — it frees their files, which the next plan then lists.
13
+
14
+ ## What counts as an orphan
15
+
16
+ An object is listed **because no row names it** — no file column, and no text
17
+ inside any row (form answers, master-data values, JSON fields, message
18
+ attachments) — it is **at least 7 days old** and **no retained setup export
19
+ pins it**. Its upload bookkeeping never decides: an object nobody names is
20
+ listed whatever that bookkeeping says, and an object somebody names is never
21
+ listed.
22
+
23
+ ## Steps
24
+ ```bash
25
+ # 1. Plan — read-only; prints count, volume, type and month, and writes every id
26
+ plexus-cli --env <env> platform storage orphans plan --out <scratch>/orphans.json
27
+
28
+ # 2. Review the file: per orphan its id, size, type, month and `copy`
29
+ # (true = the same bytes are stored more than once, false = the only copy)
30
+
31
+ # 3. Dry run of the apply — a fresh plan compared with the list, nothing deleted
32
+ plexus-cli --env <env> platform storage orphans apply --list <scratch>/orphans.json
33
+
34
+ # 4. Apply (--allow-prod only on prod)
35
+ plexus-cli --env <env> platform storage orphans apply --list <scratch>/orphans.json --confirm --allow-prod
36
+ ```
37
+
38
+ The apply deletes only objects that are **both** in the list **and** orphaned in
39
+ a fresh run, and asks each object once more right before its delete. Ids only in
40
+ the list (held again, gone) and ids only in the run (orphaned since the plan)
41
+ are reported and **not** deleted — plan again to take the latter.
42
+
43
+ To delete only part of the plan (for example only the copies), write the ids you
44
+ approve into a file, one per line, and pass that file as `--list`.
45
+
46
+ ## Verify
47
+ ```bash
48
+ plexus-cli --env <env> platform storage orphans plan # orphaned: 0 (or only what was left out on purpose)
49
+ ```
50
+
51
+ ## Idempotency / gotchas
52
+ - Re-running the apply with the same list deletes nothing more: the deleted ids
53
+ are now "only in the list".
54
+ - The plan reads every row that can carry a file reference in free text; on a
55
+ large deployment it takes minutes.
56
+ - The nightly report never deletes.
57
+
58
+ ## Related
59
+ - [Rename a tenant](./rename-tenant.md)