frontend-project-context 1.3.0 → 1.6.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 (49) hide show
  1. package/CHANGELOG.md +39 -2
  2. package/README.md +94 -16
  3. package/UPGRADING.md +47 -2
  4. package/docs/04-PROGRAM-DESIGN.md +40 -4
  5. package/docs/05-ACCEPTANCE-CONTRACT.md +33 -3
  6. package/docs/08-INSTALLATION-AND-DISTRIBUTION.md +36 -6
  7. package/docs/14-FORMAL-RELEASE-READINESS.md +46 -0
  8. package/docs/18-BRANCH-AWARE-STAGED-CONTEXT-DESIGN.md +62 -2
  9. package/docs/19-POST-1.3.1-AI-TAKEOVER-EVIDENCE-AND-UPGRADE-PLAN.md +579 -0
  10. package/docs/20-PHASE-A-AI-TAKEOVER-AND-HEALTH-CLOSURE-DESIGN.md +535 -0
  11. package/docs/21-PHASE-B-EVIDENCE-FEEDBACK-PROTOCOL-DESIGN.md +347 -0
  12. package/docs/22-PHASE-C-TARGET-UPGRADE-PROTOCOL-DESIGN.md +398 -0
  13. package/docs/README.md +21 -5
  14. package/docs/USER-AND-AI-OPERATION-MANUAL.md +797 -0
  15. package/examples/README.md +38 -0
  16. package/examples/package.json +6 -2
  17. package/migration-manifest.json +88 -0
  18. package/package.json +3 -2
  19. package/schemas/action-plan.schema.json +31 -3
  20. package/schemas/capabilities.schema.json +50 -18
  21. package/schemas/evidence-bundle.schema.json +64 -0
  22. package/schemas/evidence-input.schema.json +82 -0
  23. package/schemas/migration-manifest.schema.json +29 -0
  24. package/schemas/migration-plan.schema.json +32 -0
  25. package/schemas/project-status.schema.json +75 -0
  26. package/schemas/projection-lock.schema.json +48 -0
  27. package/schemas/review-bundle.schema.json +3 -3
  28. package/schemas/upgrade-assessment.schema.json +48 -0
  29. package/schemas/upgrade-result-bundle.schema.json +35 -0
  30. package/src/project-context/ai-entry.mjs +320 -0
  31. package/src/project-context/capabilities.mjs +44 -17
  32. package/src/project-context/checker.mjs +20 -3
  33. package/src/project-context/cli.mjs +84 -7
  34. package/src/project-context/contract-schema.mjs +30 -16
  35. package/src/project-context/dashboard-model.mjs +4 -4
  36. package/src/project-context/dashboard-renderer.mjs +3 -3
  37. package/src/project-context/discovery.mjs +6 -1
  38. package/src/project-context/evidence-schema.mjs +209 -0
  39. package/src/project-context/evidence.mjs +99 -0
  40. package/src/project-context/exchange-schema.mjs +21 -11
  41. package/src/project-context/exchange.mjs +26 -4
  42. package/src/project-context/maintenance.mjs +2 -2
  43. package/src/project-context/migration-manifest.mjs +166 -0
  44. package/src/project-context/project-status.mjs +157 -0
  45. package/src/project-context/projection-store.mjs +8 -1
  46. package/src/project-context/task-context-schema.mjs +237 -1
  47. package/src/project-context/task-context.mjs +154 -13
  48. package/src/project-context/upgrade-schema.mjs +215 -0
  49. package/src/project-context/upgrade.mjs +494 -0
@@ -8,6 +8,15 @@
8
8
  npm run context:setup -- --id my-project --name "My Project" --write --json
9
9
  ```
10
10
 
11
+ 为完全新窗口写入稳定入口并查询治理健康:
12
+
13
+ ```bash
14
+ npm run context:entry -- --write --json
15
+ npm run context:status -- --json
16
+ ```
17
+
18
+ 入口只拥有 `AGENTS.md` 标记区域;区域外人工内容可继续维护。首次写入会把 projection lock 从 schema 1 延迟升级为 schema 2,回退约束见根目录 `migration-manifest.json`。
19
+
11
20
  日常维护时生成只读变化工作单元:
12
21
 
13
22
  ```bash
@@ -21,6 +30,35 @@ npm run context:capabilities -- --json
21
30
  npm run context:preflight -- --plan .project-context/action-plan.json --json
22
31
  ```
23
32
 
33
+ 采用分阶段上下文协议时,宿主必须把每份前序 Stage Receipt 与生成该 receipt 的 Stage Context Bundle 成对传入:
34
+
35
+ ```bash
36
+ npx project-context stage-context --project . --plan task-context-plan.json --stage stage-render \
37
+ --receipt stage-understand.receipt.json --receipt-bundle stage-understand.bundle.json --json
38
+ npx project-context integration-review --project . --plan task-context-plan.json \
39
+ --receipt stage-understand.receipt.json --receipt-bundle stage-understand.bundle.json --json
40
+ ```
41
+
42
+ 两条命令都会重建 receipt 的输入 Bundle;缺失、重复、错配、篡改、过期 baseline、blocked bundle 或不完整依赖链均失败封闭,且不会创建 task store、读取 Git 或执行任务。
43
+
44
+ 如需把一次已经脱敏的目标项目观察交给人审查,先按 Evidence Input schema 1 准备项目内 JSON,再运行:
45
+
46
+ ```bash
47
+ npm run context:evidence -- --input evidence-input.json --json
48
+ ```
49
+
50
+ 输出只到 stdout,永远标记 `human-review-required`,不会保存或上传。人工仍需检查两个自由文本 summary,再决定是否转交。
51
+
52
+ Host 在产品边界外把依赖和 lockfile 固定到精确目标版本后,可生成短生命周期 assessment、单步 plan,并先 preview:
53
+
54
+ ```bash
55
+ npm run context:upgrade-check -- --from-version 1.5.0 --json
56
+ npx project-context upgrade-plan --project . --assessment .project-context/upgrade-assessment.json --json
57
+ npx project-context upgrade-apply --project . --plan .project-context/migration-plan.json --json
58
+ ```
59
+
60
+ 只有人审查精确 plan 后才可为最后一条命令增加 `--write`。每次只执行一个产品自有迁移单元;包管理器、Git、项目测试、独立新窗口复核和临时工件清理由 Host 负责。
61
+
24
62
  团队和 CI 的只读 Gate:
25
63
 
26
64
  ```bash
@@ -7,9 +7,13 @@
7
7
  "context:dashboard": "project-context dashboard --project .",
8
8
  "context:sync": "project-context sync --project .",
9
9
  "context:capabilities": "project-context capabilities --project .",
10
- "context:preflight": "project-context preflight --project ."
10
+ "context:evidence": "project-context evidence --project .",
11
+ "context:status": "project-context status --project .",
12
+ "context:entry": "project-context publish-entry --project . --output AGENTS.md",
13
+ "context:preflight": "project-context preflight --project .",
14
+ "context:upgrade-check": "project-context upgrade-check --project ."
11
15
  },
12
16
  "devDependencies": {
13
- "frontend-project-context": "1.2.0"
17
+ "frontend-project-context": "1.6.0"
14
18
  }
15
19
  }
@@ -0,0 +1,88 @@
1
+ {
2
+ "acceptanceCommands": ["npm run check", "project-context status --project . --json"],
3
+ "builtInMigrations": [
4
+ {
5
+ "id": "upgrade.republish-ai-entry.v1",
6
+ "input": {"beforeDigestRequired": true, "schemaVersions": [1, 2]},
7
+ "kind": "republish-ai-entry",
8
+ "reverseMigrationId": null,
9
+ "rollbackClass": "forward-only",
10
+ "targetType": "ai-entry",
11
+ "writes": true
12
+ },
13
+ {
14
+ "id": "upgrade.republish-projection.v1",
15
+ "input": {"beforeDigestRequired": true, "schemaVersions": [1, 2]},
16
+ "kind": "republish-projection",
17
+ "reverseMigrationId": null,
18
+ "rollbackClass": "forward-only",
19
+ "targetType": "projection",
20
+ "writes": true
21
+ }
22
+ ],
23
+ "consumerChanges": {
24
+ "actionPlan": {"reason": "Action Plan schema 1 and 2 readers remain compatible; writers remain schema 2.", "state": "preserve"},
25
+ "capabilities": {"reason": "Consumers must branch on capabilities schema 4 and exchange protocol 4.", "state": "regenerate"},
26
+ "evidenceBundle": {"reason": "Evidence Bundle schema 1 remains readable and separate from upgrade results.", "state": "preserve"},
27
+ "evidenceInput": {"reason": "Evidence Input schema 1 remains readable and is never rewritten by upgrade.", "state": "preserve"},
28
+ "exchange": {"reason": "Exchange protocol capability metadata changes to version 4.", "state": "regenerate"},
29
+ "integrationReviewBundle": {"reason": "Short-lived integration review bundles must be regenerated against current baselines.", "state": "regenerate"},
30
+ "reviewBundle": {"reason": "Review Bundle schema 2 remains readable but short-lived reviews must be regenerated when their baselines change.", "state": "regenerate"},
31
+ "stageContextBundle": {"reason": "Short-lived stage context bundles must be regenerated against current receipts.", "state": "regenerate"},
32
+ "stageReceipt": {"reason": "Existing receipts remain evidence but do not grant next-stage or upgrade authority.", "state": "preserve"},
33
+ "taskContextPlan": {"reason": "Short-lived task plans must be regenerated when their project baselines change.", "state": "regenerate"}
34
+ },
35
+ "externalEffects": {"automaticUpgrade": false, "businessCode": false, "git": false, "network": false, "packageManager": false, "projectTests": false},
36
+ "manifestDigest": "sha256:071f7461ae5669a6d78657bb81ec019a5508919a8f2de8640ba48eaec1343101",
37
+ "package": {"name": "frontend-project-context", "version": "1.6.0"},
38
+ "paths": [
39
+ {
40
+ "acceptance": ["project-context-clean", "target-renderers-current"],
41
+ "classification": "package-only",
42
+ "fromVersion": "1.3.1",
43
+ "migrationIds": ["upgrade.republish-ai-entry.v1", "upgrade.republish-projection.v1"],
44
+ "requiresHumanReview": false,
45
+ "rollbackClass": "package-only"
46
+ },
47
+ {
48
+ "acceptance": ["project-context-clean", "target-renderers-current"],
49
+ "classification": "package-only",
50
+ "fromVersion": "1.4.0",
51
+ "migrationIds": ["upgrade.republish-ai-entry.v1", "upgrade.republish-projection.v1"],
52
+ "requiresHumanReview": false,
53
+ "rollbackClass": "package-only"
54
+ },
55
+ {
56
+ "acceptance": ["project-context-clean", "target-renderers-current"],
57
+ "classification": "package-only",
58
+ "fromVersion": "1.5.0",
59
+ "migrationIds": ["upgrade.republish-ai-entry.v1", "upgrade.republish-projection.v1"],
60
+ "requiresHumanReview": false,
61
+ "rollbackClass": "package-only"
62
+ }
63
+ ],
64
+ "protocols": {
65
+ "actionPlan": {"readable": [1, 2], "written": 2},
66
+ "evidenceBundle": {"readable": [1], "written": 1},
67
+ "evidenceInput": {"readable": [1], "written": 1},
68
+ "exchange": {"readable": [4], "written": 4},
69
+ "integrationReviewBundle": {"readable": [1], "written": 1},
70
+ "reviewBundle": {"readable": [1, 2], "written": 2},
71
+ "stageContextBundle": {"readable": [1], "written": 1},
72
+ "stageReceipt": {"readable": [1], "written": 1},
73
+ "taskContextPlan": {"readable": [1], "written": 1}
74
+ },
75
+ "renderers": {
76
+ "aiEntry": {"readable": [1], "written": 1},
77
+ "projection": {"readable": [1, 2, 3], "written": 3}
78
+ },
79
+ "rollback": {"automatic": false, "defaultClass": "package-only", "externalRestoreRequired": true},
80
+ "schemaVersion": 2,
81
+ "stores": {
82
+ "contract": {"readable": [1, 2], "written": [1, 2]},
83
+ "projectionLock": {"readable": [1, 2], "written": [1, 2]},
84
+ "proposal": {"readable": [1], "written": [1]},
85
+ "sourceLock": {"readable": [1], "written": [1]}
86
+ },
87
+ "upgradeFrom": ["1.3.1", "1.4.0", "1.5.0"]
88
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frontend-project-context",
3
- "version": "1.3.0",
3
+ "version": "1.6.0",
4
4
  "description": "Govern, compile, and verify project-local context for AI coding tools.",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -16,6 +16,7 @@
16
16
  "schemas/",
17
17
  "docs/",
18
18
  "examples/",
19
+ "migration-manifest.json",
19
20
  "CHANGELOG.md",
20
21
  "UPGRADING.md",
21
22
  "LICENSE",
@@ -26,7 +27,7 @@
26
27
  },
27
28
  "scripts": {
28
29
  "check": "node --check bin/project-context.mjs && npm test",
29
- "test": "node --test test/project-context/acceptance.test.mjs test/project-context/assist.test.mjs test/project-context/cli.test.mjs test/project-context/dashboard.test.mjs test/project-context/exchange.test.mjs test/project-context/maintenance.test.mjs test/project-context/source-lifecycle.test.mjs test/project-context/task-context.test.mjs test/release/acceptance.test.mjs",
30
+ "test": "node --test test/project-context/acceptance.test.mjs test/project-context/assist.test.mjs test/project-context/cli.test.mjs test/project-context/dashboard.test.mjs test/project-context/evidence.test.mjs test/project-context/exchange.test.mjs test/project-context/maintenance.test.mjs test/project-context/source-lifecycle.test.mjs test/project-context/task-context.test.mjs test/project-context/takeover.test.mjs test/project-context/upgrade.test.mjs test/release/acceptance.test.mjs",
30
31
  "prepack": "npm run check"
31
32
  },
32
33
  "engines": {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "urn:frontend-project-context:schema:action-plan:1",
3
+ "$id": "urn:frontend-project-context:schema:action-plan:2",
4
4
  "title": "Frontend Project Context Action Plan",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
7
  "required": ["schemaVersion", "projectId", "baselines", "actions"],
8
8
  "properties": {
9
- "schemaVersion": { "const": 1 },
9
+ "schemaVersion": { "enum": [1, 2] },
10
10
  "projectId": { "$ref": "#/$defs/id" },
11
11
  "baselines": { "$ref": "#/$defs/baselines" },
12
12
  "actions": {
@@ -21,7 +21,9 @@
21
21
  { "$ref": "#/$defs/deprecateItem" },
22
22
  { "$ref": "#/$defs/deprecateSource" },
23
23
  { "$ref": "#/$defs/requestItemApproval" },
24
- { "$ref": "#/$defs/publishProjection" }
24
+ { "$ref": "#/$defs/publishProjection" },
25
+ { "$ref": "#/$defs/publishAiEntry" },
26
+ { "$ref": "#/$defs/removeAiEntry" }
25
27
  ]
26
28
  }
27
29
  }
@@ -226,6 +228,32 @@
226
228
  }
227
229
  }
228
230
  },
231
+ "entryActionInput": {
232
+ "type": "object",
233
+ "additionalProperties": false,
234
+ "required": ["output"],
235
+ "properties": { "output": { "$ref": "#/$defs/path" } }
236
+ },
237
+ "publishAiEntry": {
238
+ "type": "object",
239
+ "additionalProperties": false,
240
+ "required": ["id", "kind", "input"],
241
+ "properties": {
242
+ "id": { "$ref": "#/$defs/id" },
243
+ "kind": { "const": "publish-ai-entry" },
244
+ "input": { "$ref": "#/$defs/entryActionInput" }
245
+ }
246
+ },
247
+ "removeAiEntry": {
248
+ "type": "object",
249
+ "additionalProperties": false,
250
+ "required": ["id", "kind", "input"],
251
+ "properties": {
252
+ "id": { "$ref": "#/$defs/id" },
253
+ "kind": { "const": "remove-ai-entry" },
254
+ "input": { "$ref": "#/$defs/entryActionInput" }
255
+ }
256
+ },
229
257
  "publishProjection": {
230
258
  "type": "object",
231
259
  "additionalProperties": false,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "urn:frontend-project-context:schema:capabilities:1",
3
+ "$id": "urn:frontend-project-context:schema:capabilities:4",
4
4
  "title": "Frontend Project Context Capabilities",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
@@ -18,17 +18,17 @@
18
18
  "boundaries"
19
19
  ],
20
20
  "properties": {
21
- "schemaVersion": { "const": 1 },
21
+ "schemaVersion": { "const": 4 },
22
22
  "package": {
23
23
  "type": "object",
24
24
  "additionalProperties": false,
25
25
  "required": ["name", "version"],
26
26
  "properties": {
27
27
  "name": { "const": "frontend-project-context" },
28
- "version": { "type": "string" }
28
+ "version": { "const": "1.6.0" }
29
29
  }
30
30
  },
31
- "exchangeProtocolVersion": { "const": 1 },
31
+ "exchangeProtocolVersion": { "const": 4 },
32
32
  "schemas": {
33
33
  "type": "object",
34
34
  "additionalProperties": false,
@@ -38,38 +38,58 @@
38
38
  "capabilities",
39
39
  "contract",
40
40
  "dashboardViewModel",
41
+ "evidenceBundle",
42
+ "evidenceInput",
41
43
  "integrationReviewBundle",
42
44
  "projectionLock",
45
+ "projectionLockReadable",
46
+ "projectionLockWritten",
43
47
  "projectionRenderer",
44
48
  "proposal",
49
+ "projectStatus",
50
+ "aiEntryRenderer",
51
+ "migrationManifest",
52
+ "migrationPlan",
45
53
  "reviewBundle",
46
54
  "sourceLock",
47
55
  "stageContextBundle",
48
56
  "stageReceipt",
49
- "taskContextPlan"
57
+ "taskContextPlan",
58
+ "upgradeAssessment",
59
+ "upgradeResultBundle"
50
60
  ],
51
61
  "properties": {
52
- "actionPlan": { "const": 1 },
62
+ "actionPlan": { "const": 2 },
53
63
  "assistBundle": { "const": 1 },
54
- "capabilities": { "const": 1 },
55
- "contract": { "type": "integer" },
64
+ "capabilities": { "const": 4 },
65
+ "contract": { "const": 2 },
56
66
  "dashboardViewModel": { "type": "integer" },
67
+ "evidenceBundle": { "const": 1 },
68
+ "evidenceInput": { "const": 1 },
57
69
  "integrationReviewBundle": { "const": 1 },
58
- "projectionLock": { "type": "integer" },
70
+ "projectionLock": { "const": 2 },
71
+ "projectionLockReadable": { "const": [1, 2] },
72
+ "projectionLockWritten": { "enum": [1, 2] },
59
73
  "projectionRenderer": { "type": "integer" },
60
- "proposal": { "type": "integer" },
61
- "reviewBundle": { "const": 1 },
62
- "sourceLock": { "type": "integer" },
74
+ "proposal": { "const": 1 },
75
+ "projectStatus": { "const": 1 },
76
+ "aiEntryRenderer": { "const": 1 },
77
+ "migrationManifest": { "const": 2 },
78
+ "migrationPlan": { "const": 1 },
79
+ "reviewBundle": { "const": 2 },
80
+ "sourceLock": { "const": 1 },
63
81
  "stageContextBundle": { "const": 1 },
64
82
  "stageReceipt": { "const": 1 },
65
- "taskContextPlan": { "const": 1 }
83
+ "taskContextPlan": { "const": 1 },
84
+ "upgradeAssessment": { "const": 1 },
85
+ "upgradeResultBundle": { "const": 1 }
66
86
  }
67
87
  },
68
- "commands": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string" } },
88
+ "commands": { "type": "array", "minItems": 1, "uniqueItems": true, "allOf": [{"contains": {"const": "upgrade-check"}}, {"contains": {"const": "upgrade-plan"}}, {"contains": {"const": "upgrade-apply"}}], "items": { "type": "string" } },
69
89
  "actionKinds": {
70
90
  "type": "array",
71
- "minItems": 8,
72
- "maxItems": 8,
91
+ "minItems": 10,
92
+ "maxItems": 10,
73
93
  "uniqueItems": true,
74
94
  "items": {
75
95
  "enum": [
@@ -77,8 +97,10 @@
77
97
  "deprecate-item",
78
98
  "deprecate-source",
79
99
  "propose-item",
100
+ "publish-ai-entry",
80
101
  "publish-projection",
81
102
  "register-source",
103
+ "remove-ai-entry",
82
104
  "request-item-approval",
83
105
  "revise-item"
84
106
  ]
@@ -125,7 +147,12 @@
125
147
  "stagePathBodyReads",
126
148
  "applyPlan",
127
149
  "scheduler",
128
- "daemon"
150
+ "daemon",
151
+ "telemetry",
152
+ "selfUpdate",
153
+ "automaticEvidenceUpload",
154
+ "packageManager",
155
+ "automaticUpgrade"
129
156
  ],
130
157
  "properties": {
131
158
  "provider": { "const": false },
@@ -139,7 +166,12 @@
139
166
  "stagePathBodyReads": { "const": false },
140
167
  "applyPlan": { "const": false },
141
168
  "scheduler": { "const": false },
142
- "daemon": { "const": false }
169
+ "daemon": { "const": false },
170
+ "telemetry": { "const": false },
171
+ "selfUpdate": { "const": false },
172
+ "automaticEvidenceUpload": { "const": false },
173
+ "packageManager": { "const": false },
174
+ "automaticUpgrade": { "const": false }
143
175
  }
144
176
  }
145
177
  }
@@ -0,0 +1,64 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:frontend-project-context:schema:evidence-bundle:1",
4
+ "title": "Frontend Project Context Evidence Bundle",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "kind", "product", "capability", "result", "environment", "expected", "observed", "errorCodes", "reproduction", "artifacts", "redactions", "projectContext", "transfer", "boundaries", "bundleDigest"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "kind": { "const": "target-project-evidence" },
11
+ "product": {
12
+ "type": "object",
13
+ "additionalProperties": false,
14
+ "required": ["name", "version", "exchangeProtocolVersion"],
15
+ "properties": {
16
+ "name": { "const": "frontend-project-context" },
17
+ "version": { "const": "1.6.0" },
18
+ "exchangeProtocolVersion": { "const": 3 }
19
+ }
20
+ },
21
+ "capability": { "enum": ["setup", "takeover", "maintenance", "staged-context", "upgrade", "other-protocol"] },
22
+ "result": { "$ref": "evidence-input.schema.json#/$defs/result" },
23
+ "environment": { "$ref": "evidence-input.schema.json#/properties/environment" },
24
+ "expected": { "$ref": "evidence-input.schema.json#/$defs/observation" },
25
+ "observed": { "$ref": "evidence-input.schema.json#/$defs/observation" },
26
+ "errorCodes": { "$ref": "evidence-input.schema.json#/$defs/codes" },
27
+ "reproduction": { "$ref": "evidence-input.schema.json#/properties/reproduction" },
28
+ "artifacts": { "$ref": "evidence-input.schema.json#/properties/artifacts" },
29
+ "redactions": { "$ref": "evidence-input.schema.json#/properties/redactions" },
30
+ "projectContext": {
31
+ "type": "object",
32
+ "additionalProperties": false,
33
+ "required": ["initialization", "health", "entryState", "findingCodes", "schemas"],
34
+ "properties": {
35
+ "initialization": { "enum": ["uninitialized", "partial", "invalid", "initialized"] },
36
+ "health": { "enum": ["uninitialized", "partial", "invalid", "attention", "clean", "conflict"] },
37
+ "entryState": { "enum": ["absent", "current", "stale", "conflict"] },
38
+ "findingCodes": { "$ref": "evidence-input.schema.json#/$defs/codes" },
39
+ "schemas": {
40
+ "type": "object",
41
+ "additionalProperties": false,
42
+ "required": ["contract", "sourcesLock", "projectionsLock"],
43
+ "properties": {
44
+ "contract": { "const": 2 },
45
+ "sourcesLock": { "const": 1 },
46
+ "projectionsLock": { "const": 2 }
47
+ }
48
+ }
49
+ }
50
+ },
51
+ "transfer": {
52
+ "type": "object",
53
+ "additionalProperties": false,
54
+ "required": ["state", "automaticUpload", "destination"],
55
+ "properties": {
56
+ "state": { "const": "human-review-required" },
57
+ "automaticUpload": { "const": false },
58
+ "destination": { "type": "null" }
59
+ }
60
+ },
61
+ "boundaries": { "$ref": "capabilities.schema.json#/properties/boundaries" },
62
+ "bundleDigest": { "$ref": "evidence-input.schema.json#/$defs/digest" }
63
+ }
64
+ }
@@ -0,0 +1,82 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:frontend-project-context:schema:evidence-input:1",
4
+ "title": "Frontend Project Context Evidence Input",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "capability", "result", "environment", "expected", "observed", "errorCodes", "reproduction", "artifacts", "redactions"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "capability": { "enum": ["setup", "takeover", "maintenance", "staged-context", "upgrade", "other-protocol"] },
11
+ "result": { "$ref": "#/$defs/result" },
12
+ "environment": {
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "required": ["runtime", "runtimeMajor", "packageManager", "projectShape"],
16
+ "properties": {
17
+ "runtime": { "enum": ["node", "other", "redacted"] },
18
+ "runtimeMajor": { "type": "integer", "minimum": 0, "maximum": 999 },
19
+ "packageManager": { "enum": ["npm", "pnpm", "yarn", "bun", "other", "redacted"] },
20
+ "projectShape": { "enum": ["single", "monorepo", "multi-context", "redacted"] }
21
+ }
22
+ },
23
+ "expected": { "$ref": "#/$defs/observation" },
24
+ "observed": { "$ref": "#/$defs/observation" },
25
+ "errorCodes": { "$ref": "#/$defs/codes" },
26
+ "reproduction": {
27
+ "type": "array",
28
+ "maxItems": 20,
29
+ "items": {
30
+ "type": "object",
31
+ "additionalProperties": false,
32
+ "required": ["operation", "outcome", "findingCodes"],
33
+ "properties": {
34
+ "operation": { "enum": ["capabilities", "status", "setup-preview", "sync", "check", "context", "preflight", "stage-context", "integration-review", "publish-entry-preview", "remove-entry-preview", "upgrade-baseline", "other-protocol"] },
35
+ "outcome": { "$ref": "#/$defs/result" },
36
+ "findingCodes": { "$ref": "#/$defs/codes" }
37
+ }
38
+ }
39
+ },
40
+ "artifacts": {
41
+ "type": "array",
42
+ "maxItems": 32,
43
+ "items": {
44
+ "type": "object",
45
+ "additionalProperties": false,
46
+ "required": ["kind", "digest"],
47
+ "properties": {
48
+ "kind": { "$ref": "#/$defs/id" },
49
+ "digest": { "$ref": "#/$defs/digest" }
50
+ }
51
+ }
52
+ },
53
+ "redactions": {
54
+ "type": "array",
55
+ "maxItems": 32,
56
+ "items": {
57
+ "type": "object",
58
+ "additionalProperties": false,
59
+ "required": ["field", "method"],
60
+ "properties": {
61
+ "field": { "type": "string", "pattern": "^[a-z][A-Za-z0-9]*(\\.[a-z][A-Za-z0-9]*)*$" },
62
+ "method": { "enum": ["removed", "generalized", "hashed", "redacted", "not-collected"] }
63
+ }
64
+ }
65
+ }
66
+ },
67
+ "$defs": {
68
+ "id": { "type": "string", "pattern": "^[a-z0-9]+([.-][a-z0-9]+)*$" },
69
+ "digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
70
+ "result": { "enum": ["passed", "degraded", "blocked", "failed"] },
71
+ "codes": { "type": "array", "maxItems": 32, "items": { "$ref": "#/$defs/id" } },
72
+ "observation": {
73
+ "type": "object",
74
+ "additionalProperties": false,
75
+ "required": ["code", "summary"],
76
+ "properties": {
77
+ "code": { "$ref": "#/$defs/id" },
78
+ "summary": { "type": "string", "minLength": 1, "maxLength": 500, "pattern": "^[^\\r\\n\\u2028\\u2029]+$" }
79
+ }
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:frontend-project-context:schema:migration-manifest:2",
4
+ "title": "Frontend Project Context Migration Manifest",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "package", "upgradeFrom", "stores", "renderers", "protocols", "paths", "builtInMigrations", "consumerChanges", "acceptanceCommands", "rollback", "externalEffects", "manifestDigest"],
8
+ "properties": {
9
+ "schemaVersion": {"const": 2},
10
+ "package": {"type": "object", "additionalProperties": false, "required": ["name", "version"], "properties": {"name": {"const": "frontend-project-context"}, "version": {"const": "1.6.0"}}},
11
+ "upgradeFrom": {"const": ["1.3.1", "1.4.0", "1.5.0"]},
12
+ "stores": {"type": "object", "additionalProperties": false, "required": ["contract", "projectionLock", "proposal", "sourceLock"], "properties": {"contract": {"$ref": "#/$defs/versionMatrix"}, "projectionLock": {"$ref": "#/$defs/versionMatrix"}, "proposal": {"$ref": "#/$defs/versionMatrix"}, "sourceLock": {"$ref": "#/$defs/versionMatrix"}}},
13
+ "renderers": {"type": "object", "additionalProperties": false, "required": ["aiEntry", "projection"], "properties": {"aiEntry": {"$ref": "#/$defs/versionTarget"}, "projection": {"$ref": "#/$defs/versionTarget"}}},
14
+ "protocols": {"type": "object", "additionalProperties": {"$ref": "#/$defs/versionTarget"}},
15
+ "paths": {"type": "array", "minItems": 3, "maxItems": 3, "items": {"type": "object", "additionalProperties": false, "required": ["fromVersion", "classification", "migrationIds", "requiresHumanReview", "rollbackClass", "acceptance"], "properties": {"fromVersion": {"enum": ["1.3.1", "1.4.0", "1.5.0"]}, "classification": {"enum": ["package-only", "republish-ai-entry", "republish-projection", "built-in-store-migration", "invalidate-ephemeral-protocol"]}, "migrationIds": {"$ref": "#/$defs/strings"}, "requiresHumanReview": {"type": "boolean"}, "rollbackClass": {"$ref": "#/$defs/rollbackClass"}, "acceptance": {"$ref": "#/$defs/strings"}}}},
16
+ "builtInMigrations": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["id", "kind", "input", "targetType", "writes", "rollbackClass", "reverseMigrationId"], "properties": {"id": {"type": "string"}, "kind": {"enum": ["package-only", "republish-ai-entry", "republish-projection", "built-in-store-migration", "invalidate-ephemeral-protocol"]}, "input": {"type": "object", "additionalProperties": false, "required": ["schemaVersions", "beforeDigestRequired"], "properties": {"schemaVersions": {"type": "array", "items": {"type": "integer", "minimum": 1}}, "beforeDigestRequired": {"type": "boolean"}}}, "targetType": {"enum": ["none", "ai-entry", "projection", "store", "ephemeral-protocol"]}, "writes": {"type": "boolean"}, "rollbackClass": {"$ref": "#/$defs/rollbackClass"}, "reverseMigrationId": {"type": ["string", "null"]}}}},
17
+ "consumerChanges": {"type": "object", "additionalProperties": {"type": "object", "additionalProperties": false, "required": ["state", "reason"], "properties": {"state": {"enum": ["preserve", "regenerate", "invalidate"]}, "reason": {"type": "string"}}}},
18
+ "acceptanceCommands": {"$ref": "#/$defs/strings"},
19
+ "rollback": {"type": "object", "additionalProperties": false, "required": ["defaultClass", "externalRestoreRequired", "automatic"], "properties": {"defaultClass": {"$ref": "#/$defs/rollbackClass"}, "externalRestoreRequired": {"type": "boolean"}, "automatic": {"const": false}}},
20
+ "externalEffects": {"type": "object", "additionalProperties": false, "required": ["packageManager", "network", "git", "projectTests", "businessCode", "automaticUpgrade"], "properties": {"packageManager": {"const": false}, "network": {"const": false}, "git": {"const": false}, "projectTests": {"const": false}, "businessCode": {"const": false}, "automaticUpgrade": {"const": false}}},
21
+ "manifestDigest": {"type": "string", "pattern": "^sha256:[a-f0-9]{64}$"}
22
+ },
23
+ "$defs": {
24
+ "strings": {"type": "array", "uniqueItems": true, "items": {"type": "string"}},
25
+ "rollbackClass": {"enum": ["package-only", "reversible-data", "forward-only"]},
26
+ "versionMatrix": {"type": "object", "additionalProperties": false, "required": ["readable", "written"], "properties": {"readable": {"type": "array", "uniqueItems": true, "items": {"type": "integer", "minimum": 1}}, "written": {"type": "array", "uniqueItems": true, "items": {"type": "integer", "minimum": 1}}}},
27
+ "versionTarget": {"type": "object", "additionalProperties": false, "required": ["readable", "written"], "properties": {"readable": {"type": "array", "uniqueItems": true, "items": {"type": "integer", "minimum": 1}}, "written": {"type": "integer", "minimum": 1}}}
28
+ }
29
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:frontend-project-context:schema:migration-plan:1",
4
+ "title": "Frontend Project Context Migration Plan",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "kind", "fromVersion", "targetVersion", "manifestDigest", "assessmentDigest", "snapshots", "targetDigests", "nextAction", "remainingMigrationIds", "acceptance", "rollback", "requiresHumanReview", "authority", "planDigest"],
8
+ "properties": {
9
+ "schemaVersion": {"const": 1},
10
+ "kind": {"const": "target-upgrade-plan"},
11
+ "fromVersion": {"enum": ["1.3.1", "1.4.0", "1.5.0"]},
12
+ "targetVersion": {"const": "1.6.0"},
13
+ "manifestDigest": {"$ref": "#/$defs/digest"},
14
+ "assessmentDigest": {"$ref": "#/$defs/digest"},
15
+ "snapshots": {"anyOf": [{"type": "null"}, {"$ref": "#/$defs/snapshots"}]},
16
+ "targetDigests": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["path", "beforeDigest"], "properties": {"path": {"$ref": "#/$defs/path"}, "beforeDigest": {"anyOf": [{"type": "null"}, {"$ref": "#/$defs/digest"}]}}}},
17
+ "nextAction": {"$ref": "#/$defs/action"},
18
+ "remainingMigrationIds": {"$ref": "#/$defs/strings"},
19
+ "acceptance": {"type": "object", "additionalProperties": false, "required": ["core", "hostRequired"], "properties": {"core": {"$ref": "#/$defs/strings"}, "hostRequired": {"$ref": "#/$defs/strings"}}},
20
+ "rollback": {"type": "object", "additionalProperties": false, "required": ["class", "reverseMigrationId", "externalRestoreRequired"], "properties": {"class": {"enum": ["package-only", "reversible-data", "forward-only"]}, "reverseMigrationId": {"type": ["string", "null"]}, "externalRestoreRequired": {"type": "boolean"}}},
21
+ "requiresHumanReview": {"type": "boolean"},
22
+ "authority": {"const": "human-explicit-write-required"},
23
+ "planDigest": {"$ref": "#/$defs/digest"}
24
+ },
25
+ "$defs": {
26
+ "digest": {"type": "string", "pattern": "^sha256:[a-f0-9]{64}$"},
27
+ "strings": {"type": "array", "uniqueItems": true, "items": {"type": "string"}},
28
+ "snapshots": {"type": "object", "additionalProperties": false, "required": ["contract", "sourcesLock", "projectionsLock"], "properties": {"contract": {"$ref": "#/$defs/digest"}, "sourcesLock": {"$ref": "#/$defs/digest"}, "projectionsLock": {"$ref": "#/$defs/digest"}}},
29
+ "path": {"type": "string", "minLength": 1, "pattern": "^(?!/)(?![A-Za-z]:)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\).+$"},
30
+ "action": {"type": "object", "additionalProperties": false, "required": ["id", "kind", "migrationId", "targets", "writes", "semanticImpact"], "properties": {"id": {"type": "string"}, "kind": {"enum": ["verify-complete", "republish-ai-entry", "republish-projection", "built-in-store-migration", "invalidate-ephemeral-protocol"]}, "migrationId": {"type": ["string", "null"]}, "targets": {"type": "array", "uniqueItems": true, "items": {"$ref": "#/$defs/path"}}, "writes": {"type": "boolean"}, "semanticImpact": {"enum": ["none", "managed-rendering", "store-structure", "protocol-artifact-invalidation"]}}}
31
+ }
32
+ }