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
+27
View File
@@ -0,0 +1,27 @@
[package]
name = "asmtype"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
readme.workspace = true
publish.workspace = true
description = "List managed assembly types with AI-friendly output."
keywords.workspace = true
categories.workspace = true
[lints]
workspace = true
[dependencies]
common = { path = "../common", default-features = false }
managed = { path = "../managed" }
lexopt.workspace = true
regex-lite.workspace = true
serde.workspace = true
serde_json.workspace = true
[dev-dependencies]
assert_cmd.workspace = true
predicates.workspace = true
File diff suppressed because it is too large Load Diff
+5
View File
@@ -0,0 +1,5 @@
//! Binary entry point for `asmtype`.
fn main() {
std::process::exit(asmtype::main_entry());
}
+137
View File
@@ -0,0 +1,137 @@
//! Integration tests for the `asmtype` command.
use assert_cmd::Command;
use predicates::prelude::*;
use serde_json::Value;
use std::path::PathBuf;
fn cargo_command() -> Command {
Command::cargo_bin("asmtype").expect("binary")
}
fn workspace_root() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("..")
.join("..")
.canonicalize()
.expect("workspace root")
}
fn managed_fixture_dir() -> PathBuf {
workspace_root()
.join("fixtures")
.join("managed")
.join("bin")
}
fn fixture_assembly() -> PathBuf {
managed_fixture_dir().join("GameAssembly.dll")
}
#[test]
fn help_includes_examples_and_pipeline_usage() {
let mut command = cargo_command();
command
.arg("--help")
.assert()
.success()
.stdout(
predicate::str::contains(
"asmtype .\\fixtures\\managed\\GameAssembly\\GameAssembly.csproj",
)
.not(),
)
.stdout(predicate::str::contains("asmtype .\\target\\"))
.stdout(predicate::str::contains("ConvertFrom-Json"))
.stdout(predicate::str::contains("--match"))
.stdout(predicate::str::contains("--user-code-only"));
}
#[test]
fn filters_types_as_json() {
let mut command = cargo_command();
let output = command
.arg(fixture_assembly())
.arg("--match")
.arg("SpaceCraft|Spacecraft")
.arg("--json")
.assert()
.success()
.get_output()
.stdout
.clone();
let payload = serde_json::from_slice::<Value>(&output).expect("json payload");
let entries = payload.as_array().expect("array payload");
assert!(entries.len() >= 4, "expected at least 4 matching types");
assert!(
entries
.iter()
.any(|entry| entry["full_name"]
== "Game.UI.Windows.Windows.SpaceCraftConstructionWindow")
);
assert!(
entries.iter().any(|entry| entry["kind"] == "struct"
&& entry["full_name"] == "Data.SpacecraftConstructData")
);
}
#[test]
fn json_no_match_is_successful_empty_array_for_pipelines() {
let mut command = cargo_command();
command
.arg(fixture_assembly())
.arg("--match")
.arg("^DefinitelyMissingType$")
.arg("--json")
.assert()
.success()
.stdout(predicate::eq("[]\n"));
}
#[test]
fn supports_powershell_pipeline_input() {
let binary = assert_cmd::cargo::cargo_bin("asmtype");
let input = fixture_assembly();
let script = format!(
"'{}' | & '{}' --input-format lines --match SpaceCraft --json",
input.display(),
binary.display()
);
let mut command = Command::new("pwsh");
command
.arg("-NoProfile")
.arg("-Command")
.arg(script)
.assert()
.success()
.stdout(predicate::str::contains(
"\"full_name\":\"Game.UI.Windows.Windows.SpaceCraftConstructionWindow\"",
));
}
#[test]
fn show_matched_members_hides_backing_fields_when_user_facing_hits_exist() {
let mut command = cargo_command();
let output = command
.arg(fixture_assembly())
.arg("--with-member-match")
.arg("StartProject|QueueVehicle|k__BackingField")
.arg("--show-matched-members")
.arg("--json")
.assert()
.success()
.get_output()
.stdout
.clone();
let payload = serde_json::from_slice::<Value>(&output).expect("json payload");
let entries = payload.as_array().expect("array payload");
let construction = entries
.iter()
.find(|entry| entry["full_name"] == "Game.UI.Windows.Windows.SpaceCraftConstructionWindow")
.expect("construction row");
assert_eq!(
construction["matched_members"],
Value::Array(vec![Value::String("StartProject".to_string())])
);
}