@atlaskit/ads-cli 0.2.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 +27 -0
- package/README.md +65 -12
- package/dist/cjs/atlas-cli.js +62 -0
- package/dist/cjs/cli.js +17 -7
- package/dist/cjs/commands/definitions.js +34 -15
- package/dist/cjs/commands/import-tool-handler.js +86 -14
- package/dist/cjs/output/create-doc-search-results.js +55 -0
- package/dist/cjs/output/format-grouped-results.js +5 -3
- package/dist/cjs/output/format-results.js +14 -5
- package/dist/es2019/atlas-cli.js +27 -0
- package/dist/es2019/cli.js +17 -7
- package/dist/es2019/commands/definitions.js +30 -12
- package/dist/es2019/commands/import-tool-handler.js +35 -2
- package/dist/es2019/output/create-doc-search-results.js +42 -0
- package/dist/es2019/output/format-grouped-results.js +5 -3
- package/dist/es2019/output/format-results.js +14 -5
- package/dist/esm/atlas-cli.js +56 -0
- package/dist/esm/cli.js +17 -7
- package/dist/esm/commands/definitions.js +34 -15
- package/dist/esm/commands/import-tool-handler.js +64 -6
- package/dist/esm/output/create-doc-search-results.js +48 -0
- package/dist/esm/output/format-grouped-results.js +5 -3
- package/dist/esm/output/format-results.js +14 -5
- package/dist/types/atlas-cli.d.ts +9 -0
- package/dist/types/commands/types.d.ts +5 -6
- package/dist/types/output/create-doc-search-results.d.ts +22 -0
- package/dist/types/output/format-grouped-results.d.ts +2 -3
- package/dist/types/output/format-results.d.ts +1 -2
- package/package.json +16 -3
|
@@ -23,6 +23,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
23
23
|
|
|
24
24
|
import { accessibilityGuidelines } from '@atlaskit/ads-mcp/a11y-guidelines';
|
|
25
25
|
import { migrationRegistry } from '@atlaskit/ads-mcp/migration-registry';
|
|
26
|
+
import { createDocSearchResults } from '../output/create-doc-search-results';
|
|
26
27
|
import { isDisambiguation } from '../output/disambiguation';
|
|
27
28
|
import { formatComponent } from '../output/format-component';
|
|
28
29
|
import { formatDisambiguation } from '../output/format-disambiguation';
|
|
@@ -63,7 +64,7 @@ var parseLimit = function parseLimit(flags) {
|
|
|
63
64
|
};
|
|
64
65
|
|
|
65
66
|
/**
|
|
66
|
-
* Map of the
|
|
67
|
+
* Map of the `search --type` variants to their ADS MCP tool exports.
|
|
67
68
|
*/
|
|
68
69
|
var searchKindTools = {
|
|
69
70
|
components: {
|
|
@@ -80,17 +81,22 @@ var searchKindTools = {
|
|
|
80
81
|
importPath: '@atlaskit/ads-mcp/tools/search-icons',
|
|
81
82
|
handlerName: 'searchIconsTool',
|
|
82
83
|
envelopeType: 'search-icons'
|
|
84
|
+
},
|
|
85
|
+
docs: {
|
|
86
|
+
importPath: '@atlaskit/ads-mcp/tools/get-guidelines',
|
|
87
|
+
handlerName: 'getGuidelinesTool',
|
|
88
|
+
envelopeType: 'search-docs'
|
|
83
89
|
}
|
|
84
90
|
};
|
|
85
91
|
/**
|
|
86
|
-
* Accepted `--type` values
|
|
87
|
-
*
|
|
88
|
-
* grouped JSON keys), so the singular input normalises to it here.
|
|
92
|
+
* Accepted `--type` values → the internal {@link SearchKind}. Entity inputs are singular to match
|
|
93
|
+
* their item commands; `docs` matches the dedicated documentation command.
|
|
89
94
|
*/
|
|
90
95
|
var SEARCH_TYPE_VALUES = {
|
|
91
96
|
component: 'components',
|
|
92
97
|
token: 'tokens',
|
|
93
|
-
icon: 'icons'
|
|
98
|
+
icon: 'icons',
|
|
99
|
+
docs: 'docs'
|
|
94
100
|
};
|
|
95
101
|
var isSearchTypeValue = function isSearchTypeValue(value) {
|
|
96
102
|
return value in SEARCH_TYPE_VALUES;
|
|
@@ -411,10 +417,11 @@ var makeItemCommand = function makeItemCommand(_ref3) {
|
|
|
411
417
|
};
|
|
412
418
|
|
|
413
419
|
/**
|
|
414
|
-
* Resolver for the unified `search` (no `--type`): fan out to
|
|
415
|
-
* command. The results are grouped by kind
|
|
416
|
-
* single ranked list — each tool ranks its
|
|
417
|
-
* mean duplicating ranking logic here (breaking the
|
|
420
|
+
* Resolver for the unified `search` (no `--type`): fan out to the three entity search tools and
|
|
421
|
+
* foundations documentation search in one command. The results are grouped by kind
|
|
422
|
+
* (components/tokens/icons/docs) rather than merged into a single ranked list — each tool ranks its
|
|
423
|
+
* own domain, and re-ranking across domains would mean duplicating ranking logic here (breaking the
|
|
424
|
+
* zero-drift contract with `@atlaskit/ads-mcp`).
|
|
418
425
|
*/
|
|
419
426
|
var resolveUnifiedSearch = function resolveUnifiedSearch(input) {
|
|
420
427
|
var terms = input.positionals;
|
|
@@ -446,6 +453,10 @@ var resolveUnifiedSearch = function resolveUnifiedSearch(input) {
|
|
|
446
453
|
key: 'icons'
|
|
447
454
|
}, searchKindTools.icons), {}, {
|
|
448
455
|
args: args
|
|
456
|
+
}), _objectSpread(_objectSpread({
|
|
457
|
+
key: 'docs'
|
|
458
|
+
}, searchKindTools.docs), {}, {
|
|
459
|
+
args: args
|
|
449
460
|
})],
|
|
450
461
|
meta: args
|
|
451
462
|
};
|
|
@@ -456,7 +467,7 @@ var resolveUnifiedSearch = function resolveUnifiedSearch(input) {
|
|
|
456
467
|
*/
|
|
457
468
|
export var commands = [{
|
|
458
469
|
name: 'search',
|
|
459
|
-
description: 'Fuzzy-search ADS components, tokens, and
|
|
470
|
+
description: 'Fuzzy-search ADS components, tokens, icons, and docs together (or narrow results with --type).',
|
|
460
471
|
usage: "search <query...> [--type ".concat(Object.keys(SEARCH_TYPE_VALUES).join('|'), "] [--limit N]"),
|
|
461
472
|
arguments: [{
|
|
462
473
|
name: 'query',
|
|
@@ -472,7 +483,7 @@ export var commands = [{
|
|
|
472
483
|
choices: Object.keys(SEARCH_TYPE_VALUES),
|
|
473
484
|
description: "Narrow the search to a single kind: ".concat(Object.keys(SEARCH_TYPE_VALUES).join(', '), ".")
|
|
474
485
|
}, limitFlag],
|
|
475
|
-
examples: ['search button', 'search space color --type token', 'search add --type icon --limit 5'],
|
|
486
|
+
examples: ['search button', 'search space color --type token', 'search add --type icon --limit 5', 'search contrast --type docs'],
|
|
476
487
|
responseTypes: ['ads-cli/search'].concat(_toConsumableArray(Object.values(searchKindTools).map(function (tool) {
|
|
477
488
|
return "ads-cli/".concat(tool.envelopeType);
|
|
478
489
|
}))),
|
|
@@ -483,12 +494,20 @@ export var commands = [{
|
|
|
483
494
|
var _resolveSearchType;
|
|
484
495
|
return (_resolveSearchType = resolveSearchType(input.flags)) !== null && _resolveSearchType !== void 0 ? _resolveSearchType : undefined;
|
|
485
496
|
},
|
|
497
|
+
transform: function transform(_ref5) {
|
|
498
|
+
var data = _ref5.data,
|
|
499
|
+
input = _ref5.input;
|
|
500
|
+
return resolveSearchType(input.flags) === 'docs' ? createDocSearchResults({
|
|
501
|
+
data: data,
|
|
502
|
+
query: input.positionals.join(' ')
|
|
503
|
+
}) : data;
|
|
504
|
+
},
|
|
486
505
|
envelopeType: function envelopeType(input) {
|
|
487
506
|
var searchType = resolveSearchType(input.flags);
|
|
488
507
|
return searchType ? searchKindTools[searchType].envelopeType : 'search';
|
|
489
508
|
},
|
|
490
509
|
resolve: function resolve(input) {
|
|
491
|
-
// No `--type`: unified search across all three kinds.
|
|
510
|
+
// No `--type`: unified search across all three entity kinds and foundations docs.
|
|
492
511
|
if (input.flags.type === undefined) {
|
|
493
512
|
return resolveUnifiedSearch(input);
|
|
494
513
|
}
|
|
@@ -544,9 +563,9 @@ export var commands = [{
|
|
|
544
563
|
// shows that rule's docs, but several matches with no exact name surface a disambiguation
|
|
545
564
|
// list instead of dumping every rule's full Markdown. Skipped for bare `lint-rules` (which
|
|
546
565
|
// intentionally returns every rule's content).
|
|
547
|
-
transform: function transform(
|
|
548
|
-
var data =
|
|
549
|
-
input =
|
|
566
|
+
transform: function transform(_ref6) {
|
|
567
|
+
var data = _ref6.data,
|
|
568
|
+
input = _ref6.input;
|
|
550
569
|
var terms = input.positionals;
|
|
551
570
|
if (terms.length === 0) {
|
|
552
571
|
return data;
|
|
@@ -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,48 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
/**
|
|
5
|
+
* A concise documentation match derived from the Markdown returned by `getGuidelinesTool`.
|
|
6
|
+
*
|
|
7
|
+
* Search only surfaces this summary. The `docs` command remains the detail view for the full
|
|
8
|
+
* Markdown content.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Truncate a one-line description so compact rows stay on a single line.
|
|
13
|
+
*/
|
|
14
|
+
var truncate = function truncate(text, max) {
|
|
15
|
+
return text.length > max ? "".concat(text.slice(0, max - 1).trimEnd(), "\u2026") : text;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Remove common Markdown formatting before showing documentation content in one row.
|
|
20
|
+
*/
|
|
21
|
+
var toPlainText = function toPlainText(text) {
|
|
22
|
+
return text.replace(/!\[[^\]]*]\([^)]*\)/g, '').replace(/\[([^\]]+)]\([^)]*\)/g, '$1').replace(/^\s{0,3}#{1,6}\s+/gm, '').replace(/<[^>]+>/g, ' ').replace(/[*_`~]/g, '').replace(/\s+/g, ' ').trim();
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Turn a full foundations-doc Markdown match into the concise record used by `search`.
|
|
27
|
+
*
|
|
28
|
+
* `getGuidelinesTool` currently returns Markdown rather than structured search metadata. Its
|
|
29
|
+
* highest-ranked match is represented by the query and a preview of its leading textual content;
|
|
30
|
+
* the full payload remains available through the follow-up `docs <query>` command.
|
|
31
|
+
*/
|
|
32
|
+
export var createDocSearchResults = function createDocSearchResults(_ref) {
|
|
33
|
+
var data = _ref.data,
|
|
34
|
+
query = _ref.query;
|
|
35
|
+
if (typeof data !== 'string' || data.trim() === '') {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
var normalizedQuery = query.replace(/\s+/g, ' ').trim();
|
|
39
|
+
var title = normalizedQuery ? "".concat(normalizedQuery.charAt(0).toUpperCase()).concat(normalizedQuery.slice(1)) : 'Documentation';
|
|
40
|
+
var preview = toPlainText(data);
|
|
41
|
+
return [_objectSpread(_objectSpread({
|
|
42
|
+
title: truncate(title, 80)
|
|
43
|
+
}, preview ? {
|
|
44
|
+
summary: truncate(preview, 100)
|
|
45
|
+
} : {}), {}, {
|
|
46
|
+
followUp: "docs ".concat(query)
|
|
47
|
+
})];
|
|
48
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sectioned compact renderer for grouped (multi-kind) results, e.g. unified `search`.
|
|
3
3
|
*
|
|
4
|
-
* Prints
|
|
5
|
-
*
|
|
6
|
-
* kind.
|
|
4
|
+
* Prints Components, Tokens, Icons, and Docs sections using the per-kind compact renderer. Empty
|
|
5
|
+
* groups are skipped, so one command surfaces whatever kinds match, grouped by kind.
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
8
|
import { formatCompactResults } from './format-results';
|
|
@@ -24,6 +23,9 @@ export var formatGroupedResults = function formatGroupedResults(_ref) {
|
|
|
24
23
|
}, {
|
|
25
24
|
kind: 'icons',
|
|
26
25
|
title: 'Icons'
|
|
26
|
+
}, {
|
|
27
|
+
kind: 'docs',
|
|
28
|
+
title: 'Docs'
|
|
27
29
|
}];
|
|
28
30
|
var blocks = ["Results (".concat(totalCount, "):")];
|
|
29
31
|
for (var _i = 0, _sections = sections; _i < _sections.length; _i++) {
|
|
@@ -48,9 +48,8 @@ var truncate = function truncate(text) {
|
|
|
48
48
|
/**
|
|
49
49
|
* Append a `→ ads-cli <command> <name>` drill-in hint beneath a row.
|
|
50
50
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* for the whole list, so echoing each row's own name back would just be noise.
|
|
51
|
+
* Used for every `search` result, where the natural next step is to view that match in full.
|
|
52
|
+
* `--all` listings omit it because echoing every row's own name would just be noise.
|
|
54
53
|
*/
|
|
55
54
|
var withFollowUp = function withFollowUp(_ref) {
|
|
56
55
|
var line = _ref.line,
|
|
@@ -115,13 +114,21 @@ var formatIconLine = function formatIconLine(iconResult, showFollowUp) {
|
|
|
115
114
|
});
|
|
116
115
|
};
|
|
117
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Render one foundations-document match without dumping its full Markdown body.
|
|
119
|
+
*/
|
|
120
|
+
var formatDocLine = function formatDocLine(doc, showFollowUp) {
|
|
121
|
+
var summary = doc.summary ? " \u2014 ".concat(doc.summary) : '';
|
|
122
|
+
var line = "".concat(doc.title).concat(summary);
|
|
123
|
+
return showFollowUp ? "".concat(line, "\n \u2192 ads-cli ").concat(doc.followUp) : line;
|
|
124
|
+
};
|
|
125
|
+
|
|
118
126
|
/**
|
|
119
127
|
* Render an array of results as compact lines for the given kind. Returns `null` when the data
|
|
120
128
|
* is not an array (so the caller can fall back to generic JSON rendering).
|
|
121
129
|
*
|
|
122
130
|
* `showFollowUp` (default `false`) adds a `→ ads-cli <command> <name>` drill-in hint beneath each
|
|
123
|
-
* row.
|
|
124
|
-
* off so the output stays terse.
|
|
131
|
+
* row. Search enables it for both grouped and `--type` output; `--all` listings leave it off.
|
|
125
132
|
*/
|
|
126
133
|
export var formatCompactResults = function formatCompactResults(_ref2) {
|
|
127
134
|
var kind = _ref2.kind,
|
|
@@ -142,6 +149,8 @@ export var formatCompactResults = function formatCompactResults(_ref2) {
|
|
|
142
149
|
return formatTokenLine(entry, showFollowUp);
|
|
143
150
|
case 'icons':
|
|
144
151
|
return formatIconLine(entry, showFollowUp);
|
|
152
|
+
case 'docs':
|
|
153
|
+
return formatDocLine(entry, showFollowUp);
|
|
145
154
|
default:
|
|
146
155
|
return JSON.stringify(entry);
|
|
147
156
|
}
|
|
@@ -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>;
|
|
@@ -48,7 +48,7 @@ export type ToolCall = {
|
|
|
48
48
|
/**
|
|
49
49
|
* A stable key identifying this call within a multi-tool command. For grouped commands
|
|
50
50
|
* (e.g. unified `search`) this becomes the key in the assembled data object, e.g.
|
|
51
|
-
* `components` / `tokens` / `icons`. Ignored for single-tool commands.
|
|
51
|
+
* `components` / `tokens` / `icons` / `docs`. Ignored for single-tool commands.
|
|
52
52
|
*/
|
|
53
53
|
key: string;
|
|
54
54
|
importPath: string;
|
|
@@ -89,12 +89,11 @@ export type ResolveResult = ResolvedCommand | ResolvedStatic | {
|
|
|
89
89
|
};
|
|
90
90
|
/**
|
|
91
91
|
* The kind of *listable row* a command renders, used by the default (non-`--json`) formatter to
|
|
92
|
-
* pick a compact per-row renderer.
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* generic fallback (pretty-printed JSON for objects, verbatim text for strings).
|
|
92
|
+
* pick a compact per-row renderer. Search results include concise documentation matches, while
|
|
93
|
+
* standalone docs, a11y, and lint-rules commands render their full content via
|
|
94
|
+
* {@link CommandDefinition.formatHuman} or the generic fallback.
|
|
96
95
|
*/
|
|
97
|
-
export type RowKind = 'components' | 'tokens' | 'icons';
|
|
96
|
+
export type RowKind = 'components' | 'tokens' | 'icons' | 'docs';
|
|
98
97
|
/**
|
|
99
98
|
* A single CLI command definition.
|
|
100
99
|
*/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A concise documentation match derived from the Markdown returned by `getGuidelinesTool`.
|
|
3
|
+
*
|
|
4
|
+
* Search only surfaces this summary. The `docs` command remains the detail view for the full
|
|
5
|
+
* Markdown content.
|
|
6
|
+
*/
|
|
7
|
+
export type DocSearchResult = {
|
|
8
|
+
title: string;
|
|
9
|
+
summary?: string;
|
|
10
|
+
followUp: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Turn a full foundations-doc Markdown match into the concise record used by `search`.
|
|
14
|
+
*
|
|
15
|
+
* `getGuidelinesTool` currently returns Markdown rather than structured search metadata. Its
|
|
16
|
+
* highest-ranked match is represented by the query and a preview of its leading textual content;
|
|
17
|
+
* the full payload remains available through the follow-up `docs <query>` command.
|
|
18
|
+
*/
|
|
19
|
+
export declare const createDocSearchResults: ({ data, query, }: {
|
|
20
|
+
data: unknown;
|
|
21
|
+
query: string;
|
|
22
|
+
}) => DocSearchResult[];
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sectioned compact renderer for grouped (multi-kind) results, e.g. unified `search`.
|
|
3
3
|
*
|
|
4
|
-
* Prints
|
|
5
|
-
*
|
|
6
|
-
* kind.
|
|
4
|
+
* Prints Components, Tokens, Icons, and Docs sections using the per-kind compact renderer. Empty
|
|
5
|
+
* groups are skipped, so one command surfaces whatever kinds match, grouped by kind.
|
|
7
6
|
*/
|
|
8
7
|
/**
|
|
9
8
|
* Render grouped results as sectioned compact output.
|
|
@@ -14,8 +14,7 @@ import type { RowKind } from '../commands/types';
|
|
|
14
14
|
* is not an array (so the caller can fall back to generic JSON rendering).
|
|
15
15
|
*
|
|
16
16
|
* `showFollowUp` (default `false`) adds a `→ ads-cli <command> <name>` drill-in hint beneath each
|
|
17
|
-
* row.
|
|
18
|
-
* off so the output stays terse.
|
|
17
|
+
* row. Search enables it for both grouped and `--type` output; `--all` listings leave it off.
|
|
19
18
|
*/
|
|
20
19
|
export declare const formatCompactResults: ({ kind, data, showFollowUp, }: {
|
|
21
20
|
kind: RowKind;
|
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
|
}
|