#!/bin/sh set -eu if [ "$#" -ne 1 ] || [ -z "$1" ]; then echo "usage: resolve-target.sh " >&2 exit 2 fi script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) registry="$script_dir/../targets.json" requested=$1 exec node - "$registry" "$requested" <<'NODE' const fs = require("node:fs"); const registry = JSON.parse(fs.readFileSync(process.argv[2], "utf8")); const requested = String(process.argv[3] || "").trim(); const normalized = requested.toLocaleLowerCase("zh-CN"); const matches = registry.targets.filter(target => [target.node_id, ...(target.aliases || [])] .some(value => String(value).toLocaleLowerCase("zh-CN") === normalized) ); if (matches.length !== 1) { process.stderr.write(`TARGET_NOT_RESOLVED_EXACTLY requested=${requested} matches=${matches.length}\n`); process.exit(65); } process.stdout.write(`${JSON.stringify({ status: "TARGET_RESOLVED_EXACTLY", ...matches[0], final_guanghu_os_master_proven: false, required_live_predicates: [ "guanghu_semantic_control", "guanghu_boot_control", "linux_on_demand_subcontrol", "linux_rescue", "current_target_receipt" ], forbidden_completion_shortcuts: [ "linux_deleted", "linux_absent", "linux_free_boot", "guanghu_service_name_only" ], next: "read_back_live_boot_control_linux_lifecycle_rescue_and_server_owned_receipts" }, null, 2)}\n`); NODE