@getnote/cli 0.1.4 → 0.1.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 +9 -3
- package/package.json +1 -1
- package/scripts/postinstall.js +15 -46
package/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# Get笔记 CLI
|
|
2
2
|
|
|
3
|
-
[English](./README.en.md) | 中文
|
|
4
|
-
|
|
5
3
|
Get笔记的命令行工具,让你在终端和 AI Agent 里直接管理笔记和知识库。
|
|
6
4
|
|
|
7
5
|
存链接、记文字、搜笔记、管知识库——一条命令搞定,支持脚本和 AI Agent 调用。
|
|
@@ -226,6 +224,14 @@ make install
|
|
|
226
224
|
|
|
227
225
|
---
|
|
228
226
|
|
|
227
|
+
## 相关链接
|
|
228
|
+
|
|
229
|
+
- [Get笔记官网](https://biji.com)
|
|
230
|
+
- [Get笔记 OpenClaw Skill](https://github.com/iswalle/getnote-openclaw) — 在飞书/Telegram 等消息渠道用自然语言操作笔记
|
|
231
|
+
- [Get笔记 MCP](https://github.com/iswalle/getnote-mcp) — MCP 协议接入,适配 Claude Desktop 等工具
|
|
232
|
+
- [开放平台文档](https://openapi.biji.com/docs)
|
|
233
|
+
- [问题反馈](https://github.com/iswalle/getnote-cli/issues)
|
|
234
|
+
|
|
229
235
|
## License
|
|
230
236
|
|
|
231
|
-
MIT
|
|
237
|
+
[MIT](https://opensource.org/licenses/MIT)
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
-
const https = require('https');
|
|
7
6
|
const fs = require('fs');
|
|
8
7
|
const path = require('path');
|
|
9
8
|
const os = require('os');
|
|
@@ -17,21 +16,12 @@ function getPlatform() {
|
|
|
17
16
|
const platform = os.platform();
|
|
18
17
|
const arch = os.arch();
|
|
19
18
|
|
|
20
|
-
const platformMap = {
|
|
21
|
-
|
|
22
|
-
linux: 'linux',
|
|
23
|
-
win32: 'windows',
|
|
24
|
-
};
|
|
25
|
-
const archMap = {
|
|
26
|
-
x64: 'amd64',
|
|
27
|
-
arm64: 'arm64',
|
|
28
|
-
};
|
|
19
|
+
const platformMap = { darwin: 'darwin', linux: 'linux', win32: 'windows' };
|
|
20
|
+
const archMap = { x64: 'amd64', arm64: 'arm64' };
|
|
29
21
|
|
|
30
22
|
const p = platformMap[platform];
|
|
31
23
|
const a = archMap[arch];
|
|
32
|
-
if (!p || !a) {
|
|
33
|
-
throw new Error(`Unsupported platform: ${platform}/${arch}`);
|
|
34
|
-
}
|
|
24
|
+
if (!p || !a) throw new Error(`Unsupported platform: ${platform}/${arch}`);
|
|
35
25
|
return { platform: p, arch: a };
|
|
36
26
|
}
|
|
37
27
|
|
|
@@ -45,31 +35,6 @@ function getDownloadURL(platform) {
|
|
|
45
35
|
return `https://github.com/${REPO}/releases/download/v${VERSION}/${asset}`;
|
|
46
36
|
}
|
|
47
37
|
|
|
48
|
-
async function download(url, dest) {
|
|
49
|
-
return new Promise((resolve, reject) => {
|
|
50
|
-
const file = fs.createWriteStream(dest);
|
|
51
|
-
const get = (u) => {
|
|
52
|
-
https.get(u, (res) => {
|
|
53
|
-
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
54
|
-
file.close();
|
|
55
|
-
get(res.headers.location);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (res.statusCode !== 200) {
|
|
59
|
-
reject(new Error(`Download failed: ${res.statusCode} ${u}`));
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
res.pipe(file);
|
|
63
|
-
file.on('finish', () => file.close(resolve));
|
|
64
|
-
}).on('error', (err) => {
|
|
65
|
-
fs.unlink(dest, () => {});
|
|
66
|
-
reject(err);
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
get(url);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
38
|
async function main() {
|
|
74
39
|
const platform = getPlatform();
|
|
75
40
|
const binDir = path.join(__dirname, '..', 'bin');
|
|
@@ -84,22 +49,26 @@ async function main() {
|
|
|
84
49
|
fs.mkdirSync(binDir, { recursive: true });
|
|
85
50
|
|
|
86
51
|
try {
|
|
87
|
-
|
|
88
|
-
|
|
52
|
+
// Use curl (available on macOS/Linux) or PowerShell (Windows) for reliable redirect handling
|
|
89
53
|
if (platform.platform === 'windows') {
|
|
90
|
-
execSync(
|
|
54
|
+
execSync(
|
|
55
|
+
`powershell -Command "Invoke-WebRequest -Uri '${url}' -OutFile '${tmpFile}'"`,
|
|
56
|
+
{ stdio: 'inherit' }
|
|
57
|
+
);
|
|
58
|
+
execSync(`powershell -Command "Expand-Archive -Path '${tmpFile}' -DestinationPath '${binDir}' -Force"`, { stdio: 'inherit' });
|
|
91
59
|
} else {
|
|
92
|
-
execSync(`
|
|
60
|
+
execSync(`curl -fsSL "${url}" -o "${tmpFile}"`, { stdio: 'inherit' });
|
|
61
|
+
execSync(`tar -xzf "${tmpFile}" -C "${binDir}" "${binaryName}"`, { stdio: 'inherit' });
|
|
93
62
|
}
|
|
94
63
|
|
|
95
64
|
fs.chmodSync(binaryPath, 0o755);
|
|
96
65
|
console.log(`getnote installed at ${binaryPath}`);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
console.error('Failed to install getnote:', err.message);
|
|
68
|
+
process.exit(1);
|
|
97
69
|
} finally {
|
|
98
70
|
try { fs.unlinkSync(tmpFile); } catch (_) {}
|
|
99
71
|
}
|
|
100
72
|
}
|
|
101
73
|
|
|
102
|
-
main()
|
|
103
|
-
console.error('Failed to install getnote:', err.message);
|
|
104
|
-
process.exit(1);
|
|
105
|
-
});
|
|
74
|
+
main();
|