4 Commits
Author SHA1 Message Date
johannesandClaude Sonnet 5.5 a4df9c3b01 feat: open the session in hx with --session from the TUI
build / version (push) Successful in 10s
build / build (aarch64-apple-darwin) (push) Successful in 4m30s
build / build (x86_64-unknown-linux-musl) (push) Successful in 3m44s
build / release (push) Successful in 25s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 22:23:05 +01:00
gitea-actions 5611ad7e6a ci: bin.json v0.1.2 2026-11-15 21:14:00 +00:00
johannes 8539e0308d feat: add local profiles inspection before global
build / version (push) Successful in 9s
build / build (aarch64-apple-darwin) (push) Successful in 3m57s
build / build (x86_64-unknown-linux-musl) (push) Successful in 3m35s
build / release (push) Successful in 20s
2026-11-15 22:05:56 +01:00
gitea-actions ef53278466 ci: bin.json v0.1.1 2026-11-15 15:23:13 +00:00
4 changed files with 27 additions and 16 deletions

No files matched your search

+1 -1
View File
@@ -54,7 +54,7 @@ command = "python3 /work/adapters/gitea.py"
## State-machine sessions and the TUI
`orch` without a subcommand opens the TUI: sessions overview (`enter` on a row opens the session detail, `esc` goes
back; `t` full test output, `d` diff, `l` event transcript, `o` open the worktree in hx). It reads `.hx/orch.db` of the
back; `t` full test output, `d` diff, `l` event transcript, `o` open the session in hx, `hx --session sN` in its worktree). It reads `.hx/orch.db` of the
current directory. `orch session --repo . --machine task --name NAME [--profile P]` creates a session and runs it.
`orch session --repo . --resume s1` continues an unfinished session (for example after a crash or a closed terminal)
from its saved state; `--machine`, `--name` and `--after` are not allowed with it. Machines are TOML files in
+3 -3
View File
@@ -1,7 +1,7 @@
{
"version": "0.1.0",
"version": "0.1.2",
"sha256": {
"aarch64-apple-darwin": "910820e932ae36b65e313a23fa66c5ca5c0a0aa93fc00dc3dbf8441be1a2bcb5",
"x86_64-unknown-linux-musl": "9964dc4ff29edc7289503d52b07ae45de9a604343d6003710718bc11c3d87076"
"aarch64-apple-darwin": "90d260baec2247624a9f718fc5c66a6dfd87e11981a2660ec0caddac4b7aa066",
"x86_64-unknown-linux-musl": "6dd90621ba50e40a6efff5ecbd5f870c36ca579ec00030b0e76c4022151871e8"
}
}
+13 -8
View File
@@ -1,9 +1,19 @@
//! Profile: `<config>/profiles/NAME.toml`. One profile = one identity (own HOME/auth), budget and gate.
//! Profile: `./.hx/profiles/NAME.toml` (repo-local, checked first), else `<config>/profiles/NAME.toml`. One profile = one identity (own HOME/auth), budget and gate.
use anyhow::{Context, Result, bail};
use serde::Deserialize;
use std::path::PathBuf;
/// `./.hx/profiles/NAME.toml` when it exists (repo-local wins), else `<config>/profiles/NAME.toml`.
fn profile_path(name: &str) -> PathBuf {
let file = format!("{name}.toml");
let local = PathBuf::from(".hx/profiles").join(&file);
if local.is_file() {
return local;
}
crate::config_dir().join("profiles").join(file)
}
/// [`Profile::add_allow`] on a file.
fn add_allow_at(path: &std::path::Path, entry: &str) -> Result<bool> {
crate::policy::check_entry(entry)?;
@@ -172,9 +182,7 @@ impl Profile {
if name.is_empty() || name.contains(['/', '.']) {
bail!("bad profile name {name:?}");
}
let path = crate::config_dir()
.join("profiles")
.join(format!("{name}.toml"));
let path = profile_path(name);
let s = match std::fs::read_to_string(&path) {
// only the implicit profile may be missing; a typo in any other name must still fail
Err(e) if name == "default" && e.kind() == std::io::ErrorKind::NotFound => {
@@ -192,10 +200,7 @@ impl Profile {
if name.is_empty() || name.contains(['/', '.']) {
bail!("bad profile name {name:?}");
}
let path = crate::config_dir()
.join("profiles")
.join(format!("{name}.toml"));
add_allow_at(&path, entry)
add_allow_at(&profile_path(name), entry)
}
pub fn account<'a>(&'a self, profile: &'a str) -> &'a str {
+10 -4
View File
@@ -768,12 +768,18 @@ fn transcript(app: &App, id: &str) -> Pager {
}
}
/// Opens hx in the worktree: the TUI steps aside for the time hx runs.
fn open_in_hx(term: &mut ratatui::DefaultTerminal, worktree: &str) -> Option<String> {
/// Opens hx on the session's conversation in the worktree: the TUI steps aside for the time hx runs.
fn open_in_hx(
term: &mut ratatui::DefaultTerminal,
worktree: &str,
session: &str,
) -> Option<String> {
let hx = crate::profile::Profile::load("default").map_or_else(|_| "hx".into(), |p| p.hx);
let mut parts = hx.split_whitespace();
let mut cmd = std::process::Command::new(parts.next()?);
cmd.args(parts).current_dir(worktree);
cmd.args(parts)
.args(["--session", session])
.current_dir(worktree);
ratatui::restore();
let res = cmd.status();
*term = ratatui::init();
@@ -1002,7 +1008,7 @@ fn on_key(
}
KeyCode::Char('o') => {
if let Some(d) = &app.detail
&& let Some(err) = open_in_hx(term, &d.worktree.clone())
&& let Some(err) = open_in_hx(term, &d.worktree.clone(), &d.id.clone())
{
app.pager = Some(Pager {
title: "open worktree".into(),