@hexagen-monaco/sync 0.9.0 → 0.11.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 (185) hide show
  1. package/LICENSE +6 -0
  2. package/README.md +56 -8
  3. package/dist/application/ports/out/index.d.ts +1 -2
  4. package/dist/application/ports/out/index.d.ts.map +1 -1
  5. package/dist/application/ports/out/symbol-reference-index.port.d.ts +74 -0
  6. package/dist/application/ports/out/symbol-reference-index.port.d.ts.map +1 -0
  7. package/dist/application/use-cases/get-architecture-graph.use-case.d.ts +1 -1
  8. package/dist/application/use-cases/get-architecture-graph.use-case.d.ts.map +1 -1
  9. package/dist/application/use-cases/get-linter-report.use-case.d.ts +1 -1
  10. package/dist/application/use-cases/get-linter-report.use-case.d.ts.map +1 -1
  11. package/dist/application/use-cases/index.d.ts +0 -1
  12. package/dist/application/use-cases/index.d.ts.map +1 -1
  13. package/dist/application/use-cases/refactoring-impact.use-case.d.ts +24 -6
  14. package/dist/application/use-cases/refactoring-impact.use-case.d.ts.map +1 -1
  15. package/dist/arch-linter-bin.d.ts +19 -3
  16. package/dist/arch-linter-bin.d.ts.map +1 -1
  17. package/dist/cli.js +2905 -5399
  18. package/dist/cli.js.map +1 -1
  19. package/dist/commands/add/validate.d.ts.map +1 -1
  20. package/dist/commands/adopt/index.d.ts +24 -0
  21. package/dist/commands/adopt/index.d.ts.map +1 -0
  22. package/dist/commands/bootstrap/index.d.ts +41 -0
  23. package/dist/commands/bootstrap/index.d.ts.map +1 -0
  24. package/dist/commands/bootstrap.d.ts +30 -0
  25. package/dist/commands/bootstrap.d.ts.map +1 -0
  26. package/dist/commands/report/baseline-read.d.ts +12 -0
  27. package/dist/commands/report/baseline-read.d.ts.map +1 -0
  28. package/dist/commands/report/build-report.d.ts +13 -0
  29. package/dist/commands/report/build-report.d.ts.map +1 -0
  30. package/dist/commands/report/context-map.d.ts +9 -0
  31. package/dist/commands/report/context-map.d.ts.map +1 -0
  32. package/dist/commands/report/exec-git.d.ts +3 -0
  33. package/dist/commands/report/exec-git.d.ts.map +1 -0
  34. package/dist/commands/report/handoff.d.ts +3 -0
  35. package/dist/commands/report/handoff.d.ts.map +1 -0
  36. package/dist/commands/report/index.d.ts +14 -0
  37. package/dist/commands/report/index.d.ts.map +1 -0
  38. package/dist/commands/report/lint-collect.d.ts +4 -0
  39. package/dist/commands/report/lint-collect.d.ts.map +1 -0
  40. package/dist/commands/report/ratchet-trend.d.ts +3 -0
  41. package/dist/commands/report/ratchet-trend.d.ts.map +1 -0
  42. package/dist/commands/report/render-html.d.ts +3 -0
  43. package/dist/commands/report/render-html.d.ts.map +1 -0
  44. package/dist/commands/report/render-markdown.d.ts +3 -0
  45. package/dist/commands/report/render-markdown.d.ts.map +1 -0
  46. package/dist/commands/report/types.d.ts +52 -0
  47. package/dist/commands/report/types.d.ts.map +1 -0
  48. package/dist/commands/report/zip-store.d.ts +10 -0
  49. package/dist/commands/report/zip-store.d.ts.map +1 -0
  50. package/dist/commands/shared/detect-workspaces.d.ts +12 -0
  51. package/dist/commands/shared/detect-workspaces.d.ts.map +1 -0
  52. package/dist/commands/shared/index.d.ts +1 -1
  53. package/dist/commands/shared/index.d.ts.map +1 -1
  54. package/dist/commands/shared/project-root.d.ts +7 -0
  55. package/dist/commands/shared/project-root.d.ts.map +1 -1
  56. package/dist/domain/services/emission-plan-builder.d.ts +14 -3
  57. package/dist/domain/services/emission-plan-builder.d.ts.map +1 -1
  58. package/dist/domain/services/impact-analysis.types.d.ts +6 -1
  59. package/dist/domain/services/impact-analysis.types.d.ts.map +1 -1
  60. package/dist/domain/services/index.d.ts +2 -0
  61. package/dist/domain/services/index.d.ts.map +1 -1
  62. package/dist/domain/services/layer-classifier.d.ts +53 -2
  63. package/dist/domain/services/layer-classifier.d.ts.map +1 -1
  64. package/dist/domain/services/layer-dir-resolver.d.ts +63 -0
  65. package/dist/domain/services/layer-dir-resolver.d.ts.map +1 -0
  66. package/dist/domain/services/name-normalizer.d.ts +35 -0
  67. package/dist/domain/services/name-normalizer.d.ts.map +1 -0
  68. package/dist/domain/services/stub-template-resolver.d.ts +33 -2
  69. package/dist/domain/services/stub-template-resolver.d.ts.map +1 -1
  70. package/dist/generators/apps-framework-templates.d.ts.map +1 -1
  71. package/dist/generators/architecture-file-templates.d.ts +2 -2
  72. package/dist/generators/architecture-file-templates.d.ts.map +1 -1
  73. package/dist/generators/architecture-files.d.ts.map +1 -1
  74. package/dist/generators/cross-context.d.ts.map +1 -1
  75. package/dist/generators/eslint.d.ts.map +1 -1
  76. package/dist/generators/layer-folders.d.ts.map +1 -1
  77. package/dist/generators/package-json.d.ts.map +1 -1
  78. package/dist/generators/root-file-templates.d.ts +1 -1
  79. package/dist/generators/root-file-templates.d.ts.map +1 -1
  80. package/dist/generators/root-files.d.ts.map +1 -1
  81. package/dist/generators/stubs.d.ts +4 -1
  82. package/dist/generators/stubs.d.ts.map +1 -1
  83. package/dist/index.d.ts +23 -3
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +581 -4770
  86. package/dist/index.js.map +1 -1
  87. package/dist/infrastructure/adapters/index.d.ts +1 -0
  88. package/dist/infrastructure/adapters/index.d.ts.map +1 -1
  89. package/dist/infrastructure/adapters/ts-morph-symbol-index.adapter.d.ts +47 -0
  90. package/dist/infrastructure/adapters/ts-morph-symbol-index.adapter.d.ts.map +1 -0
  91. package/dist/infrastructure/config/layout-schema.d.ts +29 -0
  92. package/dist/infrastructure/config/layout-schema.d.ts.map +1 -0
  93. package/dist/infrastructure/config/load-layout-config.d.ts +8 -0
  94. package/dist/infrastructure/config/load-layout-config.d.ts.map +1 -0
  95. package/dist/linter.d.ts +24 -0
  96. package/dist/linter.d.ts.map +1 -1
  97. package/dist/manifest-service.d.ts.map +1 -1
  98. package/dist/refactoring/impact-analyzer.d.ts +7 -2
  99. package/dist/refactoring/impact-analyzer.d.ts.map +1 -1
  100. package/dist/sync-engine.d.ts.map +1 -1
  101. package/dist/templates/adobe-creative-production/files/src/domain/ports/out/creative-production.port.ts +2 -4
  102. package/dist/templates/adobe-creative-production/files/src/infrastructure/adobe/creative-production/creative-production.adapter.ts +8 -7
  103. package/dist/templates/adobe-express/files/src/domain/ports/out/express.port.ts +2 -4
  104. package/dist/templates/adobe-express/files/src/infrastructure/adobe/express/express.adapter.ts +9 -8
  105. package/dist/templates/adobe-firefly-composite/files/src/domain/ports/out/composite.port.ts +2 -4
  106. package/dist/templates/adobe-firefly-composite/files/src/infrastructure/adobe/composite/composite.adapter.ts +12 -12
  107. package/dist/templates/adobe-firefly-content-tagging/files/src/domain/ports/out/content-tagging.port.ts +2 -4
  108. package/dist/templates/adobe-firefly-content-tagging/files/src/infrastructure/adobe/content-tagging/content-tagging.adapter.ts +6 -5
  109. package/dist/templates/adobe-firefly-core/README.md +1 -1
  110. package/dist/templates/adobe-firefly-core/files/src/domain/errors/creative-service-error.ts +62 -0
  111. package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/errors/to-creative-service-error.ts +45 -0
  112. package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/index.ts +9 -0
  113. package/dist/templates/adobe-firefly-core/manifest.json +2 -0
  114. package/dist/templates/adobe-firefly-custom-models/files/src/domain/ports/out/custom-model.port.ts +5 -7
  115. package/dist/templates/adobe-firefly-custom-models/files/src/infrastructure/adobe/custom-models/firefly-custom-model.adapter.ts +16 -15
  116. package/dist/templates/adobe-firefly-generate/files/src/domain/ports/out/image-generation.port.ts +6 -8
  117. package/dist/templates/adobe-firefly-generate/files/src/infrastructure/adobe/generate/firefly-generate.adapter.ts +14 -16
  118. package/dist/templates/adobe-firefly-media/files/src/domain/ports/out/media-generation.port.ts +6 -8
  119. package/dist/templates/adobe-firefly-media/files/src/infrastructure/adobe/media/firefly-media.adapter.ts +11 -10
  120. package/dist/templates/adobe-firefly-upscale/files/src/domain/ports/out/upscale.port.ts +2 -4
  121. package/dist/templates/adobe-firefly-upscale/files/src/infrastructure/adobe/upscale/upscale.adapter.ts +13 -11
  122. package/dist/templates/adobe-illustrator/files/src/domain/ports/out/illustrator.port.ts +4 -6
  123. package/dist/templates/adobe-illustrator/files/src/infrastructure/adobe/illustrator/illustrator.adapter.ts +17 -15
  124. package/dist/templates/adobe-indesign/files/src/domain/ports/out/indesign.port.ts +4 -6
  125. package/dist/templates/adobe-indesign/files/src/infrastructure/adobe/indesign/indesign.adapter.ts +10 -9
  126. package/dist/templates/adobe-lightroom/files/src/domain/ports/out/lightroom.port.ts +4 -6
  127. package/dist/templates/adobe-lightroom/files/src/infrastructure/adobe/lightroom/lightroom.adapter.ts +10 -9
  128. package/dist/templates/adobe-photoshop/files/src/domain/ports/out/photoshop-automation.port.ts +6 -8
  129. package/dist/templates/adobe-photoshop/files/src/infrastructure/adobe/photoshop/photoshop-automation.adapter.ts +12 -11
  130. package/dist/templates/adobe-substance-3d/files/src/domain/ports/out/substance-3d.port.ts +4 -6
  131. package/dist/templates/adobe-substance-3d/files/src/infrastructure/adobe/substance-3d/substance-3d.adapter.ts +10 -9
  132. package/dist/templates/agents-md/files/AGENTS.md +5 -5
  133. package/dist/templates/bedrock-agentcore-runtime/files/src/application/ports/agent-runtime.port.ts +25 -0
  134. package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/http/invocations.handler.ts +1 -1
  135. package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/http/server.ts +1 -1
  136. package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/runtime/payload.ts +5 -22
  137. package/dist/templates/bedrock-agentcore-runtime/manifest.json +1 -0
  138. package/dist/templates/ci-github-actions/README.md +13 -7
  139. package/dist/templates/ci-github-actions/files/.github/dependabot.yml +9 -2
  140. package/dist/templates/ci-github-actions/files/.github/workflows/ci.yml +18 -14
  141. package/dist/templates/ci-github-actions/files/.github/workflows/deploy-fly.yml +12 -6
  142. package/dist/templates/ci-github-actions/files/.github/workflows/deploy-railway.yml +14 -8
  143. package/dist/templates/ci-github-actions/files/.github/workflows/deploy-vercel.yml +29 -8
  144. package/dist/templates/ci-github-actions/files/.github/workflows/deploy-vps.yml +14 -8
  145. package/dist/templates/ci-github-actions/files/.github/workflows/preview.yml +34 -18
  146. package/dist/templates/ci-github-actions/manifest.json +2 -2
  147. package/dist/templates/docker/README.md +3 -0
  148. package/dist/templates/docker/files/.github/workflows/docker-build.yml +15 -6
  149. package/dist/templates/docker/manifest.json +1 -0
  150. package/dist/templates/llm-adapter/files/src/domain/errors/llm-error.ts +35 -0
  151. package/dist/templates/llm-adapter/files/src/domain/ports/out/llm-client.port.ts +1 -1
  152. package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/anthropic-llm-client.adapter.ts +1 -1
  153. package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/azure-openai-llm-client.adapter.ts +1 -1
  154. package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/ollama-llm-client.adapter.ts +1 -1
  155. package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/openai-llm-client.adapter.ts +1 -1
  156. package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/xai-llm-client.adapter.ts +1 -1
  157. package/dist/templates/llm-adapter/files/src/infrastructure/llm/errors/llm-errors.ts +9 -23
  158. package/dist/templates/llm-adapter/files/src/infrastructure/llm/index.ts +4 -3
  159. package/dist/templates/llm-adapter/files/src/infrastructure/llm/router/llm-router.ts +1 -1
  160. package/dist/templates/llm-adapter/files/src/infrastructure/llm/utils/retry.ts +1 -1
  161. package/dist/templates/llm-adapter/files/src/infrastructure/llm/utils/structured-output.ts +1 -1
  162. package/dist/templates/llm-adapter/manifest.json +1 -0
  163. package/dist/templates/llm-adapter-bedrock/files/src/infrastructure/llm/adapters/bedrock-llm-client.adapter.ts +1 -1
  164. package/dist/templates/llm-adapter-bedrock/files/src/infrastructure/llm/errors/bedrock-errors.ts +1 -1
  165. package/dist/templates/mcp-server/README.md +1 -1
  166. package/dist/templates/mcp-server-http/README.md +1 -1
  167. package/package.json +6 -5
  168. package/dist/application/ports/out/project-configuration-read.port.d.ts +0 -9
  169. package/dist/application/ports/out/project-configuration-read.port.d.ts.map +0 -1
  170. package/dist/application/ports/out/symbol-reference-provider.port.d.ts +0 -10
  171. package/dist/application/ports/out/symbol-reference-provider.port.d.ts.map +0 -1
  172. package/dist/application/use-cases/get-manifest-resource.use-case.d.ts +0 -8
  173. package/dist/application/use-cases/get-manifest-resource.use-case.d.ts.map +0 -1
  174. package/dist/generators/validators/index.d.ts +0 -11
  175. package/dist/generators/validators/index.d.ts.map +0 -1
  176. package/dist/generators/validators/validate-dependencies.d.ts +0 -7
  177. package/dist/generators/validators/validate-dependencies.d.ts.map +0 -1
  178. package/dist/generators/validators/validate-manifest-sync.d.ts +0 -5
  179. package/dist/generators/validators/validate-manifest-sync.d.ts.map +0 -1
  180. package/dist/generators/validators/validate-port-adapter.d.ts +0 -5
  181. package/dist/generators/validators/validate-port-adapter.d.ts.map +0 -1
  182. package/dist/generators/validators/validation-types.d.ts +0 -20
  183. package/dist/generators/validators/validation-types.d.ts.map +0 -1
  184. package/dist/generators/validators.d.ts +0 -7
  185. package/dist/generators/validators.d.ts.map +0 -1
@@ -1,5 +1,6 @@
1
1
  export * from "./atomic-file-system.adapter.js";
2
2
  export * from "./file-system-workspace.adapter.js";
3
3
  export * from "./in-memory-config-double.js";
4
+ export * from "./ts-morph-symbol-index.adapter.js";
4
5
  export * from "./yaml-config.adapter.js";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/adapters/index.ts"],"names":[],"mappings":"AAEA,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/adapters/index.ts"],"names":[],"mappings":"AAEA,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,47 @@
1
+ import type { SymbolReferenceDto, SymbolReferenceIndexPort } from "../../application/ports/out/symbol-reference-index.port.js";
2
+ /**
3
+ * The ts-morph project settings this analyser parses consumer workspaces with.
4
+ *
5
+ * Exported so the parser contract can be pinned by a test against the *same*
6
+ * object production uses, rather than a copy that silently drifts. See
7
+ * `__tests__/refactoring/modern-typescript-syntax.test.ts` (AUD-012): the
8
+ * engine is published and points at arbitrary user code, so the TypeScript
9
+ * version ts-morph bundles has to be at least as new as the one this repo
10
+ * compiles with — ts-morph 22 bundled TS 5.4.2 and could not parse TS 5.9
11
+ * syntax at all.
12
+ *
13
+ * These live here rather than beside the use case (where they used to sit)
14
+ * because they are parser configuration: naming `skipAddingFilesFromTsConfig`
15
+ * or a numeric `moduleResolution` is already speaking ts-morph, and HEX-013 is
16
+ * about the application layer not speaking it.
17
+ */
18
+ export declare const REFACTORING_IMPACT_COMPILER_OPTIONS: {
19
+ readonly skipAddingFilesFromTsConfig: true;
20
+ readonly compilerOptions: {
21
+ readonly target: 99;
22
+ readonly module: 99;
23
+ readonly moduleResolution: 100;
24
+ };
25
+ };
26
+ /**
27
+ * `SymbolReferenceIndexPort` backed by ts-morph (HEX-013, item 5.7).
28
+ *
29
+ * This is the only place in `packages/sync` outside `src/refactoring/`'s own
30
+ * rewrite patterns that knows the analyser is built on ts-morph. Everything it
31
+ * hands back across the boundary is a `SymbolReferenceDto` of two strings.
32
+ *
33
+ * The reason ladder below is lifted verbatim (order included) from the
34
+ * `DefaultSymbolReferenceProvider` that used to live inside
35
+ * `src/refactoring/impact-analyzer.ts`. The order is contract, not taste: a
36
+ * file can be several of these at once and the first match is what a consumer
37
+ * of the published engine has always been shown. `__tests__/refactoring/
38
+ * symbol-reference-index.contract.test.ts` pins every branch and the
39
+ * precedence between them.
40
+ */
41
+ export declare class TsMorphSymbolIndexAdapter implements SymbolReferenceIndexPort {
42
+ private readonly project;
43
+ constructor();
44
+ indexFiles(filePaths: readonly string[]): void;
45
+ findReferences(symbolName: string): readonly SymbolReferenceDto[];
46
+ }
47
+ //# sourceMappingURL=ts-morph-symbol-index.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ts-morph-symbol-index.adapter.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/adapters/ts-morph-symbol-index.adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,4DAA4D,CAAC;AAEpE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,mCAAmC;;;;;;;CAOtC,CAAC;AAEX;;;;;;;;;;;;;;GAcG;AACH,qBAAa,yBAA0B,YAAW,wBAAwB;IACxE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;;IAMlC,UAAU,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IAM9C,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,kBAAkB,EAAE;CAYlE"}
@@ -0,0 +1,29 @@
1
+ import { z } from "zod";
2
+ /** Canonical path consumed by bootstrap, the linter, and impact classification. */
3
+ export declare const LAYOUT_YAML_RELATIVE_PATH = ".architecture/layout.yaml";
4
+ export declare const DEFAULT_LAYOUT_LAYERS: readonly ["domain", "application", "infrastructure"];
5
+ export declare const layoutSchema: z.ZodObject<{
6
+ version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
7
+ contexts: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
8
+ root: z.ZodOptional<z.ZodString>;
9
+ layers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
10
+ ignore: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
11
+ workspaces: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
12
+ }, "strict", z.ZodTypeAny, {
13
+ version?: string | number | undefined;
14
+ workspaces?: Record<string, string> | undefined;
15
+ layers?: string[] | undefined;
16
+ ignore?: string[] | undefined;
17
+ root?: string | undefined;
18
+ contexts?: string | Record<string, unknown> | undefined;
19
+ }, {
20
+ version?: string | number | undefined;
21
+ workspaces?: Record<string, string> | undefined;
22
+ layers?: string[] | undefined;
23
+ ignore?: string[] | undefined;
24
+ root?: string | undefined;
25
+ contexts?: string | Record<string, unknown> | undefined;
26
+ }>;
27
+ export type LayoutFile = z.infer<typeof layoutSchema>;
28
+ export type LayoutConfig = LayoutFile;
29
+ //# sourceMappingURL=layout-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout-schema.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/config/layout-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,mFAAmF;AACnF,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AAErE,eAAO,MAAM,qBAAqB,sDAIxB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;EAWd,CAAC;AAEZ,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACtD,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type LayoutFile } from "./layout-schema.js";
2
+ /**
3
+ * Load the canonical layout file. Missing is legitimate (defaults apply).
4
+ * A file that exists and fails the schema is fatal — silent fallback would
5
+ * classify every file against the wrong layer names.
6
+ */
7
+ export declare function loadLayoutConfig(workspaceRoot: string): LayoutFile | undefined;
8
+ //# sourceMappingURL=load-layout-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-layout-config.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/config/load-layout-config.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,MAAM,GACpB,UAAU,GAAG,SAAS,CAsBxB"}
package/dist/linter.d.ts CHANGED
@@ -1,4 +1,28 @@
1
1
  import type { SyncConfig } from "./config.js";
2
+ /**
3
+ * Default wall-clock budget for one arch-linter invocation. Raised from the
4
+ * original 30s: a cold monorepo lint (a ts-morph project load spanning every
5
+ * context) can legitimately approach that ceiling, and under the old
6
+ * swallow-on-timeout behaviour a spurious kill was indistinguishable from a
7
+ * clean pass (AUD-010). Override per-environment via ARCH_LINTER_TIMEOUT_MS.
8
+ */
9
+ export declare const DEFAULT_ARCH_LINTER_TIMEOUT_MS = 60000;
10
+ /**
11
+ * Resolves the arch-linter exec timeout. Honours a positive, finite
12
+ * ARCH_LINTER_TIMEOUT_MS override; falls back to the default for unset or
13
+ * malformed values. Never returns a zero/negative budget — child_process
14
+ * treats those as "no timeout", which would silently disable the guard.
15
+ */
16
+ export declare function resolveLinterTimeoutMs(env?: NodeJS.ProcessEnv): number;
17
+ /**
18
+ * True when `error` is child_process's timeout kill rather than a linter
19
+ * verdict. `exec` kills the child with SIGTERM once `timeout` elapses
20
+ * (surfacing `killed: true`); some platforms additionally tag it
21
+ * `code: "ETIMEDOUT"`. A timeout means the linter never reached a conclusion —
22
+ * it is emphatically NOT a pass — so callers must escalate it regardless of
23
+ * strict mode.
24
+ */
25
+ export declare function isTimeoutError(error: unknown): boolean;
2
26
  /**
3
27
  * Runs the architectural integrity linter (extracted from old arch-linter sync.ts).
4
28
  * Now fully config-driven and crash-proof.
@@ -1 +1 @@
1
- {"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../src/linter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAK9C;;;GAGG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA6CrE"}
1
+ {"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../src/linter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAK9C;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,QAAS,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,CAMR;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAUtD;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA0ErE"}
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-service.d.ts","sourceRoot":"","sources":["../src/manifest-service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI1D,YAAY,EAAE,MAAM,EAAE,CAAC;AAIvB,wBAAsB,YAAY,CAChC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAsBlC;AAED,wBAAsB,gBAAgB,CACpC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,KAAK,CAAC,CAAC,CAkC9D;AAED,wBAAsB,YAAY,CAChC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAc9B"}
1
+ {"version":3,"file":"manifest-service.d.ts","sourceRoot":"","sources":["../src/manifest-service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI1D,YAAY,EAAE,MAAM,EAAE,CAAC;AAIvB,wBAAsB,YAAY,CAChC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAsBlC;AAED,wBAAsB,gBAAgB,CACpC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,KAAK,CAAC,CAAC,CAiC9D;AAED,wBAAsB,YAAY,CAChC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAc9B"}
@@ -5,6 +5,11 @@ import type { ImpactAnalysisRequest } from "../application/use-cases/refactoring
5
5
  /**
6
6
  * Analyzes the impact of proposed refactorings
7
7
  *
8
+ * This is the composition root for the impact analyser: it is the only place
9
+ * that names both the workspace adapter and the ts-morph-backed symbol index
10
+ * (HEX-013). The reason ladder that used to live here as
11
+ * `DefaultSymbolReferenceProvider` moved into that adapter unchanged.
12
+ *
8
13
  * @deprecated Use RefactoringImpactUseCase directly for new code
9
14
  */
10
15
  export declare class ImpactAnalyzer {
@@ -15,9 +20,9 @@ export declare class ImpactAnalyzer {
15
20
  constructor(workspaceRoot: string, manifest: Manifest);
16
21
  analyze(request: ImpactAnalysisRequest): Promise<Result<ImpactAnalysisResult, Error>>;
17
22
  }
18
- export type { RefactoringType, Layer, FileToModify, CrossPackageDependency, ArchitecturalImpact, ImpactAnalysisResult } from "../domain/services/impact-analysis.types.js";
23
+ export type { RefactoringType, Layer, FileToModify, CrossPackageDependency, ArchitecturalImpact, ImpactAnalysisResult, } from "../domain/services/impact-analysis.types.js";
19
24
  export type { ImpactAnalysisRequest } from "../application/use-cases/refactoring-impact.use-case.js";
20
25
  export { validateRequest } from "../domain/services/impact-request-validator.js";
21
- export { determineLayer, determinePackageName } from "../domain/services/layer-classifier.js";
26
+ export { determineLayer, determinePackageName, } from "../domain/services/layer-classifier.js";
22
27
  export { assessArchitecturalImpact } from "../domain/services/architectural-boundary-checker.js";
23
28
  //# sourceMappingURL=impact-analyzer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"impact-analyzer.d.ts","sourceRoot":"","sources":["../../src/refactoring/impact-analyzer.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAGxF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAKrG;;;;GAIG;AACH,qBAAa,cAAc;IAKvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAL3B,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,YAAY,CAA4B;gBAG7B,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,QAAQ;IAY/B,OAAO,CACX,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;CAGhD;AAiED,YAAY,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAC3K,YAAY,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,sDAAsD,CAAC"}
1
+ {"version":3,"file":"impact-analyzer.d.ts","sourceRoot":"","sources":["../../src/refactoring/impact-analyzer.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAKxF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAGrG;;;;;;;;;GASG;AACH,qBAAa,cAAc;IAKvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAL3B,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,YAAY,CAA4B;gBAG7B,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,QAAQ;IAe/B,OAAO,CACX,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;CAGhD;AAED,YAAY,EACV,eAAe,EACf,KAAK,EACL,YAAY,EACZ,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,6CAA6C,CAAC;AACrD,YAAY,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EACL,cAAc,EACd,oBAAoB,GACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sDAAsD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sync-engine.d.ts","sourceRoot":"","sources":["../src/sync-engine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAkBpD,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAkBpD,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAyB;IAKvC,OAAO,CAAC,OAAO,CAAqB;IAYpC,OAAO,CAAC,QAAQ,CAA+C;IAC/D,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAoB;gBAEjC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,iBAAiB;IAKzD,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,SAAS;IAOjB;;;;;;;OAOG;IACH,OAAO,CAAC,WAAW;YAML,iBAAiB;YAmCjB,qBAAqB;IAiG7B,GAAG,IAAI,OAAO,CAAC,cAAc,CAAC;CAmTrC"}
1
+ {"version":3,"file":"sync-engine.d.ts","sourceRoot":"","sources":["../src/sync-engine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAkBpD,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAkBpD,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAyB;IAKvC,OAAO,CAAC,OAAO,CAAqB;IAYpC,OAAO,CAAC,QAAQ,CAA+C;IAC/D,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAoB;gBAEjC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,iBAAiB;IAKzD,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,SAAS;IAOjB;;;;;;;OAOG;IACH,OAAO,CAAC,WAAW;YAML,iBAAiB;YAmCjB,qBAAqB;IAiG7B,GAAG,IAAI,OAAO,CAAC,cAAc,CAAC;CAwTrC"}
@@ -1,7 +1,5 @@
1
1
  import type { Result } from "../../../shared/result";
2
- // Type-only import of the infrastructure error (erased at compile) — the deliberate
3
- // domain→infra decoupling for the port's failure channel, not an oversight.
4
- import type { FireflyError } from "../../../infrastructure/adobe/errors/firefly-errors";
2
+ import type { CreativeServiceError } from "../../errors/creative-service-error";
5
3
 
6
4
  /**
7
5
  * Outbound port for the Adobe Creative Production API (batch automation).
@@ -58,5 +56,5 @@ export interface CreativeProductionPort {
58
56
  */
59
57
  runWorkflow(
60
58
  req: RunWorkflowRequest,
61
- ): Promise<Result<AssetResult[], FireflyError>>;
59
+ ): Promise<Result<AssetResult[], CreativeServiceError>>;
62
60
  }
@@ -8,7 +8,8 @@ import { fireflyClient } from "../http/firefly-client";
8
8
  import { jobPort } from "../jobs/job-port";
9
9
  import { toJobHandle } from "../jobs/job-result";
10
10
  import { getStoragePresigner } from "../storage/passthrough-storage.adapter";
11
- import { classifyAdobeError, FireflyError } from "../errors/firefly-errors";
11
+ import { toCreativeServiceError } from "../errors/to-creative-service-error";
12
+ import { CreativeServiceError } from "../../../domain/errors/creative-service-error";
12
13
  import { ok, err, type Result } from "../../../shared/result";
13
14
 
14
15
  /**
@@ -32,11 +33,11 @@ const CREATIVE_PRODUCTION_BASE = normalizeBase(
32
33
  export class CreativeProductionAdapter implements CreativeProductionPort {
33
34
  async runWorkflow(
34
35
  req: RunWorkflowRequest,
35
- ): Promise<Result<AssetResult[], FireflyError>> {
36
+ ): Promise<Result<AssetResult[], CreativeServiceError>> {
36
37
  // A batch with no assets would submit an empty job the API rejects — guard
37
38
  // up front rather than spending a round-trip to discover it.
38
39
  if (req.assets.length === 0) {
39
- return err(new FireflyError("runWorkflow requires at least one asset."));
40
+ return err(new CreativeServiceError("unknown", "runWorkflow requires at least one asset."));
40
41
  }
41
42
  try {
42
43
  // Presign each asset's input + output up front; the workflow runs over the
@@ -67,7 +68,7 @@ export class CreativeProductionAdapter implements CreativeProductionPort {
67
68
  // resolves a jobId-only handle in webhook mode and would fail in polling builds.
68
69
  if (!handle.statusUrl) {
69
70
  return err(
70
- new FireflyError(
71
+ new CreativeServiceError("unknown",
71
72
  "Creative Production submit response had no status URL to track the job.",
72
73
  ),
73
74
  );
@@ -77,7 +78,7 @@ export class CreativeProductionAdapter implements CreativeProductionPort {
77
78
  const done = await jobPort.poll(handle);
78
79
  if (done.status !== "succeeded") {
79
80
  return err(
80
- new FireflyError(
81
+ new CreativeServiceError("unknown",
81
82
  done.error ?? "Creative Production job did not succeed.",
82
83
  ),
83
84
  );
@@ -93,7 +94,7 @@ export class CreativeProductionAdapter implements CreativeProductionPort {
93
94
  // service exists to provide.
94
95
  if (done.outputs.length !== req.assets.length) {
95
96
  return err(
96
- new FireflyError(
97
+ new CreativeServiceError("unknown",
97
98
  `Creative Production returned ${done.outputs.length} outputs for ${req.assets.length} assets.`,
98
99
  ),
99
100
  );
@@ -113,7 +114,7 @@ export class CreativeProductionAdapter implements CreativeProductionPort {
113
114
  });
114
115
  return ok(results);
115
116
  } catch (error) {
116
- return err(classifyAdobeError(error));
117
+ return err(toCreativeServiceError(error));
117
118
  }
118
119
  }
119
120
  }
@@ -1,7 +1,5 @@
1
1
  import type { Result } from "../../../shared/result";
2
- // Type-only import of the infrastructure error (erased at compile) — the deliberate
3
- // domain→infra decoupling for the port's failure channel, not an oversight.
4
- import type { FireflyError } from "../../../infrastructure/adobe/errors/firefly-errors";
2
+ import type { CreativeServiceError } from "../../errors/creative-service-error";
5
3
 
6
4
  /**
7
5
  * Outbound port for the Adobe Express API (batch automation).
@@ -43,5 +41,5 @@ export interface ExpressAutomationPort {
43
41
  * Render a batch of variants from a published Express template. Resolves to
44
42
  * one output href per item, in the same order as `req.items`.
45
43
  */
46
- renderBatch(req: RenderBatchRequest): Promise<Result<string[], FireflyError>>;
44
+ renderBatch(req: RenderBatchRequest): Promise<Result<string[], CreativeServiceError>>;
47
45
  }
@@ -8,7 +8,8 @@ import { fireflyClient } from "../http/firefly-client";
8
8
  import { jobPort } from "../jobs/job-port";
9
9
  import { toJobHandle } from "../jobs/job-result";
10
10
  import { getStoragePresigner } from "../storage/passthrough-storage.adapter";
11
- import { classifyAdobeError, FireflyError } from "../errors/firefly-errors";
11
+ import { toCreativeServiceError } from "../errors/to-creative-service-error";
12
+ import { CreativeServiceError } from "../../../domain/errors/creative-service-error";
12
13
  import { ok, err, type Result } from "../../../shared/result";
13
14
 
14
15
  /**
@@ -39,12 +40,12 @@ const DEFAULT_FORMAT: ExpressFormat =
39
40
  export class ExpressAdapter implements ExpressAutomationPort {
40
41
  async renderBatch(
41
42
  req: RenderBatchRequest,
42
- ): Promise<Result<string[], FireflyError>> {
43
+ ): Promise<Result<string[], CreativeServiceError>> {
43
44
  // A batch with no variants would submit an empty job the API rejects — guard
44
45
  // up front rather than spending a round-trip to discover it. This is
45
46
  // batch-specific; the single-output image.adobe.io services can't hit it.
46
47
  if (req.items.length === 0) {
47
- return err(new FireflyError("renderBatch requires at least one variant."));
48
+ return err(new CreativeServiceError("unknown", "renderBatch requires at least one variant."));
48
49
  }
49
50
  try {
50
51
  // Presign every variant's destination up front. An asset-valued
@@ -77,7 +78,7 @@ export class ExpressAdapter implements ExpressAutomationPort {
77
78
  // resolves a jobId-only handle in webhook mode and would fail in polling builds.
78
79
  if (!handle.statusUrl) {
79
80
  return err(
80
- new FireflyError(
81
+ new CreativeServiceError("unknown",
81
82
  "Express batch submit response had no status URL to track the job.",
82
83
  ),
83
84
  );
@@ -87,7 +88,7 @@ export class ExpressAdapter implements ExpressAutomationPort {
87
88
  const done = await jobPort.poll(handle);
88
89
  if (done.status !== "succeeded") {
89
90
  return err(
90
- new FireflyError(done.error ?? "Express batch job did not succeed."),
91
+ new CreativeServiceError("unknown", done.error ?? "Express batch job did not succeed."),
91
92
  );
92
93
  }
93
94
  // The port promises one href per item, in request order. `done.outputs` is a
@@ -97,7 +98,7 @@ export class ExpressAdapter implements ExpressAutomationPort {
97
98
  // return a shorter array that no longer lines up with req.items.
98
99
  if (done.outputs.length !== req.items.length) {
99
100
  return err(
100
- new FireflyError(
101
+ new CreativeServiceError("unknown",
101
102
  `Express batch returned ${done.outputs.length} outputs for ${req.items.length} items.`,
102
103
  ),
103
104
  );
@@ -107,14 +108,14 @@ export class ExpressAdapter implements ExpressAutomationPort {
107
108
  const href = done.outputs[i]?.href;
108
109
  if (!href) {
109
110
  return err(
110
- new FireflyError(`Express batch output ${i} has no href.`),
111
+ new CreativeServiceError("unknown", `Express batch output ${i} has no href.`),
111
112
  );
112
113
  }
113
114
  hrefs.push(href);
114
115
  }
115
116
  return ok(hrefs);
116
117
  } catch (error) {
117
- return err(classifyAdobeError(error));
118
+ return err(toCreativeServiceError(error));
118
119
  }
119
120
  }
120
121
  }
@@ -1,7 +1,5 @@
1
1
  import type { Result } from "../../../shared/result";
2
- // Type-only import of the infrastructure error (erased at compile) — types the
3
- // port's failure channel without runtime domain→infra coupling.
4
- import type { FireflyError } from "../../../infrastructure/adobe/errors/firefly-errors";
2
+ import type { CreativeServiceError } from "../../errors/creative-service-error";
5
3
 
6
4
  /**
7
5
  * Outbound port for the Firefly Composite Operations service.
@@ -35,5 +33,5 @@ export interface CompositeRequest extends CompositeOptions {
35
33
 
36
34
  export interface CompositePort {
37
35
  /** Composite `productHref` into `sceneHref`; resolves to candidate output hrefs. */
38
- composite(req: CompositeRequest): Promise<Result<string[], FireflyError>>;
36
+ composite(req: CompositeRequest): Promise<Result<string[], CreativeServiceError>>;
39
37
  }
@@ -7,11 +7,8 @@ import { fireflyClient } from "../http/firefly-client";
7
7
  import { jobPort } from "../jobs/job-port";
8
8
  import { toJobHandle } from "../jobs/job-result";
9
9
  import { getStoragePresigner } from "../storage/passthrough-storage.adapter";
10
- import {
11
- classifyAdobeError,
12
- FireflyError,
13
- FireflyValidationError,
14
- } from "../errors/firefly-errors";
10
+ import { toCreativeServiceError } from "../errors/to-creative-service-error";
11
+ import { CreativeServiceError } from "../../../domain/errors/creative-service-error";
15
12
  import { ok, err, type Result } from "../../../shared/result";
16
13
 
17
14
  /**
@@ -43,12 +40,15 @@ function resolveCandidates(raw: string | undefined): number {
43
40
  }
44
41
 
45
42
  export class FireflyCompositeAdapter implements CompositePort {
46
- async composite(req: CompositeRequest): Promise<Result<string[], FireflyError>> {
43
+ async composite(req: CompositeRequest): Promise<Result<string[], CreativeServiceError>> {
47
44
  // Validate the caller's count up front (the env default is already validated)
48
- // rather than letting an out-of-range value reach the API as a 400.
45
+ // rather than letting an out-of-range value reach the API as a 400. This
46
+ // returns the port's own failure type directly: the request never reached the
47
+ // vendor, so there is no vendor error to map (ADR-0053 §1).
49
48
  if (req.numVariations !== undefined && !isValidCandidates(req.numVariations)) {
50
49
  return err(
51
- new FireflyValidationError(
50
+ new CreativeServiceError(
51
+ "invalid-request",
52
52
  `Invalid candidate count ${JSON.stringify(req.numVariations)} — must be an integer between 1 and 10.`,
53
53
  ),
54
54
  );
@@ -74,22 +74,22 @@ export class FireflyCompositeAdapter implements CompositePort {
74
74
 
75
75
  const handle = toJobHandle(await fireflyClient.post(ENDPOINT, body));
76
76
  if (!handle.jobId) {
77
- return err(new FireflyError("Composite submit response did not include a job id."));
77
+ return err(new CreativeServiceError("unknown", "Composite submit response did not include a job id."));
78
78
  }
79
79
  const done = await jobPort.await(handle);
80
80
  if (done.status !== "succeeded") {
81
- return err(new FireflyError(done.error ?? "Composite job did not succeed."));
81
+ return err(new CreativeServiceError("unknown", done.error ?? "Composite job did not succeed."));
82
82
  }
83
83
  // Multiple candidates — return them all.
84
84
  const hrefs = done.outputs
85
85
  .map((o) => o.href)
86
86
  .filter((href): href is string => Boolean(href));
87
87
  if (hrefs.length === 0) {
88
- return err(new FireflyError("Composite job produced no output."));
88
+ return err(new CreativeServiceError("unknown", "Composite job produced no output."));
89
89
  }
90
90
  return ok(hrefs);
91
91
  } catch (error) {
92
- return err(classifyAdobeError(error));
92
+ return err(toCreativeServiceError(error));
93
93
  }
94
94
  }
95
95
  }
@@ -1,7 +1,5 @@
1
1
  import type { Result } from "../../../shared/result";
2
- // Type-only import of the infrastructure error (erased at compile) — types the
3
- // port's failure channel without runtime domain→infra coupling.
4
- import type { FireflyError } from "../../../infrastructure/adobe/errors/firefly-errors";
2
+ import type { CreativeServiceError } from "../../errors/creative-service-error";
5
3
 
6
4
  /**
7
5
  * Outbound port for the Firefly Content Tagging service.
@@ -24,5 +22,5 @@ export interface ContentTaggingResult {
24
22
 
25
23
  export interface ContentTaggingPort {
26
24
  /** Return structured tags for the image at `inputHref` (presigned). */
27
- tag(inputHref: string): Promise<Result<ContentTaggingResult, FireflyError>>;
25
+ tag(inputHref: string): Promise<Result<ContentTaggingResult, CreativeServiceError>>;
28
26
  }
@@ -8,7 +8,8 @@ import { fireflyClient } from "../http/firefly-client";
8
8
  import { jobPort } from "../jobs/job-port";
9
9
  import { toJobHandle } from "../jobs/job-result";
10
10
  import { getStoragePresigner } from "../storage/passthrough-storage.adapter";
11
- import { classifyAdobeError, FireflyError } from "../errors/firefly-errors";
11
+ import { toCreativeServiceError } from "../errors/to-creative-service-error";
12
+ import { CreativeServiceError } from "../../../domain/errors/creative-service-error";
12
13
  import { ok, err, type Result } from "../../../shared/result";
13
14
 
14
15
  /**
@@ -36,7 +37,7 @@ function resolveMinConfidence(raw: string | undefined): number {
36
37
  }
37
38
 
38
39
  export class FireflyContentTaggingAdapter implements ContentTaggingPort {
39
- async tag(inputHref: string): Promise<Result<ContentTaggingResult, FireflyError>> {
40
+ async tag(inputHref: string): Promise<Result<ContentTaggingResult, CreativeServiceError>> {
40
41
  try {
41
42
  const input = await getStoragePresigner().presignInput(inputHref);
42
43
  const response = await fireflyClient.post<unknown>(ENDPOINT, {
@@ -54,21 +55,21 @@ export class FireflyContentTaggingAdapter implements ContentTaggingPort {
54
55
  if (isAsync) {
55
56
  const done = await jobPort.await(handle);
56
57
  if (done.status !== "succeeded") {
57
- return err(new FireflyError(done.error ?? "Content tagging job did not succeed."));
58
+ return err(new CreativeServiceError("unknown", done.error ?? "Content tagging job did not succeed."));
58
59
  }
59
60
  const data = done.outputs[0]?.data;
60
61
  if (data === undefined) {
61
62
  // A succeeded job with no data means the provider payload shape changed —
62
63
  // surface it rather than masking it as an empty success. Do NOT fall back
63
64
  // to the submit response on the async path.
64
- return err(new FireflyError(done.error ?? "Content tagging job produced no output data."));
65
+ return err(new CreativeServiceError("unknown", done.error ?? "Content tagging job produced no output data."));
65
66
  }
66
67
  payload = data;
67
68
  }
68
69
 
69
70
  return ok({ tags: extractTags(payload), raw: payload });
70
71
  } catch (error) {
71
- return err(classifyAdobeError(error));
72
+ return err(toCreativeServiceError(error));
72
73
  }
73
74
  }
74
75
  }
@@ -124,7 +124,7 @@ npx tsx src/infrastructure/adobe/auth/smoke-token.ts
124
124
  - **`image.adobe.io` adapter invariants:** `@hexagen-server-only`; absolute URLs via
125
125
  `normalizeBase()` (scheme lowercased, trailing slash stripped); status-URL-required guard
126
126
  before polling; type-only `import type { FireflyError }` in domain ports.
127
- - **Tests:** `node:test` + **`node:assert/strict`** (package-wide convention); emit-shape
127
+ - **Tests:** Vitest + **`node:assert/strict`** (package-wide convention); emit-shape
128
128
  tests string-match the payload and are named `adobe-<service>-emit-shape.test.ts`.
129
129
 
130
130
  ## Checklist (post-install)
@@ -0,0 +1,62 @@
1
+ /**
2
+ * The failure channel of the creative-service out-ports — owned by the domain,
3
+ * not by any vendor adapter (ADR-0053).
4
+ *
5
+ * `kind` enumerates the failure modes a caller can act on (re-authenticate, ask
6
+ * for an entitlement, back off, fix the request, retry). Nothing here names a
7
+ * vendor, an SDK or a transport, so a port typed with this union can be
8
+ * satisfied by any implementation — the shipped adapters, a different creative
9
+ * service, or a test double — and the concrete, server-only vendor error
10
+ * classes never cross into the domain or into a client bundle.
11
+ *
12
+ * Adapters map their own failures onto this union at their boundary (see
13
+ * `toCreativeServiceError()` in the infrastructure layer).
14
+ */
15
+ export type CreativeServiceErrorKind =
16
+ /** Credentials rejected or missing. */
17
+ | "auth"
18
+ /** Authenticated, but the org/credential lacks the service entitlement. */
19
+ | "entitlement"
20
+ /** Throttled; `retryAfterMs` carries the service's hint when it gave one. */
21
+ | "rate-limited"
22
+ /** The request itself is wrong — retrying it unchanged cannot help. */
23
+ | "invalid-request"
24
+ /** Upstream failure; safe to retry. */
25
+ | "service"
26
+ /** Unclassifiable. */
27
+ | "unknown";
28
+
29
+ export interface CreativeServiceErrorOptions {
30
+ /** Upstream status code, when the failure came from an HTTP boundary. */
31
+ readonly status?: number;
32
+ /** Overrides the default retryability implied by `kind`. */
33
+ readonly retryable?: boolean;
34
+ /** Backoff hint in milliseconds (rate-limited responses). */
35
+ readonly retryAfterMs?: number;
36
+ }
37
+
38
+ /** Kinds a caller may retry unchanged, absent an explicit override. */
39
+ const RETRYABLE_KINDS: ReadonlySet<CreativeServiceErrorKind> = new Set([
40
+ "rate-limited",
41
+ "service",
42
+ ]);
43
+
44
+ export class CreativeServiceError extends Error {
45
+ readonly kind: CreativeServiceErrorKind;
46
+ readonly status?: number;
47
+ readonly retryable: boolean;
48
+ readonly retryAfterMs?: number;
49
+
50
+ constructor(
51
+ kind: CreativeServiceErrorKind,
52
+ message: string,
53
+ options: CreativeServiceErrorOptions = {},
54
+ ) {
55
+ super(message);
56
+ this.name = "CreativeServiceError";
57
+ this.kind = kind;
58
+ this.status = options.status;
59
+ this.retryable = options.retryable ?? RETRYABLE_KINDS.has(kind);
60
+ this.retryAfterMs = options.retryAfterMs;
61
+ }
62
+ }
@@ -0,0 +1,45 @@
1
+ // @hexagen-server-only
2
+ import {
3
+ CreativeServiceError,
4
+ type CreativeServiceErrorKind,
5
+ } from "../../../domain/errors/creative-service-error";
6
+ import {
7
+ classifyAdobeError,
8
+ FireflyAuthError,
9
+ FireflyEntitlementError,
10
+ FireflyError,
11
+ FireflyRateLimitError,
12
+ FireflyServiceError,
13
+ FireflyValidationError,
14
+ } from "./firefly-errors";
15
+
16
+ /**
17
+ * The adapter-boundary mapping required by ADR-0053: a concrete, server-only
18
+ * `FireflyError` in, a domain `CreativeServiceError` out.
19
+ *
20
+ * Adapters call this in their `catch` so the vendor error hierarchy stops at the
21
+ * infrastructure layer and the port's `Result<T, CreativeServiceError>` contract
22
+ * stays provider-neutral. Anything unrecognised is classified first, so a raw
23
+ * thrown value (a fetch failure, a timeout) still arrives typed.
24
+ */
25
+ export function toCreativeServiceError(error: unknown): CreativeServiceError {
26
+ if (error instanceof CreativeServiceError) return error;
27
+ const classified = classifyAdobeError(error);
28
+ return new CreativeServiceError(kindOf(classified), classified.message, {
29
+ status: classified.status,
30
+ retryable: classified.retryable,
31
+ retryAfterMs:
32
+ classified instanceof FireflyRateLimitError
33
+ ? classified.retryAfterMs
34
+ : undefined,
35
+ });
36
+ }
37
+
38
+ function kindOf(error: FireflyError): CreativeServiceErrorKind {
39
+ if (error instanceof FireflyEntitlementError) return "entitlement";
40
+ if (error instanceof FireflyAuthError) return "auth";
41
+ if (error instanceof FireflyRateLimitError) return "rate-limited";
42
+ if (error instanceof FireflyValidationError) return "invalid-request";
43
+ if (error instanceof FireflyServiceError) return "service";
44
+ return "unknown";
45
+ }
@@ -29,6 +29,15 @@ export {
29
29
  classifyAdobeError,
30
30
  } from "./errors/firefly-errors";
31
31
  export type { AdobeErrorLike } from "./errors/firefly-errors";
32
+ export { toCreativeServiceError } from "./errors/to-creative-service-error";
33
+
34
+ // The out-ports' failure channel is domain-owned (ADR-0053); re-exported here so
35
+ // service adapters and callers keep a single import for the foundation.
36
+ export { CreativeServiceError } from "../../domain/errors/creative-service-error";
37
+ export type {
38
+ CreativeServiceErrorKind,
39
+ CreativeServiceErrorOptions,
40
+ } from "../../domain/errors/creative-service-error";
32
41
 
33
42
  export type {
34
43
  FireflyAuthPort,