(&self)
| 69 | |
| 70 | impl Command for IntentNew { |
| 71 | fn run(&self) -> CliResult<()> { |
| 72 | if self.template != "feature" { |
| 73 | return Err(CliError::InvalidArgument { |
| 74 | message: format!( |
| 75 | "unknown template '{}' (only 'feature' is implemented)", |
| 76 | self.template |
| 77 | ), |
| 78 | }); |
| 79 | } |
| 80 | |
| 81 | let root = find_repository_root()?; |
| 82 | let repo = Repository::open(&root).map_err(CliError::Repository)?; |
| 83 | |
| 84 | // Create through the EXISTING vault write path so the intent enters |
| 85 | // redb normally and joins the merkle exactly as `atomic vault intent |
| 86 | // create` does — we do NOT invent a new redb write. |
| 87 | let created = repo |
| 88 | .vault_intent_create(IntentCreateOptions { |
| 89 | title: self.title.clone(), |
| 90 | priority: None, |
| 91 | assignee: None, |
| 92 | labels: Vec::new(), |
| 93 | session_id: None, |
| 94 | turn_id: None, |
| 95 | }) |
| 96 | .map_err(CliError::Repository)?; |
| 97 | |
| 98 | // Overwrite the (legacy positional) scaffold body with the directive |
| 99 | // scaffold, again through the existing update path. `force` is set |
| 100 | // because this runs immediately after create; the intent is a fresh |
| 101 | // backlog draft with no linked goal, so force is a no-op guard-skip. |
| 102 | let scaffold = FEATURE_SCAFFOLD.replace("{id}", &created.id.to_lowercase()); |
| 103 | repo.vault_intent_update( |
| 104 | &created.id, |
| 105 | IntentUpdateOptions { |
| 106 | content: Some(scaffold), |
| 107 | force: true, |
| 108 | ..Default::default() |
| 109 | }, |
| 110 | ) |
| 111 | .map_err(CliError::Repository)?; |
| 112 | |
| 113 | println!("Created intent: {}", created.id); |
| 114 | println!(" file: .vault/{}", created.intent_file); |
| 115 | println!(" template: {}", self.template); |
| 116 | println!(); |
| 117 | println!("Edit the directive stubs, then:"); |
| 118 | println!(" atomic intent validate {}", created.id); |
| 119 | println!(" atomic intent attest {}", created.id); |
| 120 | |
| 121 | Ok(()) |
| 122 | } |
| 123 | } |
nothing calls this directly
no test coverage detected