@getnote/cli 1.5.2 → 1.5.5
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 +15 -9
- package/package.json +1 -1
- package/scripts/postinstall.js +59 -11
- package/skills/getnote-auth/SKILL.md +13 -3
package/README.md
CHANGED
|
@@ -10,19 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
### 让本地 AI 自动完成安装(推荐)
|
|
12
12
|
|
|
13
|
-
适用于
|
|
13
|
+
适用于 OpenClaw(小龙虾)、QClaw、Claude Code、Codex、GitHub Copilot、Cursor、Gemini CLI、Windsurf、OpenCode、Cline 和 WorkBuddy:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
npx -y @getnote/cli@latest setup
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
这条命令会把 CLI
|
|
20
|
-
|
|
21
|
-
如果只想安装到 WorkBuddy,可明确指定:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npx -y @getnote/cli@latest setup --target workbuddy
|
|
25
|
-
```
|
|
19
|
+
这条命令会把 CLI 安装到稳定的全局路径、自动识别本机平台、安装五个 Skills,并引导完成一次得到大脑授权。安装时保留醒目的 `SKILLS` 开场,最终只显示每个平台是否安装成功,以及唯一需要用户完成的下一步,不再展示 `universal`、`symlink`、`overwrites` 等内部安装细节。WorkBuddy 安装后需要重启;OpenClaw(小龙虾)和 QClaw 的 Skill 由平台管理,命令会给出对应的 ClawHub 确认入口。
|
|
26
20
|
|
|
27
21
|
安装后运行:
|
|
28
22
|
|
|
@@ -93,6 +87,14 @@ getnote notes
|
|
|
93
87
|
|
|
94
88
|
## 检查和升级
|
|
95
89
|
|
|
90
|
+
`doctor` 会同时检查 CLI 路径、npm 安装一致性、账号授权、OpenAPI 连通性、版本更新和已检测 AI 平台的 Skill 状态:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
getnote doctor -o json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
机器或 AI 应同时读取 `ready` 和 `status`:`ready=true,status=ready` 表示完整可用;`ready=true,status=degraded` 表示核心 API 可用但仍有非阻断问题;`ready=false` 表示存在阻断问题。`issues` 提供稳定问题码、严重级别和是否阻断,`next_actions` 给出修复动作与是否需要用户确认;`integrations` 区分“检测到 AI 应用”和“对应 Skill 已安装”。`--offline` 只检查本地环境,此时 `local_ready` 表示本地结果、`ready=null,status=partial` 表示远端状态未知。默认只返回检测到的平台,需要排查全部平台时加 `--all-platforms`。
|
|
97
|
+
|
|
96
98
|
```bash
|
|
97
99
|
# 查看当前版本并检查是否有新版
|
|
98
100
|
getnote version --check-update
|
|
@@ -104,6 +106,8 @@ getnote update --check
|
|
|
104
106
|
getnote update
|
|
105
107
|
```
|
|
106
108
|
|
|
109
|
+
独立二进制升级会校验 GitHub Release 的 SHA-256;npm 安装会升级整个 `@getnote/cli` 包,使二进制、元数据和内置 Skills 保持一致。
|
|
110
|
+
|
|
107
111
|
如果通过 npm 安装,也可以完整更新 npm 包和可执行程序:
|
|
108
112
|
|
|
109
113
|
```bash
|
|
@@ -175,7 +179,7 @@ npx skills add iswalle/getnote-cli -y -g
|
|
|
175
179
|
|
|
176
180
|
安装后在 Claude Code / Cursor 里说「帮我搜一下关于 RAG 的笔记」即可直接调用。
|
|
177
181
|
|
|
178
|
-
独立的聚合 Skill 面向
|
|
182
|
+
独立的聚合 Skill 面向 OpenClaw(小龙虾)及 QClaw 等生态客户端和 WorkBuddy,只负责意图理解,底层仍调用同一个 CLI,不再维护第二套 OpenAPI 请求实现。
|
|
179
183
|
|
|
180
184
|
---
|
|
181
185
|
|
|
@@ -387,6 +391,8 @@ $ getnote search "工作日志" --limit 7 -o json
|
|
|
387
391
|
|
|
388
392
|
| 日期 | 版本 | 新能力 | 适合怎么用 |
|
|
389
393
|
|------|------|--------|------------|
|
|
394
|
+
| 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
|
+
| 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 都能准确判断环境是否真正可用,并根据结构化结果完成修复;同时避免版本分裂、半安装和未校验更新包 |
|
|
390
396
|
| 2026-08-14 | **v1.5.2** | 1. 补齐团队知识库、订阅知识库与文件夹操作的执行边界<br>2. 明确目录、资源及笔记 ID 的结构化结果字段,避免 AI 猜字段<br>3. 搜索结果按字符串 `note_id` 去重,不把同一笔记的多个命中片段重复展示<br>4. 完善“这条笔记”、录音分享与权限失败的安全处理 | 提升 CLI 内置 Skills 在知识库整理、搜索和笔记管理场景中的理解与执行准确度;本次不改变既有 CLI 命令和授权凭证 |
|
|
391
397
|
| 2026-08-13 | **v1.5.1** | 1. 修复通过 `npx setup` 安装后命令指向临时 npm 缓存的问题<br>2. 同时提供稳定的 `getnote` / `gnote` 双命令<br>3. 自动把五个领域 Skill 安装到 WorkBuddy<br>4. 重复安装保留已有授权凭证 | 在 WorkBuddy、Codex、Claude Code 或 Cursor 中重复执行同一条安装命令即可修复或升级,不需要重新授权 |
|
|
392
398
|
| 2026-08-13 | **v1.5.0** | 1. 支持浏览、创建、移动和删除知识库目录<br>2. 笔记可直接加入指定目录,支持已有团队知识库 `TEAMSPACE` 的成员读取与管理员维护<br>3. 支持订阅抖音博主并读取博主内容<br>4. 新增录音原文、链接原文、附件、时间线、快捷笔记和会议待办等一级命令<br>5. 完善结构化结果、错误原因、短命令、`doctor` 和升级检查 | 让人和 AI 用同一套命令完成知识库整理、资料归档和深层笔记读取;失败时能识别原因,不再猜参数或把未完成任务当成成功 |
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
const fs = require('fs');
|
|
7
7
|
const path = require('path');
|
|
8
8
|
const os = require('os');
|
|
9
|
-
const
|
|
9
|
+
const https = require('https');
|
|
10
|
+
const crypto = require('crypto');
|
|
11
|
+
const { spawnSync } = require('child_process');
|
|
10
12
|
|
|
11
13
|
const pkg = require('../package.json');
|
|
12
14
|
const VERSION = pkg.version;
|
|
@@ -46,7 +48,9 @@ async function main() {
|
|
|
46
48
|
// Skip download if binary already matches current version
|
|
47
49
|
if (fs.existsSync(binaryPath)) {
|
|
48
50
|
try {
|
|
49
|
-
const
|
|
51
|
+
const result = spawnSync(binaryPath, ['version'], { encoding: 'utf8' });
|
|
52
|
+
const fallback = result.status === 0 ? result : spawnSync(binaryPath, ['--version'], { encoding: 'utf8' });
|
|
53
|
+
const out = (fallback.stdout || '').trim();
|
|
50
54
|
if (out.includes(VERSION)) {
|
|
51
55
|
console.log(`getnote v${VERSION} already installed, skipping download.`);
|
|
52
56
|
return;
|
|
@@ -60,16 +64,12 @@ async function main() {
|
|
|
60
64
|
fs.mkdirSync(binDir, { recursive: true });
|
|
61
65
|
|
|
62
66
|
try {
|
|
63
|
-
|
|
67
|
+
await download(url, tmpFile);
|
|
68
|
+
await verifyChecksum(url, path.basename(url), tmpFile);
|
|
64
69
|
if (platform.platform === 'windows') {
|
|
65
|
-
|
|
66
|
-
`powershell -Command "Invoke-WebRequest -Uri '${url}' -OutFile '${tmpFile}'"`,
|
|
67
|
-
{ stdio: 'inherit' }
|
|
68
|
-
);
|
|
69
|
-
execSync(`powershell -Command "Expand-Archive -Path '${tmpFile}' -DestinationPath '${binDir}' -Force"`, { stdio: 'inherit' });
|
|
70
|
+
run('powershell', ['-NoProfile', '-Command', 'Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force', tmpFile, binDir]);
|
|
70
71
|
} else {
|
|
71
|
-
|
|
72
|
-
execSync(`tar -xzf "${tmpFile}" -C "${binDir}" "${binaryName}"`, { stdio: 'inherit' });
|
|
72
|
+
run('tar', ['-xzf', tmpFile, '-C', binDir, binaryName]);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
fs.chmodSync(binaryPath, 0o755);
|
|
@@ -83,4 +83,52 @@ async function main() {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
function run(command, args) {
|
|
87
|
+
const result = spawnSync(command, args, { stdio: 'inherit' });
|
|
88
|
+
if (result.error) throw result.error;
|
|
89
|
+
if (result.status !== 0) throw new Error(`${command} exited with status ${result.status}`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function download(url, destination, redirects = 0) {
|
|
93
|
+
if (redirects > 5) return Promise.reject(new Error('Too many redirects'));
|
|
94
|
+
return new Promise((resolve, reject) => {
|
|
95
|
+
const request = https.get(url, { headers: { 'User-Agent': '@getnote/cli installer' } }, response => {
|
|
96
|
+
if (response.statusCode >= 300 && response.statusCode < 400 && response.headers.location) {
|
|
97
|
+
response.resume();
|
|
98
|
+
return resolve(download(new URL(response.headers.location, url).toString(), destination, redirects + 1));
|
|
99
|
+
}
|
|
100
|
+
if (response.statusCode !== 200) {
|
|
101
|
+
response.resume();
|
|
102
|
+
return reject(new Error(`HTTP ${response.statusCode}: ${url}`));
|
|
103
|
+
}
|
|
104
|
+
const output = fs.createWriteStream(destination, { mode: 0o600 });
|
|
105
|
+
response.pipe(output);
|
|
106
|
+
output.on('finish', () => output.close(resolve));
|
|
107
|
+
output.on('error', reject);
|
|
108
|
+
});
|
|
109
|
+
request.on('error', reject);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async function verifyChecksum(assetURL, assetName, archivePath) {
|
|
114
|
+
const checksumPath = `${archivePath}.checksums`;
|
|
115
|
+
try {
|
|
116
|
+
await download(new URL('checksums.txt', assetURL).toString(), checksumPath);
|
|
117
|
+
const line = fs.readFileSync(checksumPath, 'utf8').split(/\r?\n/).find(value => {
|
|
118
|
+
const fields = value.trim().split(/\s+/);
|
|
119
|
+
return fields.length === 2 && fields[1].replace(/^\*/, '') === assetName;
|
|
120
|
+
});
|
|
121
|
+
if (!line) throw new Error(`Checksum for ${assetName} is missing`);
|
|
122
|
+
const expected = line.trim().split(/\s+/)[0].toLowerCase();
|
|
123
|
+
if (!/^[a-f0-9]{64}$/.test(expected)) throw new Error(`Checksum for ${assetName} is invalid`);
|
|
124
|
+
const actual = crypto.createHash('sha256').update(fs.readFileSync(archivePath)).digest('hex');
|
|
125
|
+
if (actual !== expected) throw new Error(`Checksum mismatch for ${assetName}`);
|
|
126
|
+
} finally {
|
|
127
|
+
try { fs.unlinkSync(checksumPath); } catch (_) {}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
main().catch(err => {
|
|
132
|
+
console.error('Failed to install getnote:', err.message);
|
|
133
|
+
process.exit(1);
|
|
134
|
+
});
|
|
@@ -15,7 +15,7 @@ description: 安装和连接得到大脑,完成浏览器授权、环境诊断
|
|
|
15
15
|
2. 若当前环境只有 CLI 内置 Skill、没有上述安装器,则用 `command -v getnote` 检查 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
|
-
5. 执行 `getnote doctor -o json`。只有 `
|
|
18
|
+
5. 执行 `getnote doctor -o json`。只有 `diagnostics_completed=true`、`ready=true` 且 `status=ready`,才能宣布完整连接;`ready=true,status=degraded` 表示核心能力可用但仍应处理警告。`success` 和旧 `checks` 字段仅用于兼容。若未就绪,先处理 `issues[].blocking=true`,再按 `next_actions[]` 修复。需要确认的动作不得静默执行。
|
|
19
19
|
6. 在 Codex、Claude Code 或 Cursor 等本地 Agent 中,执行 `getnote setup` 同步 5 个领域 Skill;如果当前平台已经由独立 Skill 包携带这些领域 Skill,或 CLI 明确提示未检测到受支持平台,不把这一步失败误报成账号连接失败。
|
|
20
20
|
7. 先用 `getnote notes --limit 1 -o json` 做无写入验收。只有用户同意创建测试内容时,才保存测试笔记。
|
|
21
21
|
|
|
@@ -43,9 +43,9 @@ description: 安装和连接得到大脑,完成浏览器授权、环境诊断
|
|
|
43
43
|
| `getnote auth login` | 浏览器已确认,凭证已写入本机 | 再运行 `doctor -o json`;不在聊天中展示凭证。 |
|
|
44
44
|
| `getnote auth status` | `Authenticated` / `Not authenticated` 或环境变量登录状态 | 未登录才启动 `auth login`;状态里只能出现掩码。 |
|
|
45
45
|
| `getnote auth logout` | `Logged out successfully.` | 只说明本机已退出;不声称已撤销服务端授权。 |
|
|
46
|
-
| `getnote doctor -o json` | `
|
|
46
|
+
| `getnote doctor -o json` | `diagnostics_completed`、`local_ready`、`ready/status/summary`、`checks[]`、`issues[]`、`next_actions[]`、`update`、`integrations[]` | `ready=true,status=ready` 才表示完整可用;`degraded` 需继续处理警告。`platforms[]` 仅表示检测到应用或命令,不能证明 Skill 已安装;用 `integrations[].skill_status/ready` 判断 AI 接入状态。 |
|
|
47
47
|
| `getnote capabilities -o json` | `contract_version`、`commands`、`command_aliases`、`command_results`、`guarantees` | 只在安装、升级或兼容排查时读取;这是命令和结果字段的唯一事实源。 |
|
|
48
|
-
| `getnote setup -o json` | `success`、`targets[]`、`installed_skills`、`authenticated`、`next` |
|
|
48
|
+
| `getnote setup -o json` | `success`、`targets[]`、`installed_cli`、`installed_skills`、`authenticated`、`platforms[]`、`next_actions[]`、`next` | `platforms[].status=installed` 表示本地安装完成;`verify_in_platform` 表示 OpenClaw(小龙虾)或 QClaw 由平台管理,只引导用户完成对应的唯一 `next_action`。没有识别到 AI 平台不影响 CLI 和账号连接。 |
|
|
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`。 |
|
|
@@ -53,6 +53,16 @@ description: 安装和连接得到大脑,完成浏览器授权、环境诊断
|
|
|
53
53
|
|
|
54
54
|
所有命令以退出码为第一判断:退出码非 0 即失败。使用 `-o json` 的 API 与本地错误均返回 `success=false`、`data=null`、`error.code/message/reason/retryable` 和可选 `request_id`;不能把 HTTP 200 或“命令运行过”当成成功。
|
|
55
55
|
|
|
56
|
+
### Doctor 机器决策规则
|
|
57
|
+
|
|
58
|
+
1. `diagnostics_completed=false` 或命令退出非 0:诊断本身失败,不能根据残缺输出操作。
|
|
59
|
+
2. `ready=true`:CLI、账号授权和 OpenAPI 连通性均可用;若 `status=degraded`,核心能力可用但仍有非阻断警告。
|
|
60
|
+
3. `status=partial`:通常是 `--offline` 跳过远端检查;读取 `local_ready` 判断本地环境,`ready=null` 表示远端未知,不得声称已连接。
|
|
61
|
+
4. `issues[].blocking=true`:按顺序优先处理;保留 `code`、`details.request_id` 和错误字段。
|
|
62
|
+
5. `next_actions[]`:`requires_confirmation=true` 时先向用户确认,再执行精确 `command`;执行后重新运行 doctor 验证。
|
|
63
|
+
6. `integrations[].detected=true` 只表示发现宿主;只有 `skill_status=installed` 且 `ready=true` 才能确认 CLI 可验证的 Skill 已齐全。`unverified` 表示安装状态由平台管理,应让用户在平台内确认,不能猜测成功。
|
|
64
|
+
7. `update.update_available=true` 是非阻断警告;用户明确要求升级后才执行升级动作。
|
|
65
|
+
|
|
56
66
|
## 更新闭环
|
|
57
67
|
|
|
58
68
|
用户说“帮我更新得到大脑”已经构成更新授权:
|