cannbot-preflight 2.0.5 → 2.0.7
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 +32 -17
- package/bin/update-check.js +52 -13
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# cannbot
|
|
2
2
|
|
|
3
|
-
A terminal launcher for AI coding agents (starting with [opencode](https://opencode.ai)), built with [OpenTUI](https://github.com/msmps/opentui) and React, running on [Bun](https://bun.sh/). This repository is the
|
|
3
|
+
A terminal launcher for AI coding agents (starting with [opencode](https://opencode.ai)), built with [OpenTUI](https://github.com/msmps/opentui) and React, running on [Bun](https://bun.sh/). This repository is the long-term home of the `cannbot` npm package. The current release is the pre-release validation build `cannbot-preflight@2.0.7`, whose 12 platform packages are named `@cannbot-release/preflight-<suffix>` from the root manifest's `cannbot.platformPrefix`; the official `cannbot` name (already published at `1.2.0`) is delivered by a follow-up change. The earlier verification (`cannbot-rehearsal`) and pilot (`cannbot-pilot`) names are retired. The package ships a standalone TUI binary named `cannbot` and bundles the agent binary from the `cannbot-cli` repository as `cannbot-cli`. The project's upstream code repository is <https://gitcode.com/cann-dev/cannbot-ai>.
|
|
4
4
|
|
|
5
5
|
## User guide (Chinese)
|
|
6
6
|
|
|
@@ -13,15 +13,27 @@ End-user documentation — install, login, sessions, groups, commands, shortcuts
|
|
|
13
13
|
|
|
14
14
|
## Install
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Install the official package (the installed command is `cannbot`):
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
npm install -g cannbot
|
|
19
|
+
npm install -g cannbot
|
|
20
20
|
# or run without installing
|
|
21
|
-
npx cannbot
|
|
21
|
+
npx cannbot
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The current pre-release validation build is published under `cannbot-preflight`. It exposes the same `cannbot` command as the official package, so npm cannot install both side by side. To try the validation build instead of the official one:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm uninstall -g cannbot
|
|
28
|
+
npm install -g cannbot-preflight
|
|
22
29
|
```
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
To switch back to the official package:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm uninstall -g cannbot-preflight
|
|
35
|
+
npm install -g cannbot
|
|
36
|
+
```
|
|
25
37
|
|
|
26
38
|
The npm package ships standalone executables per platform. Supported platforms:
|
|
27
39
|
|
|
@@ -40,7 +52,7 @@ The npm package ships standalone executables per platform. Supported platforms:
|
|
|
40
52
|
| macOS x64 (AVX2 baseline) | `darwin-x64-baseline` |
|
|
41
53
|
| macOS arm64 | `darwin-arm64` |
|
|
42
54
|
|
|
43
|
-
The 12 suffixes map one-to-one to the built-in cannbot-cli variants. Platform sub-packages are scoped and configured in the root manifest: `cannbot.platformScope` is `@cannbot-release
|
|
55
|
+
The 12 suffixes map one-to-one to the built-in cannbot-cli variants. Platform sub-packages are scoped and configured in the root manifest: `cannbot.platformScope` is `@cannbot-release`, so the platform package for each variant is `@cannbot-release/<suffix>`. Scoped platform names deliberately avoid the unscoped `cannbot-<suffix>` names already taken on npm by another account. The launcher detects AVX2 and musl at startup and picks the matching variant, falling back to the other same-platform variants if the first choice is missing.
|
|
44
56
|
|
|
45
57
|
Notes:
|
|
46
58
|
|
|
@@ -51,7 +63,7 @@ Notes:
|
|
|
51
63
|
- The macOS binaries (both `cannbot` and `cannbot-cli`) are not codesigned/notarized. If Gatekeeper blocks them, clear the quarantine flag:
|
|
52
64
|
```bash
|
|
53
65
|
for bin in cannbot cannbot-cli; do
|
|
54
|
-
xattr -d com.apple.quarantine "$(npm root -g)/@cannbot-release/
|
|
66
|
+
xattr -d com.apple.quarantine "$(npm root -g)/@cannbot-release/darwin-arm64/bin/$bin" 2>/dev/null || true
|
|
55
67
|
done
|
|
56
68
|
```
|
|
57
69
|
If macOS still rejects the binary, ad-hoc re-sign it: `codesign --force --sign - "<path-to-binary>"`.
|
|
@@ -122,10 +134,14 @@ Without the override, launching `cannbot` shows an inline error and does not cre
|
|
|
122
134
|
| `bun run build` | Build a JS bundle (requires Bun on the target machine) |
|
|
123
135
|
| `bun run build:exe` | Build a standalone executable for the current platform |
|
|
124
136
|
| `bun run build:publish` | Cross-compile all 12 platform variants and assemble `dist/publish/<pkg>/` |
|
|
125
|
-
| `bun run
|
|
137
|
+
| `bun run changelog` | Append newer formal-release versions to `CHANGELOG.md` from git history (existing sections, including the hand-written `1.2.0`, are kept) |
|
|
138
|
+
| `bun run changelog:check` | Read-only check that every released version section is present in `CHANGELOG.md` (unreleased commits are ignored) |
|
|
139
|
+
| `bun run release` | Check → build → publish 12 sub-packages, gate main on them being live, then publish main |
|
|
126
140
|
|
|
127
141
|
`bun test test/` (direct invocation) equals the full suite. Use `bun run test` for normal development; the release pre-check and `prepublishOnly` always run `bun run test:all`, so publish E2E tests still gate releases. New publish E2E tests should be added to the `test:publish` script.
|
|
128
142
|
|
|
143
|
+
The changelog is a repository document: the `1.2.0` section is hand-written and summarises the earlier development history, while later sections are appended from commit subjects and the root manifest version history. Existing sections are never rewritten, so the hand-written content is safe. It is not shipped in the npm package and is intentionally **not** part of the release gate. Run `bun run changelog` after bumping `version`, and `bun run changelog:check` before publishing to verify that no released version section is missing; unreleased commits after the newest version boundary are ignored.
|
|
144
|
+
|
|
129
145
|
Build artifacts are written to `dist/`.
|
|
130
146
|
|
|
131
147
|
`build:publish` prepares any missing target-platform native packages (`@opentui/core-*`) automatically by fetching them from npm into `node_modules`, so the build machine needs network access on first run. Pass `--manifests-only` to assemble manifests without compiling.
|
|
@@ -134,23 +150,22 @@ It also bundles **cannbot-cli** from a local `cannbot-cli` checkout. All twelve
|
|
|
134
150
|
|
|
135
151
|
## Maintainer release runbook
|
|
136
152
|
|
|
137
|
-
Releases are published **manually by the maintainer** to <https://registry.npmjs.org/>. The current release is
|
|
153
|
+
Releases are published **manually by the maintainer** to <https://registry.npmjs.org/>. The current release is the pre-release validation build `cannbot-preflight@2.0.7` (version from the root manifest), using the same 13-package flow as before. Platform packages are named from the root manifest's `cannbot` block (`platformScope` `@cannbot-release`, `platformPrefix` `preflight`), so they are `@cannbot-release/preflight-<suffix>`. The official `cannbot` name and its `@cannbot-release/<suffix>` platform packages are delivered by a follow-up change and are not republished here. The earlier verification (`cannbot-rehearsal`) and pilot (`cannbot-pilot`) names are retired. AI assistants and other automation must not run a real release — they may only read release files, run checks/tests/builds, and use `--dry-run`.
|
|
138
154
|
|
|
139
|
-
1. Set `version` to the target release version and
|
|
140
|
-
2. `npm login` with
|
|
141
|
-
3. Optional preview: `bun run release --dry-run`. It prints the release plan (package names, version, package count, sub-packages-before-main order), runs typecheck + tests, cross-compiles, and verifies the packed artifacts **without uploading
|
|
155
|
+
1. Set `version` to the target release version and set `name` as `cannbot-preflight` plus `cannbot.platformScope` as `@cannbot-release` and `cannbot.platformPrefix` as `preflight` (single source of truth). The script never bumps the version or creates git tags for you. Make sure a local `cannbot-cli` checkout has the twelve prebuilt artifacts under `packages/opencode/dist/`, each with its `package.json` `version` set to the same target release version, and is reachable as `../cannbot-cli` / `../../cannbot-cli`, or pass `--cannbot-cli-dir <dir>`.
|
|
156
|
+
2. `npm login` with the production publishing account that holds publish rights for `cannbot-preflight` and the `@cannbot-release` scope.
|
|
157
|
+
3. Optional preview: `bun run release --dry-run`. It prints the release plan (package names, version, package count, sub-packages-before-main order), runs typecheck + tests, cross-compiles, and verifies the packed artifacts **without uploading, without registry gating, and without asking for confirmation**.
|
|
142
158
|
4. Real release: run `bun run release` in an **interactive terminal**. After checks, build, and artifact verification it prints the same plan and asks `确认发布 <name>@<version>…`; only `y` / `yes` continues. Any other input (including an empty line) cancels with exit code 0 and uploads nothing.
|
|
143
|
-
5. The script publishes
|
|
144
|
-
6. Smoke-test in a clean directory: `npx cannbot-preflight` (
|
|
145
|
-
7.
|
|
159
|
+
5. The script publishes in two stages. First it uploads the 12 `@cannbot-release/preflight-<suffix>` platform packages, then it queries the registry for those 12 and **only publishes the main `cannbot-preflight` package once all of them are `live`** (i.e. reviewed/approved and queryable via `npm view`). If any sub-package upload fails, or after the last round a sub-package is still staged (`0.0.0-stage`) or the query fails, the command exits non-zero and uploads **no main package**. After the main package is uploaded, a second check verifies the main package is `live`; only then does the command report success. Both checks run in concurrent rounds (default 30 rounds, 1 minute apart), print per-round progress, and force `npm view --prefer-online` so cached packuments cannot mask propagation.
|
|
160
|
+
6. Smoke-test in a clean directory: `npm install -g cannbot-preflight` and `npx cannbot-preflight -v` (should print `2.0.7`), then `npx cannbot-preflight` to start the TUI.
|
|
161
|
+
7. The official `cannbot` name and its `@cannbot-release/<suffix>` platform packages remain on their previous release; switching the root manifest back to the official configuration and publishing them is the job of a follow-up change. Do not republish them from this validation configuration.
|
|
162
|
+
8. Tag the release yourself (tagging is intentionally outside the script):
|
|
146
163
|
```bash
|
|
147
164
|
git tag <version>
|
|
148
165
|
```
|
|
149
166
|
|
|
150
167
|
### Release script options
|
|
151
168
|
|
|
152
|
-
- `--sub-packages <list>` - publish only the main package plus the listed platform sub-packages (comma-separated suffixes such as `windows-x64`, or full derived names). Used for the pre-release account test; omit it for the full 13-package release. The plan summary, confirmation prompt and registry check all describe the partial release.
|
|
153
|
-
|
|
154
169
|
- `--dry-run` — plan, check, build, and pack without uploading or confirming.
|
|
155
170
|
- `--yes` — skip the interactive confirmation. Only for rehearsals or explicitly authorized automation; a real release without a TTY is rejected unless this flag is present.
|
|
156
171
|
- `--no-build` / `--skip-checks` — reuse existing artifacts / skip typecheck and tests (use with care).
|
package/bin/update-check.js
CHANGED
|
@@ -1,7 +1,53 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
|
-
import {
|
|
2
|
+
import { randomBytes } from "node:crypto";
|
|
3
|
+
import { chmodSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
4
|
import { homedir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
+
import { basename, dirname, join } from "node:path";
|
|
6
|
+
|
|
7
|
+
// 私有目录/文件助手(变更 fix-pr-review-findings S1):升级状态含本机用户信息,尽量收敛为
|
|
8
|
+
// 仅属主可访问。与 src/core/fs-private 同构但本文件为纯 JS,故内联实现;失败一律静默降级,
|
|
9
|
+
// Windows 跳过 chmod。
|
|
10
|
+
const PRIVATE_DIR_MODE = 0o700;
|
|
11
|
+
const PRIVATE_FILE_MODE = 0o600;
|
|
12
|
+
|
|
13
|
+
function ensurePrivateDir(dir) {
|
|
14
|
+
try {
|
|
15
|
+
mkdirSync(dir, { recursive: true, mode: PRIVATE_DIR_MODE });
|
|
16
|
+
} catch {
|
|
17
|
+
// 交由后续写入自行失败降级
|
|
18
|
+
}
|
|
19
|
+
if (process.platform === "win32") return;
|
|
20
|
+
try {
|
|
21
|
+
chmodSync(dir, PRIVATE_DIR_MODE);
|
|
22
|
+
} catch {
|
|
23
|
+
// 权限收敛失败静默忽略
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function writePrivateFileAtomic(file, content) {
|
|
28
|
+
const dir = dirname(file);
|
|
29
|
+
ensurePrivateDir(dir);
|
|
30
|
+
const temp = join(dir, `.${basename(file)}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`);
|
|
31
|
+
try {
|
|
32
|
+
writeFileSync(temp, content, { encoding: "utf8", mode: PRIVATE_FILE_MODE });
|
|
33
|
+
if (process.platform !== "win32") {
|
|
34
|
+
try {
|
|
35
|
+
chmodSync(temp, PRIVATE_FILE_MODE);
|
|
36
|
+
} catch {
|
|
37
|
+
// 临时文件权限收敛失败不阻断写入
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
renameSync(temp, file);
|
|
41
|
+
return true;
|
|
42
|
+
} catch {
|
|
43
|
+
try {
|
|
44
|
+
unlinkSync(temp);
|
|
45
|
+
} catch {
|
|
46
|
+
// 临时文件清理失败静默忽略
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
5
51
|
|
|
6
52
|
export const DEFAULT_REGISTRY = "https://registry.npmjs.org/";
|
|
7
53
|
export const UPDATE_CHECK_TIMEOUT_MS = 1500;
|
|
@@ -145,17 +191,10 @@ export function readSkippedVersion(dir = upgradeStateDir()) {
|
|
|
145
191
|
|
|
146
192
|
export function writeSkippedVersion(version, dir = upgradeStateDir()) {
|
|
147
193
|
if (typeof version !== "string" || version.trim().length === 0) return false;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
`${JSON.stringify({ skippedVersion: version.trim() }, null, 2)}\n`,
|
|
153
|
-
"utf8",
|
|
154
|
-
);
|
|
155
|
-
return true;
|
|
156
|
-
} catch {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
194
|
+
return writePrivateFileAtomic(
|
|
195
|
+
upgradeStatePath(dir),
|
|
196
|
+
`${JSON.stringify({ skippedVersion: version.trim() }, null, 2)}\n`,
|
|
197
|
+
);
|
|
159
198
|
}
|
|
160
199
|
|
|
161
200
|
export function parseUpdateChoice(raw) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cannbot-preflight",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"cannbot": "bin/cannbot.js"
|
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
"README.md"
|
|
11
11
|
],
|
|
12
12
|
"optionalDependencies": {
|
|
13
|
-
"@cannbot-release/preflight-windows-x64": "2.0.
|
|
14
|
-
"@cannbot-release/preflight-windows-x64-baseline": "2.0.
|
|
15
|
-
"@cannbot-release/preflight-windows-arm64": "2.0.
|
|
16
|
-
"@cannbot-release/preflight-linux-x64": "2.0.
|
|
17
|
-
"@cannbot-release/preflight-linux-x64-baseline": "2.0.
|
|
18
|
-
"@cannbot-release/preflight-linux-arm64": "2.0.
|
|
19
|
-
"@cannbot-release/preflight-linux-x64-musl": "2.0.
|
|
20
|
-
"@cannbot-release/preflight-linux-x64-baseline-musl": "2.0.
|
|
21
|
-
"@cannbot-release/preflight-linux-arm64-musl": "2.0.
|
|
22
|
-
"@cannbot-release/preflight-darwin-x64": "2.0.
|
|
23
|
-
"@cannbot-release/preflight-darwin-x64-baseline": "2.0.
|
|
24
|
-
"@cannbot-release/preflight-darwin-arm64": "2.0.
|
|
13
|
+
"@cannbot-release/preflight-windows-x64": "2.0.7",
|
|
14
|
+
"@cannbot-release/preflight-windows-x64-baseline": "2.0.7",
|
|
15
|
+
"@cannbot-release/preflight-windows-arm64": "2.0.7",
|
|
16
|
+
"@cannbot-release/preflight-linux-x64": "2.0.7",
|
|
17
|
+
"@cannbot-release/preflight-linux-x64-baseline": "2.0.7",
|
|
18
|
+
"@cannbot-release/preflight-linux-arm64": "2.0.7",
|
|
19
|
+
"@cannbot-release/preflight-linux-x64-musl": "2.0.7",
|
|
20
|
+
"@cannbot-release/preflight-linux-x64-baseline-musl": "2.0.7",
|
|
21
|
+
"@cannbot-release/preflight-linux-arm64-musl": "2.0.7",
|
|
22
|
+
"@cannbot-release/preflight-darwin-x64": "2.0.7",
|
|
23
|
+
"@cannbot-release/preflight-darwin-x64-baseline": "2.0.7",
|
|
24
|
+
"@cannbot-release/preflight-darwin-arm64": "2.0.7"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"registry": "https://registry.npmjs.org/",
|