fix(conductor): Apply review suggestions for track 'history_segregation'

This commit is contained in:
2026-02-24 22:11:50 -05:00
parent a6c9093961
commit 09df57df2b
3 changed files with 102 additions and 5 deletions

View File

@@ -16,6 +16,7 @@ import re
import glob
from pathlib import Path, PureWindowsPath
import summarize
import project_manager
def find_next_increment(output_dir: Path, namespace: str) -> int:
pattern = re.compile(rf"^{re.escape(namespace)}_(\d+)\.md$")
@@ -224,9 +225,6 @@ def run(config: dict) -> tuple[str, Path, list[dict]]:
return markdown, output_file, file_items
def main():
import project_manager
import tomllib
# Load global config to find active project
config_path = Path("config.toml")
if not config_path.exists():

89
manual_slop_history.toml Normal file

File diff suppressed because one or more lines are too long

View File

@@ -122,11 +122,16 @@ def default_project(name: str = "unnamed") -> dict:
# ── load / save ──────────────────────────────────────────────────────────────
def get_history_path(project_path: str | Path) -> Path:
"""Return the Path to the sibling history TOML file for a given project."""
p = Path(project_path)
return p.parent / f"{p.stem}_history.toml"
def load_project(path) -> dict:
def load_project(path: str | Path) -> dict:
"""
Load a project TOML file.
Automatically migrates legacy 'discussion' keys to a sibling history file.
"""
with open(path, "rb") as f:
proj = tomllib.load(f)
@@ -150,6 +155,7 @@ def load_project(path) -> dict:
def load_history(project_path: str | Path) -> dict:
"""Load the segregated discussion history from its dedicated TOML file."""
hist_path = get_history_path(project_path)
if hist_path.exists():
with open(hist_path, "rb") as f:
@@ -157,7 +163,11 @@ def load_history(project_path: str | Path) -> dict:
return {}
def save_project(proj: dict, path, disc_data: dict | None = None):
def save_project(proj: dict, path: str | Path, disc_data: dict | None = None):
"""
Save the project TOML.
If 'discussion' is present in proj, it is moved to the sibling history file.
"""
# Ensure 'discussion' is NOT in the main project dict
if "discussion" in proj:
# If disc_data wasn't provided, use the one from proj