feat(tsl-syntax-reference): harden retrieval and restructure pages

- flag weak candidates (no intent/heading/identifier/tag hit) and exit 2
  when every candidate is weak: mis-hits used to be indistinguishable
  from real hits, so the retry-with-better-terms loop never fired
- accept multiple ids per --section for batch fetch, failing atomically
  on any unknown id so a partial fetch cannot pass as complete
- move query synonyms and page intent aliases to data/lexicon.json and
  enforce alias/page correspondence in --check; curation data no longer
  lives in the engine
- document the weak-hit rule, batch fetch and prelude-once guidance in
  SKILL.md, with curation discipline in data/README.md
- drop 11_pitfalls.md, renumber the trailing pages and spread retrieval
  tags across topics; lexicon keys are page filenames, so the renumbering
  and the new --check rule cannot land in separate commits
This commit is contained in:
csh
2026-07-29 15:45:47 +08:00
parent 37a3bf4b0c
commit 40a9885eb4
28 changed files with 1048 additions and 773 deletions
@@ -6,15 +6,6 @@
回答“普通变量怎样直接使用、`var` 在什么位置出现、常量必须怎样初始化、哪些名字一旦绑定就不能再赋值”。
## 智能体变量/常量判断流程
1. 普通变量默认直接用 `:=` 首次赋值,不要先补一个没有需求证据的 `var` 段。
2. 只有用户要求显式声明或遇到 `{$explicit+}` 时才优先写 `var`
3. 常量声明必须同时初始化;默认只生成 `const name = value;`,顶层脚本常量需要后续脚本语句时,仍按 `.tsl` 语句区规则组织。
4. 多参数赋值按 `[a, b] := array(...)` 写;单变量拆包必须写成 `[name, ] := array(...)`
5. 表达式求值、函数参数、运行时类型 / 转换和 `{$explicit+}` 之外的编译选项事实分别见 [06_expressions_and_operators.md](06_expressions_and_operators.md)、[05_functions_and_calls.md](05_functions_and_calls.md)、[17_types_and_conversions.md](17_types_and_conversions.md) 和 [16_lexical_structure_and_compile_options.md](16_lexical_structure_and_compile_options.md);本页不硬推断这些规则。
6. 没有对应代码块时不要发明变量/常量写法;尤其不要从 Pascal 的声明习惯反推 TSL 必须先声明变量。
## 核心规则
- 默认变量模型是“直接赋值即得到变量”,不要求先写 `var`
@@ -43,6 +34,8 @@
### 普通变量与显式声明
<!-- tags: 怎么声明变量, 变量要不要先定义, 直接赋值, var 用不用写 -->
默认变量模型:
代码块身份:可直接照写示例
@@ -89,6 +82,8 @@ writeLn(a);
### 常量初始化
<!-- tags: 定义常量, 只读的值, 不能改的值, const 怎么写 -->
顶层最稳的常量写法:
代码块身份:可直接照写示例
@@ -175,6 +170,8 @@ value := kMaxRetries;
### 多参数赋值
<!-- tags: 一次赋多个变量, 解构赋值, 拆数组到变量, 同时取两个值 -->
多参数赋值:
代码块身份:可直接照写示例