@atlaskit/ads-cli 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 +15 -0
- package/README.md +42 -3
- package/dist/cjs/atlas-cli.js +62 -0
- package/dist/cjs/commands/import-tool-handler.js +86 -14
- package/dist/es2019/atlas-cli.js +27 -0
- package/dist/es2019/commands/import-tool-handler.js +35 -2
- package/dist/esm/atlas-cli.js +56 -0
- package/dist/esm/commands/import-tool-handler.js +64 -6
- package/dist/types/atlas-cli.d.ts +9 -0
- package/package.json +16 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/ads-cli
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`ccba0c0605171`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ccba0c0605171) -
|
|
8
|
+
Add an Atlas CLI distribution (internal to Atlassian) with bundle-safe ADS MCP loading and Statlas
|
|
9
|
+
release packaging.
|
|
10
|
+
|
|
11
|
+
After the plugin is published, internal staff can run the ADS CLI with `atlas ads` instead of
|
|
12
|
+
`npx @atlaskit/ads-cli`. For example:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
atlas ads search avatar
|
|
16
|
+
```
|
|
17
|
+
|
|
3
18
|
## 0.3.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -150,6 +150,45 @@ skill are all thin surfaces over the **same** `@atlaskit/ads-mcp/tools/*` query
|
|
|
150
150
|
`ComponentMcpPayload[]` dataset. Adding or improving a tool in `ads-mcp` is automatically reflected
|
|
151
151
|
here.
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
The `--json` envelope is shared unchanged by the npm and Atlas distributions.
|
|
154
|
+
|
|
155
|
+
## Atlas CLI distribution
|
|
156
|
+
|
|
157
|
+
The same command surface is available as `atlas ads`. Its entrypoint delegates directly to `run()`,
|
|
158
|
+
so npm and Atlas share command parsing, output, and exit codes.
|
|
159
|
+
|
|
160
|
+
Build the self-contained JavaScript bundle from the `platform/` directory:
|
|
161
|
+
|
|
162
|
+
```sh
|
|
163
|
+
afm workspace @atlaskit/ads-cli build:atlas
|
|
164
|
+
node packages/design-system/ads-cli/build/atlas/ads-cli.js search button
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
The `.atlas-plugin` descriptor declares the `ads` plugin and the `atlas-cli-plugin-ads` Statlas
|
|
168
|
+
namespace. The checked-in `manifest.toml` is a seed for the first release. After the first release,
|
|
169
|
+
every upload fetches the remote Statlas manifest so its release history remains canonical.
|
|
170
|
+
|
|
171
|
+
Prepare an Atlas-shaped release locally:
|
|
172
|
+
|
|
173
|
+
```sh
|
|
174
|
+
VERSION=local-$(git rev-parse --short HEAD) \
|
|
175
|
+
afm workspace @atlaskit/ads-cli release:atlas:prepare
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
This builds 5 variants under `build/releases/$VERSION`, creates each archive and checksum,
|
|
179
|
+
smoke-tests the Linux AMD64 executable when running on Linux AMD64, and adds the release to the
|
|
180
|
+
`alpha` channel in the working manifest.
|
|
181
|
+
|
|
182
|
+
The `ads-cli-build-and-upload-to-statlas` custom pipeline runs the tests and typecheck, prepares the
|
|
183
|
+
release, uploads all artifacts, then publishes the manifest. Run it from `master`. Set
|
|
184
|
+
`ALLOW_MISSING_REMOTE_MANIFEST` to `true` only for the first release; later runs must fetch the
|
|
185
|
+
remote release history successfully.
|
|
186
|
+
|
|
187
|
+
After validating an alpha release, run the `ads-cli-promote-stable-version` custom pipeline from
|
|
188
|
+
`master` with `VERSION_TO_PROMOTE` set to its exact version. Promotion updates the canonical remote
|
|
189
|
+
manifest without rebuilding or uploading artifacts.
|
|
190
|
+
|
|
191
|
+
The Statlas namespace authorization and Atlas plugin registry entry are one-time external
|
|
192
|
+
prerequisites. Until the registry entry is available, use `atlas atlasdev exec` to exercise a
|
|
193
|
+
packaged binary in the Atlas runtime. The AFM package scripts own the Node.js executable build; the
|
|
194
|
+
generic `atlas atlasdev plugin build` command doesn't drive this package.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.main = void 0;
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _cli = require("./cli");
|
|
12
|
+
/**
|
|
13
|
+
* Process entrypoint for the `atlas ads` distribution.
|
|
14
|
+
*
|
|
15
|
+
* Atlas forwards everything after `atlas ads` as process arguments. The shared CLI owns parsing,
|
|
16
|
+
* output, and its stable exit-code contract; this entrypoint only maps that result onto the plugin
|
|
17
|
+
* process.
|
|
18
|
+
*/
|
|
19
|
+
var main = exports.main = /*#__PURE__*/function () {
|
|
20
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
21
|
+
var argv,
|
|
22
|
+
exitCode,
|
|
23
|
+
_error$stack,
|
|
24
|
+
_args = arguments,
|
|
25
|
+
_t;
|
|
26
|
+
return _regenerator.default.wrap(function (_context) {
|
|
27
|
+
while (1) switch (_context.prev = _context.next) {
|
|
28
|
+
case 0:
|
|
29
|
+
argv = _args.length > 0 && _args[0] !== undefined ? _args[0] : process.argv.slice(2);
|
|
30
|
+
_context.prev = 1;
|
|
31
|
+
_context.next = 2;
|
|
32
|
+
return (0, _cli.run)(argv);
|
|
33
|
+
case 2:
|
|
34
|
+
exitCode = _context.sent;
|
|
35
|
+
process.exitCode = exitCode;
|
|
36
|
+
_context.next = 5;
|
|
37
|
+
break;
|
|
38
|
+
case 3:
|
|
39
|
+
_context.prev = 3;
|
|
40
|
+
_t = _context["catch"](1);
|
|
41
|
+
if (!(typeof _t === 'number')) {
|
|
42
|
+
_context.next = 4;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
process.exitCode = _t;
|
|
46
|
+
return _context.abrupt("return");
|
|
47
|
+
case 4:
|
|
48
|
+
process.stderr.write("".concat(_t instanceof Error ? (_error$stack = _t.stack) !== null && _error$stack !== void 0 ? _error$stack : _t.message : String(_t), "\n"));
|
|
49
|
+
process.exitCode = 1;
|
|
50
|
+
case 5:
|
|
51
|
+
case "end":
|
|
52
|
+
return _context.stop();
|
|
53
|
+
}
|
|
54
|
+
}, _callee, null, [[1, 3]]);
|
|
55
|
+
}));
|
|
56
|
+
return function main() {
|
|
57
|
+
return _ref.apply(this, arguments);
|
|
58
|
+
};
|
|
59
|
+
}();
|
|
60
|
+
if (require.main === module) {
|
|
61
|
+
void main();
|
|
62
|
+
}
|
|
@@ -1,19 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.importToolHandler = void 0;
|
|
9
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" !=
|
|
12
|
-
function _tsRewriteRelativeImportExtensions(t, e) { return "string" == typeof t && /^\.\.?\//.test(t) ? t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+)?)\.([cm]?)ts$/i, function (t, s, r, n, o) { return s ? e ? ".jsx" : ".js" : !r || n && o ? r + n + "." + o.toLowerCase() + "js" : t; }) : t; }
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
13
12
|
/**
|
|
14
13
|
* Dynamic-import indirection used to load an ADS MCP tool handler by subpath.
|
|
15
14
|
*/
|
|
16
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Every ADS MCP tool that the CLI can dispatch to.
|
|
18
|
+
*
|
|
19
|
+
* Literal import paths let bundlers discover and embed every tool while preserving lazy loading
|
|
20
|
+
* for the npm CLI. An unconstrained `import(importPath)` cannot produce a self-contained Atlas
|
|
21
|
+
* executable.
|
|
22
|
+
*/
|
|
23
|
+
var toolImporters = {
|
|
24
|
+
'@atlaskit/ads-mcp/tools/get-a11y-guidelines': function atlaskit_adsMcp_tools_getA11yGuidelines() {
|
|
25
|
+
return Promise.resolve().then(function () {
|
|
26
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-a11y-guidelines" */
|
|
27
|
+
'@atlaskit/ads-mcp/tools/get-a11y-guidelines'));
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
'@atlaskit/ads-mcp/tools/get-all-components': function atlaskit_adsMcp_tools_getAllComponents() {
|
|
31
|
+
return Promise.resolve().then(function () {
|
|
32
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-all-components" */
|
|
33
|
+
'@atlaskit/ads-mcp/tools/get-all-components'));
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
'@atlaskit/ads-mcp/tools/get-all-icons': function atlaskit_adsMcp_tools_getAllIcons() {
|
|
37
|
+
return Promise.resolve().then(function () {
|
|
38
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-all-icons" */
|
|
39
|
+
'@atlaskit/ads-mcp/tools/get-all-icons'));
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
'@atlaskit/ads-mcp/tools/get-all-tokens': function atlaskit_adsMcp_tools_getAllTokens() {
|
|
43
|
+
return Promise.resolve().then(function () {
|
|
44
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-all-tokens" */
|
|
45
|
+
'@atlaskit/ads-mcp/tools/get-all-tokens'));
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
'@atlaskit/ads-mcp/tools/get-guidelines': function atlaskit_adsMcp_tools_getGuidelines() {
|
|
49
|
+
return Promise.resolve().then(function () {
|
|
50
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-guidelines" */
|
|
51
|
+
'@atlaskit/ads-mcp/tools/get-guidelines'));
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
'@atlaskit/ads-mcp/tools/get-lint-rules': function atlaskit_adsMcp_tools_getLintRules() {
|
|
55
|
+
return Promise.resolve().then(function () {
|
|
56
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-lint-rules" */
|
|
57
|
+
'@atlaskit/ads-mcp/tools/get-lint-rules'));
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
'@atlaskit/ads-mcp/tools/migration-guides': function atlaskit_adsMcp_tools_migrationGuides() {
|
|
61
|
+
return Promise.resolve().then(function () {
|
|
62
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-migration-guides" */
|
|
63
|
+
'@atlaskit/ads-mcp/tools/migration-guides'));
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
'@atlaskit/ads-mcp/tools/search-components': function atlaskit_adsMcp_tools_searchComponents() {
|
|
67
|
+
return Promise.resolve().then(function () {
|
|
68
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-search-components" */
|
|
69
|
+
'@atlaskit/ads-mcp/tools/search-components'));
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
'@atlaskit/ads-mcp/tools/search-icons': function atlaskit_adsMcp_tools_searchIcons() {
|
|
73
|
+
return Promise.resolve().then(function () {
|
|
74
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-search-icons" */
|
|
75
|
+
'@atlaskit/ads-mcp/tools/search-icons'));
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
'@atlaskit/ads-mcp/tools/search-tokens': function atlaskit_adsMcp_tools_searchTokens() {
|
|
79
|
+
return Promise.resolve().then(function () {
|
|
80
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-search-tokens" */
|
|
81
|
+
'@atlaskit/ads-mcp/tools/search-tokens'));
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var isToolImportPath = function isToolImportPath(importPath) {
|
|
86
|
+
return importPath in toolImporters;
|
|
87
|
+
};
|
|
88
|
+
|
|
17
89
|
/**
|
|
18
90
|
* Load an ADS MCP tool handler by subpath.
|
|
19
91
|
*
|
|
@@ -27,25 +99,25 @@ var importToolHandler = exports.importToolHandler = /*#__PURE__*/function () {
|
|
|
27
99
|
while (1) switch (_context.prev = _context.next) {
|
|
28
100
|
case 0:
|
|
29
101
|
importPath = _ref.importPath, handlerName = _ref.handlerName;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return _interopRequireWildcard(require(s));
|
|
36
|
-
});
|
|
37
|
-
}( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool" */_tsRewriteRelativeImportExtensions(importPath));
|
|
102
|
+
if (isToolImportPath(importPath)) {
|
|
103
|
+
_context.next = 1;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
throw new Error("Unknown ADS MCP tool import path \"".concat(importPath, "\"."));
|
|
38
107
|
case 1:
|
|
108
|
+
_context.next = 2;
|
|
109
|
+
return toolImporters[importPath]();
|
|
110
|
+
case 2:
|
|
39
111
|
mod = _context.sent;
|
|
40
112
|
handler = mod[handlerName];
|
|
41
113
|
if (!(typeof handler !== 'function')) {
|
|
42
|
-
_context.next =
|
|
114
|
+
_context.next = 3;
|
|
43
115
|
break;
|
|
44
116
|
}
|
|
45
117
|
throw new Error("Tool handler \"".concat(handlerName, "\" not found in \"").concat(importPath, "\"."));
|
|
46
|
-
case 2:
|
|
47
|
-
return _context.abrupt("return", handler);
|
|
48
118
|
case 3:
|
|
119
|
+
return _context.abrupt("return", handler);
|
|
120
|
+
case 4:
|
|
49
121
|
case "end":
|
|
50
122
|
return _context.stop();
|
|
51
123
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { run } from './cli';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Process entrypoint for the `atlas ads` distribution.
|
|
6
|
+
*
|
|
7
|
+
* Atlas forwards everything after `atlas ads` as process arguments. The shared CLI owns parsing,
|
|
8
|
+
* output, and its stable exit-code contract; this entrypoint only maps that result onto the plugin
|
|
9
|
+
* process.
|
|
10
|
+
*/
|
|
11
|
+
export const main = async (argv = process.argv.slice(2)) => {
|
|
12
|
+
try {
|
|
13
|
+
const exitCode = await run(argv);
|
|
14
|
+
process.exitCode = exitCode;
|
|
15
|
+
} catch (error) {
|
|
16
|
+
var _error$stack;
|
|
17
|
+
if (typeof error === 'number') {
|
|
18
|
+
process.exitCode = error;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
process.stderr.write(`${error instanceof Error ? (_error$stack = error.stack) !== null && _error$stack !== void 0 ? _error$stack : error.message : String(error)}\n`);
|
|
22
|
+
process.exitCode = 1;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
if (require.main === module) {
|
|
26
|
+
void main();
|
|
27
|
+
}
|
|
@@ -1,8 +1,38 @@
|
|
|
1
|
-
function _tsRewriteRelativeImportExtensions(t, e) { return "string" == typeof t && /^\.\.?\//.test(t) ? t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+)?)\.([cm]?)ts$/i, function (t, s, r, n, o) { return s ? e ? ".jsx" : ".js" : !r || n && o ? r + n + "." + o.toLowerCase() + "js" : t; }) : t; }
|
|
2
1
|
/**
|
|
3
2
|
* Dynamic-import indirection used to load an ADS MCP tool handler by subpath.
|
|
4
3
|
*/
|
|
5
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Every ADS MCP tool that the CLI can dispatch to.
|
|
7
|
+
*
|
|
8
|
+
* Literal import paths let bundlers discover and embed every tool while preserving lazy loading
|
|
9
|
+
* for the npm CLI. An unconstrained `import(importPath)` cannot produce a self-contained Atlas
|
|
10
|
+
* executable.
|
|
11
|
+
*/
|
|
12
|
+
const toolImporters = {
|
|
13
|
+
'@atlaskit/ads-mcp/tools/get-a11y-guidelines': () => import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-a11y-guidelines" */
|
|
14
|
+
'@atlaskit/ads-mcp/tools/get-a11y-guidelines'),
|
|
15
|
+
'@atlaskit/ads-mcp/tools/get-all-components': () => import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-all-components" */
|
|
16
|
+
'@atlaskit/ads-mcp/tools/get-all-components'),
|
|
17
|
+
'@atlaskit/ads-mcp/tools/get-all-icons': () => import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-all-icons" */
|
|
18
|
+
'@atlaskit/ads-mcp/tools/get-all-icons'),
|
|
19
|
+
'@atlaskit/ads-mcp/tools/get-all-tokens': () => import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-all-tokens" */
|
|
20
|
+
'@atlaskit/ads-mcp/tools/get-all-tokens'),
|
|
21
|
+
'@atlaskit/ads-mcp/tools/get-guidelines': () => import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-guidelines" */
|
|
22
|
+
'@atlaskit/ads-mcp/tools/get-guidelines'),
|
|
23
|
+
'@atlaskit/ads-mcp/tools/get-lint-rules': () => import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-lint-rules" */
|
|
24
|
+
'@atlaskit/ads-mcp/tools/get-lint-rules'),
|
|
25
|
+
'@atlaskit/ads-mcp/tools/migration-guides': () => import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-migration-guides" */
|
|
26
|
+
'@atlaskit/ads-mcp/tools/migration-guides'),
|
|
27
|
+
'@atlaskit/ads-mcp/tools/search-components': () => import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-search-components" */
|
|
28
|
+
'@atlaskit/ads-mcp/tools/search-components'),
|
|
29
|
+
'@atlaskit/ads-mcp/tools/search-icons': () => import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-search-icons" */
|
|
30
|
+
'@atlaskit/ads-mcp/tools/search-icons'),
|
|
31
|
+
'@atlaskit/ads-mcp/tools/search-tokens': () => import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-search-tokens" */
|
|
32
|
+
'@atlaskit/ads-mcp/tools/search-tokens')
|
|
33
|
+
};
|
|
34
|
+
const isToolImportPath = importPath => importPath in toolImporters;
|
|
35
|
+
|
|
6
36
|
/**
|
|
7
37
|
* Load an ADS MCP tool handler by subpath.
|
|
8
38
|
*
|
|
@@ -13,7 +43,10 @@ export const importToolHandler = async ({
|
|
|
13
43
|
importPath,
|
|
14
44
|
handlerName
|
|
15
45
|
}) => {
|
|
16
|
-
|
|
46
|
+
if (!isToolImportPath(importPath)) {
|
|
47
|
+
throw new Error(`Unknown ADS MCP tool import path "${importPath}".`);
|
|
48
|
+
}
|
|
49
|
+
const mod = await toolImporters[importPath]();
|
|
17
50
|
const handler = mod[handlerName];
|
|
18
51
|
if (typeof handler !== 'function') {
|
|
19
52
|
throw new Error(`Tool handler "${handlerName}" not found in "${importPath}".`);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import { run } from './cli';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Process entrypoint for the `atlas ads` distribution.
|
|
8
|
+
*
|
|
9
|
+
* Atlas forwards everything after `atlas ads` as process arguments. The shared CLI owns parsing,
|
|
10
|
+
* output, and its stable exit-code contract; this entrypoint only maps that result onto the plugin
|
|
11
|
+
* process.
|
|
12
|
+
*/
|
|
13
|
+
export var main = /*#__PURE__*/function () {
|
|
14
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
15
|
+
var argv,
|
|
16
|
+
exitCode,
|
|
17
|
+
_error$stack,
|
|
18
|
+
_args = arguments,
|
|
19
|
+
_t;
|
|
20
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
21
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
argv = _args.length > 0 && _args[0] !== undefined ? _args[0] : process.argv.slice(2);
|
|
24
|
+
_context.prev = 1;
|
|
25
|
+
_context.next = 2;
|
|
26
|
+
return run(argv);
|
|
27
|
+
case 2:
|
|
28
|
+
exitCode = _context.sent;
|
|
29
|
+
process.exitCode = exitCode;
|
|
30
|
+
_context.next = 5;
|
|
31
|
+
break;
|
|
32
|
+
case 3:
|
|
33
|
+
_context.prev = 3;
|
|
34
|
+
_t = _context["catch"](1);
|
|
35
|
+
if (!(typeof _t === 'number')) {
|
|
36
|
+
_context.next = 4;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
process.exitCode = _t;
|
|
40
|
+
return _context.abrupt("return");
|
|
41
|
+
case 4:
|
|
42
|
+
process.stderr.write("".concat(_t instanceof Error ? (_error$stack = _t.stack) !== null && _error$stack !== void 0 ? _error$stack : _t.message : String(_t), "\n"));
|
|
43
|
+
process.exitCode = 1;
|
|
44
|
+
case 5:
|
|
45
|
+
case "end":
|
|
46
|
+
return _context.stop();
|
|
47
|
+
}
|
|
48
|
+
}, _callee, null, [[1, 3]]);
|
|
49
|
+
}));
|
|
50
|
+
return function main() {
|
|
51
|
+
return _ref.apply(this, arguments);
|
|
52
|
+
};
|
|
53
|
+
}();
|
|
54
|
+
if (require.main === module) {
|
|
55
|
+
void main();
|
|
56
|
+
}
|
|
@@ -1,10 +1,62 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
function _tsRewriteRelativeImportExtensions(t, e) { return "string" == typeof t && /^\.\.?\//.test(t) ? t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+)?)\.([cm]?)ts$/i, function (t, s, r, n, o) { return s ? e ? ".jsx" : ".js" : !r || n && o ? r + n + "." + o.toLowerCase() + "js" : t; }) : t; }
|
|
4
3
|
/**
|
|
5
4
|
* Dynamic-import indirection used to load an ADS MCP tool handler by subpath.
|
|
6
5
|
*/
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Every ADS MCP tool that the CLI can dispatch to.
|
|
9
|
+
*
|
|
10
|
+
* Literal import paths let bundlers discover and embed every tool while preserving lazy loading
|
|
11
|
+
* for the npm CLI. An unconstrained `import(importPath)` cannot produce a self-contained Atlas
|
|
12
|
+
* executable.
|
|
13
|
+
*/
|
|
14
|
+
var toolImporters = {
|
|
15
|
+
'@atlaskit/ads-mcp/tools/get-a11y-guidelines': function atlaskit_adsMcp_tools_getA11yGuidelines() {
|
|
16
|
+
return import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-a11y-guidelines" */
|
|
17
|
+
'@atlaskit/ads-mcp/tools/get-a11y-guidelines');
|
|
18
|
+
},
|
|
19
|
+
'@atlaskit/ads-mcp/tools/get-all-components': function atlaskit_adsMcp_tools_getAllComponents() {
|
|
20
|
+
return import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-all-components" */
|
|
21
|
+
'@atlaskit/ads-mcp/tools/get-all-components');
|
|
22
|
+
},
|
|
23
|
+
'@atlaskit/ads-mcp/tools/get-all-icons': function atlaskit_adsMcp_tools_getAllIcons() {
|
|
24
|
+
return import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-all-icons" */
|
|
25
|
+
'@atlaskit/ads-mcp/tools/get-all-icons');
|
|
26
|
+
},
|
|
27
|
+
'@atlaskit/ads-mcp/tools/get-all-tokens': function atlaskit_adsMcp_tools_getAllTokens() {
|
|
28
|
+
return import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-all-tokens" */
|
|
29
|
+
'@atlaskit/ads-mcp/tools/get-all-tokens');
|
|
30
|
+
},
|
|
31
|
+
'@atlaskit/ads-mcp/tools/get-guidelines': function atlaskit_adsMcp_tools_getGuidelines() {
|
|
32
|
+
return import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-guidelines" */
|
|
33
|
+
'@atlaskit/ads-mcp/tools/get-guidelines');
|
|
34
|
+
},
|
|
35
|
+
'@atlaskit/ads-mcp/tools/get-lint-rules': function atlaskit_adsMcp_tools_getLintRules() {
|
|
36
|
+
return import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-get-lint-rules" */
|
|
37
|
+
'@atlaskit/ads-mcp/tools/get-lint-rules');
|
|
38
|
+
},
|
|
39
|
+
'@atlaskit/ads-mcp/tools/migration-guides': function atlaskit_adsMcp_tools_migrationGuides() {
|
|
40
|
+
return import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-migration-guides" */
|
|
41
|
+
'@atlaskit/ads-mcp/tools/migration-guides');
|
|
42
|
+
},
|
|
43
|
+
'@atlaskit/ads-mcp/tools/search-components': function atlaskit_adsMcp_tools_searchComponents() {
|
|
44
|
+
return import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-search-components" */
|
|
45
|
+
'@atlaskit/ads-mcp/tools/search-components');
|
|
46
|
+
},
|
|
47
|
+
'@atlaskit/ads-mcp/tools/search-icons': function atlaskit_adsMcp_tools_searchIcons() {
|
|
48
|
+
return import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-search-icons" */
|
|
49
|
+
'@atlaskit/ads-mcp/tools/search-icons');
|
|
50
|
+
},
|
|
51
|
+
'@atlaskit/ads-mcp/tools/search-tokens': function atlaskit_adsMcp_tools_searchTokens() {
|
|
52
|
+
return import( /* webpackChunkName: "@atlaskit-internal_ads-cli-tool-search-tokens" */
|
|
53
|
+
'@atlaskit/ads-mcp/tools/search-tokens');
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var isToolImportPath = function isToolImportPath(importPath) {
|
|
57
|
+
return importPath in toolImporters;
|
|
58
|
+
};
|
|
59
|
+
|
|
8
60
|
/**
|
|
9
61
|
* Load an ADS MCP tool handler by subpath.
|
|
10
62
|
*
|
|
@@ -18,19 +70,25 @@ export var importToolHandler = /*#__PURE__*/function () {
|
|
|
18
70
|
while (1) switch (_context.prev = _context.next) {
|
|
19
71
|
case 0:
|
|
20
72
|
importPath = _ref.importPath, handlerName = _ref.handlerName;
|
|
21
|
-
|
|
22
|
-
|
|
73
|
+
if (isToolImportPath(importPath)) {
|
|
74
|
+
_context.next = 1;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
throw new Error("Unknown ADS MCP tool import path \"".concat(importPath, "\"."));
|
|
23
78
|
case 1:
|
|
79
|
+
_context.next = 2;
|
|
80
|
+
return toolImporters[importPath]();
|
|
81
|
+
case 2:
|
|
24
82
|
mod = _context.sent;
|
|
25
83
|
handler = mod[handlerName];
|
|
26
84
|
if (!(typeof handler !== 'function')) {
|
|
27
|
-
_context.next =
|
|
85
|
+
_context.next = 3;
|
|
28
86
|
break;
|
|
29
87
|
}
|
|
30
88
|
throw new Error("Tool handler \"".concat(handlerName, "\" not found in \"").concat(importPath, "\"."));
|
|
31
|
-
case 2:
|
|
32
|
-
return _context.abrupt("return", handler);
|
|
33
89
|
case 3:
|
|
90
|
+
return _context.abrupt("return", handler);
|
|
91
|
+
case 4:
|
|
34
92
|
case "end":
|
|
35
93
|
return _context.stop();
|
|
36
94
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Process entrypoint for the `atlas ads` distribution.
|
|
4
|
+
*
|
|
5
|
+
* Atlas forwards everything after `atlas ads` as process arguments. The shared CLI owns parsing,
|
|
6
|
+
* output, and its stable exit-code contract; this entrypoint only maps that result onto the plugin
|
|
7
|
+
* process.
|
|
8
|
+
*/
|
|
9
|
+
export declare const main: (argv?: string[]) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/ads-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "An npx-runnable command-line tool to query Atlassian Design System (ADS) structured content — components, tokens, icons, and guidelines — from the terminal.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -17,7 +17,18 @@
|
|
|
17
17
|
"atlaskit:src": "src/cli.tsx",
|
|
18
18
|
"bin": "./bin/ads-cli.js",
|
|
19
19
|
"scripts": {
|
|
20
|
-
"start": "./bin/ads-cli.js"
|
|
20
|
+
"start": "./bin/ads-cli.js",
|
|
21
|
+
"build:atlas": "esbuild src/atlas-cli.tsx --bundle --outfile=build/atlas/ads-cli.js --format=cjs --platform=node --target=node18",
|
|
22
|
+
"package:atlas:darwin-amd64": "pkg --public --public-packages '*' --compress GZip --target node18-macos-x64 --output build/atlas/ads-darwin-amd64 build/atlas/ads-cli.js",
|
|
23
|
+
"package:atlas:darwin-arm64": "pkg --public --public-packages '*' --compress GZip --target node18-macos-arm64 --output build/atlas/ads-darwin-arm64 build/atlas/ads-cli.js",
|
|
24
|
+
"package:atlas:linux-amd64": "pkg --public --public-packages '*' --compress GZip --target node18-linux-x64 --output build/atlas/ads-linux-amd64 build/atlas/ads-cli.js",
|
|
25
|
+
"package:atlas:linux-arm64": "pkg --public --public-packages '*' --compress GZip --target node18-linux-arm64 --output build/atlas/ads-linux-arm64 build/atlas/ads-cli.js",
|
|
26
|
+
"package:atlas:windows-amd64": "pkg --public --public-packages '*' --compress GZip --target node18-win-x64 --output build/atlas/ads-windows-amd64.exe build/atlas/ads-cli.js",
|
|
27
|
+
"package:atlas": "afm run build:atlas && afm run package:atlas:darwin-amd64 && afm run package:atlas:darwin-arm64 && afm run package:atlas:linux-amd64 && afm run package:atlas:linux-arm64 && afm run package:atlas:windows-amd64",
|
|
28
|
+
"release:atlas:fetch-manifest": "bash scripts/atlas/fetch-manifest.sh",
|
|
29
|
+
"release:atlas:prepare": "bash scripts/atlas/prepare-release.sh",
|
|
30
|
+
"release:atlas:upload": "bash scripts/atlas/upload-release.sh",
|
|
31
|
+
"release:atlas:promote": "bash scripts/atlas/promote-stable.sh"
|
|
21
32
|
},
|
|
22
33
|
"dependencies": {
|
|
23
34
|
"@atlaskit/ads-mcp": "^1.7.0",
|
|
@@ -25,6 +36,8 @@
|
|
|
25
36
|
"chalk": "^4.1.2"
|
|
26
37
|
},
|
|
27
38
|
"devDependencies": {
|
|
28
|
-
"@atlassian/ts-loader": "^0.1.0"
|
|
39
|
+
"@atlassian/ts-loader": "^0.1.0",
|
|
40
|
+
"esbuild": "^0.15.18",
|
|
41
|
+
"pkg": "5.8.1"
|
|
29
42
|
}
|
|
30
43
|
}
|