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
Seanaye/feat/lazy xtask (#4551)
Sean Ayedb4d9613a821
diff --git a/.github/workflows/assign-author.yml b/.github/workflows/assign-author.ymlindex 3889abbf52..93b318578f 100644--- a/.github/workflows/assign-author.yml+++ b/.github/workflows/assign-author.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/assign_author.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/assign_author.rsname: Pull Request'on':pull_request:diff --git a/.github/workflows/assign-labels.yml b/.github/workflows/assign-labels.ymlindex 8832b712b2..b449b9a380 100644--- a/.github/workflows/assign-labels.yml+++ b/.github/workflows/assign-labels.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/assign_labels.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/assign_labels.rsname: Auto Label PRs'on':pull_request:diff --git a/.github/workflows/build_appimage_on_tag.yml b/.github/workflows/build_appimage_on_tag.ymlindex a2d2ca78ef..514f4ff1e8 100644--- a/.github/workflows/build_appimage_on_tag.yml+++ b/.github/workflows/build_appimage_on_tag.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/build_appimage_on_tag.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/build_appimage_on_tag.rsname: Build AppImage'on':workflow_call:diff --git a/.github/workflows/build_desktop_on_tag.yml b/.github/workflows/build_desktop_on_tag.ymlindex 2086dcaa67..e40e676c04 100644--- a/.github/workflows/build_desktop_on_tag.yml+++ b/.github/workflows/build_desktop_on_tag.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/build_desktop_on_tag.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/build_desktop_on_tag.rsname: Build Desktop on Tag'on':push:diff --git a/.github/workflows/build_dmg_on_tag.yml b/.github/workflows/build_dmg_on_tag.ymlindex 988e5b4c75..bc39b181de 100644--- a/.github/workflows/build_dmg_on_tag.yml+++ b/.github/workflows/build_dmg_on_tag.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/build_dmg_on_tag.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/build_dmg_on_tag.rsname: Build macOS DMG'on':workflow_call:diff --git a/.github/workflows/cancel_stuck_cloud_storage_deploys.yml b/.github/workflows/cancel_stuck_cloud_storage_deploys.ymlindex c3bbb52b6b..a21e2bc9ba 100644--- a/.github/workflows/cancel_stuck_cloud_storage_deploys.yml+++ b/.github/workflows/cancel_stuck_cloud_storage_deploys.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/cancel_stuck_cloud_storage_deploys.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/cancel_stuck_cloud_storage_deploys.rsname: Cancel Stuck Cloud Storage Deployson:schedule:diff --git a/.github/workflows/cargo_deny.yml b/.github/workflows/cargo_deny.ymlindex a9e4edc4bc..20a91eaa19 100644--- a/.github/workflows/cargo_deny.yml+++ b/.github/workflows/cargo_deny.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/cargo_deny.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/cargo_deny.rsname: cargo deny check'on':pull_request:diff --git a/.github/workflows/cargo_workspace_dependency_check.yml b/.github/workflows/cargo_workspace_dependency_check.ymlindex 339d274950..299621f2e4 100644--- a/.github/workflows/cargo_workspace_dependency_check.yml+++ b/.github/workflows/cargo_workspace_dependency_check.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/cargo_workspace_dependency_check.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/cargo_workspace_dependency_check.rsname: cargo workspace dependency check'on':pull_request:diff --git a/.github/workflows/check_generated.yml b/.github/workflows/check_generated.ymlindex 8752a2a538..33564d175d 100644--- a/.github/workflows/check_generated.yml+++ b/.github/workflows/check_generated.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/check_generated.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/check_generated.rsname: check generated workflows'on':pull_request:diff --git a/.github/workflows/check_node_modules_nix.yml b/.github/workflows/check_node_modules_nix.ymlindex f785dfd024..91c2bdf6de 100644--- a/.github/workflows/check_node_modules_nix.yml+++ b/.github/workflows/check_node_modules_nix.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/check_node_modules_nix.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/check_node_modules_nix.rsname: check node_modules nix'on':pull_request:diff --git a/.github/workflows/cleanup_preview.yml b/.github/workflows/cleanup_preview.ymlindex dadb322bf0..69ca2628bb 100644--- a/.github/workflows/cleanup_preview.yml+++ b/.github/workflows/cleanup_preview.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/cleanup_preview.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/cleanup_preview.rsname: Cleanup Previewenv:PREVIEW_BUCKET: macro-preview-assets-devdiff --git a/.github/workflows/code_check_cloud_storage.yml b/.github/workflows/code_check_cloud_storage.ymlindex 3b9bbeeb26..7714355b1f 100644--- a/.github/workflows/code_check_cloud_storage.yml+++ b/.github/workflows/code_check_cloud_storage.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/code_check_cloud_storage.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/code_check_cloud_storage.rsname: cloud storage code checkenv:CARGO_INCREMENTAL: '0'diff --git a/.github/workflows/code_check_infra.yml b/.github/workflows/code_check_infra.ymlindex 83ca5794e1..c560952455 100644--- a/.github/workflows/code_check_infra.yml+++ b/.github/workflows/code_check_infra.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/code_check_infra.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/code_check_infra.rsname: infra code check'on':pull_request:diff --git a/.github/workflows/deploy_preview.yml b/.github/workflows/deploy_preview.ymlindex fd92d80f4e..93878fa18b 100644--- a/.github/workflows/deploy_preview.yml+++ b/.github/workflows/deploy_preview.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/deploy_preview.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/deploy_preview.rsname: Deploy Previewenv:PREVIEW_BUCKET: macro-preview-assets-devdiff --git a/.github/workflows/deploy_web_app.yml b/.github/workflows/deploy_web_app.ymlindex 81a799ff2b..78b5631875 100644--- a/.github/workflows/deploy_web_app.yml+++ b/.github/workflows/deploy_web_app.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/deploy_web_app.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/deploy_web_app.rsname: Deploy Web Appon:workflow_call:diff --git a/.github/workflows/deploy_web_app_dev_push.yml b/.github/workflows/deploy_web_app_dev_push.ymlindex 9100ef1491..75c9f36c92 100644--- a/.github/workflows/deploy_web_app_dev_push.yml+++ b/.github/workflows/deploy_web_app_dev_push.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/deploy_web_app_dev_push.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/deploy_web_app_dev_push.rsname: Deploy web app dev on push to mainon:push:diff --git a/.github/workflows/pulumi_preview_pr.yml b/.github/workflows/pulumi_preview_pr.ymlindex f85c344eae..7065896a1c 100644--- a/.github/workflows/pulumi_preview_pr.yml+++ b/.github/workflows/pulumi_preview_pr.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/pulumi_preview_pr.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/pulumi_preview_pr.rsname: Pulumi Preview on PRon:pull_request:diff --git a/.github/workflows/reusable_preview_service.yml b/.github/workflows/reusable_preview_service.ymlindex f58d7a47e7..c69376ca3c 100644--- a/.github/workflows/reusable_preview_service.yml+++ b/.github/workflows/reusable_preview_service.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/reusable_preview_service.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/reusable_preview_service.rsname: Reusable Preview Serviceon:workflow_call:diff --git a/.github/workflows/web-app-check-main.yml b/.github/workflows/web-app-check-main.ymlindex fdb6663bef..f939cfc0e2 100644--- a/.github/workflows/web-app-check-main.yml+++ b/.github/workflows/web-app-check-main.yml@@ -1,5 +1,5 @@# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).-# Source: rust/cloud-storage/tools/xtask/src/workflows/web_app_check_main.rs+# Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rsname: Web App Pr Checks'on':pull_request:diff --git a/.github/workspace-dep-closures.json b/.github/workspace-dep-closures.jsonindex 08c8ca860c..7440e15c91 100644--- a/.github/workspace-dep-closures.json+++ b/.github/workspace-dep-closures.json@@ -4741,13 +4741,57 @@"workspace-hack"],"xtask": [+ "tools/xtask"+ ],+ "xtask_cache_wasm": [+ "tools/xtask/crates/xtask_cache_wasm",+ "tools/xtask/crates/xtask_paths"+ ],+ "xtask_deps": [+ "tools/xtask/crates/xtask_deps",+ "tools/xtask/crates/xtask_graph",+ "tools/xtask/crates/xtask_paths"+ ],+ "xtask_doppler_bins": [+ "tools/xtask/crates/xtask_doppler_bins",+ "tools/xtask/crates/xtask_graph",+ "tools/xtask/crates/xtask_paths"+ ],+ "xtask_graph": [+ "tools/xtask/crates/xtask_graph",+ "tools/xtask/crates/xtask_paths"+ ],+ "xtask_graphql_soup_schema": [+ "tools/xtask/crates/xtask_graphql_soup_schema",+ "tools/xtask/crates/xtask_paths"+ ],+ "xtask_kafka_topics": [+ "macro_event_topics",+ "tools/xtask/crates/xtask_kafka_topics",+ "tools/xtask/crates/xtask_paths",+ "workspace-hack"+ ],+ "xtask_local": ["macro_aws_config","macro_env","macro_env_var","macro_event_topics","macro_queues",- "tools/xtask",+ "tools/xtask/crates/xtask_local",+ "tools/xtask/crates/xtask_paths","workspace-hack"+ ],+ "xtask_nextest_filter": [+ "tools/xtask/crates/xtask_graph",+ "tools/xtask/crates/xtask_nextest_filter",+ "tools/xtask/crates/xtask_paths"+ ],+ "xtask_paths": [+ "tools/xtask/crates/xtask_paths"+ ],+ "xtask_workflows": [+ "tools/xtask/crates/xtask_paths",+ "tools/xtask/crates/xtask_workflows"]}}diff --git a/js/app/justfile b/js/app/justfileindex a944515264..99231c8121 100644--- a/js/app/justfile+++ b/js/app/justfile@@ -162,6 +162,6 @@ build-cache-wasm:# Dev fast path: build the wasm pkg only when missing or its version drifts# from client/cache-wasm/Cargo.toml (bump that version to push a rebuild to-# dev machines). See rust/cloud-storage/tools/xtask/src/cache_wasm.rs.+# dev machines). See rust/cloud-storage/tools/xtask/crates/xtask_cache_wasm/src/main.rs.ensure-cache-wasm:cd {{justfile_directory()}}/../../rust/cloud-storage && SQLX_OFFLINE=true cargo run -q -p xtask -- cache-wasmdiff --git a/just/xtask.just b/just/xtask.justindex 312def0e10..5836655e46 100644--- a/just/xtask.just+++ b/just/xtask.just@@ -1,7 +1,9 @@-# xtask owns all local/dev orchestration; these recipes are thin delegates.-# `local-stack` (off by default so bare CI builds of xtask skip librdkafka)-# enables the Kafka topic provisioning that run-local needs.-xtask := "cargo run --quiet --manifest-path rust/cloud-storage/Cargo.toml -p xtask --features local-stack --"+# The xtask_local crate owns all local/dev orchestration; these recipes are+# thin delegates. They target xtask_local directly (rather than the `cargo x`+# launcher) so the `local-stack` feature — off by default so bare CI builds+# skip librdkafka — can be enabled to turn on the Kafka topic provisioning that+# run-local needs.+xtask := "cargo run --quiet --manifest-path rust/cloud-storage/Cargo.toml -p xtask_local --features local-stack --"# Start a fully local stack (xtask: zigbuild + runtime image + infra + proxy + frontend).# just run_local # default instancediff --git a/rust/cloud-storage/.cargo/config.toml b/rust/cloud-storage/.cargo/config.tomlindex 6aefdbcfd3..2b80efdc32 100644--- a/rust/cloud-storage/.cargo/config.toml+++ b/rust/cloud-storage/.cargo/config.toml@@ -1,11 +1,18 @@# Cargo aliases for the cloud-storage workspace.#-# `cargo x <subcommand>` runs the xtask repo-automation tool from anywhere inside-# rust/cloud-storage:+# `cargo x <subcommand>` runs xtask from anywhere inside rust/cloud-storage:# cargo x workflows [--check] # regenerate / verify .github/workflows# cargo x deps [--check] # regenerate / verify workspace-hack + dep closures# cargo x nextest-filter <file> # nextest rdeps filter for changed files# cargo x doppler-bins <file> # Doppler config-validation bins affected by changed files# cargo x graphql-soup-schema <file> # export GraphQL Soup SDL to a file+# cargo x cache-wasm [--force] # build the browser cache wasm package+# cargo x kafka-topics [--check] # regenerate / verify kafka-cluster-topics.json+# (anything else) # local/dev orchestration (xtask_local)+#+# `xtask` is a dependency-free launcher: it maps the subcommand to its own+# command crate under tools/xtask/crates/ and re-invokes `cargo run -p+# xtask_<command>`, so each command compiles only its own dependency set+# (e.g. `cargo x cache-wasm` never builds guppy/hakari/aws-sdk/tokio).[alias]x = "run -p xtask --"diff --git a/rust/cloud-storage/.config/hakari.toml b/rust/cloud-storage/.config/hakari.tomlindex bd1bd72c41..1d5a97442b 100644--- a/rust/cloud-storage/.config/hakari.toml+++ b/rust/cloud-storage/.config/hakari.toml@@ -42,6 +42,18 @@ platforms = [# features.workspace-members = ["xtask",+ # xtask command crates: dev-only automation split out of xtask so each+ # `cargo x <cmd>` compiles only its own dependency set.+ "xtask_paths",+ "xtask_graph",+ "xtask_deps",+ "xtask_nextest_filter",+ "xtask_doppler_bins",+ "xtask_graphql_soup_schema",+ "xtask_cache_wasm",+ "xtask_kafka_topics",+ "xtask_workflows",+ "xtask_local","macro_sync_service_jwt",# client/*: browser/Tauri cache crates (cache-core compiles to wasm32 via# cache-wasm; cache-sqlite ships in the Tauri app, not services). Theydiff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex 1600b2643c..b3d7bd7eb1 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -15510,6 +15510,66 @@ checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4"[[package]]name = "xtask"version = "0.1.0"++[[package]]+name = "xtask_cache_wasm"+version = "0.1.0"+dependencies = [+ "anyhow",+ "serde_json",+ "xtask_paths",+]++[[package]]+name = "xtask_deps"+version = "0.1.0"+dependencies = [+ "anyhow",+ "guppy",+ "hakari",+ "serde_json",+ "xtask_graph",+]++[[package]]+name = "xtask_doppler_bins"+version = "0.1.0"+dependencies = [+ "anyhow",+ "guppy",+ "xtask_graph",+]++[[package]]+name = "xtask_graph"+version = "0.1.0"+dependencies = [+ "anyhow",+ "guppy",+ "xtask_paths",+]++[[package]]+name = "xtask_graphql_soup_schema"+version = "0.1.0"+dependencies = [+ "anyhow",+ "xtask_paths",+]++[[package]]+name = "xtask_kafka_topics"+version = "0.1.0"+dependencies = [+ "anyhow",+ "macro_event_topics",+ "serde_json",+ "xtask_paths",+]++[[package]]+name = "xtask_local"+version = "0.1.0"dependencies = ["anyhow","aws-sdk-dynamodb",@@ -15520,12 +15580,8 @@ dependencies = ["console 0.15.11","docker-compose-types","dotenvy",- "gh-workflow",- "guppy",- "hakari","indexmap 2.14.0","indicatif",- "indoc","libc","macro_aws_config","macro_env_var",@@ -15537,6 +15593,32 @@ dependencies = ["serde_yaml","strum","tokio",+ "xtask_paths",+]++[[package]]+name = "xtask_nextest_filter"+version = "0.1.0"+dependencies = [+ "anyhow",+ "guppy",+ "xtask_graph",+]++[[package]]+name = "xtask_paths"+version = "0.1.0"++[[package]]+name = "xtask_workflows"+version = "0.1.0"+dependencies = [+ "anyhow",+ "gh-workflow",+ "indoc",+ "serde_json",+ "serde_yaml",+ "xtask_paths",][[package]]diff --git a/rust/cloud-storage/Cargo.toml b/rust/cloud-storage/Cargo.tomlindex daf941b52e..ae843d964b 100644--- a/rust/cloud-storage/Cargo.toml+++ b/rust/cloud-storage/Cargo.toml@@ -64,6 +64,7 @@ members = ["task_dedup","tools/native_app_server","tools/xtask",+ "tools/xtask/crates/*","unfurl","unfurl_service","upload_extractor_lambda_handler",@@ -116,6 +117,11 @@ dotenvy = "0.15.7"ego-tree = "0.6.2"either = "1"futures = "0.3.31"+# Pinned engine for the generated dependency artifacts (used by the xtask+# graph/deps commands). This version lives in Cargo.lock, so dev machines and+# CI always run the identical generator; guppy is pinned to the version the+# hakari release is built against.+guppy = "0.17.24"hex = "0.4.3"hmac = "0.12.1"http = "1"@@ -183,6 +189,7 @@ serde_json = { version = "1.0.132" }serde-wasm-bindgen = "0.6"serde_repr = "0.1"serde_with = { version = "3.12.0", features = ["base64"] }+serde_yaml = "0.9"sha2 = "0.10.8"sqlx = { version = "0.8.6", features = ["chrono",diff --git a/rust/cloud-storage/tools/xtask/Cargo.toml b/rust/cloud-storage/tools/xtask/Cargo.tomlindex 7e5abce912..8938dd08ce 100644--- a/rust/cloud-storage/tools/xtask/Cargo.toml+++ b/rust/cloud-storage/tools/xtask/Cargo.toml@@ -1,63 +1,12 @@[package]-description = "Repo automation: regenerates workspace-hack and the deploy dep-closure map"+description = "cargo x launcher: delegates each subcommand to its own xtask-<command> crate so only that command's deps compile"edition = "2024"name = "xtask"publish = falseversion = "0.1.0"+# Intentionally dependency-free: the launcher only maps a subcommand to its+# command crate and re-invokes `cargo run -p xtask_<command>`. Keeping it free+# of dependencies means `cargo x` never compiles guppy/hakari/aws-sdk/etc. just+# to dispatch. The command crates live under `crates/*`.[dependencies]-anyhow = { workspace = true }-serde_json = { workspace = true }-# Pinned engine for the generated dependency artifacts. These versions live in-# Cargo.lock, so dev machines and CI always run the identical generator —-# upgrading it is an explicit, reviewed lock change. guppy is pinned to the-# version this hakari release is built against.-guppy = "0.17.24"-hakari = { version = "0.17.9", features = ["cli-support"] }-# Define GitHub Actions workflows in Rust (`cargo run -p xtask -- workflows`).-# xtask is excluded from hakari traversal, so these stay out of workspace-hack.-gh-workflow = "0.8"-indoc = "2"-# Local/dev orchestration (`cargo x run-local` etc.). xtask is excluded from-# hakari traversal, so these deps never enter workspace-hack. We reuse the-# workspace-pinned versions so the orchestrator builds against the same crate-# graph as the services it launches.-aws-sdk-dynamodb = { workspace = true }-aws-sdk-s3 = { workspace = true }-aws-sdk-sqs = { workspace = true }-clap = { workspace = true }-macro_aws_config = { path = "../../macro_aws_config" }-macro_queues = { path = "../../macro_queues" }-serde = { workspace = true }-tokio = { workspace = true }-# Source of truth for `cargo x kafka-topics`, which generates-# .github/kafka-cluster-topics.json from the crate's declared topics, and for-# the local-stack topic provisioning (local::kafka).-macro_event_topics = { path = "../../macro_event_topics" }-# AdminClient for creating the declared topics on the local broker. Optional-# (behind `local-stack`): the workspace links librdkafka dynamically, and the-# CI jobs that build xtask on bare runners (path filters, generated-file-# checks) have no system librdkafka to link against.-rdkafka = { workspace = true, optional = true }-# Typed docker-compose model (build the override as structs, not strings) +-# Docker Engine API client for the discrete container/image ops.-bollard = "0.21"-console = "0.15"-docker-compose-types = { version = "0.24", features = ["indexmap"] }-indexmap = { workspace = true }-indicatif = "0.18"-serde_yaml = "0.9"-# Parse user-provided `--env-file` overlays (reading only; no crate emits the-# docker-compose `env_file` format we generate). EnumIter derives the port list.-dotenvy = { workspace = true }-strum = { workspace = true, features = ["derive"] }-# Signal the frontend dev server's whole process group on shutdown (kill bun +-# the Vite child it spawns, not just bun).-libc = "0.2"-macro_env_var = { path = "../../macro_env_var" }--[features]-# Local Kafka topic provisioning (`run-local` / `kafka-provision`). Off by-# default so plain `cargo run -p xtask` builds without a system librdkafka;-# the just recipes (just/xtask.just) enable it.-local-stack = ["dep:rdkafka"]diff --git a/rust/cloud-storage/tools/xtask/crates/xtask_cache_wasm/Cargo.toml b/rust/cloud-storage/tools/xtask/crates/xtask_cache_wasm/Cargo.tomlnew file mode 100644index 0000000000..0dbb20558d--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_cache_wasm/Cargo.toml@@ -0,0 +1,15 @@+[package]+description = "xtask cache-wasm: build the browser cache wasm package when missing or version-drifted"+edition = "2024"+name = "xtask_cache_wasm"+publish = false+version = "0.1.0"++[[bin]]+name = "xtask_cache_wasm"+path = "src/main.rs"++[dependencies]+anyhow = { workspace = true }+serde_json = { workspace = true }+xtask_paths = { path = "../xtask_paths" }diff --git a/rust/cloud-storage/tools/xtask/src/cache_wasm.rs b/rust/cloud-storage/tools/xtask/crates/xtask_cache_wasm/src/main.rssimilarity index 85%rename from rust/cloud-storage/tools/xtask/src/cache_wasm.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_cache_wasm/src/main.rsindex 01d71f518d..9a9bf3f83a 100644--- a/rust/cloud-storage/tools/xtask/src/cache_wasm.rs+++ b/rust/cloud-storage/tools/xtask/crates/xtask_cache_wasm/src/main.rs@@ -1,4 +1,4 @@-//! `cargo run -p xtask -- cache-wasm [--force]`+//! `cargo x cache-wasm [--force]`//!//! Ensures the browser cache wasm package (`client/cache-wasm`, built by//! wasm-pack into the gitignored `js/app/packages/graphql-cache/wasm/`) is@@ -13,27 +13,26 @@//! this check — they always rebuild (`just build-cache-wasm` → `--force`),//! so deploys never depend on version-bump discipline.-use std::{- path::{Path, PathBuf},- process::Command,-};+use std::{path::Path, process::Command};use anyhow::{Context, Result, bail};const CRATE_REL: &str = "client/cache-wasm";const PKG_REL: &str = "js/app/packages/graphql-cache/wasm";-pub(crate) fn run(force: bool) -> Result<()> {- let workspace_dir: PathBuf = Path::new(env!("CARGO_MANIFEST_DIR"))- .ancestors()- .nth(2)- .context("xtask manifest dir has no workspace root two levels up")?- .to_path_buf();- let repo_root = workspace_dir- .ancestors()- .nth(2)- .context("workspace root has no repo root two levels up")?- .to_path_buf();+fn main() -> Result<()> {+ let args: Vec<String> = std::env::args().skip(1).collect();+ let force = match args.iter().map(String::as_str).collect::<Vec<_>>()[..] {+ [] => false,+ ["--force"] => true,+ _ => bail!("usage: cargo x cache-wasm [--force]"),+ };+ run(force)+}++fn run(force: bool) -> Result<()> {+ let workspace_dir = xtask_paths::workspace_root();+ let repo_root = xtask_paths::repo_root();let crate_version = crate_version(&workspace_dir.join(CRATE_REL).join("Cargo.toml"))?;let pkg_dir = repo_root.join(PKG_REL);@@ -76,7 +75,7 @@ pub(crate) fn run(force: bool) -> Result<()> {/// Reads `version = "…"` from the crate's `[package]` section. A focused/// line scan (the first `version =` in the manifest precedes any other-/// section) keeps xtask free of a toml dependency.+/// section) keeps the task free of a toml dependency.fn crate_version(manifest: &Path) -> Result<String> {let text = std::fs::read_to_string(manifest).with_context(|| format!("reading {}", manifest.display()))?;diff --git a/rust/cloud-storage/tools/xtask/crates/xtask_deps/Cargo.toml b/rust/cloud-storage/tools/xtask/crates/xtask_deps/Cargo.tomlnew file mode 100644index 0000000000..6fa809d897--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_deps/Cargo.toml@@ -0,0 +1,20 @@+[package]+description = "xtask deps: regenerate/verify workspace-hack and the deploy dep-closure map"+edition = "2024"+name = "xtask_deps"+publish = false+version = "0.1.0"++[[bin]]+name = "xtask_deps"+path = "src/main.rs"++[dependencies]+anyhow = { workspace = true }+serde_json = { workspace = true }+guppy = { workspace = true }+# Pinned engine for the generated dependency artifacts. This version lives in+# Cargo.lock, so dev machines and CI always run the identical generator —+# upgrading it is an explicit, reviewed lock change.+hakari = { version = "0.17.9", features = ["cli-support"] }+xtask_graph = { path = "../xtask_graph" }diff --git a/rust/cloud-storage/tools/xtask/src/closures.rs b/rust/cloud-storage/tools/xtask/crates/xtask_deps/src/closures.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/closures.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_deps/src/closures.rsdiff --git a/rust/cloud-storage/tools/xtask/src/hakari_ops.rs b/rust/cloud-storage/tools/xtask/crates/xtask_deps/src/hakari_ops.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/hakari_ops.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_deps/src/hakari_ops.rsdiff --git a/rust/cloud-storage/tools/xtask/crates/xtask_deps/src/main.rs b/rust/cloud-storage/tools/xtask/crates/xtask_deps/src/main.rsnew file mode 100644index 0000000000..b1040441c8--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_deps/src/main.rs@@ -0,0 +1,55 @@+//! `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 rust/cloud-storage and commit the result",+ drift.join("\n - ")+ );+ }+ Ok(())+}diff --git a/rust/cloud-storage/tools/xtask/crates/xtask_doppler_bins/Cargo.toml b/rust/cloud-storage/tools/xtask/crates/xtask_doppler_bins/Cargo.tomlnew file mode 100644index 0000000000..aa8b57bdc2--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_doppler_bins/Cargo.toml@@ -0,0 +1,15 @@+[package]+description = "xtask doppler-bins: doppler config-validation bins affected by a set of changed files"+edition = "2024"+name = "xtask_doppler_bins"+publish = false+version = "0.1.0"++[[bin]]+name = "xtask_doppler_bins"+path = "src/main.rs"++[dependencies]+anyhow = { workspace = true }+guppy = { workspace = true }+xtask_graph = { path = "../xtask_graph" }diff --git a/rust/cloud-storage/tools/xtask/src/doppler_bins.rs b/rust/cloud-storage/tools/xtask/crates/xtask_doppler_bins/src/main.rssimilarity index 80%rename from rust/cloud-storage/tools/xtask/src/doppler_bins.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_doppler_bins/src/main.rsindex f4125df269..64276d7830 100644--- a/rust/cloud-storage/tools/xtask/src/doppler_bins.rs+++ b/rust/cloud-storage/tools/xtask/crates/xtask_doppler_bins/src/main.rs@@ -1,3 +1,5 @@+//! `cargo x doppler-bins <changed-files-path>`+//!//! Computes which "doppler config" validation binaries are affected by a set of//! changed files, for cloud-storage CI.//!@@ -11,20 +13,31 @@//!//! Input is a newline-delimited file of paths relative to the repository root//! (typically `git diff --name-only ...`). Output is the affected bin names, one-//! per line, sorted and deduplicated. This is the native replacement for the-//! previous bash + python script and reuses the same guppy package graph as-//! [`crate::nextest_filter`].+//! per line, sorted and deduplicated.use std::collections::BTreeSet;use std::path::{Path, PathBuf};-use anyhow::{Context, Result};+use anyhow::{Context, Result, bail};use guppy::graph::{BuildTargetId, PackageGraph};+use xtask_graph::build_graph;/// Source path (relative to a crate root) of a service's doppler-config binary.const DOPPLER_CONFIG_SRC: &str = "src/doppler_config.rs";-pub fn run(graph: &PackageGraph, changed_files_path: &Path) -> Result<()> {+fn main() -> Result<()> {+ let args: Vec<String> = std::env::args().skip(1).collect();+ match args.iter().map(String::as_str).collect::<Vec<_>>()[..] {+ [changed_files_path] => {+ // Read-only: `--locked` so computing the filter never rewrites Cargo.lock.+ let graph = build_graph(true)?;+ run(&graph, Path::new(changed_files_path))+ }+ _ => bail!("usage: cargo x doppler-bins <changed-files-path>"),+ }+}++fn run(graph: &PackageGraph, changed_files_path: &Path) -> Result<()> {let workspace = graph.workspace();let ws_root = workspace.root();let repo_root = ws_rootdiff --git a/rust/cloud-storage/tools/xtask/crates/xtask_graph/Cargo.toml b/rust/cloud-storage/tools/xtask/crates/xtask_graph/Cargo.tomlnew file mode 100644index 0000000000..30dec9f9d2--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_graph/Cargo.toml@@ -0,0 +1,11 @@+[package]+description = "Shared guppy PackageGraph builder for the graph-based xtask commands"+edition = "2024"+name = "xtask_graph"+publish = false+version = "0.1.0"++[dependencies]+anyhow = { workspace = true }+guppy = { workspace = true }+xtask_paths = { path = "../xtask_paths" }diff --git a/rust/cloud-storage/tools/xtask/crates/xtask_graph/src/lib.rs b/rust/cloud-storage/tools/xtask/crates/xtask_graph/src/lib.rsnew file mode 100644index 0000000000..b08e98af7a--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_graph/src/lib.rs@@ -0,0 +1,31 @@+#![deny(missing_docs)]+//! Shared guppy [`PackageGraph`] construction for the graph-based xtask+//! commands (`deps`, `nextest-filter`, `doppler-bins`).+//!+//! Anchors `cargo metadata` on the workspace root (from [`xtask_paths`]) so+//! the task works from anywhere in the repo.++use anyhow::{Context, Result};+use guppy::MetadataCommand;+use guppy::graph::PackageGraph;++/// Build the workspace [`PackageGraph`] via `cargo metadata`.+///+/// When `locked` is set, `--locked` is passed so a stale `Cargo.lock` surfaces+/// as an error (it is itself drift for the generator) instead of being+/// silently rewritten.+pub fn build_graph(locked: bool) -> Result<PackageGraph> {+ let workspace_dir = xtask_paths::workspace_root();+ let mut cmd = MetadataCommand::new();+ cmd.current_dir(&workspace_dir);+ if locked {+ cmd.other_options(vec!["--locked".to_owned()]);+ }+ cmd.build_graph().with_context(|| {+ if locked {+ "running cargo metadata --locked (a stale Cargo.lock is drift: run `just hakari` and commit)"+ } else {+ "running cargo metadata"+ }+ })+}diff --git a/rust/cloud-storage/tools/xtask/crates/xtask_graphql_soup_schema/Cargo.toml b/rust/cloud-storage/tools/xtask/crates/xtask_graphql_soup_schema/Cargo.tomlnew file mode 100644index 0000000000..4d4937e204--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_graphql_soup_schema/Cargo.toml@@ -0,0 +1,14 @@+[package]+description = "xtask graphql-soup-schema: export the GraphQL Soup SDL to a file"+edition = "2024"+name = "xtask_graphql_soup_schema"+publish = false+version = "0.1.0"++[[bin]]+name = "xtask_graphql_soup_schema"+path = "src/main.rs"++[dependencies]+anyhow = { workspace = true }+xtask_paths = { path = "../xtask_paths" }diff --git a/rust/cloud-storage/tools/xtask/crates/xtask_graphql_soup_schema/src/main.rs b/rust/cloud-storage/tools/xtask/crates/xtask_graphql_soup_schema/src/main.rsnew file mode 100644index 0000000000..c5da6ee939--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_graphql_soup_schema/src/main.rs@@ -0,0 +1,41 @@+//! `cargo x graphql-soup-schema <output-path>`+//!+//! Exports the GraphQL Soup SDL to a file by running the `graphql_soup`+//! crate's schema-export bin with `SQLX_OFFLINE` so it needs no database.++use std::{path::Path, process::Command};++use anyhow::{Context, Result, bail};++fn main() -> Result<()> {+ let args: Vec<String> = std::env::args().skip(1).collect();+ match args.iter().map(String::as_str).collect::<Vec<_>>()[..] {+ [output_path] => run(Path::new(output_path)),+ _ => bail!("usage: cargo x graphql-soup-schema <output-path>"),+ }+}++fn run(output_path: &Path) -> Result<()> {+ let workspace_dir = xtask_paths::workspace_root();++ let status = Command::new("cargo")+ .current_dir(&workspace_dir)+ .arg("run")+ .arg("--config")+ .arg("env.SQLX_OFFLINE=\"true\"")+ .arg("--quiet")+ .arg("-p")+ .arg("graphql_soup")+ .arg("--bin")+ .arg("graphql_soup_schema")+ .arg("--")+ .arg(output_path)+ .status()+ .with_context(|| format!("exporting GraphQL Soup schema to {}", output_path.display()))?;++ if !status.success() {+ bail!("GraphQL Soup schema export failed with status {status}");+ }++ Ok(())+}diff --git a/rust/cloud-storage/tools/xtask/crates/xtask_kafka_topics/Cargo.toml b/rust/cloud-storage/tools/xtask/crates/xtask_kafka_topics/Cargo.tomlnew file mode 100644index 0000000000..1dcde5045d--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_kafka_topics/Cargo.toml@@ -0,0 +1,17 @@+[package]+description = "xtask kafka-topics: generate/verify .github/kafka-cluster-topics.json from macro_event_topics"+edition = "2024"+name = "xtask_kafka_topics"+publish = false+version = "0.1.0"++[[bin]]+name = "xtask_kafka_topics"+path = "src/main.rs"++[dependencies]+anyhow = { workspace = true }+serde_json = { workspace = true }+# Source of truth for the declared topics.+macro_event_topics = { path = "../../../../macro_event_topics" }+xtask_paths = { path = "../xtask_paths" }diff --git a/rust/cloud-storage/tools/xtask/src/kafka_topics.rs b/rust/cloud-storage/tools/xtask/crates/xtask_kafka_topics/src/main.rssimilarity index 75%rename from rust/cloud-storage/tools/xtask/src/kafka_topics.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_kafka_topics/src/main.rsindex 0d50cd23c1..9b17fdb6ae 100644--- a/rust/cloud-storage/tools/xtask/src/kafka_topics.rs+++ b/rust/cloud-storage/tools/xtask/crates/xtask_kafka_topics/src/main.rs@@ -1,3 +1,5 @@+//! `cargo x kafka-topics [--check]`+//!//! Generates `.github/kafka-cluster-topics.json`: the name of every Kafka//! topic declared in the `macro_event_topics` crate, consumed by infra//! (alongside `services-config.json`) to ensure all cluster topics are@@ -5,22 +7,23 @@//! can guarantee the checked-in file always matches the crate.use std::collections::BTreeSet;-use std::path::Path;use anyhow::{Context, Result, bail};const OUTPUT_REL: &str = ".github/kafka-cluster-topics.json";+fn main() -> Result<()> {+ let args: Vec<String> = std::env::args().skip(1).collect();+ match args.iter().map(String::as_str).collect::<Vec<_>>()[..] {+ [] => run(false),+ ["--check"] => run(true),+ _ => bail!("usage: cargo x kafka-topics [--check]"),+ }+}+/// Regenerates (or, in check mode, diffs) the topics file.-pub fn run(check: bool) -> Result<()> {- // Anchor on the manifest dir, not the invocation cwd, so the task works- // from anywhere in the repo. The crate lives at- // `<repo-root>/rust/cloud-storage/tools/xtask`, i.e. four ancestors up.- let repo_root = Path::new(env!("CARGO_MANIFEST_DIR"))- .ancestors()- .nth(4)- .context("xtask manifest dir has no repo root four levels up")?;- let output_path = repo_root.join(OUTPUT_REL);+fn run(check: bool) -> Result<()> {+ let output_path = xtask_paths::repo_root().join(OUTPUT_REL);// Sorted for a deterministic file regardless of declaration order. A bare// array (no disclaimer wrapper) so infra can parse the file directly.diff --git a/rust/cloud-storage/tools/xtask/crates/xtask_local/Cargo.toml b/rust/cloud-storage/tools/xtask/crates/xtask_local/Cargo.tomlnew file mode 100644index 0000000000..afbc0b9337--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_local/Cargo.toml@@ -0,0 +1,53 @@+[package]+description = "xtask local: Macro local & dev stack orchestration (infra + binaries + proxy + frontend)"+edition = "2024"+name = "xtask_local"+publish = false+version = "0.1.0"++[[bin]]+name = "xtask_local"+path = "src/main.rs"++[dependencies]+anyhow = { workspace = true }+serde_json = { workspace = true }+# Local/dev orchestration. These deps reuse the workspace-pinned versions so+# the orchestrator builds against the same crate graph as the services it+# launches.+aws-sdk-dynamodb = { workspace = true }+aws-sdk-s3 = { workspace = true }+aws-sdk-sqs = { workspace = true }+clap = { workspace = true }+macro_aws_config = { path = "../../../../macro_aws_config" }+macro_queues = { path = "../../../../macro_queues" }+serde = { workspace = true }+tokio = { workspace = true }+# Source of truth for the declared Kafka topics (local-stack provisioning).+macro_event_topics = { path = "../../../../macro_event_topics" }+# AdminClient for creating the declared topics on the local broker. Optional+# (behind `local-stack`): the workspace links librdkafka dynamically, and the+# CI jobs that build this on bare runners have no system librdkafka to link+# against.+rdkafka = { workspace = true, optional = true }+# Typed docker-compose model (build the override as structs, not strings) ++# Docker Engine API client for the discrete container/image ops.+bollard = "0.21"+console = "0.15"+docker-compose-types = { version = "0.24", features = ["indexmap"] }+indexmap = { workspace = true }+indicatif = "0.18"+serde_yaml = { workspace = true }+# Parse user-provided `--env-file` overlays. EnumIter derives the port list.+dotenvy = { workspace = true }+strum = { workspace = true, features = ["derive"] }+# Signal the frontend dev server's whole process group on shutdown.+libc = "0.2"+macro_env_var = { path = "../../../../macro_env_var" }+xtask_paths = { path = "../xtask_paths" }++[features]+# Local Kafka topic provisioning (`run-local` / `kafka-provision`). Off by+# default so a plain build works without a system librdkafka; the just recipes+# enable it.+local-stack = ["dep:rdkafka"]diff --git a/rust/cloud-storage/tools/xtask/src/local/arch.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/arch.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/arch.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/arch.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/build/binaries_dir.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/build/binaries_dir.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/build/binaries_dir.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/build/binaries_dir.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/build/mod.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/build/mod.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/build/mod.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/build/mod.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/build/runtime_image.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/build/runtime_image.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/build/runtime_image.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/build/runtime_image.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/build/zigbuild.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/build/zigbuild.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/build/zigbuild.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/build/zigbuild.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/cli.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/cli.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/cli.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/cli.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/db.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/db.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/db.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/db.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/docker.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/docker.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/docker.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/docker.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/doctor.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/doctor.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/doctor.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/doctor.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/env_layer.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/env_layer.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/env_layer.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/env_layer.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/frontend.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/frontend.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/frontend.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/frontend.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/fusionauth.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/fusionauth.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/fusionauth.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/fusionauth.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/gen_compose.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/gen_compose.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/gen_compose.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/gen_compose.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/identity.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/identity.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/identity.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/identity.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/instance.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/instance.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/instance.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/instance.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/instance/test.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/instance/test.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/instance/test.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/instance/test.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/inventory.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/inventory.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/inventory.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/inventory.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/inventory/test.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/inventory/test.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/inventory/test.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/inventory/test.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/kafka.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/kafka.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/kafka.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/kafka.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/kickstart.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/kickstart.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/kickstart.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/kickstart.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/local_env.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/local_env.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/local_env.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/local_env.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/local_env/test.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/local_env/test.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/local_env/test.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/local_env/test.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/localstack.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/localstack.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/localstack.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/localstack.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/mailpit.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/mailpit.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/mailpit.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/mailpit.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/mod.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/mod.rssimilarity index 98%rename from rust/cloud-storage/tools/xtask/src/local/mod.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/mod.rsindex 870266c70a..4163833794 100644--- a/rust/cloud-storage/tools/xtask/src/local/mod.rs+++ b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/mod.rs@@ -11,7 +11,7 @@//! Design invariant: Docker never compiles Rust. Binaries are built on the host//! and bind-mounted read-only into the runtime image at `/app/out`.-use std::path::{Path, PathBuf};+use std::path::PathBuf;pub mod arch;pub mod build;@@ -132,25 +132,17 @@ impl Mode {}/// The cloud-storage cargo workspace root (`rust/cloud-storage`). Anchored on-/// the crate manifest dir rather than the invocation cwd so the orchestrator-/// works from anywhere, exactly like `main::build_graph`.+/// the manifest dir rather than the invocation cwd so the orchestrator works+/// from anywhere.pub fn workspace_root() -> PathBuf {- Path::new(env!("CARGO_MANIFEST_DIR"))- .ancestors()- .nth(2)- .expect("xtask manifest dir has no workspace root two levels up")- .to_owned()+ xtask_paths::workspace_root()}/// The repository root (two levels above the cloud-storage workspace:/// `<repo>/rust/cloud-storage`). This is where `docker-compose.yml`,/// `infra/`, `js/`, and the root `justfile` live.pub fn repo_root() -> PathBuf {- workspace_root()- .ancestors()- .nth(2)- .expect("cloud-storage workspace has no repo root two levels up")- .to_owned()+ xtask_paths::repo_root()}use std::process::Command;diff --git a/rust/cloud-storage/tools/xtask/src/local/opensearch.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/opensearch.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/opensearch.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/opensearch.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/proxy.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/proxy.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/proxy.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/proxy.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/proxy/test.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/proxy/test.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/proxy/test.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/proxy/test.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/resources.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/resources.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/resources.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/resources.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/resources/test.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/resources/test.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/resources/test.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/resources/test.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/stage.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/stage.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/stage.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/stage.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/summary.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/summary.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/summary.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/summary.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/test.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/test.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/test.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/test.rsdiff --git a/rust/cloud-storage/tools/xtask/src/local/validate.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/validate.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/local/validate.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/validate.rsdiff --git a/rust/cloud-storage/tools/xtask/crates/xtask_local/src/main.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/main.rsnew file mode 100644index 0000000000..e77248b44b--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/main.rs@@ -0,0 +1,21 @@+//! `cargo x <local-orchestration-command>`+//!+//! The local/dev orchestration surface (`run-local`, `run-dev`, `zigbuild`,+//! `doctor-local`, …). It has many subcommands each with several flags, so it+//! uses a real (clap) parser rather than fixed-arity slice patterns. The+//! launcher forwards any command it does not recognize as a repo-automation+//! verb here, so unknown input surfaces both this parser's help and the+//! repo-automation verbs (via [`LAUNCHER_USAGE`]).++mod local;++use anyhow::Result;++/// The repo-automation verbs handled by the launcher. Shown alongside this+/// crate's own clap usage when an unrecognized command reaches the parser.+const LAUNCHER_USAGE: &str = "repo automation (from rust/cloud-storage):\n cargo x deps [--check]\n cargo x nextest-filter <changed-files-path>\n cargo x doppler-bins <changed-files-path>\n cargo x graphql-soup-schema <output-path>\n cargo x cache-wasm [--force]\n cargo x kafka-topics [--check]\n cargo x workflows [--check]";++fn main() -> Result<()> {+ let args: Vec<String> = std::env::args().skip(1).collect();+ local::cli::dispatch(&args, LAUNCHER_USAGE)+}diff --git a/rust/cloud-storage/tools/xtask/crates/xtask_nextest_filter/Cargo.toml b/rust/cloud-storage/tools/xtask/crates/xtask_nextest_filter/Cargo.tomlnew file mode 100644index 0000000000..ffb8dc6460--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_nextest_filter/Cargo.toml@@ -0,0 +1,15 @@+[package]+description = "xtask nextest-filter: nextest rdeps package filter for a set of changed files"+edition = "2024"+name = "xtask_nextest_filter"+publish = false+version = "0.1.0"++[[bin]]+name = "xtask_nextest_filter"+path = "src/main.rs"++[dependencies]+anyhow = { workspace = true }+guppy = { workspace = true }+xtask_graph = { path = "../xtask_graph" }diff --git a/rust/cloud-storage/tools/xtask/src/nextest_filter.rs b/rust/cloud-storage/tools/xtask/crates/xtask_nextest_filter/src/main.rssimilarity index 78%rename from rust/cloud-storage/tools/xtask/src/nextest_filter.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_nextest_filter/src/main.rsindex e2c8054231..5dc578c7b0 100644--- a/rust/cloud-storage/tools/xtask/src/nextest_filter.rs+++ b/rust/cloud-storage/tools/xtask/crates/xtask_nextest_filter/src/main.rs@@ -1,3 +1,5 @@+//! `cargo x nextest-filter <changed-files-path>`+//!//! Computes the cargo-nextest package filter for cloud-storage CI.//!//! Input is a newline-delimited file of paths relative to the repository root@@ -9,10 +11,23 @@use std::collections::BTreeSet;use std::path::{Path, PathBuf};-use anyhow::{Context, Result};+use anyhow::{Context, 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<_>>()[..] {+ [changed_files_path] => {+ // Read-only: `--locked` so computing the filter never rewrites Cargo.lock.+ let graph = build_graph(true)?;+ run(&graph, Path::new(changed_files_path))+ }+ _ => bail!("usage: cargo x nextest-filter <changed-files-path>"),+ }+}-pub fn run(graph: &PackageGraph, changed_files_path: &Path) -> Result<()> {+fn run(graph: &PackageGraph, changed_files_path: &Path) -> Result<()> {let workspace = graph.workspace();let ws_root = workspace.root();let repo_root = ws_rootdiff --git a/rust/cloud-storage/tools/xtask/crates/xtask_paths/Cargo.toml b/rust/cloud-storage/tools/xtask/crates/xtask_paths/Cargo.tomlnew file mode 100644index 0000000000..35771cbdf7--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_paths/Cargo.toml@@ -0,0 +1,8 @@+[package]+description = "Shared path discovery for the xtask command crates (workspace + repo roots)"+edition = "2024"+name = "xtask_paths"+publish = false+version = "0.1.0"++[dependencies]diff --git a/rust/cloud-storage/tools/xtask/crates/xtask_paths/src/lib.rs b/rust/cloud-storage/tools/xtask/crates/xtask_paths/src/lib.rsnew file mode 100644index 0000000000..3940d39b08--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_paths/src/lib.rs@@ -0,0 +1,39 @@+#![deny(missing_docs)]+//! Shared path discovery for the xtask command crates.+//!+//! Every xtask command needs to locate the cloud-storage workspace root (to+//! anchor `cargo metadata`, read member manifests, spawn `wasm-pack`, …) and+//! the repository root above it (where `docker-compose.yml`, `infra/`, `js/`,+//! and the root `justfile` live). Both are derived from this crate's own+//! manifest dir rather than the invocation cwd, so the commands work from+//! anywhere in the repo.+//!+//! Centralizing the ancestor walk here means the hardcoded depth lives in one+//! place: this crate sits at `<workspace>/tools/xtask/crates/xtask_paths`, so+//! the workspace root is four levels up regardless of which command crate+//! calls in.++use std::path::{Path, PathBuf};++/// The cloud-storage cargo workspace root (`rust/cloud-storage`).+///+/// `env!("CARGO_MANIFEST_DIR")` expands to this crate's directory, which is a+/// fixed location, so the depth here does not depend on the caller.+pub fn workspace_root() -> PathBuf {+ // <workspace>/tools/xtask/crates/xtask_paths -> nth(4) == <workspace>.+ Path::new(env!("CARGO_MANIFEST_DIR"))+ .ancestors()+ .nth(4)+ .expect("xtask_paths manifest dir has no workspace root four levels up")+ .to_owned()+}++/// The repository root (two levels above the cloud-storage workspace:+/// `<repo>/rust/cloud-storage`).+pub fn repo_root() -> PathBuf {+ workspace_root()+ .ancestors()+ .nth(2)+ .expect("cloud-storage workspace has no repo root two levels up")+ .to_owned()+}diff --git a/rust/cloud-storage/tools/xtask/crates/xtask_workflows/Cargo.toml b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/Cargo.tomlnew file mode 100644index 0000000000..51e13889cf--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/Cargo.toml@@ -0,0 +1,19 @@+[package]+description = "xtask workflows: generate/verify the repo's GitHub Actions workflows from Rust"+edition = "2024"+name = "xtask_workflows"+publish = false+version = "0.1.0"++[[bin]]+name = "xtask_workflows"+path = "src/main.rs"++[dependencies]+anyhow = { workspace = true }+serde_json = { workspace = true }+# Define GitHub Actions workflows in Rust.+gh-workflow = "0.8"+indoc = "2"+serde_yaml = { workspace = true }+xtask_paths = { path = "../xtask_paths" }diff --git a/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/main.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/main.rsnew file mode 100644index 0000000000..ff65082517--- /dev/null+++ b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/main.rs@@ -0,0 +1,19 @@+//! `cargo x workflows [--check]`+//!+//! Generates the repo's GitHub Actions workflows from Rust (see the+//! [`workflows`] module). The `--check` variant regenerates them in memory and+//! fails if the committed YAML has drifted, so CI can guarantee the checked-in+//! YAML always matches this source.++mod workflows;++use anyhow::{Result, bail};++fn main() -> Result<()> {+ let args: Vec<String> = std::env::args().skip(1).collect();+ match args.iter().map(String::as_str).collect::<Vec<_>>()[..] {+ [] => workflows::generate(),+ ["--check"] => workflows::check(),+ _ => bail!("usage: cargo x workflows [--check]"),+ }+}diff --git a/rust/cloud-storage/tools/xtask/src/workflows/assign_author.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/assign_author.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/assign_author.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/assign_author.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/assign_labels.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/assign_labels.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/assign_labels.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/assign_labels.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/build_appimage_on_tag.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/build_appimage_on_tag.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/build_appimage_on_tag.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/build_appimage_on_tag.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/build_desktop_on_tag.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/build_desktop_on_tag.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/build_desktop_on_tag.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/build_desktop_on_tag.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/build_dmg_on_tag.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/build_dmg_on_tag.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/build_dmg_on_tag.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/build_dmg_on_tag.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/cancel_stuck_cloud_storage_deploys.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/cancel_stuck_cloud_storage_deploys.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/cancel_stuck_cloud_storage_deploys.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/cancel_stuck_cloud_storage_deploys.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/cargo_deny.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/cargo_deny.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/cargo_deny.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/cargo_deny.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/cargo_workspace_dependency_check.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/cargo_workspace_dependency_check.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/cargo_workspace_dependency_check.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/cargo_workspace_dependency_check.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/check_generated.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/check_generated.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/check_generated.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/check_generated.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/check_node_modules_nix.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/check_node_modules_nix.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/check_node_modules_nix.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/check_node_modules_nix.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/cleanup_preview.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/cleanup_preview.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/cleanup_preview.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/cleanup_preview.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/code_check_cloud_storage.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/code_check_cloud_storage.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/code_check_cloud_storage.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/code_check_cloud_storage.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/code_check_infra.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/code_check_infra.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/code_check_infra.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/code_check_infra.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/deploy_preview.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/deploy_preview.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/deploy_preview.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/deploy_preview.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/deploy_web_app.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/deploy_web_app.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/deploy_web_app.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/deploy_web_app.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/deploy_web_app_dev_push.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/deploy_web_app_dev_push.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/deploy_web_app_dev_push.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/deploy_web_app_dev_push.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/mod.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/mod.rssimilarity index 93%rename from rust/cloud-storage/tools/xtask/src/workflows/mod.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/mod.rsindex ad5adf2261..551ded7fce 100644--- a/rust/cloud-storage/tools/xtask/src/workflows/mod.rs+++ b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/mod.rs@@ -1,6 +1,6 @@//! Generate the repo's GitHub Actions workflows from Rust.//!-//! `cargo run -p xtask -- workflows` writes every entry in [`WORKFLOWS`] to+//! `cargo x workflows` writes every entry in [`WORKFLOWS`] to//! `<repo-root>/.github/workflows/<filename>`. The `--check` variant regenerates//! them in memory and fails if the committed YAML has drifted, so CI can//! guarantee the checked-in YAML always matches this source.@@ -33,7 +33,7 @@ mod vars;mod web_app_check_main;use std::fs;-use std::path::{Path, PathBuf};+use std::path::PathBuf;use anyhow::{Context, Result, bail};use gh_workflow::Workflow;@@ -250,19 +250,14 @@ fn render(workflow: &WorkflowFile) -> Result<String> {fn disclaimer(source: &str) -> String {format!("# DO NOT EDIT — regenerate with `cargo x workflows` (from rust/cloud-storage).\n\- # Source: rust/cloud-storage/tools/xtask/src/workflows/{source}.rs\n",+ # Source: rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/{source}.rs\n",)}-/// `<repo-root>/.github/workflows`, anchored on the crate's manifest dir so the-/// task works from any cwd. This crate lives at-/// `<repo-root>/rust/cloud-storage/tools/xtask`, i.e. four ancestors up.+/// `<repo-root>/.github/workflows`. Anchored on the repo root (from+/// [`xtask_paths`]) so the task works from any cwd.fn workflows_dir() -> Result<PathBuf> {- let repo_root = Path::new(env!("CARGO_MANIFEST_DIR"))- .ancestors()- .nth(4)- .context("xtask manifest dir has no repo root four levels up")?;- let dir = repo_root.join(".github").join("workflows");+ let dir = xtask_paths::repo_root().join(".github").join("workflows");if !dir.is_dir() {bail!("expected a workflows directory at {}", dir.display());}diff --git a/rust/cloud-storage/tools/xtask/src/workflows/pulumi_preview_pr.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/pulumi_preview_pr.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/pulumi_preview_pr.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/pulumi_preview_pr.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/reusable_preview_service.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/reusable_preview_service.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/reusable_preview_service.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/reusable_preview_service.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/runners.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/runners.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/runners.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/runners.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/build_appimage.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/build_appimage.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/build_appimage.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/build_appimage.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/build_dmg.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/build_dmg.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/build_dmg.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/build_dmg.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/collect_appimage.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/collect_appimage.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/collect_appimage.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/collect_appimage.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/collect_dmg.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/collect_dmg.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/collect_dmg.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/collect_dmg.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/compute_changed_files.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/compute_changed_files.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/compute_changed_files.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/compute_changed_files.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/compute_doppler_bins.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/compute_doppler_bins.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/compute_doppler_bins.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/compute_doppler_bins.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/compute_nextest_filter.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/compute_nextest_filter.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/compute_nextest_filter.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/compute_nextest_filter.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/configure_postgres.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/configure_postgres.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/configure_postgres.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/configure_postgres.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/configure_signing_identity.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/configure_signing_identity.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/configure_signing_identity.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/configure_signing_identity.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/install_nix_macos.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/install_nix_macos.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/install_nix_macos.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/install_nix_macos.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/resolve_desktop_ref.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/resolve_desktop_ref.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/resolve_desktop_ref.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/resolve_desktop_ref.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/run_tests.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/run_tests.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/run_tests.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/run_tests.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/validate_doppler_configs.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/validate_doppler_configs.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/validate_doppler_configs.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/validate_doppler_configs.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/scripts/validate_signed_dmg.sh b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/validate_signed_dmg.shsimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/scripts/validate_signed_dmg.shrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/scripts/validate_signed_dmg.shdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/steps.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/steps.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/steps.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/steps.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/vars.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/vars.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/vars.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/vars.rsdiff --git a/rust/cloud-storage/tools/xtask/src/workflows/web_app_check_main.rs b/rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rssimilarity index 100%rename from rust/cloud-storage/tools/xtask/src/workflows/web_app_check_main.rsrename to rust/cloud-storage/tools/xtask/crates/xtask_workflows/src/workflows/web_app_check_main.rsdiff --git a/rust/cloud-storage/tools/xtask/src/graphql_soup_schema.rs b/rust/cloud-storage/tools/xtask/src/graphql_soup_schema.rsdeleted file mode 100644index 7fc11adce6..0000000000--- a/rust/cloud-storage/tools/xtask/src/graphql_soup_schema.rs+++ /dev/null@@ -1,31 +0,0 @@-use std::{path::Path, process::Command};--use anyhow::{Context, Result, bail};--pub(crate) fn run(output_path: &Path) -> Result<()> {- let workspace_dir = Path::new(env!("CARGO_MANIFEST_DIR"))- .ancestors()- .nth(2)- .context("xtask manifest dir has no workspace root two levels up")?;-- let status = Command::new("cargo")- .current_dir(workspace_dir)- .arg("run")- .arg("--config")- .arg("env.SQLX_OFFLINE=\"true\"")- .arg("--quiet")- .arg("-p")- .arg("graphql_soup")- .arg("--bin")- .arg("graphql_soup_schema")- .arg("--")- .arg(output_path)- .status()- .with_context(|| format!("exporting GraphQL Soup schema to {}", output_path.display()))?;-- if !status.success() {- bail!("GraphQL Soup schema export failed with status {status}");- }-- Ok(())-}diff --git a/rust/cloud-storage/tools/xtask/src/main.rs b/rust/cloud-storage/tools/xtask/src/main.rsindex e895c2035a..80109dbac0 100644--- a/rust/cloud-storage/tools/xtask/src/main.rs+++ b/rust/cloud-storage/tools/xtask/src/main.rs@@ -1,114 +1,82 @@-//! Repo automation tasks (the cargo-xtask pattern).+//! `cargo x <command>` launcher.//!-//! `cargo run -p xtask -- deps [--check]` regenerates (or, with `--check`,-//! verifies) the two generated dependency artifacts:+//! Each xtask command lives in its own crate under `tools/xtask/crates/` so+//! that `cargo x <command>` compiles only that command's dependency set — e.g.+//! `cargo x cache-wasm` (needs only anyhow) does not drag in guppy/hakari,+//! aws-sdk, tokio, or bollard.//!-//! - `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.+//! The cargo alias (`x = "run -p xtask --"`) is static, so it always builds one+//! fixed package: this launcher. The launcher itself has no dependencies (it+//! compiles in a blink and stays warm), maps the subcommand to its command+//! crate, and re-invokes `cargo run -p xtask_<command>`. Only that crate then+//! compiles.//!-//! 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 cache_wasm;-mod closures;-mod doppler_bins;-mod graphql_soup_schema;-mod hakari_ops;-mod kafka_topics;-mod local;-mod nextest_filter;-mod workflows;+//! The nested `cargo run` is pinned to the workspace via `--manifest-path`+//! (derived from this crate's own location at compile time) rather than by+//! changing the working directory. That makes it work no matter where the+//! launcher was invoked from — including outside the workspace, as CI does via+//! `cargo run --manifest-path .../tools/xtask/Cargo.toml -- <command>` — while+//! leaving the command's own working directory unchanged, so relative path+//! arguments still resolve against the caller's cwd.+//!+//! Repo-automation verbs each map to a dedicated crate; everything else is the+//! local/dev orchestration surface, forwarded wholesale to `xtask_local`'s clap+//! parser (which also prints the combined usage on unrecognized input).-use std::path::Path;+use std::process::{Command, exit};-use anyhow::{Context, Result, bail};-use guppy::MetadataCommand;-use guppy::graph::PackageGraph;+/// The workspace root manifest, resolved from this launcher crate's location+/// (`<workspace>/tools/xtask`) at compile time so the nested `cargo run`+/// resolves the workspace from any cwd.+const WORKSPACE_MANIFEST: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../../Cargo.toml");-fn main() -> Result<()> {+fn main() {let args: Vec<String> = std::env::args().skip(1).collect();- match args.iter().map(String::as_str).collect::<Vec<_>>()[..] {- ["deps"] => run_deps(false),- ["deps", "--check"] => run_deps(true),- ["nextest-filter", changed_files_path] => {- let graph = build_graph(false)?;- nextest_filter::run(&graph, Path::new(changed_files_path))- }- ["doppler-bins", changed_files_path] => {- let graph = build_graph(false)?;- doppler_bins::run(&graph, Path::new(changed_files_path))- }- ["graphql-soup-schema", output_path] => graphql_soup_schema::run(Path::new(output_path)),- ["cache-wasm"] => cache_wasm::run(false),- ["cache-wasm", "--force"] => cache_wasm::run(true),- ["kafka-topics"] => kafka_topics::run(false),- ["kafka-topics", "--check"] => kafka_topics::run(true),- ["workflows"] => workflows::generate(),- ["workflows", "--check"] => workflows::check(),- // Everything else is the local/dev orchestration surface. It has many- // subcommands each with several flags, so it uses a real (clap) parser- // rather than fixed-arity slice patterns. Unknown input falls through- // to a combined usage message inside `local::cli::dispatch`.- _ => local::cli::dispatch(&args, LEGACY_USAGE),- }-}--/// Usage for the repo-automation verbs handled by the slice match above. The-/// local orchestration parser appends its own usage and prints both on an-/// unrecognized command.-const LEGACY_USAGE: &str = "repo automation (from rust/cloud-storage):\n cargo x deps [--check]\n cargo x nextest-filter <changed-files-path>\n cargo x doppler-bins <changed-files-path>\n cargo x graphql-soup-schema <output-path>\n cargo x cache-wasm [--force]\n cargo x kafka-topics [--check]\n cargo x workflows [--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)?;+ let package = match args.first().map(String::as_str) {+ Some("deps") => "xtask_deps",+ Some("nextest-filter") => "xtask_nextest_filter",+ Some("doppler-bins") => "xtask_doppler_bins",+ Some("graphql-soup-schema") => "xtask_graphql_soup_schema",+ Some("cache-wasm") => "xtask_cache_wasm",+ Some("kafka-topics") => "xtask_kafka_topics",+ Some("workflows") => "xtask_workflows",+ // Everything else (including no args) is the local/dev orchestration+ // surface. Forward every arg — the subcommand is its clap parser's+ // first positional.+ _ => "xtask_local",+ };- // 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 = if hakari_changed {- build_graph(false)?+ // Known verbs forward the args after the verb; the local fallthrough keeps+ // the subcommand as its first argument.+ let forwarded: &[String] = if package == "xtask_local" {+ &args} else {- graph+ &args[1..]};- closures::run(&graph, check, &mut drift)?;- if !drift.is_empty() {- bail!(- "generated dependency artifacts are stale:\n - {}\nrun `just hakari` (or `cargo run -p xtask -- deps`) from rust/cloud-storage and commit the result",- drift.join("\n - ")- );- }- Ok(())-}+ // Cargo sets $CARGO to its own path when it runs the alias; fall back to+ // the plain name otherwise.+ #[allow(+ clippy::disallowed_methods,+ reason = "This is not application runtime code"+ )]+ let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".to_string());+ let status = Command::new(cargo)+ .arg("run")+ .arg("--manifest-path")+ .arg(WORKSPACE_MANIFEST)+ .arg("-p")+ .arg(package)+ .arg("--")+ .args(forwarded)+ .status();-fn build_graph(locked: bool) -> Result<PackageGraph> {- // Anchor on the manifest dir, not the invocation cwd, so the task works- // from anywhere in the repo. The crate lives at <workspace>/tools/xtask.- let workspace_dir = Path::new(env!("CARGO_MANIFEST_DIR"))- .ancestors()- .nth(2)- .context("xtask manifest dir has no workspace root two levels up")?- .to_owned();- let mut cmd = MetadataCommand::new();- cmd.current_dir(&workspace_dir);- if locked {- // In check mode a stale lockfile is itself drift; surface it instead- // of silently rewriting it.- cmd.other_options(vec!["--locked".to_owned()]);- }- cmd.build_graph().with_context(|| {- if locked {- "running cargo metadata --locked (a stale Cargo.lock is drift: run `just hakari` and commit)"- } else {- "running cargo metadata"+ match status {+ Ok(status) => exit(status.code().unwrap_or(1)),+ Err(e) => {+ eprintln!("xtask: failed to launch `cargo run -p {package}`: {e}");+ exit(1);}- })+ }}