edsger 0.76.0 → 0.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (853) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +95 -210
  3. package/assets/LICENSE +21 -0
  4. package/assets/README.md +104 -0
  5. package/assets/benchmark/base.yaml +286 -0
  6. package/assets/benchmark/csharp.yaml +68 -0
  7. package/assets/benchmark/dart.yaml +70 -0
  8. package/assets/benchmark/go.yaml +71 -0
  9. package/assets/benchmark/java.yaml +68 -0
  10. package/assets/benchmark/python.yaml +72 -0
  11. package/assets/benchmark/typescript.yaml +71 -0
  12. package/assets/languages.yaml +35 -0
  13. package/assets/manifest.yaml +39 -0
  14. package/assets/review/base.yaml +111 -0
  15. package/assets/review/csharp.yaml +38 -0
  16. package/assets/review/dart.yaml +40 -0
  17. package/assets/review/go.yaml +40 -0
  18. package/assets/review/java.yaml +40 -0
  19. package/assets/review/python.yaml +41 -0
  20. package/assets/review/typescript.yaml +40 -0
  21. package/assets/schema/benchmark.schema.json +87 -0
  22. package/assets/schema/review.schema.json +73 -0
  23. package/assets/skills/benchmark/SKILL.md +66 -0
  24. package/assets/skills/pr-resolve/SKILL.md +58 -0
  25. package/assets/skills/pr-review/SKILL.md +66 -0
  26. package/dist/index.js +1339 -1218
  27. package/dist/index.js.map +1 -0
  28. package/package.json +58 -53
  29. package/dist/api/adr.d.ts +0 -48
  30. package/dist/api/adr.js +0 -139
  31. package/dist/api/app-store-iap.d.ts +0 -60
  32. package/dist/api/app-store-iap.js +0 -145
  33. package/dist/api/app-store.d.ts +0 -93
  34. package/dist/api/app-store.js +0 -206
  35. package/dist/api/chat.d.ts +0 -72
  36. package/dist/api/chat.js +0 -272
  37. package/dist/api/cross-product.d.ts +0 -33
  38. package/dist/api/cross-product.js +0 -127
  39. package/dist/api/financing.d.ts +0 -47
  40. package/dist/api/financing.js +0 -37
  41. package/dist/api/github.d.ts +0 -86
  42. package/dist/api/github.js +0 -203
  43. package/dist/api/growth.d.ts +0 -81
  44. package/dist/api/growth.js +0 -75
  45. package/dist/api/intelligence-normalize.d.ts +0 -25
  46. package/dist/api/intelligence-normalize.js +0 -103
  47. package/dist/api/intelligence.d.ts +0 -187
  48. package/dist/api/intelligence.js +0 -402
  49. package/dist/api/issues/approval-checker.d.ts +0 -22
  50. package/dist/api/issues/approval-checker.js +0 -141
  51. package/dist/api/issues/batch-operations.d.ts +0 -17
  52. package/dist/api/issues/batch-operations.js +0 -100
  53. package/dist/api/issues/get-issue.d.ts +0 -5
  54. package/dist/api/issues/get-issue.js +0 -47
  55. package/dist/api/issues/index.d.ts +0 -8
  56. package/dist/api/issues/index.js +0 -10
  57. package/dist/api/issues/issue-utils.d.ts +0 -25
  58. package/dist/api/issues/issue-utils.js +0 -133
  59. package/dist/api/issues/status-updater.d.ts +0 -68
  60. package/dist/api/issues/status-updater.js +0 -190
  61. package/dist/api/issues/test-cases.d.ts +0 -29
  62. package/dist/api/issues/test-cases.js +0 -185
  63. package/dist/api/issues/update-issue.d.ts +0 -25
  64. package/dist/api/issues/update-issue.js +0 -127
  65. package/dist/api/issues/user-stories.d.ts +0 -21
  66. package/dist/api/issues/user-stories.js +0 -163
  67. package/dist/api/mcp-client.d.ts +0 -22
  68. package/dist/api/mcp-client.js +0 -75
  69. package/dist/api/products/test-cases.d.ts +0 -18
  70. package/dist/api/products/test-cases.js +0 -51
  71. package/dist/api/products.d.ts +0 -15
  72. package/dist/api/products.js +0 -45
  73. package/dist/api/release-test-cases.d.ts +0 -7
  74. package/dist/api/release-test-cases.js +0 -59
  75. package/dist/api/releases.d.ts +0 -41
  76. package/dist/api/releases.js +0 -117
  77. package/dist/api/run-sheets.d.ts +0 -22
  78. package/dist/api/run-sheets.js +0 -13
  79. package/dist/api/storage.d.ts +0 -13
  80. package/dist/api/storage.js +0 -29
  81. package/dist/api/tasks.d.ts +0 -26
  82. package/dist/api/tasks.js +0 -81
  83. package/dist/api/test-reports.d.ts +0 -9
  84. package/dist/api/test-reports.js +0 -43
  85. package/dist/api/user-psychology.d.ts +0 -101
  86. package/dist/api/user-psychology.js +0 -143
  87. package/dist/api/web-deploy.d.ts +0 -67
  88. package/dist/api/web-deploy.js +0 -199
  89. package/dist/auth/auth-store.d.ts +0 -98
  90. package/dist/auth/auth-store.js +0 -194
  91. package/dist/auth/env-store.d.ts +0 -41
  92. package/dist/auth/env-store.js +0 -127
  93. package/dist/auth/login.d.ts +0 -18
  94. package/dist/auth/login.js +0 -179
  95. package/dist/commands/adr/index.d.ts +0 -13
  96. package/dist/commands/adr/index.js +0 -31
  97. package/dist/commands/agent-workflow/chat-worker.d.ts +0 -16
  98. package/dist/commands/agent-workflow/chat-worker.js +0 -465
  99. package/dist/commands/agent-workflow/index.d.ts +0 -13
  100. package/dist/commands/agent-workflow/index.js +0 -107
  101. package/dist/commands/agent-workflow/issue-worker.d.ts +0 -14
  102. package/dist/commands/agent-workflow/issue-worker.js +0 -65
  103. package/dist/commands/agent-workflow/processor.d.ts +0 -95
  104. package/dist/commands/agent-workflow/processor.js +0 -519
  105. package/dist/commands/analyze-logs/index.d.ts +0 -7
  106. package/dist/commands/analyze-logs/index.js +0 -34
  107. package/dist/commands/app-store/index.d.ts +0 -12
  108. package/dist/commands/app-store/index.js +0 -69
  109. package/dist/commands/architecture-diagram/index.d.ts +0 -8
  110. package/dist/commands/architecture-diagram/index.js +0 -10
  111. package/dist/commands/build/detect-project.d.ts +0 -52
  112. package/dist/commands/build/detect-project.js +0 -277
  113. package/dist/commands/build/index.d.ts +0 -66
  114. package/dist/commands/build/index.js +0 -544
  115. package/dist/commands/chat-serve/chat-server.d.ts +0 -114
  116. package/dist/commands/chat-serve/chat-server.js +0 -339
  117. package/dist/commands/chat-serve/index.d.ts +0 -20
  118. package/dist/commands/chat-serve/index.js +0 -58
  119. package/dist/commands/checklists/index.d.ts +0 -16
  120. package/dist/commands/checklists/index.js +0 -187
  121. package/dist/commands/checklists/tools.d.ts +0 -17
  122. package/dist/commands/checklists/tools.js +0 -19
  123. package/dist/commands/class-diagram/index.d.ts +0 -7
  124. package/dist/commands/class-diagram/index.js +0 -9
  125. package/dist/commands/code-review/index.d.ts +0 -2
  126. package/dist/commands/code-review/index.js +0 -37
  127. package/dist/commands/code-review/reviewer.d.ts +0 -3
  128. package/dist/commands/code-review/reviewer.js +0 -205
  129. package/dist/commands/config/index.d.ts +0 -16
  130. package/dist/commands/config/index.js +0 -60
  131. package/dist/commands/data-flow/index.d.ts +0 -19
  132. package/dist/commands/data-flow/index.js +0 -55
  133. package/dist/commands/diagram-shared/index.d.ts +0 -21
  134. package/dist/commands/diagram-shared/index.js +0 -37
  135. package/dist/commands/discover/index.d.ts +0 -14
  136. package/dist/commands/discover/index.js +0 -29
  137. package/dist/commands/er-diagram/index.d.ts +0 -19
  138. package/dist/commands/er-diagram/index.js +0 -55
  139. package/dist/commands/features/index.d.ts +0 -15
  140. package/dist/commands/features/index.js +0 -34
  141. package/dist/commands/financing-deck/index.d.ts +0 -8
  142. package/dist/commands/financing-deck/index.js +0 -66
  143. package/dist/commands/find-architecture/index.d.ts +0 -15
  144. package/dist/commands/find-architecture/index.js +0 -50
  145. package/dist/commands/find-bugs/index.d.ts +0 -13
  146. package/dist/commands/find-bugs/index.js +0 -48
  147. package/dist/commands/find-features/index.d.ts +0 -14
  148. package/dist/commands/find-features/index.js +0 -42
  149. package/dist/commands/find-smells/index.d.ts +0 -23
  150. package/dist/commands/find-smells/index.js +0 -74
  151. package/dist/commands/flowchart/index.d.ts +0 -8
  152. package/dist/commands/flowchart/index.js +0 -10
  153. package/dist/commands/growth-analysis/index.d.ts +0 -7
  154. package/dist/commands/growth-analysis/index.js +0 -89
  155. package/dist/commands/init/index.d.ts +0 -5
  156. package/dist/commands/init/index.js +0 -152
  157. package/dist/commands/init/prompts.d.ts +0 -9
  158. package/dist/commands/init/prompts.js +0 -128
  159. package/dist/commands/init/templates.d.ts +0 -9
  160. package/dist/commands/init/templates.js +0 -264
  161. package/dist/commands/intelligence/index.d.ts +0 -15
  162. package/dist/commands/intelligence/index.js +0 -138
  163. package/dist/commands/issue-analysis/index.d.ts +0 -5
  164. package/dist/commands/issue-analysis/index.js +0 -9
  165. package/dist/commands/pr-resolve/index.d.ts +0 -13
  166. package/dist/commands/pr-resolve/index.js +0 -50
  167. package/dist/commands/pr-review/index.d.ts +0 -12
  168. package/dist/commands/pr-review/index.js +0 -47
  169. package/dist/commands/product-techniques/index.d.ts +0 -15
  170. package/dist/commands/product-techniques/index.js +0 -37
  171. package/dist/commands/product-test-cases/index.d.ts +0 -12
  172. package/dist/commands/product-test-cases/index.js +0 -40
  173. package/dist/commands/quality-benchmark/index.d.ts +0 -40
  174. package/dist/commands/quality-benchmark/index.js +0 -219
  175. package/dist/commands/recipes/index.d.ts +0 -17
  176. package/dist/commands/recipes/index.js +0 -40
  177. package/dist/commands/refactor/refactor.d.ts +0 -2
  178. package/dist/commands/refactor/refactor.js +0 -134
  179. package/dist/commands/release-sync/index.d.ts +0 -5
  180. package/dist/commands/release-sync/index.js +0 -38
  181. package/dist/commands/run-sheet/index.d.ts +0 -6
  182. package/dist/commands/run-sheet/index.js +0 -48
  183. package/dist/commands/screen-flow/index.d.ts +0 -18
  184. package/dist/commands/screen-flow/index.js +0 -54
  185. package/dist/commands/sequence-diagram/index.d.ts +0 -19
  186. package/dist/commands/sequence-diagram/index.js +0 -55
  187. package/dist/commands/session-serve/index.d.ts +0 -32
  188. package/dist/commands/session-serve/index.js +0 -100
  189. package/dist/commands/session-turn/index.d.ts +0 -73
  190. package/dist/commands/session-turn/index.js +0 -254
  191. package/dist/commands/smoke-test/index.d.ts +0 -5
  192. package/dist/commands/smoke-test/index.js +0 -40
  193. package/dist/commands/state-diagram/index.d.ts +0 -7
  194. package/dist/commands/state-diagram/index.js +0 -9
  195. package/dist/commands/sync-aws/index.d.ts +0 -16
  196. package/dist/commands/sync-aws/index.js +0 -214
  197. package/dist/commands/sync-datadog/index.d.ts +0 -16
  198. package/dist/commands/sync-datadog/index.js +0 -236
  199. package/dist/commands/sync-github-issues/index.d.ts +0 -11
  200. package/dist/commands/sync-github-issues/index.js +0 -42
  201. package/dist/commands/sync-github-pull-requests/index.d.ts +0 -11
  202. package/dist/commands/sync-github-pull-requests/index.js +0 -42
  203. package/dist/commands/sync-org-repos/index.d.ts +0 -12
  204. package/dist/commands/sync-org-repos/index.js +0 -60
  205. package/dist/commands/sync-sentry-issues/index.d.ts +0 -14
  206. package/dist/commands/sync-sentry-issues/index.js +0 -73
  207. package/dist/commands/sync-terraform/index.d.ts +0 -16
  208. package/dist/commands/sync-terraform/index.js +0 -248
  209. package/dist/commands/task-worker/index.d.ts +0 -8
  210. package/dist/commands/task-worker/index.js +0 -34
  211. package/dist/commands/task-worker/processor.d.ts +0 -23
  212. package/dist/commands/task-worker/processor.js +0 -84
  213. package/dist/commands/technical-design/index.d.ts +0 -5
  214. package/dist/commands/technical-design/index.js +0 -9
  215. package/dist/commands/test-cases-analysis/index.d.ts +0 -5
  216. package/dist/commands/test-cases-analysis/index.js +0 -9
  217. package/dist/commands/user-psychology/index.d.ts +0 -7
  218. package/dist/commands/user-psychology/index.js +0 -51
  219. package/dist/commands/user-stories-analysis/index.d.ts +0 -5
  220. package/dist/commands/user-stories-analysis/index.js +0 -9
  221. package/dist/commands/workflow/config/phase-configs.d.ts +0 -5
  222. package/dist/commands/workflow/config/phase-configs.js +0 -132
  223. package/dist/commands/workflow/core/index.d.ts +0 -8
  224. package/dist/commands/workflow/core/index.js +0 -12
  225. package/dist/commands/workflow/core/issue-filter.d.ts +0 -16
  226. package/dist/commands/workflow/core/issue-filter.js +0 -47
  227. package/dist/commands/workflow/core/pipeline-evaluator.d.ts +0 -24
  228. package/dist/commands/workflow/core/pipeline-evaluator.js +0 -32
  229. package/dist/commands/workflow/core/state-manager.d.ts +0 -24
  230. package/dist/commands/workflow/core/state-manager.js +0 -42
  231. package/dist/commands/workflow/core/workflow-logger.d.ts +0 -23
  232. package/dist/commands/workflow/core/workflow-logger.js +0 -77
  233. package/dist/commands/workflow/executors/phase-executor.d.ts +0 -8
  234. package/dist/commands/workflow/executors/phase-executor.js +0 -338
  235. package/dist/commands/workflow/index.d.ts +0 -2
  236. package/dist/commands/workflow/index.js +0 -34
  237. package/dist/commands/workflow/issue-coordinator.d.ts +0 -18
  238. package/dist/commands/workflow/issue-coordinator.js +0 -161
  239. package/dist/commands/workflow/phase-orchestrator.d.ts +0 -26
  240. package/dist/commands/workflow/phase-orchestrator.js +0 -699
  241. package/dist/commands/workflow/processor.d.ts +0 -47
  242. package/dist/commands/workflow/processor.js +0 -149
  243. package/dist/config/issue-status.d.ts +0 -29
  244. package/dist/config/issue-status.js +0 -44
  245. package/dist/config.d.ts +0 -3
  246. package/dist/config.js +0 -79
  247. package/dist/constants.d.ts +0 -10
  248. package/dist/constants.js +0 -36
  249. package/dist/errors/index.d.ts +0 -68
  250. package/dist/errors/index.js +0 -129
  251. package/dist/index.d.ts +0 -4
  252. package/dist/phases/adr-generation/agent.d.ts +0 -6
  253. package/dist/phases/adr-generation/agent.js +0 -69
  254. package/dist/phases/adr-generation/index.d.ts +0 -15
  255. package/dist/phases/adr-generation/index.js +0 -66
  256. package/dist/phases/adr-generation/parse.d.ts +0 -12
  257. package/dist/phases/adr-generation/parse.js +0 -123
  258. package/dist/phases/adr-generation/prompts.d.ts +0 -8
  259. package/dist/phases/adr-generation/prompts.js +0 -35
  260. package/dist/phases/analyze-logs/agent.d.ts +0 -11
  261. package/dist/phases/analyze-logs/agent.js +0 -66
  262. package/dist/phases/analyze-logs/index.d.ts +0 -23
  263. package/dist/phases/analyze-logs/index.js +0 -152
  264. package/dist/phases/analyze-logs/prompts.d.ts +0 -3
  265. package/dist/phases/analyze-logs/prompts.js +0 -27
  266. package/dist/phases/app-store-generation/agent.d.ts +0 -2
  267. package/dist/phases/app-store-generation/agent.js +0 -177
  268. package/dist/phases/app-store-generation/assets/inter-latin-ext.woff2 +0 -0
  269. package/dist/phases/app-store-generation/assets/inter-latin.woff2 +0 -0
  270. package/dist/phases/app-store-generation/context.d.ts +0 -21
  271. package/dist/phases/app-store-generation/context.js +0 -78
  272. package/dist/phases/app-store-generation/index.d.ts +0 -20
  273. package/dist/phases/app-store-generation/index.js +0 -157
  274. package/dist/phases/app-store-generation/inter-font.d.ts +0 -20
  275. package/dist/phases/app-store-generation/inter-font.js +0 -49
  276. package/dist/phases/app-store-generation/prompts.d.ts +0 -43
  277. package/dist/phases/app-store-generation/prompts.js +0 -73
  278. package/dist/phases/app-store-generation/screenshot-composer.d.ts +0 -41
  279. package/dist/phases/app-store-generation/screenshot-composer.js +0 -516
  280. package/dist/phases/app-store-generation/uploader.d.ts +0 -19
  281. package/dist/phases/app-store-generation/uploader.js +0 -150
  282. package/dist/phases/architecture-diagram/index.d.ts +0 -15
  283. package/dist/phases/architecture-diagram/index.js +0 -51
  284. package/dist/phases/autonomous/index.d.ts +0 -32
  285. package/dist/phases/autonomous/index.js +0 -412
  286. package/dist/phases/autonomous/prompts.d.ts +0 -5
  287. package/dist/phases/autonomous/prompts.js +0 -31
  288. package/dist/phases/branch-planning/context.d.ts +0 -14
  289. package/dist/phases/branch-planning/context.js +0 -43
  290. package/dist/phases/branch-planning/index.d.ts +0 -25
  291. package/dist/phases/branch-planning/index.js +0 -404
  292. package/dist/phases/branch-planning/outcome.d.ts +0 -28
  293. package/dist/phases/branch-planning/outcome.js +0 -115
  294. package/dist/phases/branch-planning/prompts.d.ts +0 -41
  295. package/dist/phases/branch-planning/prompts.js +0 -157
  296. package/dist/phases/bug-fixing/analyzer.d.ts +0 -17
  297. package/dist/phases/bug-fixing/analyzer.js +0 -247
  298. package/dist/phases/bug-fixing/context-fetcher.d.ts +0 -22
  299. package/dist/phases/bug-fixing/context-fetcher.js +0 -137
  300. package/dist/phases/bug-fixing/index.d.ts +0 -7
  301. package/dist/phases/bug-fixing/index.js +0 -7
  302. package/dist/phases/bug-fixing/mcp-server.d.ts +0 -18
  303. package/dist/phases/bug-fixing/mcp-server.js +0 -19
  304. package/dist/phases/bug-fixing/prompts.d.ts +0 -2
  305. package/dist/phases/bug-fixing/prompts.js +0 -9
  306. package/dist/phases/chat-processor/context.d.ts +0 -38
  307. package/dist/phases/chat-processor/context.js +0 -91
  308. package/dist/phases/chat-processor/index.d.ts +0 -49
  309. package/dist/phases/chat-processor/index.js +0 -482
  310. package/dist/phases/chat-processor/product-context.d.ts +0 -36
  311. package/dist/phases/chat-processor/product-context.js +0 -113
  312. package/dist/phases/chat-processor/product-prompts.d.ts +0 -4
  313. package/dist/phases/chat-processor/product-prompts.js +0 -65
  314. package/dist/phases/chat-processor/product-tools.d.ts +0 -8
  315. package/dist/phases/chat-processor/product-tools.js +0 -11
  316. package/dist/phases/chat-processor/prompts.d.ts +0 -35
  317. package/dist/phases/chat-processor/prompts.js +0 -213
  318. package/dist/phases/chat-processor/tools.d.ts +0 -8
  319. package/dist/phases/chat-processor/tools.js +0 -11
  320. package/dist/phases/class-diagram/index.d.ts +0 -14
  321. package/dist/phases/class-diagram/index.js +0 -76
  322. package/dist/phases/code-implementation/branch-pr-creator.d.ts +0 -31
  323. package/dist/phases/code-implementation/branch-pr-creator.js +0 -172
  324. package/dist/phases/code-implementation/context.d.ts +0 -17
  325. package/dist/phases/code-implementation/context.js +0 -88
  326. package/dist/phases/code-implementation/index.d.ts +0 -33
  327. package/dist/phases/code-implementation/index.js +0 -926
  328. package/dist/phases/code-implementation/outcome.d.ts +0 -47
  329. package/dist/phases/code-implementation/outcome.js +0 -53
  330. package/dist/phases/code-implementation/prompts.d.ts +0 -8
  331. package/dist/phases/code-implementation/prompts.js +0 -166
  332. package/dist/phases/code-implementation-verification/agent.d.ts +0 -32
  333. package/dist/phases/code-implementation-verification/agent.js +0 -225
  334. package/dist/phases/code-implementation-verification/index.d.ts +0 -27
  335. package/dist/phases/code-implementation-verification/index.js +0 -121
  336. package/dist/phases/code-implementation-verification/prompts.d.ts +0 -10
  337. package/dist/phases/code-implementation-verification/prompts.js +0 -90
  338. package/dist/phases/code-refine/context.d.ts +0 -99
  339. package/dist/phases/code-refine/context.js +0 -457
  340. package/dist/phases/code-refine/index.d.ts +0 -59
  341. package/dist/phases/code-refine/index.js +0 -348
  342. package/dist/phases/code-refine/prompts.d.ts +0 -5
  343. package/dist/phases/code-refine/prompts.js +0 -162
  344. package/dist/phases/code-refine/refine-iteration.d.ts +0 -33
  345. package/dist/phases/code-refine/refine-iteration.js +0 -166
  346. package/dist/phases/code-refine/retry-handler.d.ts +0 -17
  347. package/dist/phases/code-refine/retry-handler.js +0 -87
  348. package/dist/phases/code-refine-verification/github.d.ts +0 -54
  349. package/dist/phases/code-refine-verification/github.js +0 -328
  350. package/dist/phases/code-refine-verification/index.d.ts +0 -11
  351. package/dist/phases/code-refine-verification/index.js +0 -260
  352. package/dist/phases/code-refine-verification/llm-analyzer.d.ts +0 -22
  353. package/dist/phases/code-refine-verification/llm-analyzer.js +0 -152
  354. package/dist/phases/code-refine-verification/prompts.d.ts +0 -5
  355. package/dist/phases/code-refine-verification/prompts.js +0 -119
  356. package/dist/phases/code-refine-verification/types.d.ts +0 -74
  357. package/dist/phases/code-refine-verification/types.js +0 -4
  358. package/dist/phases/code-review/context.d.ts +0 -96
  359. package/dist/phases/code-review/context.js +0 -278
  360. package/dist/phases/code-review/diff-utils.d.ts +0 -36
  361. package/dist/phases/code-review/diff-utils.js +0 -100
  362. package/dist/phases/code-review/index.d.ts +0 -40
  363. package/dist/phases/code-review/index.js +0 -627
  364. package/dist/phases/code-testing/analyzer.d.ts +0 -19
  365. package/dist/phases/code-testing/analyzer.js +0 -215
  366. package/dist/phases/code-testing/context-fetcher.d.ts +0 -16
  367. package/dist/phases/code-testing/context-fetcher.js +0 -83
  368. package/dist/phases/code-testing/index.d.ts +0 -2
  369. package/dist/phases/code-testing/index.js +0 -2
  370. package/dist/phases/code-testing/prompts.d.ts +0 -3
  371. package/dist/phases/code-testing/prompts.js +0 -63
  372. package/dist/phases/data-flow/index.d.ts +0 -28
  373. package/dist/phases/data-flow/index.js +0 -286
  374. package/dist/phases/data-flow/mcp-server.d.ts +0 -85
  375. package/dist/phases/data-flow/mcp-server.js +0 -140
  376. package/dist/phases/data-flow/prompts.d.ts +0 -14
  377. package/dist/phases/data-flow/prompts.js +0 -36
  378. package/dist/phases/data-flow/types.d.ts +0 -71
  379. package/dist/phases/data-flow/types.js +0 -86
  380. package/dist/phases/diagram-shared/clone-repos.d.ts +0 -63
  381. package/dist/phases/diagram-shared/clone-repos.js +0 -153
  382. package/dist/phases/diagram-shared/generate.d.ts +0 -42
  383. package/dist/phases/diagram-shared/generate.js +0 -162
  384. package/dist/phases/diagram-shared/graph.d.ts +0 -62
  385. package/dist/phases/diagram-shared/graph.js +0 -169
  386. package/dist/phases/diagram-shared/mcp.d.ts +0 -35
  387. package/dist/phases/diagram-shared/mcp.js +0 -68
  388. package/dist/phases/diagram-shared/prompts.d.ts +0 -23
  389. package/dist/phases/diagram-shared/prompts.js +0 -35
  390. package/dist/phases/discover-services/index.d.ts +0 -29
  391. package/dist/phases/discover-services/index.js +0 -528
  392. package/dist/phases/er-diagram/index.d.ts +0 -28
  393. package/dist/phases/er-diagram/index.js +0 -290
  394. package/dist/phases/er-diagram/mcp-server.d.ts +0 -77
  395. package/dist/phases/er-diagram/mcp-server.js +0 -144
  396. package/dist/phases/er-diagram/prompts.d.ts +0 -14
  397. package/dist/phases/er-diagram/prompts.js +0 -36
  398. package/dist/phases/er-diagram/types.d.ts +0 -76
  399. package/dist/phases/er-diagram/types.js +0 -84
  400. package/dist/phases/features/index.d.ts +0 -65
  401. package/dist/phases/features/index.js +0 -292
  402. package/dist/phases/features/mcp-server.d.ts +0 -61
  403. package/dist/phases/features/mcp-server.js +0 -165
  404. package/dist/phases/features/prompts.d.ts +0 -32
  405. package/dist/phases/features/prompts.js +0 -92
  406. package/dist/phases/features/types.d.ts +0 -34
  407. package/dist/phases/features/types.js +0 -15
  408. package/dist/phases/financing-deck/agent.d.ts +0 -1
  409. package/dist/phases/financing-deck/agent.js +0 -96
  410. package/dist/phases/financing-deck/context.d.ts +0 -13
  411. package/dist/phases/financing-deck/context.js +0 -69
  412. package/dist/phases/financing-deck/index.d.ts +0 -15
  413. package/dist/phases/financing-deck/index.js +0 -89
  414. package/dist/phases/financing-deck/prompts.d.ts +0 -2
  415. package/dist/phases/financing-deck/prompts.js +0 -94
  416. package/dist/phases/find-architecture/index.d.ts +0 -47
  417. package/dist/phases/find-architecture/index.js +0 -261
  418. package/dist/phases/find-architecture/prompts.d.ts +0 -31
  419. package/dist/phases/find-architecture/prompts.js +0 -128
  420. package/dist/phases/find-architecture/state.d.ts +0 -21
  421. package/dist/phases/find-architecture/state.js +0 -17
  422. package/dist/phases/find-architecture/types.d.ts +0 -55
  423. package/dist/phases/find-architecture/types.js +0 -69
  424. package/dist/phases/find-bugs/index.d.ts +0 -33
  425. package/dist/phases/find-bugs/index.js +0 -236
  426. package/dist/phases/find-bugs/prompts.d.ts +0 -22
  427. package/dist/phases/find-bugs/prompts.js +0 -101
  428. package/dist/phases/find-bugs/state.d.ts +0 -19
  429. package/dist/phases/find-bugs/state.js +0 -13
  430. package/dist/phases/find-bugs/types.d.ts +0 -21
  431. package/dist/phases/find-bugs/types.js +0 -16
  432. package/dist/phases/find-features/index.d.ts +0 -40
  433. package/dist/phases/find-features/index.js +0 -328
  434. package/dist/phases/find-features/prompts.d.ts +0 -43
  435. package/dist/phases/find-features/prompts.js +0 -138
  436. package/dist/phases/find-features/state.d.ts +0 -25
  437. package/dist/phases/find-features/state.js +0 -22
  438. package/dist/phases/find-features/types.d.ts +0 -27
  439. package/dist/phases/find-features/types.js +0 -16
  440. package/dist/phases/find-shared/git.d.ts +0 -24
  441. package/dist/phases/find-shared/git.js +0 -60
  442. package/dist/phases/find-shared/mcp.d.ts +0 -48
  443. package/dist/phases/find-shared/mcp.js +0 -125
  444. package/dist/phases/find-shared/scan-state.d.ts +0 -33
  445. package/dist/phases/find-shared/scan-state.js +0 -112
  446. package/dist/phases/find-smells/index.d.ts +0 -50
  447. package/dist/phases/find-smells/index.js +0 -298
  448. package/dist/phases/find-smells/prompts.d.ts +0 -30
  449. package/dist/phases/find-smells/prompts.js +0 -129
  450. package/dist/phases/find-smells/state.d.ts +0 -21
  451. package/dist/phases/find-smells/state.js +0 -17
  452. package/dist/phases/find-smells/types.d.ts +0 -51
  453. package/dist/phases/find-smells/types.js +0 -64
  454. package/dist/phases/flow-shared/clone-repos.d.ts +0 -63
  455. package/dist/phases/flow-shared/clone-repos.js +0 -153
  456. package/dist/phases/flowchart/index.d.ts +0 -15
  457. package/dist/phases/flowchart/index.js +0 -50
  458. package/dist/phases/functional-testing/analyzer.d.ts +0 -46
  459. package/dist/phases/functional-testing/analyzer.js +0 -622
  460. package/dist/phases/functional-testing/context-fetcher.d.ts +0 -16
  461. package/dist/phases/functional-testing/context-fetcher.js +0 -83
  462. package/dist/phases/functional-testing/http-fallback.d.ts +0 -10
  463. package/dist/phases/functional-testing/http-fallback.js +0 -156
  464. package/dist/phases/functional-testing/index.d.ts +0 -4
  465. package/dist/phases/functional-testing/index.js +0 -4
  466. package/dist/phases/functional-testing/mcp-server.d.ts +0 -9
  467. package/dist/phases/functional-testing/mcp-server.js +0 -13
  468. package/dist/phases/functional-testing/prompts.d.ts +0 -2
  469. package/dist/phases/functional-testing/prompts.js +0 -58
  470. package/dist/phases/functional-testing/test-report-creator.d.ts +0 -68
  471. package/dist/phases/functional-testing/test-report-creator.js +0 -306
  472. package/dist/phases/functional-testing/test-retry-handler.d.ts +0 -16
  473. package/dist/phases/functional-testing/test-retry-handler.js +0 -70
  474. package/dist/phases/growth-analysis/agent.d.ts +0 -2
  475. package/dist/phases/growth-analysis/agent.js +0 -107
  476. package/dist/phases/growth-analysis/context.d.ts +0 -23
  477. package/dist/phases/growth-analysis/context.js +0 -137
  478. package/dist/phases/growth-analysis/index.d.ts +0 -32
  479. package/dist/phases/growth-analysis/index.js +0 -226
  480. package/dist/phases/growth-analysis/prompts.d.ts +0 -2
  481. package/dist/phases/growth-analysis/prompts.js +0 -45
  482. package/dist/phases/intelligence-analysis/agent.d.ts +0 -2
  483. package/dist/phases/intelligence-analysis/agent.js +0 -338
  484. package/dist/phases/intelligence-analysis/context.d.ts +0 -23
  485. package/dist/phases/intelligence-analysis/context.js +0 -142
  486. package/dist/phases/intelligence-analysis/index.d.ts +0 -58
  487. package/dist/phases/intelligence-analysis/index.js +0 -244
  488. package/dist/phases/intelligence-analysis/prompts.d.ts +0 -2
  489. package/dist/phases/intelligence-analysis/prompts.js +0 -62
  490. package/dist/phases/issue-analysis/agent.d.ts +0 -21
  491. package/dist/phases/issue-analysis/agent.js +0 -153
  492. package/dist/phases/issue-analysis/context.d.ts +0 -20
  493. package/dist/phases/issue-analysis/context.js +0 -93
  494. package/dist/phases/issue-analysis/index.d.ts +0 -8
  495. package/dist/phases/issue-analysis/index.js +0 -147
  496. package/dist/phases/issue-analysis/outcome.d.ts +0 -10
  497. package/dist/phases/issue-analysis/outcome.js +0 -42
  498. package/dist/phases/issue-analysis/prompts.d.ts +0 -8
  499. package/dist/phases/issue-analysis/prompts.js +0 -99
  500. package/dist/phases/issue-analysis-verification/agent.d.ts +0 -33
  501. package/dist/phases/issue-analysis-verification/agent.js +0 -124
  502. package/dist/phases/issue-analysis-verification/index.d.ts +0 -27
  503. package/dist/phases/issue-analysis-verification/index.js +0 -79
  504. package/dist/phases/issue-analysis-verification/prompts.d.ts +0 -9
  505. package/dist/phases/issue-analysis-verification/prompts.js +0 -75
  506. package/dist/phases/output-contracts.d.ts +0 -7
  507. package/dist/phases/output-contracts.js +0 -1201
  508. package/dist/phases/pr-execution/context.d.ts +0 -32
  509. package/dist/phases/pr-execution/context.js +0 -246
  510. package/dist/phases/pr-execution/file-assigner.d.ts +0 -57
  511. package/dist/phases/pr-execution/file-assigner.js +0 -287
  512. package/dist/phases/pr-execution/index.d.ts +0 -22
  513. package/dist/phases/pr-execution/index.js +0 -401
  514. package/dist/phases/pr-execution/outcome.d.ts +0 -24
  515. package/dist/phases/pr-execution/outcome.js +0 -34
  516. package/dist/phases/pr-execution/pr-executor.d.ts +0 -42
  517. package/dist/phases/pr-execution/pr-executor.js +0 -78
  518. package/dist/phases/pr-execution/prompts.d.ts +0 -27
  519. package/dist/phases/pr-execution/prompts.js +0 -131
  520. package/dist/phases/pr-resolve/checklist-learner.d.ts +0 -28
  521. package/dist/phases/pr-resolve/checklist-learner.js +0 -153
  522. package/dist/phases/pr-resolve/github-reply.d.ts +0 -16
  523. package/dist/phases/pr-resolve/github-reply.js +0 -75
  524. package/dist/phases/pr-resolve/index.d.ts +0 -33
  525. package/dist/phases/pr-resolve/index.js +0 -272
  526. package/dist/phases/pr-resolve/prompts.d.ts +0 -17
  527. package/dist/phases/pr-resolve/prompts.js +0 -107
  528. package/dist/phases/pr-resolve/types.d.ts +0 -18
  529. package/dist/phases/pr-resolve/types.js +0 -14
  530. package/dist/phases/pr-resolve/workspace.d.ts +0 -45
  531. package/dist/phases/pr-resolve/workspace.js +0 -174
  532. package/dist/phases/pr-review/index.d.ts +0 -27
  533. package/dist/phases/pr-review/index.js +0 -209
  534. package/dist/phases/pr-review/prompts.d.ts +0 -5
  535. package/dist/phases/pr-review/prompts.js +0 -87
  536. package/dist/phases/pr-shared/agent-utils.d.ts +0 -47
  537. package/dist/phases/pr-shared/agent-utils.js +0 -112
  538. package/dist/phases/pr-shared/context.d.ts +0 -24
  539. package/dist/phases/pr-shared/context.js +0 -78
  540. package/dist/phases/pr-shared/status.d.ts +0 -18
  541. package/dist/phases/pr-shared/status.js +0 -37
  542. package/dist/phases/pr-splitting/context.d.ts +0 -28
  543. package/dist/phases/pr-splitting/context.js +0 -182
  544. package/dist/phases/pr-splitting/import-dep-validator.d.ts +0 -67
  545. package/dist/phases/pr-splitting/import-dep-validator.js +0 -255
  546. package/dist/phases/pr-splitting/index.d.ts +0 -36
  547. package/dist/phases/pr-splitting/index.js +0 -413
  548. package/dist/phases/pr-splitting/outcome.d.ts +0 -24
  549. package/dist/phases/pr-splitting/outcome.js +0 -114
  550. package/dist/phases/pr-splitting/prompts.d.ts +0 -43
  551. package/dist/phases/pr-splitting/prompts.js +0 -154
  552. package/dist/phases/product-techniques/index.d.ts +0 -52
  553. package/dist/phases/product-techniques/index.js +0 -268
  554. package/dist/phases/product-techniques/mcp-server.d.ts +0 -41
  555. package/dist/phases/product-techniques/mcp-server.js +0 -96
  556. package/dist/phases/product-techniques/prompts.d.ts +0 -19
  557. package/dist/phases/product-techniques/prompts.js +0 -66
  558. package/dist/phases/product-techniques/types.d.ts +0 -13
  559. package/dist/phases/product-techniques/types.js +0 -13
  560. package/dist/phases/product-test-cases/index.d.ts +0 -25
  561. package/dist/phases/product-test-cases/index.js +0 -174
  562. package/dist/phases/product-test-cases/prompts.d.ts +0 -24
  563. package/dist/phases/product-test-cases/prompts.js +0 -80
  564. package/dist/phases/product-test-cases/types.d.ts +0 -17
  565. package/dist/phases/product-test-cases/types.js +0 -27
  566. package/dist/phases/pull-request/creator.d.ts +0 -30
  567. package/dist/phases/pull-request/creator.js +0 -319
  568. package/dist/phases/pull-request/handler.d.ts +0 -15
  569. package/dist/phases/pull-request/handler.js +0 -92
  570. package/dist/phases/quality-benchmark/index.d.ts +0 -65
  571. package/dist/phases/quality-benchmark/index.js +0 -194
  572. package/dist/phases/quality-benchmark/mcp-server.d.ts +0 -46
  573. package/dist/phases/quality-benchmark/mcp-server.js +0 -252
  574. package/dist/phases/quality-benchmark/parsers.d.ts +0 -22
  575. package/dist/phases/quality-benchmark/parsers.js +0 -1101
  576. package/dist/phases/quality-benchmark/prompts.d.ts +0 -31
  577. package/dist/phases/quality-benchmark/prompts.js +0 -154
  578. package/dist/phases/quality-benchmark/rubric.md +0 -1174
  579. package/dist/phases/quality-benchmark/tool-catalog.d.ts +0 -33
  580. package/dist/phases/quality-benchmark/tool-catalog.js +0 -636
  581. package/dist/phases/quality-benchmark/tool-runner.d.ts +0 -69
  582. package/dist/phases/quality-benchmark/tool-runner.js +0 -399
  583. package/dist/phases/quality-benchmark/types.d.ts +0 -312
  584. package/dist/phases/quality-benchmark/types.js +0 -23
  585. package/dist/phases/quality-benchmark/workspace.d.ts +0 -31
  586. package/dist/phases/quality-benchmark/workspace.js +0 -110
  587. package/dist/phases/recipes/index.d.ts +0 -63
  588. package/dist/phases/recipes/index.js +0 -358
  589. package/dist/phases/recipes/mcp-server.d.ts +0 -66
  590. package/dist/phases/recipes/mcp-server.js +0 -229
  591. package/dist/phases/recipes/prompts.d.ts +0 -35
  592. package/dist/phases/recipes/prompts.js +0 -105
  593. package/dist/phases/recipes/types.d.ts +0 -42
  594. package/dist/phases/recipes/types.js +0 -16
  595. package/dist/phases/release-sync/github.d.ts +0 -66
  596. package/dist/phases/release-sync/github.js +0 -140
  597. package/dist/phases/release-sync/index.d.ts +0 -24
  598. package/dist/phases/release-sync/index.js +0 -156
  599. package/dist/phases/release-sync/snapshot.d.ts +0 -27
  600. package/dist/phases/release-sync/snapshot.js +0 -158
  601. package/dist/phases/run-sheet/agent.d.ts +0 -49
  602. package/dist/phases/run-sheet/agent.js +0 -156
  603. package/dist/phases/run-sheet/index.d.ts +0 -57
  604. package/dist/phases/run-sheet/index.js +0 -392
  605. package/dist/phases/screen-flow/index.d.ts +0 -26
  606. package/dist/phases/screen-flow/index.js +0 -349
  607. package/dist/phases/screen-flow/mcp-server.d.ts +0 -201
  608. package/dist/phases/screen-flow/mcp-server.js +0 -272
  609. package/dist/phases/screen-flow/prompts.d.ts +0 -19
  610. package/dist/phases/screen-flow/prompts.js +0 -43
  611. package/dist/phases/screen-flow/theme.d.ts +0 -19
  612. package/dist/phases/screen-flow/theme.js +0 -193
  613. package/dist/phases/screen-flow/types.d.ts +0 -137
  614. package/dist/phases/screen-flow/types.js +0 -81
  615. package/dist/phases/sequence-diagram/index.d.ts +0 -30
  616. package/dist/phases/sequence-diagram/index.js +0 -290
  617. package/dist/phases/sequence-diagram/mcp-server.d.ts +0 -64
  618. package/dist/phases/sequence-diagram/mcp-server.js +0 -134
  619. package/dist/phases/sequence-diagram/prompts.d.ts +0 -14
  620. package/dist/phases/sequence-diagram/prompts.js +0 -36
  621. package/dist/phases/sequence-diagram/types.d.ts +0 -52
  622. package/dist/phases/sequence-diagram/types.js +0 -93
  623. package/dist/phases/smoke-test/agent.d.ts +0 -12
  624. package/dist/phases/smoke-test/agent.js +0 -93
  625. package/dist/phases/smoke-test/index.d.ts +0 -22
  626. package/dist/phases/smoke-test/index.js +0 -241
  627. package/dist/phases/smoke-test/prompts.d.ts +0 -15
  628. package/dist/phases/smoke-test/prompts.js +0 -35
  629. package/dist/phases/state-diagram/index.d.ts +0 -15
  630. package/dist/phases/state-diagram/index.js +0 -53
  631. package/dist/phases/sync-github-issues/index.d.ts +0 -41
  632. package/dist/phases/sync-github-issues/index.js +0 -187
  633. package/dist/phases/sync-github-issues/state.d.ts +0 -26
  634. package/dist/phases/sync-github-issues/state.js +0 -18
  635. package/dist/phases/sync-github-issues/types.d.ts +0 -35
  636. package/dist/phases/sync-github-issues/types.js +0 -6
  637. package/dist/phases/sync-github-pull-requests/index.d.ts +0 -23
  638. package/dist/phases/sync-github-pull-requests/index.js +0 -210
  639. package/dist/phases/sync-github-pull-requests/state.d.ts +0 -24
  640. package/dist/phases/sync-github-pull-requests/state.js +0 -16
  641. package/dist/phases/sync-github-pull-requests/types.d.ts +0 -22
  642. package/dist/phases/sync-github-pull-requests/types.js +0 -1
  643. package/dist/phases/sync-org-repos/index.d.ts +0 -28
  644. package/dist/phases/sync-org-repos/index.js +0 -133
  645. package/dist/phases/sync-sentry-issues/index.d.ts +0 -29
  646. package/dist/phases/sync-sentry-issues/index.js +0 -153
  647. package/dist/phases/sync-sentry-issues/sentry-client.d.ts +0 -66
  648. package/dist/phases/sync-sentry-issues/sentry-client.js +0 -221
  649. package/dist/phases/sync-sentry-issues/state.d.ts +0 -23
  650. package/dist/phases/sync-sentry-issues/state.js +0 -18
  651. package/dist/phases/sync-sentry-issues/types.d.ts +0 -46
  652. package/dist/phases/sync-sentry-issues/types.js +0 -6
  653. package/dist/phases/sync-shared/mcp.d.ts +0 -81
  654. package/dist/phases/sync-shared/mcp.js +0 -111
  655. package/dist/phases/task/agent.d.ts +0 -10
  656. package/dist/phases/task/agent.js +0 -83
  657. package/dist/phases/task/context.d.ts +0 -16
  658. package/dist/phases/task/context.js +0 -50
  659. package/dist/phases/task/index.d.ts +0 -17
  660. package/dist/phases/task/index.js +0 -54
  661. package/dist/phases/task/prompts.d.ts +0 -9
  662. package/dist/phases/task/prompts.js +0 -21
  663. package/dist/phases/technical-design/context.d.ts +0 -12
  664. package/dist/phases/technical-design/context.js +0 -39
  665. package/dist/phases/technical-design/index.d.ts +0 -21
  666. package/dist/phases/technical-design/index.js +0 -456
  667. package/dist/phases/technical-design/outcome.d.ts +0 -25
  668. package/dist/phases/technical-design/outcome.js +0 -41
  669. package/dist/phases/technical-design/prompts.d.ts +0 -8
  670. package/dist/phases/technical-design/prompts.js +0 -210
  671. package/dist/phases/technical-design-verification/agent.d.ts +0 -53
  672. package/dist/phases/technical-design-verification/agent.js +0 -186
  673. package/dist/phases/technical-design-verification/index.d.ts +0 -38
  674. package/dist/phases/technical-design-verification/index.js +0 -152
  675. package/dist/phases/technical-design-verification/prompts.d.ts +0 -12
  676. package/dist/phases/technical-design-verification/prompts.js +0 -143
  677. package/dist/phases/test-cases-analysis/agent.d.ts +0 -9
  678. package/dist/phases/test-cases-analysis/agent.js +0 -105
  679. package/dist/phases/test-cases-analysis/context.d.ts +0 -15
  680. package/dist/phases/test-cases-analysis/context.js +0 -86
  681. package/dist/phases/test-cases-analysis/formatters.d.ts +0 -6
  682. package/dist/phases/test-cases-analysis/formatters.js +0 -35
  683. package/dist/phases/test-cases-analysis/index.d.ts +0 -9
  684. package/dist/phases/test-cases-analysis/index.js +0 -175
  685. package/dist/phases/test-cases-analysis/outcome.d.ts +0 -27
  686. package/dist/phases/test-cases-analysis/outcome.js +0 -146
  687. package/dist/phases/test-cases-analysis/prompts.d.ts +0 -7
  688. package/dist/phases/test-cases-analysis/prompts.js +0 -171
  689. package/dist/phases/user-psychology/agent.d.ts +0 -16
  690. package/dist/phases/user-psychology/agent.js +0 -105
  691. package/dist/phases/user-psychology/context.d.ts +0 -10
  692. package/dist/phases/user-psychology/context.js +0 -65
  693. package/dist/phases/user-psychology/index.d.ts +0 -18
  694. package/dist/phases/user-psychology/index.js +0 -96
  695. package/dist/phases/user-psychology/prompts.d.ts +0 -2
  696. package/dist/phases/user-psychology/prompts.js +0 -41
  697. package/dist/phases/user-stories-analysis/agent.d.ts +0 -9
  698. package/dist/phases/user-stories-analysis/agent.js +0 -105
  699. package/dist/phases/user-stories-analysis/context.d.ts +0 -15
  700. package/dist/phases/user-stories-analysis/context.js +0 -86
  701. package/dist/phases/user-stories-analysis/formatters.d.ts +0 -6
  702. package/dist/phases/user-stories-analysis/formatters.js +0 -32
  703. package/dist/phases/user-stories-analysis/index.d.ts +0 -9
  704. package/dist/phases/user-stories-analysis/index.js +0 -175
  705. package/dist/phases/user-stories-analysis/outcome.d.ts +0 -27
  706. package/dist/phases/user-stories-analysis/outcome.js +0 -146
  707. package/dist/phases/user-stories-analysis/prompts.d.ts +0 -7
  708. package/dist/phases/user-stories-analysis/prompts.js +0 -194
  709. package/dist/services/audit-logs.d.ts +0 -73
  710. package/dist/services/audit-logs.js +0 -174
  711. package/dist/services/branches.d.ts +0 -103
  712. package/dist/services/branches.js +0 -391
  713. package/dist/services/checklist.d.ts +0 -100
  714. package/dist/services/checklist.js +0 -259
  715. package/dist/services/coaching/coaching-agent.d.ts +0 -39
  716. package/dist/services/coaching/coaching-agent.js +0 -308
  717. package/dist/services/coaching/coaching-loop.d.ts +0 -62
  718. package/dist/services/coaching/coaching-loop.js +0 -265
  719. package/dist/services/coaching/index.d.ts +0 -8
  720. package/dist/services/coaching/index.js +0 -8
  721. package/dist/services/coaching/phase-coaching.d.ts +0 -47
  722. package/dist/services/coaching/phase-coaching.js +0 -60
  723. package/dist/services/coaching/self-rating.d.ts +0 -26
  724. package/dist/services/coaching/self-rating.js +0 -153
  725. package/dist/services/feedbacks.d.ts +0 -57
  726. package/dist/services/feedbacks.js +0 -264
  727. package/dist/services/phase-hooks/bindings-fetcher.d.ts +0 -21
  728. package/dist/services/phase-hooks/bindings-fetcher.js +0 -53
  729. package/dist/services/phase-hooks/hook-executor.d.ts +0 -36
  730. package/dist/services/phase-hooks/hook-executor.js +0 -167
  731. package/dist/services/phase-hooks/hook-logging.d.ts +0 -14
  732. package/dist/services/phase-hooks/hook-logging.js +0 -41
  733. package/dist/services/phase-hooks/hook-runner.d.ts +0 -19
  734. package/dist/services/phase-hooks/hook-runner.js +0 -83
  735. package/dist/services/phase-hooks/index.d.ts +0 -10
  736. package/dist/services/phase-hooks/index.js +0 -9
  737. package/dist/services/phase-hooks/plugin-loader.d.ts +0 -31
  738. package/dist/services/phase-hooks/plugin-loader.js +0 -207
  739. package/dist/services/phase-hooks/types.d.ts +0 -69
  740. package/dist/services/phase-hooks/types.js +0 -8
  741. package/dist/services/phase-ratings.d.ts +0 -70
  742. package/dist/services/phase-ratings.js +0 -143
  743. package/dist/services/product-logs.d.ts +0 -31
  744. package/dist/services/product-logs.js +0 -94
  745. package/dist/services/pull-requests.d.ts +0 -57
  746. package/dist/services/pull-requests.js +0 -186
  747. package/dist/services/quality-reports.d.ts +0 -45
  748. package/dist/services/quality-reports.js +0 -93
  749. package/dist/services/repo-config.d.ts +0 -17
  750. package/dist/services/repo-config.js +0 -50
  751. package/dist/services/skill-resolver.d.ts +0 -46
  752. package/dist/services/skill-resolver.js +0 -123
  753. package/dist/services/video/device-frames.d.ts +0 -34
  754. package/dist/services/video/device-frames.js +0 -513
  755. package/dist/services/video/index.d.ts +0 -66
  756. package/dist/services/video/index.js +0 -238
  757. package/dist/services/video/retry.d.ts +0 -20
  758. package/dist/services/video/retry.js +0 -76
  759. package/dist/services/video/screenshot-generator.d.ts +0 -69
  760. package/dist/services/video/screenshot-generator.js +0 -259
  761. package/dist/services/video/tts-generator.d.ts +0 -40
  762. package/dist/services/video/tts-generator.js +0 -121
  763. package/dist/services/video/video-assembler.d.ts +0 -45
  764. package/dist/services/video/video-assembler.js +0 -351
  765. package/dist/services/video/video-uploader.d.ts +0 -28
  766. package/dist/services/video/video-uploader.js +0 -108
  767. package/dist/skills/phase/adr-generation/SKILL.md +0 -51
  768. package/dist/skills/phase/analyze-logs/SKILL.md +0 -24
  769. package/dist/skills/phase/app-store-generation/SKILL.md +0 -60
  770. package/dist/skills/phase/architecture-diagram/SKILL.md +0 -41
  771. package/dist/skills/phase/autonomous/SKILL.md +0 -52
  772. package/dist/skills/phase/branch-planning/SKILL.md +0 -55
  773. package/dist/skills/phase/bug-fixing/SKILL.md +0 -47
  774. package/dist/skills/phase/class-diagram/SKILL.md +0 -44
  775. package/dist/skills/phase/code-implementation/SKILL.md +0 -68
  776. package/dist/skills/phase/code-implementation-verification/SKILL.md +0 -76
  777. package/dist/skills/phase/code-refine/SKILL.md +0 -62
  778. package/dist/skills/phase/code-testing/SKILL.md +0 -78
  779. package/dist/skills/phase/data-flow/SKILL.md +0 -82
  780. package/dist/skills/phase/er-diagram/SKILL.md +0 -71
  781. package/dist/skills/phase/flowchart/SKILL.md +0 -38
  782. package/dist/skills/phase/functional-testing/SKILL.md +0 -62
  783. package/dist/skills/phase/growth-analysis/SKILL.md +0 -97
  784. package/dist/skills/phase/incremental-sync/SKILL.md +0 -59
  785. package/dist/skills/phase/intelligence-analysis/SKILL.md +0 -52
  786. package/dist/skills/phase/issue-analysis/SKILL.md +0 -73
  787. package/dist/skills/phase/issue-analysis-verification/SKILL.md +0 -61
  788. package/dist/skills/phase/pr-execution/SKILL.md +0 -69
  789. package/dist/skills/phase/pr-splitting/SKILL.md +0 -78
  790. package/dist/skills/phase/screen-flow/SKILL.md +0 -78
  791. package/dist/skills/phase/sequence-diagram/SKILL.md +0 -67
  792. package/dist/skills/phase/smoke-test/SKILL.md +0 -80
  793. package/dist/skills/phase/state-diagram/SKILL.md +0 -38
  794. package/dist/skills/phase/task/SKILL.md +0 -19
  795. package/dist/skills/phase/technical-design/SKILL.md +0 -75
  796. package/dist/skills/phase/technical-design-verification/SKILL.md +0 -43
  797. package/dist/skills/phase/test-cases-analysis/SKILL.md +0 -88
  798. package/dist/skills/phase/user-psychology/SKILL.md +0 -135
  799. package/dist/skills/phase/user-stories-analysis/SKILL.md +0 -118
  800. package/dist/supabase/client.d.ts +0 -34
  801. package/dist/supabase/client.js +0 -123
  802. package/dist/system/session-manager.d.ts +0 -67
  803. package/dist/system/session-manager.js +0 -300
  804. package/dist/system/sleep-notification.d.ts +0 -15
  805. package/dist/system/sleep-notification.js +0 -108
  806. package/dist/system/sleep-prevention.d.ts +0 -20
  807. package/dist/system/sleep-prevention.js +0 -112
  808. package/dist/tools/bootstrap.d.ts +0 -45
  809. package/dist/tools/bootstrap.js +0 -50
  810. package/dist/types/external-sources.d.ts +0 -22
  811. package/dist/types/external-sources.js +0 -23
  812. package/dist/types/index.d.ts +0 -206
  813. package/dist/types/index.js +0 -1
  814. package/dist/types/issues.d.ts +0 -37
  815. package/dist/types/issues.js +0 -1
  816. package/dist/types/llm-responses.d.ts +0 -114
  817. package/dist/types/llm-responses.js +0 -9
  818. package/dist/types/pipeline.d.ts +0 -28
  819. package/dist/types/pipeline.js +0 -4
  820. package/dist/updater/auto-updater.d.ts +0 -39
  821. package/dist/updater/auto-updater.js +0 -134
  822. package/dist/utils/conflict-resolver.d.ts +0 -49
  823. package/dist/utils/conflict-resolver.js +0 -201
  824. package/dist/utils/formatters.d.ts +0 -42
  825. package/dist/utils/formatters.js +0 -166
  826. package/dist/utils/git-branch-manager-async.d.ts +0 -127
  827. package/dist/utils/git-branch-manager-async.js +0 -425
  828. package/dist/utils/git-branch-manager.d.ts +0 -160
  829. package/dist/utils/git-branch-manager.js +0 -613
  830. package/dist/utils/git-push.d.ts +0 -43
  831. package/dist/utils/git-push.js +0 -136
  832. package/dist/utils/github-repo-info.d.ts +0 -26
  833. package/dist/utils/github-repo-info.js +0 -45
  834. package/dist/utils/image-downloader.d.ts +0 -32
  835. package/dist/utils/image-downloader.js +0 -152
  836. package/dist/utils/issue-phase-cli.d.ts +0 -26
  837. package/dist/utils/issue-phase-cli.js +0 -44
  838. package/dist/utils/json-extract.d.ts +0 -6
  839. package/dist/utils/json-extract.js +0 -44
  840. package/dist/utils/json-extractor.d.ts +0 -27
  841. package/dist/utils/json-extractor.js +0 -102
  842. package/dist/utils/logger.d.ts +0 -35
  843. package/dist/utils/logger.js +0 -167
  844. package/dist/utils/pipeline-logger.d.ts +0 -8
  845. package/dist/utils/pipeline-logger.js +0 -38
  846. package/dist/utils/validation.d.ts +0 -68
  847. package/dist/utils/validation.js +0 -229
  848. package/dist/utils/workflow-utils.d.ts +0 -22
  849. package/dist/utils/workflow-utils.js +0 -48
  850. package/dist/workspace/session-workspace.d.ts +0 -43
  851. package/dist/workspace/session-workspace.js +0 -90
  852. package/dist/workspace/workspace-manager.d.ts +0 -105
  853. package/dist/workspace/workspace-manager.js +0 -280
package/dist/index.js CHANGED
@@ -1,1242 +1,1363 @@
1
1
  #!/usr/bin/env node
2
- import { Command } from 'commander';
3
- import { config as dotenvConfig } from 'dotenv';
4
- import { readFileSync } from 'fs';
5
- import { dirname, join } from 'path';
6
- import { fileURLToPath } from 'url';
7
- import { applyEnvStore } from './auth/env-store.js';
8
- import { runLogin, runLogout, runStatus } from './auth/login.js';
9
- import { runAdr } from './commands/adr/index.js';
10
- import { runAgentWorkflow } from './commands/agent-workflow/index.js';
11
- import { runAnalyzeLogs } from './commands/analyze-logs/index.js';
12
- import { runAppStoreGeneration } from './commands/app-store/index.js';
13
- import { runArchitectureDiagram } from './commands/architecture-diagram/index.js';
14
- import { runBuild } from './commands/build/index.js';
15
- import { runChatServeCommand } from './commands/chat-serve/index.js';
16
- import { runChecklists } from './commands/checklists/index.js';
17
- import { runClassDiagram } from './commands/class-diagram/index.js';
18
- import { runCodeReview } from './commands/code-review/index.js';
19
- import { runConfigGet, runConfigList, runConfigSet, runConfigUnset, } from './commands/config/index.js';
20
- import { runDataFlow } from './commands/data-flow/index.js';
21
- import { runDiscover } from './commands/discover/index.js';
22
- import { runErDiagram } from './commands/er-diagram/index.js';
23
- import { runFeatures } from './commands/features/index.js';
24
- import { runFinancingDeck } from './commands/financing-deck/index.js';
25
- import { runFindArchitecture } from './commands/find-architecture/index.js';
26
- import { runFindBugs } from './commands/find-bugs/index.js';
27
- import { runFindFeatures } from './commands/find-features/index.js';
28
- import { parseCategoriesOption, runFindSmells, } from './commands/find-smells/index.js';
29
- import { runFlowchart } from './commands/flowchart/index.js';
30
- import { runGrowthAnalysis } from './commands/growth-analysis/index.js';
31
- import { runInit } from './commands/init/index.js';
32
- import { runIntelligence } from './commands/intelligence/index.js';
33
- import { runIssueAnalysisCommand } from './commands/issue-analysis/index.js';
34
- import { runPRResolve } from './commands/pr-resolve/index.js';
35
- import { runPRReview } from './commands/pr-review/index.js';
36
- import { runProductTestCases } from './commands/product-test-cases/index.js';
37
- import { runQualityBenchmarkCli } from './commands/quality-benchmark/index.js';
38
- import { runRecipes } from './commands/recipes/index.js';
39
- import { runRefactor } from './commands/refactor/refactor.js';
40
- import { runReleaseSyncCommand } from './commands/release-sync/index.js';
41
- import { runRunSheetCommand } from './commands/run-sheet/index.js';
42
- import { runScreenFlow } from './commands/screen-flow/index.js';
43
- import { runSequenceDiagram } from './commands/sequence-diagram/index.js';
44
- import { runSessionServeCommand } from './commands/session-serve/index.js';
45
- import { runSessionTurnCommand } from './commands/session-turn/index.js';
46
- import { runSmokeTestCommand } from './commands/smoke-test/index.js';
47
- import { runStateDiagram } from './commands/state-diagram/index.js';
48
- import { runSyncAws } from './commands/sync-aws/index.js';
49
- import { runSyncDatadog } from './commands/sync-datadog/index.js';
50
- import { runSyncGithubIssues } from './commands/sync-github-issues/index.js';
51
- import { runSyncGithubPullRequests } from './commands/sync-github-pull-requests/index.js';
52
- import { runSyncOrgRepos } from './commands/sync-org-repos/index.js';
53
- import { runSyncSentryIssues } from './commands/sync-sentry-issues/index.js';
54
- import { runSyncTerraform } from './commands/sync-terraform/index.js';
55
- import { runTaskWorker } from './commands/task-worker/index.js';
56
- import { runTechnicalDesignCommand } from './commands/technical-design/index.js';
57
- import { runTestCasesAnalysisCommand } from './commands/test-cases-analysis/index.js';
58
- import { runUserPsychologyAnalysis } from './commands/user-psychology/index.js';
59
- import { runUserStoriesAnalysisCommand } from './commands/user-stories-analysis/index.js';
60
- import { runWorkflow } from './commands/workflow/index.js';
61
- import { DEFAULT_MAX_FILES as FIND_ARCHITECTURE_DEFAULT_MAX_FILES } from './phases/find-architecture/index.js';
62
- import { DEFAULT_MAX_FILES as FIND_SMELLS_DEFAULT_MAX_FILES } from './phases/find-smells/index.js';
63
- import { SMELL_CATEGORIES, } from './phases/find-smells/types.js';
64
- import { deregisterSession, registerSession, startHeartbeat, } from './system/session-manager.js';
65
- import { logError, logInfo } from './utils/logger.js';
66
- // Get package.json version dynamically
67
- // eslint-disable-next-line @typescript-eslint/naming-convention -- ESM __filename/__dirname polyfill
68
- const __filename = fileURLToPath(import.meta.url);
69
- // eslint-disable-next-line @typescript-eslint/naming-convention -- ESM __filename/__dirname polyfill
70
- const __dirname = dirname(__filename);
71
- const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
72
- const { version } = packageJson;
73
- // Load environment variables (each only sets vars not already defined):
74
- // 1. Real environment variables (highest priority - already in process.env)
75
- // 2. .env file in cwd (medium priority - loaded first)
76
- // 3. ~/.edsger/env.json (lowest priority - loaded last)
77
- dotenvConfig({ path: join(process.cwd(), '.env') });
78
- applyEnvStore();
79
- const program = new Command();
80
- program
81
- .name('edsger')
82
- .description('AI-powered workflow automation and code review CLI tool')
83
- .version(version);
84
- // When the desktop app spawns a streamed CLI it sets EDSGER_PROCESS_KEY (its
85
- // process-registry key with the `:output` marker stripped, e.g.
86
- // `sync-terraform` or `recipes:<productId>`). Open a cli_sessions row whose
87
- // `command` is that key so the originating tab can find the still-running
88
- // session and replay its logs across tab switches / restarts / devices.
89
- // registerSession is idempotent: commands that open their own (richer) session
90
- // just enrich the row started here (the process key stays in `command`), and
91
- // deregisterSession is a no-op once they've closed it.
92
- program.hook('preAction', async (_thisCommand, actionCommand) => {
93
- if (process.env.EDSGER_PROCESS_KEY) {
94
- await registerSession({ command: actionCommand.name() });
95
- // Keep last_heartbeat fresh while the run is alive, so consumers of the
96
- // cli_sessions row (the desktop's tab views) can tell a live session from
97
- // a stale one left behind by a crash / SIGKILL.
98
- startHeartbeat();
99
- }
100
- });
101
- program.hook('postAction', async () => {
102
- if (process.env.EDSGER_PROCESS_KEY) {
103
- await deregisterSession();
104
- }
105
- });
106
- /**
107
- * Mark the session row stopped (bounded, best-effort) and exit non-zero.
108
- *
109
- * Every command's catch block used to call `process.exit(1)` directly, which
110
- * skips the postAction hook above — the cli_sessions row stayed 'running'
111
- * forever and the desktop kept showing a ghost in-progress run that no Stop
112
- * button could clear.
113
- */
114
- function exitWithError(error) {
115
- logError(error instanceof Error ? error.message : String(error));
116
- void Promise.race([
117
- deregisterSession(),
118
- new Promise((resolve) => {
119
- setTimeout(resolve, 3000);
120
- }),
121
- ]).finally(() => process.exit(1));
122
- }
123
- // The desktop's Stop button sends SIGTERM (escalating to SIGKILL after 5s).
124
- // Without a handler the process dies with its cli_sessions row still
125
- // 'running' same ghost-run problem as the error path above. Finalize the
126
- // row (bounded) before exiting. Commands that install their own handlers
127
- // (build, agent-workflow, task-worker, chat-serve, ...) own the process
128
- // lifetime; in that case only the session row is finalized here.
129
- for (const signal of ['SIGTERM', 'SIGINT']) {
130
- const onTermination = () => {
131
- const finalize = Promise.race([
132
- deregisterSession(),
133
- new Promise((resolve) => {
134
- setTimeout(resolve, 3000);
135
- }),
136
- ]);
137
- const others = process
138
- .listeners(signal)
139
- .filter((listener) => listener !== onTermination);
140
- if (others.length === 0) {
141
- void finalize.finally(() => process.exit(signal === 'SIGINT' ? 130 : 143));
142
- }
143
- };
144
- process.on(signal, onTermination);
145
- }
146
- // ============================================================
147
- // Subcommand: edsger login
148
- // ============================================================
149
- program
150
- .command('login')
151
- .description('Authenticate with edsger.ai - opens browser to get a CLI token')
152
- .action(async () => {
153
- try {
154
- await runLogin();
155
- }
156
- catch (error) {
157
- exitWithError(error);
158
- }
159
- });
160
- // ============================================================
161
- // Subcommand: edsger logout
162
- // ============================================================
163
- program
164
- .command('logout')
165
- .description('Remove stored authentication credentials')
166
- .action(() => {
167
- try {
168
- runLogout();
169
- }
170
- catch (error) {
171
- exitWithError(error);
172
- }
173
- });
174
- // ============================================================
175
- // Subcommand: edsger status
176
- // ============================================================
177
- program
178
- .command('status')
179
- .description('Show current login and session status')
180
- .action(() => {
181
- try {
182
- runStatus();
183
- }
184
- catch (error) {
185
- exitWithError(error);
186
- }
187
- });
188
- // ============================================================
189
- // Subcommand: edsger config set/get/list/unset
190
- // ============================================================
191
- const configCmd = program
192
- .command('config')
193
- .description('Manage CLI environment variables (stored in ~/.edsger/env.json)');
194
- configCmd
195
- .command('set <key=value>')
196
- .description('Set an environment variable (e.g., edsger config set ELEVENLABS_API_KEY=sk-xxx)')
197
- .action((pair) => {
198
- runConfigSet(pair);
199
- });
200
- configCmd
201
- .command('get <key>')
202
- .description('Get the value of a stored environment variable')
203
- .action((key) => {
204
- runConfigGet(key);
205
- });
206
- configCmd
207
- .command('unset <key>')
208
- .description('Remove a stored environment variable')
209
- .action((key) => {
210
- runConfigUnset(key);
211
- });
212
- configCmd
213
- .command('list')
214
- .description('List all stored environment variables')
215
- .action(() => {
216
- runConfigList();
217
- });
218
- // ============================================================
219
- // Subcommand: edsger growth <productId>
220
- // ============================================================
221
- program
222
- .command('growth <productId>')
223
- .description('Run AI-powered growth analysis for a product')
224
- .option('-v, --verbose', 'Verbose output')
225
- .option('-g, --guidance <text>', 'Human direction for the AI (themes, audience, tone, etc.)')
226
- .option('--analysis-id <id>', 'Update an existing pending analysis instead of creating new')
227
- .action(async (productId, opts) => {
228
- try {
229
- await runGrowthAnalysis({
230
- growthAnalysis: productId,
231
- verbose: opts.verbose,
232
- growthGuidance: opts.guidance,
233
- growthAnalysisId: opts.analysisId,
234
- });
235
- }
236
- catch (error) {
237
- exitWithError(error);
238
- }
239
- });
240
- // ============================================================
241
- // Subcommand: edsger screen-flow <productId>
242
- // ============================================================
243
- program
244
- .command('screen-flow [productId]')
245
- .description('Generate a structured screen flow (screens + transitions) for a product (or standalone repository) from its source code')
246
- .requiredOption('--diagram-id <id>', 'Pending diagrams row id to populate')
247
- .option('--repo-id <id>', 'Run in repo-only mode against a single repositories row (no product context)')
248
- .option('-g, --guidance <text>', 'Human direction for the AI (focus areas, exclusions)')
249
- .option('-v, --verbose', 'Verbose output')
250
- .action(async (productId, opts) => {
251
- try {
252
- if (!productId && !opts.repoId) {
253
- throw new Error('Provide a productId or --repo-id (repo-only mode) for screen-flow');
254
- }
255
- await runScreenFlow(productId, {
256
- diagramId: opts.diagramId,
257
- repoId: opts.repoId,
258
- guidance: opts.guidance,
259
- verbose: opts.verbose,
260
- });
261
- }
262
- catch (error) {
263
- exitWithError(error);
264
- }
265
- });
266
- // ============================================================
267
- // Subcommand: edsger data-flow <productId>
268
- // ============================================================
269
- program
270
- .command('data-flow [productId]')
271
- .description('Generate a structured data flow (sources, datasets, transforms, sinks, queues, models) for a product (or standalone repository) from its source code')
272
- .requiredOption('--diagram-id <id>', 'Pending diagrams row id to populate')
273
- .option('--repo-id <id>', 'Run in repo-only mode against a single repositories row (no product context)')
274
- .option('-g, --guidance <text>', 'Human direction for the AI (focus areas, exclusions)')
275
- .option('-v, --verbose', 'Verbose output')
276
- .action(async (productId, opts) => {
277
- try {
278
- if (!productId && !opts.repoId) {
279
- throw new Error('Provide a productId or --repo-id (repo-only mode) for data-flow');
280
- }
281
- await runDataFlow(productId, {
282
- diagramId: opts.diagramId,
283
- repoId: opts.repoId,
284
- guidance: opts.guidance,
285
- verbose: opts.verbose,
286
- });
287
- }
288
- catch (error) {
289
- exitWithError(error);
290
- }
291
- });
292
- // ============================================================
293
- // Subcommand: edsger er-diagram <productId>
294
- // ============================================================
295
- program
296
- .command('er-diagram [productId]')
297
- .description('Generate a structured entity-relationship diagram (tables, views, enums, junctions + their relationships) for a product (or standalone repository) from its schema source')
298
- .requiredOption('--diagram-id <id>', 'Pending diagrams row id to populate')
299
- .option('--repo-id <id>', 'Run in repo-only mode against a single repositories row (no product context)')
300
- .option('-g, --guidance <text>', 'Human direction for the AI (focus areas, exclusions)')
301
- .option('-v, --verbose', 'Verbose output')
302
- .action(async (productId, opts) => {
303
- try {
304
- if (!productId && !opts.repoId) {
305
- throw new Error('Provide a productId or --repo-id (repo-only mode) for er-diagram');
306
- }
307
- await runErDiagram(productId, {
308
- diagramId: opts.diagramId,
309
- repoId: opts.repoId,
310
- guidance: opts.guidance,
311
- verbose: opts.verbose,
312
- });
313
- }
314
- catch (error) {
315
- exitWithError(error);
316
- }
317
- });
318
- // ============================================================
319
- // Subcommand: edsger sequence-diagram <productId>
320
- // ============================================================
321
- program
322
- .command('sequence-diagram [productId]')
323
- .description('Generate a structured sequence diagram (participants + ordered messages for one scenario) for a product (or standalone repository) from its source code')
324
- .requiredOption('--diagram-id <id>', 'Pending diagrams row id to populate')
325
- .option('--repo-id <id>', 'Run in repo-only mode against a single repositories row (no product context)')
326
- .option('-g, --guidance <text>', 'Human direction for the AI — the scenario to map (e.g. "user checkout")')
327
- .option('-v, --verbose', 'Verbose output')
328
- .action(async (productId, opts) => {
2
+
3
+ // src/index.ts
4
+ import { resolve as resolve2 } from "path";
5
+ import { Command, Option } from "commander";
6
+ import pc6 from "picocolors";
7
+
8
+ // src/commands/benchmark.ts
9
+ import { mkdirSync, writeFileSync } from "fs";
10
+ import { basename, join as join3 } from "path";
11
+ import pc2 from "picocolors";
12
+
13
+ // src/core/assets.ts
14
+ import { execFileSync } from "child_process";
15
+ import { existsSync, readdirSync, statSync } from "fs";
16
+ import { homedir } from "os";
17
+ import { dirname, isAbsolute, join, resolve } from "path";
18
+ import { fileURLToPath } from "url";
19
+
20
+ // src/core/logger.ts
21
+ import pc from "picocolors";
22
+ var verbose = false;
23
+ function setVerbose(v) {
24
+ verbose = v;
25
+ }
26
+ var log = {
27
+ info(msg) {
28
+ process.stderr.write(`${pc.cyan("\u2022")} ${msg}
29
+ `);
30
+ },
31
+ success(msg) {
32
+ process.stderr.write(`${pc.green("\u2713")} ${msg}
33
+ `);
34
+ },
35
+ warn(msg) {
36
+ process.stderr.write(`${pc.yellow("!")} ${msg}
37
+ `);
38
+ },
39
+ error(msg) {
40
+ process.stderr.write(`${pc.red("\u2717")} ${msg}
41
+ `);
42
+ },
43
+ step(msg) {
44
+ process.stderr.write(`${pc.dim(" \u2192")} ${pc.dim(msg)}
45
+ `);
46
+ },
47
+ debug(msg) {
48
+ if (verbose) process.stderr.write(`${pc.dim(` ${msg}`)}
49
+ `);
50
+ },
51
+ /** Print a heading to stderr so structured stdout stays clean. */
52
+ heading(msg) {
53
+ process.stderr.write(`
54
+ ${pc.bold(msg)}
55
+ `);
56
+ }
57
+ };
58
+
59
+ // src/util/yaml.ts
60
+ import { readFileSync } from "fs";
61
+ import yaml from "js-yaml";
62
+ function loadStructured(path) {
63
+ const raw = readFileSync(path, "utf8");
64
+ return yaml.load(raw);
65
+ }
66
+
67
+ // src/core/assets.ts
68
+ var moduleDir = dirname(fileURLToPath(import.meta.url));
69
+ function findBundledAssetsDir() {
70
+ if (process.env.EDSGER_ASSETS_DIR && existsSync(process.env.EDSGER_ASSETS_DIR)) {
71
+ return process.env.EDSGER_ASSETS_DIR;
72
+ }
73
+ let dir = moduleDir;
74
+ for (let i = 0; i < 8; i++) {
75
+ const candidate = join(dir, "assets");
76
+ if (existsSync(join(candidate, "manifest.yaml"))) return candidate;
77
+ if (existsSync(join(dir, "manifest.yaml")) && existsSync(join(dir, "benchmark"))) {
78
+ return dir;
79
+ }
80
+ const parent = dirname(dir);
81
+ if (parent === dir) break;
82
+ dir = parent;
83
+ }
84
+ throw new Error("Could not locate bundled assets. Reinstall edsger or set EDSGER_ASSETS_DIR.");
85
+ }
86
+ function loadLangConfig(assetsRoot) {
87
+ const cfgPath = join(assetsRoot, "languages.yaml");
88
+ if (!existsSync(cfgPath)) return null;
89
+ return loadStructured(cfgPath);
90
+ }
91
+ function scoreLanguages(names, cfg, minScore) {
92
+ const exts = new Set(names.map(extOf));
93
+ const scored = [];
94
+ for (const lang of cfg.languages) {
95
+ let score = 0;
96
+ for (const m of lang.markers) {
97
+ if (m.includes("*")) {
98
+ const re = globToRegExp(m);
99
+ if (names.some((f) => re.test(f))) score += 3;
100
+ } else if (names.includes(m)) {
101
+ score += 3;
102
+ }
103
+ }
104
+ let extHits = 0;
105
+ for (const e of lang.extensions) if (exts.has(e)) extHits++;
106
+ score += Math.min(extHits, cfg.maxExtensionMatches);
107
+ if (score >= minScore) scored.push({ id: lang.id, score });
108
+ }
109
+ return scored.sort((a, b) => b.score - a.score).map((s) => s.id);
110
+ }
111
+ function detectLanguages(cwd, assetsRoot) {
112
+ const cfg = loadLangConfig(assetsRoot);
113
+ if (!cfg) return [];
114
+ const names = readShallowTree(cwd, 3).map((e) => e.name);
115
+ return scoreLanguages(names, cfg, cfg.minScore);
116
+ }
117
+ function inferLanguagesFromFiles(paths, assetsRoot, minScore = 1) {
118
+ const cfg = loadLangConfig(assetsRoot);
119
+ if (!cfg) return [];
120
+ const names = paths.flatMap((p) => [p, p.split("/").pop() ?? p]);
121
+ return scoreLanguages(names, cfg, minScore);
122
+ }
123
+ function resolveStandard(kind, opts, config, configDir, forcedLanguages) {
124
+ const bundled = opts.assetsPath ? resolveRootPath(opts.assetsPath, opts.cwd) : findBundledAssetsDir();
125
+ const languages = opts.lang ? [normaliseLang(opts.lang)] : config.language ? [normaliseLang(config.language)] : pickDetected(detectLanguages(opts.cwd, bundled), forcedLanguages);
126
+ const roots = [
127
+ { path: bundled, label: opts.assetsPath ? `assets:${opts.assetsPath}` : "bundled" }
128
+ ];
129
+ const overrideSpec = (kind === "benchmark" ? config.benchmark?.standards : config.review?.standards) ?? config.standards;
130
+ if (overrideSpec && !opts.assetsPath) {
131
+ roots.push({ path: resolveRootPath(overrideSpec, configDir), label: `config:${overrideSpec}` });
132
+ }
133
+ const layers = [];
134
+ for (const root of roots) {
135
+ pushIfExists(layers, join(root.path, kind, "base.yaml"), `${root.label}/base`);
136
+ for (const lang of languages) {
137
+ pushIfExists(layers, join(root.path, kind, `${lang}.yaml`), `${root.label}/${lang}`);
138
+ }
139
+ }
140
+ const repoLocal = join(opts.cwd, ".edsger", kind);
141
+ if (existsSync(repoLocal)) {
142
+ pushIfExists(layers, join(repoLocal, "base.yaml"), `repo:.edsger/${kind}/base`);
143
+ for (const lang of languages) {
144
+ pushIfExists(layers, join(repoLocal, `${lang}.yaml`), `repo:.edsger/${kind}/${lang}`);
145
+ }
146
+ }
147
+ if (opts.standardPath) {
148
+ const p = resolveRootPath(opts.standardPath, opts.cwd);
149
+ if (existsSync(p) && statSync(p).isDirectory()) {
150
+ pushIfExists(layers, join(p, kind, "base.yaml"), `--standard/base`);
151
+ for (const lang of languages) {
152
+ pushIfExists(layers, join(p, kind, `${lang}.yaml`), `--standard/${lang}`);
153
+ }
154
+ pushIfExists(layers, join(p, "base.yaml"), `--standard/base`);
155
+ } else if (existsSync(p)) {
156
+ pushIfExists(layers, p, `--standard:${opts.standardPath}`);
157
+ } else {
158
+ throw new Error(`--standard path not found: ${p}`);
159
+ }
160
+ }
161
+ if (layers.length === 0) {
162
+ throw new Error(`No ${kind} standard found in any source.`);
163
+ }
164
+ const merged = mergeLayers(
165
+ kind,
166
+ layers.map((l) => l.data)
167
+ );
168
+ return { standard: merged, layers: layers.map((l) => l.label), languages };
169
+ }
170
+ function mergeLayers(kind, layers) {
171
+ if (kind === "benchmark") {
172
+ return layers.reduce(
173
+ (acc, layer) => mergeBenchmark(acc, layer),
174
+ {}
175
+ );
176
+ }
177
+ return layers.reduce(
178
+ (acc, layer) => mergeReview(acc, layer),
179
+ {}
180
+ );
181
+ }
182
+ function mergeBenchmark(base, overlay) {
183
+ const categories = mergeById(
184
+ base.categories ?? [],
185
+ overlay.categories ?? [],
186
+ (b, o) => ({
187
+ ...b,
188
+ ...o,
189
+ criteria: mergeById(b.criteria ?? [], o.criteria ?? [], (bc, oc) => ({
190
+ ...bc,
191
+ ...oc
192
+ }))
193
+ })
194
+ );
195
+ return {
196
+ ...base,
197
+ ...overlay,
198
+ // Preserve the base layer's identity rather than the last overlay's.
199
+ id: base.id ?? overlay.id,
200
+ name: base.name ?? overlay.name,
201
+ version: base.version ?? overlay.version,
202
+ kind: "benchmark",
203
+ scoreScale: overlay.scoreScale ?? base.scoreScale ?? 4,
204
+ categories
205
+ };
206
+ }
207
+ function mergeReview(base, overlay) {
208
+ const focusAreas = mergeById(
209
+ base.focusAreas ?? [],
210
+ overlay.focusAreas ?? [],
211
+ (b, o) => ({
212
+ ...b,
213
+ ...o
214
+ })
215
+ );
216
+ return {
217
+ ...base,
218
+ ...overlay,
219
+ id: base.id ?? overlay.id,
220
+ name: base.name ?? overlay.name,
221
+ version: base.version ?? overlay.version,
222
+ kind: "review",
223
+ policy: { ...base.policy ?? {}, ...overlay.policy ?? {} },
224
+ focusAreas
225
+ };
226
+ }
227
+ function mergeById(base, overlay, merge) {
228
+ const out = base.map((x) => ({ ...x }));
229
+ const index = new Map(out.map((x, i) => [x.id, i]));
230
+ for (const item of overlay) {
231
+ const at = index.get(item.id);
232
+ if (at === void 0) {
233
+ index.set(item.id, out.length);
234
+ out.push({ ...item });
235
+ } else {
236
+ out[at] = merge(out[at], item);
237
+ }
238
+ }
239
+ return out;
240
+ }
241
+ function pushIfExists(layers, path, label) {
242
+ if (existsSync(path)) {
243
+ layers.push({ data: loadStructured(path), label });
244
+ log.debug(`standard layer: ${label} (${path})`);
245
+ }
246
+ }
247
+ function resolveRootPath(spec, baseDir) {
248
+ if (spec.startsWith("git+") || /^(https?|git|ssh):\/\//.test(spec)) {
249
+ return cloneToCache(spec.replace(/^git\+/, ""));
250
+ }
251
+ return isAbsolute(spec) ? spec : resolve(baseDir, spec);
252
+ }
253
+ function cloneToCache(url) {
254
+ const [repo, ref] = url.split("#");
255
+ const safe = repo.replace(/[^a-zA-Z0-9._-]/g, "_");
256
+ const dest = join(homedir(), ".cache", "edsger", "standards", safe);
257
+ if (!existsSync(dest)) {
258
+ log.step(`cloning standards repo ${repo}`);
259
+ execFileSync("git", ["clone", "--depth", "1", ...ref ? ["--branch", ref] : [], repo, dest], {
260
+ stdio: "ignore"
261
+ });
262
+ }
263
+ return dest;
264
+ }
265
+ function readShallowTree(root, depth) {
266
+ const skip = /* @__PURE__ */ new Set([
267
+ "node_modules",
268
+ ".git",
269
+ "dist",
270
+ "build",
271
+ "out",
272
+ "target",
273
+ "vendor",
274
+ ".venv",
275
+ "venv",
276
+ "__pycache__",
277
+ ".dart_tool"
278
+ ]);
279
+ const out = [];
280
+ const walk = (dir, level) => {
281
+ let items;
329
282
  try {
330
- if (!productId && !opts.repoId) {
331
- throw new Error('Provide a productId or --repo-id (repo-only mode) for sequence-diagram');
283
+ items = readdirSync(dir);
284
+ } catch {
285
+ return;
286
+ }
287
+ for (const name of items) {
288
+ if (skip.has(name)) continue;
289
+ out.push({ name });
290
+ if (level < depth) {
291
+ const full = join(dir, name);
292
+ try {
293
+ if (statSync(full).isDirectory()) walk(full, level + 1);
294
+ } catch {
332
295
  }
333
- await runSequenceDiagram(productId, {
334
- diagramId: opts.diagramId,
335
- repoId: opts.repoId,
336
- guidance: opts.guidance,
337
- verbose: opts.verbose,
338
- });
296
+ }
339
297
  }
340
- catch (error) {
341
- exitWithError(error);
342
- }
343
- });
344
- const diagramSubcommands = [
345
- {
346
- name: 'state-diagram',
347
- description: 'Generate a state diagram (states + transitions for one lifecycle) for a product (or standalone repository) from its source code',
348
- guidance: 'Human direction for the AI — the lifecycle to map',
349
- run: runStateDiagram,
350
- },
351
- {
352
- name: 'class-diagram',
353
- description: 'Generate a UML class diagram (types + relationships) for a product (or standalone repository) from its source code',
354
- guidance: 'Human direction for the AI (focus areas, exclusions)',
355
- run: runClassDiagram,
356
- },
357
- {
358
- name: 'architecture-diagram',
359
- description: 'Generate an architecture/component diagram (components + dependencies) for a product (or standalone repository) from its source code',
360
- guidance: 'Human direction for the AI (focus areas, exclusions)',
361
- run: runArchitectureDiagram,
362
- },
363
- {
364
- name: 'flowchart',
365
- description: 'Generate a flowchart (control flow of one process/function) for a product (or standalone repository) from its source code',
366
- guidance: 'Human direction for the AI — the process to map',
367
- run: runFlowchart,
368
- },
298
+ };
299
+ walk(root, 1);
300
+ return out;
301
+ }
302
+ function extOf(name) {
303
+ const i = name.lastIndexOf(".");
304
+ return i < 0 ? "" : name.slice(i);
305
+ }
306
+ function globToRegExp(glob) {
307
+ const escaped = glob.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
308
+ return new RegExp(`^${escaped}$`);
309
+ }
310
+ function pickDetected(detected, fallback) {
311
+ return detected.length ? detected : fallback ?? [];
312
+ }
313
+ function normaliseLang(input) {
314
+ const v = input.trim().toLowerCase();
315
+ const aliases = {
316
+ ts: "typescript",
317
+ js: "typescript",
318
+ javascript: "typescript",
319
+ node: "typescript",
320
+ nodejs: "typescript",
321
+ py: "python",
322
+ golang: "go",
323
+ cs: "csharp",
324
+ "c#": "csharp",
325
+ dotnet: "csharp",
326
+ jvm: "java",
327
+ kotlin: "java",
328
+ flutter: "dart"
329
+ };
330
+ return aliases[v] ?? v;
331
+ }
332
+
333
+ // src/core/config.ts
334
+ import { existsSync as existsSync2 } from "fs";
335
+ import { join as join2 } from "path";
336
+ var CONFIG_FILENAMES = [
337
+ "edsger.config.yaml",
338
+ "edsger.config.yml",
339
+ "edsger.config.json",
340
+ ".edsgerrc.yaml",
341
+ ".edsgerrc.yml",
342
+ ".edsgerrc.json",
343
+ ".edsgerrc"
369
344
  ];
370
- for (const sub of diagramSubcommands) {
371
- program
372
- .command(`${sub.name} [productId]`)
373
- .description(sub.description)
374
- .requiredOption('--diagram-id <id>', 'Pending diagrams row id to populate')
375
- .option('--repo-id <id>', 'Run in repo-only mode against a single repositories row (no product context)')
376
- .option('-g, --guidance <text>', sub.guidance)
377
- .option('-v, --verbose', 'Verbose output')
378
- .action(async (productId, opts) => {
345
+ function loadConfig(cwd) {
346
+ const searchDirs = [cwd, join2(cwd, ".edsger")];
347
+ for (const dir of searchDirs) {
348
+ for (const name of CONFIG_FILENAMES) {
349
+ const p = join2(dir, name);
350
+ if (existsSync2(p)) {
379
351
  try {
380
- if (!productId && !opts.repoId) {
381
- throw new Error(`Provide a productId or --repo-id (repo-only mode) for ${sub.name}`);
382
- }
383
- await sub.run(productId, {
384
- diagramId: opts.diagramId,
385
- repoId: opts.repoId,
386
- guidance: opts.guidance,
387
- verbose: opts.verbose,
388
- });
389
- }
390
- catch (error) {
391
- exitWithError(error);
352
+ const config = loadStructured(p) ?? {};
353
+ return { config, path: p };
354
+ } catch {
392
355
  }
393
- });
394
- }
395
- // ============================================================
396
- // Subcommand: edsger user-psychology <productId>
397
- // ============================================================
398
- program
399
- .command('user-psychology <productId>')
400
- .description('Research the product target users and produce a structured psychographic profile (personas + JTBD + Fogg + messaging angles)')
401
- .option('-v, --verbose', 'Verbose output')
402
- .option('-g, --guidance <text>', 'Human direction for the AI (audience focus, market, segment)')
403
- .requiredOption('--analysis-id <id>', 'ID of the pending analysis row to fill in (reserved by the desktop UI)')
404
- .action(async (productId, opts) => {
405
- try {
406
- await runUserPsychologyAnalysis({
407
- userPsychology: productId,
408
- verbose: opts.verbose,
409
- userPsychologyGuidance: opts.guidance,
410
- userPsychologyAnalysisId: opts.analysisId,
411
- });
412
- }
413
- catch (error) {
414
- exitWithError(error);
415
- }
416
- });
417
- // ============================================================
418
- // Subcommand: edsger financing-deck <productId>
419
- // ============================================================
420
- program
421
- .command('financing-deck <productId>')
422
- .description('Draft an investor pitch deck for a product (AI-generated)')
423
- .requiredOption('--target-stage <stage>', 'Target stage: pre_seed | seed | series_a | series_b | series_c | growth')
424
- .option('-v, --verbose', 'Verbose output')
425
- .action(async (productId, opts) => {
426
- try {
427
- await runFinancingDeck({
428
- financingDeck: productId,
429
- financingTargetStage: opts.targetStage,
430
- verbose: opts.verbose,
431
- });
432
- }
433
- catch (error) {
434
- exitWithError(error);
435
- }
436
- });
437
- // ============================================================
438
- // Subcommand: edsger intel <productId>
439
- // ============================================================
440
- program
441
- .command('intel <productId>')
442
- .description('Run AI-powered competitive intelligence analysis for a product')
443
- .option('-v, --verbose', 'Verbose output')
444
- .option('-t, --type <type>', 'Report type: competitive, market, pmf, research, comprehensive', 'competitive')
445
- .option('-g, --guidance <text>', 'Human direction for the analysis focus')
446
- .option('--report-id <id>', 'Update an existing pending report instead of creating new')
447
- .option('--list-competitors', 'List discovered and confirmed competitors')
448
- .option('--confirm-competitor <id>', 'Confirm a suggested competitor for tracking')
449
- .option('--dismiss-competitor <id>', 'Dismiss a suggested competitor')
450
- .action(async (productId, opts) => {
451
- try {
452
- await runIntelligence({
453
- productId,
454
- reportType: opts.type,
455
- verbose: opts.verbose,
456
- guidance: opts.guidance,
457
- reportId: opts.reportId,
458
- listCompetitors: opts.listCompetitors,
459
- confirmCompetitor: opts.confirmCompetitor,
460
- dismissCompetitor: opts.dismissCompetitor,
461
- });
462
- }
463
- catch (error) {
464
- exitWithError(error);
465
- }
466
- });
467
- // ============================================================
468
- // Subcommand: edsger adr <adrId>
469
- // ============================================================
470
- program
471
- .command('adr <adrId>')
472
- .description('Generate decision options (pros/cons) for a draft Architecture Decision Record')
473
- .option('-v, --verbose', 'Verbose output')
474
- .action(async (adrId, opts) => {
475
- try {
476
- await runAdr({ adrId, verbose: opts.verbose });
477
- }
478
- catch (error) {
479
- exitWithError(error);
480
- }
481
- });
482
- // ============================================================
483
- // Subcommand: edsger app-store <productId>
484
- // ============================================================
485
- program
486
- .command('app-store <productId>')
487
- .description('Generate professional App Store / Play Store screenshots and listing content')
488
- .option('-v, --verbose', 'Verbose output')
489
- .option('--screenshots-only', 'Only generate screenshots')
490
- .option('--listings-only', 'Only generate listing content')
491
- .option('--store <type>', 'Target store: apple, google, or all (default: all)', 'all')
492
- .option('--locale <locale>', 'Target locale (auto-detected from App Store Connect if omitted)')
493
- .action(async (productId, opts) => {
494
- try {
495
- await runAppStoreGeneration({
496
- appStoreProductId: productId,
497
- verbose: opts.verbose,
498
- screenshotsOnly: opts.screenshotsOnly,
499
- listingsOnly: opts.listingsOnly,
500
- store: opts.store,
501
- locale: opts.locale,
502
- });
503
- }
504
- catch (error) {
505
- exitWithError(error);
506
- }
507
- });
508
- // ============================================================
509
- // Subcommand: edsger build <productId>
510
- // ============================================================
511
- program
512
- .command('build <productId>')
513
- .description('Build iOS/macOS app and optionally upload to App Store Connect')
514
- .option('-v, --verbose', 'Verbose output')
515
- .option('--scheme <name>', 'Xcode scheme (auto-detected if omitted)')
516
- .option('--project <path>', 'Path to .xcworkspace or .xcodeproj (relative to repo root)')
517
- .option('--configuration <name>', 'Build configuration (default: Release)', 'Release')
518
- .option('--platform <platform>', 'Target platform: ios or macos (default: ios)', 'ios')
519
- .option('--upload', 'Upload IPA to App Store Connect after building')
520
- .option('--reselect', 'Re-discover project and scheme (ignore saved config)')
521
- .option('--skip-archive', 'Skip build, only upload existing IPA')
522
- .option('--ipa <path>', 'Upload a specific IPA file directly')
523
- .action(async (productId, opts) => {
524
- try {
525
- await runBuild({
526
- buildProductId: productId,
527
- verbose: opts.verbose,
528
- scheme: opts.scheme,
529
- project: opts.project,
530
- configuration: opts.configuration,
531
- platform: opts.platform,
532
- upload: opts.upload,
533
- reselect: opts.reselect,
534
- skipArchive: opts.skipArchive,
535
- ipa: opts.ipa,
536
- });
537
- }
538
- catch (error) {
539
- exitWithError(error);
540
- }
541
- });
542
- // ============================================================
543
- // Subcommand: edsger checklists [productId] [--team-id <id>]
544
- // ============================================================
545
- program
546
- .command('checklists [productId]')
547
- .description('Analyse a local directory and sync product OR team checklists (create/update/delete) using AI. Pass a product ID positionally for product scope, or --team-id for team scope.')
548
- .option('-v, --verbose', 'Verbose output')
549
- .option('--dir <path>', 'Directory to analyse (defaults to current working directory)')
550
- .option('--prompt <text>', 'Additional instructions for the AI agent')
551
- .option('--team-id <id>', 'Sync TEAM-level checklists for this team instead of a product. The directory is treated as team standards / reference material.')
552
- .action(async (productId, opts) => {
553
- try {
554
- if (!productId && !opts.teamId) {
555
- throw new Error('Provide a product ID positionally or pass --team-id <id> for team scope.');
556
- }
557
- if (productId && opts.teamId) {
558
- throw new Error('Pass either a product ID or --team-id, not both.');
559
- }
560
- await runChecklists({
561
- checklistsProductId: productId,
562
- checklistsTeamId: opts.teamId,
563
- checklistsDir: opts.dir,
564
- checklistsPrompt: opts.prompt,
565
- verbose: opts.verbose,
566
- });
567
- }
568
- catch (error) {
569
- exitWithError(error);
570
- }
571
- });
572
- // ============================================================
573
- // Subcommand: edsger analyze-logs <productId>
574
- // ============================================================
575
- program
576
- .command('analyze-logs <productId>')
577
- .description('Analyze pending product logs and create feedback for issues found')
578
- .option('-v, --verbose', 'Verbose output')
579
- .action(async (productId, opts) => {
580
- try {
581
- await runAnalyzeLogs({
582
- analyzeLogs: productId,
583
- verbose: opts.verbose,
584
- });
585
- }
586
- catch (error) {
587
- exitWithError(error);
588
- }
589
- });
590
- // ============================================================
591
- // Subcommand: edsger release-sync <productId>
592
- // ============================================================
593
- program
594
- .command('release-sync <productId>')
595
- .description('Sync GitHub releases (and any unreleased snapshot version) into the releases table for a product')
596
- .option('-v, --verbose', 'Verbose output')
597
- .action(async (productId, opts) => {
598
- try {
599
- await runReleaseSyncCommand({
600
- productId,
601
- verbose: opts.verbose,
602
- });
603
- }
604
- catch (error) {
605
- exitWithError(error);
606
- }
607
- });
608
- // ============================================================
609
- // Subcommand: edsger issue-analysis <issueId>
610
- // ============================================================
611
- program
612
- .command('issue-analysis <issueId>')
613
- .description('Generate or refine the execution plan for an issue (issue_analysis phase, with verification loop)')
614
- .option('-v, --verbose', 'Verbose output')
615
- .action(async (issueId, opts) => {
616
- try {
617
- await runIssueAnalysisCommand({ issueId, verbose: opts.verbose });
618
- }
619
- catch (error) {
620
- exitWithError(error);
621
- }
622
- });
623
- // ============================================================
624
- // Subcommand: edsger session-turn <channelId>
625
- // ============================================================
626
- program
627
- .command('session-turn <channelId>')
628
- .description('Run one conversational agent turn for a chat session (ai_assistant channel)')
629
- .requiredOption('--product <productId>', 'Product the session is bound to')
630
- .option('--repos <ids>', 'Comma-separated repository IDs the agent may touch', '')
631
- .option('--resume <sessionId>', 'SDK session id from a previous turn to resume the same conversation')
632
- .option('--run-finished <runId>', 'Follow-up turn: report the results of a background cli_* run that finished')
633
- .option('--run-command <command>', 'The command name of the finished run (used with --run-finished)')
634
- .option('-v, --verbose', 'Verbose output')
635
- .action(async (channelId, opts) => {
636
- try {
637
- await runSessionTurnCommand({
638
- channelId,
639
- productId: opts.product,
640
- repositoryIds: (opts.repos ?? '')
641
- .split(',')
642
- .map((s) => s.trim())
643
- .filter(Boolean),
644
- resumeSessionId: opts.resume,
645
- runFinished: opts.runFinished
646
- ? { runId: opts.runFinished, command: opts.runCommand }
647
- : undefined,
648
- verbose: opts.verbose,
649
- });
650
- }
651
- catch (error) {
652
- exitWithError(error);
653
- }
654
- });
655
- // ============================================================
656
- // Subcommand: edsger session-serve <channelId>
657
- // ============================================================
658
- program
659
- .command('session-serve <channelId>')
660
- .description('Run a long-lived conversational agent for a chat session, taking one turn per command read from stdin')
661
- .requiredOption('--product <productId>', 'Product the session is bound to')
662
- .option('--repos <ids>', 'Comma-separated repository IDs the agent may touch', '')
663
- .option('--resume <sessionId>', 'SDK session id to resume on the first turn (e.g. after a crash-restart)')
664
- .option('-v, --verbose', 'Verbose output')
665
- .action(async (channelId, opts) => {
666
- try {
667
- await runSessionServeCommand({
668
- channelId,
669
- productId: opts.product,
670
- repositoryIds: (opts.repos ?? '')
671
- .split(',')
672
- .map((s) => s.trim())
673
- .filter(Boolean),
674
- resumeSessionId: opts.resume,
675
- verbose: opts.verbose,
676
- });
677
- }
678
- catch (error) {
679
- exitWithError(error);
680
- }
681
- });
682
- // ============================================================
683
- // Subcommand: edsger chat-serve
684
- // ============================================================
685
- program
686
- .command('chat-serve')
687
- .description('Run a long-lived daemon that answers human messages on issue and product group chat channels')
688
- .option('-v, --verbose', 'Verbose output')
689
- .action(async (opts) => {
690
- try {
691
- await runChatServeCommand({ verbose: opts.verbose });
692
- }
693
- catch (error) {
694
- exitWithError(error);
695
- }
696
- });
697
- // ============================================================
698
- // Subcommand: edsger user-stories-analysis <issueId>
699
- // ============================================================
700
- program
701
- .command('user-stories-analysis <issueId>')
702
- .description('Generate or refine user stories for an issue (user_stories_analysis phase, with verification loop)')
703
- .option('-v, --verbose', 'Verbose output')
704
- .action(async (issueId, opts) => {
705
- try {
706
- await runUserStoriesAnalysisCommand({ issueId, verbose: opts.verbose });
707
- }
708
- catch (error) {
709
- exitWithError(error);
710
- }
711
- });
712
- // ============================================================
713
- // Subcommand: edsger test-cases-analysis <issueId>
714
- // ============================================================
715
- program
716
- .command('test-cases-analysis <issueId>')
717
- .description('Generate or refine test cases for an issue (test_cases_analysis phase, with verification loop)')
718
- .option('-v, --verbose', 'Verbose output')
719
- .action(async (issueId, opts) => {
720
- try {
721
- await runTestCasesAnalysisCommand({ issueId, verbose: opts.verbose });
722
- }
723
- catch (error) {
724
- exitWithError(error);
725
- }
726
- });
727
- // ============================================================
728
- // Subcommand: edsger technical-design <issueId>
729
- // ============================================================
730
- program
731
- .command('technical-design <issueId>')
732
- .description('Generate or refine the technical design for an issue (technical_design phase, with verification loop)')
733
- .option('-v, --verbose', 'Verbose output')
734
- .action(async (issueId, opts) => {
735
- try {
736
- await runTechnicalDesignCommand({ issueId, verbose: opts.verbose });
737
- }
738
- catch (error) {
739
- exitWithError(error);
740
- }
741
- });
742
- // ============================================================
743
- // Subcommand: edsger smoke-test <releaseId>
744
- // ============================================================
745
- program
746
- .command('smoke-test <releaseId>')
747
- .description('Generate smoke-test cases for a specific release (requires the release to be synced first — see `edsger release-sync`)')
748
- .option('-v, --verbose', 'Verbose output')
749
- .action(async (releaseId, opts) => {
750
- try {
751
- await runSmokeTestCommand({
752
- releaseId,
753
- verbose: opts.verbose,
754
- });
755
- }
756
- catch (error) {
757
- exitWithError(error);
356
+ }
758
357
  }
759
- });
760
- // ============================================================
761
- // Subcommand: edsger run-sheet <releaseId>
762
- // ============================================================
763
- program
764
- .command('run-sheet <releaseId>')
765
- .description('Render the product run sheet template against a release (clones the repo at the release tag to resolve {{file:...}} placeholders)')
766
- .option('-f, --force', 'Regenerate even if the cached run sheet is fresh')
767
- .option('-v, --verbose', 'Verbose output')
768
- .action(async (releaseId, opts) => {
769
- try {
770
- await runRunSheetCommand({
771
- releaseId,
772
- force: opts.force,
773
- verbose: opts.verbose,
774
- });
775
- }
776
- catch (error) {
777
- exitWithError(error);
778
- }
779
- });
780
- // ============================================================
781
- // Subcommand: edsger pr-review <productId>
782
- // ============================================================
783
- program
784
- .command('pr-review [productId]')
785
- .description('AI-review a GitHub PR for a product (or standalone repository)')
786
- .requiredOption('--pr-url <url>', 'GitHub PR URL')
787
- .option('--pr-id <id>', 'Pull request record ID in database')
788
- .option('--repo-id <id>', 'Run in repo-only mode against a single repositories row (no product context)')
789
- .option('-v, --verbose', 'Verbose output')
790
- .action(async (productId, opts) => {
791
- try {
792
- if (!productId && !opts.repoId) {
793
- throw new Error('Provide a productId or --repo-id (repo-only mode) for pr-review');
358
+ }
359
+ return { config: {} };
360
+ }
361
+
362
+ // src/core/agent.ts
363
+ import {
364
+ createSdkMcpServer,
365
+ query,
366
+ tool
367
+ } from "@anthropic-ai/claude-agent-sdk";
368
+ var READ_ONLY_DISALLOWED = ["Edit", "Write", "NotebookEdit"];
369
+ async function runAgent(opts) {
370
+ assertAuth();
371
+ let captured;
372
+ const submitTool = tool(
373
+ "submit_result",
374
+ "Submit the final structured result. Call this exactly once when done.",
375
+ opts.resultShape,
376
+ async (args) => {
377
+ captured = args;
378
+ return { content: [{ type: "text", text: "Result recorded. You may stop now." }] };
379
+ }
380
+ );
381
+ const outServer = createSdkMcpServer({
382
+ name: "edsger_out",
383
+ version: "1.0.0",
384
+ tools: [submitTool]
385
+ });
386
+ const allowedTools = [
387
+ "Read",
388
+ "Grep",
389
+ "Glob",
390
+ "Bash",
391
+ "mcp__edsger_out__submit_result",
392
+ ...opts.allowWrite ? ["Edit", "Write", "MultiEdit"] : [],
393
+ ...opts.extraAllowedTools ?? []
394
+ ];
395
+ const mcpServers = {
396
+ edsger_out: outServer,
397
+ ...opts.extraMcpServers ?? {}
398
+ };
399
+ let costUsd = 0;
400
+ let numTurns = 0;
401
+ const controller = new AbortController();
402
+ const timer = opts.timeoutMs ? setTimeout(() => controller.abort(), opts.timeoutMs) : void 0;
403
+ const stream = query({
404
+ prompt: opts.prompt,
405
+ options: {
406
+ model: opts.model,
407
+ cwd: opts.cwd,
408
+ maxTurns: opts.maxTurns,
409
+ // Reproducible runs: do not load the target repo's settings/CLAUDE.md.
410
+ settingSources: [],
411
+ systemPrompt: {
412
+ type: "preset",
413
+ preset: "claude_code",
414
+ append: opts.systemPromptAppend
415
+ },
416
+ // The user explicitly invoked an agent to inspect/modify their own repo.
417
+ // Capability is shaped by allowedTools/disallowedTools rather than prompts:
418
+ // read-only runs have edit tools removed from context entirely (below).
419
+ permissionMode: "bypassPermissions",
420
+ allowedTools,
421
+ disallowedTools: opts.allowWrite ? [] : READ_ONLY_DISALLOWED,
422
+ mcpServers,
423
+ abortController: controller
424
+ }
425
+ });
426
+ try {
427
+ for await (const message of stream) {
428
+ if (message.type === "assistant") {
429
+ for (const block of message.message?.content ?? []) {
430
+ if (block.type === "tool_use") {
431
+ log.debug(`tool: ${block.name}`);
432
+ } else if (block.type === "text" && opts.verbose && block.text?.trim()) {
433
+ log.debug(block.text.trim().split("\n")[0] ?? "");
434
+ }
794
435
  }
795
- await runPRReview(productId, opts);
796
- }
797
- catch (error) {
798
- exitWithError(error);
799
- }
800
- });
801
- // ============================================================
802
- // Subcommand: edsger find-bugs <productId>
803
- // ============================================================
804
- program
805
- .command('find-bugs [productId]')
806
- .description("AI-audit a product's (or a standalone repository's) repo for bugs and file each new finding as an issue")
807
- .option('--repo-id <id>', 'Run in repo-only mode against a single repositories row (no product context)')
808
- .option('--full', 'Force a full scan even if previous-scan state exists')
809
- .option('--branch <name>', 'Branch to scan (defaults to repo default branch)')
810
- .option('--max-files <n>', 'Upper bound on files the auditor may Read (default 200)', (value) => {
811
- const n = parseInt(value, 10);
812
- if (Number.isNaN(n) || n <= 0) {
813
- throw new Error('--max-files must be a positive integer');
814
- }
815
- return n;
816
- })
817
- .option('-v, --verbose', 'Verbose output')
818
- .action(async (productId, opts) => {
819
- try {
820
- await runFindBugs(productId, opts);
821
- }
822
- catch (error) {
823
- exitWithError(error);
824
- }
825
- });
826
- // ============================================================
827
- // Subcommand: edsger quality-benchmark <productId>
828
- // ============================================================
829
- program
830
- .command('quality-benchmark [productId]')
831
- .description("Run an industrial-grade code quality benchmark against the product's (or a standalone repository's) GitHub repo")
832
- .option('--repo <path>', "Override the auto-clone with a local checkout (default: clone the product's repo into ~/edsger/quality-<owner>-<repo>)")
833
- .option('--repo-id <id>', 'Benchmark a specific repository (id). With a productId, targets that linked repo; without a productId, runs in repo-only mode (no product)')
834
- .option('--branch <name>', 'Override the detected default branch on the report envelope')
835
- .option('--pkg-manager <name>', 'npm | pnpm | yarn (auto-detected if absent)')
836
- .option('--no-install', 'Refuse to install missing tools; mark them unmeasured')
837
- .option('--output <path>', 'Where to write the JSON report (default: ./quality-report-<commit>.json)')
838
- .option('--no-save', 'Skip the quality_reports/save MCP call (local-only run)')
839
- .option('--force', 'Overwrite any existing report row for this (product, commit, rubric)')
840
- .option('-v, --verbose', 'Print every progress event')
841
- .action(async (productId, opts) => {
842
- try {
843
- if (!productId && !opts.repoId) {
844
- throw new Error('Provide a productId or --repo-id (repo-only mode) for quality-benchmark');
436
+ } else if (message.type === "result") {
437
+ costUsd = message.total_cost_usd ?? 0;
438
+ numTurns = message.num_turns ?? 0;
439
+ if (message.subtype && message.subtype !== "success") {
440
+ log.warn(`agent ended with: ${message.subtype}`);
845
441
  }
846
- await runQualityBenchmarkCli(productId ?? '', opts);
847
- }
848
- catch (error) {
849
- exitWithError(error);
442
+ }
850
443
  }
851
- });
852
- // ============================================================
853
- // Subcommand: edsger sync-github-issues <productId>
854
- // ============================================================
855
- program
856
- .command('sync-github-issues <productId>')
857
- .description("Mirror the product's connected GitHub repo issues into the local issues list (handles new, updated, closed, and deleted)")
858
- .option('-v, --verbose', 'Verbose output')
859
- .action(async (productId, opts) => {
860
- try {
861
- await runSyncGithubIssues(productId, opts);
862
- }
863
- catch (error) {
864
- exitWithError(error);
865
- }
866
- });
867
- // ============================================================
868
- // Subcommand: edsger sync-github-pull-requests <repoId>
869
- // ============================================================
870
- program
871
- .command('sync-github-pull-requests <repoId>')
872
- .description("Mirror a connected GitHub repo's pull requests into the local pull_requests list for the repo detail page (idempotent — refreshes, never duplicates)")
873
- .option('-v, --verbose', 'Verbose output')
874
- .action(async (repoId, opts) => {
875
- try {
876
- await runSyncGithubPullRequests(repoId, opts);
877
- }
878
- catch (error) {
879
- exitWithError(error);
880
- }
881
- });
882
- // ============================================================
883
- // Subcommand: edsger sync-org-repos <teamId>
884
- // ============================================================
885
- program
886
- .command('sync-org-repos <teamId>')
887
- .description("Sync a GitHub org's repos under a team via the Edsger GitHub App, falling back to your personal GitHub token.")
888
- .option('-v, --verbose', 'Verbose output')
889
- .option('--org <name>', "GitHub org name (defaults to the team's configured github_org)")
890
- .action(async (teamId, opts) => {
891
- try {
892
- await runSyncOrgRepos(teamId, opts);
893
- }
894
- catch (error) {
895
- exitWithError(error);
896
- }
897
- });
898
- // ============================================================
899
- // Subcommand: edsger sync-sentry-issues <productId>
900
- //
901
- // Requires SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT in env (set via
902
- // `edsger config set`). Optional SENTRY_BASE_URL for self-hosted Sentry.
903
- // ============================================================
904
- program
905
- .command('sync-sentry-issues <productId>')
906
- .description('Mirror Sentry project issues into the local issues list (requires SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT env)')
907
- .option('-v, --verbose', 'Verbose output')
908
- .action(async (productId, opts) => {
909
- try {
910
- await runSyncSentryIssues(productId, opts);
911
- }
912
- catch (error) {
913
- exitWithError(error);
914
- }
915
- });
916
- // ============================================================
917
- // Subcommand: edsger sync-datadog <teamId>
918
- //
919
- // Requires DD_API_KEY, DD_APP_KEY in env (set via `edsger config set`
920
- // or desktop Settings → Credentials → Datadog). Optional DD_SITE.
921
- // ============================================================
922
- program
923
- .command('sync-datadog <teamId>')
924
- .description('Import services from Datadog Service Catalog into the edsger service catalog (requires DD_API_KEY, DD_APP_KEY env)')
925
- .option('-v, --verbose', 'Verbose output')
926
- .action(async (teamId, opts) => {
927
- try {
928
- await runSyncDatadog(teamId, opts);
929
- }
930
- catch (error) {
931
- exitWithError(error);
932
- }
933
- });
934
- // ============================================================
935
- // ============================================================
936
- // Subcommand: edsger sync-aws <teamId>
937
- //
938
- // Uses the standard AWS credential chain to discover services by
939
- // their Service tag and optionally pull cost data.
940
- // ============================================================
941
- program
942
- .command('sync-aws <teamId>')
943
- .description('Discover services from AWS by Service tag and pull cost data from Cost Explorer')
944
- .option('-v, --verbose', 'Verbose output')
945
- .option('--region <region>', 'AWS region (default: AWS_REGION env or us-east-1)')
946
- .option('--no-cost', 'Skip Cost Explorer query')
947
- .action(async (teamId, opts) => {
948
- try {
949
- await runSyncAws(teamId, {
950
- verbose: opts.verbose,
951
- region: opts.region,
952
- noCost: opts.cost === false,
953
- });
954
- }
955
- catch (error) {
956
- exitWithError(error);
444
+ } catch (err) {
445
+ if (controller.signal.aborted) {
446
+ throw new Error(`Agent run timed out after ${Math.round((opts.timeoutMs ?? 0) / 1e3)}s.`);
957
447
  }
448
+ throw err;
449
+ } finally {
450
+ if (timer) clearTimeout(timer);
451
+ }
452
+ return { result: captured, costUsd, numTurns };
453
+ }
454
+ function assertAuth() {
455
+ if (!process.env.ANTHROPIC_API_KEY && !process.env.CLAUDE_CODE_OAUTH_TOKEN) {
456
+ throw new Error(
457
+ "No Anthropic credentials found. Set ANTHROPIC_API_KEY (or CLAUDE_CODE_OAUTH_TOKEN) before running edsger."
458
+ );
459
+ }
460
+ }
461
+
462
+ // src/core/report.ts
463
+ function scoreBenchmark(standard, result) {
464
+ const scale = standard.scoreScale || 4;
465
+ const totalWeight = standard.categories.reduce((s, c) => s + c.weight, 0) || 1;
466
+ const scoreLookup = /* @__PURE__ */ new Map();
467
+ for (const cat of result.categories) {
468
+ for (const cr of cat.criteria) scoreLookup.set(`${cat.id}/${cr.id}`, cr.score);
469
+ }
470
+ const justifyLookup = /* @__PURE__ */ new Map();
471
+ for (const cat of result.categories) {
472
+ for (const cr of cat.criteria) {
473
+ justifyLookup.set(`${cat.id}/${cr.id}`, {
474
+ justification: cr.justification,
475
+ evidence: cr.evidence ?? []
476
+ });
477
+ }
478
+ }
479
+ const categories = standard.categories.map((cat) => {
480
+ const critWeightTotal = cat.criteria.reduce((s, c) => s + (c.weight ?? 1), 0) || 1;
481
+ const scored = cat.criteria.map((cr) => {
482
+ const raw = clamp(scoreLookup.get(`${cat.id}/${cr.id}`) ?? 0, 0, scale);
483
+ const meta = justifyLookup.get(`${cat.id}/${cr.id}`);
484
+ return {
485
+ id: cr.id,
486
+ title: cr.title,
487
+ weight: cr.weight ?? 1,
488
+ rawScore: raw,
489
+ maxScore: scale,
490
+ fraction: raw / scale,
491
+ justification: meta?.justification ?? "Not assessed.",
492
+ evidence: meta?.evidence ?? []
493
+ };
494
+ });
495
+ const fraction = scored.reduce((s, c) => s + c.fraction * c.weight, 0) / critWeightTotal;
496
+ const normWeight = cat.weight / totalWeight * 100;
497
+ return {
498
+ id: cat.id,
499
+ name: cat.name,
500
+ weight: round(normWeight, 1),
501
+ fraction,
502
+ points: round(normWeight * fraction, 1),
503
+ criteria: scored
504
+ };
505
+ });
506
+ const overall = round(
507
+ categories.reduce((s, c) => s + c.points, 0),
508
+ 1
509
+ );
510
+ return {
511
+ standardName: standard.name,
512
+ standardVersion: standard.version,
513
+ overall,
514
+ grade: gradeFor(overall),
515
+ categories,
516
+ summary: result.summary,
517
+ strengths: result.strengths ?? [],
518
+ weaknesses: result.weaknesses ?? [],
519
+ recommendations: result.recommendations ?? []
520
+ };
521
+ }
522
+ function gradeFor(score) {
523
+ if (score >= 90) return "A";
524
+ if (score >= 80) return "B";
525
+ if (score >= 70) return "C";
526
+ if (score >= 60) return "D";
527
+ return "F";
528
+ }
529
+ function renderBenchmarkMarkdown(scored, meta) {
530
+ const lines = [];
531
+ lines.push(`# Edsger Benchmark Report`);
532
+ lines.push("");
533
+ lines.push(`**Score: ${scored.overall} / 100 (Grade ${scored.grade})**`);
534
+ lines.push("");
535
+ lines.push(`> ${scored.summary}`);
536
+ lines.push("");
537
+ lines.push(`| Field | Value |`);
538
+ lines.push(`| --- | --- |`);
539
+ lines.push(`| Repository | \`${meta.repo}\` |`);
540
+ lines.push(`| Languages | ${meta.languages.join(", ") || "n/a"} |`);
541
+ lines.push(`| Standard | ${scored.standardName} v${scored.standardVersion} |`);
542
+ lines.push(`| Sources | ${meta.layers.join(" \u2192 ")} |`);
543
+ lines.push(`| Model | ${meta.model} |`);
544
+ lines.push(`| Generated | ${meta.generatedAt} |`);
545
+ lines.push("");
546
+ lines.push(`## Category scores`);
547
+ lines.push("");
548
+ lines.push(`| Category | Weight | Score | Weighted |`);
549
+ lines.push(`| --- | ---: | ---: | ---: |`);
550
+ for (const c of scored.categories) {
551
+ lines.push(`| ${c.name} | ${c.weight}% | ${Math.round(c.fraction * 100)}% | ${c.points} |`);
552
+ }
553
+ lines.push(`| **Overall** | **100%** | | **${scored.overall}** |`);
554
+ lines.push("");
555
+ if (scored.strengths.length) {
556
+ lines.push(`## Strengths`);
557
+ lines.push("");
558
+ for (const s of scored.strengths) lines.push(`- ${s}`);
559
+ lines.push("");
560
+ }
561
+ if (scored.weaknesses.length) {
562
+ lines.push(`## Weaknesses`);
563
+ lines.push("");
564
+ for (const w of scored.weaknesses) lines.push(`- ${w}`);
565
+ lines.push("");
566
+ }
567
+ if (scored.recommendations.length) {
568
+ lines.push(`## Recommendations`);
569
+ lines.push("");
570
+ for (const r of scored.recommendations) {
571
+ lines.push(`- **[${r.priority}] ${r.title}** \u2014 ${r.detail}`);
572
+ }
573
+ lines.push("");
574
+ }
575
+ lines.push(`## Detailed findings`);
576
+ lines.push("");
577
+ for (const c of scored.categories) {
578
+ lines.push(`### ${c.name} \u2014 ${Math.round(c.fraction * 100)}%`);
579
+ lines.push("");
580
+ for (const cr of c.criteria) {
581
+ lines.push(`- **${cr.title}** (${cr.rawScore}/${cr.maxScore}) \u2014 ${cr.justification}`);
582
+ for (const e of cr.evidence) lines.push(` - \`${e}\``);
583
+ }
584
+ lines.push("");
585
+ }
586
+ lines.push(`---`);
587
+ lines.push(`<sub>Generated by [edsger](https://www.npmjs.com/package/edsger).</sub>`);
588
+ return lines.join("\n");
589
+ }
590
+ function clamp(n, lo, hi) {
591
+ return Math.max(lo, Math.min(hi, n));
592
+ }
593
+ function round(n, dp) {
594
+ const f = 10 ** dp;
595
+ return Math.round(n * f) / f;
596
+ }
597
+
598
+ // src/core/schema.ts
599
+ import { z } from "zod";
600
+ var CriterionScoreSchema = z.object({
601
+ id: z.string().describe("Criterion id from the rubric"),
602
+ score: z.number().describe("Score for this criterion, 0..scoreScale"),
603
+ justification: z.string().describe("Why this score, in one or two sentences"),
604
+ evidence: z.array(z.string()).default([]).describe("File paths / snippets supporting the score")
958
605
  });
959
- // ============================================================
960
- // Subcommand: edsger discover <teamId> [runId]
961
- //
962
- // Scans every repo in the team's connected GitHub org and upserts an
963
- // inferred service for each into the service catalog. Drives an existing
964
- // discovery_runs row (created by the desktop) to running → success/failed.
965
- // ============================================================
966
- program
967
- .command('discover <teamId> [runId]')
968
- .description('Discover services by scanning every repo in the team’s connected GitHub organisation')
969
- .option('-v, --verbose', 'Verbose output')
970
- .option('--org <name>', 'Override the GitHub organisation to scan')
971
- .action(async (teamId, runId, opts) => {
972
- try {
973
- await runDiscover(teamId, runId, opts);
974
- }
975
- catch (error) {
976
- exitWithError(error);
977
- }
606
+ var CategoryScoreSchema = z.object({
607
+ id: z.string().describe("Category id from the rubric"),
608
+ criteria: z.array(CriterionScoreSchema)
978
609
  });
979
- // Subcommand: edsger sync-terraform <teamId>
980
- //
981
- // Clones the team's terraform repo (from teams.terraform_repo_full_name)
982
- // and lets the agent analyse .tf files to extract services, resources,
983
- // and dependencies. Alternatively, --dir for a local directory.
984
- // ============================================================
985
- program
986
- .command('sync-terraform <teamId>')
987
- .description('Scan a Terraform repo to discover services, AWS resources, and infrastructure dependencies')
988
- .option('-v, --verbose', 'Verbose output')
989
- .option('--dir <path>', 'Local directory to scan instead of cloning from GitHub')
990
- .action(async (teamId, opts) => {
991
- try {
992
- await runSyncTerraform(teamId, opts);
993
- }
994
- catch (error) {
995
- exitWithError(error);
996
- }
610
+ var BenchmarkResultSchema = z.object({
611
+ categories: z.array(CategoryScoreSchema),
612
+ summary: z.string().describe("2-4 sentence overall assessment"),
613
+ strengths: z.array(z.string()).default([]),
614
+ weaknesses: z.array(z.string()).default([]),
615
+ recommendations: z.array(
616
+ z.object({
617
+ priority: z.enum(["high", "medium", "low"]),
618
+ title: z.string(),
619
+ detail: z.string()
620
+ })
621
+ ).default([])
997
622
  });
998
- // ============================================================
999
- // Subcommand: edsger find-features <productId>
1000
- // ============================================================
1001
- program
1002
- .command('find-features <productId>')
1003
- .description("Synthesise feature opportunities from user feedback + intelligence reports + the product's codebase, and file each one as an issue")
1004
- .option('--branch <name>', 'Branch to scan (defaults to repo default branch)')
1005
- .option('--since <duration>', 'Feedback lookback window e.g. "30d", "12h", "4w" (default 90d)')
1006
- .option('--min-cluster-size <n>', 'Min feedback mentions for a theme to count as high-confidence (default 3)', (value) => {
1007
- const n = parseInt(value, 10);
1008
- if (Number.isNaN(n) || n <= 0) {
1009
- throw new Error('--min-cluster-size must be a positive integer');
1010
- }
1011
- return n;
1012
- })
1013
- .option('--max-suggestions <n>', 'Cap on opportunities the agent may surface (default 10)', (value) => {
1014
- const n = parseInt(value, 10);
1015
- if (Number.isNaN(n) || n <= 0) {
1016
- throw new Error('--max-suggestions must be a positive integer');
1017
- }
1018
- return n;
1019
- })
1020
- .option('--against-report <id>', 'Narrow the run to opportunities implied by a specific intelligence report')
1021
- .option('-v, --verbose', 'Verbose output')
1022
- .action(async (productId, opts) => {
1023
- try {
1024
- await runFindFeatures(productId, opts);
1025
- }
1026
- catch (error) {
1027
- exitWithError(error);
1028
- }
623
+ var SeveritySchema = z.enum(["critical", "high", "medium", "low", "info"]);
624
+ var ReviewFindingSchema = z.object({
625
+ focusArea: z.string().describe("Focus area id this finding relates to"),
626
+ severity: SeveritySchema,
627
+ file: z.string().describe("Repo-relative file path, or '-' if general"),
628
+ line: z.number().nullable().default(null).describe("1-based line in the new file, if applicable"),
629
+ title: z.string(),
630
+ detail: z.string().describe("What is wrong and why it matters"),
631
+ suggestion: z.string().nullable().default(null).describe("Concrete suggested fix")
1029
632
  });
1030
- // ============================================================
1031
- // Subcommand: edsger find-smells <productId>
1032
- // ============================================================
1033
- program
1034
- .command('find-smells [productId]')
1035
- .description("AI-audit a product's (or a standalone repository's) repo for code smells (refactor candidates, perf cliffs, dead code, type-safety gaps) and file each new finding as an issue")
1036
- .option('--repo-id <id>', 'Run in repo-only mode against a single repositories row (no product context)')
1037
- .option('--full', 'Force a full scan even if previous-scan state exists')
1038
- .option('--branch <name>', 'Branch to scan (defaults to repo default branch)')
1039
- .option('--max-files <n>', `Upper bound on files the auditor may Read (default ${FIND_SMELLS_DEFAULT_MAX_FILES})`, (value) => {
1040
- const n = parseInt(value, 10);
1041
- if (Number.isNaN(n) || n <= 0) {
1042
- throw new Error('--max-files must be a positive integer');
1043
- }
1044
- return n;
1045
- })
1046
- .option('--categories <list>', `Comma-separated category filter (${SMELL_CATEGORIES.join(',')})`, parseCategoriesOption)
1047
- .option('-v, --verbose', 'Verbose output')
1048
- .action(async (productId, opts) => {
1049
- try {
1050
- await runFindSmells(productId, opts);
1051
- }
1052
- catch (error) {
1053
- exitWithError(error);
1054
- }
633
+ var ReviewResultSchema = z.object({
634
+ summary: z.string().describe("Overall summary of the change and review"),
635
+ verdict: z.enum(["approve", "request_changes", "comment"]),
636
+ findings: z.array(ReviewFindingSchema).default([])
1055
637
  });
1056
- // ============================================================
1057
- // Subcommand: edsger find-architecture <productId>
1058
- // ============================================================
1059
- program
1060
- .command('find-architecture [productId]')
1061
- .description("AI-audit a product's (or a standalone repository's) repo for architectural concerns (layering, coupling, cycles, missing/duplicated abstractions, responsibility creep) and file each new finding as an issue")
1062
- .option('--repo-id <id>', 'Run in repo-only mode against a single repositories row (no product context)')
1063
- .option('--full', 'Force a full scan even if previous-scan state exists')
1064
- .option('--branch <name>', 'Branch to scan (defaults to repo default branch)')
1065
- .option('--max-files <n>', `Upper bound on files the auditor may Read (default ${FIND_ARCHITECTURE_DEFAULT_MAX_FILES})`, (value) => {
1066
- const n = parseInt(value, 10);
1067
- if (Number.isNaN(n) || n <= 0) {
1068
- throw new Error('--max-files must be a positive integer');
1069
- }
1070
- return n;
1071
- })
1072
- .option('-v, --verbose', 'Verbose output')
1073
- .action(async (productId, opts) => {
1074
- try {
1075
- await runFindArchitecture(productId, opts);
1076
- }
1077
- catch (error) {
1078
- exitWithError(error);
1079
- }
638
+ var ResolveResultSchema = z.object({
639
+ summary: z.string().describe("What was changed and why"),
640
+ changes: z.array(z.object({ file: z.string(), description: z.string() })).default([]),
641
+ testsRun: z.string().nullable().default(null).describe("Command used to verify, and its outcome"),
642
+ remaining: z.array(z.string()).default([]).describe("Anything still unresolved")
1080
643
  });
1081
- // ============================================================
1082
- // Subcommand: edsger product-test-cases <productId>
1083
- // ============================================================
1084
- program
1085
- .command('product-test-cases <productId>')
1086
- .description("Generate product-level regression test cases by exploring the product's repo. Existing approved cases are preserved; replaceable (draft / pending_approval) ones may be deleted and replaced.")
1087
- .option('--branch <name>', 'Branch to scan (defaults to repo default branch)')
1088
- .option('-v, --verbose', 'Verbose output')
1089
- .action(async (productId, opts) => {
644
+
645
+ // src/commands/benchmark.ts
646
+ async function runBenchmark(opts) {
647
+ const { config, path: configPath } = loadConfig(opts.cwd);
648
+ const configDir = configPath ? join3(configPath, "..") : opts.cwd;
649
+ const resolved = resolveStandard("benchmark", opts, config, configDir);
650
+ const standard = resolved.standard;
651
+ log.info(
652
+ `Benchmarking ${pc2.bold(basename(opts.cwd))} against ${pc2.bold(standard.name)} (languages: ${resolved.languages.join(", ") || "generic"})`
653
+ );
654
+ log.debug(`standard layers: ${resolved.layers.join(" \u2192 ")}`);
655
+ const prompt = buildPrompt(standard, opts.cwd);
656
+ const { result, costUsd, numTurns } = await runAgent({
657
+ prompt,
658
+ cwd: opts.cwd,
659
+ model: opts.model,
660
+ maxTurns: opts.maxTurns,
661
+ timeoutMs: opts.timeoutMs,
662
+ allowWrite: false,
663
+ verbose: opts.verbose,
664
+ resultShape: BenchmarkResultSchema.shape,
665
+ systemPromptAppend: "You are Edsger, a meticulous staff-level engineer performing an objective repository assessment. Inspect the actual code and configuration before scoring. Be evidence-driven and fair; cite concrete files. Do not modify any files."
666
+ });
667
+ if (!result) {
668
+ log.error(
669
+ "The agent did not produce a result. Try increasing --max-turns or check credentials."
670
+ );
671
+ return 1;
672
+ }
673
+ const scored = scoreBenchmark(standard, result);
674
+ const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
675
+ const md = renderBenchmarkMarkdown(scored, {
676
+ repo: basename(opts.cwd),
677
+ languages: resolved.languages,
678
+ layers: resolved.layers,
679
+ generatedAt,
680
+ model: opts.model
681
+ });
682
+ const jsonReport = {
683
+ schema: "edsger.benchmark/1",
684
+ generatedAt,
685
+ model: opts.model,
686
+ repo: basename(opts.cwd),
687
+ languages: resolved.languages,
688
+ standard: { name: standard.name, version: standard.version, layers: resolved.layers },
689
+ overall: scored.overall,
690
+ grade: scored.grade,
691
+ categories: scored.categories,
692
+ summary: scored.summary,
693
+ strengths: scored.strengths,
694
+ weaknesses: scored.weaknesses,
695
+ recommendations: scored.recommendations,
696
+ costUsd
697
+ };
698
+ if (!opts.noWrite && !opts.dryRun) {
699
+ const outDir = join3(opts.cwd, opts.out);
700
+ mkdirSync(outDir, { recursive: true });
701
+ writeFileSync(join3(outDir, "report.md"), md + "\n", "utf8");
702
+ writeFileSync(join3(outDir, "report.json"), JSON.stringify(jsonReport, null, 2) + "\n", "utf8");
703
+ log.success(`Report written to ${pc2.bold(join3(opts.out, "report.md"))}`);
704
+ }
705
+ printSummary(scored, numTurns, costUsd);
706
+ if (opts.json) process.stdout.write(JSON.stringify(jsonReport, null, 2) + "\n");
707
+ return 0;
708
+ }
709
+ function printSummary(scored, numTurns, costUsd) {
710
+ log.heading(`Score: ${scored.overall}/100 (Grade ${scored.grade})`);
711
+ for (const c of scored.categories) {
712
+ const pct = Math.round(c.fraction * 100);
713
+ process.stderr.write(` ${bar(pct)} ${String(pct).padStart(3)}% ${c.name}
714
+ `);
715
+ }
716
+ log.step(`${numTurns} turns \xB7 ~$${costUsd.toFixed(3)}`);
717
+ }
718
+ function bar(pct) {
719
+ const width = 20;
720
+ const filled = Math.round(pct / 100 * width);
721
+ const color = pct >= 80 ? pc2.green : pct >= 60 ? pc2.yellow : pc2.red;
722
+ return color("\u2588".repeat(filled)) + pc2.dim("\u2591".repeat(width - filled));
723
+ }
724
+ function buildPrompt(standard, cwd) {
725
+ const rubric = standard.categories.map((cat) => {
726
+ const crits = cat.criteria.map((cr) => {
727
+ const anchors = cr.rubric ? Object.entries(cr.rubric).map(([k, v]) => ` - ${k}: ${v}`).join("\n") : "";
728
+ return ` - id: ${cat.id}/${cr.id}
729
+ title: ${cr.title}
730
+ guidance: ${cr.guidance.trim()}` + (anchors ? `
731
+ anchors:
732
+ ${anchors}` : "");
733
+ }).join("\n");
734
+ return `- category: ${cat.id} (${cat.name}, weight ${cat.weight})
735
+ ${crits}`;
736
+ }).join("\n");
737
+ return [
738
+ `Assess the repository located at: ${cwd}`,
739
+ ``,
740
+ `Score it against the rubric below. Each criterion is scored from 0 to ${standard.scoreScale}`,
741
+ `(0 = absent/harmful, ${standard.scoreScale} = exemplary), using the level anchors as a guide.`,
742
+ ``,
743
+ `Method:`,
744
+ `1. Explore the repository structure, key source files, configuration, CI, tests, and docs.`,
745
+ ` Use Read/Grep/Glob and read-only Bash (e.g. ls, cat, git log). Do NOT modify anything.`,
746
+ `2. For each criterion, gather concrete evidence (file paths) before deciding a score.`,
747
+ `3. Be objective and consistent. Absence of evidence for a practice means a low score.`,
748
+ `4. When finished, call submit_result exactly once with a score for EVERY criterion id below,`,
749
+ ` grouped by category. Include a short justification and evidence paths for each.`,
750
+ ``,
751
+ `Rubric:`,
752
+ rubric
753
+ ].join("\n");
754
+ }
755
+
756
+ // src/commands/pr-review.ts
757
+ import pc3 from "picocolors";
758
+
759
+ // src/core/gh.ts
760
+ import { execFile } from "child_process";
761
+ import { mkdtempSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
762
+ import { tmpdir } from "os";
763
+ import { join as join4 } from "path";
764
+ import { promisify } from "util";
765
+ var exec = promisify(execFile);
766
+ async function gh(args, cwd) {
767
+ const { stdout } = await exec("gh", args, {
768
+ cwd,
769
+ maxBuffer: 64 * 1024 * 1024,
770
+ env: process.env
771
+ });
772
+ return stdout;
773
+ }
774
+ async function ensureGhReady() {
775
+ try {
776
+ await exec("gh", ["--version"]);
777
+ } catch {
778
+ throw new Error(
779
+ "GitHub CLI (gh) not found. Install it from https://cli.github.com and run `gh auth login`."
780
+ );
781
+ }
782
+ try {
783
+ await exec("gh", ["auth", "status"]);
784
+ } catch {
785
+ throw new Error("Not authenticated with GitHub. Run `gh auth login` first.");
786
+ }
787
+ }
788
+ async function getPrContext(ref, repo, cwd) {
789
+ const repoArgs = repo ? ["--repo", repo] : [];
790
+ const fields = "number,title,body,author,baseRefName,headRefName,state,url,isCrossRepository,files";
791
+ const metaRaw = await gh(["pr", "view", ref, ...repoArgs, "--json", fields], cwd);
792
+ const meta = JSON.parse(metaRaw);
793
+ const diff = await gh(["pr", "diff", ref, ...repoArgs], cwd);
794
+ return {
795
+ number: meta.number,
796
+ title: meta.title,
797
+ body: meta.body ?? "",
798
+ author: meta.author?.login ?? "unknown",
799
+ baseRefName: meta.baseRefName,
800
+ headRefName: meta.headRefName,
801
+ state: meta.state,
802
+ url: meta.url,
803
+ isCrossRepository: Boolean(meta.isCrossRepository),
804
+ files: meta.files ?? [],
805
+ diff
806
+ };
807
+ }
808
+ async function checkoutPr(ref, repo, cwd) {
809
+ const repoArgs = repo ? ["--repo", repo] : [];
810
+ await gh(["pr", "checkout", ref, ...repoArgs], cwd);
811
+ }
812
+ async function postReview(ctx, repo, event, body, inline, cwd) {
813
+ const target = repo ?? await currentRepoSlug(cwd);
814
+ if (inline.length === 0) {
815
+ const flag = event === "APPROVE" ? "--approve" : event === "REQUEST_CHANGES" ? "--request-changes" : "--comment";
816
+ await gh(["pr", "review", String(ctx.number), "--repo", target, flag, "--body", body], cwd);
817
+ return;
818
+ }
819
+ const payload = {
820
+ body,
821
+ event,
822
+ comments: inline.map((c) => ({ path: c.path, line: c.line, side: "RIGHT", body: c.body }))
823
+ };
824
+ const dir = mkdtempSync(join4(tmpdir(), "edsger-review-"));
825
+ const file = join4(dir, "review.json");
826
+ writeFileSync2(file, JSON.stringify(payload), "utf8");
827
+ try {
828
+ await gh(
829
+ ["api", "--method", "POST", `repos/${target}/pulls/${ctx.number}/reviews`, "--input", file],
830
+ cwd
831
+ );
832
+ } catch {
833
+ const flag = event === "APPROVE" ? "--approve" : event === "REQUEST_CHANGES" ? "--request-changes" : "--comment";
834
+ await gh(["pr", "review", String(ctx.number), "--repo", target, flag, "--body", body], cwd);
835
+ } finally {
836
+ rmSync(dir, { recursive: true, force: true });
837
+ }
838
+ }
839
+ async function currentRepoSlug(cwd) {
840
+ const raw = await gh(["repo", "view", "--json", "nameWithOwner"], cwd);
841
+ return JSON.parse(raw).nameWithOwner;
842
+ }
843
+ async function getPrFeedback(ctx, repo, cwd) {
844
+ const target = repo ?? await currentRepoSlug(cwd);
845
+ const reviewRaw = await gh(
846
+ ["api", `repos/${target}/pulls/${ctx.number}/comments`, "--paginate"],
847
+ cwd
848
+ ).catch(() => "[]");
849
+ const issueRaw = await gh(
850
+ ["api", `repos/${target}/issues/${ctx.number}/comments`, "--paginate"],
851
+ cwd
852
+ ).catch(() => "[]");
853
+ const review = JSON.parse(reviewRaw);
854
+ const issue = JSON.parse(issueRaw);
855
+ return {
856
+ reviewComments: review.map((c) => ({
857
+ author: c.user?.login ?? "unknown",
858
+ path: c.path,
859
+ line: c.line,
860
+ body: c.body
861
+ })),
862
+ issueComments: issue.map((c) => ({ author: c.user?.login ?? "unknown", body: c.body }))
863
+ };
864
+ }
865
+
866
+ // src/commands/pr-review.ts
867
+ var SEVERITY_RANK = {
868
+ critical: 4,
869
+ high: 3,
870
+ medium: 2,
871
+ low: 1,
872
+ info: 0
873
+ };
874
+ async function runPrReview(opts) {
875
+ await ensureGhReady();
876
+ log.info(`Fetching PR ${pc3.bold(opts.pr)}${opts.repo ? ` from ${opts.repo}` : ""}`);
877
+ const ctx = await getPrContext(opts.pr, opts.repo, opts.cwd);
878
+ const { config, path: configPath } = loadConfig(opts.cwd);
879
+ const configDir = configPath ? `${configPath}/..` : opts.cwd;
880
+ const fileHint = inferLanguagesFromFiles(
881
+ ctx.files.map((f) => f.path),
882
+ findBundledAssetsDir()
883
+ );
884
+ const resolved = resolveStandard("review", opts, config, configDir, fileHint);
885
+ const standard = resolved.standard;
886
+ log.info(
887
+ `Reviewing "${pc3.bold(ctx.title)}" (#${ctx.number}, ${ctx.files.length} files) against ${pc3.bold(standard.name)}`
888
+ );
889
+ const { result, costUsd, numTurns } = await runAgent({
890
+ prompt: buildPrompt2(standard, ctx),
891
+ cwd: opts.cwd,
892
+ model: opts.model,
893
+ maxTurns: opts.maxTurns,
894
+ timeoutMs: opts.timeoutMs,
895
+ allowWrite: false,
896
+ verbose: opts.verbose,
897
+ resultShape: ReviewResultSchema.shape,
898
+ systemPromptAppend: "You are Edsger, a senior code reviewer. Review only what the diff changes, but read surrounding code for context. Be specific, kind, and actionable; prefer high-signal findings over nitpicks. Do not modify any files."
899
+ });
900
+ if (!result) {
901
+ log.error("The agent did not produce a review.");
902
+ return 1;
903
+ }
904
+ const event = decideEvent(result, standard);
905
+ const body = renderBody(result, ctx, standard, resolved.layers);
906
+ const inline = buildInlineComments(result, ctx, standard);
907
+ printPreview(result, event, numTurns, costUsd);
908
+ if (opts.json) {
909
+ process.stdout.write(
910
+ JSON.stringify(
911
+ { verdict: result.verdict, event, findings: result.findings, summary: result.summary },
912
+ null,
913
+ 2
914
+ ) + "\n"
915
+ );
916
+ }
917
+ if (opts.post && !opts.dryRun) {
918
+ await postReview(ctx, opts.repo, event, body, inline, opts.cwd);
919
+ log.success(`Posted review (${event}) to ${ctx.url}`);
920
+ } else {
921
+ log.warn(`Preview only. Re-run with ${pc3.bold("--post")} to submit this review to GitHub.`);
922
+ process.stderr.write("\n" + body + "\n");
923
+ }
924
+ return 0;
925
+ }
926
+ function decideEvent(result, standard) {
927
+ const blocking = new Set(standard.policy.blockingSeverities);
928
+ const hasBlocking = result.findings.some((f) => blocking.has(f.severity));
929
+ if (hasBlocking) return "REQUEST_CHANGES";
930
+ if (result.verdict === "approve") return "APPROVE";
931
+ if (result.verdict === "request_changes") return "REQUEST_CHANGES";
932
+ return "COMMENT";
933
+ }
934
+ function buildInlineComments(result, ctx, standard) {
935
+ const changed = new Set(ctx.files.map((f) => f.path));
936
+ const sorted = [...result.findings].sort(
937
+ (a, b) => SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity]
938
+ );
939
+ const out = [];
940
+ for (const f of sorted) {
941
+ if (out.length >= standard.policy.maxComments) break;
942
+ if (f.line && f.file && f.file !== "-" && changed.has(f.file)) {
943
+ out.push({ path: f.file, line: f.line, body: renderFinding(f) });
944
+ }
945
+ }
946
+ return out;
947
+ }
948
+ function renderFinding(f) {
949
+ const head = `**[${f.severity}] ${f.title}**`;
950
+ const fix = f.suggestion ? `
951
+
952
+ _Suggestion:_ ${f.suggestion}` : "";
953
+ return `${head}
954
+
955
+ ${f.detail}${fix}`;
956
+ }
957
+ function renderBody(result, ctx, standard, layers) {
958
+ const counts = countBySeverity(result.findings);
959
+ const lines = [];
960
+ lines.push(`## Edsger review \u2014 ${verdictLabel(result.verdict)}`);
961
+ lines.push("");
962
+ lines.push(result.summary);
963
+ lines.push("");
964
+ lines.push(
965
+ `**Findings:** ` + ["critical", "high", "medium", "low", "info"].filter((s) => counts[s]).map((s) => `${counts[s]} ${s}`).join(", ") || "no blocking issues"
966
+ );
967
+ lines.push("");
968
+ const general = result.findings.filter((f) => !f.line || f.file === "-");
969
+ if (general.length) {
970
+ lines.push(`### General comments`);
971
+ lines.push("");
972
+ for (const f of general) lines.push(`- ${renderFinding(f).replace(/\n+/g, " ")}`);
973
+ lines.push("");
974
+ }
975
+ lines.push("---");
976
+ lines.push(
977
+ `<sub>Reviewed against ${standard.name} v${standard.version} (${layers.join(" \u2192 ")}) by [edsger](https://www.npmjs.com/package/edsger).</sub>`
978
+ );
979
+ void ctx;
980
+ return lines.join("\n");
981
+ }
982
+ function printPreview(result, event, numTurns, costUsd) {
983
+ log.heading(`Verdict: ${event}`);
984
+ const counts = countBySeverity(result.findings);
985
+ for (const s of ["critical", "high", "medium", "low", "info"]) {
986
+ if (counts[s]) process.stderr.write(` ${sevColor(s)(s.padEnd(8))} ${counts[s]}
987
+ `);
988
+ }
989
+ log.step(`${numTurns} turns \xB7 ~$${costUsd.toFixed(3)}`);
990
+ }
991
+ function countBySeverity(findings) {
992
+ const c = { critical: 0, high: 0, medium: 0, low: 0, info: 0 };
993
+ for (const f of findings) c[f.severity]++;
994
+ return c;
995
+ }
996
+ function sevColor(s) {
997
+ if (s === "critical" || s === "high") return pc3.red;
998
+ if (s === "medium") return pc3.yellow;
999
+ return pc3.dim;
1000
+ }
1001
+ function verdictLabel(v) {
1002
+ return v === "approve" ? "Approve" : v === "request_changes" ? "Request changes" : "Comment";
1003
+ }
1004
+ function buildPrompt2(standard, ctx) {
1005
+ const focus = standard.focusAreas.map((fa) => {
1006
+ const checklist = (fa.checklist ?? []).map((c) => ` - ${c}`).join("\n");
1007
+ return `- id: ${fa.id} (${fa.title}, default severity ${fa.defaultSeverity ?? "medium"})
1008
+ guidance: ${fa.guidance.trim()}` + (checklist ? `
1009
+ checklist:
1010
+ ${checklist}` : "");
1011
+ }).join("\n");
1012
+ return [
1013
+ `Review the following pull request.`,
1014
+ ``,
1015
+ `Title: ${ctx.title}`,
1016
+ `Author: ${ctx.author}`,
1017
+ `Base: ${ctx.baseRefName} Head: ${ctx.headRefName}`,
1018
+ `Description:`,
1019
+ ctx.body ? indent(ctx.body) : " (no description)",
1020
+ ``,
1021
+ `Changed files: ${ctx.files.map((f) => f.path).join(", ")}`,
1022
+ ``,
1023
+ `Method:`,
1024
+ `1. Read the diff below. Use Read/Grep/Glob to inspect surrounding code in the working`,
1025
+ ` directory for context when needed. Do NOT modify files.`,
1026
+ `2. Evaluate the change against the focus areas. Assign each finding a severity`,
1027
+ ` (critical/high/medium/low/info) and, where it maps to a changed line, the file path`,
1028
+ ` and the 1-based line number in the NEW version of the file.`,
1029
+ `3. Verify the change does what its description claims; flag missing tests for new logic.`,
1030
+ `4. Choose a verdict: approve, request_changes, or comment. Then call submit_result once.`,
1031
+ ``,
1032
+ `Focus areas:`,
1033
+ focus,
1034
+ ``,
1035
+ `Unified diff:`,
1036
+ "```diff",
1037
+ truncate(ctx.diff, 18e4),
1038
+ "```"
1039
+ ].join("\n");
1040
+ }
1041
+ function indent(s) {
1042
+ return s.split("\n").map((l) => ` ${l}`).join("\n");
1043
+ }
1044
+ function truncate(s, max) {
1045
+ return s.length > max ? s.slice(0, max) + "\n... [diff truncated] ..." : s;
1046
+ }
1047
+
1048
+ // src/commands/pr-resolve.ts
1049
+ import { execFile as execFile2 } from "child_process";
1050
+ import { promisify as promisify2 } from "util";
1051
+ import pc4 from "picocolors";
1052
+ var exec2 = promisify2(execFile2);
1053
+ async function runPrResolve(opts) {
1054
+ await ensureGhReady();
1055
+ log.info(`Fetching PR ${pc4.bold(opts.pr)}${opts.repo ? ` from ${opts.repo}` : ""}`);
1056
+ const ctx = await getPrContext(opts.pr, opts.repo, opts.cwd);
1057
+ const feedback = await getPrFeedback(ctx, opts.repo, opts.cwd).catch(() => ({
1058
+ reviewComments: [],
1059
+ issueComments: []
1060
+ }));
1061
+ if (opts.checkout && !opts.dryRun) {
1062
+ log.step(`checking out PR branch ${ctx.headRefName}`);
1063
+ await checkoutPr(opts.pr, opts.repo, opts.cwd);
1064
+ }
1065
+ log.info(
1066
+ `Resolving "${pc4.bold(ctx.title)}" (#${ctx.number}) \u2014 ${feedback.reviewComments.length} review comments`
1067
+ );
1068
+ const { result, costUsd, numTurns } = await runAgent({
1069
+ prompt: buildPrompt3(ctx, feedback, opts.instruction),
1070
+ cwd: opts.cwd,
1071
+ model: opts.model,
1072
+ maxTurns: Math.max(opts.maxTurns, 30),
1073
+ timeoutMs: Math.max(opts.timeoutMs, 20 * 6e4),
1074
+ allowWrite: true,
1075
+ verbose: opts.verbose,
1076
+ resultShape: ResolveResultSchema.shape,
1077
+ systemPromptAppend: "You are Edsger, a careful senior engineer fixing a pull request. Make the smallest correct change that addresses the feedback. Match the existing code style. After editing, run the project's tests/linters to verify. Never weaken tests to make them pass, and never commit secrets."
1078
+ });
1079
+ if (!result) {
1080
+ log.error("The agent did not produce a result.");
1081
+ return 1;
1082
+ }
1083
+ printSummary2(result, numTurns, costUsd);
1084
+ if (opts.json) process.stdout.write(JSON.stringify(result, null, 2) + "\n");
1085
+ if (opts.push && !opts.dryRun) {
1086
+ const pushed = await commitAndPush(ctx, result, opts.cwd, opts.checkout);
1087
+ if (pushed) log.success(`Committed and pushed to ${ctx.headRefName}`);
1088
+ else log.warn("Nothing to commit \u2014 working tree is clean.");
1089
+ } else {
1090
+ log.warn(
1091
+ `Changes left in the working tree. Review them, then commit/push (or re-run with ${pc4.bold("--push")}).`
1092
+ );
1093
+ }
1094
+ return 0;
1095
+ }
1096
+ async function commitAndPush(ctx, result, cwd, checkedOut) {
1097
+ const status = await exec2("git", ["status", "--porcelain"], { cwd });
1098
+ if (!status.stdout.trim()) return false;
1099
+ await exec2("git", ["add", "-A"], { cwd });
1100
+ const message = `fix: address review feedback on #${ctx.number}
1101
+
1102
+ ${result.summary}`;
1103
+ await exec2("git", ["commit", "-m", message], { cwd });
1104
+ if (checkedOut) {
1090
1105
  try {
1091
- await runProductTestCases(productId, opts);
1092
- }
1093
- catch (error) {
1094
- exitWithError(error);
1095
- }
1106
+ await exec2("git", ["push"], { cwd });
1107
+ return true;
1108
+ } catch (err) {
1109
+ if (ctx.isCrossRepository) {
1110
+ throw new Error(
1111
+ `Could not push to the fork's branch automatically: ${errText(err)}
1112
+ Push manually, or ensure the PR branch was checked out with gh.`
1113
+ );
1114
+ }
1115
+ }
1116
+ }
1117
+ if (ctx.isCrossRepository) {
1118
+ throw new Error(
1119
+ "This PR is from a fork. Re-run without --no-checkout so gh can configure the push target, or commit and push to the fork manually."
1120
+ );
1121
+ }
1122
+ await exec2("git", ["push", "origin", `HEAD:${ctx.headRefName}`], { cwd });
1123
+ return true;
1124
+ }
1125
+ function errText(err) {
1126
+ return err instanceof Error ? err.message.split("\n")[0] ?? "" : String(err);
1127
+ }
1128
+ function printSummary2(result, numTurns, costUsd) {
1129
+ log.heading("Resolution summary");
1130
+ process.stderr.write(` ${result.summary}
1131
+
1132
+ `);
1133
+ if (result.changes.length) {
1134
+ for (const c of result.changes)
1135
+ process.stderr.write(` ${pc4.green("~")} ${c.file} \u2014 ${c.description}
1136
+ `);
1137
+ }
1138
+ if (result.testsRun) log.step(`verification: ${result.testsRun}`);
1139
+ if (result.remaining.length) {
1140
+ log.warn("Remaining items:");
1141
+ for (const r of result.remaining) process.stderr.write(` - ${r}
1142
+ `);
1143
+ }
1144
+ log.step(`${numTurns} turns \xB7 ~$${costUsd.toFixed(3)}`);
1145
+ }
1146
+ function buildPrompt3(ctx, feedback, instruction) {
1147
+ const reviewComments = feedback.reviewComments.length ? feedback.reviewComments.map((c) => ` - ${c.path}${c.line ? `:${c.line}` : ""} (${c.author}): ${c.body}`).join("\n") : " (none)";
1148
+ const issueComments = feedback.issueComments.length ? feedback.issueComments.map((c) => ` - ${c.author}: ${c.body}`).join("\n") : " (none)";
1149
+ return [
1150
+ `Resolve the open items on this pull request by editing the code in the working directory.`,
1151
+ ``,
1152
+ `PR #${ctx.number}: ${ctx.title}`,
1153
+ `Base: ${ctx.baseRefName} Head: ${ctx.headRefName}`,
1154
+ ``,
1155
+ instruction ? `Primary instruction: ${instruction}` : `Primary goal: address the reviewer feedback below.`,
1156
+ ``,
1157
+ `Inline review comments:`,
1158
+ reviewComments,
1159
+ ``,
1160
+ `Conversation comments:`,
1161
+ issueComments,
1162
+ ``,
1163
+ `Method:`,
1164
+ `1. Understand each requested change. Use Read/Grep/Glob to locate the relevant code.`,
1165
+ `2. Make the minimal, correct edits with Edit/Write. Match existing conventions.`,
1166
+ `3. Run the project's tests and linters (via Bash) to verify your changes pass.`,
1167
+ `4. Do not weaken or delete tests to make them pass; do not introduce secrets.`,
1168
+ `5. Call submit_result once with a summary, the list of files changed, how you verified,`,
1169
+ ` and anything you could not resolve.`
1170
+ ].join("\n");
1171
+ }
1172
+
1173
+ // src/commands/skills.ts
1174
+ import {
1175
+ cpSync,
1176
+ existsSync as existsSync3,
1177
+ mkdirSync as mkdirSync2,
1178
+ readFileSync as readFileSync2,
1179
+ readdirSync as readdirSync2,
1180
+ rmSync as rmSync2,
1181
+ statSync as statSync2,
1182
+ writeFileSync as writeFileSync3
1183
+ } from "fs";
1184
+ import { homedir as homedir2 } from "os";
1185
+ import { join as join5 } from "path";
1186
+ import pc5 from "picocolors";
1187
+ var MANAGED = ["benchmark", "pr-review", "pr-resolve"];
1188
+ function targetSkillsDir(scope) {
1189
+ return scope.global ? join5(homedir2(), ".claude", "skills") : join5(scope.cwd, ".claude", "skills");
1190
+ }
1191
+ function sourceSkillsDir() {
1192
+ return join5(findBundledAssetsDir(), "skills");
1193
+ }
1194
+ async function runSkillsInstall(opts) {
1195
+ const assetsDir = findBundledAssetsDir();
1196
+ const src = sourceSkillsDir();
1197
+ if (!existsSync3(src)) {
1198
+ log.error(`Bundled skills not found at ${src}. Reinstall edsger.`);
1199
+ return 1;
1200
+ }
1201
+ const dest = targetSkillsDir(opts);
1202
+ mkdirSync2(dest, { recursive: true });
1203
+ const available = readdirSync2(src).filter((n) => existsSync3(join5(src, n, "SKILL.md")));
1204
+ let installed = 0;
1205
+ for (const name of available) {
1206
+ const outDir = join5(dest, name);
1207
+ if (existsSync3(outDir) && !opts.force) {
1208
+ log.warn(`skill "${name}" already exists \u2014 use --force to overwrite`);
1209
+ continue;
1210
+ }
1211
+ rmSync2(outDir, { recursive: true, force: true });
1212
+ cpSync(join5(src, name), outDir, { recursive: true });
1213
+ const skillFile = join5(outDir, "SKILL.md");
1214
+ const rewritten = readFileSync2(skillFile, "utf8").split("${CLAUDE_PLUGIN_ROOT}").join(assetsDir);
1215
+ writeFileSync3(skillFile, rewritten, "utf8");
1216
+ installed++;
1217
+ log.success(`installed /${name}`);
1218
+ }
1219
+ if (installed === 0) {
1220
+ log.info("Nothing installed.");
1221
+ return 0;
1222
+ }
1223
+ log.heading(`Installed ${installed} skill(s) into ${pc5.bold(dest)}`);
1224
+ log.step(`scope: ${opts.global ? "user (all projects)" : "this project"}`);
1225
+ log.step(`standards: ${assetsDir}`);
1226
+ log.step("Open Claude Code and run /benchmark, /pr-review, or /pr-resolve.");
1227
+ return 0;
1228
+ }
1229
+ async function runSkillsUninstall(opts) {
1230
+ const dest = targetSkillsDir(opts);
1231
+ let removed = 0;
1232
+ for (const name of MANAGED) {
1233
+ const dir = join5(dest, name);
1234
+ if (existsSync3(dir)) {
1235
+ rmSync2(dir, { recursive: true, force: true });
1236
+ removed++;
1237
+ log.success(`removed /${name}`);
1238
+ }
1239
+ }
1240
+ log.info(removed ? `Removed ${removed} skill(s) from ${dest}` : "No edsger skills found.");
1241
+ return 0;
1242
+ }
1243
+ async function runSkillsList(opts) {
1244
+ for (const [label, scope] of [
1245
+ ["user", { ...opts, global: true }],
1246
+ ["project", { ...opts, global: false }]
1247
+ ]) {
1248
+ const dir = targetSkillsDir(scope);
1249
+ const present = MANAGED.filter((n) => {
1250
+ const p = join5(dir, n, "SKILL.md");
1251
+ return existsSync3(p) && statSync2(p).isFile();
1252
+ });
1253
+ log.heading(`${label}: ${dir}`);
1254
+ if (present.length) for (const n of present) process.stderr.write(` ${pc5.green("\u2713")} /${n}
1255
+ `);
1256
+ else process.stderr.write(` ${pc5.dim("(none installed)")}
1257
+ `);
1258
+ }
1259
+ return 0;
1260
+ }
1261
+
1262
+ // src/index.ts
1263
+ var VERSION = "0.78.0";
1264
+ var DEFAULT_MODEL = "claude-sonnet-4-6";
1265
+ function toGlobal(raw) {
1266
+ setVerbose(Boolean(raw.verbose));
1267
+ return {
1268
+ cwd: resolve2(raw.cwd ?? process.cwd()),
1269
+ model: raw.model ?? process.env.EDSGER_MODEL ?? DEFAULT_MODEL,
1270
+ standardPath: raw.standard,
1271
+ assetsPath: raw.assets,
1272
+ lang: raw.lang,
1273
+ json: Boolean(raw.json),
1274
+ verbose: Boolean(raw.verbose),
1275
+ dryRun: Boolean(raw.dryRun),
1276
+ maxTurns: raw.maxTurns ? Number.parseInt(raw.maxTurns, 10) : 20,
1277
+ timeoutMs: (raw.timeout ? Number.parseFloat(raw.timeout) : 15) * 6e4
1278
+ };
1279
+ }
1280
+ function addGlobalOptions(cmd) {
1281
+ return cmd.option("-C, --cwd <dir>", "directory of the repository to operate on").addOption(new Option("-m, --model <model>", "model id for the agent").default(void 0)).option("--standard <path>", "path to a custom standards dir or file (overrides bundled)").option("--assets <path>", "override the entire assets root").option("--lang <id>", "force a language id, skipping detection").option("--max-turns <n>", "max agentic turns").option("--timeout <minutes>", "hard wall-clock limit per agent run (default 15)").option("--json", "print machine-readable JSON to stdout").option("-v, --verbose", "verbose logging").option("--dry-run", "run the agent but make no persistent/external changes");
1282
+ }
1283
+ async function guard(fn) {
1284
+ try {
1285
+ const code = await fn();
1286
+ process.exitCode = code;
1287
+ } catch (err) {
1288
+ log.error(err instanceof Error ? err.message : String(err));
1289
+ if (process.env.EDSGER_DEBUG && err instanceof Error)
1290
+ process.stderr.write((err.stack ?? "") + "\n");
1291
+ process.exitCode = 1;
1292
+ }
1293
+ }
1294
+ var program = new Command();
1295
+ program.name("edsger").description(
1296
+ "Agentic CLI to benchmark repositories and review/resolve pull requests\nagainst industrial-grade standards (from edsger-assets, fully overridable)."
1297
+ ).version(VERSION, "-V, --version");
1298
+ addGlobalOptions(
1299
+ program.command("benchmark").description("Score a repository against a benchmark rubric and write a report").option("--out <dir>", "report output directory (relative to repo)", ".edsger/benchmark").option("--no-write", "do not write report files into the repo")
1300
+ ).action(async (opts) => {
1301
+ await guard(
1302
+ () => runBenchmark({ ...toGlobal(opts), out: opts.out, noWrite: opts.write === false })
1303
+ );
1096
1304
  });
1097
- // ============================================================
1098
- // Subcommand: edsger recipes <productId>
1099
- // ============================================================
1100
- program
1101
- .command('recipes [productId]')
1102
- .description("Scan a product's (or standalone repository's) repo for the implementation recipes it uses (which services/tools are chained together to deliver each capability) and persist them via the recipes / product_recipes (or repository_recipes) tables. Writes against the pending recipe_scans row identified by --scan-id.")
1103
- .requiredOption('--scan-id <id>', 'Pending recipe_scans row id to drive (created by the desktop UI before invocation)')
1104
- .option('--repo-id <id>', 'Run in repo-only mode against a single repositories row (no product context)')
1105
- .option('-g, --guidance <text>', 'Human direction for the AI (focus areas, exclusions)')
1106
- .option('-v, --verbose', 'Verbose output')
1107
- .action(async (productId, opts) => {
1108
- try {
1109
- if (!productId && !opts.repoId) {
1110
- throw new Error('Provide a productId or --repo-id (repo-only mode) for recipes');
1111
- }
1112
- await runRecipes(productId, {
1113
- scanId: opts.scanId,
1114
- repoId: opts.repoId,
1115
- guidance: opts.guidance,
1116
- verbose: opts.verbose,
1117
- });
1118
- }
1119
- catch (error) {
1120
- exitWithError(error);
1121
- }
1305
+ addGlobalOptions(
1306
+ program.command("pr-review").description("Review a pull request against the review standard (requires gh)").argument("<pr>", "PR number, URL, or branch").option("--repo <owner/repo>", "target repository (defaults to current)").option("--post", "submit the review to GitHub (otherwise preview only)")
1307
+ ).action(async (pr, opts) => {
1308
+ await guard(
1309
+ () => runPrReview({ ...toGlobal(opts), pr, repo: opts.repo, post: Boolean(opts.post) })
1310
+ );
1122
1311
  });
1123
- // ============================================================
1124
- // Subcommand: edsger features <productId>
1125
- // ============================================================
1126
- program
1127
- .command('features <productId>')
1128
- .description('Scan every repository linked to a product for the user-facing features it delivers and persist them via the product_features table. Manually defined features are enriched, never rewritten. Writes against the pending feature_scans row identified by --scan-id.')
1129
- .requiredOption('--scan-id <id>', 'Pending feature_scans row id to drive (created by the desktop UI before invocation)')
1130
- .option('-g, --guidance <text>', 'Human direction for the AI (focus areas, exclusions)')
1131
- .option('-v, --verbose', 'Verbose output')
1132
- .action(async (productId, opts) => {
1133
- try {
1134
- await runFeatures(productId, {
1135
- scanId: opts.scanId,
1136
- guidance: opts.guidance,
1137
- verbose: opts.verbose,
1138
- });
1139
- }
1140
- catch (error) {
1141
- exitWithError(error);
1142
- }
1312
+ addGlobalOptions(
1313
+ program.command("pr-resolve").description("Resolve review feedback / fix a pull request (requires gh)").argument("<pr>", "PR number, URL, or branch").option("--repo <owner/repo>", "target repository (defaults to current)").option("--instruction <text>", "what to do (defaults to addressing review comments)").option("--no-checkout", "do not check out the PR branch first").option("--push", "commit and push the changes when done")
1314
+ ).action(
1315
+ async (pr, opts) => {
1316
+ await guard(
1317
+ () => runPrResolve({
1318
+ ...toGlobal(opts),
1319
+ pr,
1320
+ repo: opts.repo,
1321
+ instruction: opts.instruction,
1322
+ checkout: opts.checkout !== false,
1323
+ push: Boolean(opts.push)
1324
+ })
1325
+ );
1326
+ }
1327
+ );
1328
+ var skills = program.command("skills").description("install edsger as Claude Code skills (/benchmark, /pr-review, /pr-resolve)");
1329
+ skills.command("install").description("install the skills into Claude Code").option("--global", "install for the current user (~/.claude/skills) [default]").option("--project", "install into ./.claude/skills instead").option("-C, --cwd <dir>", "project directory (with --project)").option("--force", "overwrite existing skills").action(async (opts) => {
1330
+ await guard(
1331
+ () => runSkillsInstall({
1332
+ cwd: resolve2(opts.cwd ?? process.cwd()),
1333
+ global: opts.project ? false : true,
1334
+ force: Boolean(opts.force)
1335
+ })
1336
+ );
1143
1337
  });
1144
- // ============================================================
1145
- // Subcommand: edsger pr-resolve <productId>
1146
- // ============================================================
1147
- program
1148
- .command('pr-resolve [productId]')
1149
- .description('AI-resolve change requests on a GitHub PR for a product (or standalone repository)')
1150
- .requiredOption('--pr-url <url>', 'GitHub PR URL')
1151
- .option('--pr-id <id>', 'Pull request record ID in database')
1152
- .option('--repo-id <id>', 'Run in repo-only mode against a single repositories row (no product context)')
1153
- .option('--no-learn', 'Skip checklist learning after resolve')
1154
- .option('-v, --verbose', 'Verbose output')
1155
- .action(async (productId, opts) => {
1156
- try {
1157
- if (!productId && !opts.repoId) {
1158
- throw new Error('Provide a productId or --repo-id (repo-only mode) for pr-resolve');
1159
- }
1160
- await runPRResolve(productId, opts);
1161
- }
1162
- catch (error) {
1163
- exitWithError(error);
1164
- }
1338
+ skills.command("uninstall").description("remove the edsger skills from Claude Code").option("--global", "remove from the user scope (~/.claude/skills) [default]").option("--project", "remove from ./.claude/skills instead").option("-C, --cwd <dir>", "project directory (with --project)").action(async (opts) => {
1339
+ await guard(
1340
+ () => runSkillsUninstall({
1341
+ cwd: resolve2(opts.cwd ?? process.cwd()),
1342
+ global: opts.project ? false : true
1343
+ })
1344
+ );
1165
1345
  });
1166
- // ============================================================
1167
- // Default command (options-based, backward compatible)
1168
- // ============================================================
1169
- program
1170
- .option('-r, --review', 'Review code changes')
1171
- .option('-s, --staged', 'Review only staged changes')
1172
- .option('-f, --files <patterns...>', 'Review specific file patterns')
1173
- .option('--refactor', 'Refactor code in current directory')
1174
- .option('--init', 'Initialize .edsger directory with project templates')
1175
- .option('--product-level', 'Use legacy product-level workflow (requires EDSGER_PRODUCT_ID, EDSGER_MCP_SERVER_URL, EDSGER_MCP_TOKEN env vars)')
1176
- .option('--watch-tasks <productId>', 'Watch and execute pending tasks for a product')
1177
- .option('--concurrency <number>', 'Max concurrent issues to process (default: 3)', parseInt)
1178
- .option('-c, --config <path>', 'Path to config file')
1179
- .option('-v, --verbose', 'Verbose output');
1180
- program.action(async (options, command) => {
1181
- // Commander silently falls through to this default action when the user
1182
- // passes a subcommand name that isn't registered (e.g. an old binary that
1183
- // doesn't yet know about `sync-sentry-issues`). That makes version-skew
1184
- // bugs look like the agent inexplicably running with the wrong intent.
1185
- // Treat any leftover positional arg as an unknown command and abort.
1186
- if (command.args.length > 0) {
1187
- logError(`Run 'edsger --help' to see available commands.`);
1188
- exitWithError(new Error(`Unknown command: ${command.args[0]}`));
1189
- return;
1190
- }
1191
- try {
1192
- await runEdsger(options);
1193
- }
1194
- catch (error) {
1195
- exitWithError(error);
1196
- }
1346
+ skills.command("list").description("show which edsger skills are installed").option("-C, --cwd <dir>", "project directory").action(async (opts) => {
1347
+ await guard(() => runSkillsList({ cwd: resolve2(opts.cwd ?? process.cwd()), global: true }));
1197
1348
  });
1198
- export const runEdsger = async (options) => {
1199
- // Handle init mode
1200
- if (options.init) {
1201
- await runInit(options);
1202
- return;
1203
- }
1204
- // Handle task watcher mode
1205
- if (options.watchTasks) {
1206
- await runTaskWorker(options);
1207
- return;
1208
- }
1209
- // Handle refactor mode
1210
- if (options.refactor) {
1211
- await runRefactor(options);
1212
- return;
1213
- }
1214
- // Handle code review mode
1215
- if (options.review || options.staged || options.files) {
1216
- await runCodeReview(options);
1217
- return;
1218
- }
1219
- // Handle legacy product-level workflow mode
1220
- if (options.productLevel) {
1221
- logInfo('Running in legacy product-level mode...');
1222
- await runWorkflow(options);
1223
- return;
1224
- }
1225
- // Auto-detect: if EDSGER_PRODUCT_ID is set, use legacy mode for backward compatibility
1226
- if (process.env.EDSGER_PRODUCT_ID) {
1227
- logInfo('EDSGER_PRODUCT_ID detected. Using legacy product-level mode. Use `edsger login` for the new cross-product mode.');
1228
- await runWorkflow(options);
1229
- return;
1230
- }
1231
- // Default: new agent workflow mode (cross-product)
1232
- await runAgentWorkflow(options);
1233
- };
1234
- // Only parse when this file is run directly (not imported as module)
1235
- // Check if this is the main module being executed
1236
- const isMainModule = import.meta.url === `file://${process.argv[1]}` ||
1237
- process.argv[1]?.endsWith('/edsger') ||
1238
- process.argv[1]?.endsWith('\\edsger') ||
1239
- process.argv[1]?.endsWith('index.js');
1240
- if (isMainModule) {
1241
- program.parse();
1242
- }
1349
+ program.addHelpText(
1350
+ "after",
1351
+ `
1352
+ Examples:
1353
+ ${pc6.dim("$")} edsger benchmark
1354
+ ${pc6.dim("$")} edsger benchmark -C ./my-repo --json
1355
+ ${pc6.dim("$")} edsger pr-review 123 --post
1356
+ ${pc6.dim("$")} edsger pr-resolve 123 --instruction "fix the failing test" --push
1357
+ ${pc6.dim("$")} edsger skills install ${pc6.dim("# enable /benchmark etc. in Claude Code")}
1358
+
1359
+ Auth: set ANTHROPIC_API_KEY for the agent; run \`gh auth login\` for PR commands.
1360
+ `
1361
+ );
1362
+ program.parseAsync(process.argv);
1363
+ //# sourceMappingURL=index.js.map