feat(kis-collection): finalize sqlite migration, add fallback resilience, and update WBS documentation

This commit is contained in:
2026-06-22 18:34:56 +09:00
parent c576138829
commit 6c549b7bdc
48 changed files with 34610 additions and 24883 deletions
@@ -2,6 +2,7 @@ from __future__ import annotations
import os
import subprocess
import sys
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime, timezone
from math import fsum
@@ -12,6 +13,27 @@ from typing import Any, Callable
ROOT = Path(__file__).resolve().parents[2]
def resolve_python_interpreter() -> list[str]:
"""Prefer the project Python 3.13 interpreter on Windows.
The repo's working `python` command may point at an older interpreter, but
the build and validation scripts depend on the package set installed under
Python 3.13. Fall back to sys.executable only if the launcher is unavailable.
"""
configured = os.environ.get("CODEX_PYTHON")
if configured:
return [configured]
if os.name == "nt":
for candidate in (
r"C:\Users\kjh20\AppData\Local\Programs\Python\Python313\python.exe",
r"C:\Users\kjh20\AppData\Local\Python\pythoncore-3.13-64\python.exe",
):
if Path(candidate).exists():
return [candidate]
return ["py", "-3.13"]
return [sys.executable]
def utf8_env() -> dict[str, str]:
env = os.environ.copy()
env.setdefault("PYTHONIOENCODING", "utf-8")
@@ -24,6 +46,8 @@ def _run_command(command: list[str], cwd: Path | None = None) -> dict[str, Any]:
resolved = list(command)
if os.name == "nt" and resolved and resolved[0].lower() == "npm":
resolved[0] = "npm.cmd"
if resolved and resolved[0].endswith(".py"):
resolved = [*resolve_python_interpreter(), *resolved]
subprocess.run(resolved, cwd=cwd or ROOT, check=True, env=utf8_env())
finished = datetime.now(timezone.utc)
return {