Files
platform/src/servers/ensure-tool-loader.ts
T
pastilhasandClaude Opus 4.8 b9eb78c919 add header rescan button to apply officer-items changes without restart
New POST /api/rescan re-runs the boot item setup (ensureItemDirs +
ensureToolLoader) and returns live item counts; the header button calls it
and invalidates the item query caches so the UI refetches from disk.

Also fix ensure-tool-loader to write into OFFICER_ITEMS_DIR/extensions (the
runtime read path) instead of the now-unread DATA_PATH/extensions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 01:31:51 +00:00

18 lines
603 B
TypeScript

import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
import { join, resolve } from 'node:path';
import { itemsDir } from './data-path';
const SOURCE_PATH = resolve(import.meta.dir, 'tool-loader-source.ts');
export function ensureToolLoader(): void {
const targetDir = join(itemsDir('extensions'), 'tool-loader');
const targetFile = join(targetDir, 'index.ts');
mkdirSync(targetDir, { recursive: true });
const source = readFileSync(SOURCE_PATH, 'utf-8');
writeFileSync(targetFile, source, 'utf-8');
console.log('[bootstrap] Wrote tool-loader extension →', targetFile);
}