MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / run

Method run

atomic-cli/src/commands/intent/new.rs:71–122  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

69
70impl 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}

Callers

nothing calls this directly

Calls 5

find_repository_rootFunction · 0.85
vault_intent_createMethod · 0.80
vault_intent_updateMethod · 0.80
cloneMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected