refactor: restructure project layout and add install.mjs

- Move src/ → plugin/ with subdirectories:
  - plugin/core/ (business logic, models, store, permissions, utils, memory)
  - plugin/tools/ (query, resources)
  - plugin/commands/ (placeholder for slash commands)
  - plugin/hooks/ (placeholder for lifecycle hooks)
  - plugin/index.ts (wiring layer only, no business logic)
- Add install.mjs with --install, --uninstall, --openclaw-profile-path
- Add skills/ and docs/ root directories
- Move planning docs (PLAN.md, FEAT.md, AGENT_TASKS.md) to docs/
- Remove old scripts/install.sh
- Update tsconfig rootDir: src → plugin
- Update README.md and README.zh.md with new layout
- Bump version to 0.2.0
- All tests pass
This commit is contained in:
root
2026-03-10 14:39:24 +00:00
parent 00ffef0d8e
commit 08a66d7659
30 changed files with 260 additions and 81 deletions

View File

@@ -24,24 +24,20 @@ Yonexus 是一个用于 OpenClaw 的组织结构与 Agent 身份管理插件。
```text
.
├─ plugin.json
├─ src/
│ ├─ index.ts
│ ├─ models/
│ ├─ permissions/
store/
│ ├─ tools/
│ ├─ memory/
│ └─ utils/
├─ scripts/
├─ install.sh
│ └─ demo.ts
├─ tests/
│ └─ smoke.ts
├─ examples/
│ └─ sample-data.json
└─ dist/
└─ yonexus/
├─ plugin/
│ ├─ index.ts # 接线层:初始化、注册命令/hooks/tools
│ ├─ commands/ # slash commands
│ ├─ tools/ # 查询与资源工具
│ ├─ hooks/ # 生命周期钩子
core/ # 业务逻辑、模型、存储、权限
├─ skills/ # 技能定义
├─ docs/ # 项目文档
├─ scripts/ # 演示与工具脚本
├─ tests/ # 测试
├─ install.mjs # 安装/卸载脚本
├─ plugin.json # 插件清单
├─ README.md
└─ README.zh.md
```
## 环境要求
@@ -54,11 +50,23 @@ Yonexus 是一个用于 OpenClaw 的组织结构与 Agent 身份管理插件。
```bash
npm install
npm run build
bash scripts/install.sh
npm run test:smoke
npm run demo
```
## 安装 / 卸载
```bash
# 安装(构建并复制到 ~/.openclaw/plugins/yonexus
node install.mjs --install
# 安装到自定义 openclaw profile 路径
node install.mjs --install --openclaw-profile-path /path/to/.openclaw
# 卸载
node install.mjs --uninstall
```
## 配置说明
`plugin.json` 默认包含以下配置:
@@ -98,8 +106,6 @@ npm run demo
## 测试
冒烟测试:
```bash
npm run test:smoke
```