@stackable-labs/cli-app-extension 1.82.0 → 1.83.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/dist/index.js +87 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3164,6 +3164,29 @@ var downloadAndExtractAiDocs = async (targetDir, version2) => {
|
|
|
3164
3164
|
}
|
|
3165
3165
|
return { files: extractedFiles.sort() };
|
|
3166
3166
|
};
|
|
3167
|
+
var MCP_FILE_PATTERN = /mcp\.json$|\.gemini\/settings\.json$|\.codex\/config\.toml$/;
|
|
3168
|
+
var downloadAndExtractMcpConfig = async (targetDir, version2) => {
|
|
3169
|
+
const baseUrl = getStaticCdnBaseUrl();
|
|
3170
|
+
const zipUrl = `${baseUrl}/ai-docs/${version2}/${AI_DOCS_FILENAME}`;
|
|
3171
|
+
const response = await fetch(zipUrl);
|
|
3172
|
+
if (!response.ok) {
|
|
3173
|
+
throw new Error(`Failed to download AI docs from ${zipUrl}: ${response.status} ${response.statusText}`);
|
|
3174
|
+
}
|
|
3175
|
+
const buffer = Buffer.from(await response.arrayBuffer());
|
|
3176
|
+
const zip = new AdmZip(buffer);
|
|
3177
|
+
const entries = zip.getEntries();
|
|
3178
|
+
const extractedFiles = [];
|
|
3179
|
+
for (const entry of entries) {
|
|
3180
|
+
if (entry.isDirectory || !MCP_FILE_PATTERN.test(entry.entryName)) {
|
|
3181
|
+
continue;
|
|
3182
|
+
}
|
|
3183
|
+
const targetPath = join(targetDir, entry.entryName);
|
|
3184
|
+
await mkdir(dirname(targetPath), { recursive: true });
|
|
3185
|
+
await writeFile(targetPath, entry.getData());
|
|
3186
|
+
extractedFiles.push(entry.entryName);
|
|
3187
|
+
}
|
|
3188
|
+
return { files: extractedFiles.sort() };
|
|
3189
|
+
};
|
|
3167
3190
|
var AIScaffold = ({ version: version2 }) => {
|
|
3168
3191
|
const { exit } = useApp();
|
|
3169
3192
|
const [state, setState] = useState("validating");
|
|
@@ -3225,6 +3248,67 @@ var AIScaffold = ({ version: version2 }) => {
|
|
|
3225
3248
|
] })
|
|
3226
3249
|
] });
|
|
3227
3250
|
};
|
|
3251
|
+
var AIMcp = ({ version: version2, dir }) => {
|
|
3252
|
+
const { exit } = useApp();
|
|
3253
|
+
const [state, setState] = useState("validating");
|
|
3254
|
+
const [files, setFiles] = useState([]);
|
|
3255
|
+
const [errorMessage, setErrorMessage] = useState("");
|
|
3256
|
+
useEffect(() => {
|
|
3257
|
+
const run = async () => {
|
|
3258
|
+
const projectDir = dir;
|
|
3259
|
+
const check = isExtensionProject(projectDir);
|
|
3260
|
+
if (!check.valid) {
|
|
3261
|
+
setErrorMessage(check.reason);
|
|
3262
|
+
setState("error");
|
|
3263
|
+
exit();
|
|
3264
|
+
return;
|
|
3265
|
+
}
|
|
3266
|
+
setState("downloading");
|
|
3267
|
+
try {
|
|
3268
|
+
const result = await downloadAndExtractMcpConfig(projectDir, version2);
|
|
3269
|
+
setFiles(result.files);
|
|
3270
|
+
setState("done");
|
|
3271
|
+
} catch (err) {
|
|
3272
|
+
setErrorMessage(err instanceof Error ? err.message : String(err));
|
|
3273
|
+
setState("error");
|
|
3274
|
+
}
|
|
3275
|
+
exit();
|
|
3276
|
+
};
|
|
3277
|
+
run();
|
|
3278
|
+
}, []);
|
|
3279
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
3280
|
+
/* @__PURE__ */ jsx(Banner, {}),
|
|
3281
|
+
/* @__PURE__ */ jsxs(StepShell, { title: "MCP Server Config", children: [
|
|
3282
|
+
state === "validating" && /* @__PURE__ */ jsxs(Box, { gap: 1, children: [
|
|
3283
|
+
/* @__PURE__ */ jsx(Text, { color: "cyan", children: /* @__PURE__ */ jsx(Spinner5, { type: "dots" }) }),
|
|
3284
|
+
/* @__PURE__ */ jsx(Text, { children: "Checking project..." })
|
|
3285
|
+
] }),
|
|
3286
|
+
state === "downloading" && /* @__PURE__ */ jsxs(Box, { gap: 1, children: [
|
|
3287
|
+
/* @__PURE__ */ jsx(Text, { color: "cyan", children: /* @__PURE__ */ jsx(Spinner5, { type: "dots" }) }),
|
|
3288
|
+
/* @__PURE__ */ jsxs(Text, { children: [
|
|
3289
|
+
"Downloading MCP server configs (",
|
|
3290
|
+
version2,
|
|
3291
|
+
")..."
|
|
3292
|
+
] })
|
|
3293
|
+
] }),
|
|
3294
|
+
state === "done" && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: 1, children: [
|
|
3295
|
+
/* @__PURE__ */ jsxs(Box, { gap: 1, children: [
|
|
3296
|
+
/* @__PURE__ */ jsx(Text, { color: "green", bold: true, children: "\u2714" }),
|
|
3297
|
+
/* @__PURE__ */ jsxs(Text, { bold: true, children: [
|
|
3298
|
+
"MCP server configs installed (",
|
|
3299
|
+
files.length,
|
|
3300
|
+
" files)"
|
|
3301
|
+
] })
|
|
3302
|
+
] }),
|
|
3303
|
+
/* @__PURE__ */ jsx(Box, { flexDirection: "column", marginLeft: 2, children: files.map((f) => /* @__PURE__ */ jsx(Text, { dimColor: true, children: f }, f)) })
|
|
3304
|
+
] }),
|
|
3305
|
+
state === "error" && /* @__PURE__ */ jsxs(Box, { gap: 1, children: [
|
|
3306
|
+
/* @__PURE__ */ jsx(Text, { color: "red", children: "\u2716" }),
|
|
3307
|
+
/* @__PURE__ */ jsx(Text, { children: errorMessage })
|
|
3308
|
+
] })
|
|
3309
|
+
] })
|
|
3310
|
+
] });
|
|
3311
|
+
};
|
|
3228
3312
|
var AUTH_DIR = join(homedir(), ".stackable");
|
|
3229
3313
|
var AUTH_FILE = join(AUTH_DIR, "auth.json");
|
|
3230
3314
|
var readAuthState = async () => {
|
|
@@ -3642,4 +3726,7 @@ var ai = program.command("ai").description("AI editor configuration tools");
|
|
|
3642
3726
|
ai.command("scaffold").description("Download AI editor config files into your Extension project").option("--version <version>", 'AI docs version (semver or "latest")', "latest").action(async (options) => {
|
|
3643
3727
|
render(/* @__PURE__ */ jsx(AIScaffold, { version: options.version }));
|
|
3644
3728
|
});
|
|
3729
|
+
ai.command("mcp").description("Add MCP server config to your Extension project").option("--version <version>", 'AI docs version (semver or "latest")', "latest").option("--dir <path>", "Project root directory", process.cwd()).action(async (options) => {
|
|
3730
|
+
render(/* @__PURE__ */ jsx(AIMcp, { version: options.version, dir: options.dir }));
|
|
3731
|
+
});
|
|
3645
3732
|
program.parse(process.argv.filter((arg) => arg !== "--"));
|