nodebench-mcp 2.11.0 → 2.14.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 (67) hide show
  1. package/NODEBENCH_AGENTS.md +809 -809
  2. package/README.md +443 -431
  3. package/STYLE_GUIDE.md +477 -477
  4. package/dist/__tests__/evalHarness.test.js +1 -1
  5. package/dist/__tests__/gaiaCapabilityAudioEval.test.js +9 -14
  6. package/dist/__tests__/gaiaCapabilityAudioEval.test.js.map +1 -1
  7. package/dist/__tests__/gaiaCapabilityEval.test.js +88 -14
  8. package/dist/__tests__/gaiaCapabilityEval.test.js.map +1 -1
  9. package/dist/__tests__/gaiaCapabilityFilesEval.test.js +9 -5
  10. package/dist/__tests__/gaiaCapabilityFilesEval.test.js.map +1 -1
  11. package/dist/__tests__/gaiaCapabilityMediaEval.test.js +165 -17
  12. package/dist/__tests__/gaiaCapabilityMediaEval.test.js.map +1 -1
  13. package/dist/__tests__/helpers/answerMatch.d.ts +36 -7
  14. package/dist/__tests__/helpers/answerMatch.js +224 -35
  15. package/dist/__tests__/helpers/answerMatch.js.map +1 -1
  16. package/dist/__tests__/helpers/textLlm.d.ts +1 -1
  17. package/dist/__tests__/presetRealWorldBench.test.d.ts +1 -0
  18. package/dist/__tests__/presetRealWorldBench.test.js +850 -0
  19. package/dist/__tests__/presetRealWorldBench.test.js.map +1 -0
  20. package/dist/__tests__/tools.test.js +20 -7
  21. package/dist/__tests__/tools.test.js.map +1 -1
  22. package/dist/__tests__/toolsetGatingEval.test.js +21 -11
  23. package/dist/__tests__/toolsetGatingEval.test.js.map +1 -1
  24. package/dist/db.js +21 -0
  25. package/dist/db.js.map +1 -1
  26. package/dist/index.js +424 -327
  27. package/dist/index.js.map +1 -1
  28. package/dist/tools/agentBootstrapTools.js +258 -258
  29. package/dist/tools/boilerplateTools.js +144 -144
  30. package/dist/tools/cCompilerBenchmarkTools.js +33 -33
  31. package/dist/tools/documentationTools.js +59 -59
  32. package/dist/tools/flywheelTools.js +6 -6
  33. package/dist/tools/gitWorkflowTools.d.ts +11 -0
  34. package/dist/tools/gitWorkflowTools.js +580 -0
  35. package/dist/tools/gitWorkflowTools.js.map +1 -0
  36. package/dist/tools/learningTools.js +26 -26
  37. package/dist/tools/localFileTools.d.ts +3 -0
  38. package/dist/tools/localFileTools.js +3164 -125
  39. package/dist/tools/localFileTools.js.map +1 -1
  40. package/dist/tools/metaTools.js +82 -0
  41. package/dist/tools/metaTools.js.map +1 -1
  42. package/dist/tools/parallelAgentTools.js +228 -0
  43. package/dist/tools/parallelAgentTools.js.map +1 -1
  44. package/dist/tools/patternTools.d.ts +13 -0
  45. package/dist/tools/patternTools.js +456 -0
  46. package/dist/tools/patternTools.js.map +1 -0
  47. package/dist/tools/reconTools.js +31 -31
  48. package/dist/tools/selfEvalTools.js +44 -44
  49. package/dist/tools/seoTools.d.ts +16 -0
  50. package/dist/tools/seoTools.js +866 -0
  51. package/dist/tools/seoTools.js.map +1 -0
  52. package/dist/tools/sessionMemoryTools.d.ts +15 -0
  53. package/dist/tools/sessionMemoryTools.js +348 -0
  54. package/dist/tools/sessionMemoryTools.js.map +1 -0
  55. package/dist/tools/toolRegistry.d.ts +4 -0
  56. package/dist/tools/toolRegistry.js +489 -0
  57. package/dist/tools/toolRegistry.js.map +1 -1
  58. package/dist/tools/toonTools.d.ts +15 -0
  59. package/dist/tools/toonTools.js +94 -0
  60. package/dist/tools/toonTools.js.map +1 -0
  61. package/dist/tools/verificationTools.js +41 -41
  62. package/dist/tools/visionTools.js +17 -17
  63. package/dist/tools/voiceBridgeTools.d.ts +15 -0
  64. package/dist/tools/voiceBridgeTools.js +1427 -0
  65. package/dist/tools/voiceBridgeTools.js.map +1 -0
  66. package/dist/tools/webTools.js +18 -18
  67. package/package.json +102 -101
@@ -0,0 +1,580 @@
1
+ /**
2
+ * Git Workflow tools — branch compliance, PR review checklists, and merge gates.
3
+ *
4
+ * - check_git_compliance: Validate branch state, uncommitted changes, conventional commits
5
+ * - review_pr_checklist: Structured PR review with verification/eval cross-reference
6
+ * - enforce_merge_gate: Pre-merge validation combining quality gates + verification + eval
7
+ *
8
+ * All git commands are wrapped in try/catch for environments where git is unavailable.
9
+ */
10
+ import { getDb } from "../db.js";
11
+ import { execSync } from "node:child_process";
12
+ // ─── Helpers ──────────────────────────────────────────────────────────────────
13
+ const PROTECTED_BRANCHES = ["main", "master", "production", "release"];
14
+ const CONVENTIONAL_COMMIT_RE = /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?!?:\s.+/;
15
+ function gitExecOptions(repoPath) {
16
+ return {
17
+ cwd: repoPath || process.cwd(),
18
+ encoding: "utf8",
19
+ timeout: 10000,
20
+ stdio: ["pipe", "pipe", "pipe"],
21
+ };
22
+ }
23
+ function runGit(command, repoPath) {
24
+ return execSync(command, gitExecOptions(repoPath)).toString().trim();
25
+ }
26
+ // ─── Tools ────────────────────────────────────────────────────────────────────
27
+ export const gitWorkflowTools = [
28
+ // ─── Tool 1: check_git_compliance ─────────────────────────────────────────
29
+ {
30
+ name: "check_git_compliance",
31
+ description: "Validate branch state, uncommitted changes, and conventional commit compliance. Checks if on a protected branch, lists uncommitted changes, and optionally validates recent commit messages against conventional commit format (type(scope): message). Returns structured compliance report with warnings.",
32
+ inputSchema: {
33
+ type: "object",
34
+ properties: {
35
+ repoPath: {
36
+ type: "string",
37
+ description: "Repository root path (default: current working directory)",
38
+ },
39
+ branch: {
40
+ type: "string",
41
+ description: "Expected branch name to validate against (optional)",
42
+ },
43
+ conventionalCommits: {
44
+ type: "boolean",
45
+ description: "Validate commit messages against conventional commit format (default: false)",
46
+ },
47
+ },
48
+ },
49
+ handler: async (args) => {
50
+ const cwd = args.repoPath || process.cwd();
51
+ const warnings = [];
52
+ // Get current branch
53
+ let currentBranch = "unknown";
54
+ try {
55
+ currentBranch = runGit("git branch --show-current", cwd);
56
+ }
57
+ catch (err) {
58
+ return {
59
+ error: true,
60
+ message: `Failed to get current branch: ${err.message ?? "git not available or not a repository"}`,
61
+ repoPath: cwd,
62
+ };
63
+ }
64
+ // Check protected branch
65
+ const isProtected = PROTECTED_BRANCHES.includes(currentBranch);
66
+ if (isProtected) {
67
+ warnings.push(`Currently on protected branch '${currentBranch}' — avoid direct commits`);
68
+ }
69
+ // Validate expected branch
70
+ if (args.branch && currentBranch !== args.branch) {
71
+ warnings.push(`Expected branch '${args.branch}' but on '${currentBranch}'`);
72
+ }
73
+ // Check uncommitted changes
74
+ let uncommittedChanges = [];
75
+ try {
76
+ const status = runGit("git status --porcelain", cwd);
77
+ if (status) {
78
+ uncommittedChanges = status.split("\n").filter(Boolean);
79
+ }
80
+ }
81
+ catch { /* git status failed — already reported above */ }
82
+ if (uncommittedChanges.length > 0) {
83
+ warnings.push(`${uncommittedChanges.length} uncommitted change(s) detected`);
84
+ }
85
+ // Get recent commits
86
+ let recentCommits = [];
87
+ try {
88
+ const log = runGit("git log --oneline -10", cwd);
89
+ if (log) {
90
+ recentCommits = log.split("\n").filter(Boolean).map((line) => {
91
+ const spaceIdx = line.indexOf(" ");
92
+ return {
93
+ hash: line.slice(0, spaceIdx),
94
+ message: line.slice(spaceIdx + 1),
95
+ };
96
+ });
97
+ }
98
+ }
99
+ catch { /* no commits or git error */ }
100
+ // Conventional commit validation
101
+ let conventionalCommitCompliance;
102
+ if (args.conventionalCommits && recentCommits.length > 0) {
103
+ const violations = [];
104
+ let valid = 0;
105
+ let invalid = 0;
106
+ for (const commit of recentCommits) {
107
+ if (CONVENTIONAL_COMMIT_RE.test(commit.message)) {
108
+ valid++;
109
+ }
110
+ else {
111
+ invalid++;
112
+ violations.push({
113
+ hash: commit.hash,
114
+ message: commit.message,
115
+ reason: "Does not match pattern: type(scope): message",
116
+ });
117
+ }
118
+ }
119
+ conventionalCommitCompliance = { valid, invalid, violations };
120
+ if (invalid > 0) {
121
+ warnings.push(`${invalid} of ${recentCommits.length} recent commits do not follow conventional commit format`);
122
+ }
123
+ }
124
+ return {
125
+ branch: currentBranch,
126
+ isProtected,
127
+ uncommittedChanges,
128
+ recentCommits,
129
+ ...(conventionalCommitCompliance
130
+ ? { conventionalCommitCompliance }
131
+ : {}),
132
+ warnings,
133
+ summary: warnings.length === 0
134
+ ? `Branch '${currentBranch}' is clean with no compliance issues.`
135
+ : `Found ${warnings.length} warning(s) on branch '${currentBranch}'. Review before proceeding.`,
136
+ };
137
+ },
138
+ },
139
+ // ─── Tool 2: review_pr_checklist ──────────────────────────────────────────
140
+ {
141
+ name: "review_pr_checklist",
142
+ description: "Structured PR review checklist with verification/eval cross-reference. Validates PR title format, description presence, file change scope, test coverage, and optionally checks NodeBench verification cycle completion. Returns scored checklist with recommendations.",
143
+ inputSchema: {
144
+ type: "object",
145
+ properties: {
146
+ prTitle: {
147
+ type: "string",
148
+ description: "Pull request title",
149
+ },
150
+ prDescription: {
151
+ type: "string",
152
+ description: "Pull request description/body (optional)",
153
+ },
154
+ filesChanged: {
155
+ type: "array",
156
+ items: { type: "string" },
157
+ description: "List of changed file paths (optional)",
158
+ },
159
+ testsPassed: {
160
+ type: "boolean",
161
+ description: "Whether tests have passed (optional)",
162
+ },
163
+ verificationCycleId: {
164
+ type: "string",
165
+ description: "NodeBench verification cycle ID to cross-reference for completion status (optional)",
166
+ },
167
+ },
168
+ required: ["prTitle"],
169
+ },
170
+ handler: async (args) => {
171
+ const checklist = [];
172
+ const recommendations = [];
173
+ // 1. Title follows conventional format
174
+ const titleConventional = CONVENTIONAL_COMMIT_RE.test(args.prTitle);
175
+ checklist.push({
176
+ item: "Title follows conventional commit format",
177
+ passed: titleConventional,
178
+ note: titleConventional
179
+ ? "Title matches type(scope): message pattern"
180
+ : "Title should follow conventional commit format: type(scope): message",
181
+ });
182
+ if (!titleConventional) {
183
+ recommendations.push("Rewrite PR title to follow conventional commit format (e.g., feat(auth): add OAuth2 login)");
184
+ }
185
+ // 2. Description provided
186
+ const hasDescription = !!args.prDescription && args.prDescription.trim().length > 10;
187
+ checklist.push({
188
+ item: "Description provided",
189
+ passed: hasDescription,
190
+ note: hasDescription
191
+ ? `Description present (${args.prDescription.trim().length} chars)`
192
+ : "No meaningful description provided",
193
+ });
194
+ if (!hasDescription) {
195
+ recommendations.push("Add a description explaining what changed and why");
196
+ }
197
+ // 3. Files changed listed
198
+ const hasFilesChanged = !!args.filesChanged && args.filesChanged.length > 0;
199
+ checklist.push({
200
+ item: "Files changed listed",
201
+ passed: hasFilesChanged,
202
+ note: hasFilesChanged
203
+ ? `${args.filesChanged.length} file(s) changed`
204
+ : "No file change list provided",
205
+ });
206
+ // 4. Tests passed
207
+ if (args.testsPassed !== undefined) {
208
+ checklist.push({
209
+ item: "Tests passed",
210
+ passed: args.testsPassed,
211
+ note: args.testsPassed
212
+ ? "All tests passing"
213
+ : "Tests are failing — fix before merge",
214
+ });
215
+ if (!args.testsPassed) {
216
+ recommendations.push("Fix failing tests before requesting review");
217
+ }
218
+ }
219
+ else {
220
+ checklist.push({
221
+ item: "Tests passed",
222
+ passed: false,
223
+ note: "Test status not provided — run tests and report results",
224
+ });
225
+ recommendations.push("Run tests and pass testsPassed parameter");
226
+ }
227
+ // 5. Verification cycle cross-reference
228
+ if (args.verificationCycleId) {
229
+ try {
230
+ const db = getDb();
231
+ const cycle = db
232
+ .prepare("SELECT * FROM verification_cycles WHERE id = ?")
233
+ .get(args.verificationCycleId);
234
+ if (cycle) {
235
+ const cycleCompleted = cycle.status === "completed";
236
+ checklist.push({
237
+ item: "Verification cycle completed",
238
+ passed: cycleCompleted,
239
+ note: cycleCompleted
240
+ ? `Cycle '${cycle.title}' completed (phase ${cycle.current_phase}/6)`
241
+ : `Cycle '${cycle.title}' is '${cycle.status}' at phase ${cycle.current_phase}/6`,
242
+ });
243
+ if (!cycleCompleted) {
244
+ recommendations.push(`Complete verification cycle '${cycle.title}' (currently at phase ${cycle.current_phase}) before merging`);
245
+ }
246
+ }
247
+ else {
248
+ checklist.push({
249
+ item: "Verification cycle completed",
250
+ passed: false,
251
+ note: `Cycle not found: ${args.verificationCycleId}`,
252
+ });
253
+ recommendations.push("Verification cycle ID not found — start a new cycle with start_verification_cycle");
254
+ }
255
+ }
256
+ catch {
257
+ checklist.push({
258
+ item: "Verification cycle completed",
259
+ passed: false,
260
+ note: "Failed to query verification cycle database",
261
+ });
262
+ }
263
+ }
264
+ // 6. Anti-pattern checks
265
+ if (hasFilesChanged) {
266
+ const fileCount = args.filesChanged.length;
267
+ // Too many files changed
268
+ if (fileCount > 20) {
269
+ checklist.push({
270
+ item: "Reasonable change scope",
271
+ passed: false,
272
+ note: `${fileCount} files changed — consider splitting into smaller PRs`,
273
+ });
274
+ recommendations.push("Large PR detected. Split into smaller, focused PRs for easier review");
275
+ }
276
+ else {
277
+ checklist.push({
278
+ item: "Reasonable change scope",
279
+ passed: true,
280
+ note: `${fileCount} file(s) changed — manageable scope`,
281
+ });
282
+ }
283
+ // No test files in changes
284
+ const testFiles = args.filesChanged.filter((f) => f.includes(".test.") ||
285
+ f.includes(".spec.") ||
286
+ f.includes("__tests__"));
287
+ if (testFiles.length === 0) {
288
+ checklist.push({
289
+ item: "Test files included in changes",
290
+ passed: false,
291
+ note: "No test files in changed files — add tests for new/changed behavior",
292
+ });
293
+ recommendations.push("Add or update test files to cover the changes");
294
+ }
295
+ else {
296
+ checklist.push({
297
+ item: "Test files included in changes",
298
+ passed: true,
299
+ note: `${testFiles.length} test file(s) included`,
300
+ });
301
+ }
302
+ }
303
+ // Score
304
+ const totalItems = checklist.length;
305
+ const passedItems = checklist.filter((c) => c.passed).length;
306
+ const score = totalItems > 0 ? Math.round((passedItems / totalItems) * 100) / 100 : 0;
307
+ const passed = checklist.every((c) => c.passed);
308
+ return {
309
+ passed,
310
+ score,
311
+ checklist,
312
+ recommendations,
313
+ summary: passed
314
+ ? `PR checklist passed (${passedItems}/${totalItems} items). Ready for review.`
315
+ : `PR checklist has ${totalItems - passedItems} issue(s). Address recommendations before merging.`,
316
+ };
317
+ },
318
+ },
319
+ // ─── Tool 3: enforce_merge_gate ───────────────────────────────────────────
320
+ {
321
+ name: "enforce_merge_gate",
322
+ description: "Pre-merge validation combining git state, verification cycles, eval runs, test results, and quality gates. Returns a go/no-go merge decision with detailed check results and blocking issues. Use before merging any branch.",
323
+ inputSchema: {
324
+ type: "object",
325
+ properties: {
326
+ branch: {
327
+ type: "string",
328
+ description: "Branch to validate (default: current branch)",
329
+ },
330
+ repoPath: {
331
+ type: "string",
332
+ description: "Repository root path (default: current working directory)",
333
+ },
334
+ requireVerification: {
335
+ type: "boolean",
336
+ description: "Require a completed verification cycle (default: false)",
337
+ },
338
+ requireEval: {
339
+ type: "boolean",
340
+ description: "Require a recent completed eval run (default: false)",
341
+ },
342
+ requireTests: {
343
+ type: "boolean",
344
+ description: "Require recent passing test results (default: false)",
345
+ },
346
+ },
347
+ },
348
+ handler: async (args) => {
349
+ const cwd = args.repoPath || process.cwd();
350
+ const checks = [];
351
+ const blockingIssues = [];
352
+ // ── Git state checks ────────────────────────────────────────────────
353
+ // Current branch
354
+ let currentBranch = "unknown";
355
+ try {
356
+ currentBranch = runGit("git branch --show-current", cwd);
357
+ }
358
+ catch (err) {
359
+ checks.push({
360
+ name: "git_available",
361
+ passed: false,
362
+ detail: `Git not available: ${err.message ?? "unknown error"}`,
363
+ });
364
+ blockingIssues.push("Cannot access git — ensure you are in a git repository");
365
+ }
366
+ // Validate branch matches expected
367
+ if (args.branch && currentBranch !== args.branch) {
368
+ checks.push({
369
+ name: "correct_branch",
370
+ passed: false,
371
+ detail: `Expected branch '${args.branch}' but on '${currentBranch}'`,
372
+ });
373
+ blockingIssues.push(`Switch to branch '${args.branch}' before merging`);
374
+ }
375
+ else {
376
+ checks.push({
377
+ name: "correct_branch",
378
+ passed: true,
379
+ detail: `On branch '${currentBranch}'`,
380
+ });
381
+ }
382
+ // Uncommitted changes
383
+ try {
384
+ const status = runGit("git status --porcelain", cwd);
385
+ const hasUncommitted = status.length > 0;
386
+ checks.push({
387
+ name: "no_uncommitted_changes",
388
+ passed: !hasUncommitted,
389
+ detail: hasUncommitted
390
+ ? `${status.split("\n").filter(Boolean).length} uncommitted change(s)`
391
+ : "Working directory clean",
392
+ });
393
+ if (hasUncommitted) {
394
+ blockingIssues.push("Commit or stash uncommitted changes before merging");
395
+ }
396
+ }
397
+ catch {
398
+ checks.push({
399
+ name: "no_uncommitted_changes",
400
+ passed: false,
401
+ detail: "Could not check working directory status",
402
+ });
403
+ }
404
+ // Ahead/behind remote
405
+ try {
406
+ // Fetch latest remote state (best-effort, may fail without network)
407
+ try {
408
+ runGit("git fetch --quiet", cwd);
409
+ }
410
+ catch { /* fetch failed — proceed with local state */ }
411
+ const aheadBehind = runGit("git rev-list --left-right --count HEAD...@{upstream}", cwd);
412
+ const parts = aheadBehind.split(/\s+/);
413
+ const ahead = parseInt(parts[0], 10) || 0;
414
+ const behind = parseInt(parts[1], 10) || 0;
415
+ checks.push({
416
+ name: "synced_with_remote",
417
+ passed: behind === 0,
418
+ detail: behind === 0
419
+ ? `Up to date with remote${ahead > 0 ? ` (${ahead} commit(s) ahead)` : ""}`
420
+ : `${behind} commit(s) behind remote — pull before merging`,
421
+ });
422
+ if (behind > 0) {
423
+ blockingIssues.push(`Branch is ${behind} commit(s) behind remote — pull and resolve conflicts`);
424
+ }
425
+ }
426
+ catch {
427
+ checks.push({
428
+ name: "synced_with_remote",
429
+ passed: true,
430
+ detail: "No upstream tracking branch configured — skipping remote sync check",
431
+ });
432
+ }
433
+ // ── NodeBench database checks ───────────────────────────────────────
434
+ const db = getDb();
435
+ // Verification cycle check
436
+ if (args.requireVerification) {
437
+ try {
438
+ const cycle = db
439
+ .prepare("SELECT * FROM verification_cycles WHERE status = 'completed' ORDER BY updated_at DESC LIMIT 1")
440
+ .get();
441
+ if (cycle) {
442
+ checks.push({
443
+ name: "verification_completed",
444
+ passed: true,
445
+ detail: `Completed cycle: '${cycle.title}' (${cycle.updated_at})`,
446
+ });
447
+ }
448
+ else {
449
+ checks.push({
450
+ name: "verification_completed",
451
+ passed: false,
452
+ detail: "No completed verification cycle found",
453
+ });
454
+ blockingIssues.push("Complete a verification cycle (start_verification_cycle) before merging");
455
+ }
456
+ }
457
+ catch {
458
+ checks.push({
459
+ name: "verification_completed",
460
+ passed: false,
461
+ detail: "Failed to query verification cycles",
462
+ });
463
+ }
464
+ }
465
+ // Eval run check
466
+ if (args.requireEval) {
467
+ try {
468
+ const evalRun = db
469
+ .prepare("SELECT * FROM eval_runs WHERE status = 'completed' ORDER BY completed_at DESC LIMIT 1")
470
+ .get();
471
+ if (evalRun) {
472
+ checks.push({
473
+ name: "eval_completed",
474
+ passed: true,
475
+ detail: `Completed eval: '${evalRun.name}' (${evalRun.completed_at})`,
476
+ });
477
+ }
478
+ else {
479
+ checks.push({
480
+ name: "eval_completed",
481
+ passed: false,
482
+ detail: "No completed eval run found",
483
+ });
484
+ blockingIssues.push("Complete an eval run (start_eval_run) before merging");
485
+ }
486
+ }
487
+ catch {
488
+ checks.push({
489
+ name: "eval_completed",
490
+ passed: false,
491
+ detail: "Failed to query eval runs",
492
+ });
493
+ }
494
+ }
495
+ // Test results check
496
+ if (args.requireTests) {
497
+ try {
498
+ const recentTests = db
499
+ .prepare("SELECT layer, passed, COUNT(*) as count FROM test_results ORDER BY created_at DESC LIMIT 50")
500
+ .all();
501
+ if (recentTests.length > 0) {
502
+ const allPassing = recentTests.every((t) => t.passed === 1);
503
+ const failedCount = recentTests.filter((t) => t.passed === 0).length;
504
+ checks.push({
505
+ name: "tests_passing",
506
+ passed: allPassing,
507
+ detail: allPassing
508
+ ? `${recentTests.length} recent test result(s) — all passing`
509
+ : `${failedCount} failing test(s) out of ${recentTests.length} recent results`,
510
+ });
511
+ if (!allPassing) {
512
+ blockingIssues.push("Fix failing tests before merging");
513
+ }
514
+ }
515
+ else {
516
+ checks.push({
517
+ name: "tests_passing",
518
+ passed: false,
519
+ detail: "No test results found — run tests and log results with log_test_result",
520
+ });
521
+ blockingIssues.push("Run tests and record results before merging");
522
+ }
523
+ }
524
+ catch {
525
+ checks.push({
526
+ name: "tests_passing",
527
+ passed: false,
528
+ detail: "Failed to query test results",
529
+ });
530
+ }
531
+ }
532
+ // Quality gate check (always check if any exist)
533
+ try {
534
+ const recentGate = db
535
+ .prepare("SELECT * FROM quality_gate_runs ORDER BY created_at DESC LIMIT 1")
536
+ .get();
537
+ if (recentGate) {
538
+ const gatePassed = recentGate.passed === 1;
539
+ checks.push({
540
+ name: "quality_gate_passed",
541
+ passed: gatePassed,
542
+ detail: gatePassed
543
+ ? `Latest gate '${recentGate.gate_name}' passed (score: ${recentGate.score})`
544
+ : `Latest gate '${recentGate.gate_name}' failed — ${recentGate.failures}`,
545
+ });
546
+ if (!gatePassed) {
547
+ blockingIssues.push(`Quality gate '${recentGate.gate_name}' is failing — fix and re-run`);
548
+ }
549
+ }
550
+ else {
551
+ checks.push({
552
+ name: "quality_gate_passed",
553
+ passed: true,
554
+ detail: "No quality gate runs found — consider running run_quality_gate",
555
+ });
556
+ }
557
+ }
558
+ catch {
559
+ checks.push({
560
+ name: "quality_gate_passed",
561
+ passed: true,
562
+ detail: "Could not query quality gate runs",
563
+ });
564
+ }
565
+ // ── Final decision ──────────────────────────────────────────────────
566
+ const canMerge = blockingIssues.length === 0;
567
+ const passedChecks = checks.filter((c) => c.passed).length;
568
+ return {
569
+ canMerge,
570
+ branch: currentBranch,
571
+ checks,
572
+ blockingIssues,
573
+ summary: canMerge
574
+ ? `All ${passedChecks} check(s) passed. Branch '${currentBranch}' is clear to merge.`
575
+ : `${blockingIssues.length} blocking issue(s) found. Resolve before merging.`,
576
+ };
577
+ },
578
+ },
579
+ ];
580
+ //# sourceMappingURL=gitWorkflowTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitWorkflowTools.js","sourceRoot":"","sources":["../../src/tools/gitWorkflowTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,EAAS,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,C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