@smartkomm/plexus-cli 0.0.0-stage → 0.1.0

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 (80) hide show
  1. package/README.md +826 -2
  2. package/dist/cli.mjs +483 -0
  3. package/dist/skill/.managed-by-plexus-cli +1 -0
  4. package/dist/skill/SKILL.md +185 -0
  5. package/dist/skill/references/accounts/email-changes.md +46 -0
  6. package/dist/skill/references/applications/inspect-process-store.md +61 -0
  7. package/dist/skill/references/applications/start-a-test-application.md +66 -0
  8. package/dist/skill/references/audit/answer-access-request.md +115 -0
  9. package/dist/skill/references/config/attach-a-template.md +117 -0
  10. package/dist/skill/references/config/init-tenant.md +121 -0
  11. package/dist/skill/references/config/onboard-tenant.md +71 -0
  12. package/dist/skill/references/config/rename-program-stage.md +99 -0
  13. package/dist/skill/references/config/set-tenant-branding.md +150 -0
  14. package/dist/skill/references/config/set-tenant-terms.md +50 -0
  15. package/dist/skill/references/config/set-up-billing-catalog.md +73 -0
  16. package/dist/skill/references/config/update-tenant-config.md +170 -0
  17. package/dist/skill/references/config/wipe-tenant-config.md +107 -0
  18. package/dist/skill/references/export/create-named-export.md +47 -0
  19. package/dist/skill/references/feedback/create-and-triage-feedback.md +69 -0
  20. package/dist/skill/references/feedback/manage-feedback-tags.md +57 -0
  21. package/dist/skill/references/finance/change-contract-grant.md +36 -0
  22. package/dist/skill/references/finance/record-submission-date.md +33 -0
  23. package/dist/skill/references/interessenten/list-interessenten.md +54 -0
  24. package/dist/skill/references/notifications/debug-mail-delivery.md +77 -0
  25. package/dist/skill/references/notifications/mail-level.md +90 -0
  26. package/dist/skill/references/notifications/reword-a-letter.md +155 -0
  27. package/dist/skill/references/notifications/trace-a-login.md +50 -0
  28. package/dist/skill/references/offer/add-workflow-node.md +268 -0
  29. package/dist/skill/references/offer/addresses.md +129 -0
  30. package/dist/skill/references/offer/appointment-task.md +79 -0
  31. package/dist/skill/references/offer/assignment-rule.md +195 -0
  32. package/dist/skill/references/offer/attach-form-to-workflow.md +79 -0
  33. package/dist/skill/references/offer/author-form-scenarios.md +97 -0
  34. package/dist/skill/references/offer/author-manifest-meta.md +94 -0
  35. package/dist/skill/references/offer/author-smartform.md +102 -0
  36. package/dist/skill/references/offer/bind-node-input.md +76 -0
  37. package/dist/skill/references/offer/completeness-check.md +137 -0
  38. package/dist/skill/references/offer/countersign-node.md +91 -0
  39. package/dist/skill/references/offer/create-pedagogy-unit.md +55 -0
  40. package/dist/skill/references/offer/declare-node-reads.md +99 -0
  41. package/dist/skill/references/offer/edit-live-tenant-offer.md +144 -0
  42. package/dist/skill/references/offer/edit-smartform.md +121 -0
  43. package/dist/skill/references/offer/edit-workflow-node.md +126 -0
  44. package/dist/skill/references/offer/engage-push-node.md +147 -0
  45. package/dist/skill/references/offer/insert-and-rewire-node.md +67 -0
  46. package/dist/skill/references/offer/node-tasks.md +162 -0
  47. package/dist/skill/references/offer/optional-assessment.md +65 -0
  48. package/dist/skill/references/offer/publish-offer-bundle.md +117 -0
  49. package/dist/skill/references/offer/set-offer-capacities.md +78 -0
  50. package/dist/skill/references/offer/staff-input-if-node.md +112 -0
  51. package/dist/skill/references/offer/task-appointment-result.md +69 -0
  52. package/dist/skill/references/offer/task-family-request.md +69 -0
  53. package/dist/skill/references/offer/task-result-files.md +52 -0
  54. package/dist/skill/references/offer/template-document-node.md +113 -0
  55. package/dist/skill/references/offer/workflow-default-channels.md +69 -0
  56. package/dist/skill/references/resolver/manage-contract-resolver.md +159 -0
  57. package/dist/skill/references/retention/erase-due-applications.md +99 -0
  58. package/dist/skill/references/retention/erase-due-parties.md +107 -0
  59. package/dist/skill/references/roles/migrate-parent-assignments.md +31 -0
  60. package/dist/skill/references/signing/README.md +113 -0
  61. package/dist/skill/references/signing/connect-a-school.md +90 -0
  62. package/dist/skill/references/signing/rotate-the-key.md +41 -0
  63. package/dist/skill/references/stammdaten/purge-deleted-person.md +68 -0
  64. package/dist/skill/references/stripe/connect-a-school.md +107 -0
  65. package/dist/skill/references/stripe/request-and-verify-a-payment.md +78 -0
  66. package/dist/skill/references/test-actions/drive-a-test-application.md +59 -0
  67. package/dist/skill/references/users/add-platform-admin.md +59 -0
  68. package/dist/skill/references/users/add-platform-user.md +59 -0
  69. package/dist/skill/references/users/add-tenant-admin.md +75 -0
  70. package/dist/skill/references/users/change-login-email.md +55 -0
  71. package/dist/skill/references/users/cli-access-for-tenant-admin.md +117 -0
  72. package/dist/skill/references/users/delete-permission-group.md +76 -0
  73. package/dist/skill/references/users/grant-cross-tenant-access.md +57 -0
  74. package/dist/skill/references/users/grant-feedback-assignable.md +43 -0
  75. package/dist/skill/references/users/set-password.md +57 -0
  76. package/dist/skill/references/users/use-test-account.md +79 -0
  77. package/dist/skill/references/worker-ops/debug-worker-jobs.md +90 -0
  78. package/dist/skill/references/worker-ops/verify-migrations.md +51 -0
  79. package/dist/spec.snapshot.json +145815 -0
  80. package/package.json +53 -4
@@ -0,0 +1,79 @@
1
+ # Use a tenant's test account
2
+
3
+ **When to use:** you want to walk a school's actual admission process as an
4
+ applicant — on local, staging or prod — without registering a new address first.
5
+
6
+ ## Prerequisites
7
+
8
+ - The account exists already in every tenant with an applicant portal:
9
+ `config:bootstrap` provisions it on every deploy, `config apply` on every
10
+ tenant onboarding, and the local development seed. Nothing to create.
11
+ - Identity: **`test@example.com`** ("Test Bewerber", stable key `fixture_test`
12
+ on `user_tenant_access.configKey`), a member of the tenant's applicant group.
13
+ - Staging/prod: a platform admin (`_platform.users.manage`) to set its password
14
+ once per deployment.
15
+
16
+ ## Steps
17
+
18
+ ### 1. Check the account in the target tenant
19
+
20
+ ```bash
21
+ plexus-cli --env <local|staging|prod> users show test@example.com
22
+ ```
23
+
24
+ Expect one access row per tenant with an applicant portal, each in the
25
+ `applicant` group.
26
+
27
+ ### 2. Set a password (staging / prod, once per deployment)
28
+
29
+ A deploy provisions the account with a random password nobody holds. Set one:
30
+
31
+ ```bash
32
+ plexus-cli --env <staging|prod> --tenant <slug> users set-password test@example.com
33
+ ```
34
+
35
+ The identity is global, so this one password opens the account in **every**
36
+ tenant of that deployment. The plaintext is printed once — password manager,
37
+ not a ticket.
38
+
39
+ **Local** needs no password: the account carries the dev-login marker, so
40
+ `/login?as=test@example.com&redirect=/<slug>/e` signs in as it.
41
+
42
+ ### 3. Apply
43
+
44
+ Open `https://<host>/<slug>/e`, start the offer, fill the form — the same
45
+ surfaces a parent uses.
46
+
47
+ ## Verify
48
+
49
+ ```bash
50
+ # It is the test row of "Wer ist der Antragsteller?" (needs testActions.run).
51
+ plexus-cli --env <env> call admission:testApplicantParties client=<slug>
52
+ ```
53
+
54
+ ## Gotchas
55
+
56
+ - **Every application of it is a test application.** Started by the
57
+ account itself through the portal (any Testmodus checkbox is irrelevant) or
58
+ by staff from the internal „+ Bewerbung" dialog (its amber first row, for
59
+ anyone with `bewerbungsmanagement.testActions.run`; refused without it), the
60
+ server derives test mode from the key. Discard it like any test application.
61
+ - **Mail.** Never sent, in any mode (staging `redirect` included):
62
+ `example.com` is a reserved test address, so the delivery is rendered and
63
+ recorded and settles `skipped` / `reserved_address` — sign in with the
64
+ password, not a magic link.
65
+ - **A deploy never rotates the password.** An existing credential is preserved,
66
+ so a password you distributed survives every `config:bootstrap`.
67
+ - **Identity is the key, not the name.** Renaming "Test Bewerber" moves the row;
68
+ it never creates a second account.
69
+ - **A real account on `test@example.com` fails the deploy** (`config:bootstrap`
70
+ throws "not the test fixture"). Move that account to another address first.
71
+ - **Not in `config export`.** The account is platform-provisioned, so it is
72
+ never emitted as a config user.
73
+ - Skipped (and named in the bootstrap result under `fixtures.skipped`): tenants
74
+ without a `defaultApplicantGroupKey`, and the reserved `_platform` tenant.
75
+
76
+ ## Related
77
+
78
+ - [Drive a test application through test mode](../test-actions/drive-a-test-application.md)
79
+ - [Set (rotate) a user's password](./set-password.md)
@@ -0,0 +1,90 @@
1
+ # Debug a stuck / failed import or worker job
2
+
3
+ **When to use:** an import shows "running" but looks stuck, the Worker console
4
+ shows no active worker, a job failed and you need to know why, or you must clean
5
+ up a stranded import run. This is the **canonical agent debugging setup** for the
6
+ worker/job system: `plexus-cli` for the LIVE job/worker/import state +
7
+ `glitchtip-cli` for the captured stack traces.
8
+
9
+ ## Prerequisites
10
+ - `--env local|staging|prod`; the new worker/job commands need **platform-admin**
11
+ (the configured token already is, on staging/prod).
12
+ - For the stack traces: access to the platform's GlitchTip (the error tracker the
13
+ worker reports to), e.g. through `glitchtip-cli` (`glitchtip-cli info` shows the
14
+ server + auth). That is platform-operator access; without it, ask the operator.
15
+
16
+ ## Steps
17
+
18
+ ```bash
19
+ # 1. Live fleet: is any worker alive, and what is it running right now?
20
+ plexus-cli --env prod platform workers --json # lifecycle live|stale|dead, currentJob
21
+
22
+ # 2. The jobs themselves (generic queue). Filter to what's stuck/broken.
23
+ plexus-cli --env prod jobs list --status running # genuinely in flight
24
+ plexus-cli --env prod jobs list --status failed --kind import
25
+ plexus-cli --env prod jobs show <jobId> # lease, attempts, phase, error, run timeline
26
+ plexus-cli --env prod jobs logs <jobId> # captured worker stdout/stderr
27
+
28
+ # 3. Import-domain view (imports stuck "still running" live here, NOT in jobs).
29
+ plexus-cli --env prod imports status --tenant <slug>
30
+
31
+ # 4. Captured exceptions for the failure (stack trace + tags).
32
+ glitchtip-cli issues list
33
+ # GlitchTip event tags the worker attaches: errorSource=backend:worker,
34
+ # jobKind, jobId, importRunId, configKey. Filter by them via GlitchTip's API
35
+ # (the CLI `issues list` has no tag filter).
36
+
37
+ # 5. Is the reaper (the only authority that frees stuck leases) actually firing?
38
+ plexus-cli --env prod workers reaper-status --json # ranAt should be < ~1 min old
39
+ ```
40
+
41
+ ### The decision rule (why did the worker die?)
42
+
43
+ A job reaper-failed / vanished, **and**:
44
+ - **GlitchTip HAS an event** → it was a JS throw. Read the stack in the issue.
45
+ - **GlitchTip has NO event** → uncatchable **OOM/SIGKILL**. The only trace is the
46
+ reaper-failed job; its error message names the last phase + idle time (e.g.
47
+ *"vanished during phase 'importing' after N min"*). Confirming it needs a
48
+ platform operator with host access: the worker container's **exit code 137**
49
+ (or the kernel's OOM-killer log).
50
+
51
+ ## Recovery
52
+
53
+ ```bash
54
+ # Force a reaper pass now instead of waiting for the 1-min cron.
55
+ plexus-cli --env prod workers reap --allow-prod --json
56
+
57
+ # Clear import runs stuck 'running' with no active job (the orphan class).
58
+ # DRY-RUN first (no --confirm), then confirm. Marks failed, never deletes.
59
+ plexus-cli --env prod imports cleanup-orphaned --tenant <slug>
60
+ plexus-cli --env prod imports cleanup-orphaned --allow-prod --tenant <slug> --confirm
61
+ plexus-cli --env prod imports cleanup-orphaned --all-tenants # dry-run sweep
62
+
63
+ # Cancel a job that should not be running.
64
+ plexus-cli --env prod jobs cancel --allow-prod <jobId>
65
+ ```
66
+
67
+ ## Verify
68
+
69
+ ```bash
70
+ plexus-cli --env prod imports status --tenant <slug> # the stuck run now 'failed'
71
+ plexus-cli --env prod jobs list --status running # nothing unexpectedly in flight
72
+ ```
73
+
74
+ ## Idempotency / gotchas
75
+ - `cleanup-orphaned` and `jobs cancel` flip rows to **failed/canceled**, never
76
+ delete — history is preserved. `cleanup-orphaned` is dry-run unless `--confirm`.
77
+ - Since the terminal-state fix (the job registry's `onTerminal` hook), a job
78
+ that terminally fails now propagates to its `import_runs` row automatically —
79
+ **new** orphans shouldn't appear; `cleanup-orphaned` is for pre-fix strays and
80
+ as a backstop.
81
+ - The **reaper** only touches the generic `jobs` table (frees leases / fails
82
+ stalled jobs); it does **not** scan `import_runs`. A "running" import with all
83
+ workers idle = an orphaned domain row → use `cleanup-orphaned`.
84
+ - `jobs list --kind` filters client-side after paging; raise `--limit` if you page
85
+ past the row you want.
86
+
87
+ ## Related
88
+ - [Verify that a deploy's migrations ran](./verify-migrations.md)
89
+ - Command reference: `plexus-cli jobs list --help`, `plexus-cli workers reap --help`,
90
+ `plexus-cli imports cleanup-orphaned --help`.
@@ -0,0 +1,51 @@
1
+ # Verify that a deploy's migrations ran
2
+
3
+ **When to use:** after a staging or production deploy whose release lists
4
+ pending migrations (the release's `PENDING_MIGRATIONS` list), when you need the
5
+ state from the deployment itself rather than from the deploy log. The deploy job
6
+ already prints, by name, the dry run of the next migration, every migration that
7
+ ran (with its document count) and a final check that every pending entry is
8
+ `success` — it goes red if any is not; that log is the platform operator's.
9
+
10
+ ## Prerequisites
11
+ - `--env staging|prod` (or `local` for a local development backend).
12
+ - The CLI token's user holds `_platform.config.read` (every full platform
13
+ admin does). Anyone else gets `FORBIDDEN`.
14
+
15
+ ## Steps
16
+
17
+ ```bash
18
+ plexus-cli --env staging migrations status # pending migrations, exit 1 while one is not success
19
+ plexus-cli --env staging migrations status --recent # + the 20 most recently started of any name
20
+ plexus-cli --env staging migrations status --json # raw answer + `unfinished`
21
+ ```
22
+
23
+ A release script gates on the exit code instead of grepping the output:
24
+ `plexus-cli --env prod migrations status || exit 1`.
25
+
26
+ Underneath it reads `migrations:getStatus`, which returns two lists of `{ name, state, isDone, processed, error, latestStart, latestEnd }`:
27
+ - **`pending`**: every entry of `PENDING_MIGRATIONS`, in run order. After a good
28
+ deploy each one reads `state: "success"`, `isDone: true`. A name that reads
29
+ `unknown` never started on this deployment.
30
+ - **`recent`**: the 20 most recently started migrations of any name, newest
31
+ first. Use it to see what the last deploy actually touched.
32
+
33
+ ## Verify
34
+ - Every `pending` entry is `success`, and `latestEnd` is after the deploy's
35
+ workflow run started.
36
+ - `pending` is empty when the release carries no migration. Then there is
37
+ nothing to verify, and the migration step only pushed functions.
38
+
39
+ ## Gotchas
40
+ - `failed` or `canceled` with an `error`: `runPending` threw and the deploy
41
+ stopped before the config bootstrap. Read the error here; the host-side output
42
+ is in the deploy log (platform operator).
43
+ - `inProgress` long after the deploy means the migration is stuck. Hand it to a
44
+ platform operator; do not try to restart it from the CLI.
45
+ - A local development backend lists every pending migration as `unknown` (exit 1): the seed
46
+ builds data in the new shape and never runs migrations. Only staging/prod answer the question.
47
+ - „Could not find public function migrations:getStatus“: the CLI points at a deployment
48
+ without this release (often a local development backend that never received the
49
+ functions). Check `--env` (`plexus-cli config show`).
50
+ - The query shows names, state, progress and errors only; it never returns a
51
+ cursor or document data.