refactor(linkedin-studio): M0-12 — wire + run migrateData (data externalized before scrub)
This commit is contained in:
parent
33aa3c4ca9
commit
5c1e1800f0
1 changed files with 16 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import { calculateScore } from './personalization-score.mjs';
|
|||
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';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const PLUGIN_ROOT = join(__dirname, '..', '..');
|
||||
|
|
@ -44,6 +45,16 @@ function dayOfWeek() {
|
|||
|
||||
let context = '';
|
||||
|
||||
// M0: relocate per-user data to the external root on first run. Idempotent
|
||||
// (silent no-op once .migrated exists); must precede every moved-path read
|
||||
// (voice/profile/scaffold scores, queue, content-history).
|
||||
let m0Migration = { status: 'skip', moved: [], copied: [] };
|
||||
try {
|
||||
m0Migration = migrateData();
|
||||
} catch {
|
||||
// Non-critical: never block session start on migration failure.
|
||||
}
|
||||
|
||||
if (existsSync(STATE_FILE)) {
|
||||
const stateContent = readFileSync(STATE_FILE, 'utf-8');
|
||||
|
||||
|
|
@ -423,6 +434,11 @@ if (!existsSync(rememberFile) && existsSync(rememberTemplate)) {
|
|||
context += `\\n## Session Context (from REMEMBER.md)\\n${rememberSummary.replace(/\n/g, '\\n')}\\n`;
|
||||
}
|
||||
|
||||
// M0: log one line when the migration actually relocated data (D5).
|
||||
if (m0Migration.status === 'migrated' && (m0Migration.moved.length || m0Migration.copied.length)) {
|
||||
context += `\\nLinkedIn Studio: migrated ${m0Migration.moved.length} file(s) + ${m0Migration.copied.length} scaffold(s) to the external data root.\\n`;
|
||||
}
|
||||
|
||||
// Output JSON for Claude Code
|
||||
const output = {
|
||||
continue: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue