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
+4 -10
View File
@@ -260,16 +260,6 @@ def load_authoritative_board(project_root_value: str) -> tuple[Path, dict]:
if errors:
formatted = "\n".join(f" - {error}" for error in dict.fromkeys(errors))
raise LaunchError(f"任务板未通过 worker 路由校验:\n{formatted}")
project = board.get("project")
repo_path = project.get("repoPath") if isinstance(project, dict) else None
if not isinstance(repo_path, str):
raise LaunchError("project.repoPath 必须配置为项目根绝对路径")
configured_root = canonical_directory(repo_path, "project.repoPath")
if configured_root != project_root:
raise LaunchError(
f"project.repoPath 与 --project-root 不一致: {configured_root}"
)
return project_root, board
@@ -641,6 +631,7 @@ def build_plan(
raise LaunchError("slot 必须是 1..99 的整数")
project_root, board = load_authoritative_board(project_root_value)
board_hash = canonical_sha256(board)
find_task(board, task_id)
project = board["project"]
orchestration = project.get("orchestration")
@@ -696,6 +687,8 @@ def build_plan(
{
"protocolVersion": PROTOCOL_VERSION,
"backend": "orca",
"projectRoot": str(project_root),
"boardHash": board_hash,
"profileId": profile_id,
"profileHash": current_profile_hash,
"createdFor": created_for,
@@ -715,6 +708,7 @@ def build_plan(
"protocolVersion": PROTOCOL_VERSION,
"backend": "orca",
"projectRoot": str(project_root),
"boardHash": board_hash,
"taskId": task_id,
"attemptId": attempt_id,
"role": role,
+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)