@@ -15,6 +15,9 @@ const SENSITIVE_PATHS = [
1515 ".claude.json" ,
1616 ".gitmodules" ,
1717 ".ripgreprc" ,
18+ "CLAUDE.md" ,
19+ "CLAUDE.local.md" ,
20+ ".husky" ,
1821] ;
1922
2023/**
@@ -44,16 +47,19 @@ export function restoreConfigFromBase(baseBranch: string): void {
4447 `Restoring ${ SENSITIVE_PATHS . join ( ", " ) } from origin/${ baseBranch } (PR head is untrusted)` ,
4548 ) ;
4649
47- // Snapshot the PR's .claude/ tree to .claude-pr/ before deleting it.
48- // This lets review agents inspect what the PR actually changes (CLAUDE.md,
49- // settings, hooks, MCP configs) without those files ever being executed.
50- // The snapshot is taken before the security delete so it captures the
50+ // Snapshot every PR-authored sensitive path into .claude-pr/ before deletion
51+ // so review agents can inspect what the PR changes without those files ever
52+ // being executed. Captured before the security delete so it reflects the
5153 // PR-authored version.
5254 rmSync ( ".claude-pr" , { recursive : true , force : true } ) ;
53- if ( existsSync ( ".claude" ) ) {
54- cpSync ( ".claude" , ".claude-pr" , { recursive : true } ) ;
55+ for ( const p of SENSITIVE_PATHS ) {
56+ if ( existsSync ( p ) ) {
57+ cpSync ( p , `.claude-pr/${ p } ` , { recursive : true } ) ;
58+ }
59+ }
60+ if ( existsSync ( ".claude-pr" ) ) {
5561 console . log (
56- "Preserved PR's .claude/ → .claude-pr/ for review agents (not executed)" ,
62+ "Preserved PR's sensitive paths → .claude-pr/ for review agents (not executed)" ,
5763 ) ;
5864 }
5965
0 commit comments