feat(linkedin-studio): N13 — publiserings-slots + vacancy-varsel + WIP-roll-up + slot-default [skip-docs]
A1-10 + D-5. The queue answers "what is scheduled"; nothing answered "is the week covered, and what is still being written". N13 makes both readable at session start. - Publishing slots are operator config: profile/publishing-slots.json in the per-user data dir, schema + OPT-IN template in config/publishing-slots.template.json. The plugin ships no publishing times and writes the grid for nobody; absent config means every slot surface stays silent (same never-nag discipline as the trend/brain nudges). Data dir rather than the state file, which is machine-written and whose frontmatter reader does not parse lists. - hooks/scripts/slots.mjs (new): one implementation behind four surfaces. Zero-dep (a SessionStart hook must not spawn tsx), pure core (dates in as strings, no clock), imported by the commands exactly as queue-manager.mjs already is — so session-start's vacancy warning and Step 10's slot default cannot drift apart. - Coverage counts the short-form queue (scheduled/published; cancelled frees the slot) AND editions-register rows claiming that date, counted per date, so long-form and short-form cannot be double-booked and a two-slot day needs two posts. - Session start gains "## Editions in Flight" (series, phase, next action, claimed slot, days in flight) and "## Publishing Slots" (next open slot, open count in 14 days, and how to fill it when the gap is <=3 days). The existing discovery nudge is untouched. - /linkedin router + /linkedin:calendar surface the same roll-up; calendar documents the opt-in copy. /linkedin:newsletter Step 10 defaults to the next open slot (one confirmation, not an interview) and writes --slot onto the register row. - D-5: references/scheduling-strategy.md marked "confidence: low / directional" per the algorithm reference's own standard, deferring to the operator's grid and their own analytics. Neutral example time replaces the operator-specific one in the N12 docs. TDD: red proven first (module absent; 5 session-start behaviours failing). hooks 140 -> 174 · test-runner 184 -> 197 (Section 16t: 13 unconditional greps incl. a de-niche check that no publishing time is hardcoded in the slot path and no operator grid is committed, + non-vacuity self-test; anti-erosion floor 166 -> 179). Suites green: trends 300/0 · brain 134/0 · editions 72/0 · specifics-bank 45/0 · tests 35/0 · render 60/0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QxvWAjte7vPcF79QeSRvRJ
This commit is contained in:
parent
657539ef09
commit
677eab9294
14 changed files with 1069 additions and 19 deletions
|
|
@ -10,6 +10,15 @@ import { queueToday, queueOverdue, queueUpcoming } from './queue-manager.mjs';
|
|||
import { applyWeekRollover } from './week-rollover.mjs';
|
||||
import { getDataRoot } from './data-root.mjs';
|
||||
import { migrateData } from './migrate-data.mjs';
|
||||
import {
|
||||
activeEditions,
|
||||
readSlots,
|
||||
slotOccurrences,
|
||||
slotVacancies,
|
||||
daysUntil,
|
||||
formatSlot,
|
||||
defaultSlotsPath,
|
||||
} from './slots.mjs';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const PLUGIN_ROOT = join(__dirname, '..', '..');
|
||||
|
|
@ -536,6 +545,49 @@ if (latestBrief && latestBrief.summary) {
|
|||
context += `\\n## Morning Brief (${latestBrief.date})\\n${latestBrief.summary}\\n→ Full brief: ${latestBrief.file}\\n`;
|
||||
}
|
||||
|
||||
// N13 (A1-10/A1-11): the week's production picture — long-form editions in
|
||||
// flight, and publishing slots nothing covers yet. Unconditional like the brain
|
||||
// nudge above (the fresh-install branch reassigns `context`, so an earlier
|
||||
// append would be clobbered). Zero-tsx: slots.mjs reads the register, the queue
|
||||
// and the grid as plain JSON, the same discipline as trendsNewestCapture.
|
||||
// Both blocks are silent when their data is absent — an operator who has
|
||||
// configured no slots and started no edition is never nagged.
|
||||
const SLOT_HORIZON_DAYS = 14;
|
||||
const SLOT_IMMINENT_DAYS = 3;
|
||||
try {
|
||||
const inFlight = activeEditions();
|
||||
if (inFlight.length > 0) {
|
||||
context += '\\n## Editions in Flight\\n';
|
||||
for (const e of inFlight) {
|
||||
const age = e.daysInFlight === null ? '' : ` | ${e.daysInFlight}d in flight`;
|
||||
context += `- ${e.series} #${e.editionId} — ${e.title || 'untitled'} | phase: ${e.currentPhase}`;
|
||||
context += ` | next: ${e.nextAction || 'unset'} | slot: ${e.slot || 'unclaimed'}${age}\\n`;
|
||||
}
|
||||
context += '- Resume an edition with /linkedin:newsletter (it reads edition-state.json, not this view).\\n';
|
||||
}
|
||||
|
||||
const { slots } = readSlots();
|
||||
if (slots.length > 0) {
|
||||
const today = new Date().toISOString().slice(0, 10);
|
||||
const planned = slotOccurrences(slots, today, SLOT_HORIZON_DAYS).length;
|
||||
const vacancies = slotVacancies({ from: today, days: SLOT_HORIZON_DAYS });
|
||||
context += '\\n## Publishing Slots\\n';
|
||||
if (vacancies.length > 0) {
|
||||
const until = daysUntil(today, vacancies[0].date);
|
||||
context += `- Next open slot: ${formatSlot(vacancies[0], today)}\\n`;
|
||||
context += `- Open in the next ${SLOT_HORIZON_DAYS} days: ${vacancies.length} of ${planned} slot(s)\\n`;
|
||||
if (until !== null && until <= SLOT_IMMINENT_DAYS) {
|
||||
context += '- Fill it: /linkedin:batch (short-form) or /linkedin:newsletter (long-form).\\n';
|
||||
}
|
||||
} else {
|
||||
context += `- All ${planned} slot(s) in the next ${SLOT_HORIZON_DAYS} days are covered.\\n`;
|
||||
}
|
||||
context += `- Grid: ${defaultSlotsPath()}\\n`;
|
||||
}
|
||||
} catch {
|
||||
// Non-critical: a broken grid or register must never block session start.
|
||||
}
|
||||
|
||||
// Read REMEMBER.md for user session context
|
||||
const rememberFile = join(getDataRoot(), 'REMEMBER.md');
|
||||
const rememberTemplate = join(PLUGIN_ROOT, 'config', 'REMEMBER.template.md');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue