@hexagen-monaco/sync 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/LICENSE +8 -5
  2. package/README.md +2 -2
  3. package/dist/application/ports/out/file-system.port.d.ts.map +1 -1
  4. package/dist/application/ports/out/symbol-reference-index.port.d.ts +9 -9
  5. package/dist/application/ports/out/symbol-reference-index.port.d.ts.map +1 -1
  6. package/dist/application/use-cases/migrate-manifest.use-case.d.ts +4 -1
  7. package/dist/application/use-cases/migrate-manifest.use-case.d.ts.map +1 -1
  8. package/dist/application/use-cases/refactoring-impact.use-case.d.ts +6 -5
  9. package/dist/application/use-cases/refactoring-impact.use-case.d.ts.map +1 -1
  10. package/dist/cli.js +891 -323
  11. package/dist/cli.js.map +1 -1
  12. package/dist/commands/adopt/index.d.ts.map +1 -1
  13. package/dist/commands/bootstrap/index.d.ts +21 -0
  14. package/dist/commands/bootstrap/index.d.ts.map +1 -1
  15. package/dist/commands/manifest/migrate.d.ts.map +1 -1
  16. package/dist/commands/scan/index.d.ts +185 -0
  17. package/dist/commands/scan/index.d.ts.map +1 -0
  18. package/dist/commands/shared/index.d.ts +1 -0
  19. package/dist/commands/shared/index.d.ts.map +1 -1
  20. package/dist/commands/shared/lstat-exists.d.ts +7 -0
  21. package/dist/commands/shared/lstat-exists.d.ts.map +1 -0
  22. package/dist/domain/services/impact-request-validator.d.ts.map +1 -1
  23. package/dist/domain/services/layer-dir-resolver.d.ts +20 -1
  24. package/dist/domain/services/layer-dir-resolver.d.ts.map +1 -1
  25. package/dist/generators/layer-folders.d.ts +9 -1
  26. package/dist/generators/layer-folders.d.ts.map +1 -1
  27. package/dist/generators/package-src-index.d.ts +5 -0
  28. package/dist/generators/package-src-index.d.ts.map +1 -0
  29. package/dist/index.js +106 -11
  30. package/dist/index.js.map +1 -1
  31. package/dist/infrastructure/adapters/atomic-file-system.adapter.d.ts.map +1 -1
  32. package/dist/infrastructure/adapters/file-system-workspace.adapter.d.ts.map +1 -1
  33. package/dist/infrastructure/adapters/ts-morph-symbol-index.adapter.d.ts +1 -1
  34. package/dist/infrastructure/adapters/ts-morph-symbol-index.adapter.d.ts.map +1 -1
  35. package/dist/sync-engine.d.ts.map +1 -1
  36. package/dist/types/index.d.ts +20 -1
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/dist/commands/bootstrap.d.ts +0 -30
  40. package/dist/commands/bootstrap.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/adopt/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAG9D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAqBD,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAoErC;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBhB;AAED,eAAO,MAAM,cAAc,SAsBxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/adopt/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAI9D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAqBD,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAiErC;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBhB;AAED,eAAO,MAAM,cAAc,SAsBxB,CAAC"}
@@ -1,3 +1,12 @@
1
+ /**
2
+ * `hexagen bootstrap` is ratification-driven. It writes a starting
3
+ * `manifest.yaml` + `layout.yaml` + empty baseline from questions, `--yes`,
4
+ * `--answers`, or `--stdin-json`. It does **not** scan the TypeScript import
5
+ * graph and does **not** auto-fill `depends_on`. Callers who need declared
6
+ * edges must supply `contexts[].dependsOn` in an answers file. The retired
7
+ * Phase-0 module (`commands/bootstrap.ts`) inferred edges via ts-morph; that
8
+ * path is gone on purpose, not silently.
9
+ */
1
10
  import { Command } from "commander";
2
11
  import { type Result } from "../../domain/result.js";
3
12
  export interface BootstrapContextAnswer {
@@ -22,11 +31,23 @@ export interface BootstrapOptions {
22
31
  llm?: boolean;
23
32
  dryRun?: boolean;
24
33
  force?: boolean;
34
+ /**
35
+ * When true, do not write `layout.yaml` and do not treat an existing layout
36
+ * as a blocker. Used by `hexagen scan`, which owns layout via adopt.
37
+ */
38
+ skipLayout?: boolean;
25
39
  }
26
40
  export interface BootstrapResult {
27
41
  files: string[];
28
42
  wrote: boolean;
29
43
  }
44
+ /** ts-morph globs reject native Windows separators. Folded from the retired Phase-0 module. */
45
+ export declare function toTsMorphGlob(absPath: string): string;
46
+ export declare function resolveWorkspaceSpecifier(specifier: string, packageNames: Iterable<string>): string | undefined;
47
+ export declare function deriveSystemAndScope(pkgName: string | undefined): {
48
+ system: string;
49
+ scope: string;
50
+ };
30
51
  export declare function runBootstrap(options: BootstrapOptions): Promise<Result<BootstrapResult, Error>>;
31
52
  export declare function bootstrapCommand(options: {
32
53
  root?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/bootstrap/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAI9D,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,M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AAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BhB;AAED,eAAO,MAAM,kBAAkB,SA0B5B,CAAC"}
@@ -1 +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"}
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;AAOpC,eAAO,MAAM,wBAAwB,SAyEjC,CAAC"}
@@ -0,0 +1,185 @@
1
+ import { Command } from "commander";
2
+ import { type Result } from "../../domain/result.js";
3
+ import type { DriftSummary } from "../report/types.js";
4
+ /**
5
+ * Findings carried by the scan envelope.
6
+ *
7
+ * Deliberately an ALIAS of the report package's `DriftSummary` rather than a
8
+ * fresh interface: `parseLintJson` (commands/report/lint-collect.ts) is this
9
+ * repo's one reader of the `hexagen-lint --json` contract and already produces
10
+ * exactly this shape. A second shape here would make two producers of one
11
+ * contract -- the drift that kept `reportMarkdown` null for a release.
12
+ *
13
+ * `collected: false` (always with a `failureReason`) is how "the findings
14
+ * could not be read" is stated. Four empty arrays with `collected: true` mean
15
+ * a genuinely clean tree. The two must never be collapsed: that is the same
16
+ * "reported success while producing nothing" defect this command has already
17
+ * been fixed for twice.
18
+ */
19
+ export type ScanFindings = DriftSummary;
20
+ /**
21
+ * What the lint seam reports back: the exit code that drives the scan's own
22
+ * exit status, plus the findings read from `hexagen-lint --json`.
23
+ *
24
+ * A bare `number` remains accepted by {@link ScanLintRunner} so callers and
25
+ * injected test doubles written against the pre-BF-0.3 seam keep compiling.
26
+ * Such a runner is normalised to `collected: false`, never to an empty-but-
27
+ * clean summary -- it genuinely reported no findings either way.
28
+ */
29
+ export interface ScanLintOutcome {
30
+ exitCode: number;
31
+ findings: ScanFindings;
32
+ /**
33
+ * Files the linter actually walked, read from its `--json` payload.
34
+ *
35
+ * Null when the linter could not run or its output could not be parsed --
36
+ * never a silent 0, which would read as "scanned nothing and passed", the
37
+ * exact false-green this codebase's abortIfVacuous exists to prevent.
38
+ */
39
+ filesScanned: number | null;
40
+ }
41
+ export interface ScanLintRunner {
42
+ (root: string): number | ScanLintOutcome | Promise<number | ScanLintOutcome>;
43
+ }
44
+ export interface ScanReportRunner {
45
+ (options: {
46
+ cwd: string;
47
+ format?: "html" | "md" | "both";
48
+ handoff?: boolean;
49
+ handoffOut?: string;
50
+ }): Promise<{
51
+ markdownPath: string;
52
+ htmlPath: string;
53
+ handoffPath?: string;
54
+ }>;
55
+ }
56
+ export interface ScanOptions {
57
+ root: string;
58
+ yes?: boolean;
59
+ dryRun?: boolean;
60
+ force?: boolean;
61
+ skipBootstrap?: boolean;
62
+ noReport?: boolean;
63
+ /**
64
+ * Also write the Tier-A handoff zip (`hexagen-handoff.zip`).
65
+ *
66
+ * Not a second implementation: it forwards to `reportCommand`, which already
67
+ * owns `buildHandoffZip` and therefore owns the entry names the web ingest
68
+ * route matches on. Duplicating the packing here is exactly the drift that
69
+ * made `reportMarkdown` always null before.
70
+ */
71
+ handoff?: boolean;
72
+ /** Handoff zip path. Relative paths resolve against `root`. */
73
+ handoffOut?: string;
74
+ /** Test / composition seam. Defaults to spawning hexagen-lint --root. */
75
+ lint?: ScanLintRunner;
76
+ /** Test / composition seam. Defaults to reportCommand. */
77
+ report?: ScanReportRunner;
78
+ }
79
+ export interface ScanResult {
80
+ layoutPath: string;
81
+ manifestPath: string;
82
+ wrote: boolean;
83
+ lintExitCode: number;
84
+ reportPaths: string[];
85
+ /**
86
+ * Absolute path of the handoff zip, present only when `--handoff` was asked
87
+ * for and the report actually ran. Kept OUT of `reportPaths`: that list is
88
+ * consumed as "the report documents" (`.md`/`.html`), and a zip in it would
89
+ * be read as one.
90
+ */
91
+ handoffPath?: string;
92
+ nextSteps: string[];
93
+ /**
94
+ * Machine-readable summary for non-human consumers (the web scan adapter).
95
+ *
96
+ * Emitted by `scanCommand` as the FINAL stdout line, after the human
97
+ * `nextSteps`. That placement is the repo's existing convention for mixing
98
+ * both on one stream -- `parseLintJson` reads `hexagen-lint --json` the same
99
+ * way, taking the last trimmed line that starts with `{`.
100
+ */
101
+ envelope: ScanEnvelopePayload;
102
+ }
103
+ /**
104
+ * The scan envelope. Field names are the contract the web adapter already
105
+ * parses; `schemaVersion` comes from @hexagen/shared so producer and consumer
106
+ * cannot drift on it independently.
107
+ */
108
+ export interface ScanEnvelopePayload {
109
+ schemaVersion: string;
110
+ layout: string | null;
111
+ /**
112
+ * The count of files the linter walked, or null when it could not run.
113
+ *
114
+ * The history matters, because the obvious reading of the CLI is wrong:
115
+ * `hexagen-lint` prints `Files scanned: N` through `logger.info`, and its
116
+ * logger is built as `createConsoleLogger(process.argv.includes("--json"))`
117
+ * -- i.e. `--json` makes it QUIET. So the findings and the count are not
118
+ * both obtainable from one linter run. Verified against the built linter
119
+ * both ways: with `--json`, stdout is exactly one line (the findings JSON)
120
+ * and the count appears nowhere; without it, `Files scanned: 1946` is on
121
+ * stdout and there is no JSON at all.
122
+ *
123
+ * RESOLVED: `tools/arch-linter/src/cli.ts` now carries `filesScanned` in
124
+ * the `--json` payload, so a single `--json` run yields both the findings
125
+ * and the count. Left null only when the linter could not run or its
126
+ * output could not be parsed -- never as a silent default.
127
+ */
128
+ filesScanned: number | null;
129
+ reportMarkdown: string | null;
130
+ error: string | null;
131
+ /**
132
+ * Findings from `hexagen-lint --json`, always present.
133
+ *
134
+ * Additive: the shared `ScanEnvelope` schema is `.passthrough()`, so an
135
+ * older consumer preserves this field without understanding it and no schema
136
+ * version bump is needed.
137
+ *
138
+ * The linter also emits `introduced` and `baselineGrowth`; both are
139
+ * deliberately dropped. They are populated only under `--pr-diff`, which
140
+ * requires a base branch to diff against -- an imported brownfield tree has
141
+ * none, so carrying them would ship two permanently empty arrays that read
142
+ * as "nothing was introduced" rather than "the question does not apply".
143
+ */
144
+ findings: ScanFindings;
145
+ }
146
+ export declare function collectFilesScanned(stdout: string): number | null;
147
+ export declare function collectLintFindings(stdout: string): ScanFindings;
148
+ /**
149
+ * Spawn the installed `hexagen-lint` bin against `root` and return both its
150
+ * exit code and its findings. Missing bin, spawn failure, signal-kill, timeout
151
+ * and an over-long output are all "could not run" (exit 2) — never a silent
152
+ * pass. Vacuous scans reuse the linter's own exit 2.
153
+ *
154
+ * `--json` is what makes the findings readable at all, and it is why stdout is
155
+ * PIPED where it used to be inherited. Two consequences worth stating:
156
+ *
157
+ * - stderr stays INHERITED, so the user still sees the violation text live in
158
+ * their terminal: every violation line is `logger.error`, i.e. stderr.
159
+ * - the linter's console logger is constructed quiet under `--json`, so its
160
+ * informational stdout (including `Files scanned: N`) is not emitted at all.
161
+ * That is why the count needed the linter change this packet makes; see
162
+ * `ScanEnvelopePayload.filesScanned`.
163
+ *
164
+ * Capturing stdout also keeps the linter's JSON line OFF the scan's own
165
+ * stdout, where a stray `{`-line would compete with the envelope the web
166
+ * adapter reads as "the last line starting with `{`".
167
+ *
168
+ * Posix-only (no shell). A Windows `.cmd` shim is not launched; `shell: true`
169
+ * would reintroduce the quoting bug other execFile call sites exist to avoid.
170
+ * CI is Ubuntu — win32 is unsupported here rather than half-supported.
171
+ */
172
+ export declare function invokeHexagenLint(root: string): ScanLintOutcome;
173
+ export declare function runScan(options: ScanOptions): Promise<Result<ScanResult, Error>>;
174
+ export declare function scanCommand(options: {
175
+ root?: string;
176
+ yes?: boolean;
177
+ dryRun?: boolean;
178
+ force?: boolean;
179
+ skipBootstrap?: boolean;
180
+ noReport?: boolean;
181
+ handoff?: boolean;
182
+ handoffOut?: string;
183
+ }): Promise<void>;
184
+ export declare const scanCommander: Command;
185
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/scan/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAQ9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;IACvB;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,eAAe,GAAG,OAAO,CAAC,MAAM,GAAG,eAAe,CAAC,CAAC;CAC9E;AAED,MAAM,WAAW,gBAAgB;IAC/B,CAAC,OAAO,EAAE;QACR,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;QAChC,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC;QACV,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAA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AAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAgF/D;AA2DD,wBAAsB,OAAO,CAC3B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CA4LpC;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkDhB;AAED,eAAO,MAAM,aAAa,SA8CvB,CAAC"}
@@ -12,4 +12,5 @@ export { confirm } from "./confirm.js";
12
12
  export * from "./validation.js";
13
13
  export * from "./error-formatter.js";
14
14
  export { resolveTemplatesDir } from "./template-engine-path.js";
15
+ export { lstatExists } from "./lstat-exists.js";
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,cAAc,EACd,eAAe,EACf,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,cAAc,EACd,eAAe,EACf,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type Result } from "../../domain/result.js";
2
+ /**
3
+ * Existence via lstat: a dangling or live symlink is present.
4
+ * Only ENOENT is absence; EACCES and other errors propagate.
5
+ */
6
+ export declare function lstatExists(target: string): Promise<Result<boolean, Error>>;
7
+ //# sourceMappingURL=lstat-exists.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lstat-exists.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/lstat-exists.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAQjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"impact-request-validator.d.ts","sourceRoot":"","sources":["../../../src/domain/services/impact-request-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,gBAAgB,CA8BlB;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,eAAe,EACrB,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,gBAAgB,CAUlB;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACzF,gBAAgB,CAgBlB"}
1
+ {"version":3,"file":"impact-request-validator.d.ts","sourceRoot":"","sources":["../../../src/domain/services/impact-request-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,gBAAgB,CAuClB;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,eAAe,EACrB,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,gBAAgB,CAalB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE;IACvC,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,gBAAgB,CAgBnB"}
@@ -24,7 +24,7 @@
24
24
  * bug was exactly that split. Known-site spellings normalize to the
25
25
  * kebab-case convention; unknown custom subfolders pass through verbatim.
26
26
  */
27
- import type { LayerConfig } from "../../types/manifest.js";
27
+ import type { BoundedContextLayers, LayerConfig } from "../../types/manifest.js";
28
28
  export type LayerKind = "domain" | "application" | "infrastructure";
29
29
  export type LayersConfig = Record<string, LayerConfig>;
30
30
  /**
@@ -60,4 +60,23 @@ export declare function resolveLayerDir(layers: LayersConfig | undefined, layer:
60
60
  * `"application/ports/in"`, ...): split into (layer, site) and resolve.
61
61
  */
62
62
  export declare function resolveEmissionDir(layers: LayersConfig | undefined, site: `${LayerKind}/${string}`): string;
63
+ /**
64
+ * Wave C 6.7(a) / HEX-025 / ADR-0050 Decision 1: a configured layer is
65
+ * *used* only when the bounded-context YAML lists real content
66
+ * (entities / ports / adapters / …) for it. Empty objects, empty arrays,
67
+ * a missing `layers:` block, and unknown layer names are unused — the
68
+ * scaffold must not emit those folders (or plan them as created).
69
+ *
70
+ * Fail-closed: no context layers means nothing is used. A forgotten
71
+ * caller must not fall back to "mkdir every declared layer" — that was
72
+ * the twice-bitten trap on foreign trees.
73
+ *
74
+ * Schema coupling: the keys below are the declared-name lists on
75
+ * `BoundedContextLayers` (`src/types/manifest/layers.ts`). Adding a new
76
+ * list field (e.g. `domain_events`) requires updating THAT type and this
77
+ * predicate together — otherwise a layer that only has the new field is
78
+ * treated as unused and is not emitted. That fail-closed miss is
79
+ * intentional; do not replace this with "any non-empty value".
80
+ */
81
+ export declare function layerDeclaresContent(layerName: string, contextLayers: BoundedContextLayers | undefined): boolean;
63
82
  //# sourceMappingURL=layer-dir-resolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layer-dir-resolver.d.ts","sourceRoot":"","sources":["../../../src/domain/services/layer-dir-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,aAAa,GAAG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AAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,GAAG,SAAS,EAChC,IAAI,EAAE,GAAG,SAAS,IAAI,MAAM,EAAE,GAC7B,MAAM,CAIR;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,oBAAoB,GAAG,SAAS,GAC9C,OAAO,CAiCT"}
@@ -1,5 +1,6 @@
1
1
  import { SyncConfig } from "../config.js";
2
2
  import { type GeneratorResult } from "../results.js";
3
+ import type { BoundedContextLayers } from "../types/manifest.js";
3
4
  interface LayerConfig {
4
5
  folder: string;
5
6
  subfolders?: string[];
@@ -27,7 +28,14 @@ interface LayerConfig {
27
28
  * creates an `export {};` barrel in an empty layer directory and migrates the
28
29
  * legacy "No exports yet" content). Same single-writer doctrine as
29
30
  * cross-context.
31
+ *
32
+ * Wave C 6.7(a) / HEX-025 / ADR-0050 Decision 1: a configured layer is
33
+ * emitted only when `contextLayers` lists real content for it. Unused
34
+ * layers (missing `layers:`, empty objects, empty arrays) are not created
35
+ * and not planned as created — on Hexagen self-regen and on foreign trees
36
+ * alike. Fail-closed when `contextLayers` is omitted. Used-layer
37
+ * `.gitkeep` / leaf-tracking is unchanged.
30
38
  */
31
- export declare function ensureLayerFolders(moduleDir: string, layers: Record<string, LayerConfig>, config: SyncConfig): Promise<GeneratorResult>;
39
+ export declare function ensureLayerFolders(moduleDir: string, layers: Record<string, LayerConfig>, config: SyncConfig, contextLayers?: BoundedContextLayers): Promise<GeneratorResult>;
32
40
  export {};
33
41
  //# sourceMappingURL=layer-folders.d.ts.map
@@ -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,EAGL,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AASvB,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,CAkG1B"}
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;AAQvB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAGjE,UAAU,WAAW;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAgJD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACnC,MAAM,EAAE,UAAU,EAClB,aAAa,CAAC,EAAE,oBAAoB,GACnC,OAAO,CAAC,eAAe,CAAC,CA0G1B"}
@@ -0,0 +1,5 @@
1
+ import type { SyncConfig } from "../config.js";
2
+ import type { ReportRecorder } from "../domain/types.js";
3
+ import { type GeneratorResult } from "../results.js";
4
+ export declare function ensurePackageSrcIndex(moduleDir: string, config: SyncConfig, report?: ReportRecorder): Promise<GeneratorResult>;
5
+ //# sourceMappingURL=package-src-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-src-index.d.ts","sourceRoot":"","sources":["../../src/generators/package-src-index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAmBvB,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,UAAU,EAClB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,eAAe,CAAC,CA8B1B"}
package/dist/index.js CHANGED
@@ -514,6 +514,28 @@ function resolveEmissionDir(layers, site) {
514
514
  const layer = site.slice(0, slash);
515
515
  return resolveLayerDir(layers, layer, site.slice(slash + 1));
516
516
  }
517
+ function hasDeclaredNames(value) {
518
+ return Array.isArray(value) && value.length > 0;
519
+ }
520
+ function layerDeclaresContent(layerName, contextLayers) {
521
+ if (!contextLayers) return false;
522
+ if (layerName === "domain") {
523
+ const layer = contextLayers.domain;
524
+ if (!layer) return false;
525
+ return hasDeclaredNames(layer.entities) || hasDeclaredNames(layer.value_objects) || hasDeclaredNames(layer.domain_services) || hasDeclaredNames(layer.ports?.in) || hasDeclaredNames(layer.ports?.out);
526
+ }
527
+ if (layerName === "application") {
528
+ const layer = contextLayers.application;
529
+ if (!layer) return false;
530
+ return hasDeclaredNames(layer.use_cases) || hasDeclaredNames(layer.factories) || hasDeclaredNames(layer.ports?.in) || hasDeclaredNames(layer.ports?.out);
531
+ }
532
+ if (layerName === "infrastructure") {
533
+ const layer = contextLayers.infrastructure;
534
+ if (!layer) return false;
535
+ return hasDeclaredNames(layer.adapters);
536
+ }
537
+ return false;
538
+ }
517
539
 
518
540
  // src/generators/layer-folders.ts
519
541
  async function directoryExists(dirPath) {
@@ -578,7 +600,7 @@ async function loadYamlSafe(filePath) {
578
600
  throw e;
579
601
  }
580
602
  }
581
- async function ensureLayerFolders(moduleDir, layers, config) {
603
+ async function ensureLayerFolders(moduleDir, layers, config, contextLayers) {
582
604
  const result = createEmptyResult();
583
605
  const { logger } = config;
584
606
  const layerRulesPath = path7.join(
@@ -592,6 +614,9 @@ async function ensureLayerFolders(moduleDir, layers, config) {
592
614
  logger.warn("layer-rules.yaml not found — skipping layer rule enforcement");
593
615
  }
594
616
  for (const [layerName, layerConfig] of Object.entries(layers)) {
617
+ if (!layerDeclaresContent(layerName, contextLayers)) {
618
+ continue;
619
+ }
595
620
  const layerPath = path7.join(moduleDir, resolveLayerDir(layers, layerName));
596
621
  if (!isInScope(layerPath, config) && !isInScope(path7.join(layerPath, "index.ts"), config)) {
597
622
  continue;
@@ -646,18 +671,18 @@ function contentHash2(content) {
646
671
  function detectCircularExports(exportGraph) {
647
672
  const visited = /* @__PURE__ */ new Set();
648
673
  const recursionStack = /* @__PURE__ */ new Set();
649
- const path24 = [];
674
+ const path25 = [];
650
675
  function dfs(node) {
651
676
  if (recursionStack.has(node)) {
652
- const cycleStart = path24.indexOf(node);
653
- return [...path24.slice(cycleStart), node];
677
+ const cycleStart = path25.indexOf(node);
678
+ return [...path25.slice(cycleStart), node];
654
679
  }
655
680
  if (visited.has(node)) {
656
681
  return null;
657
682
  }
658
683
  visited.add(node);
659
684
  recursionStack.add(node);
660
- path24.push(node);
685
+ path25.push(node);
661
686
  const exports$1 = exportGraph.get(node) ?? [];
662
687
  for (const exportPath of exports$1) {
663
688
  const cycle = dfs(exportPath);
@@ -665,7 +690,7 @@ function detectCircularExports(exportGraph) {
665
690
  return cycle;
666
691
  }
667
692
  }
668
- path24.pop();
693
+ path25.pop();
669
694
  recursionStack.delete(node);
670
695
  return null;
671
696
  }
@@ -682,8 +707,8 @@ function generateBarrelContent(entries) {
682
707
  return null;
683
708
  }
684
709
  const exportLines = entries.sort((a, b) => a.name.localeCompare(b.name)).map((entry) => {
685
- const path24 = entry.isDirectory ? `./${entry.name}/index.js` : `./${entry.name}.js`;
686
- return `export * from "${path24}";`;
710
+ const path25 = entry.isDirectory ? `./${entry.name}/index.js` : `./${entry.name}.js`;
711
+ return `export * from "${path25}";`;
687
712
  });
688
713
  return `${GENERATED_MARKER2}
689
714
 
@@ -1193,6 +1218,37 @@ async function generateTsconfig(moduleDir, moduleName, config, report) {
1193
1218
  return result;
1194
1219
  }
1195
1220
  }
1221
+ var SRC_INDEX_STUB = `${GENERATED_MARKER2}
1222
+
1223
+ export {};
1224
+ `;
1225
+ async function ensurePackageSrcIndex(moduleDir, config, report) {
1226
+ const result = createEmptyResult();
1227
+ const filePath = path7.join(moduleDir, "src", "index.ts");
1228
+ if (!isInScope(filePath, config)) {
1229
+ result.skipped.push(filePath);
1230
+ return result;
1231
+ }
1232
+ try {
1233
+ await fs5.stat(filePath);
1234
+ result.skipped.push(filePath);
1235
+ return result;
1236
+ } catch (err3) {
1237
+ if (err3.code !== "ENOENT") throw err3;
1238
+ }
1239
+ if (!config.dryRun) {
1240
+ await fs5.mkdir(path7.dirname(filePath), { recursive: true });
1241
+ }
1242
+ const status = await safeWriteFileAtomic(
1243
+ filePath,
1244
+ SRC_INDEX_STUB,
1245
+ config,
1246
+ report,
1247
+ false
1248
+ );
1249
+ recordWriteStatus(result, filePath, status);
1250
+ return result;
1251
+ }
1196
1252
  async function reapLegacyFolders(moduleDir, config, report) {
1197
1253
  const { dryRun, logger } = config;
1198
1254
  const legacyLayers = ["domain", "application", "infrastructure"];
@@ -1267,6 +1323,33 @@ function interpolate(template, vars) {
1267
1323
  });
1268
1324
  return { output, warnings };
1269
1325
  }
1326
+ var CURRENT_SCHEMA_VERSION = "1.0.0";
1327
+ function majorOf(version) {
1328
+ const match = /^(\d+)(?:\.|$)/.exec(version);
1329
+ return match ? match[1] : null;
1330
+ }
1331
+ var SUPPORTED_MAJOR = majorOf(CURRENT_SCHEMA_VERSION);
1332
+ z.object({
1333
+ schemaVersion: z.string({ required_error: "schemaVersion is required" }).refine((v) => majorOf(v) !== null, {
1334
+ message: "schemaVersion must start with a numeric major, e.g. '1.0.0'"
1335
+ }).refine((v) => majorOf(v) === SUPPORTED_MAJOR, {
1336
+ message: `Unsupported schemaVersion major; this consumer understands ${SUPPORTED_MAJOR}.x`
1337
+ }),
1338
+ // `layout` is the raw TEXT of the producer's .architecture/layout.yaml, not
1339
+ // a structured object: packages/sync reads that file, and the web adapter
1340
+ // guards on `typeof rec.layout === "string"` before clipping it to an
1341
+ // excerpt. A looser z.unknown() here let a structured fixture through that
1342
+ // the real consumer would silently ignore.
1343
+ layout: z.string().nullable().optional(),
1344
+ // Nullable like its siblings: the producer emits an explicit null when the
1345
+ // count is unknown (the linter prints "Files scanned" on inherited stdio,
1346
+ // so scan cannot see it until BF-0.3 captures that stream). Making this
1347
+ // optional-but-not-nullable would force the producer to choose between
1348
+ // omitting the key and failing its own schema.
1349
+ filesScanned: z.number().int().min(0).nullable().optional(),
1350
+ reportMarkdown: z.string().nullable().optional(),
1351
+ error: z.string().nullable().optional()
1352
+ }).passthrough();
1270
1353
 
1271
1354
  // src/generators/root-file-templates.ts
1272
1355
  var BUILTIN_PACKAGE_JSON_TEMPLATE = `{
@@ -1431,7 +1514,7 @@ function assertValidToolchainVersion(version, source) {
1431
1514
  function resolveToolchainVersion() {
1432
1515
  {
1433
1516
  return assertValidToolchainVersion(
1434
- "0.11.0",
1517
+ "0.12.0",
1435
1518
  "build-injected __HEXAGEN_TOOLCHAIN_VERSION__"
1436
1519
  );
1437
1520
  }
@@ -5171,7 +5254,12 @@ var SyncEngine = class {
5171
5254
  logger.info(
5172
5255
  `Ensuring directories for module: ${mod.name} at ${moduleDir}`
5173
5256
  );
5174
- const layerResult = await ensureLayerFolders(moduleDir, layers, config);
5257
+ const layerResult = await ensureLayerFolders(
5258
+ moduleDir,
5259
+ layers,
5260
+ config,
5261
+ mod.layers
5262
+ );
5175
5263
  mergeResult2(result, layerResult);
5176
5264
  }
5177
5265
  return result;
@@ -5212,6 +5300,11 @@ var SyncEngine = class {
5212
5300
  config,
5213
5301
  this.report
5214
5302
  );
5303
+ const srcIndexResult = await ensurePackageSrcIndex(
5304
+ moduleDir,
5305
+ config,
5306
+ this.report
5307
+ );
5215
5308
  const eslintResult = await generateEslintConfig(
5216
5309
  moduleDir,
5217
5310
  moduleName,
@@ -5227,6 +5320,7 @@ var SyncEngine = class {
5227
5320
  this.noteFailure("Barrels", barrelResult);
5228
5321
  this.noteFailure("package.json", pkgResult);
5229
5322
  this.noteFailure("tsconfig.json", tsResult);
5323
+ this.noteFailure("src/index.ts", srcIndexResult);
5230
5324
  this.noteFailure("ESLint", eslintResult);
5231
5325
  this.noteFailure("Stubs", stubResult);
5232
5326
  if (this.partialConfig.mode === "self-regen") {
@@ -5235,6 +5329,7 @@ var SyncEngine = class {
5235
5329
  mergeResult2(barrels, barrelResult);
5236
5330
  mergeResult2(pkgs, pkgResult);
5237
5331
  mergeResult2(tsconfigs, tsResult);
5332
+ mergeResult2(tsconfigs, srcIndexResult);
5238
5333
  mergeResult2(eslint, eslintResult);
5239
5334
  mergeResult2(stubs, stubResult);
5240
5335
  }
@@ -5663,6 +5758,6 @@ async function saveManifest(workspaceRoot, manifest) {
5663
5758
  }
5664
5759
  }
5665
5760
 
5666
- export { DEFAULT_NAMING, DEFAULT_TEMPLATES, SyncEngine, createEmptyResult, err2 as err, isIndexManifest, loadManifest2 as loadManifest, mergeSplitManifest, ok2 as ok, parseArgs, portName, recordWriteStatus, saveManifest, validateManifest2 as validateManifest };
5761
+ export { DEFAULT_NAMING, DEFAULT_TEMPLATES, SyncEngine, createEmptyResult, err2 as err, isIndexManifest, loadManifest2 as loadManifest, mergeSplitManifest, ok2 as ok, parseArgs, portName, recordWriteStatus, sanitizeScope, saveManifest, validateManifest2 as validateManifest };
5667
5762
  //# sourceMappingURL=index.js.map
5668
5763
  //# sourceMappingURL=index.js.map