/**
 * @internal
 * G6 gitignore-in-sync — blocking gate for `apt:ship`.
 *
 * Promotes the existing C34a drift warning to a hard block at ship time:
 * wraps checkGitignoreDrift(projectRoot) and fails when drifted === true.
 */
import { join } from 'node:path';
import { checkGitignoreDrift } from '../../config/gitignore-drift.mjs';
import { registerGate } from '../registry.mjs';
const gate = {
    id: 'gitignore-in-sync',
    description: '.aperant/.gitignore matches policy-expected template',
    severity: 'blocking',
    skills: ['ship'],
    async check(ctx) {
        const inputs = [
            join(ctx.sharedRoot, '.aperant', '.gitignore'),
            join(ctx.sharedRoot, '.aperant', 'config.json'),
        ];
        const result = checkGitignoreDrift(ctx.sharedRoot);
        if (result.drifted) {
            // BUG-028: surface the unified-diff summary in the reason so
            // users see exactly which template lines drifted without
            // re-running `apt-tools config upgrade-gitignore --dry-run`.
            return {
                status: 'fail',
                reason: result.reason ?? '.aperant/.gitignore has drifted from policy-expected template',
                evidence: { diff: result.diff ?? null },
                inputs,
            };
        }
        return {
            status: 'pass',
            reason: '.aperant/.gitignore matches policy-expected template',
            inputs,
        };
    },
};
registerGate(gate);
export default gate;
//# sourceMappingURL=gitignore-in-sync.mjs.map