ht32-code-mcp 0.3.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/PKG-INFO +1 -1
  2. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/pyproject.toml +1 -1
  3. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/src/ht32_code_mcp/materializer.py +12 -4
  4. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/tests/test_tools.py +4 -1
  5. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/.gitignore +0 -0
  6. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/.gitkeep +0 -0
  7. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/.pytest_base_final_run.log +0 -0
  8. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/DEPLOY.md +0 -0
  9. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/README.md +0 -0
  10. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/e2e_scenario_a.py +0 -0
  11. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/e2e_scenario_b.py +0 -0
  12. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/smoke_http.py +0 -0
  13. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/smoke_stdio.py +0 -0
  14. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/src/ht32_code_mcp/__init__.py +0 -0
  15. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/src/ht32_code_mcp/__main__.py +0 -0
  16. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/src/ht32_code_mcp/exporter.py +0 -0
  17. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/src/ht32_code_mcp/index.py +0 -0
  18. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/src/ht32_code_mcp/knowledge.py +0 -0
  19. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/src/ht32_code_mcp/release.py +0 -0
  20. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/src/ht32_code_mcp/server.py +0 -0
  21. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/src/ht32_code_mcp/usage.py +0 -0
  22. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/tests/conftest.py +0 -0
  23. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/tests/test_knowledge_grounding.py +0 -0
  24. {ht32_code_mcp-0.3.0 → ht32_code_mcp-0.3.1}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: ht32-code-mcp
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: HT32 Code MCP Server - 为 AI Agent 提供 HT32 函数库/例程/模板检索与工程导出
5
5
  License-Expression: MIT
6
6
  Keywords: firmware,holtek,ht32,mcp,mcu
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "ht32-code-mcp"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "HT32 Code MCP Server - 为 AI Agent 提供 HT32 函数库/例程/模板检索与工程导出"
9
9
  requires-python = ">=3.11"
10
10
  license = "MIT"
@@ -714,18 +714,24 @@ class Materializer:
714
714
  text = text.replace("<umfTarg>0</umfTarg>", "<umfTarg>1</umfTarg>", 1)
715
715
  edits.append("umfTarg 0->1 (Use Memory Layout from Target Dialog)")
716
716
  # FlashDriverDll:-FL 与裁决容量一致(官方逐 IC 值优先;仅裁决覆盖时改写)
717
+ # 注意 UL2CM3 参数是**按算法块分块**的:
718
+ # UL2CM3(... -FF0HT32F -FS00 -FL<主 Flash 容量> -FF1HT32F_OPT -FS11FF00000 -FL<OPT 区长度>)
719
+ # 裁决容量只属于 block 0(主 Flash);block 1 是 Option Bytes 区(另一基址/另一长度),
720
+ # 改写它会把 OPT 区长度错写成主 Flash 大小。故 count=1 只改首个 -FL。
717
721
  if origin["kind"] == "official-per-ic-project":
718
722
  m = re.search(r"(<FlashDriverDll>)(.*?)(</FlashDriverDll>)", text, re.S)
719
723
  if m and "-FL" in m.group(2):
720
724
  fdd = m.group(2)
721
725
  fl = re.search(r"-FL([0-9A-Fa-f]+)", fdd)
722
726
  if fl and int(fl.group(1), 16) != flash_size:
723
- new_fdd, n = re.subn(r"-FL[0-9A-Fa-f]+", f"-FL{flash_size:X}", fdd)
727
+ new_fdd, n = re.subn(r"-FL[0-9A-Fa-f]+", f"-FL{flash_size:X}", fdd,
728
+ count=1)
724
729
  if n != 1:
725
- raise ContractError(RECIPE_MISMATCH, f"{what}: FlashDriverDll -FL 命中异常")
730
+ raise ContractError(RECIPE_MISMATCH,
731
+ f"{what}: FlashDriverDll -FL 命中异常")
726
732
  text = text[:m.start()] + m.group(1) + new_fdd + m.group(3) + text[m.end():]
727
733
  edits.append(f"FlashDriverDll -FL{fl.group(1)} -> -FL{flash_size:X} "
728
- f"(LIBCFG adjudication)")
734
+ f"(LIBCFG adjudication, main alg block only)")
729
735
  # d) dfp-derived:Define/RegisterFile/SFDFile 的器件宏替换
730
736
  if origin["kind"] == "dfp-derived":
731
737
  base_dev = orig_device
@@ -841,7 +847,9 @@ class Materializer:
841
847
  "",
842
848
  "## 前置条件",
843
849
  "",
844
- f"- Keil MDK-ARM 5.x(AC5;本地以 ARMCC V5.06 update 4/7 实测)",
850
+ f"- Keil MDK-ARM 5.x,编译器 **AC5(armcc)**(本地以 ARMCC V5.06 update 4/7 实测)"
851
+ f"——**本工程暂不支持 AC6(armclang)**,请在 Options for Target → Target 保持"
852
+ f"编译器版本为 AC5;切到 AC6 可能在编译/链接阶段报错",
845
853
  f"- {r.recipe['pack']['device_macro_note']}(manifest 锁定 "
846
854
  f"`{r.recipe['pack']['id']}`)",
847
855
  "",
@@ -275,7 +275,10 @@ def _bundle_checks_v2(out_dir: Path, device: str, config_id: str = ""):
275
275
  # 模板自用文件不进用户工程;README 属于用户工程
276
276
  assert not (out_dir / "devices.json").exists()
277
277
  assert not (out_dir / "TEMPLATE.md").exists()
278
- assert (out_dir / "README.md").read_text(encoding="utf-8").startswith(f"# {device}")
278
+ readme = (out_dir / "README.md").read_text(encoding="utf-8")
279
+ assert readme.startswith(f"# {device}")
280
+ # 工具链声明必须随产物交付(仅 AC5;AC6 暂不支持)
281
+ assert "AC5" in readme and "不支持 AC6" in readme, "导出 README 未声明仅支持 AC5"
279
282
  # 完整官方库(自包含) + 文件清单逐条登记
280
283
  files = json.loads((mdir / "files.json").read_text(encoding="utf-8"))
281
284
  registered = {f["path"] for f in files["files"]}
File without changes
File without changes
File without changes
File without changes
File without changes