@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,46 @@
|
|
|
1
|
+
import type { Logger } from '../utils/logger';
|
|
2
|
+
/**
|
|
3
|
+
* Load the repository's coding guidelines.
|
|
4
|
+
*
|
|
5
|
+
* **Always read at the base ref, never the head.** Guideline files are trusted
|
|
6
|
+
* input — they are inlined into the review's system prompt — and reading them
|
|
7
|
+
* from the pull request's own branch would let any contributor rewrite the
|
|
8
|
+
* instructions their code is reviewed against. At the base ref they are
|
|
9
|
+
* commit-reviewed content, which is what makes trusting them defensible.
|
|
10
|
+
*
|
|
11
|
+
* @param read - Reader that fetches a path at a given ref
|
|
12
|
+
* @param baseRef - Branch or SHA to read from, never the PR head
|
|
13
|
+
* @param files - Files to look for; defaults to the conventional set
|
|
14
|
+
* @param logger - Logger for diagnostics
|
|
15
|
+
* @returns Concatenated guidelines, empty when none are found
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const guidelines = await loadGuidelines(
|
|
19
|
+
* (path, ref) => provider.getFileContent(path, ref),
|
|
20
|
+
* 'main',
|
|
21
|
+
* )
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function loadGuidelines(read: RefFileReader, baseRef: string, files?: string[] | false, logger?: Logger): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Build the instruction block for a review.
|
|
27
|
+
*
|
|
28
|
+
* @param parts - Global instructions, path-specific instructions and guidelines
|
|
29
|
+
* @returns Combined instructions, empty when there is nothing to say
|
|
30
|
+
*/
|
|
31
|
+
export declare function composeInstructions(parts: {
|
|
32
|
+
global?: string
|
|
33
|
+
pathInstructions?: string[]
|
|
34
|
+
guidelines?: string
|
|
35
|
+
}): string;
|
|
36
|
+
/**
|
|
37
|
+
* Files whose contents describe how this repository expects code to be written.
|
|
38
|
+
*
|
|
39
|
+
* These are the conventional agent-instruction files, so a repository that
|
|
40
|
+
* already tells another tool its conventions does not have to repeat them.
|
|
41
|
+
*/
|
|
42
|
+
export declare const DEFAULT_GUIDELINE_FILES: string[];
|
|
43
|
+
/** Total guideline text handed to the model, before truncation. */
|
|
44
|
+
export declare const MAX_GUIDELINE_CHARS: unknown;
|
|
45
|
+
/** Reads a repository file at a specific ref. */
|
|
46
|
+
export type RefFileReader = (path: string, ref: string) => Promise<string | null>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type { DiffFile, ParsedDiff } from './diff';
|
|
2
|
+
export type { ReviewOptions, ReviewProfile } from './engine';
|
|
3
|
+
export type { FindingSeverity, ReviewFinding, ReviewResult } from './findings';
|
|
4
|
+
export type { ReviewState } from './marker';
|
|
5
|
+
export type { RefFileReader } from './guidelines';
|
|
6
|
+
export type { RunReviewOptions } from './run';
|
|
7
|
+
export type { InlineComment, PreparedReview } from './poster';
|
|
8
|
+
export type { DiffMode, ReviewFormat } from './local';
|
|
9
|
+
export { collectGitDiff, parseUnifiedDiff, renderDiffForReview } from './diff';
|
|
10
|
+
export {
|
|
11
|
+
anchorMap,
|
|
12
|
+
DEFAULT_EXCLUDED_PATHS,
|
|
13
|
+
defaultIncludePath,
|
|
14
|
+
reviewDiff,
|
|
15
|
+
} from './engine';
|
|
16
|
+
export {
|
|
17
|
+
dedupeFindings,
|
|
18
|
+
fingerprint,
|
|
19
|
+
REVIEW_SCHEMA,
|
|
20
|
+
SEVERITY_ORDER,
|
|
21
|
+
validateFindings,
|
|
22
|
+
} from './findings';
|
|
23
|
+
export {
|
|
24
|
+
needsReview,
|
|
25
|
+
parseReviewState,
|
|
26
|
+
REVIEW_STATE_VERSION,
|
|
27
|
+
serializeReviewState,
|
|
28
|
+
} from './marker';
|
|
29
|
+
export {
|
|
30
|
+
composeInstructions,
|
|
31
|
+
DEFAULT_GUIDELINE_FILES,
|
|
32
|
+
loadGuidelines,
|
|
33
|
+
MAX_GUIDELINE_CHARS,
|
|
34
|
+
} from './guidelines';
|
|
35
|
+
export { prepareReview, renderFinding } from './poster';
|
|
36
|
+
export { runReviewForPR } from './run';
|
|
37
|
+
export {
|
|
38
|
+
applySuggestion,
|
|
39
|
+
collectLocalDiff,
|
|
40
|
+
countBySeverity,
|
|
41
|
+
diffArgsFor,
|
|
42
|
+
formatAgent,
|
|
43
|
+
formatGithub,
|
|
44
|
+
formatPretty,
|
|
45
|
+
formatReview,
|
|
46
|
+
REVIEW_FORMATS,
|
|
47
|
+
shouldFail,
|
|
48
|
+
} from './local';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ReviewFinding, ReviewResult } from './findings';
|
|
2
|
+
/**
|
|
3
|
+
* Git arguments producing the diff for a mode.
|
|
4
|
+
*
|
|
5
|
+
* `working` deliberately includes staged changes too (`git diff HEAD`): a
|
|
6
|
+
* pre-commit review that ignored what you just staged would miss the very
|
|
7
|
+
* changes you are about to commit.
|
|
8
|
+
*
|
|
9
|
+
* @param mode - Which changes to collect
|
|
10
|
+
* @param base - Base ref, used by `branch`
|
|
11
|
+
* @returns Arguments to pass to `git`
|
|
12
|
+
*/
|
|
13
|
+
export declare function diffArgsFor(mode: DiffMode, base: string): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Collect a local diff.
|
|
16
|
+
*
|
|
17
|
+
* @param mode - Which changes to review
|
|
18
|
+
* @param base - Base ref for branch mode
|
|
19
|
+
* @param cwd - Repository directory
|
|
20
|
+
* @returns The unified diff, empty when nothing changed
|
|
21
|
+
* @throws {Error} When git fails, with git's own message
|
|
22
|
+
*/
|
|
23
|
+
export declare function collectLocalDiff(mode: DiffMode, base: string, cwd?: string): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Render a review for a terminal.
|
|
26
|
+
*
|
|
27
|
+
* Grouped by file rather than by severity, because that is the order the
|
|
28
|
+
* reader will open them in.
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatPretty(result: ReviewResult): string;
|
|
31
|
+
/**
|
|
32
|
+
* Render a review as GitHub Actions workflow commands.
|
|
33
|
+
*
|
|
34
|
+
* Actions renders these as annotations on the diff, so a local review and a CI
|
|
35
|
+
* review put the comment in the same place.
|
|
36
|
+
*/
|
|
37
|
+
export declare function formatGithub(result: ReviewResult): string;
|
|
38
|
+
/**
|
|
39
|
+
* Render a review as a prompt block for a coding agent.
|
|
40
|
+
*
|
|
41
|
+
* The point is `buddy review --format agent | claude`: the output has to
|
|
42
|
+
* be an instruction, not a report, and it has to carry enough location
|
|
43
|
+
* information for the agent to find each site without re-deriving it.
|
|
44
|
+
*/
|
|
45
|
+
export declare function formatAgent(result: ReviewResult): string;
|
|
46
|
+
/** Count findings per severity, omitting severities with none. */
|
|
47
|
+
export declare function countBySeverity(findings: ReviewFinding[]): Record<string, number>;
|
|
48
|
+
/**
|
|
49
|
+
* Render a review in the requested format.
|
|
50
|
+
*
|
|
51
|
+
* @param result - The review to render
|
|
52
|
+
* @param format - Output format
|
|
53
|
+
* @returns The rendered review
|
|
54
|
+
*/
|
|
55
|
+
export declare function formatReview(result: ReviewResult, format: ReviewFormat): string;
|
|
56
|
+
/**
|
|
57
|
+
* Apply a finding's suggestion to a file in the working tree.
|
|
58
|
+
*
|
|
59
|
+
* Replaces exactly the flagged line. A suggestion spanning several lines is
|
|
60
|
+
* written as several lines at that position, which is what a reviewer applying
|
|
61
|
+
* it by hand would do.
|
|
62
|
+
*
|
|
63
|
+
* @param content - Current file content
|
|
64
|
+
* @param line - 1-based line to replace
|
|
65
|
+
* @param suggestion - Replacement text
|
|
66
|
+
* @returns The new content, or null when the line is out of range
|
|
67
|
+
*/
|
|
68
|
+
export declare function applySuggestion(content: string, line: number, suggestion: string): string | null;
|
|
69
|
+
/**
|
|
70
|
+
* Whether a review's findings should fail a command.
|
|
71
|
+
*
|
|
72
|
+
* @param findings - The review's findings
|
|
73
|
+
* @param threshold - Lowest severity that counts as a failure
|
|
74
|
+
*/
|
|
75
|
+
export declare function shouldFail(findings: ReviewFinding[], threshold?: ReviewFinding['severity']): boolean;
|
|
76
|
+
/** Every format the CLI accepts, for validation and help text. */
|
|
77
|
+
export declare const REVIEW_FORMATS: ReviewFormat[];
|
|
78
|
+
/** Which local changes to review. */
|
|
79
|
+
export type DiffMode = 'working' | 'staged' | 'branch';
|
|
80
|
+
/** How to render a local review. */
|
|
81
|
+
export type ReviewFormat = 'pretty' | 'json' | 'github' | 'agent';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render review state as a hidden comment.
|
|
3
|
+
*
|
|
4
|
+
* Stored on the pull request rather than in a database because the runtime is
|
|
5
|
+
* a CI job with no storage of its own — the PR is the only place state can
|
|
6
|
+
* live that both survives the run and stays visible to maintainers.
|
|
7
|
+
*
|
|
8
|
+
* @param state - State to persist
|
|
9
|
+
*/
|
|
10
|
+
export declare function serializeReviewState(state: Omit<ReviewState, 'schemaVersion'>): string;
|
|
11
|
+
/**
|
|
12
|
+
* Read review state back out of a comment body.
|
|
13
|
+
*
|
|
14
|
+
* @param body - Comment body, possibly null
|
|
15
|
+
* @returns The state, or `null` when absent or unreadable
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseReviewState(body: string | null | undefined): ReviewState | null;
|
|
18
|
+
/**
|
|
19
|
+
* Whether a pull request needs reviewing.
|
|
20
|
+
*
|
|
21
|
+
* @param state - Previous review state, if any
|
|
22
|
+
* @param headSha - Current head commit
|
|
23
|
+
*/
|
|
24
|
+
export declare function needsReview(state: ReviewState | null, headSha: string): boolean;
|
|
25
|
+
/** Schema version emitted by this build. */
|
|
26
|
+
export declare const REVIEW_STATE_VERSION: 1;
|
|
27
|
+
/** Review state carried in a hidden comment on the pull request. */
|
|
28
|
+
export declare interface ReviewState {
|
|
29
|
+
schemaVersion: number
|
|
30
|
+
reviewedSha: string
|
|
31
|
+
fingerprints: string[]
|
|
32
|
+
reviewedAt: string
|
|
33
|
+
paused?: boolean
|
|
34
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ReviewFinding, ReviewResult } from './findings';
|
|
2
|
+
/**
|
|
3
|
+
* Render one finding as an inline comment.
|
|
4
|
+
*
|
|
5
|
+
* A suggestion is emitted as a GitHub suggestion block so a maintainer can
|
|
6
|
+
* commit it from the review thread; findings without a mechanical fix render
|
|
7
|
+
* as prose only, since a half-right suggestion costs more to undo than to
|
|
8
|
+
* write by hand.
|
|
9
|
+
*
|
|
10
|
+
* @param finding - Finding to render
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderFinding(finding: ReviewFinding): string;
|
|
13
|
+
/**
|
|
14
|
+
* Build the summary comment and inline comments for a review.
|
|
15
|
+
*
|
|
16
|
+
* @param result - Review output
|
|
17
|
+
* @param options - Head SHA to record and gating behaviour
|
|
18
|
+
* @returns A review ready to hand to the provider
|
|
19
|
+
*/
|
|
20
|
+
export declare function prepareReview(result: ReviewResult, options: {
|
|
21
|
+
headSha: string
|
|
22
|
+
/** Severity at which to request changes rather than comment */
|
|
23
|
+
requestChangesOn?: 'never' | 'critical'
|
|
24
|
+
/** Fingerprints already reported, carried forward into the new state */
|
|
25
|
+
seenFingerprints?: string[]
|
|
26
|
+
}): PreparedReview;
|
|
27
|
+
/** An inline comment ready for the review API. */
|
|
28
|
+
export declare interface InlineComment {
|
|
29
|
+
path: string
|
|
30
|
+
line: number
|
|
31
|
+
side: 'RIGHT'
|
|
32
|
+
body: string
|
|
33
|
+
}
|
|
34
|
+
/** A complete review, ready to post. */
|
|
35
|
+
export declare interface PreparedReview {
|
|
36
|
+
body: string
|
|
37
|
+
comments: InlineComment[]
|
|
38
|
+
event: 'COMMENT' | 'REQUEST_CHANGES'
|
|
39
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BuddyConfig } from '../types';
|
|
2
|
+
import type { GitProvider } from '../git/provider';
|
|
3
|
+
import type { Logger } from '../utils/logger';
|
|
4
|
+
/**
|
|
5
|
+
* Review a pull request end to end and post the result.
|
|
6
|
+
*
|
|
7
|
+
* Shared by the CLI, the `@buddy review` command and the automatic
|
|
8
|
+
* trigger, so all three assemble context — guidelines, learnings, analyzer
|
|
9
|
+
* findings — the same way rather than drifting apart.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Repository context and review settings
|
|
12
|
+
* @returns A short status line describing what happened
|
|
13
|
+
*/
|
|
14
|
+
export declare function runReviewForPR(options: RunReviewOptions): Promise<string>;
|
|
15
|
+
/** Inputs to a full review of a pull request. */
|
|
16
|
+
export declare interface RunReviewOptions {
|
|
17
|
+
config: BuddyConfig
|
|
18
|
+
provider: GitProvider
|
|
19
|
+
prNumber: number
|
|
20
|
+
full?: boolean
|
|
21
|
+
summaryOnly?: boolean
|
|
22
|
+
skipIfReviewed?: boolean
|
|
23
|
+
logger?: Logger
|
|
24
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { PackageUpdate } from '../types';
|
|
2
|
+
/** Which ecosystem an update belongs to, inferred from its file and type. */
|
|
3
|
+
export declare function ecosystemOf(update: PackageUpdate): RuleEcosystem;
|
|
4
|
+
/**
|
|
5
|
+
* Whether a rule matches an update.
|
|
6
|
+
*
|
|
7
|
+
* Matchers combine with AND, so a rule with several matchers is a
|
|
8
|
+
* conjunction. An absent matcher is not a wildcard match on its own — a rule
|
|
9
|
+
* with no matchers at all matches everything, which is why config validation
|
|
10
|
+
* asks for an explicit `matchPackages: ['*']` rather than accepting silence.
|
|
11
|
+
*
|
|
12
|
+
* @param rule - Rule to test
|
|
13
|
+
* @param update - Update to test against
|
|
14
|
+
* @param now - Instant to evaluate `schedule` against (default: now)
|
|
15
|
+
*/
|
|
16
|
+
export declare function ruleMatches(rule: PackageRule, update: PackageUpdate, now?: Date): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve the effects that apply to an update.
|
|
19
|
+
*
|
|
20
|
+
* Rules are evaluated in order and later matches override earlier ones on a
|
|
21
|
+
* per-field basis, which is what lets a broad rule set a default and a narrow
|
|
22
|
+
* one refine it. List effects accumulate rather than replace, because a
|
|
23
|
+
* package matching both a "security" and a "frontend" rule should carry both
|
|
24
|
+
* labels rather than whichever happened to be last.
|
|
25
|
+
*
|
|
26
|
+
* @param update - Update to resolve
|
|
27
|
+
* @param rules - Rules in configuration order
|
|
28
|
+
* @returns The merged effects
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const effects = resolveRuleEffects(update, config.packages.rules)
|
|
32
|
+
* if (!effects.enabled)
|
|
33
|
+
* return // rule disabled this update
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function resolveRuleEffects(update: PackageUpdate, rules?: PackageRule[], now?: Date): ResolvedEffects;
|
|
37
|
+
/**
|
|
38
|
+
* Drop updates a rule disabled, and retarget those a rule constrains.
|
|
39
|
+
*
|
|
40
|
+
* @param updates - Candidate updates
|
|
41
|
+
* @param rules - Rules in configuration order
|
|
42
|
+
* @returns Updates that survived, each paired with its effects
|
|
43
|
+
*/
|
|
44
|
+
export declare function applyRules(updates: PackageUpdate[], rules?: PackageRule[], now?: Date): Array<{ update: PackageUpdate, effects: ResolvedEffects }>;
|
|
45
|
+
/**
|
|
46
|
+
* Merge the effects of every update in a group into the group's PR metadata.
|
|
47
|
+
*
|
|
48
|
+
* Conflicting effects resolve conservatively: labels and reviewers union, and
|
|
49
|
+
* auto-merge requires every update in the group to allow it. One package that
|
|
50
|
+
* must not merge unattended has to be able to hold back the whole PR that
|
|
51
|
+
* contains it.
|
|
52
|
+
*
|
|
53
|
+
* @param effects - Effects of each update in the group
|
|
54
|
+
*/
|
|
55
|
+
export declare function mergeGroupEffects(effects: ResolvedEffects[]): {
|
|
56
|
+
labels: string[]
|
|
57
|
+
reviewers: string[]
|
|
58
|
+
assignees: string[]
|
|
59
|
+
autoMerge: boolean
|
|
60
|
+
prPriority: number
|
|
61
|
+
autoMigrate: boolean
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Compile legacy `packages.groups` into equivalent rules.
|
|
65
|
+
*
|
|
66
|
+
* Keeps existing configurations working unchanged while giving the engine one
|
|
67
|
+
* code path to reason about, rather than two grouping mechanisms that can
|
|
68
|
+
* disagree.
|
|
69
|
+
*
|
|
70
|
+
* @param groups - Legacy group definitions
|
|
71
|
+
*/
|
|
72
|
+
export declare function groupsToRules(groups?: Array<{ name: string, patterns: string[], strategy?: PackageRule['strategy'] }>): PackageRule[];
|
|
73
|
+
/** A conditional override applied to matching updates. */
|
|
74
|
+
export declare interface PackageRule {
|
|
75
|
+
matchPackages?: string[]
|
|
76
|
+
matchEcosystems?: RuleEcosystem[]
|
|
77
|
+
matchDepTypes?: string[]
|
|
78
|
+
matchUpdateTypes?: Array<'major' | 'minor' | 'patch'>
|
|
79
|
+
matchFiles?: string[]
|
|
80
|
+
matchCurrentVersion?: string
|
|
81
|
+
enabled?: boolean
|
|
82
|
+
strategy?: 'major' | 'minor' | 'patch' | 'all'
|
|
83
|
+
groupName?: string
|
|
84
|
+
labels?: string[]
|
|
85
|
+
reviewers?: string[]
|
|
86
|
+
assignees?: string[]
|
|
87
|
+
autoMerge?: boolean
|
|
88
|
+
minimumReleaseAge?: number
|
|
89
|
+
prPriority?: number
|
|
90
|
+
autoMigrate?: boolean
|
|
91
|
+
schedule?: string
|
|
92
|
+
scheduleTimezone?: string
|
|
93
|
+
}
|
|
94
|
+
/** The effects that survived rule evaluation for one update. */
|
|
95
|
+
export declare interface ResolvedEffects {
|
|
96
|
+
enabled: boolean
|
|
97
|
+
strategy?: PackageRule['strategy']
|
|
98
|
+
groupName?: string
|
|
99
|
+
labels: string[]
|
|
100
|
+
reviewers: string[]
|
|
101
|
+
assignees: string[]
|
|
102
|
+
autoMerge?: boolean
|
|
103
|
+
minimumReleaseAge?: number
|
|
104
|
+
prPriority: number
|
|
105
|
+
autoMigrate?: boolean
|
|
106
|
+
}
|
|
107
|
+
/** Ecosystems a rule can match on. */
|
|
108
|
+
export type RuleEcosystem = 'npm' | 'composer' | 'github-actions' | 'docker' | 'pkgx' | 'zig' | 'python' | 'rust' | 'go' | 'ruby';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { PackageRule } from './engine';
|
|
2
|
+
/**
|
|
3
|
+
* Convert Renovate `packageRules` into buddy `packages.rules`.
|
|
4
|
+
*
|
|
5
|
+
* The mapping is deliberately conservative: a Renovate feature with no
|
|
6
|
+
* equivalent is listed in `incompatible` rather than approximated, and a
|
|
7
|
+
* matcher that converts only loosely produces a warning. A migration that
|
|
8
|
+
* quietly changes which packages a rule governs is worse than one that says
|
|
9
|
+
* what it could not carry over.
|
|
10
|
+
*
|
|
11
|
+
* @param packageRules - The `packageRules` array from a Renovate config
|
|
12
|
+
* @returns Converted rules alongside what did not survive the conversion
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const { rules, incompatible } = convertRenovateRules(renovate.packageRules)
|
|
16
|
+
* config.packages.rules = rules
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function convertRenovateRules(packageRules: unknown): RenovateConversion;
|
|
20
|
+
/** What converting a Renovate `packageRules` array produced. */
|
|
21
|
+
export declare interface RenovateConversion {
|
|
22
|
+
rules: PackageRule[]
|
|
23
|
+
incompatible: string[]
|
|
24
|
+
warnings: string[]
|
|
25
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a cron expression into the window it describes.
|
|
3
|
+
*
|
|
4
|
+
* The minute field is parsed for validity and then discarded: a buddy run
|
|
5
|
+
* is not instantaneous, and a rule that only applied during the exact minute a
|
|
6
|
+
* cron would fire would be a coin toss rather than a schedule.
|
|
7
|
+
*
|
|
8
|
+
* @param cron - A 5-field cron expression
|
|
9
|
+
* @returns The window, or null when the expression is malformed
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseCronWindow(cron: string): CronWindow | null;
|
|
12
|
+
/**
|
|
13
|
+
* Whether an instant falls inside a schedule's window.
|
|
14
|
+
*
|
|
15
|
+
* A rule's `schedule` says *when its updates may be proposed*, not when a run
|
|
16
|
+
* happens — the run's own cron decides that. So "weekend-only majors"
|
|
17
|
+
* (`0 0 * * 6,0`) holds majors back on a Tuesday run and lets them through on
|
|
18
|
+
* a Saturday one, regardless of what time either run started.
|
|
19
|
+
*
|
|
20
|
+
* Standard cron semantics apply to the day fields: when both day-of-month and
|
|
21
|
+
* day-of-week are restricted, either matching is enough.
|
|
22
|
+
*
|
|
23
|
+
* A malformed expression matches nothing. Silently treating a typo as "always"
|
|
24
|
+
* would mean a schedule the user believed was holding updates back was doing
|
|
25
|
+
* nothing at all.
|
|
26
|
+
*
|
|
27
|
+
* @param cron - A 5-field cron expression
|
|
28
|
+
* @param now - Instant to test (default: current time)
|
|
29
|
+
* @param timezone - IANA zone the expression is written in (default: local)
|
|
30
|
+
* @returns Whether updates governed by this schedule may be proposed now
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* if (!matchesSchedule('0 0 * * 6,0', new Date()))
|
|
34
|
+
* return // outside the weekend window
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function matchesSchedule(cron: string, now?: Date, timezone?: string): boolean;
|
|
38
|
+
/** The fields of a cron expression that describe a window. */
|
|
39
|
+
declare interface CronWindow {
|
|
40
|
+
hours: Set<number>
|
|
41
|
+
daysOfMonth: Set<number>
|
|
42
|
+
months: Set<number>
|
|
43
|
+
daysOfWeek: Set<number>
|
|
44
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CatalogEntry } from './workspace-catalog';
|
|
2
|
+
import type { Logger } from '../utils/logger';
|
|
3
|
+
import type { PackageUpdate } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Scan a workspace's catalogs for updates.
|
|
6
|
+
*
|
|
7
|
+
* Catalogs are where the version lives in a workspace that uses them — every
|
|
8
|
+
* `package.json` says `catalog:`, so updating those files would write the
|
|
9
|
+
* protocol string over itself and change nothing at all. This is the only
|
|
10
|
+
* place an update can land.
|
|
11
|
+
*
|
|
12
|
+
* @param dir - Repository root
|
|
13
|
+
* @param resolveLatest - Looks a package's newest version up
|
|
14
|
+
* @param options - Ignore list and logger
|
|
15
|
+
* @returns Updates against the workspace file
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const { updates } = await scanCatalogs(root, name => registry.getLatest(name))
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function scanCatalogs(dir: string, resolveLatest: (name: string) => Promise<string | null>, options?: { ignore?: string[], logger?: Logger }): Promise<CatalogScanResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Write catalog updates into the workspace file.
|
|
24
|
+
*
|
|
25
|
+
* @param content - Current file content
|
|
26
|
+
* @param updates - Catalog updates to apply
|
|
27
|
+
* @returns The updated content
|
|
28
|
+
*/
|
|
29
|
+
export declare function applyCatalogUpdates(content: string, updates: PackageUpdate[]): string;
|
|
30
|
+
/** Where pnpm workspace catalogs live. */
|
|
31
|
+
export declare const WORKSPACE_FILE: 'pnpm-workspace.yaml';
|
|
32
|
+
/** Alternative spelling pnpm also accepts. */
|
|
33
|
+
export declare const WORKSPACE_FILE_ALT: 'pnpm-workspace.yml';
|
|
34
|
+
/** What a catalog scan found. */
|
|
35
|
+
export declare interface CatalogScanResult {
|
|
36
|
+
updates: PackageUpdate[]
|
|
37
|
+
entries: CatalogEntry[]
|
|
38
|
+
file?: string
|
|
39
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { Dependency } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Extract `engines` as dependencies.
|
|
4
|
+
*
|
|
5
|
+
* An engine constraint is a dependency in every way that matters — it pins
|
|
6
|
+
* what the project runs on, it goes stale, and a security release in Node is
|
|
7
|
+
* exactly as worth knowing about as one in a library. It is separated from
|
|
8
|
+
* ordinary dependencies only because bumping it is a deployment decision, so
|
|
9
|
+
* it is reported with its own dependency type and left off by default.
|
|
10
|
+
*
|
|
11
|
+
* @param engines - The `engines` object from a package.json
|
|
12
|
+
* @param file - Manifest path, for attribution
|
|
13
|
+
* @returns Dependencies, one per known engine
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* extractEngines({ node: '>=20' }, 'package.json')
|
|
17
|
+
* // [{ name: 'node', currentVersion: '>=20', type: 'engines', … }]
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function extractEngines(engines: unknown, file: string): Dependency[];
|
|
21
|
+
/**
|
|
22
|
+
* Collect the versions `overrides` and `resolutions` pin.
|
|
23
|
+
*
|
|
24
|
+
* A package pinned by an override cannot be updated by editing the dependency
|
|
25
|
+
* that declares it: the override wins at install time regardless. Proposing
|
|
26
|
+
* one anyway produces a pull request that changes `package.json`, passes CI,
|
|
27
|
+
* merges, and installs exactly the same tree as before — which is worse than
|
|
28
|
+
* no pull request, because it looks like progress.
|
|
29
|
+
*
|
|
30
|
+
* Nested override objects are walked, since npm allows an override to apply
|
|
31
|
+
* only under a particular parent.
|
|
32
|
+
*
|
|
33
|
+
* @param packageData - Parsed package.json
|
|
34
|
+
* @returns Every pin found, with the field it came from
|
|
35
|
+
*/
|
|
36
|
+
export declare function collectResolutionPins(packageData: unknown): ResolutionPin[];
|
|
37
|
+
/**
|
|
38
|
+
* Whether a pin holds a package at a version an update would not reach.
|
|
39
|
+
*
|
|
40
|
+
* An override naming a range that already admits the new version is not
|
|
41
|
+
* holding anything back — only an exact pin, or one that excludes it, is.
|
|
42
|
+
*
|
|
43
|
+
* @param pin - The pin to test
|
|
44
|
+
* @param newVersion - Version an update would propose
|
|
45
|
+
* @returns Whether the pin would defeat the update
|
|
46
|
+
*/
|
|
47
|
+
export declare function pinBlocksUpdate(pin: ResolutionPin, newVersion: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Resolve the newest version of a known engine.
|
|
50
|
+
*
|
|
51
|
+
* npm-published runtimes are looked up on the registry; Node and Deno publish
|
|
52
|
+
* releases on GitHub instead. Both are behind injected lookups so the caller
|
|
53
|
+
* reuses whatever clients and caching it already has.
|
|
54
|
+
*
|
|
55
|
+
* @param engine - Engine name, as it appears under `engines`
|
|
56
|
+
* @param lookups - Registry and release lookups
|
|
57
|
+
* @returns The newest version, or null when it cannot be resolved
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveEngineVersion(engine: string, lookups: {
|
|
60
|
+
npm: (name: string) => Promise<string | null>
|
|
61
|
+
github: (repo: string) => Promise<string | null>
|
|
62
|
+
}): Promise<string | null>;
|
|
63
|
+
/**
|
|
64
|
+
* Propose a new engine constraint, preserving its shape.
|
|
65
|
+
*
|
|
66
|
+
* An engine constraint is usually a floor (`>=20`), and rewriting it to an
|
|
67
|
+
* exact version would turn "runs on 20 or newer" into "runs only on 20.11.1" —
|
|
68
|
+
* which breaks every contributor on a different patch release. The operator
|
|
69
|
+
* and the precision are both carried across.
|
|
70
|
+
*
|
|
71
|
+
* @param constraint - The declared constraint
|
|
72
|
+
* @param latest - Newest available version
|
|
73
|
+
* @returns The new constraint, or null when it already admits `latest`
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* bumpEngineConstraint('>=20', '22.3.0') // '>=22'
|
|
77
|
+
* bumpEngineConstraint('>=20', '20.11.1') // null — already satisfied
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function bumpEngineConstraint(constraint: string, latest: string): string | null;
|
|
81
|
+
/**
|
|
82
|
+
* Runtimes buddy knows how to resolve a version for.
|
|
83
|
+
* @defaultValue
|
|
84
|
+
* ```ts
|
|
85
|
+
* {
|
|
86
|
+
* node: { registry: 'github', source: 'nodejs/node' },
|
|
87
|
+
* bun: { registry: 'npm', source: 'bun' },
|
|
88
|
+
* npm: { registry: 'npm', source: 'npm' },
|
|
89
|
+
* pnpm: { registry: 'npm', source: 'pnpm' },
|
|
90
|
+
* yarn: { registry: 'npm', source: 'yarn' },
|
|
91
|
+
* deno: { registry: 'github', source: 'denoland/deno' }
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare const KNOWN_ENGINES: Record<string, { registry: 'npm' | 'github', source: string }>;
|
|
96
|
+
/** A version another field pins, and where the pin came from. */
|
|
97
|
+
export declare interface ResolutionPin {
|
|
98
|
+
name: string
|
|
99
|
+
version: string
|
|
100
|
+
field: string
|
|
101
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { parseGitHubActionsFile } from '../utils/github-actions-parser';
|
|
2
|
+
import { parsePantryLockFile } from '../utils/pantry-parser';
|
|
3
|
+
import type { Dependency, Logger, PackageFile } from '../types';
|
|
4
|
+
export declare class PackageScanner {
|
|
5
|
+
constructor(projectPath: string, logger: Logger, ignorePaths?: string[]);
|
|
6
|
+
scanProject(): Promise<PackageFile[]>;
|
|
7
|
+
parsePackageJsonFile(filePath: string): Promise<PackageFile | null>;
|
|
8
|
+
parseLockFile(filePath: string): Promise<PackageFile | null>;
|
|
9
|
+
parseDependencyFile(filePath: string): Promise<PackageFile | null>;
|
|
10
|
+
parseGitHubActionsFile(filePath: string): Promise<PackageFile | null>;
|
|
11
|
+
parseDockerfile(filePath: string): Promise<PackageFile | null>;
|
|
12
|
+
parseZigManifestFile(filePath: string): Promise<PackageFile | null>;
|
|
13
|
+
parseComposerFile(filePath: string): Promise<PackageFile | null>;
|
|
14
|
+
parsePantryLockFile(filePath: string): Promise<PackageFile | null>;
|
|
15
|
+
getDependencyCount(): Promise<number>;
|
|
16
|
+
getUniqueDependencies(): Promise<Dependency[]>;
|
|
17
|
+
}
|