@getnote/cli 1.0.1 → 1.0.3

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
@@ -27,7 +27,7 @@ npm install -g @getnote/cli
27
27
 
28
28
  在 Claude Code、Cursor 等 AI 编程工具里用自然语言操作笔记,需要额外安装 Skill:
29
29
  ```bash
30
- npx skills add @getnote/cli -y -g
30
+ npx skills add iswalle/getnote-cli -y -g
31
31
  ```
32
32
 
33
33
  **第二步:登录**
@@ -109,7 +109,7 @@ getnote save https://example.com -o json # 自动轮询,返回最终笔记
109
109
  `skills/` 目录下有 Claude Code 专用的 Skill 文件,安装后 AI Agent 可以直接用自然语言操作笔记:
110
110
 
111
111
  ```bash
112
- npx skills add @getnote/cli -y -g
112
+ npx skills add iswalle/getnote-cli -y -g
113
113
  ```
114
114
 
115
115
  安装后在 Claude Code / Cursor 里说「帮我搜一下关于 RAG 的笔记」即可直接调用。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getnote/cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "CLI tool for Get笔记 — manage notes and knowledge bases from the terminal",
5
5
  "keywords": [
6
6
  "getnote",
@@ -74,6 +74,9 @@ async function main() {
74
74
 
75
75
  fs.chmodSync(binaryPath, 0o755);
76
76
  console.log(`getnote installed at ${binaryPath}`);
77
+
78
+ // Create symlink in npm global bin directory so `getnote` is on PATH
79
+ createSymlink(binaryPath, binaryName);
77
80
  } catch (err) {
78
81
  console.error('Failed to install getnote:', err.message);
79
82
  process.exit(1);
@@ -83,3 +86,23 @@ async function main() {
83
86
  }
84
87
 
85
88
  main();
89
+
90
+ // Create a symlink in the npm global bin directory after download.
91
+ // npm only creates the symlink at install time when the file already exists;
92
+ // since we download the binary in postinstall, we need to do it ourselves.
93
+ function createSymlink(binaryPath, binaryName) {
94
+ try {
95
+ const npmPrefix = execSync('npm prefix -g', { encoding: 'utf8' }).trim();
96
+ const globalBin = path.join(npmPrefix, 'bin');
97
+ const symlinkPath = path.join(globalBin, binaryName);
98
+
99
+ if (fs.existsSync(globalBin)) {
100
+ try { fs.unlinkSync(symlinkPath); } catch (_) {}
101
+ fs.symlinkSync(binaryPath, symlinkPath);
102
+ console.log(`Symlink created: ${symlinkPath} -> ${binaryPath}`);
103
+ }
104
+ } catch (err) {
105
+ // Non-fatal: user can run the binary directly or add it to PATH manually
106
+ console.warn(`Could not create symlink (you may need to add ${path.dirname(binaryPath)} to PATH): ${err.message}`);
107
+ }
108
+ }