@astralkit/cli 4.7.1 → 4.7.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.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/commands/list.js +8 -5
- package/src/commands/search.js +18 -6
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to the `@astralkit/cli` package.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [4.7.2] (2026-11-30)
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **`astralkit search` and `astralkit list` work again.** `search <anything>` stopped with "(components.value || []).map is not a function", and `list` (also with `--boosters` or `--workflows`) answered "No components found." Both read the registry's answer as a bare list; it is an object holding the list. `add` was not affected.
|
|
12
|
+
- When the registry holds more than it returns in one answer, the heading says so ("Showing 50 of 636 components available") instead of giving the number shown as the whole library.
|
|
13
|
+
|
|
8
14
|
## [4.7.1] (2026-11-30)
|
|
9
15
|
|
|
10
16
|
### Fixed
|
package/package.json
CHANGED
package/src/commands/list.js
CHANGED
|
@@ -15,12 +15,15 @@ export async function listCommand(options) {
|
|
|
15
15
|
const spinner = ora(`Fetching ${type}...`).start();
|
|
16
16
|
|
|
17
17
|
try {
|
|
18
|
-
let items;
|
|
19
18
|
const filters = { framework: options.framework, pro: options.pro, free: options.free, category: options.category };
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
else
|
|
20
|
+
let res;
|
|
21
|
+
if (options.boosters) res = await listBoosters(filters);
|
|
22
|
+
else if (options.workflows) res = await listWorkflows(filters);
|
|
23
|
+
else res = await listComponents(filters);
|
|
24
|
+
// The API answers { components: [...], pagination, total } (or boosters / workflows). Older answers were a bare list.
|
|
25
|
+
const items = Array.isArray(res) ? res : res?.[type] || res?.data || [];
|
|
26
|
+
const total = res?.pagination?.total ?? items.length;
|
|
24
27
|
|
|
25
28
|
spinner.stop();
|
|
26
29
|
|
|
@@ -30,7 +33,7 @@ export async function listCommand(options) {
|
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
console.log();
|
|
33
|
-
console.log(pc.bold(` ${items.length} ${type} available\n`));
|
|
36
|
+
console.log(pc.bold(` ${total > items.length ? `Showing ${items.length} of ${total}` : items.length} ${type} available\n`));
|
|
34
37
|
|
|
35
38
|
for (const item of items) {
|
|
36
39
|
const proTag = item.is_pro ? pc.magenta(' [PRO]') : pc.green(' [FREE]');
|
package/src/commands/search.js
CHANGED
|
@@ -7,6 +7,10 @@ const s = (v) => sanitizeForTerminal(v || '');
|
|
|
7
7
|
|
|
8
8
|
const FRAMEWORK_LABELS = { nextjs: 'Next.js', react: 'React', html: 'HTML' };
|
|
9
9
|
|
|
10
|
+
// The API answers { components: [...], pagination, total } (or boosters / workflows). Older answers were a bare list.
|
|
11
|
+
const itemsOf = (res, key) => (Array.isArray(res) ? res : res?.[key] || res?.data || []);
|
|
12
|
+
const totalOf = (res, shown) => res?.pagination?.total ?? shown;
|
|
13
|
+
|
|
10
14
|
export async function searchCommand(query, options) {
|
|
11
15
|
const ora = (await import('ora')).default;
|
|
12
16
|
const spinner = ora(`Searching for "${pc.cyan(query)}"...`).start();
|
|
@@ -14,11 +18,16 @@ export async function searchCommand(query, options) {
|
|
|
14
18
|
try {
|
|
15
19
|
const filters = { search: query, framework: options.framework };
|
|
16
20
|
let results = [];
|
|
21
|
+
let total = 0;
|
|
17
22
|
|
|
18
23
|
if (options.boosters) {
|
|
19
|
-
|
|
24
|
+
const res = await listBoosters(filters);
|
|
25
|
+
results = itemsOf(res, 'boosters');
|
|
26
|
+
total = totalOf(res, results.length);
|
|
20
27
|
} else if (options.workflows) {
|
|
21
|
-
|
|
28
|
+
const res = await listWorkflows(filters);
|
|
29
|
+
results = itemsOf(res, 'workflows');
|
|
30
|
+
total = totalOf(res, results.length);
|
|
22
31
|
} else {
|
|
23
32
|
// Search all three in parallel
|
|
24
33
|
const [components, boosters, workflows] = await Promise.allSettled([
|
|
@@ -26,9 +35,12 @@ export async function searchCommand(query, options) {
|
|
|
26
35
|
listBoosters(filters),
|
|
27
36
|
listWorkflows(filters),
|
|
28
37
|
]);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
for (const [settled, key, type] of [[components, 'components', 'component'], [boosters, 'boosters', 'booster'], [workflows, 'workflows', 'workflow']]) {
|
|
39
|
+
if (settled.status !== 'fulfilled') continue;
|
|
40
|
+
const items = itemsOf(settled.value, key);
|
|
41
|
+
results.push(...items.map(i => ({ ...i, _type: type })));
|
|
42
|
+
total += totalOf(settled.value, items.length);
|
|
43
|
+
}
|
|
32
44
|
}
|
|
33
45
|
|
|
34
46
|
spinner.stop();
|
|
@@ -39,7 +51,7 @@ export async function searchCommand(query, options) {
|
|
|
39
51
|
}
|
|
40
52
|
|
|
41
53
|
console.log();
|
|
42
|
-
console.log(pc.bold(` ${results.length} result(s) for "${query}"\n`));
|
|
54
|
+
console.log(pc.bold(` ${total > results.length ? `Showing ${results.length} of ${total}` : results.length} result(s) for "${query}"\n`));
|
|
43
55
|
|
|
44
56
|
for (const item of results) {
|
|
45
57
|
const typeLabel = item._type ? pc.gray(` [${item._type}]`) : '';
|