@nucleoicons/skills 0.1.7 → 0.1.8
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/README.md +3 -1
- package/dist/commands/setup.js +7 -2
- package/dist/commands/update.js +5 -20
- package/dist/config.d.ts +2 -2
- package/dist/install.d.ts +38 -4
- package/dist/install.js +94 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Requires **Node.js 20+**.
|
|
|
14
14
|
|
|
15
15
|
## Install
|
|
16
16
|
|
|
17
|
-
**Pro** (Nucleo account — licensed families):
|
|
17
|
+
**Pro** (Nucleo account — licensed families **plus** free sets in the same install):
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
npx @nucleoicons/skills setup --target react --tools cursor
|
|
@@ -26,6 +26,8 @@ npx @nucleoicons/skills setup --target react --tools cursor
|
|
|
26
26
|
npx @nucleoicons/skills setup --free --target react --tools cursor
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
If Pro is already installed, `setup --free` **merges** free families in and keeps Pro. Free-only installs never download Pro families (login required for Pro).
|
|
30
|
+
|
|
29
31
|
**Required for setup:** `--target` (`react` or `vanilla`) and `--tools` (`cursor`, `claude`, `codex`).
|
|
30
32
|
|
|
31
33
|
```bash
|
package/dist/commands/setup.js
CHANGED
|
@@ -2,7 +2,7 @@ import { confirm, select, checkbox } from "@inquirer/prompts";
|
|
|
2
2
|
import { mkdir } from "node:fs/promises";
|
|
3
3
|
import { ApiError, fetchSkillsFreeRelease, fetchSkillsRelease } from "../api.js";
|
|
4
4
|
import { installRoot, nucleoHomeDir } from "../config.js";
|
|
5
|
-
import { buildMcp, ensureManifestTarget, installFromLocalDir, installFromRelease, readInstallManifest, } from "../install.js";
|
|
5
|
+
import { buildMcp, ensureManifestTarget, hasProFamilies, installFromLocalDir, installFromRelease, readInstallManifest, } from "../install.js";
|
|
6
6
|
import { configureTool } from "../adapters/agents.js";
|
|
7
7
|
import { ensureSkillsSession, isInvalidTokenError } from "../session.js";
|
|
8
8
|
async function fetchProReleaseWithSession(target, emailHint) {
|
|
@@ -64,6 +64,10 @@ export async function runSetup(options = {}) {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
else if (free) {
|
|
67
|
+
const mergingIntoPro = hasProFamilies();
|
|
68
|
+
if (mergingIntoPro) {
|
|
69
|
+
console.log("Existing Pro install detected — free icons will be added alongside Pro.\n");
|
|
70
|
+
}
|
|
67
71
|
console.log(`Fetching free ${target} release…`);
|
|
68
72
|
let release;
|
|
69
73
|
try {
|
|
@@ -82,7 +86,7 @@ export async function runSetup(options = {}) {
|
|
|
82
86
|
await installFromRelease(release, target);
|
|
83
87
|
}
|
|
84
88
|
else {
|
|
85
|
-
console.log(`Fetching ${target} release…`);
|
|
89
|
+
console.log(`Fetching ${target} release (Pro + free)…`);
|
|
86
90
|
let release;
|
|
87
91
|
try {
|
|
88
92
|
release = await fetchProReleaseWithSession(target, options.email);
|
|
@@ -111,5 +115,6 @@ export async function runSetup(options = {}) {
|
|
|
111
115
|
console.log(` Target: ${manifest?.target ?? target}`);
|
|
112
116
|
console.log(` Tier: ${manifest?.tier ?? (free ? "free" : "pro")}`);
|
|
113
117
|
console.log(` Version: ${manifest?.version ?? "(none)"}`);
|
|
118
|
+
console.log(` Families: ${(manifest?.families ?? []).join(", ") || "(none)"}`);
|
|
114
119
|
console.log("\nReload MCP in your editor, then try asking about Nucleo icons.\n");
|
|
115
120
|
}
|
package/dist/commands/update.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { confirm } from "@inquirer/prompts";
|
|
2
2
|
import { ApiError, fetchSkillsFreeRelease, fetchSkillsRelease } from "../api.js";
|
|
3
3
|
import { installRoot } from "../config.js";
|
|
4
|
-
import { buildMcp, ensureManifestTarget, installFromLocalDir, installFromRelease, readInstallManifest, } from "../install.js";
|
|
4
|
+
import { buildMcp, ensureManifestTarget, installFromLocalDir, installFromRelease, isFreeOnlyInstall, readInstallManifest, } from "../install.js";
|
|
5
5
|
import { configureTool } from "../adapters/agents.js";
|
|
6
6
|
import { ensureSkillsSession, isInvalidTokenError } from "../session.js";
|
|
7
7
|
async function fetchProReleaseWithSession(target) {
|
|
@@ -18,18 +18,6 @@ async function fetchProReleaseWithSession(target) {
|
|
|
18
18
|
throw error;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function isFreeInstall(manifest) {
|
|
22
|
-
if (!manifest) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
if (manifest.tier === "free") {
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
if (typeof manifest.product === "string" && manifest.product.includes("free")) {
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
21
|
export async function runUpdate(options = {}) {
|
|
34
22
|
console.log("\nNucleo Skills update");
|
|
35
23
|
console.log("────────────────────\n");
|
|
@@ -39,14 +27,11 @@ export async function runUpdate(options = {}) {
|
|
|
39
27
|
}
|
|
40
28
|
const target = manifest?.target ?? "react";
|
|
41
29
|
const localVersion = manifest?.version ?? "0.0.0";
|
|
42
|
-
const
|
|
30
|
+
const freeOnly = isFreeOnlyInstall(installRoot(), manifest);
|
|
43
31
|
if (options.from) {
|
|
44
32
|
console.log(`Updating from local folder:\n ${options.from}\n`);
|
|
45
33
|
await installFromLocalDir(options.from);
|
|
46
|
-
await ensureManifestTarget(target
|
|
47
|
-
tier: free ? "free" : "pro",
|
|
48
|
-
product: free ? "nucleo-skills-free" : "nucleo-skills",
|
|
49
|
-
});
|
|
34
|
+
await ensureManifestTarget(target);
|
|
50
35
|
console.log("Building MCP…");
|
|
51
36
|
await buildMcp();
|
|
52
37
|
await reconfigure(options.tools);
|
|
@@ -57,12 +42,12 @@ export async function runUpdate(options = {}) {
|
|
|
57
42
|
}
|
|
58
43
|
let release;
|
|
59
44
|
try {
|
|
60
|
-
if (
|
|
45
|
+
if (freeOnly) {
|
|
61
46
|
console.log("Channel: free");
|
|
62
47
|
release = await fetchSkillsFreeRelease(target);
|
|
63
48
|
}
|
|
64
49
|
else {
|
|
65
|
-
console.log("Channel: pro");
|
|
50
|
+
console.log("Channel: pro (+ free)");
|
|
66
51
|
release = await fetchProReleaseWithSession(target);
|
|
67
52
|
}
|
|
68
53
|
}
|
package/dist/config.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export interface NucleoCredentials {
|
|
|
15
15
|
}
|
|
16
16
|
export interface InstallManifest {
|
|
17
17
|
product?: string;
|
|
18
|
-
/** free | pro — drives update channel without requiring --free again */
|
|
19
|
-
tier?: "free" | "pro" | string;
|
|
18
|
+
/** free | pro | pro+free — drives update channel without requiring --free again */
|
|
19
|
+
tier?: "free" | "pro" | "pro+free" | string;
|
|
20
20
|
target?: PackageTarget | string;
|
|
21
21
|
version?: string;
|
|
22
22
|
families?: string[];
|
package/dist/install.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type SkillsReleaseData } from "./api.js";
|
|
2
2
|
import { type InstallManifest, type PackageTarget } from "./config.js";
|
|
3
|
+
/** Licensed Pro families — never installed via the free (no-auth) channel. */
|
|
4
|
+
export declare const PRO_FAMILIES: readonly ["core", "ui", "sharp", "micro", "pixel"];
|
|
5
|
+
/** Free families from react-free.zip / vanilla-free.zip. */
|
|
6
|
+
export declare const FREE_FAMILIES: readonly ["flags", "cursors", "credit-cards", "social-media", "isometric", "arcade", "glass"];
|
|
3
7
|
/**
|
|
4
8
|
* Resolve a real npm binary. Prefer the one next to the running Node
|
|
5
9
|
* (`process.execPath`) so we don't depend on PATH / shell aliases
|
|
@@ -8,12 +12,42 @@ import { type InstallManifest, type PackageTarget } from "./config.js";
|
|
|
8
12
|
export declare function resolveNpmBin(): string;
|
|
9
13
|
export declare function readInstallManifest(root?: string): Promise<InstallManifest | null>;
|
|
10
14
|
export declare function cleanInstallRoot(root?: string): Promise<void>;
|
|
15
|
+
/** True if any Pro family catalog is present under the install root. */
|
|
16
|
+
export declare function hasProFamilies(root?: string): boolean;
|
|
17
|
+
/** True if any free family catalog is present under the install root. */
|
|
18
|
+
export declare function hasFreeFamilies(root?: string): boolean;
|
|
11
19
|
/**
|
|
12
|
-
*
|
|
13
|
-
* Downloads complete first, then the install folder is replaced — so a failed
|
|
14
|
-
* download does not wipe a previous working install.
|
|
20
|
+
* Detect installed icon families by looking for `{family}/icons.json`.
|
|
15
21
|
*/
|
|
16
|
-
export declare function
|
|
22
|
+
export declare function detectInstalledFamilies(root?: string): string[];
|
|
23
|
+
export declare function resolveInstallTier(root?: string): {
|
|
24
|
+
hasPro: boolean;
|
|
25
|
+
hasFree: boolean;
|
|
26
|
+
tier: "free" | "pro" | "pro+free";
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Free-only installs use the public free channel.
|
|
30
|
+
* Any Pro families on disk → Pro (authenticated) channel, which also ships free.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isFreeOnlyInstall(root?: string, manifest?: InstallManifest | null): boolean;
|
|
33
|
+
export interface InstallFromReleaseOptions {
|
|
34
|
+
/**
|
|
35
|
+
* When true, extract into the existing root without wiping.
|
|
36
|
+
* Used so `setup --free` can add free families beside Pro.
|
|
37
|
+
* Default: auto — merge free releases onto an existing Pro install.
|
|
38
|
+
*/
|
|
39
|
+
merge?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Download all release files (signed URLs) and install into the root.
|
|
43
|
+
*
|
|
44
|
+
* - Pro releases: replace the install root, then extract (Pro zips + free zip).
|
|
45
|
+
* - Free releases on top of Pro: merge (keep Pro families).
|
|
46
|
+
* - Free-only: replace the install root with free content.
|
|
47
|
+
*
|
|
48
|
+
* Downloads complete first — a failed download does not wipe a previous install.
|
|
49
|
+
*/
|
|
50
|
+
export declare function installFromRelease(release: SkillsReleaseData, target: PackageTarget, root?: string, options?: InstallFromReleaseOptions): Promise<void>;
|
|
17
51
|
/**
|
|
18
52
|
* Copy a local prepared package (e.g. packages/react) into the install root.
|
|
19
53
|
*/
|
package/dist/install.js
CHANGED
|
@@ -7,6 +7,18 @@ import extract from "extract-zip";
|
|
|
7
7
|
import { downloadUrlToFile, formatBytes } from "./api.js";
|
|
8
8
|
import { installRoot, nucleoHomeDir } from "./config.js";
|
|
9
9
|
const execFileAsync = promisify(execFile);
|
|
10
|
+
/** Licensed Pro families — never installed via the free (no-auth) channel. */
|
|
11
|
+
export const PRO_FAMILIES = ["core", "ui", "sharp", "micro", "pixel"];
|
|
12
|
+
/** Free families from react-free.zip / vanilla-free.zip. */
|
|
13
|
+
export const FREE_FAMILIES = [
|
|
14
|
+
"flags",
|
|
15
|
+
"cursors",
|
|
16
|
+
"credit-cards",
|
|
17
|
+
"social-media",
|
|
18
|
+
"isometric",
|
|
19
|
+
"arcade",
|
|
20
|
+
"glass",
|
|
21
|
+
];
|
|
10
22
|
/**
|
|
11
23
|
* Resolve a real npm binary. Prefer the one next to the running Node
|
|
12
24
|
* (`process.execPath`) so we don't depend on PATH / shell aliases
|
|
@@ -58,6 +70,52 @@ export async function cleanInstallRoot(root = installRoot()) {
|
|
|
58
70
|
await rm(root, { recursive: true, force: true });
|
|
59
71
|
await mkdir(root, { recursive: true });
|
|
60
72
|
}
|
|
73
|
+
/** True if any Pro family catalog is present under the install root. */
|
|
74
|
+
export function hasProFamilies(root = installRoot()) {
|
|
75
|
+
return PRO_FAMILIES.some((family) => existsSync(join(root, family, "icons.json")));
|
|
76
|
+
}
|
|
77
|
+
/** True if any free family catalog is present under the install root. */
|
|
78
|
+
export function hasFreeFamilies(root = installRoot()) {
|
|
79
|
+
return FREE_FAMILIES.some((family) => existsSync(join(root, family, "icons.json")));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Detect installed icon families by looking for `{family}/icons.json`.
|
|
83
|
+
*/
|
|
84
|
+
export function detectInstalledFamilies(root = installRoot()) {
|
|
85
|
+
const known = [...PRO_FAMILIES, ...FREE_FAMILIES];
|
|
86
|
+
return known.filter((family) => existsSync(join(root, family, "icons.json")));
|
|
87
|
+
}
|
|
88
|
+
export function resolveInstallTier(root = installRoot()) {
|
|
89
|
+
const hasPro = hasProFamilies(root);
|
|
90
|
+
const hasFree = hasFreeFamilies(root);
|
|
91
|
+
if (hasPro && hasFree) {
|
|
92
|
+
return { hasPro, hasFree, tier: "pro+free" };
|
|
93
|
+
}
|
|
94
|
+
if (hasPro) {
|
|
95
|
+
return { hasPro, hasFree, tier: "pro" };
|
|
96
|
+
}
|
|
97
|
+
return { hasPro, hasFree, tier: "free" };
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Free-only installs use the public free channel.
|
|
101
|
+
* Any Pro families on disk → Pro (authenticated) channel, which also ships free.
|
|
102
|
+
*/
|
|
103
|
+
export function isFreeOnlyInstall(root = installRoot(), manifest) {
|
|
104
|
+
if (hasProFamilies(root)) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
if (manifest?.tier === "pro" || manifest?.tier === "pro+free") {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
if (manifest?.tier === "free") {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
if (typeof manifest?.product === "string" && manifest.product.includes("free")) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
// No Pro on disk and no explicit Pro tier → free-only channel.
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
61
119
|
async function canRunUnzip() {
|
|
62
120
|
try {
|
|
63
121
|
await execFileAsync("unzip", ["-v"], { timeout: 5_000 });
|
|
@@ -104,11 +162,15 @@ async function assertInstallLooksComplete(root) {
|
|
|
104
162
|
}
|
|
105
163
|
}
|
|
106
164
|
/**
|
|
107
|
-
* Download all release files (signed URLs) and
|
|
108
|
-
*
|
|
109
|
-
*
|
|
165
|
+
* Download all release files (signed URLs) and install into the root.
|
|
166
|
+
*
|
|
167
|
+
* - Pro releases: replace the install root, then extract (Pro zips + free zip).
|
|
168
|
+
* - Free releases on top of Pro: merge (keep Pro families).
|
|
169
|
+
* - Free-only: replace the install root with free content.
|
|
170
|
+
*
|
|
171
|
+
* Downloads complete first — a failed download does not wipe a previous install.
|
|
110
172
|
*/
|
|
111
|
-
export async function installFromRelease(release, target, root = installRoot()) {
|
|
173
|
+
export async function installFromRelease(release, target, root = installRoot(), options = {}) {
|
|
112
174
|
if (!release.downloadReady) {
|
|
113
175
|
throw new Error(release.message ||
|
|
114
176
|
"Downloads are not ready on the server yet. Please try again later.");
|
|
@@ -117,6 +179,15 @@ export async function installFromRelease(release, target, root = installRoot())
|
|
|
117
179
|
if (missingUrl.length > 0) {
|
|
118
180
|
throw new Error(`Release files missing download urls: ${missingUrl.map((f) => f.id).join(", ")}`);
|
|
119
181
|
}
|
|
182
|
+
const isFreeRelease = release.tier === "free";
|
|
183
|
+
const merge = options.merge ?? (isFreeRelease && existsSync(root) && hasProFamilies(root));
|
|
184
|
+
// Safety: free channel must never claim Pro family modules.
|
|
185
|
+
if (isFreeRelease) {
|
|
186
|
+
const forbidden = release.files.filter((f) => PRO_FAMILIES.includes(f.id));
|
|
187
|
+
if (forbidden.length > 0) {
|
|
188
|
+
throw new Error(`Free release unexpectedly included Pro modules: ${forbidden.map((f) => f.id).join(", ")}`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
120
191
|
const downloadsDir = join(nucleoHomeDir(), "downloads");
|
|
121
192
|
await mkdir(downloadsDir, { recursive: true });
|
|
122
193
|
const downloaded = [];
|
|
@@ -150,9 +221,14 @@ export async function installFromRelease(release, target, root = installRoot())
|
|
|
150
221
|
}
|
|
151
222
|
downloaded.push({ id: file.id, zipPath });
|
|
152
223
|
}
|
|
153
|
-
// 2)
|
|
154
|
-
console.log(" Extracting…");
|
|
155
|
-
|
|
224
|
+
// 2) Extract — wipe unless merging free into Pro
|
|
225
|
+
console.log(merge ? " Merging into existing install (Pro families kept)…" : " Extracting…");
|
|
226
|
+
if (!merge) {
|
|
227
|
+
await cleanInstallRoot(root);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
await mkdir(root, { recursive: true });
|
|
231
|
+
}
|
|
156
232
|
for (const file of downloaded) {
|
|
157
233
|
const zipInfo = await stat(file.zipPath);
|
|
158
234
|
process.stdout.write(` ▸ ${file.id} (${formatBytes(zipInfo.size)}) `);
|
|
@@ -172,12 +248,14 @@ export async function installFromRelease(release, target, root = installRoot())
|
|
|
172
248
|
finally {
|
|
173
249
|
await rm(downloadsDir, { recursive: true, force: true }).catch(() => undefined);
|
|
174
250
|
}
|
|
251
|
+
const families = detectInstalledFamilies(root);
|
|
252
|
+
const { tier } = resolveInstallTier(root);
|
|
175
253
|
await writeInstallManifest({
|
|
176
|
-
product:
|
|
177
|
-
tier
|
|
254
|
+
product: tier === "free" ? "nucleo-skills-free" : "nucleo-skills",
|
|
255
|
+
tier,
|
|
178
256
|
target,
|
|
179
257
|
version: release.version,
|
|
180
|
-
families
|
|
258
|
+
families,
|
|
181
259
|
}, root);
|
|
182
260
|
}
|
|
183
261
|
/**
|
|
@@ -205,15 +283,18 @@ export async function ensureManifestTarget(target, extras = {}, root = installRo
|
|
|
205
283
|
manifest = {};
|
|
206
284
|
}
|
|
207
285
|
}
|
|
286
|
+
const families = extras.families ?? detectInstalledFamilies(root);
|
|
287
|
+
const { tier: detectedTier } = resolveInstallTier(root);
|
|
208
288
|
manifest = {
|
|
209
289
|
...manifest,
|
|
210
290
|
...extras,
|
|
211
291
|
target: extras.target ?? manifest.target ?? target,
|
|
212
292
|
version: extras.version ?? manifest.version ?? "0.0.0-local",
|
|
293
|
+
families,
|
|
294
|
+
tier: extras.tier ?? detectedTier,
|
|
295
|
+
product: extras.product ??
|
|
296
|
+
(detectedTier === "free" ? "nucleo-skills-free" : "nucleo-skills"),
|
|
213
297
|
};
|
|
214
|
-
if (extras.families) {
|
|
215
|
-
manifest.families = extras.families;
|
|
216
|
-
}
|
|
217
298
|
await writeInstallManifest(manifest, root);
|
|
218
299
|
return manifest;
|
|
219
300
|
}
|