import type { AssetPack } from "./schema.js"; import type { Blueprint, Domain, Profile, SourceAdapterContext, WorkingSet } from "./schema.js"; /** 问题严重程度。error 必须修;warning 可延后;info 是预期但值得告知。 */ export type IssueSeverity = "error" | "warning" | "info"; /** 问题归属:profile / blueprint / domain。本 issue v1 范围只产 profile 类。 */ export type IssueScope = "profile" | "blueprint" | "domain"; /** 单条问题。issue-doc-structure 类似——结构化便于测试断言 + UI 格式化 + 自动 fix。 */ export interface AssetHealthIssue { severity: IssueSeverity; scope: IssueScope; /** 问题所在资产名(profile.name / blueprint.name / domain.name)。 */ name: string; /** Optional field path (e.g. "groups.session-context.modules"), for precise pointing. */ field?: string; /** 人类可读问题描述。 */ msg: string; /** 修复建议(hint)。 */ hint?: string; /** 自动 fix 命令(v2 `--fix` 用,本 issue v1 不实现执行)。 */ fix?: string; } /** 规则 id。issue §Layer 2 5 条规则 → 5 个 id;v16+ optional-domains 诊断;v17+ use 链错误诊断;v18+ 引用完整性合并。 */ export type HealthRuleId = "missing-modules" | "dangling-blueprint-ref" | "orphan-h2" | "empty-segment" | "unknown-modname" | "optional-domain-no-matching-section" | "use-expansion-error" | "dangling-domain-ref"; /** 资产健康扫描结果(按 profile 聚合)。 */ export interface AssetHealthReport { issues: AssetHealthIssue[]; errors: number; warnings: number; /** v16:info 数(optional-domain-unresolved 等预期行为的诊断)。 */ infos?: number; } /** 简报格式选项(issue pt-asset-health-diag-report-format)。 * - maxItems:最大列出项数;超限时附加一条「→ /pt check 查看全部」引导。 * - prefix:默认 "[pt] 诊断:";可换为 "[pt] " 或空。 */ export interface FormatHealthSummaryOpts { maxItems?: number; prefix?: string; } /** 把 AssetHealthReport 格式化为人类可读分类简报(不输出逐条详情——那是 /pt check 的职责)。 * 输出形如: * ``` * [pt] 诊断:4 项配置问题(不阻断) * · 2× profile 配置问题 → /pt check * · 1× domain 引用问题 → /pt check * · 1× manifest 警告 → /pt packs * ``` * 超 maxItems 时追加 `→ /pt check 查看全部`。 * * v0.3.0 随 pt-cold-start-warning-noise 一起发版。 */ export declare function formatHealthSummary(report: AssetHealthReport, opts?: FormatHealthSummaryOpts): string; /** 扫描整个项目的资产配置(issue §Layer 2 主入口)。 * * 检测 5 类反模式: * 1. missing-modules ProfileGroup.modules 为空 * 2. dangling-blueprint-ref profile.blueprint 不存在 * 3. orphan-h2 ProfileGroup.name 不在 Blueprint.groups * 4. empty-segment compileAgentContext 产出为空段 * 5. unknown-modname `### Modules` 项不在 KNOWN_SECTION_NAMES(需重读文件) * * 参数: * - cwd:项目根目录(unknown-modname 重读 profile 文件需要) * - profiles / blueprints / domains:从 SchemaBundle 取的全集 * - adapterCtx:可选。log writer 用于 trace(warn 不走 notify——会刷屏) * * 调用方:session_start / /pt info lint / pt_info {kind: lint} tool。 * * 不抛错——任何内层异常降级为 log warn + 不阻止结果。体检失败不该阻塞 session 启动。 */ export declare function scanProjectHealth(cwd: string, profiles: Profile[], blueprints: Blueprint[], domains: Domain[], packs: AssetPack[], // v15.x PR2:compileAgentContext 需要 packs 进 sourceHash profilePack: string, // v15.x PR2:scan 时用 default "prj"——不真正读 pack 信息 workingSet?: { domains?: WorkingSet; blueprints?: WorkingSet; profiles?: WorkingSet; }, adapterCtx?: SourceAdapterContext): Promise;