(input)
| 23 | async function main(input) { |
| 24 | const worktreePath = input.path; |
| 25 | if (!worktreePath) return; |
| 26 | |
| 27 | const pathCheck = health.validatePath(worktreePath); |
| 28 | if (!pathCheck.safe) { |
| 29 | health.securityWarning('worktree-setup', `Possible injection in worktree path — ${pathCheck.violation}. Skipping setup.`); |
| 30 | return; |
| 31 | } |
| 32 | |
| 33 | // Readiness only. Tracked manifests and ignored env files are not consent |
| 34 | // to execute lifecycle scripts or distribute secrets to another checkout. |
| 35 | |
| 36 | try { |
| 37 | const report = await checkWorktreeReadiness({ |
| 38 | projectRoot: MAIN_ROOT, |
| 39 | worktreePath, |
| 40 | branch: input.branch || null, |
| 41 | write: true, |
| 42 | }); |
| 43 | health.logTiming('worktree-readiness', 0, { |
| 44 | event: 'worktree-readiness', |
| 45 | status: report.status, |
| 46 | branch: input.branch || null, |
| 47 | worktree: path.basename(worktreePath), |
| 48 | }); |
| 49 | health.writeAuditLog('worktree-readiness', { |
| 50 | status: report.status, |
| 51 | blockFleet: report.blockFleet, |
| 52 | branch: input.branch || null, |
| 53 | worktree: path.basename(worktreePath), |
| 54 | report: report.file, |
| 55 | }); |
| 56 | } catch (err) { |
| 57 | process.stderr.write(`[worktree-setup] Readiness check failed in ${worktreePath}: ${err.message}\n`); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | let data = ''; |
| 62 | process.stdin.setEncoding('utf8'); |
| 63 | process.stdin.on('data', chunk => { data += chunk; }); |
| 64 | process.stdin.on('end', async () => { |
| 65 | try { await main(JSON.parse(data)); } catch { /* silent */ } |
| 66 | process.stdout.write('ok\n'); |
| 67 | }); |
no test coverage detected