This commit is contained in:
Dax Raad
2025-05-18 02:43:01 -04:00
parent a34d020bc6
commit d0d67029f4
11 changed files with 351 additions and 75 deletions

View File

@@ -1,42 +0,0 @@
import path from "node:path";
import { Log } from "../util/log";
import { App } from "../app";
export namespace Config {
const log = Log.create({ service: "config" });
// TODO: this should be zod
export interface Info {
mcp: any; // TODO
lsp: any; // TODO
}
function state() {
return App.service("config", async () => {
const app = await App.use();
let result: Info = {
mcp: {},
lsp: {},
};
for (const file of ["opencode.jsonc", "opencode.json"]) {
const resolved = path.join(app.root, file);
log.info("searching", { path: resolved });
try {
result = await import(path.join(app.root, file)).then(
(mod) => mod.default,
);
log.info("found", { path: resolved });
break;
} catch (e) {
continue;
}
}
log.info("loaded", result);
return result;
});
}
function get() {
return state();
}
}