project-tiny-context-harness 0.8.4 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +394 -363
- package/assets/README.md +570 -514
- package/assets/README.zh-CN.md +331 -300
- package/assets/agents/.gitkeep +1 -1
- package/assets/agents/AGENTS_CORE.md +45 -25
- package/assets/context_templates/architecture.md +26 -25
- package/assets/context_templates/area.md +32 -31
- package/assets/context_templates/context.toml +30 -24
- package/assets/context_templates/deployment.md +35 -35
- package/assets/context_templates/global.md +57 -57
- package/assets/context_templates/product-surface-contract.md +70 -70
- package/assets/context_templates/screen-contract.md +189 -189
- package/assets/context_templates/verification.md +31 -30
- package/assets/github/.gitkeep +1 -1
- package/assets/github/harness.yml +39 -39
- package/assets/make/.gitkeep +1 -1
- package/assets/make/ty-context.mk +48 -48
- package/assets/skills/context_development_engineer/SKILL.md +155 -122
- package/assets/skills/context_full_project_export/SKILL.md +28 -28
- package/assets/skills/context_harness_upgrade/SKILL.md +60 -60
- package/assets/skills/context_product_plan/SKILL.md +99 -79
- package/assets/skills/context_surface_contract/SKILL.md +191 -191
- package/assets/skills/context_uiux_design/SKILL.md +171 -171
- package/assets/skills/design-resource-authoring/SKILL.md +86 -84
- package/assets/skills/design-resource-authoring/references/downstream-handoff.md +138 -123
- package/assets/skills/design-resource-authoring/references/open-design-provider.md +132 -127
- package/assets/skills/design-resource-authoring/references/resource-selection.md +181 -154
- package/assets/skills/design-system-authoring/SKILL.md +57 -57
- package/assets/skills/design-system-authoring/agents/openai.yaml +6 -6
- package/assets/skills/design-system-authoring/references/authority-adoption.md +48 -48
- package/assets/skills/design-system-authoring/references/open-design-design-system-provider.md +110 -110
- package/assets/skills/long-task-workflow/SKILL.md +98 -92
- package/assets/skills/long-task-workflow/agents/openai.yaml +3 -1
- package/assets/skills/long-task-workflow/references/authority-lifecycle.md +72 -72
- package/assets/skills/long-task-workflow/references/contract-authoring.md +122 -101
- package/assets/skills/long-task-workflow/references/evidence-design.md +82 -61
- package/assets/skills/long-task-workflow/references/source-authoring.md +109 -90
- package/assets/skills/source-plan-authoring/SKILL.md +14 -14
- package/assets/tools/validate_context.py +442 -442
- package/dist/commands/long-task-authoring.js +27 -2
- package/dist/lib/context-default-footprint.js +2 -0
- package/dist/lib/context-manifest.js +6 -0
- package/dist/lib/context-templates.js +1 -1
- package/dist/lib/design-resource-fact-enums.d.ts +20 -0
- package/dist/lib/design-resource-fact-enums.js +170 -0
- package/dist/lib/design-resource-fact-locator-extractors.d.ts +8 -0
- package/dist/lib/design-resource-fact-locator-extractors.js +108 -0
- package/dist/lib/design-resource-fact-locator-resolver.d.ts +3 -0
- package/dist/lib/design-resource-fact-locator-resolver.js +112 -0
- package/dist/lib/design-resource-fact-locator-validation.d.ts +5 -0
- package/dist/lib/design-resource-fact-locator-validation.js +16 -0
- package/dist/lib/design-resource-fact-manifest-catalog.d.ts +4 -0
- package/dist/lib/design-resource-fact-manifest-catalog.js +249 -0
- package/dist/lib/design-resource-fact-manifest-model.d.ts +91 -0
- package/dist/lib/design-resource-fact-manifest-model.js +21 -0
- package/dist/lib/design-resource-fact-manifest-shape-axes.d.ts +6 -0
- package/dist/lib/design-resource-fact-manifest-shape-axes.js +159 -0
- package/dist/lib/design-resource-fact-manifest-shape-evidence.d.ts +4 -0
- package/dist/lib/design-resource-fact-manifest-shape-evidence.js +59 -0
- package/dist/lib/design-resource-fact-manifest-shape-facts.d.ts +4 -0
- package/dist/lib/design-resource-fact-manifest-shape-facts.js +109 -0
- package/dist/lib/design-resource-fact-manifest-shape-inspector.d.ts +5 -0
- package/dist/lib/design-resource-fact-manifest-shape-inspector.js +144 -0
- package/dist/lib/design-resource-fact-manifest-shape.d.ts +7 -0
- package/dist/lib/design-resource-fact-manifest-shape.js +75 -0
- package/dist/lib/design-resource-fact-manifest-types.d.ts +3 -0
- package/dist/lib/design-resource-fact-manifest-types.js +3 -0
- package/dist/lib/design-resource-fact-manifest-universe.d.ts +5 -0
- package/dist/lib/design-resource-fact-manifest-universe.js +50 -0
- package/dist/lib/design-resource-fact-manifest-validation.d.ts +3 -0
- package/dist/lib/design-resource-fact-manifest-validation.js +106 -0
- package/dist/lib/design-resource-fact-policy.d.ts +18 -0
- package/dist/lib/design-resource-fact-policy.js +72 -1
- package/dist/lib/design-resource-fact-property-methods.d.ts +3 -0
- package/dist/lib/design-resource-fact-property-methods.js +158 -0
- package/dist/lib/design-resource-fact-shape-primitives.d.ts +3 -0
- package/dist/lib/design-resource-fact-shape-primitives.js +18 -0
- package/dist/lib/design-resource-fact-types.d.ts +164 -0
- package/dist/lib/design-resource-fact-types.js +1 -0
- package/dist/lib/design-resource-fact-universe-assets.d.ts +4 -0
- package/dist/lib/design-resource-fact-universe-assets.js +71 -0
- package/dist/lib/design-resource-fact-universe-catalog.d.ts +4 -0
- package/dist/lib/design-resource-fact-universe-catalog.js +151 -0
- package/dist/lib/design-resource-fact-universe-conditions.d.ts +2 -0
- package/dist/lib/design-resource-fact-universe-conditions.js +92 -0
- package/dist/lib/design-resource-fact-universe-facts.d.ts +4 -0
- package/dist/lib/design-resource-fact-universe-facts.js +108 -0
- package/dist/lib/design-resource-fact-universe-helpers.d.ts +30 -0
- package/dist/lib/design-resource-fact-universe-helpers.js +167 -0
- package/dist/lib/design-resource-fact-universe-inspector.d.ts +7 -0
- package/dist/lib/design-resource-fact-universe-inspector.js +119 -0
- package/dist/lib/design-resource-fact-universe-proof.d.ts +4 -0
- package/dist/lib/design-resource-fact-universe-proof.js +113 -0
- package/dist/lib/design-resource-fact-universe-subjects.d.ts +5 -0
- package/dist/lib/design-resource-fact-universe-subjects.js +97 -0
- package/dist/lib/design-resource-fact-universe-variations.d.ts +2 -0
- package/dist/lib/design-resource-fact-universe-variations.js +75 -0
- package/dist/lib/design-resource-fact-value-validation.d.ts +2 -0
- package/dist/lib/design-resource-fact-value-validation.js +80 -0
- package/dist/lib/design-resource-handoff-file-primitives.js +2 -0
- package/dist/lib/design-resource-handoff-file-validation.js +13 -100
- package/dist/lib/design-resource-handoff-policy.d.ts +1 -0
- package/dist/lib/design-resource-handoff-policy.js +118 -11
- package/dist/lib/design-resource-handoff-shape-evidence.js +46 -3
- package/dist/lib/design-resource-handoff-shape-primitives.d.ts +5 -0
- package/dist/lib/design-resource-handoff-shape-primitives.js +28 -0
- package/dist/lib/design-resource-handoff-shape-structure.js +143 -22
- package/dist/lib/design-resource-handoff-shape.js +25 -0
- package/dist/lib/design-resource-handoff-types.d.ts +97 -21
- package/dist/lib/design-resource-handoff-types.js +22 -0
- package/dist/lib/design-resource-handoff-validation-coverage.d.ts +1 -1
- package/dist/lib/design-resource-handoff-validation-coverage.js +145 -118
- package/dist/lib/design-resource-handoff-validation-fact-cells.d.ts +2 -0
- package/dist/lib/design-resource-handoff-validation-fact-cells.js +60 -0
- package/dist/lib/design-resource-handoff-validation-fact-records.d.ts +2 -0
- package/dist/lib/design-resource-handoff-validation-fact-records.js +90 -0
- package/dist/lib/design-resource-handoff-validation-facts.js +10 -94
- package/dist/lib/design-resource-handoff-validation-proofs.d.ts +2 -0
- package/dist/lib/design-resource-handoff-validation-proofs.js +67 -0
- package/dist/lib/design-resource-handoff-validation-resource-closure.d.ts +3 -0
- package/dist/lib/design-resource-handoff-validation-resource-closure.js +88 -0
- package/dist/lib/design-resource-handoff-validation-structure.js +43 -14
- package/dist/lib/design-resource-handoff-validation.js +32 -0
- package/dist/lib/design-resource-handoff-web-dependency-validation.d.ts +2 -1
- package/dist/lib/design-resource-handoff-web-dependency-validation.js +67 -7
- package/dist/lib/execution-target-capabilities.d.ts +1 -1
- package/dist/lib/execution-target-capabilities.js +14 -0
- package/dist/lib/long-task-activation-validation.js +6 -2
- package/dist/lib/long-task-applicability-shape.js +3 -3
- package/dist/lib/long-task-authoring-authority-preview.js +1 -0
- package/dist/lib/long-task-authority-policy.d.ts +1 -0
- package/dist/lib/long-task-authority-policy.js +1 -0
- package/dist/lib/long-task-authority.js +13 -0
- package/dist/lib/long-task-claim-definitions.js +13 -1
- package/dist/lib/long-task-claims.js +23 -1
- package/dist/lib/long-task-contract-types.d.ts +3 -0
- package/dist/lib/long-task-delivery-compiler.js +1 -0
- package/dist/lib/long-task-delivery-parser.js +11 -1
- package/dist/lib/long-task-delivery-types.d.ts +1 -0
- package/dist/lib/long-task-delivery-types.js +1 -0
- package/dist/lib/long-task-delivery-validation.js +17 -0
- package/dist/lib/long-task-design-resource-handoff.js +62 -38
- package/dist/lib/long-task-design-target-capabilities.d.ts +14 -0
- package/dist/lib/long-task-design-target-capabilities.js +126 -0
- package/dist/lib/long-task-evidence-capability-codec.d.ts +94 -0
- package/dist/lib/long-task-evidence-capability-codec.js +395 -22
- package/dist/lib/long-task-evidence-capability-policy.js +18 -0
- package/dist/lib/long-task-evidence-capability-runtime.js +78 -0
- package/dist/lib/long-task-evidence-capability-types.d.ts +114 -1
- package/dist/lib/long-task-outcome-parser.js +4 -0
- package/dist/lib/long-task-playwright-capability-records.d.ts +5 -0
- package/dist/lib/long-task-playwright-capability-records.js +146 -0
- package/dist/lib/long-task-playwright-case-evidence.d.ts +3 -2
- package/dist/lib/long-task-playwright-case-evidence.js +10 -79
- package/dist/lib/long-task-playwright-case-primitives.d.ts +28 -0
- package/dist/lib/long-task-playwright-case-primitives.js +143 -0
- package/dist/lib/long-task-playwright-evidence.d.ts +1 -1
- package/dist/lib/long-task-playwright-evidence.js +10 -75
- package/dist/lib/long-task-runner-freeze.d.ts +2 -2
- package/dist/lib/long-task-runner-freeze.js +15 -1
- package/dist/lib/long-task-runtime-types.d.ts +4 -1
- package/dist/lib/long-task-semantic-contract-types.d.ts +1 -1
- package/dist/lib/long-task-semantic-drift-migration.js +2 -2
- package/dist/lib/long-task-semantic-fact-binding-types.d.ts +57 -0
- package/dist/lib/long-task-semantic-fact-binding-types.js +1 -0
- package/dist/lib/long-task-semantic-fact-closure-primitives.d.ts +5 -0
- package/dist/lib/long-task-semantic-fact-closure-primitives.js +43 -0
- package/dist/lib/long-task-semantic-fact-closure.d.ts +13 -0
- package/dist/lib/long-task-semantic-fact-closure.js +48 -0
- package/dist/lib/long-task-semantic-fact-contract-closure.d.ts +4 -0
- package/dist/lib/long-task-semantic-fact-contract-closure.js +24 -0
- package/dist/lib/long-task-semantic-fact-contract-facts.d.ts +4 -0
- package/dist/lib/long-task-semantic-fact-contract-facts.js +30 -0
- package/dist/lib/long-task-semantic-fact-contract-proofs.d.ts +4 -0
- package/dist/lib/long-task-semantic-fact-contract-proofs.js +97 -0
- package/dist/lib/long-task-semantic-fact-evidence.d.ts +21 -0
- package/dist/lib/long-task-semantic-fact-evidence.js +165 -0
- package/dist/lib/long-task-semantic-fact-input-closure.d.ts +4 -0
- package/dist/lib/long-task-semantic-fact-input-closure.js +101 -0
- package/dist/lib/long-task-semantic-fact-provenance-closure.d.ts +4 -0
- package/dist/lib/long-task-semantic-fact-provenance-closure.js +140 -0
- package/dist/lib/long-task-semantic-fact-shape.d.ts +3 -0
- package/dist/lib/long-task-semantic-fact-shape.js +89 -0
- package/dist/lib/long-task-semantic-fact-value-closure.d.ts +3 -0
- package/dist/lib/long-task-semantic-fact-value-closure.js +110 -0
- package/dist/lib/long-task-shape-primitives.d.ts +2 -1
- package/dist/lib/long-task-shape-primitives.js +7 -0
- package/dist/lib/long-task-source-item-parser.js +25 -6
- package/dist/lib/long-task-source-target-continuity.js +4 -1
- package/dist/lib/long-task-source-target-index.d.ts +1 -1
- package/dist/lib/long-task-source-target-index.js +5 -1
- package/dist/lib/long-task-ui-design-policy.js +8 -4
- package/dist/lib/long-task-ui-surface-shape.js +83 -1
- package/dist/lib/long-task-ui-surface-types.d.ts +29 -0
- package/dist/lib/modularity.js +7 -1
- package/dist/lib/semantic-fact-base-types.d.ts +14 -0
- package/dist/lib/semantic-fact-base-types.js +1 -0
- package/dist/lib/semantic-fact-catalog.d.ts +8 -0
- package/dist/lib/semantic-fact-catalog.js +191 -0
- package/dist/lib/semantic-fact-condition-shape.d.ts +48 -0
- package/dist/lib/semantic-fact-condition-shape.js +111 -0
- package/dist/lib/semantic-fact-input-shape.d.ts +34 -0
- package/dist/lib/semantic-fact-input-shape.js +111 -0
- package/dist/lib/semantic-fact-inventory-types.d.ts +147 -0
- package/dist/lib/semantic-fact-inventory-types.js +1 -0
- package/dist/lib/semantic-fact-manifest-shape.d.ts +4 -0
- package/dist/lib/semantic-fact-manifest-shape.js +135 -0
- package/dist/lib/semantic-fact-manifest-types.d.ts +58 -0
- package/dist/lib/semantic-fact-manifest-types.js +19 -0
- package/dist/lib/semantic-fact-policy-authority.d.ts +8 -0
- package/dist/lib/semantic-fact-policy-authority.js +79 -0
- package/dist/lib/semantic-fact-policy-census.d.ts +2 -0
- package/dist/lib/semantic-fact-policy-census.js +80 -0
- package/dist/lib/semantic-fact-policy-condition-references.d.ts +7 -0
- package/dist/lib/semantic-fact-policy-condition-references.js +19 -0
- package/dist/lib/semantic-fact-policy-conditions.d.ts +2 -0
- package/dist/lib/semantic-fact-policy-conditions.js +105 -0
- package/dist/lib/semantic-fact-policy-facts.d.ts +3 -0
- package/dist/lib/semantic-fact-policy-facts.js +73 -0
- package/dist/lib/semantic-fact-policy-primitives.d.ts +26 -0
- package/dist/lib/semantic-fact-policy-primitives.js +169 -0
- package/dist/lib/semantic-fact-policy-proofs.d.ts +2 -0
- package/dist/lib/semantic-fact-policy-proofs.js +75 -0
- package/dist/lib/semantic-fact-policy-properties.d.ts +3 -0
- package/dist/lib/semantic-fact-policy-properties.js +84 -0
- package/dist/lib/semantic-fact-policy-units.d.ts +4 -0
- package/dist/lib/semantic-fact-policy-units.js +103 -0
- package/dist/lib/semantic-fact-policy.d.ts +17 -0
- package/dist/lib/semantic-fact-policy.js +41 -0
- package/dist/lib/semantic-fact-proof-shape.d.ts +51 -0
- package/dist/lib/semantic-fact-proof-shape.js +121 -0
- package/dist/lib/semantic-fact-proof-types.d.ts +74 -0
- package/dist/lib/semantic-fact-proof-types.js +1 -0
- package/dist/lib/semantic-fact-property-shape.d.ts +29 -0
- package/dist/lib/semantic-fact-property-shape.js +77 -0
- package/dist/lib/semantic-fact-shape-constants.d.ts +3 -0
- package/dist/lib/semantic-fact-shape-constants.js +38 -0
- package/dist/lib/semantic-fact-shape-primitives.d.ts +15 -0
- package/dist/lib/semantic-fact-shape-primitives.js +68 -0
- package/dist/lib/semantic-fact-source-parser.d.ts +9 -0
- package/dist/lib/semantic-fact-source-parser.js +46 -0
- package/dist/lib/semantic-fact-support-shape.d.ts +21 -0
- package/dist/lib/semantic-fact-support-shape.js +59 -0
- package/dist/lib/semantic-fact-types.d.ts +5 -0
- package/dist/lib/semantic-fact-types.js +5 -0
- package/dist/lib/semantic-fact-unit-shape.d.ts +34 -0
- package/dist/lib/semantic-fact-unit-shape.js +89 -0
- package/dist/lib/semantic-fact-value-shape.d.ts +12 -0
- package/dist/lib/semantic-fact-value-shape.js +39 -0
- package/dist/schemas/long-task-delivery-v2/long-task-delivery-v2.schema.json +1339 -131
- package/migrations/README.md +15 -15
- package/package.json +84 -84
- package/source-mappings.yaml +25 -25
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { isTextResource, } from "./design-resource-handoff-file-primitives.js";
|
|
4
4
|
import { invalidDesignResourceHandoff } from "./design-resource-handoff-validation-primitives.js";
|
|
5
|
-
import {
|
|
5
|
+
import { resolveDesignResourceLocatorValue } from "./design-resource-fact-locator-validation.js";
|
|
6
|
+
import { validateDesignResourceImplementationDependencyClosure } from "./design-resource-handoff-web-dependency-validation.js";
|
|
6
7
|
import { assertProtectedRepositoryFile } from "./long-task-protected-files.js";
|
|
7
|
-
import { markdownAnchors } from "./long-task-source-validation.js";
|
|
8
8
|
export async function validateDesignResourceFiles(repository, parsed) {
|
|
9
9
|
const resources = new Map(parsed.handoff.resources.map((resource) => [resource.key, resource]));
|
|
10
10
|
const contents = new Map();
|
|
@@ -15,8 +15,9 @@ export async function validateDesignResourceFiles(repository, parsed) {
|
|
|
15
15
|
for (const evidence of parsed.handoff.evidence)
|
|
16
16
|
validateLocator(evidence, resources.get(evidence.resource_ref), contents.get(evidence.resource_ref));
|
|
17
17
|
for (const target of parsed.handoff.targets)
|
|
18
|
-
if (target.source_profile.kind === "implementation_web"
|
|
19
|
-
|
|
18
|
+
if (target.source_profile.kind === "implementation_web" ||
|
|
19
|
+
target.source_profile.kind === "implementation_app")
|
|
20
|
+
validateDesignResourceImplementationDependencyClosure(target, resources, contents);
|
|
20
21
|
}
|
|
21
22
|
function validateLocator(evidence, resource, bytes) {
|
|
22
23
|
const { kind, value } = evidence.locator;
|
|
@@ -30,37 +31,7 @@ function validateLocator(evidence, resource, bytes) {
|
|
|
30
31
|
invalidDesignResourceHandoff("locator_whole_resource_too_broad", label);
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
-
if (kind === "html_selector") {
|
|
35
|
-
requireMediaType(resource, ["text/html", "application/xhtml+xml"], label);
|
|
36
|
-
if (!htmlSelectorExists(content, value))
|
|
37
|
-
invalidDesignResourceHandoff("locator_not_found", label);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (kind === "markdown_anchor") {
|
|
41
|
-
requireMediaType(resource, ["text/markdown"], label);
|
|
42
|
-
if (value.startsWith("#") || !markdownAnchors(content).has(value))
|
|
43
|
-
invalidDesignResourceHandoff("locator_not_found", label);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (kind === "json_pointer") {
|
|
47
|
-
requireMediaType(resource, ["application/json"], label);
|
|
48
|
-
if (!jsonPointerExists(content, value))
|
|
49
|
-
invalidDesignResourceHandoff("locator_not_found", label);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
if (kind === "css_selector") {
|
|
53
|
-
requireMediaType(resource, ["text/css"], label);
|
|
54
|
-
if (!cssSelectorExists(content, value))
|
|
55
|
-
invalidDesignResourceHandoff("locator_not_found", label);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
requireMediaType(resource, ["text/css"], label);
|
|
59
|
-
if (!/^--[A-Za-z0-9_-]+$/u.test(value))
|
|
60
|
-
invalidDesignResourceHandoff("locator_css_custom_property_invalid", label);
|
|
61
|
-
const customProperty = new RegExp(`${escapeRegExp(value)}\\s*:`, "u");
|
|
62
|
-
if (!customProperty.test(content))
|
|
63
|
-
invalidDesignResourceHandoff("locator_not_found", label);
|
|
34
|
+
resolveDesignResourceLocatorValue({ resource_ref: resource.key, kind, value }, resource, bytes, `evidence.${evidence.key}`);
|
|
64
35
|
}
|
|
65
36
|
function validateEvidenceResourceCompatibility(evidence, resource) {
|
|
66
37
|
const machineReadableKinds = new Set([
|
|
@@ -72,71 +43,13 @@ function validateEvidenceResourceCompatibility(evidence, resource) {
|
|
|
72
43
|
"semantic_tree",
|
|
73
44
|
"token_spec",
|
|
74
45
|
"annotation",
|
|
46
|
+
"localization_spec",
|
|
47
|
+
"system_ui_spec",
|
|
48
|
+
"haptic_spec",
|
|
49
|
+
"sound_spec",
|
|
50
|
+
"render_environment",
|
|
51
|
+
"relation_spec",
|
|
75
52
|
]);
|
|
76
53
|
if (machineReadableKinds.has(evidence.kind) && !isTextResource(resource))
|
|
77
54
|
invalidDesignResourceHandoff("evidence_resource_media_type_incompatible", `${evidence.key}:${evidence.kind}:${resource.media_type}`);
|
|
78
55
|
}
|
|
79
|
-
function requireMediaType(resource, expected, detail) {
|
|
80
|
-
if (!expected.includes(resource.media_type))
|
|
81
|
-
invalidDesignResourceHandoff("locator_media_type_incompatible", `${detail}:${resource.media_type}`);
|
|
82
|
-
}
|
|
83
|
-
function htmlSelectorExists(content, selector) {
|
|
84
|
-
const parsed = /^(?:([A-Za-z][A-Za-z0-9:-]*))?(?:#([A-Za-z][A-Za-z0-9_.:-]*))?(?:\[([A-Za-z_:][A-Za-z0-9_.:-]*)(?:=(?:"([^"]*)"|'([^']*)'|([^\]\s]+)))?\])?$/u.exec(selector);
|
|
85
|
-
if (!parsed || (!parsed[1] && !parsed[2] && !parsed[3]))
|
|
86
|
-
invalidDesignResourceHandoff("locator_html_selector_unsupported", selector);
|
|
87
|
-
const [, expectedTag, expectedId, expectedAttribute] = parsed;
|
|
88
|
-
const expectedValue = parsed[4] ?? parsed[5] ?? parsed[6];
|
|
89
|
-
for (const match of content.matchAll(/<([A-Za-z][A-Za-z0-9:-]*)\b([^<>]*)>/gu)) {
|
|
90
|
-
if (expectedTag && match[1].toLowerCase() !== expectedTag.toLowerCase())
|
|
91
|
-
continue;
|
|
92
|
-
const attributes = htmlAttributes(match[2]);
|
|
93
|
-
if (expectedId && attributes.get("id") !== expectedId)
|
|
94
|
-
continue;
|
|
95
|
-
if (expectedAttribute) {
|
|
96
|
-
const attributeName = expectedAttribute.toLowerCase();
|
|
97
|
-
if (!attributes.has(attributeName))
|
|
98
|
-
continue;
|
|
99
|
-
if (expectedValue !== undefined &&
|
|
100
|
-
attributes.get(attributeName) !== expectedValue)
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
function jsonPointerExists(content, pointer) {
|
|
108
|
-
if (!pointer.startsWith("/"))
|
|
109
|
-
return false;
|
|
110
|
-
let current;
|
|
111
|
-
try {
|
|
112
|
-
current = JSON.parse(content);
|
|
113
|
-
}
|
|
114
|
-
catch {
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
for (const token of pointer
|
|
118
|
-
.slice(1)
|
|
119
|
-
.split("/")
|
|
120
|
-
.map((part) => part.replace(/~1/gu, "/").replace(/~0/gu, "~"))) {
|
|
121
|
-
if (current === null ||
|
|
122
|
-
typeof current !== "object" ||
|
|
123
|
-
!Object.hasOwn(current, token))
|
|
124
|
-
return false;
|
|
125
|
-
current = current[token];
|
|
126
|
-
}
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
function cssSelectorExists(content, selector) {
|
|
130
|
-
if (!selector.trim() || selector.includes("{") || selector.includes("}"))
|
|
131
|
-
invalidDesignResourceHandoff("locator_css_selector_unsupported", selector);
|
|
132
|
-
for (const match of content.matchAll(/(?:^|\})\s*([^@{}][^{}]*)\{/gmu))
|
|
133
|
-
if (match[1]
|
|
134
|
-
.split(",")
|
|
135
|
-
.map((item) => item.trim())
|
|
136
|
-
.includes(selector))
|
|
137
|
-
return true;
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
function escapeRegExp(value) {
|
|
141
|
-
return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
142
|
-
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { DesignResourceDimension, DesignResourceEvidenceKind, DesignResourceVerificationMethod } from "./design-resource-handoff-types.js";
|
|
2
2
|
export declare const DESIGN_RESOURCE_EVIDENCE_BY_DIMENSION: Record<DesignResourceDimension, readonly DesignResourceEvidenceKind[]>;
|
|
3
3
|
export declare const DESIGN_RESOURCE_METHODS_BY_DIMENSION: Record<DesignResourceDimension, readonly DesignResourceVerificationMethod[]>;
|
|
4
|
+
export declare const DESIGN_RESOURCE_EVIDENCE_BY_METHOD: Record<DesignResourceVerificationMethod, readonly DesignResourceEvidenceKind[]>;
|
|
@@ -3,14 +3,23 @@ export const DESIGN_RESOURCE_EVIDENCE_BY_DIMENSION = {
|
|
|
3
3
|
"frame",
|
|
4
4
|
"prototype_state",
|
|
5
5
|
"prototype_transition",
|
|
6
|
+
"relation_spec",
|
|
7
|
+
"annotation",
|
|
8
|
+
],
|
|
9
|
+
visual_content: [
|
|
10
|
+
"frame",
|
|
11
|
+
"component_variant",
|
|
12
|
+
"token_spec",
|
|
13
|
+
"localization_spec",
|
|
14
|
+
"render_environment",
|
|
6
15
|
"annotation",
|
|
7
16
|
],
|
|
8
|
-
visual_content: ["frame", "component_variant", "token_spec", "annotation"],
|
|
9
17
|
component_control: [
|
|
10
18
|
"frame",
|
|
11
19
|
"component_variant",
|
|
12
20
|
"prototype_state",
|
|
13
21
|
"token_spec",
|
|
22
|
+
"relation_spec",
|
|
14
23
|
"annotation",
|
|
15
24
|
],
|
|
16
25
|
state_interaction: [
|
|
@@ -18,19 +27,117 @@ export const DESIGN_RESOURCE_EVIDENCE_BY_DIMENSION = {
|
|
|
18
27
|
"prototype_state",
|
|
19
28
|
"prototype_transition",
|
|
20
29
|
"input_spec",
|
|
30
|
+
"haptic_spec",
|
|
31
|
+
"sound_spec",
|
|
32
|
+
"sound_capture",
|
|
33
|
+
"system_ui_spec",
|
|
34
|
+
],
|
|
35
|
+
motion: [
|
|
36
|
+
"prototype_transition",
|
|
37
|
+
"motion_spec",
|
|
38
|
+
"motion_capture",
|
|
39
|
+
"haptic_spec",
|
|
40
|
+
"sound_spec",
|
|
41
|
+
"sound_capture",
|
|
42
|
+
],
|
|
43
|
+
adaptation_input: [
|
|
44
|
+
"responsive_spec",
|
|
45
|
+
"input_spec",
|
|
46
|
+
"localization_spec",
|
|
47
|
+
"system_ui_spec",
|
|
48
|
+
"render_environment",
|
|
21
49
|
],
|
|
22
|
-
|
|
23
|
-
adaptation_input: ["responsive_spec", "input_spec"],
|
|
24
|
-
accessibility: ["accessibility_spec", "semantic_tree", "input_spec"],
|
|
50
|
+
accessibility: ["accessibility_spec", "semantic_tree", "input_spec", "frame"],
|
|
25
51
|
assets: ["asset", "token_spec", "annotation"],
|
|
26
52
|
};
|
|
27
53
|
export const DESIGN_RESOURCE_METHODS_BY_DIMENSION = {
|
|
28
|
-
surface_flow: [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
54
|
+
surface_flow: [
|
|
55
|
+
"layout_geometry",
|
|
56
|
+
"design_token",
|
|
57
|
+
"interaction_trace",
|
|
58
|
+
"scroll_navigation",
|
|
59
|
+
],
|
|
60
|
+
visual_content: [
|
|
61
|
+
"layout_geometry",
|
|
62
|
+
"visual_pixel",
|
|
63
|
+
"design_token",
|
|
64
|
+
"content",
|
|
65
|
+
"responsive_reflow",
|
|
66
|
+
"localization",
|
|
67
|
+
],
|
|
68
|
+
component_control: [
|
|
69
|
+
"layout_geometry",
|
|
70
|
+
"visual_pixel",
|
|
71
|
+
"design_token",
|
|
72
|
+
"component_state",
|
|
73
|
+
],
|
|
74
|
+
state_interaction: [
|
|
75
|
+
"component_state",
|
|
76
|
+
"interaction_trace",
|
|
77
|
+
"gesture_trace",
|
|
78
|
+
"scroll_navigation",
|
|
79
|
+
"input_method",
|
|
80
|
+
"system_ui",
|
|
81
|
+
"haptic_feedback",
|
|
82
|
+
"sound_feedback",
|
|
83
|
+
],
|
|
84
|
+
motion: ["motion_timeline", "haptic_feedback", "sound_feedback"],
|
|
85
|
+
adaptation_input: [
|
|
86
|
+
"layout_geometry",
|
|
87
|
+
"responsive_reflow",
|
|
88
|
+
"input_method",
|
|
89
|
+
"scroll_navigation",
|
|
90
|
+
"localization",
|
|
91
|
+
"system_ui",
|
|
92
|
+
],
|
|
93
|
+
accessibility: [
|
|
94
|
+
"accessibility_semantics",
|
|
95
|
+
"accessibility_navigation",
|
|
96
|
+
"accessibility_visual",
|
|
97
|
+
],
|
|
35
98
|
assets: ["asset_integrity"],
|
|
36
99
|
};
|
|
100
|
+
export const DESIGN_RESOURCE_EVIDENCE_BY_METHOD = {
|
|
101
|
+
layout_geometry: [
|
|
102
|
+
"frame",
|
|
103
|
+
"component_variant",
|
|
104
|
+
"responsive_spec",
|
|
105
|
+
"relation_spec",
|
|
106
|
+
"annotation",
|
|
107
|
+
],
|
|
108
|
+
visual_pixel: ["frame", "component_variant", "render_environment"],
|
|
109
|
+
design_token: ["token_spec", "component_variant", "annotation"],
|
|
110
|
+
content: ["frame", "component_variant", "localization_spec", "annotation"],
|
|
111
|
+
component_state: [
|
|
112
|
+
"component_variant",
|
|
113
|
+
"prototype_state",
|
|
114
|
+
"prototype_transition",
|
|
115
|
+
],
|
|
116
|
+
interaction_trace: [
|
|
117
|
+
"prototype_transition",
|
|
118
|
+
"input_spec",
|
|
119
|
+
"system_ui_spec",
|
|
120
|
+
"haptic_spec",
|
|
121
|
+
],
|
|
122
|
+
motion_timeline: ["prototype_transition", "motion_spec", "motion_capture"],
|
|
123
|
+
responsive_reflow: [
|
|
124
|
+
"responsive_spec",
|
|
125
|
+
"component_variant",
|
|
126
|
+
"render_environment",
|
|
127
|
+
],
|
|
128
|
+
input_method: ["input_spec", "prototype_transition"],
|
|
129
|
+
accessibility_semantics: ["accessibility_spec", "semantic_tree"],
|
|
130
|
+
accessibility_navigation: [
|
|
131
|
+
"accessibility_spec",
|
|
132
|
+
"semantic_tree",
|
|
133
|
+
"input_spec",
|
|
134
|
+
],
|
|
135
|
+
accessibility_visual: ["accessibility_spec", "frame"],
|
|
136
|
+
gesture_trace: ["input_spec", "prototype_transition", "motion_capture"],
|
|
137
|
+
scroll_navigation: ["prototype_transition", "responsive_spec", "input_spec"],
|
|
138
|
+
localization: ["localization_spec", "component_variant", "frame"],
|
|
139
|
+
system_ui: ["system_ui_spec", "prototype_transition"],
|
|
140
|
+
haptic_feedback: ["haptic_spec", "prototype_transition"],
|
|
141
|
+
sound_feedback: ["sound_spec", "sound_capture", "prototype_transition"],
|
|
142
|
+
asset_integrity: ["asset"],
|
|
143
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { DESIGN_RESOURCE_VALUE_KINDS } from "./design-resource-fact-manifest-types.js";
|
|
2
|
+
import { parseDesignResourceLocatedDigest } from "./design-resource-fact-shape-primitives.js";
|
|
1
3
|
import { DESIGN_RESOURCE_DIMENSIONS, DESIGN_RESOURCE_EVIDENCE_KINDS, DESIGN_RESOURCE_LOCATOR_KINDS, } from "./design-resource-handoff-types.js";
|
|
2
4
|
import { contractKey, contractKeys, sourceItemKeys, stableKey, stableKeys, verificationMethods, } from "./design-resource-handoff-shape-primitives.js";
|
|
3
|
-
import { array, literal, object, string, } from "./long-task-shape-primitives.js";
|
|
5
|
+
import { array, literal, nullable, object, string, text, } from "./long-task-shape-primitives.js";
|
|
4
6
|
import { EXECUTION_TARGET_CAPABILITIES } from "./execution-target-capabilities.js";
|
|
5
7
|
export function parseDesignResourceHandoffEvidence(value) {
|
|
6
8
|
return array(value, "design_resource_handoff.evidence").map((item, index) => {
|
|
@@ -35,8 +37,12 @@ export function parseDesignResourceHandoffCoverage(value) {
|
|
|
35
37
|
"disposition",
|
|
36
38
|
"target_refs",
|
|
37
39
|
"condition_refs",
|
|
40
|
+
"variation_refs",
|
|
41
|
+
"property_refs",
|
|
38
42
|
"evidence_refs",
|
|
43
|
+
"fact_cell_refs",
|
|
39
44
|
"fact_refs",
|
|
45
|
+
"proof_obligation_refs",
|
|
40
46
|
"source_item_refs",
|
|
41
47
|
"verification_methods",
|
|
42
48
|
"rationale",
|
|
@@ -54,8 +60,12 @@ export function parseDesignResourceHandoffCoverage(value) {
|
|
|
54
60
|
], `${label}.disposition`),
|
|
55
61
|
target_refs: contractKeys(row.target_refs, `${label}.target_refs`),
|
|
56
62
|
condition_refs: contractKeys(row.condition_refs, `${label}.condition_refs`),
|
|
63
|
+
variation_refs: stableKeys(row.variation_refs, `${label}.variation_refs`),
|
|
64
|
+
property_refs: stableKeys(row.property_refs, `${label}.property_refs`),
|
|
57
65
|
evidence_refs: stableKeys(row.evidence_refs, `${label}.evidence_refs`),
|
|
66
|
+
fact_cell_refs: stableKeys(row.fact_cell_refs, `${label}.fact_cell_refs`),
|
|
58
67
|
fact_refs: stableKeys(row.fact_refs, `${label}.fact_refs`),
|
|
68
|
+
proof_obligation_refs: stableKeys(row.proof_obligation_refs, `${label}.proof_obligation_refs`),
|
|
59
69
|
source_item_refs: sourceItemKeys(row.source_item_refs, `${label}.source_item_refs`),
|
|
60
70
|
verification_methods: verificationMethods(row.verification_methods, `${label}.verification_methods`),
|
|
61
71
|
rationale: string(row.rationale, `${label}.rationale`),
|
|
@@ -67,25 +77,52 @@ export function parseDesignResourceHandoffFacts(value) {
|
|
|
67
77
|
const label = `design_resource_handoff.facts[${index}]`;
|
|
68
78
|
const row = object(item, label, [
|
|
69
79
|
"key",
|
|
80
|
+
"cell_ref",
|
|
70
81
|
"subject_ref",
|
|
71
82
|
"target_ref",
|
|
72
83
|
"condition_ref",
|
|
84
|
+
"variation_ref",
|
|
85
|
+
"property_ref",
|
|
73
86
|
"dimension",
|
|
74
87
|
"observation_scope",
|
|
88
|
+
"observation_sensitivity",
|
|
89
|
+
"value_kind",
|
|
90
|
+
"value",
|
|
75
91
|
"evidence_refs",
|
|
76
92
|
"source_item_refs",
|
|
77
|
-
"
|
|
93
|
+
"lineage",
|
|
94
|
+
]);
|
|
95
|
+
const lineage = object(row.lineage, `${label}.lineage`, [
|
|
96
|
+
"design_system_ref",
|
|
97
|
+
"token_chain_refs",
|
|
98
|
+
"override_chain_refs",
|
|
99
|
+
"resolved_value",
|
|
100
|
+
"conflict_status",
|
|
101
|
+
"conflict_resolution",
|
|
78
102
|
]);
|
|
79
103
|
return {
|
|
80
104
|
key: stableKey(row.key, `${label}.key`),
|
|
105
|
+
cell_ref: stableKey(row.cell_ref, `${label}.cell_ref`),
|
|
81
106
|
subject_ref: stableKey(row.subject_ref, `${label}.subject_ref`),
|
|
82
107
|
target_ref: contractKey(row.target_ref, `${label}.target_ref`),
|
|
83
108
|
condition_ref: contractKey(row.condition_ref, `${label}.condition_ref`),
|
|
109
|
+
variation_ref: stableKey(row.variation_ref, `${label}.variation_ref`),
|
|
110
|
+
property_ref: stableKey(row.property_ref, `${label}.property_ref`),
|
|
84
111
|
dimension: literal(row.dimension, DESIGN_RESOURCE_DIMENSIONS, `${label}.dimension`),
|
|
85
112
|
observation_scope: literal(row.observation_scope, ["subject", "full_target"], `${label}.observation_scope`),
|
|
113
|
+
observation_sensitivity: literal(row.observation_sensitivity, ["plain", "protected"], `${label}.observation_sensitivity`),
|
|
114
|
+
value_kind: literal(row.value_kind, DESIGN_RESOURCE_VALUE_KINDS, `${label}.value_kind`),
|
|
115
|
+
value: parseDesignResourceLocatedDigest(row.value, `${label}.value`),
|
|
86
116
|
evidence_refs: stableKeys(row.evidence_refs, `${label}.evidence_refs`),
|
|
87
117
|
source_item_refs: sourceItemKeys(row.source_item_refs, `${label}.source_item_refs`),
|
|
88
|
-
|
|
118
|
+
lineage: {
|
|
119
|
+
design_system_ref: nullable(lineage.design_system_ref, (item) => stableKey(item, `${label}.lineage.design_system_ref`)),
|
|
120
|
+
token_chain_refs: stableKeys(lineage.token_chain_refs, `${label}.lineage.token_chain_refs`),
|
|
121
|
+
override_chain_refs: stableKeys(lineage.override_chain_refs, `${label}.lineage.override_chain_refs`),
|
|
122
|
+
resolved_value: parseDesignResourceLocatedDigest(lineage.resolved_value, `${label}.lineage.resolved_value`),
|
|
123
|
+
conflict_status: literal(lineage.conflict_status, ["none", "resolved"], `${label}.lineage.conflict_status`),
|
|
124
|
+
conflict_resolution: text(lineage.conflict_resolution, `${label}.lineage.conflict_resolution`),
|
|
125
|
+
},
|
|
89
126
|
};
|
|
90
127
|
});
|
|
91
128
|
}
|
|
@@ -125,6 +162,9 @@ export function parseDesignResourceHandoffBlockers(value) {
|
|
|
125
162
|
"target_refs",
|
|
126
163
|
"subject_refs",
|
|
127
164
|
"dimensions",
|
|
165
|
+
"fact_cell_refs",
|
|
166
|
+
"fact_refs",
|
|
167
|
+
"proof_obligation_refs",
|
|
128
168
|
"source_item_refs",
|
|
129
169
|
"verification_methods",
|
|
130
170
|
"required_capabilities",
|
|
@@ -135,6 +175,9 @@ export function parseDesignResourceHandoffBlockers(value) {
|
|
|
135
175
|
target_refs: contractKeys(row.target_refs, `${label}.target_refs`),
|
|
136
176
|
subject_refs: stableKeys(row.subject_refs, `${label}.subject_refs`),
|
|
137
177
|
dimensions: array(row.dimensions, `${label}.dimensions`).map((dimension, itemIndex) => literal(dimension, DESIGN_RESOURCE_DIMENSIONS, `${label}.dimensions[${itemIndex}]`)),
|
|
178
|
+
fact_cell_refs: stableKeys(row.fact_cell_refs, `${label}.fact_cell_refs`),
|
|
179
|
+
fact_refs: stableKeys(row.fact_refs, `${label}.fact_refs`),
|
|
180
|
+
proof_obligation_refs: stableKeys(row.proof_obligation_refs, `${label}.proof_obligation_refs`),
|
|
138
181
|
source_item_refs: sourceItemKeys(row.source_item_refs, `${label}.source_item_refs`),
|
|
139
182
|
verification_methods: verificationMethods(row.verification_methods, `${label}.verification_methods`),
|
|
140
183
|
required_capabilities: array(row.required_capabilities, `${label}.required_capabilities`).map((capability, capabilityIndex) => literal(capability, EXECUTION_TARGET_CAPABILITIES, `${label}.required_capabilities[${capabilityIndex}]`)),
|
|
@@ -6,4 +6,9 @@ export declare function contractKeys(value: unknown, label: string): string[];
|
|
|
6
6
|
export declare function sourceItemKeys(value: unknown, label: string): string[];
|
|
7
7
|
export declare function verificationMethods(value: unknown, label: string): DesignResourceHandoffCoverageV1["verification_methods"];
|
|
8
8
|
export declare function positiveInteger(value: unknown, label: string): number;
|
|
9
|
+
export declare function nonnegativeInteger(value: unknown, label: string): number;
|
|
10
|
+
export declare function positiveNumber(value: unknown, label: string): number;
|
|
11
|
+
export declare function nonnegativeNumber(value: unknown, label: string): number;
|
|
12
|
+
export declare function sha256(value: unknown, label: string): string;
|
|
13
|
+
export declare function atomicAxisValue(value: unknown, label: string): string;
|
|
9
14
|
export declare function designResourceShapeFail(label: string, message: string): never;
|
|
@@ -2,6 +2,7 @@ import { DESIGN_RESOURCE_VERIFICATION_METHODS } from "./design-resource-handoff-
|
|
|
2
2
|
import { array, literal, string } from "./long-task-shape-primitives.js";
|
|
3
3
|
const KEY = /^[a-z0-9][a-z0-9._-]*$/u;
|
|
4
4
|
const SOURCE_ITEM_KEY = /^[a-z0-9][a-z0-9-]*$/u;
|
|
5
|
+
const SHA256 = /^[a-f0-9]{64}$/u;
|
|
5
6
|
export function stableKey(value, label) {
|
|
6
7
|
const result = string(value, label);
|
|
7
8
|
if (!KEY.test(result))
|
|
@@ -37,6 +38,33 @@ export function positiveInteger(value, label) {
|
|
|
37
38
|
designResourceShapeFail(label, "must be a positive safe integer");
|
|
38
39
|
return value;
|
|
39
40
|
}
|
|
41
|
+
export function nonnegativeInteger(value, label) {
|
|
42
|
+
if (!Number.isSafeInteger(value) || Number(value) < 0)
|
|
43
|
+
designResourceShapeFail(label, "must be a non-negative safe integer");
|
|
44
|
+
return Number(value);
|
|
45
|
+
}
|
|
46
|
+
export function positiveNumber(value, label) {
|
|
47
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0)
|
|
48
|
+
designResourceShapeFail(label, "must be a positive finite number");
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
export function nonnegativeNumber(value, label) {
|
|
52
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0)
|
|
53
|
+
designResourceShapeFail(label, "must be a non-negative finite number");
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
export function sha256(value, label) {
|
|
57
|
+
const result = string(value, label);
|
|
58
|
+
if (!SHA256.test(result))
|
|
59
|
+
designResourceShapeFail(label, "must be a lowercase SHA-256");
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
export function atomicAxisValue(value, label) {
|
|
63
|
+
const result = stableKey(value, label);
|
|
64
|
+
if (/^all-/u.test(result) || /(?:^|[._-])catalog(?:$|[._-])/u.test(result))
|
|
65
|
+
designResourceShapeFail(label, "must identify one atomic value, not a compound collection");
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
40
68
|
export function designResourceShapeFail(label, message) {
|
|
41
69
|
throw new Error(`design_resource_handoff_invalid:${label}:${message}`);
|
|
42
70
|
}
|