@supercakex/davnote 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +216 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,216 @@
1
+ # davnote
2
+
3
+ 将明确指定的 Markdown 笔记上传到 WebDAV,并提供适合 AI Agent 调用的稳定命令行接口。
4
+
5
+ ```bash
6
+ davnote push "/path/to/note.md"
7
+ ```
8
+
9
+ ## 要求
10
+
11
+ - Node.js 20 或更高版本
12
+ - 支持 HTTPS 和 Basic Auth 的 WebDAV 服务
13
+
14
+ ## 安装
15
+
16
+ 从 npm 全局安装:
17
+
18
+ ```bash
19
+ npm install -g @supercakex/davnote
20
+ ```
21
+
22
+ 确认安装:
23
+
24
+ ```bash
25
+ davnote --version
26
+ davnote --help
27
+ ```
28
+
29
+ 在本仓库中开发时:
30
+
31
+ ```bash
32
+ npm install
33
+ npm link
34
+ ```
35
+
36
+ ## 首次配置
37
+
38
+ 在用户自己的交互式终端中运行:
39
+
40
+ ```bash
41
+ davnote setup
42
+ ```
43
+
44
+ 程序会询问:
45
+
46
+ - Profile 名称,例如 `personal`
47
+ - WebDAV HTTPS 地址
48
+ - 用户名和密码
49
+ - Remote root,即远程保存目录,例如 `/Notes/Inbox`
50
+ - 是否允许覆盖远程同名文件,默认不允许
51
+
52
+ 配置完成后会测试连接,并在需要时创建 Remote root。
53
+
54
+ 密码保存在 davnote 自己的配置文件中。配置和凭证不会出现在 `skill`、JSON 输出或普通日志中。
55
+
56
+ ## 上传笔记
57
+
58
+ 上传一个文件:
59
+
60
+ ```bash
61
+ davnote push "/absolute/path/note.md"
62
+ ```
63
+
64
+ 上传多个明确指定的文件:
65
+
66
+ ```bash
67
+ davnote push "/path/one.md" "/path/two.md"
68
+ ```
69
+
70
+ 默认使用本地文件名并保存到 Remote root:
71
+
72
+ ```text
73
+ 本地:/Users/alice/Notes/project.md
74
+ 远程:/Notes/Inbox/project.md
75
+ ```
76
+
77
+ 只允许上传普通 `.md` 文件,默认最大文件大小为 20 MiB。不支持目录递归、附件解析、同步或远程删除。
78
+
79
+ ### 指定远程文件名
80
+
81
+ 发送时可以直接使用另一个远程文件名,不会修改本地文件:
82
+
83
+ ```bash
84
+ davnote push "/path/meeting.md" --remote-name "meeting-2026-06-13.md"
85
+ ```
86
+
87
+ `--remote-name` 一次只能用于一个文件。
88
+
89
+ ### 同名文件与覆盖
90
+
91
+ 远程已经存在同名文件时,默认返回 `REMOTE_FILE_EXISTS`,不会自动覆盖。可以改名后重新上传:
92
+
93
+ ```bash
94
+ davnote push "/path/note.md" --remote-name "note-2.md"
95
+ ```
96
+
97
+ 只有 setup 或权限配置明确允许覆盖后,才能执行:
98
+
99
+ ```bash
100
+ davnote push "/path/note.md" --conflict overwrite
101
+ ```
102
+
103
+ 修改覆盖权限必须在交互式终端中运行:
104
+
105
+ ```bash
106
+ davnote config permissions
107
+ ```
108
+
109
+ 即使配置允许覆盖,AI Agent 也应先获得用户对当前文件的明确授权。
110
+
111
+ ### Agent 调用参数
112
+
113
+ 推荐 Agent 使用:
114
+
115
+ ```bash
116
+ davnote push "/absolute/path/note.md" --json --non-interactive
117
+ ```
118
+
119
+ - `--json`:输出结构化 JSON,便于可靠读取结果、错误码和远程路径。
120
+ - `--non-interactive`:声明本次调用不得询问或等待用户输入。
121
+ - `--dry-run`:执行验证和路径计算,但不上传文件。
122
+ - `--profile <name>`:使用指定的 WebDAV Profile。
123
+
124
+ ## 安装 Agent Skill
125
+
126
+ 输出给 Agent 阅读的 Skill 安装提示:
127
+
128
+ ```bash
129
+ davnote skill
130
+ ```
131
+
132
+ 将完整输出交给 Agent,Agent 会根据自己的平台规范创建 `push-notes` Skill。CLI 不会自行检测或修改 Agent 的 Skill 目录。
133
+
134
+ 只输出 `SKILL.md` 正文:
135
+
136
+ ```bash
137
+ davnote skill --raw
138
+ ```
139
+
140
+ ## Profile 管理
141
+
142
+ ```bash
143
+ davnote profile list
144
+ davnote profile show [name]
145
+ davnote profile add <name>
146
+ davnote profile edit [name]
147
+ davnote profile credentials [name]
148
+ davnote profile test [name]
149
+ davnote profile default <name>
150
+ davnote profile remove <name>
151
+ ```
152
+
153
+ 修改 Profile、凭证、默认 Profile 和删除 Profile 都要求交互式终端。`show` 不会显示密码。
154
+
155
+ ## 配置与诊断
156
+
157
+ 查看当前配置文件位置:
158
+
159
+ ```bash
160
+ davnote config path
161
+ ```
162
+
163
+ 默认路径:
164
+
165
+ | 系统 | 路径 |
166
+ | --- | --- |
167
+ | macOS | `~/Library/Application Support/davnote/config.toml` |
168
+ | Linux | `$XDG_CONFIG_HOME/davnote/config.toml`,默认 `~/.config/davnote/config.toml` |
169
+ | Windows | `%AppData%\davnote\config.toml` |
170
+
171
+ 查看脱敏后的配置:
172
+
173
+ ```bash
174
+ davnote config show
175
+ davnote config show --json
176
+ ```
177
+
178
+ 检查配置权限、Profile 和 WebDAV 连接:
179
+
180
+ ```bash
181
+ davnote doctor
182
+ davnote doctor --json
183
+ ```
184
+
185
+ 在 macOS 和 Linux 上,配置文件会设置为仅当前用户可读写的 `0600` 权限。Windows 使用用户目录及系统 ACL。
186
+
187
+ 从旧版 `note-send` 升级时,如果新的配置不存在,davnote 会读取旧配置并自动复制到新的 `davnote` 配置目录。
188
+
189
+ ## 命令概览
190
+
191
+ ```text
192
+ davnote setup
193
+ davnote push
194
+ davnote profile
195
+ davnote config
196
+ davnote skill
197
+ davnote doctor
198
+ davnote version
199
+ ```
200
+
201
+ 完整帮助:
202
+
203
+ ```bash
204
+ davnote --help
205
+ ```
206
+
207
+ ## 开发
208
+
209
+ 项目没有运行时第三方依赖。
210
+
211
+ ```bash
212
+ npm test
213
+ npm run check
214
+ npm pack --dry-run
215
+ ```
216
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supercakex/davnote",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Send explicitly selected Markdown notes to configured WebDAV storage.",
5
5
  "type": "module",
6
6
  "bin": {