Keep configs in ~/.config/build-release/ and tool state in ~/.local/state/build-release/, under XDG_* where set
CI / tests (pull_request) Successful in 6m34s
CI / tests (pull_request) Successful in 6m34s
This commit is contained in:
@@ -30,10 +30,10 @@ def gather(env: typing.Mapping[str, str], home: pathlib.Path, claude: Claude) ->
|
||||
checkout = top(git)
|
||||
if isinstance(checkout, Failure):
|
||||
return checkout
|
||||
rung = project_rung(home, git)
|
||||
rung = project_rung(home, env, git)
|
||||
if isinstance(rung, Failure):
|
||||
return rung
|
||||
review = made_review_folder(checkout, home)
|
||||
review = made_review_folder(checkout, home, env)
|
||||
if isinstance(review, Failure):
|
||||
return review
|
||||
with held(review) as folder:
|
||||
@@ -61,20 +61,20 @@ def run_claude(args: list[str], cwd: str, prompt: str) -> subprocess.CompletedPr
|
||||
return subprocess.run(["claude", *args], capture_output=True, cwd=cwd, env=with_release_tools(os.environ), input=prompt, text=True)
|
||||
|
||||
|
||||
def project_rung(home: pathlib.Path, git: Git) -> Rung | Failure:
|
||||
def project_rung(home: pathlib.Path, env: typing.Mapping[str, str], git: Git) -> Rung | Failure:
|
||||
"""The cheapest rung for the model build-release runs the project on. The routing ladder is that of the project the process runs in."""
|
||||
common = git("rev-parse", "--path-format=absolute", "--git-common-dir")
|
||||
if isinstance(common, Failure):
|
||||
return common
|
||||
# A worktree's project is its main checkout's, which holds the folder every worktree shares.
|
||||
key = project_key(os.path.dirname(common.strip()), home)
|
||||
saved = paths_from(home).models_file
|
||||
saved = paths_from(home, env).models_file
|
||||
models = read_models_file(saved)
|
||||
if isinstance(models, Failure):
|
||||
return models
|
||||
if key not in models:
|
||||
return Failure(f"{saved} names no model for {key}: run build-release in the project once, which asks for it.")
|
||||
ladder = project_ladder(None, home)
|
||||
ladder = project_ladder(None, home, env)
|
||||
if isinstance(ladder, Failure):
|
||||
return ladder
|
||||
project = ladder.project_rung(models[key])
|
||||
|
||||
Reference in New Issue
Block a user