add-coder 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.
- package/README.md +54 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,30 @@ ADD 范式将 AI 开发从"口述代码"升级为"可审计工程"——DPS/RAHS
|
|
|
10
10
|
npx add-coder init
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
自动检测 IDE
|
|
13
|
+
首次 init 自动检测 IDE,交互式引导完成 Prisma 初始化、User 模型注入、ADD 模板部署。
|
|
14
|
+
|
|
15
|
+
### 完整初始化流程
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# ① 首次执行(自动:prisma init + User 模型 + add.prisma + 模板部署)
|
|
19
|
+
npx add-coder init
|
|
20
|
+
# → 是否执行 prisma init?[Y/n] y
|
|
21
|
+
# → 已将 DATABASE_URL 迁移到 .env.development
|
|
22
|
+
# → 已注入 User 模型
|
|
23
|
+
# → 已复制 add.prisma
|
|
24
|
+
# → Core 模板: 55 文件 + adapter 模板已就位
|
|
25
|
+
|
|
26
|
+
# ② 编辑 .env.development 配置数据库连接串
|
|
27
|
+
DATABASE_URL="postgresql://user:pass@localhost:5432/mydb?schema=public"
|
|
28
|
+
|
|
29
|
+
# ③ 第二次执行(自动:prisma migrate + generate)
|
|
30
|
+
npx add-coder init --yes
|
|
31
|
+
# → prisma migrate dev(创建 DevOperation + AuditLog 表)
|
|
32
|
+
# → prisma generate
|
|
33
|
+
# → ADD 治理模型已就绪 ✓
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
> **环境文件优先级**:`.env.development.local` > `.env.development` > `.env.local` > `.env`
|
|
14
37
|
|
|
15
38
|
## 命令
|
|
16
39
|
|
|
@@ -20,6 +43,22 @@ npx add-coder init
|
|
|
20
43
|
| `sync` | 增量同步缺失文件 |
|
|
21
44
|
| `status` | 检查模板完整性 |
|
|
22
45
|
|
|
46
|
+
### init 内部流程
|
|
47
|
+
|
|
48
|
+
`npx add-coder init` 按以下步骤执行:
|
|
49
|
+
|
|
50
|
+
| 步骤 | 动作 | 说明 |
|
|
51
|
+
|------|------|------|
|
|
52
|
+
| ① | 检测 IDE | 扫描 `.qoder/` `.claude/` `.vscode/` 存在性,或通过 `--adapter` 指定 |
|
|
53
|
+
| ② | 加载配置 | 交互式问答 > `add-coder.config.ts` > 自动检测 > 默认值 |
|
|
54
|
+
| ③ | Prisma 注入 | 检测 Prisma → 引导安装 → 注入 User 模型 → 复制 `add.prisma` → 迁移 |
|
|
55
|
+
| ④ | 渲染模板 | 55 个 core 模板文件(skills/agents/templates/plans/specs/scripts…) |
|
|
56
|
+
| ⑤ | 部署适配 | 将 core 内容复制到 `.add/` `.qoder/` `.claude/` 三目录,补 IDE 专属 hooks/mcp |
|
|
57
|
+
| ⑥ | 写入文件 | 交互/yes/force/dry-run 四种模式,`.sh` 脚本自动 `chmod` |
|
|
58
|
+
| ⑦ | 输出摘要 | 新建/跳过/覆盖统计 + 下一步提示 |
|
|
59
|
+
|
|
60
|
+
> **Prisma 注入说明**:ADD-7 审计需要 `DevOperation` + `AuditLog` 两张表。首次 `init` 自动引导 `prisma init` 并注入 `User` 模型,第二次 `init` 执行 `prisma migrate dev` 完成建表。
|
|
61
|
+
|
|
23
62
|
### init 选项
|
|
24
63
|
|
|
25
64
|
| 选项 | 说明 |
|
|
@@ -46,5 +85,17 @@ npm 包提供模板和 MCP 工具链骨架。Report 体系(gateway.md 边界
|
|
|
46
85
|
## 前置条件
|
|
47
86
|
|
|
48
87
|
- Node.js >= 20
|
|
49
|
-
- Prisma >= 6.9
|
|
50
|
-
- PostgreSQL(MCP
|
|
88
|
+
- Prisma >= 6.9 / ^7.0(`init` 时自动检测,无则引导安装)
|
|
89
|
+
- PostgreSQL(MCP 工具链依赖 DevOperation + AuditLog 表)
|
|
90
|
+
|
|
91
|
+
> **推荐**:使用 Podman/Docker 运行 PostgreSQL,参考配置:
|
|
92
|
+
> ```yaml
|
|
93
|
+
> postgres:
|
|
94
|
+
> image: docker.io/postgres:16-alpine
|
|
95
|
+
> ports: ["127.0.0.1:5433:5432"]
|
|
96
|
+
> environment:
|
|
97
|
+
> POSTGRES_DB: mydb
|
|
98
|
+
> POSTGRES_USER: admin
|
|
99
|
+
> POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
100
|
+
> ```
|
|
101
|
+
> 数据卷建议挂载到 `~/data/your_project/postgres/`,避免容器销毁丢失数据。
|