@codeworksh/cli 0.5.0 → 0.6.0-canary.100.1.g71d09a02
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -2
- package/{acp-JnyJmRCD.mjs → acp-DLewRhY0.mjs} +92 -42
- package/acp-DLewRhY0.mjs.map +1 -0
- package/{add-Dzsv-fKd.mjs → add-DtqnGWjN.mjs} +5 -5
- package/add-DtqnGWjN.mjs.map +1 -0
- package/add-cjwCaNUh.mjs +87 -0
- package/add-cjwCaNUh.mjs.map +1 -0
- package/{catalog-C1G3pzHZ.mjs → catalog-XfqtqMDz.mjs} +2 -2
- package/{catalog-C1G3pzHZ.mjs.map → catalog-XfqtqMDz.mjs.map} +1 -1
- package/{check-DhojkK_E.mjs → check-DnIEQ4vp.mjs} +4 -4
- package/{check-DhojkK_E.mjs.map → check-DnIEQ4vp.mjs.map} +1 -1
- package/control-kIq8zb3O.mjs +31 -0
- package/control-kIq8zb3O.mjs.map +1 -0
- package/disconnect-BzjVSYdQ.mjs +2 -0
- package/{entries-KpYvZdpi.mjs → entries-hMxcOaPm.mjs} +3 -3
- package/{entries-KpYvZdpi.mjs.map → entries-hMxcOaPm.mjs.map} +1 -1
- package/{error-BMI81XvR.mjs → error-BVSfzBzb.mjs} +240 -91
- package/error-BVSfzBzb.mjs.map +1 -0
- package/fork-DQWc28Mp.mjs +32 -0
- package/fork-DQWc28Mp.mjs.map +1 -0
- package/{identity-BA1-EGoN.mjs → identity-b5SuHVok.mjs} +2 -2
- package/{identity-BA1-EGoN.mjs.map → identity-b5SuHVok.mjs.map} +1 -1
- package/index.mjs +40 -25
- package/index.mjs.map +1 -1
- package/{install-BLRDBzp1.mjs → install-Cl2JX_Ds.mjs} +4 -4
- package/{install-BLRDBzp1.mjs.map → install-Cl2JX_Ds.mjs.map} +1 -1
- package/jsonc-BwztMdEB.mjs +58 -0
- package/jsonc-BwztMdEB.mjs.map +1 -0
- package/{link--UnM2qnT.mjs → link-CVW9LiJQ.mjs} +3 -3
- package/{link--UnM2qnT.mjs.map → link-CVW9LiJQ.mjs.map} +1 -1
- package/list-C4029JEd.mjs +36 -0
- package/list-C4029JEd.mjs.map +1 -0
- package/list-CKxJokDj.mjs +71 -0
- package/list-CKxJokDj.mjs.map +1 -0
- package/{list-BE4xSEe3.mjs → list-CQcI-iX0.mjs} +4 -4
- package/{list-BE4xSEe3.mjs.map → list-CQcI-iX0.mjs.map} +1 -1
- package/{list-9fVqelid.mjs → list-CtFUvztt.mjs} +4 -4
- package/{list-9fVqelid.mjs.map → list-CtFUvztt.mjs.map} +1 -1
- package/{login-CRwxi5WD.mjs → login-DT1s4zCM.mjs} +4 -4
- package/{login-CRwxi5WD.mjs.map → login-DT1s4zCM.mjs.map} +1 -1
- package/login-qqBsseni.mjs +59 -0
- package/login-qqBsseni.mjs.map +1 -0
- package/logout-D1-vVgEh.mjs +17 -0
- package/logout-D1-vVgEh.mjs.map +1 -0
- package/{logout-C89X0B9M.mjs → logout-OnEsebcY.mjs} +4 -4
- package/{logout-C89X0B9M.mjs.map → logout-OnEsebcY.mjs.map} +1 -1
- package/package-DdxpVK0O.mjs +6 -0
- package/package-DdxpVK0O.mjs.map +1 -0
- package/package.json +3 -4
- package/{providers-BrXJvY2P.mjs → providers-DnhkGLsd.mjs} +4 -4
- package/{providers-BrXJvY2P.mjs.map → providers-DnhkGLsd.mjs.map} +1 -1
- package/reconnect-B0WnyTXS.mjs +2 -0
- package/{refresh--j0Pj4Cw.mjs → refresh-BUW0WVh_.mjs} +4 -4
- package/{refresh--j0Pj4Cw.mjs.map → refresh-BUW0WVh_.mjs.map} +1 -1
- package/{refresh-D0wBP2Go.mjs → refresh-PdkrwU5g.mjs} +4 -4
- package/{refresh-D0wBP2Go.mjs.map → refresh-PdkrwU5g.mjs.map} +1 -1
- package/relink-CAPQjc2V.mjs +23 -0
- package/relink-CAPQjc2V.mjs.map +1 -0
- package/{reload-DgPawyzr.mjs → reload-DVPHF5gJ.mjs} +3 -3
- package/{reload-DgPawyzr.mjs.map → reload-DVPHF5gJ.mjs.map} +1 -1
- package/remove-DY5b7L8Y.mjs +26 -0
- package/remove-DY5b7L8Y.mjs.map +1 -0
- package/{remove-DfFme5w2.mjs → remove-iGViyrLi.mjs} +4 -4
- package/{remove-DfFme5w2.mjs.map → remove-iGViyrLi.mjs.map} +1 -1
- package/{restart-DDrkmn2h.mjs → restart-BtqqBQLt.mjs} +4 -4
- package/{restart-DDrkmn2h.mjs.map → restart-BtqqBQLt.mjs.map} +1 -1
- package/{run-CVRkm_Iz.mjs → run-B0PLTBoU.mjs} +34 -18
- package/run-B0PLTBoU.mjs.map +1 -0
- package/{runtime-B43doHjV.mjs → runtime-CK2CunDw.mjs} +175 -20
- package/runtime-CK2CunDw.mjs.map +1 -0
- package/{serve-DDw1dCvW.mjs → serve-DbmAg7QU.mjs} +122 -75
- package/serve-DbmAg7QU.mjs.map +1 -0
- package/{service-DJR6nPam.mjs → service-Ddcq73-8.mjs} +8 -32
- package/service-Ddcq73-8.mjs.map +1 -0
- package/{settings-BfmoL27m.mjs → settings-Ct8kxLeD.mjs} +8 -36
- package/settings-Ct8kxLeD.mjs.map +1 -0
- package/{shared-CnuCjvcG.mjs → shared-B6BI-4BA.mjs} +3 -3
- package/{shared-CnuCjvcG.mjs.map → shared-B6BI-4BA.mjs.map} +1 -1
- package/shared-QBlwaQPR.mjs +88 -0
- package/shared-QBlwaQPR.mjs.map +1 -0
- package/{start-DwhV9ucd.mjs → start-KGLC_hu2.mjs} +4 -4
- package/{start-DwhV9ucd.mjs.map → start-KGLC_hu2.mjs.map} +1 -1
- package/{status-DVzFDoek.mjs → status-B1zDTFpF.mjs} +4 -4
- package/{status-DVzFDoek.mjs.map → status-B1zDTFpF.mjs.map} +1 -1
- package/{status-Bklxb3u6.mjs → status-l1g4IrPc.mjs} +4 -4
- package/{status-Bklxb3u6.mjs.map → status-l1g4IrPc.mjs.map} +1 -1
- package/{stop-DI91UvG_.mjs → stop-ttgPPf0H.mjs} +4 -4
- package/{stop-DI91UvG_.mjs.map → stop-ttgPPf0H.mjs.map} +1 -1
- package/thread-skUkybyv.mjs +15 -0
- package/thread-skUkybyv.mjs.map +1 -0
- package/{update-D0XPVfJu.mjs → update-Y2GmQPZW.mjs} +4 -4
- package/{update-D0XPVfJu.mjs.map → update-Y2GmQPZW.mjs.map} +1 -1
- package/acp-JnyJmRCD.mjs.map +0 -1
- package/add-Dzsv-fKd.mjs.map +0 -1
- package/error-BMI81XvR.mjs.map +0 -1
- package/package-Bi5FfVSP.mjs +0 -6
- package/package-Bi5FfVSP.mjs.map +0 -1
- package/run-CVRkm_Iz.mjs.map +0 -1
- package/runtime-B43doHjV.mjs.map +0 -1
- package/serve-DDw1dCvW.mjs.map +0 -1
- package/service-DJR6nPam.mjs.map +0 -1
- package/settings-BfmoL27m.mjs.map +0 -1
- package/tui-Cdim7SjU.mjs +0 -76
- package/tui-Cdim7SjU.mjs.map +0 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure } from "./error-BVSfzBzb.mjs";
|
|
3
|
+
import { n as configured, r as describe, t as MARKS } from "./shared-QBlwaQPR.mjs";
|
|
4
|
+
import { Effect, Layer, References } from "effect";
|
|
5
|
+
import { Database, Event, Mcp } from "@codeworksh/harness/effect";
|
|
6
|
+
//#region src/cli/cmd/handlers/mcp/list.ts
|
|
7
|
+
var list_default = handler(Cmd.commands.mcp.commands.list, Effect.fn("CLI.mcp.list")(function* ({ json }) {
|
|
8
|
+
return yield* Effect.gen(function* () {
|
|
9
|
+
const { home, authFile, hostCwd, root, user, servers, errors } = yield* configured();
|
|
10
|
+
const statuses = yield* Mcp.check({
|
|
11
|
+
servers: servers.map((server) => [server.name, server.config]),
|
|
12
|
+
directory: hostCwd,
|
|
13
|
+
hostDir: root ?? hostCwd
|
|
14
|
+
}).pipe(Effect.provide(Mcp.layer({
|
|
15
|
+
hostCwd,
|
|
16
|
+
home,
|
|
17
|
+
authFile
|
|
18
|
+
}).pipe(Layer.provide(Event.layer.pipe(Layer.provide(Database.layer(":memory:")))))), Effect.provideService(References.MinimumLogLevel, "None"));
|
|
19
|
+
const reports = servers.map((server) => {
|
|
20
|
+
const { config } = server;
|
|
21
|
+
const status = statuses.find((one) => one.server === server.name);
|
|
22
|
+
const exposure = config.exposure ?? "direct";
|
|
23
|
+
const tools = status?.tools ?? [];
|
|
24
|
+
const overrides = tools.filter((tool) => tool.exposure !== exposure);
|
|
25
|
+
const state = status?.state ?? "disabled";
|
|
26
|
+
return {
|
|
27
|
+
name: server.name,
|
|
28
|
+
level: server.file === user ? "user" : "project",
|
|
29
|
+
file: server.file,
|
|
30
|
+
...server.override === void 0 ? {} : { override: server.override },
|
|
31
|
+
enabled: config.enabled !== false,
|
|
32
|
+
exposure,
|
|
33
|
+
transport: "url" in config ? config.url : [config.command, ...config.args ?? []].join(" "),
|
|
34
|
+
state,
|
|
35
|
+
tools: tools.map((tool) => tool.name),
|
|
36
|
+
...status?.skipped === void 0 ? {} : { skipped: status.skipped },
|
|
37
|
+
...overrides.length === 0 ? {} : { toolExposure: Object.fromEntries(overrides.map((tool) => [tool.name, tool.exposure])) },
|
|
38
|
+
...status?.resources ? { resources: true } : {},
|
|
39
|
+
...state !== "connected" && status?.error !== void 0 ? { error: status.error } : {}
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
if (errors.length > 0 || reports.some((report) => report.enabled && report.state !== "connected")) yield* Effect.sync(() => {
|
|
43
|
+
process.exitCode = 1;
|
|
44
|
+
});
|
|
45
|
+
if (json) return yield* writeOut(`${JSON.stringify({
|
|
46
|
+
servers: reports,
|
|
47
|
+
errors
|
|
48
|
+
}, null, 2)}\n`);
|
|
49
|
+
const lines = [];
|
|
50
|
+
if (reports.length === 0 && errors.length === 0) lines.push(`No MCP servers configured. Add them to ${user} or .codework/mcp.json.`);
|
|
51
|
+
const width = Math.max(0, ...reports.map((report) => report.name.length));
|
|
52
|
+
for (const report of reports) {
|
|
53
|
+
lines.push(`${MARKS[report.state]} ${report.name.padEnd(width)} ${describe(report.state, report.tools.length, report.skipped)} (${report.exposure}, ${report.level})`);
|
|
54
|
+
const detail = (line) => lines.push(` ${line}`);
|
|
55
|
+
detail(report.transport);
|
|
56
|
+
if (report.override !== void 0) detail(`project override: ${report.override}`);
|
|
57
|
+
if (report.tools.length > 0) detail(`tools: ${report.tools.map((tool) => {
|
|
58
|
+
const exposure = report.toolExposure?.[tool];
|
|
59
|
+
return exposure === void 0 ? tool : `${tool} [${exposure}]`;
|
|
60
|
+
}).join(", ")}`);
|
|
61
|
+
if (report.resources) detail("offers resources");
|
|
62
|
+
if (report.error !== void 0) for (const line of report.error.split("\n")) detail(line);
|
|
63
|
+
}
|
|
64
|
+
for (const error of errors) lines.push(`config error: ${error}`);
|
|
65
|
+
yield* writeOut(`${lines.join("\n")}\n`);
|
|
66
|
+
}).pipe(Effect.catch(reportFailure));
|
|
67
|
+
}));
|
|
68
|
+
//#endregion
|
|
69
|
+
export { list_default as default };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=list-CKxJokDj.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-CKxJokDj.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/mcp/list.ts"],"sourcesContent":["/* @effect-diagnostics preferSchemaOverJson:off -- `--json` prints the report as it is built. */\nimport { Database, Event, type EventList, Mcp } from \"@codeworksh/harness/effect\";\nimport { Effect, Layer, References } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { configured, describe, MARKS } from \"./shared.ts\";\n\ninterface Report {\n\treadonly name: string;\n\treadonly level: \"user\" | \"project\";\n\treadonly file: string;\n\t/** The project `mcp.json` that overrides `enabled` or exposure of this user server. */\n\treadonly override?: string;\n\treadonly enabled: boolean;\n\treadonly exposure: string;\n\treadonly transport: string;\n\treadonly state: Mcp.State;\n\treadonly tools: ReadonlyArray<string>;\n\t/** Tools it listed that were left out because the MCP SDK rejects them. */\n\treadonly skipped?: EventList.McpSkipped;\n\t/** Tools whose exposure differs from the server's, from `toolExposure`. */\n\treadonly toolExposure?: Record<string, string>;\n\t/** Whether the server offers resources. They are not listed: listing every one can take long. */\n\treadonly resources?: true;\n\treadonly error?: string;\n}\n\nexport default Runtime.handler(\n\tCmd.commands.mcp.commands.list,\n\tEffect.fn(\"CLI.mcp.list\")(function* ({ json }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst { home, authFile, hostCwd, root, user, servers, errors } = yield* configured();\n\t\t\t// Every connect problem is in the report; the service's own logs would only repeat it.\n\t\t\tconst statuses = yield* Mcp.check({\n\t\t\t\tservers: servers.map((server) => [server.name, server.config] as const),\n\t\t\t\tdirectory: hostCwd,\n\t\t\t\thostDir: root ?? hostCwd,\n\t\t\t}).pipe(\n\t\t\t\t// Status events need an event service; nothing reads them here, so it keeps them in memory.\n\t\t\t\tEffect.provide(\n\t\t\t\t\tMcp.layer({ hostCwd, home, authFile }).pipe(\n\t\t\t\t\t\tLayer.provide(Event.layer.pipe(Layer.provide(Database.layer(\":memory:\")))),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tEffect.provideService(References.MinimumLogLevel, \"None\"),\n\t\t\t);\n\t\t\tconst reports = servers.map((server): Report => {\n\t\t\t\tconst { config } = server;\n\t\t\t\tconst status = statuses.find((one) => one.server === server.name);\n\t\t\t\tconst exposure = config.exposure ?? \"direct\";\n\t\t\t\tconst tools = status?.tools ?? [];\n\t\t\t\tconst overrides = tools.filter((tool) => tool.exposure !== exposure);\n\t\t\t\tconst state = status?.state ?? \"disabled\";\n\t\t\t\treturn {\n\t\t\t\t\tname: server.name,\n\t\t\t\t\tlevel: server.file === user ? \"user\" : \"project\",\n\t\t\t\t\tfile: server.file,\n\t\t\t\t\t...(server.override === undefined ? {} : { override: server.override }),\n\t\t\t\t\tenabled: config.enabled !== false,\n\t\t\t\t\texposure,\n\t\t\t\t\ttransport: \"url\" in config ? config.url : [config.command, ...(config.args ?? [])].join(\" \"),\n\t\t\t\t\tstate,\n\t\t\t\t\ttools: tools.map((tool) => tool.name),\n\t\t\t\t\t...(status?.skipped === undefined ? {} : { skipped: status.skipped }),\n\t\t\t\t\t...(overrides.length === 0\n\t\t\t\t\t\t? {}\n\t\t\t\t\t\t: { toolExposure: Object.fromEntries(overrides.map((tool) => [tool.name, tool.exposure])) }),\n\t\t\t\t\t...(status?.resources ? { resources: true as const } : {}),\n\t\t\t\t\t...(state !== \"connected\" && status?.error !== undefined ? { error: status.error } : {}),\n\t\t\t\t};\n\t\t\t});\n\t\t\tconst failed = errors.length > 0 || reports.some((report) => report.enabled && report.state !== \"connected\");\n\t\t\tif (failed)\n\t\t\t\tyield* Effect.sync(() => {\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t});\n\n\t\t\tif (json) return yield* writeOut(`${JSON.stringify({ servers: reports, errors }, null, 2)}\\n`);\n\t\t\tconst lines: string[] = [];\n\t\t\tif (reports.length === 0 && errors.length === 0)\n\t\t\t\tlines.push(`No MCP servers configured. Add them to ${user} or .codework/mcp.json.`);\n\t\t\tconst width = Math.max(0, ...reports.map((report) => report.name.length));\n\t\t\tfor (const report of reports) {\n\t\t\t\tlines.push(\n\t\t\t\t\t`${MARKS[report.state]} ${report.name.padEnd(width)} ${describe(report.state, report.tools.length, report.skipped)} (${report.exposure}, ${report.level})`,\n\t\t\t\t);\n\t\t\t\tconst detail = (line: string) => lines.push(` ${line}`);\n\t\t\t\tdetail(report.transport);\n\t\t\t\tif (report.override !== undefined) detail(`project override: ${report.override}`);\n\t\t\t\tif (report.tools.length > 0)\n\t\t\t\t\tdetail(\n\t\t\t\t\t\t`tools: ${report.tools\n\t\t\t\t\t\t\t.map((tool) => {\n\t\t\t\t\t\t\t\tconst exposure = report.toolExposure?.[tool];\n\t\t\t\t\t\t\t\treturn exposure === undefined ? tool : `${tool} [${exposure}]`;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.join(\", \")}`,\n\t\t\t\t\t);\n\t\t\t\tif (report.resources) detail(\"offers resources\");\n\t\t\t\tif (report.error !== undefined) for (const line of report.error.split(\"\\n\")) detail(line);\n\t\t\t}\n\t\t\tfor (const error of errors) lines.push(`config error: ${error}`);\n\t\t\tyield* writeOut(`${lines.join(\"\\n\")}\\n`);\n\t\t});\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AA6BA,IAAA,eAAeA,QACd,IAAI,SAAS,IAAI,SAAS,MAC1B,OAAO,GAAG,cAAc,CAAC,CAAC,WAAW,EAAE,QAAQ;CA2E9C,OAAO,OA1ES,OAAO,IAAI,aAAa;EACvC,MAAM,EAAE,MAAM,UAAU,SAAS,MAAM,MAAM,SAAS,WAAW,OAAO,WAAW;EAEnF,MAAM,WAAW,OAAO,IAAI,MAAM;GACjC,SAAS,QAAQ,KAAK,WAAW,CAAC,OAAO,MAAM,OAAO,MAAM,CAAU;GACtE,WAAW;GACX,SAAS,QAAQ;EAClB,CAAC,CAAC,CAAC,KAEF,OAAO,QACN,IAAI,MAAM;GAAE;GAAS;GAAM;EAAS,CAAC,CAAC,CAAC,KACtC,MAAM,QAAQ,MAAM,MAAM,KAAK,MAAM,QAAQ,SAAS,MAAM,UAAU,CAAC,CAAC,CAAC,CAC1E,CACD,GACA,OAAO,eAAe,WAAW,iBAAiB,MAAM,CACzD;EACA,MAAM,UAAU,QAAQ,KAAK,WAAmB;GAC/C,MAAM,EAAE,WAAW;GACnB,MAAM,SAAS,SAAS,MAAM,QAAQ,IAAI,WAAW,OAAO,IAAI;GAChE,MAAM,WAAW,OAAO,YAAY;GACpC,MAAM,QAAQ,QAAQ,SAAS,CAAC;GAChC,MAAM,YAAY,MAAM,QAAQ,SAAS,KAAK,aAAa,QAAQ;GACnE,MAAM,QAAQ,QAAQ,SAAS;GAC/B,OAAO;IACN,MAAM,OAAO;IACb,OAAO,OAAO,SAAS,OAAO,SAAS;IACvC,MAAM,OAAO;IACb,GAAI,OAAO,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,OAAO,SAAS;IACrE,SAAS,OAAO,YAAY;IAC5B;IACA,WAAW,SAAS,SAAS,OAAO,MAAM,CAAC,OAAO,SAAS,GAAI,OAAO,QAAQ,CAAC,CAAE,CAAC,CAAC,KAAK,GAAG;IAC3F;IACA,OAAO,MAAM,KAAK,SAAS,KAAK,IAAI;IACpC,GAAI,QAAQ,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS,OAAO,QAAQ;IACnE,GAAI,UAAU,WAAW,IACtB,CAAC,IACD,EAAE,cAAc,OAAO,YAAY,UAAU,KAAK,SAAS,CAAC,KAAK,MAAM,KAAK,QAAQ,CAAC,CAAC,EAAE;IAC3F,GAAI,QAAQ,YAAY,EAAE,WAAW,KAAc,IAAI,CAAC;IACxD,GAAI,UAAU,eAAe,QAAQ,UAAU,KAAA,IAAY,EAAE,OAAO,OAAO,MAAM,IAAI,CAAC;GACvF;EACD,CAAC;EAED,IADe,OAAO,SAAS,KAAK,QAAQ,MAAM,WAAW,OAAO,WAAW,OAAO,UAAU,WAAW,GAE1G,OAAO,OAAO,WAAW;GACxB,QAAQ,WAAW;EACpB,CAAC;EAEF,IAAI,MAAM,OAAO,OAAO,SAAS,GAAG,KAAK,UAAU;GAAE,SAAS;GAAS;EAAO,GAAG,MAAM,CAAC,EAAE,GAAG;EAC7F,MAAM,QAAkB,CAAC;EACzB,IAAI,QAAQ,WAAW,KAAK,OAAO,WAAW,GAC7C,MAAM,KAAK,0CAA0C,KAAK,wBAAwB;EACnF,MAAM,QAAQ,KAAK,IAAI,GAAG,GAAG,QAAQ,KAAK,WAAW,OAAO,KAAK,MAAM,CAAC;EACxE,KAAK,MAAM,UAAU,SAAS;GAC7B,MAAM,KACL,GAAG,MAAM,OAAO,OAAO,GAAG,OAAO,KAAK,OAAO,KAAK,EAAE,IAAI,SAAS,OAAO,OAAO,OAAO,MAAM,QAAQ,OAAO,OAAO,EAAE,IAAI,OAAO,SAAS,IAAI,OAAO,MAAM,EAC1J;GACA,MAAM,UAAU,SAAiB,MAAM,KAAK,OAAO,MAAM;GACzD,OAAO,OAAO,SAAS;GACvB,IAAI,OAAO,aAAa,KAAA,GAAW,OAAO,qBAAqB,OAAO,UAAU;GAChF,IAAI,OAAO,MAAM,SAAS,GACzB,OACC,UAAU,OAAO,MACf,KAAK,SAAS;IACd,MAAM,WAAW,OAAO,eAAe;IACvC,OAAO,aAAa,KAAA,IAAY,OAAO,GAAG,KAAK,IAAI,SAAS;GAC7D,CAAC,CAAC,CACD,KAAK,IAAI,GACZ;GACD,IAAI,OAAO,WAAW,OAAO,kBAAkB;GAC/C,IAAI,OAAO,UAAU,KAAA,GAAW,KAAK,MAAM,QAAQ,OAAO,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI;EACzF;EACA,KAAK,MAAM,SAAS,QAAQ,MAAM,KAAK,iBAAiB,OAAO;EAC/D,OAAO,SAAS,GAAG,MAAM,KAAK,IAAI,EAAE,GAAG;CACxC,CACoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { i as read } from "./entries-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure } from "./error-BVSfzBzb.mjs";
|
|
3
|
+
import { i as read } from "./entries-hMxcOaPm.mjs";
|
|
4
4
|
import { Effect, Schema } from "effect";
|
|
5
5
|
import { Plugin } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/plugin/list.ts
|
|
@@ -74,4 +74,4 @@ var list_default = handler(Cmd.commands.plugin.commands.list, Effect.fn("CLI.plu
|
|
|
74
74
|
//#endregion
|
|
75
75
|
export { list_default as default };
|
|
76
76
|
|
|
77
|
-
//# sourceMappingURL=list-
|
|
77
|
+
//# sourceMappingURL=list-CQcI-iX0.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-
|
|
1
|
+
{"version":3,"file":"list-CQcI-iX0.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/plugin/list.ts"],"sourcesContent":["import { Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect, Schema } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { read } from \"./entries.ts\";\n\n/**\n * Two columns: what was written, and what it turned out to be.\n *\n * **The second column doubles as the state, for free.** An ID cannot be known without importing\n * the module -- the store records nothing about the plugin inside a package -- so printing one is\n * proof that everything worked: the entry parsed, the store had it, the import succeeded, and the\n * definition validated. When any of that fails there is no ID to print, and the reason goes in its\n * place.\n *\n * **Nothing is stored to make that work.** The reason is the live error from this run, not a\n * record of an older one: a stored failure goes stale the moment someone fixes the cause, and a\n * list still printing `plugin-import-failed` after you installed the missing dependency is worse\n * than one that says nothing. The work is cheap and local -- a parse, a lookup and an import.\n *\n * (`checkedAt`/`outdated` are stored, for the opposite reason: those come from the network, so\n * re-obtaining them is expensive and a slightly stale answer is the right trade. Local facts are\n * recomputed; remote facts are cached.)\n */\nconst isSourceError = Schema.is(Plugin.SourceError);\nconst isInstallError = Schema.is(Plugin.InstallError);\nconst isStoreError = Schema.is(Plugin.StoreError);\nconst isLoadError = Schema.is(Plugin.LoadError);\n\n/** The §5.5 reason slug, which is the same string the CLI prints and a log line carries. */\nconst reasonOf = (error: unknown): { readonly reason: string; readonly message: string } =>\n\tisSourceError(error) || isInstallError(error) || isStoreError(error) || isLoadError(error)\n\t\t? { reason: error.reason, message: error.message }\n\t\t: { reason: \"plugin-load-failed\", message: String(error) };\n\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.list,\n\tEffect.fn(\"CLI.plugin.list\")(function* ({ verbose }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst { entries, cache } = yield* read(shared);\n\t\t\tif (entries.length === 0) {\n\t\t\t\tyield* writeOut(\"No plugins are configured.\\n\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst rows: Array<{ written: string; file: string; state: string; detail?: string }> = [];\n\t\t\tfor (const entry of entries) {\n\t\t\t\t// Resolve-only: listing what is configured must never install anything.\n\t\t\t\tconst inspected = yield* Plugin.inspect(entry.reference, {\n\t\t\t\t\tcache,\n\t\t\t\t\thostDir: entry.from,\n\t\t\t\t\tfile: entry.file,\n\t\t\t\t\tinstall: Plugin.resolveCached,\n\t\t\t\t}).pipe(Effect.result);\n\t\t\t\trows.push(\n\t\t\t\t\tinspected._tag === \"Success\"\n\t\t\t\t\t\t? { written: entry.written, file: entry.file, state: inspected.success.id }\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\twritten: entry.written,\n\t\t\t\t\t\t\t\tfile: entry.file,\n\t\t\t\t\t\t\t\tstate: reasonOf(inspected.failure).reason,\n\t\t\t\t\t\t\t\tdetail: reasonOf(inspected.failure).message,\n\t\t\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// The left column is the reference exactly as the entry spells it, because that is the\n\t\t\t// string a person will search their settings for.\n\t\t\tconst width = Math.max(...rows.map((row) => row.written.length));\n\t\t\tfor (const row of rows) {\n\t\t\t\tyield* writeOut(`${row.written.padEnd(width)} ${row.state}\\n`);\n\t\t\t\tif (verbose) {\n\t\t\t\t\tif (row.detail !== undefined) yield* writeOut(`${\" \".repeat(width)} ${row.detail}\\n`);\n\t\t\t\t\tyield* writeOut(`${\" \".repeat(width)} declared in: ${row.file}\\n`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,gBAAgB,OAAO,GAAG,OAAO,WAAW;AAClD,MAAM,iBAAiB,OAAO,GAAG,OAAO,YAAY;AACpD,MAAM,eAAe,OAAO,GAAG,OAAO,UAAU;AAChD,MAAM,cAAc,OAAO,GAAG,OAAO,SAAS;;AAG9C,MAAM,YAAY,UACjB,cAAc,KAAK,KAAK,eAAe,KAAK,KAAK,aAAa,KAAK,KAAK,YAAY,KAAK,IACtF;CAAE,QAAQ,MAAM;CAAQ,SAAS,MAAM;AAAQ,IAC/C;CAAE,QAAQ;CAAsB,SAAS,OAAO,KAAK;AAAE;AAE3D,IAAA,eAAeA,QACd,IAAI,SAAS,OAAO,SAAS,MAC7B,OAAO,GAAG,iBAAiB,CAAC,CAAC,WAAW,EAAE,WAAW;CA0CpD,OAAO,OAzCS,OAAO,IAAI,aAAa;EACvC,MAAM,SAAS,OAAO,IAAI;EAC1B,MAAM,EAAE,SAAS,UAAU,OAAO,KAAK,MAAM;EAC7C,IAAI,QAAQ,WAAW,GAAG;GACzB,OAAO,SAAS,8BAA8B;GAC9C;EACD;EAEA,MAAM,OAAiF,CAAC;EACxF,KAAK,MAAM,SAAS,SAAS;GAE5B,MAAM,YAAY,OAAO,OAAO,QAAQ,MAAM,WAAW;IACxD;IACA,SAAS,MAAM;IACf,MAAM,MAAM;IACZ,SAAS,OAAO;GACjB,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM;GACrB,KAAK,KACJ,UAAU,SAAS,YAChB;IAAE,SAAS,MAAM;IAAS,MAAM,MAAM;IAAM,OAAO,UAAU,QAAQ;GAAG,IACxE;IACA,SAAS,MAAM;IACf,MAAM,MAAM;IACZ,OAAO,SAAS,UAAU,OAAO,CAAC,CAAC;IACnC,QAAQ,SAAS,UAAU,OAAO,CAAC,CAAC;GACrC,CACH;EACD;EAIA,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,KAAK,QAAQ,IAAI,QAAQ,MAAM,CAAC;EAC/D,KAAK,MAAM,OAAO,MAAM;GACvB,OAAO,SAAS,GAAG,IAAI,QAAQ,OAAO,KAAK,EAAE,IAAI,IAAI,MAAM,GAAG;GAC9D,IAAI,SAAS;IACZ,IAAI,IAAI,WAAW,KAAA,GAAW,OAAO,SAAS,GAAG,IAAI,OAAO,KAAK,EAAE,IAAI,IAAI,OAAO,GAAG;IACrF,OAAO,SAAS,GAAG,IAAI,OAAO,KAAK,EAAE,iBAAiB,IAAI,KAAK,GAAG;GACnE;EACD;CACD,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { n as synced } from "./catalog-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure, t as InvalidInputError } from "./error-BVSfzBzb.mjs";
|
|
3
|
+
import { n as synced } from "./catalog-XfqtqMDz.mjs";
|
|
4
4
|
import { Effect, Option } from "effect";
|
|
5
5
|
import { ModelCatalog } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/models/list.ts
|
|
@@ -27,4 +27,4 @@ var list_default = handler(Cmd.commands.models, Effect.fn("CLI.models.list")(fun
|
|
|
27
27
|
//#endregion
|
|
28
28
|
export { list_default as default };
|
|
29
29
|
|
|
30
|
-
//# sourceMappingURL=list-
|
|
30
|
+
//# sourceMappingURL=list-CtFUvztt.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-
|
|
1
|
+
{"version":3,"file":"list-CtFUvztt.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/models/list.ts"],"sourcesContent":["import { ModelCatalog } from \"@codeworksh/harness/effect\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { InvalidInputError, reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { synced } from \"./catalog.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.models,\n\tEffect.fn(\"CLI.models.list\")(function* ({ provider }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tyield* synced;\n\t\t\tconst catalog = yield* ModelCatalog.models;\n\t\t\tif (Option.isSome(provider)) {\n\t\t\t\tconst providerId = provider.value;\n\t\t\t\tif (!Object.hasOwn(catalog, providerId)) {\n\t\t\t\t\treturn yield* new InvalidInputError({\n\t\t\t\t\t\tmessage: `provider \"${providerId}\" is not in the catalog\\nhint: run \\`codework models providers\\``,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst sorted = Object.keys(catalog[providerId] ?? {}).sort((a, b) => a.localeCompare(b));\n\t\t\t\tyield* writeOut(sorted.map((modelId) => `${providerId}/${modelId}\\n`).join(\"\"));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst lines: string[] = [];\n\t\t\tconst providers = Object.keys(catalog).sort((a, b) => a.localeCompare(b));\n\t\t\tfor (const providerId of providers) {\n\t\t\t\tconst providerModels = Object.keys(catalog[providerId] ?? {}).sort((a, b) => a.localeCompare(b));\n\t\t\t\tfor (const modelId of providerModels) {\n\t\t\t\t\tlines.push(`${providerId}/${modelId}\\n`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tyield* writeOut(lines.join(\"\"));\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAQA,IAAA,eAAeA,QACd,IAAI,SAAS,QACb,OAAO,GAAG,iBAAiB,CAAC,CAAC,WAAW,EAAE,YAAY;CA2BrD,OAAO,OA1BS,OAAO,IAAI,aAAa;EACvC,OAAO;EACP,MAAM,UAAU,OAAO,aAAa;EACpC,IAAI,OAAO,OAAO,QAAQ,GAAG;GAC5B,MAAM,aAAa,SAAS;GAC5B,IAAI,CAAC,OAAO,OAAO,SAAS,UAAU,GACrC,OAAO,OAAO,IAAI,kBAAkB,EACnC,SAAS,aAAa,WAAW,kEAClC,CAAC;GAEF,MAAM,SAAS,OAAO,KAAK,QAAQ,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;GACvF,OAAO,SAAS,OAAO,KAAK,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;GAC9E;EACD;EAEA,MAAM,QAAkB,CAAC;EACzB,MAAM,YAAY,OAAO,KAAK,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;EACxE,KAAK,MAAM,cAAc,WAAW;GACnC,MAAM,iBAAiB,OAAO,KAAK,QAAQ,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;GAC/F,KAAK,MAAM,WAAW,gBACrB,MAAM,KAAK,GAAG,WAAW,GAAG,QAAQ,GAAG;EAEzC;EACA,OAAO,SAAS,MAAM,KAAK,EAAE,CAAC;CAC/B,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { a as oauthProviderLabel, i as makeOps, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure, m as make, t as InvalidInputError, u as writeError } from "./error-BVSfzBzb.mjs";
|
|
3
|
+
import { a as oauthProviderLabel, i as makeOps, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-B6BI-4BA.mjs";
|
|
4
4
|
import { Effect, Option } from "effect";
|
|
5
5
|
import { formatOAuthSummary, oauthLoginIssue, oauthNotice } from "@codeworksh/aikit/oauth/summary";
|
|
6
6
|
//#region src/cli/cmd/handlers/auth/login.ts
|
|
@@ -42,4 +42,4 @@ var login_default = handler(Cmd.commands.auth.commands.login, Effect.fn("CLI.aut
|
|
|
42
42
|
//#endregion
|
|
43
43
|
export { login_default as default };
|
|
44
44
|
|
|
45
|
-
//# sourceMappingURL=login-
|
|
45
|
+
//# sourceMappingURL=login-DT1s4zCM.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-
|
|
1
|
+
{"version":3,"file":"login-DT1s4zCM.mjs","names":["Runtime.handler","Client.make"],"sources":["../../src/cli/cmd/handlers/auth/login.ts"],"sourcesContent":["import { formatOAuthSummary, oauthLoginIssue, oauthNotice } from \"@codeworksh/aikit/oauth/summary\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { InvalidInputError, reportFailure } from \"../../../error.ts\";\nimport { writeError, writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport {\n\tassertServerScope,\n\tattempt,\n\tClient,\n\tlocalOps,\n\tmakeOps,\n\toauthProviderLabel,\n\tselectProvider,\n\twithServer,\n\ttype LoginOptions,\n} from \"./shared.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.auth.commands.login,\n\tEffect.fn(\"CLI.auth.login\")(function* ({\n\t\tserver,\n\t\topenaiCodex,\n\t\tgithubCopilot,\n\t\tauthFile,\n\t\tbrowser,\n\t\tdevice,\n\t\tenterprise,\n\t\tenableModels,\n\t\tjson,\n\t}) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst provider = yield* selectProvider({ openaiCodex, githubCopilot });\n\t\t\tconst issue = oauthLoginIssue(provider, {\n\t\t\t\tdevice,\n\t\t\t\tenableModels,\n\t\t\t\t...(Option.isSome(enterprise) && { enterprise: enterprise.value }),\n\t\t\t});\n\t\t\tif (issue !== undefined) return yield* new InvalidInputError({ message: issue });\n\n\t\t\tconst name = oauthProviderLabel(provider);\n\t\t\tconst options: LoginOptions = { browser, device, enterprise, enableModels };\n\n\t\t\tif (Option.isSome(server)) {\n\t\t\t\tyield* assertServerScope(authFile);\n\t\t\t\treturn yield* withServer(\n\t\t\t\t\tserver.value,\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tconst rpc = yield* Client.make;\n\t\t\t\t\t\t// The browser callback and the device prompt both need this\n\t\t\t\t\t\t// terminal, so the login runs here and only the result travels.\n\t\t\t\t\t\tconst { wire } = yield* attempt(`${name} login failed`, () =>\n\t\t\t\t\t\t\tmakeOps(provider, { persist: false }).login(options),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst info = yield* rpc[\"auth.save\"]({ credentials: wire });\n\t\t\t\t\t\tyield* writeError(`${oauthNotice(\"saved\", provider, \"the server\")}\\n`);\n\t\t\t\t\t\tyield* writeOut(formatOAuthSummary(info, { json }));\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst ops = yield* localOps(provider, authFile);\n\t\t\tconst { summary } = yield* attempt(`${name} login failed`, () => ops.login(options));\n\t\t\tyield* writeError(`${oauthNotice(\"saved\", provider, ops.path)}\\n`);\n\t\t\tyield* writeOut(formatOAuthSummary(summary, { json }));\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAkBA,IAAA,gBAAeA,QACd,IAAI,SAAS,KAAK,SAAS,OAC3B,OAAO,GAAG,gBAAgB,CAAC,CAAC,WAAW,EACtC,QACA,aACA,eACA,UACA,SACA,QACA,YACA,cACA,QACE;CAqCF,OAAO,OApCS,OAAO,IAAI,aAAa;EACvC,MAAM,WAAW,OAAO,eAAe;GAAE;GAAa;EAAc,CAAC;EACrE,MAAM,QAAQ,gBAAgB,UAAU;GACvC;GACA;GACA,GAAI,OAAO,OAAO,UAAU,KAAK,EAAE,YAAY,WAAW,MAAM;EACjE,CAAC;EACD,IAAI,UAAU,KAAA,GAAW,OAAO,OAAO,IAAI,kBAAkB,EAAE,SAAS,MAAM,CAAC;EAE/E,MAAM,OAAO,mBAAmB,QAAQ;EACxC,MAAM,UAAwB;GAAE;GAAS;GAAQ;GAAY;EAAa;EAE1E,IAAI,OAAO,OAAO,MAAM,GAAG;GAC1B,OAAO,kBAAkB,QAAQ;GACjC,OAAO,OAAO,WACb,OAAO,OACP,OAAO,IAAI,aAAa;IACvB,MAAM,MAAM,OAAOC;IAGnB,MAAM,EAAE,SAAS,OAAO,QAAQ,GAAG,KAAK,sBACvC,QAAQ,UAAU,EAAE,SAAS,MAAM,CAAC,CAAC,CAAC,MAAM,OAAO,CACpD;IACA,MAAM,OAAO,OAAO,IAAI,YAAY,CAAC,EAAE,aAAa,KAAK,CAAC;IAC1D,OAAO,WAAW,GAAG,YAAY,SAAS,UAAU,YAAY,EAAE,GAAG;IACrE,OAAO,SAAS,mBAAmB,MAAM,EAAE,KAAK,CAAC,CAAC;GACnD,CAAC,CACF;EACD;EAEA,MAAM,MAAM,OAAO,SAAS,UAAU,QAAQ;EAC9C,MAAM,EAAE,YAAY,OAAO,QAAQ,GAAG,KAAK,sBAAsB,IAAI,MAAM,OAAO,CAAC;EACnF,OAAO,WAAW,GAAG,YAAY,SAAS,UAAU,IAAI,IAAI,EAAE,GAAG;EACjE,OAAO,SAAS,mBAAmB,SAAS,EAAE,KAAK,CAAC,CAAC;CACtD,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure, n as OAuthError, u as writeError } from "./error-BVSfzBzb.mjs";
|
|
3
|
+
import { i as oauthServer } from "./shared-QBlwaQPR.mjs";
|
|
4
|
+
import { Duration, Effect, Logger } from "effect";
|
|
5
|
+
import { McpOAuth } from "@codeworksh/harness/effect";
|
|
6
|
+
import { openBrowser } from "@codeworksh/aikit/oauth/interactive";
|
|
7
|
+
import { createInterface } from "node:readline";
|
|
8
|
+
//#region src/cli/cmd/handlers/mcp/login.ts
|
|
9
|
+
/**
|
|
10
|
+
* The redirected URL, typed or piped in when the browser cannot reach this machine's callback (over
|
|
11
|
+
* SSH, say). Piped input that ends without a line leaves the callback to finish the sign-in; a
|
|
12
|
+
* terminal that closes (Ctrl+C, Ctrl+D) cancels it.
|
|
13
|
+
*/
|
|
14
|
+
const paste = Effect.acquireUseRelease(Effect.sync(() => ({
|
|
15
|
+
readline: createInterface({
|
|
16
|
+
input: process.stdin,
|
|
17
|
+
output: process.stderr
|
|
18
|
+
}),
|
|
19
|
+
answered: false
|
|
20
|
+
})), (asking) => Effect.callback((resume) => {
|
|
21
|
+
const answer = (line) => {
|
|
22
|
+
asking.answered = true;
|
|
23
|
+
resume(Effect.succeed(line));
|
|
24
|
+
};
|
|
25
|
+
asking.readline.question("Or paste the URL the browser was redirected to: ", answer);
|
|
26
|
+
if (process.stdin.isTTY) asking.readline.once("close", () => answer(""));
|
|
27
|
+
}), (asking) => Effect.sync(() => {
|
|
28
|
+
const unanswered = !asking.answered;
|
|
29
|
+
asking.readline.close();
|
|
30
|
+
process.stdin.destroy();
|
|
31
|
+
if (unanswered) process.stderr.write("\n");
|
|
32
|
+
}));
|
|
33
|
+
var login_default = handler(Cmd.commands.mcp.commands.login, Effect.fn("CLI.mcp.login")(function* ({ name, browser, timeout }) {
|
|
34
|
+
return yield* Effect.gen(function* () {
|
|
35
|
+
const { store, config } = yield* oauthServer(name);
|
|
36
|
+
const limit = Duration.seconds(timeout);
|
|
37
|
+
const result = yield* McpOAuth.login({
|
|
38
|
+
store,
|
|
39
|
+
name,
|
|
40
|
+
config,
|
|
41
|
+
prompt: {
|
|
42
|
+
show: (url) => Effect.gen(function* () {
|
|
43
|
+
yield* writeError(`Sign in to MCP server "${name}" in your browser:\n${url.href}\n`);
|
|
44
|
+
if (browser) yield* Effect.sync(() => void openBrowser(url.href, (error) => process.stderr.write(`Failed to open browser: ${error.message}\n`)));
|
|
45
|
+
}),
|
|
46
|
+
paste
|
|
47
|
+
}
|
|
48
|
+
}).pipe(Effect.timeoutOrElse({
|
|
49
|
+
duration: limit,
|
|
50
|
+
orElse: () => Effect.fail(new OAuthError({ message: `sign-in timed out after ${Duration.format(limit)}` }))
|
|
51
|
+
}));
|
|
52
|
+
const tools = `${result.tools} tool${result.tools === 1 ? "" : "s"}`;
|
|
53
|
+
yield* writeOut(result.signedIn ? `Signed in to MCP server "${name}" (${tools}).\n` : `Already signed in to MCP server "${name}" (${tools}).\n`);
|
|
54
|
+
}).pipe(Effect.provideService(Logger.LogToStderr, true), Effect.catch(reportFailure));
|
|
55
|
+
}));
|
|
56
|
+
//#endregion
|
|
57
|
+
export { login_default as default };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=login-qqBsseni.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-qqBsseni.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/mcp/login.ts"],"sourcesContent":["/* @effect-diagnostics nodeBuiltinImport:off -- the pasted redirect URL is read from standard input. */\nimport { createInterface } from \"node:readline\";\nimport { openBrowser } from \"@codeworksh/aikit/oauth/interactive\";\nimport { McpOAuth } from \"@codeworksh/harness/effect\";\nimport { Duration, Effect, Logger } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { OAuthError, reportFailure } from \"../../../error.ts\";\nimport { writeError, writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { oauthServer } from \"./shared.ts\";\n\n/**\n * The redirected URL, typed or piped in when the browser cannot reach this machine's callback (over\n * SSH, say). Piped input that ends without a line leaves the callback to finish the sign-in; a\n * terminal that closes (Ctrl+C, Ctrl+D) cancels it.\n */\nconst paste: Effect.Effect<string> = Effect.acquireUseRelease(\n\tEffect.sync(() => ({\n\t\treadline: createInterface({ input: process.stdin, output: process.stderr }),\n\t\tanswered: false,\n\t})),\n\t(asking) =>\n\t\tEffect.callback<string>((resume) => {\n\t\t\tconst answer = (line: string) => {\n\t\t\t\tasking.answered = true;\n\t\t\t\tresume(Effect.succeed(line));\n\t\t\t};\n\t\t\tasking.readline.question(\"Or paste the URL the browser was redirected to: \", answer);\n\t\t\t// An empty answer cancels the sign-in.\n\t\t\tif (process.stdin.isTTY) asking.readline.once(\"close\", () => answer(\"\"));\n\t\t}),\n\t(asking) =>\n\t\tEffect.sync(() => {\n\t\t\tconst unanswered = !asking.answered;\n\t\t\tasking.readline.close();\n\t\t\t// A pipe still open would keep the process alive after the sign-in.\n\t\t\tprocess.stdin.destroy();\n\t\t\t// What follows starts on its own line, not after the prompt.\n\t\t\tif (unanswered) process.stderr.write(\"\\n\");\n\t\t}),\n);\n\nexport default Runtime.handler(\n\tCmd.commands.mcp.commands.login,\n\tEffect.fn(\"CLI.mcp.login\")(function* ({ name, browser, timeout }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst { store, config } = yield* oauthServer(name);\n\t\t\tconst limit = Duration.seconds(timeout);\n\t\t\tconst result = yield* McpOAuth.login({\n\t\t\t\tstore,\n\t\t\t\tname,\n\t\t\t\tconfig,\n\t\t\t\tprompt: {\n\t\t\t\t\tshow: (url) =>\n\t\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\t\tyield* writeError(`Sign in to MCP server \"${name}\" in your browser:\\n${url.href}\\n`);\n\t\t\t\t\t\t\tif (browser)\n\t\t\t\t\t\t\t\tyield* Effect.sync(\n\t\t\t\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\t\t\t\tvoid openBrowser(url.href, (error) =>\n\t\t\t\t\t\t\t\t\t\t\tprocess.stderr.write(`Failed to open browser: ${error.message}\\n`),\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}),\n\t\t\t\t\tpaste,\n\t\t\t\t},\n\t\t\t}).pipe(\n\t\t\t\tEffect.timeoutOrElse({\n\t\t\t\t\tduration: limit,\n\t\t\t\t\torElse: () =>\n\t\t\t\t\t\tEffect.fail(new OAuthError({ message: `sign-in timed out after ${Duration.format(limit)}` })),\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst tools = `${result.tools} tool${result.tools === 1 ? \"\" : \"s\"}`;\n\t\t\tyield* writeOut(\n\t\t\t\tresult.signedIn\n\t\t\t\t\t? `Signed in to MCP server \"${name}\" (${tools}).\\n`\n\t\t\t\t\t: `Already signed in to MCP server \"${name}\" (${tools}).\\n`,\n\t\t\t);\n\t\t});\n\t\t// Stdout carries only the outcome; harness logs go with the rest of the diagnostics.\n\t\treturn yield* program.pipe(Effect.provideService(Logger.LogToStderr, true), Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,QAA+B,OAAO,kBAC3C,OAAO,YAAY;CAClB,UAAU,gBAAgB;EAAE,OAAO,QAAQ;EAAO,QAAQ,QAAQ;CAAO,CAAC;CAC1E,UAAU;AACX,EAAE,IACD,WACA,OAAO,UAAkB,WAAW;CACnC,MAAM,UAAU,SAAiB;EAChC,OAAO,WAAW;EAClB,OAAO,OAAO,QAAQ,IAAI,CAAC;CAC5B;CACA,OAAO,SAAS,SAAS,oDAAoD,MAAM;CAEnF,IAAI,QAAQ,MAAM,OAAO,OAAO,SAAS,KAAK,eAAe,OAAO,EAAE,CAAC;AACxE,CAAC,IACD,WACA,OAAO,WAAW;CACjB,MAAM,aAAa,CAAC,OAAO;CAC3B,OAAO,SAAS,MAAM;CAEtB,QAAQ,MAAM,QAAQ;CAEtB,IAAI,YAAY,QAAQ,OAAO,MAAM,IAAI;AAC1C,CAAC,CACH;AAEA,IAAA,gBAAeA,QACd,IAAI,SAAS,IAAI,SAAS,OAC1B,OAAO,GAAG,eAAe,CAAC,CAAC,WAAW,EAAE,MAAM,SAAS,WAAW;CAqCjE,OAAO,OApCS,OAAO,IAAI,aAAa;EACvC,MAAM,EAAE,OAAO,WAAW,OAAO,YAAY,IAAI;EACjD,MAAM,QAAQ,SAAS,QAAQ,OAAO;EACtC,MAAM,SAAS,OAAO,SAAS,MAAM;GACpC;GACA;GACA;GACA,QAAQ;IACP,OAAO,QACN,OAAO,IAAI,aAAa;KACvB,OAAO,WAAW,0BAA0B,KAAK,sBAAsB,IAAI,KAAK,GAAG;KACnF,IAAI,SACH,OAAO,OAAO,WAEZ,KAAK,YAAY,IAAI,OAAO,UAC3B,QAAQ,OAAO,MAAM,2BAA2B,MAAM,QAAQ,GAAG,CAClE,CACF;IACF,CAAC;IACF;GACD;EACD,CAAC,CAAC,CAAC,KACF,OAAO,cAAc;GACpB,UAAU;GACV,cACC,OAAO,KAAK,IAAI,WAAW,EAAE,SAAS,2BAA2B,SAAS,OAAO,KAAK,IAAI,CAAC,CAAC;EAC9F,CAAC,CACF;EACA,MAAM,QAAQ,GAAG,OAAO,MAAM,OAAO,OAAO,UAAU,IAAI,KAAK;EAC/D,OAAO,SACN,OAAO,WACJ,4BAA4B,KAAK,KAAK,MAAM,QAC5C,oCAAoC,KAAK,KAAK,MAAM,KACxD;CACD,CAEoB,CAAC,CAAC,KAAK,OAAO,eAAe,OAAO,aAAa,IAAI,GAAG,OAAO,MAAM,aAAa,CAAC;AACxG,CAAC,CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure } from "./error-BVSfzBzb.mjs";
|
|
3
|
+
import { i as oauthServer } from "./shared-QBlwaQPR.mjs";
|
|
4
|
+
import { Effect } from "effect";
|
|
5
|
+
import { McpOAuth } from "@codeworksh/harness/effect";
|
|
6
|
+
//#region src/cli/cmd/handlers/mcp/logout.ts
|
|
7
|
+
var logout_default = handler(Cmd.commands.mcp.commands.logout, Effect.fn("CLI.mcp.logout")(function* ({ name }) {
|
|
8
|
+
return yield* Effect.gen(function* () {
|
|
9
|
+
const { store, server } = yield* oauthServer(name);
|
|
10
|
+
const removed = yield* McpOAuth.signOut(store, server);
|
|
11
|
+
yield* writeOut(removed ? `Signed out of MCP server "${name}".\n` : `MCP server "${name}" has no stored sign-in.\n`);
|
|
12
|
+
}).pipe(Effect.catch(reportFailure));
|
|
13
|
+
}));
|
|
14
|
+
//#endregion
|
|
15
|
+
export { logout_default as default };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=logout-D1-vVgEh.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout-D1-vVgEh.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/mcp/logout.ts"],"sourcesContent":["import { McpOAuth } from \"@codeworksh/harness/effect\";\nimport { Effect } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { oauthServer } from \"./shared.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.mcp.commands.logout,\n\tEffect.fn(\"CLI.mcp.logout\")(function* ({ name }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst { store, server } = yield* oauthServer(name);\n\t\t\tconst removed = yield* McpOAuth.signOut(store, server);\n\t\t\tyield* writeOut(\n\t\t\t\tremoved ? `Signed out of MCP server \"${name}\".\\n` : `MCP server \"${name}\" has no stored sign-in.\\n`,\n\t\t\t);\n\t\t});\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAQA,IAAA,iBAAeA,QACd,IAAI,SAAS,IAAI,SAAS,QAC1B,OAAO,GAAG,gBAAgB,CAAC,CAAC,WAAW,EAAE,QAAQ;CAQhD,OAAO,OAPS,OAAO,IAAI,aAAa;EACvC,MAAM,EAAE,OAAO,WAAW,OAAO,YAAY,IAAI;EACjD,MAAM,UAAU,OAAO,SAAS,QAAQ,OAAO,MAAM;EACrD,OAAO,SACN,UAAU,6BAA6B,KAAK,QAAQ,eAAe,KAAK,2BACzE;CACD,CACoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import { i as reportFailure,
|
|
3
|
-
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { i as reportFailure, m as make, u as writeError } from "./error-BVSfzBzb.mjs";
|
|
3
|
+
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-B6BI-4BA.mjs";
|
|
4
4
|
import { Effect, Option } from "effect";
|
|
5
5
|
import { oauthNotice } from "@codeworksh/aikit/oauth/summary";
|
|
6
6
|
//#region src/cli/cmd/handlers/auth/logout.ts
|
|
@@ -26,4 +26,4 @@ var logout_default = handler(Cmd.commands.auth.commands.logout, Effect.fn("CLI.a
|
|
|
26
26
|
//#endregion
|
|
27
27
|
export { logout_default as default };
|
|
28
28
|
|
|
29
|
-
//# sourceMappingURL=logout-
|
|
29
|
+
//# sourceMappingURL=logout-OnEsebcY.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout-
|
|
1
|
+
{"version":3,"file":"logout-OnEsebcY.mjs","names":["Runtime.handler","Client.make"],"sources":["../../src/cli/cmd/handlers/auth/logout.ts"],"sourcesContent":["import { oauthNotice } from \"@codeworksh/aikit/oauth/summary\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeError } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport {\n\tassertServerScope,\n\tattempt,\n\tClient,\n\tlocalOps,\n\toauthProviderLabel,\n\tselectProvider,\n\twithServer,\n} from \"./shared.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.auth.commands.logout,\n\tEffect.fn(\"CLI.auth.logout\")(function* ({ server, openaiCodex, githubCopilot, authFile }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst provider = yield* selectProvider({ openaiCodex, githubCopilot });\n\t\t\tconst name = oauthProviderLabel(provider);\n\n\t\t\tif (Option.isSome(server)) {\n\t\t\t\tyield* assertServerScope(authFile);\n\t\t\t\treturn yield* withServer(\n\t\t\t\t\tserver.value,\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tconst rpc = yield* Client.make;\n\t\t\t\t\t\tyield* rpc[\"auth.logout\"]({ provider });\n\t\t\t\t\t\tyield* writeError(`${oauthNotice(\"cleared\", provider, \"the server\")}\\n`);\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst ops = yield* localOps(provider, authFile);\n\t\t\tyield* attempt(`failed to clear ${name} credentials`, () => ops.logout());\n\t\t\tyield* writeError(`${oauthNotice(\"cleared\", provider, ops.path)}\\n`);\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAgBA,IAAA,iBAAeA,QACd,IAAI,SAAS,KAAK,SAAS,QAC3B,OAAO,GAAG,iBAAiB,CAAC,CAAC,WAAW,EAAE,QAAQ,aAAa,eAAe,YAAY;CAsBzF,OAAO,OArBS,OAAO,IAAI,aAAa;EACvC,MAAM,WAAW,OAAO,eAAe;GAAE;GAAa;EAAc,CAAC;EACrE,MAAM,OAAO,mBAAmB,QAAQ;EAExC,IAAI,OAAO,OAAO,MAAM,GAAG;GAC1B,OAAO,kBAAkB,QAAQ;GACjC,OAAO,OAAO,WACb,OAAO,OACP,OAAO,IAAI,aAAa;IAEvB,QAAO,OADYC,KAAAA,CACR,cAAc,CAAC,EAAE,SAAS,CAAC;IACtC,OAAO,WAAW,GAAG,YAAY,WAAW,UAAU,YAAY,EAAE,GAAG;GACxE,CAAC,CACF;EACD;EAEA,MAAM,MAAM,OAAO,SAAS,UAAU,QAAQ;EAC9C,OAAO,QAAQ,mBAAmB,KAAK,qBAAqB,IAAI,OAAO,CAAC;EACxE,OAAO,WAAW,GAAG,YAAY,WAAW,UAAU,IAAI,IAAI,EAAE,GAAG;CACpE,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-DdxpVK0O.mjs","names":[],"sources":["../../package.json"],"sourcesContent":[""],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeworksh/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-canary.100.1.g71d09a02",
|
|
4
4
|
"description": "CLI for running CodeWork coding agent harness.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -40,9 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@agentclientprotocol/sdk": "1.5.1",
|
|
43
|
-
"@codeworksh/aikit": "
|
|
44
|
-
"@codeworksh/harness": "0.
|
|
45
|
-
"@codeworksh/tui": "0.1.0",
|
|
43
|
+
"@codeworksh/aikit": "0.13.0-canary.100.1.g71d09a02",
|
|
44
|
+
"@codeworksh/harness": "0.6.0-canary.100.1.g71d09a02",
|
|
46
45
|
"@effect/platform-node": "4.0.5",
|
|
47
46
|
"@effect/platform-node-shared": "4.0.5",
|
|
48
47
|
"effect": "4.0.5",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { n as synced } from "./catalog-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure } from "./error-BVSfzBzb.mjs";
|
|
3
|
+
import { n as synced } from "./catalog-XfqtqMDz.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import { ModelCatalog } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/models/providers.ts
|
|
@@ -14,4 +14,4 @@ var providers_default = handler(Cmd.commands.models.commands.providers, Effect.f
|
|
|
14
14
|
//#endregion
|
|
15
15
|
export { providers_default as default };
|
|
16
16
|
|
|
17
|
-
//# sourceMappingURL=providers-
|
|
17
|
+
//# sourceMappingURL=providers-DnhkGLsd.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers-
|
|
1
|
+
{"version":3,"file":"providers-DnhkGLsd.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/models/providers.ts"],"sourcesContent":["import { ModelCatalog } from \"@codeworksh/harness/effect\";\nimport { Effect } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { synced } from \"./catalog.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.models.commands.providers,\n\tEffect.fn(\"CLI.models.providers\")(function* () {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tyield* synced;\n\t\t\tconst providers = yield* ModelCatalog.providers;\n\t\t\tconst sorted = [...providers].sort((a, b) => a.localeCompare(b));\n\t\t\tyield* writeOut(sorted.map((providerId) => `${providerId}\\n`).join(\"\"));\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAQA,IAAA,oBAAeA,QACd,IAAI,SAAS,OAAO,SAAS,WAC7B,OAAO,GAAG,sBAAsB,CAAC,CAAC,aAAa;CAQ9C,OAAO,OAPS,OAAO,IAAI,aAAa;EACvC,OAAO;EAEP,MAAM,SAAS,CAAC,GAAG,OADM,aAAa,SACV,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;EAC/D,OAAO,SAAS,OAAO,KAAK,eAAe,GAAG,WAAW,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;CACvE,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { t as home } from "./catalog-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure, u as writeError } from "./error-BVSfzBzb.mjs";
|
|
3
|
+
import { t as home } from "./catalog-XfqtqMDz.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import { ModelCatalog } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/models/refresh.ts
|
|
@@ -14,4 +14,4 @@ var refresh_default = handler(Cmd.commands.models.commands.refresh, Effect.fn("C
|
|
|
14
14
|
//#endregion
|
|
15
15
|
export { refresh_default as default };
|
|
16
16
|
|
|
17
|
-
//# sourceMappingURL=refresh
|
|
17
|
+
//# sourceMappingURL=refresh-BUW0WVh_.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh
|
|
1
|
+
{"version":3,"file":"refresh-BUW0WVh_.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/models/refresh.ts"],"sourcesContent":["import { ModelCatalog } from \"@codeworksh/harness/effect\";\nimport { Effect } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeError, writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { home } from \"./catalog.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.models.commands.refresh,\n\tEffect.fn(\"CLI.models.refresh\")(function* ({ force }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst status = yield* ModelCatalog.refresh(yield* home, { force });\n\t\t\tyield* writeError(\n\t\t\t\tstatus.refreshed\n\t\t\t\t\t? `Refreshed model catalog at ${status.path}\\n`\n\t\t\t\t\t: `Model catalog at ${status.path} is fresh; pass --force to download it anyway\\n`,\n\t\t\t);\n\t\t\tyield* writeOut(`${status.path}\\n`);\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAQA,IAAA,kBAAeA,QACd,IAAI,SAAS,OAAO,SAAS,SAC7B,OAAO,GAAG,oBAAoB,CAAC,CAAC,WAAW,EAAE,SAAS;CAWrD,OAAO,OAVS,OAAO,IAAI,aAAa;EACvC,MAAM,SAAS,OAAO,aAAa,QAAQ,OAAO,MAAM,EAAE,MAAM,CAAC;EACjE,OAAO,WACN,OAAO,YACJ,8BAA8B,OAAO,KAAK,MAC1C,oBAAoB,OAAO,KAAK,gDACpC;EACA,OAAO,SAAS,GAAG,OAAO,KAAK,GAAG;CACnC,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure, m as make, n as OAuthError, t as InvalidInputError, u as writeError } from "./error-BVSfzBzb.mjs";
|
|
3
|
+
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-B6BI-4BA.mjs";
|
|
4
4
|
import { Effect, Option } from "effect";
|
|
5
5
|
import { formatOAuthSummary, oauthNotice, oauthRefreshIssue } from "@codeworksh/aikit/oauth/summary";
|
|
6
6
|
//#region src/cli/cmd/handlers/auth/refresh.ts
|
|
@@ -32,4 +32,4 @@ var refresh_default = handler(Cmd.commands.auth.commands.refresh, Effect.fn("CLI
|
|
|
32
32
|
//#endregion
|
|
33
33
|
export { refresh_default as default };
|
|
34
34
|
|
|
35
|
-
//# sourceMappingURL=refresh-
|
|
35
|
+
//# sourceMappingURL=refresh-PdkrwU5g.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh-
|
|
1
|
+
{"version":3,"file":"refresh-PdkrwU5g.mjs","names":["Runtime.handler","Client.make"],"sources":["../../src/cli/cmd/handlers/auth/refresh.ts"],"sourcesContent":["import { formatOAuthSummary, oauthNotice, oauthRefreshIssue } from \"@codeworksh/aikit/oauth/summary\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { InvalidInputError, OAuthError, reportFailure } from \"../../../error.ts\";\nimport { writeError, writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport {\n\tassertServerScope,\n\tattempt,\n\tClient,\n\tlocalOps,\n\toauthProviderLabel,\n\tselectProvider,\n\twithServer,\n} from \"./shared.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.auth.commands.refresh,\n\tEffect.fn(\"CLI.auth.refresh\")(function* ({ server, openaiCodex, githubCopilot, authFile, json }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst provider = yield* selectProvider({ openaiCodex, githubCopilot });\n\t\t\tconst blocked = oauthRefreshIssue(provider);\n\t\t\tif (blocked !== undefined) return yield* new InvalidInputError({ message: blocked });\n\n\t\t\tconst name = oauthProviderLabel(provider);\n\n\t\t\tif (Option.isSome(server)) {\n\t\t\t\tyield* assertServerScope(authFile);\n\t\t\t\treturn yield* withServer(\n\t\t\t\t\tserver.value,\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tconst rpc = yield* Client.make;\n\t\t\t\t\t\tconst info = yield* rpc[\"auth.refresh\"]({ provider });\n\t\t\t\t\t\tif (info === null) {\n\t\t\t\t\t\t\treturn yield* new OAuthError({ message: oauthNotice(\"missing\", provider, \"the server\") });\n\t\t\t\t\t\t}\n\t\t\t\t\t\tyield* writeError(`${oauthNotice(\"refreshed\", provider, \"the server\")}\\n`);\n\t\t\t\t\t\tyield* writeOut(formatOAuthSummary(info, { json }));\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst ops = yield* localOps(provider, authFile);\n\t\t\tconst summary = yield* attempt(`failed to read ${name} credentials`, () => ops.refreshed());\n\t\t\tif (summary === undefined) {\n\t\t\t\treturn yield* new OAuthError({ message: oauthNotice(\"missing\", provider, ops.path) });\n\t\t\t}\n\t\t\tyield* writeError(`${oauthNotice(\"refreshed\", provider, ops.path)}\\n`);\n\t\t\tyield* writeOut(formatOAuthSummary(summary, { json }));\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAgBA,IAAA,kBAAeA,QACd,IAAI,SAAS,KAAK,SAAS,SAC3B,OAAO,GAAG,kBAAkB,CAAC,CAAC,WAAW,EAAE,QAAQ,aAAa,eAAe,UAAU,QAAQ;CAiChG,OAAO,OAhCS,OAAO,IAAI,aAAa;EACvC,MAAM,WAAW,OAAO,eAAe;GAAE;GAAa;EAAc,CAAC;EACrE,MAAM,UAAU,kBAAkB,QAAQ;EAC1C,IAAI,YAAY,KAAA,GAAW,OAAO,OAAO,IAAI,kBAAkB,EAAE,SAAS,QAAQ,CAAC;EAEnF,MAAM,OAAO,mBAAmB,QAAQ;EAExC,IAAI,OAAO,OAAO,MAAM,GAAG;GAC1B,OAAO,kBAAkB,QAAQ;GACjC,OAAO,OAAO,WACb,OAAO,OACP,OAAO,IAAI,aAAa;IAEvB,MAAM,OAAO,QAAO,OADDC,KAAAA,CACK,eAAe,CAAC,EAAE,SAAS,CAAC;IACpD,IAAI,SAAS,MACZ,OAAO,OAAO,IAAI,WAAW,EAAE,SAAS,YAAY,WAAW,UAAU,YAAY,EAAE,CAAC;IAEzF,OAAO,WAAW,GAAG,YAAY,aAAa,UAAU,YAAY,EAAE,GAAG;IACzE,OAAO,SAAS,mBAAmB,MAAM,EAAE,KAAK,CAAC,CAAC;GACnD,CAAC,CACF;EACD;EAEA,MAAM,MAAM,OAAO,SAAS,UAAU,QAAQ;EAC9C,MAAM,UAAU,OAAO,QAAQ,kBAAkB,KAAK,qBAAqB,IAAI,UAAU,CAAC;EAC1F,IAAI,YAAY,KAAA,GACf,OAAO,OAAO,IAAI,WAAW,EAAE,SAAS,YAAY,WAAW,UAAU,IAAI,IAAI,EAAE,CAAC;EAErF,OAAO,WAAW,GAAG,YAAY,aAAa,UAAU,IAAI,IAAI,EAAE,GAAG;EACrE,OAAO,SAAS,mBAAmB,SAAS,EAAE,KAAK,CAAC,CAAC;CACtD,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { d as writeJson, f as writeOut, i as reportFailure, m as make, p as layer, v as ThreadInfo } from "./error-BVSfzBzb.mjs";
|
|
3
|
+
import { t as threadFlag } from "./thread-skUkybyv.mjs";
|
|
4
|
+
import { Effect, Option } from "effect";
|
|
5
|
+
import { Sandbox, Session } from "@codeworksh/harness/effect";
|
|
6
|
+
//#region src/cli/cmd/handlers/session/relink.ts
|
|
7
|
+
var relink_default = handler(Cmd.commands.session.commands.relink, Effect.fn("CLI.session.relink")(function* ({ session, thread, directory, sandboxId, json, server }) {
|
|
8
|
+
return yield* Effect.gen(function* () {
|
|
9
|
+
const threadId = yield* threadFlag(thread);
|
|
10
|
+
const info = yield* (yield* make)["session.relink"]({
|
|
11
|
+
sessionId: Session.SessionSchema.ID.make(session),
|
|
12
|
+
...threadId === void 0 ? {} : { threadId },
|
|
13
|
+
...Option.isNone(sandboxId) ? {} : { sandbox: { id: Sandbox.SandboxInstance.ID.make(sandboxId.value) } },
|
|
14
|
+
...Option.isNone(directory) ? {} : { directory: directory.value }
|
|
15
|
+
});
|
|
16
|
+
if (json) return yield* writeJson(ThreadInfo, info);
|
|
17
|
+
yield* writeOut(threadId === void 0 ? `Moved ${info.session.id} to ${info.session.directory}\n` : `Moved thread ${info.id} of ${info.session.id} to ${info.placement?.directory ?? info.session.directory}\n`);
|
|
18
|
+
}).pipe(Effect.provide(layer(server)), Effect.scoped, Effect.catch(reportFailure));
|
|
19
|
+
}));
|
|
20
|
+
//#endregion
|
|
21
|
+
export { relink_default as default };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=relink-CAPQjc2V.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relink-CAPQjc2V.mjs","names":["Runtime.handler","Client.make","Client.layer"],"sources":["../../src/cli/cmd/handlers/session/relink.ts"],"sourcesContent":["import { Sandbox, Session } from \"@codeworksh/harness/effect\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { Client } from \"../../../../server/client.ts\";\nimport { ThreadInfo } from \"../../../../server/contract.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeJson, writeOut } from \"../../../output.ts\";\nimport { threadFlag } from \"../../../thread.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.session.commands.relink,\n\tEffect.fn(\"CLI.session.relink\")(function* ({ session, thread, directory, sandboxId, json, server }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst threadId = yield* threadFlag(thread);\n\t\t\tconst rpc = yield* Client.make;\n\t\t\tconst info = yield* rpc[\"session.relink\"]({\n\t\t\t\tsessionId: Session.SessionSchema.ID.make(session),\n\t\t\t\t...(threadId === undefined ? {} : { threadId }),\n\t\t\t\t...(Option.isNone(sandboxId) ? {} : { sandbox: { id: Sandbox.SandboxInstance.ID.make(sandboxId.value) } }),\n\t\t\t\t...(Option.isNone(directory) ? {} : { directory: directory.value }),\n\t\t\t});\n\t\t\tif (json) return yield* writeJson(ThreadInfo, info);\n\t\t\t// Without `--thread` the session's default moved; a thread with its own placement stays put.\n\t\t\tyield* writeOut(\n\t\t\t\tthreadId === undefined\n\t\t\t\t\t? `Moved ${info.session.id} to ${info.session.directory}\\n`\n\t\t\t\t\t: `Moved thread ${info.id} of ${info.session.id} to ${info.placement?.directory ?? info.session.directory}\\n`,\n\t\t\t);\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.provide(Client.layer(server)), Effect.scoped, Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAUA,IAAA,iBAAeA,QACd,IAAI,SAAS,QAAQ,SAAS,QAC9B,OAAO,GAAG,oBAAoB,CAAC,CAAC,WAAW,EAAE,SAAS,QAAQ,WAAW,WAAW,MAAM,UAAU;CAmBnG,OAAO,OAlBS,OAAO,IAAI,aAAa;EACvC,MAAM,WAAW,OAAO,WAAW,MAAM;EAEzC,MAAM,OAAO,QAAO,OADDC,KAAAA,CACK,iBAAiB,CAAC;GACzC,WAAW,QAAQ,cAAc,GAAG,KAAK,OAAO;GAChD,GAAI,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS;GAC7C,GAAI,OAAO,OAAO,SAAS,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,QAAQ,gBAAgB,GAAG,KAAK,UAAU,KAAK,EAAE,EAAE;GACxG,GAAI,OAAO,OAAO,SAAS,IAAI,CAAC,IAAI,EAAE,WAAW,UAAU,MAAM;EAClE,CAAC;EACD,IAAI,MAAM,OAAO,OAAO,UAAU,YAAY,IAAI;EAElD,OAAO,SACN,aAAa,KAAA,IACV,SAAS,KAAK,QAAQ,GAAG,MAAM,KAAK,QAAQ,UAAU,MACtD,gBAAgB,KAAK,GAAG,MAAM,KAAK,QAAQ,GAAG,MAAM,KAAK,WAAW,aAAa,KAAK,QAAQ,UAAU,GAC5G;CACD,CAEoB,CAAC,CAAC,KAAK,OAAO,QAAQC,MAAa,MAAM,CAAC,GAAG,OAAO,QAAQ,OAAO,MAAM,aAAa,CAAC;AAC5G,CAAC,CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import {
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure, m as make, p as layer } from "./error-BVSfzBzb.mjs";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
//#region src/cli/cmd/handlers/plugin/reload.ts
|
|
5
5
|
/**
|
|
@@ -23,4 +23,4 @@ var reload_default = handler(Cmd.commands.plugin.commands.reload, Effect.fn("CLI
|
|
|
23
23
|
//#endregion
|
|
24
24
|
export { reload_default as default };
|
|
25
25
|
|
|
26
|
-
//# sourceMappingURL=reload-
|
|
26
|
+
//# sourceMappingURL=reload-DVPHF5gJ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reload-
|
|
1
|
+
{"version":3,"file":"reload-DVPHF5gJ.mjs","names":["Runtime.handler","Client.make","Client.layer"],"sources":["../../src/cli/cmd/handlers/plugin/reload.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Client } from \"../../../../server/client.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\n/**\n * Re-import every configured plugin in a running server.\n *\n * It exists for exactly one case: a **local** plugin edited in place. Nothing in settings changed\n * and no generation moved -- a local source is never copied into the store, so it has none -- and\n * the module registry holds the old module against an unchanged URL. Everything else the runtime\n * notices for itself at the next exchange.\n *\n * There is no local form, and that is not an omission. In a CLI every run is a fresh process, so\n * the load pass happens at startup and a reload would have nothing to do.\n */\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.reload,\n\tEffect.fn(\"CLI.plugin.reload\")(function* ({ server }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst rpc = yield* Client.make;\n\t\t\tconst result = yield* rpc[\"plugin.reload\"]({});\n\t\t\t// A reload that failed still reports the set that stayed loaded: the server kept\n\t\t\t// working, which is the whole point of not failing it.\n\t\t\tyield* writeOut(\n\t\t\t\tresult.failure === undefined\n\t\t\t\t\t? `Reloaded ${result.plugins} plugin${result.plugins === 1 ? \"\" : \"s\"}.\\n`\n\t\t\t\t\t: `Reload failed, keeping ${result.plugins} loaded: ${result.failure}\\n`,\n\t\t\t);\n\t\t\tif (result.failure !== undefined) process.exitCode = 1;\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.provide(Client.layer(server)), Effect.scoped, Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,IAAA,iBAAeA,QACd,IAAI,SAAS,OAAO,SAAS,QAC7B,OAAO,GAAG,mBAAmB,CAAC,CAAC,WAAW,EAAE,UAAU;CAcrD,OAAO,OAbS,OAAO,IAAI,aAAa;EAEvC,MAAM,SAAS,QAAO,OADHC,KAAAA,CACO,gBAAgB,CAAC,CAAC,CAAC;EAG7C,OAAO,SACN,OAAO,YAAY,KAAA,IAChB,YAAY,OAAO,QAAQ,SAAS,OAAO,YAAY,IAAI,KAAK,IAAI,OACpE,0BAA0B,OAAO,QAAQ,WAAW,OAAO,QAAQ,GACvE;EACA,IAAI,OAAO,YAAY,KAAA,GAAW,QAAQ,WAAW;CACtD,CAEoB,CAAC,CAAC,KAAK,OAAO,QAAQC,MAAa,MAAM,CAAC,GAAG,OAAO,QAAQ,OAAO,MAAM,aAAa,CAAC;AAC5G,CAAC,CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure, t as InvalidInputError } from "./error-BVSfzBzb.mjs";
|
|
3
|
+
import { r as write, t as locked } from "./jsonc-BwztMdEB.mjs";
|
|
4
|
+
import { a as readServers, n as configured } from "./shared-QBlwaQPR.mjs";
|
|
5
|
+
import { Effect, FileSystem } from "effect";
|
|
6
|
+
//#region src/cli/cmd/handlers/mcp/remove.ts
|
|
7
|
+
var remove_default = handler(Cmd.commands.mcp.commands.remove, Effect.fn("CLI.mcp.remove")(function* ({ name, local }) {
|
|
8
|
+
return yield* Effect.gen(function* () {
|
|
9
|
+
const { user, project, servers } = yield* configured();
|
|
10
|
+
const path = local ? project : user;
|
|
11
|
+
const level = local ? "project" : "user";
|
|
12
|
+
if ((yield* (yield* FileSystem.FileSystem).exists(path)) && (yield* locked(path, Effect.gen(function* () {
|
|
13
|
+
const { source, servers } = yield* readServers(path);
|
|
14
|
+
if (servers[name] === void 0) return false;
|
|
15
|
+
yield* write(path, source, ["mcpServers", name], void 0);
|
|
16
|
+
return true;
|
|
17
|
+
})))) return yield* writeOut(`Removed ${level} MCP server "${name}" from ${path}.\n`);
|
|
18
|
+
const other = servers.find((server) => server.name === name && server.file !== path);
|
|
19
|
+
const hint = other === void 0 ? "" : ` It is defined in ${other.file}; ${other.file === project ? "use --local" : "omit --local"}.`;
|
|
20
|
+
return yield* new InvalidInputError({ message: `no ${level} MCP server named "${name}" in ${path}.${hint}` });
|
|
21
|
+
}).pipe(Effect.catch(reportFailure));
|
|
22
|
+
}));
|
|
23
|
+
//#endregion
|
|
24
|
+
export { remove_default as default };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=remove-DY5b7L8Y.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-DY5b7L8Y.mjs","names":["Runtime.handler","Jsonc.locked","Jsonc.write"],"sources":["../../src/cli/cmd/handlers/mcp/remove.ts"],"sourcesContent":["import { Effect, FileSystem } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { InvalidInputError, reportFailure } from \"../../../error.ts\";\nimport { Jsonc } from \"../../../jsonc.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { configured, readServers } from \"./shared.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.mcp.commands.remove,\n\tEffect.fn(\"CLI.mcp.remove\")(function* ({ name, local }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst { user, project, servers } = yield* configured();\n\t\t\tconst path = local ? project : user;\n\t\t\tconst level = local ? \"project\" : \"user\";\n\t\t\tconst fs = yield* FileSystem.FileSystem;\n\t\t\t// No file, nothing to remove: locking it would make its directory, and a `.codework/` here.\n\t\t\tconst removed =\n\t\t\t\t(yield* fs.exists(path)) &&\n\t\t\t\t(yield* Jsonc.locked(\n\t\t\t\t\tpath,\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tconst { source, servers } = yield* readServers(path);\n\t\t\t\t\t\tif (servers[name] === undefined) return false;\n\t\t\t\t\t\tyield* Jsonc.write(path, source, [\"mcpServers\", name], undefined);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}),\n\t\t\t\t));\n\t\t\tif (removed) return yield* writeOut(`Removed ${level} MCP server \"${name}\" from ${path}.\\n`);\n\t\t\tconst other = servers.find((server) => server.name === name && server.file !== path);\n\t\t\tconst hint =\n\t\t\t\tother === undefined\n\t\t\t\t\t? \"\"\n\t\t\t\t\t: ` It is defined in ${other.file}; ${other.file === project ? \"use --local\" : \"omit --local\"}.`;\n\t\t\treturn yield* new InvalidInputError({\n\t\t\t\tmessage: `no ${level} MCP server named \"${name}\" in ${path}.${hint}`,\n\t\t\t});\n\t\t});\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAQA,IAAA,iBAAeA,QACd,IAAI,SAAS,IAAI,SAAS,QAC1B,OAAO,GAAG,gBAAgB,CAAC,CAAC,WAAW,EAAE,MAAM,SAAS;CA4BvD,OAAO,OA3BS,OAAO,IAAI,aAAa;EACvC,MAAM,EAAE,MAAM,SAAS,YAAY,OAAO,WAAW;EACrD,MAAM,OAAO,QAAQ,UAAU;EAC/B,MAAM,QAAQ,QAAQ,YAAY;EAclC,KAVE,QAAO,OAHS,WAAW,WAAA,CAGjB,OAAO,IAAI,OACrB,OAAOC,OACP,MACA,OAAO,IAAI,aAAa;GACvB,MAAM,EAAE,QAAQ,YAAY,OAAO,YAAY,IAAI;GACnD,IAAI,QAAQ,UAAU,KAAA,GAAW,OAAO;GACxC,OAAOC,MAAY,MAAM,QAAQ,CAAC,cAAc,IAAI,GAAG,KAAA,CAAS;GAChE,OAAO;EACR,CAAC,CACF,IACY,OAAO,OAAO,SAAS,WAAW,MAAM,eAAe,KAAK,SAAS,KAAK,IAAI;EAC3F,MAAM,QAAQ,QAAQ,MAAM,WAAW,OAAO,SAAS,QAAQ,OAAO,SAAS,IAAI;EACnF,MAAM,OACL,UAAU,KAAA,IACP,KACA,qBAAqB,MAAM,KAAK,IAAI,MAAM,SAAS,UAAU,gBAAgB,eAAe;EAChG,OAAO,OAAO,IAAI,kBAAkB,EACnC,SAAS,MAAM,MAAM,qBAAqB,KAAK,OAAO,KAAK,GAAG,OAC/D,CAAC;CACF,CACoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { a as resolveTarget, c as withPluginsLock, i as readPlugins, l as writePlugins, o as spellings, r as matching, t as identify } from "./settings-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure } from "./error-BVSfzBzb.mjs";
|
|
3
|
+
import { a as resolveTarget, c as withPluginsLock, i as readPlugins, l as writePlugins, o as spellings, r as matching, t as identify } from "./settings-Ct8kxLeD.mjs";
|
|
4
4
|
import { Effect, FileSystem, Option, Path } from "effect";
|
|
5
5
|
import { Global } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/plugin/remove.ts
|
|
@@ -34,4 +34,4 @@ var remove_default = handler(Cmd.commands.plugin.commands.remove, Effect.fn("CLI
|
|
|
34
34
|
//#endregion
|
|
35
35
|
export { remove_default as default };
|
|
36
36
|
|
|
37
|
-
//# sourceMappingURL=remove-
|
|
37
|
+
//# sourceMappingURL=remove-iGViyrLi.mjs.map
|