Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
//! `cargo x deps [--check]` regenerates (or, with `--check`, verifies) the two
//! generated dependency artifacts:
//!
//! - `workspace-hack/Cargo.toml` (via the hakari engine): pins every
//! third-party dep to its union feature set so a solo `cargo build -p X`
//! resolves the same features as the union-built crane dep layers, keeping
//! the warm dependency caches exact fingerprint matches.
//! - `.github/workspace-dep-closures.json`: every workspace crate's
//! transitive workspace dependency closure, consumed by flake.nix to build
//! pruned per-artifact deploy sources.
//!
//! Both run from the hakari/guppy versions pinned in Cargo.lock, so local
//! runs and CI cannot disagree about generator versions. `just hakari` wraps
//! the regenerate mode; CI runs `--check` and fails on drift.
mod closures;
mod hakari_ops;
use anyhow::{Result, bail};
use guppy::graph::PackageGraph;
use xtask_graph::build_graph;
fn main() -> Result<()> {
let args: Vec<String> = std::env::args().skip(1).collect();
match args.iter().map(String::as_str).collect::<Vec<_>>()[..] {
[] => run_deps(false),
["--check"] => run_deps(true),
_ => bail!("usage: cargo x deps [--check]"),
}
}
fn run_deps(check: bool) -> Result<()> {
let graph = build_graph(check)?;
let mut drift: Vec<String> = Vec::new();
let hakari_changed = hakari_ops::run(&graph, check, &mut drift)?;
// The hakari step may have edited manifests (hack contents or member dep
// lines); recompute the graph so the closure map sees the result. The
// fresh `cargo metadata` also refreshes Cargo.lock after those edits.
let graph: PackageGraph = if hakari_changed {
build_graph(false)?
} else {
graph
};
closures::run(&graph, check, &mut drift)?;
if !drift.is_empty() {
bail!(
"generated dependency artifacts are stale:\n - {}\nrun `just hakari` (or `cargo x deps`) from the repository root and commit the result",
drift.join("\n - ")
);
}
Ok(())
}