ghagga-core 2.0.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.
Files changed (82) hide show
  1. package/README.md +51 -0
  2. package/dist/agents/consensus.d.ts +68 -0
  3. package/dist/agents/consensus.d.ts.map +1 -0
  4. package/dist/agents/consensus.js +216 -0
  5. package/dist/agents/consensus.js.map +1 -0
  6. package/dist/agents/prompts.d.ts +18 -0
  7. package/dist/agents/prompts.d.ts.map +1 -0
  8. package/dist/agents/prompts.js +194 -0
  9. package/dist/agents/prompts.js.map +1 -0
  10. package/dist/agents/simple.d.ts +49 -0
  11. package/dist/agents/simple.d.ts.map +1 -0
  12. package/dist/agents/simple.js +135 -0
  13. package/dist/agents/simple.js.map +1 -0
  14. package/dist/agents/workflow.d.ts +40 -0
  15. package/dist/agents/workflow.d.ts.map +1 -0
  16. package/dist/agents/workflow.js +127 -0
  17. package/dist/agents/workflow.js.map +1 -0
  18. package/dist/index.d.ts +19 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +21 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/memory/context.d.ts +23 -0
  23. package/dist/memory/context.d.ts.map +1 -0
  24. package/dist/memory/context.js +36 -0
  25. package/dist/memory/context.js.map +1 -0
  26. package/dist/memory/persist.d.ts +22 -0
  27. package/dist/memory/persist.d.ts.map +1 -0
  28. package/dist/memory/persist.js +103 -0
  29. package/dist/memory/persist.js.map +1 -0
  30. package/dist/memory/privacy.d.ts +19 -0
  31. package/dist/memory/privacy.d.ts.map +1 -0
  32. package/dist/memory/privacy.js +77 -0
  33. package/dist/memory/privacy.js.map +1 -0
  34. package/dist/memory/search.d.ts +20 -0
  35. package/dist/memory/search.d.ts.map +1 -0
  36. package/dist/memory/search.js +76 -0
  37. package/dist/memory/search.js.map +1 -0
  38. package/dist/pipeline.d.ts +30 -0
  39. package/dist/pipeline.d.ts.map +1 -0
  40. package/dist/pipeline.js +267 -0
  41. package/dist/pipeline.js.map +1 -0
  42. package/dist/providers/fallback.d.ts +46 -0
  43. package/dist/providers/fallback.d.ts.map +1 -0
  44. package/dist/providers/fallback.js +84 -0
  45. package/dist/providers/fallback.js.map +1 -0
  46. package/dist/providers/index.d.ts +40 -0
  47. package/dist/providers/index.d.ts.map +1 -0
  48. package/dist/providers/index.js +76 -0
  49. package/dist/providers/index.js.map +1 -0
  50. package/dist/tools/cpd.d.ts +24 -0
  51. package/dist/tools/cpd.d.ts.map +1 -0
  52. package/dist/tools/cpd.js +130 -0
  53. package/dist/tools/cpd.js.map +1 -0
  54. package/dist/tools/runner.d.ts +19 -0
  55. package/dist/tools/runner.d.ts.map +1 -0
  56. package/dist/tools/runner.js +61 -0
  57. package/dist/tools/runner.js.map +1 -0
  58. package/dist/tools/semgrep.d.ts +12 -0
  59. package/dist/tools/semgrep.d.ts.map +1 -0
  60. package/dist/tools/semgrep.js +97 -0
  61. package/dist/tools/semgrep.js.map +1 -0
  62. package/dist/tools/trivy.d.ts +11 -0
  63. package/dist/tools/trivy.d.ts.map +1 -0
  64. package/dist/tools/trivy.js +74 -0
  65. package/dist/tools/trivy.js.map +1 -0
  66. package/dist/types.d.ts +168 -0
  67. package/dist/types.d.ts.map +1 -0
  68. package/dist/types.js +24 -0
  69. package/dist/types.js.map +1 -0
  70. package/dist/utils/diff.d.ts +53 -0
  71. package/dist/utils/diff.d.ts.map +1 -0
  72. package/dist/utils/diff.js +103 -0
  73. package/dist/utils/diff.js.map +1 -0
  74. package/dist/utils/stack-detect.d.ts +15 -0
  75. package/dist/utils/stack-detect.d.ts.map +1 -0
  76. package/dist/utils/stack-detect.js +54 -0
  77. package/dist/utils/stack-detect.js.map +1 -0
  78. package/dist/utils/token-budget.d.ts +31 -0
  79. package/dist/utils/token-budget.d.ts.map +1 -0
  80. package/dist/utils/token-budget.js +62 -0
  81. package/dist/utils/token-budget.js.map +1 -0
  82. package/package.json +68 -0
@@ -0,0 +1,168 @@
1
+ /**
2
+ * GHAGGA Core Types
3
+ *
4
+ * These types define the contract between the core review engine
5
+ * and all distribution adapters (server, CLI, action).
6
+ */
7
+ export type ReviewMode = 'simple' | 'workflow' | 'consensus';
8
+ export type LLMProvider = 'anthropic' | 'openai' | 'google' | 'github' | 'ollama';
9
+ export type ReviewLevel = 'soft' | 'normal' | 'strict';
10
+ /**
11
+ * Progress callback for pipeline steps.
12
+ * Used by the CLI in --verbose mode to show real-time progress.
13
+ */
14
+ export type ProgressCallback = (event: ProgressEvent) => void;
15
+ export interface ProgressEvent {
16
+ /** Pipeline step identifier */
17
+ step: string;
18
+ /** Human-readable message */
19
+ message: string;
20
+ /** Optional details (e.g., specialist output, vote reasoning) */
21
+ detail?: string;
22
+ }
23
+ export interface ReviewInput {
24
+ /** The unified diff string from the PR or local changes */
25
+ diff: string;
26
+ /** Review mode to use */
27
+ mode: ReviewMode;
28
+ /** Primary LLM provider */
29
+ provider: LLMProvider;
30
+ /** Model identifier (e.g., "claude-sonnet-4-20250514", "gpt-4o") */
31
+ model: string;
32
+ /** Decrypted API key for the LLM provider */
33
+ apiKey: string;
34
+ /** Tool and review configuration */
35
+ settings: ReviewSettings;
36
+ /** Optional context about the PR (not available in CLI mode) */
37
+ context?: ReviewContext;
38
+ /**
39
+ * Database connection for memory operations.
40
+ * Undefined in CLI/Action modes — memory gracefully degrades.
41
+ */
42
+ db?: unknown;
43
+ /**
44
+ * Optional progress callback for verbose/debug output.
45
+ * Called at each pipeline step with status updates.
46
+ */
47
+ onProgress?: ProgressCallback;
48
+ }
49
+ export interface ReviewSettings {
50
+ enableSemgrep: boolean;
51
+ enableTrivy: boolean;
52
+ enableCpd: boolean;
53
+ enableMemory: boolean;
54
+ customRules: string[];
55
+ ignorePatterns: string[];
56
+ reviewLevel: ReviewLevel;
57
+ }
58
+ export interface ReviewContext {
59
+ /** Repository full name (e.g., "owner/repo") */
60
+ repoFullName: string;
61
+ /** Pull request number */
62
+ prNumber: number;
63
+ /** Commit messages in the PR */
64
+ commitMessages: string[];
65
+ /** List of all file paths in the diff */
66
+ fileList: string[];
67
+ }
68
+ export type ReviewStatus = 'PASSED' | 'FAILED' | 'NEEDS_HUMAN_REVIEW' | 'SKIPPED';
69
+ export type FindingSeverity = 'critical' | 'high' | 'medium' | 'low' | 'info';
70
+ export type FindingSource = 'ai' | 'semgrep' | 'trivy' | 'cpd';
71
+ export interface ReviewResult {
72
+ /** Overall review status */
73
+ status: ReviewStatus;
74
+ /** Human-readable summary (2-3 sentences) */
75
+ summary: string;
76
+ /** All findings from AI agents and static analysis */
77
+ findings: ReviewFinding[];
78
+ /** Static analysis results per tool */
79
+ staticAnalysis: StaticAnalysisResult;
80
+ /** Memory context that was injected into agent prompts (if any) */
81
+ memoryContext: string | null;
82
+ /** Execution metadata */
83
+ metadata: ReviewMetadata;
84
+ }
85
+ export interface ReviewFinding {
86
+ /** Severity level */
87
+ severity: FindingSeverity;
88
+ /** Category (e.g., "security", "performance", "style", "bug") */
89
+ category: string;
90
+ /** File path relative to repo root */
91
+ file: string;
92
+ /** Line number (if applicable) */
93
+ line?: number;
94
+ /** Description of the finding */
95
+ message: string;
96
+ /** Suggested fix or improvement */
97
+ suggestion?: string;
98
+ /** Which tool or agent produced this finding */
99
+ source: FindingSource;
100
+ }
101
+ export interface ReviewMetadata {
102
+ /** Review mode used */
103
+ mode: ReviewMode;
104
+ /** LLM provider used (may differ from requested if fallback occurred) */
105
+ provider: LLMProvider;
106
+ /** Model used */
107
+ model: string;
108
+ /** Total tokens consumed */
109
+ tokensUsed: number;
110
+ /** Total execution time in milliseconds */
111
+ executionTimeMs: number;
112
+ /** Static analysis tools that ran successfully */
113
+ toolsRun: string[];
114
+ /** Static analysis tools that were skipped or failed */
115
+ toolsSkipped: string[];
116
+ }
117
+ export type ToolStatus = 'success' | 'skipped' | 'error';
118
+ export interface ToolResult {
119
+ /** Whether the tool ran successfully */
120
+ status: ToolStatus;
121
+ /** Findings from this tool */
122
+ findings: ReviewFinding[];
123
+ /** Error message if status is 'error' */
124
+ error?: string;
125
+ /** Execution time in milliseconds */
126
+ executionTimeMs: number;
127
+ }
128
+ export interface StaticAnalysisResult {
129
+ semgrep: ToolResult;
130
+ trivy: ToolResult;
131
+ cpd: ToolResult;
132
+ }
133
+ export type WorkflowSpecialist = 'scope-analysis' | 'coding-standards' | 'error-handling' | 'security-audit' | 'performance-review';
134
+ export type ConsensusStance = 'for' | 'against' | 'neutral';
135
+ export interface ConsensusVote {
136
+ /** Which provider cast this vote */
137
+ provider: LLMProvider;
138
+ /** Model used */
139
+ model: string;
140
+ /** Assigned stance */
141
+ stance: ConsensusStance;
142
+ /** Decision: approve, reject, or abstain */
143
+ decision: 'approve' | 'reject' | 'abstain';
144
+ /** Confidence level (0-1) */
145
+ confidence: number;
146
+ /** Reasoning for the decision */
147
+ reasoning: string;
148
+ }
149
+ export type ObservationType = 'decision' | 'pattern' | 'bugfix' | 'learning' | 'architecture' | 'config' | 'discovery';
150
+ export interface MemoryObservation {
151
+ /** Observation type */
152
+ type: ObservationType;
153
+ /** Concise title */
154
+ title: string;
155
+ /** Structured content (what happened, why it matters, what was learned) */
156
+ content: string;
157
+ /** Project identifier (e.g., "owner/repo") */
158
+ project: string;
159
+ /** Session ID this observation belongs to */
160
+ sessionId?: number;
161
+ /** Stable key for upsert (evolving knowledge) */
162
+ topicKey?: string;
163
+ /** Affected file paths */
164
+ filePaths: string[];
165
+ }
166
+ export declare const DEFAULT_SETTINGS: ReviewSettings;
167
+ export declare const DEFAULT_MODELS: Record<LLMProvider, string>;
168
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAC7D,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAClF,MAAM,MA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,MAAM,CAAC;IAEd,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAEhB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAEhB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,0BAA0B;IAC1B,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAID,eAAO,MAAM,gBAAgB,EAAE,cAQ9B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAMtD,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * GHAGGA Core Types
3
+ *
4
+ * These types define the contract between the core review engine
5
+ * and all distribution adapters (server, CLI, action).
6
+ */
7
+ // ─── Configuration Defaults ─────────────────────────────────────
8
+ export const DEFAULT_SETTINGS = {
9
+ enableSemgrep: true,
10
+ enableTrivy: true,
11
+ enableCpd: true,
12
+ enableMemory: true,
13
+ customRules: [],
14
+ ignorePatterns: ['*.md', '*.txt', '.gitignore', 'LICENSE', '*.lock'],
15
+ reviewLevel: 'normal',
16
+ };
17
+ export const DEFAULT_MODELS = {
18
+ anthropic: 'claude-sonnet-4-20250514',
19
+ openai: 'gpt-4o',
20
+ google: 'gemini-2.0-flash',
21
+ github: 'gpt-4o-mini',
22
+ ollama: 'qwen2.5-coder:7b',
23
+ };
24
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqPH,mEAAmE;AAEnE,MAAM,CAAC,MAAM,gBAAgB,GAAmB;IAC9C,aAAa,EAAE,IAAI;IACnB,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;IACf,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,EAAE;IACf,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC;IACpE,WAAW,EAAE,QAAQ;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAgC;IACzD,SAAS,EAAE,0BAA0B;IACrC,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,kBAAkB;IAC1B,MAAM,EAAE,aAAa;IACrB,MAAM,EAAE,kBAAkB;CAC3B,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Unified diff parsing utilities.
3
+ *
4
+ * Provides functions to extract structured file information from unified
5
+ * diffs, filter out ignored files (e.g., lockfiles, docs), and truncate
6
+ * large diffs to fit within LLM token budgets.
7
+ */
8
+ /** Represents a single file extracted from a unified diff. */
9
+ export interface DiffFile {
10
+ /** File path relative to the repository root */
11
+ path: string;
12
+ /** Number of added lines */
13
+ additions: number;
14
+ /** Number of deleted lines */
15
+ deletions: number;
16
+ /** Raw diff content for this file (including headers and hunks) */
17
+ content: string;
18
+ }
19
+ /**
20
+ * Parse a unified diff string into structured file objects.
21
+ *
22
+ * Splits the diff by file boundaries (diff --git lines), extracts
23
+ * file paths, and counts additions/deletions per file.
24
+ *
25
+ * @param diff - Full unified diff string
26
+ * @returns Array of DiffFile objects
27
+ */
28
+ export declare function parseDiffFiles(diff: string): DiffFile[];
29
+ /**
30
+ * Filter out files matching ignore patterns (e.g., lockfiles, docs).
31
+ *
32
+ * Uses minimatch for glob pattern matching, consistent with .gitignore style.
33
+ *
34
+ * @param files - Array of DiffFile objects to filter
35
+ * @param patterns - Glob patterns to exclude (e.g., ["*.md", "*.lock"])
36
+ * @returns Filtered array with ignored files removed
37
+ */
38
+ export declare function filterIgnoredFiles(files: DiffFile[], patterns: string[]): DiffFile[];
39
+ /**
40
+ * Truncate a diff string to fit within a token budget.
41
+ *
42
+ * Uses a rough approximation of 1 token ≈ 4 characters, which is
43
+ * a reasonable middle ground across different LLM tokenizers.
44
+ *
45
+ * @param diff - The diff string to truncate
46
+ * @param maxTokens - Maximum number of tokens allowed
47
+ * @returns Object with the (possibly truncated) diff and a flag indicating truncation
48
+ */
49
+ export declare function truncateDiff(diff: string, maxTokens: number): {
50
+ truncated: string;
51
+ wasTruncated: boolean;
52
+ };
53
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/utils/diff.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,8DAA8D;AAC9D,MAAM,WAAW,QAAQ;IACvB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IAEb,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAElB,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;IAElB,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;CACjB;AAYD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,CA2CvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAOpF;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,CAc9C"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Unified diff parsing utilities.
3
+ *
4
+ * Provides functions to extract structured file information from unified
5
+ * diffs, filter out ignored files (e.g., lockfiles, docs), and truncate
6
+ * large diffs to fit within LLM token budgets.
7
+ */
8
+ import { minimatch } from 'minimatch';
9
+ // ─── Constants ──────────────────────────────────────────────────
10
+ /**
11
+ * Regex to match the start of a file diff block.
12
+ * Handles both `a/path` and `b/path` formats from git diff.
13
+ */
14
+ const FILE_HEADER_RE = /^diff --git a\/.+ b\/(.+)$/;
15
+ // ─── Core Functions ─────────────────────────────────────────────
16
+ /**
17
+ * Parse a unified diff string into structured file objects.
18
+ *
19
+ * Splits the diff by file boundaries (diff --git lines), extracts
20
+ * file paths, and counts additions/deletions per file.
21
+ *
22
+ * @param diff - Full unified diff string
23
+ * @returns Array of DiffFile objects
24
+ */
25
+ export function parseDiffFiles(diff) {
26
+ const files = [];
27
+ const lines = diff.split('\n');
28
+ let currentFile = null;
29
+ const contentLines = [];
30
+ function flushCurrent() {
31
+ if (currentFile) {
32
+ currentFile.content = contentLines.join('\n');
33
+ files.push(currentFile);
34
+ contentLines.length = 0;
35
+ }
36
+ }
37
+ for (const line of lines) {
38
+ const match = FILE_HEADER_RE.exec(line);
39
+ if (match) {
40
+ // Start of a new file — flush previous
41
+ flushCurrent();
42
+ currentFile = {
43
+ path: match[1],
44
+ additions: 0,
45
+ deletions: 0,
46
+ content: '',
47
+ };
48
+ contentLines.push(line);
49
+ }
50
+ else if (currentFile) {
51
+ contentLines.push(line);
52
+ // Count additions and deletions (skip hunk headers and --- / +++ lines)
53
+ if (line.startsWith('+') && !line.startsWith('+++')) {
54
+ currentFile.additions++;
55
+ }
56
+ else if (line.startsWith('-') && !line.startsWith('---')) {
57
+ currentFile.deletions++;
58
+ }
59
+ }
60
+ }
61
+ // Flush last file
62
+ flushCurrent();
63
+ return files;
64
+ }
65
+ /**
66
+ * Filter out files matching ignore patterns (e.g., lockfiles, docs).
67
+ *
68
+ * Uses minimatch for glob pattern matching, consistent with .gitignore style.
69
+ *
70
+ * @param files - Array of DiffFile objects to filter
71
+ * @param patterns - Glob patterns to exclude (e.g., ["*.md", "*.lock"])
72
+ * @returns Filtered array with ignored files removed
73
+ */
74
+ export function filterIgnoredFiles(files, patterns) {
75
+ if (patterns.length === 0)
76
+ return files;
77
+ return files.filter((file) => {
78
+ // Keep the file if it does NOT match any ignore pattern
79
+ return !patterns.some((pattern) => minimatch(file.path, pattern, { dot: true }));
80
+ });
81
+ }
82
+ /**
83
+ * Truncate a diff string to fit within a token budget.
84
+ *
85
+ * Uses a rough approximation of 1 token ≈ 4 characters, which is
86
+ * a reasonable middle ground across different LLM tokenizers.
87
+ *
88
+ * @param diff - The diff string to truncate
89
+ * @param maxTokens - Maximum number of tokens allowed
90
+ * @returns Object with the (possibly truncated) diff and a flag indicating truncation
91
+ */
92
+ export function truncateDiff(diff, maxTokens) {
93
+ const maxChars = maxTokens * 4;
94
+ if (diff.length <= maxChars) {
95
+ return { truncated: diff, wasTruncated: false };
96
+ }
97
+ // Truncate at the character limit, then trim to the last complete line
98
+ const cutoff = diff.lastIndexOf('\n', maxChars);
99
+ const truncated = (cutoff > 0 ? diff.slice(0, cutoff) : diff.slice(0, maxChars)) +
100
+ '\n\n[... diff truncated to fit token budget ...]';
101
+ return { truncated, wasTruncated: true };
102
+ }
103
+ //# sourceMappingURL=diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/utils/diff.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAmBtC,mEAAmE;AAEnE;;;GAGG;AACH,MAAM,cAAc,GAAG,4BAA4B,CAAC;AAEpD,mEAAmE;AAEnE;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,KAAK,GAAe,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,WAAW,GAAoB,IAAI,CAAC;IACxC,MAAM,YAAY,GAAa,EAAE,CAAC;IAElC,SAAS,YAAY;QACnB,IAAI,WAAW,EAAE,CAAC;YAChB,WAAW,CAAC,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC9C,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACxB,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CA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,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAY,EACZ,SAAiB;IAEjB,MAAM,QAAQ,GAAG,SAAS,GAAG,CAAC,CAAC;IAE/B,IAAI,IAAI,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC5B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAClD,CAAC;IAED,uEAAuE;IACvE,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAChD,MAAM,SAAS,GACb,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC9D,kDAAkD,CAAC;IAErD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Tech stack detection from file extensions.
3
+ *
4
+ * Analyzes a list of file paths (typically from a diff) to determine
5
+ * which technology stacks are involved. This allows the review engine
6
+ * to inject stack-specific review hints into agent prompts.
7
+ */
8
+ /**
9
+ * Detect technology stacks from a list of file paths.
10
+ *
11
+ * @param fileList - Array of file paths (e.g., ["src/index.ts", "lib/utils.py"])
12
+ * @returns Deduplicated array of stack names (e.g., ["typescript", "python"])
13
+ */
14
+ export declare function detectStacks(fileList: string[]): string[];
15
+ //# sourceMappingURL=stack-detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack-detect.d.ts","sourceRoot":"","sources":["../../src/utils/stack-detect.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+BH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAczD"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Tech stack detection from file extensions.
3
+ *
4
+ * Analyzes a list of file paths (typically from a diff) to determine
5
+ * which technology stacks are involved. This allows the review engine
6
+ * to inject stack-specific review hints into agent prompts.
7
+ */
8
+ import { extname } from 'node:path';
9
+ /**
10
+ * Mapping of file extensions to the technology stacks they represent.
11
+ * Some extensions map to multiple stacks (e.g., .tsx → typescript + react).
12
+ */
13
+ const EXTENSION_MAP = {
14
+ '.ts': ['typescript'],
15
+ '.tsx': ['typescript', 'react'],
16
+ '.js': ['javascript'],
17
+ '.jsx': ['javascript', 'react'],
18
+ '.mjs': ['javascript'],
19
+ '.cjs': ['javascript'],
20
+ '.py': ['python'],
21
+ '.java': ['java'],
22
+ '.kt': ['kotlin'],
23
+ '.kts': ['kotlin'],
24
+ '.go': ['go'],
25
+ '.rs': ['rust'],
26
+ '.sql': ['sql'],
27
+ '.cs': ['csharp'],
28
+ '.rb': ['ruby'],
29
+ '.php': ['php'],
30
+ '.swift': ['swift'],
31
+ '.scala': ['scala'],
32
+ '.ex': ['elixir'],
33
+ '.exs': ['elixir'],
34
+ };
35
+ /**
36
+ * Detect technology stacks from a list of file paths.
37
+ *
38
+ * @param fileList - Array of file paths (e.g., ["src/index.ts", "lib/utils.py"])
39
+ * @returns Deduplicated array of stack names (e.g., ["typescript", "python"])
40
+ */
41
+ export function detectStacks(fileList) {
42
+ const stacks = new Set();
43
+ for (const filePath of fileList) {
44
+ const ext = extname(filePath).toLowerCase();
45
+ const mapped = EXTENSION_MAP[ext];
46
+ if (mapped) {
47
+ for (const stack of mapped) {
48
+ stacks.add(stack);
49
+ }
50
+ }
51
+ }
52
+ return [...stacks];
53
+ }
54
+ //# sourceMappingURL=stack-detect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack-detect.js","sourceRoot":"","sources":["../../src/utils/stack-detect.ts"],"names":[],"mappings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;gBAC3B,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC;AACrB,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Token budget management for LLM context windows.
3
+ *
4
+ * Different models have different context window sizes. This module
5
+ * provides utilities to calculate how much of the token budget should
6
+ * be allocated to the diff vs. surrounding context (system prompt,
7
+ * static analysis, memory, stack hints).
8
+ */
9
+ /**
10
+ * Get the context window size for a given model.
11
+ *
12
+ * @param model - Model identifier (e.g., "claude-sonnet-4-20250514", "gpt-4o")
13
+ * @returns Context window size in tokens
14
+ */
15
+ export declare function getContextWindow(model: string): number;
16
+ /**
17
+ * Calculate token budgets for diff and context.
18
+ *
19
+ * The diff gets 70% of the total context window, while surrounding
20
+ * context (system prompt, memory, static analysis hints) gets 30%.
21
+ * This ensures the diff always has enough room while leaving space
22
+ * for enrichment.
23
+ *
24
+ * @param model - Model identifier
25
+ * @returns Object with diffBudget and contextBudget in tokens
26
+ */
27
+ export declare function calculateTokenBudget(model: string): {
28
+ diffBudget: number;
29
+ contextBudget: number;
30
+ };
31
+ //# sourceMappingURL=token-budget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-budget.d.ts","sourceRoot":"","sources":["../../src/utils/token-budget.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAoCH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB,CAOA"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Token budget management for LLM context windows.
3
+ *
4
+ * Different models have different context window sizes. This module
5
+ * provides utilities to calculate how much of the token budget should
6
+ * be allocated to the diff vs. surrounding context (system prompt,
7
+ * static analysis, memory, stack hints).
8
+ */
9
+ // ─── Context Window Sizes ───────────────────────────────────────
10
+ /**
11
+ * Known model context window sizes (in tokens).
12
+ * Sourced from official provider documentation as of 2025.
13
+ */
14
+ const MODEL_CONTEXT_WINDOWS = {
15
+ // Anthropic
16
+ 'claude-sonnet-4-20250514': 200_000,
17
+ 'claude-3-5-sonnet-20241022': 200_000,
18
+ 'claude-3-5-haiku-20241022': 200_000,
19
+ // OpenAI
20
+ 'gpt-4o': 128_000,
21
+ 'gpt-4o-mini': 128_000,
22
+ 'gpt-4-turbo': 128_000,
23
+ // Google
24
+ 'gemini-2.0-flash': 1_048_576,
25
+ 'gemini-1.5-pro': 2_097_152,
26
+ 'gemini-1.5-flash': 1_048_576,
27
+ };
28
+ /** Default context window when the model is not in our lookup table. */
29
+ const DEFAULT_CONTEXT_WINDOW = 128_000;
30
+ /** Fraction of total budget allocated to the diff content. */
31
+ const DIFF_BUDGET_RATIO = 0.7;
32
+ /** Fraction of total budget allocated to context (system, memory, static analysis). */
33
+ const CONTEXT_BUDGET_RATIO = 0.3;
34
+ // ─── Public API ─────────────────────────────────────────────────
35
+ /**
36
+ * Get the context window size for a given model.
37
+ *
38
+ * @param model - Model identifier (e.g., "claude-sonnet-4-20250514", "gpt-4o")
39
+ * @returns Context window size in tokens
40
+ */
41
+ export function getContextWindow(model) {
42
+ return MODEL_CONTEXT_WINDOWS[model] ?? DEFAULT_CONTEXT_WINDOW;
43
+ }
44
+ /**
45
+ * Calculate token budgets for diff and context.
46
+ *
47
+ * The diff gets 70% of the total context window, while surrounding
48
+ * context (system prompt, memory, static analysis hints) gets 30%.
49
+ * This ensures the diff always has enough room while leaving space
50
+ * for enrichment.
51
+ *
52
+ * @param model - Model identifier
53
+ * @returns Object with diffBudget and contextBudget in tokens
54
+ */
55
+ export function calculateTokenBudget(model) {
56
+ const total = getContextWindow(model);
57
+ return {
58
+ diffBudget: Math.floor(total * DIFF_BUDGET_RATIO),
59
+ contextBudget: Math.floor(total * CONTEXT_BUDGET_RATIO),
60
+ };
61
+ }
62
+ //# sourceMappingURL=token-budget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-budget.js","sourceRoot":"","sources":["../../src/utils/token-budget.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,mEAAmE;AAEnE;;;GAGG;AACH,MAAM,qBAAqB,GAA2B;IACpD,YAAY;IACZ,0BAA0B,EAAE,OAAO;IACnC,4BAA4B,EAAE,OAAO;IACrC,2BAA2B,EAAE,OAAO;IAEpC,SAAS;IACT,QAAQ,EAAE,OAAO;IACjB,aAAa,EAAE,OAAO;IACtB,aAAa,EAAE,OAAO;IAEtB,SAAS;IACT,kBAAkB,EAAE,SAAS;IAC7B,gBAAgB,EAAE,SAAS;IAC3B,kBAAkB,EAAE,SAAS;CAC9B,CAAC;AAEF,wEAAwE;AACxE,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAEvC,8DAA8D;AAC9D,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,uFAAuF;AACvF,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,mEAAmE;AAEnE;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,OAAO,qBAAqB,CAAC,KAAK,CAAC,IAAI,sBAAsB,CAAC;AAChE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAIhD,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAEtC,OAAO;QACL,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,iBAAiB,CAAC;QACjD,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,oBAAoB,CAAC;KACxD,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "ghagga-core",
3
+ "version": "2.0.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Core review engine for GHAGGA — AI-powered multi-agent code reviewer",
7
+ "author": "JNZader",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/JNZader/ghagga.git",
12
+ "directory": "packages/core"
13
+ },
14
+ "homepage": "https://github.com/JNZader/ghagga#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/JNZader/ghagga/issues"
17
+ },
18
+ "keywords": [
19
+ "ghagga",
20
+ "code-review",
21
+ "ai",
22
+ "multi-agent",
23
+ "llm",
24
+ "static-analysis",
25
+ "github"
26
+ ],
27
+ "engines": {
28
+ "node": ">=20.0.0"
29
+ },
30
+ "main": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "import": "./dist/index.js",
35
+ "types": "./dist/index.d.ts"
36
+ }
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "README.md"
41
+ ],
42
+ "scripts": {
43
+ "build": "tsc",
44
+ "dev": "tsc --watch",
45
+ "typecheck": "tsc --noEmit",
46
+ "test": "vitest run",
47
+ "test:watch": "vitest",
48
+ "test:mutate": "stryker run",
49
+ "clean": "rm -rf dist",
50
+ "prepublishOnly": "npm run build"
51
+ },
52
+ "dependencies": {
53
+ "@ai-sdk/anthropic": "^1.2.0",
54
+ "@ai-sdk/google": "^1.2.0",
55
+ "@ai-sdk/openai": "^1.3.0",
56
+ "ghagga-db": "workspace:^",
57
+ "ai": "^4.3.0",
58
+ "minimatch": "^10.0.1",
59
+ "zod": "^3.24.0"
60
+ },
61
+ "devDependencies": {
62
+ "@stryker-mutator/core": "^9.6.0",
63
+ "@stryker-mutator/vitest-runner": "^9.6.0",
64
+ "@types/node": "^22.0.0",
65
+ "typescript": "^5.7.0",
66
+ "vitest": "^3.0.0"
67
+ }
68
+ }