mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Add atlas-push skill documentation and enhance git submodule management
- Introduced a new `SKILL.md` file for the `atlas-push` skill, detailing the automated workflow for pushing filesystem changes into Roblox Studio, including prerequisites, workflow steps, and conflict resolution strategies. - Implemented `git_submodule_add` and `git_config_set` functions to manage git submodules and configuration settings, enhancing the git integration within the project. - Updated the `InitCommand` to add agent submodules in parallel, improving the efficiency of the initialization process. These changes aim to improve user guidance for the `atlas-push` skill and streamline git submodule handling in the project.
This commit is contained in:
parent
e8dc9b09b9
commit
cb3036a5d0
4 changed files with 311 additions and 17 deletions
|
|
@ -127,27 +127,68 @@ impl InitCommand {
|
|||
!self.skip_git
|
||||
};
|
||||
|
||||
if !self.skip_rules {
|
||||
log::debug!("Cloning cursor rules...");
|
||||
if !self.skip_rules && did_git_init {
|
||||
log::debug!("Adding agent submodules...");
|
||||
|
||||
let cursor_dir = base_path.join(".cursor");
|
||||
let result = crate::git::git_clone_shallow(
|
||||
"https://github.com/jrmelsha/cursor-rules.git",
|
||||
&cursor_dir,
|
||||
);
|
||||
let submodules: &[(&str, &str)] = &[
|
||||
(
|
||||
"https://github.com/UserGeneratedLLC/agent-rules.git",
|
||||
".cursor/rules/shared",
|
||||
),
|
||||
(
|
||||
"https://github.com/UserGeneratedLLC/agent-commands.git",
|
||||
".cursor/commands/shared",
|
||||
),
|
||||
(
|
||||
"https://github.com/UserGeneratedLLC/agent-skills.git",
|
||||
".cursor/skills/shared",
|
||||
),
|
||||
(
|
||||
"https://github.com/UserGeneratedLLC/agent-docs.git",
|
||||
".cursor/docs/shared",
|
||||
),
|
||||
];
|
||||
|
||||
match result {
|
||||
Ok(()) => {
|
||||
let git_dir = cursor_dir.join(".git");
|
||||
if git_dir.exists() {
|
||||
let _ = fs::remove_dir_all(&git_dir);
|
||||
}
|
||||
println!("Cloned cursor rules successfully.");
|
||||
// Shallow-clone all repos in parallel (network I/O).
|
||||
let clone_results: Vec<anyhow::Result<()>> = std::thread::scope(|s| {
|
||||
let handles: Vec<_> = submodules
|
||||
.iter()
|
||||
.map(|(url, path)| {
|
||||
let target = base_path.join(path);
|
||||
s.spawn(move || crate::git::git_clone_shallow(url, &target))
|
||||
})
|
||||
.collect();
|
||||
handles
|
||||
.into_iter()
|
||||
.map(|h| {
|
||||
h.join()
|
||||
.unwrap_or_else(|_| Err(anyhow::anyhow!("thread panicked")))
|
||||
})
|
||||
.collect()
|
||||
});
|
||||
|
||||
// Register each clone as a submodule (sequential, index-lock safe).
|
||||
let mut any_failed = false;
|
||||
for ((url, path), clone_res) in submodules.iter().zip(clone_results) {
|
||||
if let Err(e) = clone_res {
|
||||
log::warn!("Failed to clone {path}: {e}");
|
||||
any_failed = true;
|
||||
continue;
|
||||
}
|
||||
Err(_) => {
|
||||
log::debug!("Failed to clone cursor rules, skipping.");
|
||||
if let Err(e) = crate::git::git_submodule_add(&base_path, url, path) {
|
||||
log::warn!("Failed to register submodule {path}: {e}");
|
||||
any_failed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if let Err(e) = crate::git::git_config_set(&base_path, "submodule.recurse", "true") {
|
||||
log::warn!("Failed to set submodule.recurse: {e}");
|
||||
any_failed = true;
|
||||
}
|
||||
|
||||
if !any_failed {
|
||||
println!("Added agent submodules successfully.");
|
||||
}
|
||||
}
|
||||
|
||||
if did_git_init {
|
||||
|
|
|
|||
35
src/git.rs
35
src/git.rs
|
|
@ -424,6 +424,41 @@ pub fn git_clone_shallow(url: &str, target_dir: &Path) -> anyhow::Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Register a git submodule at `path` within the repo rooted at `repo_dir`.
|
||||
///
|
||||
/// If `path` already contains a valid clone, git skips the network fetch and
|
||||
/// just records the submodule in `.gitmodules` and the index.
|
||||
pub fn git_submodule_add(repo_dir: &Path, url: &str, path: &str) -> anyhow::Result<()> {
|
||||
let output = Command::new("git")
|
||||
.args(["submodule", "add", url, path])
|
||||
.current_dir(repo_dir)
|
||||
.output()
|
||||
.context("Failed to run git submodule add")?;
|
||||
if !output.status.success() {
|
||||
anyhow::bail!(
|
||||
"git submodule add failed: {}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Set a git config value in the repo at `repo_dir`.
|
||||
pub fn git_config_set(repo_dir: &Path, key: &str, value: &str) -> anyhow::Result<()> {
|
||||
let output = Command::new("git")
|
||||
.args(["config", key, value])
|
||||
.current_dir(repo_dir)
|
||||
.output()
|
||||
.context("Failed to run git config")?;
|
||||
if !output.status.success() {
|
||||
anyhow::bail!(
|
||||
"git config failed: {}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
struct ResolvedInstance {
|
||||
id: Ref,
|
||||
class_name: String,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ mod web;
|
|||
|
||||
// TODO: Work out what we should expose publicly
|
||||
|
||||
pub use git::{git_add, git_add_all_and_commit, git_clone_shallow, git_init_repo, git_is_staged};
|
||||
pub use git::{git_add, git_add_all_and_commit, git_init_repo, git_is_staged};
|
||||
pub use project::*;
|
||||
pub use rojo_ref::*;
|
||||
pub use serve_session::TreeFreshnessReport;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue