📝 docs(tsl): sync api skill with corrected codegen

Mirror docs/tsl/codegen into the bundled tsl-api-reference skill and rebuild the function index.

Remove invalid duplicate API entries for cb_delistedbydate, createhttpsession, exportJsonString, and Anova_Bartlett so exact lookup returns the canonical entries.
This commit is contained in:
csh
2026-07-07 16:47:03 +08:00
parent bbf6977f57
commit c0bf0358e0
278 changed files with 45212 additions and 35782 deletions
+23 -56
View File
@@ -1,71 +1,38 @@
---
name: tsl-api-reference
description: "Use when writing or reviewing TSL code and you need authoritative TSL API facts: builtin functions, dotnet functions, module APIs, exact signatures, parameters, return values, examples, or Chinese keyword discovery when the function name is unknown."
description: "Use when writing or reviewing TSL code and needing authoritative TSL API facts: builtin/dotnet functions, module APIs, exact signatures, parameters, return values, examples, or Chinese keyword discovery when the function name is unknown."
---
# TSL API Reference
## Overview
Use this skill for TSL API facts only: function/module names, exact signatures,
parameters, return values, and examples. For TSL syntax, control flow, variables,
object model, or runtime language rules, use the TSL language docs instead.
Use the bundled API index and markdown references in this skill instead of
guessing from similar languages. The API index is `data/function_index.tsv`
with `name / scope / module / signature / page / anchor / summary`; the full
entries live under `references/codegen/`.
Do not infer API signatures from memory or similar languages. TSL names are
case-insensitive, but underscores are significant: do not remove underscores or
camel-case names when querying or reporting APIs.
This skill is for API facts only. For TSL syntax, variables, control flow,
object model, and runtime language rules, use the TSL syntax documentation or a
future `tsl-syntax-reference` skill.
Run the bundled lookup script. Replace `<this-skill-dir>` with the directory
containing this `SKILL.md`.
## Procedure
- Known API name:
Use this skill's bundled lookup script. In the commands below,
`<this-skill-dir>` means the directory containing this `SKILL.md`; replace it
with the actual skill directory before running.
```bash
python <this-skill-dir>/scripts/lookup.py --name argmax
```
The script resolves bundled `data/` and `references/` relative to its own file.
- Unknown name, known behavior or Chinese keywords:
1. If the function name is known, run exact lookup:
```bash
python <this-skill-dir>/scripts/lookup.py --kw 数组 排序
```
```bash
python <this-skill-dir>/scripts/lookup.py --name argmax
```
- Keyword terms use AND semantics; add terms to narrow results.
- Use `--limit N` to change how many candidate rows are printed.
Use the returned entry body for the exact signature, parameters, return
value, examples, and source location.
Exact lookup prints the full entry body and source marker. Keyword lookup prints
candidate rows; pick a candidate, then rerun exact lookup with `--name`.
2. If only the intended behavior is known, run keyword discovery:
```bash
python <this-skill-dir>/scripts/lookup.py --kw 数组 排序
```
Terms are matched with AND semantics over `name`, `signature`, `module`, and
`summary`. Pick a candidate, then run `--name` for the complete entry.
3. Use `--limit N` when keyword discovery returns too many rows.
4. Use `--tsv /abs/path/function_index.tsv` only when testing or overriding the
bundled index. The normal installed skill is self-contained and does not
require the full playbook repository.
## Output Contract
- Exact mode prints each matching markdown entry body plus its
`scope/module · page#anchor` source marker.
- Keyword mode prints `# N matches`, then
`name / signature / page#anchor / summary` rows.
## Failure Handling
- If exact lookup has no match, retry with Chinese keywords.
- If keyword lookup is too broad, add more terms or lower/raise `--limit`.
- If bundled data is missing, reinstall the skill or pass `--tsv` for debugging.
- If summaries or index.md counts look stale in an installed skill, reinstall
it. An installed skill is a read-only snapshot: it ships only `lookup.py`, not
the index generator, so it cannot and need not rebuild anything locally.
- Rebuilding the index is a playbook-repository maintenance step, not a skill
operation. Only when developing inside the playbook repo, after editing API
markdown, rebuild the tsv and every `index.md` by running (from the repo root)
`python scripts/tsl_codegen_function_index.py`. The leaf pages are the source
of truth; the tsv and all index pages are derived. Use `--check` to verify
they are in sync without writing (exits non-zero when stale).
If exact lookup has no match, retry with Chinese keywords. If bundled data is
missing, reinstall the skill.