37 lines
1.7 KiB
Python
37 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
||
"""Generate module-scoped API tier task cards from the canonical manifest."""
|
||
from __future__ import annotations
|
||
|
||
import json
|
||
from pathlib import Path
|
||
|
||
ROOT = Path(__file__).resolve().parents[1]
|
||
manifest = json.loads((ROOT / "docs/p6/python-api-manifest.json").read_text())
|
||
tasks = ROOT / "docs/tasks/p6/full-parity"
|
||
|
||
for tier, prefix, title in [
|
||
("tier-2-pure", "F2", "Tier-2 pure-function"),
|
||
("tier-1-readonly", "F1", "Tier-1 readonly"),
|
||
("tier-3-stateful", "F3", "Tier-3 stateful"),
|
||
]:
|
||
modules: dict[str, int] = {}
|
||
for row in manifest["records"]:
|
||
if row["tier"] == tier:
|
||
modules[row["module"]] = modules.get(row["module"], 0) + 1
|
||
for module, count in sorted(modules.items()):
|
||
card_id = f"FW-P6-FPA-{prefix}-{module.upper()}"
|
||
path = tasks / f"{card_id}.md"
|
||
if path.exists():
|
||
continue
|
||
path.write_text(
|
||
f"# {card_id}:{module} {title} API 批次({count})\n\n"
|
||
"- 状态:`planned`\n"
|
||
"- 类型:`coverage`\n"
|
||
"- 前置:`FW-P6-FPA-F0`、`FW-P6-FPA-F1`\n"
|
||
f"- 合同:仅处理 manifest 中 `module={module}` 且 `tier={tier}` 的 {count} 条记录;按 adapter family 生成真实 Python/WASM dispatch、参数/返回值 schema、错误和资源回放。\n"
|
||
"- 验收:每条记录获得 exposed/restricted/nonportable/not_implemented 终态和 evidence hash;禁止跨模块同名匹配。\n"
|
||
"- 边界:本批次不改变其他模块和 tier 的 disposition。\n",
|
||
encoding="utf-8",
|
||
)
|
||
print(json.dumps({"generated": True, "tiers": ["F1", "F2", "F3"]}, ensure_ascii=False))
|