(opts: RegisterOptions)
| 276 | * Called from `server.ts` once the HTTP server is listening. |
| 277 | */ |
| 278 | export function register(opts: RegisterOptions): void { |
| 279 | try { |
| 280 | const now = new Date().toISOString(); |
| 281 | const entry: RegistryEntry = { |
| 282 | dir: canonicalizeDir(opts.dir), |
| 283 | name: opts.name, |
| 284 | version: opts.version, |
| 285 | port: opts.port, |
| 286 | pid: process.pid, |
| 287 | status: "running", |
| 288 | startedAt: now, |
| 289 | updatedAt: now, |
| 290 | }; |
| 291 | |
| 292 | writeEntryFile(entry); |
| 293 | console.log(` [Registry] Registered "${opts.name}" (pid ${process.pid})`); |
| 294 | } catch (err) { |
| 295 | // Registry is a best-effort feature — never crash the main process |
| 296 | console.warn(" [Registry] Failed to register:", err); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * Deregister a Pack from the local registry directory. |
nothing calls this directly
no test coverage detected