@zokizuan/satori-cli 0.1.1
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/LICENSE +21 -0
- package/README.md +50 -0
- package/assets/skills/satori-indexing/SKILL.md +36 -0
- package/assets/skills/satori-navigation/SKILL.md +36 -0
- package/assets/skills/satori-search/SKILL.md +36 -0
- package/dist/args.d.ts +54 -0
- package/dist/args.js +474 -0
- package/dist/client.d.ts +26 -0
- package/dist/client.js +101 -0
- package/dist/errors.d.ts +7 -0
- package/dist/errors.js +18 -0
- package/dist/format.d.ts +15 -0
- package/dist/format.js +100 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +301 -0
- package/dist/install.d.ts +30 -0
- package/dist/install.js +333 -0
- package/dist/managed-package.d.ts +11 -0
- package/dist/managed-package.js +39 -0
- package/dist/package-installability.d.ts +14 -0
- package/dist/package-installability.js +123 -0
- package/dist/resolve-server-entry.d.ts +2 -0
- package/dist/resolve-server-entry.js +17 -0
- package/package.json +52 -0
package/dist/format.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export function emitJson(writers, payload) {
|
|
2
|
+
writers.writeStdout(`${JSON.stringify(payload, null, 2)}\n`);
|
|
3
|
+
}
|
|
4
|
+
export function emitError(writers, token, message) {
|
|
5
|
+
writers.writeStderr(`${token} ${message}\n`);
|
|
6
|
+
}
|
|
7
|
+
function firstTextContent(result) {
|
|
8
|
+
const content = result?.content;
|
|
9
|
+
if (!Array.isArray(content)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const firstText = content.find((entry) => entry && entry.type === "text" && typeof entry.text === "string");
|
|
13
|
+
if (!firstText || typeof firstText.text !== "string") {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return firstText.text;
|
|
17
|
+
}
|
|
18
|
+
export function parseStructuredEnvelope(result) {
|
|
19
|
+
const text = firstTextContent(result);
|
|
20
|
+
if (!text) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const parsed = JSON.parse(text);
|
|
25
|
+
if (!parsed || typeof parsed !== "object") {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const status = parsed.status;
|
|
29
|
+
if (typeof status !== "string") {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const reason = parsed.reason;
|
|
33
|
+
const hints = parsed.hints;
|
|
34
|
+
const hintStatus = hints && typeof hints === "object"
|
|
35
|
+
? hints.status
|
|
36
|
+
: undefined;
|
|
37
|
+
return {
|
|
38
|
+
status,
|
|
39
|
+
reason: typeof reason === "string" ? reason : undefined,
|
|
40
|
+
hintStatus
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export function inferManageStatusState(result) {
|
|
48
|
+
const envelope = parseStructuredEnvelope(result);
|
|
49
|
+
if (envelope) {
|
|
50
|
+
if (envelope.status === "not_ready" && envelope.reason === "indexing") {
|
|
51
|
+
return "indexing";
|
|
52
|
+
}
|
|
53
|
+
if (envelope.status === "not_ready" && envelope.reason === "requires_reindex") {
|
|
54
|
+
return "requires_reindex";
|
|
55
|
+
}
|
|
56
|
+
if (envelope.status === "requires_reindex") {
|
|
57
|
+
return "requires_reindex";
|
|
58
|
+
}
|
|
59
|
+
if (envelope.status === "blocked" && envelope.reason === "requires_reindex") {
|
|
60
|
+
return "requires_reindex";
|
|
61
|
+
}
|
|
62
|
+
if (envelope.status === "not_indexed") {
|
|
63
|
+
return "not_indexed";
|
|
64
|
+
}
|
|
65
|
+
if (envelope.status === "blocked" && envelope.reason === "not_indexed") {
|
|
66
|
+
return "not_indexed";
|
|
67
|
+
}
|
|
68
|
+
if (envelope.status === "ok") {
|
|
69
|
+
return "indexed";
|
|
70
|
+
}
|
|
71
|
+
if (envelope.status === "error" && envelope.reason === "requires_reindex") {
|
|
72
|
+
return "requires_reindex";
|
|
73
|
+
}
|
|
74
|
+
if (envelope.status === "error" && envelope.reason === "not_indexed") {
|
|
75
|
+
return "not_indexed";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const text = firstTextContent(result);
|
|
79
|
+
if (!text) {
|
|
80
|
+
return "unknown";
|
|
81
|
+
}
|
|
82
|
+
const normalized = text.toLowerCase();
|
|
83
|
+
if (normalized.includes("currently being indexed") || normalized.includes("currently indexing")) {
|
|
84
|
+
return "indexing";
|
|
85
|
+
}
|
|
86
|
+
if (normalized.includes("fully indexed and ready")) {
|
|
87
|
+
return "indexed";
|
|
88
|
+
}
|
|
89
|
+
if (normalized.includes("indexing failed")) {
|
|
90
|
+
return "indexfailed";
|
|
91
|
+
}
|
|
92
|
+
if (normalized.includes("must be rebuilt") || normalized.includes("incompatible with the current runtime")) {
|
|
93
|
+
return "requires_reindex";
|
|
94
|
+
}
|
|
95
|
+
if (normalized.includes("is not indexed")) {
|
|
96
|
+
return "not_indexed";
|
|
97
|
+
}
|
|
98
|
+
return "unknown";
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=format.js.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
interface RunCliOptions {
|
|
3
|
+
writeStdout?: (text: string) => void;
|
|
4
|
+
writeStderr?: (text: string) => void;
|
|
5
|
+
stdin?: NodeJS.ReadStream;
|
|
6
|
+
env?: NodeJS.ProcessEnv;
|
|
7
|
+
serverCommand?: string;
|
|
8
|
+
serverArgs?: string[];
|
|
9
|
+
serverEnv?: Record<string, string>;
|
|
10
|
+
startupTimeoutMs?: number;
|
|
11
|
+
callTimeoutMs?: number;
|
|
12
|
+
cwd?: string;
|
|
13
|
+
installabilityVerifier?: () => string | Promise<string>;
|
|
14
|
+
connectSession?: (options: {
|
|
15
|
+
command: string;
|
|
16
|
+
args: string[];
|
|
17
|
+
env: Record<string, string | undefined>;
|
|
18
|
+
cwd?: string;
|
|
19
|
+
startupTimeoutMs: number;
|
|
20
|
+
callTimeoutMs: number;
|
|
21
|
+
writeStderr: (text: string) => void;
|
|
22
|
+
}) => Promise<CliSession>;
|
|
23
|
+
}
|
|
24
|
+
interface CliSession {
|
|
25
|
+
listTools(): Promise<any>;
|
|
26
|
+
callTool(name: string, args: Record<string, unknown>): Promise<any>;
|
|
27
|
+
close(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export declare function runCli(argv: string[], options?: RunCliOptions): Promise<number>;
|
|
30
|
+
export declare function isExecutedDirectlyForPaths(moduleUrl: string, entryPath: string | undefined): boolean;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { parseCliArgs, parseWrapperArgumentsFromSchema, resolveRawArguments } from "./args.js";
|
|
6
|
+
import { connectCliMcpSession } from "./client.js";
|
|
7
|
+
import { asCliError, CliError } from "./errors.js";
|
|
8
|
+
import { emitError, emitJson, inferManageStatusState, parseStructuredEnvelope } from "./format.js";
|
|
9
|
+
import { executeInstallCommand } from "./install.js";
|
|
10
|
+
import { verifyManagedPackageInstallability } from "./package-installability.js";
|
|
11
|
+
import { resolveServerEntryPath } from "./resolve-server-entry.js";
|
|
12
|
+
const MANAGE_INDEX_MIN_POLL_TIMEOUT_MS = 10 * 60 * 1000;
|
|
13
|
+
function firstText(result) {
|
|
14
|
+
const content = result?.content;
|
|
15
|
+
if (!Array.isArray(content)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const entry = content.find((item) => item?.type === "text" && typeof item?.text === "string");
|
|
19
|
+
return entry?.text || null;
|
|
20
|
+
}
|
|
21
|
+
function readPackageVersion() {
|
|
22
|
+
try {
|
|
23
|
+
const currentFile = fileURLToPath(import.meta.url);
|
|
24
|
+
const packagePath = path.resolve(path.dirname(currentFile), "..", "package.json");
|
|
25
|
+
const content = fs.readFileSync(packagePath, "utf8");
|
|
26
|
+
const parsed = JSON.parse(content);
|
|
27
|
+
if (parsed && typeof parsed.version === "string") {
|
|
28
|
+
return parsed.version;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Best-effort only.
|
|
33
|
+
}
|
|
34
|
+
return "unknown";
|
|
35
|
+
}
|
|
36
|
+
function resolveDefaultServerArgs() {
|
|
37
|
+
const serverEntry = resolveServerEntryPath();
|
|
38
|
+
if (serverEntry.endsWith(".ts")) {
|
|
39
|
+
return ["--import", "tsx", serverEntry];
|
|
40
|
+
}
|
|
41
|
+
return [serverEntry];
|
|
42
|
+
}
|
|
43
|
+
function buildHelpPayload() {
|
|
44
|
+
return {
|
|
45
|
+
usage: "satori-cli <command>",
|
|
46
|
+
commands: [
|
|
47
|
+
"install [--client all|codex|claude] [--dry-run]",
|
|
48
|
+
"uninstall [--client all|codex|claude] [--dry-run]",
|
|
49
|
+
"tools list",
|
|
50
|
+
"tool call <toolName> --args-json '<json>'",
|
|
51
|
+
"tool call <toolName> --args-file <path>",
|
|
52
|
+
"<toolName> [schema-driven flags]"
|
|
53
|
+
],
|
|
54
|
+
globalFlags: [
|
|
55
|
+
"--startup-timeout-ms <n>",
|
|
56
|
+
"--call-timeout-ms <n>",
|
|
57
|
+
"--format json|text",
|
|
58
|
+
"--debug"
|
|
59
|
+
]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function resolveToolSchema(toolsResult, toolName) {
|
|
63
|
+
const tools = Array.isArray(toolsResult?.tools) ? toolsResult.tools : [];
|
|
64
|
+
const tool = tools.find((entry) => entry && entry.name === toolName);
|
|
65
|
+
if (!tool) {
|
|
66
|
+
throw new CliError("E_USAGE", `Unknown tool '${toolName}'.`, 2);
|
|
67
|
+
}
|
|
68
|
+
const schema = tool.inputSchema ?? tool.input_schema;
|
|
69
|
+
if (!schema || typeof schema !== "object") {
|
|
70
|
+
throw new CliError("E_SCHEMA_UNSUPPORTED", `${toolName} schema is missing or invalid. Use --args-json/--args-file.`, 2);
|
|
71
|
+
}
|
|
72
|
+
return schema;
|
|
73
|
+
}
|
|
74
|
+
function sleep(ms) {
|
|
75
|
+
return new Promise((resolve) => {
|
|
76
|
+
const timer = setTimeout(resolve, ms);
|
|
77
|
+
timer.unref();
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async function pollManageIndexUntilTerminal(pathArg, session, timeoutMs) {
|
|
81
|
+
const startedAt = Date.now();
|
|
82
|
+
const pollIntervalMs = 500;
|
|
83
|
+
while (Date.now() - startedAt < timeoutMs) {
|
|
84
|
+
await sleep(pollIntervalMs);
|
|
85
|
+
const statusResult = await session.callTool("manage_index", {
|
|
86
|
+
action: "status",
|
|
87
|
+
path: pathArg
|
|
88
|
+
});
|
|
89
|
+
const state = inferManageStatusState(statusResult);
|
|
90
|
+
if (state === "indexing" || state === "unknown") {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
return { result: statusResult, state };
|
|
94
|
+
}
|
|
95
|
+
throw new CliError("E_CALL_TIMEOUT", `Timed out after ${timeoutMs}ms while waiting for manage_index status.`, 3);
|
|
96
|
+
}
|
|
97
|
+
function shouldWaitManageIndex(toolName, args) {
|
|
98
|
+
if (toolName !== "manage_index") {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
const action = args.action;
|
|
102
|
+
if (action !== "create" && action !== "reindex") {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
return typeof args.path === "string" && args.path.length > 0;
|
|
106
|
+
}
|
|
107
|
+
function summarizeEnvelopeError(writers, envelope) {
|
|
108
|
+
if (!envelope) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const status = envelope.status;
|
|
112
|
+
const reasonPart = envelope.reason ? ` reason=${envelope.reason}` : "";
|
|
113
|
+
const statusHintPart = envelope.hintStatus ? ` status_hint=${JSON.stringify(envelope.hintStatus)}` : "";
|
|
114
|
+
writers.writeStderr(`E_TOOL_ERROR status=${status}${reasonPart}${statusHintPart}\n`);
|
|
115
|
+
}
|
|
116
|
+
function maybeEmitTextSummary(writers, result) {
|
|
117
|
+
const text = firstText(result);
|
|
118
|
+
if (text) {
|
|
119
|
+
writers.writeStderr(`${text}\n`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function evaluateToolResultForError(result, writers) {
|
|
123
|
+
if (result?.isError === true) {
|
|
124
|
+
const message = firstText(result) || "tool call failed";
|
|
125
|
+
writers.writeStderr(`E_TOOL_ERROR ${message}\n`);
|
|
126
|
+
return 1;
|
|
127
|
+
}
|
|
128
|
+
const envelope = parseStructuredEnvelope(result);
|
|
129
|
+
if (envelope && envelope.status !== "ok") {
|
|
130
|
+
summarizeEnvelopeError(writers, envelope);
|
|
131
|
+
return 1;
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
async function invokeTool(toolName, args, session, callTimeoutMs, writers, format) {
|
|
136
|
+
let result = await session.callTool(toolName, args);
|
|
137
|
+
let manageWaitState = null;
|
|
138
|
+
const initialErrorExit = evaluateToolResultForError(result, writers);
|
|
139
|
+
if (initialErrorExit !== null) {
|
|
140
|
+
emitJson(writers, result);
|
|
141
|
+
if (format === "text") {
|
|
142
|
+
maybeEmitTextSummary(writers, result);
|
|
143
|
+
}
|
|
144
|
+
return initialErrorExit;
|
|
145
|
+
}
|
|
146
|
+
if (shouldWaitManageIndex(toolName, args)) {
|
|
147
|
+
const effectiveManagePollTimeoutMs = Math.max(callTimeoutMs, MANAGE_INDEX_MIN_POLL_TIMEOUT_MS);
|
|
148
|
+
const polled = await pollManageIndexUntilTerminal(args.path, session, effectiveManagePollTimeoutMs);
|
|
149
|
+
result = polled.result;
|
|
150
|
+
manageWaitState = polled.state;
|
|
151
|
+
}
|
|
152
|
+
emitJson(writers, result);
|
|
153
|
+
if (format === "text") {
|
|
154
|
+
maybeEmitTextSummary(writers, result);
|
|
155
|
+
}
|
|
156
|
+
const finalErrorExit = evaluateToolResultForError(result, writers);
|
|
157
|
+
if (finalErrorExit !== null) {
|
|
158
|
+
return finalErrorExit;
|
|
159
|
+
}
|
|
160
|
+
if (manageWaitState === "indexfailed" || manageWaitState === "requires_reindex" || manageWaitState === "not_indexed") {
|
|
161
|
+
emitError(writers, "E_TOOL_ERROR", `manage_index terminal state=${manageWaitState}`);
|
|
162
|
+
return 1;
|
|
163
|
+
}
|
|
164
|
+
return 0;
|
|
165
|
+
}
|
|
166
|
+
export async function runCli(argv, options = {}) {
|
|
167
|
+
const writers = {
|
|
168
|
+
writeStdout: options.writeStdout || ((text) => process.stdout.write(text)),
|
|
169
|
+
writeStderr: options.writeStderr || ((text) => process.stderr.write(text)),
|
|
170
|
+
};
|
|
171
|
+
const effectiveEnv = options.env || process.env;
|
|
172
|
+
let parsedFormat = "json";
|
|
173
|
+
let parsedCommandKind = null;
|
|
174
|
+
try {
|
|
175
|
+
const parsed = parseCliArgs(argv);
|
|
176
|
+
parsedFormat = parsed.globals.format;
|
|
177
|
+
parsedCommandKind = parsed.command.kind;
|
|
178
|
+
const startupTimeoutMs = options.startupTimeoutMs ?? parsed.globals.startupTimeoutMs;
|
|
179
|
+
const callTimeoutMs = options.callTimeoutMs ?? parsed.globals.callTimeoutMs;
|
|
180
|
+
if (parsed.command.kind === "help") {
|
|
181
|
+
emitJson(writers, buildHelpPayload());
|
|
182
|
+
if (parsed.globals.format === "text") {
|
|
183
|
+
writers.writeStderr("satori-cli help requested.\n");
|
|
184
|
+
}
|
|
185
|
+
return 0;
|
|
186
|
+
}
|
|
187
|
+
if (parsed.command.kind === "version") {
|
|
188
|
+
emitJson(writers, {
|
|
189
|
+
name: "@zokizuan/satori-cli",
|
|
190
|
+
cli: "satori-cli",
|
|
191
|
+
version: readPackageVersion(),
|
|
192
|
+
});
|
|
193
|
+
if (parsed.globals.format === "text") {
|
|
194
|
+
writers.writeStderr("satori-cli version shown.\n");
|
|
195
|
+
}
|
|
196
|
+
return 0;
|
|
197
|
+
}
|
|
198
|
+
if (parsed.command.kind === "install" || parsed.command.kind === "uninstall") {
|
|
199
|
+
if (parsed.command.kind === "install") {
|
|
200
|
+
await (options.installabilityVerifier || verifyManagedPackageInstallability)();
|
|
201
|
+
}
|
|
202
|
+
const result = executeInstallCommand(parsed.command, {
|
|
203
|
+
homeDir: effectiveEnv.HOME,
|
|
204
|
+
});
|
|
205
|
+
emitJson(writers, result);
|
|
206
|
+
if (parsed.globals.format === "text") {
|
|
207
|
+
writers.writeStderr(`satori-cli ${parsed.command.kind} completed for ${parsed.command.client}.\n`);
|
|
208
|
+
}
|
|
209
|
+
return 0;
|
|
210
|
+
}
|
|
211
|
+
const session = await (options.connectSession || connectCliMcpSession)({
|
|
212
|
+
command: options.serverCommand || process.execPath,
|
|
213
|
+
args: options.serverArgs || resolveDefaultServerArgs(),
|
|
214
|
+
env: {
|
|
215
|
+
...effectiveEnv,
|
|
216
|
+
...options.serverEnv,
|
|
217
|
+
SATORI_RUN_MODE: "cli",
|
|
218
|
+
},
|
|
219
|
+
cwd: options.cwd,
|
|
220
|
+
startupTimeoutMs,
|
|
221
|
+
callTimeoutMs,
|
|
222
|
+
writeStderr: writers.writeStderr,
|
|
223
|
+
});
|
|
224
|
+
try {
|
|
225
|
+
if (parsed.command.kind === "tools-list") {
|
|
226
|
+
const result = await session.listTools();
|
|
227
|
+
emitJson(writers, result);
|
|
228
|
+
return 0;
|
|
229
|
+
}
|
|
230
|
+
if (parsed.command.kind === "tool-call") {
|
|
231
|
+
const args = await resolveRawArguments(parsed.command.rawArgsMode, {
|
|
232
|
+
stdin: options.stdin,
|
|
233
|
+
stdinTimeoutMs: callTimeoutMs,
|
|
234
|
+
});
|
|
235
|
+
return await invokeTool(parsed.command.toolName, args, session, callTimeoutMs, writers, parsed.globals.format);
|
|
236
|
+
}
|
|
237
|
+
const listToolsResult = await session.listTools();
|
|
238
|
+
const schema = resolveToolSchema(listToolsResult, parsed.command.toolName);
|
|
239
|
+
const args = parsed.command.rawArgsMode.kind !== "none"
|
|
240
|
+
? await resolveRawArguments(parsed.command.rawArgsMode, {
|
|
241
|
+
stdin: options.stdin,
|
|
242
|
+
stdinTimeoutMs: callTimeoutMs,
|
|
243
|
+
})
|
|
244
|
+
: parseWrapperArgumentsFromSchema(parsed.command.toolName, schema, parsed.command.wrapperArgs);
|
|
245
|
+
return await invokeTool(parsed.command.toolName, args, session, callTimeoutMs, writers, parsed.globals.format);
|
|
246
|
+
}
|
|
247
|
+
finally {
|
|
248
|
+
await session.close();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
const cliError = asCliError(error);
|
|
253
|
+
if (parsedFormat === "json"
|
|
254
|
+
&& (parsedCommandKind === "tool-call" || parsedCommandKind === "wrapper")) {
|
|
255
|
+
emitJson(writers, {
|
|
256
|
+
isError: true,
|
|
257
|
+
content: [{
|
|
258
|
+
type: "text",
|
|
259
|
+
text: `${cliError.token} ${cliError.message}`
|
|
260
|
+
}],
|
|
261
|
+
_meta: {
|
|
262
|
+
cliErrorToken: cliError.token,
|
|
263
|
+
exitCode: cliError.exitCode
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
emitError(writers, cliError.token, cliError.message);
|
|
268
|
+
return cliError.exitCode;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
async function main() {
|
|
272
|
+
const exitCode = await runCli(process.argv.slice(2));
|
|
273
|
+
process.exit(exitCode);
|
|
274
|
+
}
|
|
275
|
+
function isExecutedDirectly() {
|
|
276
|
+
return isExecutedDirectlyForPaths(import.meta.url, process.argv[1]);
|
|
277
|
+
}
|
|
278
|
+
export function isExecutedDirectlyForPaths(moduleUrl, entryPath) {
|
|
279
|
+
if (!entryPath) {
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
try {
|
|
283
|
+
const modulePath = fs.realpathSync(fileURLToPath(moduleUrl));
|
|
284
|
+
const invokedPath = fs.realpathSync(path.resolve(entryPath));
|
|
285
|
+
return modulePath === invokedPath;
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
try {
|
|
289
|
+
const modulePath = path.resolve(fileURLToPath(moduleUrl));
|
|
290
|
+
const invokedPath = path.resolve(entryPath);
|
|
291
|
+
return modulePath === invokedPath;
|
|
292
|
+
}
|
|
293
|
+
catch {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (isExecutedDirectly()) {
|
|
299
|
+
void main();
|
|
300
|
+
}
|
|
301
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { InstallClient } from "./args.js";
|
|
2
|
+
type ClientName = Exclude<InstallClient, "all">;
|
|
3
|
+
export interface InstallCommandInput {
|
|
4
|
+
kind: "install" | "uninstall";
|
|
5
|
+
client: InstallClient;
|
|
6
|
+
dryRun: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface InstallCommandOptions {
|
|
9
|
+
homeDir?: string;
|
|
10
|
+
packageSpecifier?: string;
|
|
11
|
+
skillAssetRoot?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ClientInstallResult {
|
|
14
|
+
client: ClientName;
|
|
15
|
+
configPath: string;
|
|
16
|
+
skillsPath: string;
|
|
17
|
+
configChanged: boolean;
|
|
18
|
+
skillsChanged: boolean;
|
|
19
|
+
status: "updated" | "unchanged";
|
|
20
|
+
dryRun: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface InstallCommandResult {
|
|
23
|
+
action: "install" | "uninstall";
|
|
24
|
+
client: InstallClient;
|
|
25
|
+
dryRun: boolean;
|
|
26
|
+
results: ClientInstallResult[];
|
|
27
|
+
}
|
|
28
|
+
export declare function executeInstallCommand(command: InstallCommandInput, options?: InstallCommandOptions): InstallCommandResult;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=install.d.ts.map
|