@bamboocss/dev 1.13.1 → 1.14.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/dist/cli-default.cjs +21 -40
- package/dist/cli-default.mjs +15 -41
- package/dist/cli-main.cjs +17 -68
- package/dist/cli-main.mjs +15 -47
- package/dist/interactive.cjs +1 -1
- package/dist/interactive.d.cts +1 -1
- package/dist/interactive.d.mts +1 -1
- package/dist/interactive.mjs +1 -1
- package/dist/mcp-init-8JZx1VWY.mjs +131 -0
- package/dist/mcp-init-BW-QbhaD.cjs +132 -0
- package/dist/mcp-init-CqMVs7Zx.cjs +132 -0
- package/dist/mcp-init-Dc87mc_h.mjs +131 -0
- package/dist/package-CJPGzAjR.mjs +4 -0
- package/dist/package-DsByZeDf.cjs +37 -0
- package/dist/types.d.cts +1 -14
- package/dist/types.d.mts +1 -14
- package/package.json +10 -12
package/dist/cli-default.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
3
|
//#region \0rolldown/runtime.js
|
|
3
4
|
var __create = Object.create;
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
@@ -41,7 +42,6 @@ let node_tty = require("node:tty");
|
|
|
41
42
|
node_tty = __toESM(node_tty, 1);
|
|
42
43
|
let worker_threads = require("worker_threads");
|
|
43
44
|
let _bamboocss_shared = require("@bamboocss/shared");
|
|
44
|
-
let _bamboocss_config = require("@bamboocss/config");
|
|
45
45
|
let _bamboocss_logger = require("@bamboocss/logger");
|
|
46
46
|
let _bamboocss_node = require("@bamboocss/node");
|
|
47
47
|
let cac = require("cac");
|
|
@@ -7627,7 +7627,7 @@ function isLocError(error) {
|
|
|
7627
7627
|
//#endregion
|
|
7628
7628
|
//#region package.json
|
|
7629
7629
|
var name = "@bamboocss/dev";
|
|
7630
|
-
var version = "1.
|
|
7630
|
+
var version = "1.14.0";
|
|
7631
7631
|
//#endregion
|
|
7632
7632
|
//#region src/interactive.ts
|
|
7633
7633
|
const interactive = async () => {
|
|
@@ -7908,40 +7908,6 @@ async function main() {
|
|
|
7908
7908
|
config: { cwd }
|
|
7909
7909
|
}), { outdir });
|
|
7910
7910
|
});
|
|
7911
|
-
cli.command("studio", "Realtime documentation for your design tokens").option("--build", "Build").option("--preview", "Preview").option("--port <port>", "Port").option("--host", "Host").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--outdir <dir>", "Output directory for static files").option("--base <path>", "Base path of project").action(async (flags) => {
|
|
7912
|
-
const { build, preview, port, host, outdir, config, base } = flags;
|
|
7913
|
-
const cwd = (0, path.resolve)(flags.cwd ?? "");
|
|
7914
|
-
const ctx = await (0, _bamboocss_node.loadConfigAndCreateContext)({
|
|
7915
|
-
cwd,
|
|
7916
|
-
configPath: config
|
|
7917
|
-
});
|
|
7918
|
-
const buildOpts = {
|
|
7919
|
-
configPath: (0, _bamboocss_config.findConfig)({
|
|
7920
|
-
cwd,
|
|
7921
|
-
file: config
|
|
7922
|
-
}),
|
|
7923
|
-
outDir: (0, path.resolve)(outdir || ctx.studio.outdir),
|
|
7924
|
-
port,
|
|
7925
|
-
host,
|
|
7926
|
-
base
|
|
7927
|
-
};
|
|
7928
|
-
let studio;
|
|
7929
|
-
try {
|
|
7930
|
-
const studioPath = require.resolve("@bamboocss/studio", { paths: [cwd] });
|
|
7931
|
-
studio = require(studioPath);
|
|
7932
|
-
} catch (error) {
|
|
7933
|
-
throw new _bamboocss_shared.BambooError("MISSING_STUDIO", "You need to install '@bamboocss/studio' to use this command", { cause: error });
|
|
7934
|
-
}
|
|
7935
|
-
if (preview) await studio.previewStudio(buildOpts);
|
|
7936
|
-
else if (build) await studio.buildStudio(buildOpts);
|
|
7937
|
-
else {
|
|
7938
|
-
await studio.serveStudio(buildOpts);
|
|
7939
|
-
const note = `use ${_bamboocss_logger.colors.reset(_bamboocss_logger.colors.bold("--build"))} to build`;
|
|
7940
|
-
const port = `use ${_bamboocss_logger.colors.reset(_bamboocss_logger.colors.bold("--port"))} for a different port`;
|
|
7941
|
-
_bamboocss_logger.logger.log(_bamboocss_logger.colors.dim(` ${_bamboocss_logger.colors.green("➜")} ${_bamboocss_logger.colors.bold("Build")}: ${note}`));
|
|
7942
|
-
_bamboocss_logger.logger.log(_bamboocss_logger.colors.dim(` ${_bamboocss_logger.colors.green("➜")} ${_bamboocss_logger.colors.bold("Port")}: ${port}`));
|
|
7943
|
-
}
|
|
7944
|
-
});
|
|
7945
7911
|
cli.command("analyze [glob]", "Analyze design token usage in glob").option("--outfile [filepath]", "Output analyze report in JSON").option("--silent", "Don't print any logs").option("--scope <type>", "Select analysis scope (token or recipe)").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).action(async (maybeGlob, flags = {}) => {
|
|
7946
7912
|
const { silent, config: configPath, scope } = flags;
|
|
7947
7913
|
const tokenScope = scope == null || scope === "token";
|
|
@@ -8106,12 +8072,20 @@ async function main() {
|
|
|
8106
8072
|
await ctx.runtime.fs.writeFile(pkgPath, JSON.stringify(content, null, 2) + "\n");
|
|
8107
8073
|
_bamboocss_logger.logger.info("cli", `Emit package.json to ${pkgPath}`);
|
|
8108
8074
|
});
|
|
8109
|
-
cli.command("mcp", "
|
|
8110
|
-
|
|
8111
|
-
|
|
8075
|
+
cli.command("mcp", "Moved to the standalone @bamboocss/mcp package").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).action(() => {
|
|
8076
|
+
process.stderr.write([
|
|
8077
|
+
"The MCP server now ships as its own package, so installing Bamboo no longer pulls in",
|
|
8078
|
+
"the Model Context Protocol SDK and its HTTP server dependencies.",
|
|
8079
|
+
"",
|
|
8080
|
+
"Run `bamboo init-mcp` to rewrite your client config, or start it directly with:",
|
|
8081
|
+
"",
|
|
8082
|
+
` npx -y @bamboocss/mcp@${version}`,
|
|
8083
|
+
""
|
|
8084
|
+
].join("\n"));
|
|
8085
|
+
process.exitCode = 1;
|
|
8112
8086
|
});
|
|
8113
8087
|
cli.command("init-mcp", "Initialize MCP configuration for AI clients").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--client <clients>", "AI clients to configure (claude, cursor, vscode, windsurf, codex)").action(async (mcpInitFlags) => {
|
|
8114
|
-
const { initMcpConfig } = await
|
|
8088
|
+
const { initMcpConfig } = await Promise.resolve().then(() => require("./mcp-init-CqMVs7Zx.cjs"));
|
|
8115
8089
|
const resolvedCwd = (0, path.resolve)(mcpInitFlags.cwd ?? cwd);
|
|
8116
8090
|
let clients;
|
|
8117
8091
|
if (mcpInitFlags.client) clients = (Array.isArray(mcpInitFlags.client) ? mcpInitFlags.client : [mcpInitFlags.client]).flatMap((c) => c.split(",")).map((c) => c.trim());
|
|
@@ -8136,3 +8110,10 @@ updateNotifier({
|
|
|
8136
8110
|
}).notify();
|
|
8137
8111
|
main().catch(handleError);
|
|
8138
8112
|
//#endregion
|
|
8113
|
+
exports.__toESM = __toESM;
|
|
8114
|
+
Object.defineProperty(exports, "version", {
|
|
8115
|
+
enumerable: true,
|
|
8116
|
+
get: function() {
|
|
8117
|
+
return version;
|
|
8118
|
+
}
|
|
8119
|
+
});
|
package/dist/cli-default.mjs
CHANGED
|
@@ -12,8 +12,7 @@ import fs from "node:fs";
|
|
|
12
12
|
import tty from "node:tty";
|
|
13
13
|
import { isMainThread, parentPort } from "worker_threads";
|
|
14
14
|
import { BambooError, compact } from "@bamboocss/shared";
|
|
15
|
-
import {
|
|
16
|
-
import { colors, logger } from "@bamboocss/logger";
|
|
15
|
+
import { logger } from "@bamboocss/logger";
|
|
17
16
|
import { BambooContext, analyze, buildInfo, codegen, cssgen, debug, generate, loadConfigAndCreateContext, setLogStream, setupConfig, setupGitIgnore, setupPostcss, spec, startProfiling } from "@bamboocss/node";
|
|
18
17
|
import { cac } from "cac";
|
|
19
18
|
import * as p from "@clack/prompts";
|
|
@@ -7631,7 +7630,7 @@ function isLocError(error) {
|
|
|
7631
7630
|
//#endregion
|
|
7632
7631
|
//#region package.json
|
|
7633
7632
|
var name = "@bamboocss/dev";
|
|
7634
|
-
var version = "1.
|
|
7633
|
+
var version = "1.14.0";
|
|
7635
7634
|
//#endregion
|
|
7636
7635
|
//#region src/interactive.ts
|
|
7637
7636
|
const interactive = async () => {
|
|
@@ -7912,39 +7911,6 @@ async function main() {
|
|
|
7912
7911
|
config: { cwd }
|
|
7913
7912
|
}), { outdir });
|
|
7914
7913
|
});
|
|
7915
|
-
cli.command("studio", "Realtime documentation for your design tokens").option("--build", "Build").option("--preview", "Preview").option("--port <port>", "Port").option("--host", "Host").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--outdir <dir>", "Output directory for static files").option("--base <path>", "Base path of project").action(async (flags) => {
|
|
7916
|
-
const { build, preview, port, host, outdir, config, base } = flags;
|
|
7917
|
-
const cwd = resolve(flags.cwd ?? "");
|
|
7918
|
-
const ctx = await loadConfigAndCreateContext({
|
|
7919
|
-
cwd,
|
|
7920
|
-
configPath: config
|
|
7921
|
-
});
|
|
7922
|
-
const buildOpts = {
|
|
7923
|
-
configPath: findConfig({
|
|
7924
|
-
cwd,
|
|
7925
|
-
file: config
|
|
7926
|
-
}),
|
|
7927
|
-
outDir: resolve(outdir || ctx.studio.outdir),
|
|
7928
|
-
port,
|
|
7929
|
-
host,
|
|
7930
|
-
base
|
|
7931
|
-
};
|
|
7932
|
-
let studio;
|
|
7933
|
-
try {
|
|
7934
|
-
studio = __require(__require.resolve("@bamboocss/studio", { paths: [cwd] }));
|
|
7935
|
-
} catch (error) {
|
|
7936
|
-
throw new BambooError("MISSING_STUDIO", "You need to install '@bamboocss/studio' to use this command", { cause: error });
|
|
7937
|
-
}
|
|
7938
|
-
if (preview) await studio.previewStudio(buildOpts);
|
|
7939
|
-
else if (build) await studio.buildStudio(buildOpts);
|
|
7940
|
-
else {
|
|
7941
|
-
await studio.serveStudio(buildOpts);
|
|
7942
|
-
const note = `use ${colors.reset(colors.bold("--build"))} to build`;
|
|
7943
|
-
const port = `use ${colors.reset(colors.bold("--port"))} for a different port`;
|
|
7944
|
-
logger.log(colors.dim(` ${colors.green("➜")} ${colors.bold("Build")}: ${note}`));
|
|
7945
|
-
logger.log(colors.dim(` ${colors.green("➜")} ${colors.bold("Port")}: ${port}`));
|
|
7946
|
-
}
|
|
7947
|
-
});
|
|
7948
7914
|
cli.command("analyze [glob]", "Analyze design token usage in glob").option("--outfile [filepath]", "Output analyze report in JSON").option("--silent", "Don't print any logs").option("--scope <type>", "Select analysis scope (token or recipe)").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).action(async (maybeGlob, flags = {}) => {
|
|
7949
7915
|
const { silent, config: configPath, scope } = flags;
|
|
7950
7916
|
const tokenScope = scope == null || scope === "token";
|
|
@@ -8109,12 +8075,20 @@ async function main() {
|
|
|
8109
8075
|
await ctx.runtime.fs.writeFile(pkgPath, JSON.stringify(content, null, 2) + "\n");
|
|
8110
8076
|
logger.info("cli", `Emit package.json to ${pkgPath}`);
|
|
8111
8077
|
});
|
|
8112
|
-
cli.command("mcp", "
|
|
8113
|
-
|
|
8114
|
-
|
|
8078
|
+
cli.command("mcp", "Moved to the standalone @bamboocss/mcp package").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).action(() => {
|
|
8079
|
+
process.stderr.write([
|
|
8080
|
+
"The MCP server now ships as its own package, so installing Bamboo no longer pulls in",
|
|
8081
|
+
"the Model Context Protocol SDK and its HTTP server dependencies.",
|
|
8082
|
+
"",
|
|
8083
|
+
"Run `bamboo init-mcp` to rewrite your client config, or start it directly with:",
|
|
8084
|
+
"",
|
|
8085
|
+
` npx -y @bamboocss/mcp@${version}`,
|
|
8086
|
+
""
|
|
8087
|
+
].join("\n"));
|
|
8088
|
+
process.exitCode = 1;
|
|
8115
8089
|
});
|
|
8116
8090
|
cli.command("init-mcp", "Initialize MCP configuration for AI clients").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--client <clients>", "AI clients to configure (claude, cursor, vscode, windsurf, codex)").action(async (mcpInitFlags) => {
|
|
8117
|
-
const { initMcpConfig } = await import("
|
|
8091
|
+
const { initMcpConfig } = await import("./mcp-init-8JZx1VWY.mjs");
|
|
8118
8092
|
const resolvedCwd = resolve(mcpInitFlags.cwd ?? cwd);
|
|
8119
8093
|
let clients;
|
|
8120
8094
|
if (mcpInitFlags.client) clients = (Array.isArray(mcpInitFlags.client) ? mcpInitFlags.client : [mcpInitFlags.client]).flatMap((c) => c.split(",")).map((c) => c.trim());
|
|
@@ -8139,4 +8113,4 @@ updateNotifier({
|
|
|
8139
8113
|
}).notify();
|
|
8140
8114
|
main().catch(handleError);
|
|
8141
8115
|
//#endregion
|
|
8142
|
-
export {};
|
|
8116
|
+
export { version as t };
|
package/dist/cli-main.cjs
CHANGED
|
@@ -1,40 +1,15 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
|
-
let _bamboocss_config = require("@bamboocss/config");
|
|
2
|
+
const require_package = require("./package-DsByZeDf.cjs");
|
|
25
3
|
let _bamboocss_logger = require("@bamboocss/logger");
|
|
26
4
|
let _bamboocss_node = require("@bamboocss/node");
|
|
27
5
|
let _bamboocss_shared = require("@bamboocss/shared");
|
|
28
6
|
let cac = require("cac");
|
|
29
7
|
let path = require("path");
|
|
30
8
|
let _clack_prompts = require("@clack/prompts");
|
|
31
|
-
_clack_prompts = __toESM(_clack_prompts);
|
|
32
|
-
//#region package.json
|
|
33
|
-
var version = "1.13.1";
|
|
34
|
-
//#endregion
|
|
9
|
+
_clack_prompts = require_package.__toESM(_clack_prompts);
|
|
35
10
|
//#region src/interactive.ts
|
|
36
11
|
const interactive = async () => {
|
|
37
|
-
_clack_prompts.intro(`bamboo v${version}`);
|
|
12
|
+
_clack_prompts.intro(`bamboo v${require_package.version}`);
|
|
38
13
|
const initFlags = await _clack_prompts.group({
|
|
39
14
|
usePostcss: () => _clack_prompts.select({
|
|
40
15
|
message: "Would you like to use PostCSS ?",
|
|
@@ -159,7 +134,7 @@ async function main() {
|
|
|
159
134
|
cwd,
|
|
160
135
|
logfile: flags.logfile
|
|
161
136
|
});
|
|
162
|
-
_bamboocss_logger.logger.info("cli", `Bamboo v${version}\n`);
|
|
137
|
+
_bamboocss_logger.logger.info("cli", `Bamboo v${require_package.version}\n`);
|
|
163
138
|
const done = _bamboocss_logger.logger.time.info("✨ Bamboo initialized");
|
|
164
139
|
if (postcss) await (0, _bamboocss_node.setupPostcss)(cwd);
|
|
165
140
|
await (0, _bamboocss_node.setupConfig)(cwd, (0, _bamboocss_shared.compact)({
|
|
@@ -311,40 +286,6 @@ async function main() {
|
|
|
311
286
|
config: { cwd }
|
|
312
287
|
}), { outdir });
|
|
313
288
|
});
|
|
314
|
-
cli.command("studio", "Realtime documentation for your design tokens").option("--build", "Build").option("--preview", "Preview").option("--port <port>", "Port").option("--host", "Host").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--outdir <dir>", "Output directory for static files").option("--base <path>", "Base path of project").action(async (flags) => {
|
|
315
|
-
const { build, preview, port, host, outdir, config, base } = flags;
|
|
316
|
-
const cwd = (0, path.resolve)(flags.cwd ?? "");
|
|
317
|
-
const ctx = await (0, _bamboocss_node.loadConfigAndCreateContext)({
|
|
318
|
-
cwd,
|
|
319
|
-
configPath: config
|
|
320
|
-
});
|
|
321
|
-
const buildOpts = {
|
|
322
|
-
configPath: (0, _bamboocss_config.findConfig)({
|
|
323
|
-
cwd,
|
|
324
|
-
file: config
|
|
325
|
-
}),
|
|
326
|
-
outDir: (0, path.resolve)(outdir || ctx.studio.outdir),
|
|
327
|
-
port,
|
|
328
|
-
host,
|
|
329
|
-
base
|
|
330
|
-
};
|
|
331
|
-
let studio;
|
|
332
|
-
try {
|
|
333
|
-
const studioPath = require.resolve("@bamboocss/studio", { paths: [cwd] });
|
|
334
|
-
studio = require(studioPath);
|
|
335
|
-
} catch (error) {
|
|
336
|
-
throw new _bamboocss_shared.BambooError("MISSING_STUDIO", "You need to install '@bamboocss/studio' to use this command", { cause: error });
|
|
337
|
-
}
|
|
338
|
-
if (preview) await studio.previewStudio(buildOpts);
|
|
339
|
-
else if (build) await studio.buildStudio(buildOpts);
|
|
340
|
-
else {
|
|
341
|
-
await studio.serveStudio(buildOpts);
|
|
342
|
-
const note = `use ${_bamboocss_logger.colors.reset(_bamboocss_logger.colors.bold("--build"))} to build`;
|
|
343
|
-
const port = `use ${_bamboocss_logger.colors.reset(_bamboocss_logger.colors.bold("--port"))} for a different port`;
|
|
344
|
-
_bamboocss_logger.logger.log(_bamboocss_logger.colors.dim(` ${_bamboocss_logger.colors.green("➜")} ${_bamboocss_logger.colors.bold("Build")}: ${note}`));
|
|
345
|
-
_bamboocss_logger.logger.log(_bamboocss_logger.colors.dim(` ${_bamboocss_logger.colors.green("➜")} ${_bamboocss_logger.colors.bold("Port")}: ${port}`));
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
289
|
cli.command("analyze [glob]", "Analyze design token usage in glob").option("--outfile [filepath]", "Output analyze report in JSON").option("--silent", "Don't print any logs").option("--scope <type>", "Select analysis scope (token or recipe)").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).action(async (maybeGlob, flags = {}) => {
|
|
349
290
|
const { silent, config: configPath, scope } = flags;
|
|
350
291
|
const tokenScope = scope == null || scope === "token";
|
|
@@ -509,12 +450,20 @@ async function main() {
|
|
|
509
450
|
await ctx.runtime.fs.writeFile(pkgPath, JSON.stringify(content, null, 2) + "\n");
|
|
510
451
|
_bamboocss_logger.logger.info("cli", `Emit package.json to ${pkgPath}`);
|
|
511
452
|
});
|
|
512
|
-
cli.command("mcp", "
|
|
513
|
-
|
|
514
|
-
|
|
453
|
+
cli.command("mcp", "Moved to the standalone @bamboocss/mcp package").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).action(() => {
|
|
454
|
+
process.stderr.write([
|
|
455
|
+
"The MCP server now ships as its own package, so installing Bamboo no longer pulls in",
|
|
456
|
+
"the Model Context Protocol SDK and its HTTP server dependencies.",
|
|
457
|
+
"",
|
|
458
|
+
"Run `bamboo init-mcp` to rewrite your client config, or start it directly with:",
|
|
459
|
+
"",
|
|
460
|
+
` npx -y @bamboocss/mcp@${require_package.version}`,
|
|
461
|
+
""
|
|
462
|
+
].join("\n"));
|
|
463
|
+
process.exitCode = 1;
|
|
515
464
|
});
|
|
516
465
|
cli.command("init-mcp", "Initialize MCP configuration for AI clients").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--client <clients>", "AI clients to configure (claude, cursor, vscode, windsurf, codex)").action(async (mcpInitFlags) => {
|
|
517
|
-
const { initMcpConfig } = await
|
|
466
|
+
const { initMcpConfig } = await Promise.resolve().then(() => require("./mcp-init-BW-QbhaD.cjs"));
|
|
518
467
|
const resolvedCwd = (0, path.resolve)(mcpInitFlags.cwd ?? cwd);
|
|
519
468
|
let clients;
|
|
520
469
|
if (mcpInitFlags.client) clients = (Array.isArray(mcpInitFlags.client) ? mcpInitFlags.client : [mcpInitFlags.client]).flatMap((c) => c.split(",")).map((c) => c.trim());
|
|
@@ -524,7 +473,7 @@ async function main() {
|
|
|
524
473
|
});
|
|
525
474
|
});
|
|
526
475
|
cli.help();
|
|
527
|
-
cli.version(version);
|
|
476
|
+
cli.version(require_package.version);
|
|
528
477
|
cli.parse(process.argv, { run: false });
|
|
529
478
|
await cli.runMatchedCommand();
|
|
530
479
|
}
|
package/dist/cli-main.mjs
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { colors, logger } from "@bamboocss/logger";
|
|
1
|
+
import { t as version } from "./package-CJPGzAjR.mjs";
|
|
2
|
+
import { logger } from "@bamboocss/logger";
|
|
4
3
|
import { BambooContext, analyze, buildInfo, codegen, cssgen, debug, generate, loadConfigAndCreateContext, setLogStream, setupConfig, setupGitIgnore, setupPostcss, spec, startProfiling } from "@bamboocss/node";
|
|
5
|
-
import {
|
|
4
|
+
import { compact } from "@bamboocss/shared";
|
|
6
5
|
import { cac } from "cac";
|
|
7
6
|
import { join, resolve } from "path";
|
|
8
7
|
import * as p from "@clack/prompts";
|
|
9
|
-
//#region \0rolldown/runtime.js
|
|
10
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region package.json
|
|
13
|
-
var version = "1.13.1";
|
|
14
|
-
//#endregion
|
|
15
8
|
//#region src/interactive.ts
|
|
16
9
|
const interactive = async () => {
|
|
17
10
|
p.intro(`bamboo v${version}`);
|
|
@@ -291,39 +284,6 @@ async function main() {
|
|
|
291
284
|
config: { cwd }
|
|
292
285
|
}), { outdir });
|
|
293
286
|
});
|
|
294
|
-
cli.command("studio", "Realtime documentation for your design tokens").option("--build", "Build").option("--preview", "Preview").option("--port <port>", "Port").option("--host", "Host").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--outdir <dir>", "Output directory for static files").option("--base <path>", "Base path of project").action(async (flags) => {
|
|
295
|
-
const { build, preview, port, host, outdir, config, base } = flags;
|
|
296
|
-
const cwd = resolve(flags.cwd ?? "");
|
|
297
|
-
const ctx = await loadConfigAndCreateContext({
|
|
298
|
-
cwd,
|
|
299
|
-
configPath: config
|
|
300
|
-
});
|
|
301
|
-
const buildOpts = {
|
|
302
|
-
configPath: findConfig({
|
|
303
|
-
cwd,
|
|
304
|
-
file: config
|
|
305
|
-
}),
|
|
306
|
-
outDir: resolve(outdir || ctx.studio.outdir),
|
|
307
|
-
port,
|
|
308
|
-
host,
|
|
309
|
-
base
|
|
310
|
-
};
|
|
311
|
-
let studio;
|
|
312
|
-
try {
|
|
313
|
-
studio = __require(__require.resolve("@bamboocss/studio", { paths: [cwd] }));
|
|
314
|
-
} catch (error) {
|
|
315
|
-
throw new BambooError("MISSING_STUDIO", "You need to install '@bamboocss/studio' to use this command", { cause: error });
|
|
316
|
-
}
|
|
317
|
-
if (preview) await studio.previewStudio(buildOpts);
|
|
318
|
-
else if (build) await studio.buildStudio(buildOpts);
|
|
319
|
-
else {
|
|
320
|
-
await studio.serveStudio(buildOpts);
|
|
321
|
-
const note = `use ${colors.reset(colors.bold("--build"))} to build`;
|
|
322
|
-
const port = `use ${colors.reset(colors.bold("--port"))} for a different port`;
|
|
323
|
-
logger.log(colors.dim(` ${colors.green("➜")} ${colors.bold("Build")}: ${note}`));
|
|
324
|
-
logger.log(colors.dim(` ${colors.green("➜")} ${colors.bold("Port")}: ${port}`));
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
287
|
cli.command("analyze [glob]", "Analyze design token usage in glob").option("--outfile [filepath]", "Output analyze report in JSON").option("--silent", "Don't print any logs").option("--scope <type>", "Select analysis scope (token or recipe)").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).action(async (maybeGlob, flags = {}) => {
|
|
328
288
|
const { silent, config: configPath, scope } = flags;
|
|
329
289
|
const tokenScope = scope == null || scope === "token";
|
|
@@ -488,12 +448,20 @@ async function main() {
|
|
|
488
448
|
await ctx.runtime.fs.writeFile(pkgPath, JSON.stringify(content, null, 2) + "\n");
|
|
489
449
|
logger.info("cli", `Emit package.json to ${pkgPath}`);
|
|
490
450
|
});
|
|
491
|
-
cli.command("mcp", "
|
|
492
|
-
|
|
493
|
-
|
|
451
|
+
cli.command("mcp", "Moved to the standalone @bamboocss/mcp package").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).action(() => {
|
|
452
|
+
process.stderr.write([
|
|
453
|
+
"The MCP server now ships as its own package, so installing Bamboo no longer pulls in",
|
|
454
|
+
"the Model Context Protocol SDK and its HTTP server dependencies.",
|
|
455
|
+
"",
|
|
456
|
+
"Run `bamboo init-mcp` to rewrite your client config, or start it directly with:",
|
|
457
|
+
"",
|
|
458
|
+
` npx -y @bamboocss/mcp@${version}`,
|
|
459
|
+
""
|
|
460
|
+
].join("\n"));
|
|
461
|
+
process.exitCode = 1;
|
|
494
462
|
});
|
|
495
463
|
cli.command("init-mcp", "Initialize MCP configuration for AI clients").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--client <clients>", "AI clients to configure (claude, cursor, vscode, windsurf, codex)").action(async (mcpInitFlags) => {
|
|
496
|
-
const { initMcpConfig } = await import("
|
|
464
|
+
const { initMcpConfig } = await import("./mcp-init-Dc87mc_h.mjs");
|
|
497
465
|
const resolvedCwd = resolve(mcpInitFlags.cwd ?? cwd);
|
|
498
466
|
let clients;
|
|
499
467
|
if (mcpInitFlags.client) clients = (Array.isArray(mcpInitFlags.client) ? mcpInitFlags.client : [mcpInitFlags.client]).flatMap((c) => c.split(",")).map((c) => c.trim());
|
package/dist/interactive.cjs
CHANGED
|
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
let _clack_prompts = require("@clack/prompts");
|
|
25
25
|
_clack_prompts = __toESM(_clack_prompts);
|
|
26
26
|
//#region package.json
|
|
27
|
-
var version = "1.
|
|
27
|
+
var version = "1.14.0";
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/interactive.ts
|
|
30
30
|
const interactive = async () => {
|
package/dist/interactive.d.cts
CHANGED
package/dist/interactive.d.mts
CHANGED
package/dist/interactive.mjs
CHANGED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { t as version } from "./cli-default.mjs";
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
3
|
+
import { dirname, resolve } from "path";
|
|
4
|
+
import { logger } from "@bamboocss/logger";
|
|
5
|
+
import * as p from "@clack/prompts";
|
|
6
|
+
//#region src/mcp-clients.ts
|
|
7
|
+
const MCP_CLIENTS = {
|
|
8
|
+
claude: {
|
|
9
|
+
name: "claude",
|
|
10
|
+
label: "Claude (.mcp.json)",
|
|
11
|
+
configPath: ".mcp.json",
|
|
12
|
+
configKey: "mcpServers"
|
|
13
|
+
},
|
|
14
|
+
cursor: {
|
|
15
|
+
name: "cursor",
|
|
16
|
+
label: "Cursor (.cursor/mcp.json)",
|
|
17
|
+
configPath: ".cursor/mcp.json",
|
|
18
|
+
configKey: "mcpServers"
|
|
19
|
+
},
|
|
20
|
+
vscode: {
|
|
21
|
+
name: "vscode",
|
|
22
|
+
label: "VS Code (.vscode/mcp.json)",
|
|
23
|
+
configPath: ".vscode/mcp.json",
|
|
24
|
+
configKey: "servers"
|
|
25
|
+
},
|
|
26
|
+
windsurf: {
|
|
27
|
+
name: "windsurf",
|
|
28
|
+
label: "Windsurf (.windsurf/mcp.json)",
|
|
29
|
+
configPath: ".windsurf/mcp.json",
|
|
30
|
+
configKey: "mcpServers"
|
|
31
|
+
},
|
|
32
|
+
codex: {
|
|
33
|
+
name: "codex",
|
|
34
|
+
label: "Codex (.codex/mcp.json)",
|
|
35
|
+
configPath: ".codex/mcp.json",
|
|
36
|
+
configKey: "mcpServers"
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const CLIENT_NAMES = Object.keys(MCP_CLIENTS);
|
|
40
|
+
function isValidClient(client) {
|
|
41
|
+
return CLIENT_NAMES.includes(client);
|
|
42
|
+
}
|
|
43
|
+
function getClientConfig(client) {
|
|
44
|
+
return MCP_CLIENTS[client];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The server is started through `npx` rather than through this CLI.
|
|
48
|
+
*
|
|
49
|
+
* `@bamboocss/mcp` carries the Model Context Protocol SDK, which brings an HTTP server and a
|
|
50
|
+
* JOSE implementation with it — around 18 MB, several times the weight of the CSS toolchain,
|
|
51
|
+
* for a feature most projects never start. Keeping it out of `@bamboocss/dev` means an install
|
|
52
|
+
* only pays for it when a client actually launches the server.
|
|
53
|
+
*
|
|
54
|
+
* `-y` so npx fetches it without prompting the first time.
|
|
55
|
+
*
|
|
56
|
+
* Pinned to this CLI's version rather than left to float. The server loads the project's config
|
|
57
|
+
* with its own copy of `@bamboocss/node`, and every `@bamboocss/*` package releases in lockstep,
|
|
58
|
+
* so an unpinned `latest` would read a pinned project's design system through a different
|
|
59
|
+
* release of the thing that defines it. Re-run `bamboo init-mcp` after upgrading.
|
|
60
|
+
*/
|
|
61
|
+
function generateMcpConfig(clientConfig, version) {
|
|
62
|
+
const serverConfig = {
|
|
63
|
+
command: "npx",
|
|
64
|
+
args: ["-y", `@bamboocss/mcp@${version}`]
|
|
65
|
+
};
|
|
66
|
+
return { [clientConfig.configKey]: { bamboo: serverConfig } };
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/mcp-init.ts
|
|
70
|
+
async function initMcpConfig(options = {}) {
|
|
71
|
+
const { cwd = process.cwd() } = options;
|
|
72
|
+
let { clients } = options;
|
|
73
|
+
p.intro("Bamboo MCP Setup");
|
|
74
|
+
if (!clients || clients.length === 0) {
|
|
75
|
+
const selected = await p.multiselect({
|
|
76
|
+
message: "Select AI clients to configure:",
|
|
77
|
+
options: CLIENT_NAMES.map((client) => ({
|
|
78
|
+
value: client,
|
|
79
|
+
label: MCP_CLIENTS[client].label
|
|
80
|
+
})),
|
|
81
|
+
required: true
|
|
82
|
+
});
|
|
83
|
+
if (p.isCancel(selected)) {
|
|
84
|
+
p.cancel("Setup cancelled.");
|
|
85
|
+
process.exit(0);
|
|
86
|
+
}
|
|
87
|
+
clients = selected;
|
|
88
|
+
}
|
|
89
|
+
const validClients = clients.filter((client) => {
|
|
90
|
+
if (!isValidClient(client)) {
|
|
91
|
+
logger.warn("mcp:init", `Unknown client: ${client}`);
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
});
|
|
96
|
+
if (validClients.length === 0) {
|
|
97
|
+
p.cancel("No valid clients selected.");
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
const results = [];
|
|
101
|
+
for (const client of validClients) {
|
|
102
|
+
const clientConfig = getClientConfig(client);
|
|
103
|
+
const configPath = resolve(cwd, clientConfig.configPath);
|
|
104
|
+
const configDir = dirname(configPath);
|
|
105
|
+
if (!existsSync(configDir)) mkdirSync(configDir, { recursive: true });
|
|
106
|
+
const newConfig = generateMcpConfig(clientConfig, version);
|
|
107
|
+
let finalConfig = newConfig;
|
|
108
|
+
if (existsSync(configPath)) try {
|
|
109
|
+
const existingContent = readFileSync(configPath, "utf-8");
|
|
110
|
+
const existingConfig = JSON.parse(existingContent);
|
|
111
|
+
finalConfig = {
|
|
112
|
+
...existingConfig,
|
|
113
|
+
[clientConfig.configKey]: {
|
|
114
|
+
...existingConfig[clientConfig.configKey],
|
|
115
|
+
...newConfig[clientConfig.configKey]
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
} catch {}
|
|
119
|
+
writeFileSync(configPath, JSON.stringify(finalConfig, null, 2));
|
|
120
|
+
results.push({
|
|
121
|
+
client,
|
|
122
|
+
path: clientConfig.configPath,
|
|
123
|
+
created: true
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
p.note(results.map((r) => `${r.client}: ${r.path}`).join("\n"), "Created MCP configurations");
|
|
127
|
+
p.outro("MCP setup complete! Your AI assistants can now use Bamboo CSS tools.");
|
|
128
|
+
return results;
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
export { initMcpConfig };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
const require_package = require("./package-DsByZeDf.cjs");
|
|
2
|
+
let _bamboocss_logger = require("@bamboocss/logger");
|
|
3
|
+
let path = require("path");
|
|
4
|
+
let _clack_prompts = require("@clack/prompts");
|
|
5
|
+
_clack_prompts = require_package.__toESM(_clack_prompts);
|
|
6
|
+
let fs = require("fs");
|
|
7
|
+
//#region src/mcp-clients.ts
|
|
8
|
+
const MCP_CLIENTS = {
|
|
9
|
+
claude: {
|
|
10
|
+
name: "claude",
|
|
11
|
+
label: "Claude (.mcp.json)",
|
|
12
|
+
configPath: ".mcp.json",
|
|
13
|
+
configKey: "mcpServers"
|
|
14
|
+
},
|
|
15
|
+
cursor: {
|
|
16
|
+
name: "cursor",
|
|
17
|
+
label: "Cursor (.cursor/mcp.json)",
|
|
18
|
+
configPath: ".cursor/mcp.json",
|
|
19
|
+
configKey: "mcpServers"
|
|
20
|
+
},
|
|
21
|
+
vscode: {
|
|
22
|
+
name: "vscode",
|
|
23
|
+
label: "VS Code (.vscode/mcp.json)",
|
|
24
|
+
configPath: ".vscode/mcp.json",
|
|
25
|
+
configKey: "servers"
|
|
26
|
+
},
|
|
27
|
+
windsurf: {
|
|
28
|
+
name: "windsurf",
|
|
29
|
+
label: "Windsurf (.windsurf/mcp.json)",
|
|
30
|
+
configPath: ".windsurf/mcp.json",
|
|
31
|
+
configKey: "mcpServers"
|
|
32
|
+
},
|
|
33
|
+
codex: {
|
|
34
|
+
name: "codex",
|
|
35
|
+
label: "Codex (.codex/mcp.json)",
|
|
36
|
+
configPath: ".codex/mcp.json",
|
|
37
|
+
configKey: "mcpServers"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const CLIENT_NAMES = Object.keys(MCP_CLIENTS);
|
|
41
|
+
function isValidClient(client) {
|
|
42
|
+
return CLIENT_NAMES.includes(client);
|
|
43
|
+
}
|
|
44
|
+
function getClientConfig(client) {
|
|
45
|
+
return MCP_CLIENTS[client];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The server is started through `npx` rather than through this CLI.
|
|
49
|
+
*
|
|
50
|
+
* `@bamboocss/mcp` carries the Model Context Protocol SDK, which brings an HTTP server and a
|
|
51
|
+
* JOSE implementation with it — around 18 MB, several times the weight of the CSS toolchain,
|
|
52
|
+
* for a feature most projects never start. Keeping it out of `@bamboocss/dev` means an install
|
|
53
|
+
* only pays for it when a client actually launches the server.
|
|
54
|
+
*
|
|
55
|
+
* `-y` so npx fetches it without prompting the first time.
|
|
56
|
+
*
|
|
57
|
+
* Pinned to this CLI's version rather than left to float. The server loads the project's config
|
|
58
|
+
* with its own copy of `@bamboocss/node`, and every `@bamboocss/*` package releases in lockstep,
|
|
59
|
+
* so an unpinned `latest` would read a pinned project's design system through a different
|
|
60
|
+
* release of the thing that defines it. Re-run `bamboo init-mcp` after upgrading.
|
|
61
|
+
*/
|
|
62
|
+
function generateMcpConfig(clientConfig, version) {
|
|
63
|
+
const serverConfig = {
|
|
64
|
+
command: "npx",
|
|
65
|
+
args: ["-y", `@bamboocss/mcp@${version}`]
|
|
66
|
+
};
|
|
67
|
+
return { [clientConfig.configKey]: { bamboo: serverConfig } };
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/mcp-init.ts
|
|
71
|
+
async function initMcpConfig(options = {}) {
|
|
72
|
+
const { cwd = process.cwd() } = options;
|
|
73
|
+
let { clients } = options;
|
|
74
|
+
_clack_prompts.intro("Bamboo MCP Setup");
|
|
75
|
+
if (!clients || clients.length === 0) {
|
|
76
|
+
const selected = await _clack_prompts.multiselect({
|
|
77
|
+
message: "Select AI clients to configure:",
|
|
78
|
+
options: CLIENT_NAMES.map((client) => ({
|
|
79
|
+
value: client,
|
|
80
|
+
label: MCP_CLIENTS[client].label
|
|
81
|
+
})),
|
|
82
|
+
required: true
|
|
83
|
+
});
|
|
84
|
+
if (_clack_prompts.isCancel(selected)) {
|
|
85
|
+
_clack_prompts.cancel("Setup cancelled.");
|
|
86
|
+
process.exit(0);
|
|
87
|
+
}
|
|
88
|
+
clients = selected;
|
|
89
|
+
}
|
|
90
|
+
const validClients = clients.filter((client) => {
|
|
91
|
+
if (!isValidClient(client)) {
|
|
92
|
+
_bamboocss_logger.logger.warn("mcp:init", `Unknown client: ${client}`);
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
});
|
|
97
|
+
if (validClients.length === 0) {
|
|
98
|
+
_clack_prompts.cancel("No valid clients selected.");
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
const results = [];
|
|
102
|
+
for (const client of validClients) {
|
|
103
|
+
const clientConfig = getClientConfig(client);
|
|
104
|
+
const configPath = (0, path.resolve)(cwd, clientConfig.configPath);
|
|
105
|
+
const configDir = (0, path.dirname)(configPath);
|
|
106
|
+
if (!(0, fs.existsSync)(configDir)) (0, fs.mkdirSync)(configDir, { recursive: true });
|
|
107
|
+
const newConfig = generateMcpConfig(clientConfig, require_package.version);
|
|
108
|
+
let finalConfig = newConfig;
|
|
109
|
+
if ((0, fs.existsSync)(configPath)) try {
|
|
110
|
+
const existingContent = (0, fs.readFileSync)(configPath, "utf-8");
|
|
111
|
+
const existingConfig = JSON.parse(existingContent);
|
|
112
|
+
finalConfig = {
|
|
113
|
+
...existingConfig,
|
|
114
|
+
[clientConfig.configKey]: {
|
|
115
|
+
...existingConfig[clientConfig.configKey],
|
|
116
|
+
...newConfig[clientConfig.configKey]
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
} catch {}
|
|
120
|
+
(0, fs.writeFileSync)(configPath, JSON.stringify(finalConfig, null, 2));
|
|
121
|
+
results.push({
|
|
122
|
+
client,
|
|
123
|
+
path: clientConfig.configPath,
|
|
124
|
+
created: true
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
_clack_prompts.note(results.map((r) => `${r.client}: ${r.path}`).join("\n"), "Created MCP configurations");
|
|
128
|
+
_clack_prompts.outro("MCP setup complete! Your AI assistants can now use Bamboo CSS tools.");
|
|
129
|
+
return results;
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
exports.initMcpConfig = initMcpConfig;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
const require_cli_default = require("./cli-default.cjs");
|
|
2
|
+
let fs = require("fs");
|
|
3
|
+
let path = require("path");
|
|
4
|
+
let _bamboocss_logger = require("@bamboocss/logger");
|
|
5
|
+
let _clack_prompts = require("@clack/prompts");
|
|
6
|
+
_clack_prompts = require_cli_default.__toESM(_clack_prompts);
|
|
7
|
+
//#region src/mcp-clients.ts
|
|
8
|
+
const MCP_CLIENTS = {
|
|
9
|
+
claude: {
|
|
10
|
+
name: "claude",
|
|
11
|
+
label: "Claude (.mcp.json)",
|
|
12
|
+
configPath: ".mcp.json",
|
|
13
|
+
configKey: "mcpServers"
|
|
14
|
+
},
|
|
15
|
+
cursor: {
|
|
16
|
+
name: "cursor",
|
|
17
|
+
label: "Cursor (.cursor/mcp.json)",
|
|
18
|
+
configPath: ".cursor/mcp.json",
|
|
19
|
+
configKey: "mcpServers"
|
|
20
|
+
},
|
|
21
|
+
vscode: {
|
|
22
|
+
name: "vscode",
|
|
23
|
+
label: "VS Code (.vscode/mcp.json)",
|
|
24
|
+
configPath: ".vscode/mcp.json",
|
|
25
|
+
configKey: "servers"
|
|
26
|
+
},
|
|
27
|
+
windsurf: {
|
|
28
|
+
name: "windsurf",
|
|
29
|
+
label: "Windsurf (.windsurf/mcp.json)",
|
|
30
|
+
configPath: ".windsurf/mcp.json",
|
|
31
|
+
configKey: "mcpServers"
|
|
32
|
+
},
|
|
33
|
+
codex: {
|
|
34
|
+
name: "codex",
|
|
35
|
+
label: "Codex (.codex/mcp.json)",
|
|
36
|
+
configPath: ".codex/mcp.json",
|
|
37
|
+
configKey: "mcpServers"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const CLIENT_NAMES = Object.keys(MCP_CLIENTS);
|
|
41
|
+
function isValidClient(client) {
|
|
42
|
+
return CLIENT_NAMES.includes(client);
|
|
43
|
+
}
|
|
44
|
+
function getClientConfig(client) {
|
|
45
|
+
return MCP_CLIENTS[client];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The server is started through `npx` rather than through this CLI.
|
|
49
|
+
*
|
|
50
|
+
* `@bamboocss/mcp` carries the Model Context Protocol SDK, which brings an HTTP server and a
|
|
51
|
+
* JOSE implementation with it — around 18 MB, several times the weight of the CSS toolchain,
|
|
52
|
+
* for a feature most projects never start. Keeping it out of `@bamboocss/dev` means an install
|
|
53
|
+
* only pays for it when a client actually launches the server.
|
|
54
|
+
*
|
|
55
|
+
* `-y` so npx fetches it without prompting the first time.
|
|
56
|
+
*
|
|
57
|
+
* Pinned to this CLI's version rather than left to float. The server loads the project's config
|
|
58
|
+
* with its own copy of `@bamboocss/node`, and every `@bamboocss/*` package releases in lockstep,
|
|
59
|
+
* so an unpinned `latest` would read a pinned project's design system through a different
|
|
60
|
+
* release of the thing that defines it. Re-run `bamboo init-mcp` after upgrading.
|
|
61
|
+
*/
|
|
62
|
+
function generateMcpConfig(clientConfig, version) {
|
|
63
|
+
const serverConfig = {
|
|
64
|
+
command: "npx",
|
|
65
|
+
args: ["-y", `@bamboocss/mcp@${version}`]
|
|
66
|
+
};
|
|
67
|
+
return { [clientConfig.configKey]: { bamboo: serverConfig } };
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/mcp-init.ts
|
|
71
|
+
async function initMcpConfig(options = {}) {
|
|
72
|
+
const { cwd = process.cwd() } = options;
|
|
73
|
+
let { clients } = options;
|
|
74
|
+
_clack_prompts.intro("Bamboo MCP Setup");
|
|
75
|
+
if (!clients || clients.length === 0) {
|
|
76
|
+
const selected = await _clack_prompts.multiselect({
|
|
77
|
+
message: "Select AI clients to configure:",
|
|
78
|
+
options: CLIENT_NAMES.map((client) => ({
|
|
79
|
+
value: client,
|
|
80
|
+
label: MCP_CLIENTS[client].label
|
|
81
|
+
})),
|
|
82
|
+
required: true
|
|
83
|
+
});
|
|
84
|
+
if (_clack_prompts.isCancel(selected)) {
|
|
85
|
+
_clack_prompts.cancel("Setup cancelled.");
|
|
86
|
+
process.exit(0);
|
|
87
|
+
}
|
|
88
|
+
clients = selected;
|
|
89
|
+
}
|
|
90
|
+
const validClients = clients.filter((client) => {
|
|
91
|
+
if (!isValidClient(client)) {
|
|
92
|
+
_bamboocss_logger.logger.warn("mcp:init", `Unknown client: ${client}`);
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
});
|
|
97
|
+
if (validClients.length === 0) {
|
|
98
|
+
_clack_prompts.cancel("No valid clients selected.");
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
const results = [];
|
|
102
|
+
for (const client of validClients) {
|
|
103
|
+
const clientConfig = getClientConfig(client);
|
|
104
|
+
const configPath = (0, path.resolve)(cwd, clientConfig.configPath);
|
|
105
|
+
const configDir = (0, path.dirname)(configPath);
|
|
106
|
+
if (!(0, fs.existsSync)(configDir)) (0, fs.mkdirSync)(configDir, { recursive: true });
|
|
107
|
+
const newConfig = generateMcpConfig(clientConfig, require_cli_default.version);
|
|
108
|
+
let finalConfig = newConfig;
|
|
109
|
+
if ((0, fs.existsSync)(configPath)) try {
|
|
110
|
+
const existingContent = (0, fs.readFileSync)(configPath, "utf-8");
|
|
111
|
+
const existingConfig = JSON.parse(existingContent);
|
|
112
|
+
finalConfig = {
|
|
113
|
+
...existingConfig,
|
|
114
|
+
[clientConfig.configKey]: {
|
|
115
|
+
...existingConfig[clientConfig.configKey],
|
|
116
|
+
...newConfig[clientConfig.configKey]
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
} catch {}
|
|
120
|
+
(0, fs.writeFileSync)(configPath, JSON.stringify(finalConfig, null, 2));
|
|
121
|
+
results.push({
|
|
122
|
+
client,
|
|
123
|
+
path: clientConfig.configPath,
|
|
124
|
+
created: true
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
_clack_prompts.note(results.map((r) => `${r.client}: ${r.path}`).join("\n"), "Created MCP configurations");
|
|
128
|
+
_clack_prompts.outro("MCP setup complete! Your AI assistants can now use Bamboo CSS tools.");
|
|
129
|
+
return results;
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
exports.initMcpConfig = initMcpConfig;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { t as version } from "./package-CJPGzAjR.mjs";
|
|
2
|
+
import { logger } from "@bamboocss/logger";
|
|
3
|
+
import { dirname, resolve } from "path";
|
|
4
|
+
import * as p from "@clack/prompts";
|
|
5
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
6
|
+
//#region src/mcp-clients.ts
|
|
7
|
+
const MCP_CLIENTS = {
|
|
8
|
+
claude: {
|
|
9
|
+
name: "claude",
|
|
10
|
+
label: "Claude (.mcp.json)",
|
|
11
|
+
configPath: ".mcp.json",
|
|
12
|
+
configKey: "mcpServers"
|
|
13
|
+
},
|
|
14
|
+
cursor: {
|
|
15
|
+
name: "cursor",
|
|
16
|
+
label: "Cursor (.cursor/mcp.json)",
|
|
17
|
+
configPath: ".cursor/mcp.json",
|
|
18
|
+
configKey: "mcpServers"
|
|
19
|
+
},
|
|
20
|
+
vscode: {
|
|
21
|
+
name: "vscode",
|
|
22
|
+
label: "VS Code (.vscode/mcp.json)",
|
|
23
|
+
configPath: ".vscode/mcp.json",
|
|
24
|
+
configKey: "servers"
|
|
25
|
+
},
|
|
26
|
+
windsurf: {
|
|
27
|
+
name: "windsurf",
|
|
28
|
+
label: "Windsurf (.windsurf/mcp.json)",
|
|
29
|
+
configPath: ".windsurf/mcp.json",
|
|
30
|
+
configKey: "mcpServers"
|
|
31
|
+
},
|
|
32
|
+
codex: {
|
|
33
|
+
name: "codex",
|
|
34
|
+
label: "Codex (.codex/mcp.json)",
|
|
35
|
+
configPath: ".codex/mcp.json",
|
|
36
|
+
configKey: "mcpServers"
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const CLIENT_NAMES = Object.keys(MCP_CLIENTS);
|
|
40
|
+
function isValidClient(client) {
|
|
41
|
+
return CLIENT_NAMES.includes(client);
|
|
42
|
+
}
|
|
43
|
+
function getClientConfig(client) {
|
|
44
|
+
return MCP_CLIENTS[client];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The server is started through `npx` rather than through this CLI.
|
|
48
|
+
*
|
|
49
|
+
* `@bamboocss/mcp` carries the Model Context Protocol SDK, which brings an HTTP server and a
|
|
50
|
+
* JOSE implementation with it — around 18 MB, several times the weight of the CSS toolchain,
|
|
51
|
+
* for a feature most projects never start. Keeping it out of `@bamboocss/dev` means an install
|
|
52
|
+
* only pays for it when a client actually launches the server.
|
|
53
|
+
*
|
|
54
|
+
* `-y` so npx fetches it without prompting the first time.
|
|
55
|
+
*
|
|
56
|
+
* Pinned to this CLI's version rather than left to float. The server loads the project's config
|
|
57
|
+
* with its own copy of `@bamboocss/node`, and every `@bamboocss/*` package releases in lockstep,
|
|
58
|
+
* so an unpinned `latest` would read a pinned project's design system through a different
|
|
59
|
+
* release of the thing that defines it. Re-run `bamboo init-mcp` after upgrading.
|
|
60
|
+
*/
|
|
61
|
+
function generateMcpConfig(clientConfig, version) {
|
|
62
|
+
const serverConfig = {
|
|
63
|
+
command: "npx",
|
|
64
|
+
args: ["-y", `@bamboocss/mcp@${version}`]
|
|
65
|
+
};
|
|
66
|
+
return { [clientConfig.configKey]: { bamboo: serverConfig } };
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/mcp-init.ts
|
|
70
|
+
async function initMcpConfig(options = {}) {
|
|
71
|
+
const { cwd = process.cwd() } = options;
|
|
72
|
+
let { clients } = options;
|
|
73
|
+
p.intro("Bamboo MCP Setup");
|
|
74
|
+
if (!clients || clients.length === 0) {
|
|
75
|
+
const selected = await p.multiselect({
|
|
76
|
+
message: "Select AI clients to configure:",
|
|
77
|
+
options: CLIENT_NAMES.map((client) => ({
|
|
78
|
+
value: client,
|
|
79
|
+
label: MCP_CLIENTS[client].label
|
|
80
|
+
})),
|
|
81
|
+
required: true
|
|
82
|
+
});
|
|
83
|
+
if (p.isCancel(selected)) {
|
|
84
|
+
p.cancel("Setup cancelled.");
|
|
85
|
+
process.exit(0);
|
|
86
|
+
}
|
|
87
|
+
clients = selected;
|
|
88
|
+
}
|
|
89
|
+
const validClients = clients.filter((client) => {
|
|
90
|
+
if (!isValidClient(client)) {
|
|
91
|
+
logger.warn("mcp:init", `Unknown client: ${client}`);
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
});
|
|
96
|
+
if (validClients.length === 0) {
|
|
97
|
+
p.cancel("No valid clients selected.");
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
const results = [];
|
|
101
|
+
for (const client of validClients) {
|
|
102
|
+
const clientConfig = getClientConfig(client);
|
|
103
|
+
const configPath = resolve(cwd, clientConfig.configPath);
|
|
104
|
+
const configDir = dirname(configPath);
|
|
105
|
+
if (!existsSync(configDir)) mkdirSync(configDir, { recursive: true });
|
|
106
|
+
const newConfig = generateMcpConfig(clientConfig, version);
|
|
107
|
+
let finalConfig = newConfig;
|
|
108
|
+
if (existsSync(configPath)) try {
|
|
109
|
+
const existingContent = readFileSync(configPath, "utf-8");
|
|
110
|
+
const existingConfig = JSON.parse(existingContent);
|
|
111
|
+
finalConfig = {
|
|
112
|
+
...existingConfig,
|
|
113
|
+
[clientConfig.configKey]: {
|
|
114
|
+
...existingConfig[clientConfig.configKey],
|
|
115
|
+
...newConfig[clientConfig.configKey]
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
} catch {}
|
|
119
|
+
writeFileSync(configPath, JSON.stringify(finalConfig, null, 2));
|
|
120
|
+
results.push({
|
|
121
|
+
client,
|
|
122
|
+
path: clientConfig.configPath,
|
|
123
|
+
created: true
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
p.note(results.map((r) => `${r.client}: ${r.path}`).join("\n"), "Created MCP configurations");
|
|
127
|
+
p.outro("MCP setup complete! Your AI assistants can now use Bamboo CSS tools.");
|
|
128
|
+
return results;
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
export { initMcpConfig };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region package.json
|
|
24
|
+
var version = "1.14.0";
|
|
25
|
+
//#endregion
|
|
26
|
+
Object.defineProperty(exports, "__toESM", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function() {
|
|
29
|
+
return __toESM;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "version", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function() {
|
|
35
|
+
return version;
|
|
36
|
+
}
|
|
37
|
+
});
|
package/dist/types.d.cts
CHANGED
|
@@ -26,15 +26,6 @@ interface CssGenCommandFlags {
|
|
|
26
26
|
logfile?: string;
|
|
27
27
|
splitting?: boolean;
|
|
28
28
|
}
|
|
29
|
-
interface StudioCommandFlags extends Pick<Config, 'cwd'> {
|
|
30
|
-
build?: boolean;
|
|
31
|
-
preview?: boolean;
|
|
32
|
-
config?: string;
|
|
33
|
-
outdir?: string;
|
|
34
|
-
port?: string;
|
|
35
|
-
host?: boolean;
|
|
36
|
-
base?: string;
|
|
37
|
-
}
|
|
38
29
|
interface AnalyzeCommandFlags {
|
|
39
30
|
silent?: boolean;
|
|
40
31
|
outfile?: string;
|
|
@@ -89,10 +80,6 @@ interface EmitPackageCommandFlags {
|
|
|
89
80
|
cwd: string;
|
|
90
81
|
base?: string;
|
|
91
82
|
}
|
|
92
|
-
interface McpCommandFlags {
|
|
93
|
-
cwd?: string;
|
|
94
|
-
config?: string;
|
|
95
|
-
}
|
|
96
83
|
interface McpInitCommandFlags {
|
|
97
84
|
cwd?: string;
|
|
98
85
|
client?: string[];
|
|
@@ -104,4 +91,4 @@ interface SpecCommandFlags {
|
|
|
104
91
|
config?: string;
|
|
105
92
|
}
|
|
106
93
|
//#endregion
|
|
107
|
-
export { AnalyzeCommandFlags, CodegenCommandFlags, CssGenCommandFlags, DebugCommandFlags, EmitPackageCommandFlags, InitCommandFlags, MainCommandFlags,
|
|
94
|
+
export { AnalyzeCommandFlags, CodegenCommandFlags, CssGenCommandFlags, DebugCommandFlags, EmitPackageCommandFlags, InitCommandFlags, MainCommandFlags, McpInitCommandFlags, ShipCommandFlags, SpecCommandFlags };
|
package/dist/types.d.mts
CHANGED
|
@@ -26,15 +26,6 @@ interface CssGenCommandFlags {
|
|
|
26
26
|
logfile?: string;
|
|
27
27
|
splitting?: boolean;
|
|
28
28
|
}
|
|
29
|
-
interface StudioCommandFlags extends Pick<Config, 'cwd'> {
|
|
30
|
-
build?: boolean;
|
|
31
|
-
preview?: boolean;
|
|
32
|
-
config?: string;
|
|
33
|
-
outdir?: string;
|
|
34
|
-
port?: string;
|
|
35
|
-
host?: boolean;
|
|
36
|
-
base?: string;
|
|
37
|
-
}
|
|
38
29
|
interface AnalyzeCommandFlags {
|
|
39
30
|
silent?: boolean;
|
|
40
31
|
outfile?: string;
|
|
@@ -89,10 +80,6 @@ interface EmitPackageCommandFlags {
|
|
|
89
80
|
cwd: string;
|
|
90
81
|
base?: string;
|
|
91
82
|
}
|
|
92
|
-
interface McpCommandFlags {
|
|
93
|
-
cwd?: string;
|
|
94
|
-
config?: string;
|
|
95
|
-
}
|
|
96
83
|
interface McpInitCommandFlags {
|
|
97
84
|
cwd?: string;
|
|
98
85
|
client?: string[];
|
|
@@ -104,4 +91,4 @@ interface SpecCommandFlags {
|
|
|
104
91
|
config?: string;
|
|
105
92
|
}
|
|
106
93
|
//#endregion
|
|
107
|
-
export { AnalyzeCommandFlags, CodegenCommandFlags, CssGenCommandFlags, DebugCommandFlags, EmitPackageCommandFlags, InitCommandFlags, MainCommandFlags,
|
|
94
|
+
export { AnalyzeCommandFlags, CodegenCommandFlags, CssGenCommandFlags, DebugCommandFlags, EmitPackageCommandFlags, InitCommandFlags, MainCommandFlags, McpInitCommandFlags, ShipCommandFlags, SpecCommandFlags };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/dev",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.14.0",
|
|
4
|
+
"description": "Build-time, type-safe, zero-runtime CSS-in-JS",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Gajus Kuizinas <gajus@gajus.com>",
|
|
@@ -54,16 +54,14 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@clack/prompts": "0.11.0",
|
|
56
56
|
"cac": "6.7.14",
|
|
57
|
-
"@bamboocss/
|
|
58
|
-
"@bamboocss/
|
|
59
|
-
"@bamboocss/
|
|
60
|
-
"@bamboocss/
|
|
61
|
-
"@bamboocss/
|
|
62
|
-
"@bamboocss/
|
|
63
|
-
"@bamboocss/
|
|
64
|
-
"@bamboocss/
|
|
65
|
-
"@bamboocss/token-dictionary": "1.13.1",
|
|
66
|
-
"@bamboocss/types": "1.13.1"
|
|
57
|
+
"@bamboocss/logger": "1.14.0",
|
|
58
|
+
"@bamboocss/node": "1.14.0",
|
|
59
|
+
"@bamboocss/postcss": "1.14.0",
|
|
60
|
+
"@bamboocss/preset-bamboo": "1.14.0",
|
|
61
|
+
"@bamboocss/preset-base": "1.14.0",
|
|
62
|
+
"@bamboocss/shared": "1.14.0",
|
|
63
|
+
"@bamboocss/token-dictionary": "1.14.0",
|
|
64
|
+
"@bamboocss/types": "1.14.0"
|
|
67
65
|
},
|
|
68
66
|
"devDependencies": {
|
|
69
67
|
"@types/update-notifier": "6.0.8",
|