Skip to content

fix: not executing on Windows#12

Merged
Tygo-van-den-Hurk merged 7 commits intomainfrom
fix/windows-exec
Feb 16, 2026
Merged

fix: not executing on Windows#12
Tygo-van-den-Hurk merged 7 commits intomainfrom
fix/windows-exec

Conversation

@Tygo-van-den-Hurk
Copy link
Copy Markdown
Owner

@Tygo-van-den-Hurk Tygo-van-den-Hurk commented Jan 17, 2026

Fixes #11: CLI not executing on windows

This has something to do with the guard at the bottom that sees if it is being sourced or executed, but it has flaws. This patch should fix that by moving everything into another file. Now the main CLI file only has the call to execute, no guard checks, no nothing. So don't import it.

Checklist

  • Made sure my pull request fits CONTRIBUTING.md.
  • Marked commits with ! if they were breaking changes.
  • Updated the docs/ when needed.
  • Added tests to test/ for all new code.
  • This pull request does not fix a security issue. (See SECURITY.md)

Meta data

Built on platform (select all applicable):

  • Linux (x86_64)
  • Linux (aarch64)
  • Macos (x86_64)
  • Macos (aarch64)
  • Windows (x86_64)
  • Windows (aarch64)
  • other: ...

Add a 👍 reaction to pull requests you find important.

@Tygo-van-den-Hurk Tygo-van-den-Hurk self-assigned this Jan 17, 2026
@github-actions github-actions bot added the fix A fix or report for something that isn't working label Jan 17, 2026
@Tygo-van-den-Hurk Tygo-van-den-Hurk added this to the v1.0.0 milestone Jan 17, 2026
@Tygo-van-den-Hurk Tygo-van-den-Hurk force-pushed the main branch 5 times, most recently from 9ab7b86 to 8ddac06 Compare February 4, 2026 16:46
This is probably still not ideal, but at least its broken up into smaller
files.
Fixed it by moving the base command into its own file and moving everything out
of the CLI file so that now there is only the execution call in there.

fixes #11: CLI not executing on windows
The previous version searched for it in main cli file which now just executes
the program.
@github-actions github-actions bot added refactor Code change that neither fixes a bug nor adds a feature test Adding or updating tests style Code style or formatting changes labels Feb 16, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the CLI code structure to fix Windows execution issues. The main problem was a guard check in src/cli.ts that compared import.meta.url with process.argv[1], which failed on Windows due to path format differences (backslashes vs forward slashes, drive letter format). The solution moves all CLI logic into separate command files and makes src/cli.ts a pure entry point that only imports and executes, removing the problematic guard entirely.

Changes:

  • Removed Windows-incompatible execution guard from src/cli.ts and simplified it to a pure entry point
  • Refactored CLI code into modular command structure with separate files for compile, serve, and enumerate commands
  • Extracted shared utilities, middleware functions, and constants into separate files

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/cli.ts Simplified to only import and execute CLI, removing the Windows-incompatible guard check
src/commands/base.ts New file containing the main CLI argument parser and command setup
src/commands/compile.ts Extracted compile command with flags and callback
src/commands/serve.ts Extracted serve command with flags and callback
src/commands/enumerate.ts Extracted enumerate command with flags and callback
src/utils.ts Extracted utility functions (getStringOrLast, wrapZodForCleanerError, onFail)
src/middleware.ts Extracted middleware functions for logging, color, and plugin loading
src/const.ts Extracted package constants and epilogue text
lib/core/compiler/index.ts Removed output field from CompileArgs interface (now handled by CLI layer)
test/src/commands/base.test.ts Updated import path from #src/cli to #src/commands/base

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

CI pipeline was failing, and copilot made some suggestions on my grammar, and
variable naming which were fair points.
The program was allowed to continue executing even after a write error, which
means that the program could exit with a 0 exit code, even though it did not
finish execution as expected.
The compile subcommand would log the input file as the problem when an error
happend instead of the output file. Which is wrong. This commit fixes that.
This was obviously because of a copy paste from the serve command that I forgot
to change aferwards.
@github-actions github-actions bot added the docs Documentation-only changes label Feb 16, 2026
@Tygo-van-den-Hurk Tygo-van-den-Hurk merged commit 3925916 into main Feb 16, 2026
11 checks passed
@Tygo-van-den-Hurk Tygo-van-den-Hurk deleted the fix/windows-exec branch February 16, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation-only changes fix A fix or report for something that isn't working refactor Code change that neither fixes a bug nor adds a feature style Code style or formatting changes test Adding or updating tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: CLI not executing on Windows

2 participants