♻️ refactor(tsl-api-reference): split lookup workflows and maintenance tooling

This commit is contained in:
csh
2026-08-20 17:47:48 +08:00
parent 9b95bf2682
commit cd0405d64b
18 changed files with 707 additions and 374 deletions
@@ -0,0 +1,57 @@
# Class 与 Framework 查询
用于 class 摘要、成员分类、子类实现、回调重写和生命周期协议。公开入口只有
`class_lookup.py`Framework Profile 是 class 查询的附加层,不单独调用另一个 CLI。
先查看脚本当前契约:
```bash
python <this-skill-dir>/scripts/class_lookup.py --help
```
## 查询
```bash
python <this-skill-dir>/scripts/class_lookup.py --list
python <this-skill-dir>/scripts/class_lookup.py --class TStringList
python <this-skill-dir>/scripts/class_lookup.py --class TSBackTesting
python <this-skill-dir>/scripts/class_lookup.py \
--class TSBackTesting --config FGroupType=1 --format json
```
- 查询或使用任意 class 时,先取类摘要;需要具体成员正文时,再按返回的
`qualified_name` 运行 `lookup.py --name`
- `class_lookup.py` 自动覆盖 `function_index.tsv``kind=class` 的条目,不要求普通
对象类维护人工 Profile。
- 只有 `kind=framework` 且有证据化生命周期的类才叠加 Framework Profile。不得因目标
是 class 就推断它是框架。
- 同名 class 的 `status=ambiguous` 时,使用 `--scope``--module` 或完全限定名消歧。
## 状态判读
- `status=resolved`:类查询已解析;`status=not_found`:索引中无该 class
`status=ambiguous`:存在多个候选。
- `profile_status=not_profiled`:普通 class,只使用自动成员视图,不是错误,也不表示数据
不完整;成员查询可以继续。若当前请求依赖生命周期、配置或回调,则表示没有已验证的
framework 契约,必须停止该部分,不能假设空的 Framework Profile。
- `profile_status=resolved`:返回了 Framework Profile。
- `scaffold_status=resolved` 只表示生命周期和成员引用完整。
- `contract_status` 不是 `resolved` 时,必须按 `diagnostics` 补齐模式与返回 schema 证据,
并停止生成回调字段。
Framework Profile 只描述 API 协议,不定义 TSL 语法或代码结构。解析后的 Framework
Contract Packet 仅作为已验证的 API 事实输出。
只有返回的 Profile 本身带有生命周期、配置、回调、执行入口或结果查询证据时,才使用
这些协议;`not_profiled` 时不能从 class 名称或成员列表推断 framework。
使用自定义 `--tsv` 时默认不加载 Framework Profile,普通 class 仍可查询;该索引确有
curated Profile 时必须同时显式传入 `--profiles`
## 退出码
- rc=0:查询或校验完成;`not_found``ambiguous` 通过输出状态表达。
- rc=1:索引/Profile 数据缺失、损坏或引用校验失败。
- rc=2:参数不合法。
`--check` 属维护动作,普通编码查询不需要运行。