mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-10 03:30:59 +00:00
Print resolved graph path in arc run and arc validate
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
53b27ab188
commit
7dfbd53797
3 changed files with 22 additions and 2 deletions
|
|
@ -250,6 +250,16 @@ pub fn format_tokens_human(tokens: i64) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
/// Produce a relative path from cwd; falls back to `tilde_path` if not under cwd.
|
||||
pub fn relative_path(path: &Path) -> String {
|
||||
if let Ok(cwd) = std::env::current_dir() {
|
||||
if let Ok(rel) = path.strip_prefix(&cwd) {
|
||||
return rel.display().to_string();
|
||||
}
|
||||
}
|
||||
tilde_path(path)
|
||||
}
|
||||
|
||||
/// Shorten an absolute path by replacing the home directory prefix with `~`.
|
||||
pub fn tilde_path(path: &Path) -> String {
|
||||
if let Some(home) = dirs::home_dir() {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use arc_util::terminal::Styles;
|
|||
use chrono::{Local, Utc};
|
||||
use tracing::debug;
|
||||
|
||||
use super::tilde_path;
|
||||
use super::{relative_path, tilde_path};
|
||||
use crate::checkpoint::Checkpoint;
|
||||
use crate::engine::{RunConfig, WorkflowRunEngine};
|
||||
use crate::event::EventEmitter;
|
||||
|
|
@ -359,6 +359,11 @@ pub async fn run_command(
|
|||
graph.edges.len()
|
||||
)),
|
||||
);
|
||||
eprintln!(
|
||||
"{} {}",
|
||||
styles.dim.apply_to("Graph:"),
|
||||
styles.dim.apply_to(relative_path(&dot_path)),
|
||||
);
|
||||
|
||||
let goal = graph.goal();
|
||||
if !goal.is_empty() {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use arc_util::terminal::Styles;
|
|||
use crate::validation::Severity;
|
||||
use crate::workflow::prepare_from_file;
|
||||
|
||||
use super::{print_diagnostics, ValidateArgs};
|
||||
use super::{print_diagnostics, relative_path, ValidateArgs};
|
||||
|
||||
/// Parse and validate a workflow file without executing it.
|
||||
///
|
||||
|
|
@ -22,6 +22,11 @@ pub fn validate_command(args: &ValidateArgs, styles: &Styles) -> anyhow::Result<
|
|||
graph.nodes.len(),
|
||||
graph.edges.len(),
|
||||
);
|
||||
eprintln!(
|
||||
"{} {}",
|
||||
styles.dim.apply_to("Graph:"),
|
||||
styles.dim.apply_to(relative_path(&dot_path)),
|
||||
);
|
||||
|
||||
print_diagnostics(&diagnostics, styles);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue