@warlock.js/core 5.1.0 → 5.2.1

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 (356) hide show
  1. package/CHANGELOG.md +152 -0
  2. package/esm/application/application.d.mts.map +1 -1
  3. package/esm/application/application.mjs.map +1 -1
  4. package/esm/benchmark/benchmark-snapshots.d.mts.map +1 -1
  5. package/esm/benchmark/benchmark.d.mts.map +1 -1
  6. package/esm/benchmark/channels/console.channel.mjs.map +1 -1
  7. package/esm/benchmark/channels/noop.channel.d.mts.map +1 -1
  8. package/esm/benchmark/profiler.d.mts.map +1 -1
  9. package/esm/benchmark/profiler.mjs.map +1 -1
  10. package/esm/bootstrap/setup.d.mts.map +1 -1
  11. package/esm/bootstrap/setup.mjs.map +1 -1
  12. package/esm/bootstrap.d.mts.map +1 -1
  13. package/esm/cache/database-cache-driver.d.mts.map +1 -1
  14. package/esm/cache/database-cache-driver.mjs.map +1 -1
  15. package/esm/cli/cli-commands.manager.mjs.map +1 -1
  16. package/esm/cli/cli-commands.utils.mjs +16 -10
  17. package/esm/cli/cli-commands.utils.mjs.map +1 -1
  18. package/esm/cli/commands/doctor/boot-for-diagnostics.mjs.map +1 -1
  19. package/esm/cli/commands/doctor/checks/connectors.check.mjs.map +1 -1
  20. package/esm/cli/commands/doctor/checks/handler-signature.check.mjs.map +1 -1
  21. package/esm/cli/commands/doctor/checks/health.check.mjs.map +1 -1
  22. package/esm/cli/commands/doctor/checks/optional-peers.check.mjs.map +1 -1
  23. package/esm/cli/commands/doctor/checks/routes.check.mjs.map +1 -1
  24. package/esm/cli/commands/generate/generate.command.mjs.map +1 -1
  25. package/esm/cli/commands/generate/generators/column-dsl-parser.mjs.map +1 -1
  26. package/esm/cli/commands/generate/generators/migration.generator.mjs.map +1 -1
  27. package/esm/cli/commands/generate/generators/model.generator.mjs.map +1 -1
  28. package/esm/cli/commands/generate/templates/stubs.mjs.map +1 -1
  29. package/esm/cli/commands/generate/utils/name-parser.mjs.map +1 -1
  30. package/esm/cli/commands/generate/utils/prompt.mjs.map +1 -1
  31. package/esm/cli/commands/routes/diff-page-routes.mjs +84 -0
  32. package/esm/cli/commands/routes/diff-page-routes.mjs.map +1 -0
  33. package/esm/cli/commands/routes/format-routes-table.mjs.map +1 -1
  34. package/esm/cli/commands/routes/route-row.mjs.map +1 -1
  35. package/esm/cli/commands/routes/routes-command.action.mjs.map +1 -1
  36. package/esm/cli/commands/routes/routes-diff.action.mjs +84 -0
  37. package/esm/cli/commands/routes/routes-diff.action.mjs.map +1 -0
  38. package/esm/cli/commands/routes.command.mjs +15 -1
  39. package/esm/cli/commands/routes.command.mjs.map +1 -1
  40. package/esm/cli/commands/start-production.command.mjs +8 -1
  41. package/esm/cli/commands/start-production.command.mjs.map +1 -1
  42. package/esm/cli/commands/storage-put.action.mjs.map +1 -1
  43. package/esm/cli/commands/typings-generator.command.mjs.map +1 -1
  44. package/esm/cli/commands-loader.mjs.map +1 -1
  45. package/esm/cli/framework-cli-commands.mjs +2 -1
  46. package/esm/cli/framework-cli-commands.mjs.map +1 -1
  47. package/esm/cli/start.mjs.map +1 -1
  48. package/esm/cli/string-similarity.mjs.map +1 -1
  49. package/esm/commands/cli-command.mjs.map +1 -1
  50. package/esm/config/config-loader.d.mts +1 -1
  51. package/esm/config/config-loader.d.mts.map +1 -1
  52. package/esm/config/config-loader.mjs.map +1 -1
  53. package/esm/config/config-setter.d.mts.map +1 -1
  54. package/esm/config/config-special-handlers.d.mts +1 -1
  55. package/esm/config/config-special-handlers.mjs.map +1 -1
  56. package/esm/config/load-config-files.mjs.map +1 -1
  57. package/esm/connectors/access-connector.d.mts.map +1 -1
  58. package/esm/connectors/ai-connector.d.mts.map +1 -1
  59. package/esm/connectors/assert-no-reserved-connector-names.mjs.map +1 -1
  60. package/esm/connectors/assert-unique-connector-names.mjs.map +1 -1
  61. package/esm/connectors/base-connector.d.mts.map +1 -1
  62. package/esm/connectors/base-connector.mjs.map +1 -1
  63. package/esm/connectors/cache-connector.d.mts.map +1 -1
  64. package/esm/connectors/connectors-manager.d.mts.map +1 -1
  65. package/esm/connectors/connectors-manager.mjs.map +1 -1
  66. package/esm/connectors/database-connector.d.mts.map +1 -1
  67. package/esm/connectors/describe-server-address.mjs +20 -3
  68. package/esm/connectors/describe-server-address.mjs.map +1 -1
  69. package/esm/connectors/herald-connector.d.mts.map +1 -1
  70. package/esm/connectors/http-connector.d.mts.map +1 -1
  71. package/esm/connectors/http-connector.mjs +5 -1
  72. package/esm/connectors/http-connector.mjs.map +1 -1
  73. package/esm/connectors/logger-connector.d.mts.map +1 -1
  74. package/esm/connectors/mail-connector.d.mts.map +1 -1
  75. package/esm/connectors/notifications-connector.d.mts.map +1 -1
  76. package/esm/connectors/register-configured-connectors.mjs.map +1 -1
  77. package/esm/connectors/socket-connector.d.mts.map +1 -1
  78. package/esm/connectors/socket-connector.mjs.map +1 -1
  79. package/esm/connectors/storage.connector.d.mts.map +1 -1
  80. package/esm/container/index.d.mts.map +1 -1
  81. package/esm/database/create-database-action.mjs.map +1 -1
  82. package/esm/database/drop-tables-action.mjs.map +1 -1
  83. package/esm/database/migrate-action.mjs.map +1 -1
  84. package/esm/database/models/database-log/database-log.mjs.map +1 -1
  85. package/esm/database/seed-command-action.mjs.map +1 -1
  86. package/esm/database/seeds/seed-records-table-migration.mjs +1 -1
  87. package/esm/database/seeds/seed-records-table-migration.mjs.map +1 -1
  88. package/esm/database/seeds/seeder.mjs.map +1 -1
  89. package/esm/database/seeds/seeders.manager.mjs.map +1 -1
  90. package/esm/database/seeds/seeds-table-migration.mjs +1 -1
  91. package/esm/database/seeds/seeds-table-migration.mjs.map +1 -1
  92. package/esm/database/utils.mjs.map +1 -1
  93. package/esm/dev-server/check-for-updates.mjs.map +1 -1
  94. package/esm/dev-server/dependency-graph.d.mts.map +1 -1
  95. package/esm/dev-server/dependency-graph.mjs.map +1 -1
  96. package/esm/dev-server/dev-logger.mjs.map +1 -1
  97. package/esm/dev-server/development-server.mjs.map +1 -1
  98. package/esm/dev-server/file-event-handler.mjs.map +1 -1
  99. package/esm/dev-server/file-manager.d.mts.map +1 -1
  100. package/esm/dev-server/file-manager.mjs.map +1 -1
  101. package/esm/dev-server/file-operations.d.mts.map +1 -1
  102. package/esm/dev-server/files-orchestrator.mjs.map +1 -1
  103. package/esm/dev-server/files-watcher.mjs.map +1 -1
  104. package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs.map +1 -1
  105. package/esm/dev-server/health-checker/checkers/typescript-health-checker.mjs.map +1 -1
  106. package/esm/dev-server/health-checker/file-health-result.d.mts.map +1 -1
  107. package/esm/dev-server/health-checker/file-health-result.mjs.map +1 -1
  108. package/esm/dev-server/health-checker/files-healthcare.manager.mjs.map +1 -1
  109. package/esm/dev-server/layer-executor.mjs +10 -3
  110. package/esm/dev-server/layer-executor.mjs.map +1 -1
  111. package/esm/dev-server/loader/hook-thread.d.mts.map +1 -1
  112. package/esm/dev-server/loader/own-resolver.mjs.map +1 -1
  113. package/esm/dev-server/loader/register-loader.mjs.map +1 -1
  114. package/esm/dev-server/loader/resolve-hook.mjs.map +1 -1
  115. package/esm/dev-server/loader/source-slug.mjs.map +1 -1
  116. package/esm/dev-server/loader/transpile-cache.mjs +12 -3
  117. package/esm/dev-server/loader/transpile-cache.mjs.map +1 -1
  118. package/esm/dev-server/loader/version-registry.mjs.map +1 -1
  119. package/esm/dev-server/manifest-manager.d.mts.map +1 -1
  120. package/esm/dev-server/manifest-manager.mjs.map +1 -1
  121. package/esm/dev-server/module-loader.mjs.map +1 -1
  122. package/esm/dev-server/package-json-manager.mjs.map +1 -1
  123. package/esm/dev-server/parse-imports.mjs.map +1 -1
  124. package/esm/dev-server/ready-block.mjs.map +1 -1
  125. package/esm/dev-server/special-files-collector.d.mts.map +1 -1
  126. package/esm/dev-server/special-files-collector.mjs.map +1 -1
  127. package/esm/dev-server/supervisor.mjs +9 -6
  128. package/esm/dev-server/supervisor.mjs.map +1 -1
  129. package/esm/dev-server/tsconfig-manager.mjs.map +1 -1
  130. package/esm/dev-server/type-generator.mjs.map +1 -1
  131. package/esm/dev-server/utils.mjs.map +1 -1
  132. package/esm/encryption/encrypt.mjs.map +1 -1
  133. package/esm/encryption/hash.mjs.map +1 -1
  134. package/esm/encryption/password.mjs.map +1 -1
  135. package/esm/generations/add-command.action.mjs +11 -4
  136. package/esm/generations/add-command.action.mjs.map +1 -1
  137. package/esm/generations/features/access.feature.mjs +2 -1
  138. package/esm/generations/features/access.feature.mjs.map +1 -1
  139. package/esm/generations/features/ai-anthropic.feature.mjs +3 -1
  140. package/esm/generations/features/ai-anthropic.feature.mjs.map +1 -1
  141. package/esm/generations/features/ai-bedrock.feature.mjs +3 -1
  142. package/esm/generations/features/ai-bedrock.feature.mjs.map +1 -1
  143. package/esm/generations/features/ai-google.feature.mjs +3 -1
  144. package/esm/generations/features/ai-google.feature.mjs.map +1 -1
  145. package/esm/generations/features/ai-ollama.feature.mjs +3 -1
  146. package/esm/generations/features/ai-ollama.feature.mjs.map +1 -1
  147. package/esm/generations/features/ai-openai.feature.mjs +3 -1
  148. package/esm/generations/features/ai-openai.feature.mjs.map +1 -1
  149. package/esm/generations/features/ai-panoptic.feature.mjs +2 -1
  150. package/esm/generations/features/ai-panoptic.feature.mjs.map +1 -1
  151. package/esm/generations/features/ai-tools.feature.mjs +2 -1
  152. package/esm/generations/features/ai-tools.feature.mjs.map +1 -1
  153. package/esm/generations/features/ai-workspace.feature.mjs +2 -1
  154. package/esm/generations/features/ai-workspace.feature.mjs.map +1 -1
  155. package/esm/generations/features/ai.feature.mjs +2 -1
  156. package/esm/generations/features/ai.feature.mjs.map +1 -1
  157. package/esm/generations/features/herald.feature.mjs +2 -1
  158. package/esm/generations/features/herald.feature.mjs.map +1 -1
  159. package/esm/generations/features/notifications.feature.mjs +3 -2
  160. package/esm/generations/features/notifications.feature.mjs.map +1 -1
  161. package/esm/generations/features/scheduler.feature.mjs +3 -1
  162. package/esm/generations/features/scheduler.feature.mjs.map +1 -1
  163. package/esm/generations/features/shadcn.feature.mjs.map +1 -1
  164. package/esm/generations/features/shared/migration-timestamp.mjs.map +1 -1
  165. package/esm/generations/features/tailwind.feature.mjs.map +1 -1
  166. package/esm/generations/features/types.mjs +14 -0
  167. package/esm/generations/features/types.mjs.map +1 -0
  168. package/esm/generations/features/web.feature.mjs +10 -2
  169. package/esm/generations/features/web.feature.mjs.map +1 -1
  170. package/esm/generations/stubs.mjs +169 -28
  171. package/esm/generations/stubs.mjs.map +1 -1
  172. package/esm/http/boot-port-preflight.d.mts +46 -0
  173. package/esm/http/boot-port-preflight.d.mts.map +1 -0
  174. package/esm/http/boot-port-preflight.mjs +87 -0
  175. package/esm/http/boot-port-preflight.mjs.map +1 -0
  176. package/esm/http/context/request-context.d.mts.map +1 -1
  177. package/esm/http/context/request-context.mjs.map +1 -1
  178. package/esm/http/context/request-memo.d.mts.map +1 -1
  179. package/esm/http/context/request-memo.mjs.map +1 -1
  180. package/esm/http/createHttpApplication.d.mts.map +1 -1
  181. package/esm/http/createHttpApplication.mjs.map +1 -1
  182. package/esm/http/health.d.mts.map +1 -1
  183. package/esm/http/index.d.mts +1 -0
  184. package/esm/http/index.mjs +1 -0
  185. package/esm/http/middleware/cache-response-middleware.mjs.map +1 -1
  186. package/esm/http/middleware/idempotency.middleware.mjs.map +1 -1
  187. package/esm/http/middleware/inject-request-context.mjs.map +1 -1
  188. package/esm/http/middleware/ip-filter.middleware.d.mts +1 -1
  189. package/esm/http/middleware/ip-filter.middleware.mjs +1 -1
  190. package/esm/http/middleware/ip-filter.middleware.mjs.map +1 -1
  191. package/esm/http/middleware/maintenance.middleware.mjs.map +1 -1
  192. package/esm/http/middleware/utils/idempotency-key.mjs.map +1 -1
  193. package/esm/http/port-preflight.d.mts +8 -0
  194. package/esm/http/port-preflight.d.mts.map +1 -1
  195. package/esm/http/port-preflight.mjs +8 -1
  196. package/esm/http/port-preflight.mjs.map +1 -1
  197. package/esm/http/ready-report.d.mts.map +1 -1
  198. package/esm/http/request-controller.d.mts.map +1 -1
  199. package/esm/http/request.d.mts +14 -2
  200. package/esm/http/request.d.mts.map +1 -1
  201. package/esm/http/request.mjs +16 -2
  202. package/esm/http/request.mjs.map +1 -1
  203. package/esm/http/response.d.mts +3 -3
  204. package/esm/http/response.d.mts.map +1 -1
  205. package/esm/http/response.mjs.map +1 -1
  206. package/esm/http/server.d.mts.map +1 -1
  207. package/esm/http/server.mjs +26 -2
  208. package/esm/http/server.mjs.map +1 -1
  209. package/esm/http/types.d.mts +1 -3
  210. package/esm/http/types.d.mts.map +1 -1
  211. package/esm/http/uploaded-file.d.mts.map +1 -1
  212. package/esm/http/uploaded-file.mjs.map +1 -1
  213. package/esm/http/uploads-config.d.mts.map +1 -1
  214. package/esm/image/image.d.mts.map +1 -1
  215. package/esm/image/image.mjs.map +1 -1
  216. package/esm/index.d.mts +6 -1
  217. package/esm/index.mjs +6 -1
  218. package/esm/logger/fatal-visibility.d.mts +25 -0
  219. package/esm/logger/fatal-visibility.d.mts.map +1 -0
  220. package/esm/logger/fatal-visibility.mjs +31 -0
  221. package/esm/logger/fatal-visibility.mjs.map +1 -0
  222. package/esm/logger/index.d.mts +1 -0
  223. package/esm/logger/index.mjs +1 -0
  224. package/esm/logger/logger.mjs.map +1 -1
  225. package/esm/mail/config.d.mts.map +1 -1
  226. package/esm/mail/events.d.mts.map +1 -1
  227. package/esm/mail/mail.d.mts.map +1 -1
  228. package/esm/mail/mail.mjs.map +1 -1
  229. package/esm/mail/mailer-pool.d.mts.map +1 -1
  230. package/esm/mail/mailer-pool.mjs +2 -0
  231. package/esm/mail/mailer-pool.mjs.map +1 -1
  232. package/esm/mail/send-mail.mjs.map +1 -1
  233. package/esm/mail/test-mailbox.d.mts.map +1 -1
  234. package/esm/mail/test-mailbox.mjs.map +1 -1
  235. package/esm/production/assert-dist-ready-to-start.mjs +24 -0
  236. package/esm/production/assert-dist-ready-to-start.mjs.map +1 -0
  237. package/esm/production/assert-generated-imports.mjs.map +1 -1
  238. package/esm/production/build-app-production.mjs.map +1 -1
  239. package/esm/production/dist-build-manifest.mjs +47 -0
  240. package/esm/production/dist-build-manifest.mjs.map +1 -0
  241. package/esm/production/production-builder.mjs +68 -13
  242. package/esm/production/production-builder.mjs.map +1 -1
  243. package/esm/production/production-supervisor.mjs +21 -9
  244. package/esm/production/production-supervisor.mjs.map +1 -1
  245. package/esm/production/promote-dist.mjs +115 -0
  246. package/esm/production/promote-dist.mjs.map +1 -0
  247. package/esm/production/resolve-build-config.mjs.map +1 -1
  248. package/esm/repositories/adapters/cascade/cascade-adapter.d.mts.map +1 -1
  249. package/esm/repositories/adapters/cascade/cascade-adapter.mjs.map +1 -1
  250. package/esm/repositories/adapters/cascade/cascade-query-builder.d.mts.map +1 -1
  251. package/esm/repositories/adapters/cascade/cascade-query-builder.mjs.map +1 -1
  252. package/esm/repositories/adapters/cascade/filter-applicator.mjs.map +1 -1
  253. package/esm/repositories/repository.manager.d.mts.map +1 -1
  254. package/esm/repositories/repository.manager.mjs.map +1 -1
  255. package/esm/resource/register-resource.d.mts.map +1 -1
  256. package/esm/resource/resource-field-builder.d.mts.map +1 -1
  257. package/esm/resource/resource-field-builder.mjs.map +1 -1
  258. package/esm/resource/resource.d.mts.map +1 -1
  259. package/esm/resource/resource.mjs.map +1 -1
  260. package/esm/restful/restful.d.mts.map +1 -1
  261. package/esm/restful/restful.mjs.map +1 -1
  262. package/esm/router/index.d.mts +3 -0
  263. package/esm/router/index.mjs +3 -0
  264. package/esm/router/log-request-lifecycle.mjs.map +1 -1
  265. package/esm/router/normalize-request-path.d.mts +14 -0
  266. package/esm/router/normalize-request-path.d.mts.map +1 -0
  267. package/esm/router/normalize-request-path.mjs +18 -0
  268. package/esm/router/normalize-request-path.mjs.map +1 -0
  269. package/esm/router/normalize-route-path.d.mts +28 -0
  270. package/esm/router/normalize-route-path.d.mts.map +1 -0
  271. package/esm/router/normalize-route-path.mjs +33 -0
  272. package/esm/router/normalize-route-path.mjs.map +1 -0
  273. package/esm/router/positional-handler-diagnostics.d.mts.map +1 -1
  274. package/esm/router/positional-handler-diagnostics.mjs.map +1 -1
  275. package/esm/router/route-name-method-suffix.d.mts +33 -0
  276. package/esm/router/route-name-method-suffix.d.mts.map +1 -0
  277. package/esm/router/route-name-method-suffix.mjs +39 -0
  278. package/esm/router/route-name-method-suffix.mjs.map +1 -0
  279. package/esm/router/route-registry.d.mts.map +1 -1
  280. package/esm/router/route-registry.mjs +3 -2
  281. package/esm/router/route-registry.mjs.map +1 -1
  282. package/esm/router/router.d.mts +14 -0
  283. package/esm/router/router.d.mts.map +1 -1
  284. package/esm/router/router.mjs +50 -11
  285. package/esm/router/router.mjs.map +1 -1
  286. package/esm/socket/utils.d.mts.map +1 -1
  287. package/esm/storage/config.d.mts.map +1 -1
  288. package/esm/storage/context/storage-driver-context.d.mts.map +1 -1
  289. package/esm/storage/drivers/cloud-driver.d.mts.map +1 -1
  290. package/esm/storage/drivers/cloud-driver.mjs.map +1 -1
  291. package/esm/storage/drivers/do-spaces-driver.d.mts.map +1 -1
  292. package/esm/storage/drivers/local-driver.d.mts.map +1 -1
  293. package/esm/storage/drivers/local-driver.mjs.map +1 -1
  294. package/esm/storage/drivers/r2-driver.d.mts.map +1 -1
  295. package/esm/storage/scoped-storage.d.mts.map +1 -1
  296. package/esm/storage/scoped-storage.mjs.map +1 -1
  297. package/esm/storage/storage-file.d.mts.map +1 -1
  298. package/esm/storage/storage-file.mjs.map +1 -1
  299. package/esm/storage/storage.d.mts.map +1 -1
  300. package/esm/storage/types.d.mts +14 -0
  301. package/esm/storage/types.d.mts.map +1 -1
  302. package/esm/storage/utils/safe-fetch.mjs.map +1 -1
  303. package/esm/tests/start-http-development-server.d.mts.map +1 -1
  304. package/esm/tests/start-http-development-server.mjs +2 -1
  305. package/esm/tests/start-http-development-server.mjs.map +1 -1
  306. package/esm/tests/test-connectors-selection.mjs.map +1 -1
  307. package/esm/tests/test-helpers.d.mts.map +1 -1
  308. package/esm/tests/test-setup-timeout.mjs.map +1 -1
  309. package/esm/tests/vitest-setup.d.mts.map +1 -1
  310. package/esm/tests/vitest-setup.mjs.map +1 -1
  311. package/esm/updater/update-warlock-packages.mjs.map +1 -1
  312. package/esm/use-cases/use-case-broadcast.d.mts.map +1 -1
  313. package/esm/use-cases/use-case-events.d.mts.map +1 -1
  314. package/esm/use-cases/use-case-pipeline.d.mts.map +1 -1
  315. package/esm/use-cases/use-case.d.mts.map +1 -1
  316. package/esm/use-cases/use-cases-registry.d.mts.map +1 -1
  317. package/esm/use-cases/use-cases-registry.mjs.map +1 -1
  318. package/esm/utils/database-log.d.mts.map +1 -1
  319. package/esm/utils/database-log.mjs.map +1 -1
  320. package/esm/utils/environment.d.mts.map +1 -1
  321. package/esm/utils/framework-vesion.mjs.map +1 -1
  322. package/esm/utils/get-localized.mjs.map +1 -1
  323. package/esm/utils/load-environment.mjs.map +1 -1
  324. package/esm/utils/normalized-path.d.mts.map +1 -1
  325. package/esm/utils/paths.d.mts.map +1 -1
  326. package/esm/utils/promise-all-object.d.mts.map +1 -1
  327. package/esm/utils/promise-all-object.mjs.map +1 -1
  328. package/esm/utils/sluggable.mjs.map +1 -1
  329. package/esm/utils/version-compare.mjs.map +1 -1
  330. package/esm/validation/database/exists-except-current-id.mjs.map +1 -1
  331. package/esm/validation/database/exists-except-current-user.mjs.map +1 -1
  332. package/esm/validation/database/unique-except-current-id.mjs.map +1 -1
  333. package/esm/validation/plugins/localized-plugin.mjs.map +1 -1
  334. package/esm/validation/validators/file-validator.mjs.map +1 -1
  335. package/esm/vite/lower-stage3-decorators.d.mts.map +1 -1
  336. package/esm/warlock-config/default-configurations.mjs.map +1 -1
  337. package/esm/warlock-config/warlock-config.manager.d.mts.map +1 -1
  338. package/esm/warlock-config/warlock-config.manager.mjs.map +1 -1
  339. package/llms-full.txt +205 -90
  340. package/llms.txt +5 -5
  341. package/package.json +12 -12
  342. package/skills/add-connector/SKILL.md +35 -28
  343. package/skills/create-controller/SKILL.md +1 -1
  344. package/skills/create-module/SKILL.md +12 -12
  345. package/skills/hash-password/SKILL.md +4 -4
  346. package/skills/run-app/SKILL.md +77 -16
  347. package/skills/send-mail/SKILL.md +2 -2
  348. package/skills/use-middleware/SKILL.md +13 -4
  349. package/skills/use-model-transformers/SKILL.md +2 -2
  350. package/skills/use-repository/SKILL.md +1 -1
  351. package/skills/validate-input/SKILL.md +1 -1
  352. package/skills/warlock-conventions/SKILL.md +1 -1
  353. package/skills/warlock-doctor/SKILL.md +3 -3
  354. package/skills/warlock-routes/SKILL.md +47 -9
  355. package/skills/write-cli-command/SKILL.md +1 -1
  356. package/skills/write-seeder/SKILL.md +8 -8
@@ -9,6 +9,14 @@ import { execSync } from "node:child_process";
9
9
 
10
10
  //#region ../core/src/generations/add-command.action.ts
11
11
  const allowedFeatures = Object.keys(featuresMap);
12
+ /**
13
+ * Resolve the internal feature-map placeholder to the version of Core that is
14
+ * actually executing the command. Every @warlock.js package is lockstep, so
15
+ * Core is the single source of truth; non-Warlock dependencies are untouched.
16
+ */
17
+ function resolveWarlockDependencyVersions(dependencies, frameworkVersion) {
18
+ for (const dependency of Object.keys(dependencies)) if (dependency.startsWith("@warlock.js/")) dependencies[dependency] = frameworkVersion;
19
+ }
12
20
  function resolveFeatures(features, visited = /* @__PURE__ */ new Set()) {
13
21
  const resolved = [];
14
22
  for (const feature of features) {
@@ -41,8 +49,7 @@ async function addCommandAction(options) {
41
49
  if (featurePackages.ejectConfig) ejectConfigs[featurePackages.ejectConfig.name] = featurePackages.ejectConfig;
42
50
  if (featurePackages.script) Object.assign(scripts, featurePackages.script);
43
51
  }
44
- const frameworkVersion = await getWarlockVersion();
45
- for (const dependency of Object.keys(dependencies)) if (dependency.startsWith("@warlock.js/")) dependencies[dependency] = frameworkVersion;
52
+ resolveWarlockDependencyVersions(dependencies, await getWarlockVersion());
46
53
  const currentPackageJson = await getJsonFileAsync(rootPath("package.json"));
47
54
  currentPackageJson.dependencies = currentPackageJson.dependencies ?? {};
48
55
  currentPackageJson.devDependencies = currentPackageJson.devDependencies ?? {};
@@ -89,7 +96,7 @@ async function installDependencies(packageManager, dependencies, devDependencies
89
96
  const packageManagerCommand = getAddCommand(packageManager ?? await detectPackageManager());
90
97
  if (Object.keys(dependencies).length > 0) {
91
98
  console.log(`Installing dependencies ${colors.magenta(Object.keys(dependencies).join(", "))}`);
92
- execSync(`${packageManagerCommand} ${Object.keys(dependencies).join(" ")}`, {
99
+ execSync(`${packageManagerCommand} ${Object.entries(dependencies).map(([name, version]) => `${name}@${version}`).join(" ")}`, {
93
100
  cwd: process.cwd(),
94
101
  stdio: "inherit"
95
102
  });
@@ -97,7 +104,7 @@ async function installDependencies(packageManager, dependencies, devDependencies
97
104
  }
98
105
  if (Object.keys(devDependencies).length > 0) {
99
106
  console.log(`Installing dev dependencies ${colors.magenta(Object.keys(devDependencies).join(", "))}`);
100
- execSync(`${packageManagerCommand} ${Object.keys(devDependencies).join(" ")} -D`, {
107
+ execSync(`${packageManagerCommand} ${Object.entries(devDependencies).map(([name, version]) => `${name}@${version}`).join(" ")} -D`, {
101
108
  cwd: process.cwd(),
102
109
  stdio: "inherit"
103
110
  });
@@ -1 +1 @@
1
- {"version":3,"file":"add-command.action.mjs","names":[],"sources":["../../../../../../../core/src/generations/add-command.action.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\r\nimport {\r\n fileExistsAsync,\r\n getJsonFileAsync,\r\n putFileAsync,\r\n putJsonFileAsync,\r\n} from \"@warlock.js/fs\";\r\nimport { execSync } from \"node:child_process\";\r\nimport { CommandActionData } from \"../commands/types\";\r\nimport {\r\n detectPackageManager,\r\n getAddCommand,\r\n type PackageManager,\r\n} from \"../updater/package-manager\";\r\nimport { rootPath, srcPath } from \"../utils\";\r\nimport { getWarlockVersion } from \"../utils/framework-vesion\";\r\nimport { featuresMap } from \"./features\";\r\n\r\nexport { featuresMap };\r\nexport type { FeatureDefinition } from \"./features\";\r\n\r\n/**\r\n * The parts of a project `package.json` this action reads or writes. Deliberately\r\n * partial — it describes what we touch, not the whole manifest.\r\n */\r\ntype ProjectPackageJson = {\r\n dependencies?: Record<string, string>;\r\n devDependencies?: Record<string, string>;\r\n scripts?: Record<string, string>;\r\n};\r\n\r\nexport const allowedFeatures = Object.keys(featuresMap);\r\n\r\nfunction resolveFeatures(features: string[], visited = new Set<string>()): string[] {\r\n const resolved: string[] = [];\r\n\r\n for (const feature of features) {\r\n if (visited.has(feature)) continue;\r\n visited.add(feature);\r\n\r\n const def = featuresMap[feature];\r\n\r\n if (def.requires?.length) {\r\n resolved.push(...resolveFeatures(def.requires, visited));\r\n }\r\n\r\n resolved.push(feature);\r\n }\r\n\r\n return resolved;\r\n}\r\n\r\nexport async function addCommandAction(options: CommandActionData) {\r\n const features = options.args;\r\n const { packageManager, list, noInstall } = options.options;\r\n\r\n if (list) {\r\n console.log(\"Available Features:\");\r\n\r\n for (const feature of allowedFeatures) {\r\n console.log(\r\n `- ${colors.yellowBright(feature)}: ${colors.green(featuresMap[feature].description)}`,\r\n );\r\n }\r\n\r\n process.exit(0);\r\n }\r\n\r\n validateFeatures(features);\r\n\r\n const resolvedFeatures = resolveFeatures(features);\r\n\r\n const dependencies: Record<string, string> = {};\r\n const devDependencies: Record<string, string> = {};\r\n const ejectConfigs: Record<string, { content: string; name: string }> = {};\r\n const scripts: Record<string, string> = {};\r\n\r\n for (const feature of resolvedFeatures) {\r\n const featurePackages = featuresMap[feature as keyof typeof featuresMap];\r\n Object.assign(dependencies, featurePackages.dependencies);\r\n if (featurePackages.devDependencies) {\r\n Object.assign(devDependencies, featurePackages.devDependencies);\r\n }\r\n\r\n if (featurePackages.ejectConfig) {\r\n ejectConfigs[featurePackages.ejectConfig.name] = featurePackages.ejectConfig;\r\n }\r\n\r\n if (featurePackages.script) {\r\n Object.assign(scripts, featurePackages.script);\r\n }\r\n }\r\n\r\n // Pin every @warlock.js/* feature package to the INSTALLED framework version so\r\n // a scaffolded project's features match its core version instead of drifting to\r\n // the feature map's static range.\r\n const frameworkVersion = await getWarlockVersion();\r\n for (const dependency of Object.keys(dependencies)) {\r\n if (dependency.startsWith(\"@warlock.js/\")) {\r\n dependencies[dependency] = frameworkVersion;\r\n }\r\n }\r\n\r\n const currentPackageJson = await getJsonFileAsync<ProjectPackageJson>(rootPath(\"package.json\"));\r\n\r\n // Fresh templates may omit one of the maps — guard before reading.\r\n currentPackageJson.dependencies = currentPackageJson.dependencies ?? {};\r\n currentPackageJson.devDependencies = currentPackageJson.devDependencies ?? {};\r\n\r\n // Skip anything already present so we never downgrade an existing pin.\r\n for (const dependency of Object.keys(dependencies)) {\r\n if (currentPackageJson.dependencies[dependency]) {\r\n console.log(`${colors.yellowBright(dependency)} is already installed, skipping...`);\r\n delete dependencies[dependency];\r\n }\r\n }\r\n\r\n for (const devDependency of Object.keys(devDependencies)) {\r\n if (currentPackageJson.devDependencies[devDependency]) {\r\n console.log(`${colors.yellowBright(devDependency)} is already installed, skipping...`);\r\n delete devDependencies[devDependency];\r\n }\r\n }\r\n\r\n if (noInstall) {\r\n await recordDependencies(dependencies, devDependencies);\r\n } else {\r\n await installDependencies(packageManager as PackageManager | undefined, dependencies, devDependencies);\r\n }\r\n\r\n for (const [name, config] of Object.entries(ejectConfigs)) {\r\n if (await fileExistsAsync(srcPath(`config/${name}.ts`))) {\r\n console.log(`${colors.yellowBright(name)} config already exists, skipping...`);\r\n continue;\r\n }\r\n\r\n console.log(`Creating ${colors.magenta(name)} config...`);\r\n\r\n await putFileAsync(srcPath(`config/${name}.ts`), config.content);\r\n\r\n console.log(`${colors.green(name)} config created successfully`);\r\n }\r\n\r\n // now loop again over features to execute onExecuting\r\n for (const feature of resolvedFeatures) {\r\n const featurePackages = featuresMap[feature as keyof typeof featuresMap];\r\n if (featurePackages.onExecuting) {\r\n await featurePackages.onExecuting(options);\r\n }\r\n }\r\n\r\n if (Object.keys(scripts).length > 0) {\r\n console.log(`Adding scripts ${colors.magenta(Object.keys(scripts).join(\", \"))}`);\r\n const packageJsonPath = rootPath(\"package.json\");\r\n const packageJson = await getJsonFileAsync<ProjectPackageJson>(packageJsonPath);\r\n packageJson.scripts = { ...(packageJson.scripts ?? {}), ...scripts };\r\n await putJsonFileAsync(packageJsonPath, packageJson);\r\n\r\n console.log(`Scripts added successfully ${colors.green(Object.keys(scripts).join(\", \"))}`);\r\n }\r\n}\r\n\r\n/**\r\n * Install the resolved dependency sets through the project's package manager.\r\n * Runs two passes (prod then dev) so each lands in the correct section.\r\n */\r\nasync function installDependencies(\r\n packageManager: PackageManager | undefined,\r\n dependencies: Record<string, string>,\r\n devDependencies: Record<string, string>,\r\n) {\r\n // `--package-manager` is optional; without it, fall back to the lockfile.\r\n const packageManagerCommand = getAddCommand(packageManager ?? (await detectPackageManager()));\r\n\r\n if (Object.keys(dependencies).length > 0) {\r\n console.log(`Installing dependencies ${colors.magenta(Object.keys(dependencies).join(\", \"))}`);\r\n\r\n execSync(`${packageManagerCommand} ${Object.keys(dependencies).join(\" \")}`, {\r\n cwd: process.cwd(),\r\n stdio: \"inherit\",\r\n });\r\n\r\n console.log(\r\n `Dependencies installed successfully ${colors.green(Object.keys(dependencies).join(\", \"))}`,\r\n );\r\n }\r\n\r\n if (Object.keys(devDependencies).length > 0) {\r\n console.log(\r\n `Installing dev dependencies ${colors.magenta(Object.keys(devDependencies).join(\", \"))}`,\r\n );\r\n\r\n execSync(`${packageManagerCommand} ${Object.keys(devDependencies).join(\" \")} -D`, {\r\n cwd: process.cwd(),\r\n stdio: \"inherit\",\r\n });\r\n\r\n console.log(\r\n `Dev dependencies installed successfully ${colors.green(Object.keys(devDependencies).join(\", \"))}`,\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Write the resolved dependency sets into package.json without installing.\r\n * Used by `--no-install` so a scaffolder can batch every feature into one\r\n * install pass after the command returns. Versions come from the feature map.\r\n */\r\nasync function recordDependencies(\r\n dependencies: Record<string, string>,\r\n devDependencies: Record<string, string>,\r\n) {\r\n if (Object.keys(dependencies).length === 0 && Object.keys(devDependencies).length === 0) {\r\n return;\r\n }\r\n\r\n const packageJsonPath = rootPath(\"package.json\");\r\n const packageJson = await getJsonFileAsync<ProjectPackageJson>(packageJsonPath);\r\n\r\n packageJson.dependencies = packageJson.dependencies ?? {};\r\n packageJson.devDependencies = packageJson.devDependencies ?? {};\r\n\r\n Object.assign(packageJson.dependencies, dependencies);\r\n Object.assign(packageJson.devDependencies, devDependencies);\r\n\r\n await putJsonFileAsync(packageJsonPath, packageJson);\r\n\r\n const recorded = [...Object.keys(dependencies), ...Object.keys(devDependencies)];\r\n\r\n console.log(\r\n `Recorded ${colors.green(recorded.join(\", \"))} in package.json (install skipped via --no-install)`,\r\n );\r\n}\r\n\r\nfunction validateFeatures(features: string[]) {\r\n for (const feature of features) {\r\n if (!allowedFeatures.includes(feature)) {\r\n console.log(\r\n `Feature ${colors.redBright(feature)} is not allowed, allowed features are: ${colors.green(allowedFeatures.join(\", \"))}`,\r\n );\r\n process.exit(1);\r\n }\r\n }\r\n}\r\n\r"],"mappings":";;;;;;;;;;AA+BA,MAAa,kBAAkB,OAAO,KAAK,WAAW;AAEtD,SAAS,gBAAgB,UAAoB,0BAAU,IAAI,IAAY,GAAa;CAClF,MAAM,WAAqB,CAAC;CAE5B,KAAK,MAAM,WAAW,UAAU;EAC9B,IAAI,QAAQ,IAAI,OAAO,GAAG;EAC1B,QAAQ,IAAI,OAAO;EAEnB,MAAM,MAAM,YAAY;EAExB,IAAI,IAAI,UAAU,QAChB,SAAS,KAAK,GAAG,gBAAgB,IAAI,UAAU,OAAO,CAAC;EAGzD,SAAS,KAAK,OAAO;CACvB;CAEA,OAAO;AACT;AAEA,eAAsB,iBAAiB,SAA4B;CACjE,MAAM,WAAW,QAAQ;CACzB,MAAM,EAAE,gBAAgB,MAAM,cAAc,QAAQ;CAEpD,IAAI,MAAM;EACR,QAAQ,IAAI,qBAAqB;EAEjC,KAAK,MAAM,WAAW,iBACpB,QAAQ,IACN,KAAK,OAAO,aAAa,OAAO,EAAE,IAAI,OAAO,MAAM,YAAY,QAA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AAO,MAAM,gBAAgB,KAAK,IAAI,CAAC,GACvH;EACA,QAAQ,KAAK,CAAC;CAChB;AAEJ"}
1
+ {"version":3,"file":"add-command.action.mjs","names":[],"sources":["../../../../../../../core/src/generations/add-command.action.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\r\nimport {\r\n fileExistsAsync,\r\n getJsonFileAsync,\r\n putFileAsync,\r\n putJsonFileAsync,\r\n} from \"@warlock.js/fs\";\r\nimport { execSync } from \"node:child_process\";\r\nimport { CommandActionData } from \"../commands/types\";\r\nimport {\r\n detectPackageManager,\r\n getAddCommand,\r\n type PackageManager,\r\n} from \"../updater/package-manager\";\r\nimport { rootPath, srcPath } from \"../utils\";\r\nimport { getWarlockVersion } from \"../utils/framework-vesion\";\r\nimport { featuresMap } from \"./features\";\r\n\r\nexport { featuresMap };\r\nexport type { FeatureDefinition } from \"./features\";\r\n\r\n/**\r\n * The parts of a project `package.json` this action reads or writes. Deliberately\r\n * partial — it describes what we touch, not the whole manifest.\r\n */\r\ntype ProjectPackageJson = {\r\n dependencies?: Record<string, string>;\r\n devDependencies?: Record<string, string>;\r\n scripts?: Record<string, string>;\r\n};\r\n\r\nexport const allowedFeatures = Object.keys(featuresMap);\n\n/**\n * Resolve the internal feature-map placeholder to the version of Core that is\n * actually executing the command. Every @warlock.js package is lockstep, so\n * Core is the single source of truth; non-Warlock dependencies are untouched.\n */\nexport function resolveWarlockDependencyVersions(\n dependencies: Record<string, string>,\n frameworkVersion: string,\n): void {\n for (const dependency of Object.keys(dependencies)) {\n if (dependency.startsWith(\"@warlock.js/\")) {\n dependencies[dependency] = frameworkVersion;\n }\n }\n}\n\nfunction resolveFeatures(features: string[], visited = new Set<string>()): string[] {\n const resolved: string[] = [];\r\n\r\n for (const feature of features) {\r\n if (visited.has(feature)) continue;\r\n visited.add(feature);\r\n\r\n const def = featuresMap[feature];\r\n\r\n if (def.requires?.length) {\r\n resolved.push(...resolveFeatures(def.requires, visited));\r\n }\r\n\r\n resolved.push(feature);\r\n }\r\n\r\n return resolved;\r\n}\r\n\r\nexport async function addCommandAction(options: CommandActionData) {\r\n const features = options.args;\r\n const { packageManager, list, noInstall } = options.options;\r\n\r\n if (list) {\r\n console.log(\"Available Features:\");\r\n\r\n for (const feature of allowedFeatures) {\r\n console.log(\r\n `- ${colors.yellowBright(feature)}: ${colors.green(featuresMap[feature].description)}`,\r\n );\r\n }\r\n\r\n process.exit(0);\r\n }\r\n\r\n validateFeatures(features);\r\n\r\n const resolvedFeatures = resolveFeatures(features);\r\n\r\n const dependencies: Record<string, string> = {};\r\n const devDependencies: Record<string, string> = {};\r\n const ejectConfigs: Record<string, { content: string; name: string }> = {};\r\n const scripts: Record<string, string> = {};\r\n\r\n for (const feature of resolvedFeatures) {\r\n const featurePackages = featuresMap[feature as keyof typeof featuresMap];\r\n Object.assign(dependencies, featurePackages.dependencies);\r\n if (featurePackages.devDependencies) {\r\n Object.assign(devDependencies, featurePackages.devDependencies);\r\n }\r\n\r\n if (featurePackages.ejectConfig) {\r\n ejectConfigs[featurePackages.ejectConfig.name] = featurePackages.ejectConfig;\r\n }\r\n\r\n if (featurePackages.script) {\r\n Object.assign(scripts, featurePackages.script);\r\n }\r\n }\r\n\r\n // Pin every @warlock.js/* feature package to the INSTALLED framework version so\r\n // a scaffolded project's features match its core version instead of drifting to\n // the feature map's static range.\n const frameworkVersion = await getWarlockVersion();\n resolveWarlockDependencyVersions(dependencies, frameworkVersion);\n\r\n const currentPackageJson = await getJsonFileAsync<ProjectPackageJson>(rootPath(\"package.json\"));\r\n\r\n // Fresh templates may omit one of the maps — guard before reading.\r\n currentPackageJson.dependencies = currentPackageJson.dependencies ?? {};\r\n currentPackageJson.devDependencies = currentPackageJson.devDependencies ?? {};\r\n\r\n // Skip anything already present so we never downgrade an existing pin.\r\n for (const dependency of Object.keys(dependencies)) {\r\n if (currentPackageJson.dependencies[dependency]) {\r\n console.log(`${colors.yellowBright(dependency)} is already installed, skipping...`);\r\n delete dependencies[dependency];\r\n }\r\n }\r\n\r\n for (const devDependency of Object.keys(devDependencies)) {\r\n if (currentPackageJson.devDependencies[devDependency]) {\r\n console.log(`${colors.yellowBright(devDependency)} is already installed, skipping...`);\r\n delete devDependencies[devDependency];\r\n }\r\n }\r\n\r\n if (noInstall) {\r\n await recordDependencies(dependencies, devDependencies);\r\n } else {\r\n await installDependencies(packageManager as PackageManager | undefined, dependencies, devDependencies);\r\n }\r\n\r\n for (const [name, config] of Object.entries(ejectConfigs)) {\r\n if (await fileExistsAsync(srcPath(`config/${name}.ts`))) {\r\n console.log(`${colors.yellowBright(name)} config already exists, skipping...`);\r\n continue;\r\n }\r\n\r\n console.log(`Creating ${colors.magenta(name)} config...`);\r\n\r\n await putFileAsync(srcPath(`config/${name}.ts`), config.content);\r\n\r\n console.log(`${colors.green(name)} config created successfully`);\r\n }\r\n\r\n // now loop again over features to execute onExecuting\r\n for (const feature of resolvedFeatures) {\r\n const featurePackages = featuresMap[feature as keyof typeof featuresMap];\r\n if (featurePackages.onExecuting) {\r\n await featurePackages.onExecuting(options);\r\n }\r\n }\r\n\r\n if (Object.keys(scripts).length > 0) {\r\n console.log(`Adding scripts ${colors.magenta(Object.keys(scripts).join(\", \"))}`);\r\n const packageJsonPath = rootPath(\"package.json\");\r\n const packageJson = await getJsonFileAsync<ProjectPackageJson>(packageJsonPath);\r\n packageJson.scripts = { ...(packageJson.scripts ?? {}), ...scripts };\r\n await putJsonFileAsync(packageJsonPath, packageJson);\r\n\r\n console.log(`Scripts added successfully ${colors.green(Object.keys(scripts).join(\", \"))}`);\r\n }\r\n}\r\n\r\n/**\r\n * Install the resolved dependency sets through the project's package manager.\r\n * Runs two passes (prod then dev) so each lands in the correct section.\r\n */\r\nexport async function installDependencies(\n packageManager: PackageManager | undefined,\r\n dependencies: Record<string, string>,\r\n devDependencies: Record<string, string>,\r\n) {\r\n // `--package-manager` is optional; without it, fall back to the lockfile.\r\n const packageManagerCommand = getAddCommand(packageManager ?? (await detectPackageManager()));\r\n\r\n if (Object.keys(dependencies).length > 0) {\r\n console.log(`Installing dependencies ${colors.magenta(Object.keys(dependencies).join(\", \"))}`);\r\n\r\n const dependencySpecs = Object.entries(dependencies).map(\n ([name, version]) => `${name}@${version}`,\n );\n\n execSync(`${packageManagerCommand} ${dependencySpecs.join(\" \")}`, {\n cwd: process.cwd(),\r\n stdio: \"inherit\",\r\n });\r\n\r\n console.log(\r\n `Dependencies installed successfully ${colors.green(Object.keys(dependencies).join(\", \"))}`,\r\n );\r\n }\r\n\r\n if (Object.keys(devDependencies).length > 0) {\r\n console.log(\r\n `Installing dev dependencies ${colors.magenta(Object.keys(devDependencies).join(\", \"))}`,\r\n );\r\n\r\n const devDependencySpecs = Object.entries(devDependencies).map(\n ([name, version]) => `${name}@${version}`,\n );\n\n execSync(`${packageManagerCommand} ${devDependencySpecs.join(\" \")} -D`, {\n cwd: process.cwd(),\r\n stdio: \"inherit\",\r\n });\r\n\r\n console.log(\r\n `Dev dependencies installed successfully ${colors.green(Object.keys(devDependencies).join(\", \"))}`,\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Write the resolved dependency sets into package.json without installing.\r\n * Used by `--no-install` so a scaffolder can batch every feature into one\r\n * install pass after the command returns. Versions come from the feature map.\r\n */\r\nasync function recordDependencies(\r\n dependencies: Record<string, string>,\r\n devDependencies: Record<string, string>,\r\n) {\r\n if (Object.keys(dependencies).length === 0 && Object.keys(devDependencies).length === 0) {\r\n return;\r\n }\r\n\r\n const packageJsonPath = rootPath(\"package.json\");\r\n const packageJson = await getJsonFileAsync<ProjectPackageJson>(packageJsonPath);\r\n\r\n packageJson.dependencies = packageJson.dependencies ?? {};\r\n packageJson.devDependencies = packageJson.devDependencies ?? {};\r\n\r\n Object.assign(packageJson.dependencies, dependencies);\r\n Object.assign(packageJson.devDependencies, devDependencies);\r\n\r\n await putJsonFileAsync(packageJsonPath, packageJson);\r\n\r\n const recorded = [...Object.keys(dependencies), ...Object.keys(devDependencies)];\r\n\r\n console.log(\r\n `Recorded ${colors.green(recorded.join(\", \"))} in package.json (install skipped via --no-install)`,\r\n );\r\n}\r\n\r\nfunction validateFeatures(features: string[]) {\n for (const feature of features) {\r\n if (!allowedFeatures.includes(feature)) {\r\n console.log(\r\n `Feature ${colors.redBright(feature)} is not allowed, allowed features are: ${colors.green(allowedFeatures.join(\", \"))}`,\r\n );\r\n process.exit(1);\r\n }\r\n }\n}\n"],"mappings":";;;;;;;;;;AA+BA,MAAa,kBAAkB,OAAO,KAAK,WAAW;;;;;;AAOtD,SAAgB,iCACd,cACA,kBACM;CACN,KAAK,MAAM,cAAc,OAAO,KAAK,YAAY,GAC/C,IAAI,WAAW,WAAW,cAAc,GACtC,aAAa,cAAc;AAGjC;AAEA,SAAS,gBAAgB,UAAoB,0BAAU,IAAI,IAAY,GAAa;CAClF,MAAM,WAAqB,CAAC;CAE5B,KAAK,MAAM,WAAW,UAAU;EAC9B,IAAI,QAAQ,IAAI,OAAO,GAAG;EAC1B,QAAQ,IAAI,OAAO;EAEnB,MAAM,MAAM,YAAY;EAExB,IAAI,IAAI,UAAU,QAChB,SAAS,KAAK,GAAG,gBAAgB,IAAI,UAAU,OAAO,CAAC;EAGzD,SAAS,KAAK,OAAO;CACvB;CAEA,OAAO;AACT;AAEA,eAAsB,iBAAiB,SAA4B;CACjE,MAAM,WAAW,QAAQ;CACzB,MAAM,EAAE,gBAAgB,MAAM,cAAc,QAAQ;CAEpD,IAAI,MAAM;EACR,QAAQ,IAAI,qBAAqB;EAEjC,KAAK,MAAM,WAAW,iBACpB,QAAQ,IACN,KAAK,OAAO,aAAa,OAAO,EAAE,IAAI,OAAO,MAAM,YAAY,SAAS,WAAW,GACrF;EAGF,QAAQ,KAAK,CAAC;CAChB;CAEA,iBAAiB,QAAQ;CAEzB,MAAM,mBAAmB,gBAAgB,QAAQ;CAEjD,MAAM,eAAuC,CAAC;CAC9C,MAAM,kBAA0C,CAAC;CACjD,MAAM,eAAkE,CAAC;CACzE,MAAM,UAAkC,CAAC;CAEzC,KA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AJP,OAAO,QAAQ,eAAe,EAAE,KACxD,CAAC,MAAM,aAAa,GAAG,KAAK,GAAG,SAGoB,EAAE,KAAK,GAAG,EAAE,MAAM;GACtE,KAAK,QAAQ,IAAI;GACjB,OAAO;EACT,CAAC;EAED,QAAQ,IACN,2CAA2C,OAAO,MAAM,OAAO,KAAK,eAAe,EAAE,KAAK,IAAI,CAAC,GACjG;CACF;AACF;;;;;;AAOA,eAAe,mBACb,cACA,iBACA;CACA,IAAI,OAAO,KAAK,YAAY,EAAE,WAAW,KAAK,OAAO,KAAK,eAAe,EAAE,WAAW,GACpF;CAGF,MAAM,kBAAkB,SAAS,cAAc;CAC/C,MAAM,cAAc,MAAM,iBAAqC,eAAe;CAE9E,YAAY,eAAe,YAAY,gBAAgB,CAAC;CACxD,YAAY,kBAAkB,YAAY,mBAAmB,CAAC;CAE9D,OAAO,OAAO,YAAY,cAAc,YAAY;CACpD,OAAO,OAAO,YAAY,iBAAiB,eAAe;CAE1D,MAAM,iBAAiB,iBAAiB,WAAW;CAEnD,MAAM,WAAW,CAAC,GAAG,OAAO,KAAK,YAAY,GAAG,GAAG,OAAO,KAAK,eAAe,CAAC;CAE/E,QAAQ,IACN,YAAY,OAAO,MAAM,SAAS,KAAK,IAAI,CAAC,EAAE,oDAChD;AACF;AAEA,SAAS,iBAAiB,UAAoB;CAC5C,KAAK,MAAM,WAAW,UACpB,IAAI,CAAC,gBAAgB,SAAS,OAAO,GAAG;EACtC,QAAQ,IACN,WAAW,OAAO,UAAU,OAAO,EAAE,yCAAyC,OAAO,MAAM,gBAAgB,KAAK,IAAI,CAAC,GACvH;EACA,QAAQ,KAAK,CAAC;CAChB;AAEJ"}
@@ -2,6 +2,7 @@ import { srcPath } from "../../utils/paths.mjs";
2
2
  import "../../utils/index.mjs";
3
3
  import { accessConfigStub, accessResolverStub, accessRoleMigrationStub, accessRoleModelIndexStub, accessRoleModelStub, accessUserRoleMigrationStub, accessUserRoleModelIndexStub, accessUserRoleModelStub } from "../stubs.mjs";
4
4
  import { migrationTimestamp } from "./shared/migration-timestamp.mjs";
5
+ import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
5
6
  import { colors } from "@mongez/copper";
6
7
  import { ensureDirectoryAsync, fileExistsAsync, getFileAsync, putFileAsync } from "@warlock.js/fs";
7
8
 
@@ -63,7 +64,7 @@ async function completeAccessInstallation(_options) {
63
64
  }
64
65
  const accessFeature = {
65
66
  description: "Installs @warlock.js/access — authorization (RBAC + ABAC): permission checks, ABAC policies, and roles. Ejects config/access.ts, the DatabaseAccessResolver + Role/UserRole models and migrations into src/app/access, and registers the access locale in src/app/shared/utils/locales.ts",
66
- dependencies: { "@warlock.js/access": "~4.0.0" },
67
+ dependencies: { "@warlock.js/access": INSTALLED_WARLOCK_VERSION },
67
68
  ejectConfig: {
68
69
  content: accessConfigStub,
69
70
  name: "access"
@@ -1 +1 @@
1
- {"version":3,"file":"access.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/access.feature.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\r\nimport {\r\n ensureDirectoryAsync,\r\n fileExistsAsync,\r\n getFileAsync,\r\n putFileAsync,\r\n} from \"@warlock.js/fs\";\r\nimport { CommandActionData } from \"../../commands/types\";\r\nimport { srcPath } from \"../../utils\";\r\nimport {\r\n accessConfigStub,\r\n accessResolverStub,\r\n accessRoleMigrationStub,\r\n accessRoleModelIndexStub,\r\n accessRoleModelStub,\r\n accessUserRoleMigrationStub,\r\n accessUserRoleModelIndexStub,\r\n accessUserRoleModelStub,\r\n} from \"../stubs\";\r\nimport { migrationTimestamp } from \"./shared/migration-timestamp\";\r\nimport { FeatureDefinition } from \"./types\";\r\n\r\nasync function registerAccessLocale() {\r\n // Register the access locale in the project's shared translations file so a\r\n // denied check returns a real sentence, not the raw \"access.errors.forbidden\"\r\n // key. Append when the file exists, create it otherwise; skip if already there.\r\n const localesPath = srcPath(\"app/shared/utils/locales.ts\");\r\n\r\n const accessLocale = `groupedTranslations(\"access\", {\r\n errors: {\r\n forbidden: {\r\n en: \"You do not have permission to perform this action.\",\r\n ar: \"ليس لديك صلاحية لتنفيذ هذا الإجراء.\",\r\n },\r\n },\r\n});\r\n`;\r\n\r\n if (await fileExistsAsync(localesPath)) {\r\n const current = await getFileAsync(localesPath);\r\n\r\n if (current.includes(`groupedTranslations(\"access\"`)) {\r\n console.log(`${colors.yellowBright(\"access\")} locale already registered, skipping...`);\r\n\r\n return;\r\n }\r\n\r\n // The file uses groupedTranslations already iff it calls it — only inject the\r\n // import when no call is present yet.\r\n const importLine = `import { groupedTranslations } from \"@warlock.js/core\";`;\r\n const prefix = current.includes(\"groupedTranslations(\") ? \"\" : `${importLine}\\n\\n`;\r\n\r\n await putFileAsync(localesPath, `${prefix}${current.trimEnd()}\\n\\n${accessLocale}`);\r\n\r\n console.log(\r\n `${colors.green(\"✓\")} Registered the access locale in src/app/shared/utils/locales.ts`,\r\n );\r\n\r\n return;\r\n }\r\n\r\n await ensureDirectoryAsync(srcPath(\"app/shared/utils\"));\r\n\r\n await putFileAsync(\r\n localesPath,\r\n `import { groupedTranslations } from \"@warlock.js/core\";\\n\\n${accessLocale}`,\r\n );\r\n\r\n console.log(`${colors.green(\"✓\")} Created src/app/shared/utils/locales.ts with the access locale`);\r\n}\r\n\r\nasync function scaffoldAccessFiles() {\r\n // The resolver file is the sentinel for \"access already scaffolded\" — its\r\n // presence means the role/user-role model folders and their timestamped\r\n // migrations were created too, so we must not re-emit duplicate migrations on\r\n // a second run.\r\n const resolverPath = srcPath(\"app/access/services/access-resolver.ts\");\r\n\r\n if (await fileExistsAsync(resolverPath)) {\r\n console.log(\r\n `${colors.yellowBright(\"src/app/access\")} already scaffolded, skipping resolver + role tables...`,\r\n );\r\n\r\n return;\r\n }\r\n\r\n // 1. Role catalog model folder (model + barrel + migration). The catalog row\r\n // is role name → granted permissions; managed at runtime in the DB.\r\n await ensureDirectoryAsync(srcPath(\"app/access/models/role\"));\r\n await putFileAsync(srcPath(\"app/access/models/role/role.model.ts\"), accessRoleModelStub);\r\n await putFileAsync(srcPath(\"app/access/models/role/index.ts\"), accessRoleModelIndexStub);\r\n console.log(`${colors.green(\"✓\")} Created src/app/access/models/role`);\r\n\r\n await ensureDirectoryAsync(srcPath(\"app/access/models/role/migrations\"));\r\n\r\n // Migration filenames carry a MM-DD-YYYY_HH-MM-SS prefix so cascade infers\r\n // their createdAt and orders them deterministically (the migrate action\r\n // discovers src/app/*/models/*/migrations/*). The two tables are independent\r\n // (no FK between them), but the user-role migration is stamped a second later\r\n // so the relative order is stable.\r\n const roleMigrationFile = `${migrationTimestamp()}-role.migration.ts`;\r\n await putFileAsync(\r\n srcPath(\"app/access/models/role/migrations\", roleMigrationFile),\r\n accessRoleMigrationStub,\r\n );\r\n console.log(\r\n `${colors.green(\"✓\")} Created src/app/access/models/role/migrations/${roleMigrationFile}`,\r\n );\r\n\r\n // 2. UserRole assignment model folder (model + barrel + migration). The model\r\n // statics scope an unresolved tenant to GLOBAL rows only (security\r\n // invariant) — see the stub for the reasoning.\r\n await ensureDirectoryAsync(srcPath(\"app/access/models/user-role\"));\r\n await putFileAsync(\r\n srcPath(\"app/access/models/user-role/user-role.model.ts\"),\r\n accessUserRoleModelStub,\r\n );\r\n await putFileAsync(\r\n srcPath(\"app/access/models/user-role/index.ts\"),\r\n accessUserRoleModelIndexStub,\r\n );\r\n console.log(`${colors.green(\"✓\")} Created src/app/access/models/user-role`);\r\n\r\n await ensureDirectoryAsync(srcPath(\"app/access/models/user-role/migrations\"));\r\n\r\n const userRoleMigrationFile = `${migrationTimestamp(1)}-user-role.migration.ts`;\r\n await putFileAsync(\r\n srcPath(\"app/access/models/user-role/migrations\", userRoleMigrationFile),\r\n accessUserRoleMigrationStub,\r\n );\r\n console.log(\r\n `${colors.green(\"✓\")} Created src/app/access/models/user-role/migrations/${userRoleMigrationFile}`,\r\n );\r\n\r\n // 3. The DatabaseAccessResolver — the one required config seam, wired into\r\n // config/access.ts by the ejected stub.\r\n await ensureDirectoryAsync(srcPath(\"app/access/services\"));\r\n await putFileAsync(resolverPath, accessResolverStub);\r\n console.log(`${colors.green(\"✓\")} Created src/app/access/services/access-resolver.ts`);\r\n}\r\n\r\nasync function completeAccessInstallation(_options: CommandActionData) {\r\n await registerAccessLocale();\r\n await scaffoldAccessFiles();\r\n}\r\n\r\nexport const accessFeature: FeatureDefinition = {\r\n description:\r\n \"Installs @warlock.js/access — authorization (RBAC + ABAC): permission checks, ABAC policies, and roles. Ejects config/access.ts, the DatabaseAccessResolver + Role/UserRole models and migrations into src/app/access, and registers the access locale in src/app/shared/utils/locales.ts\",\r\n dependencies: {\r\n \"@warlock.js/access\": \"~4.0.0\",\r\n },\r\n ejectConfig: {\r\n content: accessConfigStub,\r\n name: \"access\",\r\n },\r\n onExecuting: completeAccessInstallation,\r\n};\r\n"],"mappings":";;;;;;;;AAsBA,eAAe,uBAAuB;CAIpC,MAAM,cAAc,QAAQ,6BAA6B;CAEzD,MAAM,eAAe;;;;;;;;;CAUrB,IAAI,MAAM,gBAAgB,WAAW,GAAG;EACtC,MAAM,UAAU,MAAM,aAAa,WAAW;EAE9C,IAAI,QAAQ,SAAS,8BAA8B,GAAG;GACpD,QAAQ,IAAI,GAAG,OAAO,aAAa,QAAQ,EAAE,wCAAwC;GAErF;EACF;EAOA,MAAM,aAAa,aAAa,GAFjB,QAAQ,SAAS,sBAAsB,IAAI,KAAK,gEAEnB,QAAQ,QAAQ,EAAE,MAAM,cAAc;EAElF,QAAQ,IACN,GAAG,OAAO,MAAM,GAAG,EAAE,iEACvB;EAEA;CACF;CAEA,MAAM,qBAAqB,QAAQ,kBAAkB,CAAC;CAEtD,MAAM,aACJ,aACA,8DAA8D,cAChE;CAEA,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,gEAAgE;AACnG;AAEA,eAAe,sBAAsB;CAKnC,MAAM,eAAe,QAAQ,wCAAwC;CAErE,IAAI,MAAM,gBAAgB,YAAY,GAAG;EACvC,QAAQ,IACN,GAAG,OA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/features/access.feature.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\r\nimport {\r\n ensureDirectoryAsync,\r\n fileExistsAsync,\r\n getFileAsync,\r\n putFileAsync,\r\n} from \"@warlock.js/fs\";\r\nimport { CommandActionData } from \"../../commands/types\";\r\nimport { srcPath } from \"../../utils\";\r\nimport {\r\n accessConfigStub,\r\n accessResolverStub,\r\n accessRoleMigrationStub,\r\n accessRoleModelIndexStub,\r\n accessRoleModelStub,\r\n accessUserRoleMigrationStub,\r\n accessUserRoleModelIndexStub,\r\n accessUserRoleModelStub,\r\n} from \"../stubs\";\r\nimport { migrationTimestamp } from \"./shared/migration-timestamp\";\r\nimport { FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\r\nasync function registerAccessLocale() {\r\n // Register the access locale in the project's shared translations file so a\r\n // denied check returns a real sentence, not the raw \"access.errors.forbidden\"\r\n // key. Append when the file exists, create it otherwise; skip if already there.\r\n const localesPath = srcPath(\"app/shared/utils/locales.ts\");\r\n\r\n const accessLocale = `groupedTranslations(\"access\", {\r\n errors: {\r\n forbidden: {\r\n en: \"You do not have permission to perform this action.\",\r\n ar: \"ليس لديك صلاحية لتنفيذ هذا الإجراء.\",\r\n },\r\n },\r\n});\r\n`;\r\n\r\n if (await fileExistsAsync(localesPath)) {\r\n const current = await getFileAsync(localesPath);\r\n\r\n if (current.includes(`groupedTranslations(\"access\"`)) {\r\n console.log(`${colors.yellowBright(\"access\")} locale already registered, skipping...`);\r\n\r\n return;\r\n }\r\n\r\n // The file uses groupedTranslations already iff it calls it — only inject the\r\n // import when no call is present yet.\r\n const importLine = `import { groupedTranslations } from \"@warlock.js/core\";`;\r\n const prefix = current.includes(\"groupedTranslations(\") ? \"\" : `${importLine}\\n\\n`;\r\n\r\n await putFileAsync(localesPath, `${prefix}${current.trimEnd()}\\n\\n${accessLocale}`);\r\n\r\n console.log(\r\n `${colors.green(\"✓\")} Registered the access locale in src/app/shared/utils/locales.ts`,\r\n );\r\n\r\n return;\r\n }\r\n\r\n await ensureDirectoryAsync(srcPath(\"app/shared/utils\"));\r\n\r\n await putFileAsync(\r\n localesPath,\r\n `import { groupedTranslations } from \"@warlock.js/core\";\\n\\n${accessLocale}`,\r\n );\r\n\r\n console.log(`${colors.green(\"✓\")} Created src/app/shared/utils/locales.ts with the access locale`);\r\n}\r\n\r\nasync function scaffoldAccessFiles() {\r\n // The resolver file is the sentinel for \"access already scaffolded\" — its\r\n // presence means the role/user-role model folders and their timestamped\r\n // migrations were created too, so we must not re-emit duplicate migrations on\r\n // a second run.\r\n const resolverPath = srcPath(\"app/access/services/access-resolver.ts\");\r\n\r\n if (await fileExistsAsync(resolverPath)) {\r\n console.log(\r\n `${colors.yellowBright(\"src/app/access\")} already scaffolded, skipping resolver + role tables...`,\r\n );\r\n\r\n return;\r\n }\r\n\r\n // 1. Role catalog model folder (model + barrel + migration). The catalog row\r\n // is role name → granted permissions; managed at runtime in the DB.\r\n await ensureDirectoryAsync(srcPath(\"app/access/models/role\"));\r\n await putFileAsync(srcPath(\"app/access/models/role/role.model.ts\"), accessRoleModelStub);\r\n await putFileAsync(srcPath(\"app/access/models/role/index.ts\"), accessRoleModelIndexStub);\r\n console.log(`${colors.green(\"✓\")} Created src/app/access/models/role`);\r\n\r\n await ensureDirectoryAsync(srcPath(\"app/access/models/role/migrations\"));\r\n\r\n // Migration filenames carry a MM-DD-YYYY_HH-MM-SS prefix so cascade infers\r\n // their createdAt and orders them deterministically (the migrate action\r\n // discovers src/app/*/models/*/migrations/*). The two tables are independent\r\n // (no FK between them), but the user-role migration is stamped a second later\r\n // so the relative order is stable.\r\n const roleMigrationFile = `${migrationTimestamp()}-role.migration.ts`;\r\n await putFileAsync(\r\n srcPath(\"app/access/models/role/migrations\", roleMigrationFile),\r\n accessRoleMigrationStub,\r\n );\r\n console.log(\r\n `${colors.green(\"✓\")} Created src/app/access/models/role/migrations/${roleMigrationFile}`,\r\n );\r\n\r\n // 2. UserRole assignment model folder (model + barrel + migration). The model\r\n // statics scope an unresolved tenant to GLOBAL rows only (security\r\n // invariant) — see the stub for the reasoning.\r\n await ensureDirectoryAsync(srcPath(\"app/access/models/user-role\"));\r\n await putFileAsync(\r\n srcPath(\"app/access/models/user-role/user-role.model.ts\"),\r\n accessUserRoleModelStub,\r\n );\r\n await putFileAsync(\r\n srcPath(\"app/access/models/user-role/index.ts\"),\r\n accessUserRoleModelIndexStub,\r\n );\r\n console.log(`${colors.green(\"✓\")} Created src/app/access/models/user-role`);\r\n\r\n await ensureDirectoryAsync(srcPath(\"app/access/models/user-role/migrations\"));\r\n\r\n const userRoleMigrationFile = `${migrationTimestamp(1)}-user-role.migration.ts`;\r\n await putFileAsync(\r\n srcPath(\"app/access/models/user-role/migrations\", userRoleMigrationFile),\r\n accessUserRoleMigrationStub,\r\n );\r\n console.log(\r\n `${colors.green(\"✓\")} Created src/app/access/models/user-role/migrations/${userRoleMigrationFile}`,\r\n );\r\n\r\n // 3. The DatabaseAccessResolver — the one required config seam, wired into\r\n // config/access.ts by the ejected stub.\r\n await ensureDirectoryAsync(srcPath(\"app/access/services\"));\r\n await putFileAsync(resolverPath, accessResolverStub);\r\n console.log(`${colors.green(\"✓\")} Created src/app/access/services/access-resolver.ts`);\r\n}\r\n\r\nasync function completeAccessInstallation(_options: CommandActionData) {\r\n await registerAccessLocale();\r\n await scaffoldAccessFiles();\r\n}\r\n\r\nexport const accessFeature: FeatureDefinition = {\r\n description:\r\n \"Installs @warlock.js/access — authorization (RBAC + ABAC): permission checks, ABAC policies, and roles. Ejects config/access.ts, the DatabaseAccessResolver + Role/UserRole models and migrations into src/app/access, and registers the access locale in src/app/shared/utils/locales.ts\",\r\n dependencies: {\r\n \"@warlock.js/access\": INSTALLED_WARLOCK_VERSION,\n },\r\n ejectConfig: {\r\n content: accessConfigStub,\r\n name: \"access\",\r\n },\r\n onExecuting: completeAccessInstallation,\r\n};\r\n"],"mappings":";;;;;;;;;AAsBA,eAAe,uBAAuB;CAIpC,MAAM,cAAc,QAAQ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,4BACF;CACA,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,yCAAyC;CAE1E,MAAM,qBAAqB,QAAQ,wCAAwC,CAAC;CAE5E,MAAM,wBAAwB,GAAG,mBAAmB,CAAC,EAAE;CACvD,MAAM,aACJ,QAAQ,0CAA0C,qBAAqB,GACvE,2BACF;CACA,QAAQ,IACN,GAAG,OAAO,MAAM,GAAG,EAAE,sDAAsD,uBAC7E;CAIA,MAAM,qBAAqB,QAAQ,qBAAqB,CAAC;CACzD,MAAM,aAAa,cAAc,kBAAkB;CACnD,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,oDAAoD;AACvF;AAEA,eAAe,2BAA2B,UAA6B;CACrE,MAAM,qBAAqB;CAC3B,MAAM,oBAAoB;AAC5B;AAEA,MAAa,gBAAmC;CAC9C,aACE;CACF,cAAc,EACZ,sBAAsB,0BACxB;CACA,aAAa;EACX,SAAS;EACT,MAAM;CACR;CACA,aAAa;AACf"}
@@ -1,8 +1,10 @@
1
+ import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
2
+
1
3
  //#region ../core/src/generations/features/ai-anthropic.feature.ts
2
4
  const aiAnthropicFeature = {
3
5
  description: "Anthropic (Claude) provider for @warlock.js/ai (pulls the core ai package)",
4
6
  requires: ["ai"],
5
- dependencies: { "@warlock.js/ai-anthropic": "~4.0.0" }
7
+ dependencies: { "@warlock.js/ai-anthropic": INSTALLED_WARLOCK_VERSION }
6
8
  };
7
9
 
8
10
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"ai-anthropic.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-anthropic.feature.ts"],"sourcesContent":["import { FeatureDefinition } from \"./types\";\r\n\r\nexport const aiAnthropicFeature: FeatureDefinition = {\r\n description: \"Anthropic (Claude) provider for @warlock.js/ai (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-anthropic\": \"~4.0.0\",\r\n },\r\n};\r\n"],"mappings":";AAEA,MAAa,qBAAwC;CACnD,aAAa;CACb,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,4BAA4B,SAC9B;AACF"}
1
+ {"version":3,"file":"ai-anthropic.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-anthropic.feature.ts"],"sourcesContent":["import { FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\r\nexport const aiAnthropicFeature: FeatureDefinition = {\r\n description: \"Anthropic (Claude) provider for @warlock.js/ai (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-anthropic\": INSTALLED_WARLOCK_VERSION,\n },\r\n};\r\n"],"mappings":";;;AAEA,MAAa,qBAAwC;CACnD,aAAa;CACb,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,4BAA4B,0BAC9B;AACF"}
@@ -1,8 +1,10 @@
1
+ import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
2
+
1
3
  //#region ../core/src/generations/features/ai-bedrock.feature.ts
2
4
  const aiBedrockFeature = {
3
5
  description: "AWS Bedrock provider for @warlock.js/ai (pulls the core ai package)",
4
6
  requires: ["ai"],
5
- dependencies: { "@warlock.js/ai-bedrock": "~4.0.0" }
7
+ dependencies: { "@warlock.js/ai-bedrock": INSTALLED_WARLOCK_VERSION }
6
8
  };
7
9
 
8
10
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"ai-bedrock.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-bedrock.feature.ts"],"sourcesContent":["import { FeatureDefinition } from \"./types\";\r\n\r\nexport const aiBedrockFeature: FeatureDefinition = {\r\n description: \"AWS Bedrock provider for @warlock.js/ai (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-bedrock\": \"~4.0.0\",\r\n },\r\n};\r\n"],"mappings":";AAEA,MAAa,mBAAsC;CACjD,aAAa;CACb,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,0BAA0B,SAC5B;AACF"}
1
+ {"version":3,"file":"ai-bedrock.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-bedrock.feature.ts"],"sourcesContent":["import { FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\r\nexport const aiBedrockFeature: FeatureDefinition = {\r\n description: \"AWS Bedrock provider for @warlock.js/ai (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-bedrock\": INSTALLED_WARLOCK_VERSION,\n },\r\n};\r\n"],"mappings":";;;AAEA,MAAa,mBAAsC;CACjD,aAAa;CACb,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,0BAA0B,0BAC5B;AACF"}
@@ -1,8 +1,10 @@
1
+ import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
2
+
1
3
  //#region ../core/src/generations/features/ai-google.feature.ts
2
4
  const aiGoogleFeature = {
3
5
  description: "Google (Gemini) provider for @warlock.js/ai (pulls the core ai package)",
4
6
  requires: ["ai"],
5
- dependencies: { "@warlock.js/ai-google": "~4.0.0" }
7
+ dependencies: { "@warlock.js/ai-google": INSTALLED_WARLOCK_VERSION }
6
8
  };
7
9
 
8
10
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"ai-google.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-google.feature.ts"],"sourcesContent":["import { FeatureDefinition } from \"./types\";\r\n\r\nexport const aiGoogleFeature: FeatureDefinition = {\r\n description: \"Google (Gemini) provider for @warlock.js/ai (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-google\": \"~4.0.0\",\r\n },\r\n};\r\n"],"mappings":";AAEA,MAAa,kBAAqC;CAChD,aAAa;CACb,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,yBAAyB,SAC3B;AACF"}
1
+ {"version":3,"file":"ai-google.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-google.feature.ts"],"sourcesContent":["import { FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\r\nexport const aiGoogleFeature: FeatureDefinition = {\r\n description: \"Google (Gemini) provider for @warlock.js/ai (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-google\": INSTALLED_WARLOCK_VERSION,\n },\r\n};\r\n"],"mappings":";;;AAEA,MAAa,kBAAqC;CAChD,aAAa;CACb,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,yBAAyB,0BAC3B;AACF"}
@@ -1,8 +1,10 @@
1
+ import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
2
+
1
3
  //#region ../core/src/generations/features/ai-ollama.feature.ts
2
4
  const aiOllamaFeature = {
3
5
  description: "Ollama provider for @warlock.js/ai (pulls the core ai package)",
4
6
  requires: ["ai"],
5
- dependencies: { "@warlock.js/ai-ollama": "~4.0.0" }
7
+ dependencies: { "@warlock.js/ai-ollama": INSTALLED_WARLOCK_VERSION }
6
8
  };
7
9
 
8
10
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"ai-ollama.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-ollama.feature.ts"],"sourcesContent":["import { FeatureDefinition } from \"./types\";\r\n\r\nexport const aiOllamaFeature: FeatureDefinition = {\r\n description: \"Ollama provider for @warlock.js/ai (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-ollama\": \"~4.0.0\",\r\n },\r\n};\r\n"],"mappings":";AAEA,MAAa,kBAAqC;CAChD,aAAa;CACb,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,yBAAyB,SAC3B;AACF"}
1
+ {"version":3,"file":"ai-ollama.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-ollama.feature.ts"],"sourcesContent":["import { FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\r\nexport const aiOllamaFeature: FeatureDefinition = {\r\n description: \"Ollama provider for @warlock.js/ai (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-ollama\": INSTALLED_WARLOCK_VERSION,\n },\r\n};\r\n"],"mappings":";;;AAEA,MAAa,kBAAqC;CAChD,aAAa;CACb,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,yBAAyB,0BAC3B;AACF"}
@@ -1,8 +1,10 @@
1
+ import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
2
+
1
3
  //#region ../core/src/generations/features/ai-openai.feature.ts
2
4
  const aiOpenaiFeature = {
3
5
  description: "OpenAI provider for @warlock.js/ai (pulls the core ai package)",
4
6
  requires: ["ai"],
5
- dependencies: { "@warlock.js/ai-openai": "~4.0.0" }
7
+ dependencies: { "@warlock.js/ai-openai": INSTALLED_WARLOCK_VERSION }
6
8
  };
7
9
 
8
10
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"ai-openai.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-openai.feature.ts"],"sourcesContent":["import { FeatureDefinition } from \"./types\";\r\n\r\nexport const aiOpenaiFeature: FeatureDefinition = {\r\n description: \"OpenAI provider for @warlock.js/ai (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-openai\": \"~4.0.0\",\r\n },\r\n};\r\n"],"mappings":";AAEA,MAAa,kBAAqC;CAChD,aAAa;CACb,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,yBAAyB,SAC3B;AACF"}
1
+ {"version":3,"file":"ai-openai.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-openai.feature.ts"],"sourcesContent":["import { FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\r\nexport const aiOpenaiFeature: FeatureDefinition = {\r\n description: \"OpenAI provider for @warlock.js/ai (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-openai\": INSTALLED_WARLOCK_VERSION,\n },\r\n};\r\n"],"mappings":";;;AAEA,MAAa,kBAAqC;CAChD,aAAa;CACb,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,yBAAyB,0BAC3B;AACF"}
@@ -1,10 +1,11 @@
1
+ import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
1
2
  import { linkAiPackageImport } from "./shared/link-ai-package-import.mjs";
2
3
 
3
4
  //#region ../core/src/generations/features/ai-panoptic.feature.ts
4
5
  const aiPanopticFeature = {
5
6
  description: "Installs @warlock.js/ai-panoptic — observability for @warlock.js/ai (collector, exporters, zero-setup local dashboard) via ai.config({ panoptic }) (pulls the core ai package)",
6
7
  requires: ["ai"],
7
- dependencies: { "@warlock.js/ai-panoptic": "~4.0.0" },
8
+ dependencies: { "@warlock.js/ai-panoptic": INSTALLED_WARLOCK_VERSION },
8
9
  onExecuting: () => linkAiPackageImport("@warlock.js/ai-panoptic")
9
10
  };
10
11
 
@@ -1 +1 @@
1
- {"version":3,"file":"ai-panoptic.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-panoptic.feature.ts"],"sourcesContent":["import { linkAiPackageImport } from \"./shared/link-ai-package-import\";\r\nimport { FeatureDefinition } from \"./types\";\r\n\r\nexport const aiPanopticFeature: FeatureDefinition = {\r\n description:\r\n \"Installs @warlock.js/ai-panoptic — observability for @warlock.js/ai (collector, exporters, zero-setup local dashboard) via ai.config({ panoptic }) (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-panoptic\": \"~4.0.0\",\r\n },\r\n onExecuting: () => linkAiPackageImport(\"@warlock.js/ai-panoptic\"),\r\n};\r\n"],"mappings":";;;AAGA,MAAa,oBAAuC;CAClD,aACE;CACF,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,2BAA2B,SAC7B;CACA,mBAAmB,oBAAoB,yBAAyB;AAClE"}
1
+ {"version":3,"file":"ai-panoptic.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-panoptic.feature.ts"],"sourcesContent":["import { linkAiPackageImport } from \"./shared/link-ai-package-import\";\r\nimport { FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\r\nexport const aiPanopticFeature: FeatureDefinition = {\r\n description:\r\n \"Installs @warlock.js/ai-panoptic — observability for @warlock.js/ai (collector, exporters, zero-setup local dashboard) via ai.config({ panoptic }) (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-panoptic\": INSTALLED_WARLOCK_VERSION,\n },\r\n onExecuting: () => linkAiPackageImport(\"@warlock.js/ai-panoptic\"),\r\n};\r\n"],"mappings":";;;;AAGA,MAAa,oBAAuC;CAClD,aACE;CACF,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,2BAA2B,0BAC7B;CACA,mBAAmB,oBAAoB,yBAAyB;AAClE"}
@@ -1,10 +1,11 @@
1
+ import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
1
2
  import { linkAiPackageImport } from "./shared/link-ai-package-import.mjs";
2
3
 
3
4
  //#region ../core/src/generations/features/ai-tools.feature.ts
4
5
  const aiToolsFeature = {
5
6
  description: "Installs @warlock.js/ai-tools — ready-made agent tools (web search, fetch, HTTP, calculator, date-time) + an MCP client/server, under ai.tools.* / ai.mcp (pulls the core ai package)",
6
7
  requires: ["ai"],
7
- dependencies: { "@warlock.js/ai-tools": "~4.0.0" },
8
+ dependencies: { "@warlock.js/ai-tools": INSTALLED_WARLOCK_VERSION },
8
9
  onExecuting: () => linkAiPackageImport("@warlock.js/ai-tools")
9
10
  };
10
11
 
@@ -1 +1 @@
1
- {"version":3,"file":"ai-tools.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-tools.feature.ts"],"sourcesContent":["import { linkAiPackageImport } from \"./shared/link-ai-package-import\";\r\nimport { FeatureDefinition } from \"./types\";\r\n\r\nexport const aiToolsFeature: FeatureDefinition = {\r\n description:\r\n \"Installs @warlock.js/ai-tools — ready-made agent tools (web search, fetch, HTTP, calculator, date-time) + an MCP client/server, under ai.tools.* / ai.mcp (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-tools\": \"~4.0.0\",\r\n },\r\n onExecuting: () => linkAiPackageImport(\"@warlock.js/ai-tools\"),\r\n};\r\n"],"mappings":";;;AAGA,MAAa,iBAAoC;CAC/C,aACE;CACF,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,wBAAwB,SAC1B;CACA,mBAAmB,oBAAoB,sBAAsB;AAC/D"}
1
+ {"version":3,"file":"ai-tools.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-tools.feature.ts"],"sourcesContent":["import { linkAiPackageImport } from \"./shared/link-ai-package-import\";\r\nimport { FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\r\nexport const aiToolsFeature: FeatureDefinition = {\r\n description:\r\n \"Installs @warlock.js/ai-tools — ready-made agent tools (web search, fetch, HTTP, calculator, date-time) + an MCP client/server, under ai.tools.* / ai.mcp (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-tools\": INSTALLED_WARLOCK_VERSION,\n },\r\n onExecuting: () => linkAiPackageImport(\"@warlock.js/ai-tools\"),\r\n};\r\n"],"mappings":";;;;AAGA,MAAa,iBAAoC;CAC/C,aACE;CACF,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,wBAAwB,0BAC1B;CACA,mBAAmB,oBAAoB,sBAAsB;AAC/D"}
@@ -1,10 +1,11 @@
1
+ import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
1
2
  import { linkAiPackageImport } from "./shared/link-ai-package-import.mjs";
2
3
 
3
4
  //#region ../core/src/generations/features/ai-workspace.feature.ts
4
5
  const aiWorkspaceFeature = {
5
6
  description: "Installs @warlock.js/ai-workspace — a policy-jailed filesystem + shell workspace for coding agents, as ai.workspace (pulls the core ai package)",
6
7
  requires: ["ai"],
7
- dependencies: { "@warlock.js/ai-workspace": "~4.0.0" },
8
+ dependencies: { "@warlock.js/ai-workspace": INSTALLED_WARLOCK_VERSION },
8
9
  onExecuting: () => linkAiPackageImport("@warlock.js/ai-workspace")
9
10
  };
10
11
 
@@ -1 +1 @@
1
- {"version":3,"file":"ai-workspace.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-workspace.feature.ts"],"sourcesContent":["import { linkAiPackageImport } from \"./shared/link-ai-package-import\";\r\nimport { FeatureDefinition } from \"./types\";\r\n\r\nexport const aiWorkspaceFeature: FeatureDefinition = {\r\n description:\r\n \"Installs @warlock.js/ai-workspace — a policy-jailed filesystem + shell workspace for coding agents, as ai.workspace (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-workspace\": \"~4.0.0\",\r\n },\r\n onExecuting: () => linkAiPackageImport(\"@warlock.js/ai-workspace\"),\r\n};\r\n"],"mappings":";;;AAGA,MAAa,qBAAwC;CACnD,aACE;CACF,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,4BAA4B,SAC9B;CACA,mBAAmB,oBAAoB,0BAA0B;AACnE"}
1
+ {"version":3,"file":"ai-workspace.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai-workspace.feature.ts"],"sourcesContent":["import { linkAiPackageImport } from \"./shared/link-ai-package-import\";\r\nimport { FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\r\nexport const aiWorkspaceFeature: FeatureDefinition = {\r\n description:\r\n \"Installs @warlock.js/ai-workspace — a policy-jailed filesystem + shell workspace for coding agents, as ai.workspace (pulls the core ai package)\",\r\n requires: [\"ai\"],\r\n dependencies: {\r\n \"@warlock.js/ai-workspace\": INSTALLED_WARLOCK_VERSION,\n },\r\n onExecuting: () => linkAiPackageImport(\"@warlock.js/ai-workspace\"),\r\n};\r\n"],"mappings":";;;;AAGA,MAAa,qBAAwC;CACnD,aACE;CACF,UAAU,CAAC,IAAI;CACf,cAAc,EACZ,4BAA4B,0BAC9B;CACA,mBAAmB,oBAAoB,0BAA0B;AACnE"}
@@ -1,9 +1,10 @@
1
1
  import { aiConfigStub } from "../stubs.mjs";
2
+ import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
2
3
 
3
4
  //#region ../core/src/generations/features/ai.feature.ts
4
5
  const aiFeature = {
5
6
  description: "Installs @warlock.js/ai — the core AI toolkit (agents, tools, workflows)",
6
- dependencies: { "@warlock.js/ai": "~4.0.0" },
7
+ dependencies: { "@warlock.js/ai": INSTALLED_WARLOCK_VERSION },
7
8
  ejectConfig: {
8
9
  content: aiConfigStub,
9
10
  name: "ai"
@@ -1 +1 @@
1
- {"version":3,"file":"ai.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai.feature.ts"],"sourcesContent":["import { aiConfigStub } from \"../stubs\";\r\nimport { FeatureDefinition } from \"./types\";\r\n\r\nexport const aiFeature: FeatureDefinition = {\r\n description: \"Installs @warlock.js/ai — the core AI toolkit (agents, tools, workflows)\",\r\n dependencies: {\r\n \"@warlock.js/ai\": \"~4.0.0\",\r\n },\r\n ejectConfig: {\r\n content: aiConfigStub,\r\n name: \"ai\",\r\n },\r\n};\r\n"],"mappings":";;;AAGA,MAAa,YAA+B;CAC1C,aAAa;CACb,cAAc,EACZ,kBAAkB,SACpB;CACA,aAAa;EACX,SAAS;EACT,MAAM;CACR;AACF"}
1
+ {"version":3,"file":"ai.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/ai.feature.ts"],"sourcesContent":["import { aiConfigStub } from \"../stubs\";\r\nimport { FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\r\nexport const aiFeature: FeatureDefinition = {\r\n description: \"Installs @warlock.js/ai — the core AI toolkit (agents, tools, workflows)\",\r\n dependencies: {\r\n \"@warlock.js/ai\": INSTALLED_WARLOCK_VERSION,\n },\r\n ejectConfig: {\r\n content: aiConfigStub,\r\n name: \"ai\",\r\n },\r\n};\r\n"],"mappings":";;;;AAGA,MAAa,YAA+B;CAC1C,aAAa;CACb,cAAc,EACZ,kBAAkB,0BACpB;CACA,aAAa;EACX,SAAS;EACT,MAAM;CACR;AACF"}
@@ -1,10 +1,11 @@
1
1
  import { communicatorsConfigStub } from "../stubs.mjs";
2
+ import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
2
3
 
3
4
  //#region ../core/src/generations/features/herald.feature.ts
4
5
  const heraldFeature = {
5
6
  description: "Installs herald for message broker (Herald Package)",
6
7
  dependencies: {
7
- "@warlock.js/herald": "~4.0.0",
8
+ "@warlock.js/herald": INSTALLED_WARLOCK_VERSION,
8
9
  amqplib: "^0.10.0"
9
10
  },
10
11
  devDependencies: { "@types/amqplib": "^0.10.0" },
@@ -1 +1 @@
1
- {"version":3,"file":"herald.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/herald.feature.ts"],"sourcesContent":["import { communicatorsConfigStub } from \"../stubs\";\r\nimport { FeatureDefinition } from \"./types\";\r\n\r\nexport const heraldFeature: FeatureDefinition = {\r\n description: \"Installs herald for message broker (Herald Package)\",\r\n dependencies: {\r\n \"@warlock.js/herald\": \"~4.0.0\",\r\n amqplib: \"^0.10.0\",\r\n },\r\n devDependencies: {\r\n \"@types/amqplib\": \"^0.10.0\",\r\n },\r\n ejectConfig: {\r\n content: communicatorsConfigStub,\r\n name: \"herald\",\r\n },\r\n};\r\n"],"mappings":";;;AAGA,MAAa,gBAAmC;CAC9C,aAAa;CACb,cAAc;EACZ,sBAAsB;EACtB,SAAS;CACX;CACA,iBAAiB,EACf,kBAAkB,UACpB;CACA,aAAa;EACX,SAAS;EACT,MAAM;CACR;AACF"}
1
+ {"version":3,"file":"herald.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/herald.feature.ts"],"sourcesContent":["import { communicatorsConfigStub } from \"../stubs\";\r\nimport { FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\r\nexport const heraldFeature: FeatureDefinition = {\r\n description: \"Installs herald for message broker (Herald Package)\",\r\n dependencies: {\r\n \"@warlock.js/herald\": INSTALLED_WARLOCK_VERSION,\n amqplib: \"^0.10.0\",\r\n },\r\n devDependencies: {\r\n \"@types/amqplib\": \"^0.10.0\",\r\n },\r\n ejectConfig: {\r\n content: communicatorsConfigStub,\r\n name: \"herald\",\r\n },\r\n};\r\n"],"mappings":";;;;AAGA,MAAa,gBAAmC;CAC9C,aAAa;CACb,cAAc;EACZ,sBAAsB;EACtB,SAAS;CACX;CACA,iBAAiB,EACf,kBAAkB,UACpB;CACA,aAAa;EACX,SAAS;EACT,MAAM;CACR;AACF"}
@@ -2,6 +2,7 @@ import { srcPath } from "../../utils/paths.mjs";
2
2
  import "../../utils/index.mjs";
3
3
  import { notificationControllersStub, notificationMigrationStub, notificationModelStub, notificationRoutesStub, notificationsConfigStub } from "../stubs.mjs";
4
4
  import { migrationTimestamp } from "./shared/migration-timestamp.mjs";
5
+ import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
5
6
  import { colors } from "@mongez/copper";
6
7
  import { ensureDirectoryAsync, fileExistsAsync, putFileAsync } from "@warlock.js/fs";
7
8
 
@@ -28,8 +29,8 @@ const notificationsFeature = {
28
29
  description: "Installs @warlock.js/notifications — multi-channel notifications (mail + in-app database). Pulls the mail feature, ejects config/notifications.ts, and scaffolds the Notification model + migration plus the recipient-scoped read/dismiss routes + controllers into src/app/notifications",
29
30
  requires: ["mail"],
30
31
  dependencies: {
31
- "@warlock.js/notifications": "~4.0.0",
32
- "@warlock.js/auth": "~4.0.0"
32
+ "@warlock.js/notifications": INSTALLED_WARLOCK_VERSION,
33
+ "@warlock.js/auth": INSTALLED_WARLOCK_VERSION
33
34
  },
34
35
  ejectConfig: {
35
36
  content: notificationsConfigStub,
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/notifications.feature.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\r\nimport { ensureDirectoryAsync, fileExistsAsync, putFileAsync } from \"@warlock.js/fs\";\r\nimport { CommandActionData } from \"../../commands/types\";\r\nimport { srcPath } from \"../../utils\";\r\nimport {\r\n notificationControllersStub,\r\n notificationMigrationStub,\r\n notificationModelStub,\r\n notificationRoutesStub,\r\n notificationsConfigStub,\r\n} from \"../stubs\";\r\nimport { migrationTimestamp } from \"./shared/migration-timestamp\";\r\nimport { FeatureDefinition } from \"./types\";\r\n\r\nasync function completeNotificationsInstallation(_options: CommandActionData) {\r\n const modelPath = srcPath(\"app/notifications/notification.model.ts\");\r\n\r\n // The model file is the sentinel for \"notifications already scaffolded\" —\r\n // its presence means the migration was created too (timestamped, so we must\r\n // not re-emit a duplicate on a second run).\r\n if (await fileExistsAsync(modelPath)) {\r\n console.log(\r\n `${colors.yellowBright(\"src/app/notifications\")} already scaffolded, skipping model + migration...`,\r\n );\r\n return;\r\n }\r\n\r\n // 1. Notification model — extends the package's DatabaseNotification base.\r\n await ensureDirectoryAsync(srcPath(\"app/notifications\"));\r\n await putFileAsync(modelPath, notificationModelStub);\r\n console.log(`${colors.green(\"✓\")} Created src/app/notifications/notification.model.ts`);\r\n\r\n // 2. Migration — timestamped MM-DD-YYYY_HH-MM-SS prefix so cascade infers its\r\n // createdAt and orders it deterministically (migrate-action discovers\r\n // src/app/*/migrations/*).\r\n await ensureDirectoryAsync(srcPath(\"app/notifications/migrations\"));\r\n\r\n const migrationFile = `${migrationTimestamp()}-notification.migration.ts`;\r\n\r\n await putFileAsync(\r\n srcPath(\"app/notifications/migrations\", migrationFile),\r\n notificationMigrationStub,\r\n );\r\n console.log(\r\n `${colors.green(\"✓\")} Created src/app/notifications/migrations/${migrationFile}`,\r\n );\r\n\r\n // 3. HTTP surface — the in-app read/dismiss endpoints (routes + controllers),\r\n // gated by authMiddleware. Delete if the app exposes notifications another way.\r\n await ensureDirectoryAsync(srcPath(\"app/notifications/controllers\"));\r\n await putFileAsync(\r\n srcPath(\"app/notifications/controllers/notifications.controller.ts\"),\r\n notificationControllersStub,\r\n );\r\n await putFileAsync(srcPath(\"app/notifications/routes.ts\"), notificationRoutesStub);\r\n console.log(`${colors.green(\"✓\")} Created src/app/notifications/routes.ts + controllers`);\r\n}\r\n\r\nexport const notificationsFeature: FeatureDefinition = {\r\n description:\r\n \"Installs @warlock.js/notifications — multi-channel notifications (mail + in-app database). Pulls the mail feature, ejects config/notifications.ts, and scaffolds the Notification model + migration plus the recipient-scoped read/dismiss routes + controllers into src/app/notifications\",\r\n // The ejected config wires a `mail` channel by default (needs nodemailer,\r\n // via the `mail` feature); the scaffolded routes are gated by\r\n // `authMiddleware`, so `@warlock.js/auth` is pulled in too.\r\n requires: [\"mail\"],\r\n dependencies: {\r\n \"@warlock.js/notifications\": \"~4.0.0\",\r\n \"@warlock.js/auth\": \"~4.0.0\",\r\n },\r\n ejectConfig: {\r\n content: notificationsConfigStub,\r\n name: \"notifications\",\r\n },\r\n onExecuting: completeNotificationsInstallation,\r\n};\r\n"],"mappings":";;;;;;;;AAcA,eAAe,kCAAkC,UAA6B;CAC5E,MAAM,YAAY,QAAQ,yCAAyC;CAKnE,IAAI,MAAM,gBAAgB,SAAS,GAAG;EACpC,QAAQ,IACN,GAAG,OAAO,aAAa,uBAAuB,EAAE,mDAClD;EACA;CACF;CAGA,MAAM,qBAAqB,QAAQ,mBAAmB,CAAC;CACvD,MAAM,aAAa,WAAW,qBAAqB;CACnD,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,qDAAqD;CAKtF,MAAM,qBAAqB,QAAQ,8BAA8B,CAAC;CAElE,MAAM,gBAAgB,GAAG,mBAAmB,EAAE;CAE9C,MAAM,aACJ,QAAQ,gCAAgC,aAAa,GACrD,yBACF;CACA,QAAQ,IACN,GAAG,OAAO,MAAM,GAAG,EAAE,4CAA4C,eACnE;CAIA,MAAM,qBAAqB,QAAQ,+BAA+B,CAAC;CACnE,MAAM,aACJ,QAAQ,2DAA2D,GACnE,2BACF;CACA,MAAM,aAAa,QAAQ,6BAA6B,GAAG,sBAAsB;CACjF,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,uDAAuD;AAC1F;AAEA,MAAa,uBAA0C;CACrD,aACE;CAIF,UAAU,CAAC,MAAM;CACjB,cAAc;EACZ,6BAA6B;EAC7B,oBAAoB;CACtB;CACA,aAAa;EACX,SAAS;EACT,MAAM;CACR;CACA,aAAa;AACf"}
1
+ {"version":3,"file":"notifications.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/notifications.feature.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\r\nimport { ensureDirectoryAsync, fileExistsAsync, putFileAsync } from \"@warlock.js/fs\";\r\nimport { CommandActionData } from \"../../commands/types\";\r\nimport { srcPath } from \"../../utils\";\r\nimport {\r\n notificationControllersStub,\r\n notificationMigrationStub,\r\n notificationModelStub,\r\n notificationRoutesStub,\r\n notificationsConfigStub,\r\n} from \"../stubs\";\r\nimport { migrationTimestamp } from \"./shared/migration-timestamp\";\r\nimport { FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\r\nasync function completeNotificationsInstallation(_options: CommandActionData) {\r\n const modelPath = srcPath(\"app/notifications/notification.model.ts\");\r\n\r\n // The model file is the sentinel for \"notifications already scaffolded\" —\r\n // its presence means the migration was created too (timestamped, so we must\r\n // not re-emit a duplicate on a second run).\r\n if (await fileExistsAsync(modelPath)) {\r\n console.log(\r\n `${colors.yellowBright(\"src/app/notifications\")} already scaffolded, skipping model + migration...`,\r\n );\r\n return;\r\n }\r\n\r\n // 1. Notification model — extends the package's DatabaseNotification base.\r\n await ensureDirectoryAsync(srcPath(\"app/notifications\"));\r\n await putFileAsync(modelPath, notificationModelStub);\r\n console.log(`${colors.green(\"✓\")} Created src/app/notifications/notification.model.ts`);\r\n\r\n // 2. Migration — timestamped MM-DD-YYYY_HH-MM-SS prefix so cascade infers its\r\n // createdAt and orders it deterministically (migrate-action discovers\r\n // src/app/*/migrations/*).\r\n await ensureDirectoryAsync(srcPath(\"app/notifications/migrations\"));\r\n\r\n const migrationFile = `${migrationTimestamp()}-notification.migration.ts`;\r\n\r\n await putFileAsync(\r\n srcPath(\"app/notifications/migrations\", migrationFile),\r\n notificationMigrationStub,\r\n );\r\n console.log(\r\n `${colors.green(\"✓\")} Created src/app/notifications/migrations/${migrationFile}`,\r\n );\r\n\r\n // 3. HTTP surface — the in-app read/dismiss endpoints (routes + controllers),\r\n // gated by authMiddleware. Delete if the app exposes notifications another way.\r\n await ensureDirectoryAsync(srcPath(\"app/notifications/controllers\"));\r\n await putFileAsync(\r\n srcPath(\"app/notifications/controllers/notifications.controller.ts\"),\r\n notificationControllersStub,\r\n );\r\n await putFileAsync(srcPath(\"app/notifications/routes.ts\"), notificationRoutesStub);\r\n console.log(`${colors.green(\"✓\")} Created src/app/notifications/routes.ts + controllers`);\r\n}\r\n\r\nexport const notificationsFeature: FeatureDefinition = {\r\n description:\r\n \"Installs @warlock.js/notifications — multi-channel notifications (mail + in-app database). Pulls the mail feature, ejects config/notifications.ts, and scaffolds the Notification model + migration plus the recipient-scoped read/dismiss routes + controllers into src/app/notifications\",\r\n // The ejected config wires a `mail` channel by default (needs nodemailer,\r\n // via the `mail` feature); the scaffolded routes are gated by\r\n // `authMiddleware`, so `@warlock.js/auth` is pulled in too.\r\n requires: [\"mail\"],\r\n dependencies: {\r\n \"@warlock.js/notifications\": INSTALLED_WARLOCK_VERSION,\n \"@warlock.js/auth\": INSTALLED_WARLOCK_VERSION,\n },\r\n ejectConfig: {\r\n content: notificationsConfigStub,\r\n name: \"notifications\",\r\n },\r\n onExecuting: completeNotificationsInstallation,\r\n};\r\n"],"mappings":";;;;;;;;;AAcA,eAAe,kCAAkC,UAA6B;CAC5E,MAAM,YAAY,QAAQ,yCAAyC;CAKnE,IAAI,MAAM,gBAAgB,SAAS,GAAG;EACpC,QAAQ,IACN,GAAG,OAAO,aAAa,uBAAuB,EAAE,mDAClD;EACA;CACF;CAGA,MAAM,qBAAqB,QAAQ,mBAAmB,CAAC;CACvD,MAAM,aAAa,WAAW,qBAAqB;CACnD,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,qDAAqD;CAKtF,MAAM,qBAAqB,QAAQ,8BAA8B,CAAC;CAElE,MAAM,gBAAgB,GAAG,mBAAmB,EAAE;CAE9C,MAAM,aACJ,QAAQ,gCAAgC,aAAa,GACrD,yBACF;CACA,QAAQ,IACN,GAAG,OAAO,MAAM,GAAG,EAAE,4CAA4C,eACnE;CAIA,MAAM,qBAAqB,QAAQ,+BAA+B,CAAC;CACnE,MAAM,aACJ,QAAQ,2DAA2D,GACnE,2BACF;CACA,MAAM,aAAa,QAAQ,6BAA6B,GAAG,sBAAsB;CACjF,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,uDAAuD;AAC1F;AAEA,MAAa,uBAA0C;CACrD,aACE;CAIF,UAAU,CAAC,MAAM;CACjB,cAAc;EACZ,6BAA6B;EAC7B,oBAAoB;CACtB;CACA,aAAa;EACX,SAAS;EACT,MAAM;CACR;CACA,aAAa;AACf"}
@@ -1,7 +1,9 @@
1
+ import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
2
+
1
3
  //#region ../core/src/generations/features/scheduler.feature.ts
2
4
  const schedulerFeature = {
3
5
  description: "Installs warlock scheduler for scheduling tasks",
4
- dependencies: { "@warlock.js/scheduler": "~4.0.0" }
6
+ dependencies: { "@warlock.js/scheduler": INSTALLED_WARLOCK_VERSION }
5
7
  };
6
8
 
7
9
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"scheduler.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/scheduler.feature.ts"],"sourcesContent":["import { FeatureDefinition } from \"./types\";\r\n\r\nexport const schedulerFeature: FeatureDefinition = {\r\n description: \"Installs warlock scheduler for scheduling tasks\",\r\n dependencies: {\r\n \"@warlock.js/scheduler\": \"~4.0.0\",\r\n },\r\n};\r\n"],"mappings":";AAEA,MAAa,mBAAsC;CACjD,aAAa;CACb,cAAc,EACZ,yBAAyB,SAC3B;AACF"}
1
+ {"version":3,"file":"scheduler.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/scheduler.feature.ts"],"sourcesContent":["import { FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\r\nexport const schedulerFeature: FeatureDefinition = {\r\n description: \"Installs warlock scheduler for scheduling tasks\",\r\n dependencies: {\r\n \"@warlock.js/scheduler\": INSTALLED_WARLOCK_VERSION,\n },\r\n};\r\n"],"mappings":";;;AAEA,MAAa,mBAAsC;CACjD,aAAa;CACb,cAAc,EACZ,yBAAyB,0BAC3B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"shadcn.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/shadcn.feature.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { ensureDirectoryAsync, fileExistsAsync, getFileAsync, putFileAsync } from \"@warlock.js/fs\";\nimport { CommandActionData } from \"../../commands/types\";\nimport { rootPath, srcPath } from \"../../utils\";\nimport { FeatureDefinition } from \"./types\";\n\n/**\n * `warlock add shadcn` installs the PREREQUISITES for shadcn/ui. It does not\n * wrap `shadcn add`, and it never will.\n *\n * shadcn/ui is a copy-in generator with its own CLI and its own registry, not a\n * dependency: components are written into your source tree and become yours the\n * moment they land. Wrapping their CLI would make their moving target our bug\n * reports, for a command that adds nothing but a rename.\n *\n * What is worth owning is the part their CLI gets wrong here. Measured against\n * this framework's layout on 2026-08-25, `shadcn add button card` exited 0 and\n * produced components that rendered COMPLETELY UNSTYLED. It writes components\n * that import `cn` and reference `bg-primary` / `ring-ring`, but only\n * `shadcn init` creates `lib/utils` and the theme tokens those names resolve\n * against. The class was in the generated CSS and the element carried it, and\n * the rule still evaluated to an empty `var()` — a silent failure with a zero\n * exit code, which is the worst kind to hand a user.\n *\n * So this feature ships the five things that make `npx shadcn add <component>`\n * work the first time:\n *\n * 1. `components.json` written for OUR layout (their defaults assume `src/app`\n * or a bare `components/`, neither of which is where pages live here).\n * 2. `src/web/lib/utils.ts` exporting `cn`.\n * 3. The design tokens appended to `src/web/app.css`.\n * 4. A `web/*` entry in tsconfig `paths`, so the generated imports typecheck.\n * 5. The packages `init` would have installed — see `printNextStep` below.\n * Skipping `init` is correct; skipping its dependency list was a bug, and\n * it cost a generated button that imports `cva` and cannot compile.\n *\n * After that, the user talks to shadcn directly, and their docs are true.\n */\n\n/**\n * The aliases shadcn's CLI rewrites every generated import against.\n *\n * These are the whole reason this feature exists. shadcn's defaults do not fit\n * `src/web`, and no user would guess this mapping: the alias keys are shadcn's\n * vocabulary, the values are tsconfig `paths` prefixes (hence `web/...`, not\n * `src/web/...`), and `tailwind.css` is a real path from the project root\n * (hence `src/web/app.css`, WITH the `src`). Getting one of them wrong produces\n * components in the wrong folder importing `cn` from somewhere that does not\n * exist.\n *\n * `tailwind.config` is deliberately empty: v4 is CSS-first and there is no\n * config file for it to point at. `rsc: false` because these are SSR React\n * pages rendered by the Warlock HTTP server, not React Server Components.\n */\nconst componentsJsonStub = `{\n \"$schema\": \"https://ui.shadcn.com/schema.json\",\n \"style\": \"new-york\",\n \"rsc\": false,\n \"tsx\": true,\n \"tailwind\": {\n \"config\": \"\",\n \"css\": \"src/web/app.css\",\n \"baseColor\": \"neutral\",\n \"cssVariables\": true,\n \"prefix\": \"\"\n },\n \"aliases\": {\n \"components\": \"web/components\",\n \"utils\": \"web/lib/utils\",\n \"ui\": \"web/components/ui\",\n \"lib\": \"web/lib\",\n \"hooks\": \"web/hooks\"\n },\n \"iconLibrary\": \"lucide\"\n}\n`;\n\n/**\n * `cn` — the one import every single shadcn component makes.\n *\n * `clsx` resolves the conditional/array/object class syntax, and `tailwind-merge`\n * then de-duplicates conflicting Tailwind utilities so a caller's `className`\n * actually beats the component's own default rather than depending on which one\n * happens to come later in the generated stylesheet. Both halves are required:\n * clsx alone leaves `px-2 px-4` in the attribute and the loser wins at random.\n */\nconst cnUtilStub = `import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names, with later Tailwind utilities winning over earlier ones.\n *\n * Every shadcn/ui component imports this. Keep the export name and signature.\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n`;\n\n/**\n * Marker for \"the tokens are already in this stylesheet\".\n *\n * A comment rather than a token name, because a user is free to retune every\n * value below and we must still recognise our own block on a re-run.\n */\nconst SHADCN_TOKENS_MARKER = \"shadcn/ui design tokens\";\n\n/**\n * The shadcn token set, as a plain `@theme` block with LITERAL values.\n *\n * Not `@theme inline` over `:root` custom properties, which is what shadcn's own\n * `init` writes. That form was verified against this stylesheet pipeline on\n * 2026-08-25 and it produces utilities that resolve to nothing: the class is in\n * the generated CSS, the class is on the element, and the rule still evaluates\n * to an empty `var()`. Literal values in `@theme` are what make `bg-primary`\n * emit a colour instead of a dangling reference.\n *\n * Dark mode still works, and works the way shadcn expects: `@theme` emits these\n * as real custom properties, so the `.dark` block re-declares the same\n * `--color-*` names and the cascade does the rest. `@custom-variant dark` is\n * what points Tailwind's `dark:` prefix at that class instead of the OS setting.\n *\n * Values are shadcn's `neutral` base. They are the starting point, not the\n * answer — this is the block to edit when the project gets a real palette.\n */\nconst shadcnTokensStub = `\n/* ${SHADCN_TOKENS_MARKER} — edit freely, this is your palette now.\n\n These are LITERAL values in a plain @theme block, on purpose. shadcn's own\n \\`init\\` writes \\`@theme inline\\` over :root custom properties; that form emits\n utilities which resolve to an empty var() here, so every component renders\n unstyled while the class sits right there on the element. Do not convert it.\n*/\n@custom-variant dark (&:is(.dark *));\n\n@theme {\n --color-background: oklch(1 0 0);\n --color-foreground: oklch(0.145 0 0);\n --color-card: oklch(1 0 0);\n --color-card-foreground: oklch(0.145 0 0);\n --color-popover: oklch(1 0 0);\n --color-popover-foreground: oklch(0.145 0 0);\n --color-primary: oklch(0.205 0 0);\n --color-primary-foreground: oklch(0.985 0 0);\n --color-secondary: oklch(0.97 0 0);\n --color-secondary-foreground: oklch(0.205 0 0);\n --color-muted: oklch(0.97 0 0);\n --color-muted-foreground: oklch(0.556 0 0);\n --color-accent: oklch(0.97 0 0);\n --color-accent-foreground: oklch(0.205 0 0);\n --color-destructive: oklch(0.577 0.245 27.325);\n --color-destructive-foreground: oklch(0.985 0 0);\n --color-border: oklch(0.922 0 0);\n --color-input: oklch(0.922 0 0);\n --color-ring: oklch(0.708 0 0);\n\n --color-chart-1: oklch(0.646 0.222 41.116);\n --color-chart-2: oklch(0.6 0.118 184.704);\n --color-chart-3: oklch(0.398 0.07 227.392);\n --color-chart-4: oklch(0.828 0.189 84.429);\n --color-chart-5: oklch(0.769 0.188 70.08);\n\n --color-sidebar: oklch(0.985 0 0);\n --color-sidebar-foreground: oklch(0.145 0 0);\n --color-sidebar-primary: oklch(0.205 0 0);\n --color-sidebar-primary-foreground: oklch(0.985 0 0);\n --color-sidebar-accent: oklch(0.97 0 0);\n --color-sidebar-accent-foreground: oklch(0.205 0 0);\n --color-sidebar-border: oklch(0.922 0 0);\n --color-sidebar-ring: oklch(0.708 0 0);\n\n /* shadcn components reach for rounded-lg/md/sm and expect them to track one\n radius. Changing --radius-lg here also retunes Tailwind's own rounded-lg,\n which is the intended trade: one radius scale per project, not two. */\n --radius-sm: 0.375rem;\n --radius-md: 0.5rem;\n --radius-lg: 0.625rem;\n --radius-xl: 1rem;\n}\n\n.dark {\n --color-background: oklch(0.145 0 0);\n --color-foreground: oklch(0.985 0 0);\n --color-card: oklch(0.205 0 0);\n --color-card-foreground: oklch(0.985 0 0);\n --color-popover: oklch(0.205 0 0);\n --color-popover-foreground: oklch(0.985 0 0);\n --color-primary: oklch(0.922 0 0);\n --color-primary-foreground: oklch(0.205 0 0);\n --color-secondary: oklch(0.269 0 0);\n --color-secondary-foreground: oklch(0.985 0 0);\n --color-muted: oklch(0.269 0 0);\n --color-muted-foreground: oklch(0.708 0 0);\n --color-accent: oklch(0.269 0 0);\n --color-accent-foreground: oklch(0.985 0 0);\n --color-destructive: oklch(0.704 0.191 22.216);\n --color-destructive-foreground: oklch(0.985 0 0);\n --color-border: oklch(1 0 0 / 10%);\n --color-input: oklch(1 0 0 / 15%);\n --color-ring: oklch(0.556 0 0);\n\n --color-chart-1: oklch(0.488 0.243 264.376);\n --color-chart-2: oklch(0.696 0.17 162.48);\n --color-chart-3: oklch(0.769 0.188 70.08);\n --color-chart-4: oklch(0.627 0.265 303.9);\n --color-chart-5: oklch(0.645 0.246 16.439);\n\n --color-sidebar: oklch(0.205 0 0);\n --color-sidebar-foreground: oklch(0.985 0 0);\n --color-sidebar-primary: oklch(0.488 0.243 264.376);\n --color-sidebar-primary-foreground: oklch(0.985 0 0);\n --color-sidebar-accent: oklch(0.269 0 0);\n --color-sidebar-accent-foreground: oklch(0.985 0 0);\n --color-sidebar-border: oklch(1 0 0 / 10%);\n --color-sidebar-ring: oklch(0.556 0 0);\n}\n`;\n\n/**\n * Write `components.json` — the sentinel for \"this feature already ran\".\n *\n * Nothing in the project template creates this file, so its presence means\n * `add shadcn` has been here and a human may since have retuned the aliases,\n * the style, or the base colour. It is never rewritten: shadcn's CLI reads this\n * file on every `add`, so overwriting it would silently relocate a project's\n * component folder out from under the components already in it.\n */\nasync function writeComponentsJson(): Promise<void> {\n const componentsJsonPath = rootPath(\"components.json\");\n\n if (await fileExistsAsync(componentsJsonPath)) {\n console.log(`${colors.yellowBright(\"components.json\")} already exists, skipping...`);\n\n return;\n }\n\n await putFileAsync(componentsJsonPath, componentsJsonStub);\n console.log(`${colors.green(\"✓\")} Created components.json`);\n}\n\n/**\n * Write `src/web/lib/utils.ts`.\n *\n * Guarded on its own rather than on the sentinel above, because `lib/utils` is\n * a name a project may well already own — and if it does, whatever is in there\n * is user code with other callers. We print instead of merging.\n */\nasync function writeCnUtil(): Promise<void> {\n const utilsFile = srcPath(\"web/lib/utils.ts\");\n\n if (await fileExistsAsync(utilsFile)) {\n const current = await getFileAsync(utilsFile).catch(() => \"\");\n\n if (/export\\s+(function|const)\\s+cn\\b/.test(current)) {\n console.log(`${colors.yellowBright(\"src/web/lib/utils.ts\")} already exports cn, skipping...`);\n } else {\n console.log(\n `${colors.yellowBright(\"!\")} ${colors.yellowBright(\"src/web/lib/utils.ts\")} exists but does not export ` +\n `${colors.yellowBright(\"cn\")} — add it yourself:\\n` +\n \" export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); }\\n\" +\n \" Every shadcn component imports it, and none of them will compile until it is there.\",\n );\n }\n\n return;\n }\n\n await ensureDirectoryAsync(srcPath(\"web/lib\"));\n await putFileAsync(utilsFile, cnUtilStub);\n console.log(`${colors.green(\"✓\")} Created src/web/lib/utils.ts`);\n}\n\n/**\n * Append the token block to `src/web/app.css`.\n *\n * The stylesheet is guaranteed to exist by the time this runs: `requires:\n * [\"tailwind\"]` makes the add command resolve `tailwind` first and run its\n * `onExecuting` ahead of this one, and that is what creates the file. The check\n * below is for a stylesheet a human has since moved or deleted — worth a\n * printed instruction, not a failure.\n *\n * Appended, never rewritten. Everything already in that file is either\n * Tailwind's own `@import` or the project's design system.\n */\nasync function appendThemeTokens(): Promise<void> {\n const cssFile = srcPath(\"web/app.css\");\n\n if (!(await fileExistsAsync(cssFile))) {\n console.log(\n `${colors.yellowBright(\"!\")} ${colors.yellowBright(\"src/web/app.css\")} not found — ` +\n \"append the shadcn token block to your Tailwind stylesheet yourself.\\n\" +\n \" Without the tokens, shadcn components render unstyled: the classes are emitted and applied, \" +\n \"but `bg-primary` and friends resolve to an empty var().\",\n );\n\n return;\n }\n\n const current = await getFileAsync(cssFile);\n\n if (current.includes(SHADCN_TOKENS_MARKER) || current.includes(\"--color-primary-foreground\")) {\n console.log(`${colors.yellowBright(\"src/web/app.css\")} already has the tokens, skipping...`);\n\n return;\n }\n\n await putFileAsync(cssFile, `${current.trimEnd()}\\n${shadcnTokensStub}`);\n console.log(`${colors.green(\"✓\")} Appended the shadcn tokens to src/web/app.css`);\n}\n\n/** The tsconfig `paths` entry the generated imports resolve through. */\nconst WEB_PATH_ALIAS = '\"web/*\": [\"./src/web/*\"]';\n\n/**\n * Add `web/*` to tsconfig `compilerOptions.paths`.\n *\n * The template declares only `app/*`, so every import shadcn generates against\n * the aliases above (`web/lib/utils`, `web/components/ui/button`) would fail to\n * typecheck the moment it lands. This is the first `add` feature to patch\n * `paths` rather than `include`.\n *\n * String surgery, and NOT the parse-and-write that the `include` patches use.\n * The project template's `tsconfig.json` carries `//` comments — it is JSONC,\n * and `JSON.parse` throws on it — so a parse-first patch would fail on exactly\n * the projects this feature is for. Editing the text also preserves those\n * comments, which are load-bearing documentation in that file.\n */\nasync function addWebPathAlias(): Promise<void> {\n const tsconfigPath = rootPath(\"tsconfig.json\");\n\n const printManualInstruction = (reason: string) => {\n console.log(\n `${colors.yellowBright(\"!\")} ${colors.yellowBright(\"tsconfig.json\")} ${reason} — ` +\n \"add this to `compilerOptions.paths` yourself:\\n\" +\n ` ${WEB_PATH_ALIAS}\\n` +\n \" Without it, every import shadcn generates against the `web/*` aliases fails to typecheck.\",\n );\n };\n\n if (!(await fileExistsAsync(tsconfigPath))) {\n printManualInstruction(\"not found\");\n\n return;\n }\n\n const current = await getFileAsync(tsconfigPath);\n\n // Matches the alias whichever quote style and spacing the file uses, so a\n // re-run against a hand-edited tsconfig does not stack a second entry.\n if (/[\"']web\\/\\*[\"']\\s*:/.test(current)) {\n console.log(`${colors.yellowBright(\"tsconfig.json\")} already maps web/*, skipping...`);\n\n return;\n }\n\n let next: string;\n\n if (/\"paths\"\\s*:\\s*\\{/.test(current)) {\n next = current.replace(/\"paths\"\\s*:\\s*\\{/, `$&\\n ${WEB_PATH_ALIAS},`);\n } else if (/\"compilerOptions\"\\s*:\\s*\\{/.test(current)) {\n next = current.replace(\n /\"compilerOptions\"\\s*:\\s*\\{/,\n `$&\\n \"paths\": {\\n ${WEB_PATH_ALIAS}\\n },`,\n );\n } else {\n printManualInstruction(\"has no recognisable compilerOptions block\");\n\n return;\n }\n\n await putFileAsync(tsconfigPath, next);\n console.log(`${colors.green(\"✓\")} Added ${WEB_PATH_ALIAS} to tsconfig.json paths`);\n}\n\n/**\n * Tell the user the next command is theirs to run.\n *\n * This is the seam. Everything above is prerequisite; from here the shadcn docs\n * apply verbatim, which is the entire point of not wrapping their CLI.\n *\n * WHY THIS FEATURE DECLARES cva AND lucide-react, and where the list came from.\n *\n * shadcn's registry splits dependencies across two levels. Each component item\n * (`.../new-york-v4/button.json`) declares only what that file pulls beyond the\n * baseline — for button, `radix-ui` and nothing else. Everything the baseline\n * assumes lives on the STYLE INDEX (`.../new-york-v4/index.json`), which is\n * fetched by `init` and only by `init`:\n *\n * dependencies: class-variance-authority, lucide-react, radix-ui\n * devDependencies: tw-animate-css, shadcn\n *\n * We skip `init` on purpose — it would rewrite components.json and replace the\n * literal tokens with the `@theme inline` block that resolves to nothing here.\n * Skipping it is right; inheriting nothing from it was the bug. `shadcn add\n * button` exits 0 and writes `import { cva } from \"class-variance-authority\"`\n * against a package no one installed. Zero exit code, TS2307, blank page.\n *\n * `radix-ui` stays off our list: it is the one style-index dependency that is\n * ALSO declared per-component, so `add` really does install it on demand, and\n * declaring it here would pull the whole primitive set into projects using two\n * components. `shadcn` itself stays off too — it is the CLI, and the user is\n * invoking it via `npx`.\n *\n * `tw-animate-css` was checked and deliberately EXCLUDED. It is not imported by\n * any component; it is a plain stylesheet whose only entry point is the\n * `@import \"tw-animate-css\"` line that `init` writes into the CSS — and we do\n * not write that line, so the package would install and never load. Nothing\n * fails to compile or render without it. What you lose is the enter/exit\n * animation on overlay components (dialog, dropdown, tooltip, sheet): their\n * `animate-in` / `fade-in-0` classes are simply never generated, so the overlay\n * appears instantly instead of fading. That is opt-in, and the note below is how\n * a user opts in — the `@import` has to go at the TOP of app.css, next to\n * Tailwind's own, which is why this feature cannot append it to the token block.\n */\nfunction printNextStep(): void {\n console.log(\n `\\n${colors.green(\"✓\")} shadcn/ui prerequisites are in place. Add components with shadcn's own CLI:\\n` +\n ` ${colors.yellowBright(\"npx shadcn@latest add button card\")}\\n` +\n \" Skip `shadcn init` — this feature did its job, and running it would rewrite components.json\\n\" +\n \" and replace the theme tokens with an `@theme inline` block that resolves to nothing here.\\n\" +\n ` ${colors.yellowBright(\"class-variance-authority\")} and ${colors.yellowBright(\"lucide-react\")} are already installed: shadcn declares\\n` +\n \" them on the style index that only `init` reads, so `add` would never install them for you.\\n\" +\n ` ${colors.yellowBright(\"radix-ui\")} (the unified package, not @radix-ui/react-*) IS declared per component,\\n` +\n \" so shadcn's CLI installs that one itself as each component needs it.\\n\" +\n ` For overlay animations, add ${colors.yellowBright(\"tw-animate-css\")} and put ${colors.yellowBright('@import \"tw-animate-css\";')}\\n` +\n \" at the TOP of src/web/app.css, under the Tailwind import. Without it dialogs and dropdowns\\n\" +\n \" still work, they just appear instantly instead of animating.\",\n );\n}\n\n/**\n * Lay the ground shadcn's CLI expects to find, and nothing more.\n *\n * Four files, none of which needs `node_modules` to be populated: on the\n * `create-warlock` path this runs under `--no-install`, so the dependencies\n * declared below are only recorded in `package.json` and nothing here may\n * import, resolve, or execute shadcn, clsx, or Tailwind.\n */\nasync function completeShadcnInstallation(_options: CommandActionData) {\n await writeComponentsJson();\n await writeCnUtil();\n await appendThemeTokens();\n await addWebPathAlias();\n printNextStep();\n}\n\nexport const shadcnFeature: FeatureDefinition = {\n description:\n \"Sets up the prerequisites for shadcn/ui so `npx shadcn add <component>` works first time: components.json aliased to src/web, src/web/lib/utils.ts (cn), the design tokens in src/web/app.css, and a web/* tsconfig path. It does NOT wrap shadcn's CLI — components stay theirs to generate and yours to own.\",\n // `tailwind` owns src/web/app.css, which the token block is appended to.\n // Requiring it also fixes the order: the add command resolves requirements\n // depth-first, so the stylesheet exists before this feature writes into it.\n requires: [\"tailwind\"],\n // Everything `shadcn init` would have installed, minus the parts their CLI\n // genuinely does install per-component. See the note above `printNextStep`\n // for how this list was derived and what is deliberately NOT in it.\n dependencies: {\n // Both are runtime dependencies of `cn`, which every generated component\n // calls on every render — not build-time tooling.\n clsx: \"^2.1.1\",\n // v3 is the Tailwind v4 line; tailwind-merge v2 knows the v3 utility set and\n // silently fails to de-duplicate against v4 class names.\n \"tailwind-merge\": \"^3.3.1\",\n // `cva` is imported on line 2 of the generated button — and of every other\n // component with a `variant` prop. The registry declares it ONCE, on the\n // style index that only `init` applies, so `shadcn add button` resolves the\n // component's own deps, exits 0, and leaves TS2307 on a file it just wrote.\n // Still 0.x upstream, so this caret pins to 0.7.x; expect 0.7.1 to land.\n \"class-variance-authority\": \"^0.7.1\",\n // Same trap, one layer further in. `components.json` declares\n // `iconLibrary: \"lucide\"`, and dialog/select/checkbox/dropdown-menu all\n // import `lucide-react` in their source while declaring only `radix-ui` —\n // verified against the new-york-v4 registry items. So the CLI installs it\n // for nobody, and the first icon-bearing component fails to resolve.\n // Peer range covers React 19, which is what `web` brings.\n \"lucide-react\": \"^1.34.0\",\n },\n onExecuting: completeShadcnInstallation,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgC3B,MAAM,aAAa;;;;;;;;;;;;;;;;;;AAmBnB,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;AAoB7B,MAAM,mBAAmB;KACpB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqG1B,eAAe,sBAAqC;CAClD,MAAM,qBAAqB,SAAS,iBAAiB;CAErD,IAAI,MAAM,gBAAgB,kBAAkB,GAAG;EAC7C,QAAQ,IAAI,GAAG,OAAO,aAAa,iBAAiB,EAAE,6BAA6B;EAEnF;CACF;CAEA,MAAM,aAAa,oBAAoB,kBAAkB;CACzD,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,yBAAyB;AAC5D;;;;;;;;AASA,eAAe,cAA6B;CAC1C,MAAM,YAAY,QAAQ,kBAAkB;CAE5C,IAAI,MAAM,gBAAgB,SAAS,GAA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AAuB,WAAW;EAElC;CACF;CAEA,MAAM,UAAU,MAAM,aAAa,YAAY;CAI/C,IAAI,sBAAsB,KAAK,OAAO,GAAG;EACvC,QAAQ,IAAI,GAAG,OAAO,aAAa,eAAe,EAAE,iCAAiC;EAErF;CACF;CAEA,IAAI;CAEJ,IAAI,mBAAmB,KAAK,OAAO,GACjC,OAAO,QAAQ,QAAQ,oBAAoB,aAAa,eAAe,EAAE;MACpE,IAAI,6BAA6B,KAAK,OAAO,GAClD,OAAO,QAAQ,QACb,8BACA,6BAA6B,eAAe,SAC9C;MACK;EACL,uBAAuB,2CAA2C;EAElE;CACF;CAEA,MAAM,aAAa,cAAc,IAAI;CACrC,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,SAAS,eAAe,wBAAwB;AACnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAS,gBAAsB;CAC7B,QAAQ,IACN,KAAK,OAAO,MAAM,GAAG,EAAE,kFAChB,OAAO,aAAa,mCAAmC,EAAE;;IAGzD,OAAO,aAAa,0BAA0B,EAAE,OAAO,OAAO,aAAa,cAAc,EAAE;IAE3F,OAAO,aAAa,UAAU,EAAE;gCAEJ,OAAO,aAAa,gBAAgB,EAAE,WAAW,OAAO,aAAa,6BAA2B,EAAE;+DAGvI;AACF;;;;;;;;;AAUA,eAAe,2BAA2B,UAA6B;CACrE,MAAM,oBAAoB;CAC1B,MAAM,YAAY;CAClB,MAAM,kBAAkB;CACxB,MAAM,gBAAgB;CACtB,cAAc;AAChB;AAEA,MAAa,gBAAmC;CAC9C,aACE;CAIF,UAAU,CAAC,UAAU;CAIrB,cAAc;EAGZ,MAAM;EAGN,kBAAkB;EAMlB,4BAA4B;EAO5B,gBAAgB;CAClB;CACA,aAAa;AACf"}
1
+ {"version":3,"file":"shadcn.feature.mjs","names":[],"sources":["../../../../../../../../core/src/generations/features/shadcn.feature.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { ensureDirectoryAsync, fileExistsAsync, getFileAsync, putFileAsync } from \"@warlock.js/fs\";\nimport { CommandActionData } from \"../../commands/types\";\nimport { rootPath, srcPath } from \"../../utils\";\nimport { FeatureDefinition } from \"./types\";\n\n/**\n * `warlock add shadcn` installs the PREREQUISITES for shadcn/ui. It does not\n * wrap `shadcn add`, and it never will.\n *\n * shadcn/ui is a copy-in generator with its own CLI and its own registry, not a\n * dependency: components are written into your source tree and become yours the\n * moment they land. Wrapping their CLI would make their moving target our bug\n * reports, for a command that adds nothing but a rename.\n *\n * What is worth owning is the part their CLI gets wrong here. Measured against\n * this framework's layout on 2026-08-25, `shadcn add button card` exited 0 and\n * produced components that rendered COMPLETELY UNSTYLED. It writes components\n * that import `cn` and reference `bg-primary` / `ring-ring`, but only\n * `shadcn init` creates `lib/utils` and the theme tokens those names resolve\n * against. The class was in the generated CSS and the element carried it, and\n * the rule still evaluated to an empty `var()` — a silent failure with a zero\n * exit code, which is the worst kind to hand a user.\n *\n * So this feature ships the five things that make `npx shadcn add <component>`\n * work the first time:\n *\n * 1. `components.json` written for OUR layout (their defaults assume `src/app`\n * or a bare `components/`, neither of which is where pages live here).\n * 2. `src/web/lib/utils.ts` exporting `cn`.\n * 3. The design tokens appended to `src/web/app.css`.\n * 4. A `web/*` entry in tsconfig `paths`, so the generated imports typecheck.\n * 5. The packages `init` would have installed — see `printNextStep` below.\n * Skipping `init` is correct; skipping its dependency list was a bug, and\n * it cost a generated button that imports `cva` and cannot compile.\n *\n * After that, the user talks to shadcn directly, and their docs are true.\n */\n\n/**\n * The aliases shadcn's CLI rewrites every generated import against.\n *\n * These are the whole reason this feature exists. shadcn's defaults do not fit\n * `src/web`, and no user would guess this mapping: the alias keys are shadcn's\n * vocabulary, the values are tsconfig `paths` prefixes (hence `web/...`, not\n * `src/web/...`), and `tailwind.css` is a real path from the project root\n * (hence `src/web/app.css`, WITH the `src`). Getting one of them wrong produces\n * components in the wrong folder importing `cn` from somewhere that does not\n * exist.\n *\n * `tailwind.config` is deliberately empty: v4 is CSS-first and there is no\n * config file for it to point at. `rsc: false` because these are SSR React\n * pages rendered by the Warlock HTTP server, not React Server Components.\n */\nconst componentsJsonStub = `{\n \"$schema\": \"https://ui.shadcn.com/schema.json\",\n \"style\": \"new-york\",\n \"rsc\": false,\n \"tsx\": true,\n \"tailwind\": {\n \"config\": \"\",\n \"css\": \"src/web/app.css\",\n \"baseColor\": \"neutral\",\n \"cssVariables\": true,\n \"prefix\": \"\"\n },\n \"aliases\": {\n \"components\": \"web/components\",\n \"utils\": \"web/lib/utils\",\n \"ui\": \"web/components/ui\",\n \"lib\": \"web/lib\",\n \"hooks\": \"web/hooks\"\n },\n \"iconLibrary\": \"lucide\"\n}\n`;\n\n/**\n * `cn` — the one import every single shadcn component makes.\n *\n * `clsx` resolves the conditional/array/object class syntax, and `tailwind-merge`\n * then de-duplicates conflicting Tailwind utilities so a caller's `className`\n * actually beats the component's own default rather than depending on which one\n * happens to come later in the generated stylesheet. Both halves are required:\n * clsx alone leaves `px-2 px-4` in the attribute and the loser wins at random.\n */\nconst cnUtilStub = `import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names, with later Tailwind utilities winning over earlier ones.\n *\n * Every shadcn/ui component imports this. Keep the export name and signature.\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n`;\n\n/**\n * Marker for \"the tokens are already in this stylesheet\".\n *\n * A comment rather than a token name, because a user is free to retune every\n * value below and we must still recognise our own block on a re-run.\n */\nconst SHADCN_TOKENS_MARKER = \"shadcn/ui design tokens\";\n\n/**\n * The shadcn token set, as a plain `@theme` block with LITERAL values.\n *\n * Not `@theme inline` over `:root` custom properties, which is what shadcn's own\n * `init` writes. That form was verified against this stylesheet pipeline on\n * 2026-08-25 and it produces utilities that resolve to nothing: the class is in\n * the generated CSS, the class is on the element, and the rule still evaluates\n * to an empty `var()`. Literal values in `@theme` are what make `bg-primary`\n * emit a colour instead of a dangling reference.\n *\n * Dark mode still works, and works the way shadcn expects: `@theme` emits these\n * as real custom properties, so the `.dark` block re-declares the same\n * `--color-*` names and the cascade does the rest. `@custom-variant dark` is\n * what points Tailwind's `dark:` prefix at that class instead of the OS setting.\n *\n * Values are shadcn's `neutral` base. They are the starting point, not the\n * answer — this is the block to edit when the project gets a real palette.\n */\nconst shadcnTokensStub = `\n/* ${SHADCN_TOKENS_MARKER} — edit freely, this is your palette now.\n\n These are LITERAL values in a plain @theme block, on purpose. shadcn's own\n \\`init\\` writes \\`@theme inline\\` over :root custom properties; that form emits\n utilities which resolve to an empty var() here, so every component renders\n unstyled while the class sits right there on the element. Do not convert it.\n*/\n@custom-variant dark (&:is(.dark *));\n\n@theme {\n --color-background: oklch(1 0 0);\n --color-foreground: oklch(0.145 0 0);\n --color-card: oklch(1 0 0);\n --color-card-foreground: oklch(0.145 0 0);\n --color-popover: oklch(1 0 0);\n --color-popover-foreground: oklch(0.145 0 0);\n --color-primary: oklch(0.205 0 0);\n --color-primary-foreground: oklch(0.985 0 0);\n --color-secondary: oklch(0.97 0 0);\n --color-secondary-foreground: oklch(0.205 0 0);\n --color-muted: oklch(0.97 0 0);\n --color-muted-foreground: oklch(0.556 0 0);\n --color-accent: oklch(0.97 0 0);\n --color-accent-foreground: oklch(0.205 0 0);\n --color-destructive: oklch(0.577 0.245 27.325);\n --color-destructive-foreground: oklch(0.985 0 0);\n --color-border: oklch(0.922 0 0);\n --color-input: oklch(0.922 0 0);\n --color-ring: oklch(0.708 0 0);\n\n --color-chart-1: oklch(0.646 0.222 41.116);\n --color-chart-2: oklch(0.6 0.118 184.704);\n --color-chart-3: oklch(0.398 0.07 227.392);\n --color-chart-4: oklch(0.828 0.189 84.429);\n --color-chart-5: oklch(0.769 0.188 70.08);\n\n --color-sidebar: oklch(0.985 0 0);\n --color-sidebar-foreground: oklch(0.145 0 0);\n --color-sidebar-primary: oklch(0.205 0 0);\n --color-sidebar-primary-foreground: oklch(0.985 0 0);\n --color-sidebar-accent: oklch(0.97 0 0);\n --color-sidebar-accent-foreground: oklch(0.205 0 0);\n --color-sidebar-border: oklch(0.922 0 0);\n --color-sidebar-ring: oklch(0.708 0 0);\n\n /* shadcn components reach for rounded-lg/md/sm and expect them to track one\n radius. Changing --radius-lg here also retunes Tailwind's own rounded-lg,\n which is the intended trade: one radius scale per project, not two. */\n --radius-sm: 0.375rem;\n --radius-md: 0.5rem;\n --radius-lg: 0.625rem;\n --radius-xl: 1rem;\n}\n\n.dark {\n --color-background: oklch(0.145 0 0);\n --color-foreground: oklch(0.985 0 0);\n --color-card: oklch(0.205 0 0);\n --color-card-foreground: oklch(0.985 0 0);\n --color-popover: oklch(0.205 0 0);\n --color-popover-foreground: oklch(0.985 0 0);\n --color-primary: oklch(0.922 0 0);\n --color-primary-foreground: oklch(0.205 0 0);\n --color-secondary: oklch(0.269 0 0);\n --color-secondary-foreground: oklch(0.985 0 0);\n --color-muted: oklch(0.269 0 0);\n --color-muted-foreground: oklch(0.708 0 0);\n --color-accent: oklch(0.269 0 0);\n --color-accent-foreground: oklch(0.985 0 0);\n --color-destructive: oklch(0.704 0.191 22.216);\n --color-destructive-foreground: oklch(0.985 0 0);\n --color-border: oklch(1 0 0 / 10%);\n --color-input: oklch(1 0 0 / 15%);\n --color-ring: oklch(0.556 0 0);\n\n --color-chart-1: oklch(0.488 0.243 264.376);\n --color-chart-2: oklch(0.696 0.17 162.48);\n --color-chart-3: oklch(0.769 0.188 70.08);\n --color-chart-4: oklch(0.627 0.265 303.9);\n --color-chart-5: oklch(0.645 0.246 16.439);\n\n --color-sidebar: oklch(0.205 0 0);\n --color-sidebar-foreground: oklch(0.985 0 0);\n --color-sidebar-primary: oklch(0.488 0.243 264.376);\n --color-sidebar-primary-foreground: oklch(0.985 0 0);\n --color-sidebar-accent: oklch(0.269 0 0);\n --color-sidebar-accent-foreground: oklch(0.985 0 0);\n --color-sidebar-border: oklch(1 0 0 / 10%);\n --color-sidebar-ring: oklch(0.556 0 0);\n}\n`;\n\n/**\n * Write `components.json` — the sentinel for \"this feature already ran\".\n *\n * Nothing in the project template creates this file, so its presence means\n * `add shadcn` has been here and a human may since have retuned the aliases,\n * the style, or the base colour. It is never rewritten: shadcn's CLI reads this\n * file on every `add`, so overwriting it would silently relocate a project's\n * component folder out from under the components already in it.\n */\nasync function writeComponentsJson(): Promise<void> {\n const componentsJsonPath = rootPath(\"components.json\");\n\n if (await fileExistsAsync(componentsJsonPath)) {\n console.log(`${colors.yellowBright(\"components.json\")} already exists, skipping...`);\n\n return;\n }\n\n await putFileAsync(componentsJsonPath, componentsJsonStub);\n console.log(`${colors.green(\"✓\")} Created components.json`);\n}\n\n/**\n * Write `src/web/lib/utils.ts`.\n *\n * Guarded on its own rather than on the sentinel above, because `lib/utils` is\n * a name a project may well already own — and if it does, whatever is in there\n * is user code with other callers. We print instead of merging.\n */\nasync function writeCnUtil(): Promise<void> {\n const utilsFile = srcPath(\"web/lib/utils.ts\");\n\n if (await fileExistsAsync(utilsFile)) {\n const current = await getFileAsync(utilsFile).catch(() => \"\");\n\n if (/export\\s+(function|const)\\s+cn\\b/.test(current)) {\n console.log(`${colors.yellowBright(\"src/web/lib/utils.ts\")} already exports cn, skipping...`);\n } else {\n console.log(\n `${colors.yellowBright(\"!\")} ${colors.yellowBright(\"src/web/lib/utils.ts\")} exists but does not export ` +\n `${colors.yellowBright(\"cn\")} — add it yourself:\\n` +\n \" export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); }\\n\" +\n \" Every shadcn component imports it, and none of them will compile until it is there.\",\n );\n }\n\n return;\n }\n\n await ensureDirectoryAsync(srcPath(\"web/lib\"));\n await putFileAsync(utilsFile, cnUtilStub);\n console.log(`${colors.green(\"✓\")} Created src/web/lib/utils.ts`);\n}\n\n/**\n * Append the token block to `src/web/app.css`.\n *\n * The stylesheet is guaranteed to exist by the time this runs: `requires:\n * [\"tailwind\"]` makes the add command resolve `tailwind` first and run its\n * `onExecuting` ahead of this one, and that is what creates the file. The check\n * below is for a stylesheet a human has since moved or deleted — worth a\n * printed instruction, not a failure.\n *\n * Appended, never rewritten. Everything already in that file is either\n * Tailwind's own `@import` or the project's design system.\n */\nasync function appendThemeTokens(): Promise<void> {\n const cssFile = srcPath(\"web/app.css\");\n\n if (!(await fileExistsAsync(cssFile))) {\n console.log(\n `${colors.yellowBright(\"!\")} ${colors.yellowBright(\"src/web/app.css\")} not found — ` +\n \"append the shadcn token block to your Tailwind stylesheet yourself.\\n\" +\n \" Without the tokens, shadcn components render unstyled: the classes are emitted and applied, \" +\n \"but `bg-primary` and friends resolve to an empty var().\",\n );\n\n return;\n }\n\n const current = await getFileAsync(cssFile);\n\n if (current.includes(SHADCN_TOKENS_MARKER) || current.includes(\"--color-primary-foreground\")) {\n console.log(`${colors.yellowBright(\"src/web/app.css\")} already has the tokens, skipping...`);\n\n return;\n }\n\n await putFileAsync(cssFile, `${current.trimEnd()}\\n${shadcnTokensStub}`);\n console.log(`${colors.green(\"✓\")} Appended the shadcn tokens to src/web/app.css`);\n}\n\n/** The tsconfig `paths` entry the generated imports resolve through. */\nconst WEB_PATH_ALIAS = '\"web/*\": [\"./src/web/*\"]';\n\n/**\n * Add `web/*` to tsconfig `compilerOptions.paths`.\n *\n * The template declares only `app/*`, so every import shadcn generates against\n * the aliases above (`web/lib/utils`, `web/components/ui/button`) would fail to\n * typecheck the moment it lands. This is the first `add` feature to patch\n * `paths` rather than `include`.\n *\n * String surgery, and NOT the parse-and-write that the `include` patches use.\n * The project template's `tsconfig.json` carries `//` comments — it is JSONC,\n * and `JSON.parse` throws on it — so a parse-first patch would fail on exactly\n * the projects this feature is for. Editing the text also preserves those\n * comments, which are load-bearing documentation in that file.\n */\nasync function addWebPathAlias(): Promise<void> {\n const tsconfigPath = rootPath(\"tsconfig.json\");\n\n const printManualInstruction = (reason: string) => {\n console.log(\n `${colors.yellowBright(\"!\")} ${colors.yellowBright(\"tsconfig.json\")} ${reason} — ` +\n \"add this to `compilerOptions.paths` yourself:\\n\" +\n ` ${WEB_PATH_ALIAS}\\n` +\n \" Without it, every import shadcn generates against the `web/*` aliases fails to typecheck.\",\n );\n };\n\n if (!(await fileExistsAsync(tsconfigPath))) {\n printManualInstruction(\"not found\");\n\n return;\n }\n\n const current = await getFileAsync(tsconfigPath);\n\n // Matches the alias whichever quote style and spacing the file uses, so a\n // re-run against a hand-edited tsconfig does not stack a second entry.\n if (/[\"']web\\/\\*[\"']\\s*:/.test(current)) {\n console.log(`${colors.yellowBright(\"tsconfig.json\")} already maps web/*, skipping...`);\n\n return;\n }\n\n let next: string;\n\n if (/\"paths\"\\s*:\\s*\\{/.test(current)) {\n next = current.replace(/\"paths\"\\s*:\\s*\\{/, `$&\\n ${WEB_PATH_ALIAS},`);\n } else if (/\"compilerOptions\"\\s*:\\s*\\{/.test(current)) {\n next = current.replace(\n /\"compilerOptions\"\\s*:\\s*\\{/,\n `$&\\n \"paths\": {\\n ${WEB_PATH_ALIAS}\\n },`,\n );\n } else {\n printManualInstruction(\"has no recognisable compilerOptions block\");\n\n return;\n }\n\n await putFileAsync(tsconfigPath, next);\n console.log(`${colors.green(\"✓\")} Added ${WEB_PATH_ALIAS} to tsconfig.json paths`);\n}\n\n/**\n * Tell the user the next command is theirs to run.\n *\n * This is the seam. Everything above is prerequisite; from here the shadcn docs\n * apply verbatim, which is the entire point of not wrapping their CLI.\n *\n * WHY THIS FEATURE DECLARES cva AND lucide-react, and where the list came from.\n *\n * shadcn's registry splits dependencies across two levels. Each component item\n * (`.../new-york-v4/button.json`) declares only what that file pulls beyond the\n * baseline — for button, `radix-ui` and nothing else. Everything the baseline\n * assumes lives on the STYLE INDEX (`.../new-york-v4/index.json`), which is\n * fetched by `init` and only by `init`:\n *\n * dependencies: class-variance-authority, lucide-react, radix-ui\n * devDependencies: tw-animate-css, shadcn\n *\n * We skip `init` on purpose — it would rewrite components.json and replace the\n * literal tokens with the `@theme inline` block that resolves to nothing here.\n * Skipping it is right; inheriting nothing from it was the bug. `shadcn add\n * button` exits 0 and writes `import { cva } from \"class-variance-authority\"`\n * against a package no one installed. Zero exit code, TS2307, blank page.\n *\n * `radix-ui` stays off our list: it is the one style-index dependency that is\n * ALSO declared per-component, so `add` really does install it on demand, and\n * declaring it here would pull the whole primitive set into projects using two\n * components. `shadcn` itself stays off too — it is the CLI, and the user is\n * invoking it via `npx`.\n *\n * `tw-animate-css` was checked and deliberately EXCLUDED. It is not imported by\n * any component; it is a plain stylesheet whose only entry point is the\n * `@import \"tw-animate-css\"` line that `init` writes into the CSS — and we do\n * not write that line, so the package would install and never load. Nothing\n * fails to compile or render without it. What you lose is the enter/exit\n * animation on overlay components (dialog, dropdown, tooltip, sheet): their\n * `animate-in` / `fade-in-0` classes are simply never generated, so the overlay\n * appears instantly instead of fading. That is opt-in, and the note below is how\n * a user opts in — the `@import` has to go at the TOP of app.css, next to\n * Tailwind's own, which is why this feature cannot append it to the token block.\n */\nfunction printNextStep(): void {\n console.log(\n `\\n${colors.green(\"✓\")} shadcn/ui prerequisites are in place. Add components with shadcn's own CLI:\\n` +\n ` ${colors.yellowBright(\"npx shadcn@latest add button card\")}\\n` +\n \" Skip `shadcn init` — this feature did its job, and running it would rewrite components.json\\n\" +\n \" and replace the theme tokens with an `@theme inline` block that resolves to nothing here.\\n\" +\n ` ${colors.yellowBright(\"class-variance-authority\")} and ${colors.yellowBright(\"lucide-react\")} are already installed: shadcn declares\\n` +\n \" them on the style index that only `init` reads, so `add` would never install them for you.\\n\" +\n ` ${colors.yellowBright(\"radix-ui\")} (the unified package, not @radix-ui/react-*) IS declared per component,\\n` +\n \" so shadcn's CLI installs that one itself as each component needs it.\\n\" +\n ` For overlay animations, add ${colors.yellowBright(\"tw-animate-css\")} and put ${colors.yellowBright('@import \"tw-animate-css\";')}\\n` +\n \" at the TOP of src/web/app.css, under the Tailwind import. Without it dialogs and dropdowns\\n\" +\n \" still work, they just appear instantly instead of animating.\",\n );\n}\n\n/**\n * Lay the ground shadcn's CLI expects to find, and nothing more.\n *\n * Four files, none of which needs `node_modules` to be populated: on the\n * `create-warlock` path this runs under `--no-install`, so the dependencies\n * declared below are only recorded in `package.json` and nothing here may\n * import, resolve, or execute shadcn, clsx, or Tailwind.\n */\nasync function completeShadcnInstallation(_options: CommandActionData) {\n await writeComponentsJson();\n await writeCnUtil();\n await appendThemeTokens();\n await addWebPathAlias();\n printNextStep();\n}\n\nexport const shadcnFeature: FeatureDefinition = {\n description:\n \"Sets up the prerequisites for shadcn/ui so `npx shadcn add <component>` works first time: components.json aliased to src/web, src/web/lib/utils.ts (cn), the design tokens in src/web/app.css, and a web/* tsconfig path. It does NOT wrap shadcn's CLI — components stay theirs to generate and yours to own.\",\n // `tailwind` owns src/web/app.css, which the token block is appended to.\n // Requiring it also fixes the order: the add command resolves requirements\n // depth-first, so the stylesheet exists before this feature writes into it.\n requires: [\"tailwind\"],\n // Everything `shadcn init` would have installed, minus the parts their CLI\n // genuinely does install per-component. See the note above `printNextStep`\n // for how this list was derived and what is deliberately NOT in it.\n dependencies: {\n // Both are runtime dependencies of `cn`, which every generated component\n // calls on every render — not build-time tooling.\n clsx: \"^2.1.1\",\n // v3 is the Tailwind v4 line; tailwind-merge v2 knows the v3 utility set and\n // silently fails to de-duplicate against v4 class names.\n \"tailwind-merge\": \"^3.3.1\",\n // `cva` is imported on line 2 of the generated button — and of every other\n // component with a `variant` prop. The registry declares it ONCE, on the\n // style index that only `init` applies, so `shadcn add button` resolves the\n // component's own deps, exits 0, and leaves TS2307 on a file it just wrote.\n // Still 0.x upstream, so this caret pins to 0.7.x; expect 0.7.1 to land.\n \"class-variance-authority\": \"^0.7.1\",\n // Same trap, one layer further in. `components.json` declares\n // `iconLibrary: \"lucide\"`, and dialog/select/checkbox/dropdown-menu all\n // import `lucide-react` in their source while declaring only `radix-ui` —\n // verified against the new-york-v4 registry items. So the CLI installs it\n // for nobody, and the first icon-bearing component fails to resolve.\n // Peer range covers React 19, which is what `web` brings.\n \"lucide-react\": \"^1.34.0\",\n },\n onExecuting: completeShadcnInstallation,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