import type { TokenClass } from "../../../lib/view/model.ts"; /** * Source evidence whose token class proves that a language highlighter ran. */ export interface HighlightEvidence { readonly text: string; readonly className: TokenClass; } /** Selection paths exercised for a language, carried by one of its fixtures. */ export interface SelectionCases { readonly filenames: readonly string[]; readonly aliases: readonly string[]; readonly shebangs?: readonly string[]; /** Names no language claims, under which the fixture's own source selects * the language. */ readonly unclaimedFilenames?: readonly string[]; } /** * One source family in the shared `cf view` language fixture corpus. * * The repository, commit, and path identify a file in the frozen coverage * survey. The checked-in sources reduce that file to the syntax needed by the * fixture contract, then adapt it into before, after, and incomplete states. */ export interface ViewLanguageFixture { readonly languageId: string; /** Other adapters that deliberately share this fixture's token evidence. */ readonly highlightingPeers?: readonly string[]; readonly surveyRepository: string; readonly surveyCommit: string; readonly surveyPath: string; readonly before: URL; readonly after: URL; readonly incomplete: URL; /** Present on the fixture that carries the language's selection routes. */ readonly selection?: SelectionCases; readonly beforeEvidence: HighlightEvidence; readonly afterEvidence: HighlightEvidence; readonly incompleteEvidence: HighlightEvidence; } /** Text-language fixtures covered by the shared language contract. */ export const VIEW_LANGUAGE_FIXTURES: readonly ViewLanguageFixture[] = [ { languageId: "typescript", surveyRepository: "labs", surveyCommit: "a09656c3342bf3e34b68c5f754c25473acb0afef", surveyPath: "packages/patterns/counter/counter.tsx", before: new URL("./typescript/before.tsx", import.meta.url), after: new URL("./typescript/after.tsx", import.meta.url), incomplete: new URL("./typescript/incomplete.fixture", import.meta.url), selection: { filenames: [ "packages/patterns/counter/counter.tsx", "src/runtime.ts", "scripts/check.mts", "scripts/check.cts", "web/client.js", "web/client.jsx", "tools/inspect.mjs", "tools/inspect.cjs", ], aliases: ["typescript", "ts", "javascript", "js"], shebangs: [ "#!/usr/bin/env -S deno run -A", "#!/usr/bin/env node", "#!/usr/bin/nodejs", "#!/usr/bin/env bun", ], }, beforeEvidence: { text: "pattern", className: "builderCall" }, afterEvidence: { text: "pattern", className: "builderCall" }, incompleteEvidence: { text: "`Count: ${", className: "template" }, }, { languageId: "markdown", surveyRepository: "specs", surveyCommit: "57d00d343109b34e279a11efcb8517ff0e25e9c4", surveyPath: "attention-framework/README.md", before: new URL("./markdown/before.md", import.meta.url), after: new URL("./markdown/after.md", import.meta.url), incomplete: new URL("./markdown/incomplete.fixture", import.meta.url), selection: { filenames: [ "attention-framework/README.md", "notes.markdown", "guide.mdown", "guide.mkd", "guide.mdx", ], aliases: ["markdown", "md"], }, beforeEvidence: { text: "# Attention Framework", className: "sectionHeader", }, afterEvidence: { text: "# Attention Framework revision", className: "sectionHeader", }, incompleteEvidence: { text: "```ts", className: "punctuation" }, }, { languageId: "json", // A Java properties line colors the key before its `:` as a property name, // as JSON and YAML color their keys. highlightingPeers: ["json-lines", "properties"], surveyRepository: "labs", surveyCommit: "a09656c3342bf3e34b68c5f754c25473acb0afef", surveyPath: "deno.jsonc", before: new URL("./json/before.jsonc", import.meta.url), after: new URL("./json/after.jsonc", import.meta.url), incomplete: new URL("./json/incomplete.fixture", import.meta.url), selection: { filenames: [ "deno.jsonc", "package.json", "settings.jsonc.example", "packages/shell/public/manifest.webmanifest", "packages/memory/memory.tldr", "deno.lock", "bay.code-workspace", "ios/Package.resolved", "images/syzkaller/default-gvisor-config.cfg", ], aliases: ["json", "jsonc"], }, beforeEvidence: { text: '"tasks"', className: "propertyName" }, afterEvidence: { text: '"tasks"', className: "propertyName" }, incompleteEvidence: { text: '"workspace"', className: "propertyName" }, }, { languageId: "json-lines", surveyRepository: "labs", surveyCommit: "69fcd7efa983a143d1fbe0bc8167b0a6a9be6835", surveyPath: "tasks/test-identity-aliases.jsonl", before: new URL("./json-lines/before.jsonl", import.meta.url), after: new URL("./json-lines/after.jsonl", import.meta.url), incomplete: new URL( "./json-lines/incomplete.fixture", import.meta.url, ), selection: { filenames: [ "tasks/test-identity-aliases.jsonl", "tests/fixtures/location.point.sample.ndjson", ], aliases: ["json-lines", "jsonl", "ndjson"], }, beforeEvidence: { text: '"queued"', className: "propertyName" }, afterEvidence: { text: '"processed"', className: "propertyName" }, incompleteEvidence: { text: '"editing"', className: "propertyName" }, }, { languageId: "yaml", // Java properties and INI lines color the key before a `:` as a property // name, as YAML colors its keys. highlightingPeers: ["properties", "ini"], surveyRepository: "common-cluster", surveyCommit: "50c7f1bb0b83dad6057b3bde73ce599f86624084", surveyPath: ".github/workflows/ci.yml", before: new URL("./yaml/before.yml", import.meta.url), after: new URL("./yaml/after.yml", import.meta.url), incomplete: new URL("./yaml/incomplete.yml", import.meta.url), selection: { filenames: [ ".github/workflows/ci.yml", "deploy/config.yaml", ], aliases: ["yaml", "yml"], }, beforeEvidence: { text: "jobs", className: "propertyName" }, afterEvidence: { text: "jobs", className: "propertyName" }, incompleteEvidence: { text: "script", className: "propertyName" }, }, { languageId: "python", surveyRepository: "loom", surveyCommit: "43a4afe18fbfc37ab8a11da8fe5011f0be81f6e7", surveyPath: "src/bin/loom-size-report.py", before: new URL("./python-loom/before.py", import.meta.url), after: new URL("./python-loom/after.py", import.meta.url), incomplete: new URL("./python-loom/incomplete.py", import.meta.url), selection: { filenames: [ "src/bin/loom-size-report.py", "cfc/formal/scripts/check-architecture.py", "src/probe/artifact_refs.py", "bench/analyze.py", "vdso/check_vdso.py", "src/loom/types.pyi", "tools/app.pyw", ], aliases: ["python", "py"], shebangs: [ "#!/usr/bin/python3", "#!/usr/bin/env python", "#!/usr/bin/env pypy3", "#!/usr/bin/env -S uv run --script", ], }, beforeEvidence: { text: "count_items", className: "functionName" }, afterEvidence: { text: "count_items", className: "functionName" }, incompleteEvidence: { text: "count_items", className: "functionName" }, }, { languageId: "python", surveyRepository: "specs", surveyCommit: "34fb8680caa9f68005a438854fa5dc2ef15ff953", surveyPath: "cfc/formal/scripts/check-architecture.py", before: new URL("./python-specs/before.py", import.meta.url), after: new URL("./python-specs/after.py", import.meta.url), incomplete: new URL("./python-specs/incomplete.py", import.meta.url), beforeEvidence: { text: "closure", className: "functionName" }, afterEvidence: { text: "closure", className: "functionName" }, incompleteEvidence: { text: "closure", className: "functionName" }, }, { languageId: "python", surveyRepository: "legibility", surveyCommit: "ff46a8e811e0f75246b2fe1cafa8e18954dede3f", surveyPath: "src/probe/artifact_refs.py", before: new URL("./python-legibility/before.py", import.meta.url), after: new URL("./python-legibility/after.py", import.meta.url), incomplete: new URL("./python-legibility/incomplete.py", import.meta.url), beforeEvidence: { text: "display_date", className: "functionName" }, afterEvidence: { text: "display_date", className: "functionName" }, incompleteEvidence: { text: "display_date", className: "functionName" }, }, { languageId: "python", surveyRepository: "raia", surveyCommit: "a9998da33e2a04df830d684cd6eef1a3ec2a4f59", surveyPath: "bench/analyze.py", before: new URL("./python-raia/before.py", import.meta.url), after: new URL("./python-raia/after.py", import.meta.url), incomplete: new URL("./python-raia/incomplete.py", import.meta.url), beforeEvidence: { text: "fail_vec", className: "functionName" }, afterEvidence: { text: "fail_vec", className: "functionName" }, incompleteEvidence: { text: "fail_vec", className: "functionName" }, }, { languageId: "python", surveyRepository: "gvisor", surveyCommit: "0da391ef9ab8d513fba6412f4b14680917a00556", surveyPath: "vdso/check_vdso.py", before: new URL("./python-gvisor/before.py", import.meta.url), after: new URL("./python-gvisor/after.py", import.meta.url), incomplete: new URL("./python-gvisor/incomplete.py", import.meta.url), beforeEvidence: { text: "PageRoundDown", className: "functionName" }, afterEvidence: { text: "PageRoundDown", className: "functionName" }, incompleteEvidence: { text: "PageRoundDown", className: "functionName" }, }, { languageId: "swift", surveyRepository: "fabric-mobile", surveyCommit: "94ae27c19a5accba06ccc84172a6e0f7bc16259c", surveyPath: "plugins/tauri-plugin-loom-location/ios/Sources/LoomLocationPlugin/LoomLocationPlugin.swift", before: new URL("./swift-fabric-mobile/before.swift", import.meta.url), after: new URL("./swift-fabric-mobile/after.swift", import.meta.url), incomplete: new URL( "./swift-fabric-mobile/incomplete.swift", import.meta.url, ), selection: { filenames: [ "plugins/tauri-plugin-loom-location/ios/Sources/LoomLocationPlugin/LoomLocationPlugin.swift", "plugins/tauri-plugin-loom-location/ios/Package.swift", "tools/cfc-sandbox/Package.swift", "Package@swift-5.9.swift", "icontact/extract-contacts.swift", "ios/FabricBeacon/Beacon/Barometer.swift", ], aliases: ["swift"], shebangs: [ "#!/usr/bin/swift", "#!/usr/bin/env swift", "#!/usr/bin/xcrun swift", "#!/usr/bin/env xcrun swift", ], }, beforeEvidence: { text: "startBeacon", className: "functionName" }, afterEvidence: { text: "startBeacon", className: "functionName" }, incompleteEvidence: { text: "startBeacon", className: "functionName" }, }, { languageId: "swift", surveyRepository: "gvisor", surveyCommit: "bb309e286c61e1a5a5f9893666443a9ea31c4f17", surveyPath: "tools/cfc-sandbox/Package.swift", before: new URL("./swift-gvisor/before.swift", import.meta.url), after: new URL("./swift-gvisor/after.swift", import.meta.url), incomplete: new URL("./swift-gvisor/incomplete.swift", import.meta.url), beforeEvidence: { text: "package", className: "binding" }, afterEvidence: { text: "package", className: "binding" }, incompleteEvidence: { text: "package", className: "binding" }, }, { languageId: "swift", surveyRepository: "loom", surveyCommit: "43a4afe18fbfc37ab8a11da8fe5011f0be81f6e7", surveyPath: "src/services/loom-daemon/attention/usps_vision.swift", before: new URL("./swift-loom/before.swift", import.meta.url), after: new URL("./swift-loom/after.swift", import.meta.url), incomplete: new URL("./swift-loom/incomplete.swift", import.meta.url), beforeEvidence: { text: "guard", className: "controlKeyword" }, afterEvidence: { text: "guard", className: "controlKeyword" }, incompleteEvidence: { text: "guard", className: "controlKeyword" }, }, { languageId: "swift", surveyRepository: "loom-scripts", surveyCommit: "fb0f2eb1031c548992b4e76bd79f79c30b7c548e", surveyPath: "icontact/extract-contacts.swift", before: new URL("./swift-loom-scripts/before.swift", import.meta.url), after: new URL("./swift-loom-scripts/after.swift", import.meta.url), incomplete: new URL( "./swift-loom-scripts/incomplete.swift", import.meta.url, ), beforeEvidence: { text: "labelString", className: "functionName" }, afterEvidence: { text: "labelString", className: "functionName" }, incompleteEvidence: { text: "labelString", className: "functionName" }, }, { languageId: "kotlin", surveyRepository: "commonfabric-weaver", surveyCommit: "776e81bca0cbee698d99808973212273b62af8d0", surveyPath: "android/app/src/main/java/com/commontools/CommonFabricWeaver/IOSPeopleSummaryRepository.kt", before: new URL("./kotlin-weaver/before.kt", import.meta.url), after: new URL("./kotlin-weaver/after.kt", import.meta.url), incomplete: new URL("./kotlin-weaver/incomplete.kt", import.meta.url), selection: { filenames: [ "android/app/src/main/java/com/commontools/CommonFabricWeaver/IOSPeopleSummaryRepository.kt", "android/app/build.gradle.kts", "android/settings.gradle.kts", "scripts/release.main.kts", ], aliases: ["kotlin", "kt"], shebangs: ["#!/usr/bin/env kotlin"], }, beforeEvidence: { text: "read", className: "functionName" }, afterEvidence: { text: "read", className: "functionName" }, incompleteEvidence: { text: "suspend", className: "keyword" }, }, { languageId: "kotlin", surveyRepository: "commonfabric-weaver", surveyCommit: "e88977de1086357c148795a3d8560ff164ba2278", surveyPath: "android/app/build.gradle.kts", before: new URL( "./kotlin-weaver-gradle/before.gradle.kts", import.meta.url, ), after: new URL("./kotlin-weaver-gradle/after.gradle.kts", import.meta.url), incomplete: new URL( "./kotlin-weaver-gradle/incomplete.gradle.kts", import.meta.url, ), beforeEvidence: { text: "uploadKeystore", className: "binding" }, afterEvidence: { text: "uploadKeystore", className: "binding" }, incompleteEvidence: { text: "uploadKeystore", className: "binding" }, }, { languageId: "toml", // An INI section header is a TOML table header, and INI colors its name // as TOML colors a table's. highlightingPeers: ["ini"], surveyRepository: "labs", surveyCommit: "fbdd14d3fa220dfffcb52a423d1180e514c5134b", surveyPath: "mise.toml", before: new URL("./toml-labs/before.toml", import.meta.url), after: new URL("./toml-labs/after.toml", import.meta.url), incomplete: new URL("./toml-labs/incomplete.toml", import.meta.url), selection: { filenames: [ "mise.toml", "android/gradle/libs.versions.toml", "images/basic/rust/Cargo.toml", "Cargo.lock", "cfc/lakefile.toml", "pyproject.toml", ], aliases: ["toml"], }, beforeEvidence: { text: "tools", className: "interfaceName" }, afterEvidence: { text: "tools", className: "interfaceName" }, incompleteEvidence: { text: "tools", className: "interfaceName" }, }, { languageId: "hcl", surveyRepository: "infra", surveyCommit: "3ae071216e1aad454f2465e8d57164d6c38c90e3", surveyPath: "tofu/ci-runners/alerts.tf", before: new URL("./hcl-infra/before.tf", import.meta.url), after: new URL("./hcl-infra/after.tf", import.meta.url), incomplete: new URL("./hcl-infra/incomplete.tf", import.meta.url), selection: { filenames: [ "tofu/ci-runners/alerts.tf", "tofu/ci-runners/prod.tfvars", "tofu/iam/.terraform.lock.hcl", "tofu/shell/override.tofu", "tofu/shell/prod.tfbackend", "tests/main.tftest.hcl", ], aliases: ["hcl", "opentofu", "tofu", "terraform", "tf"], }, beforeEvidence: { text: "reconcile_passes", className: "interfaceName" }, afterEvidence: { text: "controller_errors", className: "interfaceName" }, incompleteEvidence: { text: "controller_errors", className: "interfaceName", }, }, { languageId: "shell", surveyRepository: "infra", surveyCommit: "e86055db01424713770930acc24b5a20d2e96448", surveyPath: "k8s/scripts/force-sync-externalsecrets.sh", before: new URL("./shell-infra/before.sh", import.meta.url), after: new URL("./shell-infra/after.sh", import.meta.url), incomplete: new URL("./shell-infra/incomplete.sh", import.meta.url), selection: { filenames: [ "k8s/scripts/force-sync-externalsecrets.sh", "scripts/completion.bash", "install.command", ".bashrc", ".profile", // Git hooks and extensionless programs select shell through the // fixture's `bash` shebang. ".githooks/pre-commit", ".ops/hooks/post-merge", "android/gradlew", "images/arm-qemu/initramfs/init", ], aliases: ["shell", "sh", "bash"], shebangs: [ "#!/bin/sh", "#!/bin/bash", "#!/usr/bin/env bash", "#!/usr/bin/env sh", "#!/bin/dash", ], }, beforeEvidence: { text: "force_sync_and_wait", className: "functionName" }, afterEvidence: { text: "read_status_snapshot", className: "functionName" }, incompleteEvidence: { text: "local", className: "storageKeyword" }, }, { languageId: "shell", surveyRepository: "loom", surveyCommit: "12d633c0e865491b4d006c883f4201eab1edcaec", surveyPath: "src/bin/check-deno-setup-gate.sh", before: new URL("./shell-loom/before.sh", import.meta.url), after: new URL("./shell-loom/after.sh", import.meta.url), incomplete: new URL("./shell-loom/incomplete.sh", import.meta.url), beforeEvidence: { text: "setup_version_from_file", className: "functionName", }, afterEvidence: { text: "setup_version_from_file", className: "functionName", }, incompleteEvidence: { text: "fi", className: "controlKeyword" }, }, { languageId: "make", surveyRepository: "infra", surveyCommit: "574f4a94cebb04cd12134146a25f0d7ba804da67", surveyPath: "tofu/postmark/Makefile", before: new URL("./make-infra/before.mk", import.meta.url), after: new URL("./make-infra/after.mk", import.meta.url), incomplete: new URL("./make-infra/incomplete.mk", import.meta.url), selection: { filenames: [ "tofu/postmark/Makefile", "website/assets/logos/makefile", "GNUmakefile", "tools/bazel.mk", ], aliases: ["make", "makefile", "mk"], shebangs: ["#!/usr/bin/make -f", "#!/usr/bin/env make"], }, beforeEvidence: { text: "servers", className: "functionName" }, afterEvidence: { text: "verify-domains", className: "functionName" }, incompleteEvidence: { text: "if", className: "callName" }, }, { languageId: "properties", // A shell or make variable assignment, an HCL attribute, and an INI key are // each a `name=value` line, and shell, make, HCL, and INI color the name as // properties files color their keys. highlightingPeers: ["hcl", "shell", "make", "ini"], surveyRepository: "commonfabric-weaver", surveyCommit: "b457431c6f5e32305a2e6feb7901f8d05a9b2f6e", surveyPath: "android/gradle/wrapper/gradle-wrapper.properties", before: new URL("./properties-weaver/before.properties", import.meta.url), after: new URL("./properties-weaver/after.properties", import.meta.url), incomplete: new URL( "./properties-weaver/incomplete.properties", import.meta.url, ), selection: { filenames: [ "android/gradle/wrapper/gradle-wrapper.properties", "android/gradle.properties", "local.properties", ], aliases: ["properties", "java-properties"], }, beforeEvidence: { text: "distributionUrl", className: "propertyName" }, afterEvidence: { text: "distributionUrl", className: "propertyName" }, incompleteEvidence: { text: "distributionUrl", className: "propertyName" }, }, { languageId: "ini", // An INI `name=value` line is a valid make assignment, and make colors // the name as INI colors its keys. highlightingPeers: ["make"], surveyRepository: "infra", surveyCommit: "cfe4ac630b0b1e223d57bed12ae02fa6c53b9eb2", surveyPath: "ansible/rapids-inventory.ini", before: new URL("./ini-infra/before.ini", import.meta.url), after: new URL("./ini-infra/after.ini", import.meta.url), incomplete: new URL("./ini-infra/incomplete.ini", import.meta.url), selection: { filenames: [ "ansible/rapids-inventory.ini", "ansible/ansible.cfg", "pytest.ini", ".codespellrc", ], aliases: ["ini", "dosini", "cfg"], }, beforeEvidence: { text: "ansible_user", className: "propertyName" }, afterEvidence: { text: "ansible_user", className: "propertyName" }, incompleteEvidence: { text: "ansible_user", className: "propertyName" }, }, { languageId: "proguard", surveyRepository: "commonfabric-weaver", surveyCommit: "df01b1c67c027f3b3de39a5bd85e2f84312d6495", surveyPath: "android/app/proguard-rules.pro", before: new URL("./proguard-weaver/before.pro", import.meta.url), after: new URL("./proguard-weaver/after.pro", import.meta.url), incomplete: new URL("./proguard-weaver/incomplete.pro", import.meta.url), selection: { filenames: [ "android/app/proguard-rules.pro", "library/consumer-rules.pro", "rules/keep-jni.pro", ], aliases: ["proguard", "r8"], }, beforeEvidence: { text: "-keep", className: "keyword" }, afterEvidence: { text: "-keep", className: "keyword" }, incompleteEvidence: { text: "-keep", className: "keyword" }, }, { languageId: "xml", surveyRepository: "commonfabric-weaver", surveyCommit: "6cc0468bdafdf8dc44cd86faba60ff5912ead945", surveyPath: "android/app/src/main/AndroidManifest.xml", before: new URL("./xml-weaver/before.xml", import.meta.url), after: new URL("./xml-weaver/after.xml", import.meta.url), incomplete: new URL("./xml-weaver/incomplete.xml", import.meta.url), selection: { filenames: [ "android/app/src/main/AndroidManifest.xml", "android/app/src/main/res/values/styles.xml", "android/app/src/main/res/drawable/fabric_logo.xml", "apple/FabricWeaver/FabricWeaver.entitlements", "apple/FabricWeaver/PrivacyInfo.xcprivacy", "apple/FabricWeaver/Info.plist", "docs/images/logo.svg", "FabricWeaver.xcworkspace/contents.xcworkspacedata", ], aliases: ["xml", "svg", "plist"], unclaimedFilenames: [ "apple/FabricWeaver/Base.lproj/Main.storyboard", "apple/FabricWeaver/MainMenu.xib", ], }, beforeEvidence: { text: "android:allowBackup", className: "propertyName", }, afterEvidence: { text: "android:allowBackup", className: "propertyName" }, incompleteEvidence: { text: "android:allowBackup", className: "propertyName", }, }, { languageId: "plain-text", surveyRepository: "raia", surveyCommit: "6b9cc95befe5f7cf0929eb569d9a1157e62d2374", surveyPath: "LICENSE", before: new URL("./plain-text/before", import.meta.url), after: new URL("./plain-text/after", import.meta.url), incomplete: new URL("./plain-text/incomplete", import.meta.url), selection: { filenames: [ "harness/tasks_postmortem_declines/bay_261_sticky_ids", "notes.txt", "LICENSE", "NOTICE", "LICENSE.third-party", "NOTICE.third-party", ], aliases: ["plain-text", "text", "plaintext"], }, beforeEvidence: { text: "# Permission to use, copy, and modify", className: "plain", }, afterEvidence: { text: "# Permission to use, copy, and distribute", className: "plain", }, incompleteEvidence: { text: "# THE SOFTWARE IS PROVIDED “AS IS", className: "plain", }, }, ];