@mwillbanks/ast-mcp 0.1.3 → 0.2.0
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 +59 -20
- package/dist/ast-mcp.js +232 -130
- package/dist/ast-mcp.js.map +107 -27
- package/package.json +2 -1
- package/src/ast-bro/capability.ts +3 -8
- package/src/ast-bro/client.ts +18 -2
- package/src/ast-bro/result.ts +5 -12
- package/src/cli.ts +70 -95
- package/src/config-cli.ts +54 -0
- package/src/config.ts +886 -0
- package/src/helpers/aider.ts +252 -0
- package/src/helpers/ast-bro.ts +64 -0
- package/src/helpers/config.ts +149 -0
- package/src/helpers/hook.ts +60 -0
- package/src/helpers/installer.ts +249 -0
- package/src/helpers/json.ts +19 -0
- package/src/helpers/mcp-schema.ts +31 -0
- package/src/helpers/process.ts +31 -0
- package/src/helpers/string.ts +97 -0
- package/src/hook.ts +135 -40
- package/src/http-entry.ts +1 -1
- package/src/http.ts +118 -103
- package/src/installer-transport.ts +190 -0
- package/src/installer.ts +579 -242
- package/src/mcp-cli.ts +104 -0
- package/src/patch/aider.ts +6 -199
- package/src/patch/engine.ts +271 -197
- package/src/runtime/dependencies.ts +48 -29
- package/src/runtime/file-delete.ts +13 -9
- package/src/runtime/file-read.ts +91 -57
- package/src/runtime/file-rename.ts +158 -0
- package/src/runtime/format.ts +57 -34
- package/src/runtime/paths.ts +30 -16
- package/src/runtime/policy.ts +21 -0
- package/src/runtime/process-input.ts +14 -4
- package/src/service.ts +219 -0
- package/src/shell-policy.ts +331 -0
- package/src/stdio.ts +47 -35
- package/src/tools/ast-bro.ts +12 -6
- package/src/tools/configured.ts +28 -0
- package/src/tools/files.ts +24 -27
- package/src/tools/index.ts +5 -3
- package/src/tools/lifecycle.ts +69 -55
- package/templates/skills/ast-mcp/SKILL.md +7 -6
- package/templates/skills/ast-mcp/evals/batch.evals.json +48 -0
- package/templates/skills/ast-mcp/evals/evals.json +1 -0
- package/templates/skills/ast-mcp/evals/score.test.ts +175 -0
- package/templates/skills/ast-mcp/evals/score.ts +304 -267
- package/templates/skills/ast-mcp/evals/semantic.test.ts +322 -0
- package/templates/skills/ast-mcp/evals/semantic.ts +390 -135
- package/templates/skills/ast-mcp/evals/shell-policy.ts +252 -0
- package/templates/skills/ast-mcp/evals/source.test.ts +46 -0
- package/templates/skills/ast-mcp/evals/source.ts +164 -0
- package/templates/skills/ast-mcp/evals/trigger-queries.json +1 -1
- package/templates/skills/ast-mcp/references/installation.md +9 -8
- package/templates/skills/ast-mcp/references/patch-state-machine.md +5 -5
- package/templates/skills/ast-mcp/references/tool-catalog.md +4 -2
- package/templates/skills/ast-mcp/scripts/check-install.ts +312 -110
package/src/http.ts
CHANGED
|
@@ -3,26 +3,21 @@ import type { McpServer } from "@modelcontextprotocol/server";
|
|
|
3
3
|
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/server";
|
|
4
4
|
import { serve } from "bun";
|
|
5
5
|
|
|
6
|
+
import { type ResolvedConfig, resolveConfig } from "./config";
|
|
6
7
|
import { createServer, installProcessSignalHandlers } from "./lifecycle";
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
+
const configuration = resolveConfig;
|
|
9
10
|
|
|
10
|
-
function httpBinding() {
|
|
11
|
-
return { hostname:
|
|
11
|
+
function httpBinding(config: ResolvedConfig) {
|
|
12
|
+
return { hostname: config.http.host };
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
function updateSessionDurations(config: ResolvedConfig) {
|
|
15
|
+
SESSION_TIMEOUT_MS = config.http.sessionTimeoutMs;
|
|
16
|
+
SESSION_SWEEP_INTERVAL_MS = config.http.sessionSweepIntervalMs;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
30 * 60 * 1000,
|
|
21
|
-
);
|
|
22
|
-
const SESSION_SWEEP_INTERVAL_MS = durationFromEnv(
|
|
23
|
-
"AST_MCP_SESSION_SWEEP_INTERVAL_MS",
|
|
24
|
-
60 * 1000,
|
|
25
|
-
); // 30 minutes
|
|
19
|
+
let SESSION_TIMEOUT_MS = 30 * 60 * 1000;
|
|
20
|
+
let SESSION_SWEEP_INTERVAL_MS = 60 * 1000; // 30 minutes
|
|
26
21
|
|
|
27
22
|
const sessions = new Map<
|
|
28
23
|
string,
|
|
@@ -34,105 +29,125 @@ const sessions = new Map<
|
|
|
34
29
|
>();
|
|
35
30
|
|
|
36
31
|
// Clean up idle sessions periodically
|
|
37
|
-
|
|
32
|
+
let sessionSweep: ReturnType<typeof setInterval> | undefined;
|
|
33
|
+
|
|
34
|
+
function discardSession(sessionId: string) {
|
|
35
|
+
const session = sessions.get(sessionId);
|
|
36
|
+
if (!session) return;
|
|
37
|
+
void session.server.close();
|
|
38
|
+
sessions.delete(sessionId);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function closeSession(sessionId: string) {
|
|
42
|
+
const session = sessions.get(sessionId);
|
|
43
|
+
if (!session) return;
|
|
44
|
+
await session.server.close();
|
|
45
|
+
sessions.delete(sessionId);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function sweepExpiredSessions() {
|
|
38
49
|
const now = Date.now();
|
|
39
50
|
for (const [id, session] of sessions) {
|
|
40
|
-
if (now - session.lastActivity > SESSION_TIMEOUT_MS)
|
|
41
|
-
void session.server.close();
|
|
42
|
-
sessions.delete(id);
|
|
43
|
-
}
|
|
51
|
+
if (now - session.lastActivity > SESSION_TIMEOUT_MS) discardSession(id);
|
|
44
52
|
}
|
|
45
|
-
}
|
|
53
|
+
}
|
|
46
54
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return response;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (request.method === "POST") {
|
|
80
|
-
if (sessionId) {
|
|
81
|
-
const session = sessions.get(sessionId);
|
|
82
|
-
if (!session) {
|
|
83
|
-
return new Response("Session not found", { status: 404 });
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
session.lastActivity = Date.now();
|
|
87
|
-
return session.transport.handleRequest(request);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const server = createServer();
|
|
91
|
-
|
|
92
|
-
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
93
|
-
onsessionclosed: (closedSessionId) => {
|
|
94
|
-
const session = sessions.get(closedSessionId);
|
|
95
|
-
if (session) {
|
|
96
|
-
void session.server.close();
|
|
97
|
-
sessions.delete(closedSessionId);
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
onsessioninitialized: (newSessionId) => {
|
|
101
|
-
sessions.set(newSessionId, {
|
|
102
|
-
lastActivity: Date.now(),
|
|
103
|
-
server,
|
|
104
|
-
transport,
|
|
105
|
-
});
|
|
106
|
-
},
|
|
107
|
-
sessionIdGenerator: () => crypto.randomUUID(),
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
await server.connect(transport);
|
|
111
|
-
|
|
112
|
-
return transport.handleRequest(request);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return new Response("Method not allowed", { status: 405 });
|
|
55
|
+
function startSessionSweep() {
|
|
56
|
+
sessionSweep = setInterval(sweepExpiredSessions, SESSION_SWEEP_INTERVAL_MS);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function existingSessionRequest(
|
|
60
|
+
request: Request,
|
|
61
|
+
sessionId: string,
|
|
62
|
+
closeAfterResponse = false,
|
|
63
|
+
) {
|
|
64
|
+
const session = sessions.get(sessionId);
|
|
65
|
+
if (!session) return new Response("Session not found", { status: 404 });
|
|
66
|
+
session.lastActivity = Date.now();
|
|
67
|
+
const response = await session.transport.handleRequest(request);
|
|
68
|
+
if (closeAfterResponse) await closeSession(sessionId);
|
|
69
|
+
return response;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function sessionTransport(server: ReturnType<typeof createServer>) {
|
|
73
|
+
let transport: WebStandardStreamableHTTPServerTransport;
|
|
74
|
+
transport = new WebStandardStreamableHTTPServerTransport({
|
|
75
|
+
onsessionclosed: discardSession,
|
|
76
|
+
onsessioninitialized: (sessionId) => {
|
|
77
|
+
sessions.set(sessionId, {
|
|
78
|
+
lastActivity: Date.now(),
|
|
79
|
+
server,
|
|
80
|
+
transport,
|
|
81
|
+
});
|
|
116
82
|
},
|
|
117
|
-
|
|
118
|
-
|
|
83
|
+
sessionIdGenerator: () => crypto.randomUUID(),
|
|
84
|
+
});
|
|
85
|
+
return transport;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async function createSession(request: Request) {
|
|
89
|
+
const server = createServer();
|
|
90
|
+
const transport = sessionTransport(server);
|
|
91
|
+
await server.connect(transport);
|
|
92
|
+
return transport.handleRequest(request);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async function sessionRequest(request: Request) {
|
|
96
|
+
const sessionId = request.headers.get("mcp-session-id");
|
|
97
|
+
if (request.method === "GET" || request.method === "DELETE") {
|
|
98
|
+
if (!sessionId) return new Response("Missing session ID", { status: 400 });
|
|
99
|
+
return existingSessionRequest(
|
|
100
|
+
request,
|
|
101
|
+
sessionId,
|
|
102
|
+
request.method === "DELETE",
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
if (request.method !== "POST")
|
|
106
|
+
return new Response("Method not allowed", { status: 405 });
|
|
107
|
+
return sessionId
|
|
108
|
+
? existingSessionRequest(request, sessionId)
|
|
109
|
+
: createSession(request);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function handleMcpRequest(request: Request) {
|
|
113
|
+
const url = new URL(request.url);
|
|
114
|
+
return url.pathname === "/mcp"
|
|
115
|
+
? sessionRequest(request)
|
|
116
|
+
: new Response("Not found", { status: 404 });
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async function shutdownHttpServer(httpServer: ReturnType<typeof serve>) {
|
|
120
|
+
httpServer.stop(false);
|
|
121
|
+
if (sessionSweep) clearInterval(sessionSweep);
|
|
122
|
+
const results = await Promise.allSettled(
|
|
123
|
+
[...sessions.values()].map((session) => session.server.close()),
|
|
124
|
+
);
|
|
125
|
+
sessions.clear();
|
|
126
|
+
httpServer.stop(true);
|
|
127
|
+
const failed = results.find((result) => result.status === "rejected");
|
|
128
|
+
if (failed?.status === "rejected") throw failed.reason;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export async function startHttpServer(
|
|
132
|
+
overrides: { host?: string; port?: number } = {},
|
|
133
|
+
) {
|
|
134
|
+
const config = await configuration();
|
|
135
|
+
updateSessionDurations(config);
|
|
136
|
+
startSessionSweep();
|
|
137
|
+
const httpServer = serve({
|
|
138
|
+
fetch: handleMcpRequest,
|
|
139
|
+
port: overrides.port ?? config.http.port,
|
|
140
|
+
...httpBinding({
|
|
141
|
+
...config,
|
|
142
|
+
http: { ...config.http, host: overrides.host ?? config.http.host },
|
|
143
|
+
}),
|
|
119
144
|
});
|
|
120
145
|
let shutdown: Promise<void> | undefined;
|
|
121
146
|
installProcessSignalHandlers(() => {
|
|
122
|
-
shutdown ??= (
|
|
123
|
-
httpServer.stop(false);
|
|
124
|
-
clearInterval(sessionSweep);
|
|
125
|
-
const results = await Promise.allSettled(
|
|
126
|
-
[...sessions.values()].map((session) => session.server.close()),
|
|
127
|
-
);
|
|
128
|
-
sessions.clear();
|
|
129
|
-
httpServer.stop(true);
|
|
130
|
-
const failed = results.find((result) => result.status === "rejected");
|
|
131
|
-
if (failed?.status === "rejected") throw failed.reason;
|
|
132
|
-
})();
|
|
147
|
+
shutdown ??= shutdownHttpServer(httpServer);
|
|
133
148
|
return shutdown;
|
|
134
149
|
});
|
|
135
150
|
return httpServer;
|
|
136
151
|
}
|
|
137
152
|
|
|
138
|
-
if (import.meta.main) startHttpServer();
|
|
153
|
+
if (import.meta.main) await startHttpServer();
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { isIP } from "node:net";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { clearConfigCache, globalConfigPath, resolveConfig } from "./config";
|
|
5
|
+
|
|
6
|
+
export const transports = ["stdio", "http"] as const;
|
|
7
|
+
export type McpTransport = (typeof transports)[number];
|
|
8
|
+
|
|
9
|
+
export interface HttpEndpoint {
|
|
10
|
+
host: string;
|
|
11
|
+
port: number;
|
|
12
|
+
url: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface InstallerEndpointOptions {
|
|
16
|
+
env?: NodeJS.ProcessEnv;
|
|
17
|
+
home: string;
|
|
18
|
+
host?: string;
|
|
19
|
+
persist?: boolean;
|
|
20
|
+
port?: number;
|
|
21
|
+
root: string;
|
|
22
|
+
scope: "local" | "global";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function validateHttpHost(host: string) {
|
|
26
|
+
const value = host.trim();
|
|
27
|
+
const hostname =
|
|
28
|
+
value.startsWith("[") && value.endsWith("]") ? value.slice(1, -1) : value;
|
|
29
|
+
if (
|
|
30
|
+
!hostname ||
|
|
31
|
+
(!isIP(hostname) &&
|
|
32
|
+
!/^(?:[a-zA-Z0-9](?:[a-zA-Z0-9.-]*[a-zA-Z0-9])?)$/.test(hostname))
|
|
33
|
+
)
|
|
34
|
+
throw new Error(
|
|
35
|
+
`Invalid HTTP host "${host}"; expected a hostname or IP address without a scheme or path`,
|
|
36
|
+
);
|
|
37
|
+
return hostname;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function validateHttpPort(port: number) {
|
|
41
|
+
if (!Number.isInteger(port) || port < 1 || port > 65_535)
|
|
42
|
+
throw new Error(
|
|
43
|
+
`Invalid HTTP port "${port}"; expected an integer from 1 through 65535`,
|
|
44
|
+
);
|
|
45
|
+
return port;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function httpEndpoint(host: string, port: number): HttpEndpoint {
|
|
49
|
+
const bindHost = validateHttpHost(host);
|
|
50
|
+
const clientHost =
|
|
51
|
+
bindHost === "0.0.0.0" ? "127.0.0.1" : bindHost === "::" ? "::1" : bindHost;
|
|
52
|
+
const urlHost = isIP(clientHost) === 6 ? `[${clientHost}]` : clientHost;
|
|
53
|
+
return {
|
|
54
|
+
host: bindHost,
|
|
55
|
+
port: validateHttpPort(port),
|
|
56
|
+
url: `http://${urlHost}:${port}/mcp`,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function assignment(name: "host" | "port", value: string | number) {
|
|
61
|
+
return `${name} = ${typeof value === "string" ? JSON.stringify(value) : value}`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type HttpValues = { host?: string; port?: number };
|
|
65
|
+
type HttpField = "host" | "port";
|
|
66
|
+
|
|
67
|
+
function assertToml(content: string, message: string) {
|
|
68
|
+
try {
|
|
69
|
+
Bun.TOML.parse(content);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
throw new Error(
|
|
72
|
+
`${message}: ${error instanceof Error ? error.message : String(error)}`,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function httpHeader(content: string) {
|
|
78
|
+
if (/^\s*http\.(?:host|port)\s*=/m.test(content))
|
|
79
|
+
throw new Error(
|
|
80
|
+
"Cannot update HTTP configuration with dotted http.host or http.port keys; move them into an [http] table",
|
|
81
|
+
);
|
|
82
|
+
const headers = [...content.matchAll(/^\s*\[http\]\s*(?:#.*)?$/gm)];
|
|
83
|
+
if (headers.length > 1)
|
|
84
|
+
throw new Error(
|
|
85
|
+
"Cannot update HTTP configuration with duplicate [http] tables",
|
|
86
|
+
);
|
|
87
|
+
return headers[0];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function normalizedHttpValue(name: HttpField, value: string | number) {
|
|
91
|
+
return name === "host"
|
|
92
|
+
? validateHttpHost(String(value))
|
|
93
|
+
: validateHttpPort(Number(value));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function newHttpSection(content: string, values: HttpValues) {
|
|
97
|
+
const lines = ["[http]"];
|
|
98
|
+
for (const [name, value] of Object.entries(values) as Array<
|
|
99
|
+
[HttpField, string | number | undefined]
|
|
100
|
+
>) {
|
|
101
|
+
if (value !== undefined)
|
|
102
|
+
lines.push(assignment(name, normalizedHttpValue(name, value)));
|
|
103
|
+
}
|
|
104
|
+
return `${content.trimEnd()}${content.trim() ? "\n\n" : ""}${lines.join("\n")}\n`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function updateHttpField(
|
|
108
|
+
section: string,
|
|
109
|
+
name: HttpField,
|
|
110
|
+
value: string | number,
|
|
111
|
+
) {
|
|
112
|
+
const line = assignment(name, normalizedHttpValue(name, value));
|
|
113
|
+
const pattern = new RegExp(`^(\\s*)${name}\\s*=([^#\\n]*)(\\s+#.*)?$`, "m");
|
|
114
|
+
return pattern.test(section)
|
|
115
|
+
? section.replace(
|
|
116
|
+
pattern,
|
|
117
|
+
(_match, indentation: string, _oldValue: string, comment = "") =>
|
|
118
|
+
`${indentation}${line}${comment}`,
|
|
119
|
+
)
|
|
120
|
+
: `${section.trimEnd()}\n${line}\n`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function updateHttpSection(
|
|
124
|
+
content: string,
|
|
125
|
+
header: RegExpMatchArray,
|
|
126
|
+
values: HttpValues,
|
|
127
|
+
) {
|
|
128
|
+
const start = (header.index ?? 0) + header[0].length;
|
|
129
|
+
const nextHeader = /^\s*\[(?!http\])[^\n]+\]\s*(?:#.*)?$/gm;
|
|
130
|
+
nextHeader.lastIndex = start;
|
|
131
|
+
const end = nextHeader.exec(content)?.index ?? content.length;
|
|
132
|
+
let section = content.slice(start, end);
|
|
133
|
+
for (const [name, value] of Object.entries(values) as Array<
|
|
134
|
+
[HttpField, string | number | undefined]
|
|
135
|
+
>) {
|
|
136
|
+
if (value !== undefined) section = updateHttpField(section, name, value);
|
|
137
|
+
}
|
|
138
|
+
return `${content.slice(0, start)}${section}${content.slice(end)}`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function updateHttpToml(
|
|
142
|
+
content: string,
|
|
143
|
+
values: { host?: string; port?: number },
|
|
144
|
+
) {
|
|
145
|
+
if (values.host === undefined && values.port === undefined) return content;
|
|
146
|
+
assertToml(
|
|
147
|
+
content,
|
|
148
|
+
"Cannot update HTTP configuration because the existing TOML is invalid",
|
|
149
|
+
);
|
|
150
|
+
const header = httpHeader(content);
|
|
151
|
+
const result = header
|
|
152
|
+
? updateHttpSection(content, header, values)
|
|
153
|
+
: newHttpSection(content, values);
|
|
154
|
+
assertToml(result, "Generated invalid HTTP configuration");
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export async function resolveInstallerEndpoint(
|
|
159
|
+
options: InstallerEndpointOptions,
|
|
160
|
+
): Promise<HttpEndpoint> {
|
|
161
|
+
const configFile =
|
|
162
|
+
options.scope === "local"
|
|
163
|
+
? path.join(path.resolve(options.root), "ast-mcp.toml")
|
|
164
|
+
: globalConfigPath({ env: options.env, home: options.home });
|
|
165
|
+
if (
|
|
166
|
+
options.persist !== false &&
|
|
167
|
+
(options.host !== undefined || options.port !== undefined)
|
|
168
|
+
) {
|
|
169
|
+
const current = await readFile(configFile, "utf8").catch((error) => {
|
|
170
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return "";
|
|
171
|
+
throw error;
|
|
172
|
+
});
|
|
173
|
+
const updated = updateHttpToml(current, {
|
|
174
|
+
host: options.host,
|
|
175
|
+
port: options.port,
|
|
176
|
+
});
|
|
177
|
+
await mkdir(path.dirname(configFile), { recursive: true });
|
|
178
|
+
await writeFile(configFile, updated);
|
|
179
|
+
clearConfigCache();
|
|
180
|
+
}
|
|
181
|
+
const config = await resolveConfig({
|
|
182
|
+
cwd: options.scope === "local" ? options.root : options.home,
|
|
183
|
+
env: options.env,
|
|
184
|
+
home: options.home,
|
|
185
|
+
});
|
|
186
|
+
return httpEndpoint(
|
|
187
|
+
options.host ?? config.http.host,
|
|
188
|
+
options.port ?? config.http.port,
|
|
189
|
+
);
|
|
190
|
+
}
|