@hexagen-monaco/sync 0.5.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/cli.js +1610 -620
  2. package/dist/cli.js.map +1 -1
  3. package/dist/config.d.ts +24 -0
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/domain/types.d.ts +8 -1
  6. package/dist/domain/types.d.ts.map +1 -1
  7. package/dist/fs-utils.d.ts +17 -4
  8. package/dist/fs-utils.d.ts.map +1 -1
  9. package/dist/generators/apps-framework-templates.d.ts +2 -1
  10. package/dist/generators/apps-framework-templates.d.ts.map +1 -1
  11. package/dist/generators/apps.d.ts.map +1 -1
  12. package/dist/generators/architecture-files.d.ts.map +1 -1
  13. package/dist/generators/barrels/recursive.d.ts +2 -3
  14. package/dist/generators/barrels/recursive.d.ts.map +1 -1
  15. package/dist/generators/barrels.d.ts +2 -3
  16. package/dist/generators/barrels.d.ts.map +1 -1
  17. package/dist/generators/cross-context.d.ts +5 -0
  18. package/dist/generators/cross-context.d.ts.map +1 -0
  19. package/dist/generators/eslint.d.ts +3 -1
  20. package/dist/generators/eslint.d.ts.map +1 -1
  21. package/dist/generators/layer-folders.d.ts +18 -6
  22. package/dist/generators/layer-folders.d.ts.map +1 -1
  23. package/dist/generators/package-json.d.ts +2 -3
  24. package/dist/generators/package-json.d.ts.map +1 -1
  25. package/dist/generators/port-analyzer.d.ts +38 -4
  26. package/dist/generators/port-analyzer.d.ts.map +1 -1
  27. package/dist/generators/reap.d.ts +7 -3
  28. package/dist/generators/reap.d.ts.map +1 -1
  29. package/dist/generators/root-file-templates.d.ts +4 -4
  30. package/dist/generators/root-file-templates.d.ts.map +1 -1
  31. package/dist/generators/root-files.d.ts.map +1 -1
  32. package/dist/generators/shared-kernel.d.ts +23 -0
  33. package/dist/generators/shared-kernel.d.ts.map +1 -0
  34. package/dist/generators/stubs.d.ts +13 -0
  35. package/dist/generators/stubs.d.ts.map +1 -1
  36. package/dist/generators/tsconfig.d.ts.map +1 -1
  37. package/dist/index.js +1441 -470
  38. package/dist/index.js.map +1 -1
  39. package/dist/journal.d.ts +64 -0
  40. package/dist/journal.d.ts.map +1 -0
  41. package/dist/migration-report.d.ts +13 -2
  42. package/dist/migration-report.d.ts.map +1 -1
  43. package/dist/results.d.ts +66 -0
  44. package/dist/results.d.ts.map +1 -1
  45. package/dist/scope-filter.d.ts +35 -0
  46. package/dist/scope-filter.d.ts.map +1 -0
  47. package/dist/sync-engine-helpers.d.ts.map +1 -1
  48. package/dist/sync-engine.d.ts +13 -1
  49. package/dist/sync-engine.d.ts.map +1 -1
  50. package/dist/templates/adobe-creative-production/manifest.json +2 -0
  51. package/dist/templates/adobe-express/manifest.json +2 -0
  52. package/dist/templates/adobe-firefly-composite/manifest.json +2 -0
  53. package/dist/templates/adobe-firefly-content-tagging/manifest.json +2 -0
  54. package/dist/templates/adobe-firefly-core/manifest.json +2 -0
  55. package/dist/templates/adobe-firefly-custom-models/manifest.json +2 -0
  56. package/dist/templates/adobe-firefly-generate/manifest.json +2 -0
  57. package/dist/templates/adobe-firefly-media/manifest.json +2 -0
  58. package/dist/templates/adobe-firefly-storage-azure/manifest.json +2 -0
  59. package/dist/templates/adobe-firefly-storage-gcs/manifest.json +2 -0
  60. package/dist/templates/adobe-firefly-storage-s3/manifest.json +2 -0
  61. package/dist/templates/adobe-firefly-upscale/manifest.json +2 -0
  62. package/dist/templates/adobe-illustrator/manifest.json +2 -0
  63. package/dist/templates/adobe-ims-spa/manifest.json +2 -0
  64. package/dist/templates/adobe-indesign/manifest.json +2 -0
  65. package/dist/templates/adobe-lightroom/manifest.json +2 -0
  66. package/dist/templates/adobe-photoshop/manifest.json +2 -0
  67. package/dist/templates/adobe-substance-3d/manifest.json +2 -0
  68. package/dist/templates/auth-mock/manifest.json +2 -0
  69. package/dist/templates/bedrock-agentcore-runtime/manifest.json +10 -2
  70. package/dist/templates/bedrock-agentcore-services/manifest.json +38 -9
  71. package/dist/templates/better-auth/manifest.json +2 -0
  72. package/dist/templates/bullmq/manifest.json +2 -0
  73. package/dist/templates/ci-github-actions/README.md +7 -0
  74. package/dist/templates/ci-github-actions/files/.github/dependabot.yml +16 -4
  75. package/dist/templates/ci-github-actions/files/.github/workflows/ci.yml +7 -3
  76. package/dist/templates/ci-github-actions/files/.github/workflows/preview.yml +20 -2
  77. package/dist/templates/ci-github-actions/manifest.json +26 -6
  78. package/dist/templates/clerk/manifest.json +2 -0
  79. package/dist/templates/design-system/manifest.json +14 -3
  80. package/dist/templates/docker/manifest.json +2 -0
  81. package/dist/templates/error-handling/manifest.json +2 -0
  82. package/dist/templates/eslint-no-console/manifest.json +2 -0
  83. package/dist/templates/github-oauth/manifest.json +2 -0
  84. package/dist/templates/google-oauth/manifest.json +2 -0
  85. package/dist/templates/langgraph/manifest.json +62 -15
  86. package/dist/templates/llm-adapter/manifest.json +2 -0
  87. package/dist/templates/magic-link/manifest.json +2 -0
  88. package/dist/templates/mcp-server/README.md +49 -0
  89. package/dist/templates/mcp-server/files/.env.mcp.example +6 -0
  90. package/dist/templates/mcp-server/files/.mcp.json.example +8 -0
  91. package/dist/templates/mcp-server/files/bin/cli.ts +15 -0
  92. package/dist/templates/mcp-server/files/src/infrastructure/mcp/prompts/example.prompt.ts +32 -0
  93. package/dist/templates/mcp-server/files/src/infrastructure/mcp/registry/register-all.ts +11 -0
  94. package/dist/templates/mcp-server/files/src/infrastructure/mcp/registry/tool-registry.test.ts +67 -0
  95. package/dist/templates/mcp-server/files/src/infrastructure/mcp/registry/tool-registry.ts +45 -0
  96. package/dist/templates/mcp-server/files/src/infrastructure/mcp/resources/example.resource.ts +28 -0
  97. package/dist/templates/mcp-server/files/src/infrastructure/mcp/sdk.ts +41 -0
  98. package/dist/templates/mcp-server/files/src/infrastructure/mcp/server.ts +52 -0
  99. package/dist/templates/mcp-server/files/src/infrastructure/mcp/tools/example.tool.test.ts +31 -0
  100. package/dist/templates/mcp-server/files/src/infrastructure/mcp/tools/example.tool.ts +74 -0
  101. package/dist/templates/mcp-server/files/src/infrastructure/mcp/transport/register-transports.ts +15 -0
  102. package/dist/templates/mcp-server/files/src/infrastructure/mcp/transport/stdio.ts +14 -0
  103. package/dist/templates/mcp-server/manifest.json +68 -0
  104. package/dist/templates/mcp-server-http/README.md +98 -0
  105. package/dist/templates/mcp-server-http/files/.env.mcp-http.example +22 -0
  106. package/dist/templates/mcp-server-http/files/src/infrastructure/mcp/auth/bearer.test.ts +54 -0
  107. package/dist/templates/mcp-server-http/files/src/infrastructure/mcp/auth/bearer.ts +49 -0
  108. package/dist/templates/mcp-server-http/files/src/infrastructure/mcp/auth/oauth.test.ts +50 -0
  109. package/dist/templates/mcp-server-http/files/src/infrastructure/mcp/auth/oauth.ts +53 -0
  110. package/dist/templates/mcp-server-http/files/src/infrastructure/mcp/guard.test.ts +75 -0
  111. package/dist/templates/mcp-server-http/files/src/infrastructure/mcp/guard.ts +26 -0
  112. package/dist/templates/mcp-server-http/files/src/infrastructure/mcp/transport/http.ts +94 -0
  113. package/dist/templates/mcp-server-http/files/src/infrastructure/mcp/transport/register-transports.ts +15 -0
  114. package/dist/templates/mcp-server-http/manifest.json +56 -0
  115. package/dist/templates/microsoft-entra/manifest.json +2 -0
  116. package/dist/templates/nextauth/manifest.json +2 -0
  117. package/dist/templates/observability/manifest.json +10 -2
  118. package/dist/templates/rate-limiting/manifest.json +2 -0
  119. package/dist/templates/shared-types/manifest.json +2 -0
  120. package/dist/templates/supabase/manifest.json +2 -0
  121. package/dist/templates/supabase-auth/manifest.json +2 -0
  122. package/dist/toolchain-version.d.ts +14 -0
  123. package/dist/toolchain-version.d.ts.map +1 -0
  124. package/dist/types/manifest/apps.d.ts +12 -1
  125. package/dist/types/manifest/apps.d.ts.map +1 -1
  126. package/package.json +1 -1
  127. package/dist/application/use-cases/stub-generation.use-case.d.ts +0 -23
  128. package/dist/application/use-cases/stub-generation.use-case.d.ts.map +0 -1
  129. package/dist/generators/migration-assistant.d.ts +0 -7
  130. package/dist/generators/migration-assistant.d.ts.map +0 -1
  131. package/dist/generators/migration-audit.d.ts +0 -28
  132. package/dist/generators/migration-audit.d.ts.map +0 -1
  133. package/dist/generators/migration-stubs.d.ts +0 -7
  134. package/dist/generators/migration-stubs.d.ts.map +0 -1
  135. package/dist/generators/test-generator.d.ts +0 -7
  136. package/dist/generators/test-generator.d.ts.map +0 -1
  137. package/dist/generators/test-templates/data-builder.d.ts +0 -2
  138. package/dist/generators/test-templates/data-builder.d.ts.map +0 -1
  139. package/dist/generators/test-templates/enhanced-test-double.d.ts +0 -2
  140. package/dist/generators/test-templates/enhanced-test-double.d.ts.map +0 -1
  141. package/dist/generators/test-templates/index.d.ts +0 -5
  142. package/dist/generators/test-templates/index.d.ts.map +0 -1
  143. package/dist/generators/test-templates/integration-test.d.ts +0 -2
  144. package/dist/generators/test-templates/integration-test.d.ts.map +0 -1
  145. package/dist/generators/test-templates/unit-test.d.ts +0 -2
  146. package/dist/generators/test-templates/unit-test.d.ts.map +0 -1
  147. package/dist/generators/wiring.d.ts +0 -20
  148. package/dist/generators/wiring.d.ts.map +0 -1
@@ -1,20 +1,32 @@
1
1
  version: 2
2
2
  updates:
3
3
  # Keep GitHub Actions versions current — stale, unpinned actions are a real
4
- # supply-chain risk.
4
+ # supply-chain risk. Grouped so a sweep of action bumps is ONE PR, not one per
5
+ # action (a fresh repo is "behind latest" on every action at first push).
5
6
  - package-ecosystem: github-actions
6
7
  directory: /
7
8
  schedule:
8
9
  interval: weekly
9
10
  open-pull-requests-limit: 5
11
+ groups:
12
+ github-actions:
13
+ patterns: ["*"]
10
14
 
11
- # Group dev-dependency bumps into a single weekly PR to cut noise.
15
+ # npm: batch NON-BREAKING bumps (minor + patch) into one PR per dependency
16
+ # type, so a freshly published repo doesn't open a wave of PRs (every dep is
17
+ # "behind latest" at once on first push — previously production deps were
18
+ # ungrouped, so each one opened its own PR). MAJOR bumps still arrive
19
+ # individually so each potentially-breaking change is reviewed on its own.
20
+ # To go quieter still, switch npm to security-only updates — see README.
12
21
  - package-ecosystem: npm
13
22
  directory: /
14
23
  schedule:
15
24
  interval: weekly
25
+ open-pull-requests-limit: 5
16
26
  groups:
27
+ production-dependencies:
28
+ dependency-type: production
29
+ update-types: ["minor", "patch"]
17
30
  dev-dependencies:
18
- patterns: ["*"]
19
31
  dependency-type: development
20
- open-pull-requests-limit: 5
32
+ update-types: ["minor", "patch"]
@@ -36,9 +36,13 @@ jobs:
36
36
  - uses: actions/setup-node@v4
37
37
  with:
38
38
  node-version: "{node_version}"
39
- # No package-manager cache here — actions/setup-node's cache requires a
40
- # committed lockfile and fails without one. The Turbo cache below covers
41
- # task outputs; re-enable the setup-node cache once you commit yarn.lock.
39
+ # No `cache: yarn` here. setup-node's yarn cache runs the runner's
40
+ # global Yarn (Classic 1.22) to locate the store — BEFORE the Corepack
41
+ # steps below activate the pinned yarn@4 — so it fails on a
42
+ # packageManager-pinned project. Committing yarn.lock does NOT make it
43
+ # safe: the hazard is ordering, not the lockfile. To cache, add a
44
+ # separate actions/cache step AFTER Corepack instead. The Turbo cache
45
+ # below already covers task outputs.
42
46
 
43
47
  # Corepack activates the package manager pinned in package.json
44
48
  # (`packageManager`). Without it, the runner's default Yarn (Classic)
@@ -34,9 +34,27 @@ jobs:
34
34
  - uses: actions/setup-node@v4
35
35
  with:
36
36
  node-version: "{node_version}"
37
- cache: "yarn"
37
+ # No `cache: yarn` here. setup-node's yarn cache runs the runner's
38
+ # global Yarn (Classic 1.22) to locate the store — BEFORE the Corepack
39
+ # steps below activate the pinned yarn@4 — so it fails on a
40
+ # packageManager-pinned project. Committing yarn.lock does NOT make it
41
+ # safe: the hazard is ordering, not the lockfile. To cache, add a
42
+ # separate actions/cache step AFTER Corepack instead. Mirrors ci.yml.
38
43
 
39
- - run: "yarn install --immutable"
44
+ # Corepack activates the package manager pinned in package.json
45
+ # (`packageManager`); without it the runner's default Yarn (Classic) can't
46
+ # honor a Yarn-4 project. Mirrors ci.yml. See SETUP.md.
47
+ - name: Enable Corepack
48
+ run: corepack enable
49
+
50
+ - name: Prepare package manager
51
+ run: |
52
+ corepack prepare "$(node -p 'require("./package.json").packageManager')" --activate
53
+
54
+ # First run has no committed lockfile, so install is NOT immutable. Switch
55
+ # to `yarn install --immutable` after you commit yarn.lock. See SETUP.md.
56
+ - name: Install dependencies
57
+ run: "yarn install"
40
58
 
41
59
  - name: Deploy preview
42
60
  id: deploy
@@ -2,6 +2,8 @@
2
2
  "id": "ci-github-actions",
3
3
  "name": "CI / GitHub Actions",
4
4
  "description": "GitHub Actions CI (build/typecheck/lint/test) with Turbo cache, a per-target deploy workflow (Vercel/Railway/Fly.io/VPS), optional PR preview deploys, and Dependabot",
5
+ "provides": "platform.ci",
6
+ "scope": "project",
5
7
  "version": "1.0.0",
6
8
  "requires": [],
7
9
  "conflicts": [],
@@ -64,27 +66,45 @@
64
66
  ".github/dependabot.yml",
65
67
  {
66
68
  "path": ".github/workflows/deploy-vercel.yml",
67
- "when": { "answer": "deploy_target", "equals": "vercel" }
69
+ "when": {
70
+ "answer": "deploy_target",
71
+ "equals": "vercel"
72
+ }
68
73
  },
69
74
  {
70
75
  "path": ".github/workflows/deploy-railway.yml",
71
- "when": { "answer": "deploy_target", "equals": "railway" }
76
+ "when": {
77
+ "answer": "deploy_target",
78
+ "equals": "railway"
79
+ }
72
80
  },
73
81
  {
74
82
  "path": ".github/workflows/deploy-fly.yml",
75
- "when": { "answer": "deploy_target", "equals": "fly-io" }
83
+ "when": {
84
+ "answer": "deploy_target",
85
+ "equals": "fly-io"
86
+ }
76
87
  },
77
88
  {
78
89
  "path": "fly.toml",
79
- "when": { "answer": "deploy_target", "equals": "fly-io" }
90
+ "when": {
91
+ "answer": "deploy_target",
92
+ "equals": "fly-io"
93
+ }
80
94
  },
81
95
  {
82
96
  "path": ".github/workflows/deploy-vps.yml",
83
- "when": { "answer": "deploy_target", "equals": "vps-ssh" }
97
+ "when": {
98
+ "answer": "deploy_target",
99
+ "equals": "vps-ssh"
100
+ }
84
101
  },
85
102
  {
86
103
  "path": ".github/workflows/preview.yml",
87
- "when": { "answer": "preview_deploys", "equals": true }
104
+ "when": {
105
+ "answer": "preview_deploys",
106
+ "equals": true
107
+ }
88
108
  }
89
109
  ],
90
110
  "checklist": [
@@ -3,6 +3,8 @@
3
3
  "name": "Clerk",
4
4
  "description": "Standalone Clerk integration: clerkMiddleware route protection, server-side auth helpers, org/app-level RoleGuard component, protected route group, and a JWT-template API example",
5
5
  "version": "1.0.0",
6
+ "provides": "platform.auth",
7
+ "scope": "project",
6
8
  "requires": ["env-setup"],
7
9
  "conflicts": [
8
10
  "auth-mock",
@@ -2,6 +2,8 @@
2
2
  "id": "design-system",
3
3
  "name": "Design System",
4
4
  "description": "Populated DESIGN.md contract, CSS custom property tokens, Tailwind config extension, base component stubs",
5
+ "provides": "platform.design-system",
6
+ "scope": "project",
5
7
  "version": "1.0.0",
6
8
  "requires": [],
7
9
  "conflicts": [],
@@ -58,15 +60,24 @@
58
60
  "tailwind.config.ts",
59
61
  {
60
62
  "path": ".storybook/main.ts",
61
- "when": { "answer": "storybook", "equals": true }
63
+ "when": {
64
+ "answer": "storybook",
65
+ "equals": true
66
+ }
62
67
  },
63
68
  {
64
69
  "path": ".storybook/preview.ts",
65
- "when": { "answer": "storybook", "equals": true }
70
+ "when": {
71
+ "answer": "storybook",
72
+ "equals": true
73
+ }
66
74
  },
67
75
  {
68
76
  "path": "src/components/ui/button.stories.tsx",
69
- "when": { "answer": "storybook", "equals": true }
77
+ "when": {
78
+ "answer": "storybook",
79
+ "equals": true
80
+ }
70
81
  }
71
82
  ],
72
83
  "checklist": [
@@ -3,6 +3,8 @@
3
3
  "name": "Docker",
4
4
  "description": "Multi-stage Dockerfile, docker-compose with peer services, dev override for hot reload, GitHub Actions image push",
5
5
  "version": "1.0.0",
6
+ "provides": "platform.container",
7
+ "scope": "project",
6
8
  "requires": [],
7
9
  "conflicts": [],
8
10
  "questions": [
@@ -3,6 +3,8 @@
3
3
  "name": "Error Handling",
4
4
  "description": "3-layer error hierarchy, Result<T,E> type, RFC 7807 HTTP mapping, React error boundary",
5
5
  "version": "1.0.0",
6
+ "provides": "platform.error-handling",
7
+ "scope": "project",
6
8
  "requires": ["env-setup"],
7
9
  "conflicts": [],
8
10
  "questions": [
@@ -3,6 +3,8 @@
3
3
  "name": "ESLint — no-console (logger enforcement)",
4
4
  "description": "A drop-in ESLint flat-config fragment that bans console.* (no-console) so logging goes through the structured logger instead of console.log technical debt — with the logger transport, server startup, CLI scripts, and config files exempted. Spread it into your eslint.config.mjs.",
5
5
  "version": "1.0.0",
6
+ "provides": "platform.lint",
7
+ "scope": "project",
6
8
  "requires": [],
7
9
  "conflicts": [],
8
10
  "questions": [
@@ -3,6 +3,8 @@
3
3
  "name": "GitHub OAuth",
4
4
  "description": "GitHub OAuth App integration: code exchange, primary-email fetch, org-membership gate, AES-256-GCM stateless session cookie, and a root middleware that protects configured paths while still honouring AUTH_MODE=mock as a dev short-circuit.",
5
5
  "version": "2.0.0",
6
+ "provides": "platform.auth",
7
+ "scope": "project",
6
8
  "requires": ["shared-types", "auth-mock", "env-setup"],
7
9
  "conflicts": [
8
10
  "nextauth",
@@ -3,6 +3,8 @@
3
3
  "name": "Google OAuth 2.0",
4
4
  "description": "Server-side Google OAuth 2.0: authorization code flow, userinfo fetch, AES-256-GCM session cookie, optional hosted-domain restriction, and a root middleware that protects configured paths while still honouring AUTH_MODE=mock as a dev short-circuit.",
5
5
  "version": "2.0.0",
6
+ "provides": "platform.auth",
7
+ "scope": "project",
6
8
  "requires": ["shared-types", "auth-mock", "env-setup"],
7
9
  "conflicts": [
8
10
  "nextauth",
@@ -2,6 +2,8 @@
2
2
  "id": "langgraph",
3
3
  "name": "LangGraph",
4
4
  "description": "Hexagonal LangGraph integration: typed AgentGraphPort, shared GraphState, node files, conditional edge routing, swap-by-env checkpointers (memory/supabase/redis/postgres), and Next.js routes for invoke / optional streaming / optional human-in-the-loop resume. Comes with one of two working example graphs (simple-chain or research-agent) so the wiring is end-to-end out of the box.",
5
+ "provides": "agent.out-adapter",
6
+ "scope": "context",
5
7
  "version": "1.0.0",
6
8
  "requires": ["env-setup", "llm-adapter"],
7
9
  "conflicts": [],
@@ -59,63 +61,108 @@
59
61
  ".env.langgraph.example",
60
62
  {
61
63
  "path": "src/infrastructure/langgraph/nodes/input-processor.node.ts",
62
- "when": { "answer": "graph_type", "equals": "simple-chain" }
64
+ "when": {
65
+ "answer": "graph_type",
66
+ "equals": "simple-chain"
67
+ }
63
68
  },
64
69
  {
65
70
  "path": "src/infrastructure/langgraph/nodes/llm-call.node.ts",
66
- "when": { "answer": "graph_type", "equals": "simple-chain" }
71
+ "when": {
72
+ "answer": "graph_type",
73
+ "equals": "simple-chain"
74
+ }
67
75
  },
68
76
  {
69
77
  "path": "src/infrastructure/langgraph/nodes/output-formatter.node.ts",
70
- "when": { "answer": "graph_type", "equals": "simple-chain" }
78
+ "when": {
79
+ "answer": "graph_type",
80
+ "equals": "simple-chain"
81
+ }
71
82
  },
72
83
  {
73
84
  "path": "src/infrastructure/langgraph/graphs/simple-chain.graph.ts",
74
- "when": { "answer": "graph_type", "equals": "simple-chain" }
85
+ "when": {
86
+ "answer": "graph_type",
87
+ "equals": "simple-chain"
88
+ }
75
89
  },
76
90
  {
77
91
  "path": "src/infrastructure/langgraph/nodes/planner.node.ts",
78
- "when": { "answer": "graph_type", "equals": "research-agent" }
92
+ "when": {
93
+ "answer": "graph_type",
94
+ "equals": "research-agent"
95
+ }
79
96
  },
80
97
  {
81
98
  "path": "src/infrastructure/langgraph/nodes/researcher.node.ts",
82
- "when": { "answer": "graph_type", "equals": "research-agent" }
99
+ "when": {
100
+ "answer": "graph_type",
101
+ "equals": "research-agent"
102
+ }
83
103
  },
84
104
  {
85
105
  "path": "src/infrastructure/langgraph/nodes/synthesiser.node.ts",
86
- "when": { "answer": "graph_type", "equals": "research-agent" }
106
+ "when": {
107
+ "answer": "graph_type",
108
+ "equals": "research-agent"
109
+ }
87
110
  },
88
111
  {
89
112
  "path": "src/infrastructure/langgraph/graphs/research-agent.graph.ts",
90
- "when": { "answer": "graph_type", "equals": "research-agent" }
113
+ "when": {
114
+ "answer": "graph_type",
115
+ "equals": "research-agent"
116
+ }
91
117
  },
92
118
  {
93
119
  "path": "src/infrastructure/langgraph/checkpointers/supabase-checkpointer.ts",
94
- "when": { "answer": "checkpointing", "equals": "supabase" }
120
+ "when": {
121
+ "answer": "checkpointing",
122
+ "equals": "supabase"
123
+ }
95
124
  },
96
125
  {
97
126
  "path": "src/infrastructure/langgraph/checkpointers/redis-checkpointer.ts",
98
- "when": { "answer": "checkpointing", "equals": "redis" }
127
+ "when": {
128
+ "answer": "checkpointing",
129
+ "equals": "redis"
130
+ }
99
131
  },
100
132
  {
101
133
  "path": "src/infrastructure/langgraph/checkpointers/postgres-checkpointer.ts",
102
- "when": { "answer": "checkpointing", "equals": "postgres" }
134
+ "when": {
135
+ "answer": "checkpointing",
136
+ "equals": "postgres"
137
+ }
103
138
  },
104
139
  {
105
140
  "path": "src/infrastructure/langgraph/streaming/token-stream.ts",
106
- "when": { "answer": "streaming", "equals": true }
141
+ "when": {
142
+ "answer": "streaming",
143
+ "equals": true
144
+ }
107
145
  },
108
146
  {
109
147
  "path": "app/api/agent/stream/route.ts",
110
- "when": { "answer": "streaming", "equals": true }
148
+ "when": {
149
+ "answer": "streaming",
150
+ "equals": true
151
+ }
111
152
  },
112
153
  {
113
154
  "path": "src/infrastructure/langgraph/nodes/human-review.node.ts",
114
- "when": { "answer": "human_in_loop", "equals": true }
155
+ "when": {
156
+ "answer": "human_in_loop",
157
+ "equals": true
158
+ }
115
159
  },
116
160
  {
117
161
  "path": "app/api/agent/resume/route.ts",
118
- "when": { "answer": "human_in_loop", "equals": true }
162
+ "when": {
163
+ "answer": "human_in_loop",
164
+ "equals": true
165
+ }
119
166
  }
120
167
  ],
121
168
  "checklist": [
@@ -3,6 +3,8 @@
3
3
  "name": "LLM Adapter",
4
4
  "description": "Typed port interface, provider adapters (xAI, OpenAI, Anthropic, Ollama, Azure OpenAI), model constants, reasoning routing, retry logic, structured output",
5
5
  "version": "1.0.0",
6
+ "provides": "llm.out-adapter",
7
+ "scope": "context",
6
8
  "requires": ["env-setup", "error-handling"],
7
9
  "conflicts": [],
8
10
  "questions": [
@@ -3,6 +3,8 @@
3
3
  "name": "Magic Link (Passwordless)",
4
4
  "description": "HMAC-SHA256 signed single-use tokens, Resend/Nodemailer transport, 10k-entry LRU replay store, AES-256-GCM stateless session cookie, and a root middleware that protects configured paths while still honouring AUTH_MODE=mock as a dev short-circuit.",
5
5
  "version": "2.0.0",
6
+ "provides": "platform.auth",
7
+ "scope": "project",
6
8
  "requires": ["shared-types", "auth-mock", "env-setup"],
7
9
  "conflicts": [
8
10
  "nextauth",
@@ -0,0 +1,49 @@
1
+ # `mcp-server` — MCP Server (stdio) add-on template
2
+
3
+ Exposes the generated project's **application use-cases as MCP tools** over stdio,
4
+ so any MCP client (Claude Desktop/Code, IDE agents, an AgentCore Gateway, a
5
+ LangGraph tool node) can call them. An MCP tool is an **inbound adapter** over a
6
+ use-case you already have — no business logic moves into it.
7
+
8
+ Design intent: `docs/planning/generator-templates/18-mcp-server.md`. Requires
9
+ `env-setup`; soft-pairs with `error-handling` + `observability`.
10
+
11
+ ## What it scaffolds
12
+
13
+ | File | Purpose |
14
+ | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
15
+ | `src/infrastructure/mcp/sdk.ts` | Dynamic `import()` of `@modelcontextprotocol/sdk` (ADR-0010) |
16
+ | `src/infrastructure/mcp/server.ts` | Composition root: a `registerTransport(factory)` seam + `startServer()` |
17
+ | `src/infrastructure/mcp/transport/stdio.ts` | stdio transport **factory** |
18
+ | `src/infrastructure/mcp/transport/register-transports.ts` | Static transport registrations (base: stdio) — the `-http` addon extends this, never `server.ts` |
19
+ | `src/infrastructure/mcp/registry/tool-registry.ts` | `registerTool` seam + `applyTools()` |
20
+ | `src/infrastructure/mcp/registry/register-all.ts` | Static tool registrations |
21
+ | `src/infrastructure/mcp/tools/example.tool.ts` | Worked tool: input validation, use-case call, **explicit `Result`→MCP mapping (incl. error path)**, `dry_run` |
22
+ | `bin/cli.ts`, `.mcp.json.example`, `.env.mcp.example` | Entry point + client/env config |
23
+ | `resources/`, `prompts/` (opt-in) | Read-only resource + reusable prompt stubs |
24
+ | `*.test.ts` | `node:test` scaffolds — emitted **only under `--with-tests`** |
25
+
26
+ Everything under `infrastructure/mcp/**` is `@hexagen-server-only` (ADR-0037): it
27
+ holds credentials + privileged use-cases and must never reach a client bundle.
28
+
29
+ ## Adding a tool
30
+
31
+ 1. Copy `tools/example.tool.ts`, wrap your use-case, and **keep the explicit
32
+ error mapping + `dry_run`** — that example is the pattern every tool inherits.
33
+ 2. Add one import + one `registerTool(...)` line in `registry/register-all.ts`.
34
+
35
+ (Static registration by design: the template engine can't codegen a loop over a
36
+ selected tool set, so the list is hand-maintained.)
37
+
38
+ ## Transports
39
+
40
+ The base ships **stdio** — the secure local default (a subprocess of a trusted
41
+ client, no network surface). For network access, install the **`mcp-server-http`**
42
+ addon: it registers a `streamable-http` transport via `register-transports.ts`
43
+ (the factory seam), so it never rewrites `server.ts`. HTTP is always authenticated.
44
+
45
+ ## Setup
46
+
47
+ `hexagen templates info mcp-server` for the checklist. In short: `npm install
48
+ @modelcontextprotocol/sdk zod`, set `MCP_SERVER_NAME`, then verify with
49
+ `npx @modelcontextprotocol/inspector npx tsx bin/cli.ts`.
@@ -0,0 +1,6 @@
1
+ # MCP server (stdio base)
2
+ # Advertised to clients; defaults to the project name.
3
+ MCP_SERVER_NAME={server_name}
4
+ # Transport selector. The stdio base supports "stdio"; the mcp-server-http addon
5
+ # adds "streamable-http".
6
+ MCP_TRANSPORT=stdio
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "{server_name}": {
4
+ "command": "npx",
5
+ "args": ["tsx", "bin/cli.ts"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ // @hexagen-server-only — MCP server entry point.
3
+ // Run: npx tsx bin/cli.ts (or build → node dist/bin/cli.js)
4
+ //
5
+ // The side-effect imports populate the tool + transport registries before the
6
+ // server starts; order doesn't matter between them, but both must precede
7
+ // startServer().
8
+ import "../src/infrastructure/mcp/registry/register-all.js";
9
+ import "../src/infrastructure/mcp/transport/register-transports.js";
10
+ import { startServer } from "../src/infrastructure/mcp/server.js";
11
+
12
+ startServer().catch((error: unknown) => {
13
+ console.error("[mcp] failed to start:", error);
14
+ process.exit(1);
15
+ });
@@ -0,0 +1,32 @@
1
+ // @hexagen-server-only
2
+ /**
3
+ * Example MCP prompt — a reusable, named message template a client can invoke.
4
+ * A worked stub: wire it onto the server from your composition root and adapt
5
+ * the messages to your domain.
6
+ */
7
+ import type { McpServerLike } from "../sdk.js";
8
+
9
+ type PromptCapableServer = McpServerLike & {
10
+ registerPrompt?: (
11
+ name: string,
12
+ config: { description: string },
13
+ handler: () => {
14
+ messages: Array<{ role: string; content: { type: "text"; text: string } }>;
15
+ },
16
+ ) => void;
17
+ };
18
+
19
+ export function registerExamplePrompt(server: McpServerLike): void {
20
+ (server as PromptCapableServer).registerPrompt?.(
21
+ "example",
22
+ { description: "Replace with a reusable prompt for your domain." },
23
+ () => ({
24
+ messages: [
25
+ {
26
+ role: "user",
27
+ content: { type: "text", text: "Summarize the latest changes." },
28
+ },
29
+ ],
30
+ }),
31
+ );
32
+ }
@@ -0,0 +1,11 @@
1
+ // @hexagen-server-only
2
+ /**
3
+ * Static tool registrations. Add a real tool with one import + one
4
+ * `registerTool(...)` line below — copy `tools/example.tool.ts` as a starting
5
+ * point. The template engine can't codegen a loop over a selected tool set, so
6
+ * this list is yours to extend by hand.
7
+ */
8
+ import { registerTool } from "./tool-registry.js";
9
+ import { exampleTool } from "../tools/example.tool.js";
10
+
11
+ registerTool(exampleTool);
@@ -0,0 +1,67 @@
1
+ // @hexagen-server-only
2
+ import { describe, it } from "node:test";
3
+ import assert from "node:assert/strict";
4
+
5
+ import {
6
+ registerTool,
7
+ getRegisteredTools,
8
+ applyTools,
9
+ } from "./tool-registry.js";
10
+ import type { RegisteredTool } from "./tool-registry.js";
11
+ import type { McpServerLike } from "../sdk.js";
12
+
13
+ const toolResult = async () => ({
14
+ content: [{ type: "text" as const, text: "ok" }],
15
+ });
16
+
17
+ describe("tool-registry", () => {
18
+ it("registers a tool and exposes it via getRegisteredTools", () => {
19
+ const before = getRegisteredTools().length;
20
+ const tool: RegisteredTool = {
21
+ name: "sample",
22
+ description: "test",
23
+ inputSchema: {},
24
+ handler: toolResult,
25
+ };
26
+ registerTool(tool);
27
+ assert.equal(getRegisteredTools().length, before + 1);
28
+ assert.ok(getRegisteredTools().some((t) => t.name === "sample"));
29
+ });
30
+
31
+ it("applies a registered tool onto the server with name, config, and handler", () => {
32
+ // Self-contained: register a uniquely-named tool here rather than relying on
33
+ // another test's registration leaking through the module-level registry.
34
+ registerTool({
35
+ name: "applied-check",
36
+ description: "desc",
37
+ inputSchema: { x: {} },
38
+ handler: toolResult,
39
+ });
40
+
41
+ // Mock the full registerTool(name, config, handler) contract — so the test
42
+ // fails if applyTools ever stops passing the config or handler.
43
+ const calls: Array<{
44
+ name: string;
45
+ hasConfig: boolean;
46
+ hasHandler: boolean;
47
+ }> = [];
48
+ const server: McpServerLike = {
49
+ registerTool: (name, config, handler) => {
50
+ calls.push({
51
+ name,
52
+ hasConfig:
53
+ typeof config.description === "string" && !!config.inputSchema,
54
+ hasHandler: typeof handler === "function",
55
+ });
56
+ },
57
+ connect: async () => {},
58
+ };
59
+
60
+ applyTools(server);
61
+
62
+ const applied = calls.find((c) => c.name === "applied-check");
63
+ assert.ok(applied, "the registered tool was applied to the server");
64
+ assert.ok(applied.hasConfig, "config (description + inputSchema) was passed");
65
+ assert.ok(applied.hasHandler, "handler was passed");
66
+ });
67
+ });
@@ -0,0 +1,45 @@
1
+ // @hexagen-server-only — privileged tool surface; never ship to a client bundle (ADR-0037).
2
+ /**
3
+ * The tool-registration seam. Tools are declared statically (see
4
+ * `register-all.ts`) by calling `registerTool(...)`; the composition root then
5
+ * `applyTools()` them onto the dynamically-loaded `McpServer`. Decoupling the
6
+ * declaration from the server instance keeps `register-all.ts` a flat, loop-free
7
+ * list (the template engine can't codegen a loop) and lets you add a tool with
8
+ * one import + one `registerTool(...)` line.
9
+ */
10
+ import type { McpServerLike } from "../sdk.js";
11
+
12
+ /** An MCP tool result: text content, with `isError` set on a failure. */
13
+ export interface ToolResult {
14
+ content: Array<{ type: "text"; text: string }>;
15
+ isError?: boolean;
16
+ }
17
+
18
+ export interface RegisteredTool {
19
+ name: string;
20
+ description: string;
21
+ /** A zod raw shape (`{ field: z.string(), ... }`) describing the tool input. */
22
+ inputSchema: Record<string, unknown>;
23
+ handler: (input: Record<string, unknown>) => Promise<ToolResult>;
24
+ }
25
+
26
+ const tools: RegisteredTool[] = [];
27
+
28
+ export function registerTool(tool: RegisteredTool): void {
29
+ tools.push(tool);
30
+ }
31
+
32
+ export function getRegisteredTools(): readonly RegisteredTool[] {
33
+ return tools;
34
+ }
35
+
36
+ /** Wire every registered tool onto the MCP server. Called by the composition root. */
37
+ export function applyTools(server: McpServerLike): void {
38
+ for (const tool of tools) {
39
+ server.registerTool(
40
+ tool.name,
41
+ { description: tool.description, inputSchema: tool.inputSchema },
42
+ (input) => tool.handler(input),
43
+ );
44
+ }
45
+ }