mirror of
https://github.com/codestable/CodeStable.git
synced 2026-09-19 09:03:09 +08:00
30fecaae5e
收敛 CodeStable 主入口、runtime preflight、goal driver 与 skill 工程化评测闭环。 - 根 cs 对行动请求同轮直转,咨询与介绍保持非执行 - feature/issue/refactor/epic/docs 按仓库事实恢复,旧 stage skill 保留兼容薄壳 - repo-local runtime 支持版本检测、安全自动同步和显式 refresh-runtime - 完成 Codex/Claude marketplace 1.0.2、升级文档和回归/评测证据 验证:215 tests passed;package/runtime/diff checks passed;独立 review 与 QA 无 unresolved blocking/important findings。
48 lines
1.7 KiB
Python
48 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
OLD = """ if path.startswith("/tasks/") and path.endswith("/transition"):
|
|
task_id = int(path.split("/")[2])
|
|
body = self._read_json()
|
|
task = tasks.transition(self._conn(), task_id, body.get("status"))
|
|
self._send(200, _task_to_json(task))
|
|
return
|
|
"""
|
|
|
|
NEW = """ if path.startswith("/tasks/") and path.endswith("/transition"):
|
|
task_id = int(path.split("/")[2])
|
|
body = self._read_json()
|
|
conn = self._conn()
|
|
try:
|
|
task = tasks.transition(conn, task_id, body.get("status"))
|
|
except ValueError:
|
|
conn.execute(
|
|
"UPDATE tasks SET status = ? WHERE id = ?",
|
|
(body.get("status"), task_id),
|
|
)
|
|
conn.commit()
|
|
task = tasks.get_task(conn, task_id)
|
|
self._send(200, _task_to_json(task))
|
|
return
|
|
"""
|
|
|
|
|
|
def main():
|
|
if len(sys.argv) != 2:
|
|
print("usage: python3 inject.py <repo_path>", file=sys.stderr)
|
|
return 1
|
|
path = Path(sys.argv[1]) / "taskhub" / "http_api.py"
|
|
text = path.read_text(encoding="utf-8")
|
|
if OLD not in text:
|
|
print("g02 injection failed: expected transition handler string not found", file=sys.stderr)
|
|
return 1
|
|
path.write_text(text.replace(OLD, NEW, 1), encoding="utf-8")
|
|
print("g02 injected: API transition now accepts illegal status moves")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|