@shepai/cli 1.154.0 → 1.155.0-pr482.ac79b36

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 (216) hide show
  1. package/apis/json-schema/Settings.yaml +3 -0
  2. package/apis/json-schema/TelegramCommandType.yaml +11 -0
  3. package/apis/json-schema/TelegramConfig.yaml +21 -0
  4. package/apis/json-schema/TelegramNotifyEvents.yaml +61 -0
  5. package/dist/packages/core/src/application/ports/output/services/telegram-service.interface.d.ts +92 -0
  6. package/dist/packages/core/src/application/ports/output/services/telegram-service.interface.d.ts.map +1 -0
  7. package/dist/packages/core/src/application/ports/output/services/telegram-service.interface.js +37 -0
  8. package/dist/packages/core/src/application/use-cases/telegram/configure-telegram.use-case.d.ts +42 -0
  9. package/dist/packages/core/src/application/use-cases/telegram/configure-telegram.use-case.d.ts.map +1 -0
  10. package/dist/packages/core/src/application/use-cases/telegram/configure-telegram.use-case.js +108 -0
  11. package/dist/packages/core/src/domain/generated/output.d.ts +82 -0
  12. package/dist/packages/core/src/domain/generated/output.d.ts.map +1 -1
  13. package/dist/packages/core/src/domain/generated/output.js +9 -0
  14. package/dist/packages/core/src/infrastructure/di/container.d.ts.map +1 -1
  15. package/dist/packages/core/src/infrastructure/di/container.js +12 -1
  16. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts +14 -0
  17. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts.map +1 -1
  18. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.js +34 -0
  19. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/049-add-telegram-settings.d.ts +17 -0
  20. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/049-add-telegram-settings.d.ts.map +1 -0
  21. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/049-add-telegram-settings.js +40 -0
  22. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/merge-prompts.d.ts.map +1 -1
  23. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/merge-prompts.js +4 -1
  24. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/pr-branding.d.ts +5 -0
  25. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/pr-branding.d.ts.map +1 -0
  26. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/pr-branding.js +4 -0
  27. package/dist/packages/core/src/infrastructure/services/deployment/deployment.service.d.ts.map +1 -1
  28. package/dist/packages/core/src/infrastructure/services/deployment/deployment.service.js +6 -5
  29. package/dist/packages/core/src/infrastructure/services/deployment/detect-dev-script.d.ts +2 -0
  30. package/dist/packages/core/src/infrastructure/services/deployment/detect-dev-script.d.ts.map +1 -1
  31. package/dist/packages/core/src/infrastructure/services/deployment/detect-dev-script.js +52 -3
  32. package/dist/packages/core/src/infrastructure/services/git/git-fork.service.d.ts.map +1 -1
  33. package/dist/packages/core/src/infrastructure/services/git/git-fork.service.js +3 -1
  34. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts.map +1 -1
  35. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.js +2 -1
  36. package/dist/packages/core/src/infrastructure/services/git/pr-branding.d.ts +17 -0
  37. package/dist/packages/core/src/infrastructure/services/git/pr-branding.d.ts.map +1 -0
  38. package/dist/packages/core/src/infrastructure/services/git/pr-branding.js +31 -0
  39. package/dist/packages/core/src/infrastructure/services/notifications/notification.service.d.ts +9 -1
  40. package/dist/packages/core/src/infrastructure/services/notifications/notification.service.d.ts.map +1 -1
  41. package/dist/packages/core/src/infrastructure/services/notifications/notification.service.js +40 -1
  42. package/dist/packages/core/src/infrastructure/services/telegram/telegram.service.d.ts +22 -0
  43. package/dist/packages/core/src/infrastructure/services/telegram/telegram.service.d.ts.map +1 -0
  44. package/dist/packages/core/src/infrastructure/services/telegram/telegram.service.js +128 -0
  45. package/dist/src/presentation/cli/commands/settings/index.d.ts +1 -0
  46. package/dist/src/presentation/cli/commands/settings/index.d.ts.map +1 -1
  47. package/dist/src/presentation/cli/commands/settings/index.js +4 -1
  48. package/dist/src/presentation/cli/commands/settings/telegram.command.d.ts +18 -0
  49. package/dist/src/presentation/cli/commands/settings/telegram.command.d.ts.map +1 -0
  50. package/dist/src/presentation/cli/commands/settings/telegram.command.js +158 -0
  51. package/dist/tsconfig.build.tsbuildinfo +1 -1
  52. package/package.json +1 -1
  53. package/web/.next/BUILD_ID +1 -1
  54. package/web/.next/build-manifest.json +2 -2
  55. package/web/.next/fallback-build-manifest.json +2 -2
  56. package/web/.next/prerender-manifest.json +3 -3
  57. package/web/.next/required-server-files.js +3 -3
  58. package/web/.next/required-server-files.json +3 -3
  59. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +28 -28
  60. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
  61. package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
  62. package/web/.next/server/app/(dashboard)/@drawer/chat/page/server-reference-manifest.json +26 -26
  63. package/web/.next/server/app/(dashboard)/@drawer/chat/page.js.nft.json +1 -1
  64. package/web/.next/server/app/(dashboard)/@drawer/chat/page_client-reference-manifest.js +1 -1
  65. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +29 -29
  66. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  67. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  68. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
  69. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  70. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  71. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +36 -36
  72. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  73. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  74. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +26 -26
  75. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  76. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  77. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
  78. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  79. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  80. package/web/.next/server/app/(dashboard)/chat/page/server-reference-manifest.json +26 -26
  81. package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
  82. package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  83. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +29 -29
  84. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  85. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  86. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
  87. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  88. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  89. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +36 -36
  90. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  91. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  92. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +26 -26
  93. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  94. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  95. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +26 -26
  96. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  97. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  98. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
  99. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  100. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  101. package/web/.next/server/app/_global-error.html +2 -2
  102. package/web/.next/server/app/_global-error.rsc +1 -1
  103. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  104. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  105. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  106. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  107. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  108. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +5 -5
  109. package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  110. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  111. package/web/.next/server/app/settings/page/server-reference-manifest.json +8 -8
  112. package/web/.next/server/app/settings/page.js.nft.json +1 -1
  113. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  114. package/web/.next/server/app/skills/page/server-reference-manifest.json +10 -10
  115. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  116. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  117. package/web/.next/server/app/tools/page/server-reference-manifest.json +10 -10
  118. package/web/.next/server/app/tools/page.js.nft.json +1 -1
  119. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  120. package/web/.next/server/app/version/page/server-reference-manifest.json +5 -5
  121. package/web/.next/server/app/version/page.js.nft.json +1 -1
  122. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  123. package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
  124. package/web/.next/server/chunks/[root-of-the-server]__beda892a._.js +1 -1
  125. package/web/.next/server/chunks/[root-of-the-server]__beda892a._.js.map +1 -1
  126. package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js +1 -1
  127. package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js.map +1 -1
  128. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
  129. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
  130. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js +2 -2
  131. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js.map +1 -1
  132. package/web/.next/server/chunks/ssr/[root-of-the-server]__0b150ddf._.js.map +1 -1
  133. package/web/.next/server/chunks/ssr/[root-of-the-server]__17ed7ed1._.js +1 -1
  134. package/web/.next/server/chunks/ssr/[root-of-the-server]__17ed7ed1._.js.map +1 -1
  135. package/web/.next/server/chunks/ssr/[root-of-the-server]__28d0d265._.js +2 -2
  136. package/web/.next/server/chunks/ssr/[root-of-the-server]__28d0d265._.js.map +1 -1
  137. package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
  138. package/web/.next/server/chunks/ssr/[root-of-the-server]__42bf1807._.js +1 -1
  139. package/web/.next/server/chunks/ssr/[root-of-the-server]__42bf1807._.js.map +1 -1
  140. package/web/.next/server/chunks/ssr/[root-of-the-server]__56b70465._.js +1 -1
  141. package/web/.next/server/chunks/ssr/[root-of-the-server]__56b70465._.js.map +1 -1
  142. package/web/.next/server/chunks/ssr/[root-of-the-server]__88f7e8e6._.js +1 -1
  143. package/web/.next/server/chunks/ssr/[root-of-the-server]__88f7e8e6._.js.map +1 -1
  144. package/web/.next/server/chunks/ssr/[root-of-the-server]__8b0aac03._.js +1 -1
  145. package/web/.next/server/chunks/ssr/[root-of-the-server]__c30f1f82._.js +1 -1
  146. package/web/.next/server/chunks/ssr/[root-of-the-server]__c30f1f82._.js.map +1 -1
  147. package/web/.next/server/chunks/ssr/[root-of-the-server]__f80bfc75._.js +1 -1
  148. package/web/.next/server/chunks/ssr/[root-of-the-server]__f80bfc75._.js.map +1 -1
  149. package/web/.next/server/chunks/ssr/[root-of-the-server]__f8dd4422._.js +1 -1
  150. package/web/.next/server/chunks/ssr/[root-of-the-server]__f8dd4422._.js.map +1 -1
  151. package/web/.next/server/chunks/ssr/{_4af8a3cb._.js → _002d7e8d._.js} +2 -2
  152. package/web/.next/server/chunks/ssr/{_4af8a3cb._.js.map → _002d7e8d._.js.map} +1 -1
  153. package/web/.next/server/chunks/ssr/_05c23ad9._.js +1 -1
  154. package/web/.next/server/chunks/ssr/_05c23ad9._.js.map +1 -1
  155. package/web/.next/server/chunks/ssr/_16eb4fec._.js +1 -1
  156. package/web/.next/server/chunks/ssr/_16eb4fec._.js.map +1 -1
  157. package/web/.next/server/chunks/ssr/_3a0b989f._.js +2 -2
  158. package/web/.next/server/chunks/ssr/_3a0b989f._.js.map +1 -1
  159. package/web/.next/server/chunks/ssr/_56b9d60f._.js +1 -1
  160. package/web/.next/server/chunks/ssr/_56b9d60f._.js.map +1 -1
  161. package/web/.next/server/chunks/ssr/_5f69c13f._.js +1 -1
  162. package/web/.next/server/chunks/ssr/_5f69c13f._.js.map +1 -1
  163. package/web/.next/server/chunks/ssr/_7c5b97c6._.js +1 -1
  164. package/web/.next/server/chunks/ssr/_7c5b97c6._.js.map +1 -1
  165. package/web/.next/server/chunks/ssr/_82c57f10._.js +1 -1
  166. package/web/.next/server/chunks/ssr/_82c57f10._.js.map +1 -1
  167. package/web/.next/server/chunks/ssr/{_a0e4c32f._.js → _912552dd._.js} +2 -2
  168. package/web/.next/server/chunks/ssr/{_a0e4c32f._.js.map → _912552dd._.js.map} +1 -1
  169. package/web/.next/server/chunks/ssr/_9495d50b._.js +1 -1
  170. package/web/.next/server/chunks/ssr/_9495d50b._.js.map +1 -1
  171. package/web/.next/server/chunks/ssr/{_27154347._.js → _97486b47._.js} +2 -2
  172. package/web/.next/server/chunks/ssr/{_27154347._.js.map → _97486b47._.js.map} +1 -1
  173. package/web/.next/server/chunks/ssr/_a0e3f7e4._.js +1 -1
  174. package/web/.next/server/chunks/ssr/_a0e3f7e4._.js.map +1 -1
  175. package/web/.next/server/chunks/ssr/_ac4a3873._.js +1 -1
  176. package/web/.next/server/chunks/ssr/_ca0aa7f0._.js +1 -1
  177. package/web/.next/server/chunks/ssr/_ca0aa7f0._.js.map +1 -1
  178. package/web/.next/server/chunks/ssr/_cb5a021e._.js +1 -1
  179. package/web/.next/server/chunks/ssr/_cb5a021e._.js.map +1 -1
  180. package/web/.next/server/chunks/ssr/_d4b20e29._.js.map +1 -1
  181. package/web/.next/server/chunks/ssr/_d86175ae._.js +1 -1
  182. package/web/.next/server/chunks/ssr/_d86175ae._.js.map +1 -1
  183. package/web/.next/server/chunks/ssr/_d8bedf13._.js +1 -1
  184. package/web/.next/server/chunks/ssr/_d8bedf13._.js.map +1 -1
  185. package/web/.next/server/chunks/ssr/_fa7efce3._.js +2 -2
  186. package/web/.next/server/chunks/ssr/_fa7efce3._.js.map +1 -1
  187. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
  188. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
  189. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_cdc632e3.js +1 -1
  190. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_cdc632e3.js.map +1 -1
  191. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_39ca0924.js +1 -1
  192. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_39ca0924.js.map +1 -1
  193. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +1 -1
  194. package/web/.next/server/chunks/ssr/src_presentation_web_components_357e3eb0._.js +1 -1
  195. package/web/.next/server/chunks/ssr/src_presentation_web_components_357e3eb0._.js.map +1 -1
  196. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
  197. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
  198. package/web/.next/server/pages/500.html +2 -2
  199. package/web/.next/server/server-reference-manifest.js +1 -1
  200. package/web/.next/server/server-reference-manifest.json +45 -45
  201. package/web/.next/static/chunks/13d4e516b0ecf5f0.js +1 -0
  202. package/web/.next/static/chunks/{f10c138c3fae4680.js → 6c5e7b36525b3532.js} +1 -1
  203. package/web/.next/static/chunks/{e0104cdb4b857e49.js → 818689ed2c41772b.js} +1 -1
  204. package/web/.next/static/chunks/{be495f0642b9f423.js → 8208e717057eedd0.js} +1 -1
  205. package/web/.next/static/chunks/{2eb2e32a6181e9ed.js → a07d5cbafca0277c.js} +1 -1
  206. package/web/.next/static/chunks/{9545412c334d71c5.js → ad67307f6b0c1490.js} +1 -1
  207. package/web/.next/static/chunks/{a18fcdf7dd4055a5.js → b4e5c56e14e63cb0.js} +2 -2
  208. package/web/.next/static/chunks/{ae61d24b1bcc8cf7.js → b6fc216cfa8fa52a.js} +2 -2
  209. package/web/.next/static/chunks/{0e258f8cce588570.js → d1c58b0747b10ae5.js} +1 -1
  210. package/web/.next/static/chunks/{e9cce6c925c64f10.js → d5cbc603b8bb904d.js} +1 -1
  211. package/web/.next/static/chunks/{e333a91862ff2423.js → deef7f0b5f7981e8.js} +1 -1
  212. package/web/.next/static/chunks/{b5bf0ff0a2bc910a.js → e664cd5c9c0f4fd4.js} +1 -1
  213. package/web/.next/static/chunks/502fd2cb6c8beb89.js +0 -1
  214. /package/web/.next/static/{9ZnNgGSTMM2ACNp4ImvQo → fX8_4OoVzGj6K0VH9X7nb}/_buildManifest.js +0 -0
  215. /package/web/.next/static/{9ZnNgGSTMM2ACNp4ImvQo → fX8_4OoVzGj6K0VH9X7nb}/_clientMiddlewareManifest.json +0 -0
  216. /package/web/.next/static/{9ZnNgGSTMM2ACNp4ImvQo → fX8_4OoVzGj6K0VH9X7nb}/_ssgManifest.js +0 -0
@@ -29,6 +29,7 @@ import { DaemonPidService } from '../services/daemon/daemon-pid.service.js';
29
29
  import { DeploymentService } from '../services/deployment/deployment.service.js';
30
30
  import { AttachmentStorageService } from '../services/attachment-storage.service.js';
31
31
  import { GitHubRepositoryService } from '../services/external/github-repository.service.js';
32
+ import { TelegramService } from '../services/telegram/telegram.service.js';
32
33
  import { AgentExecutorFactory } from '../services/agents/common/agent-executor-factory.service.js';
33
34
  import { AgentExecutorProvider } from '../services/agents/common/agent-executor-provider.service.js';
34
35
  import { StructuredAgentCallerService } from '../services/agents/common/structured-agent-caller.service.js';
@@ -43,6 +44,8 @@ import { DesktopNotifier } from '../services/notifications/desktop-notifier.js';
43
44
  import { NotificationService } from '../services/notifications/notification.service.js';
44
45
  import { getNotificationBus } from '../services/notifications/notification-bus.js';
45
46
  import { spawn } from 'node:child_process';
47
+ // Telegram use cases
48
+ import { ConfigureTelegramUseCase } from '../../application/use-cases/telegram/configure-telegram.use-case.js';
46
49
  // Use cases
47
50
  import { InitializeSettingsUseCase } from '../../application/use-cases/settings/initialize-settings.use-case.js';
48
51
  import { LoadSettingsUseCase } from '../../application/use-cases/settings/load-settings.use-case.js';
@@ -272,11 +275,15 @@ export async function initializeContainer() {
272
275
  container.register('DesktopNotifier', {
273
276
  useFactory: () => new DesktopNotifier(),
274
277
  });
278
+ container.register('ITelegramService', {
279
+ useFactory: () => new TelegramService(),
280
+ });
275
281
  container.register('INotificationService', {
276
282
  useFactory: (c) => {
277
283
  const bus = c.resolve('NotificationEventBus');
278
284
  const desktopNotif = c.resolve('DesktopNotifier');
279
- return new NotificationService(bus, desktopNotif);
285
+ const telegramSvc = c.resolve('ITelegramService');
286
+ return new NotificationService(bus, desktopNotif, telegramSvc);
280
287
  },
281
288
  });
282
289
  // Register use cases (singletons for performance)
@@ -325,6 +332,7 @@ export async function initializeContainer() {
325
332
  container.registerSingleton(ArchiveFeatureUseCase);
326
333
  container.registerSingleton(UnarchiveFeatureUseCase);
327
334
  container.registerSingleton(UpgradeCliUseCase);
335
+ container.registerSingleton(ConfigureTelegramUseCase);
328
336
  container.registerSingleton(ConflictResolutionService);
329
337
  container.register('ConflictResolutionService', {
330
338
  useFactory: (c) => c.resolve(ConflictResolutionService),
@@ -449,6 +457,9 @@ export async function initializeContainer() {
449
457
  container.register('GetBranchSyncStatusUseCase', {
450
458
  useFactory: (c) => c.resolve(GetBranchSyncStatusUseCase),
451
459
  });
460
+ container.register('ConfigureTelegramUseCase', {
461
+ useFactory: (c) => c.resolve(ConfigureTelegramUseCase),
462
+ });
452
463
  // Register interactive session infrastructure
453
464
  container.register('IInteractiveSessionRepository', {
454
465
  useFactory: (c) => {
@@ -79,6 +79,20 @@ export interface SettingsRow {
79
79
  interactive_agent_enabled: number;
80
80
  interactive_agent_auto_timeout_minutes: number;
81
81
  interactive_agent_max_concurrent_sessions: number;
82
+ telegram_enabled: number;
83
+ telegram_bot_token: string | null;
84
+ telegram_chat_id: string | null;
85
+ telegram_notify_agent_started: number;
86
+ telegram_notify_phase_completed: number;
87
+ telegram_notify_waiting_approval: number;
88
+ telegram_notify_agent_completed: number;
89
+ telegram_notify_agent_failed: number;
90
+ telegram_notify_pr_merged: number;
91
+ telegram_notify_pr_closed: number;
92
+ telegram_notify_pr_checks_passed: number;
93
+ telegram_notify_pr_checks_failed: number;
94
+ telegram_notify_pr_blocked: number;
95
+ telegram_notify_merge_review_ready: number;
82
96
  }
83
97
  /**
84
98
  * Maps Settings domain object to database row.
@@ -1 +1 @@
1
- {"version":3,"file":"settings.mapper.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAQvE;;;GAGG;AACH,MAAM,WAAW,WAAW;IAE1B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IAInB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IAGtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGpC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uBAAuB,EAAE,MAAM,CAAC;IAGhC,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IAGtB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,uBAAuB,EAAE,MAAM,CAAC;IAChC,yBAAyB,EAAE,MAAM,CAAC;IAClC,0BAA0B,EAAE,MAAM,CAAC;IACnC,yBAAyB,EAAE,MAAM,CAAC;IAClC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,mBAAm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C,sCAAsC,EAAE,MAAM,CAAC;IAC/C,yCAAyC,EAAE,MAAM,CAAC;CACnD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAuG1D;AAsCD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,QAAQ,CAoGvD"}
1
+ {"version":3,"file":"settings.mapper.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAQvE;;;GAGG;AACH,MAAM,WAAW,WAAW;IAE1B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IAInB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IAGtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGpC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uBAAuB,EAAE,MAAM,CAAC;IAGhC,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IAGtB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,uBAAu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3B,0BAA0B,EAAE,MAAM,CAAC;IACnC,yBAAyB,EAAE,MAAM,CAAC;IAClC,4BAA4B,EAAE,MAAM,CAAC;IACrC,+BAA+B,EAAE,MAAM,CAAC;IAExC,yBAAyB,EAAE,MAAM,CAAC;IAClC,sCAAsC,EAAE,MAAM,CAAC;IAC/C,yCAAyC,EAAE,MAAM,CAAC;IAGlD,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,6BAA6B,EAAE,MAAM,CAAC;IACtC,+BAA+B,EAAE,MAAM,CAAC;IACxC,gCAAgC,EAAE,MAAM,CAAC;IACzC,+BAA+B,EAAE,MAAM,CAAC;IACxC,4BAA4B,EAAE,MAAM,CAAC;IACrC,yBAAyB,EAAE,MAAM,CAAC;IAClC,yBAAyB,EAAE,MAAM,CAAC;IAClC,gCAAgC,EAAE,MAAM,CAAC;IACzC,gCAAgC,EAAE,MAAM,CAAC;IACzC,0BAA0B,EAAE,MAAM,CAAC;IACnC,kCAAkC,EAAE,MAAM,CAAC;CAC5C;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CA6H1D;AAsCD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,QAAQ,CAwHvD"}
@@ -101,6 +101,21 @@ export function toDatabase(settings) {
101
101
  interactive_agent_enabled: (settings.interactiveAgent?.enabled ?? true) ? 1 : 0,
102
102
  interactive_agent_auto_timeout_minutes: settings.interactiveAgent?.autoTimeoutMinutes ?? 15,
103
103
  interactive_agent_max_concurrent_sessions: settings.interactiveAgent?.maxConcurrentSessions ?? 3,
104
+ // TelegramConfig (boolean → 0/1, optional strings → null; defaults applied here)
105
+ telegram_enabled: (settings.telegram?.enabled ?? false) ? 1 : 0,
106
+ telegram_bot_token: settings.telegram?.botToken ?? null,
107
+ telegram_chat_id: settings.telegram?.chatId ?? null,
108
+ telegram_notify_agent_started: (settings.telegram?.notifyEvents?.agentStarted ?? false) ? 1 : 0,
109
+ telegram_notify_phase_completed: (settings.telegram?.notifyEvents?.phaseCompleted ?? false) ? 1 : 0,
110
+ telegram_notify_waiting_approval: (settings.telegram?.notifyEvents?.waitingApproval ?? true) ? 1 : 0,
111
+ telegram_notify_agent_completed: (settings.telegram?.notifyEvents?.agentCompleted ?? true) ? 1 : 0,
112
+ telegram_notify_agent_failed: (settings.telegram?.notifyEvents?.agentFailed ?? true) ? 1 : 0,
113
+ telegram_notify_pr_merged: (settings.telegram?.notifyEvents?.prMerged ?? true) ? 1 : 0,
114
+ telegram_notify_pr_closed: (settings.telegram?.notifyEvents?.prClosed ?? false) ? 1 : 0,
115
+ telegram_notify_pr_checks_passed: (settings.telegram?.notifyEvents?.prChecksPassed ?? false) ? 1 : 0,
116
+ telegram_notify_pr_checks_failed: (settings.telegram?.notifyEvents?.prChecksFailed ?? true) ? 1 : 0,
117
+ telegram_notify_pr_blocked: (settings.telegram?.notifyEvents?.prBlocked ?? true) ? 1 : 0,
118
+ telegram_notify_merge_review_ready: (settings.telegram?.notifyEvents?.mergeReviewReady ?? true) ? 1 : 0,
104
119
  };
105
120
  }
106
121
  /**
@@ -230,6 +245,25 @@ export function fromDatabase(row) {
230
245
  autoTimeoutMinutes: row.interactive_agent_auto_timeout_minutes ?? 15,
231
246
  maxConcurrentSessions: row.interactive_agent_max_concurrent_sessions ?? 3,
232
247
  },
248
+ // TelegramConfig (INTEGER 0/1 → boolean, TEXT → string | undefined)
249
+ telegram: {
250
+ enabled: (row.telegram_enabled ?? 0) !== 0,
251
+ ...(row.telegram_bot_token !== null && { botToken: row.telegram_bot_token }),
252
+ ...(row.telegram_chat_id !== null && { chatId: row.telegram_chat_id }),
253
+ notifyEvents: {
254
+ agentStarted: (row.telegram_notify_agent_started ?? 0) === 1,
255
+ phaseCompleted: (row.telegram_notify_phase_completed ?? 0) === 1,
256
+ waitingApproval: (row.telegram_notify_waiting_approval ?? 1) === 1,
257
+ agentCompleted: (row.telegram_notify_agent_completed ?? 1) === 1,
258
+ agentFailed: (row.telegram_notify_agent_failed ?? 1) === 1,
259
+ prMerged: (row.telegram_notify_pr_merged ?? 1) === 1,
260
+ prClosed: (row.telegram_notify_pr_closed ?? 0) === 1,
261
+ prChecksPassed: (row.telegram_notify_pr_checks_passed ?? 0) === 1,
262
+ prChecksFailed: (row.telegram_notify_pr_checks_failed ?? 1) === 1,
263
+ prBlocked: (row.telegram_notify_pr_blocked ?? 1) === 1,
264
+ mergeReviewReady: (row.telegram_notify_merge_review_ready ?? 1) === 1,
265
+ },
266
+ },
233
267
  // Onboarding (INTEGER → boolean)
234
268
  onboardingComplete: row.onboarding_complete === 1,
235
269
  };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Migration 049: Add Telegram remote control settings columns to the settings table.
3
+ *
4
+ * Adds columns for the Telegram Bot integration configuration:
5
+ * - telegram_enabled (INTEGER DEFAULT 0): whether Telegram integration is active
6
+ * - telegram_bot_token (TEXT): Bot API token from @BotFather
7
+ * - telegram_chat_id (TEXT): Paired chat ID
8
+ * - telegram_notify_* (INTEGER DEFAULT 0/1): per-event-type notification filters
9
+ *
10
+ * Default values are applied via column defaults so no existing rows need updating.
11
+ * Guards against duplicate column errors using table_info pragma.
12
+ */
13
+ import type { MigrationParams } from 'umzug';
14
+ import type Database from 'better-sqlite3';
15
+ export declare function up({ context: db }: MigrationParams<Database.Database>): Promise<void>;
16
+ export declare function down({ context: db }: MigrationParams<Database.Database>): Promise<void>;
17
+ //# sourceMappingURL=049-add-telegram-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"049-add-telegram-settings.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/src/infrastructure/persistence/sqlite/migrations/049-add-telegram-settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAmB3C,wBAAsB,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAS3F;AAED,wBAAsB,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7F"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Migration 049: Add Telegram remote control settings columns to the settings table.
3
+ *
4
+ * Adds columns for the Telegram Bot integration configuration:
5
+ * - telegram_enabled (INTEGER DEFAULT 0): whether Telegram integration is active
6
+ * - telegram_bot_token (TEXT): Bot API token from @BotFather
7
+ * - telegram_chat_id (TEXT): Paired chat ID
8
+ * - telegram_notify_* (INTEGER DEFAULT 0/1): per-event-type notification filters
9
+ *
10
+ * Default values are applied via column defaults so no existing rows need updating.
11
+ * Guards against duplicate column errors using table_info pragma.
12
+ */
13
+ const COLUMNS = [
14
+ { name: 'telegram_enabled', sql: 'INTEGER NOT NULL DEFAULT 0' },
15
+ { name: 'telegram_bot_token', sql: 'TEXT' },
16
+ { name: 'telegram_chat_id', sql: 'TEXT' },
17
+ { name: 'telegram_notify_agent_started', sql: 'INTEGER NOT NULL DEFAULT 0' },
18
+ { name: 'telegram_notify_phase_completed', sql: 'INTEGER NOT NULL DEFAULT 0' },
19
+ { name: 'telegram_notify_waiting_approval', sql: 'INTEGER NOT NULL DEFAULT 1' },
20
+ { name: 'telegram_notify_agent_completed', sql: 'INTEGER NOT NULL DEFAULT 1' },
21
+ { name: 'telegram_notify_agent_failed', sql: 'INTEGER NOT NULL DEFAULT 1' },
22
+ { name: 'telegram_notify_pr_merged', sql: 'INTEGER NOT NULL DEFAULT 1' },
23
+ { name: 'telegram_notify_pr_closed', sql: 'INTEGER NOT NULL DEFAULT 0' },
24
+ { name: 'telegram_notify_pr_checks_passed', sql: 'INTEGER NOT NULL DEFAULT 0' },
25
+ { name: 'telegram_notify_pr_checks_failed', sql: 'INTEGER NOT NULL DEFAULT 1' },
26
+ { name: 'telegram_notify_pr_blocked', sql: 'INTEGER NOT NULL DEFAULT 1' },
27
+ { name: 'telegram_notify_merge_review_ready', sql: 'INTEGER NOT NULL DEFAULT 1' },
28
+ ];
29
+ export async function up({ context: db }) {
30
+ const columns = db.pragma('table_info(settings)');
31
+ const existing = new Set(columns.map((c) => c.name));
32
+ for (const col of COLUMNS) {
33
+ if (!existing.has(col.name)) {
34
+ db.exec(`ALTER TABLE settings ADD COLUMN ${col.name} ${col.sql}`);
35
+ }
36
+ }
37
+ }
38
+ export async function down({ context: db }) {
39
+ void db;
40
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"merge-prompts.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/merge-prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAE3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAwCxD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAU9F;AAuCD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,QAAQ,EAAE,EACpB,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAUR;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAyER;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACb,MAAM,CA0BR;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAqDzD"}
1
+ {"version":3,"file":"merge-prompts.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/merge-prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAE3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAyCxD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAU9F;AAuCD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,QAAQ,EAAE,EACpB,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAUR;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CA2ER;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACb,MAAM,CA0BR;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAqDzD"}
@@ -11,6 +11,7 @@
11
11
  import yaml from 'js-yaml';
12
12
  import { EvidenceType } from '../../../../../../domain/generated/output.js';
13
13
  import { readSpecFile, buildResumeContext } from '../node-helpers.js';
14
+ import { PR_BRANDING } from './pr-branding.js';
14
15
  /**
15
16
  * Extract merge-phase rejection feedback from spec.yaml.
16
17
  */
@@ -152,7 +153,9 @@ export function buildCommitPushPrPrompt(state, branch, baseBranch, repoUrl) {
152
153
  steps.push(`${shouldPush ? '6' : '4'}. Create a pull request:
153
154
  - Run \`gh pr create --base ${baseBranch} --head ${branch} --title "<title>" --body "<body>"\`
154
155
  - Write a descriptive PR title using conventional commit format
155
- - Write a rich PR body that summarizes the changes using the spec context below`);
156
+ - Write a rich PR body that summarizes the changes using the spec context below
157
+ - The PR body MUST end with this exact branding line (on its own line): \`${PR_BRANDING}\`
158
+ - Do NOT include any other attribution footer (e.g. "Generated with Claude Code" or similar) — only the Shep branding line above`);
156
159
  }
157
160
  const resumeContext = buildResumeContext(state.resumeReason);
158
161
  return `${resumeContext}You are performing git operations in a feature worktree.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Re-export PR branding from the canonical location in git services.
3
+ */
4
+ export { PR_BRANDING, applyPrBranding } from '../../../../../services/git/pr-branding.js';
5
+ //# sourceMappingURL=pr-branding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-branding.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/pr-branding.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Re-export PR branding from the canonical location in git services.
3
+ */
4
+ export { PR_BRANDING, applyPrBranding } from '../../../../../services/git/pr-branding.js';
@@ -1 +1 @@
1
- {"version":3,"file":"deployment.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/deployment/deployment.service.ts"],"names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IAef;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,GAAG,IAAI;IAM5C;;OAEG;IACH,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,IAAI;IAI1D;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,IAAI;IAM3D,OAAO,CAAC,QAAQ;IAuBhB,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,MAAM;IAed,OAAO,CAAC,WAAW;IAQnB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;YA4Dd,aAAa;IAW3B,OAAO,CAAC,WAAW;IAUnB;;;;OAIG;YACW,kBAAkB;IAsChC;;;OAGG;IACH,OAAO,CAAC,SAAS;CAwBlB"}
1
+ {"version":3,"file":"deployment.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/deployment/deployment.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,EAAmC,MAAM,oBAAoB,CAAC;AAK5E,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAK3C,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,EACT,MAAM,qEAAqE,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAiCzD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,eAAe,EAAE,OAAO,eAAe,CAAC;IACxC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;IAC7D,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;C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kBAAkB;IAsChC;;;OAGG;IACH,OAAO,CAAC,SAAS;CAwBlB"}
@@ -188,14 +188,15 @@ export class DeploymentService {
188
188
  throw new Error(detection.error);
189
189
  }
190
190
  // Build spawn args based on package manager
191
- const { packageManager, scriptName, command, needsInstall } = detection;
191
+ const { packageManager, scriptName, command, needsInstall, resolvedDir } = detection;
192
+ const spawnDir = resolvedDir;
192
193
  const args = packageManager === 'npm' ? ['run', scriptName] : [scriptName];
193
194
  // Install dependencies if node_modules is missing (e.g. fresh worktree)
194
195
  if (needsInstall) {
195
- log.info(`node_modules missing in "${targetPath}" — running ${packageManager} install`);
196
+ log.info(`node_modules missing in "${spawnDir}" — running ${packageManager} install`);
196
197
  try {
197
198
  execFileSync(packageManager, ['install'], {
198
- cwd: targetPath,
199
+ cwd: spawnDir,
199
200
  shell: true,
200
201
  stdio: 'ignore',
201
202
  ...(IS_WINDOWS ? { windowsHide: true } : {}),
@@ -207,10 +208,10 @@ export class DeploymentService {
207
208
  throw new Error(`Failed to install dependencies: ${err}`);
208
209
  }
209
210
  }
210
- log.info(`Spawning dev server: command="${command}", packageManager="${packageManager}", scriptName="${scriptName}", cwd="${targetPath}"`);
211
+ log.info(`Spawning dev server: command="${command}", packageManager="${packageManager}", scriptName="${scriptName}", cwd="${spawnDir}"`);
211
212
  const child = this.deps.spawn(packageManager, args, {
212
213
  shell: true,
213
- cwd: targetPath,
214
+ cwd: spawnDir,
214
215
  // On Unix, detached: true creates a process group via setsid() so we can
215
216
  // kill the entire tree with process.kill(-pid). On Windows this flag causes
216
217
  // CREATE_NEW_CONSOLE which opens a visible terminal window and disconnects
@@ -11,6 +11,8 @@ export interface DetectDevScriptSuccess {
11
11
  scriptName: string;
12
12
  command: string;
13
13
  needsInstall: boolean;
14
+ /** The directory where package.json was found (may differ from input when scanning subdirs) */
15
+ resolvedDir: string;
14
16
  }
15
17
  export interface DetectDevScriptError {
16
18
  success: false;
@@ -1 +1 @@
1
- {"version":3,"file":"detect-dev-script.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/deployment/detect-dev-script.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgBH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,IAAI,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,qBAAqB,GAAG,sBAAsB,GAAG,oBAAoB,CAAC;AAIlF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,qBAAqB,CAwCtE"}
1
+ {"version":3,"file":"detect-dev-script.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/deployment/detect-dev-script.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgBH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,IAAI,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;IACtB,+FAA+F;IAC/F,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,qBAAqB,GAAG,sBAAsB,GAAG,oBAAoB,CAAC;AAIlF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,qBAAqB,CAetE"}
@@ -5,7 +5,7 @@
5
5
  * scripts (dev, start, serve), and detects the package manager from lockfile
6
6
  * presence. Returns the detected command or an error.
7
7
  */
8
- import { readFileSync, existsSync } from 'node:fs';
8
+ import { readFileSync, existsSync, readdirSync, statSync } from 'node:fs';
9
9
  import { join } from 'node:path';
10
10
  import { createDeploymentLogger } from './deployment-logger.js';
11
11
  /** Script names to search for, in priority order */
@@ -25,6 +25,23 @@ const log = createDeploymentLogger('[detectDevScript]');
25
25
  */
26
26
  export function detectDevScript(dirPath) {
27
27
  log.info(`scanning dirPath="${dirPath}"`);
28
+ // Try the given directory first
29
+ const directResult = detectDevScriptInDir(dirPath);
30
+ if (directResult.success)
31
+ return directResult;
32
+ // Fallback: scan immediate subdirectories for a package.json with a dev script.
33
+ // This handles monorepos and projects where the app lives in a subdirectory
34
+ // (e.g., worktree root has no package.json but `site/` or `app/` does).
35
+ log.info(`no dev script at root, scanning subdirectories of "${dirPath}"`);
36
+ const subdirResult = scanSubdirectories(dirPath);
37
+ if (subdirResult)
38
+ return subdirResult;
39
+ return directResult;
40
+ }
41
+ /**
42
+ * Attempt detection in a single directory.
43
+ */
44
+ function detectDevScriptInDir(dirPath) {
28
45
  // Read and parse package.json
29
46
  let packageJson;
30
47
  try {
@@ -51,8 +68,40 @@ export function detectDevScript(dirPath) {
51
68
  // Build the command — pnpm/yarn use `<pm> <script>`, npm uses `npm run <script>`
52
69
  const command = packageManager === 'npm' ? `npm run ${scriptName}` : `${packageManager} ${scriptName}`;
53
70
  const needsInstall = !existsSync(join(dirPath, 'node_modules'));
54
- log.info(`detected — packageManager="${packageManager}", scriptName="${scriptName}", command="${command}", needsInstall=${needsInstall}`);
55
- return { success: true, packageManager, scriptName, command, needsInstall };
71
+ log.info(`detected — packageManager="${packageManager}", scriptName="${scriptName}", command="${command}", needsInstall=${needsInstall}, resolvedDir="${dirPath}"`);
72
+ return { success: true, packageManager, scriptName, command, needsInstall, resolvedDir: dirPath };
73
+ }
74
+ /**
75
+ * Scan immediate subdirectories for a package.json with a dev script.
76
+ * Skips hidden dirs, node_modules, and common non-project directories.
77
+ */
78
+ function scanSubdirectories(dirPath) {
79
+ const SKIP_DIRS = new Set(['node_modules', '.git', '.next', 'dist', 'build', 'out', '.cache']);
80
+ let entries;
81
+ try {
82
+ entries = readdirSync(dirPath);
83
+ }
84
+ catch {
85
+ return null;
86
+ }
87
+ for (const entry of entries) {
88
+ if (entry.startsWith('.') || SKIP_DIRS.has(entry))
89
+ continue;
90
+ const subPath = join(dirPath, entry);
91
+ try {
92
+ if (!statSync(subPath).isDirectory())
93
+ continue;
94
+ }
95
+ catch {
96
+ continue;
97
+ }
98
+ const result = detectDevScriptInDir(subPath);
99
+ if (result.success) {
100
+ log.info(`found dev script in subdirectory "${entry}" — resolvedDir="${subPath}"`);
101
+ return result;
102
+ }
103
+ }
104
+ return null;
56
105
  }
57
106
  /**
58
107
  * Detect the package manager by checking for lockfile presence.
@@ -1 +1 @@
1
- {"version":3,"file":"git-fork.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/git/git-fork.service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0EAA0E,CAAC;AAChH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0EAA0E,CAAC;AAKjH,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,qBACa,cAAe,YAAW,eAAe;IAChB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAErE,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0C1C,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAatD,gBAAgB,CACpB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,gBAAgB,CAAC;IAiDtB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAsBpF;;;OAGG;IACH,OAAO,CAAC,kBAAkB;CAU3B"}
1
+ {"version":3,"file":"git-fork.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/git/git-fork.service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0EAA0E,CAAC;AAChH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0EAA0E,CAAC;AAKjH,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1D,qBACa,cAAe,YAAW,eAAe;IAChB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAErE,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0C1C,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAatD,gBAAgB,CACpB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,gBAAgB,CAAC;IAkDtB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAsBpF;;;OAGG;IACH,OAAO,CAAC,kBAAkB;CAU3B"}
@@ -20,6 +20,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
20
20
  import { injectable, inject } from 'tsyringe';
21
21
  import { GitForkError, GitForkErrorCode, } from '../../../application/ports/output/services/git-fork-service.interface.js';
22
22
  import { PrStatus } from '../../../domain/generated/output.js';
23
+ import { applyPrBranding } from './pr-branding.js';
23
24
  let GitForkService = class GitForkService {
24
25
  execFile;
25
26
  constructor(execFile) {
@@ -80,6 +81,7 @@ let GitForkService = class GitForkService {
80
81
  });
81
82
  const forkRepo = this.extractRepoFromUrl(forkUrl.trim());
82
83
  const forkOwner = forkRepo.split('/')[0];
84
+ const brandedBody = applyPrBranding(body);
83
85
  const { stdout } = await this.execFile('gh', [
84
86
  'pr',
85
87
  'create',
@@ -88,7 +90,7 @@ let GitForkService = class GitForkService {
88
90
  '--title',
89
91
  title,
90
92
  '--body',
91
- body,
93
+ brandedBody,
92
94
  '--head',
93
95
  `${forkOwner}:${head}`,
94
96
  '--base',
@@ -1 +1 @@
1
- {"version":3,"file":"git-pr.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/git/git-pr.service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wEAAwE,CAAC;AAC5G,OAAO,KAAK,EACV,cAAc,EAGd,WAAW,EACX,QAAQ,EACR,aAAa,EACb,cAAc,EACd,YAAY,EACb,MAAM,wEAAwE,CAAC;AAUhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,qBACa,YAAa,YAAW,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAErE,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAgBjD,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgF9C,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKnD,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,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AW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQvC,mBAAmB,CACvB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAe9C"}
1
+ {"version":3,"file":"git-pr.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/git/git-pr.service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wEAAwE,CAAC;AAC5G,OAAO,KAAK,EACV,cAAc,EAGd,WAAW,EACX,QAAQ,EACR,aAAa,EACb,cAAc,EACd,YAAY,EACb,MAAM,wEAAwE,CAAC;AAUhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1D,qBACa,YAAa,YAAW,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAErE,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAgBjD,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgF9C,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKnD,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKpD,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAWxD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,C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M,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAe9C"}
@@ -22,6 +22,7 @@ import { readFileSync, writeFileSync, unlinkSync } from 'node:fs';
22
22
  import { tmpdir } from 'node:os';
23
23
  import { join } from 'node:path';
24
24
  import yaml from 'js-yaml';
25
+ import { applyPrBranding } from './pr-branding.js';
25
26
  let GitPrService = class GitPrService {
26
27
  execFile;
27
28
  constructor(execFile) {
@@ -161,7 +162,7 @@ let GitPrService = class GitPrService {
161
162
  const prYamlContent = readFileSync(prYamlPath, 'utf-8');
162
163
  const prData = yaml.load(prYamlContent);
163
164
  const title = prData.title ?? 'Untitled PR';
164
- const body = prData.body ?? '';
165
+ const body = applyPrBranding(prData.body ?? '');
165
166
  const args = ['pr', 'create', '--title', title, '--body', body];
166
167
  if (prData.baseBranch) {
167
168
  args.push('--base', prData.baseBranch);
@@ -0,0 +1,17 @@
1
+ /**
2
+ * PR Branding
3
+ *
4
+ * Centralizes the branding footer used in pull request bodies
5
+ * created by Shep. Ensures consistent attribution across all
6
+ * PR creation paths (agent-driven, fork-and-PR, etc.).
7
+ */
8
+ /** The branding line to append to PR bodies. */
9
+ export declare const PR_BRANDING = "Built with Shep \uD83D\uDC11 [Shep Bot](https://github.com/shep-ai/cli)";
10
+ /**
11
+ * Ensure a PR body carries the correct Shep branding.
12
+ *
13
+ * 1. Strips any unwanted AI-tool attribution footers
14
+ * 2. Appends the Shep branding line if not already present
15
+ */
16
+ export declare function applyPrBranding(body: string): string;
17
+ //# sourceMappingURL=pr-branding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-branding.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/git/pr-branding.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gDAAgD;AAChD,eAAO,MAAM,WAAW,4EACmD,CAAC;AAS5E;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAapD"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * PR Branding
3
+ *
4
+ * Centralizes the branding footer used in pull request bodies
5
+ * created by Shep. Ensures consistent attribution across all
6
+ * PR creation paths (agent-driven, fork-and-PR, etc.).
7
+ */
8
+ /** The branding line to append to PR bodies. */
9
+ export const PR_BRANDING = 'Built with Shep \uD83D\uDC11 [Shep Bot](https://github.com/shep-ai/cli)';
10
+ /**
11
+ * Pattern matching common AI-tool attribution footers that should be
12
+ * replaced (e.g. "Generated with Claude Code", "Co-Authored-By: Claude").
13
+ */
14
+ const UNWANTED_BRANDING_PATTERN = /\n*(?:🤖\s*)?Generated with \[Claude Code\]\(https:\/\/claude\.com\/claude-code\)\s*/gi;
15
+ /**
16
+ * Ensure a PR body carries the correct Shep branding.
17
+ *
18
+ * 1. Strips any unwanted AI-tool attribution footers
19
+ * 2. Appends the Shep branding line if not already present
20
+ */
21
+ export function applyPrBranding(body) {
22
+ // Strip unwanted branding
23
+ let cleaned = body.replace(UNWANTED_BRANDING_PATTERN, '');
24
+ // Trim trailing whitespace/newlines before appending branding
25
+ cleaned = cleaned.trimEnd();
26
+ // Only append if not already present
27
+ if (!cleaned.includes(PR_BRANDING)) {
28
+ cleaned = `${cleaned}\n\n${PR_BRANDING}`;
29
+ }
30
+ return cleaned;
31
+ }
@@ -5,17 +5,25 @@
5
5
  * events to enabled channels:
6
6
  * - Notification bus (for SSE → in-app toasts and browser notifications)
7
7
  * - Desktop notifier (node-notifier for OS-level notifications)
8
+ * - Telegram bot (sends messages via Bot API)
8
9
  *
9
10
  * Channel enable/disable and event type filters are read from Settings.
10
11
  */
11
12
  import type { NotificationEvent } from '../../../domain/generated/output.js';
12
13
  import type { INotificationService } from '../../../application/ports/output/services/notification-service.interface.js';
14
+ import type { ITelegramService } from '../../../application/ports/output/services/telegram-service.interface.js';
13
15
  import type { NotificationBus } from './notification-bus.js';
14
16
  import type { DesktopNotifier } from './desktop-notifier.js';
15
17
  export declare class NotificationService implements INotificationService {
16
18
  private readonly bus;
17
19
  private readonly desktopNotifier;
18
- constructor(bus: NotificationBus, desktopNotifier: DesktopNotifier);
20
+ private readonly telegramService;
21
+ constructor(bus: NotificationBus, desktopNotifier: DesktopNotifier, telegramService: ITelegramService);
19
22
  notify(event: NotificationEvent): void;
23
+ /**
24
+ * Send a notification to Telegram if the channel is enabled and
25
+ * the specific event type is allowed in the Telegram notify events config.
26
+ */
27
+ private sendTelegramNotification;
20
28
  }
21
29
  //# sourceMappingURL=notification.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/notifications/notification.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8EAA8E,CAAC;AAEzH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAgB7D,qBAAa,mBAAoB,YAAW,oBAAoB;IAC9D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkB;IACtC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;gBAEtC,GAAG,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe;IAKlE,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;CAiBvC"}
1
+ {"version":3,"file":"notification.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/notifications/notification.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,iBAAiB,EAGlB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8EAA8E,CAAC;AACzH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0EAA0E,CAAC;AAEjH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA8B7D,qBAAa,mBAAoB,YAAW,oBAAoB;IAC9D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkB;IACtC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;IAClD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAmB;gBAGjD,GAAG,EAAE,eAAe,EACpB,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,gBAAgB;IAOnC,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAqBtC;;;OAGG;IACH,OAAO,CAAC,wBAAwB;CAmBjC"}
@@ -5,6 +5,7 @@
5
5
  * events to enabled channels:
6
6
  * - Notification bus (for SSE → in-app toasts and browser notifications)
7
7
  * - Desktop notifier (node-notifier for OS-level notifications)
8
+ * - Telegram bot (sends messages via Bot API)
8
9
  *
9
10
  * Channel enable/disable and event type filters are read from Settings.
10
11
  */
@@ -23,12 +24,27 @@ const EVENT_TYPE_TO_CONFIG_KEY = {
23
24
  [NotificationEventType.PrBlocked]: 'prBlocked',
24
25
  [NotificationEventType.MergeReviewReady]: 'mergeReviewReady',
25
26
  };
27
+ const EVENT_TYPE_TO_TELEGRAM_KEY = {
28
+ [NotificationEventType.AgentStarted]: 'agentStarted',
29
+ [NotificationEventType.PhaseCompleted]: 'phaseCompleted',
30
+ [NotificationEventType.WaitingApproval]: 'waitingApproval',
31
+ [NotificationEventType.AgentCompleted]: 'agentCompleted',
32
+ [NotificationEventType.AgentFailed]: 'agentFailed',
33
+ [NotificationEventType.PrMerged]: 'prMerged',
34
+ [NotificationEventType.PrClosed]: 'prClosed',
35
+ [NotificationEventType.PrChecksPassed]: 'prChecksPassed',
36
+ [NotificationEventType.PrChecksFailed]: 'prChecksFailed',
37
+ [NotificationEventType.PrBlocked]: 'prBlocked',
38
+ [NotificationEventType.MergeReviewReady]: 'mergeReviewReady',
39
+ };
26
40
  export class NotificationService {
27
41
  bus;
28
42
  desktopNotifier;
29
- constructor(bus, desktopNotifier) {
43
+ telegramService;
44
+ constructor(bus, desktopNotifier, telegramService) {
30
45
  this.bus = bus;
31
46
  this.desktopNotifier = desktopNotifier;
47
+ this.telegramService = telegramService;
32
48
  }
33
49
  notify(event) {
34
50
  const { notifications } = getSettings();
@@ -43,5 +59,28 @@ export class NotificationService {
43
59
  }
44
60
  // Desktop notifications disabled — removed in favour of in-app toasts.
45
61
  // The DesktopNotifier dependency is kept for API compatibility but never called.
62
+ // Send to Telegram if enabled and event type is allowed
63
+ this.sendTelegramNotification(event);
64
+ }
65
+ /**
66
+ * Send a notification to Telegram if the channel is enabled and
67
+ * the specific event type is allowed in the Telegram notify events config.
68
+ */
69
+ sendTelegramNotification(event) {
70
+ const { telegram } = getSettings();
71
+ if (!telegram?.enabled || !telegram.botToken || !telegram.chatId) {
72
+ return;
73
+ }
74
+ // Check Telegram-specific event type filter
75
+ const telegramKey = EVENT_TYPE_TO_TELEGRAM_KEY[event.eventType];
76
+ if (telegramKey && !telegram.notifyEvents[telegramKey]) {
77
+ return;
78
+ }
79
+ // Fire-and-forget: don't block the notification pipeline on Telegram API calls
80
+ this.telegramService.sendNotification(telegram.botToken, telegram.chatId, event).catch(() => {
81
+ // Swallow errors silently — Telegram is a best-effort channel.
82
+ // Network failures, rate limits, or invalid tokens should not
83
+ // break the core notification flow.
84
+ });
46
85
  }
47
86
  }