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

Function intents

atomic-cli/src/commands/diagnostics/metrics.rs:160–184  ·  view source on GitHub ↗
(txn: &redb::ReadTransaction)

Source from the content-addressed store, hash-verified

158}
159
160fn intents(txn: &redb::ReadTransaction) -> Observation<IntentCounts> {
161 let result = (|| {
162 let table = txn.open_table(VAULT_MANIFEST).ok()?;
163 let value = table.get("manifest").ok()??;
164 let manifest: VaultManifest = serde_json::from_slice(value.value()).ok()?;
165 let mut counts = IntentCounts::default();
166 for intent in manifest.intents.values() {
167 counts.total += 1;
168 match intent.status.as_str() {
169 "backlog" => counts.backlog += 1,
170 "planned" => counts.planned += 1,
171 "in_progress" => counts.in_progress += 1,
172 "needs-review" => counts.needs_review += 1,
173 "done" => counts.done += 1,
174 "icebox" => counts.icebox += 1,
175 _ => counts.other += 1,
176 }
177 }
178 Some(counts)
179 })();
180 match result {
181 Some(value) => Observation::available(value),
182 None => Observation::unavailable("vault manifest unavailable or unreadable"),
183 }
184}
185
186pub(crate) fn collect(workspace: &Result<Option<PathBuf>, SourceError>) -> RepositoryMetrics {
187 let root = match workspace {

Callers 1

collectFunction · 0.85

Calls 5

valueMethod · 0.80
getMethod · 0.65
unavailableFunction · 0.50
okMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected