#!/usr/bin/env node
// pre-compact.mjs
// PreCompact hook for linkedin-studio plugin
// Reminds Claude to preserve critical LinkedIn session context before compaction
//
// Exit codes:
//   0 - Always allow (informational hook)

const context = [
  'Before compacting context, preserve these critical LinkedIn session details:',
  '- Current post draft (full text if in progress)',
  '- Chosen angle and format',
  '- User feedback and iteration direction',
  '- Quality check results',
  '- State file values (streak, weekly count, last post date)',
  '- Any planned topics or next steps',
  'Ensure these survive the context compaction.',
].join('\n');

const output = {
  continue: true,
  hookSpecificOutput: {
    hookEventName: 'PreCompact',
    additionalContext: context,
  },
};

process.stdout.write(JSON.stringify(output));
process.exit(0);
