Skip to content

Spin deps CLI - #3660

Open
fibonacci1729 wants to merge 5 commits into
mainfrom
spin-deps-cli
Open

Spin deps CLI#3660
fibonacci1729 wants to merge 5 commits into
mainfrom
spin-deps-cli

Conversation

@fibonacci1729

@fibonacci1729 fibonacci1729 commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Implementation of SIP 024.

The first 2 commits here are two separable / independently reviewable chunks of work to (1) detect capability sets and (2) detect middleware.

The actual CLI experience (3rd commit) is still WIP (but feedback welcome regardless).

Signed-off-by: Brian Hardock <brian.hardock@fermyon.com>
Signed-off-by: Brian Hardock <brian.hardock@fermyon.com>
@fibonacci1729
fibonacci1729 requested a review from itowlson August 13, 2026 19:19
Signed-off-by: Brian Hardock <brian.hardock@fermyon.com>
@fibonacci1729 fibonacci1729 changed the title Spin deps cli Spin deps CLI Aug 13, 2026
@fibonacci1729
fibonacci1729 marked this pull request as ready for review August 13, 2026 19:22

@itowlson itowlson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! I struggled with a few things I'm afraid, and I have some naming nits. My main feeling is that I would really like to see the main flows as something like:

fn add_component_dependency() {
  let component_id = select_component();         // }
  let selected_interface = select_interface();   // } as you already have it
  let inheritance = select_inheritance();        // }
  write_dependency_to_manifest();
  regenerate_dependencies_wit();
  print_report();
}

instead if inlining the last half, which for me meant I lost track of what is really a very simple linear flow.

But all that aside the bones seem really solid and it is mostly stylistic confusion on my part. Great to see this under sail!

Comment thread crates/capabilities/src/collect.rs Outdated
Comment thread crates/capabilities/src/collect.rs Outdated
Comment thread crates/capabilities/src/collect.rs Outdated
Comment thread crates/capabilities/src/collect.rs
Comment thread crates/dependency-wit/src/lib.rs Outdated
Comment thread src/commands/deps.rs
.context("Failed to access dependencies table")?;

let dep_key = dep_name.to_string();
if deps_table.contains_key(&dep_key) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a thing we could check earlier, before tormenting them with decisions about capabilities that turn out to be completely nugatory. (We could even not offer keys that already exist.)

Comment thread src/commands/deps.rs
inherit_configuration,
} => {
let mut table = toml_edit::InlineTable::new();
table.insert(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disappointing that we can't use toml serialisation and slurp that into a toml_edit::Item.

Comment thread src/commands/deps.rs
package, version, ..
} => match package {
Some(p) => format!("{p}@{version}"),
None => version.clone(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where this is used but the comment implies it's human-facing - if so, I'm somewhat worried that a bare version may not be very informative unless it has the package name nearby. But like I say I am missing context on this

Comment thread src/commands/deps.rs
}

/// Serialize the resolved source as a middleware entry inline table.
fn serialize_trigger_dependency(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems very reminiscent of serialise_component_dependency. Even if we can't consolidate them, I'd consider locating them next to each other in the file (or even in a sub-module) so that someone maintaining them is more likely to see them both at once.

Comment thread src/commands/deps.rs
}

/// Print guidance about the capabilities the middleware needs.
fn print_middleware_capability_guidance(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems very similar to the other "print capability guidance" function except for the word "middleware" in the messages. Could we have a single function that takes a parameter? Do we even need to say "middleware" instead of "dependency" given that middleware is enough of a dependency to live under the dependencies command?

Signed-off-by: Brian Hardock <brian.hardock@fermyon.com>
Signed-off-by: Brian Hardock <brian.hardock@fermyon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants