@reqvire-org/ads 0.4.0 → 0.4.2
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/README.md +105 -86
- package/dist/a11y.mjs +108 -29
- package/dist/analysis/compiler-options.mjs +13 -0
- package/dist/analysis/context.mjs +46 -0
- package/dist/analysis/file-tree.mjs +52 -0
- package/dist/analysis/helpers.mjs +140 -0
- package/dist/analysis/impact.mjs +20 -0
- package/dist/analysis/inputs.mjs +15 -0
- package/dist/analysis/native-adapter.mjs +180 -0
- package/dist/analysis/native-project.mjs +323 -0
- package/dist/analysis/queries.mjs +133 -0
- package/dist/analysis/service.mjs +146 -0
- package/dist/analysis/standalone.mjs +57 -0
- package/dist/analysis/syntax.mjs +164 -0
- package/dist/analysis/worker.mjs +182 -0
- package/dist/assets.mjs +5 -5
- package/dist/atomic-composition.mjs +191 -70
- package/dist/atomic-trace.mjs +120 -50
- package/dist/behavior-libraries.mjs +106 -37
- package/dist/behaviors.mjs +219 -77
- package/dist/boundaries.mjs +135 -38
- package/dist/brand-assets.mjs +219 -47
- package/dist/brands.mjs +86 -27
- package/dist/bun-compiler.mjs +28 -14
- package/dist/bun-worker.mjs +7 -5
- package/dist/capture/worker.mjs +15 -4
- package/dist/capture-store.mjs +4 -2
- package/dist/capture.mjs +17 -14
- package/dist/check-service.mjs +40 -57
- package/dist/check.mjs +749 -188
- package/dist/cli.mjs +200 -99
- package/dist/color-values.mjs +21 -21
- package/dist/component-contrast.mjs +2 -2
- package/dist/config.mjs +303 -135
- package/dist/construction-styles.cjs +10 -0
- package/dist/control-padding.mjs +45 -25
- package/dist/css-values.mjs +3 -2
- package/dist/declarative-flow.mjs +209 -109
- package/dist/design-values.mjs +136 -51
- package/dist/development-runtime.mjs +4 -6
- package/dist/draft-boundary.mjs +11 -6
- package/dist/evidence.mjs +1 -1
- package/dist/finding-rules.mjs +7 -5
- package/dist/font-rules.mjs +2 -2
- package/dist/fonts-generated.mjs +2 -2
- package/dist/foundation-views.mjs +238 -0
- package/dist/foundation.mjs +63 -39
- package/dist/generated-entries.mjs +101 -34
- package/dist/icons.mjs +79 -32
- package/dist/image-attributes.mjs +109 -36
- package/dist/image-size.mjs +1 -1
- package/dist/index.mjs +0 -2
- package/dist/init.mjs +122 -41
- package/dist/investigations.mjs +2 -2
- package/dist/layers.mjs +298 -129
- package/dist/layout-widths.mjs +180 -85
- package/dist/linaria/preserve-values.cjs +7 -0
- package/dist/linaria/spatial-inputs.cjs +56 -0
- package/dist/lockup-composition.mjs +44 -0
- package/dist/lockup-model.cjs +64 -0
- package/dist/mcp/THIRD_PARTY_NOTICES.md +51 -1
- package/dist/mcp/apps.mjs +4 -30
- package/dist/mcp/behavior-pages.mjs +72 -24
- package/dist/mcp/build-status.mjs +257 -64
- package/dist/mcp/catalog.mjs +90 -26
- package/dist/mcp/context.mjs +17 -18
- package/dist/mcp/draft-discovery.mjs +44 -21
- package/dist/mcp/drafts.mjs +901 -281
- package/dist/mcp/execution-coordinator.mjs +417 -167
- package/dist/mcp/execution-results.mjs +7 -7
- package/dist/mcp/mutations.mjs +670 -234
- package/dist/mcp/preview-watch.mjs +448 -170
- package/dist/mcp/preview-widget.bundle.js +44 -50
- package/dist/mcp/prompts.mjs +5 -5
- package/dist/mcp/result-pages.mjs +1 -1
- package/dist/mcp/sandbox-host.mjs +1 -1
- package/dist/mcp/server.mjs +2402 -577
- package/dist/mcp/showcase-host.mjs +165 -41
- package/dist/mcp/skills.mjs +1 -1
- package/dist/mcp/text-diff.mjs +29 -10
- package/dist/paint-contracts.mjs +174 -81
- package/dist/palette-generated.mjs +2 -2
- package/dist/preview-bun.mjs +493 -187
- package/dist/preview-failure.mjs +1 -1
- package/dist/preview-files.mjs +13 -13
- package/dist/preview-imports.mjs +104 -55
- package/dist/preview-inputs.mjs +2 -2
- package/dist/preview-requests.mjs +24 -0
- package/dist/preview-resources.mjs +288 -147
- package/dist/preview-scope.mjs +5 -4
- package/dist/program-cache.mjs +8 -34
- package/dist/project-documents.mjs +1 -1
- package/dist/public-api.mjs +69 -31
- package/dist/public-props.mjs +39 -22
- package/dist/{browser-audit → render-audit}/axe-run.mjs +3 -3
- package/dist/{browser-audit → render-audit}/image-shape.mjs +2 -2
- package/dist/{browser-audit → render-audit}/layout-overflow.mjs +86 -23
- package/dist/{browser-audit → render-audit}/non-text-contrast.mjs +86 -27
- package/dist/{browser-audit → render-audit}/render-states.mjs +208 -52
- package/dist/{browser-audit → render-audit}/worker.mjs +86 -30
- package/dist/render-audit.mjs +828 -0
- package/dist/render-color-probe.mjs +96 -42
- package/dist/resource-limits.mjs +229 -97
- package/dist/runtime-contracts.mjs +467 -185
- package/dist/scenario-groups.mjs +22 -10
- package/dist/scenario-inspector.mjs +6 -43
- package/dist/scenario-program.mjs +8 -25
- package/dist/scenario-registry.mjs +72 -30
- package/dist/scenario-selectors.mjs +161 -64
- package/dist/scenario-slots.mjs +149 -56
- package/dist/scenario-trace.mjs +215 -109
- package/dist/scenarios-compiler.mjs +719 -378
- package/dist/scenarios-vite.d.mts +1 -3
- package/dist/scenarios-vite.mjs +2 -81
- package/dist/scenarios.mjs +421 -157
- package/dist/selector-match.mjs +2 -2
- package/dist/showcase/client.bundle.js +57 -56
- package/dist/showcase/draft-navigation.js +18 -0
- package/dist/showcase/favicon.ico +0 -0
- package/dist/showcase/favicon.svg +1 -0
- package/dist/showcase/foundation-view.css +55 -0
- package/dist/showcase/foundation-view.mjs +252 -0
- package/dist/showcase/guide-controls.ads.review.mjs +32 -0
- package/dist/showcase/icons.js +1 -145
- package/dist/showcase/index.html +3 -31
- package/dist/showcase/preview-frame.ads.review.css +46 -0
- package/dist/showcase/preview-frame.ads.review.d.mts +11 -0
- package/dist/showcase/preview-frame.ads.review.mjs +22 -0
- package/dist/showcase/preview-state.js +0 -9
- package/dist/showcase/refresh-scheduler.js +23 -0
- package/dist/showcase/style.css +5 -47
- package/dist/showcase/ui/ui.css +1353 -0
- package/dist/showcase/ui/ui.js +1062 -0
- package/dist/showcase-coverage.mjs +58 -37
- package/dist/skills/README.md +24 -23
- package/dist/skills/ads-designer/README.md +8 -2
- package/dist/skills/ads-designer/SKILL.md +130 -119
- package/dist/skills/ads-designer/references/accessibility.md +12 -13
- package/dist/skills/ads-designer/references/atomic-styles.md +4 -4
- package/dist/skills/ads-designer/references/behaviors.md +30 -27
- package/dist/skills/ads-designer/references/branding.md +98 -10
- package/dist/skills/ads-designer/references/captures.md +25 -0
- package/dist/skills/ads-designer/references/cli.md +21 -24
- package/dist/skills/ads-designer/references/contracts.md +7 -6
- package/dist/skills/ads-designer/references/design-data.md +49 -52
- package/dist/skills/ads-designer/references/drafts.md +20 -17
- package/dist/skills/ads-designer/references/evidence.md +1 -5
- package/dist/skills/ads-designer/references/guarded-editing.md +14 -18
- package/dist/skills/ads-designer/references/layers.md +1 -1
- package/dist/skills/ads-designer/references/layout.md +347 -0
- package/dist/skills/ads-designer/references/mobile.md +2 -1
- package/dist/skills/{ads-motion/references/performance.md → ads-designer/references/motion-performance.md} +5 -1
- package/dist/skills/{ads-motion/references/build.md → ads-designer/references/motion.md} +73 -5
- package/dist/skills/ads-designer/references/review.md +37 -34
- package/dist/skills/ads-designer/references/runtimes.md +33 -30
- package/dist/skills/ads-designer/references/scenarios.md +16 -18
- package/dist/skills/{ads-break-ui/references/catalog.md → ads-designer/references/stress-catalog.md} +3 -1
- package/dist/skills/ads-designer/references/stress-test.md +68 -0
- package/dist/skills/ads-designer/references/validation.md +83 -75
- package/dist/skills/ads-designer/references/workflows.md +8 -33
- package/dist/skills/ads-import/SKILL.md +43 -325
- package/dist/skills/ads-import/references/atomic-styles.md +4 -4
- package/dist/skills/ads-import/references/behaviors.md +30 -27
- package/dist/skills/ads-import/references/branding.md +5 -5
- package/dist/skills/ads-import/references/captures.md +25 -0
- package/dist/skills/ads-import/references/cli.md +21 -24
- package/dist/skills/ads-import/references/compatibility.md +1 -1
- package/dist/skills/ads-import/references/contracts.md +7 -6
- package/dist/skills/ads-import/references/design-data.md +49 -52
- package/dist/skills/ads-import/references/drafts.md +20 -17
- package/dist/skills/ads-import/references/evidence.md +1 -5
- package/dist/skills/ads-import/references/guarded-editing.md +14 -18
- package/dist/skills/ads-import/references/implementation.md +2 -1
- package/dist/skills/ads-import/references/layers.md +1 -1
- package/dist/skills/ads-import/references/layout.md +347 -0
- package/dist/skills/ads-import/references/review.md +37 -34
- package/dist/skills/ads-import/references/runtimes.md +33 -30
- package/dist/skills/ads-import/references/scenarios.md +16 -18
- package/dist/skills/ads-import/references/tokens.md +3 -3
- package/dist/skills/ads-import/references/validation.md +83 -75
- package/dist/skills/ads-import/references/workflows.md +8 -33
- package/dist/skills/ads-migrate/SKILL.md +56 -0
- package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +602 -0
- package/dist/skills/ads-port/SKILL.md +54 -343
- package/dist/skills/ads-port/references/atomic-styles.md +4 -4
- package/dist/skills/ads-port/references/behaviors.md +30 -27
- package/dist/skills/ads-port/references/captures.md +25 -0
- package/dist/skills/ads-port/references/cli.md +21 -24
- package/dist/skills/ads-port/references/contracts.md +7 -6
- package/dist/skills/ads-port/references/design-data.md +49 -52
- package/dist/skills/ads-port/references/drafts.md +20 -17
- package/dist/skills/ads-port/references/evidence.md +1 -5
- package/dist/skills/ads-port/references/guarded-editing.md +14 -18
- package/dist/skills/ads-port/references/layers.md +1 -1
- package/dist/skills/ads-port/references/layout.md +347 -0
- package/dist/skills/ads-port/references/lint-and-docs.md +8 -11
- package/dist/skills/ads-port/references/native-implementation.md +2 -1
- package/dist/skills/ads-port/references/review.md +37 -34
- package/dist/skills/ads-port/references/runtimes.md +33 -30
- package/dist/skills/ads-port/references/scenarios.md +16 -18
- package/dist/skills/ads-port/references/validation.md +83 -75
- package/dist/skills/ads-port/references/workflows.md +8 -33
- package/dist/source-symbols.mjs +1 -8
- package/dist/source-values.mjs +266 -128
- package/dist/spatial-composition.mjs +322 -0
- package/dist/spatial-contexts.cjs +56 -0
- package/dist/spatial-css.cjs +351 -0
- package/dist/spatial-inputs.cjs +80 -0
- package/dist/spatial-metadata.mjs +18 -0
- package/dist/spatial-model.cjs +322 -0
- package/dist/spatial.mjs +21 -0
- package/dist/stage-timing.cjs +20 -0
- package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +105 -0
- package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +275 -0
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
- package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +8 -0
- package/dist/starters/preact/ds.config.json +25 -6
- package/dist/starters/preact/package.json +4 -8
- package/dist/starters/preact/tsconfig.json +4 -5
- package/dist/starters/preact/vite.config.ts +3 -3
- package/dist/starters/react/ADS.md +42 -47
- package/dist/starters/react/README.md +47 -49
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +18 -2
- package/dist/starters/react/design-system/components/Actions/IconButton/README.md +3 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +5 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +13 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +22 -0
- package/dist/starters/react/design-system/index.ts +2 -1
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +7 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +15 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +105 -0
- package/dist/starters/react/design-system/patterns/Conversation/README.md +9 -0
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +5 -0
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +21 -0
- package/dist/starters/react/design-system/patterns/Shell/README.md +43 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +5 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +21 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +274 -0
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -1
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
- package/dist/starters/react/design-system/review/index.ads.review.ts +4 -0
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +6 -0
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -1
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
- package/dist/starters/react/design-system/showcase/mcp/{main.tsx → main.ads.mount.tsx} +4 -2
- package/dist/starters/react/design-system/tokens/catalog.ads.json +1221 -0
- package/dist/starters/react/design-system/tokens/colors.css +1 -1
- package/dist/starters/react/design-system/tokens/spacing.css +22 -32
- package/dist/starters/react/design-system/tokens/spatial.ads.json +70 -0
- package/dist/starters/react/design-system/tokens/themes.generated.ts +1 -1
- package/dist/starters/react/ds.config.json +25 -6
- package/dist/starters/react/package.json +2 -6
- package/dist/starters/react/tsconfig.json +2 -3
- package/dist/starters/react/vite.config.ts +3 -3
- package/dist/style-boundaries.mjs +70 -25
- package/dist/task-cache.mjs +173 -72
- package/dist/task-worker.mjs +22 -11
- package/dist/test-boundaries.mjs +132 -59
- package/dist/themes-generated.mjs +1 -1
- package/dist/themes-watch.mjs +57 -22
- package/dist/themes.mjs +176 -73
- package/dist/token-export.mjs +39 -14
- package/dist/token-policy.mjs +6 -3
- package/dist/token-quality.mjs +6 -6
- package/dist/token-samples.mjs +16 -5
- package/dist/tokens.mjs +71 -26
- package/dist/ui-framework.mjs +16 -14
- package/dist/unit-contracts.mjs +251 -104
- package/dist/units.mjs +208 -98
- package/dist/usage.mjs +138 -38
- package/dist/validation-checks.mjs +115 -38
- package/dist/validation-inputs.mjs +187 -78
- package/dist/validation.mjs +268 -102
- package/dist/verification/browser.mjs +27 -5
- package/dist/verification.mjs +711 -187
- package/docs/ADS.md +90 -79
- package/docs/ARCHITECTURE.md +294 -136
- package/docs/BEHAVIORS.md +29 -25
- package/docs/CACHING.md +52 -17
- package/docs/CHANGELOG.md +309 -17
- package/docs/CONTRACTS.md +12 -4
- package/docs/DESIGN-REFERENCES.md +40 -0
- package/docs/GUIDE.md +270 -258
- package/docs/MCP.md +181 -324
- package/docs/SPATIAL-CHECKS.md +69 -0
- package/docs/benchmarks/README.md +39 -0
- package/package.json +42 -34
- package/dist/browser-audit.mjs +0 -429
- package/dist/create.mjs +0 -48
- package/dist/lint-config.mjs +0 -50
- package/dist/mcp/project-widget.bundle.js +0 -114
- package/dist/mcp/reports.mjs +0 -101
- package/dist/mcp/widget.bundle.js +0 -147
- package/dist/oxlint.mjs +0 -89
- package/dist/preview-builder.mjs +0 -133
- package/dist/preview-workers.mjs +0 -184
- package/dist/showcase.mjs +0 -77
- package/dist/skills/ads-break-ui/LICENSE.upstream +0 -21
- package/dist/skills/ads-break-ui/README.md +0 -16
- package/dist/skills/ads-break-ui/SKILL.md +0 -412
- package/dist/skills/ads-break-ui/agents/openai.yaml +0 -4
- package/dist/skills/ads-break-ui/references/atomic-styles.md +0 -293
- package/dist/skills/ads-break-ui/references/behaviors.md +0 -412
- package/dist/skills/ads-break-ui/references/captures.md +0 -135
- package/dist/skills/ads-break-ui/references/contracts.md +0 -317
- package/dist/skills/ads-break-ui/references/design-data.md +0 -354
- package/dist/skills/ads-break-ui/references/drafts.md +0 -194
- package/dist/skills/ads-break-ui/references/evidence.md +0 -128
- package/dist/skills/ads-break-ui/references/guarded-editing.md +0 -165
- package/dist/skills/ads-break-ui/references/layers.md +0 -145
- package/dist/skills/ads-break-ui/references/reporting.md +0 -101
- package/dist/skills/ads-break-ui/references/review.md +0 -97
- package/dist/skills/ads-break-ui/references/runtimes.md +0 -203
- package/dist/skills/ads-break-ui/references/scenarios.md +0 -246
- package/dist/skills/ads-break-ui/references/validation.md +0 -166
- package/dist/skills/ads-break-ui/references/verification.md +0 -58
- package/dist/skills/ads-break-ui/references/workflows.md +0 -90
- package/dist/skills/ads-designer/references/reporting.md +0 -101
- package/dist/skills/ads-import/references/reporting.md +0 -101
- package/dist/skills/ads-motion/LICENSE.upstream +0 -21
- package/dist/skills/ads-motion/README.md +0 -22
- package/dist/skills/ads-motion/SKILL.md +0 -385
- package/dist/skills/ads-motion/agents/openai.yaml +0 -4
- package/dist/skills/ads-motion/references/atomic-styles.md +0 -293
- package/dist/skills/ads-motion/references/audit.md +0 -44
- package/dist/skills/ads-motion/references/behaviors.md +0 -412
- package/dist/skills/ads-motion/references/captures.md +0 -135
- package/dist/skills/ads-motion/references/contracts.md +0 -317
- package/dist/skills/ads-motion/references/design-data.md +0 -354
- package/dist/skills/ads-motion/references/drafts.md +0 -194
- package/dist/skills/ads-motion/references/evidence.md +0 -128
- package/dist/skills/ads-motion/references/guarded-editing.md +0 -165
- package/dist/skills/ads-motion/references/layers.md +0 -145
- package/dist/skills/ads-motion/references/motion-review.md +0 -35
- package/dist/skills/ads-motion/references/reporting.md +0 -101
- package/dist/skills/ads-motion/references/review.md +0 -97
- package/dist/skills/ads-motion/references/runtimes.md +0 -203
- package/dist/skills/ads-motion/references/scenarios.md +0 -246
- package/dist/skills/ads-motion/references/validation.md +0 -166
- package/dist/skills/ads-motion/references/verification.md +0 -39
- package/dist/skills/ads-motion/references/workflows.md +0 -90
- package/dist/skills/ads-port/references/reporting.md +0 -101
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +0 -76
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +0 -137
- package/dist/starters/preact/design-system/showcase/mcp/main.tsx +0 -6
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +0 -12
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +0 -17
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +0 -75
- package/dist/starters/react/design-system/components/Layout/Grid/README.md +0 -21
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +0 -112
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/starters/react/design-system/review/grid-cell/GridCell.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +0 -18
- package/dist/starters/react/design-system/review/index.ts +0 -6
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +0 -137
- package/dist/starters/react/design-system/showcase/mcp/index.html +0 -1
- package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +0 -124
- package/dist/starters/react/design-system/tokens/Color.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +0 -39
- package/dist/starters/react/design-system/tokens/Layout.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +0 -18
- package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +0 -30
- package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +0 -37
- package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +0 -29
- package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +0 -4
- package/dist/starters/react/package-lock.json +0 -4707
- package/dist/token-fixtures.mjs +0 -30
- package/docs/benchmarks/bun-previews.md +0 -91
- package/docs/benchmarks/preview-memory.md +0 -147
- package/docs/benchmarks/turbo-poc.md +0 -284
- package/docs/plans/execution-coordination.md +0 -57
- /package/dist/{browser-audit → render-audit}/first-render.mjs +0 -0
- /package/dist/{browser-audit → render-audit}/layout-shift.mjs +0 -0
package/dist/task-cache.mjs
CHANGED
|
@@ -9,114 +9,215 @@ import { validationInputFiles } from "./validation-inputs.mjs";
|
|
|
9
9
|
import { previewRuntimeFingerprint } from "./runtime-requirements.mjs";
|
|
10
10
|
import { checkCommand } from "./validation-checks.mjs";
|
|
11
11
|
|
|
12
|
-
const hash = value => createHash("sha256").update(value).digest("hex");
|
|
12
|
+
const hash = (value) => createHash("sha256").update(value).digest("hex");
|
|
13
13
|
const toolRoot = path.dirname(fileURLToPath(import.meta.url));
|
|
14
14
|
const semanticEnv = ["NODE_ENV", "NODE_OPTIONS", "BUN_OPTIONS", "TZ", "LANG", "LC_ALL"];
|
|
15
15
|
function turboBinary() {
|
|
16
|
-
const platform=process.platform==="win32"?"windows":process.platform==="android"?"linux":process.platform,
|
|
16
|
+
const platform = process.platform === "win32" ? "windows" : process.platform === "android" ? "linux" : process.platform,
|
|
17
|
+
arch = process.arch === "x64" ? "64" : process.arch;
|
|
17
18
|
try {
|
|
18
|
-
const resolve=createRequire(createRequire(import.meta.url).resolve("turbo/package.json"));
|
|
19
|
-
return resolve.resolve(`@turbo/${platform}-${arch}/bin/turbo${platform==="windows"?".exe":""}`);
|
|
20
|
-
} catch(cause) {
|
|
19
|
+
const resolve = createRequire(createRequire(import.meta.url).resolve("turbo/package.json"));
|
|
20
|
+
return resolve.resolve(`@turbo/${platform}-${arch}/bin/turbo${platform === "windows" ? ".exe" : ""}`);
|
|
21
|
+
} catch (cause) {
|
|
21
22
|
// Turbo's convenience JS launcher repairs missing binaries with npm install.
|
|
22
23
|
// Managed ADS operations must only run already-installed project dependencies.
|
|
23
|
-
throw Object.assign(
|
|
24
|
+
throw Object.assign(
|
|
25
|
+
new Error(`ADS needs its installed Turbo binary for ${platform}-${arch}. Reinstall ADS dependencies with platform optional dependencies enabled.`, {
|
|
26
|
+
cause,
|
|
27
|
+
}),
|
|
28
|
+
{ code: "ADS_TASK_RUNTIME_MISSING" },
|
|
29
|
+
);
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
function toolInputs() {
|
|
27
|
-
const rows=[];
|
|
33
|
+
const rows = [];
|
|
28
34
|
function visit(directory) {
|
|
29
|
-
for (const entry of readdirSync(directory,{withFileTypes:true}).sort((a,b)=>a.name.localeCompare(b.name))) {
|
|
30
|
-
const file=path.join(directory,entry.name);
|
|
31
|
-
if (entry.isDirectory() && !["skills","starters","showcase"].includes(entry.name)) visit(file);
|
|
32
|
-
else if(entry.isFile() && /\.(?:mjs|js|cjs|json)$/.test(entry.name)) rows.push([path.relative(toolRoot,file),hash(readFileSync(file))]);
|
|
35
|
+
for (const entry of readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
36
|
+
const file = path.join(directory, entry.name);
|
|
37
|
+
if (entry.isDirectory() && !["skills", "starters", "showcase"].includes(entry.name)) visit(file);
|
|
38
|
+
else if (entry.isFile() && /\.(?:mjs|js|cjs|json)$/.test(entry.name)) rows.push([path.relative(toolRoot, file), hash(readFileSync(file))]);
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
visit(toolRoot);
|
|
36
42
|
// Include the tool's dependency lock when running from a source checkout.
|
|
37
|
-
const lock=path.join(toolRoot,"../package-lock.json");
|
|
38
|
-
if(existsSync(lock))rows.push(["tool-lock",hash(readFileSync(lock))]);
|
|
43
|
+
const lock = path.join(toolRoot, "../package-lock.json");
|
|
44
|
+
if (existsSync(lock)) rows.push(["tool-lock", hash(readFileSync(lock))]);
|
|
39
45
|
return rows;
|
|
40
46
|
}
|
|
41
47
|
// Recompute source digests per request: editing a running checkout must invalidate.
|
|
42
|
-
export function architectureExternalInputs(root, trackingRoot=root) {
|
|
43
|
-
const options=loadConfig(root),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
export function architectureExternalInputs(root, trackingRoot = root) {
|
|
49
|
+
const options = loadConfig(root),
|
|
50
|
+
manifest = path.join(root, "package.json"),
|
|
51
|
+
pkg = existsSync(manifest) ? JSON.parse(readFileSync(manifest, "utf8")) : {};
|
|
52
|
+
const dependencies = Object.keys({ ...pkg.dependencies, ...pkg.devDependencies, ...pkg.peerDependencies })
|
|
53
|
+
.sort()
|
|
54
|
+
.map((name) => {
|
|
55
|
+
for (let directory = root; ; directory = path.dirname(directory)) {
|
|
56
|
+
const file = path.join(directory, "node_modules", name, "package.json");
|
|
57
|
+
if (existsSync(file)) return [name, hash(readFileSync(file))];
|
|
58
|
+
if (path.dirname(directory) === directory) return [name, null];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const tracked = spawnSync("git", ["ls-files", "-z", "--", "."], { cwd: trackingRoot, encoding: "utf8", maxBuffer: 16 * 1024 * 1024 });
|
|
62
|
+
const generated = [...options.config.assets.generatedPaths.map((file) => path.resolve(root, file)), path.join(root, ".ds")];
|
|
63
|
+
const noRepository = tracked.status === 128 && /not a git repository/i.test(tracked.stderr ?? "");
|
|
64
|
+
const git = {
|
|
65
|
+
status: noRepository ? 0 : tracked.status,
|
|
66
|
+
error: tracked.error?.code ?? null,
|
|
67
|
+
stderr: noRepository ? "" : (tracked.stderr ?? ""),
|
|
68
|
+
files: (tracked.stdout ?? "")
|
|
69
|
+
.split("\0")
|
|
70
|
+
.filter((file) => file && generated.some((directory) => isInside(directory, path.resolve(root, file))))
|
|
71
|
+
.sort()
|
|
72
|
+
.map((file) => [file, existsSync(path.resolve(root, file)) || existsSync(path.resolve(trackingRoot, file))]),
|
|
73
|
+
};
|
|
74
|
+
return { dependencies, git, environment: Object.fromEntries(semanticEnv.map((name) => [name, process.env[name] ?? null])) };
|
|
57
75
|
}
|
|
58
|
-
export function architectureTaskInputs(root, trackingRoot=root) {
|
|
59
|
-
return {
|
|
76
|
+
export async function architectureTaskInputs(root, trackingRoot = root) {
|
|
77
|
+
return {
|
|
78
|
+
schemaVersion: 1,
|
|
79
|
+
kind: "architecture",
|
|
80
|
+
runtime: previewRuntimeFingerprint(),
|
|
81
|
+
tool: toolInputs(),
|
|
82
|
+
files: await validationInputFiles(loadConfig(root)),
|
|
83
|
+
...architectureExternalInputs(root, trackingRoot),
|
|
84
|
+
};
|
|
60
85
|
}
|
|
61
86
|
|
|
62
87
|
export function taskCacheSettings(root) {
|
|
63
|
-
const directory=path.resolve(root,process.env.ADS_CACHE_DIR??".ds/task-cache");
|
|
64
|
-
return {backend:"turbo",enabled:process.env.ADS_CACHE!=="off",remote:process.env.ADS_REMOTE_CACHE==="1",directory};
|
|
88
|
+
const directory = path.resolve(root, process.env.ADS_CACHE_DIR ?? ".ds/task-cache");
|
|
89
|
+
return { backend: "turbo", enabled: process.env.ADS_CACHE !== "off", remote: process.env.ADS_REMOTE_CACHE === "1", directory };
|
|
65
90
|
}
|
|
66
91
|
function cacheDirectory(root, workspace) {
|
|
67
|
-
const settings=taskCacheSettings(root);
|
|
68
|
-
if(!settings.enabled)return {...settings,directory:path.join(workspace,"cache")};
|
|
92
|
+
const settings = taskCacheSettings(root);
|
|
93
|
+
if (!settings.enabled) return { ...settings, directory: path.join(workspace, "cache") };
|
|
69
94
|
try {
|
|
70
|
-
mkdirSync(settings.directory,{recursive:true});
|
|
71
|
-
if(realpathSync(settings.directory)!==settings.directory)throw new Error("ADS cache directory cannot resolve through a symlink.");
|
|
72
|
-
accessSync(settings.directory,constants.W_OK);
|
|
73
|
-
} catch(error) {
|
|
74
|
-
if(!["EACCES","EPERM","EROFS","ENOSPC","EDQUOT"].includes(error.code))throw error;
|
|
75
|
-
return {...settings,enabled:false,remote:false,directory:path.join(workspace,"cache"),reason:"cache-directory-unwritable"};
|
|
95
|
+
mkdirSync(settings.directory, { recursive: true });
|
|
96
|
+
if (realpathSync(settings.directory) !== settings.directory) throw new Error("ADS cache directory cannot resolve through a symlink.");
|
|
97
|
+
accessSync(settings.directory, constants.W_OK);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
if (!["EACCES", "EPERM", "EROFS", "ENOSPC", "EDQUOT"].includes(error.code)) throw error;
|
|
100
|
+
return { ...settings, enabled: false, remote: false, directory: path.join(workspace, "cache"), reason: "cache-directory-unwritable" };
|
|
76
101
|
}
|
|
77
102
|
return settings;
|
|
78
103
|
}
|
|
79
104
|
function collect(directory) {
|
|
80
105
|
// Turbo owns serialization and atomic publication. Only prune finished, old
|
|
81
106
|
// artifacts, never current workspaces or live ADS evidence.
|
|
82
|
-
const entries=readdirSync(directory)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
107
|
+
const entries = readdirSync(directory)
|
|
108
|
+
.filter((name) => /^[a-f0-9]+\.tar\.zst$/.test(name))
|
|
109
|
+
.map((name) => {
|
|
110
|
+
const file = path.join(directory, name),
|
|
111
|
+
stat = statSync(file),
|
|
112
|
+
companions = ["-meta.json", "-manifest.json"].map((suffix) => file.replace(/\.tar\.zst$/, suffix));
|
|
113
|
+
return {
|
|
114
|
+
file,
|
|
115
|
+
companions,
|
|
116
|
+
size: stat.size + companions.reduce((sum, file) => sum + (existsSync(file) ? statSync(file).size : 0), 0),
|
|
117
|
+
mtime: stat.mtimeMs,
|
|
118
|
+
};
|
|
119
|
+
})
|
|
120
|
+
.sort((a, b) => b.mtime - a.mtime);
|
|
121
|
+
let bytes = 0;
|
|
122
|
+
for (const entry of entries) {
|
|
123
|
+
bytes += entry.size;
|
|
124
|
+
if ((bytes > 256 * 1024 * 1024 || Date.now() - entry.mtime > 7 * 86400000) && Date.now() - entry.mtime > 60000) {
|
|
125
|
+
rmSync(entry.file, { force: true });
|
|
126
|
+
for (const file of entry.companions) rmSync(file, { force: true });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
88
129
|
}
|
|
89
130
|
|
|
90
131
|
/** One backend for deterministic ADS batch checks. Cache hits are still fenced
|
|
91
132
|
* against current source; they never restore locks, policy results or baselines. */
|
|
92
|
-
export async function runArchitectureTask(root, trackingRoot, directory, signal, {fresh=false}={}) {
|
|
133
|
+
export async function runArchitectureTask(root, trackingRoot, directory, signal, { fresh = false } = {}) {
|
|
93
134
|
// A nonexistent target is a structural diagnostic, not a task workspace to
|
|
94
135
|
// create as a side effect. The analysis primitive exits before source work.
|
|
95
|
-
if(!existsSync(root))
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
136
|
+
if (!existsSync(root)) {
|
|
137
|
+
const { checkProject } = await import("./check.mjs");
|
|
138
|
+
return checkProject(root);
|
|
139
|
+
}
|
|
140
|
+
const settings = cacheDirectory(trackingRoot, directory),
|
|
141
|
+
inputs = await architectureTaskInputs(root, trackingRoot),
|
|
142
|
+
key = hash(JSON.stringify(inputs));
|
|
143
|
+
writeFileSync(path.join(directory, "inputs.json"), JSON.stringify(inputs));
|
|
144
|
+
writeFileSync(path.join(directory, "worker.mjs"), readFileSync(new URL("./task-worker.mjs", import.meta.url)));
|
|
145
|
+
writeFileSync(
|
|
146
|
+
path.join(directory, "package.json"),
|
|
147
|
+
JSON.stringify({ name: "ads-internal-task", version: "1.0.0", private: true, packageManager: "bun@1.4.1", scripts: { architecture: "bun worker.mjs" } }),
|
|
148
|
+
);
|
|
149
|
+
const passThrough = ["ADS_TASK_ROOT", "ADS_TASK_TRACKING_ROOT", "ADS_TASK_TOOL", "ADS_TASK_KEY"];
|
|
150
|
+
writeFileSync(
|
|
151
|
+
path.join(directory, "turbo.json"),
|
|
152
|
+
JSON.stringify({
|
|
153
|
+
tasks: { architecture: { inputs: ["inputs.json", "worker.mjs"], outputs: ["out/report.json"], passThroughEnv: passThrough } },
|
|
154
|
+
globalPassThroughEnv: semanticEnv,
|
|
155
|
+
}),
|
|
156
|
+
);
|
|
157
|
+
const modes = settings.enabled ? `local:${fresh ? "w" : "rw"}${settings.remote ? `,remote:${fresh ? "w" : "rw"}` : ""}` : "local:";
|
|
158
|
+
const args = [
|
|
159
|
+
"run",
|
|
160
|
+
"architecture",
|
|
161
|
+
"--single-package",
|
|
162
|
+
`--cache=${modes}`,
|
|
163
|
+
`--cache-dir=${settings.directory}`,
|
|
164
|
+
"--concurrency=1",
|
|
165
|
+
"--summarize",
|
|
166
|
+
"--output-logs=errors-only",
|
|
167
|
+
"--ui=stream",
|
|
168
|
+
];
|
|
169
|
+
const started = Date.now();
|
|
170
|
+
let failure;
|
|
171
|
+
try {
|
|
172
|
+
await checkCommand(turboBinary(), args, directory, signal, undefined, { category: "architecture", phase: "ads-check" }, 60000, {
|
|
173
|
+
ADS_TASK_ROOT: root,
|
|
174
|
+
ADS_TASK_TRACKING_ROOT: trackingRoot,
|
|
175
|
+
ADS_TASK_TOOL: toolRoot,
|
|
176
|
+
ADS_TASK_KEY: key,
|
|
177
|
+
TURBO_TELEMETRY_DISABLED: "1",
|
|
178
|
+
});
|
|
179
|
+
} catch (error) {
|
|
180
|
+
failure = error;
|
|
181
|
+
}
|
|
182
|
+
if (signal?.aborted)
|
|
183
|
+
throw (
|
|
184
|
+
failure ??
|
|
185
|
+
Object.assign(new Error("Mutation cancelled during validation."), {
|
|
186
|
+
diagnostic: { rule: "mutation-cancelled", message: "Mutation cancelled during validation." },
|
|
187
|
+
})
|
|
188
|
+
);
|
|
189
|
+
if (hash(JSON.stringify(await architectureTaskInputs(root, trackingRoot))) !== key)
|
|
190
|
+
throw Object.assign(new Error("Source, dependencies or Git tracking changed during the ADS task; retry against the current inputs."), {
|
|
191
|
+
code: "ADS_SOURCE_CHANGED",
|
|
192
|
+
});
|
|
193
|
+
const report = path.join(directory, "out/report.json");
|
|
194
|
+
if (!existsSync(report)) throw failure ?? new Error("ADS task did not produce an architecture report.");
|
|
195
|
+
if (statSync(report).size > 16 * 1024 * 1024) throw new Error("Architecture report exceeds 16 MiB.");
|
|
196
|
+
const result = JSON.parse(readFileSync(report, "utf8"));
|
|
114
197
|
// Failing source guards return actionable diagnostics but never a cacheable
|
|
115
198
|
// successful task. Infrastructure failures cannot masquerade as source errors.
|
|
116
|
-
if(failure && result.ok!==false)throw failure;
|
|
117
|
-
let hit=false;
|
|
118
|
-
const summaries=path.join(directory,".turbo/runs");
|
|
119
|
-
if(existsSync(summaries))
|
|
120
|
-
|
|
121
|
-
|
|
199
|
+
if (failure && result.ok !== false) throw failure;
|
|
200
|
+
let hit = false;
|
|
201
|
+
const summaries = path.join(directory, ".turbo/runs");
|
|
202
|
+
if (existsSync(summaries))
|
|
203
|
+
for (const file of readdirSync(summaries).filter((name) => name.endsWith(".json"))) {
|
|
204
|
+
const summary = JSON.parse(readFileSync(path.join(summaries, file), "utf8"));
|
|
205
|
+
hit = summary.tasks?.some((task) => task.cache?.status === "HIT") ?? false;
|
|
206
|
+
}
|
|
207
|
+
try {
|
|
208
|
+
collect(settings.directory);
|
|
209
|
+
} catch {
|
|
210
|
+
/* Cache maintenance never changes gate results. */
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
...result,
|
|
214
|
+
cache: {
|
|
215
|
+
backend: "turbo",
|
|
216
|
+
task: "architecture",
|
|
217
|
+
key,
|
|
218
|
+
status: !settings.enabled ? "disabled" : fresh ? "fresh" : hit ? "hit" : "miss",
|
|
219
|
+
...(settings.reason ? { reason: settings.reason } : {}),
|
|
220
|
+
elapsedMs: Date.now() - started,
|
|
221
|
+
},
|
|
222
|
+
};
|
|
122
223
|
}
|
package/dist/task-worker.mjs
CHANGED
|
@@ -5,15 +5,26 @@ import { pathToFileURL } from "node:url";
|
|
|
5
5
|
|
|
6
6
|
// Copied to an isolated Turbo task workspace. Physical source/tool locations are
|
|
7
7
|
// passed at execution time, not embedded into portable cached task inputs.
|
|
8
|
-
const {ADS_TASK_ROOT:root,ADS_TASK_TRACKING_ROOT:trackingRoot,ADS_TASK_TOOL:tool,ADS_TASK_KEY:key}=process.env;
|
|
9
|
-
if(!root || !trackingRoot || !tool || !key)throw new Error("Missing ADS task execution context.");
|
|
10
|
-
const {architectureTaskInputs}=await import(pathToFileURL(path.join(tool,"task-cache.mjs")));
|
|
11
|
-
const current=()=>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if(current()!==key)throw new Error("ADS task inputs changed
|
|
8
|
+
const { ADS_TASK_ROOT: root, ADS_TASK_TRACKING_ROOT: trackingRoot, ADS_TASK_TOOL: tool, ADS_TASK_KEY: key } = process.env;
|
|
9
|
+
if (!root || !trackingRoot || !tool || !key) throw new Error("Missing ADS task execution context.");
|
|
10
|
+
const { architectureTaskInputs } = await import(pathToFileURL(path.join(tool, "task-cache.mjs")));
|
|
11
|
+
const current = async () =>
|
|
12
|
+
createHash("sha256")
|
|
13
|
+
.update(JSON.stringify(await architectureTaskInputs(root, trackingRoot)))
|
|
14
|
+
.digest("hex");
|
|
15
|
+
if ((await current()) !== key) throw new Error("ADS task inputs changed before execution.");
|
|
16
|
+
let result;
|
|
17
|
+
|
|
18
|
+
const { analyze, closeAnalysis } = await import(pathToFileURL(path.join(tool, "analysis/service.mjs")));
|
|
19
|
+
try {
|
|
20
|
+
result = await analyze(root, "check", [trackingRoot]);
|
|
21
|
+
} finally {
|
|
22
|
+
await closeAnalysis();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if ((await current()) !== key) throw new Error("ADS task inputs changed during execution.");
|
|
16
26
|
// The descriptor is part of Turbo's key; also reject an inconsistent caller.
|
|
17
|
-
if(createHash("sha256").update(readFileSync("inputs.json")).digest("hex")!==key)throw new Error("ADS task input descriptor mismatch.");
|
|
18
|
-
mkdirSync("out",{recursive:true});
|
|
19
|
-
|
|
27
|
+
if (createHash("sha256").update(readFileSync("inputs.json")).digest("hex") !== key) throw new Error("ADS task input descriptor mismatch.");
|
|
28
|
+
mkdirSync("out", { recursive: true });
|
|
29
|
+
writeFileSync("out/report.json", JSON.stringify(result));
|
|
30
|
+
if (!result.ok) process.exitCode = 1;
|
package/dist/test-boundaries.mjs
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
+
import { eachChild } from "./analysis/queries.mjs";
|
|
1
2
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
|
-
import ts from "
|
|
4
|
+
import ts from "./analysis/syntax.mjs";
|
|
4
5
|
import { adsFileRole, isInside, isDevelopmentFile, isScenarioFile, isTestFile } from "./config.mjs";
|
|
5
6
|
import { importResolver } from "./boundaries.mjs";
|
|
6
7
|
import { createPreviewFileFilter } from "./preview-files.mjs";
|
|
7
8
|
|
|
8
9
|
/** Test ownership is structural; arbitrary assertion intent remains the runner's concern. */
|
|
9
|
-
export function inspectTestBoundaries(options, inventory, contracts, program) {
|
|
10
|
-
const diagnostics = [],
|
|
10
|
+
export async function inspectTestBoundaries(options, inventory, contracts, program) {
|
|
11
|
+
const diagnostics = [],
|
|
12
|
+
resolve = await importResolver(options),
|
|
13
|
+
parsed = new Map(),
|
|
14
|
+
tests = [];
|
|
11
15
|
const ignored = createPreviewFileFilter(options);
|
|
12
|
-
const owner = file => inventory.owner(inventory.relative(path.relative(options.root,file)));
|
|
13
|
-
function source(file) {
|
|
14
|
-
if (!parsed.has(file))
|
|
16
|
+
const owner = (file) => inventory.owner(inventory.relative(path.relative(options.root, file)));
|
|
17
|
+
async function source(file) {
|
|
18
|
+
if (!parsed.has(file))
|
|
19
|
+
parsed.set(file, (await program?.getSourceFile(file)) ?? (await ts.createSourceFile(file, readFileSync(file, "utf8"), ts.ScriptTarget.Latest, true)));
|
|
15
20
|
return parsed.get(file);
|
|
16
21
|
}
|
|
17
22
|
/** A case tag marks a test only where it tags one: in a test call's title or options. The
|
|
@@ -24,7 +29,13 @@ export function inspectTestBoundaries(options, inventory, contracts, program) {
|
|
|
24
29
|
if (ts.isStringLiteralLike(node) && tag.test(node.text)) found = true;
|
|
25
30
|
else if (ts.isTemplateExpression(node) && tag.test(node.getText(ast))) found = true;
|
|
26
31
|
// An indirect tag cannot be read from source, so the file's text decides.
|
|
27
|
-
else if (
|
|
32
|
+
else if (
|
|
33
|
+
(ts.isPropertyAssignment(node) || ts.isShorthandPropertyAssignment(node)) &&
|
|
34
|
+
node.name.getText(ast) === "tag" &&
|
|
35
|
+
!(ts.isPropertyAssignment(node) && (ts.isStringLiteralLike(node.initializer) || ts.isArrayLiteralExpression(node.initializer))) &&
|
|
36
|
+
tag.test(ast.text)
|
|
37
|
+
)
|
|
38
|
+
found = true;
|
|
28
39
|
else ts.forEachChild(node, argument);
|
|
29
40
|
}
|
|
30
41
|
function visit(node) {
|
|
@@ -32,7 +43,7 @@ export function inspectTestBoundaries(options, inventory, contracts, program) {
|
|
|
32
43
|
if (ts.isCallExpression(node)) {
|
|
33
44
|
let base = node.expression;
|
|
34
45
|
while (ts.isPropertyAccessExpression(base) || ts.isCallExpression(base)) base = base.expression;
|
|
35
|
-
if (ts.isIdentifier(base) && ["test","it","describe"].includes(base.text)) {
|
|
46
|
+
if (ts.isIdentifier(base) && ["test", "it", "describe"].includes(base.text)) {
|
|
36
47
|
const [title] = node.arguments;
|
|
37
48
|
if (title && ts.isIdentifier(title) && tag.test(ast.text)) found = true;
|
|
38
49
|
for (const value of node.arguments) argument(value);
|
|
@@ -43,82 +54,144 @@ export function inspectTestBoundaries(options, inventory, contracts, program) {
|
|
|
43
54
|
visit(ast);
|
|
44
55
|
return found;
|
|
45
56
|
}
|
|
46
|
-
function walk(directory) {
|
|
47
|
-
for (const entry of readdirSync(directory,{withFileTypes:true})) {
|
|
48
|
-
const file = path.join(directory,entry.name);
|
|
49
|
-
if (entry.isSymbolicLink() || ignored(file) || ["output","test-results","playwright-report",".playwright-cli"].includes(entry.name)) continue;
|
|
50
|
-
if (entry.isDirectory()) walk(file);
|
|
57
|
+
async function walk(directory) {
|
|
58
|
+
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
59
|
+
const file = path.join(directory, entry.name);
|
|
60
|
+
if (entry.isSymbolicLink() || ignored(file) || ["output", "test-results", "playwright-report", ".playwright-cli"].includes(entry.name)) continue;
|
|
61
|
+
if (entry.isDirectory()) await walk(file);
|
|
51
62
|
else if (entry.isFile() && /\.[cm]?[jt]sx?$/.test(file) && isTestFile(file)) {
|
|
52
|
-
let executable
|
|
53
|
-
const names=new Set(["test","it","describe"]);
|
|
54
|
-
const ast=source(file);
|
|
55
|
-
for(const statement of ast.statements)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
let executable = /\.(?:test|spec)\.[cm]?[jt]sx?$/.test(file);
|
|
64
|
+
const names = new Set(["test", "it", "describe"]);
|
|
65
|
+
const ast = await source(file);
|
|
66
|
+
for (const statement of ast.statements)
|
|
67
|
+
if (
|
|
68
|
+
ts.isImportDeclaration(statement) &&
|
|
69
|
+
ts.isStringLiteralLike(statement.moduleSpecifier) &&
|
|
70
|
+
/^(?:vitest|@playwright\/test|node:test|bun:test|@jest\/globals)$/.test(statement.moduleSpecifier.text)
|
|
71
|
+
) {
|
|
72
|
+
const bindings = statement.importClause?.namedBindings;
|
|
73
|
+
if (statement.importClause?.name) names.add(statement.importClause.name.text);
|
|
74
|
+
if (bindings && ts.isNamespaceImport(bindings)) names.add(bindings.name.text);
|
|
75
|
+
if (bindings && ts.isNamedImports(bindings))
|
|
76
|
+
for (const item of bindings.elements) if (["test", "it", "describe"].includes((item.propertyName ?? item.name).text)) names.add(item.name.text);
|
|
77
|
+
}
|
|
78
|
+
function visit(node) {
|
|
79
|
+
if (ts.isCallExpression(node)) {
|
|
80
|
+
let base = node.expression;
|
|
81
|
+
while (ts.isPropertyAccessExpression(base) || ts.isCallExpression(base)) base = base.expression;
|
|
82
|
+
if (ts.isIdentifier(base) && names.has(base.text)) executable = true;
|
|
83
|
+
}
|
|
84
|
+
if (!executable) ts.forEachChild(node, visit);
|
|
60
85
|
}
|
|
61
|
-
|
|
62
|
-
if(
|
|
63
|
-
if(executable)tests.push(file);
|
|
86
|
+
if (!executable) visit(ast);
|
|
87
|
+
if (executable) tests.push(file);
|
|
64
88
|
}
|
|
65
89
|
}
|
|
66
90
|
}
|
|
67
|
-
walk(options.root);
|
|
68
|
-
const registered = new Set(
|
|
69
|
-
|
|
91
|
+
await walk(options.root);
|
|
92
|
+
const registered = new Set(
|
|
93
|
+
contracts.flatMap((contract) => Object.values(contract.checks).map((check) => path.resolve(options.root, path.dirname(contract.file), check.file))),
|
|
94
|
+
);
|
|
95
|
+
async function imports(file) {
|
|
70
96
|
const edges = [];
|
|
71
|
-
function visit(node) {
|
|
97
|
+
async function visit(node) {
|
|
72
98
|
let specifier;
|
|
73
|
-
if ((ts.isImportDeclaration(node)||ts.isExportDeclaration(node)) && node.moduleSpecifier && ts.isStringLiteralLike(node.moduleSpecifier))
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
99
|
+
if ((ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) && node.moduleSpecifier && ts.isStringLiteralLike(node.moduleSpecifier))
|
|
100
|
+
specifier = node.moduleSpecifier.text;
|
|
101
|
+
if (
|
|
102
|
+
ts.isCallExpression(node) &&
|
|
103
|
+
(node.expression.kind === ts.SyntaxKind.ImportKeyword || (ts.isIdentifier(node.expression) && node.expression.text === "require")) &&
|
|
104
|
+
node.arguments[0] &&
|
|
105
|
+
ts.isStringLiteralLike(node.arguments[0])
|
|
106
|
+
)
|
|
107
|
+
specifier = node.arguments[0].text;
|
|
108
|
+
const typeOnly =
|
|
109
|
+
(ts.isImportDeclaration(node) &&
|
|
110
|
+
(node.importClause?.isTypeOnly ||
|
|
111
|
+
(node.importClause?.namedBindings &&
|
|
112
|
+
ts.isNamedImports(node.importClause.namedBindings) &&
|
|
113
|
+
!node.importClause.name &&
|
|
114
|
+
node.importClause.namedBindings.elements.length &&
|
|
115
|
+
node.importClause.namedBindings.elements.every((item) => item.isTypeOnly)))) ||
|
|
116
|
+
(ts.isExportDeclaration(node) && node.isTypeOnly);
|
|
117
|
+
if (specifier && !typeOnly)
|
|
118
|
+
for (const target of await resolve(specifier, file))
|
|
119
|
+
if (existsSync(target) && isInside(options.root, target) && !target.split(path.sep).includes("node_modules") && /\.[cm]?[jt]sx?$/.test(target))
|
|
120
|
+
edges.push({ specifier, target, node });
|
|
121
|
+
await eachChild(node, visit);
|
|
78
122
|
}
|
|
79
|
-
visit(source(file));
|
|
123
|
+
await visit(await source(file));
|
|
124
|
+
return edges;
|
|
125
|
+
}
|
|
126
|
+
function report(file, rule, message) {
|
|
127
|
+
diagnostics.push({ file: path.relative(options.root, file).replaceAll("\\", "/"), rule, line: 1, column: 1, message });
|
|
80
128
|
}
|
|
81
|
-
function report(file,rule,message) { diagnostics.push({file:path.relative(options.root,file).replaceAll("\\","/"),rule,line:1,column:1,message}); }
|
|
82
129
|
for (const file of tests) {
|
|
83
|
-
const own = owner(file),
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
130
|
+
const own = owner(file),
|
|
131
|
+
inside = isInside(options.dsRoot, file);
|
|
132
|
+
const edges = await imports(file);
|
|
133
|
+
const marked = adsFileRole(file) === "behavior.spec" || caseTagged(await source(file));
|
|
134
|
+
if (marked && !registered.has(file))
|
|
135
|
+
report(file, "test-registration", "ADS behavior specs must be registered by their owning contract. Register this file or remove the obsolete spec.");
|
|
87
136
|
if (inside) {
|
|
88
|
-
const unit = inventory.units.find(unit=>unit.id===own);
|
|
89
|
-
const real =
|
|
90
|
-
|
|
137
|
+
const unit = inventory.units.find((unit) => unit.id === own);
|
|
138
|
+
const real =
|
|
139
|
+
["configuration", "foundation", "tokens"].includes(own) ||
|
|
140
|
+
unit?.files.some((relative) => {
|
|
141
|
+
const target = path.resolve(options.root, relative);
|
|
142
|
+
return !isDevelopmentFile(target, options) || (own?.startsWith("composition/") && isScenarioFile(target));
|
|
143
|
+
});
|
|
144
|
+
if (!real)
|
|
145
|
+
report(file, "test-ownership", "ADS tests belong beside a real runtime or composition owner. A test/helper file alone cannot create an owner.");
|
|
91
146
|
}
|
|
92
147
|
if (!inside) {
|
|
93
148
|
// Application tests may integrate public UI alongside application runtime.
|
|
94
149
|
// Helpers under test/ do not masquerade as the application subject.
|
|
95
|
-
let hasAppSubject = edges.some(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
150
|
+
let hasAppSubject = edges.some(
|
|
151
|
+
(edge) => isInside(options.sourceRoot, edge.target) && !isInside(options.dsRoot, edge.target) && !isDevelopmentFile(edge.target, options),
|
|
152
|
+
);
|
|
153
|
+
const seen = new Set();
|
|
154
|
+
let usesAds = marked;
|
|
155
|
+
async function trace(target) {
|
|
156
|
+
if (seen.has(target)) return;
|
|
157
|
+
seen.add(target);
|
|
158
|
+
for (const edge of await imports(target)) {
|
|
159
|
+
if (isInside(options.dsRoot, edge.target)) usesAds = true;
|
|
160
|
+
else if (isDevelopmentFile(edge.target, options)) await trace(edge.target);
|
|
161
|
+
else if (isInside(options.sourceRoot, edge.target)) hasAppSubject = true;
|
|
103
162
|
}
|
|
104
163
|
}
|
|
105
|
-
trace(file);
|
|
106
|
-
if (usesAds && !hasAppSubject)
|
|
164
|
+
await trace(file);
|
|
165
|
+
if (usesAds && !hasAppSubject)
|
|
166
|
+
report(
|
|
167
|
+
file,
|
|
168
|
+
"test-ownership",
|
|
169
|
+
"This test exercises ADS without an application runtime subject. Move it beside its owning component/pattern or composition; application integration tests stay beside their application subject.",
|
|
170
|
+
);
|
|
107
171
|
}
|
|
108
172
|
// Development helpers cannot hide a private import across owners. Public
|
|
109
173
|
// barrel imports are permitted and stop at the declared API boundary.
|
|
110
174
|
if (inside) {
|
|
111
175
|
const seen = new Set();
|
|
112
|
-
function trace(target) {
|
|
113
|
-
if (seen.has(target)) return;
|
|
114
|
-
|
|
176
|
+
async function trace(target) {
|
|
177
|
+
if (seen.has(target)) return;
|
|
178
|
+
seen.add(target);
|
|
179
|
+
for (const edge of await imports(target)) {
|
|
115
180
|
if (edge.specifier === options.config.publicAlias || edge.specifier === `${options.config.publicAlias}/review`) continue;
|
|
116
|
-
if (!isInside(options.dsRoot,edge.target)) continue;
|
|
117
|
-
if (isDevelopmentFile(edge.target,options)) {
|
|
118
|
-
|
|
181
|
+
if (!isInside(options.dsRoot, edge.target)) continue;
|
|
182
|
+
if (isDevelopmentFile(edge.target, options)) {
|
|
183
|
+
await trace(edge.target);
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (owner(edge.target) !== own && edge.target !== path.join(options.dsRoot, options.config.stylesEntry))
|
|
187
|
+
report(
|
|
188
|
+
file,
|
|
189
|
+
"test-private-import",
|
|
190
|
+
`Test ${own} reaches private source owned by ${owner(edge.target)} through ${path.relative(options.root, target)}. Use the public ADS API for peers; private helpers stay with their owner.`,
|
|
191
|
+
);
|
|
119
192
|
}
|
|
120
193
|
}
|
|
121
|
-
trace(file);
|
|
194
|
+
await trace(file);
|
|
122
195
|
}
|
|
123
196
|
}
|
|
124
197
|
return diagnostics;
|
|
@@ -38,7 +38,7 @@ const generatedTexts = (options, tokens) => {
|
|
|
38
38
|
};
|
|
39
39
|
const header = "/* Generated by ADS from the token sheets' per-theme halves and ds.config.json themes and brands.\n The showcase and MCP server rewrite it when they change; do not edit it. */\n";
|
|
40
40
|
|
|
41
|
-
const declaration =
|
|
41
|
+
const declaration = (definition )=>({property:definition.property??definition.name,value:(definition.authored??definition.value).trim()});
|
|
42
42
|
const block = (selector, lines) => lines.length ? [`${selector} {`, ...lines.map(line => ` ${line}`), "}"] : [];
|
|
43
43
|
|
|
44
44
|
/** The at-rule conditions of a default-brand :root definition ("@media … > :root"), or null. */
|