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.
Files changed (43) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/CONTRIBUTING.md +57 -0
  3. package/LICENSE +21 -0
  4. package/README.md +305 -0
  5. package/SECURITY.md +28 -0
  6. package/adapters/claude-code/README.md +27 -0
  7. package/adapters/continue/README.md +16 -0
  8. package/adapters/cursor/README.md +29 -0
  9. package/adapters/opencode/README.md +37 -0
  10. package/adapters/opencode/commands/kb-context.md +5 -0
  11. package/adapters/opencode/commands/kb-refresh.md +11 -0
  12. package/adapters/opencode/skills/project-atlas/SKILL.md +15 -0
  13. package/adapters/opencode/tools/project_atlas_context.js +37 -0
  14. package/adapters/opencode/tools/project_atlas_propose.js +53 -0
  15. package/adapters/opencode/tools/project_atlas_scan.js +34 -0
  16. package/dist/core.js +1395 -0
  17. package/dist/frontmatter.js +103 -0
  18. package/dist/index.js +7 -0
  19. package/dist/mcp.js +172 -0
  20. package/dist/scanner.js +128 -0
  21. package/dist/types.js +1 -0
  22. package/dist/utils.js +174 -0
  23. package/docs/site/README.md +47 -0
  24. package/docs/site/agent-quickstart.md +243 -0
  25. package/docs/site/best-practices.md +87 -0
  26. package/docs/site/en/README.md +49 -0
  27. package/docs/site/en/agent-quickstart.md +191 -0
  28. package/docs/site/en/quick-start.md +79 -0
  29. package/docs/site/publish-now.md +166 -0
  30. package/docs/site/quick-start.md +128 -0
  31. package/docs/site/release-process.md +94 -0
  32. package/docs/site/security-faq.md +55 -0
  33. package/docs/site/team-rollout.md +59 -0
  34. package/package.json +55 -0
  35. package/schema/context-pack.schema.json +80 -0
  36. package/schema/external-evidence.schema.json +84 -0
  37. package/schema/manifest.schema.json +28 -0
  38. package/schema/memory-candidate.schema.json +76 -0
  39. package/schema/proposal.schema.json +122 -0
  40. package/schema/trigger-result.schema.json +47 -0
  41. package/templates/frontend-app/README.md +5 -0
  42. package/templates/generic-service/README.md +5 -0
  43. package/templates/java-backend/README.md +5 -0
@@ -0,0 +1,166 @@
1
+ # 现在发布指南
2
+
3
+ 本文记录当前仓库如果要马上发布到 npm,应按什么顺序做。
4
+
5
+ ## 当前结论
6
+
7
+ - 包名是 `project-atlas`。
8
+ - 当前版本是 `0.1.0`。
9
+ - npm registry 当前没有同名包,可以按首次发布处理。
10
+ - 当前发布方式是手工发布,不做 GitHub Release,不做自动发布。
11
+ - 发布前必须保证本地 `main` 已经推送到 `origin/main`。
12
+ - `package.json` 当前 repository URL 指向 `project-atlas`。如果 GitHub 仓库还没有改名,先完成仓库改名,或者把 repository URL 调整为当前真实仓库。
13
+
14
+ ## 发布前整理
15
+
16
+ 先确认工作区和分支状态:
17
+
18
+ ```bash
19
+ git status --branch --short
20
+ ```
21
+
22
+ 如果看到 `main...origin/main [ahead 1]`,说明本地有提交还没有推送。先推送:
23
+
24
+ ```bash
25
+ git push origin main
26
+ ```
27
+
28
+ 确认 `CHANGELOG.md`。如果你要发布 `0.1.0`,就把本次要发布的 `Unreleased` 内容归入 `0.1.0`,或者确认 `Unreleased` 只保留下一版内容。
29
+
30
+ 确认 GitHub 远端名称。如果要让 npm 页面指向 Project Atlas 仓库,先在 GitHub 上把仓库改名为 `project-atlas`,再更新本地 remote:
31
+
32
+ ```bash
33
+ git remote set-url origin https://github.com/clclo121/project-atlas.git
34
+ git remote -v
35
+ ```
36
+
37
+ ## 本地验证
38
+
39
+ 固定执行:
40
+
41
+ ```bash
42
+ npm run lint:types
43
+ npm test
44
+ npm run verify
45
+ npm pack --dry-run
46
+ node dist/index.js --help
47
+ node dist/index.js init --help
48
+ node dist/index.js context --help
49
+ node dist/index.js propose --help
50
+ node dist/index.js remember --help
51
+ node dist/index.js check --help
52
+ node dist/mcp.js --help
53
+ ```
54
+
55
+ `npm pack --dry-run` 应包含:
56
+
57
+ - `README.md`
58
+ - `LICENSE`
59
+ - `CHANGELOG.md`
60
+ - `dist/`
61
+ - `adapters/`
62
+ - `schema/`
63
+ - `templates/`
64
+ - `docs/site/`
65
+ - `package.json`
66
+
67
+ 不应包含:
68
+
69
+ - `test/`
70
+ - `src/`
71
+ - `docs/development-log/`
72
+ - `node_modules/`
73
+
74
+ ## npm 登录
75
+
76
+ 确认 npm registry:
77
+
78
+ ```bash
79
+ npm config get registry
80
+ ```
81
+
82
+ 期望是:
83
+
84
+ ```text
85
+ https://registry.npmjs.org/
86
+ ```
87
+
88
+ 登录并确认账号:
89
+
90
+ ```bash
91
+ npm login
92
+ npm whoami
93
+ ```
94
+
95
+ 如果开启了两步验证,按 npm CLI 提示输入验证码。
96
+
97
+ ## 首次发布
98
+
99
+ 发布前再次确认版本:
100
+
101
+ ```bash
102
+ node -p "require('./package.json').name + '@' + require('./package.json').version"
103
+ ```
104
+
105
+ 当前应输出:
106
+
107
+ ```text
108
+ project-atlas@0.1.0
109
+ ```
110
+
111
+ 执行发布:
112
+
113
+ ```bash
114
+ npm publish
115
+ ```
116
+
117
+ 当前是非 scoped 包,不需要 `--access public`。如果以后改成 `@scope/project-atlas` 这类 scoped 包,再使用:
118
+
119
+ ```bash
120
+ npm publish --access public
121
+ ```
122
+
123
+ ## 发布后验证
124
+
125
+ 确认 npm 上的版本:
126
+
127
+ ```bash
128
+ npm view project-atlas version
129
+ ```
130
+
131
+ 用临时目录安装验证:
132
+
133
+ ```bash
134
+ tmpdir=$(mktemp -d)
135
+ cd "$tmpdir"
136
+ npm init -y
137
+ npm install project-atlas
138
+ npx project-atlas --help
139
+ npx project-atlas-mcp --help
140
+ ```
141
+
142
+ ## 打 tag 和推送
143
+
144
+ npm 发布成功后再打 tag:
145
+
146
+ ```bash
147
+ git tag v0.1.0
148
+ git push origin main --tags
149
+ ```
150
+
151
+ 如果 tag 已存在,不要覆盖。先检查:
152
+
153
+ ```bash
154
+ git tag --list "v0.1.0"
155
+ ```
156
+
157
+ ## 失败处理
158
+
159
+ 如果 `npm publish` 失败:
160
+
161
+ - `403 Forbidden` 通常是没有权限、包名不可用、账号未登录或版本已存在。
162
+ - `402 Payment Required` 通常和私有包或组织权限有关,当前项目应发布为 public。
163
+ - `ENEEDAUTH` 表示没有登录,重新执行 `npm login`。
164
+ - `You cannot publish over the previously published versions` 表示版本号已发布,需要升级 `package.json` 版本。
165
+
166
+ 不要在发布失败后直接改 tag。只有 npm 发布成功后才创建版本 tag。
@@ -0,0 +1,128 @@
1
+ # 快速开始
2
+
3
+ 本文帮助新用户在 10 分钟内跑通 Project Atlas 的最小流程。
4
+
5
+ ## 1. 准备项目
6
+
7
+ 进入一个 Git 仓库,安装并构建:
8
+
9
+ ```bash
10
+ npm install
11
+ npm run build
12
+ ```
13
+
14
+ 初始化知识库:
15
+
16
+ ```bash
17
+ node dist/index.js init --repo /path/to/repo --template generic-service
18
+ ```
19
+
20
+ Java 后端项目可以使用:
21
+
22
+ ```bash
23
+ node dist/index.js init --repo /path/to/repo --template java-backend
24
+ ```
25
+
26
+ 前端项目可以使用:
27
+
28
+ ```bash
29
+ node dist/index.js init --repo /path/to/repo --template frontend-app
30
+ ```
31
+
32
+ ## 2. 读取上下文
33
+
34
+ 按关键词读取紧凑上下文:
35
+
36
+ ```bash
37
+ node dist/index.js context --repo /path/to/repo --query "order payment" --budget 8000
38
+ ```
39
+
40
+ 按来源文件反查知识文档:
41
+
42
+ ```bash
43
+ node dist/index.js context --repo /path/to/repo --source-file README.md --format json
44
+ ```
45
+
46
+ 按项目记忆元数据读取上下文:
47
+
48
+ ```bash
49
+ node dist/index.js context --repo /path/to/repo --memory-type decision --topic payment --scope backend --format json
50
+ ```
51
+
52
+ ## 3. 生成 proposal
53
+
54
+ 准备 `updates.json`:
55
+
56
+ ```json
57
+ {
58
+ "source_files": ["README.md"],
59
+ "updates": [
60
+ {
61
+ "target": "knowledge/project/overview.md",
62
+ "content": "# Project Overview\n\nRecord the verified project overview here.\n"
63
+ }
64
+ ]
65
+ }
66
+ ```
67
+
68
+ 生成证据:
69
+
70
+ ```bash
71
+ node dist/index.js propose --repo /path/to/repo --updates-file updates.json --reason "refresh overview"
72
+ ```
73
+
74
+ ## 4. 沉淀项目记忆
75
+
76
+ 如果任务结束后产生了稳定事实、决策或经验,可以准备 `memory.json`:
77
+
78
+ ```json
79
+ {
80
+ "schema_version": "1.0",
81
+ "source_files": ["README.md"],
82
+ "memories": [
83
+ {
84
+ "target": "knowledge/decisions/payment-review.md",
85
+ "memory_type": "decision",
86
+ "topic": "payment review",
87
+ "scope": "backend",
88
+ "confidence": 0.9,
89
+ "summary": "Payment review must check duplicate callbacks.",
90
+ "body": "When changing payment callbacks, review duplicate notification handling before changing signature validation."
91
+ }
92
+ ]
93
+ }
94
+ ```
95
+
96
+ 生成记忆 proposal:
97
+
98
+ ```bash
99
+ node dist/index.js remember --repo /path/to/repo --candidate-file memory.json --reason "capture payment review memory"
100
+ ```
101
+
102
+ `remember` 只生成 proposal,不直接写 `knowledge/`。
103
+
104
+ ## 5. Review 后再写入
105
+
106
+ 查看 review summary:
107
+
108
+ ```bash
109
+ node dist/index.js review-summary --repo /path/to/repo
110
+ ```
111
+
112
+ 确认无敏感阻断、无不该写入的内容后,由人执行:
113
+
114
+ ```bash
115
+ node dist/index.js apply --repo /path/to/repo --proposal-id <id> --confirm
116
+ ```
117
+
118
+ Project Atlas 不允许 agent 直接 apply。这个边界是工具可控的关键。
119
+
120
+ ## 6. 健康检查
121
+
122
+ 发布前或交接前运行:
123
+
124
+ ```bash
125
+ node dist/index.js check --repo /path/to/repo --format json
126
+ ```
127
+
128
+ `check` 会检查 manifest、必需文件、frontmatter、source hash、缺失来源、空文档、坏相对链接、重复 topic 和 schema JSON。
@@ -0,0 +1,94 @@
1
+ # 发布流程
2
+
3
+ 本文约定 Project Atlas 的轻量发布治理方式。当前不做自动发布,也不创建 GitHub Release。
4
+
5
+ 如果你现在就准备发布,先看 [现在发布指南](publish-now.md)。本文偏长期规则,`publish-now.md` 偏本次操作步骤。
6
+
7
+ ## 版本规则
8
+
9
+ 使用 SemVer:
10
+
11
+ - `MAJOR` 用于不兼容的 CLI、schema 或 evidence 格式变化。
12
+ - `MINOR` 用于新增命令、参数、schema 字段或 adapter 能力。
13
+ - `PATCH` 用于 bug fix、文档修正和不改变行为的维护。
14
+
15
+ 当前公开 schema 版本为 `1.0`。不兼容 schema 变化必须更新 schema 版本,并在 changelog 中说明迁移方式。
16
+
17
+ ## Changelog
18
+
19
+ 每次发布前更新 `CHANGELOG.md`:
20
+
21
+ - 新增能力写清楚用户能怎么用。
22
+ - 行为变更写清楚影响范围。
23
+ - 安全边界变化必须单独说明。
24
+ - 依赖和 Node 版本要求变化必须说明。
25
+
26
+ ## 发布前检查
27
+
28
+ 发布前固定执行:
29
+
30
+ ```bash
31
+ npm run lint:types
32
+ npm test
33
+ npm pack --dry-run
34
+ npm run verify
35
+ node dist/index.js --help
36
+ node dist/index.js init --help
37
+ node dist/index.js context --help
38
+ node dist/index.js propose --help
39
+ node dist/index.js remember --help
40
+ node dist/index.js check --help
41
+ node dist/mcp.js --help
42
+ ```
43
+
44
+ `npm pack --dry-run` 应包含:
45
+
46
+ - `README.md`
47
+ - `LICENSE`
48
+ - `CHANGELOG.md`
49
+ - `dist/`
50
+ - `adapters/`
51
+ - `schema/`
52
+ - `templates/`
53
+ - `docs/site/`
54
+ - `package.json`
55
+
56
+ 不应包含:
57
+
58
+ - `test/`
59
+ - `src/`
60
+ - `docs/development-log/`
61
+ - `node_modules/`
62
+
63
+ ## 发布步骤
64
+
65
+ 当前项目只沉淀手工流程:
66
+
67
+ 1. 更新版本号和 `CHANGELOG.md`。
68
+ 2. 执行发布前检查。
69
+ 3. 检查 `npm pack --dry-run` 内容。
70
+ 4. 确认当前分支干净。
71
+ 5. 创建提交。
72
+ 6. 推送到 `origin/main`。
73
+ 7. 执行 `npm login` 和 `npm whoami`。
74
+ 8. 执行 `npm publish`。
75
+ 9. 创建版本 tag 并推送。
76
+
77
+ 首次发布当前包名时可以直接使用:
78
+
79
+ ```bash
80
+ npm publish
81
+ git tag v0.1.0
82
+ git push origin main --tags
83
+ ```
84
+
85
+ 如果 npm 要求二次验证,按 npm CLI 提示完成一次性验证码输入。
86
+
87
+ ## 当前仓库发布注意事项
88
+
89
+ - 当前 package name 是 `project-atlas`。
90
+ - 当前 package version 是 `0.1.0`。
91
+ - 当前 npm registry 未发现同名包,可以按首次发布处理。
92
+ - 发布前要确认 `CHANGELOG.md` 中 `Unreleased` 的内容已经归入要发布的版本。
93
+ - 如果本地 `main` 领先 `origin/main`,先推送代码,再发布 npm 包。
94
+ - 如果 GitHub 仓库还没有改名为 `project-atlas`,先改远端仓库名,或者在发布前把 `package.json` 的 repository URL 改回真实仓库地址。
@@ -0,0 +1,55 @@
1
+ # 安全 FAQ
2
+
3
+ ## Agent 能直接写知识库吗
4
+
5
+ 不能。Project Atlas 的 agent adapter 和 MCP server 都不提供 apply 工具。
6
+
7
+ Agent 可以:
8
+
9
+ - scan
10
+ - context
11
+ - stale
12
+ - propose
13
+ - remember
14
+ - check
15
+ - review-summary
16
+
17
+ Agent 不能:
18
+
19
+ - 调用 apply tool
20
+ - 绕过 proposal 直接写 `knowledge/**`
21
+ - 在非 TTY 环境执行 apply
22
+
23
+ ## 为什么 apply 必须在终端执行
24
+
25
+ `apply` 会真实写入知识文档。Project Atlas 要求人在终端 TTY 中确认,避免模型在没有人工检查时直接改知识库。
26
+
27
+ ## 敏感内容怎么处理
28
+
29
+ 扫描配置时只输出规则类型和文件路径,不输出真实值。
30
+
31
+ proposal 命中敏感规则时,状态会变成 `blocked_sensitive`,并且不会保存敏感原文。
32
+
33
+ ## 外部证据安全吗
34
+
35
+ `external_evidence` 只保存外部工具给出的结构化摘要。它不会运行 Serena、Codebase-Memory、Aider Repo Map 等工具,也不会把这些工具作为依赖。
36
+
37
+ 导入外部证据前,团队仍然要确认 JSON 文件里没有密钥、token、密码或客户敏感信息。
38
+
39
+ ## MCP 有写入风险吗
40
+
41
+ `project-atlas-mcp` 是本地 stdio MCP server,只暴露安全工具。它不暴露 apply。
42
+
43
+ 如果某个 MCP 客户端支持自定义命令,团队不要把 `project-atlas apply` 配成模型可调用工具。
44
+
45
+ ## 项目记忆会不会变成个人记忆
46
+
47
+ 不会。`remember` 只读取用户提供的结构化候选 JSON,只生成 proposal。它不读取聊天记录,不写个人长期记忆库,也不自动总结本地会话。
48
+
49
+ 项目记忆进入 `knowledge/` 后就是团队共享内容,必须接受 Git review。需要替换已有记忆时,命令要显式传 `--replace-existing`。
50
+
51
+ ## `.project-atlas/` 要提交吗
52
+
53
+ 默认不要提交。`.project-atlas/proposals/` 是本地证据目录,通常用于当前 review 和人工确认。
54
+
55
+ 稳定知识应该落在 `knowledge/**`,并通过 Git 审查。
@@ -0,0 +1,59 @@
1
+ # 团队落地流程
2
+
3
+ Project Atlas 的团队落地建议从一个项目开始,不要一开始就要求所有项目统一迁移。
4
+
5
+ ## 第一步 选择试点项目
6
+
7
+ 优先选择这些项目:
8
+
9
+ - 团队经常问重复问题。
10
+ - 业务流程相对稳定。
11
+ - README 或开发日志已经有基础资料。
12
+ - 最近会有真实需求进入开发。
13
+
14
+ ## 第二步 初始化知识库
15
+
16
+ 由项目负责人执行:
17
+
18
+ ```bash
19
+ project-atlas init --repo /path/to/repo --template generic-service
20
+ ```
21
+
22
+ Java 后端、前端项目可以选择对应模板。
23
+
24
+ ## 第三步 建立协作规则
25
+
26
+ 建议团队约定:
27
+
28
+ - 需求开始前,agent 先读 `project-atlas context`。
29
+ - 需求结束后,只更新确实稳定的知识。
30
+ - 所有知识更新先走 `project-atlas propose`。
31
+ - 项目记忆先走 `project-atlas remember`,再由人 review。
32
+ - reviewer 先读 `project-atlas review-summary`。
33
+ - 只有人能执行终端 apply。
34
+
35
+ ## 第四步 接入 agent
36
+
37
+ 本地 agent 可以选一种方式:
38
+
39
+ - 直接调用 `project-atlas` CLI。
40
+ - 使用 OpenCode adapter。
41
+ - 使用 `project-atlas-mcp` 接入 Claude Code、Cursor 或 Continue。
42
+
43
+ 所有 adapter 都保持同一条安全边界。agent 可以生成 proposal,不能直接写入知识库。
44
+
45
+ MCP 里的 `project_atlas_remember` 和 `project_atlas_check` 也是安全工具。前者只生成记忆 proposal,后者只做健康检查。
46
+
47
+ ## 第五步 固定检查点
48
+
49
+ 建议在这些节点检查知识库:
50
+
51
+ - 新需求完成。
52
+ - 发布前。
53
+ - 新同事接手项目。
54
+ - 关键接口或流程调整后。
55
+ - 决策、经验或项目事实被写入记忆前。
56
+
57
+ 建议把 `project-atlas check --repo /path/to/repo --format json` 放进团队本地检查清单。它能在 review 前暴露缺来源、过期来源、坏链接和重复 topic。
58
+
59
+ 团队落地的目标不是文档越多越好,而是让可复用知识保持可信。
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "project-atlas",
3
+ "version": "0.1.0",
4
+ "description": "Project Atlas is a Git-first project knowledge base CLI for AI coding agents and reviewers.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "project-atlas": "./dist/index.js",
9
+ "project-atlas-mcp": "./dist/mcp.js"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/clclo121/project-atlas.git"
14
+ },
15
+ "keywords": [
16
+ "ai-coding",
17
+ "project-atlas",
18
+ "knowledge-base",
19
+ "project-memory",
20
+ "opencode",
21
+ "cli",
22
+ "git"
23
+ ],
24
+ "files": [
25
+ "dist",
26
+ "adapters",
27
+ "schema",
28
+ "templates",
29
+ "docs/site",
30
+ "CHANGELOG.md",
31
+ "CONTRIBUTING.md",
32
+ "LICENSE",
33
+ "README.md",
34
+ "SECURITY.md"
35
+ ],
36
+ "scripts": {
37
+ "build": "tsc -p tsconfig.json",
38
+ "lint:types": "tsc --noEmit -p tsconfig.json",
39
+ "test": "npm run build && node --test test/*.test.mjs",
40
+ "verify": "npm run lint:types && npm test",
41
+ "pack:dry-run": "npm pack --dry-run"
42
+ },
43
+ "engines": {
44
+ "node": ">=22"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^24.0.0",
48
+ "typescript": "^5.8.0"
49
+ },
50
+ "dependencies": {
51
+ "@cfworker/json-schema": "^4.1.1",
52
+ "@modelcontextprotocol/server": "^2.0.0-alpha.2",
53
+ "zod": "^4.4.3"
54
+ }
55
+ }
@@ -0,0 +1,80 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/liuliuyun/project-atlas/schema/context-pack.schema.json",
4
+ "title": "project-atlas context pack",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "budget", "budget_used", "truncated", "text", "items"],
8
+ "properties": {
9
+ "schema_version": {
10
+ "const": "1.0"
11
+ },
12
+ "budget": {
13
+ "type": "integer",
14
+ "minimum": 1
15
+ },
16
+ "budget_used": {
17
+ "type": "integer",
18
+ "minimum": 0
19
+ },
20
+ "truncated": {
21
+ "type": "boolean"
22
+ },
23
+ "text": {
24
+ "type": "string"
25
+ },
26
+ "items": {
27
+ "type": "array",
28
+ "items": {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "required": ["source", "source_type", "priority", "content"],
32
+ "properties": {
33
+ "source": {
34
+ "type": "string",
35
+ "minLength": 1
36
+ },
37
+ "source_type": {
38
+ "enum": ["openspec_change", "openspec_spec", "knowledge"]
39
+ },
40
+ "priority": {
41
+ "type": "integer",
42
+ "minimum": 1
43
+ },
44
+ "content": {
45
+ "type": "string"
46
+ },
47
+ "metadata": {
48
+ "type": "object",
49
+ "additionalProperties": false,
50
+ "properties": {
51
+ "memory_type": {
52
+ "enum": ["decision", "experience", "project_fact"]
53
+ },
54
+ "topic": {
55
+ "type": "string"
56
+ },
57
+ "scope": {
58
+ "type": "string"
59
+ },
60
+ "confidence": {
61
+ "type": "number",
62
+ "minimum": 0,
63
+ "maximum": 1
64
+ },
65
+ "owner": {
66
+ "type": "string"
67
+ },
68
+ "related_docs": {
69
+ "type": "array",
70
+ "items": {
71
+ "type": "string"
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }