@atlaskit/ads-mcp 0.20.0 → 0.20.2

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 (45) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/helpers/analytics.js +17 -16
  3. package/dist/cjs/helpers/compute-multi-term-fuse-allocation.js +21 -0
  4. package/dist/cjs/helpers/config-path.js +13 -0
  5. package/dist/cjs/helpers/fuse-multi-term.js +8 -23
  6. package/dist/cjs/helpers/staff-id.js +9 -0
  7. package/dist/cjs/tools/get-all-components/components.codegen.js +2 -2
  8. package/dist/cjs/tools/migration-guides/index.js +2 -1
  9. package/dist/cjs/tools/migration-guides/migration-registry.js +10 -0
  10. package/dist/cjs/tools/migration-guides/registry.js +10 -8
  11. package/dist/es2019/helpers/analytics.js +7 -13
  12. package/dist/es2019/helpers/compute-multi-term-fuse-allocation.js +15 -0
  13. package/dist/es2019/helpers/config-path.js +7 -0
  14. package/dist/es2019/helpers/fuse-multi-term.js +3 -22
  15. package/dist/es2019/helpers/staff-id.js +4 -0
  16. package/dist/es2019/tools/get-all-components/components.codegen.js +2 -2
  17. package/dist/es2019/tools/migration-guides/index.js +2 -1
  18. package/dist/es2019/tools/migration-guides/migration-registry.js +7 -0
  19. package/dist/es2019/tools/migration-guides/registry.js +3 -9
  20. package/dist/esm/helpers/analytics.js +7 -13
  21. package/dist/esm/helpers/compute-multi-term-fuse-allocation.js +15 -0
  22. package/dist/esm/helpers/config-path.js +7 -0
  23. package/dist/esm/helpers/fuse-multi-term.js +3 -22
  24. package/dist/esm/helpers/staff-id.js +4 -0
  25. package/dist/esm/tools/get-all-components/components.codegen.js +2 -2
  26. package/dist/esm/tools/migration-guides/index.js +2 -1
  27. package/dist/esm/tools/migration-guides/migration-registry.js +3 -0
  28. package/dist/esm/tools/migration-guides/registry.js +3 -5
  29. package/dist/types/helpers/analytics.d.ts +2 -9
  30. package/dist/types/helpers/compute-multi-term-fuse-allocation.d.ts +14 -0
  31. package/dist/types/helpers/config-path.d.ts +7 -0
  32. package/dist/types/helpers/fuse-multi-term.d.ts +1 -20
  33. package/dist/types/helpers/staff-id.d.ts +1 -0
  34. package/dist/types/tools/get-all-components/components.codegen.d.ts +1 -1
  35. package/dist/types/tools/migration-guides/migration-registry.d.ts +2 -0
  36. package/dist/types/tools/migration-guides/registry.d.ts +1 -2
  37. package/dist/types-ts4.5/helpers/analytics.d.ts +2 -9
  38. package/dist/types-ts4.5/helpers/compute-multi-term-fuse-allocation.d.ts +14 -0
  39. package/dist/types-ts4.5/helpers/config-path.d.ts +7 -0
  40. package/dist/types-ts4.5/helpers/fuse-multi-term.d.ts +1 -20
  41. package/dist/types-ts4.5/helpers/staff-id.d.ts +1 -0
  42. package/dist/types-ts4.5/tools/get-all-components/components.codegen.d.ts +1 -1
  43. package/dist/types-ts4.5/tools/migration-guides/migration-registry.d.ts +2 -0
  44. package/dist/types-ts4.5/tools/migration-guides/registry.d.ts +1 -2
  45. package/package.json +4 -4
@@ -9,6 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _zod = require("zod");
11
11
  var _helpers = require("../../helpers");
12
+ var _migrationRegistry = require("./migration-registry");
12
13
  var _registry = require("./registry");
13
14
  /* eslint-disable-next-line import/extensions -- MCP SDK requires .js extensions for ESM imports */
14
15
 
@@ -38,7 +39,7 @@ var migrationGuidesTool = exports.migrationGuidesTool = /*#__PURE__*/function ()
38
39
  while (1) switch (_context.prev = _context.next) {
39
40
  case 0:
40
41
  migration = params.migration;
41
- guide = _registry.migrationRegistry[migration];
42
+ guide = _migrationRegistry.migrationRegistry[migration];
42
43
  if (guide) {
43
44
  _context.next = 4;
44
45
  break;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.migrationRegistry = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _onboardingToSpotlight = require("./migrations/onboarding-to-spotlight");
10
+ var migrationRegistry = exports.migrationRegistry = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _onboardingToSpotlight.onboardingJiraSpotlight.id, _onboardingToSpotlight.onboardingJiraSpotlight), _onboardingToSpotlight.onboardingSingleStep.id, _onboardingToSpotlight.onboardingSingleStep), _onboardingToSpotlight.onboardingMultiStep.id, _onboardingToSpotlight.onboardingMultiStep), _onboardingToSpotlight.onboardingWithMotion.id, _onboardingToSpotlight.onboardingWithMotion);
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports.migrationRegistry = exports.getAvailableMigrationsDescription = exports.getAvailableMigrationIds = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _onboardingToSpotlight = require("./migrations/onboarding-to-spotlight");
6
+ exports.getAvailableMigrationsDescription = exports.getAvailableMigrationIds = void 0;
7
+ Object.defineProperty(exports, "migrationRegistry", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _migrationRegistry.migrationRegistry;
11
+ }
12
+ });
13
+ var _migrationRegistry = require("./migration-registry");
10
14
  /**
11
15
  * Migration registry - central place to register all available migrations
12
16
  *
@@ -16,13 +20,11 @@ var _onboardingToSpotlight = require("./migrations/onboarding-to-spotlight");
16
20
  * 3. The tool will automatically include it in the available options
17
21
  */
18
22
 
19
- var migrationRegistry = exports.migrationRegistry = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _onboardingToSpotlight.onboardingJiraSpotlight.id, _onboardingToSpotlight.onboardingJiraSpotlight), _onboardingToSpotlight.onboardingSingleStep.id, _onboardingToSpotlight.onboardingSingleStep), _onboardingToSpotlight.onboardingMultiStep.id, _onboardingToSpotlight.onboardingMultiStep), _onboardingToSpotlight.onboardingWithMotion.id, _onboardingToSpotlight.onboardingWithMotion);
20
-
21
23
  /**
22
24
  * Get all available migration IDs for use in the tool schema
23
25
  */
24
26
  var getAvailableMigrationIds = exports.getAvailableMigrationIds = function getAvailableMigrationIds() {
25
- return Object.keys(migrationRegistry);
27
+ return Object.keys(_migrationRegistry.migrationRegistry);
26
28
  };
27
29
 
28
30
  /**
@@ -30,7 +32,7 @@ var getAvailableMigrationIds = exports.getAvailableMigrationIds = function getAv
30
32
  * Useful for tool descriptions and help text
31
33
  */
32
34
  var getAvailableMigrationsDescription = exports.getAvailableMigrationsDescription = function getAvailableMigrationsDescription() {
33
- return Object.values(migrationRegistry).map(function (m) {
35
+ return Object.values(_migrationRegistry.migrationRegistry).map(function (m) {
34
36
  return "- \"".concat(m.id, "\": ").concat(m.description);
35
37
  });
36
38
  };
@@ -1,12 +1,12 @@
1
1
  /* eslint-disable no-console */
2
- import { userInfo } from 'node:os';
2
+
3
+ import { configPath } from './config-path';
4
+ import { staffId } from './staff-id';
5
+
3
6
  // 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
4
7
  const pkgJson = require('@atlaskit/ads-mcp/package.json');
5
8
  const version = pkgJson.version || '0.0.0-unknown';
6
9
 
7
- // Get staff ID using the same logic as @repo-feature-flags-statsig
8
- export const staffId = process.env.STAFF_ID || process.env.USER || process.env.ATLAS_USER || userInfo().username;
9
-
10
10
  /**
11
11
  * This is a user-passed value via environment to define what agent we may be running in.
12
12
  * This could be anything, do not rely on it!
@@ -15,14 +15,6 @@ export const staffId = process.env.STAFF_ID || process.env.USER || process.env.A
15
15
 
16
16
  export const agent = process.env.ADSMCP_AGENT || 'unknown';
17
17
 
18
- /**
19
- * The path to the MCP config file that is being used to run the MCP server
20
- * e.g. 'mcp.json', 'jira/.cursor/mcp.json', 'platform/.vscode/mcp.json' or 'unknown'
21
- * This could be anything, do not rely on it!
22
- * @default `'unknown'`
23
- */
24
- export const configPath = process.env.ADSMCP_CONFIG_PATH || 'unknown';
25
-
26
18
  // Check if user has opted out of analytics
27
19
  const isAnalyticsOptedOut = String(process.env.ADSMCP_ANALYTICS_OPT_OUT) === 'true' || String(process.env.ADSMCP_ANALYTICS_OPT_OUT) === '1';
28
20
 
@@ -85,4 +77,6 @@ export function sendOperationalEvent({
85
77
  // Silently fail to avoid disrupting the main functionality
86
78
  console.error('Error sending operational event to analytics');
87
79
  }
88
- }
80
+ }
81
+ export { staffId } from './staff-id';
82
+ export { configPath } from './config-path';
@@ -0,0 +1,15 @@
1
+ export function computeMultiTermFuseAllocation(limit, termCount) {
2
+ if (termCount <= 1) return {
3
+ perTermTake: 1,
4
+ combinedTake: 0,
5
+ totalTake: 1
6
+ };
7
+ const perTermTake = Math.max(Math.round(limit / termCount), 1);
8
+ const combinedTake = Math.max(limit * termCount - termCount * perTermTake, 1);
9
+ const totalTake = Math.max(perTermTake * termCount + combinedTake, 1);
10
+ return {
11
+ perTermTake,
12
+ combinedTake,
13
+ totalTake
14
+ };
15
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The path to the MCP config file that is being used to run the MCP server
3
+ * e.g. 'mcp.json', 'jira/.cursor/mcp.json', 'platform/.vscode/mcp.json' or 'unknown'
4
+ * This could be anything, do not rely on it!
5
+ * @default `'unknown'`
6
+ */
7
+ export const configPath = process.env.ADSMCP_CONFIG_PATH || 'unknown';
@@ -1,24 +1,4 @@
1
- /**
2
- * Allocation for multi-query Fuse search: each term alone, plus one spaced combined query.
3
- *
4
- * `poolMax = limit * termCount`. From each term we take up to `perTermTake` hits; the rest of the
5
- * pool is filled from the spaced combined query.
6
- */
7
- export function computeMultiTermFuseAllocation(limit, termCount) {
8
- if (termCount <= 1) return {
9
- perTermTake: 1,
10
- combinedTake: 0,
11
- totalTake: 1
12
- };
13
- const perTermTake = Math.max(Math.round(limit / termCount), 1);
14
- const combinedTake = Math.max(limit * termCount - termCount * perTermTake, 1);
15
- const totalTake = Math.max(perTermTake * termCount + combinedTake, 1);
16
- return {
17
- perTermTake,
18
- combinedTake,
19
- totalTake
20
- };
21
- }
1
+ import { computeMultiTermFuseAllocation } from './compute-multi-term-fuse-allocation';
22
2
  /**
23
3
  * Runs `search` for each term (top `perTermTake`) and for `terms.join(' ')` (top `combinedTake`),
24
4
  * merges pools, sorts globally by Fuse score, then returns the first `limit` **distinct** keys
@@ -95,4 +75,5 @@ function takeFirstUniqueKeys(sortedHits, limit) {
95
75
  }
96
76
  }
97
77
  return out;
98
- }
78
+ }
79
+ export { computeMultiTermFuseAllocation } from './compute-multi-term-fuse-allocation';
@@ -0,0 +1,4 @@
1
+ import { userInfo } from 'node:os';
2
+
3
+ // Get staff ID using the same logic as @repo-feature-flags-statsig
4
+ export const staffId = process.env.STAFF_ID || process.env.USER || process.env.ATLAS_USER || userInfo().username;