Skip to content

[closed by author] accidental branch push — not a real change - #5362

Closed
Mustaqeem66 wants to merge 7 commits into
tinyhumansai:mainfrom
Mustaqeem66:tmp/crlf-write-probe
Closed

[closed by author] accidental branch push — not a real change#5362
Mustaqeem66 wants to merge 7 commits into
tinyhumansai:mainfrom
Mustaqeem66:tmp/crlf-write-probe

Conversation

@Mustaqeem66

@Mustaqeem66 Mustaqeem66 commented Aug 4, 2026

Copy link
Copy Markdown

Closing immediately — this was an accidental auto-opened PR from a scratch branch, not a proposed change. Sorry for the noise.

My real contribution is #5342. Nothing here should be reviewed.

pnpm runs package.json scripts through `cmd.exe /d /s /c`, which strips
the first and last quote characters from the command string. The
`dev:app:win` body quoted an absolute bash.exe path containing a space,
so cmd parsed `C:/Program` as the program name and the script failed on
every default Git for Windows install:

    'C:/Program' is not recognized as an internal or external command

Quoting works normally inside a .cmd file, so route the entry point
through a new scripts/run-dev-win.cmd. package.json now references a
relative, space-free path that needs no quoting, and the wrapper quotes
the bash.exe path itself. This mirrors the .bat shim run-dev-win.sh
already generates internally for cargo-tauri's beforeDevCommand.

The wrapper probes the standard Git for Windows locations plus the
parent of git.exe on PATH, and honours OPENHUMAN_BASH_EXE for portable
installs. It deliberately avoids a bare `bash` lookup, which resolves to
the WSL launcher in System32 when WSL is enabled.

Closes tinyhumansai#5270
An unescaped `)` inside `%ProgramFiles(x86)%` in the diagnostic echo would
have closed the enclosing `if (...)` block early, so the guidance never
printed correctly. Jump to a label instead, where parentheses are literal.

Refs tinyhumansai#5270
Collapse call expressions that fit within the repo's printWidth of 100 and
replace the multi-line concatenation with straight-line statements, so
`pnpm --filter openhuman-app format:check` is stable.

Refs tinyhumansai#5270
The repository normalises everything to LF via `* text=auto eol=lf`, and
`*.ps1` is the only Windows exception. cmd.exe's parser is line-ending
sensitive -- LF-only batch files can mis-parse `goto`/`call :label` because
of the 512-byte read-boundary bug -- so batch scripts need the same
treatment PowerShell already gets.

Refs tinyhumansai#5270
Deriving the Git root from `where git.exe` does not work under scoop: PATH
only ever contains the shim directory, so `<shim dir>\..\bin\bash.exe`
resolves to `scoop\bin\bash.exe`, which does not exist. The real binary
lives under `scoop\apps\git\current\bin`, so probe that directly for the
user-scope, global and relocated (`%SCOOP%`) install roots.

Refs tinyhumansai#5270
@Mustaqeem66
Mustaqeem66 requested a review from a team August 4, 2026 08:48
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Windows development command now uses a new .cmd wrapper. The wrapper locates Git Bash, forwards arguments to run-dev-win.sh, reports configuration errors, and has regression test coverage.

Changes

Windows development launcher

Layer / File(s) Summary
Launcher discovery and delegation
scripts/run-dev-win.cmd, .gitattributes, crlf-probe.txt
The new wrapper finds Git Bash through supported installation paths or OPENHUMAN_BASH_EXE, avoids bare bash.exe lookup, forwards arguments, and reports failures. Windows command files use CRLF line endings.
Script wiring and regression coverage
app/package.json, app/test/dev-app-win-launcher.test.ts
The Windows development script invokes the new wrapper. Tests cover command parsing, launcher existence, Bash path quoting, delegation, and lookup rejection.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: al629176

Poem

A rabbit found Bash in a Windows maze,
Quoted its path through command-line haze.
The wrapper hops, arguments in tow,
Tests guard each path where failures grow.
CRLF marks the trail in place.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Tmp/crlf write probe' is vague and does not clearly convey the main purpose of the pull request, which is to make Windows development tooling reliable across Git installations. Use a descriptive title that summarizes the primary change, such as 'Add Windows bash launcher wrapper and CRLF configuration for dev:app:win' or 'Fix Windows dev entry point with bash discovery and batch file CRLF handling'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Warning

⚠️ This pull request shows signs of AI-generated slop (description_diff_mismatch, ai_padded_prose). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@Mustaqeem66 Mustaqeem66 changed the title Tmp/crlf write probe [closed by author] accidental branch push — not a real change Aug 4, 2026
@Mustaqeem66 Mustaqeem66 closed this Aug 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/test/dev-app-win-launcher.test.ts`:
- Around line 1-10: Move the Vitest test from app/test into the related app/src
feature directory, preserving its *.test.ts name and behavior. After relocating
it, update the HERE-derived APP_DIR and REPO_ROOT path calculations in the test
so they still resolve app/package.json and the repository scripts directory
correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e673fd2c-5f4d-4422-8720-45104c191624

📥 Commits

Reviewing files that changed from the base of the PR and between 5efb24a and 7dad1f3.

📒 Files selected for processing (5)
  • .gitattributes
  • app/package.json
  • app/test/dev-app-win-launcher.test.ts
  • crlf-probe.txt
  • scripts/run-dev-win.cmd

Comment on lines +1 to +10
import { existsSync, readFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, expect, it } from 'vitest';

const HERE = path.dirname(fileURLToPath(import.meta.url));
const APP_DIR = path.resolve(HERE, '..');
const REPO_ROOT = path.resolve(APP_DIR, '..');
const PACKAGE_JSON_PATH = path.join(APP_DIR, 'package.json');
const LAUNCHER_PATH = path.join(REPO_ROOT, 'scripts', 'run-dev-win.cmd');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Move this Vitest test under app/src/**.

This new test is under app/test/. Move it to the related app/src/** feature location. Update APP_DIR and REPO_ROOT after the move.

As per coding guidelines, co-locate Vitest unit tests as *.test.ts(x) under app/src/**.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/test/dev-app-win-launcher.test.ts` around lines 1 - 10, Move the Vitest
test from app/test into the related app/src feature directory, preserving its
*.test.ts name and behavior. After relocating it, update the HERE-derived
APP_DIR and REPO_ROOT path calculations in the test so they still resolve
app/package.json and the repository scripts directory correctly.

Source: Coding guidelines

@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a Windows-only pnpm dev:app:win launch failure caused by cmd.exe /S stripping the outermost quotes from the script string, which caused C:/Program to be parsed as the program name instead of the full Git bash path. The fix introduces a .cmd wrapper at scripts/run-dev-win.cmd that can safely quote the bash path internally, and updates package.json to point at the wrapper via a relative, space-free path.

  • scripts/run-dev-win.cmd probes multiple Git for Windows install locations (Program Files, Scoop, winget/chocolatey PATH-derived roots) in priority order, avoids falling back to the WSL bash.exe, and delegates to the existing run-dev-win.sh with all arguments forwarded.
  • .gitattributes adds eol=crlf for *.cmd and *.bat so git materialises the launcher with Windows line endings on checkout.
  • crlf-probe.txt is a two-line throwaway file (line1 / line2) used to verify the new .gitattributes rule during development; it was accidentally committed and should be removed before merging.

Confidence Score: 4/5

Safe to merge after removing crlf-probe.txt; the core fix, gitattributes change, and test coverage are all solid.

The Windows launcher fix itself is well-implemented and the regression test suite covers the failure mode, single-token requirement, file existence, and WSL-bash avoidance. The only blocker is crlf-probe.txt — a temporary two-line debug file that was accidentally committed and has no purpose in the repository tree.

Files Needing Attention: crlf-probe.txt must be deleted before merging.

Important Files Changed

Filename Overview
.gitattributes Adds eol=crlf rules for *.cmd and *.bat; correct and necessary for the new launcher to function on Windows.
app/package.json Replaces the broken bash-direct invocation (space-in-path cmd /S split) with a relative, no-spaces path to the new .cmd wrapper; fix is correct.
app/test/dev-app-win-launcher.test.ts Well-structured regression tests covering the historical failure mode, single-token requirement, file existence, and WSL/bare-bash avoidance.
crlf-probe.txt Temporary debug probe file (two lines: "line1", "line2") accidentally committed; should be deleted before merging.
scripts/run-dev-win.cmd Carefully written CMD launcher that probes multiple Git for Windows install locations, quotes all paths correctly, and avoids the WSL bash.exe trap; minor edge case if %SCOOP% is undefined but covered by subsequent path checks.

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant pnpm
    participant cmd as cmd.exe /d /s /c
    participant wrapper as scripts/run-dev-win.cmd
    participant bash as bash.exe (Git for Windows)
    participant sh as scripts/run-dev-win.sh

    Dev->>pnpm: pnpm dev:app:win
    pnpm->>cmd: invoke script body
    Note over cmd: resolves ..\\scripts\\run-dev-win.cmd<br/>(no spaces, no quoting needed)
    cmd->>wrapper: execute run-dev-win.cmd
    wrapper->>wrapper: probe OPENHUMAN_BASH_EXE
    wrapper->>wrapper: probe %ProgramFiles%\\Git\\bin\\bash.exe
    wrapper->>wrapper: probe %LOCALAPPDATA%\\Programs\\Git\\bin\\bash.exe
    wrapper->>wrapper: probe Scoop paths
    wrapper->>wrapper: derive from git.exe on PATH
    alt bash.exe found
        wrapper->>bash: ""%BASH_EXE%" "%SCRIPT_DIR%run-dev-win.sh" %*"
        bash->>sh: execute run-dev-win.sh
    else bash.exe not found
        wrapper-->>Dev: error: install Git for Windows or set OPENHUMAN_BASH_EXE
    end
Loading

Reviews (1): Last reviewed commit: "chore: crlf write probe" | Re-trigger Greptile

Comment thread crlf-probe.txt
Comment on lines +1 to +2
line1
line2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Debug artifact left in the repository

crlf-probe.txt contains only line1 and line2 — it is a throwaway file used during development to verify that the new .gitattributes rule was actually applying CRLF endings to .cmd/.bat files. The PR branch name (Tmp/crlf write probe) confirms this was never meant to land in main. Committing it adds noise to the tree and undermines the tidy scope of the fix.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7dad1f3c73

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/run-dev-win.cmd
Comment on lines +9 to +10
rem pnpm runs package.json scripts through `cmd.exe /d /s /c <string>`. The /S
rem flag strips the first and last quote characters from <string> before

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Escape cmd metacharacters in REM comments

In this new .cmd launcher, the rem comments contain literal <...> placeholders here and again in the Scoop/root comments below. Windows cmd still parses redirection metacharacters in batch comments; Microsoft’s rem docs state that redirection characters like < and > cannot be used in batch-file comments. On Windows, pnpm dev:app:win will parse these as redirections before the bash lookup runs, causing confusing startup errors and possible redirect-file side effects; escape them as ^<...^> or avoid angle brackets in the comments.

Useful? React with 👍 / 👎.

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