cannwork-rehearsal 0.1.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 +27 -19
- package/bin/cannwork.js +26 -8
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -9,21 +9,27 @@ A terminal launcher for AI coding agents (starting with [opencode](https://openc
|
|
|
9
9
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
12
|
+
Trial-period name (currently available — the official scoped name is not published yet):
|
|
13
|
+
|
|
12
14
|
```bash
|
|
13
|
-
npm install -g
|
|
15
|
+
npm install -g cannwork-rehearsal
|
|
14
16
|
# or run without installing
|
|
15
|
-
npx
|
|
17
|
+
npx cannwork-rehearsal
|
|
16
18
|
```
|
|
17
19
|
|
|
20
|
+
Official name (to be published later): `@zhoufangchaojs/cannwork`, same usage once available.
|
|
21
|
+
|
|
18
22
|
The npm package ships standalone executables per platform. Supported platforms:
|
|
19
23
|
|
|
20
|
-
| Platform |
|
|
24
|
+
| Platform | Suffix |
|
|
21
25
|
| --- | --- |
|
|
22
|
-
| Windows x64 |
|
|
23
|
-
| Linux x64 (glibc) |
|
|
24
|
-
| Linux arm64 (glibc) |
|
|
25
|
-
| macOS x64 |
|
|
26
|
-
| macOS arm64 |
|
|
26
|
+
| Windows x64 | `win32-x64` |
|
|
27
|
+
| Linux x64 (glibc) | `linux-x64` |
|
|
28
|
+
| Linux arm64 (glibc) | `linux-arm64` |
|
|
29
|
+
| macOS x64 | `darwin-x64` |
|
|
30
|
+
| macOS arm64 | `darwin-arm64` |
|
|
31
|
+
|
|
32
|
+
The installed platform package is `<package-name>-<suffix>` (currently `cannwork-rehearsal-<suffix>`, later `@zhoufangchaojs/cannwork-<suffix>`).
|
|
27
33
|
|
|
28
34
|
Notes:
|
|
29
35
|
|
|
@@ -31,9 +37,9 @@ Notes:
|
|
|
31
37
|
- Linux binaries link glibc; Alpine/musl is not covered yet — `OPENTUI_LIBC`/musl builds are not published.
|
|
32
38
|
- The macOS binaries are not codesigned/notarized. If Gatekeeper blocks the binary, clear the quarantine flag:
|
|
33
39
|
```bash
|
|
34
|
-
xattr -d com.apple.quarantine "$(npm root -g)
|
|
40
|
+
xattr -d com.apple.quarantine "$(npm root -g)/cannwork-rehearsal-darwin-arm64/bin/cannwork"
|
|
35
41
|
```
|
|
36
|
-
- `cannwork-rehearsal` is
|
|
42
|
+
- `cannwork-rehearsal` is the **trial-period release name**: it is published and installable on purpose so real users can try it while the official `@zhoufangchaojs/cannwork` name is not released yet. It will be retired (unpublished/deprecated) once the official name is published.
|
|
37
43
|
|
|
38
44
|
## Getting Started (from source)
|
|
39
45
|
|
|
@@ -67,23 +73,25 @@ Build artifacts are written to `dist/`.
|
|
|
67
73
|
|
|
68
74
|
## Maintainer release runbook
|
|
69
75
|
|
|
70
|
-
Releases are published manually to <https://registry.npmjs.org/> in two phases:
|
|
76
|
+
Releases are published manually to <https://registry.npmjs.org/> in two phases: an unscoped **trial release** that is kept live for real users, then (later) the official scoped release, after which the trial name is retired.
|
|
71
77
|
|
|
72
|
-
### Phase 1 —
|
|
78
|
+
### Phase 1 — unscoped trial release (kept live)
|
|
73
79
|
|
|
74
|
-
1. Set `name` to `cannwork-rehearsal` and `version` to `0.
|
|
80
|
+
1. Set `name` to `cannwork-rehearsal` and `version` to `0.2.0` in the root `package.json` (single source of truth).
|
|
75
81
|
2. `npm login` (any account with publish rights).
|
|
76
82
|
3. `bun run release` — runs typecheck + tests, cross-compiles, then publishes the 5 platform packages followed by the main package. Add `--dry-run` to pack and verify without uploading.
|
|
77
|
-
4.
|
|
78
|
-
5.
|
|
83
|
+
4. Check each package on the registry (`npm view <pkg> version`). A `0.0.0-stage` value means npm staged the version for review; wait for it to go live (or approve it on npmjs.com) before smoke-testing.
|
|
84
|
+
5. Smoke-test in a clean directory: `npx cannwork-rehearsal`. On success the script writes `dist/.rehearsal-ok`, which unlocks phase 2.
|
|
85
|
+
6. **Keep it live**: do not unpublish. During the trial, ship updates by repeating steps 3–5 with a bumped version.
|
|
79
86
|
|
|
80
|
-
### Phase 2 —
|
|
87
|
+
### Phase 2 — official scoped release (deferred), then retire the trial name
|
|
81
88
|
|
|
82
|
-
|
|
83
|
-
|
|
89
|
+
7. Set `name` to `@zhoufangchaojs/cannwork`, then `bun run release`. The script refuses to publish a scoped name until the trial-release marker exists.
|
|
90
|
+
8. Verify: `npm view @zhoufangchaojs/cannwork version`, smoke-test `npx @zhoufangchaojs/cannwork`, then tag the release:
|
|
84
91
|
```bash
|
|
85
|
-
git tag
|
|
92
|
+
git tag <version>
|
|
86
93
|
```
|
|
94
|
+
9. Retire the trial packages: `npm unpublish` all 6 (`cannwork-rehearsal` and `cannwork-rehearsal-*`) within the 72-hour window, otherwise `npm deprecate` them as trial packages. If the active credential is a `Granular access token` that bypasses 2FA, unpublish is rejected with 403 — delete the packages on npmjs.com instead, or run `npm login --auth-type=web` first.
|
|
87
95
|
|
|
88
96
|
Rollback: `npm unpublish` the affected version within the allowed window; afterwards `npm deprecate` and publish a fixed version.
|
|
89
97
|
|
package/bin/cannwork.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
|
-
import { accessSync, chmodSync, constants } from "node:fs";
|
|
4
|
+
import { accessSync, chmodSync, constants, realpathSync } from "node:fs";
|
|
5
5
|
import { resolve } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
|
|
@@ -86,13 +86,19 @@ export async function run(argv = process.argv.slice(2)) {
|
|
|
86
86
|
const { platform: os, arch } = process;
|
|
87
87
|
|
|
88
88
|
const requireFromHere = createRequire(import.meta.url);
|
|
89
|
-
let
|
|
89
|
+
let manifest;
|
|
90
90
|
try {
|
|
91
|
-
|
|
91
|
+
manifest = requireFromHere("../package.json");
|
|
92
92
|
} catch {
|
|
93
93
|
process.stderr.write("cannwork: 无法读取自身包清单,安装可能已损坏。\n");
|
|
94
94
|
return 1;
|
|
95
95
|
}
|
|
96
|
+
const mainName = manifest.name;
|
|
97
|
+
|
|
98
|
+
if (argv.includes("-v") || argv.includes("--version")) {
|
|
99
|
+
process.stdout.write(`${manifest.version}\n`);
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
96
102
|
|
|
97
103
|
const binaryPath = resolveBinaryPath(mainName, os, arch, requireFromHere);
|
|
98
104
|
if (binaryPath === null) {
|
|
@@ -104,17 +110,29 @@ export async function run(argv = process.argv.slice(2)) {
|
|
|
104
110
|
return await spawnBinary(binaryPath, argv);
|
|
105
111
|
}
|
|
106
112
|
|
|
107
|
-
export
|
|
108
|
-
|
|
113
|
+
export const ENTRYPOINT_UNDETERMINED_MESSAGE =
|
|
114
|
+
"cannwork: 无法确认启动器入口,已跳过执行。\n";
|
|
115
|
+
|
|
116
|
+
export function entrypointStatus(metaUrl, argv1) {
|
|
117
|
+
if (typeof argv1 !== "string" || argv1.length === 0) return "not-entrypoint";
|
|
109
118
|
try {
|
|
110
|
-
|
|
119
|
+
const selfPath = realpathSync(fileURLToPath(metaUrl));
|
|
120
|
+
const argvPath = realpathSync(resolve(argv1));
|
|
121
|
+
return selfPath === argvPath ? "entrypoint" : "not-entrypoint";
|
|
111
122
|
} catch {
|
|
112
|
-
return
|
|
123
|
+
return "undetermined";
|
|
113
124
|
}
|
|
114
125
|
}
|
|
115
126
|
|
|
116
|
-
|
|
127
|
+
export function isEntrypoint(metaUrl, argv1) {
|
|
128
|
+
return entrypointStatus(metaUrl, argv1) === "entrypoint";
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const entryStatus = entrypointStatus(import.meta.url, process.argv[1]);
|
|
132
|
+
if (entryStatus === "entrypoint") {
|
|
117
133
|
run().then((code) => {
|
|
118
134
|
process.exit(code);
|
|
119
135
|
});
|
|
136
|
+
} else if (entryStatus === "undetermined") {
|
|
137
|
+
process.stderr.write(ENTRYPOINT_UNDETERMINED_MESSAGE);
|
|
120
138
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cannwork-rehearsal",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"cannwork": "bin/cannwork.js"
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"README.md"
|
|
11
11
|
],
|
|
12
12
|
"optionalDependencies": {
|
|
13
|
-
"cannwork-rehearsal-win32-x64": "0.1
|
|
14
|
-
"cannwork-rehearsal-linux-x64": "0.1
|
|
15
|
-
"cannwork-rehearsal-linux-arm64": "0.1
|
|
16
|
-
"cannwork-rehearsal-darwin-x64": "0.1
|
|
17
|
-
"cannwork-rehearsal-darwin-arm64": "0.1
|
|
13
|
+
"cannwork-rehearsal-win32-x64": "0.2.1",
|
|
14
|
+
"cannwork-rehearsal-linux-x64": "0.2.1",
|
|
15
|
+
"cannwork-rehearsal-linux-arm64": "0.2.1",
|
|
16
|
+
"cannwork-rehearsal-darwin-x64": "0.2.1",
|
|
17
|
+
"cannwork-rehearsal-darwin-arm64": "0.2.1"
|
|
18
18
|
},
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"registry": "https://registry.npmjs.org/",
|