{
  "$comment": "One adapter per stack: how the stack is recognised, which commands build, test and (optionally) lint it, which log lines prove or disprove a pass, which parser reads its test counts, and where its truth sources live. _stack-adapter.mjs loads and validates this file; evidence-gate.mjs --stack reads the markers from it, test-summary.mjs reads the parser order. Patterns are JavaScript regular expressions. A build tool that prints nothing on success gets an exitMarker: the rendered command echoes it only when the tool exits 0, so the log carries a line the gate can read. The unknown adapter is what every lookup returns for a stack nobody described; its gates report not-applicable instead of failing.",
  "version": "1.0.0",
  "order": ["ios", "android", "go", "rust", "python", "jvm", "web", "backend-node"],
  "adapters": {
    "ios": {
      "label": "iOS / Apple platforms (Xcode, Swift Package Manager)",
      "detection": { "stackDetect": "ios" },
      "commands": [
        {
          "build": {
            "template": "xcodebuild build -scheme \"{scheme}\" -destination \"generic/platform=iOS\" -derivedDataPath \"{worktreePath}/.DerivedData\""
          },
          "test": {
            "template": "xcodebuild test -scheme \"{scheme}\" -destination \"platform=iOS Simulator,name={simulator}\" -derivedDataPath \"{worktreePath}/.DerivedData\" -resultBundlePath \"{resultBundle}\""
          },
          "lint": { "template": "swift format lint --strict --recursive Sources Tests" }
        }
      ],
      "markers": {
        "build": {
          "success": [
            { "pattern": "\\*\\* BUILD SUCCEEDED \\*\\*" },
            { "pattern": "Build: SUCCESS" },
            { "pattern": "Build complete!" }
          ],
          "failure": [
            { "pattern": "\\*\\* BUILD FAILED \\*\\*" },
            { "pattern": "Build: FAILURE" },
            { "pattern": "The following build commands failed:" },
            { "pattern": "fatal error:" }
          ]
        },
        "test": {
          "success": [
            { "pattern": "\\*\\* TEST SUCCEEDED \\*\\*" },
            { "pattern": "Executed [1-9][0-9]* tests?, with 0 failures" },
            { "pattern": "Test run with [1-9][0-9]* tests?.* passed after" }
          ],
          "failure": [
            { "pattern": "\\*\\* TEST FAILED \\*\\*" },
            { "pattern": "\\*\\* BUILD FAILED \\*\\*" },
            {
              "pattern": "Executed [0-9]+ tests?, with (?:[0-9]+ tests? skipped and )?[1-9][0-9]* failures?"
            },
            { "pattern": "Test run with [0-9]+ tests?.* failed after" },
            { "pattern": "Test [Cc]ase '[^']+' failed" }
          ],
          "loadError": [
            { "pattern": "\\*\\* TEST BUILD FAILED \\*\\*" },
            { "pattern": "Testing cancelled because the build failed" },
            { "pattern": "^\\S+\\.swift:[0-9]+:[0-9]+: error: ", "flags": "m" },
            { "pattern": "error: compile command failed" }
          ]
        }
      },
      "testSummary": { "parsers": ["xcodebuild", "xcresult"] },
      "testFilePatterns": ["(^|/)[^/]*Tests?/", "Tests?\\.swift$"],
      "truthSources": {
        "localization": [
          "**/*.xcstrings",
          "**/*.lproj/*.strings",
          "**/*.lproj/*.stringsdict",
          "**/Generated/**/*Localiz*.swift"
        ],
        "endpoints": ["**/Generated/**/Endpoints/**/*.swift", "**/openapi*.{json,yaml,yml}"],
        "generated": ["**/Generated/**/*.swift", "**/*.xcassets"]
      },
      "referencePatterns": {
        "localization": [
          "NSLocalizedString\\(\\s*\"(?<ref>[^\"]+)\"",
          "String\\(localized:\\s*\"(?<ref>[^\"]+)\"",
          "LocalizedStringKey\\(\\s*\"(?<ref>[^\"]+)\"",
          "\\bL10n\\.(?<ref>[A-Za-z_][A-Za-z0-9_.]*)"
        ],
        "endpoints": ["path:\\s*\"(?<ref>/[^\"]*)\""]
      }
    },
    "android": {
      "label": "Android (Gradle with the Android plugin)",
      "detection": { "stackDetect": "android" },
      "commands": [
        {
          "build": { "template": "./gradlew assembleDebug" },
          "test": { "template": "./gradlew testDebugUnitTest" },
          "lint": { "template": "./gradlew lintDebug" }
        }
      ],
      "markers": {
        "build": {
          "success": [{ "pattern": "BUILD SUCCESSFUL" }],
          "failure": [
            { "pattern": "BUILD FAILED" },
            { "pattern": "FAILURE: Build failed with an exception" }
          ]
        },
        "test": {
          "success": [{ "pattern": "BUILD SUCCESSFUL" }],
          "failure": [
            { "pattern": "BUILD FAILED" },
            { "pattern": "There were failing tests" },
            { "pattern": "[0-9]+ tests? completed, [1-9][0-9]* failed" },
            { "pattern": "^\\S.* > .* FAILED$", "flags": "m" }
          ],
          "loadError": [
            { "pattern": "^e: ", "flags": "m" },
            { "pattern": "Compilation failed" },
            { "pattern": "> Task :\\S*compile\\S*(?:Kotlin|Java)\\S* FAILED" }
          ]
        }
      },
      "testSummary": {
        "parsers": ["junit-xml", "gradle"],
        "resultFiles": ["**/build/test-results/**/*.xml"]
      },
      "testFilePatterns": ["(^|/)src/(test|androidTest)[^/]*/", "Test\\.(kt|java)$"],
      "truthSources": {
        "localization": [
          "**/src/main/res/values*/strings.xml",
          "**/src/main/res/values*/plurals.xml"
        ],
        "endpoints": ["**/*ApiService.kt", "**/*Api.kt", "**/openapi*.{json,yaml,yml}"],
        "generated": ["**/build/generated/**/*.kt"]
      },
      "referencePatterns": {
        "localization": [
          "\\bR\\.string\\.(?<ref>[A-Za-z0-9_]+)",
          "\\bR\\.plurals\\.(?<ref>[A-Za-z0-9_]+)",
          "@string/(?<ref>[A-Za-z0-9_]+)"
        ],
        "endpoints": ["@(?:GET|POST|PUT|PATCH|DELETE|HEAD)\\(\\s*\"(?<ref>[^\"]+)\""]
      }
    },
    "web": {
      "label": "Web front end (package.json with a UI framework)",
      "detection": { "stackDetect": "web" },
      "commands": [
        {
          "build": { "packageScript": "build", "exitMarker": "[pipeline] build exited 0" },
          "test": { "packageScript": "test" },
          "testFile": { "packageScript": "test", "args": ["{file}"] },
          "lint": { "packageScript": "lint" }
        }
      ],
      "markers": {
        "build": {
          "success": [
            { "pattern": "compiled successfully", "flags": "i" },
            { "pattern": "✓ built in" },
            { "pattern": "^\\[pipeline\\] build exited 0$", "flags": "m" }
          ],
          "failure": [
            { "pattern": "Failed to compile" },
            { "pattern": "error TS[0-9]+:" },
            { "pattern": "error during build:" },
            { "pattern": "^npm (?:ERR!|error) ", "flags": "m" },
            { "pattern": "ERR_PNPM_" },
            { "pattern": "ELIFECYCLE" }
          ]
        },
        "test": {
          "success": [
            { "pattern": "^\\s*Tests:?\\s+.*\\b[1-9][0-9]* passed", "flags": "m" },
            { "pattern": "^[#ℹ] pass [1-9][0-9]*$", "flags": "m" },
            { "pattern": "\\b[1-9][0-9]* passing\\b" }
          ],
          "failure": [
            { "pattern": "^\\s*Tests?(?: Files)?:?\\s+.*\\b[1-9][0-9]* failed", "flags": "m" },
            { "pattern": "^FAIL\\s", "flags": "m" },
            { "pattern": "^[#ℹ] fail [1-9][0-9]*$", "flags": "m" },
            { "pattern": "\\b[1-9][0-9]* failing\\b" },
            { "pattern": "^npm (?:ERR!|error) ", "flags": "m" },
            { "pattern": "ELIFECYCLE" },
            { "pattern": "^\\s*Errors\\s+[1-9][0-9]*\\s+errors?\\b", "flags": "m" },
            { "pattern": "^error Command failed with exit code [1-9]", "flags": "m" }
          ],
          "skipped": [
            { "pattern": "No test files found" },
            { "pattern": "^No tests found", "flags": "m" }
          ],
          "loadError": [
            { "pattern": "ERR_MODULE_NOT_FOUND" },
            { "pattern": "Cannot find module" },
            { "pattern": "does not provide an export named" },
            { "pattern": "^SyntaxError: ", "flags": "m" },
            { "pattern": "Failed to load url" }
          ]
        }
      },
      "testSummary": { "parsers": ["vitest", "jest", "node-test"] },
      "testFilePatterns": [
        "\\.(test|spec)\\.[cm]?[jt]sx?$",
        "(^|/)__tests__/",
        "(^|/)(test|tests|e2e)/"
      ],
      "truthSources": {
        "localization": [
          "**/locales/**/*.json",
          "**/i18n/**/*.json",
          "**/messages/*.json",
          "**/lang/*.json"
        ],
        "endpoints": ["**/openapi*.{json,yaml,yml}", "**/generated/**/*.{ts,js}"],
        "generated": ["**/generated/**/*.{ts,js}"]
      },
      "referencePatterns": {
        "localization": [
          "\\bt\\(\\s*[\"'`](?<ref>[^\"'`]+)[\"'`]",
          "\\bi18n\\.t\\(\\s*[\"'`](?<ref>[^\"'`]+)[\"'`]",
          "<FormattedMessage[^>]*\\bid=[\"'](?<ref>[^\"']+)[\"']"
        ],
        "endpoints": [
          "\\bfetch\\(\\s*[\"'`](?<ref>/[^\"'`]*)[\"'`]",
          "\\b(?:axios|http|api)\\.(?:get|post|put|patch|delete)\\(\\s*[\"'`](?<ref>/[^\"'`]*)[\"'`]"
        ]
      }
    },
    "backend-node": {
      "label": "Node.js service or CLI (package.json without a UI framework)",
      "detection": { "stackDetect": "backend", "manifests": ["package.json"] },
      "commands": [
        {
          "build": { "packageScript": "build", "exitMarker": "[pipeline] build exited 0" },
          "test": { "packageScript": "test" },
          "testFile": { "packageScript": "test", "args": ["{file}"] },
          "lint": { "packageScript": "lint" }
        }
      ],
      "markers": {
        "build": {
          "success": [{ "pattern": "^\\[pipeline\\] build exited 0$", "flags": "m" }],
          "failure": [
            { "pattern": "error TS[0-9]+:" },
            { "pattern": "^npm (?:ERR!|error) ", "flags": "m" },
            { "pattern": "ERR_PNPM_" },
            { "pattern": "ELIFECYCLE" }
          ]
        },
        "test": {
          "success": [
            { "pattern": "^\\s*Tests:?\\s+.*\\b[1-9][0-9]* passed", "flags": "m" },
            { "pattern": "^[#ℹ] pass [1-9][0-9]*$", "flags": "m" },
            { "pattern": "\\b[1-9][0-9]* passing\\b" }
          ],
          "failure": [
            { "pattern": "^\\s*Tests?(?: Files)?:?\\s+.*\\b[1-9][0-9]* failed", "flags": "m" },
            { "pattern": "^FAIL\\s", "flags": "m" },
            { "pattern": "^[#ℹ] fail [1-9][0-9]*$", "flags": "m" },
            { "pattern": "\\b[1-9][0-9]* failing\\b" },
            { "pattern": "^npm (?:ERR!|error) ", "flags": "m" },
            { "pattern": "ELIFECYCLE" },
            { "pattern": "^\\s*Errors\\s+[1-9][0-9]*\\s+errors?\\b", "flags": "m" },
            { "pattern": "^error Command failed with exit code [1-9]", "flags": "m" }
          ],
          "skipped": [
            { "pattern": "No test files found" },
            { "pattern": "^No tests found", "flags": "m" }
          ],
          "loadError": [
            { "pattern": "ERR_MODULE_NOT_FOUND" },
            { "pattern": "Cannot find module" },
            { "pattern": "does not provide an export named" },
            { "pattern": "^SyntaxError: ", "flags": "m" },
            { "pattern": "Failed to load url" }
          ]
        }
      },
      "testSummary": { "parsers": ["node-test", "vitest", "jest"] },
      "testFilePatterns": ["\\.(test|spec)\\.[cm]?[jt]s$", "(^|/)__tests__/", "(^|/)(test|tests)/"],
      "truthSources": {
        "localization": ["**/locales/**/*.json", "**/i18n/**/*.json"],
        "endpoints": ["**/openapi*.{json,yaml,yml}", "**/routes/**/*.{js,ts,mjs}"],
        "generated": ["**/generated/**/*.{ts,js}"]
      },
      "referencePatterns": {
        "localization": ["\\bt\\(\\s*[\"'`](?<ref>[^\"'`]+)[\"'`]"],
        "endpoints": [
          "\\b(?:app|router|server|fastify)\\.(?:get|post|put|patch|delete|all)\\(\\s*[\"'`](?<ref>/[^\"'`]*)[\"'`]"
        ]
      }
    },
    "python": {
      "label": "Python",
      "detection": {
        "manifests": ["pyproject.toml", "requirements.txt", "setup.py", "setup.cfg", "Pipfile"]
      },
      "commands": [
        {
          "build": {
            "template": "python -m compileall -q .",
            "exitMarker": "[pipeline] build exited 0"
          },
          "test": { "template": "python -m pytest" },
          "testFile": { "template": "python -m pytest {file}" }
        }
      ],
      "markers": {
        "build": {
          "success": [
            { "pattern": "^\\[pipeline\\] build exited 0$", "flags": "m" },
            { "pattern": "Successfully built " }
          ],
          "failure": [
            { "pattern": "SyntaxError:" },
            { "pattern": "\\*\\*\\* Error compiling" },
            { "pattern": "ERROR: Failed building" }
          ]
        },
        "test": {
          "success": [
            { "pattern": "\\b[1-9][0-9]* passed\\b" },
            { "pattern": "\\bPASSED\\b" },
            { "pattern": "^OK(?: \\(.*\\))?$", "flags": "m" }
          ],
          "failure": [
            { "pattern": "\\b[1-9][0-9]* failed\\b" },
            { "pattern": "\\b[1-9][0-9]* errors?\\b" },
            { "pattern": "^FAILED\\b", "flags": "m" },
            { "pattern": "^ERROR\\b", "flags": "m" }
          ],
          "skipped": [{ "pattern": "\\bno tests ran\\b" }],
          "loadError": [
            { "pattern": "\\bModuleNotFoundError\\b" },
            { "pattern": "\\bImportError\\b" },
            { "pattern": "ERROR collecting" }
          ]
        }
      },
      "testSummary": { "parsers": ["pytest", "junit-xml"] },
      "testFilePatterns": ["(^|/)test_[^/]*\\.py$", "_test\\.py$"],
      "truthSources": {
        "localization": ["**/locale/**/*.po", "**/locales/**/*.json"],
        "endpoints": ["**/openapi*.{json,yaml,yml}", "**/urls.py", "**/routes*.py"],
        "generated": ["**/*_pb2.py"]
      },
      "referencePatterns": {
        "localization": [
          "\\b_\\(\\s*[\"'](?<ref>[^\"']+)[\"']\\s*\\)",
          "\\bgettext\\(\\s*[\"'](?<ref>[^\"']+)[\"']"
        ],
        "endpoints": [
          "@(?:app|router|bp|blueprint)\\.(?:get|post|put|patch|delete|route)\\(\\s*[\"'](?<ref>/[^\"']*)[\"']",
          "\\bpath\\(\\s*[\"'](?<ref>[^\"']*)[\"']"
        ]
      }
    },
    "go": {
      "label": "Go modules",
      "detection": { "manifests": ["go.mod"] },
      "commands": [
        {
          "build": { "template": "go build ./...", "exitMarker": "[pipeline] build exited 0" },
          "test": { "template": "go test -v ./..." },
          "testFile": { "template": "go test -v ./{fileDir}" }
        }
      ],
      "markers": {
        "build": {
          "success": [{ "pattern": "^\\[pipeline\\] build exited 0$", "flags": "m" }],
          "failure": [
            { "pattern": "^# \\S+$", "flags": "m" },
            { "pattern": "\\.go:[0-9]+:[0-9]+: " }
          ]
        },
        "test": {
          "success": [
            { "pattern": "^ok\\s+\\S+", "flags": "m" },
            { "pattern": "^\\s*--- PASS: ", "flags": "m" },
            { "pattern": "\"Action\":\"pass\"" }
          ],
          "failure": [
            { "pattern": "^\\s*--- FAIL: ", "flags": "m" },
            { "pattern": "^FAIL\\b", "flags": "m" },
            { "pattern": "\"Action\":\"fail\"" },
            { "pattern": "\\[build failed\\]" },
            { "pattern": "^panic: ", "flags": "m" }
          ],
          "loadError": [{ "pattern": "\\[build failed\\]" }, { "pattern": "\\[setup failed\\]" }]
        }
      },
      "testSummary": { "parsers": ["go-test-json", "go-test"] },
      "testFilePatterns": ["_test\\.go$"],
      "truthSources": {
        "localization": ["**/locales/**/*.{json,toml,yaml}", "**/active.*.toml"],
        "endpoints": ["**/openapi*.{json,yaml,yml}", "**/*.proto"],
        "generated": ["**/*.pb.go", "**/*_gen.go"]
      },
      "referencePatterns": {
        "localization": ["\\bMessageID:\\s*\"(?<ref>[^\"]+)\""],
        "endpoints": [
          "\\.(?:HandleFunc|Handle|GET|POST|PUT|PATCH|DELETE)\\(\\s*\"(?<ref>/[^\"]*)\""
        ]
      }
    },
    "rust": {
      "label": "Rust (Cargo)",
      "detection": { "manifests": ["Cargo.toml"] },
      "commands": [
        {
          "build": { "template": "cargo build" },
          "test": { "template": "cargo test" },
          "testFile": { "template": "cargo test --test {fileStem}" }
        }
      ],
      "markers": {
        "build": {
          "success": [{ "pattern": "^\\s*Finished\\b.*\\btarget\\(s\\) in ", "flags": "m" }],
          "failure": [
            { "pattern": "error: could not compile" },
            { "pattern": "^error(?:\\[E[0-9]+\\])?:", "flags": "m" }
          ]
        },
        "test": {
          "success": [{ "pattern": "test result: ok\\. [1-9][0-9]* passed" }],
          "failure": [
            { "pattern": "test result: FAILED" },
            { "pattern": "error: test failed" },
            { "pattern": "error: could not compile" },
            { "pattern": "^test .* \\.\\.\\. FAILED$", "flags": "m" }
          ],
          "loadError": [{ "pattern": "error: could not compile" }]
        }
      },
      "testSummary": { "parsers": ["cargo-test"] },
      "testFilePatterns": ["(^|/)tests/.*\\.rs$"],
      "truthSources": {
        "localization": ["**/locales/**/*.{ftl,yml,yaml,json}", "**/i18n/**/*.ftl"],
        "endpoints": ["**/openapi*.{json,yaml,yml}", "**/*.proto"],
        "generated": ["**/generated/**/*.rs"]
      },
      "referencePatterns": {
        "localization": [
          "\\bt!\\(\\s*\"(?<ref>[^\"]+)\"",
          "\\bfl!\\(\\s*[A-Za-z_]+\\s*,\\s*\"(?<ref>[^\"]+)\""
        ],
        "endpoints": [
          "\\.route\\(\\s*\"(?<ref>/[^\"]*)\"",
          "#\\[(?:get|post|put|patch|delete)\\(\\s*\"(?<ref>/[^\"]*)\""
        ]
      }
    },
    "jvm": {
      "label": "JVM service (Maven or Gradle without the Android plugin)",
      "detection": {
        "manifests": ["pom.xml", "build.gradle", "build.gradle.kts"],
        "notWith": ["android"]
      },
      "commands": [
        {
          "when": ["pom.xml"],
          "build": { "template": "mvn -B -DskipTests package" },
          "test": { "template": "mvn -B test" },
          "testFile": { "template": "mvn -B test -Dtest={fileStem}" }
        },
        {
          "build": { "template": "./gradlew build -x test" },
          "test": { "template": "./gradlew test" },
          "testFile": { "template": "./gradlew test --tests {fileStem}" }
        }
      ],
      "markers": {
        "build": {
          "success": [{ "pattern": "BUILD SUCCESSFUL" }, { "pattern": "BUILD SUCCESS\\b" }],
          "failure": [
            { "pattern": "BUILD FAILED" },
            { "pattern": "BUILD FAILURE" },
            { "pattern": "FAILURE: Build failed with an exception" },
            { "pattern": "COMPILATION ERROR" }
          ]
        },
        "test": {
          "success": [
            { "pattern": "BUILD SUCCESSFUL" },
            { "pattern": "BUILD SUCCESS\\b" },
            { "pattern": "Tests run: [1-9][0-9]*, Failures: 0, Errors: 0" }
          ],
          "failure": [
            { "pattern": "BUILD FAILED" },
            { "pattern": "BUILD FAILURE" },
            { "pattern": "Tests run: [0-9]+, Failures: [1-9]" },
            { "pattern": "Tests run: [0-9]+, Failures: [0-9]+, Errors: [1-9]" },
            { "pattern": "There were failing tests" },
            { "pattern": "There are test failures" },
            { "pattern": "[0-9]+ tests? completed, [1-9][0-9]* failed" }
          ],
          "skipped": [{ "pattern": "Tests are skipped\\." }],
          "loadError": [
            { "pattern": "COMPILATION ERROR" },
            { "pattern": "^e: ", "flags": "m" },
            { "pattern": "Compilation failed" },
            { "pattern": "> Task :\\S*compile\\S*(?:Kotlin|Java)\\S* FAILED" }
          ]
        }
      },
      "testSummary": {
        "parsers": ["junit-xml", "maven", "gradle"],
        "resultFiles": ["**/build/test-results/**/*.xml", "**/target/surefire-reports/*.xml"]
      },
      "testFilePatterns": ["(^|/)src/test/", "Tests?\\.(java|kt|scala|groovy)$"],
      "truthSources": {
        "localization": [
          "**/src/main/resources/messages*.properties",
          "**/src/main/resources/i18n/**"
        ],
        "endpoints": ["**/openapi*.{json,yaml,yml}", "**/*.proto"],
        "generated": ["**/build/generated/**", "**/target/generated-sources/**"]
      },
      "referencePatterns": {
        "localization": ["\\bgetMessage\\(\\s*\"(?<ref>[^\"]+)\""],
        "endpoints": [
          "@(?:Get|Post|Put|Patch|Delete|Request)Mapping\\(\\s*(?:value\\s*=\\s*|path\\s*=\\s*)?\"(?<ref>[^\"]+)\""
        ]
      }
    },
    "unknown": {
      "label": "No adapter matched",
      "applicable": false,
      "detection": {},
      "commands": [],
      "markers": {},
      "testSummary": { "parsers": [] },
      "testFilePatterns": [],
      "truthSources": {},
      "referencePatterns": {}
    }
  }
}
