project-atlas 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/CHANGELOG.md +30 -0
- package/CONTRIBUTING.md +57 -0
- package/LICENSE +21 -0
- package/README.md +305 -0
- package/SECURITY.md +28 -0
- package/adapters/claude-code/README.md +27 -0
- package/adapters/continue/README.md +16 -0
- package/adapters/cursor/README.md +29 -0
- package/adapters/opencode/README.md +37 -0
- package/adapters/opencode/commands/kb-context.md +5 -0
- package/adapters/opencode/commands/kb-refresh.md +11 -0
- package/adapters/opencode/skills/project-atlas/SKILL.md +15 -0
- package/adapters/opencode/tools/project_atlas_context.js +37 -0
- package/adapters/opencode/tools/project_atlas_propose.js +53 -0
- package/adapters/opencode/tools/project_atlas_scan.js +34 -0
- package/dist/core.js +1395 -0
- package/dist/frontmatter.js +103 -0
- package/dist/index.js +7 -0
- package/dist/mcp.js +172 -0
- package/dist/scanner.js +128 -0
- package/dist/types.js +1 -0
- package/dist/utils.js +174 -0
- package/docs/site/README.md +47 -0
- package/docs/site/agent-quickstart.md +243 -0
- package/docs/site/best-practices.md +87 -0
- package/docs/site/en/README.md +49 -0
- package/docs/site/en/agent-quickstart.md +191 -0
- package/docs/site/en/quick-start.md +79 -0
- package/docs/site/publish-now.md +166 -0
- package/docs/site/quick-start.md +128 -0
- package/docs/site/release-process.md +94 -0
- package/docs/site/security-faq.md +55 -0
- package/docs/site/team-rollout.md +59 -0
- package/package.json +55 -0
- package/schema/context-pack.schema.json +80 -0
- package/schema/external-evidence.schema.json +84 -0
- package/schema/manifest.schema.json +28 -0
- package/schema/memory-candidate.schema.json +76 -0
- package/schema/proposal.schema.json +122 -0
- package/schema/trigger-result.schema.json +47 -0
- package/templates/frontend-app/README.md +5 -0
- package/templates/generic-service/README.md +5 -0
- package/templates/java-backend/README.md +5 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.1.0 - 2026-05-22
|
|
6
|
+
|
|
7
|
+
- Fixed proposal freshness checks so `apply` blocks when the base commit or source file hashes changed after proposal creation.
|
|
8
|
+
- Added proposal-level `source_hashes` snapshots to the public proposal schema.
|
|
9
|
+
- Fixed `review-summary` apply safety so missing source and missing metadata in non-scaffold knowledge documents block apply.
|
|
10
|
+
- Included `docs/site` in the npm package because README links to the documentation site.
|
|
11
|
+
- Simplified `npm run verify` to avoid running the build step twice.
|
|
12
|
+
- Added project memory proposal generation through `project-atlas remember`.
|
|
13
|
+
- Added `project-atlas check` for knowledge health checks.
|
|
14
|
+
- Added context filters and JSON metadata for project memory documents.
|
|
15
|
+
- Added MCP tools for remember and check without changing the terminal apply boundary.
|
|
16
|
+
- Added `schema/memory-candidate.schema.json`.
|
|
17
|
+
- Hardened memory and proposal inputs by rejecting unsafe source paths, frontmatter line breaks, duplicate targets, and boolean flag values.
|
|
18
|
+
- Rewrote README in Chinese and added a concrete npm publishing guide.
|
|
19
|
+
- Renamed the project, package, CLI, MCP server, adapter tools, and local evidence directory to Project Atlas.
|
|
20
|
+
- Added bilingual documentation entry points and agent-first quick onboarding docs.
|
|
21
|
+
- Added the first `project-atlas` CLI with `init`, `scan`, `context`, `stale`, `propose`, `apply`, `review-summary`, `cleanup`, and `hash`.
|
|
22
|
+
- Added Git-first knowledge layout under `knowledge/` and local proposal evidence under `.project-atlas/proposals/`.
|
|
23
|
+
- Added interactive TTY-only `apply` flow for generated knowledge changes.
|
|
24
|
+
- Added OpenCode adapter examples for scan, context, and proposal generation without an apply tool.
|
|
25
|
+
- Added JSON Schemas for manifest, proposal, trigger result, and context pack outputs.
|
|
26
|
+
- Added context source lookup, multi-keyword query, stale suggestions, review summary safety sections, and init templates.
|
|
27
|
+
- Added optional external evidence import for scan and proposal review.
|
|
28
|
+
- Added local stdio MCP server and Claude Code, Cursor, and Continue adapter docs without model-callable apply.
|
|
29
|
+
- Added Markdown documentation site, GitHub Actions CI, and release governance notes.
|
|
30
|
+
- Updated the supported Node.js engine to `>=22`.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for helping improve Project Atlas.
|
|
4
|
+
|
|
5
|
+
Project Atlas is a Git-first project knowledge base CLI for AI coding agents and engineering teams. Its core boundary is simple: agents may read context and create proposals, but only a human should run `project-atlas apply` in a terminal.
|
|
6
|
+
|
|
7
|
+
## Local Setup
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
npm run build
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Checks
|
|
15
|
+
|
|
16
|
+
Run these checks before opening a pull request:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm run lint:types
|
|
20
|
+
npm test
|
|
21
|
+
npm run verify
|
|
22
|
+
npm pack --dry-run
|
|
23
|
+
node dist/index.js --help
|
|
24
|
+
node dist/mcp.js --help
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Pull Request Rules
|
|
28
|
+
|
|
29
|
+
- Keep changes small and focused.
|
|
30
|
+
- Add or update tests for CLI behavior, schema behavior, adapters, and safety boundaries.
|
|
31
|
+
- Update `docs/development-log/` for notable implementation work.
|
|
32
|
+
- Do not add a model-callable apply tool.
|
|
33
|
+
- Do not make `project-atlas apply` run without human terminal confirmation.
|
|
34
|
+
- Do not commit `.project-atlas/`, `.code-review-graph/`, `node_modules/`, or local credentials.
|
|
35
|
+
|
|
36
|
+
## Documentation
|
|
37
|
+
|
|
38
|
+
Human-facing documentation may be bilingual. Agent-facing documentation should be plain English so it can be reused across tools and teams.
|
|
39
|
+
|
|
40
|
+
Important entry points:
|
|
41
|
+
|
|
42
|
+
- `README.md`
|
|
43
|
+
- `docs/site/README.md`
|
|
44
|
+
- `docs/site/agent-quickstart.md`
|
|
45
|
+
- `docs/site/en/README.md`
|
|
46
|
+
|
|
47
|
+
## Release
|
|
48
|
+
|
|
49
|
+
Project maintainers publish manually:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm run verify
|
|
53
|
+
npm pack --dry-run
|
|
54
|
+
npm publish
|
|
55
|
+
git tag v<version>
|
|
56
|
+
git push origin main --tags
|
|
57
|
+
```
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 project-atlas contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# Project Atlas
|
|
2
|
+
|
|
3
|
+
Project Atlas 是一个 Git 优先的项目知识库治理 CLI,面向 AI 编程 agent 和人工 reviewer。npm 包名是 `project-atlas`。
|
|
4
|
+
|
|
5
|
+
CLI 命令名是 `project-atlas`。本地 MCP server 命令名是 `project-atlas-mcp`。项目把长期知识放在 `knowledge/`,把本地 proposal 证据放在 `.project-atlas/proposals/`,并要求真实写入必须由人在终端 TTY 中确认。
|
|
6
|
+
|
|
7
|
+
## 解决什么问题
|
|
8
|
+
|
|
9
|
+
- 减少 AI 每次任务都重新通读项目的成本。
|
|
10
|
+
- 用 `knowledge/` 保存可复用的项目知识和项目级记忆。
|
|
11
|
+
- 通过 source files、hash、proposal 和 trigger evidence 让知识更新可审查。
|
|
12
|
+
- 保持安全边界,模型不能直接写入知识库。
|
|
13
|
+
- 让 reviewer 通过 `review-summary` 快速判断 proposal 是否可 apply。
|
|
14
|
+
|
|
15
|
+
## 文档入口
|
|
16
|
+
|
|
17
|
+
先看 [docs/site/README.md](docs/site/README.md)。里面包含快速开始、最佳实践、团队落地、安全 FAQ 和发布流程。
|
|
18
|
+
|
|
19
|
+
Agent 自动接入优先看 [docs/site/agent-quickstart.md](docs/site/agent-quickstart.md)。这份文档给 agent 用,包含首轮探测、只读上下文、proposal 生成和禁止 apply 的规则。
|
|
20
|
+
|
|
21
|
+
English docs start at [docs/site/en/README.md](docs/site/en/README.md). Agent-first onboarding is available at [docs/site/en/agent-quickstart.md](docs/site/en/agent-quickstart.md).
|
|
22
|
+
|
|
23
|
+
如果现在准备发布 npm 包,直接看 [docs/site/publish-now.md](docs/site/publish-now.md)。
|
|
24
|
+
|
|
25
|
+
开源协作请看 [CONTRIBUTING.md](CONTRIBUTING.md)。安全问题和 agent 写入边界请看 [SECURITY.md](SECURITY.md)。
|
|
26
|
+
|
|
27
|
+
## 常用命令
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install
|
|
31
|
+
npm run build
|
|
32
|
+
|
|
33
|
+
node dist/index.js init --repo /path/to/repo --template java-backend
|
|
34
|
+
node dist/index.js scan --repo /path/to/repo --mode full --external-evidence-file evidence.json
|
|
35
|
+
node dist/index.js context --repo /path/to/repo --query "order payment" --budget 8000
|
|
36
|
+
node dist/index.js context --repo /path/to/repo --source-file README.md --format json
|
|
37
|
+
node dist/index.js stale --repo /path/to/repo
|
|
38
|
+
node dist/index.js propose --repo /path/to/repo --updates-file updates.json --external-evidence-file evidence.json --reason "update project knowledge" --inherit-source-metadata
|
|
39
|
+
node dist/index.js remember --repo /path/to/repo --candidate-file memory.json --reason "capture project memory"
|
|
40
|
+
node dist/index.js check --repo /path/to/repo --format json
|
|
41
|
+
node dist/index.js review-summary --repo /path/to/repo
|
|
42
|
+
node dist/index.js apply --repo /path/to/repo --proposal-id <id> --confirm
|
|
43
|
+
node dist/mcp.js --help
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
安装成 npm 包后,用 `project-atlas` 替代 `node dist/index.js`。
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
project-atlas --help
|
|
50
|
+
project-atlas-mcp --help
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 知识库结构
|
|
54
|
+
|
|
55
|
+
`project-atlas init` 会创建:
|
|
56
|
+
|
|
57
|
+
- `knowledge/project/overview.md`
|
|
58
|
+
- `knowledge/domains/`
|
|
59
|
+
- `knowledge/workflows/`
|
|
60
|
+
- `knowledge/contracts/`
|
|
61
|
+
- `knowledge/integrations/`
|
|
62
|
+
- `knowledge/quality/`
|
|
63
|
+
- `knowledge/decisions/`
|
|
64
|
+
|
|
65
|
+
生成的知识文档使用 YAML frontmatter,包含 `source_files`、`source_hashes`、`generated_by` 和 `review_status`。项目记忆文档还可以包含 `memory_type`、`topic`、`scope`、`confidence`、`owner` 和 `related_docs`。
|
|
66
|
+
|
|
67
|
+
`project-atlas init` 支持三种模板:
|
|
68
|
+
|
|
69
|
+
- `generic-service`
|
|
70
|
+
- `java-backend`
|
|
71
|
+
- `frontend-app`
|
|
72
|
+
|
|
73
|
+
模板只影响初始说明和示例问题,不改变 `knowledge/` 目录结构,也不会覆盖已有文件。
|
|
74
|
+
|
|
75
|
+
## 上下文和审查
|
|
76
|
+
|
|
77
|
+
`project-atlas context` 支持多个关键词,默认任一关键词命中即可返回。来源优先级是 active OpenSpec changes、archived OpenSpec specs、`knowledge/`。
|
|
78
|
+
|
|
79
|
+
按来源文件反查知识文档:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
project-atlas context --repo /path/to/repo --source-file README.md --format json
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
按项目记忆元数据过滤:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
project-atlas context --repo /path/to/repo --memory-type decision --topic payment --scope backend --format json
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
JSON context pack 会返回 `source_type`、`truncated` 和 `budget_used`,方便 agent 判断内容来源和是否被截断。
|
|
92
|
+
|
|
93
|
+
`project-atlas stale` 会给出 stale、missing source 和 missing metadata 的建议动作。`project-atlas review-summary` 会输出 dry-run 规模、review decision 和 apply safety。
|
|
94
|
+
|
|
95
|
+
健康检查:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
project-atlas check --repo /path/to/repo --format json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
更新已有知识文件时,可以显式继承旧来源信息:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
project-atlas propose --repo /path/to/repo --updates-file updates.json --reason "refresh order knowledge" --inherit-source-metadata
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## 项目级记忆
|
|
108
|
+
|
|
109
|
+
项目级记忆是团队共享记忆,仍然存放在 `knowledge/`。它不是个人长期记忆库,也不读取聊天记录。
|
|
110
|
+
|
|
111
|
+
`remember` 只接收结构化 JSON 候选文件,校验后生成 proposal,不直接写知识文件。
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
project-atlas remember --repo /path/to/repo --candidate-file memory.json --reason "capture project memory"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
候选文件示例:
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"schema_version": "1.0",
|
|
122
|
+
"source_files": ["docs/development-log/2026-05-22-example.md"],
|
|
123
|
+
"memories": [
|
|
124
|
+
{
|
|
125
|
+
"target": "knowledge/decisions/payment-review.md",
|
|
126
|
+
"memory_type": "decision",
|
|
127
|
+
"topic": "payment review",
|
|
128
|
+
"scope": "backend",
|
|
129
|
+
"confidence": 0.9,
|
|
130
|
+
"summary": "Payment review must check duplicate callbacks.",
|
|
131
|
+
"body": "When changing payment callbacks, review duplicate notification handling before changing signature validation.",
|
|
132
|
+
"owner": "platform-team",
|
|
133
|
+
"related_docs": ["knowledge/workflows/payment.md"]
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
记忆类型:
|
|
140
|
+
|
|
141
|
+
- `decision` 表示长期有效的决策。
|
|
142
|
+
- `experience` 表示已完成任务里的经验。
|
|
143
|
+
- `project_fact` 表示稳定项目事实。
|
|
144
|
+
|
|
145
|
+
## 外部证据
|
|
146
|
+
|
|
147
|
+
`scan` 和 `propose` 可以导入外部代码证据:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
project-atlas scan --repo /path/to/repo --external-evidence-file evidence.json
|
|
151
|
+
project-atlas propose --repo /path/to/repo --updates-file updates.json --external-evidence-file evidence.json --reason "refresh knowledge"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
外部证据文件结构:
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"schema_version": "1.0",
|
|
159
|
+
"external_evidence": [
|
|
160
|
+
{
|
|
161
|
+
"source": "aider-repo-map",
|
|
162
|
+
"source_type": "repo_map",
|
|
163
|
+
"path": "src/main/java/com/example/OrderService.java",
|
|
164
|
+
"symbol": "OrderService",
|
|
165
|
+
"summary": "Order service owns order planning rules.",
|
|
166
|
+
"locator": "src/main/java/com/example/OrderService.java#L12",
|
|
167
|
+
"confidence": 0.86
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
外部工具不是硬依赖。没有外部证据时,`external_evidence` 是空数组。
|
|
174
|
+
|
|
175
|
+
## JSON Schema
|
|
176
|
+
|
|
177
|
+
npm 包会携带 JSON Schema draft 2020-12 文件:
|
|
178
|
+
|
|
179
|
+
- `schema/manifest.schema.json`
|
|
180
|
+
- `schema/proposal.schema.json`
|
|
181
|
+
- `schema/trigger-result.schema.json`
|
|
182
|
+
- `schema/context-pack.schema.json`
|
|
183
|
+
- `schema/external-evidence.schema.json`
|
|
184
|
+
- `schema/memory-candidate.schema.json`
|
|
185
|
+
|
|
186
|
+
当前公开 schema 版本是 `1.0`。补充描述不需要升级 schema 版本。不兼容字段变更必须升级 schema 版本,并在 changelog 写清迁移方式。
|
|
187
|
+
|
|
188
|
+
## OpenCode 适配器
|
|
189
|
+
|
|
190
|
+
OpenCode adapter 是示例适配层,只暴露 scan、context 和 propose,不暴露 apply。
|
|
191
|
+
|
|
192
|
+
先安装 `project-atlas`,再把这些目录复制到团队使用的 OpenCode 资产位置:
|
|
193
|
+
|
|
194
|
+
```text
|
|
195
|
+
adapters/opencode/tools
|
|
196
|
+
adapters/opencode/commands
|
|
197
|
+
adapters/opencode/skills
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
临时项目验收:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
project-atlas init --repo /tmp/project-atlas-demo
|
|
204
|
+
project-atlas scan --repo /tmp/project-atlas-demo --mode full
|
|
205
|
+
project-atlas context --repo /tmp/project-atlas-demo --query demo
|
|
206
|
+
project-atlas propose --repo /tmp/project-atlas-demo --updates-file updates.json --reason "demo update"
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
proposal 输出必须提示用户回到终端执行 `project-atlas apply`。
|
|
210
|
+
|
|
211
|
+
## MCP 和 Agent 适配器
|
|
212
|
+
|
|
213
|
+
`project-atlas-mcp` 启动本地 stdio MCP server。它只暴露:
|
|
214
|
+
|
|
215
|
+
- `project_atlas_scan`
|
|
216
|
+
- `project_atlas_context`
|
|
217
|
+
- `project_atlas_stale`
|
|
218
|
+
- `project_atlas_propose`
|
|
219
|
+
- `project_atlas_remember`
|
|
220
|
+
- `project_atlas_check`
|
|
221
|
+
- `project_atlas_review_summary`
|
|
222
|
+
|
|
223
|
+
它不暴露 apply。proposal 仍然必须人工 review,并由人在终端执行 apply。
|
|
224
|
+
|
|
225
|
+
Claude Code:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
claude mcp add --transport stdio project-atlas -- project-atlas-mcp
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Cursor 项目配置:
|
|
232
|
+
|
|
233
|
+
```json
|
|
234
|
+
{
|
|
235
|
+
"mcpServers": {
|
|
236
|
+
"project-atlas": {
|
|
237
|
+
"type": "stdio",
|
|
238
|
+
"command": "project-atlas-mcp",
|
|
239
|
+
"args": []
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Continue 配置:
|
|
246
|
+
|
|
247
|
+
```yaml
|
|
248
|
+
mcpServers:
|
|
249
|
+
- name: project-atlas
|
|
250
|
+
command: project-atlas-mcp
|
|
251
|
+
args: []
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
更多说明见 `adapters/claude-code/`、`adapters/cursor/` 和 `adapters/continue/`。
|
|
255
|
+
|
|
256
|
+
## 发布前检查
|
|
257
|
+
|
|
258
|
+
发布前固定执行:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
npm run lint:types
|
|
262
|
+
npm test
|
|
263
|
+
npm pack --dry-run
|
|
264
|
+
npm run verify
|
|
265
|
+
node dist/index.js --help
|
|
266
|
+
node dist/index.js init --help
|
|
267
|
+
node dist/index.js context --help
|
|
268
|
+
node dist/index.js propose --help
|
|
269
|
+
node dist/index.js remember --help
|
|
270
|
+
node dist/index.js check --help
|
|
271
|
+
node dist/mcp.js --help
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
`npm run verify` 会执行类型检查和测试。`npm test` 会先构建再运行测试。`npm run pack:dry-run` 是打包预检的快捷脚本。
|
|
275
|
+
|
|
276
|
+
`npm pack --dry-run` 应包含 `README.md`、`LICENSE`、`CHANGELOG.md`、`dist/`、`adapters/`、`schema/`、`templates/`、`docs/site/` 和 `package.json`。
|
|
277
|
+
|
|
278
|
+
## 如果现在要发布
|
|
279
|
+
|
|
280
|
+
当前包名 `project-atlas` 在 npm registry 未被占用,可以按首次发布处理。详细步骤见 [docs/site/publish-now.md](docs/site/publish-now.md)。
|
|
281
|
+
|
|
282
|
+
最短命令顺序:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
git status --branch --short
|
|
286
|
+
npm run verify
|
|
287
|
+
npm pack --dry-run
|
|
288
|
+
npm login
|
|
289
|
+
npm whoami
|
|
290
|
+
npm publish
|
|
291
|
+
git tag v0.1.0
|
|
292
|
+
git push origin main --tags
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
发布前要先确认 `CHANGELOG.md` 已经把本次要发布的内容归入目标版本,并确认本地 `main` 已推送到 `origin/main`。如果 GitHub 仓库也要同步改名,需要先把远端仓库改成 `project-atlas`,再确认 `package.json` 的 repository URL 可访问。
|
|
296
|
+
|
|
297
|
+
## 第一版边界
|
|
298
|
+
|
|
299
|
+
- 只支持 Git 仓库。
|
|
300
|
+
- 不做 Web UI。
|
|
301
|
+
- 只提供本地 stdio MCP server,不提供远程 HTTP MCP server。
|
|
302
|
+
- 不内置语义检索或代码图谱。
|
|
303
|
+
- 不提供模型可调用的 apply 工具。
|
|
304
|
+
- 不提供个人长期记忆库。
|
|
305
|
+
- OpenCode、Claude Code、Cursor 和 Continue 支持都是 adapter 示例,不是核心产品。
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
Project Atlas is pre-1.0. Security fixes target the latest published version and the `main` branch.
|
|
6
|
+
|
|
7
|
+
## Reporting A Vulnerability
|
|
8
|
+
|
|
9
|
+
Please report security issues through GitHub private vulnerability reporting if it is enabled for this repository.
|
|
10
|
+
|
|
11
|
+
If private vulnerability reporting is not enabled, open a minimal GitHub issue that does not include exploit details, credentials, proprietary code, or private project data.
|
|
12
|
+
|
|
13
|
+
## Security Boundaries
|
|
14
|
+
|
|
15
|
+
Project Atlas is designed around these boundaries:
|
|
16
|
+
|
|
17
|
+
- Agents may read context.
|
|
18
|
+
- Agents may create proposals.
|
|
19
|
+
- Agents must not apply proposals.
|
|
20
|
+
- MCP and adapter integrations must not expose an apply tool.
|
|
21
|
+
- `project-atlas apply` requires human terminal confirmation.
|
|
22
|
+
- Local proposal evidence under `.project-atlas/` should not be committed.
|
|
23
|
+
|
|
24
|
+
## Sensitive Data
|
|
25
|
+
|
|
26
|
+
Project Atlas can scan project files and generate knowledge proposals. Users should review generated proposal content before applying it.
|
|
27
|
+
|
|
28
|
+
Do not store secrets in `knowledge/`. If sensitive data is detected in a proposal, reject the proposal and replace it with a redacted summary.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Claude Code Adapter
|
|
2
|
+
|
|
3
|
+
Claude Code can connect to `project-atlas-mcp` as a local stdio MCP server.
|
|
4
|
+
|
|
5
|
+
Install `project-atlas` first, then add the server from a project directory:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
claude mcp add --transport stdio project-atlas -- project-atlas-mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For a team-shared project config, create `.mcp.json`:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"project-atlas": {
|
|
17
|
+
"type": "stdio",
|
|
18
|
+
"command": "project-atlas-mcp",
|
|
19
|
+
"args": []
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Available tools are scan, context, stale, propose, remember, check, and review summary.
|
|
26
|
+
|
|
27
|
+
No model-callable write tool is provided. A human must do terminal apply after reviewing proposal evidence.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Continue Adapter
|
|
2
|
+
|
|
3
|
+
Continue can use `project-atlas-mcp` through its MCP context provider support.
|
|
4
|
+
|
|
5
|
+
Add this to `config.yaml`:
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
mcpServers:
|
|
9
|
+
- name: project-atlas
|
|
10
|
+
command: project-atlas-mcp
|
|
11
|
+
args: []
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
After reloading Continue, choose the MCP context provider and call the safe project-atlas tools for scan, context, stale checks, proposals, project memory proposals, health checks, and review summary.
|
|
15
|
+
|
|
16
|
+
The adapter does not provide a direct write tool. A human must do terminal apply after proposal review.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Cursor Adapter
|
|
2
|
+
|
|
3
|
+
Cursor can load `project-atlas-mcp` through project or global MCP config.
|
|
4
|
+
|
|
5
|
+
For project-scoped use, create `.cursor/mcp.json` in the target repository:
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"mcpServers": {
|
|
10
|
+
"project-atlas": {
|
|
11
|
+
"type": "stdio",
|
|
12
|
+
"command": "project-atlas-mcp",
|
|
13
|
+
"args": []
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Use the MCP tool list in Cursor to confirm these tools are available:
|
|
20
|
+
|
|
21
|
+
- `project_atlas_scan`
|
|
22
|
+
- `project_atlas_context`
|
|
23
|
+
- `project_atlas_stale`
|
|
24
|
+
- `project_atlas_propose`
|
|
25
|
+
- `project_atlas_remember`
|
|
26
|
+
- `project_atlas_check`
|
|
27
|
+
- `project_atlas_review_summary`
|
|
28
|
+
|
|
29
|
+
The adapter only exposes read and proposal evidence actions. A human must do terminal apply after checking the review summary.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# OpenCode Adapter Example
|
|
2
|
+
|
|
3
|
+
This adapter shows how OpenCode can call `project-atlas` without making OpenCode the core product.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
1. Install and build `project-atlas`.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
npm run build
|
|
12
|
+
npm link
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. Copy this folder into the matching OpenCode assets location used by your team.
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
adapters/opencode/tools
|
|
19
|
+
adapters/opencode/commands
|
|
20
|
+
adapters/opencode/skills
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
3. Restart OpenCode so it reloads the tools, commands, and skill.
|
|
24
|
+
|
|
25
|
+
The tools only call read, scan, and proposal commands. There is no apply tool. Real writes must be done by a human in a terminal:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
project-atlas apply --repo <repo> --proposal-id <id> --confirm
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Manual Smoke Test
|
|
32
|
+
|
|
33
|
+
- Run `project_atlas_scan` in a temporary Git project and confirm it returns scan JSON.
|
|
34
|
+
- Run `project_atlas_context` with a small query and confirm it returns source paths.
|
|
35
|
+
- Run `project_atlas_propose` with one target under `knowledge/` and confirm it creates proposal evidence.
|
|
36
|
+
- Confirm no `project_atlas_apply` tool exists.
|
|
37
|
+
- Confirm the proposal output tells the user to run `project-atlas apply` in a terminal.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate project-atlas update proposal
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Call `project_atlas_scan` with `mode=changed`. If the scan shows stable project knowledge changed, create a proposal through `project_atlas_propose`.
|
|
6
|
+
|
|
7
|
+
Do not apply the proposal from OpenCode. Tell the user to run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
project-atlas apply --repo <repo> --proposal-id <id> --confirm
|
|
11
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: project-knowledge-base
|
|
3
|
+
description: Use when reading, checking, or proposing updates to a project-atlas knowledge base.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Use `project-atlas` as the source of truth for project knowledge governance.
|
|
7
|
+
|
|
8
|
+
Rules:
|
|
9
|
+
|
|
10
|
+
- Read context with `project-atlas context` or the OpenCode `project_atlas_context` tool.
|
|
11
|
+
- Generate evidence with `project-atlas scan`, `project-atlas stale`, and `project-atlas review-summary`.
|
|
12
|
+
- Generate proposals with `project-atlas propose` or the OpenCode `project_atlas_propose` tool.
|
|
13
|
+
- Never apply knowledge changes from an agent tool.
|
|
14
|
+
- Real writes require a human terminal command with TTY confirmation.
|
|
15
|
+
- Do not write secrets, tokens, passwords, or access keys into knowledge files.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { tool } from "@opencode-ai/plugin";
|
|
3
|
+
|
|
4
|
+
function run(command, args, cwd, abort) {
|
|
5
|
+
return new Promise((resolve) => {
|
|
6
|
+
const child = spawn(command, args, { cwd, shell: false, env: process.env });
|
|
7
|
+
let stdout = "";
|
|
8
|
+
let stderr = "";
|
|
9
|
+
child.stdout.on("data", (chunk) => {
|
|
10
|
+
stdout += chunk.toString();
|
|
11
|
+
});
|
|
12
|
+
child.stderr.on("data", (chunk) => {
|
|
13
|
+
stderr += chunk.toString();
|
|
14
|
+
});
|
|
15
|
+
abort?.addEventListener("abort", () => child.kill("SIGTERM"), { once: true });
|
|
16
|
+
child.on("error", (error) => resolve({ stdout, stderr: `${stderr}${error.message}`, exitCode: 127 }));
|
|
17
|
+
child.on("close", (code) => resolve({ stdout, stderr, exitCode: code ?? 1 }));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default tool({
|
|
22
|
+
description: "Read a compact project-atlas context pack. This tool never writes knowledge files.",
|
|
23
|
+
args: {
|
|
24
|
+
query: tool.schema.string().optional().describe("Optional topic or keyword"),
|
|
25
|
+
budget: tool.schema.number().optional().describe("Maximum context characters"),
|
|
26
|
+
},
|
|
27
|
+
async execute(args, context) {
|
|
28
|
+
const repo = context.worktree || context.directory || process.cwd();
|
|
29
|
+
const commandArgs = ["context", "--repo", repo, "--budget", String(args.budget || 8000)];
|
|
30
|
+
if (args.query) commandArgs.push("--query", args.query);
|
|
31
|
+
const result = await run("project-atlas", commandArgs, repo, context.abort);
|
|
32
|
+
return {
|
|
33
|
+
output: result.stdout || result.stderr,
|
|
34
|
+
metadata: { repo, exitCode: result.exitCode },
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
|
+
import { tool } from "@opencode-ai/plugin";
|
|
6
|
+
|
|
7
|
+
function run(command, args, cwd, abort) {
|
|
8
|
+
return new Promise((resolve) => {
|
|
9
|
+
const child = spawn(command, args, { cwd, shell: false, env: process.env });
|
|
10
|
+
let stdout = "";
|
|
11
|
+
let stderr = "";
|
|
12
|
+
child.stdout.on("data", (chunk) => {
|
|
13
|
+
stdout += chunk.toString();
|
|
14
|
+
});
|
|
15
|
+
child.stderr.on("data", (chunk) => {
|
|
16
|
+
stderr += chunk.toString();
|
|
17
|
+
});
|
|
18
|
+
abort?.addEventListener("abort", () => child.kill("SIGTERM"), { once: true });
|
|
19
|
+
child.on("error", (error) => resolve({ stdout, stderr: `${stderr}${error.message}`, exitCode: 127 }));
|
|
20
|
+
child.on("close", (code) => resolve({ stdout, stderr, exitCode: code ?? 1 }));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default tool({
|
|
25
|
+
description: "Create a project-atlas proposal. This tool never applies knowledge changes.",
|
|
26
|
+
args: {
|
|
27
|
+
reason: tool.schema.string().describe("Why knowledge should be updated"),
|
|
28
|
+
updates: tool.schema
|
|
29
|
+
.array(
|
|
30
|
+
tool.schema.object({
|
|
31
|
+
target: tool.schema.string().describe("Target path under knowledge/"),
|
|
32
|
+
content: tool.schema.string().describe("Markdown content"),
|
|
33
|
+
}),
|
|
34
|
+
)
|
|
35
|
+
.describe("Knowledge updates to propose"),
|
|
36
|
+
sourceFiles: tool.schema.array(tool.schema.string()).optional().describe("Source evidence files"),
|
|
37
|
+
},
|
|
38
|
+
async execute(args, context) {
|
|
39
|
+
const repo = context.worktree || context.directory || process.cwd();
|
|
40
|
+
const dir = await mkdtemp(path.join(tmpdir(), "project-atlas-opencode-"));
|
|
41
|
+
const updatesFile = path.join(dir, "updates.json");
|
|
42
|
+
await writeFile(updatesFile, JSON.stringify({ source_files: args.sourceFiles || [], updates: args.updates }, null, 2), "utf8");
|
|
43
|
+
try {
|
|
44
|
+
const result = await run("project-atlas", ["propose", "--repo", repo, "--updates-file", updatesFile, "--reason", args.reason], repo, context.abort);
|
|
45
|
+
return {
|
|
46
|
+
output: `${result.stdout || result.stderr}\n\nNo apply tool is available. A human must run project-atlas apply in a terminal.`,
|
|
47
|
+
metadata: { repo, exitCode: result.exitCode },
|
|
48
|
+
};
|
|
49
|
+
} finally {
|
|
50
|
+
await rm(dir, { recursive: true, force: true });
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
});
|