@dependfix/engine 0.5.0 → 0.6.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/dist/chunks/auth.mjs +5 -10
- package/dist/chunks/auth.mjs.map +1 -1
- package/dist/chunks/index.d.mts +0 -8
- package/dist/index.d.mts +92 -130
- package/dist/index.mjs +1179 -650
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { c as FromAppParams, l as FromPatParams, o as AuthProvider, s as AuthProviderOptions } from "./chunks/index.mjs";
|
|
2
2
|
import { Octokit } from "@octokit/rest";
|
|
3
|
-
import { AlertClass, AlertSeverity, AlertSourceKind, AlertsDisabledRecord, AppError, CheckAttribution, CheckConclusion, CiAlignmentRecord, CiAlignmentStatus, CiDefaultBranchHealth, CiMirrorSkipped, CiWorkflowEvidence, FixAction, FixError, Logger, NormalizedSecurityAlert, PrCheckFailureSummary, PrCheckWatchReport, PrCheckWatchState, RepeatedAttemptRecord, RepositoryResult, RunResult, RunSummary, SeverityThreshold, VerifyCommandCategory, createEmptyRunSummary } from "@dependfix/core";
|
|
3
|
+
import { AlertClass, AlertFixOutcome, AlertSeverity, AlertSourceKind, AlertsDisabledRecord, AppError, BaselineRedDelivery, CheckAttribution, CheckConclusion, CiAlignmentRecord, CiAlignmentStatus, CiDefaultBranchHealth, CiMirrorSkipped, CiWorkflowEvidence, DeliverySkipRecord, FixAction, FixError, Logger, NormalizedSecurityAlert, PrCheckFailureSummary, PrCheckWatchReport, PrCheckWatchState, RepeatedAttemptRecord, RepositoryResult, RunResult, RunSummary, SeverityThreshold, VerifyCommandCategory, createEmptyRunSummary } from "@dependfix/core";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
//#region src/github/client.d.ts
|
|
6
5
|
export interface RetryPolicyOptions {
|
|
7
6
|
/** 最大重试次数(默认 3;0 = 不重试) */
|
|
8
7
|
maxRetries?: number;
|
|
@@ -100,8 +99,6 @@ export declare function createGitHubClient(options: OctokitClientOptions): Octok
|
|
|
100
99
|
* - 其他状态码
|
|
101
100
|
*/
|
|
102
101
|
export declare function computeRetryDelayMs(error: unknown, attempt: number, baseDelayMs?: number, maxBackoffMs?: number): number | null;
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region src/github/fix-fingerprint.d.ts
|
|
105
102
|
/** 修复策略(尝试键的策略维度;策略变化即视为不同尝试)。 */
|
|
106
103
|
export type PlanStrategy = 'direct-upgrade' | 'override' | 'member-upgrade' | 'family-lockstep';
|
|
107
104
|
/** 尝试键输入。 */
|
|
@@ -166,8 +163,6 @@ export declare function parseAttemptMarkers(body: string | null | undefined): At
|
|
|
166
163
|
* - 同键去重取最大序号(多仓 / 同包多 GHSA 会产出重复键)
|
|
167
164
|
*/
|
|
168
165
|
export declare function collectAttemptMarkers(records: readonly RepeatedAttemptRecord[], executed?: ReadonlyArray<Pick<FixAction, 'type' | 'repository' | 'target' | 'noOp'>>): AttemptMarker[];
|
|
169
|
-
//#endregion
|
|
170
|
-
//#region src/github/attempt-history.d.ts
|
|
171
166
|
/** 默认查询条数(设计稿 §6.2:最近 50 条关闭 PR)。 */
|
|
172
167
|
export declare const CLOSED_ATTEMPT_QUERY_LIMIT = 50;
|
|
173
168
|
/** 一条已关闭的 dependfix PR(仅保留尝试计数所需字段)。 */
|
|
@@ -202,8 +197,6 @@ export declare class ClosedAttemptIndex {
|
|
|
202
197
|
closedAttemptCount(octokit: Octokit, owner: string, repo: string, key: string): Promise<number>;
|
|
203
198
|
private load;
|
|
204
199
|
}
|
|
205
|
-
//#endregion
|
|
206
|
-
//#region src/github/ci-alignment.d.ts
|
|
207
200
|
/** 单次解析的文件数上限(防超大仓库 / 恶意仓库拖慢运行)。 */
|
|
208
201
|
export declare const MAX_WORKFLOW_FILES = 20;
|
|
209
202
|
/** 单文件字节上限(超出按「未能读取」降级,不解析半截 YAML)。 */
|
|
@@ -377,8 +370,6 @@ export interface CiAlignmentInput {
|
|
|
377
370
|
* `healthUnavailableReason`,调用方据此记录但不得阻断修复与交付。
|
|
378
371
|
*/
|
|
379
372
|
export declare function buildCiAlignmentRecord(input: CiAlignmentInput): Promise<CiAlignmentRecord>;
|
|
380
|
-
//#endregion
|
|
381
|
-
//#region src/github/code-quality-fetcher.d.ts
|
|
382
373
|
export interface FetchCodeQualityFindingsParams {
|
|
383
374
|
/** 仓库所属组织或用户 */
|
|
384
375
|
owner: string;
|
|
@@ -419,8 +410,6 @@ export declare function fetchCodeQualityFindings(client: Octokit, params: FetchC
|
|
|
419
410
|
* 映射口径与 `mapCodeScanningSeverity` 对齐(避免新源不一致)。
|
|
420
411
|
*/
|
|
421
412
|
export declare function mapCodeQualitySeverity(severity: string | null | undefined): AlertSeverity;
|
|
422
|
-
//#endregion
|
|
423
|
-
//#region src/github/code-scanning-fetcher.d.ts
|
|
424
413
|
export interface FetchCodeScanningAlertsParams {
|
|
425
414
|
/** 仓库所属组织或用户 */
|
|
426
415
|
owner: string;
|
|
@@ -451,8 +440,6 @@ export interface FetchCodeScanningAlertsParams {
|
|
|
451
440
|
* @returns 标准化告警列表
|
|
452
441
|
*/
|
|
453
442
|
export declare function fetchCodeScanningAlerts(client: Octokit, params: FetchCodeScanningAlertsParams): Promise<NormalizedSecurityAlert[]>;
|
|
454
|
-
//#endregion
|
|
455
|
-
//#region src/github/commit-scope.d.ts
|
|
456
443
|
/** 提交集合判定失败的两类信号(写入 `FixError.category`)。 */
|
|
457
444
|
export type CommitScopeErrorCode = 'UNEXPECTED_CHANGES' | 'NO_CHANGES';
|
|
458
445
|
export declare class CommitScopeError extends Error {
|
|
@@ -523,7 +510,7 @@ export declare function normalizeCommitPath(raw: string): {
|
|
|
523
510
|
* - `--no-renames`:重命名拆成「删除 + 新增」,删除因此不会绕过未声明检测
|
|
524
511
|
* - 输出路径相对**仓库根**:按 `--show-prefix` 折算为 workDir 相对路径(workDir 可为子目录)
|
|
525
512
|
*/
|
|
526
|
-
export declare function listChangedPaths(workDir: string): ChangedPath[]
|
|
513
|
+
export declare function listChangedPaths(workDir: string): Promise<ChangedPath[]>;
|
|
527
514
|
/** 从修复动作收集声明路径(仅成功且非 noOp 的动作)。 */
|
|
528
515
|
export declare function collectDeclaredPaths(actions: readonly FixAction[]): string[];
|
|
529
516
|
/** `stageAndCommit` 的可选声明路径。 */
|
|
@@ -547,7 +534,7 @@ export interface StageAndCommitResult {
|
|
|
547
534
|
* 索引区越界暂存内容(`UNEXPECTED_CHANGES`)。暂存用 `git add -- <paths>`(分批;`--` 阻断选项解析,
|
|
548
535
|
* 每条路径加 `:(literal)` 终止通配,文件名含 `*` / `?` / `[` 时也只暂存字面路径)。
|
|
549
536
|
*/
|
|
550
|
-
export declare function stageScopedChanges(workDir: string, declaredPaths?: readonly string[]): StageAndCommitResult
|
|
537
|
+
export declare function stageScopedChanges(workDir: string, declaredPaths?: readonly string[]): Promise<StageAndCommitResult>;
|
|
551
538
|
/**
|
|
552
539
|
* 提交已暂存内容(不动提交集合)。
|
|
553
540
|
*
|
|
@@ -557,13 +544,11 @@ export declare function stageScopedChanges(workDir: string, declaredPaths?: read
|
|
|
557
544
|
export declare function commitStaged(message: string, workDir: string, author: {
|
|
558
545
|
name: string;
|
|
559
546
|
email: string;
|
|
560
|
-
}): void
|
|
547
|
+
}): Promise<void>;
|
|
561
548
|
/** 判定本次提交集合(不写盘、不暂存)。 */
|
|
562
|
-
export declare function computeCommitScope(workDir: string, declaredPaths?: readonly string[]): CommitScope
|
|
549
|
+
export declare function computeCommitScope(workDir: string, declaredPaths?: readonly string[]): Promise<CommitScope>;
|
|
563
550
|
/** 按固定大小切分路径(`git add` 的 argv 上限防护)。 */
|
|
564
551
|
export declare function chunkPaths(paths: readonly string[], size?: number): string[][];
|
|
565
|
-
//#endregion
|
|
566
|
-
//#region src/github/dependabot-fetcher.d.ts
|
|
567
552
|
export interface FetchDependabotAlertsParams {
|
|
568
553
|
/** 仓库所属组织或用户 */
|
|
569
554
|
owner: string;
|
|
@@ -601,8 +586,6 @@ export interface FetchDependabotAlertsParams {
|
|
|
601
586
|
* ```
|
|
602
587
|
*/
|
|
603
588
|
export declare function fetchDependabotAlerts(client: Octokit, params: FetchDependabotAlertsParams): Promise<NormalizedSecurityAlert[]>;
|
|
604
|
-
//#endregion
|
|
605
|
-
//#region src/github/errors.d.ts
|
|
606
589
|
/**
|
|
607
590
|
* 将 Octokit 请求错误映射为 `AppError`。
|
|
608
591
|
*
|
|
@@ -610,8 +593,6 @@ export declare function fetchDependabotAlerts(client: Octokit, params: FetchDepe
|
|
|
610
593
|
* @param context - 调用上下文描述(如 `'fetch repo info for foo/bar'`),会附加到错误消息中
|
|
611
594
|
*/
|
|
612
595
|
export declare function mapGitHubError(error: unknown, context: string): AppError;
|
|
613
|
-
//#endregion
|
|
614
|
-
//#region src/github/git-signing.d.ts
|
|
615
596
|
/**
|
|
616
597
|
* git 执行语义隔离参数(单一事实源,engine 与平台侧共用)。
|
|
617
598
|
*
|
|
@@ -659,8 +640,6 @@ export declare const GIT_PUSH_SIGNING_ISOLATION_ARGS: readonly ["-c", "push.gpgS
|
|
|
659
640
|
* `core.hooksPath` 重定向场景等效。
|
|
660
641
|
*/
|
|
661
642
|
export declare const GIT_PUSH_HOOKS_ISOLATION_ARGS: readonly ["--no-verify"];
|
|
662
|
-
//#endregion
|
|
663
|
-
//#region src/github/pr-check-watch.d.ts
|
|
664
643
|
/** 首次轮询间隔。 */
|
|
665
644
|
export declare const PR_CHECK_POLL_INITIAL_MS = 15000;
|
|
666
645
|
/** 轮询间隔退避上限。 */
|
|
@@ -681,12 +660,20 @@ export declare const FAILED_CHECK_SUMMARY_LIMIT = 5;
|
|
|
681
660
|
export declare const PR_CHECK_MAX_POLLS = 200;
|
|
682
661
|
/** 归一化观测到的一条 check(check run 或 commit status)。 */
|
|
683
662
|
export interface ObservedCheck {
|
|
663
|
+
/** 来源:check run / commit status(同名多轮组键的一部分) */
|
|
664
|
+
kind: 'check' | 'status';
|
|
665
|
+
/** provider 归因(check `app.slug` / status `context` 前缀;与平台同源) */
|
|
666
|
+
provider: string;
|
|
684
667
|
name: string;
|
|
685
668
|
conclusion: CheckConclusion;
|
|
686
|
-
/** 详情页 URL */
|
|
669
|
+
/** 详情页 URL(check 用它提取 Actions run id 作为重跑血缘) */
|
|
687
670
|
url?: string;
|
|
688
671
|
/** 失败详情文本(用于 external_noise 文本签名) */
|
|
689
672
|
detail?: string;
|
|
673
|
+
/** 源侧 id(同名多轮收敛的确定性兜底,见 {@link dedupeObservedChecksByLatestRound}) */
|
|
674
|
+
id?: string | null;
|
|
675
|
+
/** 轮次时间戳(check `started_at ?? completed_at` / status `updated_at ?? created_at`) */
|
|
676
|
+
roundAt?: string | null;
|
|
690
677
|
}
|
|
691
678
|
export interface WatchPrChecksParams {
|
|
692
679
|
octokit: Octokit;
|
|
@@ -762,15 +749,28 @@ interface TerminalEvaluation {
|
|
|
762
749
|
attribution?: CheckAttribution;
|
|
763
750
|
failedChecks?: PrCheckFailureSummary[];
|
|
764
751
|
}
|
|
752
|
+
/**
|
|
753
|
+
* 同名多轮收敛:同一「组键」只保留**最新一轮**(与平台 `dedupeSignalsByLatestRound` 同源,
|
|
754
|
+
* 组键与排序均由 `@dependfix/core` 的 `checkRoundKey` / `dedupeByLatestRound` 提供)。
|
|
755
|
+
*
|
|
756
|
+
* 触发场景:check run re-run(同一 workflow run 的同名新尝试)、同一 commit status context 的后发状态。
|
|
757
|
+
* 组键含 `kind` / `provider`:check run 与 commit status 同名、或同名 job 由不同 App 上报时**不合并**;
|
|
758
|
+
* check 还要求能证明同一条 workflow run(`details_url` 里的 run id),否则各自成组——
|
|
759
|
+
* 「push 触发」与「pull_request 触发」是同名不同 run,合并会掩蔽另一方的失败。
|
|
760
|
+
* 口径见 docs/design/governance/pr-build-deploy-signals.md §3.10。
|
|
761
|
+
*/
|
|
762
|
+
export declare function dedupeObservedChecksByLatestRound(checks: readonly ObservedCheck[]): ObservedCheck[];
|
|
765
763
|
/**
|
|
766
764
|
* 判定终态;未到终态返回 `undefined`(继续轮询)。
|
|
767
765
|
*
|
|
768
766
|
* 终态条件:已观测到至少一条 check,且全部 check 已完成(无 `pending`)。
|
|
767
|
+
* `completed + conclusion=null` 归一为 `unknown` 结论(`isFailedConclusion` 判失败,fail-closed),
|
|
768
|
+
* 与平台侧 `resolveCheckRunState` 同口径(docs/design/governance/pr-build-deploy-signals.md §3.10)。
|
|
769
769
|
* - 存在失败 → `failed`(逐条归因后聚合;混合归因 → `unknown`)
|
|
770
770
|
* - 无失败且有成功 → `passed`
|
|
771
771
|
* - 无失败且无成功(全是 cancelled / skipped / neutral)→ `cancelled`
|
|
772
772
|
*/
|
|
773
|
-
export declare function evaluateCheckTerminal(params: WatchPrChecksParams,
|
|
773
|
+
export declare function evaluateCheckTerminal(params: WatchPrChecksParams, observedChecks: readonly ObservedCheck[]): Promise<TerminalEvaluation | undefined>;
|
|
774
774
|
/** 构造失败评论正文(job 名 + URL + 归因 + 尝试标记)。 */
|
|
775
775
|
export declare function buildCheckFailureComment(params: {
|
|
776
776
|
prNumber: number;
|
|
@@ -787,8 +787,6 @@ export declare function buildCheckFailureComment(params: {
|
|
|
787
787
|
* 任何 API / 评论 / 关闭失败都只降级记录,不抛错(调用方不因等待失败改变运行结论)。
|
|
788
788
|
*/
|
|
789
789
|
export declare function watchPullRequestChecks(params: WatchPrChecksParams): Promise<WatchPrChecksResult>;
|
|
790
|
-
//#endregion
|
|
791
|
-
//#region src/github/pr-creator.d.ts
|
|
792
790
|
export interface CreatePullRequestParams {
|
|
793
791
|
/** 已认证的 Octokit 实例 */
|
|
794
792
|
octokit: Octokit;
|
|
@@ -804,6 +802,13 @@ export interface CreatePullRequestParams {
|
|
|
804
802
|
title: string;
|
|
805
803
|
/** PR 内容(Markdown) */
|
|
806
804
|
body: string;
|
|
805
|
+
/**
|
|
806
|
+
* 创建为草稿 PR(基线红的交付降级 `draft` 档使用)。
|
|
807
|
+
*
|
|
808
|
+
* 草稿态让目标仓库 CI 仍会按既有失败为红,但不会触发人工 review 队列;
|
|
809
|
+
* 缺省 / `false` 时请求体不带 `draft`,与既有行为逐字一致。
|
|
810
|
+
*/
|
|
811
|
+
draft?: boolean;
|
|
807
812
|
}
|
|
808
813
|
export interface PullRequestResult {
|
|
809
814
|
/** PR 编号 */
|
|
@@ -875,7 +880,7 @@ export declare function computeFixAndPrPlan(existingPRs: DependfixOpenPR[], fing
|
|
|
875
880
|
*
|
|
876
881
|
* @returns 分支名和是否为新创建
|
|
877
882
|
*/
|
|
878
|
-
export declare function createFixBranch(branchName: string, workDir: string): FixBranchResult
|
|
883
|
+
export declare function createFixBranch(branchName: string, workDir: string): Promise<FixBranchResult>;
|
|
879
884
|
/**
|
|
880
885
|
* 暂存修复相关文件并提交。
|
|
881
886
|
*
|
|
@@ -891,7 +896,7 @@ export declare function createFixBranch(branchName: string, workDir: string): Fi
|
|
|
891
896
|
export declare function stageAndCommit(message: string, workDir: string, author?: {
|
|
892
897
|
name: string;
|
|
893
898
|
email: string;
|
|
894
|
-
}, options?: StageAndCommitOptions): StageAndCommitResult
|
|
899
|
+
}, options?: StageAndCommitOptions): Promise<StageAndCommitResult>;
|
|
895
900
|
/**
|
|
896
901
|
* 推送分支到 origin。
|
|
897
902
|
*
|
|
@@ -901,7 +906,7 @@ export declare function stageAndCommit(message: string, workDir: string, author?
|
|
|
901
906
|
* - **hooks**:`push --no-verify` 跳过被修复仓库的 `pre-push`(隔离环境无 `npx` / 目标仓库
|
|
902
907
|
* `node_modules` 不完整时该 hook 会以非 0 退出,把交付链打断为 `push_failed`)
|
|
903
908
|
*/
|
|
904
|
-
export declare function pushBranch(branchName: string, workDir: string): void
|
|
909
|
+
export declare function pushBranch(branchName: string, workDir: string): Promise<void>;
|
|
905
910
|
/**
|
|
906
911
|
* 查找目标仓库中所有 open 状态的 dependfix 自动修复 PR。
|
|
907
912
|
*
|
|
@@ -933,7 +938,7 @@ export declare function commentOnPullRequest(octokit: Octokit, owner: string, re
|
|
|
933
938
|
*/
|
|
934
939
|
export declare function addLabelToPullRequest(octokit: Octokit, owner: string, repo: string, pullNumber: number, labels: string[]): Promise<void>;
|
|
935
940
|
/**
|
|
936
|
-
* 通过 GitHub API 创建 Pull Request
|
|
941
|
+
* 通过 GitHub API 创建 Pull Request(`draft: true` 创建草稿 PR:基线红的交付降级档)。
|
|
937
942
|
*/
|
|
938
943
|
export declare function createPullRequest(params: CreatePullRequestParams): Promise<PullRequestResult>;
|
|
939
944
|
/** 分支清理状态(用于 cleanup-branches 清单分类) */
|
|
@@ -976,8 +981,6 @@ export declare function isConfirmAnswer(answer: string): boolean;
|
|
|
976
981
|
* @param attemptMarkers 同告警尝试标记(HTML 注释;必须置于正文头部——正文超 64KB 时从尾部截断,尾置标记会丢失)
|
|
977
982
|
*/
|
|
978
983
|
export declare function generatePRBody(result: RunResult, supersededNumbers?: number[], attemptMarkers?: readonly AttemptMarker[]): string;
|
|
979
|
-
//#endregion
|
|
980
|
-
//#region src/github/repo-policy.d.ts
|
|
981
984
|
/** 单条 glob 模式长度上限(加固:防止超长模式引入匹配开销;受信配置 + 短输入) */
|
|
982
985
|
export declare const MAX_GLOB_PATTERN_LENGTH = 200;
|
|
983
986
|
/**
|
|
@@ -1058,8 +1061,6 @@ export declare function matchesTopicsExclude(policy: RepoPolicy, topics: string[
|
|
|
1058
1061
|
* 设计要点:显式优先,用户显式指定的仓库不应被 include 静默剔除)。
|
|
1059
1062
|
*/
|
|
1060
1063
|
export declare function filterExplicitRepositories(policy: RepoPolicy, repositories: string[]): string[];
|
|
1061
|
-
//#endregion
|
|
1062
|
-
//#region src/github/repo-selector.d.ts
|
|
1063
1064
|
/**
|
|
1064
1065
|
* 从文件读取仓库列表(每行一个 `owner/repo`)。
|
|
1065
1066
|
* 空行和 `#` 开头的注释行会被跳过。
|
|
@@ -1069,8 +1070,6 @@ export declare function readReposFile(filePath: string): string[];
|
|
|
1069
1070
|
* 合并 CLI 传入仓库列表与文件中的仓库列表,去重并校验。
|
|
1070
1071
|
*/
|
|
1071
1072
|
export declare function resolveRepoList(cliRepos: string[], reposFilePath?: string): string[];
|
|
1072
|
-
//#endregion
|
|
1073
|
-
//#region src/github/repository-discovery.d.ts
|
|
1074
1073
|
export interface RepositoryDiscoveryOptions {
|
|
1075
1074
|
/** 已认证的 Octokit 实例 */
|
|
1076
1075
|
client: Octokit;
|
|
@@ -1097,7 +1096,7 @@ export interface RepositoryDiscoveryOptions {
|
|
|
1097
1096
|
probeConcurrency?: number;
|
|
1098
1097
|
/**
|
|
1099
1098
|
* 发现规模上限:最多保留的仓库数(按 fullName 字典序排序后截断)。
|
|
1100
|
-
* 默认 100;设为 0
|
|
1099
|
+
* 默认 100;设为 0 表示不限制(负数会被拒绝)。
|
|
1101
1100
|
* 大 org 场景下防止一次性全量发现导致 API 配额不可控消耗和超时。
|
|
1102
1101
|
*/
|
|
1103
1102
|
maxRepos?: number;
|
|
@@ -1133,8 +1132,6 @@ export declare function discoverRepositories(options: RepositoryDiscoveryOptions
|
|
|
1133
1132
|
* 显式 `Owner/Repo` 与发现 `owner/repo` 视为同一仓库)
|
|
1134
1133
|
*/
|
|
1135
1134
|
export declare function mergeRepositories(explicit: string[], discovered: string[]): string[];
|
|
1136
|
-
//#endregion
|
|
1137
|
-
//#region src/github/token-scope.d.ts
|
|
1138
1135
|
/**
|
|
1139
1136
|
* 凭据权限面启动检查(安全治理:超权限 token 启动即警告)。
|
|
1140
1137
|
*
|
|
@@ -1184,8 +1181,6 @@ export declare function analyzeTokenScope(scopeHeader: string | undefined, accep
|
|
|
1184
1181
|
export declare function checkTokenPermissions(client: Octokit, options?: {
|
|
1185
1182
|
codeScanningEnabled?: boolean;
|
|
1186
1183
|
}): Promise<TokenScopeCheckResult>;
|
|
1187
|
-
//#endregion
|
|
1188
|
-
//#region src/code-scanning/rule-classifier.d.ts
|
|
1189
1184
|
/**
|
|
1190
1185
|
* A 类自动修复白名单默认集合(默认值常量;测试 disjointness 不变量用)。
|
|
1191
1186
|
*
|
|
@@ -1237,8 +1232,6 @@ export declare function classifyRule(ruleId: string | null | undefined): AlertCl
|
|
|
1237
1232
|
* 读取自当前生效配置(`getActiveRulesConfig().suggested`);未收录规则返回通用建议(C 类兜底,不静默)。
|
|
1238
1233
|
*/
|
|
1239
1234
|
export declare function suggestionFor(ruleId: string | null | undefined): string;
|
|
1240
|
-
//#endregion
|
|
1241
|
-
//#region src/code-scanning/rule-config.d.ts
|
|
1242
1235
|
export type RuleClass = 'auto-fixable' | 'suggested' | 'report-only';
|
|
1243
1236
|
export interface RuleConfigEntry {
|
|
1244
1237
|
/** 规则 id(如 `js/sql-injection`,trim 后用于匹配;空串非法) */
|
|
@@ -1296,8 +1289,6 @@ export declare function getActiveRulesConfig(): CompiledRulesConfig;
|
|
|
1296
1289
|
export declare function setActiveRulesConfig(config: CompiledRulesConfig): void;
|
|
1297
1290
|
/** 重置为默认配置(测试 cleanup + 运行时 fallback) */
|
|
1298
1291
|
export declare function resetActiveRulesConfig(): void;
|
|
1299
|
-
//#endregion
|
|
1300
|
-
//#region src/code-scanning/templates.d.ts
|
|
1301
1292
|
export interface TemplateApplyResult {
|
|
1302
1293
|
/** 修改后的文件内容 */
|
|
1303
1294
|
content: string;
|
|
@@ -1318,8 +1309,6 @@ export interface CodeScanningFixTemplate {
|
|
|
1318
1309
|
}
|
|
1319
1310
|
/** 获取规则对应的修复模板;无模板返回 undefined(调用方回退建议模式)。 */
|
|
1320
1311
|
export declare function getCodeScanningFixTemplate(ruleId: string): CodeScanningFixTemplate | undefined;
|
|
1321
|
-
//#endregion
|
|
1322
|
-
//#region src/fixers/dependency/manifest.d.ts
|
|
1323
1312
|
/** `package.json` 的最小结构视图(只声明本模块读写的字段)。 */
|
|
1324
1313
|
interface PackageJson {
|
|
1325
1314
|
name?: string;
|
|
@@ -1357,8 +1346,6 @@ export declare function extractPrefix(version: string): string;
|
|
|
1357
1346
|
* 返回 `overrides` 对象的引用,调用方可直接写入。
|
|
1358
1347
|
*/
|
|
1359
1348
|
export declare function ensurePnpmOverrides(pkg: PackageJson): Record<string, string>;
|
|
1360
|
-
//#endregion
|
|
1361
|
-
//#region src/fixers/dependency/overrides-io.d.ts
|
|
1362
1349
|
/** 版本化 overrides 批量应用条目(一条 = 一个包的多 key overrides)。 */
|
|
1363
1350
|
interface VersionedOverridesPlan {
|
|
1364
1351
|
packageName: string;
|
|
@@ -1377,8 +1364,6 @@ interface VersionedOverridesApplyResult {
|
|
|
1377
1364
|
/** 安装失败是否由安装环境问题导致(信号终止 / 超时 / 无 stderr 诊断);调用方据此停止逐包重试 */
|
|
1378
1365
|
environmental?: boolean;
|
|
1379
1366
|
}
|
|
1380
|
-
//#endregion
|
|
1381
|
-
//#region src/fixers/dependency/manifest-upgrades.d.ts
|
|
1382
1367
|
/** 单条写盘结果(版本声明保留原前缀)。 */
|
|
1383
1368
|
interface ManifestUpgradeApplied {
|
|
1384
1369
|
packageName: string;
|
|
@@ -1386,8 +1371,6 @@ interface ManifestUpgradeApplied {
|
|
|
1386
1371
|
toVersion: string;
|
|
1387
1372
|
isMajor: boolean;
|
|
1388
1373
|
}
|
|
1389
|
-
//#endregion
|
|
1390
|
-
//#region src/fixers/dependency/override-key.d.ts
|
|
1391
1374
|
/**
|
|
1392
1375
|
* 归一化单个 selector。
|
|
1393
1376
|
*
|
|
@@ -1409,8 +1392,6 @@ interface OverrideUpsert {
|
|
|
1409
1392
|
* 时复用已有写法,保证同一 selector 只保留一种写法。
|
|
1410
1393
|
*/
|
|
1411
1394
|
export declare function upsertOverride(overrides: Record<string, string | undefined>, key: string, value: string): OverrideUpsert;
|
|
1412
|
-
//#endregion
|
|
1413
|
-
//#region src/fixers/dependency/semver.d.ts
|
|
1414
1395
|
/**
|
|
1415
1396
|
* 从版本声明中提取主版本号(major)。
|
|
1416
1397
|
* 去除前缀后匹配第一个 semver 段。
|
|
@@ -1454,8 +1435,6 @@ export declare function compareSemver(a: string, b: string): number;
|
|
|
1454
1435
|
* isNonSemverDeclaration('https://...tgz') // true
|
|
1455
1436
|
*/
|
|
1456
1437
|
export declare function isNonSemverDeclaration(version: string): boolean;
|
|
1457
|
-
//#endregion
|
|
1458
|
-
//#region src/fixers/dependency/lockfile-versions.d.ts
|
|
1459
1438
|
/**
|
|
1460
1439
|
* 从 `pnpm-lock.yaml` 中读取指定包的**所有**锁定版本实例。
|
|
1461
1440
|
*
|
|
@@ -1479,8 +1458,6 @@ export declare function readLockfileVersions(lockfilePath: string, packageName:
|
|
|
1479
1458
|
* @returns 锁定版本字符串(如 `'5.0.0'`),未找到返回 `null`
|
|
1480
1459
|
*/
|
|
1481
1460
|
export declare function readLockfileVersion(lockfilePath: string, packageName: string): string | null;
|
|
1482
|
-
//#endregion
|
|
1483
|
-
//#region src/fixers/dependency/index.d.ts
|
|
1484
1461
|
export interface UpgradeDependencyParams {
|
|
1485
1462
|
/** 包名(如 `'lodash'`, `'@babel/traverse'`) */
|
|
1486
1463
|
packageName: string;
|
|
@@ -1644,8 +1621,6 @@ export declare function detectPnpmMajor(workDir: string): number | null;
|
|
|
1644
1621
|
* partitionSubmanifestAlerts 的常规跳过逻辑处理,避免重复计数。
|
|
1645
1622
|
*/
|
|
1646
1623
|
export declare function isCrossMajorFixRequired(lockfilePath: string, alert: NormalizedSecurityAlert): boolean;
|
|
1647
|
-
//#endregion
|
|
1648
|
-
//#region src/fixers/pnpm/index.d.ts
|
|
1649
1624
|
export type LockfileFailureCategory = 'LOCKFILE_NOT_FOUND' | 'MANIFEST_MISMATCH' | 'LOCKFILE_VERSION_MISMATCH' | 'CORRUPTED_LOCKFILE' | 'CREDENTIAL_ERROR' | 'RESOLVE_ERROR' | 'MINIMUM_RELEASE_AGE' | 'ENVIRONMENT_ERROR' | 'ABORTED' | 'UNKNOWN';
|
|
1650
1625
|
export type RepairStrategy = 'REGENERATE' | 'FIX_ENTRIES' | 'PIN_TOOLCHAIN' | 'REINSTALL' | 'SKIP';
|
|
1651
1626
|
export interface RepairLockfileParams {
|
|
@@ -1759,8 +1734,6 @@ export declare function resolvePnpmVersion(workDir: string, toolchain?: {
|
|
|
1759
1734
|
* 使平台的执行超时定时器一起停摆,且无法在取消时终止子进程树。
|
|
1760
1735
|
*/
|
|
1761
1736
|
export declare function repairLockfile(params: RepairLockfileParams): Promise<LockfileRepairResult>;
|
|
1762
|
-
//#endregion
|
|
1763
|
-
//#region src/fixers/code-scanning/index.d.ts
|
|
1764
1737
|
export interface ApplyCodeScanningFixParams {
|
|
1765
1738
|
/** 工作目录(告警 manifestPath 为相对路径,resolve 后读取) */
|
|
1766
1739
|
workDir: string;
|
|
@@ -1804,8 +1777,6 @@ export declare function restoreSourceFile(workDir: string, snapshot: SourceFileS
|
|
|
1804
1777
|
* 返回**真实路径**(后续读写走真实路径,避免再次经过 symlink)。
|
|
1805
1778
|
*/
|
|
1806
1779
|
export declare function resolveWithinWorkDir(workDir: string, relativePath: string): string | null;
|
|
1807
|
-
//#endregion
|
|
1808
|
-
//#region src/config/index.d.ts
|
|
1809
1780
|
export declare const RUNTIME_MODES: readonly ["report-only", "fix", "fix-and-pr", "cleanup-branches"];
|
|
1810
1781
|
export declare const SEVERITY_THRESHOLDS: readonly ["critical", "high", "medium", "all"];
|
|
1811
1782
|
export declare const ALERT_SOURCES: readonly AlertSourceKind[];
|
|
@@ -1945,6 +1916,12 @@ export interface RuntimeConfig {
|
|
|
1945
1916
|
* [pr-delivery-closure.md §6](../../../../docs/design/governance/pr-delivery-closure.md)。
|
|
1946
1917
|
*/
|
|
1947
1918
|
retryFailed?: boolean;
|
|
1919
|
+
/**
|
|
1920
|
+
* 基线红(修复后安装仍既有失败)时的交付降级档位(`DEPENDFIX_ON_BASELINE_RED`,默认 `skip`):
|
|
1921
|
+
* `skip` 回滚并留痕 / `issue` 按失败指纹开 issue / `draft` 不回滚、创建**草稿** PR(仅 fix-and-pr;
|
|
1922
|
+
* 平台只记录 summary)。口径见 [§16](../../../../docs/design/governance/pr-delivery-closure.md)。
|
|
1923
|
+
*/
|
|
1924
|
+
onBaselineRed?: BaselineRedDelivery;
|
|
1948
1925
|
/** PR 创建后等待 check 终态(`--wait-pr-checks` / `DEPENDFIX_WAIT_PR_CHECKS`,默认 false;仅 fix-and-pr,口径见 [§8](../../../../docs/design/governance/pr-delivery-closure.md)) */
|
|
1949
1926
|
waitPrChecks?: boolean;
|
|
1950
1927
|
/** check 失败且归因 self_caused 时关闭 PR 并删分支(`--close-failed-pr`,默认 false;需同时等待,其余归因只评论) */
|
|
@@ -1955,10 +1932,9 @@ export interface RuntimeConfig {
|
|
|
1955
1932
|
prCheckRunBudgetMs?: number;
|
|
1956
1933
|
/** job 总预算基线(毫秒;`DEPENDFIX_JOB_BUDGET_MS`)。缺省仅在 `GITHUB_ACTIONS=true` 按 25 分钟套用 */
|
|
1957
1934
|
jobBudgetMs?: number;
|
|
1958
|
-
/**
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
*/
|
|
1935
|
+
/** 运行截止时间(epoch ms;平台计算、引擎消费):预算不足时停止启动新工作并写 `BUDGET_EXHAUSTED` 审计。 */
|
|
1936
|
+
deadlineAt?: number;
|
|
1937
|
+
/** 执行宿主的构建版本回执(平台注入;缺省回退引擎包版本,最终 `unknown`;与 `/api/health` 同源)。 */
|
|
1962
1938
|
buildVersion?: string;
|
|
1963
1939
|
/**
|
|
1964
1940
|
* 执行宿主的构建 commit(平台容器注入)。只有宿主构建期能提供;
|
|
@@ -2005,7 +1981,7 @@ export interface RuntimeConfig {
|
|
|
2005
1981
|
toolchainPnpmVersion?: string;
|
|
2006
1982
|
/**
|
|
2007
1983
|
* 发现规模上限(`--max-repos` / `DEPENDFIX_MAX_REPOS`):最多保留的仓库数。
|
|
2008
|
-
* 默认 100;设为 0
|
|
1984
|
+
* 默认 100;设为 0 表示不限制(负数会被拒绝)。大 org 场景下防止一次性全量发现。
|
|
2009
1985
|
*/
|
|
2010
1986
|
maxRepos: number;
|
|
2011
1987
|
/**
|
|
@@ -2091,6 +2067,8 @@ export interface CliConfigOverrides {
|
|
|
2091
2067
|
mirrorCiScripts?: boolean;
|
|
2092
2068
|
/** 忽略同告警尝试上限并强制再试(`--retry-failed`;默认关闭,仅 fix-and-pr 生效) */
|
|
2093
2069
|
retryFailed?: boolean;
|
|
2070
|
+
/** 基线红的交付降级档位(`DEPENDFIX_ON_BASELINE_RED`;默认 `skip`,仅 fix-and-pr 生效) */
|
|
2071
|
+
onBaselineRed?: BaselineRedDelivery;
|
|
2094
2072
|
/** 等待本次 PR 的 check 终态(`--wait-pr-checks`;默认关闭,仅 fix-and-pr 生效) */
|
|
2095
2073
|
waitPrChecks?: boolean;
|
|
2096
2074
|
/** check 失败且归因 self_caused 时关闭 PR(`--close-failed-pr`;默认关闭,需同时等待) */
|
|
@@ -2116,7 +2094,7 @@ export interface CliConfigOverrides {
|
|
|
2116
2094
|
toolchainPnpmVersion?: string;
|
|
2117
2095
|
/**
|
|
2118
2096
|
* 发现规模上限(`--max-repos` / `DEPENDFIX_MAX_REPOS`):最多保留的仓库数。
|
|
2119
|
-
* 默认 100;设为 0
|
|
2097
|
+
* 默认 100;设为 0 表示不限制(负数会被拒绝)。大 org 场景下防止一次性全量发现。
|
|
2120
2098
|
*/
|
|
2121
2099
|
maxRepos?: number;
|
|
2122
2100
|
/** AI 研判总开关(`--ai`) */
|
|
@@ -2129,7 +2107,7 @@ export interface CliConfigOverrides {
|
|
|
2129
2107
|
aiBaseUrl?: string;
|
|
2130
2108
|
/** AI Anthropic 兼容端点(`--ai-api-url`,仅 provider=anthropic 生效) */
|
|
2131
2109
|
aiApiUrl?: string;
|
|
2132
|
-
/** AI API Key(`--ai-api-key
|
|
2110
|
+
/** AI API Key(`--ai-api-key`;CLI 参数优先,DEPENDFIX_AI_API_KEY 环境变量兜底) */
|
|
2133
2111
|
aiApiKey?: string;
|
|
2134
2112
|
/** AI 触发范围(`--ai-trigger`:failure / major / both) */
|
|
2135
2113
|
aiTrigger?: AiTriggerKind;
|
|
@@ -2168,8 +2146,6 @@ export declare function resolveRuntimeConfig(options?: ResolveRuntimeConfigOptio
|
|
|
2168
2146
|
* @returns `owner/repo` 或 `null`(非 GitHub / 无 origin)
|
|
2169
2147
|
*/
|
|
2170
2148
|
export declare function inferRepoFromGitRemote(workDir: string): string | null;
|
|
2171
|
-
//#endregion
|
|
2172
|
-
//#region src/report/archiver.d.ts
|
|
2173
2149
|
export interface ArchiveRepoStats {
|
|
2174
2150
|
repository: string;
|
|
2175
2151
|
alertsCount: number;
|
|
@@ -2221,8 +2197,6 @@ export declare function readArchiveIndex(outputDir?: string): ArchiveIndex;
|
|
|
2221
2197
|
* 仅返回包含该仓库的运行;无结果返回 []。
|
|
2222
2198
|
*/
|
|
2223
2199
|
export declare function queryRepoHistory(repo: string, outputDir?: string): ArchiveRunEntry[];
|
|
2224
|
-
//#endregion
|
|
2225
|
-
//#region src/report/history.d.ts
|
|
2226
2200
|
/**
|
|
2227
2201
|
* 将某仓库的历史运行摘要格式化为多行文本(倒序时间:最新在前)。
|
|
2228
2202
|
*
|
|
@@ -2233,8 +2207,6 @@ export declare function queryRepoHistory(repo: string, outputDir?: string): Arch
|
|
|
2233
2207
|
* 无历史时返回提示行(非空,调用方直接打印)。
|
|
2234
2208
|
*/
|
|
2235
2209
|
export declare function formatHistory(entries: ArchiveRunEntry[], repo: string): string;
|
|
2236
|
-
//#endregion
|
|
2237
|
-
//#region src/multirepo/scheduler.d.ts
|
|
2238
2210
|
/** 并发上限(1-16,配置校验范围) */
|
|
2239
2211
|
export declare const MAX_CONCURRENCY_LIMIT = 16;
|
|
2240
2212
|
/** 默认并发(保守:行为与现状一致,逐仓库串行) */
|
|
@@ -2264,15 +2236,11 @@ export interface ConcurrencySchedulerOptions<T> {
|
|
|
2264
2236
|
export declare function runWithConcurrency<T>(options: ConcurrencySchedulerOptions<T>): Promise<void>;
|
|
2265
2237
|
/** 校验并发值是否在 1-16 范围内(config 层调用,抛 AppError)。 */
|
|
2266
2238
|
export declare function isValidConcurrency(value: number): boolean;
|
|
2267
|
-
//#endregion
|
|
2268
|
-
//#region src/app/branch-cleanup.d.ts
|
|
2269
2239
|
/**
|
|
2270
2240
|
* 关闭被取代的旧 PR 并回收其 head 分支(supersede 流程)。
|
|
2271
2241
|
* 关闭失败记录错误;分支删除失败仅 warn(家务活 best-effort,不触发非零退出)。
|
|
2272
2242
|
*/
|
|
2273
2243
|
export declare function closeSupersededPRs(ctx: Pick<AppContext, 'logger' | 'allErrors'>, client: Octokit, owner: string, repo: string, supersedePRs: DependfixOpenPR[]): Promise<void>;
|
|
2274
|
-
//#endregion
|
|
2275
|
-
//#region src/ai/usage.d.ts
|
|
2276
2244
|
interface AiUsage {
|
|
2277
2245
|
/** 调用次数 */
|
|
2278
2246
|
calls: number;
|
|
@@ -2303,8 +2271,6 @@ export declare class AiUsageTracker {
|
|
|
2303
2271
|
record(inputTokens: number, outputTokens: number): void;
|
|
2304
2272
|
snapshot(): AiUsage;
|
|
2305
2273
|
}
|
|
2306
|
-
//#endregion
|
|
2307
|
-
//#region src/app/helpers.d.ts
|
|
2308
2274
|
/** DependfixApp 提供给辅助方法的最小状态切片。 */
|
|
2309
2275
|
interface AppContext {
|
|
2310
2276
|
config: RuntimeConfig;
|
|
@@ -2347,11 +2313,29 @@ interface AppContext {
|
|
|
2347
2313
|
* 不做跳过判定(避免「在 A 仓计 B 仓的尝试」造成永久跳过)。
|
|
2348
2314
|
*/
|
|
2349
2315
|
attemptRepo?: string;
|
|
2316
|
+
/**
|
|
2317
|
+
* 告警级修复结果收集器(run 级;修复管线在无法由 actions 反推的判定点写入,
|
|
2318
|
+
* 报告 `alertOutcomes` 与平台 `ScanResult.fixStatus` 回写消费)。
|
|
2319
|
+
* 缺省(测试直接构造 ctx)⇒ 报告只按 actions 与告警属性推导,不含收敛 / 跳过等显式判定。
|
|
2320
|
+
*/
|
|
2321
|
+
alertOutcomes?: Map<string, AlertFixOutcome>;
|
|
2350
2322
|
/**
|
|
2351
2323
|
* PR check 回环结果(仅 `--wait-pr-checks` 且实际创建 PR 时存在)。
|
|
2352
2324
|
* 缺省 ⇒ 不等待(行为与引入前一致)。
|
|
2353
2325
|
*/
|
|
2354
2326
|
prCheckWatch?: PrCheckWatchReport;
|
|
2327
|
+
/**
|
|
2328
|
+
* 交付跳过记录(修复后安装仍为既有失败 → 有修复但不交付)。
|
|
2329
|
+
* 缺省(测试直接构造 ctx)⇒ 不记录,summary 计数保持 0。
|
|
2330
|
+
*/
|
|
2331
|
+
deliverySkips?: DeliverySkipRecord[];
|
|
2332
|
+
/**
|
|
2333
|
+
* 运行截止时间(epoch ms;来自 `RuntimeConfig.deadlineAt`)。
|
|
2334
|
+
* 缺省 ⇒ 不限预算(CLI 本地运行),所有预算检查放行。
|
|
2335
|
+
*/
|
|
2336
|
+
deadlineAt?: number;
|
|
2337
|
+
/** 已记录的预算跳过(`stage:work`;避免同一跳过来回刷审计)。缺省 ⇒ 不去重。 */
|
|
2338
|
+
budgetSkips?: Set<string>;
|
|
2355
2339
|
}
|
|
2356
2340
|
/**
|
|
2357
2341
|
* 按动作构成生成 PR 标题(收尾审查遗留修复:cs-only 修复不再误标 "N upgrades",
|
|
@@ -2361,8 +2345,6 @@ interface AppContext {
|
|
|
2361
2345
|
* codeFixes 过滤条件一致(均 success && !noOp);任一侧口径变更必须同步。
|
|
2362
2346
|
*/
|
|
2363
2347
|
export declare function buildPrTitle(summary: Pick<RunSummary, 'alertsFixed'>, actions: FixAction[]): string;
|
|
2364
|
-
//#endregion
|
|
2365
|
-
//#region src/helpers/index.d.ts
|
|
2366
2348
|
/**
|
|
2367
2349
|
* 对可修复告警按包名去重(同包收敛)。
|
|
2368
2350
|
*
|
|
@@ -2452,8 +2434,6 @@ export declare function partitionSubmanifestAlerts(alerts: NormalizedSecurityAle
|
|
|
2452
2434
|
* 进入跨线链路必然失败,维持人工处理。
|
|
2453
2435
|
*/
|
|
2454
2436
|
export declare function isRootDirectDependency(workDir: string, packageName: string): boolean;
|
|
2455
|
-
//#endregion
|
|
2456
|
-
//#region src/grouping/index.d.ts
|
|
2457
2437
|
/** 分组来源(决定分组优先级与命名语义) */
|
|
2458
2438
|
export type GroupSource = 'explicit' | 'dependabot' | 'types' | 'scope' | 'prefix' | 'single';
|
|
2459
2439
|
export interface DependencyGroup {
|
|
@@ -2544,8 +2524,6 @@ export declare function isMainPackagePresent(pkg: PackageJsonLike, lockfilePath:
|
|
|
2544
2524
|
* 5. @types 归并(主包有告警并入其组)/ 独立组 / 清理候选(主包已不存在)
|
|
2545
2525
|
*/
|
|
2546
2526
|
export declare function buildUpgradeGroups(alerts: NormalizedSecurityAlert[], options: GroupingOptions): GroupingResult;
|
|
2547
|
-
//#endregion
|
|
2548
|
-
//#region src/runners/network-audit.d.ts
|
|
2549
2527
|
/**
|
|
2550
2528
|
* 执行期网络外联审计 + 出站白名单拦截(安全治理:恶意脚本外联回传/下载 payload 的事故溯源与阻断)。
|
|
2551
2529
|
*
|
|
@@ -2575,12 +2553,8 @@ interface NetworkAuditEntry {
|
|
|
2575
2553
|
/** deny-by-default 拦截的违规外联标记(白名单校验失败的外联为 true) */
|
|
2576
2554
|
violation?: boolean;
|
|
2577
2555
|
}
|
|
2578
|
-
//#endregion
|
|
2579
|
-
//#region src/runners/output-sanitizer.d.ts
|
|
2580
2556
|
/** 对子进程输出做敏感信息脱敏(可安全写入日志 / 报告)。 */
|
|
2581
2557
|
export declare function sanitizeOutput(output: string): string;
|
|
2582
|
-
//#endregion
|
|
2583
|
-
//#region src/runners/verification-runner.d.ts
|
|
2584
2558
|
/**
|
|
2585
2559
|
* 单条命令的执行结果
|
|
2586
2560
|
*/
|
|
@@ -2723,8 +2697,6 @@ export declare function formatVerificationError(cr: CommandResult): string;
|
|
|
2723
2697
|
* ```
|
|
2724
2698
|
*/
|
|
2725
2699
|
export declare function runVerification(params: VerificationParams): Promise<VerificationResult>;
|
|
2726
|
-
//#endregion
|
|
2727
|
-
//#region src/alerts/pnpm-audit-fetcher.d.ts
|
|
2728
2700
|
/**
|
|
2729
2701
|
* pnpm audit 本地回退数据源(无 GitHub token 场景)。
|
|
2730
2702
|
*
|
|
@@ -2776,8 +2748,6 @@ export declare function parseAuditReport(report: unknown): RiskRecord[];
|
|
|
2776
2748
|
* 本函数保留仅为兼容现有 `NormalizedSecurityAlert.id: number` 字段,**不是**平台去重键。
|
|
2777
2749
|
*/
|
|
2778
2750
|
export declare function hashAdvisoryId(packageName: string, advisoryId: string): number;
|
|
2779
|
-
//#endregion
|
|
2780
|
-
//#region src/ai/provider.d.ts
|
|
2781
2751
|
interface AiConfig {
|
|
2782
2752
|
/** 提供商类型:openai-compatible(默认)/ anthropic */
|
|
2783
2753
|
provider: 'openai-compatible' | 'anthropic';
|
|
@@ -2812,8 +2782,6 @@ interface AiChatResult {
|
|
|
2812
2782
|
text: string;
|
|
2813
2783
|
usage: AiChatUsage;
|
|
2814
2784
|
}
|
|
2815
|
-
//#endregion
|
|
2816
|
-
//#region src/ai/schema.d.ts
|
|
2817
2785
|
declare const replaceBlockSchema: z.ZodObject<{
|
|
2818
2786
|
search: z.ZodString;
|
|
2819
2787
|
replace: z.ZodString;
|
|
@@ -2846,8 +2814,6 @@ declare const assessmentSchema: z.ZodObject<{
|
|
|
2846
2814
|
type AiAssessment = z.infer<typeof assessmentSchema>;
|
|
2847
2815
|
type AiFileChange = z.infer<typeof fileChangeSchema>;
|
|
2848
2816
|
type AiReplaceBlock = z.infer<typeof replaceBlockSchema>;
|
|
2849
|
-
//#endregion
|
|
2850
|
-
//#region src/ai/changelog-fetcher.d.ts
|
|
2851
2817
|
interface ChangelogEntry {
|
|
2852
2818
|
/** release 版本号(tag_name 原样保留,可能为 `v1.2.3` 形态) */
|
|
2853
2819
|
version: string;
|
|
@@ -2858,8 +2824,6 @@ interface ChangelogEntry {
|
|
|
2858
2824
|
/** release 页面地址 */
|
|
2859
2825
|
htmlUrl: string;
|
|
2860
2826
|
}
|
|
2861
|
-
//#endregion
|
|
2862
|
-
//#region src/ai/prompt.d.ts
|
|
2863
2827
|
interface AssessmentContextInput {
|
|
2864
2828
|
packageName: string;
|
|
2865
2829
|
fromVersion: string;
|
|
@@ -2871,8 +2835,6 @@ interface AssessmentContextInput {
|
|
|
2871
2835
|
/** 受影响文件路径列表(可选) */
|
|
2872
2836
|
affectedFiles?: string[];
|
|
2873
2837
|
}
|
|
2874
|
-
//#endregion
|
|
2875
|
-
//#region src/ai/secrets.d.ts
|
|
2876
2838
|
/**
|
|
2877
2839
|
* 对文本中的敏感值做脱敏替换(保留首 4 尾 4 字符便于定位)。
|
|
2878
2840
|
*
|
|
@@ -2884,8 +2846,6 @@ interface AssessmentContextInput {
|
|
|
2884
2846
|
* // → 'call failed with key sk-a****yz'
|
|
2885
2847
|
*/
|
|
2886
2848
|
export declare function maskSecrets(text: string, secrets: string[]): string;
|
|
2887
|
-
//#endregion
|
|
2888
|
-
//#region src/ai/index.d.ts
|
|
2889
2849
|
export interface AssessResult {
|
|
2890
2850
|
/** 结构化研判(降级时为 null,走建议模式) */
|
|
2891
2851
|
assessment: AiAssessment | null;
|
|
@@ -2919,16 +2879,25 @@ export interface AssessOptions {
|
|
|
2919
2879
|
* 降级语义:调用方走建议模式(报告输出人工建议),不静默、可审计。
|
|
2920
2880
|
*/
|
|
2921
2881
|
export declare function assessBreakingChange(options: AssessOptions): Promise<AssessResult>;
|
|
2922
|
-
//#endregion
|
|
2923
|
-
//#region src/app/repo-alerts.d.ts
|
|
2924
2882
|
/**
|
|
2925
2883
|
* 获取仓库的默认分支。
|
|
2926
2884
|
* pnpm-audit 模式 client 为 null → 返回 ''(报告显示 local)。
|
|
2927
2885
|
* 失败时返回 `'unknown'`(不阻塞主流程)。
|
|
2928
2886
|
*/
|
|
2929
2887
|
export declare function fetchDefaultBranch(client: Octokit | null, owner: string, repo: string): Promise<string>;
|
|
2930
|
-
|
|
2931
|
-
|
|
2888
|
+
/**
|
|
2889
|
+
* 输出「部分源拉取失败」汇总(per-source 错误隔离:单源失败不阻断其余源的结果)。
|
|
2890
|
+
*
|
|
2891
|
+
* 触发条件(必须全部满足,避免与"仓库失败"(无任何成功源)语义重叠):
|
|
2892
|
+
* 1. allErrors 至少包含一个 `stage='fetch' + category='FETCH_FAILED'` 错误(per-source 失败)
|
|
2893
|
+
* 2. **至少一个仓库成功拉取了部分告警**(isAnyRepoSuccessful = true)——
|
|
2894
|
+
* 否则该仓库已按失败处理(无任何成功源),由 processRepoForReport catch + logger.error 单独处理,
|
|
2895
|
+
* 本函数聚焦"warn + 保留成功源"场景的汇总输出,避免重复提示。
|
|
2896
|
+
*
|
|
2897
|
+
* 汇总按 source 分组('dependabot' / 'code-scanning' / 'code-quality' / 'pnpm-audit'),
|
|
2898
|
+
* 列出每个源失败的仓库数 + 示例错误消息,便于用户快速定位是 token 权限还是网络问题。
|
|
2899
|
+
*/
|
|
2900
|
+
export declare function logPartialSourceFailureSummary(allErrors: FixError[], logger: Logger, isAnyRepoSuccessful: boolean): void;
|
|
2932
2901
|
export interface DependfixAppOptions {
|
|
2933
2902
|
/** 已解析的运行时配置 */
|
|
2934
2903
|
config: RuntimeConfig;
|
|
@@ -2958,19 +2927,6 @@ export interface DependfixRunResult {
|
|
|
2958
2927
|
/** 进程退出码:0=全部成功, 1=部分失败, 2=全部失败 */
|
|
2959
2928
|
exitCode: number;
|
|
2960
2929
|
}
|
|
2961
|
-
/**
|
|
2962
|
-
* 输出"部分源拉取失败"汇总(todo.md §M19.5 C8 per-source 错误隔离)。
|
|
2963
|
-
*
|
|
2964
|
-
* 触发条件(必须全部满足,避免与"仓库失败"(无任何成功源)语义重叠):
|
|
2965
|
-
* 1. allErrors 至少包含一个 `stage='fetch' + category='FETCH_FAILED'` 错误(per-source 失败)
|
|
2966
|
-
* 2. **至少一个仓库成功拉取了部分告警**(isAnyRepoSuccessful = true)——
|
|
2967
|
-
* 否则该仓库已按失败处理(无任何成功源),由 processRepoForReport catch + logger.error 单独处理,
|
|
2968
|
-
* 本函数聚焦"warn + 保留成功源"场景的汇总输出,避免重复提示。
|
|
2969
|
-
*
|
|
2970
|
-
* 汇总按 source 分组('dependabot' / 'code-scanning' / 'code-quality' / 'pnpm-audit'),
|
|
2971
|
-
* 列出每个源失败的仓库数 + 示例错误消息,便于用户快速定位是 token 权限还是网络问题。
|
|
2972
|
-
*/
|
|
2973
|
-
export declare function logPartialSourceFailureSummary(allErrors: FixError[], logger: Logger, isAnyRepoSuccessful: boolean): void;
|
|
2974
2930
|
export declare class DependfixApp {
|
|
2975
2931
|
/** 运行时配置;构造期按「中央配置优先」合并目标仓库专属配置后单次赋值(见 applyRepoConfig) */
|
|
2976
2932
|
private readonly config;
|
|
@@ -3012,6 +2968,13 @@ export declare class DependfixApp {
|
|
|
3012
2968
|
private attemptRepo;
|
|
3013
2969
|
/** PR check 回环结果(run 级;仅在 `--wait-pr-checks` 且创建 PR 时递增) */
|
|
3014
2970
|
private readonly prCheckWatchReport;
|
|
2971
|
+
/** 交付跳过记录(基线红;`computeSummary` 据此派生 summary 计数) */
|
|
2972
|
+
private readonly deliverySkips;
|
|
2973
|
+
/** 已记录的预算跳过(`stage:work`;逐包命中不刷审计) */
|
|
2974
|
+
private readonly budgetSkips;
|
|
2975
|
+
/** `draft` 档的跳过记录(sanity: PR 创建后回填载体编号) */
|
|
2976
|
+
private baselineRedDraft?;
|
|
2977
|
+
private readonly alertOutcomes;
|
|
3015
2978
|
constructor(options: DependfixAppOptions);
|
|
3016
2979
|
/**
|
|
3017
2980
|
* 请求中止本次运行(平台执行超时 / 运维中止的接入点;协作式、可重复调用)。
|
|
@@ -3076,6 +3039,5 @@ export declare class DependfixApp {
|
|
|
3076
3039
|
*/
|
|
3077
3040
|
private resolveRepositories;
|
|
3078
3041
|
}
|
|
3079
|
-
//#endregion
|
|
3080
3042
|
export type { AiAssessment, AiChatResult, AiConfig, AiFileChange, AiReplaceBlock, AiUsage, AlertClass, AlertSourceKind, AssessmentContextInput, AuthProvider, AuthProviderOptions, FromAppParams, FromPatParams, ManifestUpgradeApplied, OverrideUpsert, PackageJson, SeverityThreshold, VersionedOverridesApplyResult, VersionedOverridesPlan };
|
|
3081
3043
|
//# sourceMappingURL=index.d.mts.map
|