feat(tsl-api-reference): add class and framework API lookup

This commit is contained in:
csh
2026-08-20 13:49:55 +08:00
parent 7233646398
commit 651c1f68d2
637 changed files with 25498 additions and 36673 deletions
+44 -2
View File
@@ -1,6 +1,6 @@
---
name: tsl-api-reference
description: "当编写、修改或审查 TSL 代码时需要确认 builtin、dotnet、third 或模块 API 是否存在及其精确签名、参数、返回值和示例时使用;也用于按自然语言查找天软数据字典中的表、数据源与字段。"
description: "当编写、修改或审查 TSL 代码时需要确认 builtin、dotnet 或 module API 是否存在及其精确签名、参数、返回值和示例时使用;也用于按自然语言查找天软数据字典中的表、数据源与字段。"
---
# TSL API 参考
@@ -9,6 +9,48 @@ description: "当编写、修改或审查 TSL 代码时需要确认 builtin、do
若需查询 TSL 语法、控制流、变量、对象模型或运行时语言规则,请改用
`tsl-syntax-reference` skill。
## 查询路由
先判断用户请求是普通 API、class,还是带生命周期的框架类工作流:
- 普通函数、单个成员或数据字典问题走现有 `lookup.py` / `dictionary_lookup.py`
- 查询或使用任意 class 时,先用 `class_lookup.py` 取回紧凑的类摘要和成员分类;
需要某个成员正文时,再运行 `lookup.py --name` 精确查询。
- `class_lookup.py` 自动覆盖 `function_index.tsv` 中的全部 class,不要求每个普通对象类
都维护人工脚手架。
- 用户要实现框架子类、重写回调或组合一组有生命周期的 class API 时,类级查询会叠加
`framework_index.json` 中证据化的 Framework Profile,返回生命周期、必要回调、
状态、执行入口和结果查询。
- 不得因为查询目标是 class 就推断它是框架;普通对象、服务类和数据类只使用自动生成的
类成员视图。只有 `kind=framework` 且具有证据化生命周期的类才加载人工 Profile。
列出和查询 class
```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 出现在多个 scope 或模块时,状态为 `ambiguous`;使用 `--scope``--module`
或完全限定名消歧,不能选择第一项。
普通 class 的 `profile_status=not_profiled` 不是错误,只表示它使用索引自动生成的成员
视图。框架类的 Profile 只描述 API 协议,不直接生成 TSL 语法;将结果作为
Framework Contract Packet 交给 `tsl-syntax-reference` 组合代码结构。
`scaffold_status=resolved` 只表示类级生命周期和成员引用完整,不表示模式相关的回调
记录结构已经确定。只要 `contract_status` 不是 `resolved`,就必须停止生成回调字段,
`diagnostics` 补齐模式和返回 schema 证据。
维护 Profile 后运行引用校验:
```bash
python <this-skill-dir>/scripts/class_lookup.py --check
```
天软数据字典中的表、数据源和字段不是可调用 API,不进入 `function_index.tsv`
函数问题使用 `lookup.py`,表或字段问题使用 `dictionary_lookup.py`
@@ -65,7 +107,7 @@ python <this-skill-dir>/scripts/dictionary_lookup.py --query "9900700" --field
```bash
python <this-skill-dir>/scripts/lookup.py --scope builtin --name boolToStr
python <this-skill-dir>/scripts/lookup.py --scope dotnet --kw argmax
python <this-skill-dir>/scripts/lookup.py --scope third --name getOleObject
python <this-skill-dir>/scripts/lookup.py --scope module --name bondAccruedInterest
```
- 关键词采用字面 AND 语义;增加关键词可缩小结果范围。常用同义词由 API 条目的