{
  "$comment": [
    "Declarative environment requirements for `ht init`.",
    "`ht init` reads this file to (1) detect external tools and (2) report which",
    "skills/agents are BLOCKED / LIMITED / OK by anything missing.",
    "",
    "tools[<id>]:",
    "  source        'path'    -> locate a runnable command (where/which) trying each alias;",
    "                'env-dir' -> a directory existence check (envVar resolved from ht config).",
    "  aliases       command names to try in order (e.g. python, python3, py). First hit wins.",
    "  verify        argv passed to the resolved command to print its version (existence proof too).",
    "                Use a flag that prints-and-exits. NEVER use `python -v` (verbose REPL -> hangs);",
    "                use `python --version`.",
    "  versionStream 'stdout' (default) or 'stderr' (java -version prints to stderr).",
    "  versionRegex  capture group(s) for the numeric version in the verify output.",
    "  version       default required range for this tool, {min, max} as [min, max) — min",
    "                inclusive, max exclusive; either may be null/omitted = unbounded. A",
    "                requirement dependency may override this.",
    "  fallback      when not on PATH, probe <base>/<segments>/<exe>. base is a config env key",
    "                (DEVECO_SDK_HOME / DEVECO_HOME). Mirrors how the skills resolve hdc/java.",
    "  hint          shown when the tool is missing.",
    "",
    "requirements[]: name + kind (skill|agent) + dependencies[] of",
    "  { tool, level: 'required'|'optional', version?: {min,max} }.",
    "  A missing 'required' tool -> BLOCKED; only 'optional' missing -> LIMITED; else OK."
  ],

  "tools": {
    "deveco": {
      "label": "harmony sdk",
      "source": "env-dir",
      "envVar": "DEVECO_SDK_HOME",
      "hint": "set DEVECO_SDK_HOME via `ht init` (DevEco Studio install)"
    },
    "adb": {
      "source": "path",
      "aliases": ["adb"],
      "verify": ["version"],
      "versionRegex": "(\\d+\\.\\d+(?:\\.\\d+)?)",
      "hint": "Android SDK platform-tools (needed for Android-device capture)"
    },
    "hdc": {
      "source": "path",
      "aliases": ["hdc"],
      "verify": ["-v"],
      "versionRegex": "(\\d+\\.\\d+(?:\\.\\d+)?)",
      "fallback": { "base": "DEVECO_SDK_HOME", "segments": ["default", "openharmony", "toolchains"], "exe": "hdc" },
      "hint": "ships with DevEco: <sdk>/default/openharmony/toolchains"
    },
    "node": {
      "source": "path",
      "aliases": ["node"],
      "verify": ["--version"],
      "versionRegex": "v?(\\d+\\.\\d+(?:\\.\\d+)?)",
      "hint": "Node.js 22+ required for TypeScript scripts that run through native type stripping"
    },
    "git": {
      "source": "path",
      "aliases": ["git"],
      "verify": ["--version"],
      "versionRegex": "git version (\\d+\\.\\d+(?:\\.\\d+)?)",
      "hint": "Git is required for diff-based agent precheck runs"
    }
  },

  "requirements": [
    {
      "name": "hmos-resources-convert",
      "kind": "skill",
      "dependencies": [{ "tool": "node", "level": "required" }],
      "note": "decodes apk_path with a2h-resource (pure Node) via npx"
    },
    {
      "name": "hmos-batch-ui-align",
      "kind": "skill",
      "dependencies": [
        { "tool": "deveco", "level": "required" },
        { "tool": "adb", "level": "optional" }
      ],
      "note": "Step 0 resolves DEVECO_HOME and Step 6 invokes hmos-fix-build-errors; adb only for page exploration"
    },
    {
      "name": "hmos-test-case-generation",
      "kind": "skill",
      "dependencies": [
        { "tool": "node", "level": "required", "version": { "min": "22.18.0" } },
        { "tool": "adb", "level": "optional" }
      ],
      "note": "validate.ts, convert_to_ui_elements.ts, and android_viewtree_bfs_crawler.ts run via `node`; adb only when producing ui_elements.json from an installed Android app"
    },
    {
      "name": "hmos-incremental-ui-align",
      "kind": "skill",
      "dependencies": [
        { "tool": "deveco", "level": "required" },
        { "tool": "hdc", "level": "required" },
        { "tool": "adb", "level": "required" }
      ]
    },
    {
      "name": "hmos-integration-test",
      "kind": "skill",
      "dependencies": [
        { "tool": "deveco", "level": "required" },
        { "tool": "hdc", "level": "required" },
        { "tool": "node", "level": "required", "version": { "min": "22.18.0" } }
      ],
      "note": "the skill runs its bundled tools directly via node \"$SKILL_SCRIPTS/<script>.ts\" where SKILL_SCRIPTS is the skill's own scripts/ directory; batch_runner.js is resolved from @autotest/agent (walk-up from script dir + global npm root fallback + auto-install if missing). Tools are .ts source files run directly via Node type stripping (zero external deps)"
    },
    {
      "name": "hmos-fix-build-errors",
      "kind": "skill",
      "dependencies": [{ "tool": "deveco", "level": "required" }]
    },
    {
      "name": "hmos-spec-generate",
      "kind": "skill",
      "dependencies": [
        { "tool": "node", "level": "required", "version": { "min": "22.18.0" } }
      ],
      "note": "homegraph code queries run via `npx --yes homegraph`; every requirement file (.txt and Excel/CSV alike) is split into individual requirements by scripts/parse_requirements.ts, which runs via `node` (native type stripping, no third-party deps)"
    },
    {
      "name": "hmos-convert-pipeline",
      "kind": "skill",
      "dependencies": [
        { "tool": "deveco", "level": "required" },
        { "tool": "hdc", "level": "optional" }
      ],
      "note": "test stage skippable via skip_test; when run it needs hdc"
    },
    {
      "name": "logic-context-builder",
      "kind": "agent",
      "dependencies": [{ "tool": "node", "level": "required" }],
      "note": "uses agents/scripts/platform_query.mjs; network access may still be needed when platform verification triggers"
    },
    {
      "name": "logic-coder",
      "kind": "agent",
      "dependencies": [
        { "tool": "node", "level": "required" },
        { "tool": "git", "level": "required" },
        { "tool": "deveco", "level": "optional" }
      ],
      "note": "uses agents/scripts/platform_query.mjs and agents/scripts/hmos-precheck/index.mjs; DevEco toolchain is needed for full ArkTS/codelinter validation when .ets files change"
    },
    {
      "name": "code-reviewer",
      "kind": "agent",
      "dependencies": [
        { "tool": "node", "level": "required" },
        { "tool": "deveco", "level": "optional" },
        { "tool": "git", "level": "optional" }
      ],
      "note": "Step 0b runs `npx arkanalysis` and the fix strategies run `npx devecocli docs` (node); Step 6 build gate uses the DevEco toolchain; Step 8 commits but degrades gracefully outside a git repo, and Step 0a reviews holistically when there is no commit to scope to"
    },
    {
      "name": "self-tester",
      "kind": "agent",
      "dependencies": [
        { "tool": "deveco", "level": "optional" },
        { "tool": "hdc", "level": "required" },
        { "tool": "node", "level": "required", "version": { "min": "22.18.0" } }
      ],
      "note": "thin wrapper that loads the hmos-integration-test skill and runs its procedure (parse test_case.md → install HAP → run AutoTest batch → produce self-test-report.md); the skill's self-test-runner.ts resolves @autotest/agent's batch_runner.js itself (walk-up + global npm root fallback + auto-install if missing — Step 0b); tools are .ts source run via Node type stripping (zero external deps); reports the terminal status (COMPLETED/CRASHED/TIMEOUT/FAILED/NOT_STARTED) + self-test-report.md path back to the caller. No setup param; install/uninstall always runs (real installable HAP required)."
    },
    {
      "name": "self-test-fixer",
      "kind": "agent",
      "dependencies": [
        { "tool": "node", "level": "required" },
        { "tool": "deveco", "level": "required" },
        { "tool": "git", "level": "optional" }
      ],
      "note": "3c invokes hmos-fix-build-errors to verify compilation (DevEco toolchain); 3.5 commits the fix but degrades gracefully when the project is not a git repo"
    }
  ]
}
