omnicrawl-cli 0.2.0 → 0.2.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/README.md +59 -59
- package/bin/omnicrawl.mjs +13 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
# omnicrawl-cli
|
|
2
|
-
|
|
3
|
-
OmniCrawl 启动器:按 `platform-arch` 选平台分包,默认启动**完整宿主**(工作台 / `api` / 插件 CLI);
|
|
4
|
-
`kernel` 子命令把 stdio 交给内核二进制(协议调试与 e2e)。
|
|
5
|
-
|
|
6
|
-
## 分发形态
|
|
7
|
-
|
|
8
|
-
| npm 包 | 内容 |
|
|
9
|
-
| --- | --- |
|
|
10
|
-
| `omnicrawl-cli` | JS 启动器(`bin/omnicrawl.mjs`) |
|
|
11
|
-
| `@omnicrawl/cli-win32-x64` | 内核二进制 + 宿主载荷(Windows x64) |
|
|
12
|
-
| `@omnicrawl/cli-linux-x64` | 内核二进制 + 宿主载荷(Linux x64,内核为 musl 静态) |
|
|
13
|
-
| `@omnicrawl/cli-linux-arm64-musl` | 内核二进制 + 宿主载荷(Linux arm64) |
|
|
14
|
-
| `@omnicrawl/cli-win32-ia32` | 仅内核(32 位 Windows 缺运行期轮子) |
|
|
15
|
-
| `@omnicrawl/cli-linux-arm-musl` | 仅内核(armv7 嵌入式目标) |
|
|
16
|
-
|
|
17
|
-
宿主载荷是 PyInstaller one-dir 产物(`host/`):CPython 运行时、依赖、代码与资源都在里面,
|
|
18
|
-
用户机器不需要 Python 或 pip。没有宿主载荷的平台由启动器退回内核直连,并打印这一边界。
|
|
19
|
-
|
|
20
|
-
**平台分包、`os`/`cpu` 与平台依赖只出现在发布产物里**(`dist/npm/`)。仓库内的 `packages/cli*/package.json`
|
|
21
|
-
刻意不带 `os`/`cpu`、也不声明平台分包依赖:npm 安装时会校验工作区成员的 `os`/`cpu`,带上就直接
|
|
22
|
-
`notsup` 失败。发布产物由 `scripts/prepare.mjs` 生成。
|
|
23
|
-
|
|
24
|
-
## 命令面
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
omnicrawl 启动工作台(TUI)
|
|
28
|
-
omnicrawl api 启动本地 HTTP 服务(无头/服务器场景)
|
|
29
|
-
omnicrawl plugin ... 插件管理
|
|
30
|
-
omnicrawl kernel ... 直连内核进程(协议调试)
|
|
31
|
-
omnicrawl --version 打印启动器、平台包、宿主与内核版本
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
无交互式终端时宿主会直接给出改用 `api` 的提示并以 2 退出,不会停在协议等待状态。
|
|
35
|
-
|
|
36
|
-
## 本地开发
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
cargo build --release -p omnicrawl-cli # 产物:rust/target/release/omnicrawl[.exe]
|
|
40
|
-
node packages/cli/scripts/build-host.mjs # 宿主载荷:dist/host/<platform>/payload
|
|
41
|
-
node packages/cli/scripts/prepare.mjs # 暂存发布产物(缺的平台只警告)
|
|
42
|
-
node packages/cli/scripts/host-smoke.mjs # 宿主冒烟:无终端提示 + 退出码
|
|
43
|
-
node packages/cli/scripts/install-smoke.mjs # 安装冒烟:干净前缀里真装真跑
|
|
44
|
-
npm test -w omnicrawl-cli # e2e:真二进制 + 协议 v1
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
宿主载荷只能与构建机同架构(里面有 CPython 与原生扩展),交叉构建不成立:
|
|
48
|
-
其它平台由 CI 在各自 runner 上构建(见 `.github/workflows/publish-npm.yml`)。
|
|
49
|
-
|
|
50
|
-
两个逃生口:`OMNICRAWL_HOST` 直接指定宿主、`OMNICRAWL_BINARY` 直接指定内核(此时启动器是纯透传)。
|
|
51
|
-
|
|
52
|
-
## 发布
|
|
53
|
-
|
|
54
|
-
1. 升 `packages/cli/package.json` 版本(平台包与启动器同版本)。
|
|
55
|
-
2. 推 `npm-v<版本>` tag(CI 会校验 tag 与包版本一致)或手动触发 workflow:
|
|
56
|
-
矩阵各平台构建内核(+ 宿主)→ 宿主冒烟 → 暂存并上传产物;
|
|
57
|
-
发布任务下载全部产物 → 暂存启动器 → 安装冒烟 → 平台包在前、启动器在后依次发布。
|
|
58
|
-
|
|
59
|
-
发布前自检:`cargo test --workspace`、`npm test --workspaces`、`prepare.mjs --require-all --require-host`。
|
|
1
|
+
# omnicrawl-cli
|
|
2
|
+
|
|
3
|
+
OmniCrawl 启动器:按 `platform-arch` 选平台分包,默认启动**完整宿主**(工作台 / `api` / 插件 CLI);
|
|
4
|
+
`kernel` 子命令把 stdio 交给内核二进制(协议调试与 e2e)。
|
|
5
|
+
|
|
6
|
+
## 分发形态
|
|
7
|
+
|
|
8
|
+
| npm 包 | 内容 |
|
|
9
|
+
| --- | --- |
|
|
10
|
+
| `omnicrawl-cli` | JS 启动器(`bin/omnicrawl.mjs`) |
|
|
11
|
+
| `@omnicrawl/cli-win32-x64` | 内核二进制 + 宿主载荷(Windows x64) |
|
|
12
|
+
| `@omnicrawl/cli-linux-x64` | 内核二进制 + 宿主载荷(Linux x64,内核为 musl 静态) |
|
|
13
|
+
| `@omnicrawl/cli-linux-arm64-musl` | 内核二进制 + 宿主载荷(Linux arm64) |
|
|
14
|
+
| `@omnicrawl/cli-win32-ia32` | 仅内核(32 位 Windows 缺运行期轮子) |
|
|
15
|
+
| `@omnicrawl/cli-linux-arm-musl` | 仅内核(armv7 嵌入式目标) |
|
|
16
|
+
|
|
17
|
+
宿主载荷是 PyInstaller one-dir 产物(`host/`):CPython 运行时、依赖、代码与资源都在里面,
|
|
18
|
+
用户机器不需要 Python 或 pip。没有宿主载荷的平台由启动器退回内核直连,并打印这一边界。
|
|
19
|
+
|
|
20
|
+
**平台分包、`os`/`cpu` 与平台依赖只出现在发布产物里**(`dist/npm/`)。仓库内的 `packages/cli*/package.json`
|
|
21
|
+
刻意不带 `os`/`cpu`、也不声明平台分包依赖:npm 安装时会校验工作区成员的 `os`/`cpu`,带上就直接
|
|
22
|
+
`notsup` 失败。发布产物由 `scripts/prepare.mjs` 生成。
|
|
23
|
+
|
|
24
|
+
## 命令面
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
omnicrawl 启动工作台(TUI)
|
|
28
|
+
omnicrawl api 启动本地 HTTP 服务(无头/服务器场景)
|
|
29
|
+
omnicrawl plugin ... 插件管理
|
|
30
|
+
omnicrawl kernel ... 直连内核进程(协议调试)
|
|
31
|
+
omnicrawl --version 打印启动器、平台包、宿主与内核版本
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
无交互式终端时宿主会直接给出改用 `api` 的提示并以 2 退出,不会停在协议等待状态。
|
|
35
|
+
|
|
36
|
+
## 本地开发
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cargo build --release -p omnicrawl-cli # 产物:rust/target/release/omnicrawl[.exe]
|
|
40
|
+
node packages/cli/scripts/build-host.mjs # 宿主载荷:dist/host/<platform>/payload
|
|
41
|
+
node packages/cli/scripts/prepare.mjs # 暂存发布产物(缺的平台只警告)
|
|
42
|
+
node packages/cli/scripts/host-smoke.mjs # 宿主冒烟:无终端提示 + 退出码
|
|
43
|
+
node packages/cli/scripts/install-smoke.mjs # 安装冒烟:干净前缀里真装真跑
|
|
44
|
+
npm test -w omnicrawl-cli # e2e:真二进制 + 协议 v1
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
宿主载荷只能与构建机同架构(里面有 CPython 与原生扩展),交叉构建不成立:
|
|
48
|
+
其它平台由 CI 在各自 runner 上构建(见 `.github/workflows/publish-npm.yml`)。
|
|
49
|
+
|
|
50
|
+
两个逃生口:`OMNICRAWL_HOST` 直接指定宿主、`OMNICRAWL_BINARY` 直接指定内核(此时启动器是纯透传)。
|
|
51
|
+
|
|
52
|
+
## 发布
|
|
53
|
+
|
|
54
|
+
1. 升 `packages/cli/package.json` 版本(平台包与启动器同版本)。
|
|
55
|
+
2. 推 `npm-v<版本>` tag(CI 会校验 tag 与包版本一致)或手动触发 workflow:
|
|
56
|
+
矩阵各平台构建内核(+ 宿主)→ 宿主冒烟 → 暂存并上传产物;
|
|
57
|
+
发布任务下载全部产物 → 暂存启动器 → 安装冒烟 → 平台包在前、启动器在后依次发布。
|
|
58
|
+
|
|
59
|
+
发布前自检:`cargo test --workspace`、`npm test --workspaces`、`prepare.mjs --require-all --require-host`。
|
package/bin/omnicrawl.mjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// OMNICRAWL_HOST=<可执行文件> 直接指定宿主,跳过平台分包
|
|
7
7
|
// OMNICRAWL_BINARY=<可执行文件> 直接指定内核;此时启动器退化为纯透传,便于协议测试
|
|
8
8
|
import { spawn } from 'node:child_process'
|
|
9
|
-
import { existsSync, readFileSync } from 'node:fs'
|
|
9
|
+
import { chmodSync, existsSync, readFileSync, statSync } from 'node:fs'
|
|
10
10
|
import { createRequire } from 'node:module'
|
|
11
11
|
import { dirname, join } from 'node:path'
|
|
12
12
|
import process from 'node:process'
|
|
@@ -97,11 +97,23 @@ function printHelp() {
|
|
|
97
97
|
)
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/** npm 打包会把未在 bin 里声明的文件权限位归一化成 0644,POSIX 下按需补回可执行位。 */
|
|
101
|
+
function ensureExecutable(path) {
|
|
102
|
+
if (IS_WINDOWS) return
|
|
103
|
+
try {
|
|
104
|
+
const mode = statSync(path).mode
|
|
105
|
+
if ((mode & 0o111) === 0) chmodSync(path, mode | 0o755)
|
|
106
|
+
} catch {
|
|
107
|
+
// 权限改不动(只读文件系统等)时交给 spawn 的错误说明原因。
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
100
111
|
/** 把 stdio 交给目标可执行文件,并把它的退出码/信号作为本次退出状态。 */
|
|
101
112
|
function run(executable, args) {
|
|
102
113
|
if (!executable || !existsSync(executable)) {
|
|
103
114
|
fail(`omnicrawl:找不到可执行文件 ${executable ?? '(未解析到)'}。请重装对应的平台包。`)
|
|
104
115
|
}
|
|
116
|
+
ensureExecutable(executable)
|
|
105
117
|
const child = spawn(executable, args, { stdio: 'inherit' })
|
|
106
118
|
|
|
107
119
|
child.on('error', (error) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnicrawl-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "OmniCrawl 启动器:按平台启动完整宿主(工作台 / api / 插件)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"optionalDependencies": {
|
|
28
|
-
"@omnicrawl/cli-win32-x64": "0.2.
|
|
29
|
-
"@omnicrawl/cli-win32-ia32": "0.2.
|
|
30
|
-
"@omnicrawl/cli-linux-x64": "0.2.
|
|
31
|
-
"@omnicrawl/cli-linux-arm-musl": "0.2.
|
|
32
|
-
"@omnicrawl/cli-linux-arm64-musl": "0.2.
|
|
28
|
+
"@omnicrawl/cli-win32-x64": "0.2.1",
|
|
29
|
+
"@omnicrawl/cli-win32-ia32": "0.2.1",
|
|
30
|
+
"@omnicrawl/cli-linux-x64": "0.2.1",
|
|
31
|
+
"@omnicrawl/cli-linux-arm-musl": "0.2.1",
|
|
32
|
+
"@omnicrawl/cli-linux-arm64-musl": "0.2.1"
|
|
33
33
|
}
|
|
34
34
|
}
|