feat: update

This commit is contained in:
2026-08-03 17:07:21 +08:00
parent 0954ad542a
commit b9c82b5520
15 changed files with 115 additions and 33 deletions
+10 -6
View File
@@ -240,20 +240,24 @@ def _validate_registry_target(
def _tasks_project_root(
tasks_data: dict[str, Any], tasks_path: Path | None
) -> Path | None:
inferred = infer_project_root(tasks_path) if tasks_path else None
if inferred is not None and inferred.is_dir():
return inferred
# Legacy task boards may still declare repoPath. It is only a fallback for
# non-standard layouts; docs/ack location is authoritative when available.
project = tasks_data.get("project")
repo_path = project.get("repoPath") if isinstance(project, dict) else None
if _nonempty(repo_path):
candidate = Path(repo_path).expanduser()
if not candidate.is_absolute():
inferred = infer_project_root(tasks_path) if tasks_path else None
if inferred is None:
return None
candidate = inferred / candidate
if not candidate.is_dir():
return None
return candidate.resolve(strict=True)
inferred = infer_project_root(tasks_path) if tasks_path else None
return inferred if inferred is not None and inferred.is_dir() else None
return None
def _unknown_keys(value: dict[str, Any], allowed: set[str], where: str) -> list[str]:
@@ -808,8 +812,8 @@ def _validate_knowledge_file_binding(
binding_root = project_root or declared_root
if binding_root is None or not binding_root.is_dir():
errors.append(
"[tasks] 无法确定现有项目根目录;请修正 project.repoPath "
"传入 --project-root"
"[tasks] 无法从 docs/ack 布局确定现有项目根目录;"
"传入 --project-root"
)
return errors
try:
@@ -1067,7 +1071,7 @@ def main(argv: list[str] | None = None) -> int:
parser.add_argument("--tasks", help="可选 tasks.yaml,用于跨文件引用校验")
parser.add_argument(
"--project-root",
help="可选项目根目录;默认从 tasks.project.repoPath 或 docs/ack 布局推断",
help="可选项目根目录;默认从 tasks.yaml 的 docs/ack 布局推断",
)
args = parser.parse_args(argv)