Files
paperclip/server/src/dev-watch-ignore.ts
T
HenkDz 14d59da316 feat(adapters): external adapter plugin system with dynamic UI parser
- Plugin loader: install/reload/remove/reinstall external adapters
  from npm packages or local directories
- Plugin store persisted at ~/.paperclip/adapter-plugins.json
- Self-healing UI parser resolution with version caching
- UI: Adapter Manager page, dynamic loader, display registry
  with humanized names for unknown adapter types
- Dev watch: exclude adapter-plugins dir from tsx watcher
  to prevent mid-request server restarts during reinstall
- All consumer fallbacks use getAdapterLabel() for consistent display
- AdapterTypeDropdown uses controlled open state for proper close behavior
- Remove hermes-local from built-in UI (externalized to plugin)
- Add docs for external adapters and UI parser contract
2026-04-03 21:11:20 +01:00

40 lines
1.1 KiB
TypeScript

import fs from "node:fs";
import path from "node:path";
function toGlobstarPath(candidate: string): string {
return `${candidate.replaceAll(path.sep, "/")}/**`;
}
function addIgnorePath(target: Set<string>, candidate: string): void {
target.add(candidate);
target.add(toGlobstarPath(candidate));
try {
const realPath = fs.realpathSync(candidate);
target.add(realPath);
target.add(toGlobstarPath(realPath));
} catch {
// Ignore paths that do not exist in the current checkout.
}
}
export function resolveServerDevWatchIgnorePaths(serverRoot: string): string[] {
const ignorePaths = new Set<string>([
"**/{node_modules,bower_components,vendor}/**",
"**/.vite-temp/**",
]);
for (const relativePath of [
"../ui/node_modules",
"../ui/node_modules/.vite-temp",
"../ui/.vite",
"../ui/dist",
// npm install during reinstall would trigger a restart mid-request
// if tsx watch sees the new files. Exclude the managed plugins dir.
process.env.HOME + "/.paperclip/adapter-plugins",
]) {
addIgnorePath(ignorePaths, path.resolve(serverRoot, relativePath));
}
return [...ignorePaths];
}