nexus-agents 2.92.0 → 2.92.1
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/{chunk-VW2LBC7B.js → chunk-74AO4RKT.js} +2 -2
- package/dist/{chunk-HPV2D4HN.js → chunk-G3CYK3WA.js} +2 -2
- package/dist/{chunk-RS6RGSYG.js → chunk-G5XKEUAP.js} +46 -3
- package/dist/chunk-G5XKEUAP.js.map +1 -0
- package/dist/{chunk-S4UF577T.js → chunk-OK6U5N5Y.js} +1 -1
- package/dist/chunk-OK6U5N5Y.js.map +1 -0
- package/dist/{chunk-LOBVTRQQ.js → chunk-ZNR3ZVC6.js} +3 -3
- package/dist/cli.js +22 -39
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +190 -190
- package/dist/index.js +3 -3
- package/dist/{pr-reviewer-helpers-7D2W5HTO.js → pr-reviewer-helpers-RBUEJI6V.js} +7 -3
- package/dist/{setup-command-UN3XDJ2H.js → setup-command-AZAWBZOP.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-RS6RGSYG.js.map +0 -1
- package/dist/chunk-S4UF577T.js.map +0 -1
- /package/dist/{chunk-VW2LBC7B.js.map → chunk-74AO4RKT.js.map} +0 -0
- /package/dist/{chunk-HPV2D4HN.js.map → chunk-G3CYK3WA.js.map} +0 -0
- /package/dist/{chunk-LOBVTRQQ.js.map → chunk-ZNR3ZVC6.js.map} +0 -0
- /package/dist/{pr-reviewer-helpers-7D2W5HTO.js.map → pr-reviewer-helpers-RBUEJI6V.js.map} +0 -0
- /package/dist/{setup-command-UN3XDJ2H.js.map → setup-command-AZAWBZOP.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -29168,6 +29168,196 @@ declare function computeAdaptiveThresholds(store: OutcomeStore, cli: CliNameLite
|
|
|
29168
29168
|
*/
|
|
29169
29169
|
declare function detectTrend(outcomes: readonly TaskOutcome$2[], windowSize?: number): Trend;
|
|
29170
29170
|
|
|
29171
|
+
/**
|
|
29172
|
+
* nexus-agents/scm - SCM Provider Types
|
|
29173
|
+
*
|
|
29174
|
+
* Shared types for the centralized SCM (Source Control Management) module.
|
|
29175
|
+
* Supports GitHub (REST API + gh CLI) with extensibility for GitLab/Gitea.
|
|
29176
|
+
*
|
|
29177
|
+
* @module scm/types
|
|
29178
|
+
* (Source: Issue #1136 — Centralized SCM Provider Module)
|
|
29179
|
+
*/
|
|
29180
|
+
|
|
29181
|
+
/** Supported SCM platforms. */
|
|
29182
|
+
type ScmPlatform = 'github' | 'gitlab' | 'gitea';
|
|
29183
|
+
/** Token resolution strategy. */
|
|
29184
|
+
type TokenStrategy = 'env' | 'cli' | 'config';
|
|
29185
|
+
/** Resolved SCM token with metadata. */
|
|
29186
|
+
interface ScmToken {
|
|
29187
|
+
/** The raw token value */
|
|
29188
|
+
readonly value: string;
|
|
29189
|
+
/** How the token was resolved */
|
|
29190
|
+
readonly strategy: TokenStrategy;
|
|
29191
|
+
/** SCM platform this token is for */
|
|
29192
|
+
readonly platform: ScmPlatform;
|
|
29193
|
+
}
|
|
29194
|
+
/** Token resolution configuration. */
|
|
29195
|
+
interface TokenResolverConfig {
|
|
29196
|
+
/** Explicit token (highest priority) */
|
|
29197
|
+
readonly token?: string;
|
|
29198
|
+
/** SCM platform to resolve for */
|
|
29199
|
+
readonly platform?: ScmPlatform;
|
|
29200
|
+
/** Custom env var name override */
|
|
29201
|
+
readonly envVar?: string;
|
|
29202
|
+
}
|
|
29203
|
+
/** SCM issue representation. */
|
|
29204
|
+
interface ScmIssue {
|
|
29205
|
+
readonly number: number;
|
|
29206
|
+
readonly title: string;
|
|
29207
|
+
readonly body: string;
|
|
29208
|
+
readonly labels: readonly string[];
|
|
29209
|
+
readonly author: string;
|
|
29210
|
+
readonly createdAt: string;
|
|
29211
|
+
}
|
|
29212
|
+
/** SCM pull/merge request representation. */
|
|
29213
|
+
interface ScmPullRequest {
|
|
29214
|
+
readonly number: number;
|
|
29215
|
+
readonly title: string;
|
|
29216
|
+
readonly body: string;
|
|
29217
|
+
readonly author: string;
|
|
29218
|
+
readonly base: string;
|
|
29219
|
+
readonly head: string;
|
|
29220
|
+
readonly url: string;
|
|
29221
|
+
}
|
|
29222
|
+
/** SCM comment representation. */
|
|
29223
|
+
interface ScmComment {
|
|
29224
|
+
readonly id: number;
|
|
29225
|
+
readonly body: string;
|
|
29226
|
+
readonly author: string;
|
|
29227
|
+
readonly createdAt: string;
|
|
29228
|
+
}
|
|
29229
|
+
/** PR creation options. */
|
|
29230
|
+
interface CreatePROptions {
|
|
29231
|
+
readonly title: string;
|
|
29232
|
+
readonly body: string;
|
|
29233
|
+
readonly head: string;
|
|
29234
|
+
readonly base: string;
|
|
29235
|
+
}
|
|
29236
|
+
/** PR merge options. */
|
|
29237
|
+
interface MergePROptions {
|
|
29238
|
+
readonly method?: 'merge' | 'squash' | 'rebase';
|
|
29239
|
+
readonly commitTitle?: string;
|
|
29240
|
+
readonly commitMessage?: string;
|
|
29241
|
+
readonly deleteBranch?: boolean;
|
|
29242
|
+
}
|
|
29243
|
+
/** PR status for merge eligibility. */
|
|
29244
|
+
interface PRStatus {
|
|
29245
|
+
readonly mergeable: boolean;
|
|
29246
|
+
readonly checksStatus: 'pending' | 'success' | 'failure';
|
|
29247
|
+
readonly reviewStatus: 'approved' | 'pending' | 'changes_requested';
|
|
29248
|
+
}
|
|
29249
|
+
/** Issue filter options. */
|
|
29250
|
+
interface IssueFilters {
|
|
29251
|
+
readonly labels?: readonly string[];
|
|
29252
|
+
readonly state?: 'open' | 'closed' | 'all';
|
|
29253
|
+
readonly limit?: number;
|
|
29254
|
+
}
|
|
29255
|
+
/** Unified SCM error with platform-aware context. */
|
|
29256
|
+
declare class ScmError extends Error {
|
|
29257
|
+
readonly platform: ScmPlatform;
|
|
29258
|
+
readonly statusCode?: number | undefined;
|
|
29259
|
+
readonly context?: Record<string, unknown> | undefined;
|
|
29260
|
+
constructor(message: string, platform: ScmPlatform, statusCode?: number | undefined, context?: Record<string, unknown> | undefined);
|
|
29261
|
+
}
|
|
29262
|
+
/** File change in a pull request. */
|
|
29263
|
+
interface ScmFileChange {
|
|
29264
|
+
readonly filename: string;
|
|
29265
|
+
readonly status: 'added' | 'removed' | 'modified' | 'renamed' | 'copied';
|
|
29266
|
+
readonly additions: number;
|
|
29267
|
+
readonly deletions: number;
|
|
29268
|
+
readonly patch?: string;
|
|
29269
|
+
readonly previousFilename?: string;
|
|
29270
|
+
}
|
|
29271
|
+
/** Extended PR with file diffs and stats. Used by IScmReviewer. */
|
|
29272
|
+
interface ScmPullRequestDetail extends ScmPullRequest {
|
|
29273
|
+
readonly draft: boolean;
|
|
29274
|
+
readonly authorAssociation: string;
|
|
29275
|
+
readonly labels: readonly string[];
|
|
29276
|
+
readonly files: readonly ScmFileChange[];
|
|
29277
|
+
readonly additions: number;
|
|
29278
|
+
readonly deletions: number;
|
|
29279
|
+
readonly headSha: string;
|
|
29280
|
+
}
|
|
29281
|
+
/** Extended issue with association and state. Used by IScmReviewer. */
|
|
29282
|
+
interface ScmIssueDetail extends ScmIssue {
|
|
29283
|
+
readonly authorAssociation: string;
|
|
29284
|
+
readonly state: string;
|
|
29285
|
+
readonly url: string;
|
|
29286
|
+
}
|
|
29287
|
+
/** Extended comment with author association. */
|
|
29288
|
+
interface ScmCommentDetail extends ScmComment {
|
|
29289
|
+
readonly authorAssociation: string;
|
|
29290
|
+
}
|
|
29291
|
+
/** Review decision for a pull request. */
|
|
29292
|
+
type ScmReviewDecision = 'approve' | 'request_changes' | 'comment';
|
|
29293
|
+
/** User metadata for reputation assessment. */
|
|
29294
|
+
interface ScmUserMetadata {
|
|
29295
|
+
readonly login: string;
|
|
29296
|
+
readonly name: string | null;
|
|
29297
|
+
readonly company: string | null;
|
|
29298
|
+
readonly followers: number;
|
|
29299
|
+
readonly following: number;
|
|
29300
|
+
readonly publicRepos: number;
|
|
29301
|
+
readonly createdAt: string;
|
|
29302
|
+
}
|
|
29303
|
+
/**
|
|
29304
|
+
* Core SCM provider interface.
|
|
29305
|
+
*
|
|
29306
|
+
* All methods return `Result<T, ScmError>` for consistent error handling
|
|
29307
|
+
* across GitHub REST API, gh CLI, and future GitLab/Gitea backends.
|
|
29308
|
+
*/
|
|
29309
|
+
interface IScmProvider {
|
|
29310
|
+
/** Platform identifier. */
|
|
29311
|
+
readonly platform: ScmPlatform;
|
|
29312
|
+
/** Repository in owner/repo format. */
|
|
29313
|
+
readonly repo: string;
|
|
29314
|
+
getIssue(number: number): Promise<Result<ScmIssue, ScmError>>;
|
|
29315
|
+
listIssues(filters?: IssueFilters): Promise<Result<readonly ScmIssue[], ScmError>>;
|
|
29316
|
+
createIssue(title: string, body: string, labels?: readonly string[]): Promise<Result<ScmIssue, ScmError>>;
|
|
29317
|
+
addLabels(issueNumber: number, labels: readonly string[]): Promise<Result<void, ScmError>>;
|
|
29318
|
+
createPR(options: CreatePROptions): Promise<Result<ScmPullRequest, ScmError>>;
|
|
29319
|
+
mergePR(prNumber: number, options?: MergePROptions): Promise<Result<void, ScmError>>;
|
|
29320
|
+
getPRStatus(prNumber: number): Promise<Result<PRStatus, ScmError>>;
|
|
29321
|
+
addComment(issueNumber: number, body: string): Promise<Result<void, ScmError>>;
|
|
29322
|
+
listComments(issueNumber: number): Promise<Result<readonly ScmComment[], ScmError>>;
|
|
29323
|
+
}
|
|
29324
|
+
/**
|
|
29325
|
+
* Review trait — PR review capabilities.
|
|
29326
|
+
*
|
|
29327
|
+
* Implemented by platforms supporting code review workflows.
|
|
29328
|
+
* Consumers declare this trait when they need PR file diffs or review posting.
|
|
29329
|
+
*/
|
|
29330
|
+
interface IScmReviewer {
|
|
29331
|
+
/** Fetch PR with full file diffs and stats. */
|
|
29332
|
+
getPullRequestDetail(prNumber: number): Promise<Result<ScmPullRequestDetail, ScmError>>;
|
|
29333
|
+
/** Post a review on a pull request. */
|
|
29334
|
+
createReview(prNumber: number, body: string, decision: ScmReviewDecision): Promise<Result<void, ScmError>>;
|
|
29335
|
+
/** Fetch issue with author association and state. */
|
|
29336
|
+
getIssueDetail(issueNumber: number): Promise<Result<ScmIssueDetail, ScmError>>;
|
|
29337
|
+
/** List comments with author associations. */
|
|
29338
|
+
listCommentDetails(issueNumber: number): Promise<Result<readonly ScmCommentDetail[], ScmError>>;
|
|
29339
|
+
}
|
|
29340
|
+
/**
|
|
29341
|
+
* User info trait — user metadata for reputation assessment.
|
|
29342
|
+
*
|
|
29343
|
+
* Implemented by platforms supporting user profile queries.
|
|
29344
|
+
* Consumers declare this trait when they need author reputation data.
|
|
29345
|
+
*/
|
|
29346
|
+
interface IScmUserInfo {
|
|
29347
|
+
/** Fetch user metadata for reputation assessment. */
|
|
29348
|
+
fetchUserMetadata(username: string): Promise<Result<ScmUserMetadata, ScmError>>;
|
|
29349
|
+
}
|
|
29350
|
+
/**
|
|
29351
|
+
* Convenience type: provider with review capabilities.
|
|
29352
|
+
* Used by PR review workflows.
|
|
29353
|
+
*/
|
|
29354
|
+
type ReviewCapableProvider = IScmProvider & IScmReviewer;
|
|
29355
|
+
/**
|
|
29356
|
+
* Convenience type: provider with all capabilities.
|
|
29357
|
+
* Used by full triage workflows that need review + user info.
|
|
29358
|
+
*/
|
|
29359
|
+
type FullCapableProvider = IScmProvider & IScmReviewer & IScmUserInfo;
|
|
29360
|
+
|
|
29171
29361
|
/**
|
|
29172
29362
|
* nexus-agents/consensus - Voting Strategies
|
|
29173
29363
|
*
|
|
@@ -31971,196 +32161,6 @@ declare class SharedMemoryStore {
|
|
|
31971
32161
|
clear(): void;
|
|
31972
32162
|
}
|
|
31973
32163
|
|
|
31974
|
-
/**
|
|
31975
|
-
* nexus-agents/scm - SCM Provider Types
|
|
31976
|
-
*
|
|
31977
|
-
* Shared types for the centralized SCM (Source Control Management) module.
|
|
31978
|
-
* Supports GitHub (REST API + gh CLI) with extensibility for GitLab/Gitea.
|
|
31979
|
-
*
|
|
31980
|
-
* @module scm/types
|
|
31981
|
-
* (Source: Issue #1136 — Centralized SCM Provider Module)
|
|
31982
|
-
*/
|
|
31983
|
-
|
|
31984
|
-
/** Supported SCM platforms. */
|
|
31985
|
-
type ScmPlatform = 'github' | 'gitlab' | 'gitea';
|
|
31986
|
-
/** Token resolution strategy. */
|
|
31987
|
-
type TokenStrategy = 'env' | 'cli' | 'config';
|
|
31988
|
-
/** Resolved SCM token with metadata. */
|
|
31989
|
-
interface ScmToken {
|
|
31990
|
-
/** The raw token value */
|
|
31991
|
-
readonly value: string;
|
|
31992
|
-
/** How the token was resolved */
|
|
31993
|
-
readonly strategy: TokenStrategy;
|
|
31994
|
-
/** SCM platform this token is for */
|
|
31995
|
-
readonly platform: ScmPlatform;
|
|
31996
|
-
}
|
|
31997
|
-
/** Token resolution configuration. */
|
|
31998
|
-
interface TokenResolverConfig {
|
|
31999
|
-
/** Explicit token (highest priority) */
|
|
32000
|
-
readonly token?: string;
|
|
32001
|
-
/** SCM platform to resolve for */
|
|
32002
|
-
readonly platform?: ScmPlatform;
|
|
32003
|
-
/** Custom env var name override */
|
|
32004
|
-
readonly envVar?: string;
|
|
32005
|
-
}
|
|
32006
|
-
/** SCM issue representation. */
|
|
32007
|
-
interface ScmIssue {
|
|
32008
|
-
readonly number: number;
|
|
32009
|
-
readonly title: string;
|
|
32010
|
-
readonly body: string;
|
|
32011
|
-
readonly labels: readonly string[];
|
|
32012
|
-
readonly author: string;
|
|
32013
|
-
readonly createdAt: string;
|
|
32014
|
-
}
|
|
32015
|
-
/** SCM pull/merge request representation. */
|
|
32016
|
-
interface ScmPullRequest {
|
|
32017
|
-
readonly number: number;
|
|
32018
|
-
readonly title: string;
|
|
32019
|
-
readonly body: string;
|
|
32020
|
-
readonly author: string;
|
|
32021
|
-
readonly base: string;
|
|
32022
|
-
readonly head: string;
|
|
32023
|
-
readonly url: string;
|
|
32024
|
-
}
|
|
32025
|
-
/** SCM comment representation. */
|
|
32026
|
-
interface ScmComment {
|
|
32027
|
-
readonly id: number;
|
|
32028
|
-
readonly body: string;
|
|
32029
|
-
readonly author: string;
|
|
32030
|
-
readonly createdAt: string;
|
|
32031
|
-
}
|
|
32032
|
-
/** PR creation options. */
|
|
32033
|
-
interface CreatePROptions {
|
|
32034
|
-
readonly title: string;
|
|
32035
|
-
readonly body: string;
|
|
32036
|
-
readonly head: string;
|
|
32037
|
-
readonly base: string;
|
|
32038
|
-
}
|
|
32039
|
-
/** PR merge options. */
|
|
32040
|
-
interface MergePROptions {
|
|
32041
|
-
readonly method?: 'merge' | 'squash' | 'rebase';
|
|
32042
|
-
readonly commitTitle?: string;
|
|
32043
|
-
readonly commitMessage?: string;
|
|
32044
|
-
readonly deleteBranch?: boolean;
|
|
32045
|
-
}
|
|
32046
|
-
/** PR status for merge eligibility. */
|
|
32047
|
-
interface PRStatus {
|
|
32048
|
-
readonly mergeable: boolean;
|
|
32049
|
-
readonly checksStatus: 'pending' | 'success' | 'failure';
|
|
32050
|
-
readonly reviewStatus: 'approved' | 'pending' | 'changes_requested';
|
|
32051
|
-
}
|
|
32052
|
-
/** Issue filter options. */
|
|
32053
|
-
interface IssueFilters {
|
|
32054
|
-
readonly labels?: readonly string[];
|
|
32055
|
-
readonly state?: 'open' | 'closed' | 'all';
|
|
32056
|
-
readonly limit?: number;
|
|
32057
|
-
}
|
|
32058
|
-
/** Unified SCM error with platform-aware context. */
|
|
32059
|
-
declare class ScmError extends Error {
|
|
32060
|
-
readonly platform: ScmPlatform;
|
|
32061
|
-
readonly statusCode?: number | undefined;
|
|
32062
|
-
readonly context?: Record<string, unknown> | undefined;
|
|
32063
|
-
constructor(message: string, platform: ScmPlatform, statusCode?: number | undefined, context?: Record<string, unknown> | undefined);
|
|
32064
|
-
}
|
|
32065
|
-
/** File change in a pull request. */
|
|
32066
|
-
interface ScmFileChange {
|
|
32067
|
-
readonly filename: string;
|
|
32068
|
-
readonly status: 'added' | 'removed' | 'modified' | 'renamed' | 'copied';
|
|
32069
|
-
readonly additions: number;
|
|
32070
|
-
readonly deletions: number;
|
|
32071
|
-
readonly patch?: string;
|
|
32072
|
-
readonly previousFilename?: string;
|
|
32073
|
-
}
|
|
32074
|
-
/** Extended PR with file diffs and stats. Used by IScmReviewer. */
|
|
32075
|
-
interface ScmPullRequestDetail extends ScmPullRequest {
|
|
32076
|
-
readonly draft: boolean;
|
|
32077
|
-
readonly authorAssociation: string;
|
|
32078
|
-
readonly labels: readonly string[];
|
|
32079
|
-
readonly files: readonly ScmFileChange[];
|
|
32080
|
-
readonly additions: number;
|
|
32081
|
-
readonly deletions: number;
|
|
32082
|
-
readonly headSha: string;
|
|
32083
|
-
}
|
|
32084
|
-
/** Extended issue with association and state. Used by IScmReviewer. */
|
|
32085
|
-
interface ScmIssueDetail extends ScmIssue {
|
|
32086
|
-
readonly authorAssociation: string;
|
|
32087
|
-
readonly state: string;
|
|
32088
|
-
readonly url: string;
|
|
32089
|
-
}
|
|
32090
|
-
/** Extended comment with author association. */
|
|
32091
|
-
interface ScmCommentDetail extends ScmComment {
|
|
32092
|
-
readonly authorAssociation: string;
|
|
32093
|
-
}
|
|
32094
|
-
/** Review decision for a pull request. */
|
|
32095
|
-
type ScmReviewDecision = 'approve' | 'request_changes' | 'comment';
|
|
32096
|
-
/** User metadata for reputation assessment. */
|
|
32097
|
-
interface ScmUserMetadata {
|
|
32098
|
-
readonly login: string;
|
|
32099
|
-
readonly name: string | null;
|
|
32100
|
-
readonly company: string | null;
|
|
32101
|
-
readonly followers: number;
|
|
32102
|
-
readonly following: number;
|
|
32103
|
-
readonly publicRepos: number;
|
|
32104
|
-
readonly createdAt: string;
|
|
32105
|
-
}
|
|
32106
|
-
/**
|
|
32107
|
-
* Core SCM provider interface.
|
|
32108
|
-
*
|
|
32109
|
-
* All methods return `Result<T, ScmError>` for consistent error handling
|
|
32110
|
-
* across GitHub REST API, gh CLI, and future GitLab/Gitea backends.
|
|
32111
|
-
*/
|
|
32112
|
-
interface IScmProvider {
|
|
32113
|
-
/** Platform identifier. */
|
|
32114
|
-
readonly platform: ScmPlatform;
|
|
32115
|
-
/** Repository in owner/repo format. */
|
|
32116
|
-
readonly repo: string;
|
|
32117
|
-
getIssue(number: number): Promise<Result<ScmIssue, ScmError>>;
|
|
32118
|
-
listIssues(filters?: IssueFilters): Promise<Result<readonly ScmIssue[], ScmError>>;
|
|
32119
|
-
createIssue(title: string, body: string, labels?: readonly string[]): Promise<Result<ScmIssue, ScmError>>;
|
|
32120
|
-
addLabels(issueNumber: number, labels: readonly string[]): Promise<Result<void, ScmError>>;
|
|
32121
|
-
createPR(options: CreatePROptions): Promise<Result<ScmPullRequest, ScmError>>;
|
|
32122
|
-
mergePR(prNumber: number, options?: MergePROptions): Promise<Result<void, ScmError>>;
|
|
32123
|
-
getPRStatus(prNumber: number): Promise<Result<PRStatus, ScmError>>;
|
|
32124
|
-
addComment(issueNumber: number, body: string): Promise<Result<void, ScmError>>;
|
|
32125
|
-
listComments(issueNumber: number): Promise<Result<readonly ScmComment[], ScmError>>;
|
|
32126
|
-
}
|
|
32127
|
-
/**
|
|
32128
|
-
* Review trait — PR review capabilities.
|
|
32129
|
-
*
|
|
32130
|
-
* Implemented by platforms supporting code review workflows.
|
|
32131
|
-
* Consumers declare this trait when they need PR file diffs or review posting.
|
|
32132
|
-
*/
|
|
32133
|
-
interface IScmReviewer {
|
|
32134
|
-
/** Fetch PR with full file diffs and stats. */
|
|
32135
|
-
getPullRequestDetail(prNumber: number): Promise<Result<ScmPullRequestDetail, ScmError>>;
|
|
32136
|
-
/** Post a review on a pull request. */
|
|
32137
|
-
createReview(prNumber: number, body: string, decision: ScmReviewDecision): Promise<Result<void, ScmError>>;
|
|
32138
|
-
/** Fetch issue with author association and state. */
|
|
32139
|
-
getIssueDetail(issueNumber: number): Promise<Result<ScmIssueDetail, ScmError>>;
|
|
32140
|
-
/** List comments with author associations. */
|
|
32141
|
-
listCommentDetails(issueNumber: number): Promise<Result<readonly ScmCommentDetail[], ScmError>>;
|
|
32142
|
-
}
|
|
32143
|
-
/**
|
|
32144
|
-
* User info trait — user metadata for reputation assessment.
|
|
32145
|
-
*
|
|
32146
|
-
* Implemented by platforms supporting user profile queries.
|
|
32147
|
-
* Consumers declare this trait when they need author reputation data.
|
|
32148
|
-
*/
|
|
32149
|
-
interface IScmUserInfo {
|
|
32150
|
-
/** Fetch user metadata for reputation assessment. */
|
|
32151
|
-
fetchUserMetadata(username: string): Promise<Result<ScmUserMetadata, ScmError>>;
|
|
32152
|
-
}
|
|
32153
|
-
/**
|
|
32154
|
-
* Convenience type: provider with review capabilities.
|
|
32155
|
-
* Used by PR review workflows.
|
|
32156
|
-
*/
|
|
32157
|
-
type ReviewCapableProvider = IScmProvider & IScmReviewer;
|
|
32158
|
-
/**
|
|
32159
|
-
* Convenience type: provider with all capabilities.
|
|
32160
|
-
* Used by full triage workflows that need review + user info.
|
|
32161
|
-
*/
|
|
32162
|
-
type FullCapableProvider = IScmProvider & IScmReviewer & IScmUserInfo;
|
|
32163
|
-
|
|
32164
32164
|
/**
|
|
32165
32165
|
* nexus-agents/scm - Centralized Token Resolver
|
|
32166
32166
|
*
|
package/dist/index.js
CHANGED
|
@@ -519,13 +519,13 @@ import {
|
|
|
519
519
|
validateWorkflow,
|
|
520
520
|
validateWorkflowDependencies,
|
|
521
521
|
withLogging
|
|
522
|
-
} from "./chunk-
|
|
522
|
+
} from "./chunk-G3CYK3WA.js";
|
|
523
523
|
import {
|
|
524
524
|
getTokenEnvVars,
|
|
525
525
|
hasToken,
|
|
526
526
|
resolveToken
|
|
527
527
|
} from "./chunk-EAT4GTMT.js";
|
|
528
|
-
import "./chunk-
|
|
528
|
+
import "./chunk-OK6U5N5Y.js";
|
|
529
529
|
import {
|
|
530
530
|
OPENAI_MODELS,
|
|
531
531
|
OPENAI_MODEL_ALIASES,
|
|
@@ -740,7 +740,7 @@ import {
|
|
|
740
740
|
getKnownNexusVarNames,
|
|
741
741
|
startStdioServer,
|
|
742
742
|
validateNexusEnv
|
|
743
|
-
} from "./chunk-
|
|
743
|
+
} from "./chunk-ZNR3ZVC6.js";
|
|
744
744
|
import {
|
|
745
745
|
AvailabilityCache,
|
|
746
746
|
filterAvailableModels,
|
|
@@ -9,14 +9,16 @@ import {
|
|
|
9
9
|
determineDecision,
|
|
10
10
|
extractStringField,
|
|
11
11
|
extractSummary,
|
|
12
|
+
fetchAccountAgeDays,
|
|
12
13
|
formatReviewComment,
|
|
14
|
+
gatePRAuthor,
|
|
13
15
|
generateSummary,
|
|
14
16
|
parseCategory,
|
|
15
17
|
parseFindings,
|
|
16
18
|
parseSeverity,
|
|
17
19
|
sumFindings
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-G5XKEUAP.js";
|
|
21
|
+
import "./chunk-OK6U5N5Y.js";
|
|
20
22
|
import "./chunk-NR4NSTJH.js";
|
|
21
23
|
import "./chunk-W5I6L4UT.js";
|
|
22
24
|
import "./chunk-CH7QIDHQ.js";
|
|
@@ -32,11 +34,13 @@ export {
|
|
|
32
34
|
determineDecision,
|
|
33
35
|
extractStringField,
|
|
34
36
|
extractSummary,
|
|
37
|
+
fetchAccountAgeDays,
|
|
35
38
|
formatReviewComment,
|
|
39
|
+
gatePRAuthor,
|
|
36
40
|
generateSummary,
|
|
37
41
|
parseCategory,
|
|
38
42
|
parseFindings,
|
|
39
43
|
parseSeverity,
|
|
40
44
|
sumFindings
|
|
41
45
|
};
|
|
42
|
-
//# sourceMappingURL=pr-reviewer-helpers-
|
|
46
|
+
//# sourceMappingURL=pr-reviewer-helpers-RBUEJI6V.js.map
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
runWizard,
|
|
9
9
|
setupCommand,
|
|
10
10
|
setupCommandAsync
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-74AO4RKT.js";
|
|
12
12
|
import "./chunk-2SMTCNXP.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-ZNR3ZVC6.js";
|
|
14
14
|
import "./chunk-SFZESA5O.js";
|
|
15
15
|
import "./chunk-6Q33PBXC.js";
|
|
16
16
|
import "./chunk-3HTUYAKS.js";
|
|
@@ -34,4 +34,4 @@ export {
|
|
|
34
34
|
setupCommand,
|
|
35
35
|
setupCommandAsync
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=setup-command-
|
|
37
|
+
//# sourceMappingURL=setup-command-AZAWBZOP.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexus-agents",
|
|
3
|
-
"version": "2.92.
|
|
3
|
+
"version": "2.92.1",
|
|
4
4
|
"description": "Intelligent orchestration platform for AI coding tools — routes tasks to the best model, learns from outcomes, and enforces quality through multi-model consensus",
|
|
5
5
|
"mcpName": "io.github.nexus-substrate/nexus-agents",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dogfooding/pr-reviewer-helpers.ts"],"sourcesContent":["/**\n * nexus-agents/dogfooding - PR Reviewer Helpers\n *\n * Helper functions for PR review formatting and aggregation.\n *\n * @module dogfooding/pr-reviewer-helpers\n * (Source: Issue #161, Alignment Roadmap Phase 3)\n */\n\nimport { randomUUID } from 'node:crypto';\nimport type {\n PRMetadata,\n PRReviewResult,\n PRTrustAssessment,\n ExpertReviewResult,\n ReviewFinding,\n ReviewCategory,\n ReviewSeverity,\n ReviewDecision,\n} from './pr-review-types.js';\nimport {\n SEVERITY_ORDER,\n CATEGORY_DISPLAY_NAMES,\n SEVERITY_EMOJI,\n DECISION_EMOJI,\n} from './pr-review-types.js';\nimport { sanitizeInput } from '../security/input-sanitizer.js';\nimport { assessReputation } from '../security/reputation-model.js';\nimport type {\n ReputationCache,\n ReputationGateDecision,\n ReputationAssessment,\n GitHubUserMetadata,\n} from '../security/reputation-model.js';\nimport type { ClassifyResult } from '../security/trust-classifier.js';\n\n// =============================================================================\n// Reputation Gating Helpers (#3123, epic #3118 Phase 5)\n// =============================================================================\n\n/**\n * Assesses the PR author's reputation from the signals available in the PR\n * event: author association + injection flags from the (sanitized) PR body.\n * Account-age / contribution signals are NOT fetched here yet — OMITTED, never\n * fabricated, so the engine skips those signals. Returns undefined when\n * reputation is disabled.\n */\nexport function assessPRReputation(\n pr: PRMetadata,\n cache: ReputationCache,\n enableReputation: boolean\n): ReputationAssessment | undefined {\n if (!enableReputation) return undefined;\n // Only `injectionFlags` is consumed here, and injection detection is\n // role-independent — the userRole arg ('unknown') and the sanitizer's own\n // trustTier output are intentionally irrelevant to this call.\n const sanitizeResult = sanitizeInput(pr.body, 'unknown', pr.author);\n const metadata: GitHubUserMetadata = {\n username: pr.author,\n authorAssociation: pr.authorAssociation,\n injectionFlags: sanitizeResult.injectionFlags,\n };\n return assessReputation(metadata, cache);\n}\n\n/** Builds the observability assessment surfaced on the review result (#3123). */\nexport function buildPRTrustAssessment(\n trustResult: ClassifyResult,\n reputation: ReputationAssessment | undefined,\n gateDecision: ReputationGateDecision\n): PRTrustAssessment {\n // Tier-1 (owner/allowlisted) authors cannot be suspicious.\n const isTier1 = trustResult.trustTier === '1';\n return {\n trustTier: trustResult.trustTier,\n userRole: trustResult.userRole,\n isAllowlisted: trustResult.isAllowlisted,\n reputationScore: reputation?.reputationScore,\n isSuspicious: isTier1 ? false : (reputation?.isSuspicious ?? false),\n enforcedTrustTier: gateDecision.enforcedTier,\n reputationReconciledTier: gateDecision.reconciledTier,\n gatingMode: gateDecision.mode,\n };\n}\n\n// =============================================================================\n// Parsing Helpers\n// =============================================================================\n\nexport function parseSeverity(value: unknown): ReviewSeverity {\n if (typeof value === 'string') {\n const lower = value.toLowerCase();\n if (lower in SEVERITY_ORDER) return lower as ReviewSeverity;\n }\n return 'medium';\n}\n\nexport function parseCategory(value: unknown): ReviewCategory {\n if (typeof value === 'string') {\n const lower = value.toLowerCase();\n if (lower in CATEGORY_DISPLAY_NAMES) return lower as ReviewCategory;\n }\n return 'code_quality';\n}\n\nexport function extractSummary(output: Record<string, unknown>): string {\n if (typeof output.summary === 'string') return output.summary;\n if (typeof output.content === 'string') return output.content;\n if (typeof output.message === 'string') return output.message;\n return 'Review completed';\n}\n\nexport function extractStringField(\n record: Record<string, unknown>,\n ...keys: string[]\n): string | undefined {\n for (const key of keys) {\n const value = record[key];\n if (typeof value === 'string') return value;\n }\n return undefined;\n}\n\n// =============================================================================\n// Finding Parsing\n// =============================================================================\n\nexport function parseFindings(\n output: Record<string, unknown>,\n expertId: string,\n minSeverity: ReviewSeverity\n): ReviewFinding[] {\n const minOrder = SEVERITY_ORDER[minSeverity];\n const sources = collectSources(output);\n\n const findings: ReviewFinding[] = [];\n for (const source of sources) {\n if (!Array.isArray(source)) continue;\n for (const item of source) {\n const finding = parseOneFinding(item, expertId, minOrder);\n if (finding !== null) findings.push(finding);\n }\n }\n return findings;\n}\n\nfunction collectSources(output: Record<string, unknown>): unknown[] {\n return [\n output.findings,\n output.vulnerabilities,\n output.issues,\n (output as { content?: { findings?: unknown } }).content,\n ];\n}\n\nfunction parseOneFinding(item: unknown, expertId: string, minOrder: number): ReviewFinding | null {\n if (typeof item !== 'object' || item === null) return null;\n\n const record = item as Record<string, unknown>;\n const severity = parseSeverity(record.severity);\n if (SEVERITY_ORDER[severity] < minOrder) return null;\n\n return {\n id: randomUUID(),\n category: parseCategory(record.category),\n severity,\n title: extractStringField(record, 'title', 'name') ?? 'Finding',\n description: extractStringField(record, 'description', 'message') ?? '',\n file: typeof record.file === 'string' ? record.file : undefined,\n line: typeof record.line === 'number' ? record.line : undefined,\n suggestion: typeof record.suggestion === 'string' ? record.suggestion : undefined,\n expertId,\n confidence: typeof record.confidence === 'number' ? record.confidence : 0.7,\n };\n}\n\n// =============================================================================\n// Decision Helpers\n// =============================================================================\n\nexport function determineApproval(findings: ReviewFinding[]): boolean {\n const hasBlocking = findings.some((f) => f.severity === 'critical' || f.severity === 'high');\n return !hasBlocking;\n}\n\nexport function determineDecision(\n reviews: ExpertReviewResult[],\n findings: ReviewFinding[]\n): ReviewDecision {\n const hasCritical = findings.some((f) => f.severity === 'critical');\n const hasHigh = findings.some((f) => f.severity === 'high');\n const allApproved = reviews.every((r) => r.approved);\n\n if (hasCritical) return 'request_changes';\n if (hasHigh && !allApproved) return 'request_changes';\n if (findings.length > 0) return 'comment';\n return 'approve';\n}\n\nexport function calculateConsensus(reviews: ExpertReviewResult[]): number {\n if (reviews.length === 0) return 1;\n const approvals = reviews.filter((r) => r.approved).length;\n return approvals / reviews.length;\n}\n\n// =============================================================================\n// Counting Helpers\n// =============================================================================\n\nexport function countBySeverity(findings: ReviewFinding[]): Record<ReviewSeverity, number> {\n const counts: Record<ReviewSeverity, number> = {\n critical: 0,\n high: 0,\n medium: 0,\n low: 0,\n info: 0,\n };\n\n for (const f of findings) {\n counts[f.severity]++;\n }\n\n return counts;\n}\n\nexport function countByCategory(findings: ReviewFinding[]): Record<ReviewCategory, number> {\n const counts: Record<ReviewCategory, number> = {\n security: 0,\n performance: 0,\n code_quality: 0,\n testing: 0,\n documentation: 0,\n architecture: 0,\n };\n\n for (const f of findings) {\n counts[f.category]++;\n }\n\n return counts;\n}\n\nexport function sumFindings(counts: Record<ReviewSeverity, number>): number {\n return Object.values(counts).reduce((a, b) => a + b, 0);\n}\n\n// =============================================================================\n// Summary Generation\n// =============================================================================\n\nexport function generateSummary(\n pr: PRMetadata,\n reviews: ExpertReviewResult[],\n decision: ReviewDecision\n): string {\n const expertSummaries = reviews\n .map((r) => `- **${CATEGORY_DISPLAY_NAMES[r.expertType as ReviewCategory]}**: ${r.summary}`)\n .join('\\n');\n\n return `Reviewed PR #${String(pr.number)}: ${pr.title}\n\n**Decision:** ${decision.replaceAll('_', ' ')}\n**Experts consulted:** ${String(reviews.length)}\n\n${expertSummaries}`;\n}\n\n// =============================================================================\n// GitHub Comment Formatting\n// =============================================================================\n\n/**\n * Formats the review result as a GitHub comment.\n */\nexport function formatReviewComment(result: PRReviewResult): string {\n const emoji = DECISION_EMOJI[result.decision];\n const decisionText = result.decision.replaceAll('_', ' ').toUpperCase();\n\n const findingsSection = formatFindingsSection(result);\n const statsSection = formatStatsSection(result);\n\n return `## ${emoji} Nexus Agents Review: ${decisionText}\n\n${result.summary}\n\n${findingsSection}\n\n${statsSection}\n\n---\n*Reviewed by [nexus-agents](https://github.com/nexus-substrate/nexus-agents) in ${String(result.totalDurationMs)}ms*`;\n}\n\nfunction formatFindingsSection(result: PRReviewResult): string {\n const allFindings = result.expertReviews.flatMap((r) => r.findings);\n\n if (allFindings.length === 0) {\n return '_No issues found._';\n }\n\n const sorted = [...allFindings].sort(\n (a, b) => SEVERITY_ORDER[b.severity] - SEVERITY_ORDER[a.severity]\n );\n\n const lines = ['### Findings', ''];\n\n for (const f of sorted) {\n const emoji = SEVERITY_EMOJI[f.severity];\n const loc =\n f.file !== undefined\n ? ` (\\`${f.file}${f.line !== undefined ? `:${String(f.line)}` : ''}\\`)`\n : '';\n lines.push(`${emoji} **${f.title}**${loc}`);\n lines.push(`> ${f.description}`);\n if (f.suggestion !== undefined) {\n lines.push(`> 💡 ${f.suggestion}`);\n }\n lines.push('');\n }\n\n return lines.join('\\n');\n}\n\nfunction formatStatsSection(result: PRReviewResult): string {\n const { findingsBySeverity } = result;\n const total = sumFindings(findingsBySeverity);\n\n const parts: string[] = [];\n for (const severity of ['critical', 'high', 'medium', 'low', 'info'] as ReviewSeverity[]) {\n const count = findingsBySeverity[severity];\n if (count > 0) {\n parts.push(`${SEVERITY_EMOJI[severity]} ${String(count)} ${severity}`);\n }\n }\n\n return `<details>\n<summary>Review Statistics (${String(total)} findings)</summary>\n\n- Experts: ${String(result.expertCount)}\n- Consensus: ${(result.consensusScore * 100).toFixed(0)}%\n- Duration: ${String(result.totalDurationMs)}ms\n- Findings: ${parts.join(', ') || 'none'}\n\n</details>`;\n}\n\n// =============================================================================\n// Failed Review Factory\n// =============================================================================\n\nexport function createFailedReview(\n expertId: string,\n category: ReviewCategory,\n durationMs: number,\n error: string\n): ExpertReviewResult {\n return {\n expertId,\n expertType: category,\n approved: true, // Don't block on failures\n summary: `Review failed: ${error}`,\n findings: [],\n durationMs,\n conf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eAAQ,EAAE,UAAU,EAAE;AAAA,IACnC;AACA,UAAM,KAAK,EAAE;AAAA,EACf;AAEA,SAAO,MAAM,KAAK,IAAI;AACxB;AAEA,SAAS,mBAAmB,QAAgC;AAC1D,QAAM,EAAE,mBAAmB,IAAI;AAC/B,QAAM,QAAQ,YAAY,kBAAkB;AAE5C,QAAM,QAAkB,CAAC;AACzB,aAAW,YAAY,CAAC,YAAY,QAAQ,UAAU,OAAO,MAAM,GAAuB;AACxF,UAAM,QAAQ,mBAAmB,QAAQ;AACzC,QAAI,QAAQ,GAAG;AACb,YAAM,KAAK,GAAG,eAAe,QAAQ,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,QAAQ,EAAE;AAAA,IACvE;AAAA,EACF;AAEA,SAAO;AAAA,8BACqB,OAAO,KAAK,CAAC;AAAA;AAAA,aAE9B,OAAO,OAAO,WAAW,CAAC;AAAA,gBACvB,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC;AAAA,cACzC,OAAO,OAAO,eAAe,CAAC;AAAA,cAC9B,MAAM,KAAK,IAAI,KAAK,MAAM;AAAA;AAAA;AAGxC;AAMO,SAAS,mBACd,UACA,UACA,YACA,OACoB;AACpB,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,UAAU;AAAA;AAAA,IACV,SAAS,kBAAkB,KAAK;AAAA,IAChC,UAAU,CAAC;AAAA,IACX;AAAA,IACA,YAAY;AAAA,EACd;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dogfooding/pr-review-types.ts"],"sourcesContent":["/**\n * nexus-agents/dogfooding - PR Review Types\n *\n * Type definitions for automated pull request review using\n * multi-agent collaboration.\n *\n * @module dogfooding/pr-review-types\n * (Source: Issue #161, Alignment Roadmap Phase 3)\n */\n\nimport { z } from 'zod';\n\n/**\n * Pull request file change information.\n */\nexport interface PRFileChange {\n /** File path */\n readonly filename: string;\n /** Change status */\n readonly status: 'added' | 'removed' | 'modified' | 'renamed' | 'copied';\n /** Number of additions */\n readonly additions: number;\n /** Number of deletions */\n readonly deletions: number;\n /** File patch/diff content */\n readonly patch?: string | undefined;\n /** Previous filename if renamed */\n readonly previousFilename?: string | undefined;\n}\n\n/**\n * Pull request metadata from GitHub API.\n */\nexport interface PRMetadata {\n /** PR number */\n readonly number: number;\n /** PR title */\n readonly title: string;\n /** PR description/body */\n readonly body: string;\n /** Author username */\n readonly author: string;\n /** GitHub API author_association (e.g., 'OWNER', 'COLLABORATOR', 'NONE') */\n readonly authorAssociation: string;\n /** Base branch */\n readonly base: string;\n /** Head branch */\n readonly head: string;\n /** Repository owner */\n readonly owner: string;\n /** Repository name */\n readonly repo: string;\n /** PR URL */\n readonly url: string;\n /** Whether PR is draft */\n readonly draft: boolean;\n /** PR labels */\n readonly labels: readonly string[];\n /** Changed files */\n readonly files: readonly PRFileChange[];\n /** Total additions */\n readonly additions: number;\n /** Total deletions */\n readonly deletions: number;\n /** Commit SHA of head */\n readonly headSha: string;\n}\n\n/**\n * Review severity levels.\n */\nexport type ReviewSeverity = 'critical' | 'high' | 'medium' | 'low' | 'info';\n\n/**\n * Review category for organizing findings.\n */\nexport type ReviewCategory =\n | 'security'\n | 'performance'\n | 'code_quality'\n | 'testing'\n | 'documentation'\n | 'architecture';\n\n/**\n * Individual review finding from an expert.\n */\nexport interface ReviewFinding {\n /** Unique finding ID */\n readonly id: string;\n /** Category of finding */\n readonly category: ReviewCategory;\n /** Severity level */\n readonly severity: ReviewSeverity;\n /** Finding title */\n readonly title: string;\n /** Detailed description */\n readonly description: string;\n /** Affected file (if applicable) */\n readonly file?: string | undefined;\n /** Line number (if applicable) */\n readonly line?: number | undefined;\n /** Suggested fix */\n readonly suggestion?: string | undefined;\n /** Expert that found this issue */\n readonly expertId: string;\n /** Confidence score (0-1) */\n readonly confidence: number;\n}\n\n/**\n * Review result from a single expert agent.\n */\nexport interface ExpertReviewResult {\n /** Expert ID */\n readonly expertId: string;\n /** Expert role/type */\n readonly expertType: string;\n /** Overall approval */\n readonly approved: boolean;\n /** Review summary */\n readonly summary: string;\n /** Individual findings */\n readonly findings: readonly ReviewFinding[];\n /** Execution time in ms */\n readonly durationMs: number;\n /** Confidence in review (0-1) */\n readonly confidence: number;\n}\n\n/**\n * Aggregated review decision after multi-agent debate.\n */\nexport type ReviewDecision = 'approve' | 'request_changes' | 'comment';\n\n/**\n * Complete PR review result from multi-agent collaboration.\n */\n/**\n * Trust + reputation assessment of the PR author, surfaced for observability\n * (#3123, epic #3118 Phase 5). Mirrors `issue_triage`'s assessment.\n */\nexport interface PRTrustAssessment {\n /** Classifier trust tier (1-4) from author association. */\n readonly trustTier: string;\n /** Author's GitHub role. */\n readonly userRole: string;\n /** Whether the author is on the maintainer allowlist. */\n readonly isAllowlisted: boolean;\n /** Reputation score (0-100) when reputation is enabled. */\n readonly reputationScore?: number | undefined;\n /** Whether the author is flagged as suspicious. */\n readonly isSuspicious: boolean;\n /** Tier the policy gate ACTUALLY enforced (== trustTier under audit/off). */\n readonly enforcedTrustTier?: string | undefined;\n /** Tier reputation reconciliation computed — what enforce mode WOULD gate on. */\n readonly reputationReconciledTier?: string | undefined;\n /** Reputation-gating rollout mode applied: `off` | `audit` | `enforce`. */\n readonly gatingMode?: string | undefined;\n}\n\nexport interface PRReviewResult {\n /** Pull request number */\n readonly prNumber: number;\n /** Repository full name (owner/repo) */\n readonly repository: string;\n /** Overall decision */\n readonly decision: ReviewDecision;\n /** Executive summary */\n readonly summary: string;\n /** Individual expert reviews */\n readonly expertReviews: readonly ExpertReviewResult[];\n /** Aggregated findings by severity */\n readonly findingsBySeverity: Readonly<Record<ReviewSeverity, number>>;\n /** Aggregated findings by category */\n readonly findingsByCategory: Readonly<Record<ReviewCategory, number>>;\n /** Total execution time in ms */\n readonly totalDurationMs: number;\n /** Number of experts that participated */\n readonly expertCount: number;\n /** Consensus score (0-1) */\n readonly consensusScore: number;\n /** Debate rounds completed */\n readonly debateRounds: number;\n /** Timestamp of review */\n readonly timestamp: string;\n /** Author trust + reputation assessment (#3123). */\n readonly trustAssessment: PRTrustAssessment;\n}\n\n/**\n * Configuration for PR review.\n */\nexport interface PRReviewConfig {\n /** Experts to include in review */\n readonly experts: readonly ReviewCategory[];\n /** Maximum debate rounds */\n readonly maxDebateRounds: number;\n /** Consensus threshold (0-1) */\n readonly consensusThreshold: number;\n /** Minimum severity to report */\n readonly minSeverity: ReviewSeverity;\n /** Whether to post inline comments */\n readonly enableInlineComments: boolean;\n /** Whether to run in dry-run mode (no GitHub posting) */\n readonly dryRun: boolean;\n /** Whether to assess author reputation and gate on it (#3123). */\n readonly enableReputation: boolean;\n /** GitHub token for API access */\n readonly githubToken?: string | undefined;\n /** Model adapter configuration */\n readonly modelConfig?: {\n readonly temperature?: number;\n readonly maxTokens?: number;\n };\n}\n\n/**\n * Default PR review configuration.\n */\nexport const DEFAULT_PR_REVIEW_CONFIG: PRReviewConfig = {\n experts: ['security', 'code_quality', 'testing'],\n maxDebateRounds: 3,\n consensusThreshold: 0.7,\n minSeverity: 'low',\n enableInlineComments: true,\n dryRun: false,\n enableReputation: true,\n modelConfig: {\n temperature: 0.3,\n maxTokens: 8192,\n },\n};\n\n/**\n * Zod schema for PR review configuration.\n */\nexport const PRReviewConfigSchema = z.object({\n experts: z\n .array(\n z.enum([\n 'security',\n 'performance',\n 'code_quality',\n 'testing',\n 'documentation',\n 'architecture',\n ])\n )\n .default(['security', 'code_quality', 'testing']),\n maxDebateRounds: z.number().int().min(1).max(10).default(3),\n consensusThreshold: z.number().min(0).max(1).default(0.7),\n minSeverity: z.enum(['critical', 'high', 'medium', 'low', 'info']).default('low'),\n enableInlineComments: z.boolean().default(true),\n dryRun: z.boolean().default(false),\n enableReputation: z.boolean().default(true),\n githubToken: z.string().optional(),\n modelConfig: z\n .object({\n temperature: z.number().min(0).max(2).default(0.3),\n maxTokens: z.number().int().positive().default(8192),\n })\n .optional(),\n});\n\n/**\n * Severity order for comparison.\n */\nexport const SEVERITY_ORDER: Record<ReviewSeverity, number> = {\n critical: 5,\n high: 4,\n medium: 3,\n low: 2,\n info: 1,\n};\n\n/**\n * Category display names.\n */\nexport const CATEGORY_DISPLAY_NAMES: Record<ReviewCategory, string> = {\n security: 'Security',\n performance: 'Performance',\n code_quality: 'Code Quality',\n testing: 'Testing',\n documentation: 'Documentation',\n architecture: 'Architecture',\n};\n\n/**\n * Severity emoji for GitHub comments.\n */\nexport const SEVERITY_EMOJI: Record<ReviewSeverity, string> = {\n critical: ':rotating_light:',\n high: ':warning:',\n medium: ':yellow_circle:',\n low: ':large_blue_circle:',\n info: ':information_source:',\n};\n\n/**\n * Decision emoji for GitHub comments.\n */\nexport const DECISION_EMOJI: Record<ReviewDecision, string> = {\n approve: ':white_check_mark:',\n request_changes: ':x:',\n comment: ':speech_balloon:',\n};\n"],"mappings":";AAUA,SAAS,SAAS;AAkNX,IAAM,2BAA2C;AAAA,EACtD,SAAS,CAAC,YAAY,gBAAgB,SAAS;AAAA,EAC/C,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,sBAAsB;AAAA,EACtB,QAAQ;AAAA,EACR,kBAAkB;AAAA,EAClB,aAAa;AAAA,IACX,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AACF;AAKO,IAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,SAAS,EACN;AAAA,IACC,EAAE,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH,EACC,QAAQ,CAAC,YAAY,gBAAgB,SAAS,CAAC;AAAA,EAClD,iBAAiB,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC;AAAA,EAC1D,oBAAoB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG;AAAA,EACxD,aAAa,EAAE,KAAK,CAAC,YAAY,QAAQ,UAAU,OAAO,MAAM,CAAC,EAAE,QAAQ,KAAK;AAAA,EAChF,sBAAsB,EAAE,QAAQ,EAAE,QAAQ,IAAI;AAAA,EAC9C,QAAQ,EAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EACjC,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,IAAI;AAAA,EAC1C,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,aAAa,EACV,OAAO;AAAA,IACN,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG;AAAA,IACjD,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,IAAI;AAAA,EACrD,CAAC,EACA,SAAS;AACd,CAAC;AAKM,IAAM,iBAAiD;AAAA,EAC5D,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,MAAM;AACR;AAKO,IAAM,yBAAyD;AAAA,EACpE,UAAU;AAAA,EACV,aAAa;AAAA,EACb,cAAc;AAAA,EACd,SAAS;AAAA,EACT,eAAe;AAAA,EACf,cAAc;AAChB;AAKO,IAAM,iBAAiD;AAAA,EAC5D,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,MAAM;AACR;AAKO,IAAM,iBAAiD;AAAA,EAC5D,SAAS;AAAA,EACT,iBAAiB;AAAA,EACjB,SAAS;AACX;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|