banyan-notes 0.0.0-stage → 0.1.0

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
@@ -1,3 +1,101 @@
1
- # Temporary Holding Version
1
+ # 榕 Banyan
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <p align="center">
4
+ <img src="docs/dev/images/ui-overview.png" alt="榕 Banyan 界面" width="920" />
5
+ </p>
6
+
7
+ **榕**是一款本地优先、插件化的笔记软件(Web 版)。一个 Markdown 文件夹就是你的全部数据——
8
+ 索引与日志都是可随时重建的派生物。插件内核内嵌 [Cordis](https://github.com/cordiverse/cordis),
9
+ 围绕三条立身之本构建:**权限声明与运行时拦截、启用时冲突检测、卸载无残留**。
10
+
11
+ ## 功能
12
+
13
+ - **本地优先** — 纯 Markdown 文件夹是唯一事实来源;`FTS5` 全文索引、事件日志皆可重建
14
+ - **书写体验** — CodeMirror 6 编辑器、800ms 防抖自动保存(经插件可扩展的 `pipeline/save` 瀑布链)、居中限宽版式
15
+ - **实时同步** — 多浏览器标签页经 WebSocket 即时同步(含插件数据快照重放)
16
+ - **全文搜索** — trigram 分词,中文子串检索,带高亮片段
17
+ - **插件系统** — 双面插件(Node 服务端 + 浏览器客户端)、四个扩展点、能力级权限代理、审计日志
18
+
19
+ ## 30 秒上手
20
+
21
+ ```powershell
22
+ # 环境要求:Node.js >= 22、pnpm >= 9
23
+ pnpm install
24
+ pnpm test # 72 个测试(内核冒烟 / 服务端 / 插件管理器)
25
+ pnpm --filter @banyan/web build # 构建前端静态资源(首次需要)
26
+ pnpm web -- --vault D:\path\to\notes # 启动并自动打开浏览器
27
+ # 前端开发模式:pnpm dev(服务端)+ pnpm dev:web(Vite 热更)
28
+ ```
29
+
30
+ 服务仅绑定 `127.0.0.1:3210`(`--port` 可改)。首次启动生成随机 token 写入
31
+ `<vault>/.banyan/config.json`,之后重启复用;浏览器 URL 自动携带 `?token=`。
32
+
33
+ ## 插件
34
+
35
+ 点击顶栏「插件」管理(启用/禁用即时生效):
36
+
37
+ | 插件 | 说明 |
38
+ |---|---|
39
+ | 字数统计 | 保存时经 `pipeline/save` 瀑布链统计,状态栏实时显示 |
40
+ | 反向链接 | 右侧面板展示 `[[wiki]]` 与 Markdown 链接图 |
41
+ | 标签聚合 | 聚合 frontmatter `tags`,点击标签过滤笔记 |
42
+ | 今日笔记 | 命令「打开/创建今日笔记」→ `YYYY-MM-DD.md` |
43
+ | 冲突演示 A/B | 演示 `provides` 冲突:同 key 同时启用 → 409 指名双方 |
44
+ | 越权演示 | 演示 `net.domains` 越权 → 拦截并写入 `audit.jsonl` |
45
+
46
+ 插件如何编写?见 [docs/dev/plugin-spec.md](docs/dev/plugin-spec.md)。
47
+
48
+ ## 架构
49
+
50
+ ```
51
+ vendor/cordis(内核,只读内嵌)
52
+ └─ @banyan/core ctx key 契约 · 类型化事件 · waterfall/LIFO 内核扩展
53
+ └─ @banyan/plugin-manager manifest 严格校验 · 权限代理 · 冲突检测 · 审计
54
+ └─ @banyan/server Hono REST + WS(仅绑定 127.0.0.1,token 鉴权)
55
+ └─ @banyan/web Vue 3 + Pinia + CodeMirror 6 + 客户端插件宿主
56
+ ```
57
+
58
+ 数据目录 `<vault>/.banyan/`:`config.json`(token、启用列表)· `index.db`(FTS5,可删可重建)·
59
+ `journal.jsonl`(append-only 事件日志)· `audit.jsonl`(安全审计)· `installed/`(用户插件)。
60
+
61
+ ## 开发
62
+
63
+ ```powershell
64
+ pnpm test # vitest,全部工作区
65
+ pnpm typecheck # tsc 严格模式
66
+ pnpm build # 全量构建
67
+ node scripts/api-smoke.mjs <baseUrl> <token> # API 冒烟矩阵(34 项)
68
+ ```
69
+
70
+ 里程碑决策与取舍记录在 [docs/dev/decisions.md](docs/dev/decisions.md),
71
+ 内核 vendor 来源与升级流程在 [docs/dev/vendor.md](docs/dev/vendor.md),
72
+ M1 图文测试报告见 [docs/dev/test-report-m1.md](docs/dev/test-report-m1.md)。
73
+
74
+ ## Roadmap
75
+
76
+ - [x] M0 内核冒烟(Cordis 内嵌 + waterfall/LIFO 语义)
77
+ - [x] M1 Web 骨架(编辑器 / 搜索 / 同步 / 索引重建)
78
+ - [x] M2 插件系统 v0(权限 / 冲突 / 审计 / 双面插件)
79
+ - [ ] M3(规划中):应用内对话框替代原生 prompt、暗色主题、更多扩展点、worker 级插件沙箱
80
+
81
+ ## License
82
+
83
+ [MIT](LICENSE)
84
+
85
+ ---
86
+
87
+ <p align="center">
88
+ <img src="docs/dev/images/ui-plugins-drawer.png" alt="插件管理" width="640" />
89
+ </p>
90
+
91
+ ## About (English)
92
+
93
+ **Banyan** is a local-first, plugin-based note-taking app for the web. A plain
94
+ folder of Markdown files is the single source of truth — the full-text index
95
+ and journals are derivable at any time. It is built on an embedded
96
+ [Cordis](https://github.com/cordiverse/cordis) kernel with a capability-based
97
+ plugin system: plugins declare permissions (`fs.globs`, `net.domains`, `exec`),
98
+ which are enforced by a runtime proxy with a security audit log; `provides`
99
+ conflicts are detected at enable time; and unloading a plugin reverses every
100
+ registration it made. Run `pnpm web -- --vault <folder>` and open
101
+ `http://127.0.0.1:3210` — everything stays on your machine.
package/bin/banyan.mjs ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '../dist/index.mjs'