story-kit: merge 164_bug_dev_process_readme_documents_wrong_pipeline_stages
This commit is contained in:
@@ -67,12 +67,10 @@ struct WorktreeListEntry {
|
||||
/// response so the agents panel is not cluttered with old completed items on
|
||||
/// frontend startup.
|
||||
pub fn story_is_archived(project_root: &path::Path, story_id: &str) -> bool {
|
||||
project_root
|
||||
.join(".story_kit")
|
||||
.join("work")
|
||||
.join("5_archived")
|
||||
.join(format!("{story_id}.md"))
|
||||
.exists()
|
||||
let work = project_root.join(".story_kit").join("work");
|
||||
let filename = format!("{story_id}.md");
|
||||
work.join("5_done").join(&filename).exists()
|
||||
|| work.join("6_archived").join(&filename).exists()
|
||||
}
|
||||
|
||||
pub struct AgentsApi {
|
||||
@@ -298,29 +296,39 @@ mod tests {
|
||||
use crate::agents::AgentStatus;
|
||||
use tempfile::TempDir;
|
||||
|
||||
fn make_archived_dir(tmp: &TempDir) -> path::PathBuf {
|
||||
fn make_work_dirs(tmp: &TempDir) -> path::PathBuf {
|
||||
let root = tmp.path().to_path_buf();
|
||||
let archived = root
|
||||
.join(".story_kit")
|
||||
.join("work")
|
||||
.join("5_archived");
|
||||
std::fs::create_dir_all(&archived).unwrap();
|
||||
for stage in &["5_done", "6_archived"] {
|
||||
std::fs::create_dir_all(root.join(".story_kit").join("work").join(stage)).unwrap();
|
||||
}
|
||||
root
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn story_is_archived_false_when_file_absent() {
|
||||
let tmp = TempDir::new().unwrap();
|
||||
let root = make_archived_dir(&tmp);
|
||||
let root = make_work_dirs(&tmp);
|
||||
assert!(!story_is_archived(&root, "79_story_foo"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn story_is_archived_true_when_file_present() {
|
||||
fn story_is_archived_true_when_file_in_5_done() {
|
||||
let tmp = TempDir::new().unwrap();
|
||||
let root = make_archived_dir(&tmp);
|
||||
let root = make_work_dirs(&tmp);
|
||||
std::fs::write(
|
||||
root.join(".story_kit/work/5_archived/79_story_foo.md"),
|
||||
root.join(".story_kit/work/5_done/79_story_foo.md"),
|
||||
"---\nname: test\n---\n",
|
||||
)
|
||||
.unwrap();
|
||||
assert!(story_is_archived(&root, "79_story_foo"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn story_is_archived_true_when_file_in_6_archived() {
|
||||
let tmp = TempDir::new().unwrap();
|
||||
let root = make_work_dirs(&tmp);
|
||||
std::fs::write(
|
||||
root.join(".story_kit/work/6_archived/79_story_foo.md"),
|
||||
"---\nname: test\n---\n",
|
||||
)
|
||||
.unwrap();
|
||||
@@ -330,11 +338,11 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn list_agents_excludes_archived_stories() {
|
||||
let tmp = TempDir::new().unwrap();
|
||||
let root = make_archived_dir(&tmp);
|
||||
let root = make_work_dirs(&tmp);
|
||||
|
||||
// Place an archived story file
|
||||
// Place an archived story file in 6_archived
|
||||
std::fs::write(
|
||||
root.join(".story_kit/work/5_archived/79_story_archived.md"),
|
||||
root.join(".story_kit/work/6_archived/79_story_archived.md"),
|
||||
"---\nname: archived story\n---\n",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user