@buddysh/buddy 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/CHANGELOG.md +1633 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +1087 -0
  4. package/bin/cli.ts +3401 -0
  5. package/dist/bin/cli.d.ts +1 -0
  6. package/dist/bin/cli.js +188 -0
  7. package/dist/chunk-0j7z87kh.js +3 -0
  8. package/dist/chunk-0r8zt3d7.js +2 -0
  9. package/dist/chunk-16yqbccr.js +3 -0
  10. package/dist/chunk-1a53wj0h.js +1 -0
  11. package/dist/chunk-1c1gznm9.js +3 -0
  12. package/dist/chunk-1h3ey7k5.js +3 -0
  13. package/dist/chunk-1stt2whn.js +62 -0
  14. package/dist/chunk-1wjnd24b.js +24 -0
  15. package/dist/chunk-1xe07hzm.js +2 -0
  16. package/dist/chunk-2bp7tqca.js +2 -0
  17. package/dist/chunk-2dbkpfy9.js +2 -0
  18. package/dist/chunk-3q6czqs4.js +6 -0
  19. package/dist/chunk-3zdcekfj.js +5 -0
  20. package/dist/chunk-49ey79p0.js +5 -0
  21. package/dist/chunk-4c9m61yd.js +5 -0
  22. package/dist/chunk-4efbxdjr.js +4 -0
  23. package/dist/chunk-4f7panqj.js +21 -0
  24. package/dist/chunk-4hd3rre0.js +2 -0
  25. package/dist/chunk-4xsq18p3.js +9 -0
  26. package/dist/chunk-52x8mvh4.js +15 -0
  27. package/dist/chunk-54sc18p8.js +2 -0
  28. package/dist/chunk-56q4pwb5.js +3 -0
  29. package/dist/chunk-5c3qf34r.js +2 -0
  30. package/dist/chunk-5k40mwd4.js +4 -0
  31. package/dist/chunk-5kt03hx5.js +2 -0
  32. package/dist/chunk-63ept76v.js +2 -0
  33. package/dist/chunk-65b3vq52.js +2 -0
  34. package/dist/chunk-6d9hmjt8.js +3 -0
  35. package/dist/chunk-6g1y9yqh.js +3 -0
  36. package/dist/chunk-6k653r8w.js +2 -0
  37. package/dist/chunk-6md7qf2g.js +4 -0
  38. package/dist/chunk-6patq6bw.js +2 -0
  39. package/dist/chunk-6sgh49z1.js +2 -0
  40. package/dist/chunk-74pxb991.js +7 -0
  41. package/dist/chunk-7mgec8kb.js +7 -0
  42. package/dist/chunk-7tfrww3v.js +2 -0
  43. package/dist/chunk-7xk28xrv.js +2 -0
  44. package/dist/chunk-82dv4p13.js +2 -0
  45. package/dist/chunk-8661pvb8.js +3 -0
  46. package/dist/chunk-887s0w81.js +2 -0
  47. package/dist/chunk-8rc6042h.js +4 -0
  48. package/dist/chunk-9750tenz.js +3 -0
  49. package/dist/chunk-978wtejw.js +44 -0
  50. package/dist/chunk-9eqpaxfz.js +2 -0
  51. package/dist/chunk-9h04nskh.js +8 -0
  52. package/dist/chunk-9p1xkmjy.js +2 -0
  53. package/dist/chunk-agdesgzv.js +2 -0
  54. package/dist/chunk-akffynkc.js +3 -0
  55. package/dist/chunk-ar01x04a.js +2 -0
  56. package/dist/chunk-ay43f085.js +2 -0
  57. package/dist/chunk-bk9bqd5j.js +2 -0
  58. package/dist/chunk-bm8d40j0.js +69 -0
  59. package/dist/chunk-bxfc4g2x.js +73 -0
  60. package/dist/chunk-c3fczawt.js +2 -0
  61. package/dist/chunk-c9r9nd4t.js +1 -0
  62. package/dist/chunk-ctsz0ynx.js +3 -0
  63. package/dist/chunk-czremqk7.js +2 -0
  64. package/dist/chunk-da3wbh04.js +2 -0
  65. package/dist/chunk-dat582cg.js +2 -0
  66. package/dist/chunk-dfesffnr.js +3 -0
  67. package/dist/chunk-djntbp7a.js +105 -0
  68. package/dist/chunk-eagjp0dh.js +3 -0
  69. package/dist/chunk-eht72nnj.js +2 -0
  70. package/dist/chunk-f4nv5x3z.js +2 -0
  71. package/dist/chunk-fdfk918n.js +2 -0
  72. package/dist/chunk-fdj0tewy.js +20 -0
  73. package/dist/chunk-fm8ckj9b.js +2 -0
  74. package/dist/chunk-fqj7e6xa.js +2 -0
  75. package/dist/chunk-frm8zz31.js +2 -0
  76. package/dist/chunk-fvpr07dn.js +16 -0
  77. package/dist/chunk-g0nv8psv.js +2 -0
  78. package/dist/chunk-g0w8n555.js +19 -0
  79. package/dist/chunk-gkmvxjbe.js +2 -0
  80. package/dist/chunk-gngwjf70.js +7 -0
  81. package/dist/chunk-h7hs95wn.js +5 -0
  82. package/dist/chunk-hfvezfxh.js +3 -0
  83. package/dist/chunk-hw70wbzg.js +3 -0
  84. package/dist/chunk-j8asz4hb.js +15 -0
  85. package/dist/chunk-k62w2v03.js +2 -0
  86. package/dist/chunk-mcrfxphm.js +5 -0
  87. package/dist/chunk-mh3x7j6h.js +2 -0
  88. package/dist/chunk-naq32yx3.js +86 -0
  89. package/dist/chunk-nsmcjkas.js +2 -0
  90. package/dist/chunk-p1xm1jvz.js +2 -0
  91. package/dist/chunk-p3wsm8kz.js +2 -0
  92. package/dist/chunk-p4zwy518.js +4 -0
  93. package/dist/chunk-p7zgy37f.js +2 -0
  94. package/dist/chunk-ph1b3vbp.js +315 -0
  95. package/dist/chunk-pkjm2r0a.js +2 -0
  96. package/dist/chunk-pkkwb0n0.js +4 -0
  97. package/dist/chunk-pnpx1kqn.js +6 -0
  98. package/dist/chunk-q9n79dd3.js +3 -0
  99. package/dist/chunk-qpz9k66h.js +2 -0
  100. package/dist/chunk-qvn1rtgp.js +2 -0
  101. package/dist/chunk-qyf90zz3.js +2 -0
  102. package/dist/chunk-r06ce5g6.js +2 -0
  103. package/dist/chunk-r2sbprdb.js +49 -0
  104. package/dist/chunk-r3zyw8x0.js +3 -0
  105. package/dist/chunk-rb1fh9vd.js +1 -0
  106. package/dist/chunk-rqdep14r.js +2 -0
  107. package/dist/chunk-s1km8cyq.js +2 -0
  108. package/dist/chunk-s4ms8zag.js +2 -0
  109. package/dist/chunk-sp818c27.js +9 -0
  110. package/dist/chunk-tb5y0350.js +3 -0
  111. package/dist/chunk-thaxgm5p.js +2 -0
  112. package/dist/chunk-tn8prpny.js +503 -0
  113. package/dist/chunk-ts35hc5t.js +3 -0
  114. package/dist/chunk-tzs22es2.js +3 -0
  115. package/dist/chunk-vagxqhef.js +13 -0
  116. package/dist/chunk-vh504tcv.js +6 -0
  117. package/dist/chunk-vkctfqpm.js +3 -0
  118. package/dist/chunk-vyapg8ca.js +186 -0
  119. package/dist/chunk-wdwvt7gb.js +43 -0
  120. package/dist/chunk-wtjhehz9.js +4 -0
  121. package/dist/chunk-x0ya2r4r.js +3 -0
  122. package/dist/chunk-x3kragh9.js +12 -0
  123. package/dist/chunk-x9ctz1qc.js +1 -0
  124. package/dist/chunk-xakpdqaq.js +3 -0
  125. package/dist/chunk-xqx460y2.js +3 -0
  126. package/dist/chunk-xvptf9jy.js +3 -0
  127. package/dist/chunk-yk23nc4t.js +2 -0
  128. package/dist/chunk-yncea6ty.js +2 -0
  129. package/dist/chunk-yq0gxtzv.js +2 -0
  130. package/dist/chunk-yqhs08ky.js +2 -0
  131. package/dist/chunk-zb62jhwm.js +31 -0
  132. package/dist/chunk-zs3jaj0g.js +1023 -0
  133. package/dist/chunk-zve5d96e.js +2 -0
  134. package/dist/src/agent/index.d.ts +44 -0
  135. package/dist/src/agent/modes.d.ts +33 -0
  136. package/dist/src/agent/runner.d.ts +44 -0
  137. package/dist/src/agent/stacked.d.ts +83 -0
  138. package/dist/src/agent/tasks.d.ts +41 -0
  139. package/dist/src/agent/toolbelt.d.ts +19 -0
  140. package/dist/src/agent/tools/fs.d.ts +26 -0
  141. package/dist/src/agent/tools/shell.d.ts +32 -0
  142. package/dist/src/agent/types.d.ts +56 -0
  143. package/dist/src/ai/aliases.d.ts +62 -0
  144. package/dist/src/ai/client.d.ts +42 -0
  145. package/dist/src/ai/index.d.ts +35 -0
  146. package/dist/src/ai/learnings.d.ts +78 -0
  147. package/dist/src/ai/providers/anthropic.d.ts +12 -0
  148. package/dist/src/ai/providers/google.d.ts +12 -0
  149. package/dist/src/ai/providers/openai.d.ts +15 -0
  150. package/dist/src/ai/redact.d.ts +30 -0
  151. package/dist/src/ai/types.d.ts +75 -0
  152. package/dist/src/analysis/analyzers/actionlint.d.ts +11 -0
  153. package/dist/src/analysis/analyzers/external.d.ts +57 -0
  154. package/dist/src/analysis/analyzers/github-actions.d.ts +9 -0
  155. package/dist/src/analysis/analyzers/hadolint.d.ts +9 -0
  156. package/dist/src/analysis/analyzers/linter.d.ts +53 -0
  157. package/dist/src/analysis/analyzers/markdownlint.d.ts +11 -0
  158. package/dist/src/analysis/analyzers/secrets.d.ts +23 -0
  159. package/dist/src/analysis/analyzers/shellcheck.d.ts +8 -0
  160. package/dist/src/analysis/analyzers/syntax.d.ts +13 -0
  161. package/dist/src/analysis/engine.d.ts +38 -0
  162. package/dist/src/analysis/index.d.ts +13 -0
  163. package/dist/src/analysis/types.d.ts +14 -0
  164. package/dist/src/buddy.d.ts +17 -0
  165. package/dist/src/ci/classify.d.ts +49 -0
  166. package/dist/src/ci/fix.d.ts +42 -0
  167. package/dist/src/ci/index.d.ts +8 -0
  168. package/dist/src/commands/dispatcher.d.ts +49 -0
  169. package/dist/src/commands/handlers.d.ts +23 -0
  170. package/dist/src/commands/index.d.ts +22 -0
  171. package/dist/src/commands/parser.d.ts +71 -0
  172. package/dist/src/config-validation.d.ts +38 -0
  173. package/dist/src/config.d.ts +22 -0
  174. package/dist/src/dashboard/dashboard-generator.d.ts +10 -0
  175. package/dist/src/doctor.d.ts +44 -0
  176. package/dist/src/ecosystems/go.d.ts +10 -0
  177. package/dist/src/ecosystems/index.d.ts +60 -0
  178. package/dist/src/ecosystems/pep440.d.ts +57 -0
  179. package/dist/src/ecosystems/python.d.ts +12 -0
  180. package/dist/src/ecosystems/ruby.d.ts +9 -0
  181. package/dist/src/ecosystems/rust.d.ts +8 -0
  182. package/dist/src/ecosystems/scan.d.ts +49 -0
  183. package/dist/src/ecosystems/shared.d.ts +45 -0
  184. package/dist/src/ecosystems/types.d.ts +58 -0
  185. package/dist/src/events/bus.d.ts +41 -0
  186. package/dist/src/events/index.d.ts +11 -0
  187. package/dist/src/events/sinks.d.ts +33 -0
  188. package/dist/src/gates/ai-checks.d.ts +77 -0
  189. package/dist/src/gates/checks.d.ts +84 -0
  190. package/dist/src/gates/index.d.ts +17 -0
  191. package/dist/src/gates/post-merge.d.ts +56 -0
  192. package/dist/src/git/bitbucket-provider.d.ts +50 -0
  193. package/dist/src/git/github-provider.d.ts +50 -0
  194. package/dist/src/git/gitlab-provider.d.ts +51 -0
  195. package/dist/src/git/provider.d.ts +210 -0
  196. package/dist/src/headless/run.d.ts +78 -0
  197. package/dist/src/index.d.ts +243 -0
  198. package/dist/src/index.js +2 -0
  199. package/dist/src/issues/enrichment.d.ts +76 -0
  200. package/dist/src/issues/index.d.ts +16 -0
  201. package/dist/src/issues/quick-links.d.ts +55 -0
  202. package/dist/src/pr/auto-merge.d.ts +75 -0
  203. package/dist/src/pr/pr-generator.d.ts +9 -0
  204. package/dist/src/pr/pr-manifest.d.ts +82 -0
  205. package/dist/src/pr/templates.d.ts +44 -0
  206. package/dist/src/registry/docker-tags.d.ts +56 -0
  207. package/dist/src/registry/eol.d.ts +87 -0
  208. package/dist/src/registry/oci-client.d.ts +98 -0
  209. package/dist/src/registry/registry-client.d.ts +39 -0
  210. package/dist/src/reports/history.d.ts +51 -0
  211. package/dist/src/reports/index.d.ts +23 -0
  212. package/dist/src/reports/metrics.d.ts +89 -0
  213. package/dist/src/reports/render.d.ts +33 -0
  214. package/dist/src/review/diff.d.ts +50 -0
  215. package/dist/src/review/engine.d.ts +49 -0
  216. package/dist/src/review/findings.d.ts +102 -0
  217. package/dist/src/review/guidelines.d.ts +46 -0
  218. package/dist/src/review/index.d.ts +48 -0
  219. package/dist/src/review/local.d.ts +81 -0
  220. package/dist/src/review/marker.d.ts +34 -0
  221. package/dist/src/review/poster.d.ts +39 -0
  222. package/dist/src/review/run.d.ts +24 -0
  223. package/dist/src/rules/engine.d.ts +108 -0
  224. package/dist/src/rules/index.d.ts +9 -0
  225. package/dist/src/rules/renovate.d.ts +25 -0
  226. package/dist/src/rules/schedule.d.ts +44 -0
  227. package/dist/src/scanner/catalog-scan.d.ts +39 -0
  228. package/dist/src/scanner/package-json-extras.d.ts +101 -0
  229. package/dist/src/scanner/package-scanner.d.ts +17 -0
  230. package/dist/src/scanner/resolution-drift.d.ts +81 -0
  231. package/dist/src/scanner/workspace-catalog.d.ts +53 -0
  232. package/dist/src/scheduler/scheduler.d.ts +27 -0
  233. package/dist/src/security/engine.d.ts +12 -0
  234. package/dist/src/security/loader.d.ts +7 -0
  235. package/dist/src/security/parser.d.ts +15 -0
  236. package/dist/src/security/rules/bash-injection.d.ts +18 -0
  237. package/dist/src/security/rules/dangerous-pull-request-target.d.ts +18 -0
  238. package/dist/src/security/rules/excessive-permissions.d.ts +14 -0
  239. package/dist/src/security/rules/index.d.ts +16 -0
  240. package/dist/src/security/rules/missing-timeout.d.ts +9 -0
  241. package/dist/src/security/rules/self-hosted-exposure.d.ts +13 -0
  242. package/dist/src/security/rules/unpinned-action.d.ts +10 -0
  243. package/dist/src/security/rules/walk.d.ts +13 -0
  244. package/dist/src/security/types.d.ts +64 -0
  245. package/dist/src/services/deprecated-dependencies-checker.d.ts +16 -0
  246. package/dist/src/services/release-notes-fetcher.d.ts +70 -0
  247. package/dist/src/services/security-advisories.d.ts +59 -0
  248. package/dist/src/setup.d.ts +162 -0
  249. package/dist/src/setup.js +2 -0
  250. package/dist/src/templates/github-actions.d.ts +31 -0
  251. package/dist/src/templates/gitlab-ci.d.ts +46 -0
  252. package/dist/src/types.d.ts +449 -0
  253. package/dist/src/upgrades/index.d.ts +18 -0
  254. package/dist/src/upgrades/migrate.d.ts +45 -0
  255. package/dist/src/upgrades/plan.d.ts +112 -0
  256. package/dist/src/upgrades/report.d.ts +22 -0
  257. package/dist/src/upgrades/span.d.ts +47 -0
  258. package/dist/src/upgrades/usage.d.ts +30 -0
  259. package/dist/src/upgrades/wire.d.ts +61 -0
  260. package/dist/src/utils/concurrency.d.ts +50 -0
  261. package/dist/src/utils/dependency-file-parser.d.ts +17 -0
  262. package/dist/src/utils/dockerfile-parser.d.ts +69 -0
  263. package/dist/src/utils/endpoints.d.ts +58 -0
  264. package/dist/src/utils/errors.d.ts +35 -0
  265. package/dist/src/utils/file-changes.d.ts +14 -0
  266. package/dist/src/utils/github-actions-parser.d.ts +21 -0
  267. package/dist/src/utils/globs.d.ts +22 -0
  268. package/dist/src/utils/helpers.d.ts +73 -0
  269. package/dist/src/utils/http.d.ts +81 -0
  270. package/dist/src/utils/lock-file.d.ts +28 -0
  271. package/dist/src/utils/logger.d.ts +45 -0
  272. package/dist/src/utils/package-paths.d.ts +6 -0
  273. package/dist/src/utils/pantry-parser.d.ts +30 -0
  274. package/dist/src/utils/repository.d.ts +41 -0
  275. package/dist/src/utils/security-format.d.ts +18 -0
  276. package/dist/src/utils/zig-parser.d.ts +18 -0
  277. package/dist/src/version/version-resolver.d.ts +9 -0
  278. package/package.json +115 -0
@@ -0,0 +1,84 @@
1
+ import type { PRManifest } from '../types';
2
+ /**
3
+ * Check a pull request title against conventional-commit format.
4
+ *
5
+ * @param title - Pull request title
6
+ * @param mode - How a failure behaves
7
+ */
8
+ export declare function checkTitleFormat(title: string, mode: GateMode): GateResult;
9
+ /**
10
+ * Check that a description is present and covers the required sections.
11
+ *
12
+ * @param body - Pull request body
13
+ * @param options - Mode and the sections that must appear
14
+ */
15
+ export declare function checkDescription(body: string, options: { mode: GateMode, requireSections?: string[] }): GateResult;
16
+ /**
17
+ * Check the dependencies a change introduces.
18
+ *
19
+ * Runs with no API key and no model: the vulnerability, deprecation and
20
+ * license facts all come from data buddy already collects, which makes
21
+ * this the gate a repository gets for free.
22
+ *
23
+ * @param dependencies - Dependencies introduced or updated
24
+ * @param options - Mode and policy
25
+ */
26
+ export declare function checkDependencies(dependencies: GateInput['dependencies'], options: NonNullable<GateConfig['dependencyGate']>): GateResult;
27
+ /**
28
+ * Run every configured check.
29
+ *
30
+ * @param input - Pull request under evaluation
31
+ * @param config - Which checks to run and how failures behave
32
+ * @returns Results for the checks that ran, in configuration order
33
+ */
34
+ export declare function runGates(input: GateInput, config: GateConfig): GateResult[];
35
+ /**
36
+ * Overall conclusion for a check run.
37
+ *
38
+ * Only an `error`-mode failure blocks; a `warning` failure reports without
39
+ * turning the check red, which is what makes a gate adoptable before a team
40
+ * has agreed to enforce it.
41
+ *
42
+ * @param results - Results from {@link runGates}
43
+ */
44
+ export declare function summarizeGates(results: GateResult[]): {
45
+ conclusion: 'success' | 'failure' | 'neutral'
46
+ title: string
47
+ summary: string
48
+ };
49
+ /** The result of one check. */
50
+ export declare interface GateResult {
51
+ name: string
52
+ mode: GateMode
53
+ passed: boolean
54
+ summary: string
55
+ detail?: string
56
+ }
57
+ /** Everything the gates need to evaluate a pull request. */
58
+ export declare interface GateInput {
59
+ title: string
60
+ body: string
61
+ manifest?: PRManifest | null
62
+ dependencies?: Array<{
63
+ name: string
64
+ version: string
65
+ license?: string
66
+ vulnerable?: boolean
67
+ deprecated?: boolean
68
+ eol?: string
69
+ }>
70
+ }
71
+ /** Configuration for the built-in checks. */
72
+ export declare interface GateConfig {
73
+ titleFormat?: GateMode
74
+ description?: { mode: GateMode, requireSections?: string[] }
75
+ dependencyGate?: {
76
+ mode: GateMode
77
+ licenseAllowlist?: string[]
78
+ blockVulnerable?: boolean
79
+ blockDeprecated?: boolean
80
+ blockEol?: boolean
81
+ }
82
+ }
83
+ /** How a failing check behaves. */
84
+ export type GateMode = 'off' | 'warning' | 'error';
@@ -0,0 +1,17 @@
1
+ export type { GateConfig, GateInput, GateMode, GateResult } from './checks';
2
+ export type { AiGateConfig, AiGateInput, CustomAssertion } from './ai-checks';
3
+ export type { PostMergeConfig, PostMergeOutcome } from './post-merge';
4
+ export {
5
+ checkDependencies,
6
+ checkDescription,
7
+ checkTitleFormat,
8
+ runGates,
9
+ summarizeGates,
10
+ } from './checks';
11
+ export {
12
+ checkCustomAssertions,
13
+ checkLinkedIssue,
14
+ findLinkedIssues,
15
+ runAiGates,
16
+ } from './ai-checks';
17
+ export { appendChangelogEntry, isMergeEvent, runPostMerge } from './post-merge';
@@ -0,0 +1,56 @@
1
+ import type { GitProvider } from '../git/provider';
2
+ import type { Logger } from '../utils/logger';
3
+ import type { PullRequest } from '../types';
4
+ /**
5
+ * Insert an entry into a changelog's unreleased section.
6
+ *
7
+ * Appends under an existing `## Unreleased` heading when there is one, and
8
+ * creates the section otherwise. Never rewrites a released section: those
9
+ * describe versions that shipped, and editing one makes the file disagree with
10
+ * what people already installed.
11
+ *
12
+ * @param content - Current changelog, empty for a new file
13
+ * @param entry - The line to add, without its bullet
14
+ * @returns The updated changelog
15
+ */
16
+ export declare function appendChangelogEntry(content: string, entry: string): string;
17
+ /**
18
+ * Run the configured post-merge actions.
19
+ *
20
+ * Every action is independent and failure-tolerant: the pull request has
21
+ * already merged, so nothing here can be undone by failing, and a changelog
22
+ * that could not be written must not stop the linked issues from being
23
+ * notified.
24
+ *
25
+ * @param provider - Provider to act through
26
+ * @param pr - The merged pull request
27
+ * @param config - Which actions to run
28
+ * @param options - Base branch and logger
29
+ * @returns What ran and what did not
30
+ * @example
31
+ * ```ts
32
+ * const outcome = await runPostMerge(provider, pr, config.postMerge, { baseBranch: 'main' })
33
+ * ```
34
+ */
35
+ export declare function runPostMerge(provider: GitProvider, pr: PullRequest, config?: PostMergeConfig, options?: { baseBranch?: string, logger?: Logger }): Promise<PostMergeOutcome>;
36
+ /**
37
+ * Whether a webhook payload describes a merged pull request.
38
+ *
39
+ * `pull_request: [closed]` fires for both merges and abandonments, and the
40
+ * post-merge actions must not run for a pull request somebody gave up on.
41
+ *
42
+ * @param event - The webhook payload
43
+ * @returns Whether this is a merge
44
+ */
45
+ export declare function isMergeEvent(event: unknown): boolean;
46
+ /** What to do after a pull request merges. */
47
+ export declare interface PostMergeConfig {
48
+ changelog?: { enabled?: boolean, path?: string }
49
+ commentOnIssues?: boolean
50
+ refreshDashboard?: boolean
51
+ }
52
+ /** What a post-merge pass did. */
53
+ export declare interface PostMergeOutcome {
54
+ performed: string[]
55
+ skipped: Array<{ action: string, reason: string }>
56
+ }
@@ -0,0 +1,50 @@
1
+ import type { FileChange, Issue, IssueOptions, PullRequest, PullRequestOptions } from '../types';
2
+ import type { GitProvider, ProviderBranch, ProviderCapabilities, ReviewSubmission, ReviewSubmissionResult } from './provider';
3
+ import type { Logger } from '../utils/logger';
4
+ /**
5
+ * Bitbucket Cloud, through the 2.0 REST API.
6
+ *
7
+ * The most capability-constrained provider, and deliberately honest about it:
8
+ * Bitbucket has no check runs, no merge queue, no issue pinning and no
9
+ * reactions. Those flags are `false`, and every call site already gates on
10
+ * them — a feature that cannot work here degrades with a note rather than
11
+ * failing halfway through a run.
12
+ *
13
+ * Its issue tracker is also optional per repository, so issue operations may
14
+ * legitimately 404 on a repository that is otherwise fine.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const provider = new BitbucketProvider(token, 'workspace', 'repo')
19
+ * ```
20
+ */
21
+ export declare class BitbucketProvider implements GitProvider {
22
+ constructor(token: string, workspace: string, repo: string, apiUrl?: string, logger?: Logger);
23
+ capabilities(): ProviderCapabilities;
24
+ branchExists(branchName: string): Promise<boolean>;
25
+ createBranch(branchName: string, baseBranch: string): Promise<void>;
26
+ deleteBranch(branchName: string): Promise<void>;
27
+ commitChanges(branchName: string, message: string, files: FileChange[], baseBranch?: string): Promise<void>;
28
+ getFileContent(path: string, ref: string): Promise<string | null>;
29
+ createPullRequest(options: PullRequestOptions): Promise<PullRequest>;
30
+ getPullRequests(state?: 'open' | 'closed' | 'all'): Promise<PullRequest[]>;
31
+ updatePullRequest(prNumber: number, options: Partial<PullRequestOptions>): Promise<PullRequest>;
32
+ closePullRequest(prNumber: number): Promise<void>;
33
+ reopenPullRequest(prNumber: number): Promise<void>;
34
+ mergePullRequest(prNumber: number, strategy?: 'merge' | 'squash' | 'rebase'): Promise<void>;
35
+ getPullRequestDiff(prNumber: number): Promise<string>;
36
+ getPullRequestHeadSha(prNumber: number): Promise<string>;
37
+ createComment(prNumber: number, comment: string): Promise<void>;
38
+ createIssue(options: IssueOptions): Promise<Issue>;
39
+ getIssues(state?: 'open' | 'closed' | 'all'): Promise<Issue[]>;
40
+ updateIssue(issueNumber: number, options: Partial<IssueOptions>): Promise<Issue>;
41
+ closeIssue(issueNumber: number): Promise<void>;
42
+ unpinIssue(_issueNumber: number): Promise<boolean>;
43
+ getPullRequestChecksState(prNumber: number): Promise<'success' | 'failure' | 'pending' | 'none'>;
44
+ createReview(prNumber: number, review: ReviewSubmission): Promise<ReviewSubmissionResult>;
45
+ createCheckRun(name: string, headSha: string, result: { conclusion: 'success' | 'failure' | 'neutral', title: string, summary: string }): Promise<void>;
46
+ hasWriteAccess(username: string): Promise<boolean>;
47
+ getBuddyBranches(): Promise<ProviderBranch[]>;
48
+ getOrphanedBuddyBranches(): Promise<ProviderBranch[]>;
49
+ cleanupStaleBranches(olderThanDays?: number, dryRun?: boolean): Promise<{ deleted: string[], failed: string[] }>;
50
+ }
@@ -0,0 +1,50 @@
1
+ import type { FileChange, Issue, IssueOptions, PullRequest, PullRequestOptions } from '../types';
2
+ import type { GitProvider, ProviderCapabilities } from './provider';
3
+ /**
4
+ * Thrown when lockfile regeneration fails. Not a transient git error —
5
+ * must bubble past the API fallback so we don't silently open a PR with
6
+ * stale lockfiles.
7
+ */
8
+ declare class LockfileRegenerationError extends Error {
9
+ constructor(message: string);
10
+ }
11
+ export declare class GitHubProvider implements GitProvider {
12
+ constructor(token: string, owner: string, repo: string, hasWorkflowPermissions?: boolean, workflowToken?: string);
13
+ capabilities(): ProviderCapabilities;
14
+ clearCache(): void;
15
+ branchExists(branchName: string): Promise<boolean>;
16
+ createBranch(branchName: string, baseBranch: string): Promise<void>;
17
+ commitChanges(branchName: string, message: string, files: FileChange[], baseBranch?: string): Promise<void>;
18
+ createPullRequest(options: PullRequestOptions): Promise<PullRequest>;
19
+ runCommand(command: string, args: string[], tokenOverride?: string): Promise<string>;
20
+ getPullRequests(state?: 'open' | 'closed' | 'all'): Promise<PullRequest[]>;
21
+ updatePullRequest(prNumber: number, options: Partial<PullRequestOptions>): Promise<PullRequest>;
22
+ closePullRequest(prNumber: number): Promise<void>;
23
+ reopenPullRequest(prNumber: number): Promise<void>;
24
+ createComment(prNumber: number, comment: string): Promise<void>;
25
+ mergePullRequest(prNumber: number, strategy?: 'merge' | 'squash' | 'rebase'): Promise<void>;
26
+ getPullRequestHeadSha(prNumber: number): Promise<string>;
27
+ hasWriteAccess(username: string): Promise<boolean>;
28
+ reactToComment(commentId: number, reaction: 'eyes' | '+1' | '-1' | 'rocket' | 'confused'): Promise<void>;
29
+ getWorkflowRunLogs(runId: number): Promise<string | null>;
30
+ createCheckRun(name: string, headSha: string, result: { conclusion: 'success' | 'failure' | 'neutral', title: string, summary: string }): Promise<void>;
31
+ getFileContent(path: string, ref: string): Promise<string | null>;
32
+ getPullRequestDiff(prNumber: number): Promise<string>;
33
+ createReview(prNumber: number, review: {
34
+ body: string
35
+ event: 'COMMENT' | 'REQUEST_CHANGES' | 'APPROVE'
36
+ comments?: Array<{ path: string, line: number, side: 'RIGHT' | 'LEFT', body: string }>
37
+ }): Promise<{ posted: boolean, inlineComments: number }>;
38
+ enableAutoMerge(prNumber: number, strategy?: 'merge' | 'squash' | 'rebase'): Promise<boolean>;
39
+ getPullRequestChecksState(prNumber: number): Promise<'success' | 'failure' | 'pending' | 'none'>;
40
+ deleteBranch(branchName: string): Promise<void>;
41
+ getBuddyBranches(): Promise<Array<{ name: string, sha: string, lastCommitDate: Date }>>;
42
+ getOrphanedBuddyBranches(): Promise<Array<{ name: string, sha: string, lastCommitDate: Date }>>;
43
+ cleanupStaleBranches(olderThanDays?: number, dryRun?: boolean): Promise<{ deleted: string[], failed: string[] }>;
44
+ createIssue(options: IssueOptions): Promise<Issue>;
45
+ getIssues(state?: 'open' | 'closed' | 'all'): Promise<Issue[]>;
46
+ updateIssue(issueNumber: number, options: Partial<IssueOptions>): Promise<Issue>;
47
+ closeIssue(issueNumber: number): Promise<void>;
48
+ pinIssue(issueNumber: number): Promise<boolean>;
49
+ unpinIssue(issueNumber: number): Promise<boolean>;
50
+ }
@@ -0,0 +1,51 @@
1
+ import type { FileChange, Issue, IssueOptions, PullRequest, PullRequestOptions } from '../types';
2
+ import type { GitProvider, ProviderBranch, ProviderCapabilities, ReviewSubmission, ReviewSubmissionResult } from './provider';
3
+ import type { Logger } from '../utils/logger';
4
+ /**
5
+ * GitLab, through the v4 REST API.
6
+ *
7
+ * Terminology is translated at this boundary rather than threaded through the
8
+ * codebase: a merge request is a `PullRequest`, and its `iid` — the
9
+ * project-scoped number a user sees — is the `number`. GitLab also has a
10
+ * global `id`, which is *not* the number in the URL; using it would address
11
+ * the wrong merge request on every project but the first.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const provider = new GitLabProvider(token, 'group/sub', 'repo')
16
+ * const mrs = await provider.getPullRequests('open')
17
+ * ```
18
+ */
19
+ export declare class GitLabProvider implements GitProvider {
20
+ constructor(token: string, owner: string, repo: string, apiUrl?: string, logger?: Logger);
21
+ capabilities(): ProviderCapabilities;
22
+ branchExists(branchName: string): Promise<boolean>;
23
+ createBranch(branchName: string, baseBranch: string): Promise<void>;
24
+ deleteBranch(branchName: string): Promise<void>;
25
+ commitChanges(branchName: string, message: string, files: FileChange[], baseBranch?: string): Promise<void>;
26
+ getFileContent(path: string, ref: string): Promise<string | null>;
27
+ createPullRequest(options: PullRequestOptions): Promise<PullRequest>;
28
+ getPullRequests(state?: 'open' | 'closed' | 'all'): Promise<PullRequest[]>;
29
+ updatePullRequest(prNumber: number, options: Partial<PullRequestOptions>): Promise<PullRequest>;
30
+ closePullRequest(prNumber: number): Promise<void>;
31
+ reopenPullRequest(prNumber: number): Promise<void>;
32
+ mergePullRequest(prNumber: number, strategy?: 'merge' | 'squash' | 'rebase'): Promise<void>;
33
+ getPullRequestDiff(prNumber: number): Promise<string>;
34
+ getPullRequestHeadSha(prNumber: number): Promise<string>;
35
+ createComment(prNumber: number, comment: string): Promise<void>;
36
+ createIssue(options: IssueOptions): Promise<Issue>;
37
+ getIssues(state?: 'open' | 'closed' | 'all'): Promise<Issue[]>;
38
+ updateIssue(issueNumber: number, options: Partial<IssueOptions>): Promise<Issue>;
39
+ closeIssue(issueNumber: number): Promise<void>;
40
+ unpinIssue(_issueNumber: number): Promise<boolean>;
41
+ enableAutoMerge(prNumber: number, strategy?: 'merge' | 'squash' | 'rebase'): Promise<boolean>;
42
+ getPullRequestChecksState(prNumber: number): Promise<'success' | 'failure' | 'pending' | 'none'>;
43
+ createReview(prNumber: number, review: ReviewSubmission): Promise<ReviewSubmissionResult>;
44
+ createCheckRun(name: string, headSha: string, result: { conclusion: 'success' | 'failure' | 'neutral', title: string, summary: string }): Promise<void>;
45
+ reactToComment(commentId: number, reaction: 'eyes' | '+1' | '-1' | 'rocket' | 'confused'): Promise<void>;
46
+ hasWriteAccess(username: string): Promise<boolean>;
47
+ getWorkflowRunLogs(runId: number): Promise<string | null>;
48
+ getBuddyBranches(): Promise<ProviderBranch[]>;
49
+ getOrphanedBuddyBranches(): Promise<ProviderBranch[]>;
50
+ cleanupStaleBranches(olderThanDays?: number, dryRun?: boolean): Promise<{ deleted: string[], failed: string[] }>;
51
+ }
@@ -0,0 +1,210 @@
1
+ import type { FileChange, Issue, IssueOptions, PullRequest, PullRequestOptions } from '../types';
2
+ import type { Logger } from '../utils/logger';
3
+ /**
4
+ * Resolve a provider's token from the environment.
5
+ *
6
+ * @param provider - Provider name
7
+ * @param env - Environment to read (defaults to `process.env`)
8
+ * @returns The first token found, with the variable it came from
9
+ */
10
+ export declare function resolveProviderToken(provider: GitProviderName, env?: Record<string, string | undefined>): { token: string, source: string } | null;
11
+ /**
12
+ * Assert a provider name is one buddy can actually use.
13
+ *
14
+ * @param provider - Name from configuration
15
+ * @throws {UnsupportedProviderError} When unknown, or known but not built
16
+ */
17
+ export declare function assertProviderSupported(provider: string): asserts provider is GitProviderName;
18
+ /**
19
+ * Build the provider for a repository configuration.
20
+ *
21
+ * @param config - Repository configuration
22
+ * @param options - Logger and environment overrides
23
+ * @returns A provider bound to the repository
24
+ * @throws {UnsupportedProviderError} When the provider is unknown or unbuilt
25
+ * @throws {Error} When no token can be resolved
26
+ * @example
27
+ * ```ts
28
+ * const provider = await createProvider(config.repository, { logger })
29
+ * const prs = await provider.getPullRequests('open')
30
+ * ```
31
+ */
32
+ export declare function createProvider(config: ProviderConfig, options?: { logger?: Logger, env?: Record<string, string | undefined> }): Promise<GitProvider>;
33
+ /**
34
+ * Whether a provider supports a capability *and* exposes its method.
35
+ *
36
+ * Checks both because a flag without the method is a provider bug, and acting
37
+ * on the flag alone would turn that bug into a `TypeError` at the call site.
38
+ *
39
+ * @param provider - The provider to interrogate
40
+ * @param capability - Capability flag to check
41
+ * @param method - Method the capability gates
42
+ */
43
+ export declare function supports<K extends keyof GitProvider>(provider: GitProvider, capability: keyof ProviderCapabilities, method: K): provider is GitProvider & Required<Pick<GitProvider, K>>;
44
+ /**
45
+ * Assert a provider supports a capability, or explain what is missing.
46
+ *
47
+ * Used where the capability *is* the command — `buddy cleanup` on a
48
+ * provider that cannot enumerate branches has nothing to degrade to, so
49
+ * failing with a clear reason beats a `TypeError` or a silent success.
50
+ *
51
+ * @param provider - The provider to interrogate
52
+ * @param capability - Capability flag to require
53
+ * @param method - Method the capability gates
54
+ * @param purpose - What the caller was trying to do
55
+ * @throws {UnsupportedProviderError} When the capability is absent
56
+ */
57
+ export declare function assertSupports<K extends keyof GitProvider>(provider: GitProvider, capability: keyof ProviderCapabilities, method: K, purpose: string): asserts provider is GitProvider & Required<Pick<GitProvider, K>>;
58
+ /** Every provider name the type admits, in preference order. */
59
+ export declare const PROVIDER_NAMES: GitProviderName[];
60
+ /** Providers with a working implementation today. */
61
+ export declare const IMPLEMENTED_PROVIDERS: GitProviderName[];
62
+ /**
63
+ * Where to follow the work for a provider that is named but not built.
64
+ *
65
+ * Empty now that every named provider is implemented. Kept because the next
66
+ * provider to be planned needs somewhere to point, and a config naming it
67
+ * should link to the thread rather than say "unknown".
68
+ */
69
+ export declare const PROVIDER_TRACKING_ISSUES: Record<string, string>;
70
+ /** Capabilities all false, to spread over in a provider that supports few. */
71
+ export declare const NO_CAPABILITIES: ProviderCapabilities;
72
+ /**
73
+ * Environment variables consulted for each provider's token, in order.
74
+ *
75
+ * The ambient CI token comes first on purpose. It is not a fallback for the
76
+ * buddy token — the two have different jobs: the ambient token attributes
77
+ * pull requests to the CI bot rather than to a human's personal token, while
78
+ * `BUDDY_TOKEN` is passed separately as the *workflow* token for the
79
+ * elevated scopes CI files need. Preferring the personal token here would
80
+ * change who appears to have opened every pull request.
81
+ * @defaultValue
82
+ * ```ts
83
+ * {
84
+ * github: ['GITHUB_TOKEN', 'BUDDY_TOKEN'],
85
+ * gitlab: ['CI_JOB_TOKEN', 'GITLAB_TOKEN', 'BUDDY_TOKEN'],
86
+ * bitbucket: ['BITBUCKET_TOKEN', 'BUDDY_TOKEN']
87
+ * }
88
+ * ```
89
+ */
90
+ export declare const PROVIDER_TOKEN_ENV: Record<GitProviderName, string[]>;
91
+ /**
92
+ * What a provider can actually do.
93
+ *
94
+ * Buddy's feature surface is wider than any single platform's API, so
95
+ * features degrade against these flags instead of assuming GitHub. A caller
96
+ * that checks a flag before calling the matching optional method gets a
97
+ * documented no-op on platforms that lack it; a caller that does not gets a
98
+ * `TypeError`, which is the intended pressure to check.
99
+ */
100
+ export declare interface ProviderCapabilities {
101
+ pinIssues: boolean
102
+ checkRuns: boolean
103
+ inlineReviewComments: boolean
104
+ reviewSuggestions: boolean
105
+ nativeAutoMerge: boolean
106
+ commentReactions: boolean
107
+ ciLogs: boolean
108
+ teamReviewers: boolean
109
+ draftPullRequests: boolean
110
+ permissionLookup: boolean
111
+ branchHousekeeping: boolean
112
+ labels: boolean
113
+ reopenPullRequests: boolean
114
+ }
115
+ /** A branch buddy created, as the provider reports it. */
116
+ export declare interface ProviderBranch {
117
+ name: string
118
+ sha: string
119
+ lastCommitDate: Date
120
+ }
121
+ /** A review to publish on a pull request. */
122
+ export declare interface ReviewSubmission {
123
+ body: string
124
+ event: 'COMMENT' | 'REQUEST_CHANGES' | 'APPROVE'
125
+ comments?: Array<{ path: string, line: number, side: 'RIGHT' | 'LEFT', body: string }>
126
+ }
127
+ /** What publishing a review actually achieved. */
128
+ export declare interface ReviewSubmissionResult {
129
+ posted: boolean
130
+ inlineComments: number
131
+ }
132
+ /** Outcome of a check run. */
133
+ export declare interface CheckRunResult {
134
+ conclusion: 'success' | 'failure' | 'neutral'
135
+ title: string
136
+ summary: string
137
+ }
138
+ /**
139
+ * Everything buddy needs from a hosting platform.
140
+ *
141
+ * The required members are the ones every code-hosting platform has; the
142
+ * optional ones are gated by {@link ProviderCapabilities}. This split is the
143
+ * contract a new provider implements: satisfy the required half and declare
144
+ * honestly which of the optional half you support.
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * const provider = createProvider({ provider: 'github', owner: 'o', name: 'r', token })
149
+ * if (provider.capabilities().pinIssues)
150
+ * await provider.pinIssue?.(dashboard.number)
151
+ * ```
152
+ */
153
+ export declare interface GitProvider {
154
+ capabilities: () => ProviderCapabilities
155
+ branchExists: (branchName: string) => Promise<boolean>
156
+ createBranch: (branchName: string, baseBranch: string) => Promise<void>
157
+ deleteBranch: (branchName: string) => Promise<void>
158
+ commitChanges: (branchName: string, message: string, files: FileChange[], baseBranch?: string) => Promise<void>
159
+ getFileContent: (path: string, ref: string) => Promise<string | null>
160
+ createPullRequest: (options: PullRequestOptions) => Promise<PullRequest>
161
+ getPullRequests: (state?: 'open' | 'closed' | 'all') => Promise<PullRequest[]>
162
+ updatePullRequest: (prNumber: number, options: Partial<PullRequestOptions>) => Promise<PullRequest>
163
+ closePullRequest: (prNumber: number) => Promise<void>
164
+ mergePullRequest: (prNumber: number, strategy?: 'merge' | 'squash' | 'rebase') => Promise<void>
165
+ getPullRequestDiff: (prNumber: number) => Promise<string>
166
+ getPullRequestHeadSha: (prNumber: number) => Promise<string>
167
+ createComment: (prNumber: number, comment: string) => Promise<void>
168
+ createIssue: (options: IssueOptions) => Promise<Issue>
169
+ getIssues: (state?: 'open' | 'closed' | 'all') => Promise<Issue[]>
170
+ updateIssue: (issueNumber: number, options: Partial<IssueOptions>) => Promise<Issue>
171
+ closeIssue: (issueNumber: number) => Promise<void>
172
+ unpinIssue: (issueNumber: number) => Promise<boolean>
173
+ reopenPullRequest?: (prNumber: number) => Promise<void>
174
+ pinIssue?: (issueNumber: number) => Promise<boolean>
175
+ enableAutoMerge?: (prNumber: number, strategy?: 'merge' | 'squash' | 'rebase') => Promise<boolean>
176
+ getPullRequestChecksState?: (prNumber: number) => Promise<'success' | 'failure' | 'pending' | 'none'>
177
+ createReview?: (prNumber: number, review: ReviewSubmission) => Promise<ReviewSubmissionResult>
178
+ createCheckRun?: (name: string, headSha: string, result: CheckRunResult) => Promise<void>
179
+ reactToComment?: (commentId: number, reaction: 'eyes' | '+1' | '-1' | 'rocket' | 'confused') => Promise<void>
180
+ hasWriteAccess?: (username: string) => Promise<boolean>
181
+ getWorkflowRunLogs?: (runId: number) => Promise<string | null>
182
+ getBuddyBranches?: () => Promise<ProviderBranch[]>
183
+ getOrphanedBuddyBranches?: () => Promise<ProviderBranch[]>
184
+ cleanupStaleBranches?: (olderThanDays?: number, dryRun?: boolean) => Promise<{ deleted: string[], failed: string[] }>
185
+ }
186
+ /** Repository coordinates a provider is built against. */
187
+ export declare interface ProviderConfig {
188
+ provider?: string
189
+ owner: string
190
+ name: string
191
+ token?: string
192
+ workflowToken?: string
193
+ apiUrl?: string
194
+ }
195
+ /**
196
+ * Hosting platforms buddy knows about.
197
+ *
198
+ * A name appearing here does not mean it works — {@link IMPLEMENTED_PROVIDERS}
199
+ * is the list that does. Naming the unimplemented ones lets configuration
200
+ * validation reject them with the issue that tracks the work rather than a
201
+ * generic "unknown value", which is the difference between a user filing a
202
+ * duplicate and finding the thread.
203
+ */
204
+ export type GitProviderName = 'github' | 'gitlab' | 'bitbucket';
205
+ /** Raised when configuration names a provider buddy cannot use. */
206
+ export declare class UnsupportedProviderError extends Error {
207
+ public readonly provider: string;
208
+ public readonly trackingIssue?: string;
209
+ constructor(message: string, provider: string, trackingIssue?: string);
210
+ }
@@ -0,0 +1,78 @@
1
+ import type { AiClient } from '../ai/types';
2
+ import type { Logger } from '../utils/logger';
3
+ /**
4
+ * Check a value against a JSON Schema subset.
5
+ *
6
+ * Deliberately partial: `type`, `required`, `properties`, `items`, `enum`.
7
+ * That is what an Actions step's `output_schema` realistically declares, and
8
+ * implementing more would mean either a dependency or a half-correct
9
+ * validator that passes things it should not — which is worse than a small
10
+ * one that is right about what it covers.
11
+ *
12
+ * @param value - Value to check
13
+ * @param schema - JSON Schema
14
+ * @param path - Path prefix, used in messages
15
+ * @returns Every violation found, empty when the value conforms
16
+ */
17
+ export declare function validateAgainstSchema(value: unknown, schema: unknown, path?: string): SchemaViolation[];
18
+ /**
19
+ * Run a prompt headlessly, enforcing a schema when one is given.
20
+ *
21
+ * The contract is that a nonconforming output *fails*: a pipeline step whose
22
+ * later steps do `fromJSON(...)` on the result needs the step to have failed
23
+ * rather than to have emitted something shaped differently than promised.
24
+ * Retries exist because a re-ask with the violations quoted back usually
25
+ * succeeds, and burning the step on a formatting slip would be needless.
26
+ *
27
+ * @param options - Prompt, client and schema
28
+ * @returns The result and whether it conformed
29
+ * @example
30
+ * ```ts
31
+ * const outcome = await runHeadless({ prompt, ai, schema })
32
+ * if (!outcome.valid)
33
+ * process.exit(1)
34
+ * ```
35
+ */
36
+ export declare function runHeadless(options: HeadlessOptions): Promise<HeadlessResult>;
37
+ /**
38
+ * Format a value for `$GITHUB_OUTPUT`.
39
+ *
40
+ * Multi-line values need heredoc syntax; the delimiter has to be absent from
41
+ * the value or a crafted output could close the block early and inject further
42
+ * outputs into the workflow — which is a real escalation when a later step
43
+ * interpolates them.
44
+ *
45
+ * @param name - Output name
46
+ * @param value - Value to write
47
+ * @returns The line(s) to append to the file
48
+ */
49
+ export declare function formatGithubOutput(name: string, value: string): string;
50
+ /**
51
+ * Write a headless result to `$GITHUB_OUTPUT` when running in Actions.
52
+ *
53
+ * @param result - The value to publish
54
+ * @param outputPath - Path from `GITHUB_OUTPUT`, absent outside Actions
55
+ * @returns Whether it was written
56
+ */
57
+ export declare function publishOutput(result: unknown, outputPath: string | undefined): Promise<boolean>;
58
+ /** What a headless run produced. */
59
+ export declare interface HeadlessResult {
60
+ result: unknown
61
+ valid: boolean
62
+ error?: string
63
+ attempts: number
64
+ }
65
+ /** Inputs to a headless run. */
66
+ export declare interface HeadlessOptions {
67
+ prompt: string
68
+ ai: AiClient
69
+ schema?: Record<string, unknown>
70
+ maxRetries?: number
71
+ system?: string
72
+ logger?: Logger
73
+ }
74
+ /** A schema violation, with the path that failed. */
75
+ export declare interface SchemaViolation {
76
+ path: string
77
+ message: string
78
+ }