@testgorilla/tgo-ui 8.16.0 → 8.17.3

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/mcp/server.mjs CHANGED
@@ -21116,7 +21116,9 @@ var CatalogStore = class {
21116
21116
  moduleName: c.moduleName,
21117
21117
  inputCount: c.inputs.length,
21118
21118
  outputCount: c.outputs.length,
21119
- supportsTheme: c.supportsTheme
21119
+ supportsTheme: c.supportsTheme,
21120
+ whenToUse: c.whenToUse ?? [],
21121
+ whenNotToUse: c.whenNotToUse ?? []
21120
21122
  }));
21121
21123
  }
21122
21124
  getByCategory(category) {
@@ -21142,7 +21144,7 @@ function handleListComponents(store, params) {
21142
21144
  function registerListComponentsTool(server, store) {
21143
21145
  server.tool(
21144
21146
  "list_components",
21145
- "List all available tgo-canopy-ui components. Returns name, selector, category, import path, and input/output counts for each component.",
21147
+ 'List all available tgo-canopy-ui components. Returns name, selector, category, import path, description, input/output counts, and "when to use" / "when not to use" guidance for each component.',
21146
21148
  {
21147
21149
  category: external_exports.string().optional().describe(
21148
21150
  'Filter by category. Categories are auto-inferred from Storybook story titles (e.g., "forms", "charts", "dialog", "bars"). Call without category first to discover available categories.'
@@ -21209,6 +21211,8 @@ function calculateScore(component, terms) {
21209
21211
  score += 30;
21210
21212
  } else if (description.includes(term)) {
21211
21213
  score += 10;
21214
+ } else if ((component.whenToUse ?? []).some((b) => b.toLowerCase().includes(term)) || (component.whenNotToUse ?? []).some((b) => b.toLowerCase().includes(term))) {
21215
+ score += 8;
21212
21216
  } else if (component.inputs.some((i) => i.name.toLowerCase().includes(term)) || component.outputs.some((o) => o.name.toLowerCase().includes(term))) {
21213
21217
  score += 5;
21214
21218
  }
@@ -21220,7 +21224,7 @@ function calculateScore(component, terms) {
21220
21224
  function registerSearchComponentsTool(server, store) {
21221
21225
  server.tool(
21222
21226
  "search_components",
21223
- "Search tgo-canopy-ui components by keyword. Searches across component names, selectors, descriptions, and categories. Returns matching components ranked by relevance.",
21227
+ `Search tgo-canopy-ui components by keyword. Searches across component names, selectors, descriptions, categories, and the "when to use" / "when not to use" usage guidance. Returns matching components ranked by relevance, including each component's usage guidance.`,
21224
21228
  {
21225
21229
  query: external_exports.string().describe('Search query (e.g., "input", "chart", "modal", "form validation")'),
21226
21230
  category: external_exports.string().optional().describe(
@@ -21238,7 +21242,9 @@ function registerSearchComponentsTool(server, store) {
21238
21242
  moduleName: c.moduleName,
21239
21243
  inputCount: c.inputs.length,
21240
21244
  outputCount: c.outputs.length,
21241
- supportsTheme: c.supportsTheme
21245
+ supportsTheme: c.supportsTheme,
21246
+ whenToUse: c.whenToUse ?? [],
21247
+ whenNotToUse: c.whenNotToUse ?? []
21242
21248
  }));
21243
21249
  return {
21244
21250
  content: [{ type: "text", text: JSON.stringify(summaries, null, 2) }]
@@ -21255,6 +21261,24 @@ function generateUsageGuide(c) {
21255
21261
  lines.push("");
21256
21262
  lines.push(c.description);
21257
21263
  lines.push("");
21264
+ const whenToUse = c.whenToUse ?? [];
21265
+ const whenNotToUse = c.whenNotToUse ?? [];
21266
+ if (whenToUse.length > 0) {
21267
+ lines.push("## When to use");
21268
+ lines.push("");
21269
+ for (const item of whenToUse) {
21270
+ lines.push(`- ${item}`);
21271
+ }
21272
+ lines.push("");
21273
+ }
21274
+ if (whenNotToUse.length > 0) {
21275
+ lines.push("## When NOT to use");
21276
+ lines.push("");
21277
+ for (const item of whenNotToUse) {
21278
+ lines.push(`- ${item}`);
21279
+ }
21280
+ lines.push("");
21281
+ }
21258
21282
  lines.push("## Import");
21259
21283
  lines.push("");
21260
21284
  lines.push("```typescript");
@@ -21350,7 +21374,7 @@ function generateUsageGuide(c) {
21350
21374
  function registerGetUsageGuideTool(server, store) {
21351
21375
  server.tool(
21352
21376
  "get_usage_guide",
21353
- "Get a complete usage guide for a tgo-canopy-ui component. Returns a markdown document with: exact import statement, module setup instructions, all inputs/outputs with types, TypeScript type definitions, basic usage template, and real examples from Storybook stories.",
21377
+ 'Get a complete usage guide for a tgo-canopy-ui component. Returns a markdown document with: "when to use" / "when not to use" guidance, exact import statement, module setup instructions, all inputs/outputs with types, TypeScript type definitions, basic usage template, and real examples from Storybook stories.',
21354
21378
  {
21355
21379
  name: external_exports.string().describe("Component name, selector, or class name")
21356
21380
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testgorilla/tgo-ui",
3
- "version": "8.16.0",
3
+ "version": "8.17.3",
4
4
  "license": "proprietary-license",
5
5
  "lint-staged": {
6
6
  "{projects,components}/**/*.ts": [
@@ -42,7 +42,7 @@
42
42
  "node": ">=22.14.0",
43
43
  "npm": ">=11.5.1"
44
44
  },
45
- "packageManager": "npm@11.5.1",
45
+ "packageManager": "npm@11.11.0",
46
46
  "optionalDependencies": {
47
47
  "@esbuild/darwin-arm64": "^0.25.10",
48
48
  "@lmdb/lmdb-win32-x64": "3.0.13",