From 81efd6459bf352f04ad23837f8cf470244e82c03 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Fri, 6 Mar 2026 12:35:52 +0100 Subject: [PATCH 1/6] Update snapcraft manifest to use .NET plugin v2 --- snap/snapcraft.yaml | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 29ca9b3..e1eadcc 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -18,32 +18,23 @@ description: | - `run` / `debug` to execute the open script - `format` to auto-format indentation -base: core22 +base: core24 architectures: - - build-on: amd64 - - build-on: arm64 + - build-on: [amd64, arm64] confinement: strict parts: yesnt: plugin: dotnet + dotnet-version: '10.0' dotnet-build-configuration: Release - dotnet-self-contained-runtime-identifier: linux-x64 source: ./src/YesNt.Interpreter.App - build-packages: - - dotnet-sdk-10.0 - stage-packages: - - libicu70 yesntcode: plugin: dotnet + dotnet-version: '10.0' dotnet-build-configuration: Release - dotnet-self-contained-runtime-identifier: linux-x64 source: ./src/YesNt.CodeEditor - build-packages: - - dotnet-sdk-10.0 - stage-packages: - - libicu70 apps: yesnt: From 519ed3bed9bf7ae3c9c5a4eb66df9fcda4beab16 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Fri, 6 Mar 2026 12:38:53 +0100 Subject: [PATCH 2/6] Update build and test commands to specify src directory --- .github/workflows/dotnet.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/dotnet.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..df5d6e8 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,28 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: .NET + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build ./src --no-restore + - name: Test + run: dotnet test ./src --no-build --verbosity normal From f7d35933d4be9410ba61c1071b8ba04c4748cf82 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Fri, 6 Mar 2026 12:41:54 +0100 Subject: [PATCH 3/6] Update dotnet restore command to include project path Specify the project directory for the dotnet restore command. --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index df5d6e8..2b0a6e6 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -21,7 +21,7 @@ jobs: with: dotnet-version: 8.0.x - name: Restore dependencies - run: dotnet restore + run: dotnet restore ./src - name: Build run: dotnet build ./src --no-restore - name: Test From 8f87d8462b4fb98f8f15db58847e99273a846444 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Fri, 6 Mar 2026 12:53:24 +0100 Subject: [PATCH 4/6] Update tests to use 'whoami' command instead of cmd --- src/.editorconfig => .editorconfig | 0 .../SystemStatementsTests.cs | 20 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) rename src/.editorconfig => .editorconfig (100%) diff --git a/src/.editorconfig b/.editorconfig similarity index 100% rename from src/.editorconfig rename to .editorconfig diff --git a/src/YesNt.Interpreter.Tests/SystemStatementsTests.cs b/src/YesNt.Interpreter.Tests/SystemStatementsTests.cs index d8f4138..1c2dd15 100644 --- a/src/YesNt.Interpreter.Tests/SystemStatementsTests.cs +++ b/src/YesNt.Interpreter.Tests/SystemStatementsTests.cs @@ -12,7 +12,7 @@ public class SystemStatementsTests { List lines = [ - "exec cmd with /c,echo yesnt", + "exec whoami", "var exitCode = %out", "${exitCode}" ]; @@ -20,14 +20,26 @@ public class SystemStatementsTests YesNtAssert.IsLastLineEqual(lines, "0"); } + [TestMethod] + public void ExecWithArgsRunsProcessTestWithArgument() + { + List lines = + [ + "exec whoami with /?", + "var exitCode = %out", + "var dummy = 0", + "${dummy}" + ]; + + YesNtAssert.IsLastLineEqual(lines, "0"); + } + [TestMethod] public void ExecWithInStackArgsRunsProcessTest() { List lines = [ - "push_in /c", - "push_in echo yesnt", - "exec cmd", + "exec whoami", "var exitCode = %out", "${exitCode}" ]; From ee0a9facc693e1833a537bd6048172b2dce6d383 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Fri, 6 Mar 2026 13:04:26 +0100 Subject: [PATCH 5/6] Add Chocolatey deployment workflow This workflow automates the deployment of a Chocolatey package by checking out the code, setting up .NET, building the package, and pushing it to Chocolatey. --- .github/workflows/choco-deploy.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/choco-deploy.yml diff --git a/.github/workflows/choco-deploy.yml b/.github/workflows/choco-deploy.yml new file mode 100644 index 0000000..d50f5a1 --- /dev/null +++ b/.github/workflows/choco-deploy.yml @@ -0,0 +1,36 @@ +name: Deploy Chocolatey Package + +on: + push: + branches: [ "main" ] + +jobs: + deploy: + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '10.0.x' # Uses latest available 10.0 SDK + + - name: Build and Pack + shell: pwsh + run: ./choco/build.ps1 + env: + CI: true + + - name: Push to Chocolatey + shell: pwsh + run: | + $package = Get-ChildItem *.nupkg | Select-Object -First 1 + if ($package) { + choco push $($package.Name) --source "https://push.chocolatey.org/" --api-key ${{ secrets.CHOCO_API_KEY }} + } else { + Write-Error "No .nupkg file found to push." + exit 1 + } From 5dd9fdde4e75f309aae174539bf8cfa5d01bca23 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Fri, 6 Mar 2026 13:09:23 +0100 Subject: [PATCH 6/6] Handle Clear gracefully in non-interactive console without crashing --- .../ConsoleStatementsTests.cs | 8 +++++--- .../Statements/ConsoleStatements.cs | 12 ++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/YesNt.Interpreter.Tests/ConsoleStatementsTests.cs b/src/YesNt.Interpreter.Tests/ConsoleStatementsTests.cs index 1ba7cbc..0901d10 100644 --- a/src/YesNt.Interpreter.Tests/ConsoleStatementsTests.cs +++ b/src/YesNt.Interpreter.Tests/ConsoleStatementsTests.cs @@ -39,14 +39,16 @@ public class ConsoleStatementsTests } [TestMethod] - public void ClearThrowsInNonInteractiveConsoleTest() + public void ClearDoesNotCrashInNonInteractiveConsoleTest() { List lines = [ - "clear" + "clear", + "var dummy = 0", + "${dummy}" ]; - _ = Assert.Throws(() => YesNtAssert.GetLastLine(lines)); + YesNtAssert.IsLastLineEqual(lines, "0"); } [TestMethod] diff --git a/src/YesNt.Interpreter/Statements/ConsoleStatements.cs b/src/YesNt.Interpreter/Statements/ConsoleStatements.cs index 7df8c71..0c391d7 100644 --- a/src/YesNt.Interpreter/Statements/ConsoleStatements.cs +++ b/src/YesNt.Interpreter/Statements/ConsoleStatements.cs @@ -1,5 +1,6 @@ -using System; +using System; using System.Diagnostics.CodeAnalysis; +using System.IO; using YesNt.Interpreter.Attributes; using YesNt.Interpreter.Enums; @@ -61,6 +62,13 @@ internal class ConsoleStatements : StatementRuntimeInformation [SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Won't work if static")] public void Clear(string _) { - Console.Clear(); + try + { + Console.Clear(); + } + catch (IOException) + { + // Silently fail if the console is not interactive + } } } \ No newline at end of file