chore(release): prepare public source release

This commit is contained in:
MercuryToolbox Release
2026-07-18 15:41:59 +08:00
commit e365e5df4d
508 changed files with 163373 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
[package]
name = "unityprobe"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
readme.workspace = true
publish.workspace = true
description = "Read-only runtime inspection for BepInEx Mono Unity games."
keywords.workspace = true
categories.workspace = true
[lints]
workspace = true
[dependencies]
common = { path = "../common", default-features = false }
lexopt.workspace = true
serde.workspace = true
serde_json.workspace = true
unitysupport = { path = "../unitysupport" }
[dev-dependencies]
assert_cmd.workspace = true
predicates.workspace = true
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
//! Public entry point for the `unityprobe` command crate.
#![allow(clippy::multiple_crate_versions)]
mod cli;
pub use cli::main_entry;
+6
View File
@@ -0,0 +1,6 @@
//! Binary entry point for `unityprobe`.
#![allow(clippy::multiple_crate_versions)]
fn main() {
std::process::exit(unityprobe::main_entry());
}
+107
View File
@@ -0,0 +1,107 @@
//! Integration tests for the `unityprobe` command.
use std::fs;
use std::path::PathBuf;
use std::time::{SystemTime, UNIX_EPOCH};
use assert_cmd::Command;
use predicates::prelude::*;
use serde_json::Value;
fn cargo_command() -> Command {
Command::cargo_bin("unityprobe").expect("binary")
}
#[test]
fn no_args_prints_quick_help_card() {
let mut command = cargo_command();
command
.assert()
.code(2)
.stdout(predicate::str::is_empty())
.stderr(predicate::str::contains(
"error: unityprobe requires a subcommand",
))
.stderr(predicate::str::contains("unityprobe - Mercury Toolbox"))
.stderr(predicate::str::contains("Usage:"))
.stderr(predicate::str::contains(
"unityprobe [OPTIONS] <SUBCOMMAND> [ARGS...]",
))
.stderr(predicate::str::contains("install <PATH>"))
.stderr(predicate::str::contains(
"Type 'unityprobe --help' for the full command reference.",
));
}
fn unique_temp_dir(prefix: &str) -> PathBuf {
let suffix = SystemTime::now()
.duration_since(UNIX_EPOCH)
.expect("epoch")
.as_nanos();
let path = std::env::temp_dir().join(format!("{prefix}-{suffix}"));
fs::create_dir_all(&path).expect("temp dir");
path
}
#[test]
fn help_calls_out_windows_only_bridge_workflow() {
let mut command = cargo_command();
command
.arg("--help")
.assert()
.success()
.stdout(predicate::str::contains("Windows only"))
.stdout(predicate::str::contains("named pipe JSON"))
.stdout(predicate::str::contains("BepInEx\\plugins"))
.stdout(predicate::str::contains("unityprobe status --game-root"))
.stdout(predicate::str::contains("unityprobe --json find"))
.stdout(predicate::str::contains("unityprobe inspect -- -938"));
}
#[cfg(windows)]
#[test]
fn status_reports_uninstalled_game_root_install_state_as_json() {
let game_root = unique_temp_dir("unityprobe-status");
let mut command = cargo_command();
let output = command
.arg("--json")
.arg("status")
.arg("--game-root")
.arg(&game_root)
.assert()
.success()
.stdout(predicate::str::contains("\"windows_supported\":true"))
.get_output()
.stdout
.clone();
let report: Value = serde_json::from_slice(&output).expect("status json");
assert_eq!(
report.get("game_root").and_then(Value::as_str),
Some(game_root.to_string_lossy().as_ref())
);
assert_eq!(
report.get("installed").and_then(Value::as_bool),
Some(false)
);
assert!(
report
.get("pipe_reachable")
.and_then(Value::as_bool)
.is_some()
);
assert!(report.get("runtime_status").is_some());
}
#[cfg(windows)]
#[test]
fn install_requires_explicit_bepinex_and_managed_layout() {
let game_root = unique_temp_dir("unityprobe-install");
let mut command = cargo_command();
command
.arg("install")
.arg(&game_root)
.assert()
.code(3)
.stderr(predicate::str::contains("BepInEx"))
.stderr(predicate::str::contains("Managed"));
}