@galaxy-stack/blackhole-cli 3.0.8 → 3.0.9
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 +24 -17
- package/dist/harness/install-command.d.ts +7 -0
- package/dist/harness/install-command.d.ts.map +1 -1
- package/dist/harness/install-command.js +33 -15
- package/dist/harness/install-command.js.map +1 -1
- package/dist/harness/install.d.ts +135 -15
- package/dist/harness/install.d.ts.map +1 -1
- package/dist/harness/install.js +326 -36
- package/dist/harness/install.js.map +1 -1
- package/dist/web/web.d.ts +7 -0
- package/dist/web/web.d.ts.map +1 -1
- package/dist/web/web.js +9 -2
- package/dist/web/web.js.map +1 -1
- package/package.json +1 -1
- package/web/brand/lib/client.js +4 -4
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ build tool of the desktop checkout (it bundles the client plugins), never a boot
|
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
26
|
npm i -g @galaxy-stack/blackhole-cli@latest
|
|
27
|
-
blackhole harness install #
|
|
27
|
+
blackhole harness install # install the harness from npm into ~/.galaxy/harness
|
|
28
28
|
blackhole doctor # check the API key and the connection
|
|
29
29
|
blackhole web # open the Galaxy Blackhole web GUI
|
|
30
30
|
blackhole chat # start working
|
|
@@ -44,24 +44,31 @@ this package installs it on demand instead of bundling it:
|
|
|
44
44
|
|
|
45
45
|
| command | what it does |
|
|
46
46
|
|---|---|
|
|
47
|
-
| `blackhole harness install` |
|
|
48
|
-
| `blackhole harness status` | Prints the harness in use, where it came from, its version, node/bun,
|
|
47
|
+
| `blackhole harness install` | Installs the harness into `~/.galaxy/harness/blackhole-harness` — the npm package first, then git, then ZIP — and verifies the host runtime (`--force`, `--dir`, `--from`, `--no-deps`) |
|
|
48
|
+
| `blackhole harness status` | Prints the harness in use, where it came from, its version, node/bun, which `node_modules` holds the kernel (`apps/host` or the hoisted one), whether the host runtime (`@deepseek-ai/dsh/lib/bin.js`) is there, and `nguồn: npm @galaxy-blackhole/blackhole-harness@0.1.0` for an npm install |
|
|
49
49
|
| `blackhole harness remove` | Deletes `~/.galaxy/harness` after asking (`--yes` skips the question) |
|
|
50
50
|
|
|
51
|
-
`install`
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
the
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
`
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
`install` fetches the published harness from npm first: `npm i --omit=dev --prefix <tmp>
|
|
52
|
+
@galaxy-blackhole/blackhole-harness@latest` is one install that already carries the kernel and its
|
|
53
|
+
dependencies — measured 12/11/2026: 684 packages, 16 direct dependencies — and the installer moves
|
|
54
|
+
that tree to the checkout root, where the kernel sits hoisted at `node_modules/@deepseek-ai/dsh`
|
|
55
|
+
(no `apps/host/node_modules`, and no second `npm install`). `GBH_HARNESS_PACKAGE` renames the
|
|
56
|
+
package and `GBH_HARNESS_SPEC` pins a version. When npm is missing or fails, it falls back to
|
|
57
|
+
`git clone --depth 1` (git on PATH; Git for Windows counts) and then to the branch archive from
|
|
58
|
+
GitHub, unpacked with a built-in ZIP reader — no git, no `unzip`, no `tar`. Those rungs install
|
|
59
|
+
what the launcher needs: `bun install` at the checkout root and in `apps/host` when Bun is
|
|
60
|
+
available, or npm inside `apps/host` when only npm is — `npm ci --omit=dev` when the checkout
|
|
61
|
+
carries a `package-lock.json`, `npm install --omit=dev` otherwise, and as the fallback when
|
|
62
|
+
`ci` refuses a lockfile it cannot honour. Every step is printed before it runs, and a step that
|
|
63
|
+
fails prints its own last 15 lines. `--force` downloads again, `--dir <path>` puts the checkout
|
|
64
|
+
somewhere else (the location is recorded so the next `chat` finds it), `--from <url|npm>` takes a
|
|
65
|
+
`.zip` URL, another git repository, or the word `npm` to force the package, and `--no-deps`
|
|
66
|
+
stops after the download (skipping npm, which always installs the package's dependencies).
|
|
67
|
+
|
|
68
|
+
`install` is finished only when the checkout can boot: it checks for the runtime the launcher
|
|
69
|
+
starts, `@deepseek-ai/dsh/lib/bin.js`, in both layouts — `apps/host/node_modules/…` for a
|
|
70
|
+
repository checkout, `node_modules/…` for the npm package — and when that file is missing it
|
|
71
|
+
reports the failure with exit code 1 instead of saying "xong".
|
|
65
72
|
`chat` and `web` make the same check before spawning anything, so a half-installed tree produces
|
|
66
73
|
one sentence (what is missing, and `blackhole harness install --force`) instead of a path from
|
|
67
74
|
inside the launcher.
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* author Bùi Trọng Hiếu
|
|
3
|
+
* email kevinbui210191@gmail.com
|
|
4
|
+
* create date 15/10/2026
|
|
5
|
+
* modify date 12/11/2026
|
|
6
|
+
* desc harness status in dòng "nguồn: npm <gói>@<version>" khi cây cài là gói npm; help nói rõ bậc npm và --from npm
|
|
7
|
+
*/
|
|
1
8
|
import { type LocateEnvironment } from "./locate.js";
|
|
2
9
|
import { type HarnessStatusFacts } from "./install.js";
|
|
3
10
|
/** The help `blackhole harness --help` prints. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-command.d.ts","sourceRoot":"","sources":["../../src/harness/install-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install-command.d.ts","sourceRoot":"","sources":["../../src/harness/install-command.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,OAAO,EAA4F,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC/I,OAAO,EAAmH,KAAK,kBAAkB,EAAkB,MAAM,cAAc,CAAC;AAGxL,kDAAkD;AAClD,eAAO,MAAM,YAAY,QAiCb,CAAC;AAEb,gEAAgE;AAChE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,GAAE,iBAA6C,GAAG,SAAS,MAAM,EAAE,CA6B5I;AAED,2DAA2D;AAC3D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,iBAAiB,GAAG,iBAAiB,CAgBnF;AAwDD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA2DhF"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* author Bùi Trọng Hiếu
|
|
3
|
+
* email kevinbui210191@gmail.com
|
|
4
|
+
* create date 15/10/2026
|
|
5
|
+
* modify date 12/11/2026
|
|
6
|
+
* desc harness status in dòng "nguồn: npm <gói>@<version>" khi cây cài là gói npm; help nói rõ bậc npm và --from npm
|
|
7
|
+
*/
|
|
1
8
|
/**
|
|
2
9
|
* `blackhole harness` — install, inspect and remove the blackhole-tauri checkout that
|
|
3
10
|
* `blackhole chat` and `blackhole web` boot.
|
|
@@ -9,33 +16,36 @@
|
|
|
9
16
|
import { existsSync, rmSync, rmdirSync } from "node:fs";
|
|
10
17
|
import { basename, dirname, resolve, sep } from "node:path";
|
|
11
18
|
import { harnessMissingMessage, defaultHarnessParent, installRecordPaths, systemLocateEnvironment } from "./locate.js";
|
|
12
|
-
import { DSH_RUNTIME_ENTRY, HARNESS_REPO, harnessStatusFacts, installHarness } from "./install.js";
|
|
19
|
+
import { DSH_RUNTIME_ENTRY, HARNESS_REPO, dshRuntimeEntry, harnessStatusFacts, installHarness } from "./install.js";
|
|
13
20
|
import { askConfirm } from "./ensure.js";
|
|
14
21
|
/** The help `blackhole harness --help` prints. */
|
|
15
22
|
export const HARNESS_HELP = [
|
|
16
23
|
"blackhole harness — bản harness blackhole-tauri mà chat/web cần",
|
|
17
24
|
"",
|
|
18
25
|
"Usage:",
|
|
19
|
-
" blackhole harness install [--force] [--dir <thư mục>] [--from <url>] [--no-deps]",
|
|
26
|
+
" blackhole harness install [--force] [--dir <thư mục>] [--from <url|npm>] [--no-deps]",
|
|
20
27
|
" blackhole harness status [--json]",
|
|
21
28
|
" blackhole harness remove [--yes]",
|
|
22
29
|
"",
|
|
23
|
-
" install
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
30
|
+
" install Cài harness vào ~/.galaxy/harness/blackhole-harness. Thứ tự nguồn: --from (khi có),",
|
|
31
|
+
" rồi gói npm đã publish — npm i --omit=dev --prefix <tạm>",
|
|
32
|
+
" @galaxy-blackhole/blackhole-harness@latest (gói kèm sẵn 16 phụ thuộc nên KHÔNG có",
|
|
33
|
+
" bước cài riêng) — rồi git clone --depth 1 nếu có git, sau cùng là ZIP của GitHub.",
|
|
34
|
+
" Cài xong phải có runtime @deepseek-ai/dsh/lib/bin.js, ở apps/host/node_modules",
|
|
35
|
+
" (bản repo) hoặc node_modules (bản npm hoist); thiếu thì lệnh này trả về mã 1.",
|
|
28
36
|
" --force Tải lại dù đã có.",
|
|
29
37
|
" --dir Đặt harness ở chỗ khác (mặc định ~/.galaxy/harness). Đường dẫn kết thúc bằng",
|
|
30
38
|
" blackhole-harness thì dùng luôn làm gốc. Vị trí được ghi lại để chat/web tìm thấy.",
|
|
31
|
-
" --from
|
|
32
|
-
" --no-deps
|
|
39
|
+
" --from Chọn nguồn: npm (ép dùng gói npm), URL .zip, hoặc repo git (mặc định " + HARNESS_REPO + ").",
|
|
40
|
+
" --no-deps Chỉ tải, không cài (bỏ luôn bậc npm, vì npm luôn cài kèm phụ thuộc).",
|
|
33
41
|
"",
|
|
34
42
|
" status In harness đang dùng + nguồn (GBH_TAURI_ROOT / $GBH_HOME / ~/.galaxy / sibling /",
|
|
35
|
-
" dev), version, node, bun
|
|
43
|
+
" dev), version, node, bun, tình trạng node_modules và runtime. Cây cài bằng npm in",
|
|
44
|
+
" thêm dòng \"nguồn: npm <gói>@<version>\" đọc từ package.json đã cài.",
|
|
36
45
|
" remove Xoá ~/.galaxy/harness (hỏi xác nhận; --yes để bỏ qua).",
|
|
37
46
|
"",
|
|
38
47
|
"Biến môi trường: GBH_TAURI_ROOT (checkout có sẵn), GBH_HOME (home dữ liệu harness),",
|
|
48
|
+
" GBH_HARNESS_PACKAGE / GBH_HARNESS_SPEC (đổi tên gói npm / ghim phiên bản),",
|
|
39
49
|
" GBH_TAURI_REPO / GBH_TAURI_ARCHIVE / GBH_TAURI_BRANCH (nguồn tải),",
|
|
40
50
|
" GBH_NPM (npm có trên máy mà CLI không tự thấy).",
|
|
41
51
|
"",
|
|
@@ -50,20 +60,28 @@ export function harnessStatusReport(facts, environment = systemLocateEnvironment
|
|
|
50
60
|
const lines = [
|
|
51
61
|
"harness: " + facts.location.root,
|
|
52
62
|
"nguồn: " + facts.location.label,
|
|
53
|
-
"version: " + (facts.version ?? "?"),
|
|
54
63
|
];
|
|
64
|
+
// The npm build carries its own name and version in package.json; a checkout never does, so this
|
|
65
|
+
// line is exactly "was this tree installed from the registry, and which build?".
|
|
66
|
+
if (facts.packageSource !== undefined) {
|
|
67
|
+
lines.push("nguồn: npm " + facts.packageSource.name + (facts.packageSource.version === undefined ? "" : "@" + facts.packageSource.version));
|
|
68
|
+
}
|
|
69
|
+
lines.push("version: " + (facts.version ?? "?"));
|
|
55
70
|
if (facts.hostVersion !== undefined)
|
|
56
71
|
lines.push("host: " + facts.hostVersion + " (apps/host)");
|
|
57
72
|
lines.push("node: " + (facts.node === undefined
|
|
58
73
|
? "KHÔNG có — " + (facts.nodeError ?? "không tìm thấy Node")
|
|
59
74
|
: facts.node.version + " (" + facts.node.bin + ", " + facts.node.source + ")"));
|
|
60
75
|
lines.push("bun: " + (facts.bun ?? "không có (không bắt buộc để chạy; cần cho bun install)"));
|
|
61
|
-
|
|
76
|
+
// Two layouts answer "is the kernel installed?": apps/host/node_modules in a checkout, the
|
|
77
|
+
// hoisted node_modules of an npm install. The line names the one that answered.
|
|
78
|
+
const runtimeEntry = facts.hostModules.runtime ? dshRuntimeEntry(facts.location.root) : DSH_RUNTIME_ENTRY;
|
|
79
|
+
lines.push(facts.hostModules.dir + ": " + (facts.hostModules.present
|
|
62
80
|
? "đã cài (" + String(facts.hostModules.packages) + " mục)"
|
|
63
81
|
: 'chưa có — chạy "blackhole harness install"')
|
|
64
82
|
+ " · runtime: " + (facts.hostModules.runtime
|
|
65
|
-
? "có " +
|
|
66
|
-
:
|
|
83
|
+
? "có " + runtimeEntry
|
|
84
|
+
: "THIẾU " + runtimeEntry + ' — chạy "blackhole harness install --force"'));
|
|
67
85
|
lines.push("GBH_HOME: " + facts.home);
|
|
68
86
|
lines.push("mặc định: " + facts.defaultDir);
|
|
69
87
|
return lines;
|
|
@@ -122,7 +140,7 @@ function parseInstallArgs(args) {
|
|
|
122
140
|
index += 1;
|
|
123
141
|
continue;
|
|
124
142
|
}
|
|
125
|
-
throw new Error('install: không hiểu "' + String(arg) + '". Dùng --force, --dir <thư mục>, --from <url>, --no-deps.');
|
|
143
|
+
throw new Error('install: không hiểu "' + String(arg) + '". Dùng --force, --dir <thư mục>, --from <url|npm>, --no-deps.');
|
|
126
144
|
}
|
|
127
145
|
return { ...(dir === undefined ? {} : { dir }), ...(from === undefined ? {} : { from }), force, noDeps };
|
|
128
146
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-command.js","sourceRoot":"","sources":["../../src/harness/install-command.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,uBAAuB,EAA0B,MAAM,aAAa,CAAC;AAC/I,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAsE,MAAM,cAAc,CAAC;
|
|
1
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harness) đứng trước git clone/ZIP; dò runtime ở cả apps/host/node_modules lẫn node_modules bị npm hoist; status in nguồn npm
|
|
7
|
+
*/
|
|
1
8
|
import { type HarnessLocation, type LocateEnvironment } from "./locate.js";
|
|
2
9
|
import { type NodeRuntime } from "./node-runtime.js";
|
|
3
10
|
/** The repository the harness is published from. */
|
|
@@ -6,6 +13,21 @@ export declare const HARNESS_REPO = "https://github.com/galaxy-blackhole/blackho
|
|
|
6
13
|
export declare const HARNESS_BRANCH = "main";
|
|
7
14
|
/** The checkout directory name every install ends with. */
|
|
8
15
|
export declare const HARNESS_DIR_NAME = "blackhole-harness";
|
|
16
|
+
/** The npm package that carries the harness (rename with `GBH_HARNESS_PACKAGE`). */
|
|
17
|
+
export declare const HARNESS_PACKAGE = "@galaxy-blackhole/blackhole-harness";
|
|
18
|
+
/** The dist-tag the npm rung asks for (pin a version with `GBH_HARNESS_SPEC`). */
|
|
19
|
+
export declare const HARNESS_PACKAGE_SPEC = "latest";
|
|
20
|
+
/**
|
|
21
|
+
* Every place the host runtime can be, relative to the harness root, in preference order.
|
|
22
|
+
*
|
|
23
|
+
* Two layouts, one fact. A repository checkout pins the kernel inside `apps/host`
|
|
24
|
+
* (`bun install` / `npm ci` there); the published npm package carries the kernel as one of its own
|
|
25
|
+
* dependencies, and npm hoists it to the `node_modules` of the directory it installed into
|
|
26
|
+
* (measured 12/11/2026: `npm i --prefix /tmp/x …` → `/tmp/x/node_modules/@deepseek-ai/dsh/lib/bin.js`,
|
|
27
|
+
* no `apps/host/node_modules` at all). The launcher itself finds either by walking parent
|
|
28
|
+
* `node_modules`; this CLI has to look in both places before it calls a tree bootable.
|
|
29
|
+
*/
|
|
30
|
+
export declare const DSH_RUNTIME_ENTRIES: readonly string[];
|
|
9
31
|
/**
|
|
10
32
|
* The host runtime the launcher boots, relative to the checkout root.
|
|
11
33
|
*
|
|
@@ -13,20 +35,48 @@ export declare const HARNESS_DIR_NAME = "blackhole-harness";
|
|
|
13
35
|
* without it (`harness runtime not found at …`), and on Windows the old installer called npm
|
|
14
36
|
* directly, so it printed "xong" over a tree that could never start.
|
|
15
37
|
*/
|
|
16
|
-
export declare const DSH_RUNTIME_ENTRY
|
|
38
|
+
export declare const DSH_RUNTIME_ENTRY: string;
|
|
17
39
|
/**
|
|
18
|
-
* Absolute
|
|
19
|
-
* @param root -
|
|
40
|
+
* Absolute paths of the host runtime inside one tree, in preference order.
|
|
41
|
+
* @param root - harness root.
|
|
42
|
+
* @returns the checkout path first, the npm-hoisted path second.
|
|
43
|
+
*/
|
|
44
|
+
export declare function dshRuntimeCandidates(root: string): string[];
|
|
45
|
+
/**
|
|
46
|
+
* Absolute path of the checkout-shaped host runtime (the one older messages name).
|
|
47
|
+
* @param root - harness root.
|
|
20
48
|
* @returns `<root>/apps/host/node_modules/@deepseek-ai/dsh/lib/bin.js`.
|
|
21
49
|
*/
|
|
22
50
|
export declare function dshRuntimePath(root: string): string;
|
|
23
51
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @param root -
|
|
52
|
+
* The host runtime that is actually on disk.
|
|
53
|
+
* @param root - harness root.
|
|
54
|
+
* @param exists - filesystem probe; `existsSync` in production.
|
|
55
|
+
* @returns the absolute path that answered, or undefined when neither layout has it.
|
|
56
|
+
*/
|
|
57
|
+
export declare function findDshRuntime(root: string, exists?: (path: string) => boolean): string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Whether a tree can actually boot the harness — in either layout.
|
|
60
|
+
* @param root - harness root.
|
|
26
61
|
* @param exists - filesystem probe; `existsSync` in production.
|
|
27
62
|
* @returns true when the host runtime entry is there.
|
|
28
63
|
*/
|
|
29
64
|
export declare function hasDshRuntime(root: string, exists?: (path: string) => boolean): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Absolute path to print for a tree's runtime: the one that answered, else the checkout-shaped one.
|
|
67
|
+
* @param root - harness root.
|
|
68
|
+
* @param exists - filesystem probe; `existsSync` in production.
|
|
69
|
+
* @returns the path `web --dry-run` and `harness status` show.
|
|
70
|
+
*/
|
|
71
|
+
export declare function dshRuntimeResolved(root: string, exists?: (path: string) => boolean): string;
|
|
72
|
+
/**
|
|
73
|
+
* The runtime entry relative to the harness root, with forward slashes: what `harness status`
|
|
74
|
+
* prints beside `runtime: có` (`apps/host/node_modules/…` or `node_modules/…`).
|
|
75
|
+
* @param root - harness root.
|
|
76
|
+
* @param exists - filesystem probe; `existsSync` in production.
|
|
77
|
+
* @returns the relative entry that answered, or the checkout-shaped one when nothing did.
|
|
78
|
+
*/
|
|
79
|
+
export declare function dshRuntimeEntry(root: string, exists?: (path: string) => boolean): string;
|
|
30
80
|
/**
|
|
31
81
|
* What to print when the checkout is there but its runtime is not: the missing file, the one
|
|
32
82
|
* command that reinstalls it, and the reason it is usually missing (no npm on the machine).
|
|
@@ -49,9 +99,9 @@ export interface HarnessInstallOptions {
|
|
|
49
99
|
readonly dir?: string;
|
|
50
100
|
/** Download again even when a checkout is already there. */
|
|
51
101
|
readonly force?: boolean;
|
|
52
|
-
/** `--from <url>`: a `.zip` URL
|
|
102
|
+
/** `--from <url|npm>`: a `.zip` URL, a git URL, or the word `npm` to force the npm package. */
|
|
53
103
|
readonly from?: string;
|
|
54
|
-
/** Skip the dependency step (`--no-deps`). */
|
|
104
|
+
/** Skip the dependency step (`--no-deps`); npm is skipped too, because npm always installs them. */
|
|
55
105
|
readonly noDeps?: boolean;
|
|
56
106
|
/** Progress sink; stdout in production. */
|
|
57
107
|
readonly write?: WriteLine;
|
|
@@ -63,36 +113,49 @@ export interface HarnessInstallOptions {
|
|
|
63
113
|
readonly download?: (url: string, dest: string) => Promise<void>;
|
|
64
114
|
/** Node binary used to run npm's JS entry on Windows; this process by default. */
|
|
65
115
|
readonly node?: string;
|
|
116
|
+
/** Runs the npm fetch (`npm i --omit=dev --prefix …`); `runNpm` by default, injected by tests. */
|
|
117
|
+
readonly npmInstall?: NpmInstallRunner;
|
|
66
118
|
}
|
|
67
119
|
/** What one install produced. */
|
|
68
120
|
export interface HarnessInstallResult {
|
|
69
121
|
/** Absolute checkout root. */
|
|
70
122
|
readonly root: string;
|
|
71
|
-
/** How the tree arrived
|
|
72
|
-
readonly via: "git" | "zip" | "existing";
|
|
123
|
+
/** How the tree arrived: the npm package, a git clone, the ZIP archive, or `existing` when nothing was downloaded. */
|
|
124
|
+
readonly via: "npm" | "git" | "zip" | "existing";
|
|
73
125
|
/** Whether a download happened in this run. */
|
|
74
126
|
readonly downloaded: boolean;
|
|
75
127
|
/** Which package manager ran, or why none did. */
|
|
76
128
|
readonly deps: "bun" | "npm" | "skipped" | "failed";
|
|
77
|
-
/** Whether
|
|
129
|
+
/** Whether a host runtime ({@link DSH_RUNTIME_ENTRIES}) exists afterwards — the launcher cannot boot without it. */
|
|
78
130
|
readonly ready: boolean;
|
|
79
131
|
/** What to do next, when the result is not ready. */
|
|
80
132
|
readonly note?: string;
|
|
81
133
|
}
|
|
82
|
-
/** The
|
|
134
|
+
/** The module tree that holds the kernel, whichever layout put it there. */
|
|
83
135
|
export interface HostModulesState {
|
|
84
136
|
/** Whether the directory holds anything at all. */
|
|
85
137
|
readonly present: boolean;
|
|
86
138
|
/** Top-level entries, so "196 mục" proves something was unpacked. */
|
|
87
139
|
readonly packages: number;
|
|
88
|
-
/** Whether the launcher's own runtime entry ({@link
|
|
140
|
+
/** Whether the launcher's own runtime entry ({@link DSH_RUNTIME_ENTRIES}) is there. */
|
|
89
141
|
readonly runtime: boolean;
|
|
142
|
+
/** The directory that answered, relative to the root: `apps/host/node_modules` or `node_modules`. */
|
|
143
|
+
readonly dir: string;
|
|
144
|
+
}
|
|
145
|
+
/** The published npm package a tree was installed from. */
|
|
146
|
+
export interface HarnessPackage {
|
|
147
|
+
/** Package name, read from the installed `package.json`. */
|
|
148
|
+
readonly name: string;
|
|
149
|
+
/** Version the package declares, when it declares one. */
|
|
150
|
+
readonly version?: string;
|
|
90
151
|
}
|
|
91
152
|
/** Everything `harness status` reports. */
|
|
92
153
|
export interface HarnessStatusFacts {
|
|
93
154
|
readonly location?: HarnessLocation;
|
|
94
155
|
readonly version?: string;
|
|
95
156
|
readonly hostVersion?: string;
|
|
157
|
+
/** Set when the tree is the published npm package: `harness status` prints `nguồn: npm …`. */
|
|
158
|
+
readonly packageSource?: HarnessPackage;
|
|
96
159
|
readonly node?: NodeRuntime;
|
|
97
160
|
readonly nodeError?: string;
|
|
98
161
|
readonly bun?: string;
|
|
@@ -109,6 +172,8 @@ export interface DependencyOutcome {
|
|
|
109
172
|
}
|
|
110
173
|
/** Runs one dependency step; production captures output, a test may simply return a code. */
|
|
111
174
|
export type DependencyRunner = (command: string, args: readonly string[], cwd: string) => Promise<number | DependencyOutcome>;
|
|
175
|
+
/** Runs the npm fetch; `runNpm` in production, a fake tree in tests. */
|
|
176
|
+
export type NpmInstallRunner = (args: readonly string[], cwd: string) => Promise<number | DependencyOutcome>;
|
|
112
177
|
/**
|
|
113
178
|
* Where a `--dir` install lands: the directory holding the checkout, or the checkout itself when
|
|
114
179
|
* the path already ends with `blackhole-tauri`.
|
|
@@ -128,9 +193,47 @@ export declare function assertReplaceable(target: string): void;
|
|
|
128
193
|
/** The `version` a checkout's package.json declares, when it has one. */
|
|
129
194
|
export declare function readHarnessVersion(root: string): string | undefined;
|
|
130
195
|
/**
|
|
131
|
-
*
|
|
196
|
+
* The npm package `harness install` fetches.
|
|
197
|
+
* @param environment - environment facts; `GBH_HARNESS_PACKAGE` renames the package.
|
|
198
|
+
* @returns the package name, defaulting to {@link HARNESS_PACKAGE}.
|
|
199
|
+
*/
|
|
200
|
+
export declare function harnessPackageName(environment: LocateEnvironment): string;
|
|
201
|
+
/**
|
|
202
|
+
* The version or dist-tag the npm rung asks for.
|
|
203
|
+
* @param environment - environment facts; `GBH_HARNESS_SPEC` pins a version.
|
|
204
|
+
* @returns the spec, defaulting to `latest`.
|
|
205
|
+
*/
|
|
206
|
+
export declare function harnessPackageSpec(environment: LocateEnvironment): string;
|
|
207
|
+
/**
|
|
208
|
+
* The one argument npm receives for the harness.
|
|
209
|
+
* @param environment - environment facts.
|
|
210
|
+
* @returns `@galaxy-blackhole/blackhole-harness@latest`.
|
|
211
|
+
*/
|
|
212
|
+
export declare function harnessPackageRequest(environment: LocateEnvironment): string;
|
|
213
|
+
/**
|
|
214
|
+
* The argv of the npm fetch, exactly as it is logged.
|
|
215
|
+
* @param prefix - directory npm installs into (`--prefix`).
|
|
216
|
+
* @param request - `<name>@<version|dist-tag>`.
|
|
217
|
+
* @returns `npm i --omit=dev --prefix <dir> <request> --no-audit --no-fund`.
|
|
218
|
+
*/
|
|
219
|
+
export declare function npmFetchArgs(prefix: string, request: string): string[];
|
|
220
|
+
/**
|
|
221
|
+
* The npm package a tree was installed from, read from the tree's own `package.json`.
|
|
222
|
+
*
|
|
223
|
+
* The published build names itself `@galaxy-blackhole/blackhole-harness`; the repository checkout
|
|
224
|
+
* still calls itself `@galaxy-blackhole/gbh-tauri`, so the name is what tells the two apart.
|
|
225
|
+
* @param root - harness root.
|
|
226
|
+
* @param environment - environment facts; the override counts as the npm name.
|
|
227
|
+
* @returns the package name and version, or undefined when this tree is not the npm build.
|
|
228
|
+
*/
|
|
229
|
+
export declare function readHarnessPackage(root: string, environment: LocateEnvironment): HarnessPackage | undefined;
|
|
230
|
+
/**
|
|
231
|
+
* Whether the kernel is installed, and in which layout.
|
|
232
|
+
*
|
|
233
|
+
* The repository checkout keeps it in `apps/host/node_modules`; the npm package gets it hoisted to
|
|
234
|
+
* `<root>/node_modules` and has no `apps/host/node_modules` at all, so both are asked.
|
|
132
235
|
* @param root - checkout root.
|
|
133
|
-
* @returns presence
|
|
236
|
+
* @returns presence, the number of top-level entries, the runtime flag and the directory that answered.
|
|
134
237
|
*/
|
|
135
238
|
export declare function hostModulesState(root: string): HostModulesState;
|
|
136
239
|
/** One package-manager invocation. */
|
|
@@ -160,7 +263,24 @@ export interface DependencyStep {
|
|
|
160
263
|
*/
|
|
161
264
|
export declare function planDependencies(root: string, environment: LocateEnvironment, node?: string): DependencyStep[];
|
|
162
265
|
/**
|
|
163
|
-
*
|
|
266
|
+
* Move an npm installation into a checkout-shaped root.
|
|
267
|
+
*
|
|
268
|
+
* `npm i --prefix <dir>` leaves the package at `<dir>/node_modules/<name>` and hoists every
|
|
269
|
+
* dependency (the kernel included) to `<dir>/node_modules`. The launcher wants `apps/cli/src/main.ts`
|
|
270
|
+
* at the root and resolves its kernel by walking parent `node_modules`, so the package's own
|
|
271
|
+
* entries move up beside that `node_modules`.
|
|
272
|
+
* @param prefix - the `--prefix` directory npm installed into.
|
|
273
|
+
* @param packageName - the package that carries the harness.
|
|
274
|
+
* @param tree - directory to build the checkout in.
|
|
275
|
+
* @returns true when the package was there and the tree was built.
|
|
276
|
+
*/
|
|
277
|
+
export declare function flattenNpmPackage(prefix: string, packageName: string, tree: string): boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Download (or reuse) the harness checkout and make sure it can boot.
|
|
280
|
+
*
|
|
281
|
+
* Rungs, in order: `--from` when the user named a source (and `--from npm` forces the npm package),
|
|
282
|
+
* then the published npm package, then `git clone --depth 1`, then the GitHub ZIP. `--no-deps` keeps
|
|
283
|
+
* its old meaning — download only — so it skips npm, which always installs the package's dependencies.
|
|
164
284
|
* @param options - destination, force, source override, progress sink and injected process facts.
|
|
165
285
|
* @returns the checkout root, how it arrived and whether it is ready to boot.
|
|
166
286
|
* @throws when the download fails, the archive has no launcher, or the destination is unsafe.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/harness/install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/harness/install.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyBH,OAAO,EASL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAwC,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG3F,oDAAoD;AACpD,eAAO,MAAM,YAAY,0DAA0D,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