Skip to content

ci: add Windows job to verify .cmd and HOME fallback fixes#17

Merged
jayzeng merged 6 commits into
mainfrom
ci/windows-job
May 22, 2026
Merged

ci: add Windows job to verify .cmd and HOME fallback fixes#17
jayzeng merged 6 commits into
mainfrom
ci/windows-job

Conversation

@jayzeng

@jayzeng jayzeng commented May 22, 2026

Copy link
Copy Markdown
Owner

Matrix-ize lint/build across ubuntu+windows, add a unit job that runs the bun:test suite on both OSes (previously not in CI at all), and add a focused windows-qmd-smoke job that:

  • demonstrates Node's stock execFile cannot launch qmd.cmd on Windows (continue-on-error, informational only)
  • asserts setupQmdCollection() succeeds through the wrapped execFile
  • asserts resolveMemoryDir() falls back to USERPROFILE when HOME is unset, with no literal '~' subdirectory in the resolved path

Gives us a runnable signal for PR #11 before merging it.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

jayzeng added 6 commits May 21, 2026 22:46
Matrix-ize lint/build across ubuntu+windows, add a unit job that runs
the bun:test suite on both OSes (previously not in CI at all), and add
a focused windows-qmd-smoke job that:

- demonstrates Node's stock execFile cannot launch qmd.cmd on Windows
  (continue-on-error, informational only)
- asserts setupQmdCollection() succeeds through the wrapped execFile
- asserts resolveMemoryDir() falls back to USERPROFILE when HOME is
  unset, with no literal '~' subdirectory in the resolved path

Gives us a runnable signal for PR #11 before merging it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Signed-off-by: Jay Zeng <jayzeng@users.noreply.github.com>
actions/checkout on windows-latest converts LF to CRLF, which trips
biome's formatter check on every TS file. Pin all text files to LF so
the lint job behaves identically across OSes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Signed-off-by: Jay Zeng <jayzeng@users.noreply.github.com>
Signed-off-by: Jay Zeng <jayzeng@users.noreply.github.com>
Signed-off-by: Jay Zeng <jayzeng@users.noreply.github.com>
npm install -g @tobilu/qmd on modern npm + Node 22 produces only qmd.ps1
(no qmd.cmd), and cmd.exe's default PATHEXT does not include .PS1. The
previous wrapper used `shell: true`, which spawns cmd.exe and therefore
could not resolve the .ps1 shim. Replace the options wrapper with
buildQmdSpawn, which on Windows transforms qmd calls into
`powershell.exe -NoProfile -NoLogo -Command "& qmd '<arg>' ...; exit
$LASTEXITCODE"`. PS resolves qmd against .cmd/.exe/.ps1, and single-
quoted PS literals neutralize $/backticks so paths with spaces or $ pass
through unchanged. PI_QMD_POWERSHELL env var allows forcing pwsh.

Also dump npm prefix shims + Get-Command -All in the windows-qmd-smoke
job for diagnostics, and verify qmd via the same path the wrapper uses.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Signed-off-by: Jay Zeng <jayzeng@users.noreply.github.com>
CI diagnostic revealed that npm install -g @tobilu/qmd produces all
three shims (qmd, qmd.cmd, qmd.ps1) but cmd-shim writes the literal
`/bin/sh` from the package's shebang into both qmd.cmd and qmd.ps1, so
both shims fail: cmd.exe with "system cannot find the path specified"
and PowerShell with "'/bin/sh.exe' is not recognized". This means
PowerShell wrapping (the previous fix) can't help — the .ps1 shim
itself is broken outside cygwin/git-bash trees.

Replace the PS wrapper with direct node invocation: on Windows, walk
PATH for a sibling node_modules/@tobilu/qmd/dist/cli/qmd.js (where
both npm and pnpm install) and spawn `node <qmd.js> <args>`. This
mirrors what bin/qmd itself does (`exec node "$JS" "$@"`) for
npm-installed packages, skipping the broken shims entirely. The
resolution is cached for the session; resetQmdJsResolution is exposed
for tests.

Add resolveQmdJsPath tests against a real temp tree, and update the
windows-qmd-smoke job to verify the direct-node path the wrapper now
uses (and keep the diagnostic dump of npm prefix + Get-Command -All).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Signed-off-by: Jay Zeng <jayzeng@users.noreply.github.com>
@jayzeng jayzeng merged commit c83f8c4 into main May 22, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant