✨ feat(tsl-api-reference): expand and reorganize api catalog
Flatten builtin pages, add third-party and platform scopes, and import financial and data warehouse references. Keep the existing generated index without rebuilding after signature normalization.
This commit is contained in:
@@ -28,10 +28,10 @@ class FunctionIndexTest(unittest.TestCase):
|
||||
self.skill_dir = Path(self.temp_dir.name) / "tsl-api-reference"
|
||||
self.codegen_root = self.skill_dir / "references" / "codegen"
|
||||
self.data_dir = self.skill_dir / "data"
|
||||
leaf = self.codegen_root / "builtin" / "base" / "array.md"
|
||||
leaf = self.codegen_root / "builtin" / "array.md"
|
||||
leaf.parent.mkdir(parents=True)
|
||||
leaf.write_text(
|
||||
"# Builtin - 基础 / 数组\n\n"
|
||||
"# Builtin - 数组\n\n"
|
||||
"## `demo()`\n\n"
|
||||
"声明:function\n\n"
|
||||
"返回示例值。\n\n"
|
||||
@@ -71,6 +71,24 @@ class FunctionIndexTest(unittest.TestCase):
|
||||
self.assertEqual("数组 列表", row["tags"])
|
||||
self.assertEqual("返回示例值。", row["summary"])
|
||||
|
||||
def test_root_page_uses_file_stem_for_scope_and_module(self):
|
||||
self.write_page(
|
||||
"deprecated.md",
|
||||
"# Deprecated\n\n"
|
||||
"## `legacy()`\n\n"
|
||||
"声明:function\n\n"
|
||||
"已废弃。\n",
|
||||
)
|
||||
|
||||
rows = {
|
||||
row[0]: dict(zip(self.module.HEADER, row))
|
||||
for row in self.module.build_rows(self.codegen_root)
|
||||
}
|
||||
|
||||
self.assertEqual("deprecated", rows["legacy"]["scope"])
|
||||
self.assertEqual("deprecated", rows["legacy"]["module"])
|
||||
self.assertEqual("deprecated.md", rows["legacy"]["page"])
|
||||
|
||||
def test_declaration_does_not_become_a_missing_description_summary(self):
|
||||
self.write_page(
|
||||
"project/missing_description.md",
|
||||
@@ -113,9 +131,9 @@ class FunctionIndexTest(unittest.TestCase):
|
||||
[
|
||||
"demo",
|
||||
"builtin",
|
||||
"base",
|
||||
"array",
|
||||
"demo()",
|
||||
"builtin/base/array.md",
|
||||
"builtin/array.md",
|
||||
"demo",
|
||||
"数组 列表",
|
||||
"返回示例值。",
|
||||
|
||||
@@ -573,6 +573,17 @@ class LookupTest(unittest.TestCase):
|
||||
self.assertEqual(2, result.returncode)
|
||||
self.assertIn("--limit must be >= 1", result.stderr)
|
||||
|
||||
def test_help_lists_all_bundled_scopes(self):
|
||||
result = subprocess.run(
|
||||
[sys.executable, str(SCRIPT), "--help"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
self.assertIn("builtin、dotnet、third 与 deprecated", result.stdout)
|
||||
|
||||
def test_exact_search_uses_anchor_for_duplicate_signatures(self):
|
||||
module = load_script()
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
@@ -767,6 +778,7 @@ class LookupTest(unittest.TestCase):
|
||||
text = SKILL_MD.read_text(encoding="utf-8")
|
||||
|
||||
self.assertIn("完全限定名称", text)
|
||||
self.assertIn("--scope third", text)
|
||||
self.assertIn("qualified_name", text)
|
||||
self.assertIn("owner、kind、binding、visibility", text)
|
||||
self.assertIn("class function", text)
|
||||
|
||||
Reference in New Issue
Block a user