feat: add deployer
This commit is contained in:
@@ -557,20 +557,13 @@ def assert_git_control_entry(worktree: Path) -> None:
|
||||
def capture_worktree_identity(
|
||||
project_root: Path,
|
||||
worktree_value: str,
|
||||
allowed_worktrees: object,
|
||||
) -> dict:
|
||||
if not isinstance(allowed_worktrees, list):
|
||||
raise LaunchError("project.orchestration.allowedWorktrees 必须是列表")
|
||||
# allowedWorktrees 白名单已废弃(v0.19 起)。worktree 合法性由以下硬约束保证:
|
||||
# 1) 必须是 Git worktree 根目录(不是任意子目录);
|
||||
# 2) 必须出现在 `git worktree list` 注册表中;
|
||||
# 3) 必须与 --project-root 属于同一 Git common-dir(同仓库)。
|
||||
# worker 默认就在 --project-root(权威状态目录)工作,天然满足这些约束。
|
||||
worktree = canonical_directory(worktree_value, "worker worktree")
|
||||
configured_paths: list[Path] = []
|
||||
for index, configured in enumerate(allowed_worktrees):
|
||||
if not isinstance(configured, str):
|
||||
raise LaunchError(f"allowedWorktrees[{index}] 必须是字符串")
|
||||
configured_paths.append(
|
||||
canonical_directory(configured, f"allowedWorktrees[{index}]")
|
||||
)
|
||||
if worktree not in configured_paths:
|
||||
raise LaunchError(f"worker worktree 不在 allowedWorktrees 中: {worktree}")
|
||||
|
||||
git = resolve_executable("git")
|
||||
assert_git_control_entry(project_root)
|
||||
@@ -699,7 +692,6 @@ def build_plan(
|
||||
worktree = capture_worktree_identity(
|
||||
project_root,
|
||||
worktree_value,
|
||||
orchestration.get("allowedWorktrees"),
|
||||
)
|
||||
executable = resolve_executable(str(profile["cli"]))
|
||||
executable_stat = executable.stat()
|
||||
|
||||
Reference in New Issue
Block a user