frontend-project-context 1.0.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 (47) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +4 -0
  4. package/PROJECT_STATE.json +176 -0
  5. package/README.md +148 -0
  6. package/RTK.md +13 -0
  7. package/UPGRADING.md +15 -0
  8. package/bin/project-context.mjs +7 -0
  9. package/docs/00-PRODUCT-CONSTITUTION.md +166 -0
  10. package/docs/01-PRODUCT-CORE.md +143 -0
  11. package/docs/02-MARKET-BOUNDARY.md +88 -0
  12. package/docs/03-FINAL-SOLUTION.md +203 -0
  13. package/docs/04-PROGRAM-DESIGN.md +428 -0
  14. package/docs/05-ACCEPTANCE-CONTRACT.md +348 -0
  15. package/docs/06-HISTORICAL-PROTOTYPE.md +55 -0
  16. package/docs/07-REAL-TASK-EVIDENCE.md +52 -0
  17. package/docs/08-INSTALLATION-AND-DISTRIBUTION.md +199 -0
  18. package/docs/09-B0-DTG-TMC-MOBILE.md +173 -0
  19. package/docs/10-B0-DTG-TMC-PC.md +118 -0
  20. package/docs/11-V1-AUTHORING-CLOSURE-DESIGN.md +312 -0
  21. package/docs/12-KNOWLEDGE-MAINTENANCE-CLOSURE-ROADMAP.md +350 -0
  22. package/docs/13-READ-ONLY-GOVERNANCE-DASHBOARD-DESIGN.md +489 -0
  23. package/docs/14-FORMAL-RELEASE-READINESS.md +61 -0
  24. package/docs/15-SOURCE-LIFECYCLE-CLOSURE-DESIGN.md +260 -0
  25. package/docs/README.md +74 -0
  26. package/examples/README.md +17 -0
  27. package/examples/package.json +11 -0
  28. package/examples/project-context-check.yml +22 -0
  29. package/package.json +40 -0
  30. package/src/project-context/approver.mjs +177 -0
  31. package/src/project-context/authoring.mjs +190 -0
  32. package/src/project-context/canonical-json.mjs +55 -0
  33. package/src/project-context/checker.mjs +132 -0
  34. package/src/project-context/cli.mjs +409 -0
  35. package/src/project-context/contract-schema.mjs +316 -0
  36. package/src/project-context/dashboard-model.mjs +278 -0
  37. package/src/project-context/dashboard-renderer.mjs +637 -0
  38. package/src/project-context/discovery.mjs +251 -0
  39. package/src/project-context/errors.mjs +13 -0
  40. package/src/project-context/io.mjs +93 -0
  41. package/src/project-context/maintenance.mjs +400 -0
  42. package/src/project-context/path-policy.mjs +155 -0
  43. package/src/project-context/project-store.mjs +138 -0
  44. package/src/project-context/projection-store.mjs +107 -0
  45. package/src/project-context/renderer.mjs +135 -0
  46. package/src/project-context/scope-compiler.mjs +132 -0
  47. package/src/project-context/source-reader.mjs +124 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 — release candidate
4
+
5
+ - 冻结 model-neutral Project Contract、来源追溯、scope compiler、Context Bundle 和受管投影边界。
6
+ - 提供通用来源登记、四类 item、三类 scope、显式批准和知识维护闭环。
7
+ - 提供只读中英双语治理看板、schema 2 View Model 与 renderer 3。
8
+ - 加固路径写入、verification schema、同 ID revision、原子失败恢复和输出精简。
9
+ - 增加 Contract schema 2 的 active/deprecated source 生命周期、显式 `deprecate-source`、schema 1 延迟迁移和 deprecated provenance 保留。
10
+ - Dashboard View Model 升为 schema 3;deprecated source 不再读取已退役 locator,并显示双语审计信息。
11
+ - 以 `Copyright 2026 Fushan` 采用 Apache License 2.0,并把 LICENSE/NOTICE 纳入发布包。
12
+ - A-01 至 A-45、B0-01/B0-02 与 CLI 共 49 项本地验收通过。
13
+
14
+ 公开 npm 发布已获授权并固定为 public access;npmjs.org CLI 身份已验证,当前进入最终发布。
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ Frontend Project Context
2
+ Copyright 2026 Fushan
3
+
4
+ This product is licensed under the Apache License, Version 2.0.
@@ -0,0 +1,176 @@
1
+ {
2
+ "schemaVersion": 43,
3
+ "status": "1.0.0-public-npm-release-ready",
4
+ "product": {
5
+ "name": "Frontend Project Context",
6
+ "identity": "A project-local, model-neutral context governance and compilation layer between a repository and existing AI coding tools.",
7
+ "promise": "Maintain one human-approved project contract with provenance, compile scoped context for existing AI tools, and detect source, contract, and projection drift.",
8
+ "kernel": [
9
+ "source-registration-and-provenance",
10
+ "human-governed-project-contract",
11
+ "scope-aware-context-compiler",
12
+ "tool-projection-boundary",
13
+ "conflict-and-drift-checking"
14
+ ],
15
+ "discoveryRole": "Optional conservative bootstrap; never a requirement to understand every frontend technology or project convention."
16
+ },
17
+ "hardBoundaries": {
18
+ "humanAuthority": "Only an explicit human action may approve or change normative contract content.",
19
+ "runtime": "No model Provider or agent loop.",
20
+ "businessCode": "No user development task execution or application-code edits.",
21
+ "git": "No Git state management.",
22
+ "externalEffects": "No automatic dependency installation, network access, external mutation, or shell workflow execution.",
23
+ "generatedFiles": "Only explicitly managed and still-owned projections may be overwritten after an explicit write action.",
24
+ "conflicts": "Report stale sources and conflicts; never silently resolve or promote them.",
25
+ "taskContext": "Ephemeral task constraints cannot expand authority or rewrite the persistent Contract."
26
+ },
27
+ "implementation": {
28
+ "version": "1.0.0",
29
+ "license": "Apache-2.0",
30
+ "copyright": "Copyright 2026 Fushan",
31
+ "entrypoint": "bin/project-context.mjs",
32
+ "modules": "src/project-context/",
33
+ "tests": "test/project-context/",
34
+ "runtime": "node-standard-library-only",
35
+ "dependenciesAdded": 0,
36
+ "schemas": {
37
+ "contract": 2,
38
+ "contractReadable": [
39
+ 1,
40
+ 2
41
+ ],
42
+ "proposal": 1,
43
+ "sourceLock": 1,
44
+ "projectionLock": 1,
45
+ "projectionRenderer": 3,
46
+ "dashboardViewModel": 3
47
+ },
48
+ "closures": [
49
+ "v1-authoring",
50
+ "knowledge-maintenance",
51
+ "read-only-governance-dashboard",
52
+ "context-efficiency-and-governance-hardening",
53
+ "formal-release-readiness",
54
+ "source-lifecycle"
55
+ ],
56
+ "hardening": [
57
+ "symlink-safe-parent-creation",
58
+ "verification-kind-schema-semantics",
59
+ "proposal-create-only-same-id-revision-guard",
60
+ "strict-contract-value-json-compatibility",
61
+ "grouped-multipath-context-rendering",
62
+ "primary-locale-context-with-explicit-en-or-all",
63
+ "compact-approval-json-receipt",
64
+ "dashboard-derived-data-deduplication",
65
+ "deprecated-source-io-suppression",
66
+ "projection-lock-snapshot-precondition"
67
+ ],
68
+ "acceptance": {
69
+ "command": "npm run check",
70
+ "range": "A-01-through-A-45-plus-B0-01-B0-02-and-CLI",
71
+ "testCount": 49,
72
+ "status": "passed-source-lifecycle-closure-local",
73
+ "teamMaintenance": {
74
+ "date": "2026-09-08",
75
+ "fixture": "isolated-temporary-project",
76
+ "workflow": "source-change-review-accept-revise-deprecate-reapprove-republish-final-check",
77
+ "result": "passed"
78
+ },
79
+ "releaseReadiness": {
80
+ "date": "2026-09-08",
81
+ "package": "frontend-project-context@1.0.0",
82
+ "publicSurface": "project-context-cli",
83
+ "packagePrivate": false,
84
+ "registry": "https://registry.npmjs.org/",
85
+ "access": "public",
86
+ "license": "Apache-2.0",
87
+ "result": "public-release-configured-authenticated-ready"
88
+ }
89
+ },
90
+ "compatibility": "Contract schema 1 and 2 are readable. Existing schema-1 stores remain byte-stable until the first successful deprecate-source write lazily upgrades the Contract to schema 2; proposal and both locks remain schema 1. Renderer 1 and 2 projections remain readable and stale until explicit owned republish to renderer 3. Dashboard JSON consumers must opt into View Model schema 3; --full-json preserves the former verbose approval result on demand."
91
+ },
92
+ "planning": {
93
+ "releaseBlocker": {
94
+ "id": "source-lifecycle-closure",
95
+ "classification": "kernel-defect",
96
+ "targetPackageVersion": "1.0.0",
97
+ "status": "implemented-local-verified-release-hold-resolved",
98
+ "design": "docs/15-SOURCE-LIFECYCLE-CLOSURE-DESIGN.md",
99
+ "evidence": [
100
+ "accept-source-change rejects missing or unreadable registered sources",
101
+ "register rejects a changed locator under an existing source ID",
102
+ "contract schema 1 has no safe source retirement state",
103
+ "a missing, relocated, or retired source therefore requires direct store editing to return check to clean"
104
+ ],
105
+ "frozenScope": [
106
+ "contract-schema-2-active-and-deprecated-source-lifecycle",
107
+ "explicit-deprecate-source-command",
108
+ "schema-1-lazy-compatibility-migration",
109
+ "checker-dashboard-context-and-publish-lifecycle-consistency",
110
+ "A-40-through-A-45"
111
+ ],
112
+ "result": {
113
+ "date": "2026-09-08",
114
+ "tests": 49,
115
+ "contractSchemasReadable": [
116
+ 1,
117
+ 2
118
+ ],
119
+ "contractSchemaWrittenByLifecycle": 2,
120
+ "dashboardViewModel": 3,
121
+ "selfHostedContractSchema": 1,
122
+ "selfHostedMigrationReason": "No self-hosted source is obsolete; schema 1 remains valid until a real source retirement requires lazy migration."
123
+ }
124
+ },
125
+ "laterCandidates": [
126
+ {
127
+ "id": "ci-reconciliation-artifacts",
128
+ "classification": "optional-adapter",
129
+ "status": "candidate-after-release-decision",
130
+ "boundary": "Reuse check and dashboard in external CI; do not add a scheduler, daemon, automatic acceptance, or approval."
131
+ },
132
+ {
133
+ "id": "targeted-context-consumer-protocol",
134
+ "classification": "optional-adapter",
135
+ "status": "candidate-requires-separate-design-authorization",
136
+ "boundary": "Coding Agent or IDE resolves candidate paths and consumes context --path; no Provider, Agent Runtime, business-code execution, or automatic authority expansion."
137
+ }
138
+ ]
139
+ },
140
+ "executionAuthority": {
141
+ "providerCallsAllowed": false,
142
+ "dependencyInstallationAllowed": false,
143
+ "networkAllowed": true,
144
+ "productImplementationAllowed": false,
145
+ "realProjectBetaAllowed": false,
146
+ "teamAcceptanceAllowed": false,
147
+ "releaseWorkAllowed": true,
148
+ "gitWriteOperationsAllowed": true,
149
+ "note": "The user authorized completing the public release and npmjs.org CLI authentication is verified as fushanyx1. Public npm visibility, private:false, release verification, Git release commit/tag/push, and npm publication are in scope for this release workflow. Provider calls, dependency installation, real-project access, and product expansion remain unauthorized."
150
+ },
151
+ "sourceOfTruth": {
152
+ "constitution": "docs/00-PRODUCT-CONSTITUTION.md",
153
+ "startup": "RTK.md",
154
+ "overview": "README.md",
155
+ "documentationIndex": "docs/README.md",
156
+ "programDesign": "docs/04-PROGRAM-DESIGN.md",
157
+ "acceptanceContract": "docs/05-ACCEPTANCE-CONTRACT.md",
158
+ "v1AuthoringClosureDesign": "docs/11-V1-AUTHORING-CLOSURE-DESIGN.md",
159
+ "knowledgeMaintenanceClosureRoadmap": "docs/12-KNOWLEDGE-MAINTENANCE-CLOSURE-ROADMAP.md",
160
+ "readOnlyGovernanceDashboardDesign": "docs/13-READ-ONLY-GOVERNANCE-DASHBOARD-DESIGN.md",
161
+ "formalReleaseReadiness": "docs/14-FORMAL-RELEASE-READINESS.md",
162
+ "sourceLifecycleClosureDesign": "docs/15-SOURCE-LIFECYCLE-CLOSURE-DESIGN.md",
163
+ "license": "LICENSE",
164
+ "notice": "NOTICE",
165
+ "installationAndDistribution": "docs/08-INSTALLATION-AND-DISTRIBUTION.md",
166
+ "historicalEvidence": [
167
+ "docs/06-HISTORICAL-PROTOTYPE.md",
168
+ "docs/07-REAL-TASK-EVIDENCE.md",
169
+ "docs/09-B0-DTG-TMC-MOBILE.md",
170
+ "docs/10-B0-DTG-TMC-PC.md"
171
+ ]
172
+ },
173
+ "next": [
174
+ "publish-frontend-project-context-1.0.0-to-public-npm"
175
+ ]
176
+ }
package/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # Frontend Project Context
2
+
3
+ Frontend Project Context 是位于前端项目与 AI 编程工具之间的模型无关上下文层。
4
+
5
+ [产品宪法](./docs/00-PRODUCT-CONSTITUTION.md)是产品身份、边界、完成条件和变更规则的唯一规范真源。
6
+
7
+ 它把分散在设计资料、文档、配置、代码和团队约定中的项目知识,整理成一份有来源、有人负责批准的 `Project Contract`,再为不同 Coding Agent 生成一致的项目上下文,并检查规则漂移。
8
+
9
+ ```text
10
+ 项目事实与人工规范
11
+ → Project Contract(唯一真源)
12
+ → Context Compiler
13
+ → AGENTS.md / Ruler / Kiro / 其他 Agent
14
+ → Drift Check
15
+ ```
16
+
17
+ ## 产品核心
18
+
19
+ - **Register / Discover**:登记项目明确提供的来源;自动发现只负责保守地提出接入候选,不尝试理解所有前端技术。
20
+ - **Govern**:人类确认哪些内容是事实、规范或参考样例;AI 不能自行批准长期规则。
21
+ - **Compile**:按目录范围和任务目标生成最小、可追溯的 Context Bundle。
22
+ - **Project**:把同一合同投影到现有 AI 工具,而不是为每个模型维护一套手写规则。
23
+ - **Check**:发现来源变化、合同冲突和生成文件漂移。
24
+
25
+ ## 与现成工具的关系
26
+
27
+ - [Ruler](https://github.com/intellectronica/ruler) 和 [Rulesync](https://github.com/dyoshikawa/rulesync) 已经覆盖多 Agent 规则分发,本项目不重建完整适配矩阵。
28
+ - [Kiro Steering](https://kiro.dev/docs/steering/) 已经展示项目知识、规则和 Specs 的完整产品体验,本项目保持 Runtime 和模型中立。
29
+ - [GitHub Spec Kit](https://github.com/github/spec-kit) 与 [OpenSpec](https://openspec.dev/) 负责规格驱动的功能开发流程,可以消费本项目上下文,但不属于本项目内核。
30
+
31
+ 本项目只在现有工具前面补一层:**从真实设计和代码中形成有来源、可审查、可按作用域编译的项目合同,并持续检查漂移。**
32
+
33
+ ## 明确不做
34
+
35
+ - 不调用模型 Provider,也不实现 Coding Agent Runtime。
36
+ - 不执行真实开发任务或自动修复代码。
37
+ - 不管理 Git 分支、commit、merge、push、PR 或部署。
38
+ - 不自动安装依赖或访问外部系统。
39
+ - 不保存 candidate、DecisionRecord 或 DeliveryRecord。
40
+ - 不复制 Kiro、Spec Kit、Ruler 等工具已有的能力。
41
+
42
+ ## 当前状态
43
+
44
+ ```text
45
+ 1.0.0-public-npm-release-ready
46
+ ```
47
+
48
+ 核心引擎、通用 authoring、knowledge maintenance、只读治理看板和来源生命周期闭环均已完成本地、零第三方依赖实现。`0.9.0` 在不扩大产品边界的前提下加固路径/合同安全,并压缩 Context、CLI JSON、Dashboard 和启动上下文的重复内容。团队维护验收已在隔离 fixture 完整走通来源变化、接受、修订、废弃、重新批准、重新投影和最终检查;加上 A-39 与 A-40 至 A-45,A-01 至 A-45、2 项 B0 回归和 CLI 端到端测试共 49 项均已通过。
49
+
50
+ 正式发布准备已经把上述能力冻结为 `frontend-project-context@1.0.0` 候选包,公共稳定面为 `project-context` CLI。后续重大调整审查发现并已关闭一个发布前缺口:已登记来源被删除、搬迁或永久退役时,现在可用稳定 CLI 完成替代、修订、重新批准、旧来源废弃、重新投影和 clean check,无需手改内部 JSON。
51
+
52
+ [Source Lifecycle Closure 设计与实现记录](./docs/15-SOURCE-LIFECYCLE-CLOSURE-DESIGN.md) 已按冻结范围落地 Contract schema 2 的 active/deprecated source、显式 `deprecate-source` 命令和 A-40 至 A-45。schema 1 项目继续原样可读,只有首次成功废弃来源时才延迟升级。公开 npm 发布已经获得授权并固定到 `https://registry.npmjs.org/`,发布者 CLI 身份已验证,当前处于最终发布就态。
53
+
54
+ ## 许可证
55
+
56
+ 本项目采用 [Apache License 2.0](./LICENSE),版权声明见 [NOTICE](./NOTICE):`Copyright 2026 Fushan`。
57
+
58
+ 本仓库已经使用同一 CLI 初始化 `.project-context/` 自托管真源。收录本次实现后,22 个精确来源和 20 个治理项均经显式批准,`check` 零 finding。根 `AGENTS.md` 继续由人维护,没有被生成投影接管。
59
+
60
+ 只读治理看板仍提供总览、知识、来源、scope、投影、finding 六个视图;默认输出确定性、自包含的离线 HTML,`--json` 输出短生命周期 View Model schema 3,并能双语解释 deprecated source 的负责人、时间与理由。HTML 只包含渲染所需内容,不再重复嵌入整份 View Model。
61
+
62
+ `0.7.0 — Knowledge Maintenance Closure` 已实现来源变化 review/accept、影响集撤销旧批准、同 ID revision、deprecation、pending reapproval、projection stale 和并发失败封闭。两个真实项目 B0 仍只作为既有证据;本次实现没有访问真实项目。
63
+
64
+ ## 本地使用
65
+
66
+ ```bash
67
+ node bin/project-context.mjs init --project /path/to/project --id project-id --name "Project Name" --write
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
79
+ ```
80
+
81
+ 知识来源发生变化后的维护流程:
82
+
83
+ ```bash
84
+ node bin/project-context.mjs review-source --project /path/to/project --id source-package --json
85
+ node bin/project-context.mjs accept-source-change --project /path/to/project --id source-package --expected-digest SHA256_FROM_REVIEW --affected-items ITEM_ID... --write
86
+ node bin/project-context.mjs revise --project /path/to/project --id ITEM_ID --kind policy --subject SUBJECT --value NEW_VALUE --statement "NEW STATEMENT" --sources source-package --scope project --json
87
+ node bin/project-context.mjs revise --project /path/to/project --id ITEM_ID --expected-item-digest SHA256_FROM_PREVIEW --kind policy --subject SUBJECT --value NEW_VALUE --statement "NEW STATEMENT" --sources source-package --scope project --write
88
+ node bin/project-context.mjs approve --project /path/to/project --pending --ids ITEM_ID... --by NAME --write
89
+ node bin/project-context.mjs publish --project /path/to/project --target agents --output AGENTS.md --write
90
+ node bin/project-context.mjs check --project /path/to/project
91
+ ```
92
+
93
+ 来源已经搬迁或永久退役时,先登记替代 source、用 `revise` 和 `approve --pending` 移走全部当前引用,再执行:
94
+
95
+ ```bash
96
+ node bin/project-context.mjs deprecate-source --project /path/to/project --id source-old --by NAME --rationale "Replaced by source-new." --json
97
+ node bin/project-context.mjs deprecate-source --project /path/to/project --id source-old --expected-source-digest SHA256_FROM_PREVIEW --by NAME --rationale "Replaced by source-new." --write
98
+ node bin/project-context.mjs publish --project /path/to/project --target agents --output AGENTS.md --write
99
+ node bin/project-context.mjs check --project /path/to/project
100
+ ```
101
+
102
+ preview 中若 `blockingItems` 非空,必须先处理这些 proposed/approved 引用;命令不会级联改 item 或自动批准。需要退役 item 时,先运行 `deprecate` preview 取得 current item digest,再以同一命令增加 `--expected-item-digest ... --by NAME --rationale TEXT --write`。所有命令默认只读;`init`、`register`、保存 proposal、`accept-source-change`、`revise`、`deprecate`、`deprecate-source`、`approve` 和 `publish` 只有在自身显式包含 `--write` 时才会写文件。
103
+
104
+ `context` 默认从 `[zh-CN] ...\n[en] ...` statement 中只选择中文主解释;可用 `--locale en` 选择英文,或 `--locale all` 保留双语原文。多条 `--path` 若得到相同知识集,只渲染一个 Targets 分组。`approve --json` 默认返回 digest 和 ID 摘要;只有确实需要完整 next Contract 时才使用 `--full-json`。
105
+
106
+ 验证:
107
+
108
+ ```bash
109
+ npm test
110
+ npm run check
111
+ ```
112
+
113
+ 发布候选与升级资料:
114
+
115
+ - [正式发布准备](./docs/14-FORMAL-RELEASE-READINESS.md)
116
+ - [变更记录](./CHANGELOG.md)
117
+ - [升级说明](./UPGRADING.md)
118
+ - [最小团队接入示例](./examples/README.md)
119
+
120
+ 检查或读取本仓库自身治理上下文:
121
+
122
+ ```bash
123
+ node bin/project-context.mjs check --project .
124
+ node bin/project-context.mjs context --project . --path . --path src/project-context --path docs --locale zh-CN
125
+ node bin/project-context.mjs dashboard --project . > /tmp/frontend-project-context-dashboard.html
126
+ ```
127
+
128
+ 现行文档按以下顺序阅读:
129
+
130
+ 1. [产品宪法](./docs/00-PRODUCT-CONSTITUTION.md)
131
+ 2. [当前状态](./PROJECT_STATE.json)
132
+ 3. [产品核心](./docs/01-PRODUCT-CORE.md)
133
+ 4. [市场与自研边界](./docs/02-MARKET-BOUNDARY.md)
134
+ 5. [最终产品方案](./docs/03-FINAL-SOLUTION.md)
135
+ 6. [v1 程序设计](./docs/04-PROGRAM-DESIGN.md)
136
+ 7. [验收合同](./docs/05-ACCEPTANCE-CONTRACT.md)
137
+ 8. [v1 authoring closure 设计与实现结果](./docs/11-V1-AUTHORING-CLOSURE-DESIGN.md)
138
+ 9. [0.7.0 Knowledge Maintenance Closure 冻结设计与实现记录](./docs/12-KNOWLEDGE-MAINTENANCE-CLOSURE-ROADMAP.md)
139
+ 10. [0.8.0 Read-only Governance Dashboard 冻结设计与实现记录](./docs/13-READ-ONLY-GOVERNANCE-DASHBOARD-DESIGN.md)
140
+ 11. [1.0.0 正式发布准备](./docs/14-FORMAL-RELEASE-READINESS.md)
141
+ 12. [1.0.0 Source Lifecycle Closure 设计与实现记录](./docs/15-SOURCE-LIFECYCLE-CLOSURE-DESIGN.md)
142
+
143
+ 历史任务执行 Harness 的结论和第一次真实业务任务只作为反例与证据保留:
144
+
145
+ - [历史原型](./docs/06-HISTORICAL-PROTOTYPE.md)
146
+ - [真实任务证据](./docs/07-REAL-TASK-EVIDENCE.md)
147
+
148
+ 当前实现不调用 Provider、网络、shell 或 Git,不执行项目验证,也不修改业务代码。历史 Harness 的源码、入口、测试和任务模板已从工作树清理,可通过 Git 历史追溯。真实项目报告只作为既有能力证据,不能自动产生新的内核需求。
package/RTK.md ADDED
@@ -0,0 +1,13 @@
1
+ # Frontend Project Context — 启动路由
2
+
3
+ 按顺序读取:
4
+
5
+ 1. `docs/00-PRODUCT-CONSTITUTION.md`:产品身份、内核、永久边界与治理规则;
6
+ 2. `PROJECT_STATE.json`:当前版本、实现、授权和唯一下一步;
7
+ 3. 仅在任务需要时读取 `PROJECT_STATE.json.sourceOfTruth` 指向的设计或证据。
8
+
9
+ 当前摘要:`1.0.0-public-npm-release-ready`。v1 已冻结为 `frontend-project-context@1.0.0`,采用 Apache-2.0 与 `Copyright 2026 Fushan`;Source Lifecycle Closure 和全部 49 项本地验收通过。Contract reader 支持 schema 1/2,schema 1 只在首次成功 `deprecate-source --write` 时延迟升级为 2;proposal 与两个 lock 保持 1,projection renderer 为 3,Dashboard View Model 为 3。
10
+
11
+ 根 `AGENTS.md` 由人工维护;`.project-context/` 是本仓库自托管真源;投影只是可重新生成的消费端文件。任何历史文档与宪法冲突时以宪法为准,任何动态状态与 `PROJECT_STATE.json` 冲突时以后者为准。
12
+
13
+ 用户已授权完成公开发布;package 已固定 `private: false`、public access 和官方 npm registry,npmjs.org CLI 身份已验证。当前唯一下一步是完成最终 pack、release commit、`v1.0.0` tag/push 与 `npm publish`。Provider、依赖安装、真实业务项目访问和产品扩张仍未授权。
package/UPGRADING.md ADDED
@@ -0,0 +1,15 @@
1
+ # 升级到 1.0.0
2
+
3
+ 从本地 `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
+
5
+ 建议步骤:
6
+
7
+ 1. 将项目依赖锁定到 `frontend-project-context@1.0.0`。
8
+ 2. 运行 `project-context check --project .`,先处理来源、批准或所有权 finding。
9
+ 3. 仍使用 renderer 1/2 的受管投影会被报告 stale;确认所有权后显式运行原 publish 命令升级到 renderer 3。
10
+ 4. 若脚本消费 dashboard JSON,确认其明确支持 View Model schema 3 和 source `deprecated` 状态。
11
+ 5. 运行项目自己的 `context:check`,与依赖和受管投影一起审查 diff。
12
+
13
+ 5. 来源搬迁或永久退役时,先登记替代来源并修订/重新批准所有当前引用,再 preview `deprecate-source`,最后用 preview 返回的 source object digest 显式写入并重新发布投影。
14
+
15
+ 旧 `1.0.0` RC reader 不支持 Contract schema 2,因此成功废弃来源后不能用旧 reader 继续维护该项目。升级不会自动迁移、接受来源变化、修改 item、批准知识、覆盖非受管文件或执行 Git。
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from "../src/project-context/cli.mjs";
3
+
4
+ const result = await runCli(process.argv.slice(2));
5
+ if (result.stdout) process.stdout.write(result.stdout);
6
+ if (result.stderr) process.stderr.write(result.stderr);
7
+ process.exitCode = result.exitCode;