@getnote/cli 1.5.5 → 1.5.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 CHANGED
@@ -13,7 +13,7 @@
13
13
  适用于 OpenClaw(小龙虾)、QClaw、Claude Code、Codex、GitHub Copilot、Cursor、Gemini CLI、Windsurf、OpenCode、Cline 和 WorkBuddy:
14
14
 
15
15
  ```bash
16
- npx -y @getnote/cli@latest setup
16
+ npm install -g @getnote/cli@latest && getnote setup
17
17
  ```
18
18
 
19
19
  这条命令会把 CLI 安装到稳定的全局路径、自动识别本机平台、安装五个 Skills,并引导完成一次得到大脑授权。安装时保留醒目的 `SKILLS` 开场,最终只显示每个平台是否安装成功,以及唯一需要用户完成的下一步,不再展示 `universal`、`symlink`、`overwrites` 等内部安装细节。WorkBuddy 安装后需要重启;OpenClaw(小龙虾)和 QClaw 的 Skill 由平台管理,命令会给出对应的 ClawHub 确认入口。
@@ -35,13 +35,14 @@ getnote auth login
35
35
 
36
36
  或者从 [Releases](https://github.com/iswalle/getnote-cli/releases) 下载对应平台的二进制文件,放到 `$PATH` 里。
37
37
 
38
- **Windows 用户**:推荐直接从 [Releases](https://github.com/iswalle/getnote-cli/releases) 下载 `.exe` 文件,放到 PATH 里。用 `npm install -g` 安装时,如果遇到 `Expand-Archive` 相关报错,可尝试:
38
+ **pnpm 10+ 用户**:pnpm 默认会拦截依赖包的构建脚本。请在工作区的 `pnpm-workspace.yaml` 中允许 `@getnote/cli` 运行安装脚本:
39
39
 
40
- ```bash
41
- npm install -g @getnote/cli --ignore-scripts
40
+ ```yaml
41
+ allowBuilds:
42
+ '@getnote/cli': true
42
43
  ```
43
44
 
44
- 然后手动从 Releases 下载对应平台的二进制文件。
45
+ 然后重新执行 `pnpm install`。也可以直接从 [Releases](https://github.com/iswalle/getnote-cli/releases) 下载对应平台的二进制文件并放入 `$PATH`。
45
46
 
46
47
  ---
47
48
 
@@ -102,16 +103,16 @@ getnote version --check-update
102
103
  # 只检查,不安装
103
104
  getnote update --check
104
105
 
105
- # 升级到最新 GitHub Release
106
+ # 升级 CLI、同步全部已检测 AI 的 Skills,并运行 doctor 验证
106
107
  getnote update
107
108
  ```
108
109
 
109
- 独立二进制升级会校验 GitHub Release 的 SHA-256;npm 安装会升级整个 `@getnote/cli` 包,使二进制、元数据和内置 Skills 保持一致。
110
+ 独立二进制升级会校验 GitHub Release 的 SHA-256;npm 安装会升级整个 `@getnote/cli` 包。升级成功后,`getnote update` 会使用新版 CLI 运行 `setup` 和 `doctor`,让二进制、元数据、内置 Skills 和本机 AI 接入状态保持一致。
110
111
 
111
- 如果通过 npm 安装,也可以完整更新 npm 包和可执行程序:
112
+ 只想升级 CLI、不需要同步 Skills 时:
112
113
 
113
114
  ```bash
114
- npm install -g @getnote/cli@latest
115
+ getnote update --cli-only
115
116
  ```
116
117
 
117
118
  ---
@@ -391,6 +392,7 @@ $ getnote search "工作日志" --limit 7 -o json
391
392
 
392
393
  | 日期 | 版本 | 新能力 | 适合怎么用 |
393
394
  |------|------|--------|------------|
395
+ | 2026-08-19 | **v1.5.6** | 1. `getnote update` 默认升级 CLI、同步五个领域 Skill 并运行诊断<br>2. capabilities 2.2 提供机器可读的安装、更新、验证与平台托管边界<br>3. 移除失效的 `install.sh` 引导 | 用户只说“安装”或“更新”即可,AI Agent 无需让用户选择内部组件,并能按统一成功条件完成验收 |
394
396
  | 2026-08-19 | **v1.5.5** | 1. 一键安装自动识别本机 AI Agent,并按平台显示安装结果<br>2. 新增 GitHub Copilot、Gemini CLI、Windsurf、OpenCode 和 Cline 自动安装<br>3. OpenClaw(小龙虾)和 QClaw 仅在检测到时提供 ClawHub 确认入口<br>4. 保留 `SKILLS` 品牌开场,隐藏底层安装术语<br>5. `doctor` 按平台真实目录检查 Skill 状态 | 用户只需运行一次安装命令;AI 能根据结构化结果判断安装状态并给出明确修复动作 |
395
397
  | 2026-08-17 | **v1.5.3** | 1. `doctor` 新增稳定问题码、阻断级别、修复动作、平台 Skill 状态和在线/离线就绪语义<br>2. 诊断失败提供可靠退出码,JSON 保持单一、可解析<br>3. npm 与独立二进制采用匹配的升级路径,Release 下载增加 SHA-256 校验<br>4. WorkBuddy Skills 整套预检并支持失败回滚<br>5. 严格校验输出格式与多余参数 | 让技术用户和 AI 都能准确判断环境是否真正可用,并根据结构化结果完成修复;同时避免版本分裂、半安装和未校验更新包 |
396
398
  | 2026-08-14 | **v1.5.2** | 1. 补齐团队知识库、订阅知识库与文件夹操作的执行边界<br>2. 明确目录、资源及笔记 ID 的结构化结果字段,避免 AI 猜字段<br>3. 搜索结果按字符串 `note_id` 去重,不把同一笔记的多个命中片段重复展示<br>4. 完善“这条笔记”、录音分享与权限失败的安全处理 | 提升 CLI 内置 Skills 在知识库整理、搜索和笔记管理场景中的理解与执行准确度;本次不改变既有 CLI 命令和授权凭证 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getnote/cli",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "description": "CLI tool for 得到大脑(Get笔记) — manage notes and knowledge bases from the terminal",
5
5
  "keywords": [
6
6
  "getnote",
@@ -19,7 +19,8 @@
19
19
  "gnote": "./bin/getnote.js"
20
20
  },
21
21
  "scripts": {
22
- "postinstall": "node scripts/postinstall.js"
22
+ "postinstall": "node scripts/postinstall.js",
23
+ "test": "node --test scripts/postinstall.test.js"
23
24
  },
24
25
  "files": [
25
26
  "bin/getnote.js",
@@ -37,6 +37,45 @@ function getDownloadURL(platform) {
37
37
  return `https://github.com/${REPO}/releases/download/v${VERSION}/${asset}`;
38
38
  }
39
39
 
40
+ function getWindowsExtractArgs(archivePath, destinationPath) {
41
+ return [
42
+ '-NoProfile',
43
+ '-Command',
44
+ '& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }',
45
+ archivePath,
46
+ destinationPath,
47
+ ];
48
+ }
49
+
50
+ async function installArchive({
51
+ platform,
52
+ binDir,
53
+ binaryName,
54
+ binaryPath,
55
+ url,
56
+ tmpFile,
57
+ downloadFn = download,
58
+ verifyChecksumFn = verifyChecksum,
59
+ runFn = run,
60
+ chmodFn = fs.chmodSync,
61
+ unlinkFn = fs.unlinkSync,
62
+ }) {
63
+ try {
64
+ await downloadFn(url, tmpFile);
65
+ await verifyChecksumFn(url, path.basename(url), tmpFile);
66
+ if (platform.platform === 'windows') {
67
+ runFn('powershell', getWindowsExtractArgs(tmpFile, binDir));
68
+ } else {
69
+ runFn('tar', ['-xzf', tmpFile, '-C', binDir, binaryName]);
70
+ }
71
+
72
+ chmodFn(binaryPath, 0o755);
73
+ console.log(`getnote installed at ${binaryPath}`);
74
+ } finally {
75
+ try { unlinkFn(tmpFile); } catch (_) {}
76
+ }
77
+ }
78
+
40
79
  async function main() {
41
80
  const platform = getPlatform();
42
81
  const binDir = path.join(__dirname, '..', 'bin');
@@ -63,24 +102,7 @@ async function main() {
63
102
 
64
103
  fs.mkdirSync(binDir, { recursive: true });
65
104
 
66
- try {
67
- await download(url, tmpFile);
68
- await verifyChecksum(url, path.basename(url), tmpFile);
69
- if (platform.platform === 'windows') {
70
- run('powershell', ['-NoProfile', '-Command', 'Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force', tmpFile, binDir]);
71
- } else {
72
- run('tar', ['-xzf', tmpFile, '-C', binDir, binaryName]);
73
- }
74
-
75
- fs.chmodSync(binaryPath, 0o755);
76
- console.log(`getnote installed at ${binaryPath}`);
77
-
78
- } catch (err) {
79
- console.error('Failed to install getnote:', err.message);
80
- process.exit(1);
81
- } finally {
82
- try { fs.unlinkSync(tmpFile); } catch (_) {}
83
- }
105
+ await installArchive({ platform, binDir, binaryName, binaryPath, url, tmpFile });
84
106
  }
85
107
 
86
108
  function run(command, args) {
@@ -128,7 +150,11 @@ async function verifyChecksum(assetURL, assetName, archivePath) {
128
150
  }
129
151
  }
130
152
 
131
- main().catch(err => {
132
- console.error('Failed to install getnote:', err.message);
133
- process.exit(1);
134
- });
153
+ if (require.main === module) {
154
+ main().catch(err => {
155
+ console.error('Failed to install getnote:', err.message);
156
+ process.exitCode = 1;
157
+ });
158
+ }
159
+
160
+ module.exports = { getWindowsExtractArgs, installArchive };
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ const assert = require('node:assert/strict');
4
+ const test = require('node:test');
5
+
6
+ const { getWindowsExtractArgs, installArchive } = require('./postinstall');
7
+
8
+ test('Windows extraction invokes Expand-Archive inside a script block', () => {
9
+ assert.deepEqual(getWindowsExtractArgs('C:\\Temp\\getnote.zip', 'C:\\Program Files\\getnote'), [
10
+ '-NoProfile',
11
+ '-Command',
12
+ '& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }',
13
+ 'C:\\Temp\\getnote.zip',
14
+ 'C:\\Program Files\\getnote',
15
+ ]);
16
+ });
17
+
18
+ test('temporary archive is removed when installation fails', async () => {
19
+ const removed = [];
20
+ await assert.rejects(
21
+ installArchive({
22
+ platform: { platform: 'windows', arch: 'amd64' },
23
+ binDir: 'C:\\getnote\\bin',
24
+ binaryName: 'getnote.exe',
25
+ binaryPath: 'C:\\getnote\\bin\\getnote.exe',
26
+ url: 'https://example.invalid/getnote.zip',
27
+ tmpFile: 'C:\\Temp\\getnote-download.zip',
28
+ downloadFn: async () => { throw new Error('download failed'); },
29
+ verifyChecksumFn: async () => {},
30
+ runFn: () => {},
31
+ chmodFn: () => {},
32
+ unlinkFn: file => removed.push(file),
33
+ }),
34
+ /download failed/,
35
+ );
36
+ assert.deepEqual(removed, ['C:\\Temp\\getnote-download.zip']);
37
+ });
@@ -11,8 +11,8 @@ description: 安装和连接得到大脑,完成浏览器授权、环境诊断
11
11
 
12
12
  按顺序执行,已经满足的步骤直接跳过:
13
13
 
14
- 1. 若当前来自独立 GetNote Skill 包,先运行 `bash scripts/install.sh --ensure`。它负责检查 Node.js 20+ 并确保官方 CLI 存在;不要因为 Skill 已安装就假设 CLI 存在。
15
- 2. 若当前环境只有 CLI 内置 Skill、没有上述安装器,则用 `command -v getnote` 检查 CLI;缺失时检查 `node --version` 和 `npm --version`,再自动执行 `npm install -g @getnote/cli@latest`。这是 Agent 的工作,不要求用户手工复制命令;只有系统弹出安装授权时才请用户确认。
14
+ 1. 用 `command -v getnote` 检查 CLI;不要因为 Skill 已安装就假设 CLI 存在。独立的 ClawHub/OpenClaw Skill 由平台管理 CLI 依赖,不查找或运行 `scripts/install.sh`。
15
+ 2. CLI 缺失时检查 `node --version` 和 `npm --version`,再自动执行 `npm install -g @getnote/cli@latest`。这是 Agent 的工作,不要求用户手工复制命令;只有系统弹出安装授权时才请用户确认。
16
16
  3. 执行 `getnote version`,必须能够正常启动。
17
17
  4. 执行 `getnote auth status`。未登录时运行 `getnote auth login`,让用户只在浏览器中确认,不索要 API Key、Cookie 或 Authorization。
18
18
  5. 执行 `getnote doctor -o json`。只有 `diagnostics_completed=true`、`ready=true` 且 `status=ready`,才能宣布完整连接;`ready=true,status=degraded` 表示核心能力可用但仍应处理警告。`success` 和旧 `checks` 字段仅用于兼容。若未就绪,先处理 `issues[].blocking=true`,再按 `next_actions[]` 修复。需要确认的动作不得静默执行。
@@ -49,7 +49,7 @@ description: 安装和连接得到大脑,完成浏览器授权、环境诊断
49
49
  | `getnote quota -o json` | `data.read/write/write_note` 下的 `daily/monthly.limit/used/remaining/reset_at` | 按真实桶说明剩余额度,不自行换算或合并桶。 |
50
50
  | `getnote version` | 版本文本 | 只用于展示版本;机器契约仍以 `capabilities -o json` 为准。 |
51
51
  | `getnote update --check` | 当前/可用新版本文本 | 有新版本再运行 `getnote update`。 |
52
- | `getnote update` | 更新完成文本 | 必须再运行 `version` 和 `doctor -o json`,通过后才能说升级完成。 |
52
+ | `getnote update` | CLI 更新、Skills 同步和 doctor 验证结果 | 默认由新版 CLI 自动完成完整更新闭环;只有全部步骤成功才能说升级完成。只升级 CLI 时使用 `--cli-only`。 |
53
53
 
54
54
  所有命令以退出码为第一判断:退出码非 0 即失败。使用 `-o json` 的 API 与本地错误均返回 `success=false`、`data=null`、`error.code/message/reason/retryable` 和可选 `request_id`;不能把 HTTP 200 或“命令运行过”当成成功。
55
55
 
@@ -65,13 +65,12 @@ description: 安装和连接得到大脑,完成浏览器授权、环境诊断
65
65
 
66
66
  ## 更新闭环
67
67
 
68
- 用户说“帮我更新得到大脑”已经构成更新授权:
68
+ 用户说“帮我更新得到大脑”已经构成完整更新授权;不要再让用户选择 CLI、领域 Skill 等内部组件:
69
69
 
70
- 1. 若当前来自独立 GetNote Skill 包,执行 `bash scripts/install.sh --update`。它升级 CLI,并在有新版发布包时刷新主 Skill 和五个领域 Skill。
71
- 2. 若当前环境只有 CLI 内置 Skill,执行 `getnote update --check`;有新版本时执行 `getnote update`,若 CLI 明确提示 npm 安装方式,则用 `npm install -g @getnote/cli@latest`。
72
- 3. 执行 `getnote version` 和 `getnote doctor -o json`。
73
- 4. 执行 `getnote setup` 同步内置领域 Skill;技能市场托管的独立 Skill 需要平台更新时,只让用户完成唯一必要的点击。
74
- 5. 用最近笔记读取做验收,再告诉用户版本、诊断结果和仍需动作。
70
+ 1. 执行 `getnote update --check`;有新版本或需要刷新 Skills 时执行 `getnote update`。命令会升级 CLI,再由新版 CLI 自动运行 `setup` 和 `doctor`,并同步 CLI 随附的五个领域 Skill。
71
+ 2. ClawHub/OpenClaw 托管的独立聚合 Skill 由平台更新;`getnote update` 不下载或覆盖该 Skill。若宿主支持检查 Skill 更新则继续使用宿主流程,否则只告知用户唯一必要的确认入口。
72
+ 3. 检查更新输出中的 CLI 版本、五个领域 Skill 同步结果和 doctor 结果。
73
+ 4. 用最近笔记读取做验收,再告诉用户版本、诊断结果和仍需动作。
75
74
 
76
75
  ## 安全与恢复
77
76