tools system - web-fetch

This commit is contained in:
2026-02-24 00:06:32 +00:00
parent 2126f3912e
commit 071e2decc3
8 changed files with 561 additions and 4 deletions
+32
View File
@@ -0,0 +1,32 @@
import { readdirSync, existsSync, mkdirSync, cpSync } from 'node:fs';
import { join } from 'node:path';
import { SEED_PATH, DATA_PATH } from './data-path';
const SEED_TOOLS_DIR = join(SEED_PATH, 'tools');
const GLOBAL_TOOLS_DIR = join(DATA_PATH, 'tools');
export function syncSeedTools(): void {
if (!existsSync(SEED_TOOLS_DIR)) return;
mkdirSync(GLOBAL_TOOLS_DIR, { recursive: true });
const seedEntries = readdirSync(SEED_TOOLS_DIR, { withFileTypes: true });
for (const entry of seedEntries) {
if (!entry.isDirectory()) continue;
const seedToolDir = join(SEED_TOOLS_DIR, entry.name);
const toolFile = join(seedToolDir, 'TOOL.md');
if (!existsSync(toolFile)) continue;
const targetDir = join(GLOBAL_TOOLS_DIR, entry.name);
if (existsSync(targetDir)) {
// Tool already exists in DATA_PATH — skip to preserve user edits
continue;
}
cpSync(seedToolDir, targetDir, { recursive: true });
console.log(`[tools] Synced seed tool: ${entry.name}`);
}
}