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
@@ -0,0 +1,526 @@
1
+ // hazo_env/src/deploy/help.ts — structured help metadata for `hazo-env deploy`
2
+ //
3
+ // Single source of truth for FOUR surfaces that must never drift apart:
4
+ // 1. `hazo-env deploy --help` — one-line-per-subcommand summary (DEPLOY_SUBCOMMAND_HELP)
5
+ // 2. `hazo-env deploy <cmd> --help` — detailed per-command reference (DEPLOY_SUBCOMMAND_HELP)
6
+ // 3. `hazo-env deploy config --help` — every `[deploy]` INI key (DEPLOY_CONFIG_HELP)
7
+ // 4. The generated "Deploy" section of README.md (`renderDeployReadmeSection`,
8
+ // written in place by `src/deploy/generate-readme-cli.ts` / `npm run docs:deploy`)
9
+ //
10
+ // `cli.ts` renders (1)-(3) from the data below via the `renderDeploy*HelpText`
11
+ // functions; nothing in cli.ts duplicates a summary, a flag description, a
12
+ // reads/writes line, a config default, or a failure-mode message — every one
13
+ // of those lives here exactly once. `__tests__/deploy-help.test.ts` asserts
14
+ // every deploy subcommand (DEPLOY_SUBCOMMAND_NAMES) and every parsed
15
+ // `[deploy]` key (cross-checked against `resolveDeployConfig`'s actual
16
+ // output) has a help entry, and that README.md's generated section matches
17
+ // `renderDeployReadmeSection()` byte for byte — so adding a step, a failure
18
+ // mode, or a config key without updating this file fails CI instead of
19
+ // silently drifting the docs from the code.
20
+ //
21
+ // Facts quoted below (error codes, exact thrown messages, step names, read/
22
+ // write lists) were verified by reading build.ts / switch.ts / rollback.ts /
23
+ // init.ts / clean.ts / verify.ts / status.ts / share.ts / shared-dirs.ts /
24
+ // resolve/deploy.ts directly — not paraphrased from memory — because this
25
+ // file is the thing an operator reads before running a command against prod.
26
+ /** The 8 real `deploy` actions (excludes the documentation-only `config` pseudo-subcommand). */
27
+ export const DEPLOY_SUBCOMMAND_NAMES = [
28
+ 'init',
29
+ 'build',
30
+ 'verify',
31
+ 'switch',
32
+ 'rollback',
33
+ 'status',
34
+ 'clean',
35
+ 'share',
36
+ ];
37
+ export const DEPLOY_SUBCOMMAND_HELP = {
38
+ init: {
39
+ name: 'init',
40
+ summary: 'Create peer dir, clone repo, generate config, write state',
41
+ flags: [],
42
+ description: [
43
+ '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.',
44
+ '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.',
45
+ ],
46
+ reads: [
47
+ 'live slot: `config/hazo_env_config.ini` (the resolved `[deploy]` section)',
48
+ 'live slot: `git remote get-url origin`',
49
+ 'live slot: each `env_files` entry present on disk (best-effort — missing ones are reported, not fatal)',
50
+ ],
51
+ writes: [
52
+ 'external: a new sibling directory — `git clone <origin>` into `<app>-<opposite dir_suffix>`',
53
+ 'standby slot: `config/hazo_env_config.ini`, with `dir_suffix` swapped blue↔green',
54
+ 'standby slot: the `[data] root` directory, when the app is sqlite-backed (`db_strategy` resolves to `copy`)',
55
+ 'standby slot: each found `env_files` entry, copied in (gitignored secrets never travel through `git clone`)',
56
+ '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',
57
+ 'state file: `~/.hazo-deploy/<app_name>.json` written fresh (`live_dir` = current dir, `standby_dir` = the new peer)',
58
+ ],
59
+ configKeys: ['app_name', 'dir_suffix', 'env_files', 'shared_root', 'shared_dirs'],
60
+ failureModes: [
61
+ '(plain Error) "Peer directory already exists" — refuses to overwrite an existing peer; remove the stale directory by hand before retrying.',
62
+ '(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.',
63
+ '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`.',
64
+ ],
65
+ examples: ['hazo-env deploy init'],
66
+ },
67
+ build: {
68
+ name: 'build',
69
+ summary: 'Run the full build pipeline on the standby dir',
70
+ flags: [
71
+ { flag: '--stop-prod', description: 'If the memory check fails, stop the live PM2 process first to free memory, then re-check.' },
72
+ { flag: '--branch=<b>', description: 'Override `config.branch` for the git pull step.' },
73
+ { flag: '--db=<env>', description: 'Resolve `[db.<env>]` instead of the current `HAZO_ENV` when validating a "shared" db strategy.' },
74
+ { flag: '--peer-dir=<path>', description: '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).' },
75
+ ],
76
+ description: [
77
+ '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.',
78
+ '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.',
79
+ '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.',
80
+ ],
81
+ reads: [
82
+ 'state file: `standby_dir` must equal `cwd` (the guard above)',
83
+ 'standby slot: free disk (`df`) compared against `min_disk_mb`',
84
+ 'external: free memory compared against `min_memory_mb`',
85
+ 'standby slot: `resolveConnectConfig()` (or `--db`) to resolve `db_strategy: "auto"` to `copy`/`shared`',
86
+ 'live slot: the sqlite db file (copy strategy only, to back up from)',
87
+ 'standby slot: its own shared-dir link state (inspected internally by the `ensureLinks` call below)',
88
+ ],
89
+ writes: [
90
+ 'standby slot: cache cleanup (same targets as `deploy clean`) then a disk-free check',
91
+ 'live slot: `pm2 stop <app_name>` (only with `--stop-prod`, only if memory is still low after cleanup)',
92
+ 'standby slot: `git pull` on `branch`, then `install_cmd`, `pre_build_cmd`, `build_cmd`',
93
+ 'standby slot: sqlite backup copy from the live slot (copy strategy) — or nothing, for the "shared" strategy (same Postgres DB, no copy)',
94
+ 'standby slot: `migrate_cmd`, only if non-empty',
95
+ '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`.',
96
+ 'standby slot: stale `<app_name>-staging` pm2 process deleted, then a fresh one started on `staging_port`',
97
+ 'external: health check against `health_url` on `staging_port` (retried)',
98
+ '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',
99
+ ],
100
+ configKeys: [
101
+ 'app_name', 'dir_suffix', 'branch', 'db_strategy', 'install_cmd', 'pre_build_cmd', 'build_cmd',
102
+ 'migrate_cmd', 'min_disk_mb', 'min_memory_mb', 'staging_port', 'health_url', 'shared_root', 'shared_dirs',
103
+ ],
104
+ failureModes: [
105
+ '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.',
106
+ '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`.)',
107
+ ],
108
+ examples: ['hazo-env deploy build', 'hazo-env deploy build --stop-prod --branch=release'],
109
+ },
110
+ verify: {
111
+ name: 'verify',
112
+ summary: 'Re-run health/typecheck/migration checks on standby',
113
+ flags: [],
114
+ description: [
115
+ '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`.',
116
+ '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.',
117
+ ],
118
+ reads: [
119
+ 'state file: to find the standby dir and `staging_port`',
120
+ '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)',
121
+ 'standby slot: `verify_tsc_cmd`, run with `cwd` set to the standby dir',
122
+ 'live + standby slot: each one\'s `_migrations` table (read-only), compared for parity — only when `db_strategy` resolves to "copy" (sqlite); `skipped` otherwise',
123
+ ],
124
+ writes: ['(none — verify never mutates the filesystem, pm2, or the state file)'],
125
+ configKeys: ['staging_port', 'health_url', 'verify_tsc_cmd', 'db_strategy'],
126
+ failureModes: [
127
+ '(no thrown error) — failures are reported per-check in `checks[]`; the process exits 1 if `allPassed` is false.',
128
+ ],
129
+ examples: ['hazo-env deploy verify'],
130
+ },
131
+ switch: {
132
+ name: 'switch',
133
+ summary: 'Stop prod, start standby on the prod port, run post-switch hooks',
134
+ flags: [
135
+ { flag: '--force', description: 'Bypass BOTH the build-recency check (standby must have a successful build since the last switch) AND the shared-dirs drift check below.' },
136
+ ],
137
+ description: [
138
+ '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.',
139
+ '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.',
140
+ ],
141
+ reads: [
142
+ 'state file: `live_dir`/`standby_dir`, and `last_build`/`last_build_status`/`last_switch` for the build-recency check',
143
+ 'standby slot: `git rev-parse HEAD` (recorded as `git_ref` in the new state)',
144
+ 'live + standby slot: `inspectSharedDirs` (read-only) — skipped entirely when `shared_dirs` is empty or `--force` is passed',
145
+ ],
146
+ writes: [
147
+ 'live slot (old): `pm2 delete <app_name>`',
148
+ 'standby slot (old): `pm2 delete <app_name>-staging`, then a fresh `pm2 start` on `prod_port` (this directory becomes the new live slot)',
149
+ 'standby slot (old, now live): each `post_switch_cmd` / `post_switch_cmd_N`, run in order — a failing hook is reported, never fatal',
150
+ 'state file: `live_dir`/`standby_dir` swapped, `previous_live_dir` set to the old live dir, `last_switch`, `git_ref`, `pm2_process`',
151
+ 'external: `pm2 save` (failure is a warning, not fatal)',
152
+ 'external: `sidecar_apps` reloaded/recreated to follow the new live dir (never throws — see sidecar.ts)',
153
+ ],
154
+ configKeys: ['app_name', 'prod_port', 'post_switch_cmd', 'sidecar_apps', 'shared_dirs'],
155
+ failureModes: [
156
+ '(plain Error — SwitchAbortError) "No deploy state found for \\"<app>\\" — nothing to switch. Run \\"deploy init\\" first."',
157
+ 'SwitchAbortError "standby has not had a successful build since the last switch — run \\"deploy build\\" first, or pass --force to override." (bypassed by `--force`)',
158
+ '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)',
159
+ ],
160
+ examples: ['hazo-env deploy switch', 'hazo-env deploy switch --force'],
161
+ },
162
+ rollback: {
163
+ name: 'rollback',
164
+ summary: 'Reverse the last switch',
165
+ flags: [
166
+ { flag: '--force', description: 'Bypass the shared-dirs drift check only — the stale-build guard below has NO bypass.' },
167
+ ],
168
+ description: [
169
+ '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.',
170
+ '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.',
171
+ ],
172
+ reads: [
173
+ 'state file: `previous_live_dir`, `last_build`, `last_switch`',
174
+ 'live + standby slot: `inspectSharedDirs` (read-only), unless `--force`',
175
+ 'the directory being restored: `git rev-parse HEAD`',
176
+ ],
177
+ writes: [
178
+ 'current live slot: `pm2 delete <app_name>`',
179
+ 'restored slot: `pm2 delete <app_name>-staging` if present, then a fresh `pm2 start` on `prod_port`',
180
+ 'state file: `live_dir`/`standby_dir` swapped back, `previous_live_dir` cleared (rollback is not itself reversible)',
181
+ 'external: `pm2 save` (warning-only on failure), `sidecar_apps` reload/recreate (never throws)',
182
+ ],
183
+ configKeys: ['app_name', 'prod_port', 'sidecar_apps', 'shared_dirs'],
184
+ failureModes: [
185
+ 'RollbackAbortError "No deploy state found for \\"<app>\\" — nothing to roll back. Run \\"deploy init\\" first."',
186
+ 'RollbackAbortError "No previous switch recorded for \\"<app>\\" — nothing to roll back. ..." — `deploy rollback` only reverses a switch that hasn\'t already been rolled back.',
187
+ 'RollbackAbortError "A build has run on standby since the last switch (...) — ... Cannot safely roll back." — NO `--force` bypass exists for this one.',
188
+ '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`)',
189
+ ],
190
+ examples: ['hazo-env deploy rollback', 'hazo-env deploy rollback --force'],
191
+ },
192
+ status: {
193
+ name: 'status',
194
+ summary: 'Show live/standby dirs, ports, PM2 state, disk/memory, shared dirs',
195
+ flags: [],
196
+ description: [
197
+ '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).',
198
+ ],
199
+ reads: [
200
+ 'state file: `live_dir`/`standby_dir`/ports/`last_build`/`last_switch`',
201
+ 'external: `pm2 jlist`, `df -k <cwd>`, `vm_stat` (darwin) or `/proc/meminfo` (linux)',
202
+ 'live + standby slot: `inspectSharedDirs`, only when the state file exists and `shared_dirs` is non-empty',
203
+ ],
204
+ writes: ['(none)'],
205
+ configKeys: ['min_memory_mb', 'sidecar_apps', 'shared_root', 'shared_dirs'],
206
+ failureModes: [
207
+ '(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.',
208
+ ],
209
+ examples: ['hazo-env deploy status'],
210
+ },
211
+ clean: {
212
+ name: 'clean',
213
+ summary: 'Reclaim disk space from old builds and caches',
214
+ flags: [
215
+ { flag: '--aggressive', description: 'Also PRINT (never run) system-level cleanup suggestions (apt/journalctl/docker) that need sudo.' },
216
+ ],
217
+ description: [
218
+ '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`.',
219
+ '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.',
220
+ ],
221
+ reads: ['current slot: `du -sk` on each clean target', 'external: `npm config get cache`, free memory'],
222
+ writes: ['current slot: `rm -rf` on the three targets above (each skipped individually if it overlaps a shared dir)', 'external: `npm cache clean --force`'],
223
+ configKeys: ['shared_dirs', 'min_memory_mb'],
224
+ failureModes: [
225
+ '(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.',
226
+ ],
227
+ examples: ['hazo-env deploy clean', 'hazo-env deploy clean --aggressive'],
228
+ },
229
+ share: {
230
+ name: 'share',
231
+ summary: 'One-time migration: merge shared_dirs into shared_root + symlink',
232
+ flags: [
233
+ { flag: '--dry-run', description: 'Produce the full report without writing, renaming, or linking anything.' },
234
+ ],
235
+ description: [
236
+ '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`.',
237
+ '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).',
238
+ '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.',
239
+ ],
240
+ reads: [
241
+ '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',
242
+ 'live + standby slot: every file under each configured `shared_dirs` entry (to merge, hash-compare, and copy)',
243
+ ],
244
+ writes: [
245
+ '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)',
246
+ '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>`',
247
+ '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',
248
+ 'state file: NOT written — `deploy share` never updates deploy state.',
249
+ ],
250
+ configKeys: ['shared_root', 'shared_dirs'],
251
+ failureModes: [
252
+ '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.',
253
+ '(unwrapped) raw filesystem errors (permission denied, disk full, ...) propagate as-is.',
254
+ ],
255
+ examples: ['hazo-env deploy share --dry-run', 'hazo-env deploy share'],
256
+ },
257
+ };
258
+ /**
259
+ * Every `[deploy]` INI key `resolveDeployConfig` parses, in the order
260
+ * declared on `DeployConfig` (src/deploy/types.ts). `post_switch_cmd` is
261
+ * documented once here even though the parser also accepts numbered
262
+ * `post_switch_cmd_2`, `_3`, ... suffixes — see its `meaning` text.
263
+ * `__tests__/deploy-help.test.ts` cross-checks this list's `key`s (mapped
264
+ * back from the field names `resolveDeployConfig` actually returns) against
265
+ * a fully-populated resolved config, so a new `DeployConfig` field with no
266
+ * matching entry here fails CI.
267
+ */
268
+ export const DEPLOY_CONFIG_HELP = [
269
+ {
270
+ key: 'app_name',
271
+ type: 'string (required)',
272
+ default: '(none — required)',
273
+ meaning: 'Logical app name. Also names the state file: ~/.hazo-deploy/<app_name>.json.',
274
+ example: 'app_name = gotimer',
275
+ },
276
+ {
277
+ key: 'dir_suffix',
278
+ type: 'string (required)',
279
+ default: '(none — required)',
280
+ meaning: '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.',
281
+ example: 'dir_suffix = green',
282
+ },
283
+ {
284
+ key: 'prod_port',
285
+ type: 'integer',
286
+ default: '3000',
287
+ meaning: 'Production PM2 port.',
288
+ example: 'prod_port = 3000',
289
+ },
290
+ {
291
+ key: 'staging_port',
292
+ type: 'integer',
293
+ default: '3001',
294
+ meaning: 'Staging port used by `deploy build`/`deploy verify` before switching.',
295
+ example: 'staging_port = 3001',
296
+ },
297
+ {
298
+ key: 'health_url',
299
+ type: 'string',
300
+ default: '/api/health',
301
+ meaning: 'Path hit for health checks during build/verify/status.',
302
+ example: 'health_url = /healthz',
303
+ },
304
+ {
305
+ key: 'min_disk_mb',
306
+ type: 'integer',
307
+ default: '1024',
308
+ meaning: 'Minimum free disk (MB) required before a build proceeds.',
309
+ example: 'min_disk_mb = 2048',
310
+ },
311
+ {
312
+ key: 'min_memory_mb',
313
+ type: 'integer',
314
+ default: '512',
315
+ meaning: 'Minimum free memory (MB) required before a build proceeds (and the threshold `deploy clean`/`deploy status` compare against for swap/memory warnings).',
316
+ example: 'min_memory_mb = 1024',
317
+ },
318
+ {
319
+ key: 'branch',
320
+ type: 'string',
321
+ default: 'main',
322
+ meaning: 'Git branch pulled by `deploy build` (overridable with `--branch`).',
323
+ example: 'branch = release',
324
+ },
325
+ {
326
+ key: 'db_strategy',
327
+ type: '"auto" | "copy" | "shared"',
328
+ default: 'auto',
329
+ meaning: '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.',
330
+ example: 'db_strategy = copy',
331
+ },
332
+ {
333
+ key: 'build_cmd',
334
+ type: 'string',
335
+ default: 'npm run build',
336
+ meaning: 'Shell command that builds the app.',
337
+ example: 'build_cmd = pnpm build',
338
+ },
339
+ {
340
+ key: 'install_cmd',
341
+ type: 'string',
342
+ default: 'npm ci',
343
+ meaning: 'Shell command that installs dependencies.',
344
+ example: 'install_cmd = pnpm install',
345
+ },
346
+ {
347
+ key: 'pre_build_cmd',
348
+ type: 'string',
349
+ default: 'rm -rf .next',
350
+ meaning: 'Shell command run before the build (cache busting, etc).',
351
+ example: 'pre_build_cmd = rm -rf dist',
352
+ },
353
+ {
354
+ key: 'migrate_cmd',
355
+ type: 'string',
356
+ default: '(empty — skipped)',
357
+ meaning: '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.',
358
+ example: 'migrate_cmd = npm run db:migrate',
359
+ },
360
+ {
361
+ key: 'post_switch_cmd',
362
+ type: 'string, plus numbered post_switch_cmd_2, _3, ...',
363
+ default: '[] (none)',
364
+ meaning: '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.',
365
+ example: 'post_switch_cmd = npm run indexnow\npost_switch_cmd_2 = bash scripts/cf-purge.sh',
366
+ },
367
+ {
368
+ key: 'sidecar_apps',
369
+ type: 'comma-separated list',
370
+ default: '[] (none)',
371
+ meaning: '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, ...).',
372
+ example: 'sidecar_apps = myapp-scheduler, myapp-pdf-pool',
373
+ },
374
+ {
375
+ key: 'env_files',
376
+ type: 'comma-separated list',
377
+ default: '.env.local',
378
+ meaning: 'Gitignored files (relative to app root) copied from the live dir to the peer during `deploy init`.',
379
+ example: 'env_files = .env.local, .env.production',
380
+ },
381
+ {
382
+ key: 'verify_tsc_cmd',
383
+ type: 'string',
384
+ default: 'npx tsc --noEmit',
385
+ meaning: 'Shell command used for the TypeScript check in `deploy verify`. Override to exclude test files, e.g. with a dedicated tsconfig.',
386
+ example: 'verify_tsc_cmd = npx tsc --noEmit -p tsconfig.verify.json',
387
+ },
388
+ {
389
+ key: 'shared_root',
390
+ type: 'absolute path (~ expanded)',
391
+ default: '~/<app_name>-shared',
392
+ meaning: '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).',
393
+ example: 'shared_root = ~/gotimer-shared',
394
+ },
395
+ {
396
+ key: 'shared_dirs',
397
+ type: 'comma-separated list, slot-relative',
398
+ default: '[] (feature off)',
399
+ meaning: '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.',
400
+ example: 'shared_dirs = var/uploads, data/blog-images',
401
+ },
402
+ ];
403
+ // ---------------------------------------------------------------------------
404
+ // Terminal renderers (plain text — no ANSI; cli.ts wraps the title line in
405
+ // its own pc.bold()). Shared by `deploy --help`, `deploy <cmd> --help`, and
406
+ // `deploy config --help`.
407
+ // ---------------------------------------------------------------------------
408
+ /** Body of `hazo-env deploy --help` — one line per subcommand plus its flags, exactly as before but generated. */
409
+ export function renderDeploySummaryList() {
410
+ const lines = ['Usage:'];
411
+ for (const name of DEPLOY_SUBCOMMAND_NAMES) {
412
+ const help = DEPLOY_SUBCOMMAND_HELP[name];
413
+ lines.push(` hazo-env deploy ${name.padEnd(10)} ${help.summary}`);
414
+ for (const f of help.flags) {
415
+ lines.push(` ${f.flag.padEnd(26)} ${f.description}`);
416
+ }
417
+ }
418
+ lines.push(` hazo-env deploy config Show every [deploy] config key (default, meaning, example)`);
419
+ lines.push('');
420
+ lines.push(`Run "hazo-env deploy <subcommand> --help" for what it reads/writes and how it can fail.`);
421
+ return lines.join('\n');
422
+ }
423
+ /** Body of `hazo-env deploy <cmd> --help`. */
424
+ export function renderDeploySubcommandHelpText(name) {
425
+ const help = DEPLOY_SUBCOMMAND_HELP[name];
426
+ const lines = [`hazo-env deploy ${help.name} — ${help.summary}`, ''];
427
+ if (help.flags.length) {
428
+ lines.push('Flags:');
429
+ for (const f of help.flags)
430
+ lines.push(` ${f.flag.padEnd(18)} ${f.description}`);
431
+ lines.push('');
432
+ }
433
+ for (const para of help.description) {
434
+ lines.push(para, '');
435
+ }
436
+ lines.push('Reads:');
437
+ for (const r of help.reads)
438
+ lines.push(` - ${r}`);
439
+ lines.push('', 'Writes:');
440
+ for (const w of help.writes)
441
+ lines.push(` - ${w}`);
442
+ lines.push('', `Config keys used: ${help.configKeys.join(', ')}`, '', 'Failure modes:');
443
+ for (const f of help.failureModes)
444
+ lines.push(` - ${f}`);
445
+ lines.push('', 'Examples:');
446
+ for (const ex of help.examples)
447
+ lines.push(` ${ex}`);
448
+ return lines.join('\n');
449
+ }
450
+ /** Body of `hazo-env deploy config --help` (and `hazo-env deploy config`). */
451
+ export function renderDeployConfigHelpText() {
452
+ const lines = ['Every key hazo-env reads from the [deploy] section of hazo_env_config.ini:', ''];
453
+ for (const k of DEPLOY_CONFIG_HELP) {
454
+ lines.push(`${k.key} (${k.type})`);
455
+ lines.push(` default: ${k.default}`);
456
+ lines.push(` ${k.meaning}`);
457
+ for (const exLine of k.example.split('\n'))
458
+ lines.push(` example: ${exLine}`);
459
+ lines.push('');
460
+ }
461
+ return lines.join('\n').trimEnd();
462
+ }
463
+ // ---------------------------------------------------------------------------
464
+ // README generator. Same data as above, rendered as Markdown. Written in
465
+ // place between the DEPLOY_README markers by generate-readme-cli.ts
466
+ // (`npm run docs:deploy`) and checked byte-for-byte by
467
+ // __tests__/deploy-help.test.ts against what's committed in README.md.
468
+ // ---------------------------------------------------------------------------
469
+ export const DEPLOY_README_MARKER_START = '<!-- BEGIN GENERATED: deploy section (see src/deploy/help.ts) -->';
470
+ export const DEPLOY_README_MARKER_END = '<!-- END GENERATED: deploy section -->';
471
+ function mdList(items) {
472
+ return items.map((i) => `- ${i}`).join('\n');
473
+ }
474
+ const SHARED_DIRS_WALKTHROUGH = `### Shared dirs — first-time migration walkthrough
475
+
476
+ 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:
477
+
478
+ 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:
479
+ \`\`\`ini
480
+ [deploy]
481
+ shared_root = ~/gotimer-shared
482
+ shared_dirs = var/uploads, data/blog-images
483
+ \`\`\`
484
+ 2. **Run the migration once**, from either slot:
485
+ \`\`\`
486
+ hazo-env deploy share --dry-run # preview: what would merge, what would conflict, what would link
487
+ hazo-env deploy share # apply it
488
+ \`\`\`
489
+ 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.
490
+ 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.
491
+ 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.
492
+ 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.
493
+
494
+ 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.`;
495
+ /** The whole generated Markdown block, placed between DEPLOY_README_MARKER_START/_END in README.md. */
496
+ export function renderDeployReadmeSection() {
497
+ const parts = [];
498
+ parts.push('## Deploy (blue-green orchestration)');
499
+ parts.push('Drives `hazo-env deploy <subcommand>`. Two sibling directories differing only by a blue/green `dir_suffix` ' +
500
+ '(e.g. `gotimer-blue/`, `gotimer-green/`) — one live, one standby — swap roles on `deploy switch`. State lives ' +
501
+ 'at `~/.hazo-deploy/<app_name>.json`, never inferred from the directory name alone. All subcommand and config ' +
502
+ 'docs below are generated from `src/deploy/help.ts` — see `hazo-env deploy --help` / `hazo-env deploy <cmd> ' +
503
+ '--help` / `hazo-env deploy config --help` for the same content at the terminal.');
504
+ parts.push('### Subcommands');
505
+ const tableRows = DEPLOY_SUBCOMMAND_NAMES.map((name) => `| \`deploy ${name}\` | ${DEPLOY_SUBCOMMAND_HELP[name].summary} |`);
506
+ parts.push(['| Command | Purpose |', '|---|---|', ...tableRows, '| `deploy config` | Show every `[deploy]` config key (default, meaning, example) |'].join('\n'));
507
+ for (const name of DEPLOY_SUBCOMMAND_NAMES) {
508
+ const h = DEPLOY_SUBCOMMAND_HELP[name];
509
+ const sub = [`#### \`deploy ${name}\``];
510
+ if (h.flags.length) {
511
+ sub.push(h.flags.map((f) => `- \`${f.flag}\` — ${f.description}`).join('\n'));
512
+ }
513
+ sub.push(h.description.join('\n\n'));
514
+ sub.push(`**Reads:**\n${mdList(h.reads)}`);
515
+ sub.push(`**Writes:**\n${mdList(h.writes)}`);
516
+ sub.push(`**Config keys used:** ${h.configKeys.map((k) => `\`${k}\``).join(', ')}`);
517
+ sub.push(`**Failure modes:**\n${mdList(h.failureModes)}`);
518
+ sub.push(`**Examples:**\n\`\`\`\n${h.examples.join('\n')}\n\`\`\``);
519
+ parts.push(sub.join('\n\n'));
520
+ }
521
+ parts.push('### Config reference (`[deploy]`)');
522
+ const cfgRows = DEPLOY_CONFIG_HELP.map((k) => `| \`${k.key}\` | ${k.default} | ${k.meaning.replace(/\n/g, ' ')} |`);
523
+ parts.push(['| Key | Default | Meaning |', '|---|---|---|', ...cfgRows].join('\n'));
524
+ parts.push(SHARED_DIRS_WALKTHROUGH);
525
+ return parts.join('\n\n');
526
+ }
@@ -4,6 +4,7 @@ export * from './runner.js';
4
4
  export * from './peer.js';
5
5
  export * from './pm2-start.js';
6
6
  export * from './sidecar.js';
7
+ export * from './shared-dirs.js';
7
8
  export * from './clean.js';
8
9
  export * from './status.js';
9
10
  export * from './init.js';
@@ -11,4 +12,6 @@ export * from './build.js';
11
12
  export * from './verify.js';
12
13
  export * from './switch.js';
13
14
  export * from './rollback.js';
15
+ export * from './share.js';
16
+ export * from './help.js';
14
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deploy/index.ts"],"names":[],"mappings":"AAUA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deploy/index.ts"],"names":[],"mappings":"AAUA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
@@ -14,6 +14,7 @@ export * from './runner.js';
14
14
  export * from './peer.js';
15
15
  export * from './pm2-start.js';
16
16
  export * from './sidecar.js';
17
+ export * from './shared-dirs.js';
17
18
  export * from './clean.js';
18
19
  export * from './status.js';
19
20
  export * from './init.js';
@@ -21,3 +22,5 @@ export * from './build.js';
21
22
  export * from './verify.js';
22
23
  export * from './switch.js';
23
24
  export * from './rollback.js';
25
+ export * from './share.js';
26
+ export * from './help.js';
@@ -1,4 +1,5 @@
1
1
  import type { CommandRunner, DeployConfig } from './types.js';
2
+ import type { EnsureLinkResult } from './shared-dirs.js';
2
3
  export interface RunInitOptions {
3
4
  /** Directory to treat as "current" (the live dir). Defaults to process.cwd(). */
4
5
  cwd?: string;
@@ -11,6 +12,13 @@ export interface RunInitResult {
11
12
  originUrl: string;
12
13
  envFilesCopied: string[];
13
14
  envFilesMissing: string[];
15
+ /**
16
+ * Shared-dirs (ticket 03 of the deploy-shared-dirs spec) enforcement
17
+ * results for the freshly-cloned peer — see shared-dirs.ts's
18
+ * `ensureLinks`. `[]` when `config.shared_dirs` is empty (feature off;
19
+ * every existing caller of `runInit` is unaffected).
20
+ */
21
+ sharedDirsLinked: EnsureLinkResult[];
14
22
  }
15
23
  /**
16
24
  * Create the peer (standby) directory: resolve its path, abort if it
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/deploy/init.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAe,MAAM,YAAY,CAAC;AAgD3E,MAAM,WAAW,cAAc;IAC7B,iFAAiF;IACjF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AA0CD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,GAAE,cAAmB,GAAG,aAAa,CA8C7G"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/deploy/init.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAe,MAAM,YAAY,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAgDzD,MAAM,WAAW,cAAc;IAC7B,iFAAiF;IACjF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B;;;;;OAKG;IACH,gBAAgB,EAAE,gBAAgB,EAAE,CAAC;CACtC;AA0CD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,GAAE,cAAmB,GAAG,aAAa,CA0D7G"}
@@ -18,6 +18,7 @@ import { HazoConfig } from 'hazo_config/server';
18
18
  import { resolvePeerDir } from './peer.js';
19
19
  import { writeState } from './state.js';
20
20
  import { getEnv } from '../index.client.js';
21
+ import { ensureLinks } from './shared-dirs.js';
21
22
  const CONFIG_RELATIVE_PATH = path.join('config', 'hazo_env_config.ini');
22
23
  // Matches resolve/files.ts's DEFAULT_DATA_ROOT — kept as a local literal
23
24
  // rather than importing that module, since resolveFilesConfig()/
@@ -119,6 +120,16 @@ export function runInit(config, runner, opts = {}) {
119
120
  fs.mkdirSync(path.dirname(peerIniPath), { recursive: true });
120
121
  fs.writeFileSync(peerIniPath, swappedIni, 'utf-8');
121
122
  ensurePeerDataDir(config, peerIniPath, peerDir);
123
+ // Ticket 03 (deploy-shared-dirs): create the shared-dir symlinks in the
124
+ // freshly-cloned peer so it's correct from its first `deploy build` (user
125
+ // story 22). `allowCreate` only — never `allowReplaceEmpty` here: a fresh
126
+ // clone legitimately has nothing at these paths yet (missing -> created);
127
+ // anything else (a tracked real/non-empty dir, or someone else's link)
128
+ // means the repo itself is in an unexpected state, and `ensureLinks`
129
+ // throws its typed `SharedDirError` (with a "run deploy share" hint)
130
+ // straight through — init is not the place to silently fix that up. A
131
+ // no-op when `shared_dirs` is empty (feature off).
132
+ const sharedDirsLinked = config.shared_dirs.length > 0 ? ensureLinks(config, peerDir, { allowCreate: true }) : [];
122
133
  const envFilesCopied = [];
123
134
  const envFilesMissing = [];
124
135
  for (const envFile of config.env_files) {
@@ -141,5 +152,5 @@ export function runInit(config, runner, opts = {}) {
141
152
  staging_port: config.staging_port,
142
153
  };
143
154
  writeState(state);
144
- return { currentDir, peerDir, originUrl, envFilesCopied, envFilesMissing };
155
+ return { currentDir, peerDir, originUrl, envFilesCopied, envFilesMissing, sharedDirsLinked };
145
156
  }