frontend-project-context 1.0.1 → 1.3.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 (31) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +164 -8
  3. package/UPGRADING.md +44 -0
  4. package/docs/00-PRODUCT-CONSTITUTION.md +42 -10
  5. package/docs/04-PROGRAM-DESIGN.md +89 -2
  6. package/docs/05-ACCEPTANCE-CONTRACT.md +52 -3
  7. package/docs/08-INSTALLATION-AND-DISTRIBUTION.md +27 -15
  8. package/docs/14-FORMAL-RELEASE-READINESS.md +15 -0
  9. package/docs/16-GUIDED-ONBOARDING-AND-AI-RECONCILIATION-DESIGN.md +469 -0
  10. package/docs/17-AI-EXCHANGE-BOUNDARY-DESIGN.md +270 -0
  11. package/docs/18-BRANCH-AWARE-STAGED-CONTEXT-DESIGN.md +348 -0
  12. package/docs/README.md +17 -5
  13. package/examples/README.md +15 -2
  14. package/examples/package.json +6 -2
  15. package/package.json +4 -3
  16. package/schemas/action-plan.schema.json +250 -0
  17. package/schemas/assist-bundle.schema.json +75 -0
  18. package/schemas/capabilities.schema.json +146 -0
  19. package/schemas/integration-review-bundle.schema.json +43 -0
  20. package/schemas/review-bundle.schema.json +109 -0
  21. package/schemas/stage-context-bundle.schema.json +56 -0
  22. package/schemas/stage-receipt.schema.json +55 -0
  23. package/schemas/task-context-plan.schema.json +85 -0
  24. package/src/project-context/assist.mjs +422 -0
  25. package/src/project-context/capabilities.mjs +74 -0
  26. package/src/project-context/cli.mjs +168 -13
  27. package/src/project-context/exchange-schema.mjs +528 -0
  28. package/src/project-context/exchange.mjs +565 -0
  29. package/src/project-context/project-store.mjs +22 -0
  30. package/src/project-context/task-context-schema.mjs +290 -0
  31. package/src/project-context/task-context.mjs +361 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.0 — unreleased
4
+
5
+ - 新增严格的 Task Context Plan schema 1 与 Stage Receipt schema 1:宿主显式提供任务、stage 依赖、revision label、snapshot、路径和预算,未知、权限、执行、循环依赖、非法路径与无依赖范围重叠均失败封闭。
6
+ - 新增永远只读的 `stage-context`,复用 Scope Compiler 为显式指定阶段生成 Stage Context Bundle schema 1,并用调用方提供的规范 UTF-8 字节与 read-target 预算失败封闭。
7
+ - 新增永远只读的 `integration-review`,比较 plan/receipt/Contract baseline、宿主提供的 main/branch changed paths、Contract item 重叠、stage 越界、生命周期 finding 和待人判断的 decision candidate。
8
+ - 公开 Stage Context Bundle 和 Integration Review Bundle schema 1,capabilities 增加两个命令、四份 schema 和 `canonical-utf8-bytes` 预算语义。
9
+ - 不新增 store migration、Provider、Agent Runtime、Git 读写、源码正文读取、任务/测试执行、依赖、自动批准、合并或长期事实晋升。
10
+ - A-64 至 A-73 与全部旧回归共 79/79 项为实现 Gate;本条不代表 npm 打包、发布、Git 提交/push 或真实项目验收。
11
+
12
+ ## 1.2.0 — 2026-09-09
13
+
14
+ - 新增未初始化和已初始化项目均可使用的只读 `capabilities`,公开 package、exchange protocol、schema、command、八类 action 和永久边界。
15
+ - 新增 Action Plan schema 1 和只读 `preflight`,把 AI 建议规范化为带三个 snapshot、action 专属 baseline、精确 impact 与 blocker 的短生命周期输入。
16
+ - 新增 Review Bundle schema 1,稳定分组 current/proposed、item/source/path/projection 影响与结构化 `{ command, args }` invocation;invocation 不含 `--write` 或 `--by`。
17
+ - 发布 capabilities、Assist Bundle、Action Plan 与 Review Bundle 四份 JSON schema,并把 `schemas/` 加入 npm 白名单;动态项目状态继续排除。
18
+ - 八类 action 均复用现有 register/propose/review/accept/revise/deprecate/approve/publish 预检语义;不新增 `apply-plan`、Provider、Agent Runtime、Git、网络、依赖安装、自动批准或业务代码执行。
19
+ - A-56 至 A-63 与全部回归共 69/69 项验收通过;已发布到公共 npm,并完成候选包与 registry tarball 的逐字节一致性及独立安装验证。
20
+
21
+ ## 1.1.0 — unreleased
22
+
23
+ - 新增 `setup`,在未初始化或已初始化项目中复用现有 discovery,输出不含自动批准的 Assist Bundle;显式写入只创建三个 store 和 create-only proposal。
24
+ - 新增永远只读的 `sync`,一次聚合来源漂移、精确 item 影响、调用方 changed path、投影路径、finding、read target 和稳定 work unit。
25
+ - Assist Bundle schema 1 默认不含来源正文和无关合同值;超过 100 个受影响 item 时保留全部 ID 与基本元数据、省略完整值并显式标记,不静默截断。
26
+ - 补齐 pending-review、projection-review、setup proposal artifact receipt 和目录型 file source 的后代 changed-path 映射。
27
+ - 保持人类为唯一批准者,不增加 Provider、Agent Runtime、网络、Git、依赖、后台服务、自动接受或自动发布能力。
28
+ - A-01 至 A-55、B0-01/B0-02、CLI 和发布工件共 61 项本地验收通过;公共发布尚未授权。
29
+
3
30
  ## 1.0.1 — release candidate
4
31
 
5
32
  - 把 npm README 重写为面向使用者的中英双语安装、快速上手、工作流和命令入口。
package/README.md CHANGED
@@ -14,6 +14,8 @@ AI coding tools often read only part of a repository. Important conventions may
14
14
 
15
15
  - selects the approved guidance that applies to a file or directory;
16
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;
17
19
  - publishes managed Markdown, AGENTS, or Ruler-compatible projections;
18
20
  - reports source, contract, and projection drift;
19
21
  - keeps every persistent write and approval under explicit human control.
@@ -30,23 +32,28 @@ It does **not** call an AI provider, edit business code, manage Git, install dep
30
32
  Pin it as a development dependency so local users and CI run the same version:
31
33
 
32
34
  ```bash
33
- npm install --save-dev frontend-project-context@1.0.1
35
+ npm install --save-dev frontend-project-context@1.2.0
34
36
  ```
35
37
 
36
38
  The package has zero runtime dependencies.
37
39
 
40
+ `1.2.0` is the current independently verified public npm version. The published tarball was byte-matched against the reviewed release candidate and smoke-tested from the official registry.
41
+
38
42
  ### Quick start
39
43
 
40
- Initialize the three project-local stores:
44
+ Let an existing Coding Agent prepare deterministic onboarding candidates:
41
45
 
42
46
  ```bash
43
- npx project-context init \
47
+ npx project-context setup \
44
48
  --project . \
45
49
  --id my-project \
46
50
  --name "My Project" \
47
- --write
51
+ --write \
52
+ --json
48
53
  ```
49
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
+
50
57
  Register an explicit source:
51
58
 
52
59
  ```bash
@@ -93,6 +100,62 @@ npx project-context context --project . --path src --locale en
93
100
  npx project-context check --project .
94
101
  ```
95
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
118
+ ```
119
+
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:
121
+
122
+ ```bash
123
+ npx project-context preflight \
124
+ --project . \
125
+ --plan .project-context/action-plan.json \
126
+ --json
127
+ ```
128
+
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`.
130
+
131
+ For multi-stage feature work, a host can provide a Task Context Plan, prior Stage Receipts, and explicit changed-path signals. Compile only the requested stage:
132
+
133
+ ```bash
134
+ npx project-context stage-context \
135
+ --project . \
136
+ --plan task-context-plan.json \
137
+ --stage stage-render \
138
+ --receipt stage-understand.receipt.json \
139
+ --changed-path src/example.ts \
140
+ --json
141
+ ```
142
+
143
+ Before an external merge, compare host-provided main/branch path signals with the plan, receipts, current Contract snapshots, and checker findings:
144
+
145
+ ```bash
146
+ npx project-context integration-review \
147
+ --project . \
148
+ --plan task-context-plan.json \
149
+ --receipt stage-understand.receipt.json \
150
+ --main-changed-path src/shared.ts \
151
+ --branch-changed-path src/example.ts \
152
+ --json
153
+ ```
154
+
155
+ Both commands are read-only. They do not inspect Git, read source bodies, execute the task or tests, save task state, promote decisions, or grant merge authority. Budget limits are caller-supplied canonical UTF-8 bytes and read-target counts, not model tokens.
156
+
157
+ The package publishes eight machine schemas: capabilities, Assist Bundle, Action Plan, Review Bundle, Task Context Plan, Stage Receipt, Stage Context Bundle, and Integration Review Bundle.
158
+
96
159
  Generate the read-only governance dashboard:
97
160
 
98
161
  ```bash
@@ -122,6 +185,11 @@ Explicit project sources
122
185
  → human-approved Project Contract
123
186
  → scoped Context Bundle
124
187
  → AGENTS / Markdown / Ruler projections
188
+ → existing AI tool
189
+ → authority-free Action Plan
190
+ → read-only Review Bundle
191
+ → exact human approval
192
+ → existing fine-grained write command
125
193
  → drift check
126
194
  ```
127
195
 
@@ -131,6 +199,8 @@ All commands are read-only unless that command explicitly includes `--write`. So
131
199
 
132
200
  | Command | Purpose |
133
201
  | --- | --- |
202
+ | `setup` | Aggregate safe initialization, conservative discovery, and an Assist Bundle |
203
+ | `capabilities` | Discover protocol versions, schemas, action kinds, initialization, and permanent boundaries |
134
204
  | `init` | Create an empty project contract safely |
135
205
  | `register` | Register a file, path, JSON pointer, or human decision |
136
206
  | `discover` | Conservatively propose bootstrap candidates |
@@ -139,6 +209,10 @@ All commands are read-only unless that command explicitly includes `--write`. So
139
209
  | `context` | Compile approved context for one or more paths |
140
210
  | `publish` | Write an owned AGENTS, Markdown, or Ruler projection |
141
211
  | `check` | Detect stale sources, contracts, and projections |
212
+ | `sync` | Aggregate source drift, item impact, changed paths, and reconciliation work units |
213
+ | `preflight` | Validate an Action Plan and return a read-only grouped Review Bundle |
214
+ | `stage-context` | Compile the explicitly requested stage within caller-provided byte/read-target budgets |
215
+ | `integration-review` | Review plan, receipts, host path signals, baselines, and context-layer conflicts without Git |
142
216
  | `dashboard` | Render the read-only governance dashboard |
143
217
  | `review-source` | Review a changed source and its exact impact set |
144
218
  | `accept-source-change` | Accept a pinned source digest and revoke affected approvals |
@@ -156,6 +230,10 @@ Run `npx project-context --help` for the complete command syntax.
156
230
  - [Knowledge maintenance](./docs/12-KNOWLEDGE-MAINTENANCE-CLOSURE-ROADMAP.md)
157
231
  - [Read-only governance dashboard](./docs/13-READ-ONLY-GOVERNANCE-DASHBOARD-DESIGN.md)
158
232
  - [Source lifecycle](./docs/15-SOURCE-LIFECYCLE-CLOSURE-DESIGN.md)
233
+ - [Guided onboarding and AI-assisted reconciliation](./docs/16-GUIDED-ONBOARDING-AND-AI-RECONCILIATION-DESIGN.md)
234
+ - [AI exchange boundary](./docs/17-AI-EXCHANGE-BOUNDARY-DESIGN.md)
235
+ - [Branch-aware staged context and handoff](./docs/18-BRANCH-AWARE-STAGED-CONTEXT-DESIGN.md)
236
+ - [AI Exchange Boundary design](./docs/17-AI-EXCHANGE-BOUNDARY-DESIGN.md)
159
237
  - [Upgrade notes](./UPGRADING.md)
160
238
 
161
239
  ## 中文
@@ -166,6 +244,8 @@ AI 编程工具通常只读取仓库的一部分,而项目约定分散在文
166
244
 
167
245
  - 按文件或目录选择真正生效的已批准规则;
168
246
  - 为现有 Coding Agent 生成精简且可追溯的上下文;
247
+ - 向模型无关宿主公开版本化 capability 与机器 schema;
248
+ - 把 AI 建议收敛为无权限 Action Plan 和只读 Review Bundle;
169
249
  - 从同一合同生成受管 Markdown、AGENTS 或 Ruler 兼容投影;
170
250
  - 检测来源、合同和投影是否过期;
171
251
  - 所有持久写入与批准都必须由人显式触发。
@@ -182,23 +262,28 @@ AI 编程工具通常只读取仓库的一部分,而项目约定分散在文
182
262
  建议固定为开发依赖,让本地与 CI 使用同一版本:
183
263
 
184
264
  ```bash
185
- npm install --save-dev frontend-project-context@1.0.1
265
+ npm install --save-dev frontend-project-context@1.2.0
186
266
  ```
187
267
 
188
268
  本包没有运行时第三方依赖。
189
269
 
270
+ `1.2.0` 是当前已独立核验的公共 npm 最新版本。已发布 tarball 与审查过的发布候选逐字节一致,并已从官方 registry 完成安装冒烟验证。
271
+
190
272
  ### 快速开始
191
273
 
192
- 初始化三个项目内存储文件:
274
+ 让现有 Coding Agent 生成确定性的首次接入候选:
193
275
 
194
276
  ```bash
195
- npx project-context init \
277
+ npx project-context setup \
196
278
  --project . \
197
279
  --id my-project \
198
280
  --name "My Project" \
199
- --write
281
+ --write \
282
+ --json
200
283
  ```
201
284
 
285
+ `setup` 只创建三个 store 和一份 create-only proposal,不会批准候选或发布 Agent 文件。JSON 中的 `artifacts` receipt 会返回精确 proposal 路径,以及 preview、create 或 unchanged 结果。先读取 `summary`、`workUnits` 和 `readTargets`,再审查具体 proposal ID。
286
+
202
287
  登记一个明确来源:
203
288
 
204
289
  ```bash
@@ -245,6 +330,62 @@ npx project-context context --project . --path src --locale zh-CN
245
330
  npx project-context check --project .
246
331
  ```
247
332
 
333
+ 项目来源或实现路径变化后,可一次生成只读的增量维护工作单元:
334
+
335
+ ```bash
336
+ npx project-context sync \
337
+ --project . \
338
+ --changed-path src/example.ts \
339
+ --json
340
+ ```
341
+
342
+ `sync` 汇总变化来源、受影响 item ID、pending item 审查、路径适用规则、仅投影 finding 和精确 work unit。它不携带来源正文,也不能接受、修订、批准、废弃或发布任何内容。Coding Agent 可以准备既有安全命令,但只有人在看到明确 ID 和路径后才能授权写入。
343
+
344
+ 无需初始化项目即可查询双向交换协议:
345
+
346
+ ```bash
347
+ npx project-context capabilities --project . --json
348
+ ```
349
+
350
+ 外部 AI 宿主可使用返回的三个项目 snapshot 和八类 action 生成 Action Plan schema 1。把这份短生命周期计划保存在项目内,再生成只读 Review Bundle:
351
+
352
+ ```bash
353
+ npx project-context preflight \
354
+ --project . \
355
+ --plan .project-context/action-plan.json \
356
+ --json
357
+ ```
358
+
359
+ `preflight` 会验证 project ID、三个 snapshot digest、action 专属 baseline、精确影响集、blocker 和投影所有权,并返回不含 `--write`、`--by` 的结构化 `{ command, args }` invocation。Action Plan 和 Review Bundle 都不授予权限;只有人批准明确 action ID 与路径后,宿主才能为既有细粒度命令补入身份和写入参数。期间任何写入都会使余下 review 失效,必须重新 `sync` 和 `preflight`。
360
+
361
+ 多阶段功能开发中,宿主可以显式提供 Task Context Plan、前序 Stage Receipt 和 changed-path 信号,只编译当前指定阶段:
362
+
363
+ ```bash
364
+ npx project-context stage-context \
365
+ --project . \
366
+ --plan task-context-plan.json \
367
+ --stage stage-render \
368
+ --receipt stage-understand.receipt.json \
369
+ --changed-path src/example.ts \
370
+ --json
371
+ ```
372
+
373
+ 外部合并前,可把宿主提供的 main/branch 路径信号与 plan、receipt、当前 Contract snapshot 和 checker finding 一起进行只读审查:
374
+
375
+ ```bash
376
+ npx project-context integration-review \
377
+ --project . \
378
+ --plan task-context-plan.json \
379
+ --receipt stage-understand.receipt.json \
380
+ --main-changed-path src/shared.ts \
381
+ --branch-changed-path src/example.ts \
382
+ --json
383
+ ```
384
+
385
+ 两个命令都不会读取 Git 或源码正文、执行任务或测试、保存任务状态、晋升决定或授予合并权限。预算由调用方以规范 UTF-8 字节数和 read-target 数量显式提供,不等同于模型 token。
386
+
387
+ npm 包公开八份机器 schema:capabilities、Assist Bundle、Action Plan、Review Bundle、Task Context Plan、Stage Receipt、Stage Context Bundle 和 Integration Review Bundle。
388
+
248
389
  生成只读治理看板:
249
390
 
250
391
  ```bash
@@ -274,6 +415,11 @@ npx project-context dashboard --project . > project-context-dashboard.html
274
415
  → 人工批准的 Project Contract
275
416
  → 按作用域编译的 Context Bundle
276
417
  → AGENTS / Markdown / Ruler 投影
418
+ → 现有 AI 工具
419
+ → 无权限 Action Plan
420
+ → 只读 Review Bundle
421
+ → 人对明确 action 的批准
422
+ → 既有细粒度写命令
277
423
  → 漂移检查
278
424
  ```
279
425
 
@@ -283,6 +429,8 @@ npx project-context dashboard --project . > project-context-dashboard.html
283
429
 
284
430
  | 命令 | 用途 |
285
431
  | --- | --- |
432
+ | `setup` | 聚合安全初始化、保守 discovery 和 Assist Bundle |
433
+ | `capabilities` | 查询协议版本、schema、action kind、初始化状态和永久边界 |
286
434
  | `init` | 安全创建空项目合同 |
287
435
  | `register` | 登记文件、路径、JSON Pointer 或人工决定 |
288
436
  | `discover` | 保守提出首次接入候选 |
@@ -291,6 +439,10 @@ npx project-context dashboard --project . > project-context-dashboard.html
291
439
  | `context` | 为一个或多个路径编译已批准上下文 |
292
440
  | `publish` | 写入仍归工具所有的 AGENTS、Markdown 或 Ruler 投影 |
293
441
  | `check` | 检测来源、合同和投影漂移 |
442
+ | `sync` | 聚合来源漂移、item 影响、变化路径和维护工作单元 |
443
+ | `preflight` | 验证 Action Plan 并返回只读分组 Review Bundle |
444
+ | `stage-context` | 在调用方字节/read-target 预算内编译显式指定的当前阶段 |
445
+ | `integration-review` | 不读取 Git,只读审查 plan、receipt、路径信号、baseline 与上下文冲突 |
294
446
  | `dashboard` | 生成只读治理看板 |
295
447
  | `review-source` | 查看来源变化及精确影响集 |
296
448
  | `accept-source-change` | 接受固定摘要并撤销受影响批准 |
@@ -308,6 +460,10 @@ npx project-context dashboard --project . > project-context-dashboard.html
308
460
  - [知识维护闭环](./docs/12-KNOWLEDGE-MAINTENANCE-CLOSURE-ROADMAP.md)
309
461
  - [只读治理看板](./docs/13-READ-ONLY-GOVERNANCE-DASHBOARD-DESIGN.md)
310
462
  - [来源生命周期](./docs/15-SOURCE-LIFECYCLE-CLOSURE-DESIGN.md)
463
+ - [引导式接入与 AI 辅助维护](./docs/16-GUIDED-ONBOARDING-AND-AI-RECONCILIATION-DESIGN.md)
464
+ - [AI 双向交换边界](./docs/17-AI-EXCHANGE-BOUNDARY-DESIGN.md)
465
+ - [分支感知的分阶段上下文与交接](./docs/18-BRANCH-AWARE-STAGED-CONTEXT-DESIGN.md)
466
+ - [AI 双向交换边界设计](./docs/17-AI-EXCHANGE-BOUNDARY-DESIGN.md)
311
467
  - [升级说明](./UPGRADING.md)
312
468
 
313
469
  ## License / 许可证
package/UPGRADING.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # 升级说明
2
2
 
3
+ ## `1.2.0 → 1.3.0`
4
+
5
+ `1.3.0` 增加可选 Branch-aware Staged Context & Handoff 协议:四份新的短生命周 schema、只读 `stage-context` 和只读 `integration-review`。Contract、proposal、source/projection lock、renderer、Dashboard View Model、Assist Bundle、Action Plan 和 Review Bundle schema 都不变,旧项目无需迁移 `.project-context/`。
6
+
7
+ 采用该可选协议时:
8
+
9
+ 1. 宿主根据 `schemas/task-context-plan.schema.json` 显式准备 task、stage DAG、workspace label、三个 snapshot 与 UTF-8 字节/read-target 预算。
10
+ 2. 运行 `project-context stage-context --project . --plan FILE --stage STAGE_ID --json`;只为当前 stage 提供有效前序 receipt 和 changed-path 信号。
11
+ 3. 外部 Coding Agent 执行任务后,由宿主按 `schemas/stage-receipt.schema.json` 记录结构化结果;receipt 不是人工验收或后续权限。
12
+ 4. 合并前运行 `project-context integration-review`,显式传入 main/branch changed paths;工具不自行读 Git。
13
+ 5. 合并、测试、业务正确性、任务工件存放/删除和长期事实晋升仍由外部工具与人决定。
14
+
15
+ 当前源码已完成实现验收,但未获得 npm 打包或发布授权;已公开核验的 npm `latest` 仍为 `1.2.0`。
16
+
17
+ ## `1.1.0 → 1.2.0`
18
+
19
+ `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/`。
20
+
21
+ 该版本已于 2026-09-09 发布到官方公共 npm,`latest` 指向 `1.2.0`;发布包与冻结候选逐字节一致。
22
+
23
+ 升级后建议:
24
+
25
+ 1. 运行 `project-context capabilities --project . --json`,由宿主读取版本、schema、action kind、初始化状态和永久边界。
26
+ 2. 继续使用 `setup`/`sync` 获取项目到 AI 的 Assist Bundle;外部 AI 只生成符合 `schemas/action-plan.schema.json` 的无权限计划。
27
+ 3. 运行 `project-context preflight --project . --plan FILE --json`,集中审查 current/proposed、baseline、影响集、blocker、分组与 structured invocation。
28
+ 4. 人明确批准具体 action ID 与路径后,宿主才可给 Review Bundle 中的既有细粒度命令补入所需 `--by` 和 `--write`。
29
+ 5. 任一写入后,未执行的旧 Review Bundle 与 invocation 全部作废;重新运行 `sync` 和 `preflight`。
30
+
31
+ Action Plan 和 Review Bundle 都不是 store、Contract 或 approval receipt。升级不会执行 plan、自动批准、自动修复、修改业务代码、读取 Git、访问网络、调用 Provider 或安装依赖。
32
+
33
+ ## `1.0.1 → 1.1.0`
34
+
35
+ `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/`。
36
+
37
+ 升级后可以继续使用所有原命令,也可以逐步采用:
38
+
39
+ 1. 新项目通过 `project-context setup --project . --id ID --name NAME --json` 先预览;只有明确需要创建三个 store 和 proposal 时才加 `--write`。
40
+ 2. 已初始化项目运行 `project-context sync --project . --json`,一次查看全部来源漂移、影响 item、pending review 和仅投影 finding。
41
+ 3. 外部 Agent 或 CI 可以把变化路径通过重复的 `--changed-path` 传入;产品本身不读取 Git。
42
+ 4. AI 只根据 `readTargets` 和 `workUnits` 渐进读取,准备既有 accept/revise/deprecate/approve/publish 命令。
43
+ 5. 人工明确批准具体 ID 和路径后才能执行相应写命令,最后运行 `check`。
44
+
45
+ 升级不会自动创建 proposal、批准规则、接受来源 digest、重发投影、访问网络、运行 Provider、安装依赖或修改业务代码。
46
+
3
47
  ## `1.0.0 → 1.0.1`
4
48
 
5
49
  `1.0.1` 只修复 npm README、元数据和包文件白名单,不修改 CLI、Contract、lock、projection 或 Dashboard schema。更新依赖版本后无需迁移 `.project-context/`。
@@ -1,10 +1,10 @@
1
1
  # Frontend Project Context — 产品宪法
2
2
 
3
- > 宪法版本:`1.1.1`
3
+ > 宪法版本:`1.2.0`
4
4
  >
5
5
  > 状态:`frozen`
6
6
  >
7
- > 生效日期:`2026-09-07`
7
+ > 生效日期:`2026-09-09`
8
8
 
9
9
  ## 1. 文档权威
10
10
 
@@ -15,7 +15,7 @@
15
15
  - `PROJECT_STATE.json` 只记录当前事实、实现状态、授权和下一步;
16
16
  - `RTK.md` 只提供新窗口启动摘要;
17
17
  - `README.md` 只提供产品介绍和使用入口;
18
- - `docs/01` 至 `docs/05`、`docs/08`、`docs/11`、`docs/12` 是形成当前决定的设计或路线说明;
18
+ - `docs/01` 至 `docs/05`、`docs/08`、`docs/11` 至 `docs/17` 是形成当前决定的设计或路线说明;
19
19
  - `docs/06`、`docs/07`、`docs/09`、`docs/10` 是历史或验证证据;
20
20
  - 任务讨论、实验结果和真实项目观察都是输入证据,不能自行改变本文档。
21
21
 
@@ -23,9 +23,9 @@
23
23
 
24
24
  ## 2. 唯一产品定义
25
25
 
26
- Frontend Project Context 是一个**落在项目中的、位于项目与 AI 编程工具之间的模型无关上下文治理与编译层**。
26
+ Frontend Project Context 是一个**落在项目中的、位于项目与 AI 编程工具之间的模型无关双向上下文治理与交换层**。
27
27
 
28
- 它把项目明确提供的事实、规则和来源治理为一份人工批准的 `Project Contract`,再针对目录和任务生成最小、可追溯的 `Context Bundle`,投影给已有 AI 编程工具,并检测来源、合同和投影漂移。
28
+ 它把项目明确提供的事实、规则和来源治理为一份人工批准的 `Project Contract`,再针对目录和任务生成最小、可追溯的 `Context Bundle`,投影给已有 AI 编程工具,并把 AI 返回的建议收敛为可预检、可集中审查的短生命周期 action,最后在人明确批准后复用现有安全写入原语。
29
29
 
30
30
  ```text
31
31
  项目显式来源 + 人工规则
@@ -33,22 +33,26 @@ Frontend Project Context 是一个**落在项目中的、位于项目与 AI 编
33
33
  → 人工批准的 Project Contract
34
34
  → 按目录/任务编译的 Context Bundle
35
35
  → AGENTS.md / Ruler / 其他 AI 工具
36
- 来源与投影漂移检查
36
+ AI Action Plan
37
+ → 确定性预检与人工集中审查
38
+ → 已授权的细粒度写入
39
+ → 来源、合同与投影漂移检查
37
40
  ```
38
41
 
39
- 本产品治理“项目希望 AI 知道什么”,不负责“AI 如何完成开发任务”。
42
+ 本产品治理“项目希望 AI 知道什么”和“AI 建议如何在人工授权前被安全表达与预检”,不负责“AI 如何完成开发任务”。
40
43
 
41
44
  ## 3. 固定用户问题
42
45
 
43
46
  同一项目的知识分散在设计资料、文档、配置、代码和团队约定中,不同 AI 工具会获得不完整、重复或互相冲突的指导,并且规则变化难以追溯。
44
47
 
45
- 本产品提供的稳定价值只有三点:
48
+ 本产品提供的稳定价值只有四点:
46
49
 
47
50
  1. 一份有人批准、保留来源的项目合同;
48
51
  2. 针对目录和任务的确定性上下文编译;
49
52
  3. 同一合同面向多个 AI 消费者的一致投影和漂移检查。
53
+ 4. 项目与不同 AI 编程工具之间一份双向、模型无关、可预检且不扩张人工权限的交换协议。
50
54
 
51
- 如果某项能力不能直接服务这三点,它默认不属于内核。
55
+ 如果某项能力不能直接服务这四点,它默认不属于内核。
52
56
 
53
57
  ## 4. 固定内核
54
58
 
@@ -60,6 +64,7 @@ Frontend Project Context 是一个**落在项目中的、位于项目与 AI 编
60
64
  4. **Context Renderer**:生成包含必要批准内容和来源引用的稳定 Context Bundle,任务约束不写回合同;
61
65
  5. **Projection Boundary**:把同一合同投影为受管 Markdown、AGENTS 或 Ruler 输入,不重建完整工具适配矩阵;
62
66
  6. **Conflict and Drift Check**:报告来源、合同和受管投影变化,不自动修复或静默提升规则。
67
+ 7. **AI Exchange Boundary**:以公开、带版本的机器合同向外部 AI 输出 Context/Assist Bundle,并把 AI 建议收敛为无权限的 Action Plan 与只读 Review Bundle;所有持久动作仍需人对精确 action、ID 和路径明确批准。
63
68
 
64
69
  自动 discovery 只是帮助项目首次接入的可选辅助,不是内核完整性的衡量标准。它可以保守地提出候选,但不承担理解所有前端技术和业务语义的责任。
65
70
 
@@ -90,6 +95,7 @@ Vue、React、uni-app、Vuex、Element UI、路由、租户和发布方式等都
90
95
  8. 未知项目语义是待录入的项目数据,不自动成为产品缺陷。
91
96
  9. 真实项目只能验证预先定义的能力,不能直接产生内核需求。
92
97
  10. 新技术、新文件名或单个项目差异不能成为扩大 discovery 的充分理由。
98
+ 11. AI 产生的 Action Plan、Review Bundle、推理或建议都不是 Project Contract、approval 或持久执行权限;必须通过 schema、baseline、impact 和人工精确授权边界。
93
99
 
94
100
  ## 7. v1 完成定义
95
101
 
@@ -112,6 +118,19 @@ v1 只有在以下闭环同时成立时才算产品完成:
112
118
 
113
119
  该版本只扩展现有来源追溯、人工合同治理和漂移检查,没有改变第 2 至第 6 节的产品身份、内核、永久边界和不变量。
114
120
 
121
+ ### 7.2 AI Exchange Boundary 完成条件
122
+
123
+ `1.2.0` 的双向桥梁扩展只有在以下闭环同时成立时才算完成:
124
+
125
+ 1. 未初始化或已初始化项目都可以机器可读地查询协议能力、schema 和永久边界;
126
+ 2. Context/Assist Bundle、Action Plan 和 Review Bundle 都有公开版本化 schema;
127
+ 3. AI 建议可以通过结构化 Action Plan 复用现有原语完成确定性预检,不需要拼接 shell 字符串;
128
+ 4. Review Bundle 完整展示 current/proposed、baseline、impact、blocker、item/source/path/projection 和 structured invocation;
129
+ 5. 任何人工批准前的交换都保持只读,任何过期 baseline 都失败封闭;
130
+ 6. 宿主 Agent 适配可替换,且不改变 Project Contract、scope、approval、ownership 或漂移语义。
131
+
132
+ 完整实现合同以 [17-AI-EXCHANGE-BOUNDARY-DESIGN.md](./17-AI-EXCHANGE-BOUNDARY-DESIGN.md) 为准。
133
+
115
134
  ## 8. 真实项目与实验规则
116
135
 
117
136
  `dtg-tmc-mobile` 和 `dtg-tmc-pc` 已经完成 B0。它们证明核心机制和首轮安全修补可以落在真实仓库结构中。
@@ -130,11 +149,12 @@ v1 只有在以下闭环同时成立时才算产品完成:
130
149
  任何新增建议必须先归入且只能归入一类:
131
150
 
132
151
  - **内核缺陷**:违反第 6 节不变量或第 7 节既定完成条件,可以进入设计;
152
+ - **宪法级产品演进**:现有稳定价值或内核无法完整表达经用户确认的产品问题,必须按第 11 节单独获得产品方向变更授权;
133
153
  - **项目数据**:某项目自己的技术、目录、规则和业务语义,由 Project Contract 表达;
134
154
  - **可选适配器**:减少某种来源导入或消费者输出成本,不改变内核;
135
155
  - **外部工具职责**:继续采用现成工具,本项目拒绝实现。
136
156
 
137
- 无法证明属于内核缺陷的建议,不得进入核心实现。多个项目重复出现也只能提高审查优先级,不能绕过这一分类。
157
+ 无法证明属于内核缺陷,且没有按第 11 节获得宪法级产品演进授权的建议,不得进入核心实现。多个项目重复出现也只能提高审查优先级,不能绕过这一分类。
138
158
 
139
159
  ## 10. 当前事实职责与阶段停止规则
140
160
 
@@ -164,3 +184,15 @@ v1 只有在以下闭环同时成立时才算产品完成:
164
184
  2. 第 10 节删除会随时间失效的具体“当前下一步”,把当前事实、授权和下一步的唯一记录职责交还给 `PROJECT_STATE.json`;
165
185
  3. 产品身份、固定用户问题、内核、永久边界、不变量、需求分类和已有用户数据合同均未改变;
166
186
  4. 本次修订不授权产品代码、Git、真实项目、自托管 Project Contract、看板、团队验收或发布工作。
187
+
188
+ ## 13. `1.2.0` 双向桥梁修订记录
189
+
190
+ 本次修订经用户于 `2026-09-09` 在确认“主要功能就是项目与 AI 之间桥梁,有必要可以扩大自研内核”后明确要求执行,变更如下:
191
+
192
+ 1. 第 2 节把单向上下文输出补全为项目 → AI 与 AI → 项目的双向桥梁;
193
+ 2. 第 3 节增加“模型无关、可预检、不扩张人工权限的交换协议”作为第四项稳定价值;
194
+ 3. 第 4 节新增 AI Exchange Boundary 作为第七项自研内核;
195
+ 4. 第 6 节新增 AI 建议不是真源、批准或持久权限的不变量;
196
+ 5. 第 7.2 节新增 `1.2.0` 双向交换完成条件;
197
+ 6. Provider、Agent Runtime、开发任务执行、Git、网络、自动批准、业务代码修改和框架识别白名单仍在永久边界外;
198
+ 7. 本次授权只包含宪法修订、`1.1.0` 完整性修正和 `docs/17` 设计落盘,不自动授权 `1.2.0` 产品代码、真实项目、Git 写入或发布。