@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,18 @@
|
|
|
1
|
+
export type { UpgradeOptions, UpgradeResult } from './migrate';
|
|
2
|
+
export type { BreakingChange, MigrationConfidence, MigrationPlan } from './plan';
|
|
3
|
+
export type { MigrationOutcome } from './report';
|
|
4
|
+
export type { UsageSite } from './usage';
|
|
5
|
+
export type { ReleaseSpan, SpanRelease } from './span';
|
|
6
|
+
export type { GroupUpgradeOptions, GroupUpgradeOutcome } from './wire';
|
|
7
|
+
export { attemptMajorUpgrade } from './migrate';
|
|
8
|
+
export {
|
|
9
|
+
buildAnalysisPrompt,
|
|
10
|
+
isAllowedCodemod,
|
|
11
|
+
MIGRATION_PLAN_SCHEMA,
|
|
12
|
+
normalizePlan,
|
|
13
|
+
shouldOpenAsDraft,
|
|
14
|
+
} from './plan';
|
|
15
|
+
export { renderMigrationReport } from './report';
|
|
16
|
+
export { findUsageSites, summarizeUsage } from './usage';
|
|
17
|
+
export { collectSpanNotes, DEFAULT_SPAN_BUDGET, describeSpanGaps } from './span';
|
|
18
|
+
export { analyzeGroupMajors, appendUpgradeReport, matchesGlobs } from './wire';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AiClient } from '../ai/types';
|
|
2
|
+
import type { Logger } from '../utils/logger';
|
|
3
|
+
import type { MigrationConfidence, MigrationPlan } from './plan';
|
|
4
|
+
import type { MigrationOutcome } from './report';
|
|
5
|
+
import type { PackageUpdate } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Analyse a major upgrade, and migrate the repository when asked to.
|
|
8
|
+
*
|
|
9
|
+
* The fallback ladder is the design: with no AI configured this returns
|
|
10
|
+
* nothing and the caller opens the ordinary major-update pull request it
|
|
11
|
+
* always did; with AI it adds an analysis; with `autoMigrate` it attempts the
|
|
12
|
+
* change and reports honestly whether verification passed. A migration is
|
|
13
|
+
* never presented as finished when it is not — a broken PR that looks ready
|
|
14
|
+
* costs more than an obviously unfinished one.
|
|
15
|
+
*
|
|
16
|
+
* @param options - The update, its release notes and repository context
|
|
17
|
+
* @returns The plan, what was done, and the report to attach
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const result = await attemptMajorUpgrade({ update, releaseNotes, files, workspace, baseBranch, ai })
|
|
21
|
+
* pr.body += result.report
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function attemptMajorUpgrade(options: UpgradeOptions): Promise<UpgradeResult>;
|
|
25
|
+
/** What a major-upgrade attempt produced. */
|
|
26
|
+
export declare interface UpgradeResult {
|
|
27
|
+
plan: MigrationPlan | null
|
|
28
|
+
outcome?: MigrationOutcome
|
|
29
|
+
report: string
|
|
30
|
+
draft: boolean
|
|
31
|
+
status: 'analysis-only' | 'migrated' | 'migration-failed' | 'skipped'
|
|
32
|
+
}
|
|
33
|
+
/** Inputs to a major-upgrade attempt. */
|
|
34
|
+
export declare interface UpgradeOptions {
|
|
35
|
+
update: PackageUpdate
|
|
36
|
+
releaseNotes: string
|
|
37
|
+
files: string[]
|
|
38
|
+
workspace: string
|
|
39
|
+
baseBranch: string
|
|
40
|
+
branch?: string
|
|
41
|
+
ai?: AiClient | null
|
|
42
|
+
autoMigrate?: boolean
|
|
43
|
+
draftBelowConfidence?: MigrationConfidence
|
|
44
|
+
logger?: Logger
|
|
45
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { UsageSite } from './usage';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a codemod command is safe to execute.
|
|
4
|
+
*
|
|
5
|
+
* The command comes from a model reading a changelog, which means in the worst
|
|
6
|
+
* case it comes from whoever wrote that changelog. Only a plain package runner
|
|
7
|
+
* invocation is allowed — no shell operators, no redirection, nothing that
|
|
8
|
+
* could chain a second command.
|
|
9
|
+
*
|
|
10
|
+
* @param command - Proposed codemod command
|
|
11
|
+
*/
|
|
12
|
+
export declare function isAllowedCodemod(command: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Build the analysis prompt for a major upgrade.
|
|
15
|
+
*
|
|
16
|
+
* @param input - Package, versions, release notes and where it is used
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildAnalysisPrompt(input: {
|
|
19
|
+
packageName: string
|
|
20
|
+
fromVersion: string
|
|
21
|
+
toVersion: string
|
|
22
|
+
releaseNotes: string
|
|
23
|
+
usage: UsageSite[]
|
|
24
|
+
}): string;
|
|
25
|
+
/**
|
|
26
|
+
* Validate and normalize a plan returned by the model.
|
|
27
|
+
*
|
|
28
|
+
* Files the model named that do not appear in the known usage set are dropped:
|
|
29
|
+
* a plan that edits a file it never saw is guessing, and acting on it is how a
|
|
30
|
+
* migration corrupts unrelated code.
|
|
31
|
+
*
|
|
32
|
+
* @param raw - Parsed model output
|
|
33
|
+
* @param context - Package identity and the files known to use it
|
|
34
|
+
* @returns A plan safe to act on
|
|
35
|
+
*/
|
|
36
|
+
export declare function normalizePlan(raw: unknown, context: { packageName: string, fromVersion: string, toVersion: string, knownFiles: string[] }): MigrationPlan;
|
|
37
|
+
/**
|
|
38
|
+
* Whether a plan should open as a draft rather than a ready pull request.
|
|
39
|
+
*
|
|
40
|
+
* Anything below the configured confidence floor opens as a draft, because a
|
|
41
|
+
* migration a maintainer has to check is one that should not look finished.
|
|
42
|
+
*
|
|
43
|
+
* @param plan - Normalized plan
|
|
44
|
+
* @param floor - Minimum confidence to open ready
|
|
45
|
+
*/
|
|
46
|
+
export declare function shouldOpenAsDraft(plan: MigrationPlan, floor?: MigrationConfidence): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Schema the model's migration analysis is validated against.
|
|
49
|
+
*
|
|
50
|
+
* Constrained so a plan either names files that exist and actions that can be
|
|
51
|
+
* executed, or fails validation — a free-form plan reads convincingly and
|
|
52
|
+
* cannot be acted on.
|
|
53
|
+
* @defaultValue
|
|
54
|
+
* ```ts
|
|
55
|
+
* {
|
|
56
|
+
* type: 'object',
|
|
57
|
+
* properties: {
|
|
58
|
+
* changes: {
|
|
59
|
+
* type: 'array',
|
|
60
|
+
* items: {
|
|
61
|
+
* type: 'object',
|
|
62
|
+
* properties: {
|
|
63
|
+
* description: { type: 'string', description: 'What upstream changed' },
|
|
64
|
+
* version: { type: 'string', description: 'Version the change landed in' },
|
|
65
|
+
* affectedFiles: { type: 'array', items: { type: 'string' } },
|
|
66
|
+
* action: { type: 'string', description: 'What must be done in this repository' },
|
|
67
|
+
* automatable: { type: 'boolean', description: 'Whether the fix is mechanical' }
|
|
68
|
+
* },
|
|
69
|
+
* required: ['description', 'affectedFiles', 'action', 'automatable'],
|
|
70
|
+
* additionalProperties: false
|
|
71
|
+
* }
|
|
72
|
+
* },
|
|
73
|
+
* codemod: {
|
|
74
|
+
* type: 'object',
|
|
75
|
+
* properties: {
|
|
76
|
+
* command: { type: 'string', description: 'Command that applies the official codemod' },
|
|
77
|
+
* source: { type: 'string', description: 'Where the codemod is documented' }
|
|
78
|
+
* },
|
|
79
|
+
* required: ['command', 'source'],
|
|
80
|
+
* additionalProperties: false
|
|
81
|
+
* },
|
|
82
|
+
* confidence: { type: 'string', enum: ['high', 'medium', 'low'] },
|
|
83
|
+
* effort: { type: 'integer', description: '1 (trivial) to 5 (demanding)' },
|
|
84
|
+
* risks: { type: 'array', items: { type: 'string' } }
|
|
85
|
+
* },
|
|
86
|
+
* required: ['changes', 'confidence', 'effort', 'risks'],
|
|
87
|
+
* additionalProperties: false
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export declare const MIGRATION_PLAN_SCHEMA: Record<string, unknown>;
|
|
92
|
+
/** One breaking change and what it means for this repository. */
|
|
93
|
+
export declare interface BreakingChange {
|
|
94
|
+
description: string
|
|
95
|
+
version?: string
|
|
96
|
+
affectedFiles: string[]
|
|
97
|
+
action: string
|
|
98
|
+
automatable: boolean
|
|
99
|
+
}
|
|
100
|
+
/** The analysis produced before any code is changed. */
|
|
101
|
+
export declare interface MigrationPlan {
|
|
102
|
+
packageName: string
|
|
103
|
+
fromVersion: string
|
|
104
|
+
toVersion: string
|
|
105
|
+
changes: BreakingChange[]
|
|
106
|
+
codemod?: { command: string, source: string }
|
|
107
|
+
confidence: MigrationConfidence
|
|
108
|
+
effort: number
|
|
109
|
+
risks: string[]
|
|
110
|
+
}
|
|
111
|
+
/** How confident the analysis is that a migration will succeed. */
|
|
112
|
+
export type MigrationConfidence = 'high' | 'medium' | 'low';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MigrationPlan } from './plan';
|
|
2
|
+
import type { UsageSite } from './usage';
|
|
3
|
+
/**
|
|
4
|
+
* Render the migration report appended to a major upgrade's pull request.
|
|
5
|
+
*
|
|
6
|
+
* States plainly what was changed, what was verified, and what was left — a
|
|
7
|
+
* report that reads as finished when work remains is worse than no report,
|
|
8
|
+
* because the reviewer stops looking.
|
|
9
|
+
*
|
|
10
|
+
* @param plan - The analysis
|
|
11
|
+
* @param outcome - What the migration did, when it ran
|
|
12
|
+
* @param usage - Where the package is used, for the impact summary
|
|
13
|
+
*/
|
|
14
|
+
export declare function renderMigrationReport(plan: MigrationPlan, outcome?: MigrationOutcome, usage?: UsageSite[]): string;
|
|
15
|
+
/** What the migration actually did, as opposed to what it planned. */
|
|
16
|
+
export declare interface MigrationOutcome {
|
|
17
|
+
applied: boolean
|
|
18
|
+
verified: boolean
|
|
19
|
+
changedFiles: string[]
|
|
20
|
+
verificationOutput?: string
|
|
21
|
+
unresolved: string[]
|
|
22
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collect the release notes that describe a version span.
|
|
3
|
+
*
|
|
4
|
+
* A 5.x → 7.x upgrade is not described by the newest release: the breaking
|
|
5
|
+
* changes live in the 6.0.0 and 7.0.0 notes, which a "latest releases" fetch
|
|
6
|
+
* scrolls straight past. This walks the whole span and keeps the boundaries,
|
|
7
|
+
* because `x.y.0` is where a project documents what it broke and patch
|
|
8
|
+
* releases almost never are.
|
|
9
|
+
*
|
|
10
|
+
* The target release is always kept even if it is a patch, since it is the
|
|
11
|
+
* version actually being adopted.
|
|
12
|
+
*
|
|
13
|
+
* @param releases - Releases newest-first, as the provider returned them
|
|
14
|
+
* @param fromVersion - Version currently installed
|
|
15
|
+
* @param toVersion - Version being upgraded to
|
|
16
|
+
* @param budget - Character budget for the rendered notes
|
|
17
|
+
* @returns The rendered span and an honest account of what it left out
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const span = collectSpanNotes(releases, '5.2.1', '7.0.0')
|
|
21
|
+
* const result = await attemptMajorUpgrade({ ...options, releaseNotes: span.notes })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function collectSpanNotes(releases: SpanRelease[], fromVersion: string, toVersion: string, budget?: number): ReleaseSpan;
|
|
25
|
+
/**
|
|
26
|
+
* Describe what a span left out, for the pull request body.
|
|
27
|
+
*
|
|
28
|
+
* @param span - The collected span
|
|
29
|
+
* @returns A one-line note, or empty when nothing was dropped
|
|
30
|
+
*/
|
|
31
|
+
export declare function describeSpanGaps(span: ReleaseSpan): string;
|
|
32
|
+
/** How much of a release span to spend on prose. */
|
|
33
|
+
export declare const DEFAULT_SPAN_BUDGET: unknown;
|
|
34
|
+
/** One release as the span walker needs it. */
|
|
35
|
+
export declare interface SpanRelease {
|
|
36
|
+
version: string
|
|
37
|
+
body: string
|
|
38
|
+
htmlUrl?: string
|
|
39
|
+
isPrerelease?: boolean
|
|
40
|
+
}
|
|
41
|
+
/** Release notes spanning an upgrade, with what was left out. */
|
|
42
|
+
export declare interface ReleaseSpan {
|
|
43
|
+
notes: string
|
|
44
|
+
included: string[]
|
|
45
|
+
omitted: Array<{ version: string, reason: 'patch-release' | 'budget' }>
|
|
46
|
+
truncated: boolean
|
|
47
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find where a package is used.
|
|
3
|
+
*
|
|
4
|
+
* Matching is done on import and require specifiers rather than free text, so
|
|
5
|
+
* a changelog mentioning a package name in prose does not become a usage site
|
|
6
|
+
* the migration then tries to edit.
|
|
7
|
+
*
|
|
8
|
+
* @param packageName - Package to look for
|
|
9
|
+
* @param files - Repository-relative paths to scan
|
|
10
|
+
* @param root - Repository root
|
|
11
|
+
* @returns Every place the package is referenced
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const sites = await findUsageSites('react', await listSourceFiles(), process.cwd())
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function findUsageSites(packageName: string, files: string[], root: string): Promise<UsageSite[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Group usage sites by file, for presenting an impact summary.
|
|
20
|
+
*
|
|
21
|
+
* @param sites - Usage sites
|
|
22
|
+
*/
|
|
23
|
+
export declare function summarizeUsage(sites: UsageSite[]): Array<{ path: string, count: number }>;
|
|
24
|
+
/** Where a package is used in the repository. */
|
|
25
|
+
export declare interface UsageSite {
|
|
26
|
+
path: string
|
|
27
|
+
line: number
|
|
28
|
+
text: string
|
|
29
|
+
kind: 'import' | 'require' | 'config' | 'mention'
|
|
30
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { AiClient } from '../ai/types';
|
|
2
|
+
import type { BuddyConfig, PackageUpdate } from '../types';
|
|
3
|
+
import type { Logger } from '../utils/logger';
|
|
4
|
+
import type { UpgradeResult } from './migrate';
|
|
5
|
+
/*` and `eslint*` shapes configuration actually uses. Anchored at
|
|
6
|
+
* both ends so `react` does not match `react-dom`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function matchesGlobs(name: string, globs: string[] | undefined): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Analyse the major updates in a group and produce a body section.
|
|
11
|
+
*
|
|
12
|
+
* The ladder is deliberate: with no AI configured this returns nothing and the
|
|
13
|
+
* caller opens exactly the pull request it always did. With AI it adds a
|
|
14
|
+
* per-package migration report and may ask for the PR to open as a draft. It
|
|
15
|
+
* never fails the pull request — an analysis that errored is reported as
|
|
16
|
+
* skipped, because a missing report is a much smaller problem than a blocked
|
|
17
|
+
* dependency update.
|
|
18
|
+
*
|
|
19
|
+
* @param options - Group updates, config, repository context and clients
|
|
20
|
+
* @returns The report, draft decision, and what was skipped
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const outcome = await analyzeGroupMajors({ updates: group.updates, config, ... })
|
|
24
|
+
* const body = appendUpgradeReport(prBody, outcome.report)
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function analyzeGroupMajors(options: GroupUpgradeOptions): Promise<GroupUpgradeOutcome>;
|
|
28
|
+
/**
|
|
29
|
+
* Splice an upgrade report into a pull request body.
|
|
30
|
+
*
|
|
31
|
+
* The report goes after the rendered tables and before the manifest, so the
|
|
32
|
+
* manifest stays the last thing in the body where the parser expects it.
|
|
33
|
+
*
|
|
34
|
+
* @param body - Generated pull request body, manifest included
|
|
35
|
+
* @param report - Report section, empty to leave the body untouched
|
|
36
|
+
* @returns The body with the report inserted
|
|
37
|
+
*/
|
|
38
|
+
export declare function appendUpgradeReport(body: string, report: string): string;
|
|
39
|
+
/** What analysing a group's majors produced. */
|
|
40
|
+
export declare interface GroupUpgradeOutcome {
|
|
41
|
+
report: string
|
|
42
|
+
draft: boolean
|
|
43
|
+
results: Array<{ update: PackageUpdate, result: UpgradeResult }>
|
|
44
|
+
skipped: Array<{ name: string, reason: string }>
|
|
45
|
+
}
|
|
46
|
+
/** Everything the wiring needs to analyse a group. */
|
|
47
|
+
export declare interface GroupUpgradeOptions {
|
|
48
|
+
updates: PackageUpdate[]
|
|
49
|
+
config: BuddyConfig
|
|
50
|
+
workspace: string
|
|
51
|
+
baseBranch: string
|
|
52
|
+
files: string[]
|
|
53
|
+
ai: AiClient | null
|
|
54
|
+
fetchReleases: (name: string, from: string, to: string) => Promise<Array<{
|
|
55
|
+
version: string
|
|
56
|
+
body: string
|
|
57
|
+
htmlUrl?: string
|
|
58
|
+
isPrerelease?: boolean
|
|
59
|
+
}>>
|
|
60
|
+
logger?: Logger
|
|
61
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map over items with a bounded number of concurrent workers, preserving
|
|
3
|
+
* input order in the result.
|
|
4
|
+
*
|
|
5
|
+
* A rejected task rejects the whole call, matching `Promise.all`. Callers that
|
|
6
|
+
* want partial results should resolve to a sentinel inside `worker` rather
|
|
7
|
+
* than throwing.
|
|
8
|
+
*
|
|
9
|
+
* @param items - Values to process
|
|
10
|
+
* @param worker - Async transform, receiving the item and its original index
|
|
11
|
+
* @param concurrency - Maximum tasks in flight (default: {@link DEFAULT_CONCURRENCY})
|
|
12
|
+
* @returns Results in the same order as `items`
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const versions = await mapWithConcurrency(
|
|
16
|
+
* packageNames,
|
|
17
|
+
* name => registry.getLatestVersion(name),
|
|
18
|
+
* 16,
|
|
19
|
+
* )
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function mapWithConcurrency<T, R>(items: readonly T[], worker: (item: T, index: number) => Promise<R>, concurrency?: number): Promise<R[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Split an array into fixed-size chunks.
|
|
25
|
+
*
|
|
26
|
+
* @param items - Values to split
|
|
27
|
+
* @param size - Maximum chunk length; values below 1 are clamped to 1
|
|
28
|
+
* @returns Array of chunks, the last possibly shorter than `size`
|
|
29
|
+
*/
|
|
30
|
+
export declare function chunk<T>(items: readonly T[], size: number): T[][];
|
|
31
|
+
/**
|
|
32
|
+
* Default in-flight request cap.
|
|
33
|
+
*
|
|
34
|
+
* Registry APIs tolerate parallel reads well, but an unbounded fan-out over a
|
|
35
|
+
* few hundred dependencies gets buddy secondary-rate-limited. Eight keeps
|
|
36
|
+
* scans fast without tripping npm or GitHub throttling.
|
|
37
|
+
*/
|
|
38
|
+
export declare const DEFAULT_CONCURRENCY: 8;
|
|
39
|
+
/**
|
|
40
|
+
* Deduplicate concurrent async calls that share a key.
|
|
41
|
+
*
|
|
42
|
+
* Two callers asking for the same package's metadata at the same time should
|
|
43
|
+
* produce one network request, not two. Failed lookups are evicted so a
|
|
44
|
+
* transient error is not cached for the lifetime of the run.
|
|
45
|
+
*/
|
|
46
|
+
export declare class AsyncMemo<T> {
|
|
47
|
+
get(key: string, factory: () => Promise<T>): Promise<T>;
|
|
48
|
+
clear(): void;
|
|
49
|
+
get size(): number;
|
|
50
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PackageFile, PackageUpdate } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Check if a file path is a dependency file that we can handle
|
|
4
|
+
*/
|
|
5
|
+
export declare function isDependencyFile(filePath: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Parse a dependency file using ts-pantry (supports pkgx registry format)
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseDependencyFile(filePath: string, content: string): Promise<PackageFile | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Update dependency file content with new package versions
|
|
12
|
+
*/
|
|
13
|
+
export declare function updateDependencyFile(filePath: string, content: string, updates: PackageUpdate[]): Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Generate file changes for dependency files
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateDependencyFileUpdates(updates: PackageUpdate[]): Promise<Array<{ path: string, content: string, type: 'update' }>>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { DockerRegistryConfig } from '../registry/oci-client';
|
|
2
|
+
import type { PackageFile, PackageUpdate } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Check whether a file path names a container build file.
|
|
5
|
+
*
|
|
6
|
+
* Recognises the three conventions in real use:
|
|
7
|
+
*
|
|
8
|
+
* - `Dockerfile` and any `Dockerfile.<suffix>` variant (`Dockerfile.prod`)
|
|
9
|
+
* - the reversed `<prefix>.dockerfile` form (`api.dockerfile`), which is what
|
|
10
|
+
* monorepos use when several build files share a directory
|
|
11
|
+
* - `Containerfile`, the OCI/Podman spelling
|
|
12
|
+
*
|
|
13
|
+
* Matching is case-insensitive because both `Dockerfile` and `dockerfile`
|
|
14
|
+
* occur in the wild and case-sensitive filesystems keep them distinct.
|
|
15
|
+
*
|
|
16
|
+
* @param filePath - Path to test; only the basename is considered
|
|
17
|
+
* @returns Whether the file should be parsed for base images
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* isDockerfile('Dockerfile') // true
|
|
21
|
+
* isDockerfile('docker/api.dockerfile') // true
|
|
22
|
+
* isDockerfile('deploy/Containerfile') // true
|
|
23
|
+
* isDockerfile('dockerfile.md') // false — documentation, not a build file
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function isDockerfile(filePath: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Parse a Dockerfile to extract image dependencies with versions
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseDockerfile(filePath: string, content: string): Promise<PackageFile | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Fetch the newest tag for a Docker image.
|
|
33
|
+
*
|
|
34
|
+
* Goes through the OCI distribution API rather than Docker Hub's own, so the
|
|
35
|
+
* same code path serves GHCR, Quay, GCR, Artifact Registry and self-hosted
|
|
36
|
+
* registries. Registries that answer anonymously keep working; those that
|
|
37
|
+
* challenge get the standard bearer exchange.
|
|
38
|
+
*
|
|
39
|
+
* @param imageName - Image reference, with or without a registry host
|
|
40
|
+
* @param currentTag - Tag currently in the file, used to preserve its variant
|
|
41
|
+
* and precision
|
|
42
|
+
* @param options - Registry credentials and behaviour
|
|
43
|
+
* @returns The newer tag, or null when there is nothing better
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* await fetchLatestDockerImageVersion('ghcr.io/org/app', '1.2.0')
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function fetchLatestDockerImageVersion(imageName: string, currentTag?: string, options?: { registries?: DockerRegistryConfig, includePrerelease?: boolean }): Promise<string | null>;
|
|
50
|
+
/**
|
|
51
|
+
* Resolve a tag to its digest, for references pinned with `@sha256:…`.
|
|
52
|
+
*
|
|
53
|
+
* Moving the tag without moving the digest would leave the old image running
|
|
54
|
+
* while the file claims otherwise, which is worse than not updating at all.
|
|
55
|
+
*
|
|
56
|
+
* @param imageName - Image reference
|
|
57
|
+
* @param tag - Tag to resolve
|
|
58
|
+
* @param registries - Registry credentials
|
|
59
|
+
* @returns The digest, or null when it cannot be resolved
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolveDockerDigest(imageName: string, tag: string, registries?: DockerRegistryConfig): Promise<string | null>;
|
|
62
|
+
/**
|
|
63
|
+
* Update Dockerfile content with new image versions
|
|
64
|
+
*/
|
|
65
|
+
export declare function updateDockerfile(filePath: string, content: string, updates: PackageUpdate[]): Promise<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Generate file changes for Dockerfiles
|
|
68
|
+
*/
|
|
69
|
+
export declare function generateDockerfileUpdates(updates: PackageUpdate[]): Promise<Array<{ path: string, content: string, type: 'update' }>>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { BuddyConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the GitHub REST API base URL.
|
|
4
|
+
*
|
|
5
|
+
* Precedence is explicit config, then `GITHUB_API_URL` — which GitHub Actions
|
|
6
|
+
* sets automatically on both github.com and GitHub Enterprise Server runners —
|
|
7
|
+
* then the public host. This is what lets buddy run unmodified on GHES.
|
|
8
|
+
*
|
|
9
|
+
* @param config - Optional loaded configuration
|
|
10
|
+
* @returns Base URL with no trailing slash, e.g. `https://github.acme.com/api/v3`
|
|
11
|
+
*/
|
|
12
|
+
export declare function getGitHubApiUrl(config?: BuddyConfig): string;
|
|
13
|
+
/**
|
|
14
|
+
* Resolve the GitHub web base URL, used for links in PR bodies and dashboards.
|
|
15
|
+
*
|
|
16
|
+
* @param config - Optional loaded configuration
|
|
17
|
+
* @returns Base URL with no trailing slash
|
|
18
|
+
*/
|
|
19
|
+
export declare function getGitHubServerUrl(config?: BuddyConfig): string;
|
|
20
|
+
/**
|
|
21
|
+
* Clear the memoized `.npmrc` lookups. Exposed for tests, which write `.npmrc`
|
|
22
|
+
* files into temporary directories between assertions.
|
|
23
|
+
*/
|
|
24
|
+
export declare function clearNpmrcCache(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the npm registry to query for a package.
|
|
27
|
+
*
|
|
28
|
+
* Precedence is explicit config, then `NPM_CONFIG_REGISTRY`, then a
|
|
29
|
+
* scope-specific `.npmrc` entry, then the `.npmrc` default, then the public
|
|
30
|
+
* registry. Scoped lookups matter for private packages: `@acme/ui` may live on
|
|
31
|
+
* a different host than the rest of the tree.
|
|
32
|
+
*
|
|
33
|
+
* @param packageName - Package being resolved, used to match `@scope:registry`
|
|
34
|
+
* @param config - Optional loaded configuration
|
|
35
|
+
* @param cwd - Project directory whose `.npmrc` applies
|
|
36
|
+
* @returns Base URL with no trailing slash
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* getNpmRegistryUrl('@acme/ui', config) // 'https://npm.acme.com'
|
|
40
|
+
* getNpmRegistryUrl('react', config) // 'https://registry.npmjs.org'
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function getNpmRegistryUrl(packageName?: string, config?: BuddyConfig, cwd?: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Resolve the Composer/Packagist base URL.
|
|
46
|
+
*
|
|
47
|
+
* @param config - Optional loaded configuration
|
|
48
|
+
* @returns Base URL with no trailing slash
|
|
49
|
+
*/
|
|
50
|
+
export declare function getComposerRegistryUrl(config?: BuddyConfig): string;
|
|
51
|
+
/** Public GitHub API host, used when nothing else is configured. */
|
|
52
|
+
export declare const DEFAULT_GITHUB_API_URL: 'https://api.github.com';
|
|
53
|
+
/** Public GitHub web host, used for building human-facing links. */
|
|
54
|
+
export declare const DEFAULT_GITHUB_SERVER_URL: 'https://github.com';
|
|
55
|
+
/** Public npm registry host. */
|
|
56
|
+
export declare const DEFAULT_NPM_REGISTRY: 'https://registry.npmjs.org';
|
|
57
|
+
/** Public Packagist host. */
|
|
58
|
+
export declare const DEFAULT_COMPOSER_REGISTRY: 'https://packagist.org';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert an unknown thrown value into a single readable log line.
|
|
3
|
+
*
|
|
4
|
+
* Passing a raw `Error` to `console.error` makes Bun print a source-mapped code
|
|
5
|
+
* frame, which for a bundled CLI dumps the whole minified chunk into CI logs.
|
|
6
|
+
* This keeps the useful part — the message, plus any `cause` — and nothing else.
|
|
7
|
+
*
|
|
8
|
+
* @param error - The caught value, of any type
|
|
9
|
+
* @param maxLength - Truncate the result beyond this many characters
|
|
10
|
+
* @returns A trimmed, single-value description safe to log
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* catch (error) {
|
|
14
|
+
* console.error(`❌ Failed to update issue #${n}: ${formatError(error)}`)
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatError(error: unknown, maxLength?: number): string;
|
|
19
|
+
/**
|
|
20
|
+
* Error raised when the GitHub REST API responds with a non-2xx status.
|
|
21
|
+
*
|
|
22
|
+
* Carries the HTTP status separately from the message so callers can branch on
|
|
23
|
+
* it (for example, treating a 404 as "resource is gone, recreate it") instead
|
|
24
|
+
* of pattern matching on message text.
|
|
25
|
+
*/
|
|
26
|
+
export declare class GitHubApiError extends Error {
|
|
27
|
+
public readonly status: number;
|
|
28
|
+
public readonly method: string;
|
|
29
|
+
public readonly url: string;
|
|
30
|
+
public readonly repository: string;
|
|
31
|
+
public readonly responseBody?: string;
|
|
32
|
+
constructor(message: string, status: number, method: string, url: string, repository: string, responseBody?: string);
|
|
33
|
+
get isNotFound(): boolean;
|
|
34
|
+
get isForbidden(): boolean;
|
|
35
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FileChange } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Convert a user or scanner supplied path into a safe repository-relative path.
|
|
4
|
+
*/
|
|
5
|
+
export declare function normalizeRepositoryPath(filePath: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* An update must modify a file that already exists on the base branch. Treating
|
|
8
|
+
* a missing update target as a create is how generated cache paths can leak
|
|
9
|
+
* into dependency PRs.
|
|
10
|
+
*/
|
|
11
|
+
export declare function assertUpdateTargetsExist(files: FileChange[], targetExists: (path: string) => boolean | Promise<boolean>): Promise<void>;
|
|
12
|
+
export declare class FileChangeValidationError extends Error {
|
|
13
|
+
constructor(message: string);
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PackageFile, PackageUpdate } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Check if a file path is a GitHub Actions workflow file
|
|
4
|
+
*/
|
|
5
|
+
export declare function isGitHubActionsFile(filePath: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Parse a GitHub Actions workflow file to extract action dependencies
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseGitHubActionsFile(filePath: string, content: string): Promise<PackageFile | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Update action versions in a GitHub Actions workflow file
|
|
12
|
+
*/
|
|
13
|
+
export declare function updateGitHubActionsFile(filePath: string, content: string, updates: PackageUpdate[]): Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Generate file changes for GitHub Actions workflow files
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateGitHubActionsUpdates(updates: PackageUpdate[]): Promise<Array<{ path: string, content: string, type: 'update' }>>;
|
|
18
|
+
/**
|
|
19
|
+
* Fetch latest version for a GitHub Action from GitHub API
|
|
20
|
+
*/
|
|
21
|
+
export declare function fetchLatestActionVersion(actionName: string): Promise<string | null>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**'])
|
|
2
|
+
* matcher.matches('src/app.ts') // true
|
|
3
|
+
* matcher.matches('src/generated/api.ts') // false
|
|
4
|
+
* ```
|
|
5
|
+
*/
|
|
6
|
+
export declare function createPathMatcher(patterns?: string[]): PathMatcher;
|
|
7
|
+
/**
|
|
8
|
+
* Find the instructions that apply to a path.
|
|
9
|
+
*
|
|
10
|
+
* All matching entries apply, ordered from least to most specific, so a
|
|
11
|
+
* repository-wide rule and a directory-specific one compose rather than one
|
|
12
|
+
* silently replacing the other.
|
|
13
|
+
*
|
|
14
|
+
* @param path - Repository-relative path
|
|
15
|
+
* @param instructions - Glob-keyed guidance
|
|
16
|
+
* @returns Matching instructions, most specific last
|
|
17
|
+
*/
|
|
18
|
+
export declare function instructionsForPath(path: string, instructions?: Array<{ path: string, instructions: string }>): string[];
|
|
19
|
+
/** A compiled include/exclude pattern set. */
|
|
20
|
+
export declare interface PathMatcher {
|
|
21
|
+
matches: (path: string) => boolean
|
|
22
|
+
}
|