Sync Cupcake policies into mission workspaces
This commit is contained in:
@@ -1598,6 +1598,17 @@ pub async fn prepare_mission_workspace_with_skills_backend(
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
if workspace.workspace_type == WorkspaceType::Host {
|
||||||
|
if let Err(e) = sync_project_policy_assets(&workspace.path, &dir) {
|
||||||
|
tracing::warn!(
|
||||||
|
workspace = %workspace.name,
|
||||||
|
mission = %mission_id,
|
||||||
|
error = %e,
|
||||||
|
"Failed to sync project policy assets to mission workspace"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Sync skills and tools from workspace to mission directory
|
// Sync skills and tools from workspace to mission directory
|
||||||
if let Some(lib) = library {
|
if let Some(lib) = library {
|
||||||
let context = format!("mission-{}", mission_id);
|
let context = format!("mission-{}", mission_id);
|
||||||
@@ -1678,6 +1689,37 @@ pub async fn prepare_mission_workspace_with_skills_backend(
|
|||||||
Ok(dir)
|
Ok(dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn sync_project_policy_assets(workspace_root: &Path, mission_dir: &Path) -> anyhow::Result<()> {
|
||||||
|
let cupcake_src = workspace_root.join(".cupcake");
|
||||||
|
if cupcake_src.exists() {
|
||||||
|
let cupcake_dest = mission_dir.join(".cupcake");
|
||||||
|
if !cupcake_dest.exists() {
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
|
std::os::unix::fs::symlink(&cupcake_src, &cupcake_dest)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let opencode_dir = mission_dir.join(".opencode");
|
||||||
|
if opencode_dir.exists() {
|
||||||
|
for plugin_dir in ["plugin", "plugins"] {
|
||||||
|
let src = workspace_root.join(".opencode").join(plugin_dir);
|
||||||
|
if src.exists() {
|
||||||
|
let dest = opencode_dir.join(plugin_dir);
|
||||||
|
if !dest.exists() {
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
|
std::os::unix::fs::symlink(&src, &dest)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Prepare a workspace directory for a task and write `opencode.json`.
|
/// Prepare a workspace directory for a task and write `opencode.json`.
|
||||||
pub async fn prepare_task_workspace(
|
pub async fn prepare_task_workspace(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
|
|||||||
Reference in New Issue
Block a user