Single-commit clean baseline after security scrub of niche-tells, project codenames, internal jargon, and contributor-email leaks. Contents: - 100 Rust crates (_primitives/_rust/) - 37 agent manifests (_manifests/) + generated specs (_generated/) - 67 user-invocable skills (skills/) - 33 hooks (hooks/) - Composition blocks (_blocks/) - Documentation (docs/, README.md) - TS adapter packages (_ts_packages/) - Assembler (_assembler/) - Roles (_roles/) - Templates (_templates/) - Forgejo CI (.forgejo/) Author: Denis Parfionovich <info@greendragon.info> License: see LICENSE.
29 lines
937 B
Rust
29 lines
937 B
Rust
//! `kei-migrate status` — list applied + pending migrations.
|
|
|
|
use crate::discover::Migration;
|
|
use crate::tracker;
|
|
use anyhow::Result;
|
|
use sqlx::AnyPool;
|
|
use std::collections::HashSet;
|
|
|
|
/// Print a human-readable table. Returns (applied_count, pending_count).
|
|
pub async fn run(pool: &AnyPool, migrations: &[Migration]) -> Result<(u32, u32)> {
|
|
let applied: HashSet<i64> = tracker::applied_versions(pool).await?.into_iter().collect();
|
|
let mut a = 0u32;
|
|
let mut p = 0u32;
|
|
println!("{:>14} {:<8} name", "version", "status");
|
|
println!("{:>14} {:<8} ----", "-------", "------");
|
|
for m in migrations {
|
|
let status = if applied.contains(&m.version) {
|
|
a += 1;
|
|
"APPLIED"
|
|
} else {
|
|
p += 1;
|
|
"PENDING"
|
|
};
|
|
println!("{:>14} {:<8} {}", m.version, status, m.name);
|
|
}
|
|
println!();
|
|
println!("{} applied, {} pending", a, p);
|
|
Ok((a, p))
|
|
}
|