@starlens-app/cli 0.1.4 → 0.1.6
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/package.json +1 -1
- package/src/index.mjs +8 -4
package/package.json
CHANGED
package/src/index.mjs
CHANGED
|
@@ -717,7 +717,8 @@ function detectProjectRoot() {
|
|
|
717
717
|
|
|
718
718
|
// Skill 源目录(npm 包内的 skills/ 目录)
|
|
719
719
|
function getSkillSourceDir() {
|
|
720
|
-
|
|
720
|
+
// src/index.mjs → ../skills/starlens = cli/skills/starlens
|
|
721
|
+
return new URL("../skills/starlens", import.meta.url).pathname;
|
|
721
722
|
}
|
|
722
723
|
|
|
723
724
|
// 各客户端全局 skill 目标路径
|
|
@@ -1066,8 +1067,9 @@ async function writeMcpConfig(client, { apiBaseUrl, token, projectRoot, hosted }
|
|
|
1066
1067
|
|
|
1067
1068
|
if (client === "opencode") {
|
|
1068
1069
|
const opencodePath = join(home, ".config", "opencode", "opencode.json");
|
|
1070
|
+
// opencode schema: type must be "remote" for HTTP MCP (not "http")
|
|
1069
1071
|
const starlensEntry = hosted
|
|
1070
|
-
? { type: "
|
|
1072
|
+
? { type: "remote", url: `${apiBaseUrl}/mcp`, headers: { Authorization: `Bearer ${token || "stl_xxx"}` }, enabled: true }
|
|
1071
1073
|
: { type: "local", command: ["zsh", "-lc", `source "$HOME/.starlens/agent.env" && cd "${projectRoot}" && corepack pnpm mcp:start`], enabled: true, timeout: 10000 };
|
|
1072
1074
|
await mergeJson(opencodePath, (obj) => ({
|
|
1073
1075
|
...obj,
|
|
@@ -1078,9 +1080,11 @@ async function writeMcpConfig(client, { apiBaseUrl, token, projectRoot, hosted }
|
|
|
1078
1080
|
|
|
1079
1081
|
if (client === "codex") {
|
|
1080
1082
|
const codexPath = join(home, ".codex", "config.toml");
|
|
1083
|
+
// Codex TOML: transport inferred from keys (url = HTTP, command = stdio); no "type" field
|
|
1084
|
+
// HTTP auth uses http_headers inline table, not a [headers] sub-table
|
|
1081
1085
|
const content = hosted
|
|
1082
|
-
? `[mcp_servers.starlens]\
|
|
1083
|
-
: `[mcp_servers.starlens]\
|
|
1086
|
+
? `[mcp_servers.starlens]\nurl = "${apiBaseUrl}/mcp"\nhttp_headers = { Authorization = "Bearer ${token || "stl_xxx"}" }\nenabled = true\nstartup_timeout_sec = 30\ndefault_tools_approval_mode = "approve"`
|
|
1087
|
+
: `[mcp_servers.starlens]\ncommand = "zsh"\nargs = ["-lc", "source \\"$HOME/.starlens/agent.env\\" && cd \\"${projectRoot}\\" && corepack pnpm mcp:start"]\nenabled = true\nstartup_timeout_sec = 30\ndefault_tools_approval_mode = "approve"`;
|
|
1084
1088
|
const result = await appendTomlSection(codexPath, "mcp_servers.starlens", content);
|
|
1085
1089
|
return result.ok ? { ok: true, path: codexPath } : { ok: false, reason: result.reason };
|
|
1086
1090
|
}
|