Commit 2570bf8b
2570bf8b3a8cMerged
Scott Nixon <[email protected]> ยท 9 months ago ยท 1 file ยท ~1 modified
Description
Improve decompose command: better shell quoting rules and use bash
- Add prompt rules for single-quoting bd arguments and avoiding special chars
- Fix code fence stripping to handle
bash/sh variants - Switch from sh to bash for generated scripts
Details
- Commit
- 2570bf8b3a8c
- Parent
- 7df84510ff40
crates/attractor-cli/src/main.rsmodifiedView file
@@ -438,7 +438,9 @@
438438
8. Echo the epic ID at the end: echo $EPIC_ID\n\439439
9. Priority should be P2 for most tasks unless critical (P1) or backlog (P3/P4)\n\440440
10. Task descriptions should be 1-2 sentences summarizing what needs to be done\n\441-
11. CRITICAL: Do NOT wrap output in markdown code fences. Start directly with 'set -e'",441+
11. CRITICAL: Do NOT wrap output in markdown code fences. Start directly with 'set -e'\n\442+
12. CRITICAL: All --title and --description values MUST be in single quotes. Escape any single quotes inside values with '\\'' (end quote, escaped quote, start quote)\n\443+
13. Do NOT use parentheses, backticks, or dollar signs inside quoted strings โ keep descriptions plain text only",442444
spec_content443445
);444446
@@ -470,19 +472,17 @@
470472
.ok_or_else(|| anyhow::anyhow!("Claude output missing 'result' field"))?471473
.to_string();472474
473-
// Strip markdown code fences if present474-
if shell_commands.starts_with("```") {475-
let lines: Vec<&str> = shell_commands.lines().collect();476-
if lines.len() > 2 && lines[0].starts_with("```") && lines[lines.len() - 1] == "```" {477-
shell_commands = lines[1..lines.len() - 1].join("\n");478-
}475+
// Strip markdown code fences if present (handles ```bash, ```sh, ```, etc.)476+
let lines: Vec<&str> = shell_commands.lines().collect();477+
if lines.len() > 2 && lines[0].starts_with("```") && lines.last().map_or(false, |l| l.trim() == "```") {478+
shell_commands = lines[1..lines.len() - 1].join("\n");479479
}480480
481481
// Prepend shebang (and set -e if not already present)482482
let full_script = if shell_commands.starts_with("set -e") {483-
format!("#!/bin/sh\n{}", shell_commands)483+
format!("#!/bin/bash\n{}", shell_commands)484484
} else {485-
format!("#!/bin/sh\nset -e\n\n{}", shell_commands)485+
format!("#!/bin/bash\nset -e\n\n{}", shell_commands)486486
};487487
488488
if dry_run {@@ -504,8 +504,8 @@
504504
std::fs::set_permissions(&temp_script, perms)?;505505
}506506
507-
// Execute with sh -e508-
let exec_result = tokio::process::Command::new("sh")507+
// Execute with bash -e508+
let exec_result = tokio::process::Command::new("bash")509509
.arg("-e")510510
.arg(&temp_script)511511
.output()