25 lines
971 B
JavaScript
25 lines
971 B
JavaScript
#!/usr/bin/env node
|
|
|
|
// Initializes the additive autonomy schema and creates one reconciliation job.
|
|
// It deliberately does not rewrite legacy intelligence or enqueue millions of
|
|
// historical records; reconciliation workers discover those in bounded batches.
|
|
const path = require('path');
|
|
const Database = require('better-sqlite3');
|
|
const { initAutonomySchema } = require('../src/autonomy/schema');
|
|
const { enqueueJob } = require('../src/autonomy/jobs');
|
|
|
|
const intelligencePath = process.env.INTELLIGENCE_DB || path.resolve(process.cwd(), 'intelligence.sqlite');
|
|
const db = new Database(intelligencePath);
|
|
db.pragma('journal_mode = WAL');
|
|
initAutonomySchema(db);
|
|
const result = enqueueJob(db, {
|
|
jobType: 'reconcile_archive',
|
|
lane: 'maintenance',
|
|
priority: 100,
|
|
entityType: 'archive',
|
|
entityId: 'archive',
|
|
idempotencyKey: 'reconcile_archive:v1',
|
|
});
|
|
console.log(JSON.stringify({ intelligencePath, reconciliationJobInserted: result.inserted }));
|
|
db.close();
|