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
@@ -0,0 +1,109 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:frontend-project-context:schema:review-bundle:1",
4
+ "title": "Frontend Project Context Review Bundle",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "projectId", "planDigest", "baselines", "status", "summary", "actions", "groups", "findings", "invocations"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "projectId": { "$ref": "#/$defs/id" },
11
+ "planDigest": { "$ref": "#/$defs/digest" },
12
+ "baselines": { "$ref": "#/$defs/baselines" },
13
+ "status": { "enum": ["reviewable", "blocked"] },
14
+ "summary": {
15
+ "type": "object",
16
+ "additionalProperties": false,
17
+ "required": ["actions", "reviewable", "blocked", "groups"],
18
+ "properties": {
19
+ "actions": { "type": "integer", "minimum": 1 },
20
+ "reviewable": { "type": "integer", "minimum": 0 },
21
+ "blocked": { "type": "integer", "minimum": 0 },
22
+ "groups": { "type": "integer", "minimum": 1 }
23
+ }
24
+ },
25
+ "actions": {
26
+ "type": "array",
27
+ "minItems": 1,
28
+ "items": {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "required": ["id", "kind", "status", "current", "proposed", "baselines", "impact", "blockers", "humanApprovalRequired"],
32
+ "properties": {
33
+ "id": { "$ref": "#/$defs/id" },
34
+ "kind": { "$ref": "#/$defs/actionKind" },
35
+ "status": { "enum": ["reviewable", "blocked"] },
36
+ "current": {},
37
+ "proposed": {},
38
+ "baselines": { "type": "object" },
39
+ "impact": {
40
+ "type": "object",
41
+ "required": ["itemIds", "sourceIds", "paths", "projectionPaths"],
42
+ "properties": {
43
+ "itemIds": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
44
+ "sourceIds": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
45
+ "paths": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
46
+ "projectionPaths": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
47
+ "directProjectionPaths": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }
48
+ },
49
+ "additionalProperties": false
50
+ },
51
+ "blockers": { "type": "array", "items": { "type": "object" } },
52
+ "humanApprovalRequired": { "const": true },
53
+ "invocation": { "$ref": "#/$defs/invocation" }
54
+ }
55
+ }
56
+ },
57
+ "groups": {
58
+ "type": "array",
59
+ "minItems": 1,
60
+ "items": {
61
+ "type": "object",
62
+ "additionalProperties": false,
63
+ "required": ["kind", "actionIds"],
64
+ "properties": {
65
+ "kind": { "enum": ["source-change", "new-or-revised-knowledge", "deprecation", "approval-request", "projection", "blocker"] },
66
+ "actionIds": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/id" } }
67
+ }
68
+ }
69
+ },
70
+ "findings": { "type": "array", "items": { "type": "object" } },
71
+ "invocations": { "type": "array", "items": { "$ref": "#/$defs/invocationWithAction" } }
72
+ },
73
+ "$defs": {
74
+ "id": { "type": "string", "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)*$" },
75
+ "digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
76
+ "baselines": {
77
+ "type": "object",
78
+ "additionalProperties": false,
79
+ "required": ["contract", "sourcesLock", "projectionsLock"],
80
+ "properties": {
81
+ "contract": { "$ref": "#/$defs/digest" },
82
+ "sourcesLock": { "$ref": "#/$defs/digest" },
83
+ "projectionsLock": { "$ref": "#/$defs/digest" }
84
+ }
85
+ },
86
+ "actionKind": {
87
+ "enum": ["accept-source-change", "deprecate-item", "deprecate-source", "propose-item", "publish-projection", "register-source", "request-item-approval", "revise-item"]
88
+ },
89
+ "invocation": {
90
+ "type": "object",
91
+ "additionalProperties": false,
92
+ "required": ["command", "args"],
93
+ "properties": {
94
+ "command": { "type": "string" },
95
+ "args": { "type": "array", "items": { "type": "string" } }
96
+ }
97
+ },
98
+ "invocationWithAction": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["actionId", "command", "args"],
102
+ "properties": {
103
+ "actionId": { "$ref": "#/$defs/id" },
104
+ "command": { "type": "string" },
105
+ "args": { "type": "array", "items": { "type": "string" } }
106
+ }
107
+ }
108
+ }
109
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:frontend-project-context:schema:stage-context-bundle:1",
4
+ "title": "Frontend Project Context Stage Context Bundle",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "kind", "project", "task", "stage", "workspace", "planDigest", "snapshots", "dependencyReceipts", "changedPaths", "contractItems", "readTargets", "findings", "excluded", "budget", "status", "bundleDigest"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "kind": { "const": "stage-context-bundle" },
11
+ "project": { "$ref": "#/$defs/identity" },
12
+ "task": { "$ref": "#/$defs/task" },
13
+ "stage": { "$ref": "#/$defs/stage" },
14
+ "workspace": { "$ref": "#/$defs/workspace" },
15
+ "planDigest": { "$ref": "#/$defs/digest" },
16
+ "snapshots": { "$ref": "#/$defs/snapshots" },
17
+ "dependencyReceipts": { "type": "array", "items": { "$ref": "#/$defs/receiptSummary" } },
18
+ "changedPaths": { "$ref": "#/$defs/paths" },
19
+ "contractItems": { "type": "array", "items": { "$ref": "#/$defs/contractItem" } },
20
+ "readTargets": { "type": "array", "items": { "$ref": "#/$defs/readTarget" } },
21
+ "findings": { "type": "array", "items": { "type": "object" } },
22
+ "excluded": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
23
+ "budget": {
24
+ "type": "object",
25
+ "additionalProperties": false,
26
+ "required": ["unit", "maxUtf8Bytes", "maxReadTargets", "usedUtf8Bytes", "readTargetCount"],
27
+ "properties": {
28
+ "unit": { "const": "canonical-utf8-bytes" },
29
+ "maxUtf8Bytes": { "type": "integer", "minimum": 1 },
30
+ "maxReadTargets": { "type": "integer", "minimum": 1 },
31
+ "usedUtf8Bytes": { "type": "integer", "minimum": 0 },
32
+ "readTargetCount": { "type": "integer", "minimum": 0 }
33
+ }
34
+ },
35
+ "status": { "enum": ["ready", "blocked"] },
36
+ "bundleDigest": { "$ref": "#/$defs/digest" }
37
+ },
38
+ "$defs": {
39
+ "digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
40
+ "identity": { "type": "object", "additionalProperties": false, "required": ["id", "name"], "properties": { "id": { "$ref": "#/$defs/id" }, "name": { "$ref": "#/$defs/text" } } },
41
+ "id": { "type": "string", "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)*$" },
42
+ "text": { "type": "string", "minLength": 1 },
43
+ "paths": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
44
+ "snapshots": { "type": "object", "additionalProperties": false, "required": ["contract", "sourcesLock", "projectionsLock"], "properties": { "contract": { "$ref": "#/$defs/digest" }, "sourcesLock": { "$ref": "#/$defs/digest" }, "projectionsLock": { "$ref": "#/$defs/digest" } } },
45
+ "task": { "type": "object", "additionalProperties": false, "required": ["id", "title", "goal"], "properties": { "id": { "$ref": "#/$defs/id" }, "title": { "$ref": "#/$defs/text" }, "goal": { "$ref": "#/$defs/text" } } },
46
+ "acceptance": { "type": "object", "additionalProperties": false, "required": ["id", "text"], "properties": { "id": { "$ref": "#/$defs/id" }, "text": { "$ref": "#/$defs/text" } } },
47
+ "stage": { "type": "object", "additionalProperties": false, "required": ["id", "title", "objective", "acceptance", "paths"], "properties": { "id": { "$ref": "#/$defs/id" }, "title": { "$ref": "#/$defs/text" }, "objective": { "$ref": "#/$defs/text" }, "acceptance": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/acceptance" } }, "paths": { "$ref": "#/$defs/paths" } } },
48
+ "workspace": { "type": "object", "additionalProperties": false, "required": ["branchLabel", "baseRevision"], "properties": { "branchLabel": { "$ref": "#/$defs/text" }, "baseRevision": { "$ref": "#/$defs/text" } } },
49
+ "acceptanceResult": { "type": "object", "additionalProperties": false, "required": ["id", "status", "evidence"], "properties": { "id": { "$ref": "#/$defs/id" }, "status": { "enum": ["observed", "not-observed"] }, "evidence": { "$ref": "#/$defs/paths" } } },
50
+ "verificationResult": { "type": "object", "additionalProperties": false, "required": ["id", "status", "summary", "evidence"], "properties": { "id": { "$ref": "#/$defs/id" }, "status": { "enum": ["passed", "failed", "observed", "skipped"] }, "summary": { "$ref": "#/$defs/text" }, "evidence": { "$ref": "#/$defs/paths" } } },
51
+ "receiptSummary": { "type": "object", "additionalProperties": false, "required": ["stageId", "status", "inputBundleDigest", "changedPaths", "acceptanceResults", "verificationResults", "decisions", "openIssues"], "properties": { "stageId": { "$ref": "#/$defs/id" }, "status": { "enum": ["completed", "blocked"] }, "inputBundleDigest": { "$ref": "#/$defs/digest" }, "changedPaths": { "$ref": "#/$defs/paths" }, "acceptanceResults": { "type": "array", "items": { "$ref": "#/$defs/acceptanceResult" } }, "verificationResults": { "type": "array", "items": { "$ref": "#/$defs/verificationResult" } }, "decisions": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/text" } }, "openIssues": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/text" } } } },
52
+ "scope": { "type": "object", "additionalProperties": false, "required": ["kind"], "properties": { "kind": { "enum": ["project", "path-prefix", "file"] }, "path": { "type": "string", "minLength": 1 } } },
53
+ "contractItem": { "type": "object", "additionalProperties": false, "required": ["id", "kind", "subject", "value", "statement", "scope", "sourceIds"], "properties": { "id": { "$ref": "#/$defs/id" }, "kind": { "enum": ["fact", "policy", "reference", "validation-description"] }, "subject": { "$ref": "#/$defs/id" }, "value": {}, "statement": { "$ref": "#/$defs/text" }, "scope": { "$ref": "#/$defs/scope" }, "sourceIds": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/id" } } } },
54
+ "readTarget": { "type": "object", "additionalProperties": false, "required": ["path", "reason"], "properties": { "path": { "type": "string", "minLength": 1 }, "reason": { "enum": ["stage-scope", "host-changed-path-signal", "contract-source"] }, "sourceId": { "$ref": "#/$defs/id" } } }
55
+ }
56
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:frontend-project-context:schema:stage-receipt:1",
4
+ "title": "Frontend Project Context Stage Receipt",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "kind", "projectId", "taskId", "stageId", "planDigest", "inputBundleDigest", "status", "changedPaths", "acceptanceResults", "verificationResults", "decisions", "openIssues"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "kind": { "const": "stage-receipt" },
11
+ "projectId": { "$ref": "#/$defs/id" },
12
+ "taskId": { "$ref": "#/$defs/id" },
13
+ "stageId": { "$ref": "#/$defs/id" },
14
+ "planDigest": { "$ref": "#/$defs/digest" },
15
+ "inputBundleDigest": { "$ref": "#/$defs/digest" },
16
+ "status": { "enum": ["completed", "blocked"] },
17
+ "changedPaths": { "$ref": "#/$defs/paths" },
18
+ "acceptanceResults": {
19
+ "type": "array",
20
+ "items": {
21
+ "type": "object",
22
+ "additionalProperties": false,
23
+ "required": ["id", "status", "evidence"],
24
+ "properties": {
25
+ "id": { "$ref": "#/$defs/id" },
26
+ "status": { "enum": ["observed", "not-observed"] },
27
+ "evidence": { "$ref": "#/$defs/paths" }
28
+ }
29
+ }
30
+ },
31
+ "verificationResults": {
32
+ "type": "array",
33
+ "items": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["id", "status", "summary", "evidence"],
37
+ "properties": {
38
+ "id": { "$ref": "#/$defs/id" },
39
+ "status": { "enum": ["passed", "failed", "observed", "skipped"] },
40
+ "summary": { "type": "string", "minLength": 1 },
41
+ "evidence": { "$ref": "#/$defs/paths" }
42
+ }
43
+ }
44
+ },
45
+ "decisions": { "$ref": "#/$defs/texts" },
46
+ "openIssues": { "$ref": "#/$defs/texts" },
47
+ "nextStageId": { "$ref": "#/$defs/id" }
48
+ },
49
+ "$defs": {
50
+ "id": { "type": "string", "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)*$" },
51
+ "digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
52
+ "paths": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
53
+ "texts": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } }
54
+ }
55
+ }
@@ -0,0 +1,85 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:frontend-project-context:schema:task-context-plan:1",
4
+ "title": "Frontend Project Context Task Context Plan",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "kind", "projectId", "task", "workspace", "snapshots", "budget", "stages"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "kind": { "const": "task-context-plan" },
11
+ "projectId": { "$ref": "#/$defs/id" },
12
+ "task": {
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "required": ["id", "title", "goal", "acceptance"],
16
+ "properties": {
17
+ "id": { "$ref": "#/$defs/id" },
18
+ "title": { "$ref": "#/$defs/text" },
19
+ "goal": { "$ref": "#/$defs/text" },
20
+ "acceptance": {
21
+ "type": "array",
22
+ "minItems": 1,
23
+ "items": {
24
+ "type": "object",
25
+ "additionalProperties": false,
26
+ "required": ["id", "text"],
27
+ "properties": { "id": { "$ref": "#/$defs/id" }, "text": { "$ref": "#/$defs/text" } }
28
+ }
29
+ }
30
+ }
31
+ },
32
+ "workspace": {
33
+ "type": "object",
34
+ "additionalProperties": false,
35
+ "required": ["branchLabel", "baseRevision"],
36
+ "properties": { "branchLabel": { "$ref": "#/$defs/text" }, "baseRevision": { "$ref": "#/$defs/text" } }
37
+ },
38
+ "snapshots": { "$ref": "#/$defs/snapshots" },
39
+ "budget": {
40
+ "type": "object",
41
+ "additionalProperties": false,
42
+ "required": ["maxUtf8Bytes", "maxReadTargets"],
43
+ "properties": {
44
+ "maxUtf8Bytes": { "type": "integer", "minimum": 1 },
45
+ "maxReadTargets": { "type": "integer", "minimum": 1 }
46
+ }
47
+ },
48
+ "stages": {
49
+ "type": "array",
50
+ "minItems": 1,
51
+ "items": {
52
+ "type": "object",
53
+ "additionalProperties": false,
54
+ "required": ["id", "title", "objective", "dependsOn", "paths", "acceptanceIds"],
55
+ "properties": {
56
+ "id": { "$ref": "#/$defs/id" },
57
+ "title": { "$ref": "#/$defs/text" },
58
+ "objective": { "$ref": "#/$defs/text" },
59
+ "dependsOn": { "$ref": "#/$defs/ids" },
60
+ "paths": { "$ref": "#/$defs/paths" },
61
+ "acceptanceIds": { "$ref": "#/$defs/nonEmptyIds" }
62
+ }
63
+ }
64
+ }
65
+ },
66
+ "$defs": {
67
+ "id": { "type": "string", "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)*$" },
68
+ "text": { "type": "string", "minLength": 1 },
69
+ "digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
70
+ "path": { "type": "string", "minLength": 1 },
71
+ "ids": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/id" } },
72
+ "nonEmptyIds": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/id" } },
73
+ "paths": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/path" } },
74
+ "snapshots": {
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "required": ["contract", "sourcesLock", "projectionsLock"],
78
+ "properties": {
79
+ "contract": { "$ref": "#/$defs/digest" },
80
+ "sourcesLock": { "$ref": "#/$defs/digest" },
81
+ "projectionsLock": { "$ref": "#/$defs/digest" }
82
+ }
83
+ }
84
+ }
85
+ }