Merge project_path into project: one path relative to ~/code, or to / outside it
This commit is contained in:
+7
-14
@@ -15,9 +15,10 @@ Exit 2: the human is needed and stdin or stdout is not a terminal, or the interr
|
||||
them typing anything. Rerunning resumes the session after either exit. Before an interrupt every
|
||||
worktree is marked trusted in ~/.claude.json.
|
||||
|
||||
Each project has one session, "A ~/code/<path> auto-mode" (the absolute path outside ~/code),
|
||||
deleted when the chunk finishes. Its transcript is archived under $AUTO_MODE_TRANSCRIPTS (default
|
||||
~/.claude/auto-mode-transcripts/<path>/) whenever the human is asked and when the chunk finishes.
|
||||
Each project has one session, "A <path> auto-mode", <path> being the checkout relative to ~/code,
|
||||
or to / outside it, deleted when the chunk finishes. Its transcript is archived under
|
||||
$AUTO_MODE_TRANSCRIPTS (default ~/.claude/auto-mode-transcripts/<path>/) whenever the human is asked
|
||||
and when the chunk finishes.
|
||||
JUDGE_MODEL and WORKER_MODEL override the model the project's Claude Code settings pick. A change to
|
||||
this file takes effect at the next cycle boundary, once the new file answers --help.
|
||||
|
||||
@@ -105,15 +106,7 @@ def read_premises():
|
||||
|
||||
|
||||
def project():
|
||||
root = os.path.expanduser("~/code")
|
||||
cwd = os.getcwd()
|
||||
if cwd == root or cwd.startswith(f"{root}/"):
|
||||
return "~/" + os.path.relpath(cwd, os.path.dirname(root))
|
||||
return cwd
|
||||
|
||||
|
||||
def project_path():
|
||||
return project().removeprefix("~/code").lstrip("/") or "code"
|
||||
return os.getcwd().removeprefix(os.path.expanduser("~/code/")).lstrip("/")
|
||||
|
||||
|
||||
def session_name():
|
||||
@@ -188,14 +181,14 @@ def make_private(folder):
|
||||
|
||||
|
||||
def archive(path, note):
|
||||
folder = os.path.join(ARCHIVE, project_path())
|
||||
folder = os.path.join(ARCHIVE, project())
|
||||
try:
|
||||
stamp = time.strftime("%Y-%m-%dT%H-%M-%SZ", time.gmtime(os.path.getmtime(path)))
|
||||
make_private(folder)
|
||||
dest = os.path.join(folder, f"{stamp}.md")
|
||||
if not os.path.exists(dest):
|
||||
with open(os.open(dest, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600), "w", encoding="utf-8") as copy:
|
||||
copy.write(f"# {stamp} {project_path()}\n\n{note}\n\n{render(entries(path))}\n")
|
||||
copy.write(f"# {stamp} {project()}\n\n{note}\n\n{render(entries(path))}\n")
|
||||
print(f"transcript: {dest}", file=sys.stderr)
|
||||
except OSError as failure:
|
||||
print(f"could not archive the transcript: {failure}", file=sys.stderr)
|
||||
|
||||
@@ -56,17 +56,16 @@ class HumanTurns(unittest.TestCase):
|
||||
|
||||
|
||||
class Project(unittest.TestCase):
|
||||
def test_names_a_checkout_under_code_by_its_relative_path_and_any_other_by_its_absolute_one(self):
|
||||
def test_names_a_checkout_relative_to_code_and_any_other_relative_to_root(self):
|
||||
with unittest.mock.patch.dict(os.environ, {"HOME": "/h"}):
|
||||
with unittest.mock.patch("os.getcwd", return_value="/h/code/a/b"):
|
||||
self.assertEqual(loop.session_name(), "A ~/code/a/b auto-mode")
|
||||
self.assertEqual(loop.project_path(), "a/b")
|
||||
self.assertEqual(loop.project(), "a/b")
|
||||
self.assertEqual(loop.session_name(), "A a/b auto-mode")
|
||||
with unittest.mock.patch("os.getcwd", return_value="/h/code"):
|
||||
self.assertEqual(loop.session_name(), "A ~/code auto-mode")
|
||||
self.assertEqual(loop.project_path(), "code")
|
||||
self.assertEqual(loop.project(), "h/code")
|
||||
with unittest.mock.patch("os.getcwd", return_value="/srv/x"):
|
||||
self.assertEqual(loop.session_name(), "A /srv/x auto-mode")
|
||||
self.assertEqual(loop.project_path(), "srv/x")
|
||||
self.assertEqual(loop.project(), "srv/x")
|
||||
self.assertEqual(loop.session_name(), "A srv/x auto-mode")
|
||||
|
||||
|
||||
class WorkerArgs(unittest.TestCase):
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
Ordered by how many seats of the 2026-09-24 scoring panel (`docs/decisions.md`) named the place; each is one chunk.
|
||||
|
||||
- Merge `project` and `project_path` into one name and one shape for the project's path.
|
||||
- Name the session, the archive folder and its env var `loop-claude`; today they say `auto-mode`.
|
||||
- Pin every `CLAUDE.md` heading the agents and skills cite with a test that resolves each citation.
|
||||
- Define chunk, plan and release inside `JUDGE_RULES`; the judge reads nothing else.
|
||||
|
||||
Reference in New Issue
Block a user