Merge pull request #95 from Miyabi-G-K/feature/issue-93-bus-docking

feat(cli): Bus docking — auto-enqueue on register
This commit is contained in:
林 駿甫 (Shunsuke Hayashi) 2026-04-10 10:16:08 +09:00 committed by GitHub
commit 3ff1a09c33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -177,6 +177,9 @@ enum GateCommand {
/// Completion mode
#[arg(long, value_enum, default_value_t = CompletionModeArg::GithubPr)]
completion_mode: CompletionModeArg,
/// Skip skill-bus auto-enqueue
#[arg(long)]
no_bus: bool,
},
/// Show status for one task or the whole ledger
Status {
@ -1269,8 +1272,10 @@ fn handle_gate_command(
soft_dependencies,
priority,
completion_mode,
no_bus,
} => {
let task_id = task_id.unwrap_or_else(|| derive_task_id(issue, &title));
let task_title = title.clone();
protocol
.register(
RegisterTaskRequest {
@ -1295,6 +1300,9 @@ fn handle_gate_command(
} else {
println!("registered: {} ({})", task.id, task.title);
}
if !no_bus {
bus_enqueue(&task.id, &task_title);
}
})
}
GateCommand::Status { task_id } => {
@ -2418,3 +2426,29 @@ fn truncate_str(s: &str, max_len: usize) -> String {
s.to_string()
}
}
fn bus_enqueue(task_id: &str, title: &str) {
let skill_runs_path = std::env::current_dir()
.ok()
.map(|cwd| cwd.join("skills/self-improving-skills/skill-runs.jsonl"));
if let Some(path) = skill_runs_path.filter(|p| p.parent().is_some_and(|d| d.exists())) {
let entry = serde_json::json!({
"ts": chrono::Utc::now().to_rfc3339(),
"agent": std::env::var("POLARIS_AGENT_ID").unwrap_or_else(|_| "system".into()),
"skill": "polaris-ops",
"task": format!("register: {title} ({task_id})"),
"result": "queued",
"score": 0.0,
"notes": "auto-enqueued on register"
});
if let Ok(mut file) = std::fs::OpenOptions::new()
.create(true)
.append(true)
.open(&path)
{
use std::io::Write;
let _ = writeln!(file, "{}", serde_json::to_string(&entry).unwrap_or_default());
}
}
}