/**
 * Main Path Integration Contract — 查询函数
 */
import { EXEMPT_PATTERNS, NON_INTEGRATION_REFERENCES, SOLOFORGE_WIRING_RULES } from "./constants.js";
/**
 * 判断文件是否为豁免文件。
 */
export function isExemptFile(modulePath) {
    for (const { pattern, reason } of EXEMPT_PATTERNS) {
        if (pattern.test(modulePath)) {
            return { exempt: true, reason };
        }
    }
    return { exempt: false };
}
/**
 * 判断引用类型是否为非接入引用。
 */
export function isNonIntegrationReference(refType) {
    return NON_INTEGRATION_REFERENCES.includes(refType);
}
/**
 * 获取指定能力类型的接入要求。
 */
export function getWiringRequirement(kind) {
    return SOLOFORGE_WIRING_RULES[kind];
}
/** 判断模块是否只被测试导入 */
export function isTestOnlyModule(_modulePath, importers) {
    const prodImporters = importers.filter((i) => !i.path.startsWith("tests/") &&
        !i.path.includes(".test.") &&
        !i.path.includes(".spec.") &&
        !isNonIntegrationReference(i.ref_type));
    return prodImporters.length === 0 && importers.length > 0;
}
/** 判断模块是否只有 registry/index export 引用 */
export function isRegistryOnlyModule(_modulePath, importers) {
    const realImporters = importers.filter((i) => !isNonIntegrationReference(i.ref_type));
    return realImporters.length === 0 && importers.length > 0;
}
/** 判断契约是否有入口链路 */
export function hasEntryTrace(contract) {
    return contract.entry_traces.length > 0 &&
        contract.entry_traces.some((t) => t.call_chain.length > 0);
}
/** 判断契约是否有可观测证据 */
export function hasObservability(contract) {
    return contract.observability_refs.length > 0;
}
/** 判断契约是否有集成测试 */
export function hasIntegrationTest(contract) {
    return contract.integration_tests.length > 0;
}
/** 判断契约是否有生产调用 */
export function hasProductionImport(contract) {
    return contract.production_imports.length > 0;
}
/**
 * 获取接入状态的中文标签。
 */
export function statusLabel(status) {
    const labels = {
        integrated: "已接入",
        implemented_not_integrated: "已实现未接入",
        experimental_isolated: "实验性隔离",
        planned_integration: "计划接入",
        dead_code_candidate: "废弃候选",
    };
    return labels[status];
}
/**
 * 获取入口类型的中文标签。
 */
export function entryTypeLabel(type) {
    const labels = {
        cli: "CLI 命令",
        mcp_tool: "MCP 工具",
        workflow: "工作流",
        adapter_prompt: "Adapter 提示",
        frontend_route: "前端路由",
        backend_route: "后端路由",
        job: "后台任务",
        consumer: "消费者",
        cron: "定时任务",
        webhook: "Webhook",
        public_api: "公开 API",
        command: "命令",
    };
    return labels[type];
}
//# sourceMappingURL=queries.js.map