diff --git a/.gitattributes b/.gitattributes index 788efb114..e2f87f6dc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -.pql/changelog/*.sql merge=union +.pql/changelog/**/*.sql merge=union diff --git a/tooling/pql-migrate/add_workshop_provenance.py b/tooling/pql-migrate/add_workshop_provenance.py index 08ace0afa..ed2cec083 100644 --- a/tooling/pql-migrate/add_workshop_provenance.py +++ b/tooling/pql-migrate/add_workshop_provenance.py @@ -16,10 +16,12 @@ import glob import os import re import sqlite3 +import subprocess import sys APPLY = "--apply" in sys.argv -REPO = "/var/mnt/data/projects/settled-reach/main" +# Derive the repo root from git so the script targets the checkout it's run from. +REPO = subprocess.check_output(["git", "rev-parse", "--show-toplevel"], text=True).strip() DB = f"{REPO}/.pql/pql.db" D_IDS = set(r[0] for r in sqlite3.connect(DB).execute( @@ -48,7 +50,7 @@ def main(): text = open(f, encoding="utf-8").read() fm, body = split_frontmatter(text) refs = refs_in(body if fm is not None else text) - rel = f.split("/main/", 1)[-1] + rel = os.path.relpath(f, REPO) wname = os.path.basename(os.path.dirname(f)) refs_yaml = "[" + ", ".join(refs) + "]" diff --git a/tooling/pql-migrate/repath_references.py b/tooling/pql-migrate/repath_references.py index 6c937957f..870efc688 100644 --- a/tooling/pql-migrate/repath_references.py +++ b/tooling/pql-migrate/repath_references.py @@ -35,6 +35,9 @@ REPLACEMENTS = [ (re.compile(r"(? governance/). The +# absolute paths below are the canonical main checkout where it was run; kept +# committed for provenance. TARGETS = sorted(set( glob.glob("/var/mnt/data/projects/settled-reach/main/.claude/agents/*.md") + glob.glob("/var/mnt/data/projects/settled-reach/main/.claude/skills/**/*.md", recursive=True) diff --git a/tooling/pql-migrate/restructure_decisions.py b/tooling/pql-migrate/restructure_decisions.py index d6844b50b..8849a909b 100644 --- a/tooling/pql-migrate/restructure_decisions.py +++ b/tooling/pql-migrate/restructure_decisions.py @@ -17,6 +17,9 @@ import subprocess import sys from pathlib import Path +# One-shot transform, already applied (decisions/ -> governance/). Re-running is +# unsupported: the git mv calls would fail on already-moved sources. The path below +# is the canonical main checkout where it was run; kept committed for provenance. ROOT = Path("/var/mnt/data/projects/settled-reach/main") APPLY = "--apply" in sys.argv diff --git a/tooling/pql-migrate/retag_ticket_refs.py b/tooling/pql-migrate/retag_ticket_refs.py index 3b3a65ef9..5bc18cb28 100644 --- a/tooling/pql-migrate/retag_ticket_refs.py +++ b/tooling/pql-migrate/retag_ticket_refs.py @@ -23,6 +23,8 @@ import sqlite3 import sys APPLY = "--apply" in sys.argv +# One-shot transform, already applied (#N -> T-N). The path below is the canonical +# main checkout where it was run; kept committed for provenance. REPO = "/var/mnt/data/projects/settled-reach/main" SRC = os.environ.get("SR_DB_PATH", "/var/home/jeroenschweitzer/Projects/settled-reach/settledreach.db") diff --git a/tooling/pql-migrate/seed_tickets.py b/tooling/pql-migrate/seed_tickets.py index c41265912..bc2889759 100644 --- a/tooling/pql-migrate/seed_tickets.py +++ b/tooling/pql-migrate/seed_tickets.py @@ -25,10 +25,13 @@ import hashlib import os import re import sqlite3 +import subprocess import sys APPLY = "--apply" in sys.argv -REPO = "/var/mnt/data/projects/settled-reach/main" +# Derive the repo root from git so the script targets the checkout it's run from +# (a worktree, a fresh clone, or main) rather than a hardcoded path. +REPO = subprocess.check_output(["git", "rev-parse", "--show-toplevel"], text=True).strip() SRC = os.environ.get("SR_DB_PATH", "/var/home/jeroenschweitzer/Projects/settled-reach/settledreach.db") DST = f"{REPO}/.pql/pql.db" SEED_TS = "2026-06-06 00:00:00" # well-formed stamp for rows the legacy schema didn't timestamp