xz-note
VSCode 扩展 — 通用文档树管理器。
📦 市场安装: VSCode Marketplace · xiaozhu-studio.xz-note
在 VSCode 里直接搜 xz-note 也行。
核心理念
VSCode 侧边栏里的通用文档树——支持任意文件类型(.md、.html、.txt、.json……)。本地 vault 目录即文档库,保存自动同步到 S3 兼容存储。
不需要离开 VSCode,不绑定任何笔记应用。
功能
| 功能 |
说明 |
| 📂 侧边栏文档树 |
嵌套在 Explorer 中,支持任意文件类型 |
| ☁️ S3 自动同步 |
保存文件时自动推送到 S3 兼容存储(R2 / MinIO / OSS) |
| 🤖 Agent 工具 |
VSCode agent mode 可自动调用 createNote / searchNotes / syncToS3 |
| 🔒 安全存储 |
S3 密钥存储在 VSCode SecretStorage(macOS Keychain / Windows Credential Manager) |
配置
在 VSCode Settings 中搜索 xzNote:
| 配置项 |
默认值 |
说明 |
xzNote.vaultPath |
~/notes/ |
本地 vault 文件夹 |
xzNote.s3.endpoint |
— |
S3 endpoint(如 https://xxx.r2.cloudflarestorage.com) |
xzNote.s3.bucket |
— |
Bucket 名称 |
xzNote.s3.region |
us-east-1 |
Region |
xzNote.s3.forcePathStyle |
true |
R2/MinIO 需启用 |
xzNote.s3.prefix |
notes/ |
S3 对象前缀 |
xzNote.sync.autoSync |
true |
保存时自动同步 |
S3 密钥通过命令面板设置:
> xzNote: Set S3 Access Key
> xzNote: Set S3 Secret Key
Agent 工具
VSCode agent mode 可以自动调用以下工具:
| 工具名 |
用途 |
xznote_createNote |
创建文档(路径 + 内容,支持任意文件类型) |
xznote_searchNotes |
搜索已有文档 |
xznote_syncToS3 |
同步文档到 S3 |
Agent 写文档的流程示例:
用户: "帮我写一篇 v2.0 发版公告,参考 CHANGELOG.md"
Agent:
1. 读 CHANGELOG.md
2. 调用 searchNotes("v2.0") 检查是否已有文档
3. 调用 createNote(path="releases/v2.0.md", content="...")
4. 调用 syncToS3() 确保云端可读
开发
npm install
npm run bundle
# 在 VSCode 中按 F5 启动 Extension Development Host
架构
src/
├── extension.ts # 主入口
├── config.ts # 配置读取
├── tree/
│ ├── noteItem.ts # TreeItem 模型
│ └── notesProvider.ts # TreeDataProvider
├── s3/
│ └── s3Service.ts # S3 客户端
└── tools/
├── createNoteTool.ts # Agent 创建文档
├── searchNotesTool.ts# Agent 搜索文档
└── syncToS3Tool.ts # Agent 同步
License
MIT
| |