opencode-swarm 6.67.1 → 6.68.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/cli/index.js +1201 -167
- package/dist/commands/brainstorm.d.ts +13 -0
- package/dist/commands/brainstorm.test.d.ts +1 -0
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/qa-gates.d.ts +15 -0
- package/dist/commands/qa-gates.test.d.ts +1 -0
- package/dist/commands/registry.d.ts +12 -0
- package/dist/db/global-db.d.ts +22 -0
- package/dist/db/global-db.test.d.ts +7 -0
- package/dist/db/index.d.ts +13 -0
- package/dist/db/project-db.d.ts +40 -0
- package/dist/db/project-db.test.d.ts +4 -0
- package/dist/db/qa-gate-profile.d.ts +89 -0
- package/dist/db/qa-gate-profile.test.d.ts +4 -0
- package/dist/diff/__tests__/semantic-classifier.test.d.ts +1 -0
- package/dist/diff/__tests__/summary-generator.test.d.ts +1 -0
- package/dist/diff/semantic-classifier.d.ts +55 -0
- package/dist/diff/summary-generator.d.ts +33 -0
- package/dist/index.js +3070 -919
- package/dist/mutation/__tests__/engine.adversarial.test.d.ts +1 -0
- package/dist/mutation/__tests__/engine.test.d.ts +1 -0
- package/dist/mutation/__tests__/equivalence.adversarial.test.d.ts +1 -0
- package/dist/mutation/__tests__/equivalence.test.d.ts +1 -0
- package/dist/mutation/__tests__/gate.adversarial.test.d.ts +1 -0
- package/dist/mutation/__tests__/gate.test.d.ts +1 -0
- package/dist/mutation/engine.d.ts +47 -0
- package/dist/mutation/equivalence.d.ts +35 -0
- package/dist/mutation/gate.d.ts +28 -0
- package/dist/state.d.ts +7 -0
- package/dist/test-impact/__tests__/analyzer-import-fix.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/analyzer-import-fix.test.d.ts +1 -0
- package/dist/test-impact/__tests__/analyzer.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/analyzer.test.d.ts +1 -0
- package/dist/test-impact/__tests__/council-fixes.test.d.ts +1 -0
- package/dist/test-impact/__tests__/failure-classifier.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/failure-classifier.test.d.ts +1 -0
- package/dist/test-impact/__tests__/flaky-detector.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/flaky-detector.test.d.ts +1 -0
- package/dist/test-impact/__tests__/history-store.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/history-store.test.d.ts +1 -0
- package/dist/test-impact/__tests__/test-impact.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/test-impact.test.d.ts +1 -0
- package/dist/test-impact/analyzer.d.ts +9 -0
- package/dist/test-impact/failure-classifier.d.ts +26 -0
- package/dist/test-impact/flaky-detector.d.ts +14 -0
- package/dist/test-impact/history-store.d.ts +15 -0
- package/dist/tools/__tests__/barrel-exports.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-ast-fallback.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-markdown-summary.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-semantic.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-summary.adversarial.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-summary.test.d.ts +1 -0
- package/dist/tools/__tests__/mutation-test.adversarial.test.d.ts +1 -0
- package/dist/tools/__tests__/mutation-test.sourcefiles.test.d.ts +1 -0
- package/dist/tools/__tests__/mutation-test.test.d.ts +1 -0
- package/dist/tools/__tests__/test-runner-history.test.d.ts +1 -0
- package/dist/tools/__tests__/test-runner-impact.adversarial.test.d.ts +1 -0
- package/dist/tools/__tests__/test-runner-impact.test.d.ts +1 -0
- package/dist/tools/__tests__/test-runner-source-files.test.d.ts +1 -0
- package/dist/tools/diff-summary.d.ts +12 -0
- package/dist/tools/diff.d.ts +3 -0
- package/dist/tools/get-approved-plan.d.ts +4 -0
- package/dist/tools/get-qa-gate-profile.d.ts +27 -0
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/mutation-test.d.ts +2 -0
- package/dist/tools/mutation-test.security.test.d.ts +1 -0
- package/dist/tools/set-qa-gates.d.ts +37 -0
- package/dist/tools/test-impact.d.ts +2 -0
- package/dist/tools/test-runner.d.ts +4 -4
- package/dist/tools/tool-names.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handle /swarm brainstorm command.
|
|
3
|
+
*
|
|
4
|
+
* Returns a trigger prompt instructing the architect to enter
|
|
5
|
+
* MODE: BRAINSTORM — the seven-phase planning workflow defined in the
|
|
6
|
+
* architect prompt: CONTEXT SCAN → DIALOGUE → APPROACHES → DESIGN SECTIONS
|
|
7
|
+
* → SPEC WRITE + SELF-REVIEW → QA GATE SELECTION → TRANSITION.
|
|
8
|
+
*
|
|
9
|
+
* Any arguments become the initial topic/problem statement for the
|
|
10
|
+
* architect to reason about. The topic is sanitized to prevent prompt
|
|
11
|
+
* injection of rival MODE: headers or newline-based control sequences.
|
|
12
|
+
*/
|
|
13
|
+
export declare function handleBrainstormCommand(_directory: string, args: string[]): Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { handleAgentsCommand } from './agents';
|
|
|
4
4
|
export { handleAnalyzeCommand } from './analyze';
|
|
5
5
|
export { handleArchiveCommand } from './archive';
|
|
6
6
|
export { handleBenchmarkCommand } from './benchmark';
|
|
7
|
+
export { handleBrainstormCommand } from './brainstorm';
|
|
7
8
|
export { handleCheckpointCommand } from './checkpoint';
|
|
8
9
|
export { handleClarifyCommand } from './clarify';
|
|
9
10
|
export { handleCloseCommand } from './close';
|
|
@@ -21,6 +22,7 @@ export { handleKnowledgeListCommand, handleKnowledgeMigrateCommand, handleKnowle
|
|
|
21
22
|
export { handlePlanCommand } from './plan';
|
|
22
23
|
export { handlePreflightCommand } from './preflight';
|
|
23
24
|
export { handlePromoteCommand } from './promote';
|
|
25
|
+
export { handleQaGatesCommand } from './qa-gates';
|
|
24
26
|
export type { CommandContext, CommandEntry, RegisteredCommand, } from './registry.js';
|
|
25
27
|
export { COMMAND_REGISTRY, resolveCommand, VALID_COMMANDS, } from './registry.js';
|
|
26
28
|
export { handleResetCommand } from './reset';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* /swarm qa-gates command.
|
|
3
|
+
*
|
|
4
|
+
* View, enable, or add session overrides for QA gates tied to the current
|
|
5
|
+
* plan's QA gate profile. Read-only display when called without arguments;
|
|
6
|
+
* ratchet-tighter enable/override when called with `enable <gate>...` or
|
|
7
|
+
* `override <gate>...`.
|
|
8
|
+
*
|
|
9
|
+
* /swarm qa-gates -> show profile + effective gates
|
|
10
|
+
* /swarm qa-gates enable <gate>... -> persist into profile (architect)
|
|
11
|
+
* /swarm qa-gates override <gate>... -> session-only override
|
|
12
|
+
*
|
|
13
|
+
* Refuses to persist into a locked profile.
|
|
14
|
+
*/
|
|
15
|
+
export declare function handleQaGatesCommand(directory: string, args: string[], sessionID: string): Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -150,6 +150,18 @@ export declare const COMMAND_REGISTRY: {
|
|
|
150
150
|
readonly description: "Generate or import a feature specification [description]";
|
|
151
151
|
readonly args: "[description-text]";
|
|
152
152
|
};
|
|
153
|
+
readonly brainstorm: {
|
|
154
|
+
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
155
|
+
readonly description: "Enter architect MODE: BRAINSTORM — structured seven-phase planning workflow [topic]";
|
|
156
|
+
readonly args: "[topic-text]";
|
|
157
|
+
readonly details: "Triggers the architect to run the brainstorm workflow: CONTEXT SCAN, single-question DIALOGUE, APPROACHES, DESIGN SECTIONS, SPEC WRITE + SELF-REVIEW, QA GATE SELECTION, TRANSITION. Use for new plans where requirements need to be drawn out before writing spec.md / plan.md.";
|
|
158
|
+
};
|
|
159
|
+
readonly 'qa-gates': {
|
|
160
|
+
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
161
|
+
readonly description: "View or modify QA gate profile for the current plan [enable|override <gate>...]";
|
|
162
|
+
readonly args: "[show|enable|override] <gate>...";
|
|
163
|
+
readonly details: "show: display spec-level, session-override, and effective QA gates for the current plan. enable: persist gate(s) into the locked-once profile (architect; rejected after critic approval lock). override: session-only ratchet-tighter enable. Valid gates: reviewer, test_engineer, council_mode, sme_enabled, critic_pre_plan, hallucination_guard, sast_enabled.";
|
|
164
|
+
};
|
|
153
165
|
readonly promote: {
|
|
154
166
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
155
167
|
readonly description: "Manually promote lesson to hive knowledge";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global SQLite database singleton for opencode-swarm.
|
|
3
|
+
*
|
|
4
|
+
* Owns `global-rules.db` in the platform config directory. Stores cross-project
|
|
5
|
+
* rules and agent prompt sections. Per-project QA gate profiles live in the
|
|
6
|
+
* project DB (see `./project-db.ts`), not here.
|
|
7
|
+
*/
|
|
8
|
+
import { Database } from 'bun:sqlite';
|
|
9
|
+
/**
|
|
10
|
+
* Run all pending migrations on the provided database.
|
|
11
|
+
* Idempotent: existing migrations are not re-applied.
|
|
12
|
+
*/
|
|
13
|
+
export declare function runGlobalMigrations(db: Database): void;
|
|
14
|
+
/**
|
|
15
|
+
* Return the process-wide singleton global database, creating it on first call.
|
|
16
|
+
* Directory is created if it does not exist. WAL mode is enabled immediately.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getGlobalDb(): Database;
|
|
19
|
+
/**
|
|
20
|
+
* Close and clear the global database singleton. Test-only.
|
|
21
|
+
*/
|
|
22
|
+
export declare function closeGlobalDb(): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel re-exports for the opencode-swarm SQLite database layer.
|
|
3
|
+
*
|
|
4
|
+
* - `global-db`: process-wide singleton for cross-project rules and
|
|
5
|
+
* agent prompt sections (`global-rules.db` in the platform config dir).
|
|
6
|
+
* - `project-db`: per-project database cache (`.swarm/swarm.db`), keyed by
|
|
7
|
+
* normalized directory path.
|
|
8
|
+
* - `qa-gate-profile`: service layer for per-plan QA gate profiles stored
|
|
9
|
+
* in the project DB.
|
|
10
|
+
*/
|
|
11
|
+
export { closeGlobalDb, getGlobalDb, runGlobalMigrations, } from './global-db.js';
|
|
12
|
+
export { closeAllProjectDbs, closeProjectDb, getProjectDb, projectDbExists, projectDbPath, runProjectMigrations, } from './project-db.js';
|
|
13
|
+
export { computeProfileHash, DEFAULT_QA_GATES, getEffectiveGates, getOrCreateProfile, getProfile, lockProfile, type QaGateProfile, type QaGates, setGates, } from './qa-gate-profile.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-project SQLite database for opencode-swarm.
|
|
3
|
+
*
|
|
4
|
+
* Owns `.swarm/swarm.db` in each project directory. Stores per-project
|
|
5
|
+
* constraints and QA gate profiles. One cached instance per normalized
|
|
6
|
+
* directory path.
|
|
7
|
+
*/
|
|
8
|
+
import { Database } from 'bun:sqlite';
|
|
9
|
+
/**
|
|
10
|
+
* Run all pending migrations on the provided database.
|
|
11
|
+
* Idempotent: existing migrations are not re-applied.
|
|
12
|
+
*/
|
|
13
|
+
export declare function runProjectMigrations(db: Database): void;
|
|
14
|
+
/**
|
|
15
|
+
* Return the absolute path to `.swarm/swarm.db` for the given directory.
|
|
16
|
+
* Does not create the file or any parent directory.
|
|
17
|
+
*/
|
|
18
|
+
export declare function projectDbPath(directory: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Return true iff the project DB file already exists on disk. Does not
|
|
21
|
+
* open the DB, create `.swarm/`, or run migrations. Intended for
|
|
22
|
+
* read-only callers (e.g. `getProfile`) that must avoid mutating the
|
|
23
|
+
* workspace just to check for a missing record.
|
|
24
|
+
*/
|
|
25
|
+
export declare function projectDbExists(directory: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Return the cached project database for the given directory, opening it
|
|
28
|
+
* if needed. Creates `.swarm/` if absent and enables WAL + foreign keys.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getProjectDb(directory: string): Database;
|
|
31
|
+
/**
|
|
32
|
+
* Close and remove the cached project database for the given directory.
|
|
33
|
+
* Test-only.
|
|
34
|
+
*/
|
|
35
|
+
export declare function closeProjectDb(directory: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Close and remove all cached project databases.
|
|
38
|
+
* Test-only.
|
|
39
|
+
*/
|
|
40
|
+
export declare function closeAllProjectDbs(): void;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service layer for the `qa_gate_profile` table in the per-project database.
|
|
3
|
+
*
|
|
4
|
+
* A QA gate profile is keyed by plan_id and captures which QA gates are
|
|
5
|
+
* enabled for that plan. Profiles are locked after critic approval; once
|
|
6
|
+
* locked, row updates are rejected by a SQLite trigger and by this service.
|
|
7
|
+
* Sessions can only ratchet gates tighter (enable more), never disable them.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* QA gate flags. All seven gates are tracked explicitly.
|
|
11
|
+
*/
|
|
12
|
+
export interface QaGates {
|
|
13
|
+
reviewer: boolean;
|
|
14
|
+
test_engineer: boolean;
|
|
15
|
+
council_mode: boolean;
|
|
16
|
+
sme_enabled: boolean;
|
|
17
|
+
critic_pre_plan: boolean;
|
|
18
|
+
hallucination_guard: boolean;
|
|
19
|
+
sast_enabled: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Default QA gate configuration for newly-created profiles.
|
|
23
|
+
*/
|
|
24
|
+
export declare const DEFAULT_QA_GATES: QaGates;
|
|
25
|
+
/**
|
|
26
|
+
* Row-level representation of a persisted QA gate profile.
|
|
27
|
+
*/
|
|
28
|
+
export interface QaGateProfile {
|
|
29
|
+
id: number;
|
|
30
|
+
plan_id: string;
|
|
31
|
+
created_at: string;
|
|
32
|
+
project_type: string | null;
|
|
33
|
+
gates: QaGates;
|
|
34
|
+
locked_at: string | null;
|
|
35
|
+
locked_by_snapshot_seq: number | null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Fetch the profile for `planId` or return null if none exists.
|
|
39
|
+
*
|
|
40
|
+
* Read-only: if `.swarm/swarm.db` does not exist yet, returns null
|
|
41
|
+
* without creating the DB file or running migrations. This keeps callers
|
|
42
|
+
* on read-only paths (`get_approved_plan`, `get_qa_gate_profile`, the
|
|
43
|
+
* `qa-gates show` command) from silently mutating the workspace just by
|
|
44
|
+
* looking for a profile. Write paths (`getOrCreateProfile`, `setGates`,
|
|
45
|
+
* `lockProfile`) continue to initialize the DB on demand.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getProfile(directory: string, planId: string): QaGateProfile | null;
|
|
48
|
+
/**
|
|
49
|
+
* Return the existing profile for `planId`, or create a new one seeded with
|
|
50
|
+
* `DEFAULT_QA_GATES` if none exists. Tolerates races on the UNIQUE index.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getOrCreateProfile(directory: string, planId: string, projectType?: string): QaGateProfile;
|
|
53
|
+
/**
|
|
54
|
+
* Update gates for `planId`. Gates can only be ratcheted tighter —
|
|
55
|
+
* attempting to disable a currently-enabled gate throws. Throws if the
|
|
56
|
+
* profile is locked.
|
|
57
|
+
*/
|
|
58
|
+
export declare function setGates(directory: string, planId: string, gates: Partial<QaGates>): QaGateProfile;
|
|
59
|
+
/**
|
|
60
|
+
* Lock the profile for `planId`, recording the snapshot seq that anchors it.
|
|
61
|
+
* Idempotent: locking an already-locked profile returns it unchanged.
|
|
62
|
+
*/
|
|
63
|
+
export declare function lockProfile(directory: string, planId: string, snapshotSeq: number): QaGateProfile;
|
|
64
|
+
/**
|
|
65
|
+
* Compute a SHA-256 hex digest over the stable identity of a profile.
|
|
66
|
+
* Used by `get_approved_plan` for drift detection.
|
|
67
|
+
*/
|
|
68
|
+
export declare function computeProfileHash(profile: QaGateProfile): string;
|
|
69
|
+
/**
|
|
70
|
+
* Merge session-level gate overrides on top of the spec-level profile.
|
|
71
|
+
* Session overrides can only ratchet gates tighter (set to true); false
|
|
72
|
+
* values in overrides are ignored.
|
|
73
|
+
*
|
|
74
|
+
* IMPORTANT — caller responsibility: this function is the *computation*
|
|
75
|
+
* of effective gates, not an enforcement point. Enforcement consumers
|
|
76
|
+
* (reviewer dispatch, SAST runner, council convene paths, etc.) must
|
|
77
|
+
* call this at their own check sites, passing the current profile from
|
|
78
|
+
* `getProfile` and the agent session's `qaGateSessionOverrides ?? {}`.
|
|
79
|
+
* Reading raw `profile.gates` directly from an enforcement site will
|
|
80
|
+
* silently ignore operator-applied session overrides. Session overrides
|
|
81
|
+
* are currently surfaced via `/swarm qa-gates show`; wiring additional
|
|
82
|
+
* enforcement consumers is tracked as follow-up work and does not affect
|
|
83
|
+
* spec-level gate correctness on the approved-plan path.
|
|
84
|
+
*
|
|
85
|
+
* Session overrides are intentionally ephemeral — they live only in
|
|
86
|
+
* in-memory `AgentSessionState.qaGateSessionOverrides` and are NOT
|
|
87
|
+
* persisted to the session snapshot. Process restart clears them.
|
|
88
|
+
*/
|
|
89
|
+
export declare function getEffectiveGates(profile: QaGateProfile, sessionOverrides: Partial<QaGates>): QaGates;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic classifier for AST changes.
|
|
3
|
+
* Classifies AST changes into semantic categories with risk ranking.
|
|
4
|
+
* @module diff/semantic-classifier
|
|
5
|
+
*/
|
|
6
|
+
import type { ASTDiffResult } from '../diff/ast-diff.js';
|
|
7
|
+
/**
|
|
8
|
+
* Semantic categories for classified changes.
|
|
9
|
+
* Describes the nature of the change from a code impact perspective.
|
|
10
|
+
*/
|
|
11
|
+
export type ChangeCategory = 'SIGNATURE_CHANGE' | 'API_CHANGE' | 'GUARD_REMOVED' | 'LOGIC_CHANGE' | 'DELETED_FUNCTION' | 'NEW_FUNCTION' | 'REFACTOR' | 'COSMETIC' | 'UNCLASSIFIED';
|
|
12
|
+
/**
|
|
13
|
+
* Risk level associated with a classified change.
|
|
14
|
+
* Indicates the potential impact severity of the change.
|
|
15
|
+
*/
|
|
16
|
+
export type RiskLevel = 'Critical' | 'High' | 'Medium' | 'Low';
|
|
17
|
+
/**
|
|
18
|
+
* A classified AST change with semantic categorization and risk assessment.
|
|
19
|
+
*/
|
|
20
|
+
export interface ClassifiedChange {
|
|
21
|
+
/** Semantic category of the change */
|
|
22
|
+
category: ChangeCategory;
|
|
23
|
+
/** Risk level indicating potential impact severity */
|
|
24
|
+
riskLevel: RiskLevel;
|
|
25
|
+
/** Path to the file containing this change */
|
|
26
|
+
filePath: string;
|
|
27
|
+
/** Name of the symbol (function, class, etc.) affected */
|
|
28
|
+
symbolName: string;
|
|
29
|
+
/** Type of change operation */
|
|
30
|
+
changeType: 'added' | 'modified' | 'removed';
|
|
31
|
+
/** Starting line number of the change */
|
|
32
|
+
lineStart: number;
|
|
33
|
+
/** Ending line number of the change */
|
|
34
|
+
lineEnd: number;
|
|
35
|
+
/** Human-readable description of what was detected */
|
|
36
|
+
description: string;
|
|
37
|
+
/** Original AST change signature detail (if available) */
|
|
38
|
+
signature?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Classify an array of AST diff results into semantic categories with risk levels.
|
|
42
|
+
*
|
|
43
|
+
* @param astDiffs - Array of ASTDiffResult from the AST differ
|
|
44
|
+
* @returns Array of ClassifiedChange with semantic categorization
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const diffs = await astDiff(oldCode, newCode);
|
|
49
|
+
* const classified = classifyChanges(diffs);
|
|
50
|
+
* for (const change of classified) {
|
|
51
|
+
* console.log(`[${change.riskLevel}] ${change.category}: ${change.symbolName}`);
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function classifyChanges(astDiffs: ASTDiffResult[]): ClassifiedChange[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ChangeCategory, ClassifiedChange, RiskLevel } from './semantic-classifier.js';
|
|
2
|
+
/**
|
|
3
|
+
* Structured summary of classified semantic diff changes.
|
|
4
|
+
* Provides multiple views for different review workflows.
|
|
5
|
+
*/
|
|
6
|
+
export interface SemanticDiffSummary {
|
|
7
|
+
/** Number of files with changes */
|
|
8
|
+
totalFiles: number;
|
|
9
|
+
/** Total number of classified changes */
|
|
10
|
+
totalChanges: number;
|
|
11
|
+
/** Changes grouped by risk level */
|
|
12
|
+
byRisk: Record<RiskLevel, ClassifiedChange[]>;
|
|
13
|
+
/** Changes grouped by category */
|
|
14
|
+
byCategory: Record<ChangeCategory, ClassifiedChange[]>;
|
|
15
|
+
/** Quick access to Critical items for gate checks */
|
|
16
|
+
criticalItems: ClassifiedChange[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Generates a structured summary from classified changes.
|
|
20
|
+
* Provides by-risk and by-category groupings plus critical item quick access.
|
|
21
|
+
*
|
|
22
|
+
* @param changes - Array of classified changes to summarize
|
|
23
|
+
* @returns SemanticDiffSummary with all grouping views
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateSummary(changes: ClassifiedChange[]): SemanticDiffSummary;
|
|
26
|
+
/**
|
|
27
|
+
* Generates reviewer-ready markdown summary from a SemanticDiffSummary.
|
|
28
|
+
* Format groups by risk level with file:category annotations.
|
|
29
|
+
*
|
|
30
|
+
* @param summary - The structured summary to render as markdown
|
|
31
|
+
* @returns Markdown-formatted string ready for PR review
|
|
32
|
+
*/
|
|
33
|
+
export declare function generateSummaryMarkdown(summary: SemanticDiffSummary): string;
|