Skip to content

v0.6.0-beta3: CallerFilePath Script Execution

Pre-release
Pre-release

Choose a tag to compare

@StevenTCramer StevenTCramer released this 10 Jul 17:53
· 813 commits to master since this release

πŸš€ Beta Release: CallerFilePath Script Execution Pattern

This beta release introduces a major improvement to script execution reliability.

✨ What's New

  • CallerFilePath Pattern: All scripts now use [CallerFilePath] to determine their location
  • Push/Pop Directory Management: Scripts work reliably from any execution location
  • Local Feed Cleanup: Pack script now ensures only one version exists in local feed at a time
  • Prerelease Support: Test scripts use @*-* pattern to support beta versions

πŸ”§ Technical Details

Scripts now use this pattern:

public static async Task<int> Main(string[] args, [CallerFilePath] string scriptPath = "")
{
  string originalDirectory = Environment.CurrentDirectory;
  string scriptDirectory = Path.GetDirectoryName(scriptPath)\!;
  
  try
  {
    Environment.CurrentDirectory = scriptDirectory;
    // Use relative paths from script location
    return 0;
  }
  finally
  {
    Environment.CurrentDirectory = originalDirectory;
  }
}

This is the C# equivalent of PowerShell's $PSScriptRoot and ensures scripts work correctly regardless of where they're executed from.

⚠️ Known Issues

  • CI/CD tests are temporarily disabled due to .NET 10 preview script execution issues
  • Tests run successfully locally

πŸ“¦ Installation

dotnet tool install -g TimeWarp.Cli --version 0.6.0-beta3

Or in scripts:

#:package TimeWarp.Cli@*-*