Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "beyond-launch"
version = "0.3.1"
version = "0.3.2"
edition = "2024"
description = "Analyze a project and detect deployable services, languages, frameworks, commands, and env vars"
license = "MIT"
Expand Down
24 changes: 16 additions & 8 deletions src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ pub fn discover(
fs: &dyn FileSystem,
) -> Result<Discovery, LaunchError> {
walk(root, &mut signals, fs)?;
let outputs = generate(&mut signals, fs);
Ok(assemble(outputs, root))
let (outputs, warnings) = generate(&mut signals, fs);
let mut discovery = assemble(outputs, root);
discovery.warnings = warnings;
Ok(discovery)
}

// -- Step 1: Walk + Observe --
Expand Down Expand Up @@ -161,21 +163,27 @@ pub fn discover_local_impl(
fs: &dyn FileSystem,
) -> Result<Discovery, LaunchError> {
walk_local(root, &mut signals)?;
let outputs = generate(&mut signals, fs);
Ok(assemble(outputs, root))
let (outputs, warnings) = generate(&mut signals, fs);
let mut discovery = assemble(outputs, root);
discovery.warnings = warnings;
Ok(discovery)
}

// -- Step 2: Generate --

pub fn generate(signals: &mut [Box<dyn Signal>], fs: &dyn FileSystem) -> Vec<SignalOutput> {
pub fn generate(
signals: &mut [Box<dyn Signal>],
fs: &dyn FileSystem,
) -> (Vec<SignalOutput>, Vec<String>) {
let mut outputs = Vec::with_capacity(signals.len());
let mut warnings = Vec::new();
for signal in signals.iter_mut() {
match signal.generate(fs) {
Ok(output) => outputs.push(output),
Err(e) => eprintln!("signal {} failed: {e}", signal.name()),
Err(e) => warnings.push(format!("signal {} failed: {e}", signal.name())),
}
}
outputs
(outputs, warnings)
}

// -- Step 3: Assemble --
Expand Down Expand Up @@ -210,7 +218,7 @@ fn assemble(outputs: Vec<SignalOutput>, root: &Path) -> Discovery {
}
}

Discovery { services, monorepo }
Discovery { services, monorepo, ..Default::default() }
}

/// Get the "dir name" for a path — used for derived name detection.
Expand Down
9 changes: 5 additions & 4 deletions src/signals/docker_compose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,11 @@ impl Signal for DockerComposeSignal {
for rel in paths {
let resolved = compose_dir.join(rel);
if let Ok(bytes) = fs.read_file(&resolved) {
let contents = String::from_utf8_lossy(&bytes);
let file_path = resolved.to_string_lossy();
let file_env = parse_env_file_keys(&contents, &file_path);
merge_env_vars(&mut env, &file_env);
if let Ok(contents) = String::from_utf8(bytes) {
let file_path = resolved.to_string_lossy();
let file_env = parse_env_file_keys(&contents, &file_path);
merge_env_vars(&mut env, &file_env);
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ pub struct Discovery {
pub services: Vec<Service>,
#[serde(skip_serializing_if = "Option::is_none")]
pub monorepo: Option<Monorepo>,
/// Signals that failed during generation; non-empty means the result may be incomplete.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub warnings: Vec<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
Expand Down
Loading