@atlaskit/ads-mcp 0.7.2 → 0.8.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +63 -2
  3. package/dist/cjs/helpers/analytics.js +98 -0
  4. package/dist/cjs/index.js +142 -28
  5. package/dist/cjs/tools/analyze-a11y/index.js +38 -38
  6. package/dist/cjs/tools/get-a11y-guidelines/index.js +4 -4
  7. package/dist/cjs/tools/get-all-icons/index.js +1 -1
  8. package/dist/cjs/tools/get-all-tokens/index.js +1 -1
  9. package/dist/cjs/tools/get-components/components.js +2 -2
  10. package/dist/cjs/tools/get-components/index.js +1 -1
  11. package/dist/cjs/tools/plan/index.js +6 -6
  12. package/dist/cjs/tools/search-components/index.js +9 -9
  13. package/dist/cjs/tools/search-icons/index.js +9 -9
  14. package/dist/cjs/tools/search-tokens/index.js +5 -5
  15. package/dist/cjs/tools/suggest-a11y-fixes/index.js +4 -4
  16. package/dist/es2019/helpers/analytics.js +88 -0
  17. package/dist/es2019/index.js +118 -15
  18. package/dist/es2019/tools/get-components/components.js +2 -2
  19. package/dist/esm/helpers/analytics.js +90 -0
  20. package/dist/esm/index.js +143 -29
  21. package/dist/esm/tools/analyze-a11y/index.js +38 -38
  22. package/dist/esm/tools/get-a11y-guidelines/index.js +4 -4
  23. package/dist/esm/tools/get-all-icons/index.js +1 -1
  24. package/dist/esm/tools/get-all-tokens/index.js +1 -1
  25. package/dist/esm/tools/get-components/components.js +2 -2
  26. package/dist/esm/tools/get-components/index.js +1 -1
  27. package/dist/esm/tools/plan/index.js +6 -6
  28. package/dist/esm/tools/search-components/index.js +9 -9
  29. package/dist/esm/tools/search-icons/index.js +9 -9
  30. package/dist/esm/tools/search-tokens/index.js +5 -5
  31. package/dist/esm/tools/suggest-a11y-fixes/index.js +4 -4
  32. package/dist/types/helpers/analytics.d.ts +28 -0
  33. package/dist/types/tools/get-components/components.d.ts +1 -1
  34. package/dist/types-ts4.5/helpers/analytics.d.ts +28 -0
  35. package/dist/types-ts4.5/tools/get-components/components.d.ts +1 -1
  36. package/package.json +4 -1
@@ -43,13 +43,13 @@ export var listSearchIconsTool = {
43
43
  export var searchIconsTool = /*#__PURE__*/function () {
44
44
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
45
45
  var terms, _params$limit, limit, _params$exactName, exactName, searchTerms, exactNameMatches, fuse, results, uniqueResults, matchedIcons;
46
- return _regeneratorRuntime.wrap(function _callee$(_context) {
46
+ return _regeneratorRuntime.wrap(function (_context) {
47
47
  while (1) switch (_context.prev = _context.next) {
48
48
  case 0:
49
49
  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;
50
50
  searchTerms = terms.filter(Boolean).map(cleanQuery);
51
51
  if (searchTerms.length) {
52
- _context.next = 4;
52
+ _context.next = 1;
53
53
  break;
54
54
  }
55
55
  return _context.abrupt("return", {
@@ -59,9 +59,9 @@ export var searchIconsTool = /*#__PURE__*/function () {
59
59
  text: "Error: Required parameter 'terms' is missing or empty"
60
60
  }]
61
61
  });
62
- case 4:
62
+ case 1:
63
63
  if (!exactName) {
64
- _context.next = 8;
64
+ _context.next = 2;
65
65
  break;
66
66
  }
67
67
  // for each search term, search for the exact match
@@ -71,7 +71,7 @@ export var searchIconsTool = /*#__PURE__*/function () {
71
71
  });
72
72
  }).filter(Boolean);
73
73
  if (!(exactNameMatches.length > 0)) {
74
- _context.next = 8;
74
+ _context.next = 2;
75
75
  break;
76
76
  }
77
77
  return _context.abrupt("return", {
@@ -80,7 +80,7 @@ export var searchIconsTool = /*#__PURE__*/function () {
80
80
  text: JSON.stringify(exactNameMatches)
81
81
  }]
82
82
  });
83
- case 8:
83
+ case 2:
84
84
  // use Fuse.js to fuzzy-search through the icons
85
85
  fuse = new Fuse(icons, {
86
86
  keys: [{
@@ -117,7 +117,7 @@ export var searchIconsTool = /*#__PURE__*/function () {
117
117
  return fuse.search(term).slice(0, limit);
118
118
  }).flat();
119
119
  if (results.length) {
120
- _context.next = 12;
120
+ _context.next = 3;
121
121
  break;
122
122
  }
123
123
  return _context.abrupt("return", {
@@ -129,7 +129,7 @@ export var searchIconsTool = /*#__PURE__*/function () {
129
129
  }).join(', '))
130
130
  }]
131
131
  });
132
- case 12:
132
+ case 3:
133
133
  // Remove duplicates based on componentName
134
134
  uniqueResults = results.filter(function (result, index, arr) {
135
135
  return arr.findIndex(function (r) {
@@ -149,7 +149,7 @@ export var searchIconsTool = /*#__PURE__*/function () {
149
149
  text: JSON.stringify(matchedIcons)
150
150
  }]
151
151
  });
152
- case 15:
152
+ case 4:
153
153
  case "end":
154
154
  return _context.stop();
155
155
  }
@@ -25,13 +25,13 @@ export var listSearchTokensTool = {
25
25
  export var searchTokensTool = /*#__PURE__*/function () {
26
26
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
27
27
  var terms, _params$limit, limit, _params$exactName, exactName, searchTerms, exactNameMatches, fuse, results, uniqueResults, matchedTokens;
28
- return _regeneratorRuntime.wrap(function _callee$(_context) {
28
+ return _regeneratorRuntime.wrap(function (_context) {
29
29
  while (1) switch (_context.prev = _context.next) {
30
30
  case 0:
31
31
  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;
32
32
  searchTerms = terms.filter(Boolean).map(cleanQuery);
33
33
  if (!exactName) {
34
- _context.next = 6;
34
+ _context.next = 1;
35
35
  break;
36
36
  }
37
37
  // for each search term, search for the exact match
@@ -41,7 +41,7 @@ export var searchTokensTool = /*#__PURE__*/function () {
41
41
  });
42
42
  }).filter(Boolean);
43
43
  if (!(exactNameMatches.length > 0)) {
44
- _context.next = 6;
44
+ _context.next = 1;
45
45
  break;
46
46
  }
47
47
  return _context.abrupt("return", {
@@ -55,7 +55,7 @@ export var searchTokensTool = /*#__PURE__*/function () {
55
55
  }))
56
56
  }]
57
57
  });
58
- case 6:
58
+ case 1:
59
59
  // use Fuse.js to fuzzy-search for the tokens
60
60
  fuse = new Fuse(tokens, {
61
61
  keys: [{
@@ -90,7 +90,7 @@ export var searchTokensTool = /*#__PURE__*/function () {
90
90
  text: JSON.stringify(matchedTokens)
91
91
  }]
92
92
  });
93
- case 11:
93
+ case 2:
94
94
  case "end":
95
95
  return _context.stop();
96
96
  }
@@ -111,13 +111,13 @@ function findBestMatchingFix(violation) {
111
111
  export var suggestA11yFixesTool = /*#__PURE__*/function () {
112
112
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
113
113
  var violation, component, context, match, _match, key, fix;
114
- return _regeneratorRuntime.wrap(function _callee$(_context) {
114
+ return _regeneratorRuntime.wrap(function (_context) {
115
115
  while (1) switch (_context.prev = _context.next) {
116
116
  case 0:
117
117
  violation = params.violation, component = params.component, context = params.context; // Use improved matching logic
118
118
  match = findBestMatchingFix(violation);
119
119
  if (!match) {
120
- _context.next = 5;
120
+ _context.next = 1;
121
121
  break;
122
122
  }
123
123
  _match = _slicedToArray(match, 2), key = _match[0], fix = _match[1];
@@ -135,7 +135,7 @@ export var suggestA11yFixesTool = /*#__PURE__*/function () {
135
135
  }), null, 2)
136
136
  }]
137
137
  });
138
- case 5:
138
+ case 1:
139
139
  return _context.abrupt("return", {
140
140
  content: [{
141
141
  type: 'text',
@@ -166,7 +166,7 @@ export var suggestA11yFixesTool = /*#__PURE__*/function () {
166
166
  }, null, 2)
167
167
  }]
168
168
  });
169
- case 6:
169
+ case 2:
170
170
  case "end":
171
171
  return _context.stop();
172
172
  }
@@ -0,0 +1,28 @@
1
+ export declare const staffId: string;
2
+ /**
3
+ * This is a user-passed value via environment to define what agent we may be running in.
4
+ * This could be anything, do not rely on it!
5
+ * @default `'unknown'`
6
+ */
7
+ type AGENT = 'cursor' | 'vscode' | 'rovodev' | 'codelassian' | string;
8
+ export declare const agent: AGENT;
9
+ /**
10
+ * The path to the MCP config file that is being used to run the MCP server
11
+ * e.g. 'mcp.json', 'jira/.cursor/mcp.json', 'platform/.vscode/mcp.json' or 'unknown'
12
+ * This could be anything, do not rely on it!
13
+ * @default `'unknown'`
14
+ */
15
+ export declare const configPath: string;
16
+ interface OperationalEventOptions {
17
+ action: string;
18
+ actionSubject: string;
19
+ actionSubjectId?: string;
20
+ attributes?: Record<string, any>;
21
+ }
22
+ /**
23
+ * Send an operational event to analytics
24
+ * Wraps the analytics client and handles errors gracefully
25
+ * If analytics client is not available, this function is a no-op
26
+ */
27
+ export declare function sendOperationalEvent({ action, actionSubject, actionSubjectId, attributes, }: OperationalEventOptions): void;
28
+ export {};
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates TypeScript components data for AI tooling from offerings.json files
5
5
  *
6
- * @codegen <<SignedSource::d39d38cf9fe44e75308cd943349942d1>>
6
+ * @codegen <<SignedSource::1792e8b918fbdc85769f6ddf38970c58>>
7
7
  * @codegenCommand yarn workspace @af/ads-ai-tooling codegen:prototyping
8
8
  */
9
9
  import type { Component } from './types';
@@ -0,0 +1,28 @@
1
+ export declare const staffId: string;
2
+ /**
3
+ * This is a user-passed value via environment to define what agent we may be running in.
4
+ * This could be anything, do not rely on it!
5
+ * @default `'unknown'`
6
+ */
7
+ type AGENT = 'cursor' | 'vscode' | 'rovodev' | 'codelassian' | string;
8
+ export declare const agent: AGENT;
9
+ /**
10
+ * The path to the MCP config file that is being used to run the MCP server
11
+ * e.g. 'mcp.json', 'jira/.cursor/mcp.json', 'platform/.vscode/mcp.json' or 'unknown'
12
+ * This could be anything, do not rely on it!
13
+ * @default `'unknown'`
14
+ */
15
+ export declare const configPath: string;
16
+ interface OperationalEventOptions {
17
+ action: string;
18
+ actionSubject: string;
19
+ actionSubjectId?: string;
20
+ attributes?: Record<string, any>;
21
+ }
22
+ /**
23
+ * Send an operational event to analytics
24
+ * Wraps the analytics client and handles errors gracefully
25
+ * If analytics client is not available, this function is a no-op
26
+ */
27
+ export declare function sendOperationalEvent({ action, actionSubject, actionSubjectId, attributes, }: OperationalEventOptions): void;
28
+ export {};
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates TypeScript components data for AI tooling from offerings.json files
5
5
  *
6
- * @codegen <<SignedSource::d39d38cf9fe44e75308cd943349942d1>>
6
+ * @codegen <<SignedSource::1792e8b918fbdc85769f6ddf38970c58>>
7
7
  * @codegenCommand yarn workspace @af/ads-ai-tooling codegen:prototyping
8
8
  */
9
9
  import type { Component } from './types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/ads-mcp",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "description": "The official Atlassian Design System MCP server to develop apps and user interfaces matching the Atlassian style.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -40,6 +40,9 @@
40
40
  "zod": "^3.23.8",
41
41
  "zod-to-json-schema": "^3.24.5"
42
42
  },
43
+ "optionalDependencies": {
44
+ "@atlassiansox/analytics-node-client": "^4.0.0"
45
+ },
43
46
  "devDependencies": {
44
47
  "ts-node": "^10.9.1"
45
48
  }