hazo_env 0.15.3 → 0.16.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 (47) hide show
  1. package/CHANGE_LOG.md +72 -0
  2. package/README.md +316 -0
  3. package/dist/cli.js +102 -14
  4. package/dist/deploy/build.d.ts.map +1 -1
  5. package/dist/deploy/build.js +20 -14
  6. package/dist/deploy/clean.d.ts +2 -1
  7. package/dist/deploy/clean.d.ts.map +1 -1
  8. package/dist/deploy/clean.js +36 -6
  9. package/dist/deploy/generate-readme-cli.d.ts +3 -0
  10. package/dist/deploy/generate-readme-cli.d.ts.map +1 -0
  11. package/dist/deploy/generate-readme-cli.js +40 -0
  12. package/dist/deploy/help.d.ts +55 -0
  13. package/dist/deploy/help.d.ts.map +1 -0
  14. package/dist/deploy/help.js +526 -0
  15. package/dist/deploy/index.d.ts +3 -0
  16. package/dist/deploy/index.d.ts.map +1 -1
  17. package/dist/deploy/index.js +3 -0
  18. package/dist/deploy/init.d.ts +8 -0
  19. package/dist/deploy/init.d.ts.map +1 -1
  20. package/dist/deploy/init.js +12 -1
  21. package/dist/deploy/rollback.d.ts +10 -1
  22. package/dist/deploy/rollback.d.ts.map +1 -1
  23. package/dist/deploy/rollback.js +25 -1
  24. package/dist/deploy/share.d.ts +28 -0
  25. package/dist/deploy/share.d.ts.map +1 -0
  26. package/dist/deploy/share.js +53 -0
  27. package/dist/deploy/shared-dirs.d.ts +128 -0
  28. package/dist/deploy/shared-dirs.d.ts.map +1 -0
  29. package/dist/deploy/shared-dirs.js +486 -0
  30. package/dist/deploy/status.d.ts +8 -0
  31. package/dist/deploy/status.d.ts.map +1 -1
  32. package/dist/deploy/status.js +6 -0
  33. package/dist/deploy/switch.d.ts.map +1 -1
  34. package/dist/deploy/switch.js +25 -0
  35. package/dist/deploy/types.d.ts +18 -0
  36. package/dist/deploy/types.d.ts.map +1 -1
  37. package/dist/envsync/engine.d.ts.map +1 -1
  38. package/dist/envsync/engine.js +21 -7
  39. package/dist/envsync/paths.d.ts +22 -0
  40. package/dist/envsync/paths.d.ts.map +1 -1
  41. package/dist/envsync/paths.js +55 -0
  42. package/dist/resolve/deploy.d.ts.map +1 -1
  43. package/dist/resolve/deploy.js +165 -0
  44. package/dist/resolve/envsync.d.ts +16 -0
  45. package/dist/resolve/envsync.d.ts.map +1 -1
  46. package/dist/resolve/envsync.js +19 -0
  47. package/package.json +3 -2
package/CHANGE_LOG.md CHANGED
@@ -1,5 +1,77 @@
1
1
  # hazo_env — Change Log
2
2
 
3
+ ## 0.16.0 — 2026-11-25
4
+
5
+ New: shared dirs — upload folders (photos, blog images, composer exports, ...)
6
+ now persist across blue-green `deploy switch`/`deploy init` instead of
7
+ silently splitting per slot (every file written while one slot was live was
8
+ previously invisible after the next switch).
9
+
10
+ - **`shared_root`** config field (`[deploy]` section): absolute directory,
11
+ outside both slot dirs, that holds the real files. Default
12
+ `~/<app_name>-shared` (`~` expanded). Validated at config-resolve time to
13
+ sit outside both the current and peer slot directories.
14
+ - **`shared_dirs`** config field (`[deploy]` section): comma list of
15
+ slot-relative folders (e.g. `var/uploads, data/blog-images`) to persist.
16
+ Default `[]` — feature off, zero behaviour change for existing apps.
17
+ Rejects absolute paths, `..` traversal, duplicates, nested entries, and
18
+ (when `db_strategy` resolves to `copy`) any entry containing the sqlite db
19
+ path — each via a typed `HazoConfigError`.
20
+ - **New core module** `src/deploy/shared-dirs.ts`: `inspectSharedDirs()`
21
+ reports each dir's per-slot state (`linked` / `missing` / `empty-dir` /
22
+ `real-dir` with a file count / `wrong-link`); `ensureLinks()`
23
+ creates/self-heals links (`allowCreate`, `allowReplaceEmpty`). Both throw
24
+ typed `SharedDirError`s (`HAZO_ENV_SHARED_DIR_MISSING` / `_EMPTY_DIR` /
25
+ `_REAL_DIR` / `_WRONG_LINK`). All deploy commands go through this module —
26
+ none touch shared-dir paths on the filesystem directly.
27
+ - **`deploy init`** creates the freshly-cloned peer's shared-dir symlinks
28
+ (`allowCreate: true`) so a new standby is correct from its first build.
29
+ - **`deploy build`** self-heals a missing link and replaces a leftover empty
30
+ real dir on the standby before the destructive `git-pull` step — the only
31
+ command that auto-creates or auto-replaces. A non-empty real dir or a link
32
+ to the wrong target aborts the build, pointing at `deploy share`.
33
+ - **`deploy switch`/`deploy rollback`** refuse to promote/restore a slot with
34
+ any shared-dir drift (any state other than `linked`), bypassable with the
35
+ existing `--force`.
36
+ - **`deploy status`** gains a per-dir, per-slot shared-dirs table.
37
+ - **`deploy clean`** never deletes through a shared-dir symlink — a clean
38
+ target that overlaps a configured `shared_dirs` entry is skipped with a
39
+ warning instead of being `rm -rf`'d.
40
+ - **New command `deploy share`** (`src/deploy/share.ts`, `--dry-run`):
41
+ one-time migration for an app that already has real, per-slot data in
42
+ what `shared_dirs` now names. Merges standby then live into `shared_root`
43
+ (live wins on content conflict; the losing copy is parked under
44
+ `shared_root/.conflicts/<slot>/<dir>/...`, never overwritten or deleted;
45
+ identical files are de-duped silently), swaps the standby's real dir for
46
+ a symlink first and the live slot's last so the running app sees the swap
47
+ as late and as briefly as possible, then re-scans the renamed
48
+ `<dir>.pre-share-<timestamp>` backups for files written during that
49
+ window and merges those too. Idempotent — an already-linked dir reports
50
+ "already linked", and a hand-made link to the expected target is adopted
51
+ rather than redone. Aborts untouched (atomic, all-or-nothing) if any dir
52
+ is already a symlink to the wrong target in either slot. Reports a new
53
+ `RunShareResult` (per-dir counts: from live, from standby, identical,
54
+ conflicts, final link target).
55
+ - **`envsync`**: the realpath containment check (`src/envsync/paths.ts`,
56
+ `src/envsync/engine.ts`) now treats files reached through a shared-dir
57
+ symlink as in-bounds when `[data] root`/`files_root` resolves through one,
58
+ so dumps/restores keep working once an app adopts shared dirs.
59
+ - **Help + docs**: every `deploy` subcommand and every `[deploy]` config key
60
+ now has structured help metadata (`src/deploy/help.ts`) driving
61
+ `hazo-env deploy --help`, `hazo-env deploy <cmd> --help`, and the new
62
+ documentation-only `hazo-env deploy config --help` — reads/writes per live
63
+ slot/standby slot/shared root/state file, config keys used, failure modes
64
+ with exact error codes, examples. `npm run docs:deploy`
65
+ (`src/deploy/generate-readme-cli.ts`) regenerates README.md's "Deploy"
66
+ section — including a first-time "Shared dirs" migration walkthrough —
67
+ from the same metadata, so the CLI and README cannot drift apart.
68
+ - Out of scope (unchanged by this release): object storage (S3/R2)
69
+ migration, sharing sqlite databases between slots, automatic deletion of
70
+ `.pre-share-*` backups, and per-app adoption config for Kinstripe/GoTimer
71
+ (tracked as separate specs).
72
+ - See `docs/adr/0001-shared-dirs-via-symlinks.md` for the symlink-vs-env-var-
73
+ vs-object-storage decision record.
74
+
3
75
  ## 0.15.3 — 2026-11-23
4
76
 
5
77
  Fix: `deploy build` auto-stashes local changes before `git pull`.
package/README.md CHANGED
@@ -194,6 +194,322 @@ hazo-env sync download-files | upload-files --archive <p> [--confirm] [--allow-p
194
194
  hazo-env serve [--port <n>] [--bind <host>] # requires HAZO_ENVSYNC_TOKEN
195
195
  ```
196
196
 
197
+ <!-- BEGIN GENERATED: deploy section (see src/deploy/help.ts) -->
198
+
199
+ ## Deploy (blue-green orchestration)
200
+
201
+ Drives `hazo-env deploy <subcommand>`. Two sibling directories differing only by a blue/green `dir_suffix` (e.g. `gotimer-blue/`, `gotimer-green/`) — one live, one standby — swap roles on `deploy switch`. State lives at `~/.hazo-deploy/<app_name>.json`, never inferred from the directory name alone. All subcommand and config docs below are generated from `src/deploy/help.ts` — see `hazo-env deploy --help` / `hazo-env deploy <cmd> --help` / `hazo-env deploy config --help` for the same content at the terminal.
202
+
203
+ ### Subcommands
204
+
205
+ | Command | Purpose |
206
+ |---|---|
207
+ | `deploy init` | Create peer dir, clone repo, generate config, write state |
208
+ | `deploy build` | Run the full build pipeline on the standby dir |
209
+ | `deploy verify` | Re-run health/typecheck/migration checks on standby |
210
+ | `deploy switch` | Stop prod, start standby on the prod port, run post-switch hooks |
211
+ | `deploy rollback` | Reverse the last switch |
212
+ | `deploy status` | Show live/standby dirs, ports, PM2 state, disk/memory, shared dirs |
213
+ | `deploy clean` | Reclaim disk space from old builds and caches |
214
+ | `deploy share` | One-time migration: merge shared_dirs into shared_root + symlink |
215
+ | `deploy config` | Show every `[deploy]` config key (default, meaning, example) |
216
+
217
+ #### `deploy init`
218
+
219
+ Creates the sibling "standby" directory for a brand-new blue-green app: clones the current directory's git origin into `<app>-<opposite dir_suffix>`, rewrites the clone's own `dir_suffix`, copies gitignored env files across, and records both directories in the state file. Run once, from what becomes the "live" directory.
220
+
221
+ If `shared_dirs` is configured, also creates the peer's shared-dir symlinks so the freshly-cloned standby is correct before its first `deploy build` ever runs — see "Shared dirs" below.
222
+
223
+ **Reads:**
224
+ - live slot: `config/hazo_env_config.ini` (the resolved `[deploy]` section)
225
+ - live slot: `git remote get-url origin`
226
+ - live slot: each `env_files` entry present on disk (best-effort — missing ones are reported, not fatal)
227
+
228
+ **Writes:**
229
+ - external: a new sibling directory — `git clone <origin>` into `<app>-<opposite dir_suffix>`
230
+ - standby slot: `config/hazo_env_config.ini`, with `dir_suffix` swapped blue↔green
231
+ - standby slot: the `[data] root` directory, when the app is sqlite-backed (`db_strategy` resolves to `copy`)
232
+ - standby slot: each found `env_files` entry, copied in (gitignored secrets never travel through `git clone`)
233
+ - shared root + standby slot: shared-dir symlinks — `ensureLinks(standbyDir, { allowCreate: true })` creates `shared_root/<dir>` and the standby's `<dir>` symlink for every `shared_dirs` entry not already linked
234
+ - state file: `~/.hazo-deploy/<app_name>.json` written fresh (`live_dir` = current dir, `standby_dir` = the new peer)
235
+
236
+ **Config keys used:** `app_name`, `dir_suffix`, `env_files`, `shared_root`, `shared_dirs`
237
+
238
+ **Failure modes:**
239
+ - (plain Error) "Peer directory already exists" — refuses to overwrite an existing peer; remove the stale directory by hand before retrying.
240
+ - (plain Error) "Cannot swap dir_suffix ... expected \"blue\" or \"green\"" / "Could not find a \"dir_suffix = ...\" line" — `dir_suffix` must be exactly "blue" or "green" for the INI rewrite to find and flip it.
241
+ - SharedDirError "HAZO_ENV_SHARED_DIR_REAL_DIR" / "HAZO_ENV_SHARED_DIR_WRONG_LINK" — the freshly-cloned peer already has a real or wrongly-linked `shared_dirs` path (stale debris from a prior partial `init`); run "hazo-env deploy share" to migrate it instead of re-running `init`.
242
+
243
+ **Examples:**
244
+ ```
245
+ hazo-env deploy init
246
+ ```
247
+
248
+ #### `deploy build`
249
+
250
+ - `--stop-prod` — If the memory check fails, stop the live PM2 process first to free memory, then re-check.
251
+ - `--branch=<b>` — Override `config.branch` for the git pull step.
252
+ - `--db=<env>` — Resolve `[db.<env>]` instead of the current `HAZO_ENV` when validating a "shared" db strategy.
253
+ - `--peer-dir=<path>` — Override which directory is treated as "live" for the `--stop-prod` target and the sqlite-copy source (the state file's `live_dir` is still used otherwise).
254
+
255
+ Must be run FROM the standby directory — a "standby-dir-guard" step aborts immediately if the state file says `cwd` isn't the recorded `standby_dir`, because running the pipeline against the live dir would git-pull/rebuild the running production tree and, for a sqlite "copy" `db_strategy`, overwrite the live database with the standby's stale one.
256
+
257
+ Steps run in order and any failure aborts immediately: standby-dir-guard → clean → disk-check → memory-check (→ stop-prod, only if `--stop-prod` and memory is still low) → db-resolve → shared-dirs → git-pull → install → pre-build → build → db-setup → migrate → clean-stale-staging → start-staging → health-check.
258
+
259
+ The "shared-dirs" step runs BEFORE git-pull (the first destructive step) specifically so a shared-dir problem never marks `last_build` as attempted — see the failure modes below.
260
+
261
+ **Reads:**
262
+ - state file: `standby_dir` must equal `cwd` (the guard above)
263
+ - standby slot: free disk (`df`) compared against `min_disk_mb`
264
+ - external: free memory compared against `min_memory_mb`
265
+ - standby slot: `resolveConnectConfig()` (or `--db`) to resolve `db_strategy: "auto"` to `copy`/`shared`
266
+ - live slot: the sqlite db file (copy strategy only, to back up from)
267
+ - standby slot: its own shared-dir link state (inspected internally by the `ensureLinks` call below)
268
+
269
+ **Writes:**
270
+ - standby slot: cache cleanup (same targets as `deploy clean`) then a disk-free check
271
+ - live slot: `pm2 stop <app_name>` (only with `--stop-prod`, only if memory is still low after cleanup)
272
+ - standby slot: `git pull` on `branch`, then `install_cmd`, `pre_build_cmd`, `build_cmd`
273
+ - standby slot: sqlite backup copy from the live slot (copy strategy) — or nothing, for the "shared" strategy (same Postgres DB, no copy)
274
+ - standby slot: `migrate_cmd`, only if non-empty
275
+ - shared root + standby slot: shared-dir self-heal — `ensureLinks(standbyDir, { allowCreate: true, allowReplaceEmpty: true })`. This is the ONLY deploy command that auto-creates a missing link or auto-replaces an empty real directory; everywhere else that's left to `deploy share`.
276
+ - standby slot: stale `<app_name>-staging` pm2 process deleted, then a fresh one started on `staging_port`
277
+ - external: health check against `health_url` on `staging_port` (retried)
278
+ - state file: `last_build` / `last_build_status` — written once the pipeline reaches `git-pull` (so an early abort above that point never marks a build as attempted), and again with the final outcome when the pipeline finishes
279
+
280
+ **Config keys used:** `app_name`, `dir_suffix`, `branch`, `db_strategy`, `install_cmd`, `pre_build_cmd`, `build_cmd`, `migrate_cmd`, `min_disk_mb`, `min_memory_mb`, `staging_port`, `health_url`, `shared_root`, `shared_dirs`
281
+
282
+ **Failure modes:**
283
+ - BuildAbortError (any step name above) — aborts on the first failing step; the error carries every step completed so far for reporting. If `--stop-prod` already stopped production before the abort, the message is prefixed "⚠ PRODUCTION IS DOWN" with the exact `pm2 start` command to bring it back up by hand.
284
+ - SharedDirError "HAZO_ENV_SHARED_DIR_REAL_DIR" / "HAZO_ENV_SHARED_DIR_WRONG_LINK" (surfaces as the "shared-dirs" build step's failure) — a non-empty real directory, or a symlink to the wrong target, is sitting where a shared-dir link belongs; build refuses and its message points at "hazo-env deploy share". ("HAZO_ENV_SHARED_DIR_MISSING" / "_EMPTY_DIR" never surface here — build always passes `allowCreate` and `allowReplaceEmpty`.)
285
+
286
+ **Examples:**
287
+ ```
288
+ hazo-env deploy build
289
+ hazo-env deploy build --stop-prod --branch=release
290
+ ```
291
+
292
+ #### `deploy verify`
293
+
294
+ Re-checks the already-running staging process without rebuilding anything — the gate to run again after fixing something `deploy build` already succeeded past, right before `deploy switch`.
295
+
296
+ Never throws on a failed check: each of the three checks (`health`, `typescript`, `migration-parity`) reports `pass` / `fail` / `skipped` in the returned `checks[]` array; the CLI exits with status 1 if any check failed.
297
+
298
+ **Reads:**
299
+ - state file: to find the standby dir and `staging_port`
300
+ - external: `curl` against `health_url` on `staging_port` (2 attempts, 500ms apart — a smaller retry budget than `build`'s, since the app should already be up)
301
+ - standby slot: `verify_tsc_cmd`, run with `cwd` set to the standby dir
302
+ - live + standby slot: each one's `_migrations` table (read-only), compared for parity — only when `db_strategy` resolves to "copy" (sqlite); `skipped` otherwise
303
+
304
+ **Writes:**
305
+ - (none — verify never mutates the filesystem, pm2, or the state file)
306
+
307
+ **Config keys used:** `staging_port`, `health_url`, `verify_tsc_cmd`, `db_strategy`
308
+
309
+ **Failure modes:**
310
+ - (no thrown error) — failures are reported per-check in `checks[]`; the process exits 1 if `allPassed` is false.
311
+
312
+ **Examples:**
313
+ ```
314
+ hazo-env deploy verify
315
+ ```
316
+
317
+ #### `deploy switch`
318
+
319
+ - `--force` — Bypass BOTH the build-recency check (standby must have a successful build since the last switch) AND the shared-dirs drift check below.
320
+
321
+ Promotes the standby directory to live: deletes (not stops — a fresh `pm2 start` follows) the current live PM2 process, starts the standby fresh on `prod_port`, runs `post_switch_cmd(s)`, and swaps `live_dir`/`standby_dir` in the state file.
322
+
323
+ Refuses to promote a standby that has not had a successful `deploy build` since the last switch, and refuses to promote onto a slot with shared-dir drift — both only unless `--force` is passed.
324
+
325
+ **Reads:**
326
+ - state file: `live_dir`/`standby_dir`, and `last_build`/`last_build_status`/`last_switch` for the build-recency check
327
+ - standby slot: `git rev-parse HEAD` (recorded as `git_ref` in the new state)
328
+ - live + standby slot: `inspectSharedDirs` (read-only) — skipped entirely when `shared_dirs` is empty or `--force` is passed
329
+
330
+ **Writes:**
331
+ - live slot (old): `pm2 delete <app_name>`
332
+ - standby slot (old): `pm2 delete <app_name>-staging`, then a fresh `pm2 start` on `prod_port` (this directory becomes the new live slot)
333
+ - standby slot (old, now live): each `post_switch_cmd` / `post_switch_cmd_N`, run in order — a failing hook is reported, never fatal
334
+ - state file: `live_dir`/`standby_dir` swapped, `previous_live_dir` set to the old live dir, `last_switch`, `git_ref`, `pm2_process`
335
+ - external: `pm2 save` (failure is a warning, not fatal)
336
+ - external: `sidecar_apps` reloaded/recreated to follow the new live dir (never throws — see sidecar.ts)
337
+
338
+ **Config keys used:** `app_name`, `prod_port`, `post_switch_cmd`, `sidecar_apps`, `shared_dirs`
339
+
340
+ **Failure modes:**
341
+ - (plain Error — SwitchAbortError) "No deploy state found for \"<app>\" — nothing to switch. Run \"deploy init\" first."
342
+ - SwitchAbortError "standby has not had a successful build since the last switch — run \"deploy build\" first, or pass --force to override." (bypassed by `--force`)
343
+ - SwitchAbortError "Shared dir(s) not fully linked in both slots: ... Run \"hazo-env deploy share\" to fix, or pass --force to override." (bypassed by `--force`; never fires when `shared_dirs` is empty)
344
+
345
+ **Examples:**
346
+ ```
347
+ hazo-env deploy switch
348
+ hazo-env deploy switch --force
349
+ ```
350
+
351
+ #### `deploy rollback`
352
+
353
+ - `--force` — Bypass the shared-dirs drift check only — the stale-build guard below has NO bypass.
354
+
355
+ Reverses the most recent `deploy switch`: puts `previous_live_dir` back on `prod_port`. Only reverses a switch that hasn't already been rolled back — there is no history beyond one step.
356
+
357
+ Refuses unconditionally (no `--force`) if `deploy build` has run on the standby since the last switch, because the previous live build may no longer be intact on disk.
358
+
359
+ **Reads:**
360
+ - state file: `previous_live_dir`, `last_build`, `last_switch`
361
+ - live + standby slot: `inspectSharedDirs` (read-only), unless `--force`
362
+ - the directory being restored: `git rev-parse HEAD`
363
+
364
+ **Writes:**
365
+ - current live slot: `pm2 delete <app_name>`
366
+ - restored slot: `pm2 delete <app_name>-staging` if present, then a fresh `pm2 start` on `prod_port`
367
+ - state file: `live_dir`/`standby_dir` swapped back, `previous_live_dir` cleared (rollback is not itself reversible)
368
+ - external: `pm2 save` (warning-only on failure), `sidecar_apps` reload/recreate (never throws)
369
+
370
+ **Config keys used:** `app_name`, `prod_port`, `sidecar_apps`, `shared_dirs`
371
+
372
+ **Failure modes:**
373
+ - RollbackAbortError "No deploy state found for \"<app>\" — nothing to roll back. Run \"deploy init\" first."
374
+ - RollbackAbortError "No previous switch recorded for \"<app>\" — nothing to roll back. ..." — `deploy rollback` only reverses a switch that hasn't already been rolled back.
375
+ - RollbackAbortError "A build has run on standby since the last switch (...) — ... Cannot safely roll back." — NO `--force` bypass exists for this one.
376
+ - RollbackAbortError "Shared dir(s) not fully linked in both slots: ... Run \"hazo-env deploy share\" to fix, or pass --force to override." (bypassed by `--force`)
377
+
378
+ **Examples:**
379
+ ```
380
+ hazo-env deploy rollback
381
+ hazo-env deploy rollback --force
382
+ ```
383
+
384
+ #### `deploy status`
385
+
386
+ Read-only snapshot: which directory is live/standby, whether their PM2 processes are actually running, sidecar freshness, disk/memory headroom, and — when `shared_dirs` is configured — a per-dir, per-slot shared-dirs table (linked / missing / empty-dir / real-dir(N files) / wrong-link).
387
+
388
+ **Reads:**
389
+ - state file: `live_dir`/`standby_dir`/ports/`last_build`/`last_switch`
390
+ - external: `pm2 jlist`, `df -k <cwd>`, `vm_stat` (darwin) or `/proc/meminfo` (linux)
391
+ - live + standby slot: `inspectSharedDirs`, only when the state file exists and `shared_dirs` is non-empty
392
+
393
+ **Writes:**
394
+ - (none)
395
+
396
+ **Config keys used:** `min_memory_mb`, `sidecar_apps`, `shared_root`, `shared_dirs`
397
+
398
+ **Failure modes:**
399
+ - (no thrown error) — a missing state file, or an unreachable `pm2`/`df`/`vm_stat`, each degrade to a `warnings[]` entry and an "(unknown)" field rather than aborting.
400
+
401
+ **Examples:**
402
+ ```
403
+ hazo-env deploy status
404
+ ```
405
+
406
+ #### `deploy clean`
407
+
408
+ - `--aggressive` — Also PRINT (never run) system-level cleanup suggestions (apt/journalctl/docker) that need sudo.
409
+
410
+ Deletes `.next.rollback`, `.next.staging`, and `node_modules/.cache`, and runs `npm cache clean --force`. Also called automatically as the first step of `deploy build`.
411
+
412
+ Never deletes through a shared-dir symlink: any clean target that equals, contains, or is contained by a configured `shared_dirs` entry is skipped with a warning instead of being touched.
413
+
414
+ **Reads:**
415
+ - current slot: `du -sk` on each clean target
416
+ - external: `npm config get cache`, free memory
417
+
418
+ **Writes:**
419
+ - current slot: `rm -rf` on the three targets above (each skipped individually if it overlaps a shared dir)
420
+ - external: `npm cache clean --force`
421
+
422
+ **Config keys used:** `shared_dirs`, `min_memory_mb`
423
+
424
+ **Failure modes:**
425
+ - (no thrown error) — a target that fails to clean records `targets[].error` and a warning; "overlaps a configured shared dir" is also a warning, never an abort.
426
+
427
+ **Examples:**
428
+ ```
429
+ hazo-env deploy clean
430
+ hazo-env deploy clean --aggressive
431
+ ```
432
+
433
+ #### `deploy share`
434
+
435
+ - `--dry-run` — Produce the full report without writing, renaming, or linking anything.
436
+
437
+ The one-time migration onto shared dirs for an app that already has real (per-slot) data sitting in what `shared_dirs` now names. Runnable from either slot — live/standby roles always come from the state file's own labels (whichever side wins a content conflict), never from `cwd`.
438
+
439
+ No-op (prints a message and exits) when `shared_dirs` is empty. Safe to re-run: already-linked dirs are reported as such and left untouched (idempotent).
440
+
441
+ Order: merge standby then live into `shared_root` (live wins on content conflict; standby's losing copy is parked, never overwritten or deleted) → swap the STANDBY slot's real dir for the symlink first → swap the LIVE slot's real dir for the symlink last (so the running app sees its folder replaced as late and as briefly as possible) → re-scan both renamed backup dirs for files written during that swap window and merge those too.
442
+
443
+ **Reads:**
444
+ - state file: `live_dir`/`standby_dir` labels (never inferred from `cwd`'s blue/green naming); the standby is used only if it still exists on disk — a missing peer, or no state file at all (pre-`deploy init`), means only the live/current dir is migrated
445
+ - live + standby slot: every file under each configured `shared_dirs` entry (to merge, hash-compare, and copy)
446
+
447
+ **Writes:**
448
+ - shared root: `shared_root/<dir>` created; files copied in preserving mtime and mode; conflicting incoming copies parked under `shared_root/.conflicts/<slot-basename>/<dir>/<relPath>` (never overwrites, never deletes a source file)
449
+ - live + standby slot: each real/empty `<dir>` renamed aside to `<dir>.pre-share-<ISO timestamp>` (never deleted — left for the operator to verify and remove by hand), then replaced with a symlink to `shared_root/<dir>`
450
+ - live + standby slot: the renamed `.pre-share-*` dirs are re-scanned once for files written during the rename race window, and those are merged too
451
+ - state file: NOT written — `deploy share` never updates deploy state.
452
+
453
+ **Config keys used:** `shared_root`, `shared_dirs`
454
+
455
+ **Failure modes:**
456
+ - SharedDirError "HAZO_ENV_SHARED_DIR_WRONG_LINK" — a pre-flight check, before anything is written: if ANY configured dir is already a symlink to somewhere other than the expected target in EITHER slot, the ENTIRE run aborts untouched (atomic all-or-nothing, never partially migrates). Remove the stray link by hand first, or confirm it should point elsewhere.
457
+ - (unwrapped) raw filesystem errors (permission denied, disk full, ...) propagate as-is.
458
+
459
+ **Examples:**
460
+ ```
461
+ hazo-env deploy share --dry-run
462
+ hazo-env deploy share
463
+ ```
464
+
465
+ ### Config reference (`[deploy]`)
466
+
467
+ | Key | Default | Meaning |
468
+ |---|---|---|
469
+ | `app_name` | (none — required) | Logical app name. Also names the state file: ~/.hazo-deploy/<app_name>.json. |
470
+ | `dir_suffix` | (none — required) | Which color suffix THIS directory is (must be exactly "blue" or "green"). The peer is resolved by swapping it on the current directory's basename. |
471
+ | `prod_port` | 3000 | Production PM2 port. |
472
+ | `staging_port` | 3001 | Staging port used by `deploy build`/`deploy verify` before switching. |
473
+ | `health_url` | /api/health | Path hit for health checks during build/verify/status. |
474
+ | `min_disk_mb` | 1024 | Minimum free disk (MB) required before a build proceeds. |
475
+ | `min_memory_mb` | 512 | Minimum free memory (MB) required before a build proceeds (and the threshold `deploy clean`/`deploy status` compare against for swap/memory warnings). |
476
+ | `branch` | main | Git branch pulled by `deploy build` (overridable with `--branch`). |
477
+ | `db_strategy` | auto | How the standby DB is provisioned: auto (infer from [db.*] driver), copy (sqlite file copy from the peer), or shared (both slots point at the same Postgres DB). An invalid value throws at config-resolve time. |
478
+ | `build_cmd` | npm run build | Shell command that builds the app. |
479
+ | `install_cmd` | npm ci | Shell command that installs dependencies. |
480
+ | `pre_build_cmd` | rm -rf .next | Shell command run before the build (cache busting, etc). |
481
+ | `migrate_cmd` | (empty — skipped) | Optional shell command run after DB setup during `deploy build`. Empty (the default) means `deploy build` logs that it's assuming the app's own schema bootstrap runs automatically at startup and moves on. |
482
+ | `post_switch_cmd` | [] (none) | Shell commands run after a successful `deploy switch` (indexnow submission, CDN purge, ...). Numbered suffixes run in order after the unsuffixed key; collection stops at the first missing/blank numbered key, so a gap silently truncates the list. |
483
+ | `sidecar_apps` | [] (none) | Other pm2 app names in the SAME ecosystem file that move with the live dir but are never blue-green-swapped themselves (a cron/scheduler/jobs worker, websocket server, PDF-render pool, ...). |
484
+ | `env_files` | .env.local | Gitignored files (relative to app root) copied from the live dir to the peer during `deploy init`. |
485
+ | `verify_tsc_cmd` | npx tsc --noEmit | Shell command used for the TypeScript check in `deploy verify`. Override to exclude test files, e.g. with a dedicated tsconfig. |
486
+ | `shared_root` | ~/<app_name>-shared | Directory, outside BOTH slot dirs, that `shared_dirs` entries are symlinked from into each slot. Must resolve to an absolute path outside both the current and peer slot directories (validated at config-resolve time). |
487
+ | `shared_dirs` | [] (feature off) | Folders (e.g. var/uploads) that must persist across blue-green slots instead of being duplicated per clone — see "Shared dirs" below. Validated: no absolute paths, no ".." traversal, no duplicates, no entry nested inside another, and (when the resolved db strategy is "copy") no entry containing the sqlite db path. |
488
+
489
+ ### Shared dirs — first-time migration walkthrough
490
+
491
+ An app running blue-green loses every upload a user makes on each `deploy switch` unless the folder it's written to is declared as a shared dir. Migrating an EXISTING app (one that already has real, per-slot data in that folder) is a one-time, interactive step:
492
+
493
+ 1. **Declare the folders.** Add `shared_dirs` (and, optionally, `shared_root`) to `[deploy]` in `hazo_env_config.ini` — in BOTH slots (the live one you edit now, and the standby, which `deploy init`/`deploy build` will keep in sync going forward). Example:
494
+ ```ini
495
+ [deploy]
496
+ shared_root = ~/gotimer-shared
497
+ shared_dirs = var/uploads, data/blog-images
498
+ ```
499
+ 2. **Run the migration once**, from either slot:
500
+ ```
501
+ hazo-env deploy share --dry-run # preview: what would merge, what would conflict, what would link
502
+ hazo-env deploy share # apply it
503
+ ```
504
+ This merges whatever is already on disk in BOTH slots into `shared_root` (the live slot wins any same-path content conflict; the losing copy is parked under `.conflicts/`, never deleted), then replaces each slot's real folder with a symlink into `shared_root` — standby first, live last, so the running app sees the swap as late and as briefly as possible.
505
+ 3. **Read the report.** Each shared dir prints how many files came from live, from standby, how many were identical (deduped), and how many conflicted. A non-zero conflict count means two slots had the SAME path with DIFFERENT content — go look at the parked copies under `<shared_root>/.conflicts/<slot>/<dir>/...` before deleting anything.
506
+ 4. **Verify, then clean up.** `deploy share` never deletes your original data — it renames each slot's old real directory aside to `<dir>.pre-share-<timestamp>`. Once `hazo-env deploy status` shows every shared dir as `linked` in both slots and the app looks right, delete the `.pre-share-*` backup directories by hand.
507
+ 5. **From then on it's automatic.** `deploy init` links a new peer's shared dirs on creation; `deploy build` self-heals a missing link or an empty leftover directory on the standby before it builds; `deploy switch`/`deploy rollback` refuse to promote a slot that isn't fully linked (bypass with `--force` only if you've verified it by hand); `deploy status` shows per-slot drift at a glance; `deploy clean` never deletes through a shared-dir symlink.
508
+
509
+ A BRAND NEW app that has never had real per-slot data in these folders doesn't need this walkthrough at all — just set `shared_dirs` before the first `deploy init`, and every slot starts out correctly linked.
510
+
511
+ <!-- END GENERATED: deploy section -->
512
+
197
513
  ## Config reference (`hazo_env_config.ini`)
198
514
 
199
515
  See `config/hazo_env_config.ini.sample` for the full annotated template.
package/dist/cli.js CHANGED
@@ -4,6 +4,7 @@ import pc from 'picocolors';
4
4
  import { getEnv } from './index.client.js';
5
5
  import { describeEnv, getEnvRole, getPattern } from './env.server.js';
6
6
  import { doctor } from './doctor.js';
7
+ import { DEPLOY_SUBCOMMAND_NAMES, renderDeploySummaryList, renderDeploySubcommandHelpText, renderDeployConfigHelpText, } from './deploy/help.js';
7
8
  const [, , command, ...args] = process.argv;
8
9
  function statusIcon(status) {
9
10
  if (status === 'ok')
@@ -201,24 +202,20 @@ async function runServe() {
201
202
  process.exit(1);
202
203
  }
203
204
  }
204
- const DEPLOY_SUBCOMMANDS = ['init', 'build', 'verify', 'switch', 'rollback', 'status', 'clean'];
205
+ const DEPLOY_SUBCOMMANDS = DEPLOY_SUBCOMMAND_NAMES;
205
206
  function printDeployHelp() {
206
207
  console.log(`
207
208
  ${pc.bold('hazo-env deploy')} — blue-green deployment orchestration
208
209
 
209
- Usage:
210
- hazo-env deploy init Create peer dir, clone repo, generate config, write state
211
- hazo-env deploy build Run the full build pipeline on the standby dir
212
- --stop-prod --branch=<b> --db=<env> --peer-dir=<path>
213
- hazo-env deploy verify Re-run health/typecheck/migration checks on standby
214
- hazo-env deploy switch Stop prod, start standby on the prod port, run post-switch hooks
215
- --force Bypass the "standby must have a successful recent build" check
216
- hazo-env deploy rollback Reverse the last switch
217
- hazo-env deploy status Show live/standby dirs, ports, PM2 state, disk/memory
218
- hazo-env deploy clean Reclaim disk space from old builds and caches
219
- --aggressive Also suggest system-level cleanup commands
210
+ ${renderDeploySummaryList()}
220
211
  `);
221
212
  }
213
+ function printDeploySubcommandHelp(name) {
214
+ console.log(`\n${renderDeploySubcommandHelpText(name)}\n`);
215
+ }
216
+ function printDeployConfigHelp() {
217
+ console.log(`\n${pc.bold('hazo-env deploy config')}\n\n${renderDeployConfigHelpText()}\n`);
218
+ }
222
219
  function formatDirStatus(info) {
223
220
  const indicator = info.running ? pc.green(`✓ running (pid ${info.pid})`) : pc.dim('✗ not running');
224
221
  return ` ${pc.bold(info.role.padEnd(8))} ${info.dir} ${pc.dim(`port ${info.port}`)} ${indicator}`;
@@ -229,6 +226,25 @@ function formatSidecarStatus(info) {
229
226
  const staleNote = info.stale ? ` ${pc.yellow('⚠ stale: pm_cwd mismatch')}` : '';
230
227
  return ` ${pc.bold('sidecar'.padEnd(8))} ${info.name} ${indicator}${staleNote}`;
231
228
  }
229
+ /** Render one slot's shared-dir state. */
230
+ function formatSharedDirSlotState(s) {
231
+ switch (s.state) {
232
+ case 'linked':
233
+ return pc.green('linked');
234
+ case 'missing':
235
+ return pc.yellow('missing');
236
+ case 'empty-dir':
237
+ return pc.yellow('empty-dir');
238
+ case 'real-dir':
239
+ return pc.red(`real-dir (${s.fileCount} file${s.fileCount === 1 ? '' : 's'})`);
240
+ case 'wrong-link':
241
+ return pc.red(`wrong-link -> ${s.linkTarget}`);
242
+ }
243
+ }
244
+ /** One row of the shared-dirs table: a dir's state in both slots side by side. */
245
+ function formatSharedDirRow(entry) {
246
+ return ` ${pc.bold(entry.dir.padEnd(24))} live: ${formatSharedDirSlotState(entry.live)} standby: ${formatSharedDirSlotState(entry.standby)}`;
247
+ }
232
248
  async function runDeployStatus() {
233
249
  const { resolveDeployConfig } = await import('./resolve/deploy.js');
234
250
  const { runStatus } = await import('./deploy/status.js');
@@ -247,6 +263,13 @@ async function runDeployStatus() {
247
263
  for (const sidecar of result.sidecars) {
248
264
  console.log(formatSidecarStatus(sidecar));
249
265
  }
266
+ if (result.sharedDirs.length) {
267
+ console.log('');
268
+ console.log(` ${pc.bold('shared dirs')}`);
269
+ for (const entry of result.sharedDirs) {
270
+ console.log(formatSharedDirRow(entry));
271
+ }
272
+ }
250
273
  console.log('');
251
274
  console.log(` last switch: ${result.lastSwitch ?? pc.dim('(none)')}`);
252
275
  console.log(` last build: ${result.lastBuild ?? pc.dim('(none)')}${result.lastBuildStatus ? ` ${result.lastBuildStatus === 'success' ? pc.green(result.lastBuildStatus) : pc.red(result.lastBuildStatus)}` : ''}`);
@@ -483,9 +506,10 @@ async function runDeployRollback() {
483
506
  const { runRollback, RollbackAbortError } = await import('./deploy/rollback.js');
484
507
  const { nodeCommandRunner } = await import('./deploy/runner.js');
485
508
  const config = resolveDeployConfig();
509
+ const force = args.includes('--force');
486
510
  console.log(`\n${pc.bold('hazo-env deploy rollback')} ${pc.dim(config.app_name)}\n`);
487
511
  try {
488
- const result = runRollback(config, nodeCommandRunner);
512
+ const result = runRollback(config, nodeCommandRunner, { force });
489
513
  console.log(` ${pc.green('✓')} started "${config.app_name}" on port ${result.prodPort} in ${result.restoredLiveDir}`);
490
514
  if (result.stagingDeleteWarning) {
491
515
  console.log(` ${pc.yellow('⚠')} ${result.stagingDeleteWarning}`);
@@ -519,18 +543,78 @@ async function runDeployRollback() {
519
543
  process.exit(1);
520
544
  }
521
545
  }
546
+ async function runDeployShare() {
547
+ const { resolveDeployConfig } = await import('./resolve/deploy.js');
548
+ const { runShare } = await import('./deploy/share.js');
549
+ const dryRun = args.includes('--dry-run');
550
+ const config = resolveDeployConfig();
551
+ console.log(`\n${pc.bold('hazo-env deploy share')} ${pc.dim(config.app_name)}${dryRun ? pc.dim(' (dry run — nothing will be written)') : ''}\n`);
552
+ if (config.shared_dirs.length === 0) {
553
+ console.log(` ${pc.yellow('⚠')} No shared_dirs configured — nothing to migrate.\n`);
554
+ return;
555
+ }
556
+ try {
557
+ const result = runShare(config, { dryRun });
558
+ if (!result.stateFound) {
559
+ console.log(` ${pc.yellow('⚠')} No deploy state found — treating ${result.liveDir} as the only slot (no peer).`);
560
+ }
561
+ console.log(` live: ${result.liveDir}`);
562
+ console.log(` standby: ${result.standbyDir ?? pc.dim('(no peer)')}`);
563
+ console.log('');
564
+ for (const entry of result.dirs) {
565
+ console.log(` ${pc.bold(entry.dir)}`);
566
+ console.log(` target: ${entry.target}`);
567
+ console.log(` live: ${entry.liveAction}${entry.liveBackupDir ? pc.dim(` (backup: ${entry.liveBackupDir})`) : ''}`);
568
+ console.log(` standby: ${entry.standbyAction}${entry.standbyBackupDir ? pc.dim(` (backup: ${entry.standbyBackupDir})`) : ''}`);
569
+ console.log(` files: ${entry.filesFromLive} from live, ${entry.filesFromStandby} from standby, ${entry.identical} identical, ${entry.conflicts} conflict(s)` +
570
+ `${entry.lateMergedFiles ? `, ${entry.lateMergedFiles} merged late` : ''}`);
571
+ if (entry.conflicts) {
572
+ console.log(` ${pc.yellow('⚠')} conflicts parked under:`);
573
+ for (const f of entry.conflictFiles)
574
+ console.log(` ${f}`);
575
+ }
576
+ for (const w of entry.warnings)
577
+ console.log(` ${pc.yellow('⚠')} ${w}`);
578
+ console.log('');
579
+ }
580
+ if (dryRun) {
581
+ console.log(` ${pc.yellow('Dry run only — nothing was written. Re-run without --dry-run to apply.')}\n`);
582
+ }
583
+ else {
584
+ console.log(` ${pc.green('Share complete.')} Verify the report above, then delete the ".pre-share-*" backup dirs once you're satisfied.\n`);
585
+ }
586
+ }
587
+ catch (e) {
588
+ const msg = e instanceof Error ? e.message : String(e);
589
+ console.error(`\n ${pc.red('✗')} ${msg}\n`);
590
+ process.exit(1);
591
+ }
592
+ }
522
593
  async function runDeploy() {
523
594
  const subCmd = args[0];
595
+ const subArgs = args.slice(1);
524
596
  if (!subCmd || subCmd === '--help' || subCmd === '-h') {
525
597
  printDeployHelp();
526
598
  return;
527
599
  }
600
+ // `deploy config` is documentation-only — there is nothing else it could
601
+ // do, so it renders the same thing with or without --help.
602
+ if (subCmd === 'config') {
603
+ printDeployConfigHelp();
604
+ return;
605
+ }
528
606
  if (!DEPLOY_SUBCOMMANDS.includes(subCmd)) {
529
607
  console.error(pc.red(`Error: unknown deploy subcommand "${subCmd}"`));
530
608
  printDeployHelp();
531
609
  process.exit(1);
532
610
  return;
533
611
  }
612
+ // `deploy <cmd> --help` / `-h` shows the detailed reference for that
613
+ // subcommand instead of running it.
614
+ if (subArgs.includes('--help') || subArgs.includes('-h')) {
615
+ printDeploySubcommandHelp(subCmd);
616
+ return;
617
+ }
534
618
  if (subCmd === 'init') {
535
619
  await runDeployInit();
536
620
  return;
@@ -559,6 +643,10 @@ async function runDeploy() {
559
643
  await runDeployRollback();
560
644
  return;
561
645
  }
646
+ if (subCmd === 'share') {
647
+ await runDeployShare();
648
+ return;
649
+ }
562
650
  }
563
651
  function printHelp() {
564
652
  console.log(`
@@ -582,7 +670,7 @@ Usage:
582
670
  hazo-env serve Start the envsync HTTP service (HAZO_ENVSYNC_TOKEN required)
583
671
  --port <n> --bind <host> Override HAZO_ENVSYNC_PORT / HAZO_ENVSYNC_BIND
584
672
  hazo-env deploy [subcommand] Blue-green deployment orchestration (see "deploy --help")
585
- init | build | verify | switch | rollback | status | clean
673
+ ${[...DEPLOY_SUBCOMMAND_NAMES, 'config'].join(' | ')}
586
674
  `);
587
675
  }
588
676
  (async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/deploy/build.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI9D,MAAM,WAAW,eAAe;IAC9B,gGAAgG;IAChG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,GAAG,QAAQ,CAAC;IACtC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,6FAA6F;AAC7F,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,CAAC;gBAEtB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE;CAKtD;AAKD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAMjF;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAErE;AAiBD,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CASpH;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,GAAE,eAAoB,GAAG,cAAc,CA+ThH"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/deploy/build.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI9D,MAAM,WAAW,eAAe;IAC9B,gGAAgG;IAChG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,GAAG,QAAQ,CAAC;IACtC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,6FAA6F;AAC7F,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,CAAC;gBAEtB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE;CAKtD;AAKD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAMjF;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAErE;AAiBD,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CASpH;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,GAAE,eAAoB,GAAG,cAAc,CAqUhH"}