@hexagen-monaco/sync 0.6.0 → 0.7.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.
- package/dist/cli.js +698 -510
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/domain/types.d.ts +8 -1
- package/dist/domain/types.d.ts.map +1 -1
- package/dist/fs-utils.d.ts +4 -4
- package/dist/fs-utils.d.ts.map +1 -1
- package/dist/generators/apps-framework-templates.d.ts.map +1 -1
- package/dist/generators/apps.d.ts.map +1 -1
- package/dist/generators/architecture-files.d.ts.map +1 -1
- package/dist/generators/barrels/recursive.d.ts +2 -3
- package/dist/generators/barrels/recursive.d.ts.map +1 -1
- package/dist/generators/barrels.d.ts +2 -3
- package/dist/generators/barrels.d.ts.map +1 -1
- package/dist/generators/cross-context.d.ts.map +1 -1
- package/dist/generators/eslint.d.ts.map +1 -1
- package/dist/generators/layer-folders.d.ts +18 -6
- package/dist/generators/layer-folders.d.ts.map +1 -1
- package/dist/generators/package-json.d.ts +2 -3
- package/dist/generators/package-json.d.ts.map +1 -1
- package/dist/generators/reap.d.ts +7 -3
- package/dist/generators/reap.d.ts.map +1 -1
- package/dist/generators/root-file-templates.d.ts +1 -1
- package/dist/generators/root-file-templates.d.ts.map +1 -1
- package/dist/generators/root-files.d.ts.map +1 -1
- package/dist/generators/shared-kernel.d.ts.map +1 -1
- package/dist/generators/stubs.d.ts.map +1 -1
- package/dist/generators/tsconfig.d.ts.map +1 -1
- package/dist/index.js +572 -379
- package/dist/index.js.map +1 -1
- package/dist/journal.d.ts +64 -0
- package/dist/journal.d.ts.map +1 -0
- package/dist/migration-report.d.ts +13 -2
- package/dist/migration-report.d.ts.map +1 -1
- package/dist/results.d.ts +66 -0
- package/dist/results.d.ts.map +1 -1
- package/dist/sync-engine-helpers.d.ts.map +1 -1
- package/dist/sync-engine.d.ts +13 -1
- package/dist/sync-engine.d.ts.map +1 -1
- package/dist/toolchain-version.d.ts +14 -0
- package/dist/toolchain-version.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/application/use-cases/stub-generation.use-case.d.ts +0 -23
- package/dist/application/use-cases/stub-generation.use-case.d.ts.map +0 -1
- package/dist/generators/migration-assistant.d.ts +0 -7
- package/dist/generators/migration-assistant.d.ts.map +0 -1
- package/dist/generators/migration-audit.d.ts +0 -28
- package/dist/generators/migration-audit.d.ts.map +0 -1
- package/dist/generators/migration-stubs.d.ts +0 -7
- package/dist/generators/migration-stubs.d.ts.map +0 -1
- package/dist/generators/test-generator.d.ts +0 -7
- package/dist/generators/test-generator.d.ts.map +0 -1
- package/dist/generators/test-templates/data-builder.d.ts +0 -2
- package/dist/generators/test-templates/data-builder.d.ts.map +0 -1
- package/dist/generators/test-templates/enhanced-test-double.d.ts +0 -2
- package/dist/generators/test-templates/enhanced-test-double.d.ts.map +0 -1
- package/dist/generators/test-templates/index.d.ts +0 -5
- package/dist/generators/test-templates/index.d.ts.map +0 -1
- package/dist/generators/test-templates/integration-test.d.ts +0 -2
- package/dist/generators/test-templates/integration-test.d.ts.map +0 -1
- package/dist/generators/test-templates/unit-test.d.ts +0 -2
- package/dist/generators/test-templates/unit-test.d.ts.map +0 -1
- package/dist/generators/wiring.d.ts +0 -20
- package/dist/generators/wiring.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import path7 from 'path';
|
|
2
|
+
import fs4, { realpathSync, lstatSync, createWriteStream } from 'fs';
|
|
3
|
+
import fs5 from 'fs/promises';
|
|
4
4
|
import { promisify } from 'util';
|
|
5
5
|
import { exec } from 'child_process';
|
|
6
6
|
import yaml3 from 'js-yaml';
|
|
7
7
|
import crypto from 'crypto';
|
|
8
|
-
import { Project, MethodSignature } from 'ts-morph';
|
|
9
8
|
import { fileURLToPath } from 'url';
|
|
9
|
+
import { Project, MethodSignature } from 'ts-morph';
|
|
10
10
|
|
|
11
11
|
var __defProp = Object.defineProperty;
|
|
12
12
|
var __export = (target, all) => {
|
|
@@ -19,26 +19,132 @@ var MigrationReport = class {
|
|
|
19
19
|
this.entries.push({ type, target, message });
|
|
20
20
|
}
|
|
21
21
|
async writeReport(config) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
if (config.dryRun && !config.report) {
|
|
23
|
+
const counts = /* @__PURE__ */ new Map();
|
|
24
|
+
for (const e of this.entries) {
|
|
25
|
+
counts.set(e.type, (counts.get(e.type) ?? 0) + 1);
|
|
26
|
+
}
|
|
27
|
+
const breakdown = [...counts.entries()].map(([type, n]) => `${n} ${type}`).join(", ");
|
|
28
|
+
config.logger.info(
|
|
29
|
+
`[DRY-RUN] skipping migration report file (${this.entries.length} entries${breakdown ? `: ${breakdown}` : ""}) — pass --report <path> to write it anyway`
|
|
30
|
+
);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const reportPath = config.report ? path7.resolve(config.workspaceRoot, config.report) : path7.join(config.workspaceRoot, "SYNC-MIGRATION-REPORT.md");
|
|
34
|
+
await fs5.mkdir(path7.dirname(reportPath), { recursive: true });
|
|
35
|
+
let preContent = null;
|
|
36
|
+
try {
|
|
37
|
+
preContent = await fs5.readFile(reportPath, "utf8");
|
|
38
|
+
} catch (e) {
|
|
39
|
+
if (!(e instanceof Error && "code" in e && e.code === "ENOENT"))
|
|
40
|
+
throw e;
|
|
41
|
+
}
|
|
42
|
+
config.journal?.recordWrite(reportPath, preContent);
|
|
26
43
|
const stream = createWriteStream(reportPath, { flags: "w" });
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
stream.write(
|
|
30
|
-
|
|
44
|
+
await new Promise((resolve, reject) => {
|
|
45
|
+
stream.on("error", reject);
|
|
46
|
+
stream.write("# Sync Migration Report\n\n");
|
|
47
|
+
for (const e of this.entries) {
|
|
48
|
+
stream.write(
|
|
49
|
+
`- ${e.type.toUpperCase()}: ${e.target}${e.message ? ` – ${e.message}` : ""}
|
|
31
50
|
`
|
|
32
|
-
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
stream.end(resolve);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var SyncJournal = class {
|
|
58
|
+
entries = [];
|
|
59
|
+
/**
|
|
60
|
+
* Record a write BEFORE it is attempted. `preContent: null` means the file
|
|
61
|
+
* did not exist (a create); a string is the full pre-image of an overwrite.
|
|
62
|
+
* Over-recording is safe: rolling back a write that never happened either
|
|
63
|
+
* restores identical content or unlinks a file that is not there (ENOENT
|
|
64
|
+
* tolerated below). Under-recording loses user data — so mutation sites
|
|
65
|
+
* record first, mutate second.
|
|
66
|
+
*/
|
|
67
|
+
recordWrite(filePath, preContent) {
|
|
68
|
+
this.entries.push({
|
|
69
|
+
path: filePath,
|
|
70
|
+
kind: preContent === null ? "created" : "overwritten",
|
|
71
|
+
preContent
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/** Record a deletion BEFORE the unlink, with the full pre-image. */
|
|
75
|
+
recordDelete(filePath, preContent) {
|
|
76
|
+
this.entries.push({ path: filePath, kind: "deleted", preContent });
|
|
77
|
+
}
|
|
78
|
+
get size() {
|
|
79
|
+
return this.entries.length;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Human-readable journal lines (workspace-relative), oldest first — printed
|
|
83
|
+
* verbatim when a failed run must NOT roll back (--allow-dirty).
|
|
84
|
+
*/
|
|
85
|
+
describeEntries(workspaceRoot) {
|
|
86
|
+
return this.entries.map(
|
|
87
|
+
(e) => `${e.kind} ${path7.relative(workspaceRoot, e.path)}`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Replay the journal in REVERSE order: restore pre-images, unlink created
|
|
92
|
+
* files. Reverse order makes repeated writes to the same path converge on
|
|
93
|
+
* the OLDEST pre-image (pass-1 barrel pre-image is restored last), i.e. the
|
|
94
|
+
* true pre-sync state.
|
|
95
|
+
*
|
|
96
|
+
* Per-entry best-effort: a failing inverse op is collected and replay
|
|
97
|
+
* CONTINUES — restoring nine of ten files beats aborting at the first
|
|
98
|
+
* error. The caller prints the failures; nothing here (or anywhere) falls
|
|
99
|
+
* back to a git-wide reset/clean.
|
|
100
|
+
*
|
|
101
|
+
* Restores use a plain writeFile, not the atomic tmp+rename protocol: the
|
|
102
|
+
* rollback may be running on the same broken substrate that failed the
|
|
103
|
+
* sync, and the simplest possible write maximizes the odds of getting the
|
|
104
|
+
* user's bytes back on disk.
|
|
105
|
+
*/
|
|
106
|
+
async rollback(logger, workspaceRoot) {
|
|
107
|
+
const outcome = {
|
|
108
|
+
attempted: this.entries.length,
|
|
109
|
+
restored: 0,
|
|
110
|
+
failures: []
|
|
111
|
+
};
|
|
112
|
+
for (const entry of [...this.entries].reverse()) {
|
|
113
|
+
const relative = path7.relative(workspaceRoot, entry.path);
|
|
114
|
+
try {
|
|
115
|
+
if (entry.preContent === null) {
|
|
116
|
+
try {
|
|
117
|
+
await fs5.unlink(entry.path);
|
|
118
|
+
} catch (err3) {
|
|
119
|
+
if (!(err3 instanceof Error && "code" in err3 && err3.code === "ENOENT")) {
|
|
120
|
+
throw err3;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
logger.info(`rolled back (removed) ${relative}`);
|
|
124
|
+
} else {
|
|
125
|
+
await fs5.mkdir(path7.dirname(entry.path), { recursive: true });
|
|
126
|
+
await fs5.writeFile(entry.path, entry.preContent, {
|
|
127
|
+
encoding: "utf8"
|
|
128
|
+
});
|
|
129
|
+
logger.info(`rolled back (restored) ${relative}`);
|
|
130
|
+
}
|
|
131
|
+
outcome.restored += 1;
|
|
132
|
+
} catch (err3) {
|
|
133
|
+
outcome.failures.push({
|
|
134
|
+
path: entry.path,
|
|
135
|
+
intended: entry.preContent === null ? "remove created file" : "restore pre-image",
|
|
136
|
+
error: err3 instanceof Error ? err3.message : String(err3)
|
|
137
|
+
});
|
|
138
|
+
}
|
|
33
139
|
}
|
|
34
|
-
|
|
140
|
+
return outcome;
|
|
35
141
|
}
|
|
36
142
|
};
|
|
37
143
|
var LOCK_FILE = ".architecture/.sync.lock";
|
|
38
144
|
var LockFile = class {
|
|
39
|
-
constructor(workspaceRoot, fsImpl =
|
|
145
|
+
constructor(workspaceRoot, fsImpl = fs5, logger = console) {
|
|
40
146
|
this.workspaceRoot = workspaceRoot;
|
|
41
|
-
this.lockPath =
|
|
147
|
+
this.lockPath = path7.join(workspaceRoot, LOCK_FILE);
|
|
42
148
|
this.fsImpl = fsImpl;
|
|
43
149
|
this.logger = logger;
|
|
44
150
|
}
|
|
@@ -105,11 +211,11 @@ var LockFile = class {
|
|
|
105
211
|
};
|
|
106
212
|
var BIN_NAME = process.platform === "win32" ? "hexagen-lint.cmd" : "hexagen-lint";
|
|
107
213
|
function resolveArchLinterBin(startDir) {
|
|
108
|
-
let dir =
|
|
214
|
+
let dir = path7.resolve(startDir);
|
|
109
215
|
for (; ; ) {
|
|
110
|
-
const candidate =
|
|
111
|
-
if (
|
|
112
|
-
const parent =
|
|
216
|
+
const candidate = path7.join(dir, "node_modules", ".bin", BIN_NAME);
|
|
217
|
+
if (fs4.existsSync(candidate)) return candidate;
|
|
218
|
+
const parent = path7.dirname(dir);
|
|
113
219
|
if (parent === dir) return null;
|
|
114
220
|
dir = parent;
|
|
115
221
|
}
|
|
@@ -155,9 +261,24 @@ function createEmptyResult() {
|
|
|
155
261
|
created: [],
|
|
156
262
|
skipped: [],
|
|
157
263
|
updated: [],
|
|
264
|
+
deleted: [],
|
|
265
|
+
unchanged: [],
|
|
158
266
|
totalOps: 0
|
|
159
267
|
};
|
|
160
268
|
}
|
|
269
|
+
function recordWriteStatus(result, filePath, status) {
|
|
270
|
+
if (status === "created") {
|
|
271
|
+
result.created.push(filePath);
|
|
272
|
+
result.totalOps += 1;
|
|
273
|
+
} else if (status === "updated") {
|
|
274
|
+
result.updated.push(filePath);
|
|
275
|
+
result.totalOps += 1;
|
|
276
|
+
} else if (status === "unchanged") {
|
|
277
|
+
result.unchanged.push(filePath);
|
|
278
|
+
} else {
|
|
279
|
+
result.skipped.push(filePath);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
161
282
|
|
|
162
283
|
// src/scope-filter.ts
|
|
163
284
|
var GLOB_META = /[*?]/;
|
|
@@ -224,7 +345,7 @@ function isGeneratedFile(content) {
|
|
|
224
345
|
return content.includes(GENERATED_MARKER);
|
|
225
346
|
}
|
|
226
347
|
function isProtectedRoot(filePath, config) {
|
|
227
|
-
const relative =
|
|
348
|
+
const relative = path7.relative(config.workspaceRoot, filePath);
|
|
228
349
|
const isRootLevel = !relative.startsWith("packages/") && !relative.startsWith("tools/") && !relative.startsWith("apps/");
|
|
229
350
|
return isRootLevel && Array.from(protectedFiles).some(
|
|
230
351
|
(f) => relative.endsWith(f) || relative.includes(f)
|
|
@@ -232,12 +353,12 @@ function isProtectedRoot(filePath, config) {
|
|
|
232
353
|
}
|
|
233
354
|
function isInScope(filePath, config) {
|
|
234
355
|
if (!config.only || config.only.length === 0) return true;
|
|
235
|
-
const relativePath =
|
|
356
|
+
const relativePath = path7.relative(config.workspaceRoot, filePath);
|
|
236
357
|
return matchesScope(relativePath, config.only);
|
|
237
358
|
}
|
|
238
359
|
async function safeWriteFileAtomic(filePath, content, config, report, skipGeneratedCheck = false) {
|
|
239
360
|
const { dryRun, forceRoot, logger, workspaceRoot } = config;
|
|
240
|
-
const relativePath =
|
|
361
|
+
const relativePath = path7.relative(workspaceRoot, filePath);
|
|
241
362
|
if (!isInScope(filePath, config)) {
|
|
242
363
|
logger.debug(`skipped (outside --only) ${relativePath}`);
|
|
243
364
|
return "skipped";
|
|
@@ -246,7 +367,7 @@ async function safeWriteFileAtomic(filePath, content, config, report, skipGenera
|
|
|
246
367
|
let currentContent = "";
|
|
247
368
|
let currentHash = "";
|
|
248
369
|
try {
|
|
249
|
-
currentContent = await
|
|
370
|
+
currentContent = await fs5.readFile(filePath, "utf8");
|
|
250
371
|
currentHash = contentHash(currentContent);
|
|
251
372
|
exists = true;
|
|
252
373
|
} catch (e) {
|
|
@@ -276,20 +397,21 @@ async function safeWriteFileAtomic(filePath, content, config, report, skipGenera
|
|
|
276
397
|
logger.info(`[DRY-RUN] would ${action} ${relativePath}`);
|
|
277
398
|
return exists ? "updated" : "created";
|
|
278
399
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
const
|
|
282
|
-
|
|
400
|
+
config.journal?.recordWrite(filePath, exists ? currentContent : null);
|
|
401
|
+
await fs5.mkdir(path7.dirname(filePath), { recursive: true });
|
|
402
|
+
const tmpName = `.${path7.basename(filePath)}.${crypto.randomUUID()}.tmp`;
|
|
403
|
+
const tmpPath = path7.join(path7.dirname(filePath), tmpName);
|
|
404
|
+
await fs5.writeFile(tmpPath, content, { encoding: "utf8" });
|
|
283
405
|
try {
|
|
284
|
-
await
|
|
406
|
+
await fs5.rename(tmpPath, filePath);
|
|
285
407
|
const status = exists ? "updated" : "created";
|
|
286
408
|
logger.info(`${status} ${relativePath}`);
|
|
287
409
|
return status;
|
|
288
410
|
} catch (err3) {
|
|
289
411
|
if (err3 instanceof Error && "code" in err3 && err3.code === "EXDEV") {
|
|
290
412
|
try {
|
|
291
|
-
await
|
|
292
|
-
await
|
|
413
|
+
await fs5.copyFile(tmpPath, filePath);
|
|
414
|
+
await fs5.unlink(tmpPath);
|
|
293
415
|
const status = exists ? "updated" : "created";
|
|
294
416
|
logger.info(`${status} ${relativePath}`);
|
|
295
417
|
return status;
|
|
@@ -297,7 +419,7 @@ async function safeWriteFileAtomic(filePath, content, config, report, skipGenera
|
|
|
297
419
|
logger.warn(`EXDEV fallback failed for ${relativePath}: ${copyErr}`);
|
|
298
420
|
}
|
|
299
421
|
}
|
|
300
|
-
await
|
|
422
|
+
await fs5.unlink(tmpPath).catch(() => {
|
|
301
423
|
});
|
|
302
424
|
throw err3;
|
|
303
425
|
}
|
|
@@ -313,48 +435,45 @@ async function safeWriteFile(filePath, content, config, skipGeneratedCheck = fal
|
|
|
313
435
|
}
|
|
314
436
|
|
|
315
437
|
// src/generators/layer-folders.ts
|
|
316
|
-
|
|
317
|
-
async function loadYamlSafe(filePath) {
|
|
438
|
+
async function directoryExists(dirPath) {
|
|
318
439
|
try {
|
|
319
|
-
const
|
|
320
|
-
return
|
|
440
|
+
const stats = await fs5.stat(dirPath);
|
|
441
|
+
return stats.isDirectory();
|
|
321
442
|
} catch (e) {
|
|
322
443
|
if (e instanceof Error && "code" in e && e.code === "ENOENT") {
|
|
323
|
-
return
|
|
444
|
+
return false;
|
|
324
445
|
}
|
|
325
446
|
throw e;
|
|
326
447
|
}
|
|
327
448
|
}
|
|
328
|
-
async function
|
|
329
|
-
const
|
|
449
|
+
async function ensureDirectoryCounted(dirPath, config, result) {
|
|
450
|
+
const existed = await directoryExists(dirPath);
|
|
451
|
+
if (existed) return;
|
|
452
|
+
const relativePath = path7.relative(config.workspaceRoot, dirPath);
|
|
453
|
+
if (config.dryRun) {
|
|
454
|
+
config.logger.info(`[DRY-RUN] would create directory ${relativePath}`);
|
|
455
|
+
} else {
|
|
456
|
+
await fs5.mkdir(dirPath, { recursive: true });
|
|
457
|
+
config.logger.info(`created directory ${relativePath}`);
|
|
458
|
+
}
|
|
459
|
+
result.created.push(dirPath);
|
|
460
|
+
result.totalOps += 1;
|
|
461
|
+
}
|
|
462
|
+
async function loadYamlSafe(filePath) {
|
|
330
463
|
try {
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
if (entry.name === "index.ts" || entry.name.startsWith(".")) continue;
|
|
334
|
-
if (entry.isFile() && entry.name.endsWith(".ts")) {
|
|
335
|
-
const base = entry.name.replace(/\.ts$/, "");
|
|
336
|
-
exportLines.push(`export * from './${base}.js';`);
|
|
337
|
-
} else if (entry.isDirectory()) {
|
|
338
|
-
exportLines.push(`export * from './${entry.name}/index.js';`);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
464
|
+
const content = await fs5.readFile(filePath, "utf8");
|
|
465
|
+
return yaml3.load(content);
|
|
341
466
|
} catch (e) {
|
|
342
|
-
if (e instanceof Error && "code" in e && e.code === "ENOENT")
|
|
343
|
-
|
|
467
|
+
if (e instanceof Error && "code" in e && e.code === "ENOENT") {
|
|
468
|
+
return null;
|
|
344
469
|
}
|
|
470
|
+
throw e;
|
|
345
471
|
}
|
|
346
|
-
return exportLines.length > 0 ? `${GENERATED_MARKER2}
|
|
347
|
-
|
|
348
|
-
${exportLines.join("\n")}
|
|
349
|
-
` : `${GENERATED_MARKER2}
|
|
350
|
-
|
|
351
|
-
// No exports yet
|
|
352
|
-
`;
|
|
353
472
|
}
|
|
354
|
-
async function ensureLayerFolders(moduleDir, layers, config
|
|
473
|
+
async function ensureLayerFolders(moduleDir, layers, config) {
|
|
355
474
|
const result = createEmptyResult();
|
|
356
475
|
const { logger } = config;
|
|
357
|
-
const layerRulesPath =
|
|
476
|
+
const layerRulesPath = path7.join(
|
|
358
477
|
config.workspaceRoot,
|
|
359
478
|
".architecture",
|
|
360
479
|
"invariants",
|
|
@@ -365,64 +484,18 @@ async function ensureLayerFolders(moduleDir, layers, config, report) {
|
|
|
365
484
|
logger.warn("layer-rules.yaml not found — skipping layer rule enforcement");
|
|
366
485
|
}
|
|
367
486
|
for (const [, layerConfig] of Object.entries(layers)) {
|
|
368
|
-
const layerPath =
|
|
369
|
-
|
|
370
|
-
if (!isInScope(barrelPath, config)) {
|
|
487
|
+
const layerPath = path7.join(moduleDir, layerConfig.folder);
|
|
488
|
+
if (!isInScope(layerPath, config) && !isInScope(path7.join(layerPath, "index.ts"), config)) {
|
|
371
489
|
continue;
|
|
372
490
|
}
|
|
373
|
-
|
|
374
|
-
await fs3.mkdir(layerPath, { recursive: true });
|
|
375
|
-
result.created.push(layerPath);
|
|
376
|
-
result.totalOps += 1;
|
|
377
|
-
} catch (e) {
|
|
378
|
-
if (e instanceof Error && "code" in e && e.code === "EEXIST") {
|
|
379
|
-
result.skipped.push(layerPath);
|
|
380
|
-
} else {
|
|
381
|
-
throw e;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
const barrelContent = await generateBarrelContent(layerPath);
|
|
385
|
-
const barrelStatus = await safeWriteFileAtomic(
|
|
386
|
-
barrelPath,
|
|
387
|
-
barrelContent,
|
|
388
|
-
config,
|
|
389
|
-
report
|
|
390
|
-
);
|
|
391
|
-
if (barrelStatus === "created") result.created.push(barrelPath);
|
|
392
|
-
if (barrelStatus === "updated") result.updated.push(barrelPath);
|
|
393
|
-
if (barrelStatus === "skipped" || barrelStatus === "protected")
|
|
394
|
-
result.skipped.push(barrelPath);
|
|
395
|
-
result.totalOps += barrelStatus === "created" || barrelStatus === "updated" ? 1 : 0;
|
|
491
|
+
await ensureDirectoryCounted(layerPath, config, result);
|
|
396
492
|
const subfolders = layerConfig.subfolders ?? [];
|
|
397
493
|
for (const sub of subfolders) {
|
|
398
|
-
const subPath =
|
|
399
|
-
|
|
400
|
-
if (!isInScope(subBarrelPath, config)) {
|
|
494
|
+
const subPath = path7.join(layerPath, sub);
|
|
495
|
+
if (!isInScope(subPath, config) && !isInScope(path7.join(subPath, "index.ts"), config)) {
|
|
401
496
|
continue;
|
|
402
497
|
}
|
|
403
|
-
|
|
404
|
-
await fs3.mkdir(subPath, { recursive: true });
|
|
405
|
-
result.created.push(subPath);
|
|
406
|
-
result.totalOps += 1;
|
|
407
|
-
} catch (e) {
|
|
408
|
-
if (e instanceof Error && "code" in e && e.code === "EEXIST") {
|
|
409
|
-
result.skipped.push(subPath);
|
|
410
|
-
} else {
|
|
411
|
-
throw e;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
const subBarrelContent = await generateBarrelContent(subPath);
|
|
415
|
-
const subBarrelStatus = await safeWriteFileAtomic(
|
|
416
|
-
subBarrelPath,
|
|
417
|
-
subBarrelContent,
|
|
418
|
-
config,
|
|
419
|
-
report
|
|
420
|
-
);
|
|
421
|
-
if (subBarrelStatus === "created") result.created.push(subBarrelPath);
|
|
422
|
-
if (subBarrelStatus === "updated") result.updated.push(subBarrelPath);
|
|
423
|
-
if (subBarrelStatus === "skipped" || subBarrelStatus === "protected")
|
|
424
|
-
result.skipped.push(subBarrelPath);
|
|
425
|
-
result.totalOps += subBarrelStatus === "created" || subBarrelStatus === "updated" ? 1 : 0;
|
|
498
|
+
await ensureDirectoryCounted(subPath, config, result);
|
|
426
499
|
}
|
|
427
500
|
}
|
|
428
501
|
return result;
|
|
@@ -443,10 +516,10 @@ var BARREL_EXCLUSIONS = /* @__PURE__ */ new Set([
|
|
|
443
516
|
function isExcludedDirectory(name) {
|
|
444
517
|
return BARREL_EXCLUSIONS.has(name) || name.startsWith(".");
|
|
445
518
|
}
|
|
446
|
-
var
|
|
519
|
+
var GENERATED_MARKER2 = "// @generated by @hexagen/sync";
|
|
447
520
|
var LEGACY_GENERATED_MARKER = "— generated by sync.ts";
|
|
448
521
|
function isGeneratedFile2(content) {
|
|
449
|
-
return content.includes(
|
|
522
|
+
return content.includes(GENERATED_MARKER2) || content.includes(LEGACY_GENERATED_MARKER);
|
|
450
523
|
}
|
|
451
524
|
function contentHash2(content) {
|
|
452
525
|
return crypto.createHash("sha256").update(content).digest("hex");
|
|
@@ -454,18 +527,18 @@ function contentHash2(content) {
|
|
|
454
527
|
function detectCircularExports(exportGraph) {
|
|
455
528
|
const visited = /* @__PURE__ */ new Set();
|
|
456
529
|
const recursionStack = /* @__PURE__ */ new Set();
|
|
457
|
-
const
|
|
530
|
+
const path25 = [];
|
|
458
531
|
function dfs(node) {
|
|
459
532
|
if (recursionStack.has(node)) {
|
|
460
|
-
const cycleStart =
|
|
461
|
-
return [...
|
|
533
|
+
const cycleStart = path25.indexOf(node);
|
|
534
|
+
return [...path25.slice(cycleStart), node];
|
|
462
535
|
}
|
|
463
536
|
if (visited.has(node)) {
|
|
464
537
|
return null;
|
|
465
538
|
}
|
|
466
539
|
visited.add(node);
|
|
467
540
|
recursionStack.add(node);
|
|
468
|
-
|
|
541
|
+
path25.push(node);
|
|
469
542
|
const exports$1 = exportGraph.get(node) ?? [];
|
|
470
543
|
for (const exportPath of exports$1) {
|
|
471
544
|
const cycle = dfs(exportPath);
|
|
@@ -473,7 +546,7 @@ function detectCircularExports(exportGraph) {
|
|
|
473
546
|
return cycle;
|
|
474
547
|
}
|
|
475
548
|
}
|
|
476
|
-
|
|
549
|
+
path25.pop();
|
|
477
550
|
recursionStack.delete(node);
|
|
478
551
|
return null;
|
|
479
552
|
}
|
|
@@ -485,15 +558,15 @@ function detectCircularExports(exportGraph) {
|
|
|
485
558
|
}
|
|
486
559
|
return { hasCircular: false, cycle: null };
|
|
487
560
|
}
|
|
488
|
-
function
|
|
561
|
+
function generateBarrelContent(entries) {
|
|
489
562
|
if (entries.length === 0) {
|
|
490
563
|
return null;
|
|
491
564
|
}
|
|
492
565
|
const exportLines = entries.sort((a, b) => a.name.localeCompare(b.name)).map((entry) => {
|
|
493
|
-
const
|
|
494
|
-
return `export * from "${
|
|
566
|
+
const path25 = entry.isDirectory ? `./${entry.name}/index.js` : `./${entry.name}.js`;
|
|
567
|
+
return `export * from "${path25}";`;
|
|
495
568
|
});
|
|
496
|
-
return `${
|
|
569
|
+
return `${GENERATED_MARKER2}
|
|
497
570
|
|
|
498
571
|
${exportLines.join("\n")}
|
|
499
572
|
`;
|
|
@@ -513,16 +586,16 @@ var CircularExportError = class extends Error {
|
|
|
513
586
|
};
|
|
514
587
|
async function generateRecursiveBarrels(moduleDir, config, report) {
|
|
515
588
|
const result = createEmptyResult();
|
|
516
|
-
const srcDir =
|
|
589
|
+
const srcDir = path7.join(moduleDir, "src");
|
|
517
590
|
const layers = ["domain", "application", "infrastructure"];
|
|
518
591
|
const pendingWrites = [];
|
|
519
592
|
const preserved = [];
|
|
520
593
|
const exportGraph = /* @__PURE__ */ new Map();
|
|
521
594
|
const layersWithContent = [];
|
|
522
595
|
for (const layer of layers) {
|
|
523
|
-
const layerDir =
|
|
596
|
+
const layerDir = path7.join(srcDir, layer);
|
|
524
597
|
try {
|
|
525
|
-
await
|
|
598
|
+
await fs5.access(layerDir);
|
|
526
599
|
} catch {
|
|
527
600
|
continue;
|
|
528
601
|
}
|
|
@@ -536,9 +609,9 @@ async function generateRecursiveBarrels(moduleDir, config, report) {
|
|
|
536
609
|
if (layerExports.length > 0) layersWithContent.push(layer);
|
|
537
610
|
}
|
|
538
611
|
if (config.mode === "external" && layersWithContent.length > 0) {
|
|
539
|
-
const rootBarrelPath =
|
|
612
|
+
const rootBarrelPath = path7.join(srcDir, "index.ts");
|
|
540
613
|
if (await shouldGenerateBarrel(rootBarrelPath, preserved, config.logger)) {
|
|
541
|
-
const content =
|
|
614
|
+
const content = generateBarrelContent(
|
|
542
615
|
layersWithContent.map((name) => ({ name, isDirectory: true }))
|
|
543
616
|
);
|
|
544
617
|
const existing = await readFileIfExists(rootBarrelPath);
|
|
@@ -550,7 +623,7 @@ async function generateRecursiveBarrels(moduleDir, config, report) {
|
|
|
550
623
|
});
|
|
551
624
|
exportGraph.set(
|
|
552
625
|
rootBarrelPath,
|
|
553
|
-
layersWithContent.map((name) =>
|
|
626
|
+
layersWithContent.map((name) => path7.join(srcDir, name, "index.ts"))
|
|
554
627
|
);
|
|
555
628
|
}
|
|
556
629
|
}
|
|
@@ -561,9 +634,19 @@ async function generateRecursiveBarrels(moduleDir, config, report) {
|
|
|
561
634
|
}
|
|
562
635
|
for (const pending of pendingWrites) {
|
|
563
636
|
if (pending.content === "") {
|
|
637
|
+
if (config.dryRun) {
|
|
638
|
+
config.logger.info(
|
|
639
|
+
`[DRY-RUN] would delete empty barrel ${pending.filePath}`
|
|
640
|
+
);
|
|
641
|
+
result.deleted.push(pending.filePath);
|
|
642
|
+
result.totalOps++;
|
|
643
|
+
continue;
|
|
644
|
+
}
|
|
564
645
|
try {
|
|
565
|
-
await
|
|
566
|
-
|
|
646
|
+
const preContent = await fs5.readFile(pending.filePath, "utf8");
|
|
647
|
+
config.journal?.recordDelete(pending.filePath, preContent);
|
|
648
|
+
await fs5.unlink(pending.filePath);
|
|
649
|
+
result.deleted.push(pending.filePath);
|
|
567
650
|
result.totalOps++;
|
|
568
651
|
continue;
|
|
569
652
|
} catch (err3) {
|
|
@@ -579,15 +662,7 @@ async function generateRecursiveBarrels(moduleDir, config, report) {
|
|
|
579
662
|
config,
|
|
580
663
|
report
|
|
581
664
|
);
|
|
582
|
-
|
|
583
|
-
result.created.push(pending.filePath);
|
|
584
|
-
result.totalOps++;
|
|
585
|
-
} else if (status === "updated") {
|
|
586
|
-
result.updated.push(pending.filePath);
|
|
587
|
-
result.totalOps++;
|
|
588
|
-
} else if (status === "skipped" || status === "protected") {
|
|
589
|
-
result.skipped.push(pending.filePath);
|
|
590
|
-
}
|
|
665
|
+
recordWriteStatus(result, pending.filePath, status);
|
|
591
666
|
}
|
|
592
667
|
result.skipped.push(...preserved);
|
|
593
668
|
return result;
|
|
@@ -597,7 +672,7 @@ async function walkDirectory(dirPath, pendingWrites, preserved, exportGraph, con
|
|
|
597
672
|
const exportEntries = [];
|
|
598
673
|
let entries;
|
|
599
674
|
try {
|
|
600
|
-
entries = await
|
|
675
|
+
entries = await fs5.readdir(dirPath, { withFileTypes: true });
|
|
601
676
|
} catch {
|
|
602
677
|
return exportEntries;
|
|
603
678
|
}
|
|
@@ -614,7 +689,7 @@ async function walkDirectory(dirPath, pendingWrites, preserved, exportGraph, con
|
|
|
614
689
|
}
|
|
615
690
|
}
|
|
616
691
|
for (const dir of directories) {
|
|
617
|
-
const subDirPath =
|
|
692
|
+
const subDirPath = path7.join(dirPath, dir);
|
|
618
693
|
const subExports = await walkDirectory(
|
|
619
694
|
subDirPath,
|
|
620
695
|
pendingWrites,
|
|
@@ -622,7 +697,7 @@ async function walkDirectory(dirPath, pendingWrites, preserved, exportGraph, con
|
|
|
622
697
|
exportGraph,
|
|
623
698
|
config
|
|
624
699
|
);
|
|
625
|
-
const subBarrelPath =
|
|
700
|
+
const subBarrelPath = path7.join(subDirPath, "index.ts");
|
|
626
701
|
const isQueuedForDeletion = pendingWrites.some(
|
|
627
702
|
(p) => p.filePath === subBarrelPath && p.content === ""
|
|
628
703
|
);
|
|
@@ -634,9 +709,9 @@ async function walkDirectory(dirPath, pendingWrites, preserved, exportGraph, con
|
|
|
634
709
|
exportEntries.push({ name: file, isDirectory: false });
|
|
635
710
|
}
|
|
636
711
|
if (exportEntries.length === 0) {
|
|
637
|
-
const barrelPath2 =
|
|
712
|
+
const barrelPath2 = path7.join(dirPath, "index.ts");
|
|
638
713
|
const existingBarrel = await readFileIfExists(barrelPath2);
|
|
639
|
-
const dirName =
|
|
714
|
+
const dirName = path7.basename(dirPath);
|
|
640
715
|
const isLayerDir = ["domain", "application", "infrastructure"].includes(
|
|
641
716
|
dirName
|
|
642
717
|
);
|
|
@@ -651,7 +726,7 @@ async function walkDirectory(dirPath, pendingWrites, preserved, exportGraph, con
|
|
|
651
726
|
isNew: false
|
|
652
727
|
});
|
|
653
728
|
} else if (isEmptyStub && isLayerDir) {
|
|
654
|
-
const newContent = `${
|
|
729
|
+
const newContent = `${GENERATED_MARKER2}
|
|
655
730
|
|
|
656
731
|
export {};
|
|
657
732
|
`;
|
|
@@ -663,7 +738,7 @@ export {};
|
|
|
663
738
|
});
|
|
664
739
|
}
|
|
665
740
|
} else if (!existingBarrel.includes("export {}") && isLayerDir) {
|
|
666
|
-
const newContent = `${
|
|
741
|
+
const newContent = `${GENERATED_MARKER2}
|
|
667
742
|
|
|
668
743
|
export {};
|
|
669
744
|
`;
|
|
@@ -674,7 +749,7 @@ export {};
|
|
|
674
749
|
});
|
|
675
750
|
}
|
|
676
751
|
} else if (isLayerDir) {
|
|
677
|
-
const newContent = `${
|
|
752
|
+
const newContent = `${GENERATED_MARKER2}
|
|
678
753
|
|
|
679
754
|
export {};
|
|
680
755
|
`;
|
|
@@ -686,14 +761,14 @@ export {};
|
|
|
686
761
|
}
|
|
687
762
|
return [];
|
|
688
763
|
}
|
|
689
|
-
const barrelPath =
|
|
764
|
+
const barrelPath = path7.join(dirPath, "index.ts");
|
|
690
765
|
const shouldCreateBarrel = await shouldGenerateBarrel(
|
|
691
766
|
barrelPath,
|
|
692
767
|
preserved,
|
|
693
768
|
logger
|
|
694
769
|
);
|
|
695
770
|
if (shouldCreateBarrel) {
|
|
696
|
-
const content =
|
|
771
|
+
const content = generateBarrelContent(exportEntries);
|
|
697
772
|
if (content === null) {
|
|
698
773
|
return [];
|
|
699
774
|
}
|
|
@@ -706,14 +781,14 @@ export {};
|
|
|
706
781
|
content,
|
|
707
782
|
isNew: !existingContent
|
|
708
783
|
});
|
|
709
|
-
const exportPaths = exportEntries.filter((e) => e.isDirectory).map((e) =>
|
|
784
|
+
const exportPaths = exportEntries.filter((e) => e.isDirectory).map((e) => path7.join(dirPath, e.name, "index.ts"));
|
|
710
785
|
exportGraph.set(barrelPath, exportPaths);
|
|
711
786
|
}
|
|
712
787
|
return exportEntries;
|
|
713
788
|
}
|
|
714
789
|
async function hasBarrel(dirPath) {
|
|
715
790
|
try {
|
|
716
|
-
await
|
|
791
|
+
await fs5.access(path7.join(dirPath, "index.ts"));
|
|
717
792
|
return true;
|
|
718
793
|
} catch {
|
|
719
794
|
return false;
|
|
@@ -733,7 +808,7 @@ async function shouldGenerateBarrel(barrelPath, preserved, logger) {
|
|
|
733
808
|
}
|
|
734
809
|
async function readFileIfExists(filePath) {
|
|
735
810
|
try {
|
|
736
|
-
return await
|
|
811
|
+
return await fs5.readFile(filePath, "utf8");
|
|
737
812
|
} catch (err3) {
|
|
738
813
|
if (err3 && typeof err3 === "object" && "code" in err3 && err3.code === "ENOENT") {
|
|
739
814
|
return null;
|
|
@@ -778,7 +853,12 @@ async function generatePackageJson(modulePath, moduleName, config, report) {
|
|
|
778
853
|
const moduleOverrides = context?.packageJson ?? {};
|
|
779
854
|
const scope = config.manifest ? resolveScope(config.manifest) : "generated-project";
|
|
780
855
|
const dependsOnDeps = context ? expandDependsOn(context, scope) : {};
|
|
781
|
-
const pkgPath =
|
|
856
|
+
const pkgPath = path7.join(modulePath, "package.json");
|
|
857
|
+
const dependencies = {
|
|
858
|
+
...dependsOnDeps,
|
|
859
|
+
...defaults.dependencies ?? {},
|
|
860
|
+
...moduleOverrides.dependencies ?? {}
|
|
861
|
+
};
|
|
782
862
|
const desiredPkg = {
|
|
783
863
|
name: `@${scope}/${moduleName}`,
|
|
784
864
|
version: "0.1.0",
|
|
@@ -799,11 +879,17 @@ async function generatePackageJson(modulePath, moduleName, config, report) {
|
|
|
799
879
|
...defaults.scripts ?? {},
|
|
800
880
|
...moduleOverrides.scripts ?? {}
|
|
801
881
|
},
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
882
|
+
// Emitted only when non-empty (PR-B2, capstone 6f): Yarn 4 deletes an
|
|
883
|
+
// empty `"dependencies": {}` from workspace manifests during install, so
|
|
884
|
+
// emitting one creates a permanent install↔sync churn loop — install
|
|
885
|
+
// strips the key, the next sync re-injects it (`dependencies` is
|
|
886
|
+
// protected, but a protected key MISSING from the current file is
|
|
887
|
+
// re-added), and the tree never converges across the consumer's
|
|
888
|
+
// sync → install → sync workflow. A dependency-less package carries no
|
|
889
|
+
// block at all, matching yarn's normalized form. Existing trees that
|
|
890
|
+
// still carry `{}` on disk stay untouched via the protected-key merge.
|
|
891
|
+
// devDependencies/scripts can't go empty (both have built-in entries).
|
|
892
|
+
...Object.keys(dependencies).length > 0 ? { dependencies } : {},
|
|
807
893
|
devDependencies: {
|
|
808
894
|
typescript: "^5.0.0",
|
|
809
895
|
...defaults.devDependencies ?? {},
|
|
@@ -812,7 +898,7 @@ async function generatePackageJson(modulePath, moduleName, config, report) {
|
|
|
812
898
|
};
|
|
813
899
|
let currentPkg = {};
|
|
814
900
|
try {
|
|
815
|
-
const currentContent = await
|
|
901
|
+
const currentContent = await fs5.readFile(pkgPath, "utf8");
|
|
816
902
|
currentPkg = JSON.parse(currentContent);
|
|
817
903
|
} catch (e) {
|
|
818
904
|
if (!(e instanceof Error && "code" in e && e.code === "ENOENT")) {
|
|
@@ -852,11 +938,7 @@ async function generatePackageJson(modulePath, moduleName, config, report) {
|
|
|
852
938
|
report,
|
|
853
939
|
true
|
|
854
940
|
);
|
|
855
|
-
|
|
856
|
-
if (status === "updated") result.updated.push(pkgPath);
|
|
857
|
-
if (status === "skipped" || status === "protected")
|
|
858
|
-
result.skipped.push(pkgPath);
|
|
859
|
-
result.totalOps += status === "created" || status === "updated" ? 1 : 0;
|
|
941
|
+
recordWriteStatus(result, pkgPath, status);
|
|
860
942
|
return result;
|
|
861
943
|
}
|
|
862
944
|
var BUILTIN_FALLBACK_TEMPLATE = {
|
|
@@ -926,7 +1008,7 @@ function buildTemplate(base, context, scope) {
|
|
|
926
1008
|
}
|
|
927
1009
|
async function generateTsconfig(moduleDir, moduleName, config, report) {
|
|
928
1010
|
const result = createEmptyResult();
|
|
929
|
-
const filePath =
|
|
1011
|
+
const filePath = path7.join(moduleDir, "tsconfig.json");
|
|
930
1012
|
try {
|
|
931
1013
|
const base = resolveWorkspaceTemplate(config.manifest);
|
|
932
1014
|
const context = config.manifest.bounded_contexts?.find(
|
|
@@ -941,16 +1023,14 @@ async function generateTsconfig(moduleDir, moduleName, config, report) {
|
|
|
941
1023
|
config,
|
|
942
1024
|
report
|
|
943
1025
|
);
|
|
944
|
-
|
|
945
|
-
if (status === "updated") result.updated.push(filePath);
|
|
946
|
-
if (status === "skipped" || status === "protected")
|
|
947
|
-
result.skipped.push(filePath);
|
|
948
|
-
result.totalOps += status === "created" || status === "updated" ? 1 : 0;
|
|
1026
|
+
recordWriteStatus(result, filePath, status);
|
|
949
1027
|
return result;
|
|
950
1028
|
} catch (err3) {
|
|
951
1029
|
const message = err3 instanceof Error ? err3.message : String(err3);
|
|
952
1030
|
result.error = err3 instanceof Error ? err3 : new Error(`tsconfig generation failed for ${moduleName}: ${message}`);
|
|
953
1031
|
result.summary = `tsconfig generation failed for ${moduleName}: ${message}`;
|
|
1032
|
+
config.logger.error(result.summary);
|
|
1033
|
+
if (report) report.record("error", filePath, result.summary);
|
|
954
1034
|
return result;
|
|
955
1035
|
}
|
|
956
1036
|
}
|
|
@@ -958,15 +1038,15 @@ async function reapLegacyFolders(moduleDir, config, report) {
|
|
|
958
1038
|
const { dryRun, logger } = config;
|
|
959
1039
|
const legacyLayers = ["domain", "application", "infrastructure"];
|
|
960
1040
|
for (const layer of legacyLayers) {
|
|
961
|
-
const layerPath =
|
|
962
|
-
const relativePath =
|
|
1041
|
+
const layerPath = path7.join(moduleDir, layer);
|
|
1042
|
+
const relativePath = path7.relative(config.workspaceRoot, layerPath);
|
|
963
1043
|
try {
|
|
964
|
-
const entries = await
|
|
1044
|
+
const entries = await fs5.readdir(layerPath);
|
|
965
1045
|
if (entries.length === 0) {
|
|
966
1046
|
if (dryRun) {
|
|
967
1047
|
logger.info(`[DRY-RUN] would delete empty folder ${relativePath}`);
|
|
968
1048
|
} else {
|
|
969
|
-
await
|
|
1049
|
+
await fs5.rmdir(layerPath);
|
|
970
1050
|
logger.info(`deleted empty folder ${relativePath}`);
|
|
971
1051
|
if (report) report.record("deleted", layerPath);
|
|
972
1052
|
}
|
|
@@ -1456,8 +1536,8 @@ function getErrorMap() {
|
|
|
1456
1536
|
|
|
1457
1537
|
// ../../node_modules/zod/v3/helpers/parseUtil.js
|
|
1458
1538
|
var makeIssue = (params) => {
|
|
1459
|
-
const { data, path:
|
|
1460
|
-
const fullPath = [...
|
|
1539
|
+
const { data, path: path25, errorMaps, issueData } = params;
|
|
1540
|
+
const fullPath = [...path25, ...issueData.path || []];
|
|
1461
1541
|
const fullIssue = {
|
|
1462
1542
|
...issueData,
|
|
1463
1543
|
path: fullPath
|
|
@@ -1573,11 +1653,11 @@ var errorUtil;
|
|
|
1573
1653
|
|
|
1574
1654
|
// ../../node_modules/zod/v3/types.js
|
|
1575
1655
|
var ParseInputLazyPath = class {
|
|
1576
|
-
constructor(parent, value,
|
|
1656
|
+
constructor(parent, value, path25, key) {
|
|
1577
1657
|
this._cachedPath = [];
|
|
1578
1658
|
this.parent = parent;
|
|
1579
1659
|
this.data = value;
|
|
1580
|
-
this._path =
|
|
1660
|
+
this._path = path25;
|
|
1581
1661
|
this._key = key;
|
|
1582
1662
|
}
|
|
1583
1663
|
get path() {
|
|
@@ -5088,6 +5168,7 @@ var BUILTIN_PACKAGE_JSON_TEMPLATE = `{
|
|
|
5088
5168
|
"sync": "hexagen sync",
|
|
5089
5169
|
"sync:dry": "hexagen sync --dry-run",
|
|
5090
5170
|
"sync:force": "hexagen sync --force",
|
|
5171
|
+
"sync:check": "hexagen sync --check",
|
|
5091
5172
|
"lint:arch": "hexagen arch validate",
|
|
5092
5173
|
"templates:add": "hexagen add",
|
|
5093
5174
|
"templates:validate": "hexagen validate-templates",
|
|
@@ -5098,8 +5179,8 @@ var BUILTIN_PACKAGE_JSON_TEMPLATE = `{
|
|
|
5098
5179
|
"typescript": "^5.5.4",
|
|
5099
5180
|
"eslint": "^9.0.0",
|
|
5100
5181
|
"prettier": "^3.0.0",
|
|
5101
|
-
"@hexagen-monaco/sync": "^
|
|
5102
|
-
"@hexagen-monaco/arch-linter": "^
|
|
5182
|
+
"@hexagen-monaco/sync": "^{toolchainVersion}",
|
|
5183
|
+
"@hexagen-monaco/arch-linter": "^{toolchainVersion}"
|
|
5103
5184
|
}
|
|
5104
5185
|
}`;
|
|
5105
5186
|
var BUILTIN_TSCONFIG_BASE_TEMPLATE = `{
|
|
@@ -5211,15 +5292,33 @@ adding \`--immutable\` to the \`yarn install\` step in
|
|
|
5211
5292
|
Its pre-lockfile guidance goes stale once \`yarn.lock\` is committed. (Run
|
|
5212
5293
|
\`hexagen sync\` won't bring it back — it's a protected root file.)
|
|
5213
5294
|
`;
|
|
5295
|
+
var SEMVER_2_0_0 = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
5296
|
+
function assertValidToolchainVersion(version, source) {
|
|
5297
|
+
const invalid = !SEMVER_2_0_0.test(version) || /^0\.0\.0(?:$|[-+])/.test(version);
|
|
5298
|
+
if (invalid) {
|
|
5299
|
+
throw new Error(
|
|
5300
|
+
`Toolchain version unavailable, malformed, or degenerate (${source} → ${JSON.stringify(version)}). Refusing to continue: the scaffold would pin @hexagen-monaco/* devDependencies to a version that does not exist (RCA #1 — never emit a degenerate pin).`
|
|
5301
|
+
);
|
|
5302
|
+
}
|
|
5303
|
+
return version;
|
|
5304
|
+
}
|
|
5305
|
+
function resolveToolchainVersion() {
|
|
5306
|
+
{
|
|
5307
|
+
return assertValidToolchainVersion(
|
|
5308
|
+
"0.7.0",
|
|
5309
|
+
"build-injected __HEXAGEN_TOOLCHAIN_VERSION__"
|
|
5310
|
+
);
|
|
5311
|
+
}
|
|
5312
|
+
}
|
|
5214
5313
|
|
|
5215
5314
|
// src/generators/root-files.ts
|
|
5216
|
-
function buildVars(manifest) {
|
|
5315
|
+
function buildVars(manifest, toolchainVersion) {
|
|
5217
5316
|
const system = typeof manifest.system === "string" && manifest.system.length > 0 ? manifest.system : "generated-project";
|
|
5218
5317
|
const scope = resolveScope(manifest);
|
|
5219
5318
|
const packageManager = typeof manifest.monorepo?.packageManager === "string" && manifest.monorepo.packageManager.length > 0 ? manifest.monorepo.packageManager : "yarn@4.12.0";
|
|
5220
5319
|
const workspacesArray = Array.isArray(manifest.monorepo?.workspaces) && manifest.monorepo.workspaces.length > 0 ? manifest.monorepo.workspaces : ["apps/*", "packages/*"];
|
|
5221
5320
|
const workspaces = "[\n" + workspacesArray.map((w) => ` ${JSON.stringify(w)}`).join(",\n") + "\n ]";
|
|
5222
|
-
return { system, scope, packageManager, workspaces };
|
|
5321
|
+
return { system, scope, packageManager, workspaces, toolchainVersion };
|
|
5223
5322
|
}
|
|
5224
5323
|
function resolveTemplate(manifestTemplate, builtin) {
|
|
5225
5324
|
if (typeof manifestTemplate === "string" && manifestTemplate.length > 0) {
|
|
@@ -5245,17 +5344,14 @@ async function writeRootFile(filePath, content, config, report, result) {
|
|
|
5245
5344
|
report,
|
|
5246
5345
|
true
|
|
5247
5346
|
);
|
|
5248
|
-
|
|
5249
|
-
if (status === "updated") result.updated.push(filePath);
|
|
5250
|
-
if (status === "skipped" || status === "protected")
|
|
5251
|
-
result.skipped.push(filePath);
|
|
5252
|
-
if (status === "created" || status === "updated") result.totalOps += 1;
|
|
5347
|
+
recordWriteStatus(result, filePath, status);
|
|
5253
5348
|
}
|
|
5254
5349
|
async function generateRootFiles(config, report) {
|
|
5255
5350
|
const result = createEmptyResult();
|
|
5351
|
+
const toolchainVersion = resolveToolchainVersion();
|
|
5256
5352
|
try {
|
|
5257
5353
|
const rootFiles = config.manifest.monorepo?.rootFiles;
|
|
5258
|
-
const vars = buildVars(config.manifest);
|
|
5354
|
+
const vars = buildVars(config.manifest, toolchainVersion);
|
|
5259
5355
|
const packageJsonTemplate = resolveTemplate(
|
|
5260
5356
|
rootFiles?.packageJson?.template,
|
|
5261
5357
|
BUILTIN_PACKAGE_JSON_TEMPLATE
|
|
@@ -5267,7 +5363,7 @@ async function generateRootFiles(config, report) {
|
|
|
5267
5363
|
"package.json"
|
|
5268
5364
|
);
|
|
5269
5365
|
await writeRootFile(
|
|
5270
|
-
|
|
5366
|
+
path7.join(config.workspaceRoot, "package.json"),
|
|
5271
5367
|
packageJsonContent,
|
|
5272
5368
|
config,
|
|
5273
5369
|
report,
|
|
@@ -5284,7 +5380,7 @@ async function generateRootFiles(config, report) {
|
|
|
5284
5380
|
"tsconfig.base.json"
|
|
5285
5381
|
);
|
|
5286
5382
|
await writeRootFile(
|
|
5287
|
-
|
|
5383
|
+
path7.join(config.workspaceRoot, "tsconfig.base.json"),
|
|
5288
5384
|
tsconfigContent,
|
|
5289
5385
|
config,
|
|
5290
5386
|
report,
|
|
@@ -5301,7 +5397,7 @@ async function generateRootFiles(config, report) {
|
|
|
5301
5397
|
"turbo.json"
|
|
5302
5398
|
);
|
|
5303
5399
|
await writeRootFile(
|
|
5304
|
-
|
|
5400
|
+
path7.join(config.workspaceRoot, "turbo.json"),
|
|
5305
5401
|
turboContent,
|
|
5306
5402
|
config,
|
|
5307
5403
|
report,
|
|
@@ -5312,7 +5408,7 @@ async function generateRootFiles(config, report) {
|
|
|
5312
5408
|
BUILTIN_GITIGNORE_TEMPLATE
|
|
5313
5409
|
);
|
|
5314
5410
|
await writeRootFile(
|
|
5315
|
-
|
|
5411
|
+
path7.join(config.workspaceRoot, ".gitignore"),
|
|
5316
5412
|
interpolateAndWarn(gitignoreTemplate, vars, config, ".gitignore"),
|
|
5317
5413
|
config,
|
|
5318
5414
|
report,
|
|
@@ -5323,7 +5419,7 @@ async function generateRootFiles(config, report) {
|
|
|
5323
5419
|
BUILTIN_YARNRC_TEMPLATE
|
|
5324
5420
|
);
|
|
5325
5421
|
await writeRootFile(
|
|
5326
|
-
|
|
5422
|
+
path7.join(config.workspaceRoot, ".yarnrc.yml"),
|
|
5327
5423
|
interpolateAndWarn(yarnrcTemplate, vars, config, ".yarnrc.yml"),
|
|
5328
5424
|
config,
|
|
5329
5425
|
report,
|
|
@@ -5334,7 +5430,7 @@ async function generateRootFiles(config, report) {
|
|
|
5334
5430
|
BUILTIN_SETUP_MD_TEMPLATE
|
|
5335
5431
|
);
|
|
5336
5432
|
await writeRootFile(
|
|
5337
|
-
|
|
5433
|
+
path7.join(config.workspaceRoot, "SETUP.md"),
|
|
5338
5434
|
interpolateAndWarn(setupTemplate, vars, config, "SETUP.md"),
|
|
5339
5435
|
config,
|
|
5340
5436
|
report,
|
|
@@ -5345,6 +5441,8 @@ async function generateRootFiles(config, report) {
|
|
|
5345
5441
|
const message = err3 instanceof Error ? err3.message : String(err3);
|
|
5346
5442
|
result.error = err3 instanceof Error ? err3 : new Error(`root-files generation failed: ${message}`);
|
|
5347
5443
|
result.summary = `root-files generation failed: ${message}`;
|
|
5444
|
+
config.logger.error(result.summary);
|
|
5445
|
+
if (report) report.record("error", "root-files", result.summary);
|
|
5348
5446
|
return result;
|
|
5349
5447
|
}
|
|
5350
5448
|
}
|
|
@@ -5560,20 +5658,13 @@ function interpolateWithLogging(label, template, vars, config) {
|
|
|
5560
5658
|
}
|
|
5561
5659
|
return output;
|
|
5562
5660
|
}
|
|
5563
|
-
function recordStatus(result, filePath, status) {
|
|
5564
|
-
if (status === "created") result.created.push(filePath);
|
|
5565
|
-
else if (status === "updated") result.updated.push(filePath);
|
|
5566
|
-
else if (status === "skipped" || status === "protected")
|
|
5567
|
-
result.skipped.push(filePath);
|
|
5568
|
-
if (status === "created" || status === "updated") result.totalOps += 1;
|
|
5569
|
-
}
|
|
5570
5661
|
async function writeManifestIfFreshExternal(config, result, report) {
|
|
5571
5662
|
if (config.mode !== "external") {
|
|
5572
5663
|
return;
|
|
5573
5664
|
}
|
|
5574
|
-
const archDir =
|
|
5575
|
-
const manifestPath =
|
|
5576
|
-
const relative =
|
|
5665
|
+
const archDir = path7.join(config.workspaceRoot, ".architecture");
|
|
5666
|
+
const manifestPath = path7.join(archDir, "manifest.yaml");
|
|
5667
|
+
const relative = path7.relative(config.workspaceRoot, manifestPath);
|
|
5577
5668
|
if (!isInScope(manifestPath, config)) {
|
|
5578
5669
|
config.logger.debug(`skipped (outside --only) ${relative}`);
|
|
5579
5670
|
result.skipped.push(manifestPath);
|
|
@@ -5581,7 +5672,7 @@ async function writeManifestIfFreshExternal(config, result, report) {
|
|
|
5581
5672
|
}
|
|
5582
5673
|
let exists = false;
|
|
5583
5674
|
try {
|
|
5584
|
-
await
|
|
5675
|
+
await fs5.access(manifestPath);
|
|
5585
5676
|
exists = true;
|
|
5586
5677
|
} catch {
|
|
5587
5678
|
exists = false;
|
|
@@ -5600,8 +5691,9 @@ async function writeManifestIfFreshExternal(config, result, report) {
|
|
|
5600
5691
|
return;
|
|
5601
5692
|
}
|
|
5602
5693
|
const content = yaml3.dump(config.manifest);
|
|
5603
|
-
|
|
5604
|
-
await
|
|
5694
|
+
config.journal?.recordWrite(manifestPath, null);
|
|
5695
|
+
await fs5.mkdir(archDir, { recursive: true });
|
|
5696
|
+
await fs5.writeFile(manifestPath, content, { encoding: "utf8" });
|
|
5605
5697
|
config.logger.info(`created ${relative}`);
|
|
5606
5698
|
if (report)
|
|
5607
5699
|
report.record(
|
|
@@ -5615,12 +5707,12 @@ async function writeManifestIfFreshExternal(config, result, report) {
|
|
|
5615
5707
|
async function generateArchitectureFiles(config, report) {
|
|
5616
5708
|
const result = createEmptyResult();
|
|
5617
5709
|
const manifest = config.manifest;
|
|
5618
|
-
const archRoot =
|
|
5710
|
+
const archRoot = path7.join(config.workspaceRoot, ".architecture");
|
|
5619
5711
|
const archInvariants = manifest.monorepo?.archInvariants;
|
|
5620
5712
|
const vars = buildInterpolationVars(manifest);
|
|
5621
5713
|
const workspaceTemplate = vars.workspaceTemplate ?? "modular-monolith";
|
|
5622
5714
|
await writeManifestIfFreshExternal(config, result, report);
|
|
5623
|
-
const layerRulesPath =
|
|
5715
|
+
const layerRulesPath = path7.join(archRoot, "invariants", "layer-rules.yaml");
|
|
5624
5716
|
const layerRulesTemplate = resolveTemplate2(
|
|
5625
5717
|
archInvariants?.layerRules,
|
|
5626
5718
|
builtInLayerRules(workspaceTemplate)
|
|
@@ -5638,8 +5730,8 @@ async function generateArchitectureFiles(config, report) {
|
|
|
5638
5730
|
report,
|
|
5639
5731
|
true
|
|
5640
5732
|
);
|
|
5641
|
-
|
|
5642
|
-
const linterConfigPath =
|
|
5733
|
+
recordWriteStatus(result, layerRulesPath, layerRulesStatus);
|
|
5734
|
+
const linterConfigPath = path7.join(
|
|
5643
5735
|
archRoot,
|
|
5644
5736
|
"invariants",
|
|
5645
5737
|
"linter-config.yaml"
|
|
@@ -5661,8 +5753,8 @@ async function generateArchitectureFiles(config, report) {
|
|
|
5661
5753
|
report,
|
|
5662
5754
|
true
|
|
5663
5755
|
);
|
|
5664
|
-
|
|
5665
|
-
const generatorConfigPath =
|
|
5756
|
+
recordWriteStatus(result, linterConfigPath, linterConfigStatus);
|
|
5757
|
+
const generatorConfigPath = path7.join(archRoot, "generator.config.yaml");
|
|
5666
5758
|
const generatorConfigTemplate = resolveTemplate2(
|
|
5667
5759
|
archInvariants?.generatorConfig,
|
|
5668
5760
|
GENERATOR_CONFIG_TEMPLATE
|
|
@@ -5680,7 +5772,7 @@ async function generateArchitectureFiles(config, report) {
|
|
|
5680
5772
|
report,
|
|
5681
5773
|
true
|
|
5682
5774
|
);
|
|
5683
|
-
|
|
5775
|
+
recordWriteStatus(result, generatorConfigPath, generatorConfigStatus);
|
|
5684
5776
|
return result;
|
|
5685
5777
|
}
|
|
5686
5778
|
|
|
@@ -5784,7 +5876,6 @@ var PLAIN_TS_PACKAGE_JSON_TEMPLATE = `{
|
|
|
5784
5876
|
"lint": "eslint src --ext .ts,.tsx",
|
|
5785
5877
|
"typecheck": "tsc --noEmit"
|
|
5786
5878
|
},
|
|
5787
|
-
"dependencies": {},
|
|
5788
5879
|
"devDependencies": {
|
|
5789
5880
|
"typescript": "^5.5.4",
|
|
5790
5881
|
"eslint": "^9.0.0",
|
|
@@ -5931,7 +6022,7 @@ ${content}`;
|
|
|
5931
6022
|
}
|
|
5932
6023
|
async function generateEslintConfig(moduleDir, moduleName, config, report, options = {}) {
|
|
5933
6024
|
const result = createEmptyResult();
|
|
5934
|
-
const filePath =
|
|
6025
|
+
const filePath = path7.join(moduleDir, "eslint.config.js");
|
|
5935
6026
|
try {
|
|
5936
6027
|
const { template, source } = resolveTemplate3(
|
|
5937
6028
|
config.manifest,
|
|
@@ -5964,11 +6055,7 @@ async function generateEslintConfig(moduleDir, moduleName, config, report, optio
|
|
|
5964
6055
|
report,
|
|
5965
6056
|
false
|
|
5966
6057
|
);
|
|
5967
|
-
|
|
5968
|
-
if (status === "updated") result.updated.push(filePath);
|
|
5969
|
-
if (status === "skipped" || status === "protected")
|
|
5970
|
-
result.skipped.push(filePath);
|
|
5971
|
-
result.totalOps += status === "created" || status === "updated" ? 1 : 0;
|
|
6058
|
+
recordWriteStatus(result, filePath, status);
|
|
5972
6059
|
return result;
|
|
5973
6060
|
} catch (err3) {
|
|
5974
6061
|
const message = err3 instanceof Error ? err3.message : String(err3);
|
|
@@ -6003,21 +6090,12 @@ function interpolateWithLogging2(template, vars, context, config) {
|
|
|
6003
6090
|
}
|
|
6004
6091
|
return output;
|
|
6005
6092
|
}
|
|
6006
|
-
function recordStatus2(result, filePath, status) {
|
|
6007
|
-
if (status === "created") {
|
|
6008
|
-
result.created.push(filePath);
|
|
6009
|
-
result.totalOps += 1;
|
|
6010
|
-
} else if (status === "updated") {
|
|
6011
|
-
result.updated.push(filePath);
|
|
6012
|
-
result.totalOps += 1;
|
|
6013
|
-
} else {
|
|
6014
|
-
result.skipped.push(filePath);
|
|
6015
|
-
}
|
|
6016
|
-
}
|
|
6017
6093
|
function mergeResult(result, sub) {
|
|
6018
6094
|
result.created.push(...sub.created);
|
|
6019
6095
|
result.updated.push(...sub.updated);
|
|
6020
6096
|
result.skipped.push(...sub.skipped);
|
|
6097
|
+
result.deleted.push(...sub.deleted);
|
|
6098
|
+
result.unchanged.push(...sub.unchanged);
|
|
6021
6099
|
result.totalOps += sub.totalOps;
|
|
6022
6100
|
if (sub.error && !result.error) {
|
|
6023
6101
|
result.error = sub.error;
|
|
@@ -6031,9 +6109,9 @@ async function emitAppFile(appDir, relPath, template, vars, config, report, resu
|
|
|
6031
6109
|
`apps/${appName}/${relPath}`,
|
|
6032
6110
|
config
|
|
6033
6111
|
);
|
|
6034
|
-
const target =
|
|
6035
|
-
const relative =
|
|
6036
|
-
if (relative === "" || relative.startsWith("..") ||
|
|
6112
|
+
const target = path7.resolve(appDir, relPath);
|
|
6113
|
+
const relative = path7.relative(appDir, target);
|
|
6114
|
+
if (relative === "" || relative.startsWith("..") || path7.isAbsolute(relative)) {
|
|
6037
6115
|
config.logger.warn(
|
|
6038
6116
|
`[apps] skipping file with unsafe path (escapes apps/${appName}): ${relPath}`
|
|
6039
6117
|
);
|
|
@@ -6046,9 +6124,9 @@ async function emitAppFile(appDir, relPath, template, vars, config, report, resu
|
|
|
6046
6124
|
}
|
|
6047
6125
|
return "unsafe";
|
|
6048
6126
|
}
|
|
6049
|
-
if (isInScope(target, config)) {
|
|
6127
|
+
if (!config.dryRun && isInScope(target, config)) {
|
|
6050
6128
|
try {
|
|
6051
|
-
await
|
|
6129
|
+
await fs5.mkdir(path7.dirname(target), { recursive: true });
|
|
6052
6130
|
} catch (err3) {
|
|
6053
6131
|
const message = err3 instanceof Error ? err3.message : String(err3);
|
|
6054
6132
|
config.logger.error(
|
|
@@ -6058,7 +6136,7 @@ async function emitAppFile(appDir, relPath, template, vars, config, report, resu
|
|
|
6058
6136
|
return "error";
|
|
6059
6137
|
}
|
|
6060
6138
|
}
|
|
6061
|
-
|
|
6139
|
+
recordWriteStatus(
|
|
6062
6140
|
result,
|
|
6063
6141
|
target,
|
|
6064
6142
|
await safeWriteFileAtomic(target, content, config, report)
|
|
@@ -6139,12 +6217,12 @@ async function generateApps(config, report) {
|
|
|
6139
6217
|
version: app.version ?? "",
|
|
6140
6218
|
depends_on: (app.depends_on ?? []).join(", ")
|
|
6141
6219
|
};
|
|
6142
|
-
const appDir =
|
|
6143
|
-
const srcDir =
|
|
6144
|
-
if (isInScope(appDir, config)) {
|
|
6220
|
+
const appDir = path7.join(config.workspaceRoot, "apps", app.name);
|
|
6221
|
+
const srcDir = path7.join(appDir, "src");
|
|
6222
|
+
if (!config.dryRun && isInScope(appDir, config)) {
|
|
6145
6223
|
try {
|
|
6146
|
-
await
|
|
6147
|
-
await
|
|
6224
|
+
await fs5.mkdir(appDir, { recursive: true });
|
|
6225
|
+
await fs5.mkdir(srcDir, { recursive: true });
|
|
6148
6226
|
} catch (err3) {
|
|
6149
6227
|
const message = err3 instanceof Error ? err3.message : String(err3);
|
|
6150
6228
|
config.logger.error(
|
|
@@ -6162,14 +6240,14 @@ async function generateApps(config, report) {
|
|
|
6162
6240
|
`apps/${app.name}/package.json`,
|
|
6163
6241
|
config
|
|
6164
6242
|
);
|
|
6165
|
-
const pkgPath =
|
|
6243
|
+
const pkgPath = path7.join(appDir, "package.json");
|
|
6166
6244
|
const status = await safeWriteFileAtomic(
|
|
6167
6245
|
pkgPath,
|
|
6168
6246
|
pkgContent,
|
|
6169
6247
|
config,
|
|
6170
6248
|
report
|
|
6171
6249
|
);
|
|
6172
|
-
|
|
6250
|
+
recordWriteStatus(result, pkgPath, status);
|
|
6173
6251
|
} else {
|
|
6174
6252
|
config.logger.warn(
|
|
6175
6253
|
`[apps] framework "${framework}" has no package.json template — skipping package.json for "${app.name}"`
|
|
@@ -6178,14 +6256,14 @@ async function generateApps(config, report) {
|
|
|
6178
6256
|
const tsConfig = frameworkConfig.tsConfig;
|
|
6179
6257
|
if (tsConfig) {
|
|
6180
6258
|
const tsContent = JSON.stringify(tsConfig, null, 2) + "\n";
|
|
6181
|
-
const tsPath =
|
|
6259
|
+
const tsPath = path7.join(appDir, "tsconfig.json");
|
|
6182
6260
|
const status = await safeWriteFileAtomic(
|
|
6183
6261
|
tsPath,
|
|
6184
6262
|
tsContent,
|
|
6185
6263
|
config,
|
|
6186
6264
|
report
|
|
6187
6265
|
);
|
|
6188
|
-
|
|
6266
|
+
recordWriteStatus(result, tsPath, status);
|
|
6189
6267
|
} else {
|
|
6190
6268
|
config.logger.warn(
|
|
6191
6269
|
`[apps] framework "${framework}" has no tsConfig — skipping tsconfig.json for "${app.name}"`
|
|
@@ -6239,18 +6317,20 @@ async function generateApps(config, report) {
|
|
|
6239
6317
|
const message = err3 instanceof Error ? err3.message : String(err3);
|
|
6240
6318
|
result.error = err3 instanceof Error ? err3 : new Error(`apps generation failed: ${message}`);
|
|
6241
6319
|
result.summary = `apps generation failed: ${message}`;
|
|
6320
|
+
config.logger.error(result.summary);
|
|
6321
|
+
if (report) report.record("error", "apps", result.summary);
|
|
6242
6322
|
return result;
|
|
6243
6323
|
}
|
|
6244
6324
|
}
|
|
6245
6325
|
function relativeImportSpecifier(fromFile, toFile) {
|
|
6246
|
-
let rel =
|
|
6326
|
+
let rel = path7.relative(path7.dirname(fromFile), toFile).split(path7.sep).join("/").replace(/\.tsx?$/, ".js");
|
|
6247
6327
|
if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
6248
6328
|
return rel;
|
|
6249
6329
|
}
|
|
6250
6330
|
function rewriteRelativeSpecifier(specifier, fromFile, toFile) {
|
|
6251
6331
|
if (!specifier.startsWith(".")) return specifier;
|
|
6252
|
-
const absolute =
|
|
6253
|
-
let rel =
|
|
6332
|
+
const absolute = path7.resolve(path7.dirname(fromFile), specifier);
|
|
6333
|
+
let rel = path7.relative(path7.dirname(toFile), absolute).split(path7.sep).join("/");
|
|
6254
6334
|
if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
6255
6335
|
return rel;
|
|
6256
6336
|
}
|
|
@@ -6886,13 +6966,13 @@ function resolveNaming(kind, contextNaming, manifestNaming) {
|
|
|
6886
6966
|
async function writeStubFile(filePath, content, config, report) {
|
|
6887
6967
|
if (!isInScope(filePath, config)) {
|
|
6888
6968
|
config.logger.debug(
|
|
6889
|
-
`skipped (outside --only) ${
|
|
6969
|
+
`skipped (outside --only) ${path7.relative(config.workspaceRoot, filePath)}`
|
|
6890
6970
|
);
|
|
6891
6971
|
return "skipped";
|
|
6892
6972
|
}
|
|
6893
6973
|
try {
|
|
6894
|
-
await
|
|
6895
|
-
const relative =
|
|
6974
|
+
await fs5.stat(filePath);
|
|
6975
|
+
const relative = path7.relative(config.workspaceRoot, filePath);
|
|
6896
6976
|
config.logger.debug(`stub preserved ${relative}`);
|
|
6897
6977
|
if (report) {
|
|
6898
6978
|
report.record(
|
|
@@ -6907,7 +6987,9 @@ async function writeStubFile(filePath, content, config, report) {
|
|
|
6907
6987
|
throw err3;
|
|
6908
6988
|
}
|
|
6909
6989
|
}
|
|
6910
|
-
|
|
6990
|
+
if (!config.dryRun) {
|
|
6991
|
+
await fs5.mkdir(path7.dirname(filePath), { recursive: true });
|
|
6992
|
+
}
|
|
6911
6993
|
return safeWriteFileAtomic(filePath, content, config, report, false);
|
|
6912
6994
|
}
|
|
6913
6995
|
async function tryAnalyzeRelatedPort(moduleDir, name, kind, context, relatedPortNamingTemplate) {
|
|
@@ -6926,7 +7008,7 @@ async function tryAnalyzeRelatedPort(moduleDir, name, kind, context, relatedPort
|
|
|
6926
7008
|
`${derivedPortName}.ts`
|
|
6927
7009
|
];
|
|
6928
7010
|
for (const filename of possibleFilenames) {
|
|
6929
|
-
const portFilePath =
|
|
7011
|
+
const portFilePath = path7.join(moduleDir, "src", portSubdir, filename);
|
|
6930
7012
|
const analysis = analyzePortFile(portFilePath);
|
|
6931
7013
|
if (analysis) {
|
|
6932
7014
|
return analysis;
|
|
@@ -6979,7 +7061,7 @@ async function generateStubs(moduleDir, moduleName, config, report) {
|
|
|
6979
7061
|
`stubs.naming.${kind}`,
|
|
6980
7062
|
config
|
|
6981
7063
|
);
|
|
6982
|
-
const filePath =
|
|
7064
|
+
const filePath = path7.join(moduleDir, "src", subdir, filename);
|
|
6983
7065
|
let content;
|
|
6984
7066
|
if (kind === "adapter" || kind === "useCase") {
|
|
6985
7067
|
const relatedPortNaming = resolveNaming(
|
|
@@ -7008,7 +7090,7 @@ async function generateStubs(moduleDir, moduleName, config, report) {
|
|
|
7008
7090
|
contextNaming,
|
|
7009
7091
|
manifestNaming
|
|
7010
7092
|
);
|
|
7011
|
-
const outPortDir =
|
|
7093
|
+
const outPortDir = path7.join(
|
|
7012
7094
|
moduleDir,
|
|
7013
7095
|
"src",
|
|
7014
7096
|
"application",
|
|
@@ -7023,7 +7105,7 @@ async function generateStubs(moduleDir, moduleName, config, report) {
|
|
|
7023
7105
|
"stubs.naming.outPort",
|
|
7024
7106
|
config
|
|
7025
7107
|
);
|
|
7026
|
-
const outPortPath =
|
|
7108
|
+
const outPortPath = path7.join(outPortDir, outFile);
|
|
7027
7109
|
const analyzed = analyzePortFile(outPortPath);
|
|
7028
7110
|
return {
|
|
7029
7111
|
interfaceName: analyzed?.interfaceName ?? `${base}Port`,
|
|
@@ -7057,24 +7139,13 @@ async function generateStubs(moduleDir, moduleName, config, report) {
|
|
|
7057
7139
|
);
|
|
7058
7140
|
}
|
|
7059
7141
|
const status = await writeStubFile(filePath, content, config, report);
|
|
7060
|
-
|
|
7061
|
-
if (status === "updated") result.updated.push(filePath);
|
|
7062
|
-
if (status === "skipped" || status === "protected")
|
|
7063
|
-
result.skipped.push(filePath);
|
|
7064
|
-
if (status === "created" || status === "updated") result.totalOps += 1;
|
|
7142
|
+
recordWriteStatus(result, filePath, status);
|
|
7065
7143
|
}
|
|
7066
7144
|
}
|
|
7067
7145
|
return result;
|
|
7068
7146
|
}
|
|
7069
7147
|
var OHS_NOTE = "\n *\n * Open Host Service (open-host): this is this context's published language for consuming contexts — keep it stable.";
|
|
7070
7148
|
var ACL_NOTE = "\n *\n * Anti-Corruption Layer (acl): translate the upstream contract into this context's own domain model; do not leak provider types inward.";
|
|
7071
|
-
function recordStatus3(result, filePath, status) {
|
|
7072
|
-
if (status === "created") result.created.push(filePath);
|
|
7073
|
-
else if (status === "updated") result.updated.push(filePath);
|
|
7074
|
-
else if (status === "skipped" || status === "protected")
|
|
7075
|
-
result.skipped.push(filePath);
|
|
7076
|
-
if (status === "created" || status === "updated") result.totalOps += 1;
|
|
7077
|
-
}
|
|
7078
7149
|
function addAll(map, key, values) {
|
|
7079
7150
|
const set = map.get(key) ?? /* @__PURE__ */ new Set();
|
|
7080
7151
|
values.forEach((v) => set.add(v));
|
|
@@ -7140,27 +7211,29 @@ ${methodLines}
|
|
|
7140
7211
|
`;
|
|
7141
7212
|
}
|
|
7142
7213
|
async function emitPortAndAdapter(result, config, report, scope, spec) {
|
|
7143
|
-
const moduleRoot =
|
|
7214
|
+
const moduleRoot = path7.join(
|
|
7144
7215
|
config.workspaceRoot,
|
|
7145
7216
|
"packages",
|
|
7146
7217
|
spec.contextName
|
|
7147
7218
|
);
|
|
7148
|
-
const portDir =
|
|
7219
|
+
const portDir = path7.join(
|
|
7149
7220
|
moduleRoot,
|
|
7150
7221
|
"src",
|
|
7151
7222
|
"application",
|
|
7152
7223
|
"ports",
|
|
7153
7224
|
spec.portKind
|
|
7154
7225
|
);
|
|
7155
|
-
const portPath =
|
|
7226
|
+
const portPath = path7.join(
|
|
7156
7227
|
portDir,
|
|
7157
7228
|
`${spec.portBase}.${spec.portKind}-port.ts`
|
|
7158
7229
|
);
|
|
7159
7230
|
if (!isInScope(portPath, config)) {
|
|
7160
7231
|
return;
|
|
7161
7232
|
}
|
|
7162
|
-
|
|
7163
|
-
|
|
7233
|
+
if (!config.dryRun) {
|
|
7234
|
+
await fs5.mkdir(portDir, { recursive: true });
|
|
7235
|
+
}
|
|
7236
|
+
recordWriteStatus(
|
|
7164
7237
|
result,
|
|
7165
7238
|
portPath,
|
|
7166
7239
|
await safeWriteFileAtomic(
|
|
@@ -7183,15 +7256,17 @@ async function emitPortAndAdapter(result, config, report, scope, spec) {
|
|
|
7183
7256
|
);
|
|
7184
7257
|
return;
|
|
7185
7258
|
}
|
|
7186
|
-
const adapterDir =
|
|
7187
|
-
const adapterPath =
|
|
7259
|
+
const adapterDir = path7.join(moduleRoot, "src", "infrastructure", "adapters");
|
|
7260
|
+
const adapterPath = path7.join(adapterDir, `${spec.portBase}.adapter.ts`);
|
|
7188
7261
|
if (!isInScope(adapterPath, config)) {
|
|
7189
7262
|
return;
|
|
7190
7263
|
}
|
|
7191
|
-
|
|
7264
|
+
if (!config.dryRun) {
|
|
7265
|
+
await fs5.mkdir(adapterDir, { recursive: true });
|
|
7266
|
+
}
|
|
7192
7267
|
const adapterClassName = `${toPascalCase2(spec.portBase)}Adapter`;
|
|
7193
7268
|
const portSpecifier = relativeImportSpecifier(adapterPath, portPath);
|
|
7194
|
-
|
|
7269
|
+
recordWriteStatus(
|
|
7195
7270
|
result,
|
|
7196
7271
|
adapterPath,
|
|
7197
7272
|
await safeWriteFileAtomic(
|
|
@@ -7214,15 +7289,17 @@ function operationImports(ops) {
|
|
|
7214
7289
|
return ops.flatMap((op) => [`${op}Request`, `${op}Response`]);
|
|
7215
7290
|
}
|
|
7216
7291
|
async function writeSharedContract(result, config, report, relSegments, content) {
|
|
7217
|
-
const contractPath =
|
|
7292
|
+
const contractPath = path7.join(
|
|
7218
7293
|
config.workspaceRoot,
|
|
7219
7294
|
"packages",
|
|
7220
7295
|
"shared",
|
|
7221
7296
|
"src",
|
|
7222
7297
|
...relSegments
|
|
7223
7298
|
);
|
|
7224
|
-
|
|
7225
|
-
|
|
7299
|
+
if (!config.dryRun) {
|
|
7300
|
+
await fs5.mkdir(path7.dirname(contractPath), { recursive: true });
|
|
7301
|
+
}
|
|
7302
|
+
recordWriteStatus(
|
|
7226
7303
|
result,
|
|
7227
7304
|
contractPath,
|
|
7228
7305
|
await safeWriteFileAtomic(contractPath, content, config, report)
|
|
@@ -7372,7 +7449,7 @@ async function generateSharedKernel(config, report) {
|
|
|
7372
7449
|
(bc) => bc.name?.toLowerCase() === "shared"
|
|
7373
7450
|
);
|
|
7374
7451
|
if (!hasShared) return result;
|
|
7375
|
-
const kernelPath =
|
|
7452
|
+
const kernelPath = path7.join(
|
|
7376
7453
|
config.workspaceRoot,
|
|
7377
7454
|
"packages",
|
|
7378
7455
|
"shared",
|
|
@@ -7385,13 +7462,15 @@ async function generateSharedKernel(config, report) {
|
|
|
7385
7462
|
return result;
|
|
7386
7463
|
}
|
|
7387
7464
|
try {
|
|
7388
|
-
await
|
|
7465
|
+
await fs5.stat(kernelPath);
|
|
7389
7466
|
result.skipped.push(kernelPath);
|
|
7390
7467
|
return result;
|
|
7391
7468
|
} catch (err3) {
|
|
7392
7469
|
if (err3.code !== "ENOENT") throw err3;
|
|
7393
7470
|
}
|
|
7394
|
-
|
|
7471
|
+
if (!config.dryRun) {
|
|
7472
|
+
await fs5.mkdir(path7.dirname(kernelPath), { recursive: true });
|
|
7473
|
+
}
|
|
7395
7474
|
const status = await safeWriteFileAtomic(
|
|
7396
7475
|
kernelPath,
|
|
7397
7476
|
RESULT_KERNEL,
|
|
@@ -7399,12 +7478,7 @@ async function generateSharedKernel(config, report) {
|
|
|
7399
7478
|
report,
|
|
7400
7479
|
false
|
|
7401
7480
|
);
|
|
7402
|
-
|
|
7403
|
-
result.created.push(kernelPath);
|
|
7404
|
-
result.totalOps += 1;
|
|
7405
|
-
} else {
|
|
7406
|
-
result.skipped.push(kernelPath);
|
|
7407
|
-
}
|
|
7481
|
+
recordWriteStatus(result, kernelPath, status);
|
|
7408
7482
|
return result;
|
|
7409
7483
|
}
|
|
7410
7484
|
var execAsync = promisify(exec);
|
|
@@ -7438,14 +7512,27 @@ function mergeResult2(dest, src) {
|
|
|
7438
7512
|
dest.created.push(...src.created);
|
|
7439
7513
|
dest.updated.push(...src.updated);
|
|
7440
7514
|
dest.skipped.push(...src.skipped);
|
|
7515
|
+
dest.deleted.push(...src.deleted);
|
|
7516
|
+
dest.unchanged.push(...src.unchanged);
|
|
7441
7517
|
dest.totalOps += src.totalOps;
|
|
7518
|
+
if (src.error && !dest.error) {
|
|
7519
|
+
dest.error = src.error;
|
|
7520
|
+
dest.summary = src.summary;
|
|
7521
|
+
}
|
|
7442
7522
|
}
|
|
7443
7523
|
function mergeBarrelPasses(firstPass, secondPass) {
|
|
7444
7524
|
const combined = createEmptyResult();
|
|
7445
7525
|
const secondPaths = /* @__PURE__ */ new Set([
|
|
7446
7526
|
...secondPass.created,
|
|
7447
7527
|
...secondPass.updated,
|
|
7448
|
-
...secondPass.skipped
|
|
7528
|
+
...secondPass.skipped,
|
|
7529
|
+
...secondPass.deleted
|
|
7530
|
+
]);
|
|
7531
|
+
const secondAll = /* @__PURE__ */ new Set([...secondPaths, ...secondPass.unchanged]);
|
|
7532
|
+
const firstMutations = /* @__PURE__ */ new Set([
|
|
7533
|
+
...firstPass.created,
|
|
7534
|
+
...firstPass.updated,
|
|
7535
|
+
...firstPass.deleted
|
|
7449
7536
|
]);
|
|
7450
7537
|
for (const p of firstPass.created) {
|
|
7451
7538
|
if (!secondPaths.has(p)) combined.created.push(p);
|
|
@@ -7454,12 +7541,29 @@ function mergeBarrelPasses(firstPass, secondPass) {
|
|
|
7454
7541
|
if (!secondPaths.has(p)) combined.updated.push(p);
|
|
7455
7542
|
}
|
|
7456
7543
|
for (const p of firstPass.skipped) {
|
|
7457
|
-
if (!
|
|
7544
|
+
if (!secondAll.has(p)) combined.skipped.push(p);
|
|
7545
|
+
}
|
|
7546
|
+
for (const p of firstPass.deleted) {
|
|
7547
|
+
if (!secondPaths.has(p)) combined.deleted.push(p);
|
|
7548
|
+
}
|
|
7549
|
+
for (const p of firstPass.unchanged) {
|
|
7550
|
+
if (!secondAll.has(p)) combined.unchanged.push(p);
|
|
7458
7551
|
}
|
|
7459
7552
|
combined.created.push(...secondPass.created);
|
|
7460
7553
|
combined.updated.push(...secondPass.updated);
|
|
7461
7554
|
combined.skipped.push(...secondPass.skipped);
|
|
7462
|
-
combined.
|
|
7555
|
+
combined.deleted.push(...secondPass.deleted);
|
|
7556
|
+
for (const p of secondPass.unchanged) {
|
|
7557
|
+
if (!firstMutations.has(p)) combined.unchanged.push(p);
|
|
7558
|
+
}
|
|
7559
|
+
combined.totalOps = combined.created.length + combined.updated.length + combined.deleted.length;
|
|
7560
|
+
if (firstPass.error) {
|
|
7561
|
+
combined.error = firstPass.error;
|
|
7562
|
+
combined.summary = firstPass.summary;
|
|
7563
|
+
} else if (secondPass.error) {
|
|
7564
|
+
combined.error = secondPass.error;
|
|
7565
|
+
combined.summary = secondPass.summary;
|
|
7566
|
+
}
|
|
7463
7567
|
return combined;
|
|
7464
7568
|
}
|
|
7465
7569
|
|
|
@@ -7468,14 +7572,15 @@ function caseInsensitiveEnum(schema, dir = "lower") {
|
|
|
7468
7572
|
return external_exports.preprocess((value) => typeof value === "string" ? dir === "lower" ? value.trim().toLowerCase() : value.trim().toUpperCase() : value, schema);
|
|
7469
7573
|
}
|
|
7470
7574
|
var BoundedContextTypeSchema = boundedContextTypeSchema;
|
|
7471
|
-
var
|
|
7575
|
+
var PLANE_NAMES = [
|
|
7472
7576
|
"projection",
|
|
7473
7577
|
"probabilistic",
|
|
7474
7578
|
"infrastructure",
|
|
7475
7579
|
"shared-kernel",
|
|
7476
7580
|
"core",
|
|
7477
7581
|
"supporting"
|
|
7478
|
-
]
|
|
7582
|
+
];
|
|
7583
|
+
var PlaneTypeSchema = caseInsensitiveEnum(external_exports.enum(PLANE_NAMES));
|
|
7479
7584
|
var StatusTypeSchema = caseInsensitiveEnum(external_exports.enum(["active", "frozen", "deprecated", "experimental"]));
|
|
7480
7585
|
var RelationshipPatternSchema = caseInsensitiveEnum(external_exports.enum(["U/D", "ACL", "SK", "P", "OHS"]), "upper");
|
|
7481
7586
|
var RelationshipRoleSchema = caseInsensitiveEnum(external_exports.enum(["upstream", "downstream", "peer"]));
|
|
@@ -7779,21 +7884,21 @@ external_exports.object({
|
|
|
7779
7884
|
turboConfig: external_exports.record(external_exports.unknown()).optional()
|
|
7780
7885
|
});
|
|
7781
7886
|
function assertPathWithinArchitecture(workspaceRoot, relativePath) {
|
|
7782
|
-
const resolved =
|
|
7783
|
-
const archRoot =
|
|
7887
|
+
const resolved = path7.resolve(workspaceRoot, ".architecture", relativePath);
|
|
7888
|
+
const archRoot = path7.resolve(workspaceRoot, ".architecture");
|
|
7784
7889
|
try {
|
|
7785
7890
|
const realResolved = realpathSync(resolved);
|
|
7786
7891
|
const realArchRoot = realpathSync(archRoot);
|
|
7787
|
-
const archRootWithSep = realArchRoot +
|
|
7892
|
+
const archRootWithSep = realArchRoot + path7.sep;
|
|
7788
7893
|
if (realResolved !== realArchRoot && !realResolved.startsWith(archRootWithSep)) {
|
|
7789
7894
|
throw new Error(`Path traversal detected: "${relativePath}" resolves outside .architecture/`);
|
|
7790
7895
|
}
|
|
7791
7896
|
} catch (err3) {
|
|
7792
7897
|
if (err3 instanceof Error && "code" in err3 && err3.code === "ENOENT") {
|
|
7793
7898
|
let checkPath = archRoot;
|
|
7794
|
-
const pathSegments =
|
|
7899
|
+
const pathSegments = path7.relative(archRoot, resolved).split(path7.sep);
|
|
7795
7900
|
for (const segment of pathSegments) {
|
|
7796
|
-
checkPath =
|
|
7901
|
+
checkPath = path7.join(checkPath, segment);
|
|
7797
7902
|
try {
|
|
7798
7903
|
const stat = lstatSync(checkPath);
|
|
7799
7904
|
if (stat.isSymbolicLink()) {
|
|
@@ -7809,7 +7914,7 @@ function assertPathWithinArchitecture(workspaceRoot, relativePath) {
|
|
|
7809
7914
|
throw statErr;
|
|
7810
7915
|
}
|
|
7811
7916
|
}
|
|
7812
|
-
const archRootWithSep = archRoot +
|
|
7917
|
+
const archRootWithSep = archRoot + path7.sep;
|
|
7813
7918
|
if (resolved !== archRoot && !resolved.startsWith(archRootWithSep)) {
|
|
7814
7919
|
throw new Error(`Path traversal detected: "${relativePath}" resolves outside .architecture/`);
|
|
7815
7920
|
}
|
|
@@ -7819,7 +7924,7 @@ function assertPathWithinArchitecture(workspaceRoot, relativePath) {
|
|
|
7819
7924
|
}
|
|
7820
7925
|
}
|
|
7821
7926
|
async function mergeSplitManifest(workspaceRoot, manifestPath) {
|
|
7822
|
-
const content = await
|
|
7927
|
+
const content = await fs5.readFile(manifestPath, "utf-8");
|
|
7823
7928
|
const parsed = yaml3.load(content);
|
|
7824
7929
|
if (parsed == null) {
|
|
7825
7930
|
throw new Error("Manifest file is empty");
|
|
@@ -7852,10 +7957,10 @@ async function mergeSplitManifest(workspaceRoot, manifestPath) {
|
|
|
7852
7957
|
continue;
|
|
7853
7958
|
}
|
|
7854
7959
|
assertPathWithinArchitecture(workspaceRoot, indexEntry.file);
|
|
7855
|
-
const contextFilePath =
|
|
7960
|
+
const contextFilePath = path7.join(workspaceRoot, ".architecture", indexEntry.file);
|
|
7856
7961
|
let contextContent;
|
|
7857
7962
|
try {
|
|
7858
|
-
contextContent = await
|
|
7963
|
+
contextContent = await fs5.readFile(contextFilePath, "utf-8");
|
|
7859
7964
|
} catch (err3) {
|
|
7860
7965
|
if (err3 instanceof Error && "code" in err3 && err3.code === "ENOENT") {
|
|
7861
7966
|
throw new Error(`Context file not found: ${contextFilePath}`);
|
|
@@ -7887,10 +7992,10 @@ async function mergeSplitManifest(workspaceRoot, manifestPath) {
|
|
|
7887
7992
|
continue;
|
|
7888
7993
|
}
|
|
7889
7994
|
assertPathWithinArchitecture(workspaceRoot, appEntry.file);
|
|
7890
|
-
const appFilePath =
|
|
7995
|
+
const appFilePath = path7.join(workspaceRoot, ".architecture", appEntry.file);
|
|
7891
7996
|
let appContent;
|
|
7892
7997
|
try {
|
|
7893
|
-
appContent = await
|
|
7998
|
+
appContent = await fs5.readFile(appFilePath, "utf-8");
|
|
7894
7999
|
} catch (err3) {
|
|
7895
8000
|
if (err3 instanceof Error && "code" in err3 && err3.code === "ENOENT") {
|
|
7896
8001
|
throw new Error(`App file not found: ${appFilePath}`);
|
|
@@ -7909,23 +8014,23 @@ async function mergeSplitManifest(workspaceRoot, manifestPath) {
|
|
|
7909
8014
|
|
|
7910
8015
|
// src/sync-engine-init.ts
|
|
7911
8016
|
var __filename$1 = fileURLToPath(import.meta.url);
|
|
7912
|
-
var __dirname$1 =
|
|
8017
|
+
var __dirname$1 = path7.dirname(__filename$1);
|
|
7913
8018
|
async function findWorkspaceRoot(options) {
|
|
7914
8019
|
if (options.targetRoot) {
|
|
7915
8020
|
return options.targetRoot;
|
|
7916
8021
|
}
|
|
7917
8022
|
let currentDir = __dirname$1;
|
|
7918
|
-
while (currentDir !==
|
|
8023
|
+
while (currentDir !== path7.parse(currentDir).root) {
|
|
7919
8024
|
try {
|
|
7920
|
-
const pkgPath =
|
|
7921
|
-
const pkgContent = await
|
|
8025
|
+
const pkgPath = path7.join(currentDir, "package.json");
|
|
8026
|
+
const pkgContent = await fs5.readFile(pkgPath, "utf-8");
|
|
7922
8027
|
const pkg = JSON.parse(pkgContent);
|
|
7923
8028
|
if (pkg.workspaces && Array.isArray(pkg.workspaces)) {
|
|
7924
8029
|
return currentDir;
|
|
7925
8030
|
}
|
|
7926
8031
|
} catch {
|
|
7927
8032
|
}
|
|
7928
|
-
currentDir =
|
|
8033
|
+
currentDir = path7.dirname(currentDir);
|
|
7929
8034
|
}
|
|
7930
8035
|
throw new Error(
|
|
7931
8036
|
'Could not locate monorepo root. No package.json with "workspaces" field found.'
|
|
@@ -7936,7 +8041,7 @@ async function loadManifest(workspaceRoot, flags, options) {
|
|
|
7936
8041
|
return options.manifest;
|
|
7937
8042
|
}
|
|
7938
8043
|
const { logger, dryRun } = flags;
|
|
7939
|
-
const manifestPath =
|
|
8044
|
+
const manifestPath = path7.join(workspaceRoot, ".architecture/manifest.yaml");
|
|
7940
8045
|
logger.debug(`[debug] __dirname (ESM): ${__dirname$1}`);
|
|
7941
8046
|
logger.debug(`[debug] resolved workspaceRoot: ${workspaceRoot}`);
|
|
7942
8047
|
logger.debug(`[debug] resolved manifestPath: ${manifestPath}`);
|
|
@@ -7990,6 +8095,23 @@ function validateManifest(manifest, flags) {
|
|
|
7990
8095
|
var execAsync2 = promisify(exec);
|
|
7991
8096
|
var SyncEngine = class {
|
|
7992
8097
|
report = new MigrationReport();
|
|
8098
|
+
// PR-B1 (RCA #4): per-run mutation journal — pre-images of every file sync
|
|
8099
|
+
// touches, replayed in reverse on failure (see journal.ts). The lifetime is
|
|
8100
|
+
// one RUN, not one instance: run() re-news it on entry, so a reused engine
|
|
8101
|
+
// can never replay a previous run's pre-images into a later rollback.
|
|
8102
|
+
journal = new SyncJournal();
|
|
8103
|
+
// B-1 (PR-B2 review): generators that failed-soft this run. Four generators
|
|
8104
|
+
// catch their own exceptions into `result.error` by contract (Wave-2e: skip
|
|
8105
|
+
// the package, do not abort the run) — but a swallowed failure plans zero
|
|
8106
|
+
// ops, so a run that could not even read a target still summarized as
|
|
8107
|
+
// `Total ops : 0` and the CLI exited 0: errors masqueraded as convergence,
|
|
8108
|
+
// silently breaking `--check`'s "exit 0 ⇒ converged" promise. Failures are
|
|
8109
|
+
// recorded at each production site (NOT off the merged rows — mergeResult
|
|
8110
|
+
// keeps only the first error, so row-level counting would under-report
|
|
8111
|
+
// multi-module failures), printed as FAILED rows under the summary, and
|
|
8112
|
+
// surfaced as `SyncRunSummary.errors` for cli.ts to turn into exit ≠ 0.
|
|
8113
|
+
// Per-run lifetime, same reset discipline as the journal.
|
|
8114
|
+
failures = [];
|
|
7993
8115
|
partialConfig;
|
|
7994
8116
|
fullConfig = null;
|
|
7995
8117
|
manifest = {};
|
|
@@ -8011,6 +8133,19 @@ var SyncEngine = class {
|
|
|
8011
8133
|
}
|
|
8012
8134
|
return this.fullConfig;
|
|
8013
8135
|
}
|
|
8136
|
+
/**
|
|
8137
|
+
* Record a failed-soft generator result (B-1). Called at every site that
|
|
8138
|
+
* receives a GeneratorResult, including the ones that never set `error`
|
|
8139
|
+
* today — the check is one truthy test, and a future generator adopting the
|
|
8140
|
+
* catch-into-result contract is then surfaced without anyone remembering
|
|
8141
|
+
* this seam. `row` matches the summary-table label so the FAILED line and
|
|
8142
|
+
* the table read as one report.
|
|
8143
|
+
*/
|
|
8144
|
+
noteFailure(row, result) {
|
|
8145
|
+
if (result.error) {
|
|
8146
|
+
this.failures.push({ row, message: result.error.message });
|
|
8147
|
+
}
|
|
8148
|
+
}
|
|
8014
8149
|
async ensureDirectories() {
|
|
8015
8150
|
const config = this.getConfig();
|
|
8016
8151
|
const result = createEmptyResult();
|
|
@@ -8025,20 +8160,12 @@ var SyncEngine = class {
|
|
|
8025
8160
|
);
|
|
8026
8161
|
continue;
|
|
8027
8162
|
}
|
|
8028
|
-
const moduleDir =
|
|
8163
|
+
const moduleDir = path7.join(this.workspaceRoot, "packages", mod.name);
|
|
8029
8164
|
logger.info(
|
|
8030
8165
|
`Ensuring directories for module: ${mod.name} at ${moduleDir}`
|
|
8031
8166
|
);
|
|
8032
|
-
const layerResult = await ensureLayerFolders(
|
|
8033
|
-
|
|
8034
|
-
layers,
|
|
8035
|
-
config,
|
|
8036
|
-
this.report
|
|
8037
|
-
);
|
|
8038
|
-
result.created.push(...layerResult.created);
|
|
8039
|
-
result.skipped.push(...layerResult.skipped);
|
|
8040
|
-
result.updated.push(...layerResult.updated);
|
|
8041
|
-
result.totalOps += layerResult.totalOps;
|
|
8167
|
+
const layerResult = await ensureLayerFolders(moduleDir, layers, config);
|
|
8168
|
+
mergeResult2(result, layerResult);
|
|
8042
8169
|
}
|
|
8043
8170
|
return result;
|
|
8044
8171
|
}
|
|
@@ -8053,7 +8180,7 @@ var SyncEngine = class {
|
|
|
8053
8180
|
const stubs = createEmptyResult();
|
|
8054
8181
|
for (const module of modules) {
|
|
8055
8182
|
const moduleName = module.name;
|
|
8056
|
-
const moduleDir =
|
|
8183
|
+
const moduleDir = path7.join(this.workspaceRoot, "packages", moduleName);
|
|
8057
8184
|
if (moduleName.includes("..") || moduleName.includes("/") || moduleName.startsWith(".")) {
|
|
8058
8185
|
logger.warn(
|
|
8059
8186
|
`Skipping invalid module name (potential path traversal): ${moduleName}`
|
|
@@ -8090,6 +8217,11 @@ var SyncEngine = class {
|
|
|
8090
8217
|
config,
|
|
8091
8218
|
this.report
|
|
8092
8219
|
);
|
|
8220
|
+
this.noteFailure("Barrels", barrelResult);
|
|
8221
|
+
this.noteFailure("package.json", pkgResult);
|
|
8222
|
+
this.noteFailure("tsconfig.json", tsResult);
|
|
8223
|
+
this.noteFailure("ESLint", eslintResult);
|
|
8224
|
+
this.noteFailure("Stubs", stubResult);
|
|
8093
8225
|
if (this.partialConfig.mode === "self-regen") {
|
|
8094
8226
|
await reapLegacyFolders(moduleDir, config, this.report);
|
|
8095
8227
|
}
|
|
@@ -8115,6 +8247,8 @@ var SyncEngine = class {
|
|
|
8115
8247
|
const { logger, dryRun, allowDirty, mode } = this.partialConfig;
|
|
8116
8248
|
const start = Date.now();
|
|
8117
8249
|
let lockFile = null;
|
|
8250
|
+
this.journal = new SyncJournal();
|
|
8251
|
+
this.failures = [];
|
|
8118
8252
|
logger.info(
|
|
8119
8253
|
dryRun ? "[DRY-RUN MODE] Starting sync..." : "Starting sync..."
|
|
8120
8254
|
);
|
|
@@ -8163,7 +8297,8 @@ var SyncEngine = class {
|
|
|
8163
8297
|
this.fullConfig = {
|
|
8164
8298
|
...this.partialConfig,
|
|
8165
8299
|
workspaceRoot: this.workspaceRoot,
|
|
8166
|
-
manifest: this.manifest
|
|
8300
|
+
manifest: this.manifest,
|
|
8301
|
+
journal: this.journal
|
|
8167
8302
|
};
|
|
8168
8303
|
if (!dryRun && mode === "self-regen") {
|
|
8169
8304
|
lockFile = new LockFile(this.workspaceRoot);
|
|
@@ -8189,23 +8324,29 @@ var SyncEngine = class {
|
|
|
8189
8324
|
this.fullConfig,
|
|
8190
8325
|
this.report
|
|
8191
8326
|
);
|
|
8327
|
+
this.noteFailure("RootFiles", rootFilesResult);
|
|
8192
8328
|
const archFilesResult = await generateArchitectureFiles(
|
|
8193
8329
|
this.fullConfig,
|
|
8194
8330
|
this.report
|
|
8195
8331
|
);
|
|
8332
|
+
this.noteFailure("ArchFiles", archFilesResult);
|
|
8196
8333
|
const layerResult = await this.ensureDirectories();
|
|
8334
|
+
this.noteFailure("Layers", layerResult);
|
|
8197
8335
|
const coreResults = await this.generateCoreArtifacts();
|
|
8198
8336
|
const { pkgs, tsconfigs, eslint, stubs } = coreResults;
|
|
8199
8337
|
const firstPassBarrels = coreResults.barrels;
|
|
8200
8338
|
const appsResult = await generateApps(this.fullConfig, this.report);
|
|
8339
|
+
this.noteFailure("Apps", appsResult);
|
|
8201
8340
|
const crossContextResult = await generateCrossContext(
|
|
8202
8341
|
this.fullConfig,
|
|
8203
8342
|
this.report
|
|
8204
8343
|
);
|
|
8344
|
+
this.noteFailure("CrossContext", crossContextResult);
|
|
8205
8345
|
const sharedKernelResult = await generateSharedKernel(
|
|
8206
8346
|
this.fullConfig,
|
|
8207
8347
|
this.report
|
|
8208
8348
|
);
|
|
8349
|
+
this.noteFailure("SharedKernel", sharedKernelResult);
|
|
8209
8350
|
const secondPassBarrels = createEmptyResult();
|
|
8210
8351
|
const modules = this.fullConfig.manifest.bounded_contexts ?? [];
|
|
8211
8352
|
for (const module of modules) {
|
|
@@ -8213,16 +8354,47 @@ var SyncEngine = class {
|
|
|
8213
8354
|
if (!moduleName || moduleName.includes("..") || moduleName.includes("/") || moduleName.startsWith(".")) {
|
|
8214
8355
|
continue;
|
|
8215
8356
|
}
|
|
8216
|
-
const moduleDir =
|
|
8357
|
+
const moduleDir = path7.join(this.workspaceRoot, "packages", moduleName);
|
|
8217
8358
|
const pass2 = await generateBarrels(
|
|
8218
8359
|
moduleDir,
|
|
8219
8360
|
this.fullConfig,
|
|
8220
8361
|
this.report
|
|
8221
8362
|
);
|
|
8363
|
+
this.noteFailure("Barrels", pass2);
|
|
8222
8364
|
mergeResult2(secondPassBarrels, pass2);
|
|
8223
8365
|
}
|
|
8224
8366
|
const barrels = mergeBarrelPasses(firstPassBarrels, secondPassBarrels);
|
|
8225
|
-
const
|
|
8367
|
+
const rows = [
|
|
8368
|
+
["RootFiles", rootFilesResult],
|
|
8369
|
+
["ArchFiles", archFilesResult],
|
|
8370
|
+
["Layers", layerResult],
|
|
8371
|
+
["Barrels", barrels],
|
|
8372
|
+
["CrossContext", crossContextResult],
|
|
8373
|
+
["SharedKernel", sharedKernelResult],
|
|
8374
|
+
["package.json", pkgs],
|
|
8375
|
+
["tsconfig.json", tsconfigs],
|
|
8376
|
+
["ESLint", eslint],
|
|
8377
|
+
["Stubs", stubs],
|
|
8378
|
+
["Apps", appsResult]
|
|
8379
|
+
];
|
|
8380
|
+
const runSummary = {
|
|
8381
|
+
created: 0,
|
|
8382
|
+
updated: 0,
|
|
8383
|
+
deleted: 0,
|
|
8384
|
+
unchanged: 0,
|
|
8385
|
+
skipped: 0,
|
|
8386
|
+
totalOps: 0,
|
|
8387
|
+
errors: this.failures.length,
|
|
8388
|
+
durationMs: 0
|
|
8389
|
+
};
|
|
8390
|
+
for (const [, r] of rows) {
|
|
8391
|
+
runSummary.created += r.created.length;
|
|
8392
|
+
runSummary.updated += r.updated.length;
|
|
8393
|
+
runSummary.deleted += r.deleted.length;
|
|
8394
|
+
runSummary.unchanged += r.unchanged.length;
|
|
8395
|
+
runSummary.skipped += r.skipped.length;
|
|
8396
|
+
runSummary.totalOps += r.totalOps;
|
|
8397
|
+
}
|
|
8226
8398
|
if (mode === "self-regen") {
|
|
8227
8399
|
await runArchLinter(this.fullConfig);
|
|
8228
8400
|
await this.report.writeReport(this.fullConfig);
|
|
@@ -8230,62 +8402,70 @@ var SyncEngine = class {
|
|
|
8230
8402
|
logger.info("Skipping arch-linter and report (external mode)");
|
|
8231
8403
|
}
|
|
8232
8404
|
const duration = Date.now() - start;
|
|
8233
|
-
|
|
8405
|
+
runSummary.durationMs = duration;
|
|
8406
|
+
if (this.failures.length === 0) {
|
|
8407
|
+
logger.info("\nSync completed successfully.");
|
|
8408
|
+
} else {
|
|
8409
|
+
logger.error(
|
|
8410
|
+
`
|
|
8411
|
+
Sync completed with ${this.failures.length} generator failure(s) — see the FAILED row(s) below.`
|
|
8412
|
+
);
|
|
8413
|
+
}
|
|
8234
8414
|
logger.info(
|
|
8235
8415
|
`Processed ${this.manifest.bounded_contexts?.length ?? 0} modules in ${duration}ms`
|
|
8236
8416
|
);
|
|
8237
8417
|
logger.info(`
|
|
8238
8418
|
=== Generator Summary ===`);
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
)
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
);
|
|
8248
|
-
|
|
8249
|
-
`• Barrels : ${barrels.created.length} created, ${barrels.updated.length} updated, ${barrels.skipped.length} skipped`
|
|
8250
|
-
);
|
|
8251
|
-
logger.info(
|
|
8252
|
-
`• CrossContext : ${crossContextResult.created.length} created, ${crossContextResult.updated.length} updated, ${crossContextResult.skipped.length} skipped`
|
|
8253
|
-
);
|
|
8254
|
-
logger.info(
|
|
8255
|
-
`• SharedKernel : ${sharedKernelResult.created.length} created, ${sharedKernelResult.updated.length} updated, ${sharedKernelResult.skipped.length} skipped`
|
|
8256
|
-
);
|
|
8257
|
-
logger.info(
|
|
8258
|
-
`• package.json : ${pkgs.created.length} created, ${pkgs.updated.length} updated, ${pkgs.skipped.length} skipped`
|
|
8259
|
-
);
|
|
8260
|
-
logger.info(
|
|
8261
|
-
`• tsconfig.json : ${tsconfigs.created.length} created, ${tsconfigs.updated.length} updated, ${tsconfigs.skipped.length} skipped`
|
|
8262
|
-
);
|
|
8263
|
-
logger.info(
|
|
8264
|
-
`• ESLint : ${eslint.created.length} created, ${eslint.updated.length} updated, ${eslint.skipped.length} skipped`
|
|
8265
|
-
);
|
|
8266
|
-
logger.info(
|
|
8267
|
-
`• Stubs : ${stubs.created.length} created, ${stubs.updated.length} updated, ${stubs.skipped.length} skipped`
|
|
8268
|
-
);
|
|
8269
|
-
logger.info(
|
|
8270
|
-
`• Apps : ${appsResult.created.length} created, ${appsResult.updated.length} updated, ${appsResult.skipped.length} skipped`
|
|
8271
|
-
);
|
|
8272
|
-
logger.info(`• Total ops : ${totalOps}`);
|
|
8419
|
+
for (const [label, r] of rows) {
|
|
8420
|
+
logger.info(
|
|
8421
|
+
`• ${label} : ${r.created.length} created, ${r.updated.length} updated, ${r.deleted.length} deleted, ${r.unchanged.length} unchanged, ${r.skipped.length} skipped`
|
|
8422
|
+
);
|
|
8423
|
+
}
|
|
8424
|
+
for (const f of this.failures) {
|
|
8425
|
+
logger.error(`• ${f.row} : FAILED — ${f.message}`);
|
|
8426
|
+
}
|
|
8427
|
+
logger.info(`• Total ops : ${runSummary.totalOps}`);
|
|
8428
|
+
return runSummary;
|
|
8273
8429
|
} catch (err3) {
|
|
8274
8430
|
const message = err3 instanceof Error ? err3.message : "Unknown sync error";
|
|
8275
8431
|
logger.error(`Sync failed: ${message}`);
|
|
8276
8432
|
if (!dryRun) {
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
} catch (rollbackErr) {
|
|
8433
|
+
if (this.journal.size === 0) {
|
|
8434
|
+
logger.info(
|
|
8435
|
+
"No files were touched before the failure — nothing to roll back."
|
|
8436
|
+
);
|
|
8437
|
+
} else if (allowDirty) {
|
|
8283
8438
|
logger.warn(
|
|
8284
|
-
`
|
|
8439
|
+
`Sync failed after touching ${this.journal.size} path(s) — NO rollback under --allow-dirty; the tree is left as-is:`
|
|
8440
|
+
);
|
|
8441
|
+
for (const line of this.journal.describeEntries(this.workspaceRoot)) {
|
|
8442
|
+
logger.warn(` ${line}`);
|
|
8443
|
+
}
|
|
8444
|
+
} else {
|
|
8445
|
+
logger.info(
|
|
8446
|
+
`Rolling back ${this.journal.size} journaled path(s) (inverse-ops; never git reset/clean)...`
|
|
8285
8447
|
);
|
|
8448
|
+
const outcome = await this.journal.rollback(
|
|
8449
|
+
logger,
|
|
8450
|
+
this.workspaceRoot
|
|
8451
|
+
);
|
|
8452
|
+
if (outcome.failures.length === 0) {
|
|
8453
|
+
logger.info(
|
|
8454
|
+
`Rollback completed: ${outcome.restored}/${outcome.attempted} path(s) restored.`
|
|
8455
|
+
);
|
|
8456
|
+
} else {
|
|
8457
|
+
for (const f of outcome.failures) {
|
|
8458
|
+
logger.error(
|
|
8459
|
+
`Rollback failed for ${path7.relative(this.workspaceRoot, f.path)}: intended to ${f.intended} — ${f.error}`
|
|
8460
|
+
);
|
|
8461
|
+
}
|
|
8462
|
+
logger.error(
|
|
8463
|
+
`Rollback incomplete: ${outcome.failures.length} of ${outcome.attempted} path(s) NOT restored — inspect the paths above.`
|
|
8464
|
+
);
|
|
8465
|
+
}
|
|
8286
8466
|
}
|
|
8287
|
-
process.exit(1);
|
|
8288
8467
|
}
|
|
8468
|
+
throw err3;
|
|
8289
8469
|
} finally {
|
|
8290
8470
|
if (lockFile) {
|
|
8291
8471
|
try {
|
|
@@ -8376,6 +8556,19 @@ function parseArgs(rawArgs) {
|
|
|
8376
8556
|
case "--allow-dirty":
|
|
8377
8557
|
flags.allowDirty = true;
|
|
8378
8558
|
break;
|
|
8559
|
+
// Lenient on a missing value (warn + skip) where the commander front
|
|
8560
|
+
// door hard-errors on `--report <path>` — deliberate divergence:
|
|
8561
|
+
// parseArgs serves programmatic/test callers that shouldn't die on a
|
|
8562
|
+
// malformed optional flag (review #315).
|
|
8563
|
+
case "--report": {
|
|
8564
|
+
const next = args[i + 1];
|
|
8565
|
+
if (next !== void 0 && !next.startsWith("-")) {
|
|
8566
|
+
flags.report = args[++i];
|
|
8567
|
+
} else {
|
|
8568
|
+
flags.logger.warn("--report requires a path argument — ignored");
|
|
8569
|
+
}
|
|
8570
|
+
break;
|
|
8571
|
+
}
|
|
8379
8572
|
case "--only": {
|
|
8380
8573
|
const patterns = [];
|
|
8381
8574
|
while (i + 1 < args.length && !args[i + 1].startsWith("-")) {
|
|
@@ -8401,7 +8594,7 @@ function ok2(value) {
|
|
|
8401
8594
|
function err2(error) {
|
|
8402
8595
|
return { success: false, error };
|
|
8403
8596
|
}
|
|
8404
|
-
var CONFIG_FILE =
|
|
8597
|
+
var CONFIG_FILE = path7.join(
|
|
8405
8598
|
process.cwd(),
|
|
8406
8599
|
".architecture/generator.config.yaml"
|
|
8407
8600
|
);
|
|
@@ -8412,7 +8605,7 @@ function isFailureMode(v) {
|
|
|
8412
8605
|
return v === "abort" || v === "abort-and-cleanup" || v === "warn-and-continue";
|
|
8413
8606
|
}
|
|
8414
8607
|
var YamlConfigAdapter = class {
|
|
8415
|
-
constructor(configFile = CONFIG_FILE, fsImpl =
|
|
8608
|
+
constructor(configFile = CONFIG_FILE, fsImpl = fs5, logger = console) {
|
|
8416
8609
|
this.configFile = configFile;
|
|
8417
8610
|
this.fsImpl = fsImpl;
|
|
8418
8611
|
this.logger = logger;
|
|
@@ -8568,7 +8761,7 @@ var YamlConfigAdapter = class {
|
|
|
8568
8761
|
const updated = { ...current, ...sanitized };
|
|
8569
8762
|
const yamlDoc = this.toYamlDoc(updated);
|
|
8570
8763
|
const content = yaml3.dump(yamlDoc, { indent: 2, lineWidth: -1 });
|
|
8571
|
-
await this.fsImpl.mkdir(
|
|
8764
|
+
await this.fsImpl.mkdir(path7.dirname(this.configFile), { recursive: true });
|
|
8572
8765
|
const tmpPath = `${this.configFile}.tmp`;
|
|
8573
8766
|
await this.fsImpl.writeFile(tmpPath, content, {
|
|
8574
8767
|
encoding: "utf8",
|
|
@@ -8778,7 +8971,7 @@ var InMemoryConfigDouble = class _InMemoryConfigDouble {
|
|
|
8778
8971
|
var execAsync3 = promisify(exec);
|
|
8779
8972
|
async function loadManifest2(workspaceRoot) {
|
|
8780
8973
|
try {
|
|
8781
|
-
const manifestPath =
|
|
8974
|
+
const manifestPath = path7.join(
|
|
8782
8975
|
workspaceRoot,
|
|
8783
8976
|
".architecture/manifest.yaml"
|
|
8784
8977
|
);
|
|
@@ -8819,18 +9012,18 @@ async function validateManifest2(workspaceRoot) {
|
|
|
8819
9012
|
}
|
|
8820
9013
|
async function saveManifest(workspaceRoot, manifest) {
|
|
8821
9014
|
try {
|
|
8822
|
-
const manifestPath =
|
|
9015
|
+
const manifestPath = path7.join(
|
|
8823
9016
|
workspaceRoot,
|
|
8824
9017
|
".architecture/manifest.yaml"
|
|
8825
9018
|
);
|
|
8826
9019
|
const content = yaml3.dump(manifest, { indent: 2 });
|
|
8827
|
-
await
|
|
9020
|
+
await fs5.writeFile(manifestPath, content, "utf-8");
|
|
8828
9021
|
return ok2(void 0);
|
|
8829
9022
|
} catch (errObj) {
|
|
8830
9023
|
return err2(errObj);
|
|
8831
9024
|
}
|
|
8832
9025
|
}
|
|
8833
9026
|
|
|
8834
|
-
export { DEFAULT_NAMING, DEFAULT_TEMPLATES, InMemoryConfigDouble, SyncEngine, YamlConfigAdapter, createEmptyResult, err2 as err, isGeneratedFile, isInScope, isIndexManifest, isProtectedRoot, loadManifest2 as loadManifest, mergeSplitManifest, ok2 as ok, parseArgs, portName, protectedFiles, safeWriteFile, safeWriteFileAtomic, saveManifest, validateManifest2 as validateManifest };
|
|
9027
|
+
export { DEFAULT_NAMING, DEFAULT_TEMPLATES, InMemoryConfigDouble, SyncEngine, YamlConfigAdapter, createEmptyResult, err2 as err, isGeneratedFile, isInScope, isIndexManifest, isProtectedRoot, loadManifest2 as loadManifest, mergeSplitManifest, ok2 as ok, parseArgs, portName, protectedFiles, recordWriteStatus, safeWriteFile, safeWriteFileAtomic, saveManifest, validateManifest2 as validateManifest };
|
|
8835
9028
|
//# sourceMappingURL=index.js.map
|
|
8836
9029
|
//# sourceMappingURL=index.js.map
|