@atlaskit/ads-mcp 0.3.0 → 0.4.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/CHANGELOG.md +10 -0
- package/dist/cjs/index.js +9 -5
- package/dist/cjs/instructions.js +1 -1
- package/dist/cjs/tools/{get-icons → get-all-icons}/index.js +6 -6
- package/dist/cjs/tools/{get-tokens → get-all-tokens}/index.js +7 -8
- package/dist/cjs/tools/search-icons/index.js +138 -0
- package/dist/cjs/tools/search-tokens/index.js +106 -0
- package/dist/cjs/tools/suggest-accessibility-fixes/fixes.js +1 -1
- package/dist/es2019/index.js +9 -5
- package/dist/es2019/instructions.js +4 -0
- package/dist/es2019/tools/{get-icons → get-all-icons}/index.js +4 -4
- package/dist/es2019/tools/get-all-tokens/index.js +34 -0
- package/dist/es2019/tools/search-icons/index.js +126 -0
- package/dist/es2019/tools/search-tokens/index.js +96 -0
- package/dist/es2019/tools/suggest-accessibility-fixes/fixes.js +1 -1
- package/dist/esm/index.js +9 -5
- package/dist/esm/instructions.js +1 -1
- package/dist/esm/tools/{get-icons → get-all-icons}/index.js +5 -5
- package/dist/esm/tools/{get-tokens → get-all-tokens}/index.js +6 -7
- package/dist/esm/tools/search-icons/index.js +131 -0
- package/dist/esm/tools/search-tokens/index.js +99 -0
- package/dist/esm/tools/suggest-accessibility-fixes/fixes.js +1 -1
- package/dist/types/instructions.d.ts +1 -1
- package/dist/{types-ts4.5/tools/get-tokens → types/tools/get-all-icons}/index.d.ts +2 -2
- package/dist/types/tools/{get-tokens → get-all-tokens}/index.d.ts +2 -2
- package/dist/types/tools/search-icons/index.d.ts +38 -0
- package/dist/types/tools/search-tokens/index.d.ts +38 -0
- package/dist/types-ts4.5/instructions.d.ts +1 -1
- package/dist/types-ts4.5/tools/{get-icons → get-all-icons}/index.d.ts +2 -2
- package/dist/{types/tools/get-icons → types-ts4.5/tools/get-all-tokens}/index.d.ts +2 -2
- package/dist/types-ts4.5/tools/search-icons/index.d.ts +38 -0
- package/dist/types-ts4.5/tools/search-tokens/index.d.ts +38 -0
- package/package.json +4 -3
- package/dist/es2019/tools/get-tokens/index.js +0 -35
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import Fuse from 'fuse.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
4
|
+
import { tokens } from '@atlaskit/tokens/token-metadata';
|
|
5
|
+
const inputSchema = z.object({
|
|
6
|
+
terms: z.array(z.string()).describe('Search term(s) to find tokens by name or description'),
|
|
7
|
+
limit: z.number().optional().default(1).describe('Maximum number of results per term to return (default: 1)'),
|
|
8
|
+
exactName: z.boolean().optional().default(false).describe('Whether to search for exact match only for the token name')
|
|
9
|
+
});
|
|
10
|
+
const cleanQuery = query => query.trim().toLowerCase().replace(/\s+/g, '');
|
|
11
|
+
export const listSearchTokensTool = {
|
|
12
|
+
name: 'search_tokens',
|
|
13
|
+
description: `You SHOULD Search for Atlassian Design System tokens based on multiple query strings (if there's multiple candidates of token names, descriptions or example values, you SHOULD pass them in a single call). You SHOULD use default \`limit\` value of 1 first and only set a higher limit like 5 or 10 if you can't find the token you need). Fallback to \`get_all_tokens\` if nothing is found). This tool searches through token names, descriptions, and example values to find the most relevant design tokens.
|
|
14
|
+
|
|
15
|
+
The search will match against:
|
|
16
|
+
- Token names (e.g., "color.text", "space.100", "border.radius")
|
|
17
|
+
- Token descriptions
|
|
18
|
+
- Token example values (eg. "#2898BD" -> "color.icon.accent.teal")
|
|
19
|
+
|
|
20
|
+
The results include the token's name and example value.
|
|
21
|
+
|
|
22
|
+
Usage pattern for found tokens:
|
|
23
|
+
\`\`\`tsx
|
|
24
|
+
import { token } from '@atlaskit/tokens';
|
|
25
|
+
|
|
26
|
+
const styles = css({
|
|
27
|
+
color: token('color.text'),
|
|
28
|
+
padding: token('space.100'),
|
|
29
|
+
borderRadius: token('border.radius'),
|
|
30
|
+
});
|
|
31
|
+
\`\`\`
|
|
32
|
+
`,
|
|
33
|
+
annotations: {
|
|
34
|
+
title: 'Search ADS tokens',
|
|
35
|
+
readOnlyHint: true,
|
|
36
|
+
destructiveHint: false,
|
|
37
|
+
idempotentHint: true,
|
|
38
|
+
openWorldHint: true
|
|
39
|
+
},
|
|
40
|
+
inputSchema: zodToJsonSchema(inputSchema)
|
|
41
|
+
};
|
|
42
|
+
export const searchTokensTool = async params => {
|
|
43
|
+
const {
|
|
44
|
+
terms,
|
|
45
|
+
limit = 1,
|
|
46
|
+
exactName = false
|
|
47
|
+
} = params;
|
|
48
|
+
const searchTerms = terms.filter(Boolean).map(cleanQuery);
|
|
49
|
+
if (exactName) {
|
|
50
|
+
// for each search term, search for the exact match
|
|
51
|
+
const exactNameMatches = searchTerms.map(term => {
|
|
52
|
+
return tokens.find(token => token.name.toLowerCase() === term.toLowerCase());
|
|
53
|
+
}).filter(Boolean);
|
|
54
|
+
if (exactNameMatches.length > 0) {
|
|
55
|
+
return {
|
|
56
|
+
content: [{
|
|
57
|
+
type: 'text',
|
|
58
|
+
text: JSON.stringify(exactNameMatches.map(token => ({
|
|
59
|
+
name: token.name,
|
|
60
|
+
exampleValue: token.exampleValue
|
|
61
|
+
})))
|
|
62
|
+
}]
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// use Fuse.js to fuzzy-search for the tokens
|
|
68
|
+
const fuse = new Fuse(tokens, {
|
|
69
|
+
keys: [{
|
|
70
|
+
name: 'name',
|
|
71
|
+
weight: 3
|
|
72
|
+
}, {
|
|
73
|
+
name: 'description',
|
|
74
|
+
weight: 2
|
|
75
|
+
}, {
|
|
76
|
+
name: 'exampleValue',
|
|
77
|
+
weight: 1
|
|
78
|
+
}],
|
|
79
|
+
threshold: 0.4
|
|
80
|
+
});
|
|
81
|
+
const results = searchTerms.map(term => {
|
|
82
|
+
return fuse.search(term).slice(0, limit);
|
|
83
|
+
}).flat();
|
|
84
|
+
const matchedTokens = results.map(result => {
|
|
85
|
+
return {
|
|
86
|
+
name: result.item.name,
|
|
87
|
+
exampleValue: result.item.exampleValue
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
return {
|
|
91
|
+
content: [{
|
|
92
|
+
type: 'text',
|
|
93
|
+
text: JSON.stringify(matchedTokens)
|
|
94
|
+
}]
|
|
95
|
+
};
|
|
96
|
+
};
|
|
@@ -450,7 +450,7 @@ const styles = css({
|
|
|
450
450
|
<caption>User account information by department</caption>
|
|
451
451
|
<thead>...</thead>
|
|
452
452
|
</table>`,
|
|
453
|
-
explanation:
|
|
453
|
+
explanation: "Captions provide context about the table's purpose and structure."
|
|
454
454
|
}],
|
|
455
455
|
bestPractices: ['Use th elements for headers', 'Add scope attributes (col, row)', 'Provide table captions when helpful', 'Use thead, tbody, tfoot for structure']
|
|
456
456
|
},
|
package/dist/esm/index.js
CHANGED
|
@@ -7,10 +7,12 @@ import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprot
|
|
|
7
7
|
import { instructions } from './instructions';
|
|
8
8
|
import { analyzeAccessibilityTool, analyzeLocalhostAccessibilityTool, listAnalyzeAccessibilityTool, listAnalyzeLocalhostAccessibilityTool } from './tools/analyze-accessibility';
|
|
9
9
|
import { getAccessibilityGuidelinesTool, listGetAccessibilityGuidelinesTool } from './tools/get-accessibility-guidelines';
|
|
10
|
+
import { getAllIconsTool, listGetAllIconsTool } from './tools/get-all-icons';
|
|
11
|
+
import { getAllTokensTool, listGetAllTokensTool } from './tools/get-all-tokens';
|
|
10
12
|
import { getComponentDetailsTool, listGetComponentDetailsTool } from './tools/get-component-details';
|
|
11
13
|
import { getComponentsTool, listGetComponentsTool } from './tools/get-components';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
+
import { listSearchIconsTool, searchIconsTool } from './tools/search-icons';
|
|
15
|
+
import { listSearchTokensTool, searchTokensTool } from './tools/search-tokens';
|
|
14
16
|
import { listSuggestAccessibilityFixesTool, suggestAccessibilityFixesTool } from './tools/suggest-accessibility-fixes';
|
|
15
17
|
|
|
16
18
|
// eslint-disable-next-line import/no-extraneous-dependencies -- this uses require because not all node versions this package supports use the same import assertions/attributes
|
|
@@ -30,7 +32,7 @@ server.setRequestHandler(ListToolsRequestSchema, /*#__PURE__*/_asyncToGenerator(
|
|
|
30
32
|
while (1) switch (_context.prev = _context.next) {
|
|
31
33
|
case 0:
|
|
32
34
|
return _context.abrupt("return", {
|
|
33
|
-
tools: [
|
|
35
|
+
tools: [listGetAllTokensTool, listGetComponentsTool, listGetComponentDetailsTool, listGetAllIconsTool, listSearchIconsTool, listSearchTokensTool, listAnalyzeAccessibilityTool, listAnalyzeLocalhostAccessibilityTool, listGetAccessibilityGuidelinesTool, listSuggestAccessibilityFixesTool]
|
|
34
36
|
});
|
|
35
37
|
case 1:
|
|
36
38
|
case "end":
|
|
@@ -39,10 +41,12 @@ server.setRequestHandler(ListToolsRequestSchema, /*#__PURE__*/_asyncToGenerator(
|
|
|
39
41
|
}, _callee);
|
|
40
42
|
})));
|
|
41
43
|
var callTools = {
|
|
42
|
-
|
|
44
|
+
get_all_tokens: getAllTokensTool,
|
|
45
|
+
search_tokens: searchTokensTool,
|
|
43
46
|
get_components: getComponentsTool,
|
|
44
47
|
get_component_details: getComponentDetailsTool,
|
|
45
|
-
|
|
48
|
+
get_all_icons: getAllIconsTool,
|
|
49
|
+
search_icons: searchIconsTool,
|
|
46
50
|
analyze_accessibility: analyzeAccessibilityTool,
|
|
47
51
|
analyze_localhost_accessibility: analyzeLocalhostAccessibilityTool,
|
|
48
52
|
get_accessibility_guidelines: getAccessibilityGuidelinesTool,
|
package/dist/esm/instructions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var instructions = "\nYou are an expert in the Atlassian Design System (aka ADS). You are able to answer questions about the design system and provide guidance on what offerings to use when building user interfaces.\n\nYou have special expertise in accessibility and can help ensure that interfaces built with ADS components are accessible to all users. You can analyze code for accessibility violations, provide specific fix suggestions, and offer guidance on accessibility best practices.\n\nYou are able to use the provided tools to help answer your questions, but may also access https://atlassian.design/llms.txt, https://atlassian.design/llms-a11y.txt, or https://atlassian.design/ directly for deeper research and information.\n\nAccessibility Tools Available:\n- analyze_accessibility: Analyze React component code for accessibility violations\n- get_accessibility_guidelines: Get specific accessibility guidelines and best practices\n- suggest_accessibility_fixes: Get specific fix suggestions for accessibility violations\n";
|
|
1
|
+
export var instructions = "\nYou are an expert in the Atlassian Design System (aka ADS). You are able to answer questions about the design system and provide guidance on what offerings to use when building user interfaces.\n\nYou have special expertise in accessibility and can help ensure that interfaces built with ADS components are accessible to all users. You can analyze code for accessibility violations, provide specific fix suggestions, and offer guidance on accessibility best practices.\n\nYou are able to use the provided tools to help answer your questions, but may also access https://atlassian.design/llms.txt, https://atlassian.design/llms-a11y.txt, or https://atlassian.design/ directly for deeper research and information.\n\nAccessibility Tools Available:\n- analyze_accessibility: Analyze React component code for accessibility violations\n- get_accessibility_guidelines: Get specific accessibility guidelines and best practices\n- suggest_accessibility_fixes: Get specific fix suggestions for accessibility violations\n- get_all_tokens: Get all tokens and their example values\n- search_tokens: Search for token(s) and their example value(s)\n- get_all_icons: Get all icons and their usage\n- search_icons: Search for icon(s) and their usage\n";
|
|
@@ -18,9 +18,9 @@ var icons = Object.entries(coreIconMetadata).map(function (_ref) {
|
|
|
18
18
|
shouldRecommendSmallIcon: icon.shouldRecommendSmallIcon
|
|
19
19
|
};
|
|
20
20
|
});
|
|
21
|
-
export var
|
|
22
|
-
name: '
|
|
23
|
-
description: "You
|
|
21
|
+
export var listGetAllIconsTool = {
|
|
22
|
+
name: 'get_all_icons',
|
|
23
|
+
description: "You SHOULD call this when you need complete guidance on what icons to use, but you SHOULD use the `search_icons` tool to find specific icons instead.\nThese are the only icons to be used in modern code, though other legacy icons may still be found, these are not to be used by you, but you can keep them if you see them in existing code.\nThe resulting icon name and package is often like this:\n```tsx\nimport AddIcon from '@atlaskit/icon/core/add';\n\n// Usage in isolation\n<AddIcon label=\"Add\" />\n\n// Usage with a button\nimport Button from '@atlaskit/button/new';\n<Button iconAfter={AddIcon}>Create</Button>\n```\n",
|
|
24
24
|
annotations: {
|
|
25
25
|
title: 'Get ADS icons',
|
|
26
26
|
readOnlyHint: true,
|
|
@@ -30,7 +30,7 @@ export var listGetIconsTool = {
|
|
|
30
30
|
},
|
|
31
31
|
inputSchema: emptyInputSchema
|
|
32
32
|
};
|
|
33
|
-
export var
|
|
33
|
+
export var getAllIconsTool = /*#__PURE__*/function () {
|
|
34
34
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35
35
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
36
36
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -51,7 +51,7 @@ export var getIconsTool = /*#__PURE__*/function () {
|
|
|
51
51
|
}
|
|
52
52
|
}, _callee);
|
|
53
53
|
}));
|
|
54
|
-
return function
|
|
54
|
+
return function getAllIconsTool() {
|
|
55
55
|
return _ref3.apply(this, arguments);
|
|
56
56
|
};
|
|
57
57
|
}();
|
|
@@ -4,11 +4,11 @@ import { z } from 'zod';
|
|
|
4
4
|
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
5
5
|
import { tokens } from '@atlaskit/tokens/token-metadata';
|
|
6
6
|
var inputSchema = z.object({});
|
|
7
|
-
export var
|
|
8
|
-
name: '
|
|
9
|
-
description: "You
|
|
7
|
+
export var listGetAllTokensTool = {
|
|
8
|
+
name: 'get_all_tokens',
|
|
9
|
+
description: "You SHOULD call this when you need complete guidance on what tokens to use, but you SHOULD use the `search_tokens` tool to find specific tokens instead.\n\tThese tokens are used in place of hardcoded values; you should never use a hardcoded value where a token value is appropriate.\n\tThe resulting token name is used inside of the `token()` function, eg.:\n\t```tsx\n\timport { token } from '@atlaskit/tokens';\n\tconst styles = css({ color: token('color.text') });\n\t```\n\t",
|
|
10
10
|
annotations: {
|
|
11
|
-
title: 'Get ADS tokens',
|
|
11
|
+
title: 'Get all ADS tokens',
|
|
12
12
|
readOnlyHint: true,
|
|
13
13
|
destructiveHint: false,
|
|
14
14
|
idempotentHint: true,
|
|
@@ -16,7 +16,7 @@ export var listGetTokensTool = {
|
|
|
16
16
|
},
|
|
17
17
|
inputSchema: zodToJsonSchema(inputSchema)
|
|
18
18
|
};
|
|
19
|
-
export var
|
|
19
|
+
export var getAllTokensTool = /*#__PURE__*/function () {
|
|
20
20
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
21
21
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
22
22
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -29,7 +29,6 @@ export var getTokensTool = /*#__PURE__*/function () {
|
|
|
29
29
|
type: 'text',
|
|
30
30
|
text: JSON.stringify({
|
|
31
31
|
name: token.name,
|
|
32
|
-
description: token.description,
|
|
33
32
|
exampleValue: token.exampleValue
|
|
34
33
|
}, null, 2)
|
|
35
34
|
};
|
|
@@ -41,7 +40,7 @@ export var getTokensTool = /*#__PURE__*/function () {
|
|
|
41
40
|
}
|
|
42
41
|
}, _callee);
|
|
43
42
|
}));
|
|
44
|
-
return function
|
|
43
|
+
return function getAllTokensTool() {
|
|
45
44
|
return _ref.apply(this, arguments);
|
|
46
45
|
};
|
|
47
46
|
}();
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import Fuse from 'fuse.js';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
7
|
+
import { coreIconMetadata } from '@atlaskit/icon/metadata';
|
|
8
|
+
var inputSchema = z.object({
|
|
9
|
+
terms: z.array(z.string()).describe('Search term(s) to find icons by name, keywords, or categorization'),
|
|
10
|
+
limit: z.number().optional().default(1).describe('Maximum number of results per term to return (default: 1)'),
|
|
11
|
+
exactName: z.boolean().optional().default(false).describe('Whether to search for exact match only for the icon name')
|
|
12
|
+
});
|
|
13
|
+
var icons = Object.entries(coreIconMetadata).map(function (_ref) {
|
|
14
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
15
|
+
_key = _ref2[0],
|
|
16
|
+
icon = _ref2[1];
|
|
17
|
+
return {
|
|
18
|
+
componentName: icon.componentName,
|
|
19
|
+
package: icon.package,
|
|
20
|
+
categorization: icon.categorization,
|
|
21
|
+
keywords: icon.keywords,
|
|
22
|
+
status: icon.status,
|
|
23
|
+
usage: icon.usage,
|
|
24
|
+
type: icon.type,
|
|
25
|
+
shouldRecommendSmallIcon: icon.shouldRecommendSmallIcon
|
|
26
|
+
};
|
|
27
|
+
}).filter(function (icon) {
|
|
28
|
+
return icon.status === 'published';
|
|
29
|
+
});
|
|
30
|
+
export var listSearchIconsTool = {
|
|
31
|
+
name: 'search_icons',
|
|
32
|
+
description: "You SHOULD Search for Atlassian Design System icons based on multiple query strings (if there's multiple candidates of icon names, categorization or keywords, you SHOULD pass them in a single call). You SHOULD use default `limit` value of 1 first and only set a higher limit like 5 or 10 if you can't find the icon you need). Fallback to `get_all_icons` if nothing is found). This tool searches through component names, icon names, keywords, categorization, type and usage to find the most relevant design icons.\n\n\tThe search will match against:\n\t- Icon component names (e.g., \"AddIcon\", \"DeleteIcon\", \"EditIcon\")\n\t- Icon keywords (descriptive terms associated with icons)\n\t- Icon categorization (e.g., \"single-purpose\", \"multi-purpose\", \"utility\")\n\t- Icon usage descriptions (usage guidelines for the icon)\n\n\tThe results include the icon's component name, package path, and usage guidelines.\n\n\tUsage pattern for found icons:\n\t```tsx\n\timport AddIcon from '@atlaskit/icon/core/add';\n\n\t// Usage in isolation\n\t<AddIcon label=\"Add\" size=\"small\" />\n\n\t// Usage with a button\n\timport Button from '@atlaskit/button/new';\n\t<Button iconAfter={AddIcon}>Create</Button>\n\t```\n\n\tYou SHOULD check proper usage (props, example usage, etc.) of the icon component using `get_component_details` tool before using this tool.\n\t",
|
|
33
|
+
annotations: {
|
|
34
|
+
title: 'Search ADS icons',
|
|
35
|
+
readOnlyHint: true,
|
|
36
|
+
destructiveHint: false,
|
|
37
|
+
idempotentHint: true,
|
|
38
|
+
openWorldHint: true
|
|
39
|
+
},
|
|
40
|
+
inputSchema: zodToJsonSchema(inputSchema)
|
|
41
|
+
};
|
|
42
|
+
var cleanQuery = function cleanQuery(query) {
|
|
43
|
+
return query.trim().toLowerCase().replace(/\s+/g, '');
|
|
44
|
+
};
|
|
45
|
+
export var searchIconsTool = /*#__PURE__*/function () {
|
|
46
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
|
|
47
|
+
var terms, _params$limit, limit, _params$exactName, exactName, searchTerms, exactNameMatches, fuse, results, matchedIcons;
|
|
48
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
49
|
+
while (1) switch (_context.prev = _context.next) {
|
|
50
|
+
case 0:
|
|
51
|
+
terms = params.terms, _params$limit = params.limit, limit = _params$limit === void 0 ? 1 : _params$limit, _params$exactName = params.exactName, exactName = _params$exactName === void 0 ? false : _params$exactName;
|
|
52
|
+
searchTerms = terms.filter(Boolean).map(cleanQuery);
|
|
53
|
+
if (!exactName) {
|
|
54
|
+
_context.next = 6;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
// for each search term, search for the exact match
|
|
58
|
+
exactNameMatches = searchTerms.map(function (term) {
|
|
59
|
+
return icons.find(function (icon) {
|
|
60
|
+
return icon.componentName.toLowerCase() === term.toLowerCase();
|
|
61
|
+
});
|
|
62
|
+
}).filter(Boolean);
|
|
63
|
+
if (!(exactNameMatches.length > 0)) {
|
|
64
|
+
_context.next = 6;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
return _context.abrupt("return", {
|
|
68
|
+
content: [{
|
|
69
|
+
type: 'text',
|
|
70
|
+
text: JSON.stringify(exactNameMatches)
|
|
71
|
+
}]
|
|
72
|
+
});
|
|
73
|
+
case 6:
|
|
74
|
+
// use Fuse.js to fuzzy-search through the icons
|
|
75
|
+
fuse = new Fuse(icons, {
|
|
76
|
+
keys: [{
|
|
77
|
+
name: 'componentName',
|
|
78
|
+
weight: 3
|
|
79
|
+
}, {
|
|
80
|
+
name: 'iconName',
|
|
81
|
+
weight: 3
|
|
82
|
+
}, {
|
|
83
|
+
name: 'keywords',
|
|
84
|
+
weight: 2
|
|
85
|
+
}, {
|
|
86
|
+
name: 'categorization',
|
|
87
|
+
weight: 1
|
|
88
|
+
}, {
|
|
89
|
+
name: 'type',
|
|
90
|
+
weight: 1
|
|
91
|
+
}, {
|
|
92
|
+
name: 'usage',
|
|
93
|
+
weight: 1
|
|
94
|
+
}],
|
|
95
|
+
threshold: 0.4
|
|
96
|
+
}); // every search term, search for the results
|
|
97
|
+
results = searchTerms.map(function (term) {
|
|
98
|
+
// always search exact match from the icons
|
|
99
|
+
var exactNameMatch = icons.find(function (icon) {
|
|
100
|
+
return icon.componentName.toLowerCase() === term.toLowerCase();
|
|
101
|
+
});
|
|
102
|
+
if (exactNameMatch) {
|
|
103
|
+
return [{
|
|
104
|
+
item: exactNameMatch
|
|
105
|
+
}];
|
|
106
|
+
}
|
|
107
|
+
return fuse.search(term).slice(0, limit);
|
|
108
|
+
}).flat();
|
|
109
|
+
matchedIcons = results.map(function (result) {
|
|
110
|
+
return {
|
|
111
|
+
componentName: result.item.componentName,
|
|
112
|
+
package: result.item.package,
|
|
113
|
+
usage: result.item.usage
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
return _context.abrupt("return", {
|
|
117
|
+
content: [{
|
|
118
|
+
type: 'text',
|
|
119
|
+
text: JSON.stringify(matchedIcons)
|
|
120
|
+
}]
|
|
121
|
+
});
|
|
122
|
+
case 10:
|
|
123
|
+
case "end":
|
|
124
|
+
return _context.stop();
|
|
125
|
+
}
|
|
126
|
+
}, _callee);
|
|
127
|
+
}));
|
|
128
|
+
return function searchIconsTool(_x) {
|
|
129
|
+
return _ref3.apply(this, arguments);
|
|
130
|
+
};
|
|
131
|
+
}();
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import Fuse from 'fuse.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
6
|
+
import { tokens } from '@atlaskit/tokens/token-metadata';
|
|
7
|
+
var inputSchema = z.object({
|
|
8
|
+
terms: z.array(z.string()).describe('Search term(s) to find tokens by name or description'),
|
|
9
|
+
limit: z.number().optional().default(1).describe('Maximum number of results per term to return (default: 1)'),
|
|
10
|
+
exactName: z.boolean().optional().default(false).describe('Whether to search for exact match only for the token name')
|
|
11
|
+
});
|
|
12
|
+
var cleanQuery = function cleanQuery(query) {
|
|
13
|
+
return query.trim().toLowerCase().replace(/\s+/g, '');
|
|
14
|
+
};
|
|
15
|
+
export var listSearchTokensTool = {
|
|
16
|
+
name: 'search_tokens',
|
|
17
|
+
description: "You SHOULD Search for Atlassian Design System tokens based on multiple query strings (if there's multiple candidates of token names, descriptions or example values, you SHOULD pass them in a single call). You SHOULD use default `limit` value of 1 first and only set a higher limit like 5 or 10 if you can't find the token you need). Fallback to `get_all_tokens` if nothing is found). This tool searches through token names, descriptions, and example values to find the most relevant design tokens.\n\nThe search will match against:\n- Token names (e.g., \"color.text\", \"space.100\", \"border.radius\")\n- Token descriptions\n- Token example values (eg. \"#2898BD\" -> \"color.icon.accent.teal\")\n\nThe results include the token's name and example value.\n\nUsage pattern for found tokens:\n```tsx\nimport { token } from '@atlaskit/tokens';\n\nconst styles = css({\ncolor: token('color.text'),\npadding: token('space.100'),\nborderRadius: token('border.radius'),\n});\n```\n",
|
|
18
|
+
annotations: {
|
|
19
|
+
title: 'Search ADS tokens',
|
|
20
|
+
readOnlyHint: true,
|
|
21
|
+
destructiveHint: false,
|
|
22
|
+
idempotentHint: true,
|
|
23
|
+
openWorldHint: true
|
|
24
|
+
},
|
|
25
|
+
inputSchema: zodToJsonSchema(inputSchema)
|
|
26
|
+
};
|
|
27
|
+
export var searchTokensTool = /*#__PURE__*/function () {
|
|
28
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
|
|
29
|
+
var terms, _params$limit, limit, _params$exactName, exactName, searchTerms, exactNameMatches, fuse, results, matchedTokens;
|
|
30
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
31
|
+
while (1) switch (_context.prev = _context.next) {
|
|
32
|
+
case 0:
|
|
33
|
+
terms = params.terms, _params$limit = params.limit, limit = _params$limit === void 0 ? 1 : _params$limit, _params$exactName = params.exactName, exactName = _params$exactName === void 0 ? false : _params$exactName;
|
|
34
|
+
searchTerms = terms.filter(Boolean).map(cleanQuery);
|
|
35
|
+
if (!exactName) {
|
|
36
|
+
_context.next = 6;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
// for each search term, search for the exact match
|
|
40
|
+
exactNameMatches = searchTerms.map(function (term) {
|
|
41
|
+
return tokens.find(function (token) {
|
|
42
|
+
return token.name.toLowerCase() === term.toLowerCase();
|
|
43
|
+
});
|
|
44
|
+
}).filter(Boolean);
|
|
45
|
+
if (!(exactNameMatches.length > 0)) {
|
|
46
|
+
_context.next = 6;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
return _context.abrupt("return", {
|
|
50
|
+
content: [{
|
|
51
|
+
type: 'text',
|
|
52
|
+
text: JSON.stringify(exactNameMatches.map(function (token) {
|
|
53
|
+
return {
|
|
54
|
+
name: token.name,
|
|
55
|
+
exampleValue: token.exampleValue
|
|
56
|
+
};
|
|
57
|
+
}))
|
|
58
|
+
}]
|
|
59
|
+
});
|
|
60
|
+
case 6:
|
|
61
|
+
// use Fuse.js to fuzzy-search for the tokens
|
|
62
|
+
fuse = new Fuse(tokens, {
|
|
63
|
+
keys: [{
|
|
64
|
+
name: 'name',
|
|
65
|
+
weight: 3
|
|
66
|
+
}, {
|
|
67
|
+
name: 'description',
|
|
68
|
+
weight: 2
|
|
69
|
+
}, {
|
|
70
|
+
name: 'exampleValue',
|
|
71
|
+
weight: 1
|
|
72
|
+
}],
|
|
73
|
+
threshold: 0.4
|
|
74
|
+
});
|
|
75
|
+
results = searchTerms.map(function (term) {
|
|
76
|
+
return fuse.search(term).slice(0, limit);
|
|
77
|
+
}).flat();
|
|
78
|
+
matchedTokens = results.map(function (result) {
|
|
79
|
+
return {
|
|
80
|
+
name: result.item.name,
|
|
81
|
+
exampleValue: result.item.exampleValue
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
return _context.abrupt("return", {
|
|
85
|
+
content: [{
|
|
86
|
+
type: 'text',
|
|
87
|
+
text: JSON.stringify(matchedTokens)
|
|
88
|
+
}]
|
|
89
|
+
});
|
|
90
|
+
case 10:
|
|
91
|
+
case "end":
|
|
92
|
+
return _context.stop();
|
|
93
|
+
}
|
|
94
|
+
}, _callee);
|
|
95
|
+
}));
|
|
96
|
+
return function searchTokensTool(_x) {
|
|
97
|
+
return _ref.apply(this, arguments);
|
|
98
|
+
};
|
|
99
|
+
}();
|
|
@@ -248,7 +248,7 @@ export var accessibilityFixes = {
|
|
|
248
248
|
description: 'Provide table caption for complex tables',
|
|
249
249
|
before: "<table>\n <thead>...</thead>\n</table>",
|
|
250
250
|
after: "<table>\n <caption>User account information by department</caption>\n <thead>...</thead>\n</table>",
|
|
251
|
-
explanation:
|
|
251
|
+
explanation: "Captions provide context about the table's purpose and structure."
|
|
252
252
|
}],
|
|
253
253
|
bestPractices: ['Use th elements for headers', 'Add scope attributes (col, row)', 'Provide table captions when helpful', 'Use thead, tbody, tfoot for structure']
|
|
254
254
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const instructions = "\nYou are an expert in the Atlassian Design System (aka ADS). You are able to answer questions about the design system and provide guidance on what offerings to use when building user interfaces.\n\nYou have special expertise in accessibility and can help ensure that interfaces built with ADS components are accessible to all users. You can analyze code for accessibility violations, provide specific fix suggestions, and offer guidance on accessibility best practices.\n\nYou are able to use the provided tools to help answer your questions, but may also access https://atlassian.design/llms.txt, https://atlassian.design/llms-a11y.txt, or https://atlassian.design/ directly for deeper research and information.\n\nAccessibility Tools Available:\n- analyze_accessibility: Analyze React component code for accessibility violations\n- get_accessibility_guidelines: Get specific accessibility guidelines and best practices\n- suggest_accessibility_fixes: Get specific fix suggestions for accessibility violations\n";
|
|
1
|
+
export declare const instructions = "\nYou are an expert in the Atlassian Design System (aka ADS). You are able to answer questions about the design system and provide guidance on what offerings to use when building user interfaces.\n\nYou have special expertise in accessibility and can help ensure that interfaces built with ADS components are accessible to all users. You can analyze code for accessibility violations, provide specific fix suggestions, and offer guidance on accessibility best practices.\n\nYou are able to use the provided tools to help answer your questions, but may also access https://atlassian.design/llms.txt, https://atlassian.design/llms-a11y.txt, or https://atlassian.design/ directly for deeper research and information.\n\nAccessibility Tools Available:\n- analyze_accessibility: Analyze React component code for accessibility violations\n- get_accessibility_guidelines: Get specific accessibility guidelines and best practices\n- suggest_accessibility_fixes: Get specific fix suggestions for accessibility violations\n- get_all_tokens: Get all tokens and their example values\n- search_tokens: Search for token(s) and their example value(s)\n- get_all_icons: Get all icons and their usage\n- search_icons: Search for icon(s) and their usage\n";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const listGetAllIconsTool: {
|
|
2
2
|
name: string;
|
|
3
3
|
description: string;
|
|
4
4
|
annotations: {
|
|
@@ -15,7 +15,7 @@ export declare const listGetTokensTool: {
|
|
|
15
15
|
} | undefined;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const getAllIconsTool: () => Promise<{
|
|
19
19
|
content: {
|
|
20
20
|
type: string;
|
|
21
21
|
text: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const listGetAllTokensTool: {
|
|
2
2
|
name: string;
|
|
3
3
|
description: string;
|
|
4
4
|
annotations: {
|
|
@@ -15,7 +15,7 @@ export declare const listGetTokensTool: {
|
|
|
15
15
|
} | undefined;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const getAllTokensTool: () => Promise<{
|
|
19
19
|
content: {
|
|
20
20
|
type: string;
|
|
21
21
|
text: string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const inputSchema: z.ZodObject<{
|
|
3
|
+
terms: z.ZodArray<z.ZodString, "many">;
|
|
4
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
5
|
+
exactName: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
terms: string[];
|
|
8
|
+
limit: number;
|
|
9
|
+
exactName: boolean;
|
|
10
|
+
}, {
|
|
11
|
+
terms: string[];
|
|
12
|
+
limit?: number | undefined;
|
|
13
|
+
exactName?: boolean | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const listSearchIconsTool: {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
annotations: {
|
|
19
|
+
title: string;
|
|
20
|
+
readOnlyHint: boolean;
|
|
21
|
+
destructiveHint: boolean;
|
|
22
|
+
idempotentHint: boolean;
|
|
23
|
+
openWorldHint: boolean;
|
|
24
|
+
};
|
|
25
|
+
inputSchema: import("zod-to-json-schema").JsonSchema7Type & {
|
|
26
|
+
$schema?: string | undefined;
|
|
27
|
+
definitions?: {
|
|
28
|
+
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
29
|
+
} | undefined;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare const searchIconsTool: (params: z.infer<typeof inputSchema>) => Promise<{
|
|
33
|
+
content: {
|
|
34
|
+
type: string;
|
|
35
|
+
text: string;
|
|
36
|
+
}[];
|
|
37
|
+
}>;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const inputSchema: z.ZodObject<{
|
|
3
|
+
terms: z.ZodArray<z.ZodString, "many">;
|
|
4
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
5
|
+
exactName: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
terms: string[];
|
|
8
|
+
limit: number;
|
|
9
|
+
exactName: boolean;
|
|
10
|
+
}, {
|
|
11
|
+
terms: string[];
|
|
12
|
+
limit?: number | undefined;
|
|
13
|
+
exactName?: boolean | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const listSearchTokensTool: {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
annotations: {
|
|
19
|
+
title: string;
|
|
20
|
+
readOnlyHint: boolean;
|
|
21
|
+
destructiveHint: boolean;
|
|
22
|
+
idempotentHint: boolean;
|
|
23
|
+
openWorldHint: boolean;
|
|
24
|
+
};
|
|
25
|
+
inputSchema: import("zod-to-json-schema").JsonSchema7Type & {
|
|
26
|
+
$schema?: string | undefined;
|
|
27
|
+
definitions?: {
|
|
28
|
+
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
29
|
+
} | undefined;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare const searchTokensTool: (params: z.infer<typeof inputSchema>) => Promise<{
|
|
33
|
+
content: {
|
|
34
|
+
type: string;
|
|
35
|
+
text: string;
|
|
36
|
+
}[];
|
|
37
|
+
}>;
|
|
38
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const instructions = "\nYou are an expert in the Atlassian Design System (aka ADS). You are able to answer questions about the design system and provide guidance on what offerings to use when building user interfaces.\n\nYou have special expertise in accessibility and can help ensure that interfaces built with ADS components are accessible to all users. You can analyze code for accessibility violations, provide specific fix suggestions, and offer guidance on accessibility best practices.\n\nYou are able to use the provided tools to help answer your questions, but may also access https://atlassian.design/llms.txt, https://atlassian.design/llms-a11y.txt, or https://atlassian.design/ directly for deeper research and information.\n\nAccessibility Tools Available:\n- analyze_accessibility: Analyze React component code for accessibility violations\n- get_accessibility_guidelines: Get specific accessibility guidelines and best practices\n- suggest_accessibility_fixes: Get specific fix suggestions for accessibility violations\n";
|
|
1
|
+
export declare const instructions = "\nYou are an expert in the Atlassian Design System (aka ADS). You are able to answer questions about the design system and provide guidance on what offerings to use when building user interfaces.\n\nYou have special expertise in accessibility and can help ensure that interfaces built with ADS components are accessible to all users. You can analyze code for accessibility violations, provide specific fix suggestions, and offer guidance on accessibility best practices.\n\nYou are able to use the provided tools to help answer your questions, but may also access https://atlassian.design/llms.txt, https://atlassian.design/llms-a11y.txt, or https://atlassian.design/ directly for deeper research and information.\n\nAccessibility Tools Available:\n- analyze_accessibility: Analyze React component code for accessibility violations\n- get_accessibility_guidelines: Get specific accessibility guidelines and best practices\n- suggest_accessibility_fixes: Get specific fix suggestions for accessibility violations\n- get_all_tokens: Get all tokens and their example values\n- search_tokens: Search for token(s) and their example value(s)\n- get_all_icons: Get all icons and their usage\n- search_icons: Search for icon(s) and their usage\n";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const listGetAllIconsTool: {
|
|
2
2
|
name: string;
|
|
3
3
|
description: string;
|
|
4
4
|
annotations: {
|
|
@@ -15,7 +15,7 @@ export declare const listGetIconsTool: {
|
|
|
15
15
|
} | undefined;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const getAllIconsTool: () => Promise<{
|
|
19
19
|
content: {
|
|
20
20
|
type: string;
|
|
21
21
|
text: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const listGetAllTokensTool: {
|
|
2
2
|
name: string;
|
|
3
3
|
description: string;
|
|
4
4
|
annotations: {
|
|
@@ -15,7 +15,7 @@ export declare const listGetIconsTool: {
|
|
|
15
15
|
} | undefined;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const getAllTokensTool: () => Promise<{
|
|
19
19
|
content: {
|
|
20
20
|
type: string;
|
|
21
21
|
text: string;
|