Skip to content

feat: add zsh support - #13

Merged
lumirelle merged 3 commits into
masterfrom
feat/zsh-support
Jun 13, 2026
Merged

feat: add zsh support#13
lumirelle merged 3 commits into
masterfrom
feat/zsh-support

Conversation

@lumirelle

@lumirelle lumirelle commented Jun 13, 2026

Copy link
Copy Markdown
Owner
  • This PR contains AI-generated code, but I have carefully reviewed it myself. Otherwise, my PR may be closed.
    • I understand that my PR is more likely to be rejected or requested for changes if it contains AI-generated code that I do not fully understand.

🔗 Linked issue

#11

🧭 Context

Since v3.13.0, shfmt supports zsh.

📚 Description

Since v3.13.0, shfmt supports zsh.

Summary by CodeRabbit

  • New Features

    • Added support for Zsh shell scripts with automatic formatter activation.
  • Documentation

    • Updated supported file types to include Zsh.
  • Chores

    • Bumped formatter tool version to v3.13.1.
    • Added a project tool-version configuration.
    • Included Zsh-focused test files to validate formatting and behavior.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@lumirelle, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 7 minutes and 21 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 197e3d88-e77a-457f-8710-1787d86e7657

📥 Commits

Reviewing files that changed from the base of the PR and between 6d0b5fc and 5e45bbc.

📒 Files selected for processing (2)
  • .vscode/settings.json
  • test/supported/.zshrc
📝 Walkthrough

Walkthrough

This pull request adds zsh shell language support to the VS Code shell formatter extension. The changes register zsh as a language with the extension, bump the underlying shfmt tool to v3.13.1, implement file detection to pass the --ln=zsh flag, and include test fixtures demonstrating zsh syntax.

Changes

Zsh Shell Support

Layer / File(s) Summary
shfmt tool and dependency configuration
src/config.ts, mise.toml
shfmt version bumped to v3.13.1; development tool versions configured for node (latest) and yarn (1).
VS Code extension manifest and documentation
package.json, README.md
Extension activates on onLanguage:zsh, registers zsh as a contributed language with .zsh and common startup/profile filenames, adds zsh to shellformat.effectLanguages, and documents zsh support in the README.
Test fixtures for zsh scripts
test/supported/.zshrc, test/supported/test.zsh
Example .zshrc with environment variables, aliases, history settings, and prompt; example zsh script with a function, array iteration, globbing options, and argument-based branching.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • zsh support #11: The PR implements zsh language registration, formatter updates, file detection, and test fixtures that align with the requested zsh support.

Poem

🐇 I dug a cozy shell-software den,
Added zsh flags and tests for when
.zshrc and scripts hop into view,
Formatter ready — tidy and new! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add zsh support' accurately summarizes the main change, which is adding zsh support across multiple files including configuration, package manifest, and test files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/zsh-support

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 and usage tips.

@lumirelle

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (3)
package.json (1)

125-133: ⚡ Quick win

Consider adding other common zsh configuration files.

The current implementation includes .zshrc and .zshenv, which are the most common zsh configuration files. However, zsh users also frequently use .zprofile, .zlogin, and .zlogout for shell initialization and cleanup.

📝 Suggested enhancement
       {
         "id": "zsh",
         "extensions": [
           ".zsh"
         ],
         "filenames": [
           ".zshrc",
-          ".zshenv"
+          ".zshenv",
+          ".zprofile",
+          ".zlogin",
+          ".zlogout"
         ]
       }
🤖 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 `@package.json` around lines 125 - 133, Update the "zsh" entry (id "zsh") in
package.json to include additional common zsh config filenames by adding
".zprofile", ".zlogin", and ".zlogout" to the "filenames" array alongside the
existing ".zshrc" and ".zshenv" so the "filenames" section covers all typical
zsh init/cleanup files.
src/shFormat.ts (1)

88-90: ⚡ Quick win

Consider adding detection for other common zsh configuration files.

The current regex pattern matches .zsh, .zshrc, and .zshenv files. To provide comprehensive zsh support, consider also detecting .zprofile, .zlogin, and .zlogout files, which are commonly used zsh configuration files.

Note: This suggestion corresponds to the optional enhancement suggested in package.json lines 125-133. If you add those filenames to the language definition, this regex should also be updated.

📝 Suggested enhancement
-        if (/\.(zsh|zshrc|zshenv)$/.test(document.fileName)) {
+        if (/\.(zsh|zshrc|zshenv|zprofile|zlogin|zlogout)$/.test(document.fileName)) {
           shfmtFlags.push('--ln=zsh');
         }
🤖 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 `@src/shFormat.ts` around lines 88 - 90, The regex that detects zsh files in
src/shFormat.ts currently only matches .zsh, .zshrc and .zshenv; update that
pattern to also include .zprofile, .zlogin and .zlogout so the branch that
pushes shfmtFlags.push('--ln=zsh') runs for those files too (e.g. change
/\.(zsh|zshrc|zshenv)$/ to /\.(zsh|zshrc|zshenv|zprofile|zlogin|zlogout)$/). If
you also add those filenames to the language definition in package.json, keep
both places in sync.
mise.toml (1)

2-2: 💤 Low value

Consider pinning node to a specific version for reproducibility.

Using "latest" for the node version can lead to inconsistent development environments across team members and CI pipelines as the latest version changes over time.

📌 Suggested change
-node = "latest"
+node = "20"  # or specify exact version like "20.15.0"
🤖 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 `@mise.toml` at line 2, The node version is pinned to "latest" in the mise.toml
entry node = "latest", which causes non-reproducible environments; replace that
value with a specific, stable Node.js version (e.g., an LTS semver like
"18.20.0" or the project-chosen version) and update any CI configs/README to
match so local, CI, and team environments are consistent.
🤖 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.

Nitpick comments:
In `@mise.toml`:
- Line 2: The node version is pinned to "latest" in the mise.toml entry node =
"latest", which causes non-reproducible environments; replace that value with a
specific, stable Node.js version (e.g., an LTS semver like "18.20.0" or the
project-chosen version) and update any CI configs/README to match so local, CI,
and team environments are consistent.

In `@package.json`:
- Around line 125-133: Update the "zsh" entry (id "zsh") in package.json to
include additional common zsh config filenames by adding ".zprofile", ".zlogin",
and ".zlogout" to the "filenames" array alongside the existing ".zshrc" and
".zshenv" so the "filenames" section covers all typical zsh init/cleanup files.

In `@src/shFormat.ts`:
- Around line 88-90: The regex that detects zsh files in src/shFormat.ts
currently only matches .zsh, .zshrc and .zshenv; update that pattern to also
include .zprofile, .zlogin and .zlogout so the branch that pushes
shfmtFlags.push('--ln=zsh') runs for those files too (e.g. change
/\.(zsh|zshrc|zshenv)$/ to /\.(zsh|zshrc|zshenv|zprofile|zlogin|zlogout)$/). If
you also add those filenames to the language definition in package.json, keep
both places in sync.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0d18a1fa-c646-4672-a3b4-1a02f02a2f5c

📥 Commits

Reviewing files that changed from the base of the PR and between 76d7ef7 and 9312595.

📒 Files selected for processing (7)
  • README.md
  • mise.toml
  • package.json
  • src/config.ts
  • src/shFormat.ts
  • test/supported/.zshrc
  • test/supported/test.zsh

@lumirelle
lumirelle marked this pull request as ready for review June 13, 2026 05:19
@lumirelle
lumirelle merged commit 82e8290 into master Jun 13, 2026
10 checks passed
@lumirelle
lumirelle deleted the feat/zsh-support branch June 13, 2026 05:34
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