@hexagen-monaco/sync 0.7.0 → 0.8.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/application/use-cases/index.d.ts +1 -0
- package/dist/application/use-cases/index.d.ts.map +1 -1
- package/dist/application/use-cases/migrate-manifest.use-case.d.ts +48 -0
- package/dist/application/use-cases/migrate-manifest.use-case.d.ts.map +1 -0
- package/dist/cli.js +342 -59
- package/dist/cli.js.map +1 -1
- package/dist/commands/arch/validate.d.ts.map +1 -1
- package/dist/commands/manifest/index.d.ts.map +1 -1
- package/dist/commands/manifest/migrate.d.ts +10 -0
- package/dist/commands/manifest/migrate.d.ts.map +1 -0
- package/dist/generators/architecture-file-templates.d.ts +1 -1
- package/dist/generators/architecture-file-templates.d.ts.map +1 -1
- package/dist/generators/architecture-files.d.ts.map +1 -1
- package/dist/generators/layer-folders.d.ts +7 -2
- package/dist/generators/layer-folders.d.ts.map +1 -1
- package/dist/generators/reap.d.ts.map +1 -1
- package/dist/index.js +155 -29
- package/dist/index.js.map +1 -1
- package/dist/linter.d.ts.map +1 -1
- package/dist/results.d.ts +8 -0
- package/dist/results.d.ts.map +1 -1
- package/dist/sync-engine-init.d.ts +24 -2
- package/dist/sync-engine-init.d.ts.map +1 -1
- package/dist/sync-engine.d.ts +1 -0
- package/dist/sync-engine.d.ts.map +1 -1
- package/dist/templates/agents-md/files/AGENTS.md +7 -5
- package/dist/templates/bedrock-agentcore-runtime/files/.github/workflows/deploy-agentcore.yml +1 -1
- package/dist/templates/ci-github-actions/files/.github/workflows/ci.yml +3 -3
- package/dist/templates/ci-github-actions/files/.github/workflows/deploy-fly.yml +1 -1
- package/dist/templates/ci-github-actions/files/.github/workflows/deploy-railway.yml +1 -1
- package/dist/templates/ci-github-actions/files/.github/workflows/deploy-vercel.yml +2 -2
- package/dist/templates/ci-github-actions/files/.github/workflows/preview.yml +2 -2
- package/dist/templates/docker/files/.github/workflows/docker-build.yml +1 -1
- package/dist/templates/env-setup/files/.gitignore.hexagen +4 -3
- package/dist/templates/observability/files/.agents/logging.md +34 -0
- package/dist/templates/observability/manifest.json +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/arch/validate.ts"],"names":[],"mappings":"AAGA,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/arch/validate.ts"],"names":[],"mappings":"AAGA,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CA6BrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,iBAAiB,SAE7B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hexagen manifest migrate` (Wave-C PR-C1, RCA #6) — thin CLI plumbing
|
|
3
|
+
* around MigrateManifestUseCase: read `.architecture/manifest.yaml`, run the
|
|
4
|
+
* registry walk + stamp, report, write back (with a backup, mirroring
|
|
5
|
+
* `manifest split`'s `.pre-split-backup`). All migration semantics — and
|
|
6
|
+
* their tests — live in the use-case.
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from "commander";
|
|
9
|
+
export declare const manifestMigrateCommander: Command;
|
|
10
|
+
//# sourceMappingURL=migrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/commands/manifest/migrate.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,eAAO,MAAM,wBAAwB,SAuEjC,CAAC"}
|
|
@@ -4,6 +4,6 @@ declare const LAYER_RULES_MICRO_FRONTEND = "# HexaGen \u2014 Architectural Invar
|
|
|
4
4
|
declare const LAYER_RULES_DEFAULT = "# HexaGen \u2014 Architectural Invariants\n# Template: {template} (flexible mode)\n\nshared_kernel:\n package: \"@{scope}/shared\"\n allowed_in_all_layers: true\n\nlayers:\n domain:\n access_rule: \"internal-only\"\n allowed_imports: [\"@{scope}/shared\"]\n\n application:\n access_rule: \"ports-only\"\n allowed_imports: [\"domain\", \"@{scope}/shared\"]\n\n infrastructure:\n access_rule: \"adapters\"\n allowed_imports: [\"domain\", \"application\", \"@{scope}/shared\"]\n";
|
|
5
5
|
declare const LINTER_CONFIG_STRICT = "# Rules for @hexagen-monaco/arch-linter\n# Template: {template} (strict mode)\n\nglobal_whitelist:\n - \"@{scope}/shared\"\n - \"@{scope}/shared/**\"\n\ncross_context_rules:\n deny_sibling_imports: true\n require_port_interface: true\n\ntest_double_rules:\n allowed_cross_package_imports: true\n";
|
|
6
6
|
declare const LINTER_CONFIG_DEFAULT = "# Rules for @hexagen-monaco/arch-linter\n# Template: {template} (flexible mode)\n\nglobal_whitelist:\n - \"@{scope}/shared\"\n - \"@{scope}/shared/**\"\n\ntest_double_rules:\n allowed_cross_package_imports: true\n";
|
|
7
|
-
declare const GENERATOR_CONFIG_TEMPLATE = "generator:\n version: \"1.0\"\n description: \"Global invariants and safety rules\"\n
|
|
7
|
+
declare const GENERATOR_CONFIG_TEMPLATE = "generator:\n version: \"1.0\"\n description: \"Global invariants and safety rules\"\n workspaceTemplate: \"{workspaceTemplate}\"\n\n invariants:\n - name: composite-safety\n description: \"Every tsconfig.json must contain paths: {{}} to override inherited source mappings.\"\n priority: critical\n failure: abort-and-cleanup\n\n - name: barrel-ownership-boundary\n description: \"Barrels may only re-export types owned by the current bounded context.\"\n priority: critical\n failure: abort-and-cleanup\n\n - name: port-single-ownership\n description: \"Each port interface belongs to exactly one bounded context.\"\n priority: critical\n failure: abort-and-cleanup\n\n - name: dependency-consistency\n description: \"Every @{scope}/* import must have a matching entry in package.json.\"\n priority: high\n failure: abort\n\n - name: self-import-prevention\n description: \"No package imports itself by name.\"\n priority: high\n failure: abort\n\n - name: signature-synchronization\n description: \"Generated consumers must derive exact signatures from the canonical port.\"\n priority: high\n failure: abort\n\n - name: no-empty-stubs\n description: \"No empty barrels (export {{}}) in src/.\"\n priority: medium\n failure: warn-and-continue\n\n - name: exports-field-mandatory\n description: \"Every package.json must include a complete exports map.\"\n priority: medium\n failure: warn-and-continue\n\n - name: test-double-parity\n description: \"Test doubles must implement the same interface as the canonical port.\"\n priority: medium\n failure: warn-and-continue\n\n bootstrap-sequence:\n - load-ownership-map\n - validate-port-ownership-map\n - generate-package-skeleton\n - enforce-tsconfig-paths-override\n - generate-exports-field\n - synchronize-signatures\n - validate-barrel-chain\n - enforce-dependency-consistency\n - final-composite-reference-check\n\n failure-behavior:\n critical: abort-and-cleanup\n high: abort\n medium: warn-and-continue\n\n ownership-registry:\n ports:\n{ownershipBlock}\n";
|
|
8
8
|
export { LAYER_RULES_COMMON, LAYER_RULES_STRICT_ENTERPRISE, LAYER_RULES_MICRO_FRONTEND, LAYER_RULES_DEFAULT, LINTER_CONFIG_STRICT, LINTER_CONFIG_DEFAULT, GENERATOR_CONFIG_TEMPLATE, };
|
|
9
9
|
//# sourceMappingURL=architecture-file-templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"architecture-file-templates.d.ts","sourceRoot":"","sources":["../../src/generators/architecture-file-templates.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,kBAAkB,kaAgBvB,CAAC;AAEF,QAAA,MAAM,6BAA6B,4qBAUlC,CAAC;AAEF,QAAA,MAAM,0BAA0B,oqBAU/B,CAAC;AAEF,QAAA,MAAM,mBAAmB,ufAGH,CAAC;AAEvB,QAAA,MAAM,oBAAoB,iTAazB,CAAC;AAEF,QAAA,MAAM,qBAAqB,6NAS1B,CAAC;AAEF,QAAA,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"architecture-file-templates.d.ts","sourceRoot":"","sources":["../../src/generators/architecture-file-templates.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,kBAAkB,kaAgBvB,CAAC;AAEF,QAAA,MAAM,6BAA6B,4qBAUlC,CAAC;AAEF,QAAA,MAAM,0BAA0B,oqBAU/B,CAAC;AAEF,QAAA,MAAM,mBAAmB,ufAGH,CAAC;AAEvB,QAAA,MAAM,oBAAoB,iTAazB,CAAC;AAEF,QAAA,MAAM,qBAAqB,6NAS1B,CAAC;AAEF,QAAA,MAAM,yBAAyB,krEAsE9B,CAAC;AAEF,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,GAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"architecture-files.d.ts","sourceRoot":"","sources":["../../src/generators/architecture-files.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAgBvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"architecture-files.d.ts","sourceRoot":"","sources":["../../src/generators/architecture-files.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAgBvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAiPzD,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,UAAU,EAClB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,eAAe,CAAC,CAsF1B"}
|
|
@@ -6,8 +6,13 @@ interface LayerConfig {
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Ensures layer DIRECTORIES exist for a module (domain, application,
|
|
9
|
-
* infrastructure, plus configured subfolders)
|
|
10
|
-
*
|
|
9
|
+
* infrastructure, plus configured subfolders), and a `.gitkeep` in each LEAF
|
|
10
|
+
* directory so the scaffold survives a git checkout (see
|
|
11
|
+
* ensureGitkeepCounted). Leaf-only and config-derived: a configured dir with
|
|
12
|
+
* NO configured subfolders gets the keep; a parent layer dir is materialized
|
|
13
|
+
* transitively by its subfolders' keeps. Deriving leaves from the CONFIG
|
|
14
|
+
* (not from what's on disk) is what guarantees dry-run parity — an absent
|
|
15
|
+
* tree plans exactly the keeps a real run writes.
|
|
11
16
|
*
|
|
12
17
|
* Barrel single-ownership (PR-B2, the second half of RCA #5): this generator
|
|
13
18
|
* used to also write barrels — a naive re-export-everything index.ts per
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layer-folders.d.ts","sourceRoot":"","sources":["../../src/generators/layer-folders.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"layer-folders.d.ts","sourceRoot":"","sources":["../../src/generators/layer-folders.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAIvB,UAAU,WAAW;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAgJD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACnC,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,eAAe,CAAC,CA4E1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reap.d.ts","sourceRoot":"","sources":["../../src/generators/reap.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,UAAU,EAClB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"reap.d.ts","sourceRoot":"","sources":["../../src/generators/reap.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,UAAU,EAClB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,CAoDf"}
|
package/dist/index.js
CHANGED
|
@@ -244,7 +244,7 @@ async function runArchLinter(config) {
|
|
|
244
244
|
});
|
|
245
245
|
if (stdout) logger.info(stdout.trim());
|
|
246
246
|
if (stderr) logger.error(stderr.trim());
|
|
247
|
-
logger.info("✅ Architecture
|
|
247
|
+
logger.info("✅ Architecture check passed (arch-linter).");
|
|
248
248
|
} catch (error) {
|
|
249
249
|
const message = error instanceof Error && "stderr" in error && error.stderr || error instanceof Error && error.message || "Unknown linter error";
|
|
250
250
|
logger.error(`Architectural Integrity Check Failed:
|
|
@@ -459,6 +459,33 @@ async function ensureDirectoryCounted(dirPath, config, result) {
|
|
|
459
459
|
result.created.push(dirPath);
|
|
460
460
|
result.totalOps += 1;
|
|
461
461
|
}
|
|
462
|
+
async function ensureGitkeepCounted(dirPath, config, result) {
|
|
463
|
+
const keepPath = path7.join(dirPath, ".gitkeep");
|
|
464
|
+
let entries = null;
|
|
465
|
+
if (await directoryExists(dirPath)) {
|
|
466
|
+
entries = await fs5.readdir(dirPath);
|
|
467
|
+
}
|
|
468
|
+
if (entries !== null) {
|
|
469
|
+
const keepIsOnlyEntry = entries.length === 1 && entries[0] === ".gitkeep";
|
|
470
|
+
if (entries.length > 0 && !keepIsOnlyEntry) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
if (keepIsOnlyEntry) {
|
|
474
|
+
const existing = await fs5.readFile(keepPath, "utf8").catch(() => null);
|
|
475
|
+
if (existing !== null && existing !== "") {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
const status = await safeWriteFileAtomic(
|
|
481
|
+
keepPath,
|
|
482
|
+
"",
|
|
483
|
+
config,
|
|
484
|
+
void 0,
|
|
485
|
+
true
|
|
486
|
+
);
|
|
487
|
+
recordWriteStatus(result, keepPath, status);
|
|
488
|
+
}
|
|
462
489
|
async function loadYamlSafe(filePath) {
|
|
463
490
|
try {
|
|
464
491
|
const content = await fs5.readFile(filePath, "utf8");
|
|
@@ -490,12 +517,16 @@ async function ensureLayerFolders(moduleDir, layers, config) {
|
|
|
490
517
|
}
|
|
491
518
|
await ensureDirectoryCounted(layerPath, config, result);
|
|
492
519
|
const subfolders = layerConfig.subfolders ?? [];
|
|
520
|
+
if (subfolders.length === 0) {
|
|
521
|
+
await ensureGitkeepCounted(layerPath, config, result);
|
|
522
|
+
}
|
|
493
523
|
for (const sub of subfolders) {
|
|
494
524
|
const subPath = path7.join(layerPath, sub);
|
|
495
525
|
if (!isInScope(subPath, config) && !isInScope(path7.join(subPath, "index.ts"), config)) {
|
|
496
526
|
continue;
|
|
497
527
|
}
|
|
498
528
|
await ensureDirectoryCounted(subPath, config, result);
|
|
529
|
+
await ensureGitkeepCounted(subPath, config, result);
|
|
499
530
|
}
|
|
500
531
|
}
|
|
501
532
|
return result;
|
|
@@ -5305,7 +5336,7 @@ function assertValidToolchainVersion(version, source) {
|
|
|
5305
5336
|
function resolveToolchainVersion() {
|
|
5306
5337
|
{
|
|
5307
5338
|
return assertValidToolchainVersion(
|
|
5308
|
-
"0.
|
|
5339
|
+
"0.8.0",
|
|
5309
5340
|
"build-injected __HEXAGEN_TOOLCHAIN_VERSION__"
|
|
5310
5341
|
);
|
|
5311
5342
|
}
|
|
@@ -5518,7 +5549,7 @@ test_double_rules:
|
|
|
5518
5549
|
var GENERATOR_CONFIG_TEMPLATE = `generator:
|
|
5519
5550
|
version: "1.0"
|
|
5520
5551
|
description: "Global invariants and safety rules"
|
|
5521
|
-
|
|
5552
|
+
workspaceTemplate: "{workspaceTemplate}"
|
|
5522
5553
|
|
|
5523
5554
|
invariants:
|
|
5524
5555
|
- name: composite-safety
|
|
@@ -5599,37 +5630,65 @@ function resolveWorkspaceTemplate2(manifest) {
|
|
|
5599
5630
|
function toPascalCase(stem) {
|
|
5600
5631
|
return stem.split(/[-.]/).filter((part) => part.length > 0).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
5601
5632
|
}
|
|
5633
|
+
function yamlScalar(value) {
|
|
5634
|
+
const plainSafe = /^[A-Za-z][A-Za-z0-9._-]*$/.test(value);
|
|
5635
|
+
const reserved = /^(?:true|false|null|yes|no|on|off)$/i.test(value);
|
|
5636
|
+
return plainSafe && !reserved ? value : JSON.stringify(value);
|
|
5637
|
+
}
|
|
5602
5638
|
function buildOwnershipBlock(manifest) {
|
|
5603
5639
|
const contexts = manifest.bounded_contexts ?? [];
|
|
5604
5640
|
const entries = [];
|
|
5641
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5642
|
+
const owners = /* @__PURE__ */ new Map();
|
|
5643
|
+
const add = (name, context) => {
|
|
5644
|
+
const key = JSON.stringify([name, context]);
|
|
5645
|
+
if (seen.has(key)) return;
|
|
5646
|
+
seen.add(key);
|
|
5647
|
+
entries.push({ name, context });
|
|
5648
|
+
let contextsForName = owners.get(name);
|
|
5649
|
+
if (!contextsForName) {
|
|
5650
|
+
contextsForName = /* @__PURE__ */ new Set();
|
|
5651
|
+
owners.set(name, contextsForName);
|
|
5652
|
+
}
|
|
5653
|
+
contextsForName.add(context);
|
|
5654
|
+
};
|
|
5605
5655
|
for (const bc of contexts) {
|
|
5606
5656
|
if (bc.name === "shared") continue;
|
|
5607
5657
|
const application = bc.layers?.application;
|
|
5608
5658
|
const infrastructure = bc.layers?.infrastructure;
|
|
5609
5659
|
for (const p of application?.ports?.in ?? []) {
|
|
5610
|
-
|
|
5611
|
-
entries.push(` ${name}: ${bc.name}`);
|
|
5660
|
+
add(toPascalCase(portName(p).replace(/\.in-port\.ts$/, "")), bc.name);
|
|
5612
5661
|
}
|
|
5613
5662
|
for (const p of application?.ports?.out ?? []) {
|
|
5614
|
-
|
|
5615
|
-
entries.push(` ${name}: ${bc.name}`);
|
|
5663
|
+
add(toPascalCase(portName(p).replace(/\.out-port\.ts$/, "")), bc.name);
|
|
5616
5664
|
}
|
|
5617
5665
|
for (const a of infrastructure?.adapters ?? []) {
|
|
5618
|
-
|
|
5619
|
-
entries.push(` ${name}: ${bc.name}`);
|
|
5666
|
+
add(toPascalCase(a.replace(/\.adapter\.ts$/, "")), bc.name);
|
|
5620
5667
|
}
|
|
5621
5668
|
}
|
|
5622
|
-
|
|
5669
|
+
const collisions = [...owners.entries()].filter(([, contextsForName]) => contextsForName.size > 1).map(([name]) => name);
|
|
5670
|
+
const contested = new Set(collisions);
|
|
5671
|
+
const lines = entries.map(
|
|
5672
|
+
({ name, context }) => contested.has(name) ? ` ${JSON.stringify(`${context}.${name}`)}: ${yamlScalar(context)}` : ` ${name}: ${yamlScalar(context)}`
|
|
5673
|
+
);
|
|
5674
|
+
return {
|
|
5675
|
+
block: lines.length > 0 ? lines.join("\n") : " # No ports declared",
|
|
5676
|
+
collisions
|
|
5677
|
+
};
|
|
5623
5678
|
}
|
|
5624
5679
|
function buildInterpolationVars(manifest) {
|
|
5625
5680
|
const scope = resolveScope(manifest);
|
|
5626
5681
|
const workspaceTemplate = resolveWorkspaceTemplate2(manifest);
|
|
5682
|
+
const { block, collisions } = buildOwnershipBlock(manifest);
|
|
5627
5683
|
return {
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5684
|
+
vars: {
|
|
5685
|
+
scope,
|
|
5686
|
+
template: workspaceTemplate,
|
|
5687
|
+
workspaceTemplate,
|
|
5688
|
+
system: typeof manifest.system === "string" ? manifest.system : "",
|
|
5689
|
+
ownershipBlock: block
|
|
5690
|
+
},
|
|
5691
|
+
ownershipCollisions: collisions
|
|
5633
5692
|
};
|
|
5634
5693
|
}
|
|
5635
5694
|
function builtInLayerRules(workspaceTemplate) {
|
|
@@ -5709,8 +5768,13 @@ async function generateArchitectureFiles(config, report) {
|
|
|
5709
5768
|
const manifest = config.manifest;
|
|
5710
5769
|
const archRoot = path7.join(config.workspaceRoot, ".architecture");
|
|
5711
5770
|
const archInvariants = manifest.monorepo?.archInvariants;
|
|
5712
|
-
const vars = buildInterpolationVars(manifest);
|
|
5771
|
+
const { vars, ownershipCollisions } = buildInterpolationVars(manifest);
|
|
5713
5772
|
const workspaceTemplate = vars.workspaceTemplate ?? "modular-monolith";
|
|
5773
|
+
if (ownershipCollisions.length > 0) {
|
|
5774
|
+
config.logger.warn(
|
|
5775
|
+
`architecture-files: ownership-registry name collision${ownershipCollisions.length === 1 ? "" : "s"} — ${ownershipCollisions.join(", ")} declared by more than one context; emitted with context-qualified keys (the port-single-ownership invariant expects exactly one owner).`
|
|
5776
|
+
);
|
|
5777
|
+
}
|
|
5714
5778
|
await writeManifestIfFreshExternal(config, result, report);
|
|
5715
5779
|
const layerRulesPath = path7.join(archRoot, "invariants", "layer-rules.yaml");
|
|
5716
5780
|
const layerRulesTemplate = resolveTemplate2(
|
|
@@ -7650,6 +7714,10 @@ var AppSchema = external_exports.object({
|
|
|
7650
7714
|
depends_on: external_exports.array(external_exports.string()).optional()
|
|
7651
7715
|
}).strip();
|
|
7652
7716
|
var IndexManifestSchema = external_exports.object({
|
|
7717
|
+
// Toolchain-compatibility stamp (see manifest-schema-version.ts). Note
|
|
7718
|
+
// `version` below is a DIFFERENT field — its `"2.0"` string is the
|
|
7719
|
+
// index-form discriminator (`isIndexManifest`), not a compatibility gate.
|
|
7720
|
+
schemaVersion: external_exports.number().int().positive().optional(),
|
|
7653
7721
|
version: external_exports.string().optional(),
|
|
7654
7722
|
description: external_exports.string(),
|
|
7655
7723
|
system: external_exports.string().optional(),
|
|
@@ -7700,6 +7768,12 @@ var CrossContextEdgeSchema = external_exports.object({
|
|
|
7700
7768
|
integrationPattern: external_exports.enum(["open-host", "acl"]).optional()
|
|
7701
7769
|
});
|
|
7702
7770
|
var ManifestSchema = external_exports.object({
|
|
7771
|
+
// Toolchain-compatibility stamp (positive int; absent = legacy). NOT the
|
|
7772
|
+
// freeform `version` string below. Compatibility is asserted against the
|
|
7773
|
+
// RAW yaml BEFORE this `.strict()` parse (assertSupportedSchemaVersion in
|
|
7774
|
+
// manifest-schema-version.ts) — this entry only keeps strict mode from
|
|
7775
|
+
// rejecting stamped manifests as carrying an unknown key.
|
|
7776
|
+
schemaVersion: external_exports.number().int().positive().optional(),
|
|
7703
7777
|
version: external_exports.string().optional(),
|
|
7704
7778
|
description: external_exports.string().optional(),
|
|
7705
7779
|
system: external_exports.string().optional(),
|
|
@@ -7735,6 +7809,28 @@ var ManifestSchema = external_exports.object({
|
|
|
7735
7809
|
legacy_config: external_exports.string().optional()
|
|
7736
7810
|
}).strict();
|
|
7737
7811
|
|
|
7812
|
+
// ../project-configuration/dist/domain/model/manifest-schema/manifest-schema-version.js
|
|
7813
|
+
var CURRENT_MANIFEST_SCHEMA_VERSION = 1;
|
|
7814
|
+
function readManifestSchemaVersion(parsed) {
|
|
7815
|
+
if (parsed === null || typeof parsed !== "object")
|
|
7816
|
+
return void 0;
|
|
7817
|
+
const raw = parsed.schemaVersion;
|
|
7818
|
+
if (raw === void 0)
|
|
7819
|
+
return void 0;
|
|
7820
|
+
if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 1) {
|
|
7821
|
+
throw new Error(`Invalid manifest schemaVersion: expected a positive integer, got ${JSON.stringify(raw)}.`);
|
|
7822
|
+
}
|
|
7823
|
+
return raw;
|
|
7824
|
+
}
|
|
7825
|
+
function assertSupportedSchemaVersion(parsed) {
|
|
7826
|
+
const version = readManifestSchemaVersion(parsed);
|
|
7827
|
+
if (version === void 0)
|
|
7828
|
+
return;
|
|
7829
|
+
if (version > CURRENT_MANIFEST_SCHEMA_VERSION) {
|
|
7830
|
+
throw new Error(`Manifest schemaVersion ${version} is newer than this toolchain supports (reads ≤ ${CURRENT_MANIFEST_SCHEMA_VERSION}). This manifest requires a newer @hexagen-monaco/sync — upgrade it. (Upgrading is always safe: a newer toolchain reads every older manifest, and \`hexagen manifest migrate\` brings one forward on demand.)`);
|
|
7831
|
+
}
|
|
7832
|
+
}
|
|
7833
|
+
|
|
7738
7834
|
// ../project-configuration/dist/domain/model/manifest-schema/is-index-manifest.js
|
|
7739
7835
|
function isIndexManifest(parsed) {
|
|
7740
7836
|
if (typeof parsed !== "object" || parsed === null) {
|
|
@@ -7929,6 +8025,7 @@ async function mergeSplitManifest(workspaceRoot, manifestPath) {
|
|
|
7929
8025
|
if (parsed == null) {
|
|
7930
8026
|
throw new Error("Manifest file is empty");
|
|
7931
8027
|
}
|
|
8028
|
+
assertSupportedSchemaVersion(parsed);
|
|
7932
8029
|
if (!isIndexManifest(parsed)) {
|
|
7933
8030
|
const manifestData = {
|
|
7934
8031
|
...parsed,
|
|
@@ -7943,6 +8040,9 @@ async function mergeSplitManifest(workspaceRoot, manifestPath) {
|
|
|
7943
8040
|
}
|
|
7944
8041
|
const index = indexResult.data;
|
|
7945
8042
|
const result = {
|
|
8043
|
+
// Carry the (already-validated) stamp into the merged form so consumers
|
|
8044
|
+
// of the merge see the same version the root file declares.
|
|
8045
|
+
schemaVersion: index.schemaVersion,
|
|
7946
8046
|
description: index.description ?? "Auto-generated manifest",
|
|
7947
8047
|
system: index.system,
|
|
7948
8048
|
scope: index.scope,
|
|
@@ -8015,30 +8115,48 @@ async function mergeSplitManifest(workspaceRoot, manifestPath) {
|
|
|
8015
8115
|
// src/sync-engine-init.ts
|
|
8016
8116
|
var __filename$1 = fileURLToPath(import.meta.url);
|
|
8017
8117
|
var __dirname$1 = path7.dirname(__filename$1);
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
let currentDir =
|
|
8118
|
+
function isENOENT(err3) {
|
|
8119
|
+
return err3 instanceof Error && "code" in err3 && err3.code === "ENOENT";
|
|
8120
|
+
}
|
|
8121
|
+
async function findRootFrom(startDir, problems) {
|
|
8122
|
+
let currentDir = startDir;
|
|
8023
8123
|
while (currentDir !== path7.parse(currentDir).root) {
|
|
8124
|
+
const pkgPath = path7.join(currentDir, "package.json");
|
|
8024
8125
|
try {
|
|
8025
|
-
const pkgPath = path7.join(currentDir, "package.json");
|
|
8026
8126
|
const pkgContent = await fs5.readFile(pkgPath, "utf-8");
|
|
8027
8127
|
const pkg = JSON.parse(pkgContent);
|
|
8028
8128
|
if (pkg.workspaces && Array.isArray(pkg.workspaces)) {
|
|
8029
8129
|
return currentDir;
|
|
8030
8130
|
}
|
|
8031
|
-
} catch {
|
|
8131
|
+
} catch (err3) {
|
|
8132
|
+
if (!isENOENT(err3)) {
|
|
8133
|
+
const reason = err3 instanceof Error ? err3.message : String(err3);
|
|
8134
|
+
problems.push(new Error(`${pkgPath}: ${reason}`));
|
|
8135
|
+
}
|
|
8032
8136
|
}
|
|
8033
8137
|
currentDir = path7.dirname(currentDir);
|
|
8034
8138
|
}
|
|
8139
|
+
return null;
|
|
8140
|
+
}
|
|
8141
|
+
async function findWorkspaceRoot(options, probeStarts = [process.cwd(), __dirname$1]) {
|
|
8142
|
+
if (options.targetRoot) {
|
|
8143
|
+
return options.targetRoot;
|
|
8144
|
+
}
|
|
8145
|
+
const problems = [];
|
|
8146
|
+
for (const start of probeStarts) {
|
|
8147
|
+
const root = await findRootFrom(start, problems);
|
|
8148
|
+
if (root !== null) {
|
|
8149
|
+
return root;
|
|
8150
|
+
}
|
|
8151
|
+
}
|
|
8152
|
+
const detail = problems.length > 0 ? ` A package.json was found but could not be read or parsed: ${problems[0].message}.` : "";
|
|
8035
8153
|
throw new Error(
|
|
8036
|
-
|
|
8154
|
+
`Could not locate monorepo root: no package.json with a "workspaces" array found walking up from ${probeStarts.join(" or ")}.${detail} Run the command from inside your workspace (any subdirectory works), and check that the root package.json declares "workspaces". Note: a globally- or npx-installed CLI can only resolve the root from your current directory.`
|
|
8037
8155
|
);
|
|
8038
8156
|
}
|
|
8039
8157
|
async function loadManifest(workspaceRoot, flags, options) {
|
|
8040
8158
|
if (options.manifest) {
|
|
8041
|
-
return options.manifest;
|
|
8159
|
+
return { manifest: options.manifest, manifestMissing: false };
|
|
8042
8160
|
}
|
|
8043
8161
|
const { logger, dryRun } = flags;
|
|
8044
8162
|
const manifestPath = path7.join(workspaceRoot, ".architecture/manifest.yaml");
|
|
@@ -8051,11 +8169,14 @@ async function loadManifest(workspaceRoot, flags, options) {
|
|
|
8051
8169
|
manifestPath
|
|
8052
8170
|
);
|
|
8053
8171
|
logger.info(`Loaded manifest from ${manifestPath}`);
|
|
8054
|
-
return manifest;
|
|
8172
|
+
return { manifest, manifestMissing: false };
|
|
8055
8173
|
} catch (err3) {
|
|
8056
|
-
if (err3
|
|
8174
|
+
if (isENOENT(err3) && dryRun) {
|
|
8057
8175
|
logger.warn(`Manifest not found — using empty for dry-run`);
|
|
8058
|
-
return {
|
|
8176
|
+
return {
|
|
8177
|
+
manifest: { description: "Empty manifest", bounded_contexts: [] },
|
|
8178
|
+
manifestMissing: true
|
|
8179
|
+
};
|
|
8059
8180
|
}
|
|
8060
8181
|
const message = err3 instanceof Error ? err3.message : "Unknown parse error";
|
|
8061
8182
|
throw new Error(`Failed to parse manifest: ${message}`);
|
|
@@ -8115,6 +8236,7 @@ var SyncEngine = class {
|
|
|
8115
8236
|
partialConfig;
|
|
8116
8237
|
fullConfig = null;
|
|
8117
8238
|
manifest = {};
|
|
8239
|
+
manifestMissing = false;
|
|
8118
8240
|
workspaceRoot = "";
|
|
8119
8241
|
options;
|
|
8120
8242
|
constructor(flags, options) {
|
|
@@ -8249,6 +8371,7 @@ var SyncEngine = class {
|
|
|
8249
8371
|
let lockFile = null;
|
|
8250
8372
|
this.journal = new SyncJournal();
|
|
8251
8373
|
this.failures = [];
|
|
8374
|
+
this.manifestMissing = false;
|
|
8252
8375
|
logger.info(
|
|
8253
8376
|
dryRun ? "[DRY-RUN MODE] Starting sync..." : "Starting sync..."
|
|
8254
8377
|
);
|
|
@@ -8288,11 +8411,13 @@ var SyncEngine = class {
|
|
|
8288
8411
|
try {
|
|
8289
8412
|
const initOptions = this.getInitOptions();
|
|
8290
8413
|
this.workspaceRoot = await findWorkspaceRoot(initOptions);
|
|
8291
|
-
|
|
8414
|
+
const loaded = await loadManifest(
|
|
8292
8415
|
this.workspaceRoot,
|
|
8293
8416
|
this.partialConfig,
|
|
8294
8417
|
initOptions
|
|
8295
8418
|
);
|
|
8419
|
+
this.manifest = loaded.manifest;
|
|
8420
|
+
this.manifestMissing = loaded.manifestMissing;
|
|
8296
8421
|
validateManifest(this.manifest, this.partialConfig);
|
|
8297
8422
|
this.fullConfig = {
|
|
8298
8423
|
...this.partialConfig,
|
|
@@ -8385,6 +8510,7 @@ var SyncEngine = class {
|
|
|
8385
8510
|
skipped: 0,
|
|
8386
8511
|
totalOps: 0,
|
|
8387
8512
|
errors: this.failures.length,
|
|
8513
|
+
manifestMissing: this.manifestMissing,
|
|
8388
8514
|
durationMs: 0
|
|
8389
8515
|
};
|
|
8390
8516
|
for (const [, r] of rows) {
|