Open
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #1
- Add $fy virtual command that converts shell scripts to command-stream mjs format - Support stdin input for single commands and file input for full scripts - Handle shell operators: &&, ||, ; with proper JavaScript equivalents - Convert pipelines, sequences, variables, exports, and comments - Preserve script structure while translating to command-stream syntax - Add comprehensive test suite with 14 test cases - Include example scripts and debug utilities Features: - Single command conversion: echo "ls -la" | $fy - File conversion: $fy script.sh [output.mjs] - Shell operator translation (&&, ||, ;) - Pipeline preservation - Comment and structure preservation - Variable and export handling - Error handling for missing files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the
$fytool requested in issue #1 - a shell-to-mjs translator that converts bash/shell scripts into JavaScript modules using the command-stream library syntax.Features
Single Command Conversion: Convert shell commands from stdin
Full Script Conversion: Convert complete shell scripts
Shell Operator Support: Handles &&, ||, ; with proper JavaScript equivalents
cmd1 && cmd2→ Sequential execution with error handlingcmd1 || cmd2→ Try/catch error recoverycmd1 ; cmd2→ Sequential executionAdvanced Features:
ls | grep test→await $\ls | grep test``export VAR=value→process.env.VAR=valueImplementation
$fyregistered as built-in commandshell-parser.mjsfor command parsingExamples
Simple Command Translation
Full Script Translation
Input
deploy.sh:Output:
Test Coverage
Usage
This implementation provides a powerful bridge between shell scripts and modern JavaScript development using the command-stream library, enabling easy migration of bash automation to JavaScript.
🤖 Generated with Claude Code
Resolves #1