claude-git-hooks 2.51.2 → 2.61.2
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/CHANGELOG.md +275 -30
- package/lib/commands/back-merge.js +91 -11
- package/lib/commands/bump-version.js +39 -0
- package/lib/commands/create-pr.js +73 -33
- package/lib/commands/create-release.js +198 -52
- package/lib/messages/library-warnings.js +29 -0
- package/lib/utils/github-api.js +30 -0
- package/lib/utils/linter-runner.js +6 -0
- package/package.json +83 -83
|
@@ -4,18 +4,21 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Workflow:
|
|
6
6
|
* 1. Validate preconditions (clean tree, on develop, up-to-date, no existing RC)
|
|
7
|
-
* 2.
|
|
8
|
-
* 3.
|
|
9
|
-
* 4.
|
|
10
|
-
* 5.
|
|
11
|
-
* 6.
|
|
12
|
-
* 7.
|
|
13
|
-
* 8.
|
|
14
|
-
* 9.
|
|
15
|
-
* 10.
|
|
16
|
-
* 11.
|
|
17
|
-
* 12.
|
|
18
|
-
* 13.
|
|
7
|
+
* 2. Library verification gate (non-blocking)
|
|
8
|
+
* 3. Discover version files — abort on mismatch
|
|
9
|
+
* 4. Calculate next version
|
|
10
|
+
* 5. [dry-run] Preview + return
|
|
11
|
+
* 6. Confirm with user
|
|
12
|
+
* 7. Create RC branch from develop
|
|
13
|
+
* 8. Bump version files
|
|
14
|
+
* 9. [if stale] Library regeneration (keeps tag accurate)
|
|
15
|
+
* 10. [optional] Generate CHANGELOG
|
|
16
|
+
* 11. Stage all + commit (--no-verify)
|
|
17
|
+
* 12. Create Git tag (skip if already exists)
|
|
18
|
+
* 13. Push RC branch (unless --skip-push)
|
|
19
|
+
* 14. Create release PR (unless --skip-push or push failed)
|
|
20
|
+
* 15. Deploy to shadow (unless --no-shadow or --skip-push)
|
|
21
|
+
* 16. Return to RC branch + display summary
|
|
19
22
|
*/
|
|
20
23
|
|
|
21
24
|
import { execSync } from 'child_process';
|
|
@@ -57,6 +60,12 @@ import {
|
|
|
57
60
|
} from '../utils/interactive-ui.js';
|
|
58
61
|
import logger from '../utils/logger.js';
|
|
59
62
|
import { colors, error, checkGitRepo } from './helpers.js';
|
|
63
|
+
import {
|
|
64
|
+
CONSOLE_WARNING_TEMPLATE,
|
|
65
|
+
PR_BODY_SECTION_TEMPLATE,
|
|
66
|
+
PR_TAG_VALUE,
|
|
67
|
+
LIBRARY_VERIFY_SKIPPED_WARNING_RELEASE
|
|
68
|
+
} from '../messages/library-warnings.js';
|
|
60
69
|
|
|
61
70
|
/** Source branch for RC creation */
|
|
62
71
|
const SOURCE_BRANCH = 'develop';
|
|
@@ -264,6 +273,51 @@ function restoreSnapshot(snapshot) {
|
|
|
264
273
|
});
|
|
265
274
|
}
|
|
266
275
|
|
|
276
|
+
/**
|
|
277
|
+
* Emit a loud Library staleness warning to stderr.
|
|
278
|
+
* Content comes from the canonical template + verify result data.
|
|
279
|
+
* Formatting uses ANSI codes for visual emphasis on TTY stderr.
|
|
280
|
+
*
|
|
281
|
+
* @param {import('../../.library/librarian/index.js').VerifyResult} result
|
|
282
|
+
* @private
|
|
283
|
+
*/
|
|
284
|
+
function _emitLibraryWarning(result) {
|
|
285
|
+
const y = colors.yellow;
|
|
286
|
+
const r = colors.reset;
|
|
287
|
+
const bar = `${y}${'='.repeat(63)}${r}`;
|
|
288
|
+
const content = CONSOLE_WARNING_TEMPLATE(result, { autoRegen: 'will-run' });
|
|
289
|
+
|
|
290
|
+
const lines = ['', bar, '', `${y}${content}${r}`, '', bar, ''];
|
|
291
|
+
|
|
292
|
+
process.stderr.write(lines.join('\n'));
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** Marker comment pair wrapping the staleness section in PR bodies */
|
|
296
|
+
const STALENESS_MARKER_OPEN = '<!-- LIBRARY_STALENESS_SECTION -->';
|
|
297
|
+
const STALENESS_MARKER_CLOSE = '<!-- /LIBRARY_STALENESS_SECTION -->';
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Build the release PR body, optionally appending the staleness section.
|
|
301
|
+
*
|
|
302
|
+
* @param {string} nextVersion
|
|
303
|
+
* @param {import('../../.library/librarian/index.js').VerifyResult|null} verifyResult
|
|
304
|
+
* @param {'completed'|'failed'|null} regenOutcome - result of auto-regeneration
|
|
305
|
+
* @returns {string}
|
|
306
|
+
* @private
|
|
307
|
+
*/
|
|
308
|
+
function _buildReleasePrBody(nextVersion, verifyResult, regenOutcome) {
|
|
309
|
+
let body = `## Release V${nextVersion}\n\nRelease-candidate branch created from \`${SOURCE_BRANCH}\`.`;
|
|
310
|
+
|
|
311
|
+
if (verifyResult && !verifyResult.clean) {
|
|
312
|
+
const section = PR_BODY_SECTION_TEMPLATE(verifyResult, {
|
|
313
|
+
autoRegen: regenOutcome || 'failed'
|
|
314
|
+
});
|
|
315
|
+
body += `\n\n${STALENESS_MARKER_OPEN}\n${section}\n${STALENESS_MARKER_CLOSE}`;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return body;
|
|
319
|
+
}
|
|
320
|
+
|
|
267
321
|
/**
|
|
268
322
|
* create-release command
|
|
269
323
|
* Creates a release-candidate branch from develop, bumps version, and deploys to shadow.
|
|
@@ -318,8 +372,25 @@ export async function runCreateRelease(args) {
|
|
|
318
372
|
showSuccess('Preconditions validated');
|
|
319
373
|
console.log('');
|
|
320
374
|
|
|
321
|
-
// Step 2:
|
|
322
|
-
|
|
375
|
+
// Step 2: Library verification gate — silent on clean, loud-warn on stale, never blocks
|
|
376
|
+
let verifyResult = null;
|
|
377
|
+
logger.debug('create-release', 'Step 2: Running Library verification gate');
|
|
378
|
+
try {
|
|
379
|
+
const { verify } = await import('../../.library/librarian/index.js');
|
|
380
|
+
verifyResult = await verify();
|
|
381
|
+
|
|
382
|
+
if (verifyResult.clean) {
|
|
383
|
+
logger.debug('create-release', 'Library is clean — no warning needed');
|
|
384
|
+
} else {
|
|
385
|
+
_emitLibraryWarning(verifyResult);
|
|
386
|
+
}
|
|
387
|
+
} catch (verifyErr) {
|
|
388
|
+
const msg = `\n${colors.yellow} ${LIBRARY_VERIFY_SKIPPED_WARNING_RELEASE} ${verifyErr.message}${colors.reset}\n\n`;
|
|
389
|
+
process.stderr.write(msg);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// Step 3: Discover version files
|
|
393
|
+
logger.debug('create-release', 'Step 3: Discovering version files');
|
|
323
394
|
const discovery = discoverVersionFiles();
|
|
324
395
|
|
|
325
396
|
if (discovery.files.length === 0) {
|
|
@@ -356,7 +427,7 @@ export async function runCreateRelease(args) {
|
|
|
356
427
|
process.exit(1);
|
|
357
428
|
}
|
|
358
429
|
|
|
359
|
-
// Step
|
|
430
|
+
// Step 4: Calculate next version
|
|
360
431
|
const nextVersion = incrementVersion(currentVersion, options.bumpType);
|
|
361
432
|
const rcBranch = `${RC_PREFIX}/V${nextVersion}`;
|
|
362
433
|
const tagName = formatTagName(nextVersion);
|
|
@@ -366,13 +437,13 @@ export async function runCreateRelease(args) {
|
|
|
366
437
|
showInfo(`Branch: ${rcBranch}`);
|
|
367
438
|
console.log('');
|
|
368
439
|
|
|
369
|
-
// Step
|
|
440
|
+
// Step 5: Dry-run
|
|
370
441
|
if (options.dryRun) {
|
|
371
442
|
showDryRunPreview({ bumpType: options.bumpType, currentVersion, nextVersion, rcBranch, options });
|
|
372
443
|
return;
|
|
373
444
|
}
|
|
374
445
|
|
|
375
|
-
// Step
|
|
446
|
+
// Step 6: Confirm with user
|
|
376
447
|
const confirmed = await promptConfirmation(
|
|
377
448
|
`Create ${rcBranch} and bump version to ${nextVersion}?`,
|
|
378
449
|
true
|
|
@@ -388,30 +459,8 @@ export async function runCreateRelease(args) {
|
|
|
388
459
|
const config = await getConfig();
|
|
389
460
|
const selectedFiles = discovery.files.filter((f) => f.selected);
|
|
390
461
|
|
|
391
|
-
//
|
|
392
|
-
|
|
393
|
-
showInfo('📚 Checking library staleness...');
|
|
394
|
-
const { runAll, formatHuman } = await import('../../.library/tools/staleness.js');
|
|
395
|
-
const { getSourceDir, getBooksDir } = await import('../../.library/paths.js');
|
|
396
|
-
const { getRepoRoot } = await import('../utils/git-operations.js');
|
|
397
|
-
const stalenessResult = await runAll(getBooksDir(), getSourceDir(), getRepoRoot(), false);
|
|
398
|
-
const hasDrift = stalenessResult.stale.length > 0 ||
|
|
399
|
-
stalenessResult.orphan_books.length > 0 ||
|
|
400
|
-
stalenessResult.unbooked_sources.length > 0;
|
|
401
|
-
if (hasDrift) {
|
|
402
|
-
showError('📚 Library staleness detected — cannot create release with stale books');
|
|
403
|
-
process.stdout.write(formatHuman(stalenessResult));
|
|
404
|
-
showError('Run: npm run library:regenerate');
|
|
405
|
-
process.exit(1);
|
|
406
|
-
}
|
|
407
|
-
showSuccess('📚 Library books are current');
|
|
408
|
-
} catch (err) {
|
|
409
|
-
showWarning('📚 Library staleness check unavailable — .library/ tools not found');
|
|
410
|
-
logger.debug('create-release', 'Library staleness check skipped', { error: err.message });
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// Step 6: Create RC branch from develop
|
|
414
|
-
logger.debug('create-release', 'Step 6: Creating RC branch', { rcBranch });
|
|
462
|
+
// Step 7: Create RC branch from develop
|
|
463
|
+
logger.debug('create-release', 'Step 7: Creating RC branch', { rcBranch });
|
|
415
464
|
showInfo(`Creating branch ${rcBranch} from ${SOURCE_BRANCH}...`);
|
|
416
465
|
checkoutBranch(rcBranch, { create: true, startPoint: SOURCE_BRANCH });
|
|
417
466
|
showSuccess(`✓ Branch created: ${rcBranch}`);
|
|
@@ -430,8 +479,8 @@ export async function runCreateRelease(args) {
|
|
|
430
479
|
}
|
|
431
480
|
});
|
|
432
481
|
|
|
433
|
-
// Step
|
|
434
|
-
logger.debug('create-release', 'Step
|
|
482
|
+
// Step 8: Bump version files
|
|
483
|
+
logger.debug('create-release', 'Step 8: Bumping version files');
|
|
435
484
|
showInfo('Updating version files...');
|
|
436
485
|
try {
|
|
437
486
|
updateVersionFiles(selectedFiles, nextVersion);
|
|
@@ -455,10 +504,41 @@ export async function runCreateRelease(args) {
|
|
|
455
504
|
process.exit(1);
|
|
456
505
|
}
|
|
457
506
|
|
|
458
|
-
// Step
|
|
507
|
+
// Step 9: Library regeneration (if stale — keeps tag accurate)
|
|
508
|
+
let libraryFiles = [];
|
|
509
|
+
let regenOutcome = null;
|
|
510
|
+
if (verifyResult && !verifyResult.clean) {
|
|
511
|
+
logger.debug('create-release', 'Step 9: Running Library regeneration');
|
|
512
|
+
showInfo('📚 Regenerating stale Library books...');
|
|
513
|
+
try {
|
|
514
|
+
const { createPrPipeline } = await import('../../.library/librarian/index.js');
|
|
515
|
+
const root = getRepoRoot();
|
|
516
|
+
const pipelineSummary = await createPrPipeline({ repoRoot: root });
|
|
517
|
+
|
|
518
|
+
libraryFiles = pipelineSummary.modifiedFiles.map(
|
|
519
|
+
(f) => path.join(root, f)
|
|
520
|
+
);
|
|
521
|
+
|
|
522
|
+
regenOutcome = 'completed';
|
|
523
|
+
if (libraryFiles.length > 0) {
|
|
524
|
+
showSuccess(`✓ Library regenerated (${libraryFiles.length} file(s))`);
|
|
525
|
+
} else {
|
|
526
|
+
showInfo('Library pipeline ran — no files changed');
|
|
527
|
+
}
|
|
528
|
+
} catch (regenErr) {
|
|
529
|
+
regenOutcome = 'failed';
|
|
530
|
+
showWarning(`Library regeneration failed: ${regenErr.message}`);
|
|
531
|
+
logger.debug('create-release', 'Library regen failed', {
|
|
532
|
+
error: regenErr.message
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
process.stdout.write('\n');
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// Step 10: Optional CHANGELOG
|
|
459
539
|
let selectedChangelogPath = null;
|
|
460
540
|
if (options.updateChangelog) {
|
|
461
|
-
logger.debug('create-release', 'Step
|
|
541
|
+
logger.debug('create-release', 'Step 10: Generating CHANGELOG');
|
|
462
542
|
showInfo('Generating CHANGELOG entry...');
|
|
463
543
|
const changelogResult = await generateChangelogEntry({
|
|
464
544
|
version: nextVersion,
|
|
@@ -484,6 +564,9 @@ export async function runCreateRelease(args) {
|
|
|
484
564
|
logger.debug('create-release', 'Staging and committing version bump');
|
|
485
565
|
showInfo('Staging and committing...');
|
|
486
566
|
const filesToStage = selectedFiles.map((f) => f.path);
|
|
567
|
+
if (libraryFiles.length > 0) {
|
|
568
|
+
filesToStage.push(...libraryFiles);
|
|
569
|
+
}
|
|
487
570
|
if (options.updateChangelog) {
|
|
488
571
|
const changelogPath =
|
|
489
572
|
selectedChangelogPath || path.join(getRepoRoot(), 'CHANGELOG.md');
|
|
@@ -518,8 +601,8 @@ export async function runCreateRelease(args) {
|
|
|
518
601
|
showSuccess('✓ Version bump committed');
|
|
519
602
|
console.log('');
|
|
520
603
|
|
|
521
|
-
// Step
|
|
522
|
-
logger.debug('create-release', 'Step
|
|
604
|
+
// Step 11: Create Git tag (skip silently if already exists)
|
|
605
|
+
logger.debug('create-release', 'Step 11: Creating Git tag', { tagName });
|
|
523
606
|
const tagAlreadyExists = await tagExists(tagName, 'local');
|
|
524
607
|
if (tagAlreadyExists) {
|
|
525
608
|
showWarning(`Tag ${tagName} already exists locally — skipping tag creation`);
|
|
@@ -533,7 +616,7 @@ export async function runCreateRelease(args) {
|
|
|
533
616
|
}
|
|
534
617
|
console.log('');
|
|
535
618
|
|
|
536
|
-
// Step
|
|
619
|
+
// Step 12: Push RC branch (unless --skip-push)
|
|
537
620
|
let pushStatus = 'skipped (--skip-push)';
|
|
538
621
|
if (!options.skipPush) {
|
|
539
622
|
showInfo(`Pushing ${rcBranch} to remote...`);
|
|
@@ -551,7 +634,66 @@ export async function runCreateRelease(args) {
|
|
|
551
634
|
console.log('');
|
|
552
635
|
}
|
|
553
636
|
|
|
554
|
-
// Step
|
|
637
|
+
// Step 13: Create release PR (unless --skip-push or push failed)
|
|
638
|
+
let prUrl = null;
|
|
639
|
+
if (!options.skipPush && pushStatus === 'pushed') {
|
|
640
|
+
logger.debug('create-release', 'Step 13: Creating release PR');
|
|
641
|
+
try {
|
|
642
|
+
const { createPullRequest, validateToken, findExistingPR } =
|
|
643
|
+
await import('../utils/github-api.js');
|
|
644
|
+
const { parseGitHubRepo } = await import('../utils/github-client.js');
|
|
645
|
+
|
|
646
|
+
const tokenValidation = await validateToken();
|
|
647
|
+
if (!tokenValidation.valid) {
|
|
648
|
+
showWarning(
|
|
649
|
+
`GitHub token invalid — release PR not created: ${tokenValidation.error}`
|
|
650
|
+
);
|
|
651
|
+
console.log('');
|
|
652
|
+
console.log('Create the PR manually:');
|
|
653
|
+
console.log(` gh pr create --base main --head ${rcBranch}`);
|
|
654
|
+
} else {
|
|
655
|
+
const repoInfo = parseGitHubRepo();
|
|
656
|
+
|
|
657
|
+
// Idempotency: skip if PR already exists for this head → main
|
|
658
|
+
const existingPR = await findExistingPR({
|
|
659
|
+
owner: repoInfo.owner,
|
|
660
|
+
repo: repoInfo.repo,
|
|
661
|
+
head: rcBranch,
|
|
662
|
+
base: 'main'
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
if (existingPR) {
|
|
666
|
+
showInfo(`Release PR already exists: ${existingPR.html_url}`);
|
|
667
|
+
prUrl = existingPR.html_url;
|
|
668
|
+
} else {
|
|
669
|
+
const prBody = _buildReleasePrBody(nextVersion, verifyResult, regenOutcome);
|
|
670
|
+
const labels = verifyResult && !verifyResult.clean
|
|
671
|
+
? [PR_TAG_VALUE]
|
|
672
|
+
: [];
|
|
673
|
+
|
|
674
|
+
const pr = await createPullRequest({
|
|
675
|
+
owner: repoInfo.owner,
|
|
676
|
+
repo: repoInfo.repo,
|
|
677
|
+
title: `Release V${nextVersion}`,
|
|
678
|
+
body: prBody,
|
|
679
|
+
head: rcBranch,
|
|
680
|
+
base: 'main',
|
|
681
|
+
labels
|
|
682
|
+
});
|
|
683
|
+
prUrl = pr.html_url;
|
|
684
|
+
showSuccess(`✓ Release PR created: ${prUrl}`);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
} catch (prErr) {
|
|
688
|
+
showWarning(`Release PR creation failed: ${prErr.message}`);
|
|
689
|
+
console.log('');
|
|
690
|
+
console.log('Create the PR manually:');
|
|
691
|
+
console.log(` gh pr create --base main --head ${rcBranch}`);
|
|
692
|
+
}
|
|
693
|
+
console.log('');
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
// Step 14: Deploy to shadow (unless --no-shadow or --skip-push)
|
|
555
697
|
let shadowStatus = 'skipped';
|
|
556
698
|
if (options.noShadow) {
|
|
557
699
|
showInfo('Shadow deployment skipped (--no-shadow)');
|
|
@@ -573,7 +715,7 @@ export async function runCreateRelease(args) {
|
|
|
573
715
|
}
|
|
574
716
|
}
|
|
575
717
|
|
|
576
|
-
// Step
|
|
718
|
+
// Step 15: Ensure we land on RC branch
|
|
577
719
|
const currentBranchAfter = getCurrentBranch();
|
|
578
720
|
if (currentBranchAfter !== rcBranch) {
|
|
579
721
|
try {
|
|
@@ -583,7 +725,7 @@ export async function runCreateRelease(args) {
|
|
|
583
725
|
}
|
|
584
726
|
}
|
|
585
727
|
|
|
586
|
-
// Step
|
|
728
|
+
// Step 16: Summary
|
|
587
729
|
console.log('');
|
|
588
730
|
console.log(
|
|
589
731
|
`${colors.green}════════════════════════════════════════════════════${colors.reset}`
|
|
@@ -601,13 +743,17 @@ export async function runCreateRelease(args) {
|
|
|
601
743
|
`${colors.blue}Tag:${colors.reset} ${tagAlreadyExists ? `${tagName} (pre-existing, skipped)` : tagName}`
|
|
602
744
|
);
|
|
603
745
|
console.log(`${colors.blue}Push:${colors.reset} ${pushStatus}`);
|
|
746
|
+
console.log(
|
|
747
|
+
`${colors.blue}PR:${colors.reset} ${prUrl || 'skipped'}`
|
|
748
|
+
);
|
|
604
749
|
console.log(`${colors.blue}Shadow:${colors.reset} ${shadowStatus}`);
|
|
605
750
|
console.log('');
|
|
606
751
|
|
|
607
752
|
if (options.skipPush) {
|
|
608
753
|
console.log('Next steps:');
|
|
609
754
|
console.log(` 1. Push when ready: git push -u origin ${rcBranch}`);
|
|
610
|
-
console.log(` 2.
|
|
755
|
+
console.log(` 2. Create PR: gh pr create --base main --head ${rcBranch}`);
|
|
756
|
+
console.log(` 3. Sync shadow: claude-hooks shadow sync ${rcBranch}`);
|
|
611
757
|
} else {
|
|
612
758
|
console.log('Next steps:');
|
|
613
759
|
console.log(' 1. Verify shadow deployment is running');
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File: library-warnings.js
|
|
3
|
+
* Purpose: Warning wording for Library verification gates in claude-hooks.
|
|
4
|
+
*
|
|
5
|
+
* Staleness wording is canonical in the librarian messages module
|
|
6
|
+
* (.library/librarian/messages/staleness-warnings.js) — this file
|
|
7
|
+
* re-exports it for claude-hooks consumers. Do not edit wording here;
|
|
8
|
+
* edit the librarian template instead.
|
|
9
|
+
*
|
|
10
|
+
* Related tickets:
|
|
11
|
+
* AUT-3767 — original placeholder (retired by AUT-3769)
|
|
12
|
+
* AUT-3769 — finalized wording + librarian messages module
|
|
13
|
+
* AUT-3770 — create-release integration (PR body, label, console)
|
|
14
|
+
* AUT-3738 — parent user story
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
CONSOLE_WARNING_TEMPLATE,
|
|
19
|
+
PR_BODY_SECTION_TEMPLATE,
|
|
20
|
+
PR_TAG_VALUE
|
|
21
|
+
} from '../../.library/librarian/messages/staleness-warnings.js';
|
|
22
|
+
|
|
23
|
+
export const LIBRARY_VERIFY_SKIPPED_WARNING =
|
|
24
|
+
'Library verification skipped due to an unexpected error. ' +
|
|
25
|
+
'The version bump will proceed normally.';
|
|
26
|
+
|
|
27
|
+
export const LIBRARY_VERIFY_SKIPPED_WARNING_RELEASE =
|
|
28
|
+
'Library verification skipped due to an unexpected error. ' +
|
|
29
|
+
'The release will proceed normally.';
|
package/lib/utils/github-api.js
CHANGED
|
@@ -940,6 +940,36 @@ export const findExistingPR = async ({ owner, repo, head, base }) => {
|
|
|
940
940
|
}
|
|
941
941
|
};
|
|
942
942
|
|
|
943
|
+
/**
|
|
944
|
+
* Update the body of an existing pull request
|
|
945
|
+
* @param {string} owner - Repository owner
|
|
946
|
+
* @param {string} repo - Repository name
|
|
947
|
+
* @param {number} number - PR number
|
|
948
|
+
* @param {string} body - New PR body content
|
|
949
|
+
* @returns {Promise<Object>} Updated PR data
|
|
950
|
+
*/
|
|
951
|
+
export const updatePullRequestBody = async (owner, repo, number, body) => {
|
|
952
|
+
logger.debug('github-api - updatePullRequestBody', 'Updating PR body', {
|
|
953
|
+
owner, repo, number, bodyLength: body.length
|
|
954
|
+
});
|
|
955
|
+
|
|
956
|
+
const octokit = getOctokit();
|
|
957
|
+
|
|
958
|
+
const { data } = await octokit.pulls.update({
|
|
959
|
+
owner,
|
|
960
|
+
repo,
|
|
961
|
+
pull_number: number,
|
|
962
|
+
body
|
|
963
|
+
});
|
|
964
|
+
|
|
965
|
+
logger.debug('github-api - updatePullRequestBody', 'PR body updated', {
|
|
966
|
+
number: data.number,
|
|
967
|
+
url: data.html_url
|
|
968
|
+
});
|
|
969
|
+
|
|
970
|
+
return data;
|
|
971
|
+
};
|
|
972
|
+
|
|
943
973
|
/**
|
|
944
974
|
* Get repository information
|
|
945
975
|
* Why: Fetch repo metadata for validation and context
|
|
@@ -45,6 +45,12 @@ export function parseEslintOutput(stdout) {
|
|
|
45
45
|
|
|
46
46
|
for (const fileResult of results) {
|
|
47
47
|
for (const msg of fileResult.messages || []) {
|
|
48
|
+
// Skip ESLint meta-warnings about ignored files — not code quality issues.
|
|
49
|
+
// Dot-directory files (e.g. .library/) trigger "File ignored by default"
|
|
50
|
+
// even when ignorePatterns negation is set, because ESLint's default
|
|
51
|
+
// dot-directory ignore takes precedence for explicitly passed file paths.
|
|
52
|
+
if (msg.message && msg.message.startsWith('File ignored')) continue;
|
|
53
|
+
|
|
48
54
|
const issue = {
|
|
49
55
|
file: fileResult.filePath || '',
|
|
50
56
|
line: msg.line,
|
package/package.json
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "claude-git-hooks",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Git hooks with Claude CLI for code analysis and automatic commit messages",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"claude-hooks": "./bin/claude-hooks"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"test": "npm run test:all",
|
|
11
|
-
"test:all": "npm run lint && npm run test:smoke && npm run test:unit && npm run test:integration",
|
|
12
|
-
"test:smoke": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/smoke --maxWorkers=1",
|
|
13
|
-
"test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/unit --forceExit",
|
|
14
|
-
"test:integration": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/integration --maxWorkers=1 --testTimeout=30000 --forceExit",
|
|
15
|
-
"test:integration:ci": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/integration/ci-safe.test.js --maxWorkers=1 --testTimeout=30000 --forceExit",
|
|
16
|
-
"test:changed": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/unit --changedSince=main --forceExit",
|
|
17
|
-
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
|
|
18
|
-
"test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
|
|
19
|
-
"lint": "eslint lib/ bin/claude-hooks",
|
|
20
|
-
"lint:fix": "eslint lib/ bin/claude-hooks --fix",
|
|
21
|
-
"format": "prettier --write \"lib/**/*.js\" \"bin/**\" \"test/**/*.js\"",
|
|
22
|
-
"precommit": "npm run lint && npm run test:smoke",
|
|
23
|
-
"prepublishOnly": "npm run test:all",
|
|
24
|
-
"library:check": "node .library/bin/library check",
|
|
25
|
-
"library:regenerate": "node .library/bin/library regenerate",
|
|
26
|
-
"library:extract": "node .library/bin/library extract",
|
|
27
|
-
"library:tokens": "node .library/bin/library tokens",
|
|
28
|
-
"library:graph": "node .library/bin/library graph",
|
|
29
|
-
"library:inject": "node .library/bin/library inject",
|
|
30
|
-
"library:validate": "node .library/bin/library validate",
|
|
31
|
-
"library:report": "node .library/bin/library report"
|
|
32
|
-
},
|
|
33
|
-
"keywords": [
|
|
34
|
-
"git",
|
|
35
|
-
"hooks",
|
|
36
|
-
"claude",
|
|
37
|
-
"ai",
|
|
38
|
-
"code-review",
|
|
39
|
-
"commit-messages",
|
|
40
|
-
"pre-commit",
|
|
41
|
-
"automation"
|
|
42
|
-
],
|
|
43
|
-
"author": "Pablo Rovito",
|
|
44
|
-
"license": "MIT",
|
|
45
|
-
"repository": {
|
|
46
|
-
"type": "git",
|
|
47
|
-
"url": "https://github.com/mscope-S-L/git-hooks.git"
|
|
48
|
-
},
|
|
49
|
-
"engines": {
|
|
50
|
-
"node": ">=16.9.0"
|
|
51
|
-
},
|
|
52
|
-
"engineStrict": false,
|
|
53
|
-
"os": [
|
|
54
|
-
"darwin",
|
|
55
|
-
"linux",
|
|
56
|
-
"win32"
|
|
57
|
-
],
|
|
58
|
-
"preferGlobal": true,
|
|
59
|
-
"files": [
|
|
60
|
-
"bin/",
|
|
61
|
-
"lib/",
|
|
62
|
-
"templates/",
|
|
63
|
-
"README.md",
|
|
64
|
-
"CHANGELOG.md",
|
|
65
|
-
"CLAUDE.md",
|
|
66
|
-
"LICENSE"
|
|
67
|
-
],
|
|
68
|
-
"dependencies": {
|
|
69
|
-
"@anthropic-ai/sdk": "^0.91.0",
|
|
70
|
-
"@octokit/rest": "^21.0.0",
|
|
71
|
-
"langfuse": "^3.38.20"
|
|
72
|
-
},
|
|
73
|
-
"devDependencies": {
|
|
74
|
-
"@types/jest": "^29.5.0",
|
|
75
|
-
"eslint": "^8.57.1",
|
|
76
|
-
"jest": "^29.7.0",
|
|
77
|
-
"js-tiktoken": "^1.0.18",
|
|
78
|
-
"madge": "^8.0.0",
|
|
79
|
-
"prettier": "^3.2.0",
|
|
80
|
-
"tree-sitter-wasms": "^0.1.13",
|
|
81
|
-
"web-tree-sitter": "^0.24.7"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "claude-git-hooks",
|
|
3
|
+
"version": "2.61.2",
|
|
4
|
+
"description": "Git hooks with Claude CLI for code analysis and automatic commit messages",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"claude-hooks": "./bin/claude-hooks"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "npm run test:all",
|
|
11
|
+
"test:all": "npm run lint && npm run test:smoke && npm run test:unit && npm run test:integration",
|
|
12
|
+
"test:smoke": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/smoke --maxWorkers=1",
|
|
13
|
+
"test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/unit --forceExit",
|
|
14
|
+
"test:integration": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/integration --maxWorkers=1 --testTimeout=30000 --forceExit",
|
|
15
|
+
"test:integration:ci": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/integration/ci-safe.test.js --maxWorkers=1 --testTimeout=30000 --forceExit",
|
|
16
|
+
"test:changed": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/unit --changedSince=main --forceExit",
|
|
17
|
+
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
|
|
18
|
+
"test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
|
|
19
|
+
"lint": "eslint lib/ bin/claude-hooks .library/librarian/",
|
|
20
|
+
"lint:fix": "eslint lib/ bin/claude-hooks .library/librarian/ --fix",
|
|
21
|
+
"format": "prettier --write \"lib/**/*.js\" \"bin/**\" \"test/**/*.js\"",
|
|
22
|
+
"precommit": "npm run lint && npm run test:smoke",
|
|
23
|
+
"prepublishOnly": "npm run test:all",
|
|
24
|
+
"library:check": "node .library/bin/library check",
|
|
25
|
+
"library:regenerate": "node .library/bin/library regenerate",
|
|
26
|
+
"library:extract": "node .library/bin/library extract",
|
|
27
|
+
"library:tokens": "node .library/bin/library tokens",
|
|
28
|
+
"library:graph": "node .library/bin/library graph",
|
|
29
|
+
"library:inject": "node .library/bin/library inject",
|
|
30
|
+
"library:validate": "node .library/bin/library validate",
|
|
31
|
+
"library:report": "node .library/bin/library report"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"git",
|
|
35
|
+
"hooks",
|
|
36
|
+
"claude",
|
|
37
|
+
"ai",
|
|
38
|
+
"code-review",
|
|
39
|
+
"commit-messages",
|
|
40
|
+
"pre-commit",
|
|
41
|
+
"automation"
|
|
42
|
+
],
|
|
43
|
+
"author": "Pablo Rovito",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/mscope-S-L/git-hooks.git"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=16.9.0"
|
|
51
|
+
},
|
|
52
|
+
"engineStrict": false,
|
|
53
|
+
"os": [
|
|
54
|
+
"darwin",
|
|
55
|
+
"linux",
|
|
56
|
+
"win32"
|
|
57
|
+
],
|
|
58
|
+
"preferGlobal": true,
|
|
59
|
+
"files": [
|
|
60
|
+
"bin/",
|
|
61
|
+
"lib/",
|
|
62
|
+
"templates/",
|
|
63
|
+
"README.md",
|
|
64
|
+
"CHANGELOG.md",
|
|
65
|
+
"CLAUDE.md",
|
|
66
|
+
"LICENSE"
|
|
67
|
+
],
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"@anthropic-ai/sdk": "^0.91.0",
|
|
70
|
+
"@octokit/rest": "^21.0.0",
|
|
71
|
+
"langfuse": "^3.38.20"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@types/jest": "^29.5.0",
|
|
75
|
+
"eslint": "^8.57.1",
|
|
76
|
+
"jest": "^29.7.0",
|
|
77
|
+
"js-tiktoken": "^1.0.18",
|
|
78
|
+
"madge": "^8.0.0",
|
|
79
|
+
"prettier": "^3.2.0",
|
|
80
|
+
"tree-sitter-wasms": "^0.1.13",
|
|
81
|
+
"web-tree-sitter": "^0.24.7"
|
|
82
|
+
}
|
|
83
|
+
}
|