feat(linkedin): integrate state-updater.mjs across all commands and hooks

Replace manual YAML editing instructions with deterministic
state-updater.mjs calls in 8 content commands (post, quick, react,
pipeline, first-post, video, publish, carousel) and 2 hook prompts
(state-update-reminder, post-creation-automation). Batch.md gets note
that state updates happen at publish time.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-04-11 00:42:17 +02:00
commit 1474948ef8
11 changed files with 141 additions and 72 deletions

View file

@ -19,7 +19,7 @@ Based on the day of the week, suggest the next optimal posting window:
Remind: 'Before posting, spend 15-20 minutes on 5x5x5 pre-engagement: find 5 people with overlapping audiences, comment thoughtfully on their recent posts.'
**4. Content Logging**
Note: The post topic and hook should be logged to the state file when the session ends (handled by Stop hook).
Note: State tracking is handled deterministically by `state-updater.mjs` via the Stop hook. Do not manually edit the state file YAML frontmatter.
**5. Voice Sample Suggestion**

View file

@ -1,23 +1,34 @@
Before ending this LinkedIn content session, do two things:
**1. Update State File**
If a post was created or finalized in this session, update `~/.claude/linkedin-thought-leadership.local.md`:
- Set `last_post_date` to today (YYYY-MM-DD format)
- Set `last_post_topic` to the main topic (use the matching `expertise_areas` value when possible for consistent pillar tracking)
- If `first_post_date` is null and a post was created, set `first_post_date` to today (YYYY-MM-DD). This is set ONCE and never changed after that.
- Check if ISO week has changed — if so, reset `posts_this_week` to 0 and update `current_week`
- Increment `posts_this_week`
- Update streak: increment `current_streak` if posting on consecutive days (gap <= 1 day), reset to 1 if gap > 2 days
- Update `longest_streak` if current exceeds it
- Add entry to '## Recent Posts' section: [YYYY-MM-DD] "Hook text..." (char count) - topic_area (use expertise_area name for consistent pillar tracking)
If a post was created or finalized in this session, use the state-updater script:
```bash
node --input-type=module -e "
import { writeState, updatePostTracking } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-updater.mjs';
writeState(content => updatePostTracking(content, {
postDate: 'YYYY-MM-DD',
postTopic: 'topic_area',
hookText: 'First 60 chars of hook...',
charCount: NNNN,
format: 'post'
}));
"
```
Replace the placeholder values with actual post data from this session.
If the user mentioned or updated their follower count during this session:
```bash
node --input-type=module -e "
import { writeState, updateFollowerCount } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-updater.mjs';
writeState(content => updateFollowerCount(content, {
count: NNNN,
month: 'YYYY-MM'
}));
"
```
- Clear `next_planned_topic` if it was used, or set it to the next suggested topic
- If analytics data was imported in this session, set `last_import_date` to today (YYYY-MM-DD) and `last_import_week` to current ISO week (YYYY-WXX)
- If the user mentioned or updated their follower count during this session:
- Update `follower_count` to the new value
- If the month changed since last monthly_growth entry, append: {month: "YYYY-MM", count: X, delta: X}
- Recalculate `growth_rate_needed`: (follower_target - follower_count) / months_remaining
- Recalculate `projected_10k_date` from average of last 3 monthly deltas
- Add entry to '## Milestone Log': [YYYY-MM] count (+delta)
**2. Pre-Publish Reminders** (only if a post was created)