feat: professionalize control plane and standalone delivery

This commit is contained in:
theshy
2026-04-07 10:46:30 +08:00
parent d0cf1fd0df
commit 862db502b0
100 changed files with 8313 additions and 1483 deletions

View File

@ -0,0 +1,44 @@
from __future__ import annotations
import subprocess
from pathlib import Path
from biliup_next.core.errors import ModuleError
class CodexCliAdapter:
def run_song_detect(
self,
*,
codex_cmd: str,
work_dir: Path,
prompt: str,
) -> subprocess.CompletedProcess[str]:
cmd = [
codex_cmd,
"exec",
prompt.replace("\n", " "),
"--full-auto",
"--sandbox",
"workspace-write",
"--output-schema",
"./song_schema.json",
"-o",
"songs.json",
"--skip-git-repo-check",
"--json",
]
try:
return subprocess.run(
cmd,
cwd=str(work_dir),
capture_output=True,
text=True,
check=False,
)
except FileNotFoundError as exc:
raise ModuleError(
code="CODEX_NOT_FOUND",
message=f"找不到 codex 命令: {codex_cmd}",
retryable=False,
) from exc