@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.
- package/CHANGELOG.md +1633 -0
- package/LICENSE.md +21 -0
- package/README.md +1087 -0
- package/bin/cli.ts +3401 -0
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +188 -0
- package/dist/chunk-0j7z87kh.js +3 -0
- package/dist/chunk-0r8zt3d7.js +2 -0
- package/dist/chunk-16yqbccr.js +3 -0
- package/dist/chunk-1a53wj0h.js +1 -0
- package/dist/chunk-1c1gznm9.js +3 -0
- package/dist/chunk-1h3ey7k5.js +3 -0
- package/dist/chunk-1stt2whn.js +62 -0
- package/dist/chunk-1wjnd24b.js +24 -0
- package/dist/chunk-1xe07hzm.js +2 -0
- package/dist/chunk-2bp7tqca.js +2 -0
- package/dist/chunk-2dbkpfy9.js +2 -0
- package/dist/chunk-3q6czqs4.js +6 -0
- package/dist/chunk-3zdcekfj.js +5 -0
- package/dist/chunk-49ey79p0.js +5 -0
- package/dist/chunk-4c9m61yd.js +5 -0
- package/dist/chunk-4efbxdjr.js +4 -0
- package/dist/chunk-4f7panqj.js +21 -0
- package/dist/chunk-4hd3rre0.js +2 -0
- package/dist/chunk-4xsq18p3.js +9 -0
- package/dist/chunk-52x8mvh4.js +15 -0
- package/dist/chunk-54sc18p8.js +2 -0
- package/dist/chunk-56q4pwb5.js +3 -0
- package/dist/chunk-5c3qf34r.js +2 -0
- package/dist/chunk-5k40mwd4.js +4 -0
- package/dist/chunk-5kt03hx5.js +2 -0
- package/dist/chunk-63ept76v.js +2 -0
- package/dist/chunk-65b3vq52.js +2 -0
- package/dist/chunk-6d9hmjt8.js +3 -0
- package/dist/chunk-6g1y9yqh.js +3 -0
- package/dist/chunk-6k653r8w.js +2 -0
- package/dist/chunk-6md7qf2g.js +4 -0
- package/dist/chunk-6patq6bw.js +2 -0
- package/dist/chunk-6sgh49z1.js +2 -0
- package/dist/chunk-74pxb991.js +7 -0
- package/dist/chunk-7mgec8kb.js +7 -0
- package/dist/chunk-7tfrww3v.js +2 -0
- package/dist/chunk-7xk28xrv.js +2 -0
- package/dist/chunk-82dv4p13.js +2 -0
- package/dist/chunk-8661pvb8.js +3 -0
- package/dist/chunk-887s0w81.js +2 -0
- package/dist/chunk-8rc6042h.js +4 -0
- package/dist/chunk-9750tenz.js +3 -0
- package/dist/chunk-978wtejw.js +44 -0
- package/dist/chunk-9eqpaxfz.js +2 -0
- package/dist/chunk-9h04nskh.js +8 -0
- package/dist/chunk-9p1xkmjy.js +2 -0
- package/dist/chunk-agdesgzv.js +2 -0
- package/dist/chunk-akffynkc.js +3 -0
- package/dist/chunk-ar01x04a.js +2 -0
- package/dist/chunk-ay43f085.js +2 -0
- package/dist/chunk-bk9bqd5j.js +2 -0
- package/dist/chunk-bm8d40j0.js +69 -0
- package/dist/chunk-bxfc4g2x.js +73 -0
- package/dist/chunk-c3fczawt.js +2 -0
- package/dist/chunk-c9r9nd4t.js +1 -0
- package/dist/chunk-ctsz0ynx.js +3 -0
- package/dist/chunk-czremqk7.js +2 -0
- package/dist/chunk-da3wbh04.js +2 -0
- package/dist/chunk-dat582cg.js +2 -0
- package/dist/chunk-dfesffnr.js +3 -0
- package/dist/chunk-djntbp7a.js +105 -0
- package/dist/chunk-eagjp0dh.js +3 -0
- package/dist/chunk-eht72nnj.js +2 -0
- package/dist/chunk-f4nv5x3z.js +2 -0
- package/dist/chunk-fdfk918n.js +2 -0
- package/dist/chunk-fdj0tewy.js +20 -0
- package/dist/chunk-fm8ckj9b.js +2 -0
- package/dist/chunk-fqj7e6xa.js +2 -0
- package/dist/chunk-frm8zz31.js +2 -0
- package/dist/chunk-fvpr07dn.js +16 -0
- package/dist/chunk-g0nv8psv.js +2 -0
- package/dist/chunk-g0w8n555.js +19 -0
- package/dist/chunk-gkmvxjbe.js +2 -0
- package/dist/chunk-gngwjf70.js +7 -0
- package/dist/chunk-h7hs95wn.js +5 -0
- package/dist/chunk-hfvezfxh.js +3 -0
- package/dist/chunk-hw70wbzg.js +3 -0
- package/dist/chunk-j8asz4hb.js +15 -0
- package/dist/chunk-k62w2v03.js +2 -0
- package/dist/chunk-mcrfxphm.js +5 -0
- package/dist/chunk-mh3x7j6h.js +2 -0
- package/dist/chunk-naq32yx3.js +86 -0
- package/dist/chunk-nsmcjkas.js +2 -0
- package/dist/chunk-p1xm1jvz.js +2 -0
- package/dist/chunk-p3wsm8kz.js +2 -0
- package/dist/chunk-p4zwy518.js +4 -0
- package/dist/chunk-p7zgy37f.js +2 -0
- package/dist/chunk-ph1b3vbp.js +315 -0
- package/dist/chunk-pkjm2r0a.js +2 -0
- package/dist/chunk-pkkwb0n0.js +4 -0
- package/dist/chunk-pnpx1kqn.js +6 -0
- package/dist/chunk-q9n79dd3.js +3 -0
- package/dist/chunk-qpz9k66h.js +2 -0
- package/dist/chunk-qvn1rtgp.js +2 -0
- package/dist/chunk-qyf90zz3.js +2 -0
- package/dist/chunk-r06ce5g6.js +2 -0
- package/dist/chunk-r2sbprdb.js +49 -0
- package/dist/chunk-r3zyw8x0.js +3 -0
- package/dist/chunk-rb1fh9vd.js +1 -0
- package/dist/chunk-rqdep14r.js +2 -0
- package/dist/chunk-s1km8cyq.js +2 -0
- package/dist/chunk-s4ms8zag.js +2 -0
- package/dist/chunk-sp818c27.js +9 -0
- package/dist/chunk-tb5y0350.js +3 -0
- package/dist/chunk-thaxgm5p.js +2 -0
- package/dist/chunk-tn8prpny.js +503 -0
- package/dist/chunk-ts35hc5t.js +3 -0
- package/dist/chunk-tzs22es2.js +3 -0
- package/dist/chunk-vagxqhef.js +13 -0
- package/dist/chunk-vh504tcv.js +6 -0
- package/dist/chunk-vkctfqpm.js +3 -0
- package/dist/chunk-vyapg8ca.js +186 -0
- package/dist/chunk-wdwvt7gb.js +43 -0
- package/dist/chunk-wtjhehz9.js +4 -0
- package/dist/chunk-x0ya2r4r.js +3 -0
- package/dist/chunk-x3kragh9.js +12 -0
- package/dist/chunk-x9ctz1qc.js +1 -0
- package/dist/chunk-xakpdqaq.js +3 -0
- package/dist/chunk-xqx460y2.js +3 -0
- package/dist/chunk-xvptf9jy.js +3 -0
- package/dist/chunk-yk23nc4t.js +2 -0
- package/dist/chunk-yncea6ty.js +2 -0
- package/dist/chunk-yq0gxtzv.js +2 -0
- package/dist/chunk-yqhs08ky.js +2 -0
- package/dist/chunk-zb62jhwm.js +31 -0
- package/dist/chunk-zs3jaj0g.js +1023 -0
- package/dist/chunk-zve5d96e.js +2 -0
- package/dist/src/agent/index.d.ts +44 -0
- package/dist/src/agent/modes.d.ts +33 -0
- package/dist/src/agent/runner.d.ts +44 -0
- package/dist/src/agent/stacked.d.ts +83 -0
- package/dist/src/agent/tasks.d.ts +41 -0
- package/dist/src/agent/toolbelt.d.ts +19 -0
- package/dist/src/agent/tools/fs.d.ts +26 -0
- package/dist/src/agent/tools/shell.d.ts +32 -0
- package/dist/src/agent/types.d.ts +56 -0
- package/dist/src/ai/aliases.d.ts +62 -0
- package/dist/src/ai/client.d.ts +42 -0
- package/dist/src/ai/index.d.ts +35 -0
- package/dist/src/ai/learnings.d.ts +78 -0
- package/dist/src/ai/providers/anthropic.d.ts +12 -0
- package/dist/src/ai/providers/google.d.ts +12 -0
- package/dist/src/ai/providers/openai.d.ts +15 -0
- package/dist/src/ai/redact.d.ts +30 -0
- package/dist/src/ai/types.d.ts +75 -0
- package/dist/src/analysis/analyzers/actionlint.d.ts +11 -0
- package/dist/src/analysis/analyzers/external.d.ts +57 -0
- package/dist/src/analysis/analyzers/github-actions.d.ts +9 -0
- package/dist/src/analysis/analyzers/hadolint.d.ts +9 -0
- package/dist/src/analysis/analyzers/linter.d.ts +53 -0
- package/dist/src/analysis/analyzers/markdownlint.d.ts +11 -0
- package/dist/src/analysis/analyzers/secrets.d.ts +23 -0
- package/dist/src/analysis/analyzers/shellcheck.d.ts +8 -0
- package/dist/src/analysis/analyzers/syntax.d.ts +13 -0
- package/dist/src/analysis/engine.d.ts +38 -0
- package/dist/src/analysis/index.d.ts +13 -0
- package/dist/src/analysis/types.d.ts +14 -0
- package/dist/src/buddy.d.ts +17 -0
- package/dist/src/ci/classify.d.ts +49 -0
- package/dist/src/ci/fix.d.ts +42 -0
- package/dist/src/ci/index.d.ts +8 -0
- package/dist/src/commands/dispatcher.d.ts +49 -0
- package/dist/src/commands/handlers.d.ts +23 -0
- package/dist/src/commands/index.d.ts +22 -0
- package/dist/src/commands/parser.d.ts +71 -0
- package/dist/src/config-validation.d.ts +38 -0
- package/dist/src/config.d.ts +22 -0
- package/dist/src/dashboard/dashboard-generator.d.ts +10 -0
- package/dist/src/doctor.d.ts +44 -0
- package/dist/src/ecosystems/go.d.ts +10 -0
- package/dist/src/ecosystems/index.d.ts +60 -0
- package/dist/src/ecosystems/pep440.d.ts +57 -0
- package/dist/src/ecosystems/python.d.ts +12 -0
- package/dist/src/ecosystems/ruby.d.ts +9 -0
- package/dist/src/ecosystems/rust.d.ts +8 -0
- package/dist/src/ecosystems/scan.d.ts +49 -0
- package/dist/src/ecosystems/shared.d.ts +45 -0
- package/dist/src/ecosystems/types.d.ts +58 -0
- package/dist/src/events/bus.d.ts +41 -0
- package/dist/src/events/index.d.ts +11 -0
- package/dist/src/events/sinks.d.ts +33 -0
- package/dist/src/gates/ai-checks.d.ts +77 -0
- package/dist/src/gates/checks.d.ts +84 -0
- package/dist/src/gates/index.d.ts +17 -0
- package/dist/src/gates/post-merge.d.ts +56 -0
- package/dist/src/git/bitbucket-provider.d.ts +50 -0
- package/dist/src/git/github-provider.d.ts +50 -0
- package/dist/src/git/gitlab-provider.d.ts +51 -0
- package/dist/src/git/provider.d.ts +210 -0
- package/dist/src/headless/run.d.ts +78 -0
- package/dist/src/index.d.ts +243 -0
- package/dist/src/index.js +2 -0
- package/dist/src/issues/enrichment.d.ts +76 -0
- package/dist/src/issues/index.d.ts +16 -0
- package/dist/src/issues/quick-links.d.ts +55 -0
- package/dist/src/pr/auto-merge.d.ts +75 -0
- package/dist/src/pr/pr-generator.d.ts +9 -0
- package/dist/src/pr/pr-manifest.d.ts +82 -0
- package/dist/src/pr/templates.d.ts +44 -0
- package/dist/src/registry/docker-tags.d.ts +56 -0
- package/dist/src/registry/eol.d.ts +87 -0
- package/dist/src/registry/oci-client.d.ts +98 -0
- package/dist/src/registry/registry-client.d.ts +39 -0
- package/dist/src/reports/history.d.ts +51 -0
- package/dist/src/reports/index.d.ts +23 -0
- package/dist/src/reports/metrics.d.ts +89 -0
- package/dist/src/reports/render.d.ts +33 -0
- package/dist/src/review/diff.d.ts +50 -0
- package/dist/src/review/engine.d.ts +49 -0
- package/dist/src/review/findings.d.ts +102 -0
- package/dist/src/review/guidelines.d.ts +46 -0
- package/dist/src/review/index.d.ts +48 -0
- package/dist/src/review/local.d.ts +81 -0
- package/dist/src/review/marker.d.ts +34 -0
- package/dist/src/review/poster.d.ts +39 -0
- package/dist/src/review/run.d.ts +24 -0
- package/dist/src/rules/engine.d.ts +108 -0
- package/dist/src/rules/index.d.ts +9 -0
- package/dist/src/rules/renovate.d.ts +25 -0
- package/dist/src/rules/schedule.d.ts +44 -0
- package/dist/src/scanner/catalog-scan.d.ts +39 -0
- package/dist/src/scanner/package-json-extras.d.ts +101 -0
- package/dist/src/scanner/package-scanner.d.ts +17 -0
- package/dist/src/scanner/resolution-drift.d.ts +81 -0
- package/dist/src/scanner/workspace-catalog.d.ts +53 -0
- package/dist/src/scheduler/scheduler.d.ts +27 -0
- package/dist/src/security/engine.d.ts +12 -0
- package/dist/src/security/loader.d.ts +7 -0
- package/dist/src/security/parser.d.ts +15 -0
- package/dist/src/security/rules/bash-injection.d.ts +18 -0
- package/dist/src/security/rules/dangerous-pull-request-target.d.ts +18 -0
- package/dist/src/security/rules/excessive-permissions.d.ts +14 -0
- package/dist/src/security/rules/index.d.ts +16 -0
- package/dist/src/security/rules/missing-timeout.d.ts +9 -0
- package/dist/src/security/rules/self-hosted-exposure.d.ts +13 -0
- package/dist/src/security/rules/unpinned-action.d.ts +10 -0
- package/dist/src/security/rules/walk.d.ts +13 -0
- package/dist/src/security/types.d.ts +64 -0
- package/dist/src/services/deprecated-dependencies-checker.d.ts +16 -0
- package/dist/src/services/release-notes-fetcher.d.ts +70 -0
- package/dist/src/services/security-advisories.d.ts +59 -0
- package/dist/src/setup.d.ts +162 -0
- package/dist/src/setup.js +2 -0
- package/dist/src/templates/github-actions.d.ts +31 -0
- package/dist/src/templates/gitlab-ci.d.ts +46 -0
- package/dist/src/types.d.ts +449 -0
- package/dist/src/upgrades/index.d.ts +18 -0
- package/dist/src/upgrades/migrate.d.ts +45 -0
- package/dist/src/upgrades/plan.d.ts +112 -0
- package/dist/src/upgrades/report.d.ts +22 -0
- package/dist/src/upgrades/span.d.ts +47 -0
- package/dist/src/upgrades/usage.d.ts +30 -0
- package/dist/src/upgrades/wire.d.ts +61 -0
- package/dist/src/utils/concurrency.d.ts +50 -0
- package/dist/src/utils/dependency-file-parser.d.ts +17 -0
- package/dist/src/utils/dockerfile-parser.d.ts +69 -0
- package/dist/src/utils/endpoints.d.ts +58 -0
- package/dist/src/utils/errors.d.ts +35 -0
- package/dist/src/utils/file-changes.d.ts +14 -0
- package/dist/src/utils/github-actions-parser.d.ts +21 -0
- package/dist/src/utils/globs.d.ts +22 -0
- package/dist/src/utils/helpers.d.ts +73 -0
- package/dist/src/utils/http.d.ts +81 -0
- package/dist/src/utils/lock-file.d.ts +28 -0
- package/dist/src/utils/logger.d.ts +45 -0
- package/dist/src/utils/package-paths.d.ts +6 -0
- package/dist/src/utils/pantry-parser.d.ts +30 -0
- package/dist/src/utils/repository.d.ts +41 -0
- package/dist/src/utils/security-format.d.ts +18 -0
- package/dist/src/utils/zig-parser.d.ts +18 -0
- package/dist/src/version/version-resolver.d.ts +9 -0
- package/package.json +115 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Logger } from './logger';
|
|
2
|
+
import type { PackageFile, PackageUpdate, UpdateGroup } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Parse package file content based on file type
|
|
5
|
+
*/
|
|
6
|
+
export declare function parsePackageFile(content: string, filePath: string): Promise<PackageFile | null>;
|
|
7
|
+
/**
|
|
8
|
+
* Detect package manager based on lock files and configuration
|
|
9
|
+
*/
|
|
10
|
+
export declare function detectPackageManager(projectPath: string): 'bun' | 'npm' | 'yarn' | 'pnpm';
|
|
11
|
+
/**
|
|
12
|
+
* Format commit message for dependency updates
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatCommitMessage(updates: PackageUpdate[], template?: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Format pull request title
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatPRTitle(updates: PackageUpdate[], template?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Format pull request body with update details
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatPRBody(updates: PackageUpdate[], template?: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Generate a deterministic branch name for dependency updates.
|
|
25
|
+
* Branch names are stable (no timestamps) so the same update always
|
|
26
|
+
* maps to the same branch, preventing duplicate PRs across runs.
|
|
27
|
+
*/
|
|
28
|
+
export declare function generateBranchName(updates: PackageUpdate[], prefix?: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Group updates based on configuration and type.
|
|
31
|
+
* Separates GitHub Actions and Docker updates into their own dedicated PR groups
|
|
32
|
+
* to prevent mixing dependency ecosystems (like Renovate does).
|
|
33
|
+
*/
|
|
34
|
+
export declare function groupUpdates(updates: PackageUpdate[], options?: { prioritizeSecurity?: boolean }): UpdateGroup[];
|
|
35
|
+
/**
|
|
36
|
+
* Sort updates by priority.
|
|
37
|
+
*
|
|
38
|
+
* Updates that resolve a known vulnerability sort first, most severe first —
|
|
39
|
+
* a run that hits `maxPRsPerRun` should spend its budget on security fixes
|
|
40
|
+
* before routine version bumps. Everything else keeps the previous ordering:
|
|
41
|
+
* major before minor before patch, then alphabetical.
|
|
42
|
+
*
|
|
43
|
+
* @param updates - Updates to sort, sorted in place
|
|
44
|
+
* @param options.prioritizeSecurity - Float advisory fixes to the top (default: true)
|
|
45
|
+
* @returns The same array, sorted
|
|
46
|
+
*/
|
|
47
|
+
export declare function sortUpdatesByPriority(updates: PackageUpdate[], options?: { prioritizeSecurity?: boolean }): PackageUpdate[];
|
|
48
|
+
/**
|
|
49
|
+
* Parse version string and determine update type using Bun's semver
|
|
50
|
+
*/
|
|
51
|
+
export declare function getUpdateType(currentVersion: string, newVersion: string): 'major' | 'minor' | 'patch';
|
|
52
|
+
/**
|
|
53
|
+
* Check if version satisfies semver range
|
|
54
|
+
*/
|
|
55
|
+
export declare function satisfiesRange(version: string, range: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Check for PRs that have the rebase checkbox checked
|
|
58
|
+
*/
|
|
59
|
+
export declare function checkForRebaseRequests(token: string, owner: string, repo: string): Promise<Array<{ number: number, branchName: string }>>;
|
|
60
|
+
/**
|
|
61
|
+
* Extract package names from PR body
|
|
62
|
+
*
|
|
63
|
+
* Reads the embedded manifest when present, falling back to scraping the
|
|
64
|
+
* rendered tables for PRs opened before manifests existed.
|
|
65
|
+
*/
|
|
66
|
+
export declare function extractPackageNamesFromPRBody(body: string): string[];
|
|
67
|
+
/**
|
|
68
|
+
* Check if a PR should be auto-closed due to configuration changes
|
|
69
|
+
* This handles cases where:
|
|
70
|
+
* 1. respectLatest config changed from false to true, making dynamic version updates invalid
|
|
71
|
+
* 2. ignorePaths config changed to exclude paths that existing PRs contain updates for
|
|
72
|
+
*/
|
|
73
|
+
export declare function checkForAutoClose(pr: any, config: any, logger: Logger): Promise<boolean>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a server-provided retry delay from response headers.
|
|
3
|
+
*
|
|
4
|
+
* Understands `Retry-After` in both of its RFC 9110 forms (delta-seconds and
|
|
5
|
+
* HTTP-date) and GitHub's `x-ratelimit-reset` epoch timestamp, which is the
|
|
6
|
+
* only hint sent when a primary rate limit is exhausted.
|
|
7
|
+
*
|
|
8
|
+
* @returns Delay in milliseconds, or `null` when the response carries no hint
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseRetryDelay(headers: Headers, now?: number): number | null;
|
|
11
|
+
/**
|
|
12
|
+
* `fetch` with a hard timeout and bounded retries.
|
|
13
|
+
*
|
|
14
|
+
* Non-2xx responses are returned rather than thrown, matching `fetch`
|
|
15
|
+
* semantics — only a total failure to obtain a response raises
|
|
16
|
+
* {@link HttpRequestError}.
|
|
17
|
+
*
|
|
18
|
+
* Retries are conservative by design. Idempotent methods retry on transient
|
|
19
|
+
* statuses and network failures; POST and PATCH retry only when the server
|
|
20
|
+
* explicitly rejected the request with a rate-limit status, because a replayed
|
|
21
|
+
* write could otherwise create a duplicate pull request or issue.
|
|
22
|
+
*
|
|
23
|
+
* @param url - Absolute request URL
|
|
24
|
+
* @param options - Standard `RequestInit` plus timeout and retry controls
|
|
25
|
+
* @returns The final `Response`, successful or not
|
|
26
|
+
* @throws {HttpRequestError} When no response could be obtained after retries
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const response = await fetchWithTimeout('https://registry.npmjs.org/react', {
|
|
30
|
+
* timeoutMs: 10_000,
|
|
31
|
+
* })
|
|
32
|
+
* if (response.ok)
|
|
33
|
+
* console.log(await response.json())
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function fetchWithTimeout(url: string, options?: HttpRequestOptions): Promise<Response>;
|
|
37
|
+
/**
|
|
38
|
+
* Fetch a URL and parse the body as JSON, returning `null` for any
|
|
39
|
+
* non-2xx response or unparseable body.
|
|
40
|
+
*
|
|
41
|
+
* Intended for best-effort metadata lookups where a miss is not fatal — a
|
|
42
|
+
* package that has no Packagist entry, an image with no Docker Hub tags. Use
|
|
43
|
+
* {@link fetchWithTimeout} directly when the caller must distinguish a 404
|
|
44
|
+
* from a 500.
|
|
45
|
+
*
|
|
46
|
+
* @param url - Absolute request URL
|
|
47
|
+
* @param options - Standard `RequestInit` plus timeout and retry controls
|
|
48
|
+
* @returns The parsed body, or `null` when unavailable
|
|
49
|
+
*/
|
|
50
|
+
export declare function fetchJsonOrNull<T>(url: string, options?: HttpRequestOptions): Promise<T | null>;
|
|
51
|
+
/**
|
|
52
|
+
* Default per-request timeout.
|
|
53
|
+
*
|
|
54
|
+
* Every outbound request buddy makes is a small JSON API call, so 30s is
|
|
55
|
+
* generous. The point is that *some* bound exists: an unbounded `fetch()` in a
|
|
56
|
+
* GitHub Actions job hangs until the 6-hour job cap, turning a transient
|
|
57
|
+
* network stall into a wasted workflow run.
|
|
58
|
+
*/
|
|
59
|
+
export declare const DEFAULT_TIMEOUT_MS: unknown;
|
|
60
|
+
/** Retry attempts made *after* the initial request. */
|
|
61
|
+
export declare const DEFAULT_RETRIES: 2;
|
|
62
|
+
export declare interface HttpRequestOptions extends RequestInit {
|
|
63
|
+
timeoutMs?: number
|
|
64
|
+
retries?: number
|
|
65
|
+
retryBaseMs?: number
|
|
66
|
+
maxDelayMs?: number
|
|
67
|
+
retryNonIdempotent?: boolean
|
|
68
|
+
onRetry?: (info: { attempt: number, delayMs: number, reason: string }) => void
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Raised when a request fails to produce a response at all (timeout, DNS
|
|
72
|
+
* failure, connection reset) after exhausting retries. Non-2xx responses are
|
|
73
|
+
* *not* errors here — they are returned so callers can branch on status.
|
|
74
|
+
*/
|
|
75
|
+
export declare class HttpRequestError extends Error {
|
|
76
|
+
public readonly url: string;
|
|
77
|
+
public readonly method: string;
|
|
78
|
+
public readonly attempts: number;
|
|
79
|
+
public readonly timedOut: boolean;
|
|
80
|
+
constructor(message: string, url: string, method: string, attempts: number, timedOut: boolean, options?: { cause?: unknown });
|
|
81
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All lock file names that may need to be staged after regeneration
|
|
3
|
+
*/
|
|
4
|
+
export declare function getAllLockFilePaths(): string[];
|
|
5
|
+
/**
|
|
6
|
+
* Regenerate lock file by running the appropriate install command.
|
|
7
|
+
* Non-fatal: catches errors, logs warnings, returns a result object.
|
|
8
|
+
* @param packageManager - The package manager to use
|
|
9
|
+
* @param cwd - Working directory to run the command in
|
|
10
|
+
* @param timeoutMs - Timeout in milliseconds (default: 5 minutes)
|
|
11
|
+
*/
|
|
12
|
+
export declare function regenerateLockFile(packageManager: PackageManagerType, cwd: string, timeoutMs?: number): Promise<LockFileResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Examine which manifest files were updated to determine which package managers
|
|
15
|
+
* need lock file regeneration.
|
|
16
|
+
* @param updatedFilePaths - List of file paths that were updated
|
|
17
|
+
*/
|
|
18
|
+
export declare function detectRequiredPackageManagers(updatedFilePaths: string[]): PackageManagerType[];
|
|
19
|
+
/**
|
|
20
|
+
* Check if a lock file exists for a given package manager in the working directory
|
|
21
|
+
*/
|
|
22
|
+
export declare function hasLockFile(packageManager: PackageManagerType, cwd: string): boolean;
|
|
23
|
+
export declare interface LockFileResult {
|
|
24
|
+
success: boolean
|
|
25
|
+
packageManager: PackageManagerType
|
|
26
|
+
message: string
|
|
27
|
+
}
|
|
28
|
+
export type PackageManagerType = 'bun' | 'npm' | 'yarn' | 'pnpm' | 'composer';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replace the process-wide default logger.
|
|
3
|
+
*
|
|
4
|
+
* @param logger - Logger that free functions should use
|
|
5
|
+
*/
|
|
6
|
+
export declare function setDefaultLogger(logger: Logger): void;
|
|
7
|
+
/**
|
|
8
|
+
* The current process-wide default logger.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getDefaultLogger(): Logger;
|
|
11
|
+
/**
|
|
12
|
+
* Verbosity levels, ordered from quietest to loudest.
|
|
13
|
+
*
|
|
14
|
+
* `silent` is what programmatic consumers want: embedding buddy in another
|
|
15
|
+
* tool should not print several hundred lines to that tool's stdout.
|
|
16
|
+
*/
|
|
17
|
+
export type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'debug';
|
|
18
|
+
/**
|
|
19
|
+
* Level-aware logger used throughout buddy.
|
|
20
|
+
*
|
|
21
|
+
* Every message goes through an instance so output can be turned down or off.
|
|
22
|
+
* Previously `info`, `warn`, `error` and `success` all wrote unconditionally
|
|
23
|
+
* and only `debug` respected verbosity, which meant `verbose: false` did
|
|
24
|
+
* almost nothing and library consumers could not silence the tool at all.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const logger = new Logger(config.verbose) // 'debug' when verbose, else 'info'
|
|
29
|
+
* const quiet = Logger.silent() // suppresses everything
|
|
30
|
+
* const custom = Logger.withLevel('warn') // warnings and errors only
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class Logger {
|
|
34
|
+
constructor(verbose?: boolean, level?: LogLevel);
|
|
35
|
+
info(message: string, ...args: any[]): void;
|
|
36
|
+
warn(message: string, ...args: any[]): void;
|
|
37
|
+
error(message: string, ...args: any[]): void;
|
|
38
|
+
debug(message: string, ...args: any[]): void;
|
|
39
|
+
success(message: string, ...args: any[]): void;
|
|
40
|
+
get logLevel(): LogLevel;
|
|
41
|
+
static verbose(): Logger;
|
|
42
|
+
static quiet(): Logger;
|
|
43
|
+
static silent(): Logger;
|
|
44
|
+
static withLevel(level: LogLevel): Logger;
|
|
45
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package discovery must not descend into installed dependencies, generated
|
|
3
|
+
* package-manager trees, or build output. Manifests in those directories are
|
|
4
|
+
* implementation details, not dependency declarations owned by the project.
|
|
5
|
+
*/
|
|
6
|
+
export declare function shouldSkipPackageDirectory(dirName: string): boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { PackageFile } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Check if a file is a pantry.lock file
|
|
4
|
+
*
|
|
5
|
+
* Parsing is deliberately all this module does. `pantry.lock` is a lock file,
|
|
6
|
+
* not a manifest: its contents follow from the dependency file beside it, so
|
|
7
|
+
* it is regenerated by the install step in `lock-file.ts` rather than being
|
|
8
|
+
* updated package by package. Parsing still earns its place — the dashboard
|
|
9
|
+
* lists what a project actually resolved.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isPantryLockFile(filePath: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Parse a pantry.lock file and extract dependencies
|
|
14
|
+
*/
|
|
15
|
+
export declare function parsePantryLockFile(filePath: string, content: string): Promise<PackageFile | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Interface for pantry.lock file structure
|
|
18
|
+
*/
|
|
19
|
+
export declare interface PantryLock {
|
|
20
|
+
version: string
|
|
21
|
+
packages: Record<string, PantryPackage>
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Interface for a single pantry package entry
|
|
25
|
+
*/
|
|
26
|
+
export declare interface PantryPackage {
|
|
27
|
+
name: string
|
|
28
|
+
version: string
|
|
29
|
+
resolved: string
|
|
30
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { BuddyConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the repository buddy should operate on, mutating the config in place.
|
|
4
|
+
*
|
|
5
|
+
* The CI-provided repository wins over a configured owner/name whenever the two
|
|
6
|
+
* disagree — `GITHUB_REPOSITORY`, `CI_PROJECT_PATH` or `BITBUCKET_REPO_FULL_NAME`
|
|
7
|
+
* depending on the platform.
|
|
8
|
+
* buddy commits and pushes through the local checkout's `origin`, so the API
|
|
9
|
+
* target must be the repository that is actually checked out — a config pointing
|
|
10
|
+
* elsewhere (commonly a value copy-pasted from another project's config) can only
|
|
11
|
+
* produce 403s and updates aimed at the wrong repo.
|
|
12
|
+
*
|
|
13
|
+
* A configured `dashboard.issueNumber` is dropped when the repository is overridden,
|
|
14
|
+
* since an issue number is only meaningful within the repository it came from.
|
|
15
|
+
*
|
|
16
|
+
* @param config - Configuration to resolve and mutate
|
|
17
|
+
* @param env - Environment to read the repository from (defaults to `process.env`)
|
|
18
|
+
* @returns Details of what was resolved and whether the config was overridden
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const result = resolveRepositoryConfig(config)
|
|
22
|
+
* if (result.warning)
|
|
23
|
+
* logger.warn(result.warning)
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveRepositoryConfig(config: BuddyConfig, env?: Record<string, string | undefined>): RepositoryResolution;
|
|
27
|
+
/**
|
|
28
|
+
* The CI variable each platform exposes the repository through.
|
|
29
|
+
*
|
|
30
|
+
* Read in order, so a runner that sets more than one (a GitLab job mirroring
|
|
31
|
+
* from GitHub, say) resolves deterministically rather than by whichever
|
|
32
|
+
* happened to be checked first.
|
|
33
|
+
*/
|
|
34
|
+
export declare const REPOSITORY_ENV_VARS: string[];
|
|
35
|
+
export declare interface RepositoryResolution {
|
|
36
|
+
owner?: string
|
|
37
|
+
name?: string
|
|
38
|
+
source: 'config' | 'environment' | 'unresolved'
|
|
39
|
+
overrodeConfig: boolean
|
|
40
|
+
warning?: string
|
|
41
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PackageUpdate } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Render the vulnerability section for updates that resolve known advisories.
|
|
4
|
+
*
|
|
5
|
+
* Lives in its own module because both the PR generator and the plain-text
|
|
6
|
+
* body formatter need it, and importing one from the other would close a
|
|
7
|
+
* cycle.
|
|
8
|
+
*
|
|
9
|
+
* @param updates - Updates included in the pull request
|
|
10
|
+
* @returns Markdown section, or an empty string when no update resolves an advisory
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const section = formatSecurityAdvisorySection(group.updates)
|
|
14
|
+
* if (section)
|
|
15
|
+
* body += section
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatSecurityAdvisorySection(updates: readonly PackageUpdate[]): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PackageFile, PackageUpdate } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Check if a file path is a Zig build manifest file
|
|
4
|
+
*/
|
|
5
|
+
export declare function isZigManifest(filePath: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Parse a build.zig.zon file
|
|
8
|
+
* The format uses Zig Object Notation (ZON), which is similar to Zig struct literals
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseZigManifest(filePath: string, content: string): Promise<PackageFile | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Update Zig manifest file content with new package versions
|
|
13
|
+
*/
|
|
14
|
+
export declare function updateZigManifest(filePath: string, content: string, updates: PackageUpdate[]): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Generate file changes for Zig manifest files
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateZigManifestUpdates(updates: PackageUpdate[]): Promise<Array<{ path: string, content: string, type: 'update' }>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { VersionRange } from '../types';
|
|
2
|
+
export declare class VersionResolver {
|
|
3
|
+
static compareVersions(version1: string, version2: string): -1 | 0 | 1;
|
|
4
|
+
static satisfiesRange(version: string, range: string): boolean;
|
|
5
|
+
static getLatestInRange(versions: string[], range: string): string | null;
|
|
6
|
+
static createRange(rangeString: string): VersionRange;
|
|
7
|
+
static getUpdateType(fromVersion: string, toVersion: string): 'major' | 'minor' | 'patch';
|
|
8
|
+
static isSafeUpdate(currentRange: string, newVersion: string): boolean;
|
|
9
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@buddysh/buddy",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.11.0",
|
|
5
|
+
"description": "AI code review and dependency updates in one bot. Reviews pull requests and local changes, answers @buddy comments, gates merges, repairs failing CI, and keeps dependencies current across npm, Composer, Docker, GitHub Actions and more.",
|
|
6
|
+
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "https://github.com/stacksjs/buddy",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/stacksjs/buddy.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/stacksjs/buddy/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"buddy",
|
|
18
|
+
"code-review",
|
|
19
|
+
"ai-code-review",
|
|
20
|
+
"pull-request-review",
|
|
21
|
+
"ai",
|
|
22
|
+
"coderabbit",
|
|
23
|
+
"dependency-updates",
|
|
24
|
+
"dependency-management",
|
|
25
|
+
"renovate",
|
|
26
|
+
"dependabot",
|
|
27
|
+
"bot",
|
|
28
|
+
"bun",
|
|
29
|
+
"typescript",
|
|
30
|
+
"javascript"
|
|
31
|
+
],
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/src/index.d.ts",
|
|
35
|
+
"import": "./dist/src/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./setup": {
|
|
38
|
+
"types": "./dist/src/setup.d.ts",
|
|
39
|
+
"import": "./dist/src/setup.js"
|
|
40
|
+
},
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
"module": "./dist/src/index.js",
|
|
44
|
+
"types": "./dist/src/index.d.ts",
|
|
45
|
+
"bin": {
|
|
46
|
+
"buddy": "./dist/bin/cli.js"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"files": [
|
|
52
|
+
"README.md",
|
|
53
|
+
"bin",
|
|
54
|
+
"dist"
|
|
55
|
+
],
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "bun build.ts",
|
|
58
|
+
"build:binaries": "bun build-binaries.ts",
|
|
59
|
+
"fresh": "bunx rimraf node_modules/ bun.lock && bun i",
|
|
60
|
+
"prepublishOnly": "bun run build",
|
|
61
|
+
"test": "bun test",
|
|
62
|
+
"lint": "bunx --bun pickier .",
|
|
63
|
+
"lint:fix": "bunx --bun pickier . --fix",
|
|
64
|
+
"format": "bunx --bun pickier . --format",
|
|
65
|
+
"format:fix": "bunx --bun pickier . --format --write",
|
|
66
|
+
"changelog": "bunx logsmith --verbose",
|
|
67
|
+
"changelog:generate": "bunx logsmith --output CHANGELOG.md",
|
|
68
|
+
"release": "bunx --bun bumpx -r",
|
|
69
|
+
"typecheck": "bunx tsc --noEmit",
|
|
70
|
+
"dev:docs": "bun --bun bunpress dev",
|
|
71
|
+
"build:docs": "bun --bun bunpress build",
|
|
72
|
+
"preview:docs": "bun --bun bunpress preview --outdir docs/dist",
|
|
73
|
+
"release:patch": "bunx --bun bumpx patch --recursive --commit --tag --push --yes",
|
|
74
|
+
"release:minor": "bunx --bun bumpx minor --recursive --commit --tag --push --yes",
|
|
75
|
+
"release:major": "bunx --bun bumpx major --recursive --commit --tag --push --yes",
|
|
76
|
+
"deploy:docs": "bun scripts/deploy-docs.ts"
|
|
77
|
+
},
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"prompts": "^2.4.2",
|
|
80
|
+
"ts-pantry": "^0.11.32"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@anthropic-ai/sdk": "^0.120.0",
|
|
84
|
+
"@stacksjs/bumpx": "^0.2.17",
|
|
85
|
+
"@stacksjs/bunpress": "^0.2.13",
|
|
86
|
+
"@stacksjs/clapp": "^0.2.13",
|
|
87
|
+
"@stacksjs/clarity": "^0.3.33",
|
|
88
|
+
"@stacksjs/gitlint": "^0.1.8",
|
|
89
|
+
"@stacksjs/logsmith": "^0.2.11",
|
|
90
|
+
"@stacksjs/ts-cloud": "^0.12.0",
|
|
91
|
+
"@types/bun": "^1.4.0",
|
|
92
|
+
"@types/prompts": "^2.4.9",
|
|
93
|
+
"bun-git-hooks": "^0.3.3",
|
|
94
|
+
"bun-plugin-dtsx": "^0.11.10",
|
|
95
|
+
"bunfig": "^0.15.19",
|
|
96
|
+
"pickier": "^0.1.65",
|
|
97
|
+
"typescript": "^7.0.2"
|
|
98
|
+
},
|
|
99
|
+
"git-hooks": {
|
|
100
|
+
"pre-commit": {
|
|
101
|
+
"staged-lint": {
|
|
102
|
+
"*.{js,ts,json,yaml,yml,md}": "bunx --bun pickier lint --fix"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"commit-msg": "bunx gitlint --edit .git/COMMIT_EDITMSG"
|
|
106
|
+
},
|
|
107
|
+
"peerDependencies": {
|
|
108
|
+
"@anthropic-ai/sdk": "^0.117.1"
|
|
109
|
+
},
|
|
110
|
+
"peerDependenciesMeta": {
|
|
111
|
+
"@anthropic-ai/sdk": {
|
|
112
|
+
"optional": true
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|