@hanzogui/get 8.0.0 → 8.1.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/dist/cli.js +31 -49
- package/package.json +3 -3
- package/src/cli.ts +6 -2
- package/src/commands/pick.ts +4 -4
package/dist/cli.js
CHANGED
|
@@ -5,43 +5,25 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
function __accessProp(key) {
|
|
9
|
-
return this[key];
|
|
10
|
-
}
|
|
11
|
-
var __toESMCache_node;
|
|
12
|
-
var __toESMCache_esm;
|
|
13
8
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
-
var canCache = mod != null && typeof mod === "object";
|
|
15
|
-
if (canCache) {
|
|
16
|
-
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
-
var cached = cache.get(mod);
|
|
18
|
-
if (cached)
|
|
19
|
-
return cached;
|
|
20
|
-
}
|
|
21
9
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
10
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
11
|
for (let key of __getOwnPropNames(mod))
|
|
24
12
|
if (!__hasOwnProp.call(to, key))
|
|
25
13
|
__defProp(to, key, {
|
|
26
|
-
get:
|
|
14
|
+
get: () => mod[key],
|
|
27
15
|
enumerable: true
|
|
28
16
|
});
|
|
29
|
-
if (canCache)
|
|
30
|
-
cache.set(mod, to);
|
|
31
17
|
return to;
|
|
32
18
|
};
|
|
33
19
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
-
var __returnValue = (v) => v;
|
|
35
|
-
function __exportSetter(name, newValue) {
|
|
36
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
37
|
-
}
|
|
38
20
|
var __export = (target, all) => {
|
|
39
21
|
for (var name in all)
|
|
40
22
|
__defProp(target, name, {
|
|
41
23
|
get: all[name],
|
|
42
24
|
enumerable: true,
|
|
43
25
|
configurable: true,
|
|
44
|
-
set:
|
|
26
|
+
set: (newValue) => all[name] = () => newValue
|
|
45
27
|
});
|
|
46
28
|
};
|
|
47
29
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -64,7 +46,7 @@ var init_ansi = __esm(() => {
|
|
|
64
46
|
var require_package = __commonJS((exports, module) => {
|
|
65
47
|
module.exports = {
|
|
66
48
|
name: "@hanzogui/get",
|
|
67
|
-
version: "8.
|
|
49
|
+
version: "8.1.0",
|
|
68
50
|
description: "CLI installer for Hanzo GUI recipes.",
|
|
69
51
|
license: "BSD-3-Clause",
|
|
70
52
|
author: "Hanzo AI <dev@hanzo.ai>",
|
|
@@ -1420,6 +1402,32 @@ async function readConfig(root) {
|
|
|
1420
1402
|
function resolveInstallDir(root, config) {
|
|
1421
1403
|
return path.join(root, config.installDir ?? DEFAULT_INSTALL_DIR);
|
|
1422
1404
|
}
|
|
1405
|
+
async function getInstallDir(opts) {
|
|
1406
|
+
if (opts.installDir)
|
|
1407
|
+
return opts.installDir;
|
|
1408
|
+
const root = await findProjectRoot(opts.cwd);
|
|
1409
|
+
return resolveInstallDir(root, await readConfig(root));
|
|
1410
|
+
}
|
|
1411
|
+
async function installRecipe(recipe, opts = {}) {
|
|
1412
|
+
const installDir = await getInstallDir(opts);
|
|
1413
|
+
const written = [];
|
|
1414
|
+
for (const file of recipe.files) {
|
|
1415
|
+
const dest = path2.join(installDir, file.path);
|
|
1416
|
+
const dir = path2.dirname(dest);
|
|
1417
|
+
if (!existsSync2(dir))
|
|
1418
|
+
await fs2.mkdir(dir, { recursive: true });
|
|
1419
|
+
await fs2.writeFile(dest, file.source);
|
|
1420
|
+
written.push(dest);
|
|
1421
|
+
}
|
|
1422
|
+
return written;
|
|
1423
|
+
}
|
|
1424
|
+
async function installPlan(plan, opts = {}) {
|
|
1425
|
+
const written = [];
|
|
1426
|
+
for (const r of [plan.recipe, ...plan.transitiveRecipes]) {
|
|
1427
|
+
written.push(...await installRecipe(r, opts));
|
|
1428
|
+
}
|
|
1429
|
+
return written;
|
|
1430
|
+
}
|
|
1423
1431
|
async function getJSON(url) {
|
|
1424
1432
|
const res = await fetch(url, { headers: { Accept: "application/json" } });
|
|
1425
1433
|
if (!res.ok) {
|
|
@@ -1467,36 +1475,10 @@ async function resolveRecipe(slug, opts = {}) {
|
|
|
1467
1475
|
})();
|
|
1468
1476
|
const recipe = seen.get(slug);
|
|
1469
1477
|
const transitiveRecipes = Array.from(seen.values()).filter((r) => r.slug !== slug);
|
|
1470
|
-
const
|
|
1471
|
-
const targetPaths = [recipe, ...transitiveRecipes].flatMap((r) => r.files.map((f) =>
|
|
1478
|
+
const path3 = await import("node:path");
|
|
1479
|
+
const targetPaths = [recipe, ...transitiveRecipes].flatMap((r) => r.files.map((f) => path3.join(installDir, f.path)));
|
|
1472
1480
|
return { recipe, transitiveRecipes, targetPaths };
|
|
1473
1481
|
}
|
|
1474
|
-
async function getInstallDir(opts) {
|
|
1475
|
-
if (opts.installDir)
|
|
1476
|
-
return opts.installDir;
|
|
1477
|
-
const root = await findProjectRoot(opts.cwd);
|
|
1478
|
-
return resolveInstallDir(root, await readConfig(root));
|
|
1479
|
-
}
|
|
1480
|
-
async function installRecipe(recipe, opts = {}) {
|
|
1481
|
-
const installDir = await getInstallDir(opts);
|
|
1482
|
-
const written = [];
|
|
1483
|
-
for (const file of recipe.files) {
|
|
1484
|
-
const dest = path2.join(installDir, file.path);
|
|
1485
|
-
const dir = path2.dirname(dest);
|
|
1486
|
-
if (!existsSync2(dir))
|
|
1487
|
-
await fs2.mkdir(dir, { recursive: true });
|
|
1488
|
-
await fs2.writeFile(dest, file.source);
|
|
1489
|
-
written.push(dest);
|
|
1490
|
-
}
|
|
1491
|
-
return written;
|
|
1492
|
-
}
|
|
1493
|
-
async function installPlan(plan, opts = {}) {
|
|
1494
|
-
const written = [];
|
|
1495
|
-
for (const r of [plan.recipe, ...plan.transitiveRecipes]) {
|
|
1496
|
-
written.push(...await installRecipe(r, opts));
|
|
1497
|
-
}
|
|
1498
|
-
return written;
|
|
1499
|
-
}
|
|
1500
1482
|
var DEFAULT_BASE_URL = "https://base.hanzo.ai", RECIPES_COLLECTION = "gui_recipes", DEFAULT_INSTALL_DIR = "src/gui", DEFAULT_CONFIG_FILENAMES;
|
|
1501
1483
|
var init_dist = __esm(() => {
|
|
1502
1484
|
DEFAULT_CONFIG_FILENAMES = ["gui.config.json", ".guirc.json"];
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/get",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"description": "CLI installer for Hanzo GUI recipes.",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"author": "Hanzo AI <dev@hanzo.ai>",
|
|
7
7
|
"homepage": "https://gui.hanzo.ai",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/hanzoai/gui.git",
|
|
10
|
+
"url": "git+https://github.com/hanzoai/gui.git",
|
|
11
11
|
"directory": "pkgs/get"
|
|
12
12
|
},
|
|
13
13
|
"bin": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"test": "bun test"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@hanzogui/recipes": "8.
|
|
33
|
+
"@hanzogui/recipes": "8.1.1",
|
|
34
34
|
"fuse.js": "7.1.0"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
package/src/cli.ts
CHANGED
|
@@ -24,8 +24,12 @@ async function main(): Promise<void> {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
if (cmd === '--version' || cmd === '-v') {
|
|
27
|
-
const pkg = await import('../package.json', {
|
|
28
|
-
|
|
27
|
+
const pkg = await import('../package.json', {
|
|
28
|
+
with: { type: 'json' },
|
|
29
|
+
} as ImportCallOptions)
|
|
30
|
+
process.stdout.write(
|
|
31
|
+
((pkg as { default?: { version?: string } }).default?.version ?? 'unknown') + '\n'
|
|
32
|
+
)
|
|
29
33
|
return
|
|
30
34
|
}
|
|
31
35
|
|
package/src/commands/pick.ts
CHANGED
|
@@ -19,10 +19,10 @@ export async function pick(): Promise<void> {
|
|
|
19
19
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout })
|
|
20
20
|
|
|
21
21
|
try {
|
|
22
|
-
const query = (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const query = (
|
|
23
|
+
await rl.question(bold('Search recipes') + ' (empty = show all): ')
|
|
24
|
+
).trim()
|
|
25
|
+
const hits = query ? fuse.search(query).map((h) => h.item) : recipes
|
|
26
26
|
if (hits.length === 0) {
|
|
27
27
|
process.stdout.write(dim('No matches.\n'))
|
|
28
28
|
return
|