@hanzogui/get 7.3.1 → 8.1.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/dist/cli.js +50 -33
- package/package.json +3 -3
- package/src/cli.ts +6 -2
- package/src/commands/pick.ts +4 -4
package/dist/cli.js
CHANGED
|
@@ -5,25 +5,43 @@ 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;
|
|
8
13
|
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
|
+
}
|
|
9
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
23
|
for (let key of __getOwnPropNames(mod))
|
|
12
24
|
if (!__hasOwnProp.call(to, key))
|
|
13
25
|
__defProp(to, key, {
|
|
14
|
-
get: (
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
15
27
|
enumerable: true
|
|
16
28
|
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
17
31
|
return to;
|
|
18
32
|
};
|
|
19
33
|
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
|
+
}
|
|
20
38
|
var __export = (target, all) => {
|
|
21
39
|
for (var name in all)
|
|
22
40
|
__defProp(target, name, {
|
|
23
41
|
get: all[name],
|
|
24
42
|
enumerable: true,
|
|
25
43
|
configurable: true,
|
|
26
|
-
set: (
|
|
44
|
+
set: __exportSetter.bind(all, name)
|
|
27
45
|
});
|
|
28
46
|
};
|
|
29
47
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -46,7 +64,7 @@ var init_ansi = __esm(() => {
|
|
|
46
64
|
var require_package = __commonJS((exports, module) => {
|
|
47
65
|
module.exports = {
|
|
48
66
|
name: "@hanzogui/get",
|
|
49
|
-
version: "
|
|
67
|
+
version: "8.1.0",
|
|
50
68
|
description: "CLI installer for Hanzo GUI recipes.",
|
|
51
69
|
license: "BSD-3-Clause",
|
|
52
70
|
author: "Hanzo AI <dev@hanzo.ai>",
|
|
@@ -332,8 +350,7 @@ class FuseIndex {
|
|
|
332
350
|
value: item
|
|
333
351
|
});
|
|
334
352
|
});
|
|
335
|
-
}
|
|
336
|
-
;
|
|
353
|
+
}
|
|
337
354
|
}
|
|
338
355
|
record.$[keyIndex] = subRecords;
|
|
339
356
|
} else if (isString(value) && !isBlank(value)) {
|
|
@@ -1402,32 +1419,6 @@ async function readConfig(root) {
|
|
|
1402
1419
|
function resolveInstallDir(root, config) {
|
|
1403
1420
|
return path.join(root, config.installDir ?? DEFAULT_INSTALL_DIR);
|
|
1404
1421
|
}
|
|
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
|
-
}
|
|
1431
1422
|
async function getJSON(url) {
|
|
1432
1423
|
const res = await fetch(url, { headers: { Accept: "application/json" } });
|
|
1433
1424
|
if (!res.ok) {
|
|
@@ -1475,10 +1466,36 @@ async function resolveRecipe(slug, opts = {}) {
|
|
|
1475
1466
|
})();
|
|
1476
1467
|
const recipe = seen.get(slug);
|
|
1477
1468
|
const transitiveRecipes = Array.from(seen.values()).filter((r) => r.slug !== slug);
|
|
1478
|
-
const
|
|
1479
|
-
const targetPaths = [recipe, ...transitiveRecipes].flatMap((r) => r.files.map((f) =>
|
|
1469
|
+
const path22 = await import("node:path");
|
|
1470
|
+
const targetPaths = [recipe, ...transitiveRecipes].flatMap((r) => r.files.map((f) => path22.join(installDir, f.path)));
|
|
1480
1471
|
return { recipe, transitiveRecipes, targetPaths };
|
|
1481
1472
|
}
|
|
1473
|
+
async function getInstallDir(opts) {
|
|
1474
|
+
if (opts.installDir)
|
|
1475
|
+
return opts.installDir;
|
|
1476
|
+
const root = await findProjectRoot(opts.cwd);
|
|
1477
|
+
return resolveInstallDir(root, await readConfig(root));
|
|
1478
|
+
}
|
|
1479
|
+
async function installRecipe(recipe, opts = {}) {
|
|
1480
|
+
const installDir = await getInstallDir(opts);
|
|
1481
|
+
const written = [];
|
|
1482
|
+
for (const file of recipe.files) {
|
|
1483
|
+
const dest = path2.join(installDir, file.path);
|
|
1484
|
+
const dir = path2.dirname(dest);
|
|
1485
|
+
if (!existsSync2(dir))
|
|
1486
|
+
await fs2.mkdir(dir, { recursive: true });
|
|
1487
|
+
await fs2.writeFile(dest, file.source);
|
|
1488
|
+
written.push(dest);
|
|
1489
|
+
}
|
|
1490
|
+
return written;
|
|
1491
|
+
}
|
|
1492
|
+
async function installPlan(plan, opts = {}) {
|
|
1493
|
+
const written = [];
|
|
1494
|
+
for (const r of [plan.recipe, ...plan.transitiveRecipes]) {
|
|
1495
|
+
written.push(...await installRecipe(r, opts));
|
|
1496
|
+
}
|
|
1497
|
+
return written;
|
|
1498
|
+
}
|
|
1482
1499
|
var DEFAULT_BASE_URL = "https://base.hanzo.ai", RECIPES_COLLECTION = "gui_recipes", DEFAULT_INSTALL_DIR = "src/gui", DEFAULT_CONFIG_FILENAMES;
|
|
1483
1500
|
var init_dist = __esm(() => {
|
|
1484
1501
|
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": "
|
|
3
|
+
"version": "8.1.0",
|
|
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": "
|
|
33
|
+
"@hanzogui/recipes": "8.1.0",
|
|
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
|