Skip to main content

Module utils

Module utils 

Source
Expand description

utility functions for xbp cli

provides utility modules for common operations includes version api integration and other helper functions

Re-exports§

pub use cargo_manifest::resolve_cargo_package_version;
pub use cargo_manifest::resolve_cargo_package_version_required;
pub use cargo_manifest::write_cargo_package_version;
pub use env_files::canonicalize_env_value;
pub use env_files::escape_env_value_double_quoted;
pub use env_files::first_lookup_value;
pub use env_files::format_env_assignment;
pub use env_files::format_env_file_content;
pub use env_files::format_env_value_double_quoted;
pub use env_files::load_env_lookup;
pub use env_files::normalize_env_key;
pub use env_files::normalize_env_value;
pub use env_files::parse_env_content;
pub use env_files::parse_env_file;
pub use env_files::preferred_local_secret_env_path;
pub use env_files::resolve_env_placeholders;
pub use env_files::strip_utf8_bom;
pub use env_files::to_env_references;
pub use env_files::upsert_env_key;
pub use env_files::CLOUDFLARE_ACCOUNT_ID_ENV_KEYS;
pub use node_toolchain::find_node_toolchain_root;
pub use node_toolchain::is_node_toolchain_command;
pub use node_toolchain::node_toolchain_wrapper_path;
pub use process_monitor_json::fix_cursor_process_monitor_json;
pub use process_monitor_json::fix_cursor_process_monitor_json_file;
pub use process_monitor_json::CursorProcessMonitorJsonFix;
pub use pnpm_package_json::migrate_package_json_pnpm_settings;
pub use pnpm_package_json::PnpmSettingsMigration;
pub use project_paths::canonicalize_for_subprocess;
pub use project_paths::collapse_project_path;
pub use project_paths::resolve_project_dir;
pub use project_paths::resolve_project_path;
pub use project_paths::resolve_service_root;
pub use version::fetch_version;
pub use version::increment_version;
pub use xbp_ignore::default_global_worktree_ignore_content;
pub use xbp_ignore::default_xbp_ignore_path;
pub use xbp_ignore::load_global_worktree_ignore_from_path;
pub use xbp_ignore::load_project_xbp_ignore;
pub use xbp_ignore::sync_global_worktree_ignore_file;
pub use xbp_ignore::xbp_ignore_file_candidates;
pub use xbp_ignore::XbpIgnoreSet;
pub use xbp_ignore::DEFAULT_DISCOVERY_SKIP_DIRS;
pub use xbp_ignore::DEFAULT_GLOBAL_WORKTREE_IGNORE_PATTERNS;
pub use xbp_ignore::DEFAULT_NOISE_DIR_NAMES;
pub use xbp_ignore::GLOBAL_WORKTREE_IGNORE_FILENAME;

Modules§

cargo_manifest
Cargo manifest helpers for workspace-aware version read/write.
env_files
node_toolchain
pnpm_package_json
Migrate deprecated package.json#pnpm settings for pnpm v11+.
process_monitor_json
project_paths
tray_runtime
Platform event pumping and tray icon loading for native system tray UIs.
version
version api utilities
xbp_ignore
Project-local ignore rules for XBP discovery, versioning, and worktree-watch.

Structs§

FoundXbpConfig
KnownXbpProject
ListeningPortOwnership
XbpConfigHealResult

Constants§

DEFAULT_PROJECT_CONFIG_KIND
Default kind used when creating a brand-new project config.
DEFAULT_PROJECT_CONFIG_RELATIVE
Repo-relative default path for greenfield project config (shown in prompts/help).
PROJECT_CONFIG_FILENAMES
Supported project config basenames (under .xbp/ or project root). Order matches discovery preference (first existing wins).
PROJECT_CONFIG_HINT
Human-readable list of supported project config locations.
XBP_PROJECT_YAML_SCHEMA_DIRECTIVE
Comment directive understood by the YAML Language Server / VS Code YAML extension. Prefer xbp_project_schema_directive_for_path when writing a known config path so monorepo checkouts use the local schemas/xbp.project.schema.json.
XBP_PROJECT_YAML_SCHEMA_URL
Canonical published schema URL for project config IntelliSense (yaml-language-server).

Functions§

cargo_command_exists
cargo_program
collapse_home_to_env
collect_known_xbp_projects
collect_listening_port_ownership
command_exists
config_kind_from_path
default_project_config_path
Default config path under .xbp/ for the given format kind.
default_project_yaml_config_path
Preferred path for a new project config (.xbp/xbp.toml). Prefer resolve_project_config_write_path when a config already exists.
detect_xbp_config_heal_opportunities
ensure_xbp_yaml_schema_directive
Ensure the yaml-language-server $schema comment is present (published URL).
ensure_xbp_yaml_schema_directive_with
Ensure / rewrite the $schema directive to directive (replaces any existing header).
expand_home_in_string
find_existing_project_config
First existing project config under project_root (any supported format).
find_existing_yaml_xbp_config
@deprecated Prefer find_existing_project_config.
find_xbp_config_upwards
first_available_command
git_remote_url_from_metadata
heal_config_file
heal_project_xbp_config
is_xbp_project_config_filename
True when path is an XBP project config filename (any supported format).
load_xbp_project_config_value
Load + auto-heal project config from a discovered path.
maybe_auto_convert_legacy_xbp_json_to_yaml
Legacy helper: if only xbp.json exists and no other format is present, leave JSON as-is (do not force YAML). Returns the path that should be used for subsequent writes.
open_path_with_editor
open_with_default_handler
parse_config_with_auto_heal
parse_github_repo_from_remote_url
preferred_pip_command
preferred_python_command
project_config_candidates
All candidate project config paths for a root (.xbp/ then root, discovery order).
project_config_display_path
Repo-relative path of the project config for UI copy.
redact_remote_url_credentials
render_xbp_config_value
render_xbp_config_value_for_path
Like render_xbp_config_value, but attaches a path-aware YAML $schema directive.
resolve_project_config_write_path
Path to write project config updates:
resolve_xbp_project_for_path
serialize_xbp_config
Serialize value to the project config format for kind (yaml/json/jsonc/toml).
serialize_xbp_yaml
serialize_xbp_yaml_for_path
Serialize YAML and attach the best schema directive for config_path (local file when schemas/xbp.project.schema.json exists in the project, else the published URL).
strip_jsonc_comments_light
Remove JSONC comments and trailing commas without interpreting text inside JSON strings. This is shared by project-config parsing and Wrangler-aware commands so JSONC and JSON have identical data semantics.
write_json_config_from_any_xbp_config
write_xbp_project_config_at_path
Write project config to config_path using the format implied by its extension.
xbp_project_schema_directive_for_path
Build a # yaml-language-server: $schema=... line for a config file path.