CLI Automation API Reference
The ProjectDoctor.Cli assembly exposes the headless execution engine used to integrate ImportShield into CI/CD build agents and command-line automation tools.
The CommandLineRunner Class
The primary entry point is ProjectDoctor.Cli.CommandLineRunner.Run().
Method Signature
namespace ProjectDoctor.Cli
{
public static class CommandLineRunner
{
public static void Run();
public static int ExecuteWithArgs(string[] args);
}
}
When invoked via Unity’s -executeMethod ProjectDoctor.Cli.CommandLineRunner.Run, the runner:
- Automatically retrieves command-line arguments passed to the Unity process via
System.Environment.GetCommandLineArgs(). - Parses
-pdFailOn,-pdBaseline,-pdReport, and-pdLogVerboseflags. - Initializes the
ProjectScannerand performs an incremental index. - Compares the current reference graph against the selected baseline.
- Evaluates configured metric assertions.
- Writes test artifact reports if requested.
- Calls
EditorApplication.Exit(exitCode)with code0,1, or2.
Programmatic Invocation Example
If you are developing custom editor automation or your own build script (BuildPlayer pipeline), you can call the execution engine directly:
using ProjectDoctor.Cli;
public static class CustomBuildPipeline
{
public static void PreBuildVerification()
{
string[] args = new[]
{
"-pdFailOn", "new-broken-refs:0",
"-pdBaseline", "latest",
"-pdReport", "json"
};
int exitCode = CommandLineRunner.ExecuteWithArgs(args);
if (exitCode != 0)
{
throw new System.Exception($"ImportShield pre-build gate failed with exit code: {exitCode}");
}
UnityEngine.Debug.Log("ImportShield verification passed. Proceeding with player build.");
}
}
“No tool can truthfully guarantee ‘zero risk’ or ‘zero data loss’; ImportShield fails closed and tells you the truth instead of pretending otherwise.”