@astralkit/cli 4.7.0 → 4.7.1
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/add.js +18 -4
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.1] (2026-11-30)
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **The free components install without a key.** `astralkit add button` stopped with "No API key found" before it had asked for anything, so nobody without a key could install even the free set. A component is now asked for first; the registry says when one is premium, and the CLI then gives the three ways to sign in (`astralkit login`, `astralkit init --api-key`, or the `ASTRALKIT_API_KEY` environment variable). Boosters and workflows still need a key.
|
|
12
|
+
- **A name that is not found ends with exit code 1.** `astralkit add no-such-thing` printed "not found" and exited 0, so a script or an agent took it for installed.
|
|
13
|
+
|
|
8
14
|
## [4.7.0] (2026-11-30)
|
|
9
15
|
|
|
10
16
|
### Added
|
package/package.json
CHANGED
package/src/commands/add.js
CHANGED
|
@@ -71,10 +71,13 @@ async function addOne(nameOrSlug, options) {
|
|
|
71
71
|
saveApiKey(options.apiKey);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
//
|
|
75
|
-
//
|
|
74
|
+
// A component needs no key to be asked for (2026-11-30): the free components install for everyone, and the
|
|
75
|
+
// registry itself says when one is premium (handleAddError then tells how to sign in). The CLI used to stop here
|
|
76
|
+
// with "No API key found" before asking, so nobody without a key could install even the free set.
|
|
77
|
+
// Boosters and workflows are for paid plans: they still need a key, unless read from a local registry
|
|
78
|
+
// (the developer's own disk, no account needed).
|
|
76
79
|
const localBoosterInstall = LOCAL_REGISTRY_DIR && (options.booster || options.workflow);
|
|
77
|
-
if (!getApiKey() && !localBoosterInstall) {
|
|
80
|
+
if ((options.booster || options.workflow) && !getApiKey() && !localBoosterInstall) {
|
|
78
81
|
const auth = getAuth();
|
|
79
82
|
if (!auth.token) {
|
|
80
83
|
p.log.warn('No API key found. Run ' + pc.cyan('astralkit init --api-key <key>') + ' first.');
|
|
@@ -141,6 +144,8 @@ async function addOne(nameOrSlug, options) {
|
|
|
141
144
|
p.log.error(`"${nameOrSlug}" not found in any registry.`);
|
|
142
145
|
p.log.info('Run ' + pc.cyan('astralkit search "' + nameOrSlug + '"') + ' to browse available content.');
|
|
143
146
|
}
|
|
147
|
+
// nothing was installed: a script or an agent must be able to tell (the exit code was 0)
|
|
148
|
+
process.exitCode = 1;
|
|
144
149
|
return;
|
|
145
150
|
}
|
|
146
151
|
|
|
@@ -820,7 +825,16 @@ async function addWorkflow(slug, options) {
|
|
|
820
825
|
|
|
821
826
|
function handleAddError(err, slug, framework) {
|
|
822
827
|
if (err.code === 'AUTH_REQUIRED') {
|
|
823
|
-
|
|
828
|
+
if (!getApiKey() && !getAuth().token) {
|
|
829
|
+
// no key at all: say what the component is and the three ways to give one
|
|
830
|
+
p.log.warn(`${pc.cyan(slug)} is a premium component: it needs your AstralKit API key.`);
|
|
831
|
+
console.log(pc.gray(' Sign in once: ') + pc.cyan('astralkit login'));
|
|
832
|
+
console.log(pc.gray(' Or save a key: ') + pc.cyan('astralkit init --api-key <key>'));
|
|
833
|
+
console.log(pc.gray(' Or for this run: set the ASTRALKIT_API_KEY environment variable'));
|
|
834
|
+
console.log(pc.gray(' Your key is at ') + pc.cyan('https://astralkit.com/account') + pc.gray('. The free components install without one: ') + pc.cyan('astralkit list --free'));
|
|
835
|
+
} else {
|
|
836
|
+
p.log.warn(err.message);
|
|
837
|
+
}
|
|
824
838
|
} else if (err.code === 'PRO_REQUIRED') {
|
|
825
839
|
p.log.warn(`${FRAMEWORK_LABELS[framework] || framework} version requires a Pro subscription.`);
|
|
826
840
|
console.log(pc.gray(' Upgrade at ') + pc.cyan('https://astralkit.com/pricing'));
|