frontend-project-context 1.0.0 → 1.2.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 +27 -2
- package/README.md +359 -94
- package/UPGRADING.md +35 -1
- package/docs/00-PRODUCT-CONSTITUTION.md +42 -10
- package/docs/04-PROGRAM-DESIGN.md +76 -2
- package/docs/05-ACCEPTANCE-CONTRACT.md +35 -3
- package/docs/08-INSTALLATION-AND-DISTRIBUTION.md +32 -18
- package/docs/14-FORMAL-RELEASE-READINESS.md +11 -5
- package/docs/15-SOURCE-LIFECYCLE-CLOSURE-DESIGN.md +1 -1
- package/docs/16-GUIDED-ONBOARDING-AND-AI-RECONCILIATION-DESIGN.md +469 -0
- package/docs/17-AI-EXCHANGE-BOUNDARY-DESIGN.md +268 -0
- package/docs/README.md +13 -5
- package/examples/README.md +15 -2
- package/examples/package.json +6 -2
- package/package.json +11 -8
- package/schemas/action-plan.schema.json +250 -0
- package/schemas/assist-bundle.schema.json +75 -0
- package/schemas/capabilities.schema.json +123 -0
- package/schemas/review-bundle.schema.json +109 -0
- package/src/project-context/assist.mjs +422 -0
- package/src/project-context/cli.mjs +143 -13
- package/src/project-context/exchange-schema.mjs +528 -0
- package/src/project-context/exchange.mjs +623 -0
- package/src/project-context/project-store.mjs +22 -0
- package/PROJECT_STATE.json +0 -176
- package/RTK.md +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.2.0 — unreleased
|
|
4
|
+
|
|
5
|
+
- 新增未初始化和已初始化项目均可使用的只读 `capabilities`,公开 package、exchange protocol、schema、command、八类 action 和永久边界。
|
|
6
|
+
- 新增 Action Plan schema 1 和只读 `preflight`,把 AI 建议规范化为带三个 snapshot、action 专属 baseline、精确 impact 与 blocker 的短生命周期输入。
|
|
7
|
+
- 新增 Review Bundle schema 1,稳定分组 current/proposed、item/source/path/projection 影响与结构化 `{ command, args }` invocation;invocation 不含 `--write` 或 `--by`。
|
|
8
|
+
- 发布 capabilities、Assist Bundle、Action Plan 与 Review Bundle 四份 JSON schema,并把 `schemas/` 加入 npm 白名单;动态项目状态继续排除。
|
|
9
|
+
- 八类 action 均复用现有 register/propose/review/accept/revise/deprecate/approve/publish 预检语义;不新增 `apply-plan`、Provider、Agent Runtime、Git、网络、依赖安装、自动批准或业务代码执行。
|
|
10
|
+
- A-56 至 A-63 与全部回归共 69/69 项本地验收通过;公共发布尚未授权。
|
|
11
|
+
|
|
12
|
+
## 1.1.0 — unreleased
|
|
13
|
+
|
|
14
|
+
- 新增 `setup`,在未初始化或已初始化项目中复用现有 discovery,输出不含自动批准的 Assist Bundle;显式写入只创建三个 store 和 create-only proposal。
|
|
15
|
+
- 新增永远只读的 `sync`,一次聚合来源漂移、精确 item 影响、调用方 changed path、投影路径、finding、read target 和稳定 work unit。
|
|
16
|
+
- Assist Bundle schema 1 默认不含来源正文和无关合同值;超过 100 个受影响 item 时保留全部 ID 与基本元数据、省略完整值并显式标记,不静默截断。
|
|
17
|
+
- 补齐 pending-review、projection-review、setup proposal artifact receipt 和目录型 file source 的后代 changed-path 映射。
|
|
18
|
+
- 保持人类为唯一批准者,不增加 Provider、Agent Runtime、网络、Git、依赖、后台服务、自动接受或自动发布能力。
|
|
19
|
+
- A-01 至 A-55、B0-01/B0-02、CLI 和发布工件共 61 项本地验收通过;公共发布尚未授权。
|
|
20
|
+
|
|
21
|
+
## 1.0.1 — release candidate
|
|
22
|
+
|
|
23
|
+
- 把 npm README 重写为面向使用者的中英双语安装、快速上手、工作流和命令入口。
|
|
24
|
+
- 修正 `bin` 路径规范化警告,补充真实 npm 主页和检索关键词。
|
|
25
|
+
- 从发布白名单移除仓库动态状态文件,避免包内固化发布前状态。
|
|
26
|
+
- 未修改产品运行逻辑、Contract、CLI 命令或兼容面。
|
|
27
|
+
|
|
28
|
+
## 1.0.0 — 2026-09-08
|
|
4
29
|
|
|
5
30
|
- 冻结 model-neutral Project Contract、来源追溯、scope compiler、Context Bundle 和受管投影边界。
|
|
6
31
|
- 提供通用来源登记、四类 item、三类 scope、显式批准和知识维护闭环。
|
|
@@ -11,4 +36,4 @@
|
|
|
11
36
|
- 以 `Copyright 2026 Fushan` 采用 Apache License 2.0,并把 LICENSE/NOTICE 纳入发布包。
|
|
12
37
|
- A-01 至 A-45、B0-01/B0-02 与 CLI 共 49 项本地验收通过。
|
|
13
38
|
|
|
14
|
-
|
|
39
|
+
已由 `fushanyx1` 发布到官方公共 npm;远端 `v1.0.0` 标签对应发布提交,registry tarball 完整性已独立核验。
|
package/README.md
CHANGED
|
@@ -1,148 +1,413 @@
|
|
|
1
1
|
# Frontend Project Context
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Keep AI coding guidance consistent with one human-approved, source-traceable project contract.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
用一份经过人工批准、来源可追溯的项目合同,让不同 AI 编程工具获得一致且不过期的项目上下文。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
[English](#english) · [中文](#中文)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
## English
|
|
10
|
+
|
|
11
|
+
### Why use it?
|
|
12
|
+
|
|
13
|
+
AI coding tools often read only part of a repository. Important conventions may be scattered across documentation, configuration, source code, and team decisions. Frontend Project Context turns those explicit sources into a project-local `Project Contract`, then:
|
|
14
|
+
|
|
15
|
+
- selects the approved guidance that applies to a file or directory;
|
|
16
|
+
- renders focused context for existing coding agents;
|
|
17
|
+
- exposes versioned machine capabilities and schemas for model-neutral hosts;
|
|
18
|
+
- converts AI suggestions into authority-free Action Plans and read-only Review Bundles;
|
|
19
|
+
- publishes managed Markdown, AGENTS, or Ruler-compatible projections;
|
|
20
|
+
- reports source, contract, and projection drift;
|
|
21
|
+
- keeps every persistent write and approval under explicit human control.
|
|
22
|
+
|
|
23
|
+
It does **not** call an AI provider, edit business code, manage Git, install dependencies automatically, or approve rules on its own.
|
|
24
|
+
|
|
25
|
+
### Requirements
|
|
26
|
+
|
|
27
|
+
- Node.js 18 or newer
|
|
28
|
+
- A project whose context should live in the repository
|
|
29
|
+
|
|
30
|
+
### Install
|
|
31
|
+
|
|
32
|
+
Pin it as a development dependency so local users and CI run the same version:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install --save-dev frontend-project-context@1.2.0
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The package has zero runtime dependencies.
|
|
39
|
+
|
|
40
|
+
`1.2.0` is the locally verified source version in this repository. The latest independently verified public npm version remains `1.0.1` until separate release authorization and publication.
|
|
41
|
+
|
|
42
|
+
### Quick start
|
|
43
|
+
|
|
44
|
+
Let an existing Coding Agent prepare deterministic onboarding candidates:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx project-context setup \
|
|
48
|
+
--project . \
|
|
49
|
+
--id my-project \
|
|
50
|
+
--name "My Project" \
|
|
51
|
+
--write \
|
|
52
|
+
--json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`setup` creates only the three stores and a create-only proposal. It does not approve candidates or publish Agent files. Its JSON `artifacts` receipt reports the exact proposal path and whether it was previewed, created, or already unchanged. Read `summary`, `workUnits`, and `readTargets`, then review the exact proposed IDs.
|
|
56
|
+
|
|
57
|
+
Register an explicit source:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npx project-context register \
|
|
61
|
+
--project . \
|
|
62
|
+
--id source.package \
|
|
63
|
+
--kind file \
|
|
64
|
+
--path package.json \
|
|
65
|
+
--write
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Propose a scoped contract item. This creates a reviewable proposal; it does not approve it:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npx project-context propose \
|
|
72
|
+
--project . \
|
|
73
|
+
--id policy.ui-copy \
|
|
74
|
+
--kind policy \
|
|
75
|
+
--subject ui.visible-copy \
|
|
76
|
+
--value required \
|
|
77
|
+
--statement "Use the approved visible-copy convention." \
|
|
78
|
+
--sources source.package \
|
|
79
|
+
--scope path-prefix \
|
|
80
|
+
--scope-path src \
|
|
81
|
+
--output .project-context/policy.ui-copy.proposal.json \
|
|
82
|
+
--write
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Approve only the item you reviewed:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npx project-context approve \
|
|
89
|
+
--project . \
|
|
90
|
+
--proposal .project-context/policy.ui-copy.proposal.json \
|
|
91
|
+
--ids policy.ui-copy \
|
|
92
|
+
--by YOUR_NAME \
|
|
93
|
+
--write
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Compile context for a target and check for drift:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npx project-context context --project . --path src --locale en
|
|
100
|
+
npx project-context check --project .
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
After project sources or implementation paths change, create one read-only reconciliation work unit:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npx project-context sync \
|
|
107
|
+
--project . \
|
|
108
|
+
--changed-path src/example.ts \
|
|
109
|
+
--json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`sync` reports changed sources, affected item IDs, pending-item review, path-scoped guidance, projection-only findings, and exact work units. It contains no source bodies and cannot accept, revise, approve, deprecate, or publish anything. A Coding Agent may prepare the existing safe commands, but a human must approve the displayed IDs and paths before writes occur.
|
|
113
|
+
|
|
114
|
+
Discover the exchange contract without initializing the project:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
npx project-context capabilities --project . --json
|
|
15
118
|
```
|
|
16
119
|
|
|
17
|
-
|
|
120
|
+
An external AI host can create an Action Plan schema 1 using the returned project snapshots and one of the eight advertised action kinds. Save that short-lived plan inside the project, then produce a read-only Review Bundle:
|
|
18
121
|
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
122
|
+
```bash
|
|
123
|
+
npx project-context preflight \
|
|
124
|
+
--project . \
|
|
125
|
+
--plan .project-context/action-plan.json \
|
|
126
|
+
--json
|
|
127
|
+
```
|
|
24
128
|
|
|
25
|
-
|
|
129
|
+
`preflight` validates the project ID, all three snapshot digests, action-specific baselines, exact impacts, blockers, and projection ownership. It returns structured `{ command, args }` invocations without `--write` or `--by`. The plan and Review Bundle grant no authority: after a human approves exact action IDs and paths, the host must add the required identity and write flags to the existing fine-grained command. Any intervening write invalidates the remaining review and requires a fresh `sync` and `preflight`.
|
|
26
130
|
|
|
27
|
-
|
|
28
|
-
- [Kiro Steering](https://kiro.dev/docs/steering/) 已经展示项目知识、规则和 Specs 的完整产品体验,本项目保持 Runtime 和模型中立。
|
|
29
|
-
- [GitHub Spec Kit](https://github.com/github/spec-kit) 与 [OpenSpec](https://openspec.dev/) 负责规格驱动的功能开发流程,可以消费本项目上下文,但不属于本项目内核。
|
|
131
|
+
The package publishes `schemas/capabilities.schema.json`, `schemas/assist-bundle.schema.json`, `schemas/action-plan.schema.json`, and `schemas/review-bundle.schema.json`.
|
|
30
132
|
|
|
31
|
-
|
|
133
|
+
Generate the read-only governance dashboard:
|
|
32
134
|
|
|
33
|
-
|
|
135
|
+
```bash
|
|
136
|
+
npx project-context dashboard --project . > project-context-dashboard.html
|
|
137
|
+
```
|
|
34
138
|
|
|
35
|
-
-
|
|
36
|
-
- 不执行真实开发任务或自动修复代码。
|
|
37
|
-
- 不管理 Git 分支、commit、merge、push、PR 或部署。
|
|
38
|
-
- 不自动安装依赖或访问外部系统。
|
|
39
|
-
- 不保存 candidate、DecisionRecord 或 DeliveryRecord。
|
|
40
|
-
- 不复制 Kiro、Spec Kit、Ruler 等工具已有的能力。
|
|
139
|
+
The dashboard is a self-contained offline HTML file. The command writes only to stdout and does not open a browser or change the contract.
|
|
41
140
|
|
|
42
|
-
|
|
141
|
+
### What is created?
|
|
142
|
+
|
|
143
|
+
Initialization creates:
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
.project-context/
|
|
147
|
+
├── contract.json
|
|
148
|
+
├── sources.lock.json
|
|
149
|
+
└── projections.lock.json
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Commit these three stores. Also commit any managed projection your team intentionally publishes. Proposal files, temporary context output, dashboard HTML, caches, and tarballs should normally remain uncommitted.
|
|
153
|
+
|
|
154
|
+
### Core workflow
|
|
43
155
|
|
|
44
156
|
```text
|
|
45
|
-
|
|
157
|
+
Explicit project sources
|
|
158
|
+
→ reviewable proposals
|
|
159
|
+
→ human-approved Project Contract
|
|
160
|
+
→ scoped Context Bundle
|
|
161
|
+
→ AGENTS / Markdown / Ruler projections
|
|
162
|
+
→ existing AI tool
|
|
163
|
+
→ authority-free Action Plan
|
|
164
|
+
→ read-only Review Bundle
|
|
165
|
+
→ exact human approval
|
|
166
|
+
→ existing fine-grained write command
|
|
167
|
+
→ drift check
|
|
46
168
|
```
|
|
47
169
|
|
|
48
|
-
|
|
170
|
+
All commands are read-only unless that command explicitly includes `--write`. Source changes invalidate affected approvals; they are never accepted or reapproved automatically.
|
|
171
|
+
|
|
172
|
+
### Common commands
|
|
173
|
+
|
|
174
|
+
| Command | Purpose |
|
|
175
|
+
| --- | --- |
|
|
176
|
+
| `setup` | Aggregate safe initialization, conservative discovery, and an Assist Bundle |
|
|
177
|
+
| `capabilities` | Discover protocol versions, schemas, action kinds, initialization, and permanent boundaries |
|
|
178
|
+
| `init` | Create an empty project contract safely |
|
|
179
|
+
| `register` | Register a file, path, JSON pointer, or human decision |
|
|
180
|
+
| `discover` | Conservatively propose bootstrap candidates |
|
|
181
|
+
| `propose` | Author a fact, policy, reference, or validation description |
|
|
182
|
+
| `approve` | Explicitly approve selected proposal IDs |
|
|
183
|
+
| `context` | Compile approved context for one or more paths |
|
|
184
|
+
| `publish` | Write an owned AGENTS, Markdown, or Ruler projection |
|
|
185
|
+
| `check` | Detect stale sources, contracts, and projections |
|
|
186
|
+
| `sync` | Aggregate source drift, item impact, changed paths, and reconciliation work units |
|
|
187
|
+
| `preflight` | Validate an Action Plan and return a read-only grouped Review Bundle |
|
|
188
|
+
| `dashboard` | Render the read-only governance dashboard |
|
|
189
|
+
| `review-source` | Review a changed source and its exact impact set |
|
|
190
|
+
| `accept-source-change` | Accept a pinned source digest and revoke affected approvals |
|
|
191
|
+
| `revise` / `deprecate` | Maintain contract items explicitly |
|
|
192
|
+
| `deprecate-source` | Retire an unreferenced source with an audit record |
|
|
193
|
+
|
|
194
|
+
Run `npx project-context --help` for the complete command syntax.
|
|
195
|
+
|
|
196
|
+
### Documentation
|
|
197
|
+
|
|
198
|
+
- [Product constitution](./docs/00-PRODUCT-CONSTITUTION.md)
|
|
199
|
+
- [Program and CLI design](./docs/04-PROGRAM-DESIGN.md)
|
|
200
|
+
- [Acceptance contract](./docs/05-ACCEPTANCE-CONTRACT.md)
|
|
201
|
+
- [Installation and distribution](./docs/08-INSTALLATION-AND-DISTRIBUTION.md)
|
|
202
|
+
- [Knowledge maintenance](./docs/12-KNOWLEDGE-MAINTENANCE-CLOSURE-ROADMAP.md)
|
|
203
|
+
- [Read-only governance dashboard](./docs/13-READ-ONLY-GOVERNANCE-DASHBOARD-DESIGN.md)
|
|
204
|
+
- [Source lifecycle](./docs/15-SOURCE-LIFECYCLE-CLOSURE-DESIGN.md)
|
|
205
|
+
- [Guided onboarding and AI-assisted reconciliation](./docs/16-GUIDED-ONBOARDING-AND-AI-RECONCILIATION-DESIGN.md)
|
|
206
|
+
- [AI Exchange Boundary design](./docs/17-AI-EXCHANGE-BOUNDARY-DESIGN.md)
|
|
207
|
+
- [Upgrade notes](./UPGRADING.md)
|
|
208
|
+
|
|
209
|
+
## 中文
|
|
49
210
|
|
|
50
|
-
|
|
211
|
+
### 它解决什么问题?
|
|
51
212
|
|
|
52
|
-
|
|
213
|
+
AI 编程工具通常只读取仓库的一部分,而项目约定分散在文档、配置、源码和团队决定中。Frontend Project Context 把这些明确来源治理成项目内的 `Project Contract`,然后:
|
|
53
214
|
|
|
54
|
-
|
|
215
|
+
- 按文件或目录选择真正生效的已批准规则;
|
|
216
|
+
- 为现有 Coding Agent 生成精简且可追溯的上下文;
|
|
217
|
+
- 向模型无关宿主公开版本化 capability 与机器 schema;
|
|
218
|
+
- 把 AI 建议收敛为无权限 Action Plan 和只读 Review Bundle;
|
|
219
|
+
- 从同一合同生成受管 Markdown、AGENTS 或 Ruler 兼容投影;
|
|
220
|
+
- 检测来源、合同和投影是否过期;
|
|
221
|
+
- 所有持久写入与批准都必须由人显式触发。
|
|
55
222
|
|
|
56
|
-
|
|
223
|
+
它**不会**调用大模型、修改业务代码、管理 Git、自动安装依赖,也不会替人批准规则。
|
|
57
224
|
|
|
58
|
-
|
|
225
|
+
### 环境要求
|
|
59
226
|
|
|
60
|
-
|
|
227
|
+
- Node.js 18 或更高版本
|
|
228
|
+
- 希望把 AI 项目上下文随仓库共同维护的项目
|
|
61
229
|
|
|
62
|
-
|
|
230
|
+
### 安装
|
|
63
231
|
|
|
64
|
-
|
|
232
|
+
建议固定为开发依赖,让本地与 CI 使用同一版本:
|
|
65
233
|
|
|
66
234
|
```bash
|
|
67
|
-
|
|
68
|
-
node bin/project-context.mjs register --project /path/to/project --id source-package --kind file --path package.json --write
|
|
69
|
-
node bin/project-context.mjs register --project /path/to/project --id source-src --kind path --path src --write
|
|
70
|
-
node bin/project-context.mjs register --project /path/to/project --id source-team --kind human-decision --reference "decision:team" --write
|
|
71
|
-
node bin/project-context.mjs propose --project /path/to/project --id policy-visible-copy --kind policy --subject ui.visible-copy --value required --statement "Use the approved visible-copy convention." --sources source-team --scope path-prefix --scope-path src --output .project-context/policy-visible-copy.proposal.json --write
|
|
72
|
-
node bin/project-context.mjs approve --project /path/to/project --proposal .project-context/policy-visible-copy.proposal.json --ids policy-visible-copy --by NAME --write
|
|
73
|
-
node bin/project-context.mjs discover --project /path/to/project
|
|
74
|
-
node bin/project-context.mjs context --project /path/to/project --path src --locale zh-CN
|
|
75
|
-
node bin/project-context.mjs publish --project /path/to/project --target agents --output AGENTS.md --write
|
|
76
|
-
node bin/project-context.mjs check --project /path/to/project
|
|
77
|
-
node bin/project-context.mjs dashboard --project /path/to/project > project-context-dashboard.html
|
|
78
|
-
node bin/project-context.mjs dashboard --project /path/to/project --json
|
|
235
|
+
npm install --save-dev frontend-project-context@1.2.0
|
|
79
236
|
```
|
|
80
237
|
|
|
81
|
-
|
|
238
|
+
本包没有运行时第三方依赖。
|
|
239
|
+
|
|
240
|
+
`1.2.0` 是本仓库当前已经完成本地验收的源码版本。在获得单独发布授权并完成发布前,公共 npm 已独立核验的最新版本仍为 `1.0.1`。
|
|
241
|
+
|
|
242
|
+
### 快速开始
|
|
243
|
+
|
|
244
|
+
让现有 Coding Agent 生成确定性的首次接入候选:
|
|
82
245
|
|
|
83
246
|
```bash
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
node bin/project-context.mjs check --project /path/to/project
|
|
247
|
+
npx project-context setup \
|
|
248
|
+
--project . \
|
|
249
|
+
--id my-project \
|
|
250
|
+
--name "My Project" \
|
|
251
|
+
--write \
|
|
252
|
+
--json
|
|
91
253
|
```
|
|
92
254
|
|
|
93
|
-
|
|
255
|
+
`setup` 只创建三个 store 和一份 create-only proposal,不会批准候选或发布 Agent 文件。JSON 中的 `artifacts` receipt 会返回精确 proposal 路径,以及 preview、create 或 unchanged 结果。先读取 `summary`、`workUnits` 和 `readTargets`,再审查具体 proposal ID。
|
|
256
|
+
|
|
257
|
+
登记一个明确来源:
|
|
94
258
|
|
|
95
259
|
```bash
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
260
|
+
npx project-context register \
|
|
261
|
+
--project . \
|
|
262
|
+
--id source.package \
|
|
263
|
+
--kind file \
|
|
264
|
+
--path package.json \
|
|
265
|
+
--write
|
|
100
266
|
```
|
|
101
267
|
|
|
102
|
-
|
|
268
|
+
提出一条带作用域的合同项。这里只生成待审 proposal,不会自动批准:
|
|
103
269
|
|
|
104
|
-
|
|
270
|
+
```bash
|
|
271
|
+
npx project-context propose \
|
|
272
|
+
--project . \
|
|
273
|
+
--id policy.ui-copy \
|
|
274
|
+
--kind policy \
|
|
275
|
+
--subject ui.visible-copy \
|
|
276
|
+
--value required \
|
|
277
|
+
--statement "使用团队已经批准的界面文案约定。" \
|
|
278
|
+
--sources source.package \
|
|
279
|
+
--scope path-prefix \
|
|
280
|
+
--scope-path src \
|
|
281
|
+
--output .project-context/policy.ui-copy.proposal.json \
|
|
282
|
+
--write
|
|
283
|
+
```
|
|
105
284
|
|
|
106
|
-
|
|
285
|
+
人工审查后,只批准明确选中的 item:
|
|
107
286
|
|
|
108
287
|
```bash
|
|
109
|
-
|
|
110
|
-
|
|
288
|
+
npx project-context approve \
|
|
289
|
+
--project . \
|
|
290
|
+
--proposal .project-context/policy.ui-copy.proposal.json \
|
|
291
|
+
--ids policy.ui-copy \
|
|
292
|
+
--by YOUR_NAME \
|
|
293
|
+
--write
|
|
111
294
|
```
|
|
112
295
|
|
|
113
|
-
|
|
296
|
+
为目标目录生成上下文,并检查漂移:
|
|
114
297
|
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
|
|
298
|
+
```bash
|
|
299
|
+
npx project-context context --project . --path src --locale zh-CN
|
|
300
|
+
npx project-context check --project .
|
|
301
|
+
```
|
|
119
302
|
|
|
120
|
-
|
|
303
|
+
项目来源或实现路径变化后,可一次生成只读的增量维护工作单元:
|
|
121
304
|
|
|
122
305
|
```bash
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
306
|
+
npx project-context sync \
|
|
307
|
+
--project . \
|
|
308
|
+
--changed-path src/example.ts \
|
|
309
|
+
--json
|
|
126
310
|
```
|
|
127
311
|
|
|
128
|
-
|
|
312
|
+
`sync` 汇总变化来源、受影响 item ID、pending item 审查、路径适用规则、仅投影 finding 和精确 work unit。它不携带来源正文,也不能接受、修订、批准、废弃或发布任何内容。Coding Agent 可以准备既有安全命令,但只有人在看到明确 ID 和路径后才能授权写入。
|
|
129
313
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
314
|
+
无需初始化项目即可查询双向交换协议:
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
npx project-context capabilities --project . --json
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
外部 AI 宿主可使用返回的三个项目 snapshot 和八类 action 生成 Action Plan schema 1。把这份短生命周期计划保存在项目内,再生成只读 Review Bundle:
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
npx project-context preflight \
|
|
324
|
+
--project . \
|
|
325
|
+
--plan .project-context/action-plan.json \
|
|
326
|
+
--json
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
`preflight` 会验证 project ID、三个 snapshot digest、action 专属 baseline、精确影响集、blocker 和投影所有权,并返回不含 `--write`、`--by` 的结构化 `{ command, args }` invocation。Action Plan 和 Review Bundle 都不授予权限;只有人批准明确 action ID 与路径后,宿主才能为既有细粒度命令补入身份和写入参数。期间任何写入都会使余下 review 失效,必须重新 `sync` 和 `preflight`。
|
|
330
|
+
|
|
331
|
+
npm 包公开 `schemas/capabilities.schema.json`、`schemas/assist-bundle.schema.json`、`schemas/action-plan.schema.json` 和 `schemas/review-bundle.schema.json`。
|
|
332
|
+
|
|
333
|
+
生成只读治理看板:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
npx project-context dashboard --project . > project-context-dashboard.html
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
看板是一个可离线打开的自包含 HTML。命令只输出到 stdout,不会自动打开浏览器,也不会修改合同。
|
|
340
|
+
|
|
341
|
+
### 会生成什么?
|
|
342
|
+
|
|
343
|
+
初始化只创建:
|
|
344
|
+
|
|
345
|
+
```text
|
|
346
|
+
.project-context/
|
|
347
|
+
├── contract.json
|
|
348
|
+
├── sources.lock.json
|
|
349
|
+
└── projections.lock.json
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
这三个 store 应提交到仓库;团队明确生成的受管投影也应提交。proposal、临时上下文、看板 HTML、缓存和 tarball 通常不提交。
|
|
353
|
+
|
|
354
|
+
### 核心流程
|
|
355
|
+
|
|
356
|
+
```text
|
|
357
|
+
项目明确提供的来源
|
|
358
|
+
→ 可审查 proposal
|
|
359
|
+
→ 人工批准的 Project Contract
|
|
360
|
+
→ 按作用域编译的 Context Bundle
|
|
361
|
+
→ AGENTS / Markdown / Ruler 投影
|
|
362
|
+
→ 现有 AI 工具
|
|
363
|
+
→ 无权限 Action Plan
|
|
364
|
+
→ 只读 Review Bundle
|
|
365
|
+
→ 人对明确 action 的批准
|
|
366
|
+
→ 既有细粒度写命令
|
|
367
|
+
→ 漂移检查
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
所有命令默认只读,只有当前命令显式包含 `--write` 才会持久写入。来源变化后,受影响的批准会失效,但工具不会自动接受变化或重新批准。
|
|
371
|
+
|
|
372
|
+
### 常用命令
|
|
373
|
+
|
|
374
|
+
| 命令 | 用途 |
|
|
375
|
+
| --- | --- |
|
|
376
|
+
| `setup` | 聚合安全初始化、保守 discovery 和 Assist Bundle |
|
|
377
|
+
| `capabilities` | 查询协议版本、schema、action kind、初始化状态和永久边界 |
|
|
378
|
+
| `init` | 安全创建空项目合同 |
|
|
379
|
+
| `register` | 登记文件、路径、JSON Pointer 或人工决定 |
|
|
380
|
+
| `discover` | 保守提出首次接入候选 |
|
|
381
|
+
| `propose` | 创建 fact、policy、reference 或 validation-description |
|
|
382
|
+
| `approve` | 显式批准选中的 proposal ID |
|
|
383
|
+
| `context` | 为一个或多个路径编译已批准上下文 |
|
|
384
|
+
| `publish` | 写入仍归工具所有的 AGENTS、Markdown 或 Ruler 投影 |
|
|
385
|
+
| `check` | 检测来源、合同和投影漂移 |
|
|
386
|
+
| `sync` | 聚合来源漂移、item 影响、变化路径和维护工作单元 |
|
|
387
|
+
| `preflight` | 验证 Action Plan 并返回只读分组 Review Bundle |
|
|
388
|
+
| `dashboard` | 生成只读治理看板 |
|
|
389
|
+
| `review-source` | 查看来源变化及精确影响集 |
|
|
390
|
+
| `accept-source-change` | 接受固定摘要并撤销受影响批准 |
|
|
391
|
+
| `revise` / `deprecate` | 显式维护合同项 |
|
|
392
|
+
| `deprecate-source` | 用审计记录退役已无引用的来源 |
|
|
393
|
+
|
|
394
|
+
运行 `npx project-context --help` 查看完整命令语法。
|
|
395
|
+
|
|
396
|
+
### 深入文档
|
|
397
|
+
|
|
398
|
+
- [产品宪法](./docs/00-PRODUCT-CONSTITUTION.md)
|
|
399
|
+
- [程序与 CLI 设计](./docs/04-PROGRAM-DESIGN.md)
|
|
400
|
+
- [验收合同](./docs/05-ACCEPTANCE-CONTRACT.md)
|
|
401
|
+
- [安装与分发](./docs/08-INSTALLATION-AND-DISTRIBUTION.md)
|
|
402
|
+
- [知识维护闭环](./docs/12-KNOWLEDGE-MAINTENANCE-CLOSURE-ROADMAP.md)
|
|
403
|
+
- [只读治理看板](./docs/13-READ-ONLY-GOVERNANCE-DASHBOARD-DESIGN.md)
|
|
404
|
+
- [来源生命周期](./docs/15-SOURCE-LIFECYCLE-CLOSURE-DESIGN.md)
|
|
405
|
+
- [引导式接入与 AI 辅助维护](./docs/16-GUIDED-ONBOARDING-AND-AI-RECONCILIATION-DESIGN.md)
|
|
406
|
+
- [AI 双向交换边界设计](./docs/17-AI-EXCHANGE-BOUNDARY-DESIGN.md)
|
|
407
|
+
- [升级说明](./UPGRADING.md)
|
|
142
408
|
|
|
143
|
-
|
|
409
|
+
## License / 许可证
|
|
144
410
|
|
|
145
|
-
|
|
146
|
-
- [真实任务证据](./docs/07-REAL-TASK-EVIDENCE.md)
|
|
411
|
+
Apache License 2.0 · `Copyright 2026 Fushan`
|
|
147
412
|
|
|
148
|
-
|
|
413
|
+
See [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
|
package/UPGRADING.md
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 升级说明
|
|
2
|
+
|
|
3
|
+
## `1.1.0 → 1.2.0`
|
|
4
|
+
|
|
5
|
+
`1.2.0` 完成模型无关双向 AI Exchange Boundary:新增只读 `capabilities`、Action Plan schema 1、只读 `preflight`、Review Bundle schema 1 和四份公开机器 schema。Contract、proposal、source lock、projection lock、renderer 与 Dashboard View Model 均未升级,旧项目无需迁移 `.project-context/`。
|
|
6
|
+
|
|
7
|
+
升级后建议:
|
|
8
|
+
|
|
9
|
+
1. 运行 `project-context capabilities --project . --json`,由宿主读取版本、schema、action kind、初始化状态和永久边界。
|
|
10
|
+
2. 继续使用 `setup`/`sync` 获取项目到 AI 的 Assist Bundle;外部 AI 只生成符合 `schemas/action-plan.schema.json` 的无权限计划。
|
|
11
|
+
3. 运行 `project-context preflight --project . --plan FILE --json`,集中审查 current/proposed、baseline、影响集、blocker、分组与 structured invocation。
|
|
12
|
+
4. 人明确批准具体 action ID 与路径后,宿主才可给 Review Bundle 中的既有细粒度命令补入所需 `--by` 和 `--write`。
|
|
13
|
+
5. 任一写入后,未执行的旧 Review Bundle 与 invocation 全部作废;重新运行 `sync` 和 `preflight`。
|
|
14
|
+
|
|
15
|
+
Action Plan 和 Review Bundle 都不是 store、Contract 或 approval receipt。升级不会执行 plan、自动批准、自动修复、修改业务代码、读取 Git、访问网络、调用 Provider 或安装依赖。
|
|
16
|
+
|
|
17
|
+
## `1.0.1 → 1.1.0`
|
|
18
|
+
|
|
19
|
+
`1.1.0` 新增 `setup`、只读 `sync` 和短生命周期 Assist Bundle schema 1,它们是双向 AI Exchange Boundary 的首个模型无关内核基础;Codex、Claude、MCP 或其他宿主触发仍属可选适配器。Contract reader 仍兼容 schema 1/2,proposal、source lock、projection lock、renderer 3 和 Dashboard View Model 3 均未变化,因此无需迁移 `.project-context/`。
|
|
20
|
+
|
|
21
|
+
升级后可以继续使用所有原命令,也可以逐步采用:
|
|
22
|
+
|
|
23
|
+
1. 新项目通过 `project-context setup --project . --id ID --name NAME --json` 先预览;只有明确需要创建三个 store 和 proposal 时才加 `--write`。
|
|
24
|
+
2. 已初始化项目运行 `project-context sync --project . --json`,一次查看全部来源漂移、影响 item、pending review 和仅投影 finding。
|
|
25
|
+
3. 外部 Agent 或 CI 可以把变化路径通过重复的 `--changed-path` 传入;产品本身不读取 Git。
|
|
26
|
+
4. AI 只根据 `readTargets` 和 `workUnits` 渐进读取,准备既有 accept/revise/deprecate/approve/publish 命令。
|
|
27
|
+
5. 人工明确批准具体 ID 和路径后才能执行相应写命令,最后运行 `check`。
|
|
28
|
+
|
|
29
|
+
升级不会自动创建 proposal、批准规则、接受来源 digest、重发投影、访问网络、运行 Provider、安装依赖或修改业务代码。
|
|
30
|
+
|
|
31
|
+
## `1.0.0 → 1.0.1`
|
|
32
|
+
|
|
33
|
+
`1.0.1` 只修复 npm README、元数据和包文件白名单,不修改 CLI、Contract、lock、projection 或 Dashboard schema。更新依赖版本后无需迁移 `.project-context/`。
|
|
34
|
+
|
|
35
|
+
## `0.9.0 → 1.0.0`
|
|
2
36
|
|
|
3
37
|
从本地 `0.9.0` 升级到 `1.0.0` 不需要预先迁移 Project Contract、proposal、source lock 或 projection lock。Contract reader 同时接受 schema 1/2;既有 schema 1 项目保持原字节,只有首次成功执行 `deprecate-source --write` 时才把所有来源显式标为 active、目标标为 deprecated 并写成 schema 2。proposal、source lock 和 projection lock 继续使用 schema 1。Dashboard JSON 使用 schema 3,projection renderer 使用 3。
|
|
4
38
|
|