hazo_env 0.15.3 → 0.17.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 (67) hide show
  1. package/CHANGE_LOG.md +120 -0
  2. package/README.md +333 -0
  3. package/dist/bin.d.ts +3 -0
  4. package/dist/bin.d.ts.map +1 -0
  5. package/dist/bin.js +17 -0
  6. package/dist/cli.js +178 -17
  7. package/dist/deploy/build.d.ts +1 -1
  8. package/dist/deploy/build.d.ts.map +1 -1
  9. package/dist/deploy/build.js +51 -14
  10. package/dist/deploy/clean.d.ts +2 -1
  11. package/dist/deploy/clean.d.ts.map +1 -1
  12. package/dist/deploy/clean.js +36 -6
  13. package/dist/deploy/generate-readme-cli.d.ts +3 -0
  14. package/dist/deploy/generate-readme-cli.d.ts.map +1 -0
  15. package/dist/deploy/generate-readme-cli.js +40 -0
  16. package/dist/deploy/help.d.ts +55 -0
  17. package/dist/deploy/help.d.ts.map +1 -0
  18. package/dist/deploy/help.js +545 -0
  19. package/dist/deploy/idle-slots.d.ts +42 -0
  20. package/dist/deploy/idle-slots.d.ts.map +1 -0
  21. package/dist/deploy/idle-slots.js +136 -0
  22. package/dist/deploy/index.d.ts +5 -0
  23. package/dist/deploy/index.d.ts.map +1 -1
  24. package/dist/deploy/index.js +5 -0
  25. package/dist/deploy/init.d.ts +14 -0
  26. package/dist/deploy/init.d.ts.map +1 -1
  27. package/dist/deploy/init.js +14 -1
  28. package/dist/deploy/preflight.d.ts +26 -0
  29. package/dist/deploy/preflight.d.ts.map +1 -0
  30. package/dist/deploy/preflight.js +91 -0
  31. package/dist/deploy/rollback.d.ts +10 -1
  32. package/dist/deploy/rollback.d.ts.map +1 -1
  33. package/dist/deploy/rollback.js +25 -1
  34. package/dist/deploy/share.d.ts +28 -0
  35. package/dist/deploy/share.d.ts.map +1 -0
  36. package/dist/deploy/share.js +53 -0
  37. package/dist/deploy/shared-dirs.d.ts +128 -0
  38. package/dist/deploy/shared-dirs.d.ts.map +1 -0
  39. package/dist/deploy/shared-dirs.js +486 -0
  40. package/dist/deploy/status.d.ts +8 -0
  41. package/dist/deploy/status.d.ts.map +1 -1
  42. package/dist/deploy/status.js +6 -0
  43. package/dist/deploy/switch.d.ts.map +1 -1
  44. package/dist/deploy/switch.js +25 -0
  45. package/dist/deploy/types.d.ts +18 -0
  46. package/dist/deploy/types.d.ts.map +1 -1
  47. package/dist/deploy/verify.d.ts.map +1 -1
  48. package/dist/deploy/verify.js +7 -1
  49. package/dist/envsync/engine.d.ts.map +1 -1
  50. package/dist/envsync/engine.js +21 -7
  51. package/dist/envsync/paths.d.ts +22 -0
  52. package/dist/envsync/paths.d.ts.map +1 -1
  53. package/dist/envsync/paths.js +55 -0
  54. package/dist/peer-hint.d.ts +8 -0
  55. package/dist/peer-hint.d.ts.map +1 -0
  56. package/dist/peer-hint.js +49 -0
  57. package/dist/resolve/config-hint.d.ts +2 -0
  58. package/dist/resolve/config-hint.d.ts.map +1 -0
  59. package/dist/resolve/config-hint.js +23 -0
  60. package/dist/resolve/connect.d.ts.map +1 -1
  61. package/dist/resolve/connect.js +2 -1
  62. package/dist/resolve/deploy.d.ts.map +1 -1
  63. package/dist/resolve/deploy.js +167 -1
  64. package/dist/resolve/envsync.d.ts +16 -0
  65. package/dist/resolve/envsync.d.ts.map +1 -1
  66. package/dist/resolve/envsync.js +19 -0
  67. package/package.json +4 -3
@@ -0,0 +1,128 @@
1
+ import type { DeployConfig } from './types.js';
2
+ /** Absolute live/standby directory paths for the app being inspected. */
3
+ export interface SlotDirs {
4
+ live: string;
5
+ standby: string;
6
+ }
7
+ export type SharedDirStateName = 'linked' | 'missing' | 'empty-dir' | 'real-dir' | 'wrong-link';
8
+ export interface SharedDirSlotState {
9
+ state: SharedDirStateName;
10
+ /** Present only when `state === 'real-dir'`: recursive count of regular files found (symlinks inside count as 1, not followed). */
11
+ fileCount?: number;
12
+ /** Present only when `state === 'wrong-link'`: the symlink's target, resolved to an absolute path when it was relative. */
13
+ linkTarget?: string;
14
+ }
15
+ export interface SharedDirInspection {
16
+ /** The `shared_dirs` entry, slot-relative (e.g. "var/uploads"). */
17
+ dir: string;
18
+ /** Absolute path this dir's symlink is expected to point at (`shared_root/dir`). */
19
+ expectedTarget: string;
20
+ live: SharedDirSlotState;
21
+ standby: SharedDirSlotState;
22
+ }
23
+ /**
24
+ * Inspect every `config.shared_dirs` entry in both `slots.live` and
25
+ * `slots.standby`. Pure read — safe to call at any time, including from
26
+ * `deploy status`.
27
+ */
28
+ export declare function inspectSharedDirs(config: DeployConfig, slots: SlotDirs): SharedDirInspection[];
29
+ /** Thrown by `ensureLinks` for any shared dir it refuses to touch or can't fix without an option it wasn't given. */
30
+ export declare class SharedDirError extends Error {
31
+ readonly code: string;
32
+ readonly dir: string;
33
+ constructor(code: string, dir: string, message: string);
34
+ }
35
+ export interface EnsureLinksOptions {
36
+ /** Create the link (and the shared-root target dir) when the slot path is missing. Default: false. */
37
+ allowCreate?: boolean;
38
+ /** Replace a real-but-empty directory with the link. Default: false. */
39
+ allowReplaceEmpty?: boolean;
40
+ }
41
+ export type EnsureLinkAction = 'already-linked' | 'created' | 'replaced-empty';
42
+ export interface EnsureLinkResult {
43
+ dir: string;
44
+ action: EnsureLinkAction;
45
+ target: string;
46
+ }
47
+ /**
48
+ * Ensure every `config.shared_dirs` entry is correctly linked in `slotDir`.
49
+ *
50
+ * - `linked` (already points at the right target): no-op.
51
+ * - `missing`: created only if `allowCreate` — otherwise throws
52
+ * `HAZO_ENV_SHARED_DIR_MISSING`.
53
+ * - `empty-dir`: replaced only if `allowReplaceEmpty` — otherwise throws
54
+ * `HAZO_ENV_SHARED_DIR_EMPTY_DIR`.
55
+ * - `real-dir` (non-empty) and `wrong-link`: ALWAYS throw
56
+ * (`HAZO_ENV_SHARED_DIR_REAL_DIR` / `HAZO_ENV_SHARED_DIR_WRONG_LINK`),
57
+ * regardless of options — these states mean real data (or someone else's
58
+ * link) is sitting there, and only `deploy share`'s explicit migration is
59
+ * allowed to touch that, never an automatic "ensure" call.
60
+ *
61
+ * Processes entries in order and throws on the first blocking one — callers
62
+ * that want a full report before any error should call `inspectSharedDirs`
63
+ * first.
64
+ */
65
+ export declare function ensureLinks(config: DeployConfig, slotDir: string, opts?: EnsureLinksOptions): EnsureLinkResult[];
66
+ /** Options for `migrateSharedDirs`. */
67
+ export interface MigrateSharedDirsOptions {
68
+ /** Absolute path to the slot whose content wins on a same-path content conflict ("live"). */
69
+ live: string;
70
+ /**
71
+ * Absolute path to the other slot ("standby"). Pass `undefined` when there
72
+ * is no peer at all (pre-`deploy init`, or the peer dir no longer exists
73
+ * on disk) — only `live` is migrated in that case. Callers are responsible
74
+ * for only passing a path that actually exists; `migrateSharedDirs` itself
75
+ * never checks (an `undefined` is the explicit "no peer" signal).
76
+ */
77
+ standby?: string;
78
+ /** Preview the full report without writing, renaming, or linking anything. Default: false. */
79
+ dryRun?: boolean;
80
+ }
81
+ export type SharedDirShareSlotAction = 'already-linked' | 'linked' | 'no-peer';
82
+ /** Per-shared-dir result of one `deploy share` run. */
83
+ export interface SharedDirShareReport {
84
+ dir: string;
85
+ /** Absolute path under `shared_root` this dir was (or would be) merged into. */
86
+ target: string;
87
+ /** Files copied in from the live slot (unique to live, or the winning side of a content conflict). */
88
+ filesFromLive: number;
89
+ /** Files copied in from the standby slot (unique to standby). */
90
+ filesFromStandby: number;
91
+ /** Files present with identical content in both slots — copied once, deduped. */
92
+ identical: number;
93
+ /** Same-path files with different content — the standby copy (or whichever lost) was parked under `.conflicts/`. */
94
+ conflicts: number;
95
+ /** Absolute paths every conflicting file was parked at. */
96
+ conflictFiles: string[];
97
+ liveAction: SharedDirShareSlotAction;
98
+ standbyAction: SharedDirShareSlotAction;
99
+ /** Set only when the live slot's real directory was renamed aside during the swap. */
100
+ liveBackupDir?: string;
101
+ /** Set only when the standby slot's real directory was renamed aside during the swap. */
102
+ standbyBackupDir?: string;
103
+ /** Files merged from the renamed `.pre-share-*` backup dirs after the swap (closes the late-write race window). */
104
+ lateMergedFiles: number;
105
+ warnings: string[];
106
+ }
107
+ export interface MigrateSharedDirsResult {
108
+ dryRun: boolean;
109
+ dirs: SharedDirShareReport[];
110
+ }
111
+ /**
112
+ * One-time migration: merge whatever is already on disk in `opts.live` (and
113
+ * `opts.standby`, when present) into `config.shared_root`, then replace each
114
+ * slot's real directory with a symlink to it. See this file's header above
115
+ * (and `.scratch/deploy-shared-dirs/issues/02-deploy-share-migration.md`)
116
+ * for the full behavior. Idempotent — re-running after a successful run (or
117
+ * after a `--dry-run`) is safe; already-linked dirs are reported as such and
118
+ * untouched.
119
+ *
120
+ * Validates every configured dir's live/standby state BEFORE writing
121
+ * anything: if any dir has a `wrong-link` in either slot, the whole call
122
+ * throws `SharedDirError` without touching ANY dir (even ones that would
123
+ * otherwise have been fine) — a destructive-adjacent migration should fail
124
+ * atomically rather than leave some dirs migrated and others not because a
125
+ * later one hit a problem it can't safely resolve on its own.
126
+ */
127
+ export declare function migrateSharedDirs(config: DeployConfig, opts: MigrateSharedDirsOptions): MigrateSharedDirsResult;
128
+ //# sourceMappingURL=shared-dirs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-dirs.d.ts","sourceRoot":"","sources":["../../src/deploy/shared-dirs.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,yEAAyE;AACzE,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,CAAC;AAEhG,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,mIAAmI;IACnI,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2HAA2H;IAC3H,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,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AQ,GAAG,SAAS,CAAC;AAE/E,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC;IACf,sGAAsG;IACtG,aAAa,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,gBAAgB,EAAE,MAAM,CAAC;IACzB,iFAAiF;IACjF,SAAS,EAAE,MAAM,CAAC;IAClB,oHAAoH;IACpH,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,EAAE,wBAAwB,CAAC;IACrC,aAAa,EAAE,wBAAwB,CAAC;IACxC,sFAAsF;IACtF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yFAAyF;IACzF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mHAAmH;IACnH,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,oBAAoB,EAAE,CAAC;CAC9B;AAoZD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,wBAAwB,GAAG,uBAAuB,CAoB/G"}
@@ -0,0 +1,486 @@
1
+ // hazo_env/src/deploy/shared-dirs.ts — Shared-dirs core module
2
+ //
3
+ // Deep module for the "shared dirs" feature (see spec at
4
+ // .scratch/deploy-shared-dirs/spec.md): folders declared in
5
+ // `[deploy] shared_dirs` that live once under `shared_root` and are
6
+ // symlinked into each blue-green slot, so uploads survive `deploy switch`.
7
+ //
8
+ // Two responsibilities, deliberately kept apart from every other deploy
9
+ // command: inspecting what's actually on disk (`inspectSharedDirs`, pure
10
+ // read, never throws for a "bad" state — it just reports it) and enforcing
11
+ // the expected link (`ensureLinks`, throws a typed `SharedDirError` for any
12
+ // state it isn't explicitly told to fix). Every other deploy command
13
+ // (init/build/switch/rollback/status/clean) is expected to call through
14
+ // this module rather than touching shared-dir paths with raw fs calls
15
+ // itself — this file is the only place that does.
16
+ //
17
+ // All operations here are plain node:fs against real paths — no
18
+ // CommandRunner involved (there's no external command to run; symlink/mkdir
19
+ // are syscalls, not shell commands), matching how init.ts's
20
+ // `ensurePeerDataDir` also reaches for fs directly rather than routing
21
+ // through CommandRunner.
22
+ import crypto from 'node:crypto';
23
+ import fs from 'node:fs';
24
+ import path from 'node:path';
25
+ /**
26
+ * Recursively count regular files under `dirPath`. Symlinks found inside are
27
+ * counted (something is there) but never followed, both to avoid loops and
28
+ * because a shared dir containing a symlink is already an unexpected state
29
+ * this module doesn't try to interpret further.
30
+ */
31
+ function countFilesRecursive(dirPath) {
32
+ let count = 0;
33
+ const entries = fs.readdirSync(dirPath, { withFileTypes: true });
34
+ for (const entry of entries) {
35
+ if (entry.isSymbolicLink()) {
36
+ count += 1;
37
+ continue;
38
+ }
39
+ if (entry.isDirectory()) {
40
+ count += countFilesRecursive(path.join(dirPath, entry.name));
41
+ continue;
42
+ }
43
+ if (entry.isFile()) {
44
+ count += 1;
45
+ }
46
+ }
47
+ return count;
48
+ }
49
+ /**
50
+ * Inspect a single shared dir in a single slot. Never throws for a "bad"
51
+ * on-disk state (real-dir, wrong-link, ...) — reporting those states is the
52
+ * whole point; only an unexpected fs error (not ENOENT) propagates.
53
+ */
54
+ function inspectOneDir(slotDir, dir, expectedTarget) {
55
+ const fullPath = path.join(slotDir, dir);
56
+ let st;
57
+ try {
58
+ st = fs.lstatSync(fullPath);
59
+ }
60
+ catch (err) {
61
+ if (err.code === 'ENOENT')
62
+ return { state: 'missing' };
63
+ throw err;
64
+ }
65
+ if (st.isSymbolicLink()) {
66
+ const rawTarget = fs.readlinkSync(fullPath);
67
+ const resolvedTarget = path.isAbsolute(rawTarget) ? rawTarget : path.resolve(path.dirname(fullPath), rawTarget);
68
+ if (path.resolve(resolvedTarget) === path.resolve(expectedTarget)) {
69
+ return { state: 'linked' };
70
+ }
71
+ return { state: 'wrong-link', linkTarget: resolvedTarget };
72
+ }
73
+ if (st.isDirectory()) {
74
+ const fileCount = countFilesRecursive(fullPath);
75
+ return fileCount === 0 ? { state: 'empty-dir' } : { state: 'real-dir', fileCount };
76
+ }
77
+ // A plain file sitting where a directory/symlink was expected — treat it
78
+ // like any other unexpected real object blocking the link.
79
+ return { state: 'real-dir', fileCount: 1 };
80
+ }
81
+ /**
82
+ * Inspect every `config.shared_dirs` entry in both `slots.live` and
83
+ * `slots.standby`. Pure read — safe to call at any time, including from
84
+ * `deploy status`.
85
+ */
86
+ export function inspectSharedDirs(config, slots) {
87
+ return config.shared_dirs.map((dir) => {
88
+ const expectedTarget = path.join(config.shared_root, dir);
89
+ return {
90
+ dir,
91
+ expectedTarget,
92
+ live: inspectOneDir(slots.live, dir, expectedTarget),
93
+ standby: inspectOneDir(slots.standby, dir, expectedTarget),
94
+ };
95
+ });
96
+ }
97
+ /** Thrown by `ensureLinks` for any shared dir it refuses to touch or can't fix without an option it wasn't given. */
98
+ export class SharedDirError extends Error {
99
+ constructor(code, dir, message) {
100
+ super(message);
101
+ this.name = 'SharedDirError';
102
+ this.code = code;
103
+ this.dir = dir;
104
+ }
105
+ }
106
+ /**
107
+ * Ensure every `config.shared_dirs` entry is correctly linked in `slotDir`.
108
+ *
109
+ * - `linked` (already points at the right target): no-op.
110
+ * - `missing`: created only if `allowCreate` — otherwise throws
111
+ * `HAZO_ENV_SHARED_DIR_MISSING`.
112
+ * - `empty-dir`: replaced only if `allowReplaceEmpty` — otherwise throws
113
+ * `HAZO_ENV_SHARED_DIR_EMPTY_DIR`.
114
+ * - `real-dir` (non-empty) and `wrong-link`: ALWAYS throw
115
+ * (`HAZO_ENV_SHARED_DIR_REAL_DIR` / `HAZO_ENV_SHARED_DIR_WRONG_LINK`),
116
+ * regardless of options — these states mean real data (or someone else's
117
+ * link) is sitting there, and only `deploy share`'s explicit migration is
118
+ * allowed to touch that, never an automatic "ensure" call.
119
+ *
120
+ * Processes entries in order and throws on the first blocking one — callers
121
+ * that want a full report before any error should call `inspectSharedDirs`
122
+ * first.
123
+ */
124
+ export function ensureLinks(config, slotDir, opts = {}) {
125
+ const results = [];
126
+ for (const dir of config.shared_dirs) {
127
+ const expectedTarget = path.join(config.shared_root, dir);
128
+ const fullPath = path.join(slotDir, dir);
129
+ const slotState = inspectOneDir(slotDir, dir, expectedTarget);
130
+ if (slotState.state === 'linked') {
131
+ results.push({ dir, action: 'already-linked', target: expectedTarget });
132
+ continue;
133
+ }
134
+ if (slotState.state === 'wrong-link') {
135
+ throw new SharedDirError('HAZO_ENV_SHARED_DIR_WRONG_LINK', dir, `Shared dir "${dir}" at ${fullPath} is a symlink to "${slotState.linkTarget}", not the expected target "${expectedTarget}". Refusing to touch it — remove the link by hand, or run "hazo-env deploy share" to adopt it.`);
136
+ }
137
+ if (slotState.state === 'real-dir') {
138
+ throw new SharedDirError('HAZO_ENV_SHARED_DIR_REAL_DIR', dir, `Shared dir "${dir}" at ${fullPath} is a real directory with ${slotState.fileCount} file(s). Refusing to replace it with a link — run "hazo-env deploy share" to migrate its contents first.`);
139
+ }
140
+ if (slotState.state === 'empty-dir') {
141
+ if (!opts.allowReplaceEmpty) {
142
+ throw new SharedDirError('HAZO_ENV_SHARED_DIR_EMPTY_DIR', dir, `Shared dir "${dir}" at ${fullPath} is an empty real directory, not a link. Pass allowReplaceEmpty to replace it, or run "hazo-env deploy share".`);
143
+ }
144
+ fs.mkdirSync(expectedTarget, { recursive: true });
145
+ fs.rmdirSync(fullPath);
146
+ fs.symlinkSync(expectedTarget, fullPath, 'dir');
147
+ results.push({ dir, action: 'replaced-empty', target: expectedTarget });
148
+ continue;
149
+ }
150
+ // slotState.state === 'missing'
151
+ if (!opts.allowCreate) {
152
+ throw new SharedDirError('HAZO_ENV_SHARED_DIR_MISSING', dir, `Shared dir "${dir}" is missing at ${fullPath}. Pass allowCreate to create the link, or run "hazo-env deploy init".`);
153
+ }
154
+ fs.mkdirSync(expectedTarget, { recursive: true });
155
+ fs.mkdirSync(path.dirname(fullPath), { recursive: true });
156
+ fs.symlinkSync(expectedTarget, fullPath, 'dir');
157
+ results.push({ dir, action: 'created', target: expectedTarget });
158
+ }
159
+ return results;
160
+ }
161
+ /** sha256 + size compare — cheap size check first, full hash only when sizes match. */
162
+ function filesIdentical(pathA, pathB) {
163
+ const statA = fs.statSync(pathA);
164
+ const statB = fs.statSync(pathB);
165
+ if (statA.size !== statB.size)
166
+ return false;
167
+ const hash = (p) => crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex');
168
+ return hash(pathA) === hash(pathB);
169
+ }
170
+ /** Copy a file, preserving its mtime and mode (user story 14). Creates the destination's parent dirs. */
171
+ function copyFilePreserving(src, dest) {
172
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
173
+ fs.copyFileSync(src, dest);
174
+ const st = fs.statSync(src);
175
+ fs.utimesSync(dest, st.atime, st.mtime);
176
+ fs.chmodSync(dest, st.mode);
177
+ }
178
+ /** Recursively list regular files under `baseDir`, as paths relative to it. `[]` if `baseDir` doesn't exist. Nested symlinks are skipped (not expected inside an uploads-style shared dir; never followed). */
179
+ function listFilesRecursive(baseDir, subDir = '') {
180
+ const fullDir = path.join(baseDir, subDir);
181
+ let entries;
182
+ try {
183
+ entries = fs.readdirSync(fullDir, { withFileTypes: true });
184
+ }
185
+ catch {
186
+ return [];
187
+ }
188
+ const results = [];
189
+ for (const entry of entries) {
190
+ const relPath = path.join(subDir, entry.name);
191
+ if (entry.isDirectory()) {
192
+ results.push(...listFilesRecursive(baseDir, relPath));
193
+ }
194
+ else if (entry.isFile()) {
195
+ results.push(relPath);
196
+ }
197
+ }
198
+ return results;
199
+ }
200
+ /**
201
+ * Park a losing/incoming source file under
202
+ * `shared_root/.conflicts/<slot-basename>/<dir>/<relPath>` (user story 10).
203
+ * Never touches the source. `slotLabel` is the SLOT's own basename (e.g.
204
+ * "gotimer-green"), not the shared dir's — callers must pass the slot root
205
+ * dir's basename, never a deeper source path's.
206
+ */
207
+ function parkConflictFile(config, slotLabel, dir, relPath, sourcePath, dryRun) {
208
+ const conflictDest = path.join(config.shared_root, '.conflicts', slotLabel, dir, relPath);
209
+ if (!dryRun)
210
+ copyFilePreserving(sourcePath, conflictDest);
211
+ return conflictDest;
212
+ }
213
+ function conflictWarning(dir, relPath, conflictDest) {
214
+ return (`"${dir}/${path.normalize(relPath)}" already exists in the shared target with different content — ` +
215
+ `parked the incoming copy at ${conflictDest} instead of overwriting it.`);
216
+ }
217
+ function mergeFilesIntoTarget(standby, live, targetDir, dir, config, dryRun) {
218
+ const outcome = {
219
+ filesFromLive: 0,
220
+ filesFromStandby: 0,
221
+ identical: 0,
222
+ conflicts: 0,
223
+ conflictFiles: [],
224
+ warnings: [],
225
+ };
226
+ const standbySet = new Set(standby.files);
227
+ const liveSet = new Set(live.files);
228
+ function copyUniqueIntoTarget(relPath, sourcePath, slotLabel, category) {
229
+ const destPath = path.join(targetDir, relPath);
230
+ if (fs.existsSync(destPath)) {
231
+ if (filesIdentical(sourcePath, destPath)) {
232
+ outcome.identical++;
233
+ return;
234
+ }
235
+ const conflictDest = parkConflictFile(config, slotLabel, dir, relPath, sourcePath, dryRun);
236
+ outcome.conflicts++;
237
+ outcome.conflictFiles.push(conflictDest);
238
+ outcome.warnings.push(conflictWarning(dir, relPath, conflictDest));
239
+ return;
240
+ }
241
+ if (!dryRun)
242
+ copyFilePreserving(sourcePath, destPath);
243
+ if (category === 'live')
244
+ outcome.filesFromLive++;
245
+ else
246
+ outcome.filesFromStandby++;
247
+ }
248
+ // Files unique to standby.
249
+ for (const relPath of standby.files) {
250
+ if (liveSet.has(relPath))
251
+ continue;
252
+ copyUniqueIntoTarget(relPath, path.join(standby.sourceDir, relPath), standby.slotLabel, 'standby');
253
+ }
254
+ // Files unique to live.
255
+ for (const relPath of live.files) {
256
+ if (standbySet.has(relPath))
257
+ continue;
258
+ copyUniqueIntoTarget(relPath, path.join(live.sourceDir, relPath), live.slotLabel, 'live');
259
+ }
260
+ // Files present in both slots: dedupe identical content, or live-wins + park standby's.
261
+ for (const relPath of live.files) {
262
+ if (!standbySet.has(relPath))
263
+ continue;
264
+ const standbyPath = path.join(standby.sourceDir, relPath);
265
+ const livePath = path.join(live.sourceDir, relPath);
266
+ const destPath = path.join(targetDir, relPath);
267
+ const bothIdentical = filesIdentical(standbyPath, livePath);
268
+ if (bothIdentical) {
269
+ if (fs.existsSync(destPath)) {
270
+ if (filesIdentical(livePath, destPath)) {
271
+ outcome.identical++;
272
+ }
273
+ else {
274
+ const conflictDest = parkConflictFile(config, live.slotLabel, dir, relPath, livePath, dryRun);
275
+ outcome.conflicts++;
276
+ outcome.conflictFiles.push(conflictDest);
277
+ outcome.warnings.push(conflictWarning(dir, relPath, conflictDest));
278
+ }
279
+ }
280
+ else {
281
+ if (!dryRun)
282
+ copyFilePreserving(livePath, destPath);
283
+ outcome.identical++;
284
+ }
285
+ continue;
286
+ }
287
+ // Differ between slots: live wins into target (subject to the same
288
+ // never-overwrite-target rule); standby's version is ALWAYS parked,
289
+ // independent of what happened to live's.
290
+ if (fs.existsSync(destPath)) {
291
+ if (!filesIdentical(livePath, destPath)) {
292
+ const conflictDest = parkConflictFile(config, live.slotLabel, dir, relPath, livePath, dryRun);
293
+ outcome.conflicts++;
294
+ outcome.conflictFiles.push(conflictDest);
295
+ outcome.warnings.push(conflictWarning(dir, relPath, conflictDest));
296
+ }
297
+ // else: target already holds live's content (idempotent re-run) — nothing to do for the live side.
298
+ }
299
+ else {
300
+ if (!dryRun)
301
+ copyFilePreserving(livePath, destPath);
302
+ outcome.filesFromLive++;
303
+ }
304
+ const standbyConflictDest = parkConflictFile(config, standby.slotLabel, dir, relPath, standbyPath, dryRun);
305
+ outcome.conflicts++;
306
+ outcome.conflictFiles.push(standbyConflictDest);
307
+ }
308
+ return outcome;
309
+ }
310
+ function backupSuffix(now) {
311
+ return now.toISOString().replace(/[:.]/g, '-');
312
+ }
313
+ /**
314
+ * Ensure a single slot's shared-dir path is a symlink to `target`, handling
315
+ * every state `inspectOneDir` can report:
316
+ *
317
+ * - `linked`: no-op.
318
+ * - `wrong-link`: throws `SharedDirError` — `deploy share` refuses to
319
+ * clobber a hand-made link to somewhere else (user story 18).
320
+ * - `missing`: the path (and any missing parent dirs) is created directly
321
+ * as a symlink — there's nothing to preserve (user story 21).
322
+ * - `real-dir` / `empty-dir`: the directory is renamed aside to
323
+ * `<dir>.pre-share-<timestamp>` (never deleted) and the symlink is
324
+ * created in its place (user stories 12/13).
325
+ *
326
+ * `backupDir`'s planned name is still returned in dry-run mode (for the
327
+ * report) even though nothing is actually renamed.
328
+ */
329
+ /**
330
+ * Shared `wrong-link` guard for `deploy share` — thrown both by the
331
+ * pre-flight validation pass (before anything is touched) and by
332
+ * `swapSlotToLink` itself (belt-and-suspenders: the pre-flight pass already
333
+ * catches this for every configured dir, but a direct caller of
334
+ * `swapSlotToLink` should still get a safe refusal, not a corrupted symlink).
335
+ */
336
+ function assertNotWrongLink(state, slotDescription, fullPath, dir, target) {
337
+ if (state.state !== 'wrong-link')
338
+ return;
339
+ throw new SharedDirError('HAZO_ENV_SHARED_DIR_WRONG_LINK', dir, `Shared dir "${dir}" ${slotDescription} (${fullPath}) is a symlink to "${state.linkTarget}", not the expected target "${target}". ` +
340
+ `Refusing to run "deploy share" — remove the link by hand first if it's stale.`);
341
+ }
342
+ function swapSlotToLink(slotRootDir, dir, target, now, dryRun) {
343
+ const fullPath = path.join(slotRootDir, dir);
344
+ const state = inspectOneDir(slotRootDir, dir, target);
345
+ if (state.state === 'linked')
346
+ return { action: 'already-linked' };
347
+ assertNotWrongLink(state, 'at', fullPath, dir, target);
348
+ if (state.state === 'missing') {
349
+ if (!dryRun) {
350
+ fs.mkdirSync(path.dirname(fullPath), { recursive: true });
351
+ fs.symlinkSync(target, fullPath, 'dir');
352
+ }
353
+ return { action: 'created' };
354
+ }
355
+ // real-dir or empty-dir: rename aside (never delete), then symlink.
356
+ const backupDir = `${fullPath}.pre-share-${backupSuffix(now)}`;
357
+ if (!dryRun) {
358
+ fs.renameSync(fullPath, backupDir);
359
+ fs.symlinkSync(target, fullPath, 'dir');
360
+ }
361
+ return { action: 'swapped', backupDir };
362
+ }
363
+ function migrateOneDir(config, dir, liveRoot, standbyRoot, dryRun, now) {
364
+ const target = path.join(config.shared_root, dir);
365
+ const liveState = inspectOneDir(liveRoot, dir, target);
366
+ const standbyState = standbyRoot ? inspectOneDir(standbyRoot, dir, target) : undefined;
367
+ const report = {
368
+ dir,
369
+ target,
370
+ filesFromLive: 0,
371
+ filesFromStandby: 0,
372
+ identical: 0,
373
+ conflicts: 0,
374
+ conflictFiles: [],
375
+ liveAction: 'linked',
376
+ standbyAction: standbyRoot ? 'linked' : 'no-peer',
377
+ lateMergedFiles: 0,
378
+ warnings: [],
379
+ };
380
+ const liveAlreadyLinked = liveState.state === 'linked';
381
+ const standbyAlreadyLinked = !standbyRoot || standbyState?.state === 'linked';
382
+ if (liveAlreadyLinked && standbyAlreadyLinked) {
383
+ // Fully migrated already (user story 16: idempotent re-run) — nothing to merge or swap.
384
+ report.liveAction = 'already-linked';
385
+ if (standbyRoot)
386
+ report.standbyAction = 'already-linked';
387
+ return report;
388
+ }
389
+ if (!dryRun) {
390
+ fs.mkdirSync(target, { recursive: true });
391
+ }
392
+ const standbySourceDir = standbyState && (standbyState.state === 'real-dir' || standbyState.state === 'empty-dir')
393
+ ? path.join(standbyRoot, dir)
394
+ : undefined;
395
+ const liveSourceDir = liveState.state === 'real-dir' || liveState.state === 'empty-dir' ? path.join(liveRoot, dir) : undefined;
396
+ // Slot labels for conflict parking (`.conflicts/<slot-basename>/...`) —
397
+ // always the SLOT root's own basename (e.g. "gotimer-green"), never a
398
+ // deeper shared-dir path's, and stay the same for the late-merge pass
399
+ // below even though it reads from the renamed backup dir instead.
400
+ const standbySlotLabel = standbyRoot ? path.basename(standbyRoot) : 'standby';
401
+ const liveSlotLabel = path.basename(liveRoot);
402
+ const standbyFilesAtMergeTime = standbySourceDir ? listFilesRecursive(standbySourceDir) : [];
403
+ const liveFilesAtMergeTime = liveSourceDir ? listFilesRecursive(liveSourceDir) : [];
404
+ const merge = mergeFilesIntoTarget({ files: standbyFilesAtMergeTime, sourceDir: standbySourceDir, slotLabel: standbySlotLabel }, { files: liveFilesAtMergeTime, sourceDir: liveSourceDir, slotLabel: liveSlotLabel }, target, dir, config, dryRun);
405
+ report.filesFromLive = merge.filesFromLive;
406
+ report.filesFromStandby = merge.filesFromStandby;
407
+ report.identical = merge.identical;
408
+ report.conflicts = merge.conflicts;
409
+ report.conflictFiles.push(...merge.conflictFiles);
410
+ report.warnings.push(...merge.warnings);
411
+ // Swap standby first, live last (user story 12) — the running (live) app
412
+ // sees its folder replaced as late and as briefly as possible.
413
+ let standbyBackupDir;
414
+ if (standbyRoot) {
415
+ const standbySwap = swapSlotToLink(standbyRoot, dir, target, now, dryRun);
416
+ report.standbyAction = standbySwap.action === 'already-linked' ? 'already-linked' : 'linked';
417
+ standbyBackupDir = standbySwap.backupDir;
418
+ if (standbyBackupDir)
419
+ report.standbyBackupDir = standbyBackupDir;
420
+ }
421
+ const liveSwap = swapSlotToLink(liveRoot, dir, target, now, dryRun);
422
+ report.liveAction = liveSwap.action === 'already-linked' ? 'already-linked' : 'linked';
423
+ if (liveSwap.backupDir)
424
+ report.liveBackupDir = liveSwap.backupDir;
425
+ // Late-write re-scan (user story: backups re-scanned for late writes): a
426
+ // file written into the real dir between the initial merge scan above and
427
+ // the rename-to-backup just now would otherwise be stranded in the backup
428
+ // dir, invisible through the new symlink. Only meaningful (and only run)
429
+ // for a real apply — dry-run never created a backup dir to rescan.
430
+ //
431
+ // The backup dir is the exact same directory that was just scanned and
432
+ // merged above (rename doesn't remove any content) — re-scanning it whole
433
+ // would re-merge every already-merged file a second time. Diff against
434
+ // the file lists captured at merge time so only genuinely NEW relPaths
435
+ // (written during the rename race window) go through the merge again.
436
+ const standbyFilesAfterSwap = standbyBackupDir ? listFilesRecursive(standbyBackupDir) : [];
437
+ const liveFilesAfterSwap = liveSwap.backupDir ? listFilesRecursive(liveSwap.backupDir) : [];
438
+ const standbyAlreadyMergedSet = new Set(standbyFilesAtMergeTime);
439
+ const liveAlreadyMergedSet = new Set(liveFilesAtMergeTime);
440
+ const lateStandbyFiles = standbyFilesAfterSwap.filter((p) => !standbyAlreadyMergedSet.has(p));
441
+ const lateLiveFiles = liveFilesAfterSwap.filter((p) => !liveAlreadyMergedSet.has(p));
442
+ if (!dryRun && (lateStandbyFiles.length || lateLiveFiles.length)) {
443
+ const lateMerge = mergeFilesIntoTarget({ files: lateStandbyFiles, sourceDir: standbyBackupDir, slotLabel: standbySlotLabel }, { files: lateLiveFiles, sourceDir: liveSwap.backupDir, slotLabel: liveSlotLabel }, target, dir, config, false);
444
+ report.filesFromLive += lateMerge.filesFromLive;
445
+ report.filesFromStandby += lateMerge.filesFromStandby;
446
+ report.identical += lateMerge.identical;
447
+ report.conflicts += lateMerge.conflicts;
448
+ report.conflictFiles.push(...lateMerge.conflictFiles);
449
+ report.warnings.push(...lateMerge.warnings);
450
+ report.lateMergedFiles = lateMerge.filesFromLive + lateMerge.filesFromStandby;
451
+ }
452
+ return report;
453
+ }
454
+ /**
455
+ * One-time migration: merge whatever is already on disk in `opts.live` (and
456
+ * `opts.standby`, when present) into `config.shared_root`, then replace each
457
+ * slot's real directory with a symlink to it. See this file's header above
458
+ * (and `.scratch/deploy-shared-dirs/issues/02-deploy-share-migration.md`)
459
+ * for the full behavior. Idempotent — re-running after a successful run (or
460
+ * after a `--dry-run`) is safe; already-linked dirs are reported as such and
461
+ * untouched.
462
+ *
463
+ * Validates every configured dir's live/standby state BEFORE writing
464
+ * anything: if any dir has a `wrong-link` in either slot, the whole call
465
+ * throws `SharedDirError` without touching ANY dir (even ones that would
466
+ * otherwise have been fine) — a destructive-adjacent migration should fail
467
+ * atomically rather than leave some dirs migrated and others not because a
468
+ * later one hit a problem it can't safely resolve on its own.
469
+ */
470
+ export function migrateSharedDirs(config, opts) {
471
+ const dryRun = opts.dryRun ?? false;
472
+ const liveRoot = opts.live;
473
+ const standbyRoot = opts.standby;
474
+ const now = new Date();
475
+ for (const dir of config.shared_dirs) {
476
+ const target = path.join(config.shared_root, dir);
477
+ const liveState = inspectOneDir(liveRoot, dir, target);
478
+ assertNotWrongLink(liveState, 'in the live slot', path.join(liveRoot, dir), dir, target);
479
+ if (standbyRoot) {
480
+ const standbyState = inspectOneDir(standbyRoot, dir, target);
481
+ assertNotWrongLink(standbyState, 'in the standby slot', path.join(standbyRoot, dir), dir, target);
482
+ }
483
+ }
484
+ const dirs = config.shared_dirs.map((dir) => migrateOneDir(config, dir, liveRoot, standbyRoot, dryRun, now));
485
+ return { dryRun, dirs };
486
+ }
@@ -1,4 +1,5 @@
1
1
  import type { CommandRunner, DeployConfig } from './types.js';
2
+ import type { SharedDirInspection } from './shared-dirs.js';
2
3
  /** Snapshot of one directory's role in the blue/green pair. */
3
4
  export interface DeployDirStatus {
4
5
  role: 'live' | 'standby';
@@ -40,6 +41,13 @@ export interface DeployStatusResult {
40
41
  pm_cwd?: string;
41
42
  stale: boolean;
42
43
  }>;
44
+ /**
45
+ * Per-dir, per-slot state for each `config.shared_dirs` entry (see
46
+ * shared-dirs.ts). `[]` when `shared_dirs` is empty (feature unused) or
47
+ * when `!stateFound` (live/standby dirs aren't known yet) — same
48
+ * convention as `sidecars`.
49
+ */
50
+ sharedDirs: SharedDirInspection[];
43
51
  /** Non-fatal problems encountered while gathering status (pm2 unavailable, unparsable df output, ...). */
44
52
  warnings: string[];
45
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/deploy/status.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAe,MAAM,YAAY,CAAC;AAE3E,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC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