Skip to content

Conversation

@tobiaslins
Copy link
Contributor

I found this when trying to store and read a ASCII triangle using just-bash

[vercel] 🔧 Tool call: bash
[vercel] 📝 Command: cat > triangle.txt << 'EOF'
                    *
                   * *
                  *   *
                 *     *
                *       *
               *         *
              *           *
             *             *
            *               *
           *                 *
          *                   *
         *********************
EOF
cat triangle.txt

[vercel] ✅ Exit code: 0
[vercel] stdout: *
* *
*   *
*     *
*       *
*         *
*           *
*             *
*               *
*                 *
*                   *
*********************

[vercel] 🏁 Completed - 1 tool calls, response length: 65

The heredoc content was losing leading whitespace due to two issues:

  1. In lexer.ts, skipWhitespace() was called before checking for pending heredocs, which stripped leading whitespace from the first line of heredoc content. Fixed by moving the heredoc check before skipWhitespace().

  2. In Bash.ts, the script normalization (trimStart on every line) was stripping whitespace from heredoc content. Fixed by making the normalizeScript function heredoc-aware so it preserves content inside heredocs while still normalizing the surrounding script.

Added tests for whitespace preservation in heredocs.

The heredoc content was losing leading whitespace due to two issues:

1. In lexer.ts, skipWhitespace() was called before checking for pending
   heredocs, which stripped leading whitespace from the first line of
   heredoc content. Fixed by moving the heredoc check before skipWhitespace().

2. In Bash.ts, the script normalization (trimStart on every line) was
   stripping whitespace from heredoc content. Fixed by making the
   normalizeScript function heredoc-aware so it preserves content inside
   heredocs while still normalizing the surrounding script.

Added tests for whitespace preservation in heredocs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Jan 22, 2026

@tobiaslins is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

tobiaslins and others added 2 commits January 22, 2026 14:43
The heredoc content was losing leading whitespace due to two issues:

1. In lexer.ts, skipWhitespace() was called before checking for pending
   heredocs, which stripped leading whitespace from the first line of
   heredoc content. Fixed by moving the heredoc check before skipWhitespace().

2. In Bash.ts, the script normalization (trimStart on every line) was
   stripping whitespace from heredoc content. Fixed by making the
   normalizeScript function heredoc-aware so it preserves content inside
   heredocs while still normalizing the surrounding script.

Added tests for whitespace preservation in heredocs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
tobiaslins and others added 4 commits January 22, 2026 14:56
1. Don't use trimStart() for regular << heredocs - delimiter must match
   exactly. A line like "  EOF" should be content, not end the heredoc.

2. Allow hyphens in heredoc delimiters (e.g., END-TEST) by using
   [\w-]+ instead of \w+ in the regex pattern.

Added tests for both edge cases.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1. Don't use trimStart() for regular << heredocs - delimiter must match
   exactly. A line like "  EOF" should be content, not end the heredoc.

2. Allow hyphens in heredoc delimiters (e.g., END-TEST) by using
   [\w-]+ instead of \w+ in the regex pattern.

Added tests for both edge cases.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@cramforce cramforce merged commit e776055 into vercel-labs:main Jan 22, 2026
4 of 6 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.

2 participants