@agimon-ai/style-system 0.1.6 → 0.1.8

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.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_stdio = require("./stdio-AKV8yNq8.cjs");
2
+ const require_stdio = require("./stdio-EAP8fZ2p.cjs");
3
3
  let node_fs = require("node:fs");
4
4
  let node_path = require("node:path");
5
5
  node_path = require_stdio.__toESM(node_path, 1);
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { A as STYLE_SYSTEM_TYPES, C as getAppDesignSystemConfig, L as log, N as DEFAULT_STYLE_SYSTEM_CONFIG, P as TailwindCSSClassesService, a as STYLE_SYSTEM_CLI_NAME, b as getBundlerServiceFromConfig, i as createServer, k as resolveStyleSystemThemePath, o as STYLE_SYSTEM_VERSION, r as generateRestrictedClassesConfig, s as createContainer, t as StdioTransportHandler } from "./stdio-DwdNNCAh.mjs";
2
+ import { A as STYLE_SYSTEM_TYPES, C as getAppDesignSystemConfig, L as log, N as DEFAULT_STYLE_SYSTEM_CONFIG, P as TailwindCSSClassesService, a as STYLE_SYSTEM_CLI_NAME, b as getBundlerServiceFromConfig, i as createServer, k as resolveStyleSystemThemePath, o as STYLE_SYSTEM_VERSION, r as generateRestrictedClassesConfig, s as createContainer, t as StdioTransportHandler } from "./stdio-kBUcm1mr.mjs";
3
3
  import { promises } from "node:fs";
4
4
  import path from "node:path";
5
5
  import { registerManagedProcess } from "@agimon-ai/foundation-exec";
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_stdio = require("./stdio-AKV8yNq8.cjs");
2
+ const require_stdio = require("./stdio-EAP8fZ2p.cjs");
3
3
  let node_fs = require("node:fs");
4
4
  let node_path = require("node:path");
5
5
  node_path = require_stdio.__toESM(node_path, 1);
package/dist/index.d.cts CHANGED
@@ -126,12 +126,12 @@ declare class StyleSystemConfigLoader {
126
126
  * Promises rather than values, so concurrent resolves de-duplicate. Several
127
127
  * callers hit config from inside Promise.all/allSettled.
128
128
  */
129
- private rootPromise;
129
+ private readonly rootPromises;
130
130
  private readonly projectCache;
131
131
  /** Drop all cached config state. */
132
132
  invalidate(): void;
133
133
  /** Load and cache the workspace root config. */
134
- loadRoot(): Promise<StyleSystemRootConfig>;
134
+ loadRoot(workspaceRoot?: string): Promise<StyleSystemRootConfig>;
135
135
  /** Resolve the merged configuration for a project. */
136
136
  resolveProject(appPath: string): Promise<ResolvedDesignSystemConfig>;
137
137
  private readRoot;
package/dist/index.d.mts CHANGED
@@ -126,12 +126,12 @@ declare class StyleSystemConfigLoader {
126
126
  * Promises rather than values, so concurrent resolves de-duplicate. Several
127
127
  * callers hit config from inside Promise.all/allSettled.
128
128
  */
129
- private rootPromise;
129
+ private readonly rootPromises;
130
130
  private readonly projectCache;
131
131
  /** Drop all cached config state. */
132
132
  invalidate(): void;
133
133
  /** Load and cache the workspace root config. */
134
- loadRoot(): Promise<StyleSystemRootConfig>;
134
+ loadRoot(workspaceRoot?: string): Promise<StyleSystemRootConfig>;
135
135
  /** Resolve the merged configuration for a project. */
136
136
  resolveProject(appPath: string): Promise<ResolvedDesignSystemConfig>;
137
137
  private readRoot;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as STYLE_SYSTEM_TYPES, C as getAppDesignSystemConfig, D as resolveAppDesignSystemConfig, E as resetStyleSystemConfigCache, F as BaseCSSClassesService, I as TemplatesManagerService, M as CSSClassesServiceFactory, N as DEFAULT_STYLE_SYSTEM_CONFIG, O as StyleSystemConfigLoader, P as TailwindCSSClassesService, S as BaseBundlerService, T as hasStyleSystemProjectConfig, _ as ThemeService, b as getBundlerServiceFromConfig, c as createStyleSystemModule, d as ListSharedComponentsTool, f as GetComponentVisualTool, g as ComponentRendererService, h as GetUiComponentService, i as createServer, j as StoriesIndexService, k as resolveStyleSystemThemePath, l as PolishComponentTool, m as ListThemesTool, n as extractCustomTokenNames, p as GetCSSClassesTool, r as generateRestrictedClassesConfig, s as createContainer, t as StdioTransportHandler, u as ListAppComponentsTool, v as createDefaultBundlerService, w as getSharedComponentTags, x as ViteReactBundlerService, y as getBundlerService } from "./stdio-DwdNNCAh.mjs";
1
+ import { A as STYLE_SYSTEM_TYPES, C as getAppDesignSystemConfig, D as resolveAppDesignSystemConfig, E as resetStyleSystemConfigCache, F as BaseCSSClassesService, I as TemplatesManagerService, M as CSSClassesServiceFactory, N as DEFAULT_STYLE_SYSTEM_CONFIG, O as StyleSystemConfigLoader, P as TailwindCSSClassesService, S as BaseBundlerService, T as hasStyleSystemProjectConfig, _ as ThemeService, b as getBundlerServiceFromConfig, c as createStyleSystemModule, d as ListSharedComponentsTool, f as GetComponentVisualTool, g as ComponentRendererService, h as GetUiComponentService, i as createServer, j as StoriesIndexService, k as resolveStyleSystemThemePath, l as PolishComponentTool, m as ListThemesTool, n as extractCustomTokenNames, p as GetCSSClassesTool, r as generateRestrictedClassesConfig, s as createContainer, t as StdioTransportHandler, u as ListAppComponentsTool, v as createDefaultBundlerService, w as getSharedComponentTags, x as ViteReactBundlerService, y as getBundlerService } from "./stdio-kBUcm1mr.mjs";
2
2
  import { promises } from "node:fs";
3
3
  import path from "node:path";
4
4
  import { createHash, randomUUID } from "node:crypto";
@@ -1329,8 +1329,9 @@ const EXPO_APP_CONFIG_FILE = "app.json";
1329
1329
  * values, and warns when it is the one that resolves.
1330
1330
  */
1331
1331
  async function resolveStyleSystemThemePath(input) {
1332
- const monorepoRoot = TemplatesManagerService.getWorkspaceRootSync();
1333
- const resolvedAppPath = input.appPath ? node_path.default.isAbsolute(input.appPath) ? input.appPath : node_path.default.join(monorepoRoot, input.appPath) : monorepoRoot;
1332
+ const hostRoot = TemplatesManagerService.getWorkspaceRootSync();
1333
+ const resolvedAppPath = input.appPath ? node_path.default.isAbsolute(input.appPath) ? node_path.default.normalize(input.appPath) : node_path.default.join(hostRoot, input.appPath) : hostRoot;
1334
+ const monorepoRoot = input.appPath ? TemplatesManagerService.getWorkspaceRootSync(resolvedAppPath) : hostRoot;
1334
1335
  const workspaceCandidate = node_path.default.join(monorepoRoot, input.themePath);
1335
1336
  const candidates = node_path.default.isAbsolute(input.themePath) ? [input.themePath] : [workspaceCandidate, node_path.default.resolve(resolvedAppPath, input.themePath)];
1336
1337
  const uniqueCandidates = [...new Set(candidates)];
@@ -1384,26 +1385,35 @@ let StyleSystemConfigLoader = class StyleSystemConfigLoader {
1384
1385
  * Promises rather than values, so concurrent resolves de-duplicate. Several
1385
1386
  * callers hit config from inside Promise.all/allSettled.
1386
1387
  */
1387
- rootPromise = null;
1388
+ rootPromises = /* @__PURE__ */ new Map();
1388
1389
  projectCache = /* @__PURE__ */ new Map();
1389
1390
  /** Drop all cached config state. */
1390
1391
  invalidate() {
1391
- this.rootPromise = null;
1392
+ this.rootPromises.clear();
1392
1393
  this.projectCache.clear();
1393
1394
  }
1394
1395
  /** Load and cache the workspace root config. */
1395
- async loadRoot() {
1396
- this.rootPromise ??= this.readRoot();
1397
- return this.rootPromise;
1396
+ async loadRoot(workspaceRoot = TemplatesManagerService.getWorkspaceRootSync()) {
1397
+ let pending = this.rootPromises.get(workspaceRoot);
1398
+ if (!pending) {
1399
+ pending = this.readRoot(workspaceRoot);
1400
+ this.rootPromises.set(workspaceRoot, pending);
1401
+ }
1402
+ try {
1403
+ return await pending;
1404
+ } catch (error) {
1405
+ if (this.rootPromises.get(workspaceRoot) === pending) this.rootPromises.delete(workspaceRoot);
1406
+ throw error;
1407
+ }
1398
1408
  }
1399
1409
  /** Resolve the merged configuration for a project. */
1400
1410
  async resolveProject(appPath) {
1401
1411
  if (!appPath || typeof appPath !== "string") throw new Error("appPath is required and must be a non-empty string");
1402
- const workspaceRoot = TemplatesManagerService.getWorkspaceRootSync();
1403
- const resolvedAppPath = node_path.default.isAbsolute(appPath) ? appPath : node_path.default.join(workspaceRoot, appPath);
1412
+ const resolvedAppPath = node_path.default.isAbsolute(appPath) ? node_path.default.normalize(appPath) : node_path.default.join(TemplatesManagerService.getWorkspaceRootSync(), appPath);
1413
+ const workspaceRoot = TemplatesManagerService.getWorkspaceRootSync(resolvedAppPath);
1404
1414
  const cached = this.projectCache.get(resolvedAppPath);
1405
1415
  if (cached) return cached;
1406
- const pending = this.readProject(resolvedAppPath);
1416
+ const pending = this.readProject(resolvedAppPath, workspaceRoot);
1407
1417
  this.projectCache.set(resolvedAppPath, pending);
1408
1418
  try {
1409
1419
  return await pending;
@@ -1412,8 +1422,7 @@ let StyleSystemConfigLoader = class StyleSystemConfigLoader {
1412
1422
  throw error;
1413
1423
  }
1414
1424
  }
1415
- async readRoot() {
1416
- const workspaceRoot = TemplatesManagerService.getWorkspaceRootSync();
1425
+ async readRoot(workspaceRoot) {
1417
1426
  const configPath = node_path.default.join(workspaceRoot, STYLE_SYSTEM_CONFIG_FILE);
1418
1427
  let content;
1419
1428
  try {
@@ -1429,9 +1438,9 @@ let StyleSystemConfigLoader = class StyleSystemConfigLoader {
1429
1438
  log.info(`[Config] Loaded workspace style-system config from ${configPath}`);
1430
1439
  return parsed;
1431
1440
  }
1432
- async readProject(resolvedAppPath) {
1441
+ async readProject(resolvedAppPath, workspaceRoot) {
1433
1442
  if (!(await node_fs.promises.stat(resolvedAppPath).catch(() => null))?.isDirectory()) throw new Error(`Project directory not found: ${resolvedAppPath}`);
1434
- const rootConfig = await this.loadRoot();
1443
+ const rootConfig = await this.loadRoot(workspaceRoot);
1435
1444
  const projectConfigPath = node_path.default.join(resolvedAppPath, STYLE_SYSTEM_CONFIG_FILE);
1436
1445
  const projectName = node_path.default.basename(resolvedAppPath);
1437
1446
  let rawProjectConfig = null;
@@ -5055,7 +5064,7 @@ function createContainer(options) {
5055
5064
  }
5056
5065
  //#endregion
5057
5066
  //#region package.json
5058
- var version = "0.1.5";
5067
+ var version = "0.1.7";
5059
5068
  //#endregion
5060
5069
  //#region src/metadata.ts
5061
5070
  const STYLE_SYSTEM_CLI_NAME = "style-system";
@@ -1303,8 +1303,9 @@ const EXPO_APP_CONFIG_FILE = "app.json";
1303
1303
  * values, and warns when it is the one that resolves.
1304
1304
  */
1305
1305
  async function resolveStyleSystemThemePath(input) {
1306
- const monorepoRoot = TemplatesManagerService.getWorkspaceRootSync();
1307
- const resolvedAppPath = input.appPath ? path.isAbsolute(input.appPath) ? input.appPath : path.join(monorepoRoot, input.appPath) : monorepoRoot;
1306
+ const hostRoot = TemplatesManagerService.getWorkspaceRootSync();
1307
+ const resolvedAppPath = input.appPath ? path.isAbsolute(input.appPath) ? path.normalize(input.appPath) : path.join(hostRoot, input.appPath) : hostRoot;
1308
+ const monorepoRoot = input.appPath ? TemplatesManagerService.getWorkspaceRootSync(resolvedAppPath) : hostRoot;
1308
1309
  const workspaceCandidate = path.join(monorepoRoot, input.themePath);
1309
1310
  const candidates = path.isAbsolute(input.themePath) ? [input.themePath] : [workspaceCandidate, path.resolve(resolvedAppPath, input.themePath)];
1310
1311
  const uniqueCandidates = [...new Set(candidates)];
@@ -1358,26 +1359,35 @@ let StyleSystemConfigLoader = class StyleSystemConfigLoader {
1358
1359
  * Promises rather than values, so concurrent resolves de-duplicate. Several
1359
1360
  * callers hit config from inside Promise.all/allSettled.
1360
1361
  */
1361
- rootPromise = null;
1362
+ rootPromises = /* @__PURE__ */ new Map();
1362
1363
  projectCache = /* @__PURE__ */ new Map();
1363
1364
  /** Drop all cached config state. */
1364
1365
  invalidate() {
1365
- this.rootPromise = null;
1366
+ this.rootPromises.clear();
1366
1367
  this.projectCache.clear();
1367
1368
  }
1368
1369
  /** Load and cache the workspace root config. */
1369
- async loadRoot() {
1370
- this.rootPromise ??= this.readRoot();
1371
- return this.rootPromise;
1370
+ async loadRoot(workspaceRoot = TemplatesManagerService.getWorkspaceRootSync()) {
1371
+ let pending = this.rootPromises.get(workspaceRoot);
1372
+ if (!pending) {
1373
+ pending = this.readRoot(workspaceRoot);
1374
+ this.rootPromises.set(workspaceRoot, pending);
1375
+ }
1376
+ try {
1377
+ return await pending;
1378
+ } catch (error) {
1379
+ if (this.rootPromises.get(workspaceRoot) === pending) this.rootPromises.delete(workspaceRoot);
1380
+ throw error;
1381
+ }
1372
1382
  }
1373
1383
  /** Resolve the merged configuration for a project. */
1374
1384
  async resolveProject(appPath) {
1375
1385
  if (!appPath || typeof appPath !== "string") throw new Error("appPath is required and must be a non-empty string");
1376
- const workspaceRoot = TemplatesManagerService.getWorkspaceRootSync();
1377
- const resolvedAppPath = path.isAbsolute(appPath) ? appPath : path.join(workspaceRoot, appPath);
1386
+ const resolvedAppPath = path.isAbsolute(appPath) ? path.normalize(appPath) : path.join(TemplatesManagerService.getWorkspaceRootSync(), appPath);
1387
+ const workspaceRoot = TemplatesManagerService.getWorkspaceRootSync(resolvedAppPath);
1378
1388
  const cached = this.projectCache.get(resolvedAppPath);
1379
1389
  if (cached) return cached;
1380
- const pending = this.readProject(resolvedAppPath);
1390
+ const pending = this.readProject(resolvedAppPath, workspaceRoot);
1381
1391
  this.projectCache.set(resolvedAppPath, pending);
1382
1392
  try {
1383
1393
  return await pending;
@@ -1386,8 +1396,7 @@ let StyleSystemConfigLoader = class StyleSystemConfigLoader {
1386
1396
  throw error;
1387
1397
  }
1388
1398
  }
1389
- async readRoot() {
1390
- const workspaceRoot = TemplatesManagerService.getWorkspaceRootSync();
1399
+ async readRoot(workspaceRoot) {
1391
1400
  const configPath = path.join(workspaceRoot, STYLE_SYSTEM_CONFIG_FILE);
1392
1401
  let content;
1393
1402
  try {
@@ -1403,9 +1412,9 @@ let StyleSystemConfigLoader = class StyleSystemConfigLoader {
1403
1412
  log.info(`[Config] Loaded workspace style-system config from ${configPath}`);
1404
1413
  return parsed;
1405
1414
  }
1406
- async readProject(resolvedAppPath) {
1415
+ async readProject(resolvedAppPath, workspaceRoot) {
1407
1416
  if (!(await promises.stat(resolvedAppPath).catch(() => null))?.isDirectory()) throw new Error(`Project directory not found: ${resolvedAppPath}`);
1408
- const rootConfig = await this.loadRoot();
1417
+ const rootConfig = await this.loadRoot(workspaceRoot);
1409
1418
  const projectConfigPath = path.join(resolvedAppPath, STYLE_SYSTEM_CONFIG_FILE);
1410
1419
  const projectName = path.basename(resolvedAppPath);
1411
1420
  let rawProjectConfig = null;
@@ -5029,7 +5038,7 @@ function createContainer(options) {
5029
5038
  }
5030
5039
  //#endregion
5031
5040
  //#region package.json
5032
- var version = "0.1.5";
5041
+ var version = "0.1.7";
5033
5042
  //#endregion
5034
5043
  //#region src/metadata.ts
5035
5044
  const STYLE_SYSTEM_CLI_NAME = "style-system";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/style-system",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "MCP server for exploring themes, Tailwind CSS classes, and UI components from Storybook with standalone component rendering capabilities",
5
5
  "keywords": [
6
6
  "design-system",
@@ -60,7 +60,7 @@
60
60
  "tailwindcss": "4.3.3",
61
61
  "vite": "8.1.5",
62
62
  "vite-plugin-singlefile": "^2.3.3",
63
- "@agimon-ai/foundation-exec": "0.26.28"
63
+ "@agimon-ai/foundation-exec": "0.26.30"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@babel/parser": "8.0.0",