Enhance initialization and API handling

- Updated the `InitCommand` to conditionally add and commit all changes after initializing a git repository, improving project setup efficiency.
- Modified the API service to include requested IDs in the instance retrieval process, ensuring accurate instance management.

These changes aim to streamline the initialization process and enhance the API's functionality for better user experience.
This commit is contained in:
Joe 2026-03-03 08:08:47 -06:00
parent d434a97334
commit 3b3bd04fad
3 changed files with 15 additions and 3 deletions

View file

@ -127,6 +127,10 @@ impl InitCommand {
!self.skip_git
};
if did_git_init {
crate::git::git_add_all_and_commit(&base_path, "Initial commit");
}
if !self.skip_rules && did_git_init {
log::debug!("Adding agent submodules...");
@ -189,10 +193,8 @@ impl InitCommand {
if !any_failed {
println!("Added agent submodules successfully.");
}
}
if did_git_init {
crate::git::git_add_all_and_commit(&base_path, "Initial commit");
crate::git::git_add_all_and_commit(&base_path, "Add agent submodules");
}
println!("Created project successfully.");

View file

@ -3411,6 +3411,12 @@ impl ApiService {
}
}
for &id in &requested_ids {
if tree.get_instance(id).is_some() {
included_ids.insert(id);
}
}
for &id in &included_ids {
if let Some(instance) = tree.get_instance(id) {
instances.insert(id, instance_for_scripts_only(instance, &included_ids));