{"id":31650506,"url":"https://github.com/open-technology-foundation/editfile","last_synced_at":"2026-04-20T13:37:18.147Z","repository":{"id":316415719,"uuid":"1063272514","full_name":"Open-Technology-Foundation/editfile","owner":"Open-Technology-Foundation","description":"A terminal-based text file editor with built-in validation support. Pure bash implementation with minimal external dependencies.","archived":false,"fork":false,"pushed_at":"2025-09-24T13:19:15.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-24T14:16:28.424Z","etag":null,"topics":["bash","file-validator","terminal-editor","text-editor"],"latest_commit_sha":null,"homepage":"https://yatti.id/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Open-Technology-Foundation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-24T11:59:16.000Z","updated_at":"2025-09-24T13:19:18.000Z","dependencies_parsed_at":"2025-09-24T14:16:30.093Z","dependency_job_id":"1309e4f7-c4bc-407c-85c2-f18da583a3f3","html_url":"https://github.com/Open-Technology-Foundation/editfile","commit_stats":null,"previous_names":["open-technology-foundation/editfile"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Open-Technology-Foundation/editfile","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Feditfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Feditfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Feditfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Feditfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Open-Technology-Foundation","download_url":"https://codeload.github.com/Open-Technology-Foundation/editfile/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Feditfile/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278742889,"owners_count":26037915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","file-validator","terminal-editor","text-editor"],"created_at":"2025-10-07T08:30:05.388Z","updated_at":"2026-04-20T13:37:18.105Z","avatar_url":"https://github.com/Open-Technology-Foundation.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# editfile - Developer's Text Editor with Built-in Validation\n\nA terminal-based text editor wrapper that adds comprehensive syntax validation to your editing workflow. Built as a validation layer on top of the [filetype package](https://github.com/Open-Technology-Foundation/filetype), editfile provides automatic file type detection, syntax validation for 10+ languages/formats, and safe atomic file operations.\n\n## Table of Contents\n\n- [Features](#features)\n- [How It Works](#how-it-works)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Usage](#usage)\n- [Supported File Types](#supported-file-types)\n- [Validation Workflow](#validation-workflow)\n- [Editor Configuration](#editor-configuration)\n- [Dependencies](#dependencies)\n- [Use Cases](#use-cases)\n- [Security](#security)\n- [Troubleshooting](#troubleshooting)\n- [Testing](#testing)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Features\n\n### Core Capabilities\n- **Automatic Syntax Validation** - Built-in validators for JSON, YAML, XML, Python, Shell, PHP, HTML, INI, CSV, and TOML\n- **Intelligent File Type Detection** - Recognizes 46+ file types via extension, shebang, or content analysis\n- **Interactive Error Recovery** - When validation fails, choose to re-edit, force save, or quit\n- **Atomic File Operations** - Uses temporary files for safe editing; original never corrupted\n- **PATH Search** - Automatically finds and edits executables/scripts in your PATH\n- **Binary Protection** - Refuses to edit binary files to prevent corruption\n- **Line Positioning** - Jump directly to specific line numbers\n- **Shellcheck Integration** - Optional advanced shell script analysis (with `-s` flag)\n\n### Editor Integration\n- **Syntax Highlighting** - Automatic syntax configuration for 46+ file types\n- **Multi-Editor Support** - Works with joe, nano, vim, emacs, VS Code\n- **Auto-Detection** - Finds available editors or uses `$EDITOR` environment variable\n\n### Safety Features\n- Symlink resolution (edits actual file, not the link)\n- Permission checking (file and directory)\n- Self-edit protection (prevents corrupting the running script)\n- Change detection (skips validation if file unchanged)\n- Temporary file cleanup on exit/interrupt\n\n## How It Works\n\neditfile is a validation wrapper built on the [filetype package](https://github.com/Open-Technology-Foundation/filetype):\n\n```\n┌─────────────────────────────────────────────┐\n│  editfile (this project)                    │\n│  • Validation logic                         │\n│  • Atomic file operations                   │\n│  • Interactive error handling               │\n│  • PATH search                              │\n└─────────────────┬───────────────────────────┘\n                  │ uses\n┌─────────────────▼───────────────────────────┐\n│  filetype package (dependency)              │\n│  • editcmd - Editor launcher                │\n│  • filetype - Type detection (100+)          │\n│  • Syntax highlighting configuration        │\n└─────────────────┬───────────────────────────┘\n                  │ launches\n┌─────────────────▼───────────────────────────┐\n│  Your Editor                                │\n│  vim, nano, joe, emacs, VS Code, etc.       │\n└─────────────────────────────────────────────┘\n```\n\n### Workflow\n\n1. **File Resolution** - Searches locally, then in PATH if not found\n2. **Binary Check** - Verifies file is text (using `file` command and null-byte detection)\n3. **Type Detection** - Identifies file type using filetype library (extension, shebang, or content)\n4. **Temporary Copy** - Creates temp file with preserved extension for proper syntax highlighting\n5. **Editor Launch** - Uses editcmd to open file with correct syntax highlighting\n6. **Change Detection** - Compares temp file with original to detect actual changes\n7. **Validation** - Runs appropriate validator based on file type (if enabled)\n8. **Interactive Handling** - On validation failure, prompts: [e]dit again, [s]ave anyway, or [q]uit\n9. **Atomic Replace** - Moves validated temp file to final location\n\n## Installation\n\n### Quick Start\n\n```bash\ngit clone https://github.com/Open-Technology-Foundation/editfile.git \u0026\u0026 cd editfile \u0026\u0026 sudo make install-deps \u0026\u0026 sudo make install\n```\n\nOr step-by-step:\n\n```bash\ngit clone https://github.com/Open-Technology-Foundation/editfile.git\ncd editfile\nsudo make install-deps   # Install filetype dependency\nsudo make install        # Install editfile and bash completion\n```\n\n### Available Targets\n\n```bash\nmake                # Show help and available targets\nsudo make install   # Install editfile and bash completion\nsudo make uninstall # Remove editfile and bash completion\nmake test           # Run test suite\nmake check          # Run shellcheck on editfile\nmake check-deps     # Check optional validators and python modules\nsudo make install-deps  # Install filetype package from GitHub\n```\n\n### Custom Install Location\n\n```bash\n# Install to a custom prefix\nsudo make install PREFIX=/opt/editfile\n\n# Packaging (staged install)\nmake install DESTDIR=/tmp/pkg PREFIX=/usr\n```\n\n### Install Optional Validators (Recommended)\n\nFor full validation support:\n\n```bash\n# Ubuntu/Debian\nsudo apt install jq yamllint libxml2-utils shellcheck php-cli tidy\n\n# Fedora/RHEL/Rocky\nsudo dnf install jq yamllint libxml2 ShellCheck php-cli tidy\n\n# Python-based validators\npip install PyYAML tomli  # For YAML and TOML validation\n\n# Check what's installed\nmake check-deps\n```\n\n**Note**: Missing validators generate warnings but don't prevent editing.\n\n## Quick Start\n\n```bash\n# Edit with validation\neditfile config.json\n\n# Edit without validation (faster for large files)\neditfile -n script.py\n\n# Jump to specific line\neditfile -l 42 server.py\n\n# Edit shell script with shellcheck analysis\neditfile -s deploy.sh\n\n# Edit executable from PATH\neditfile backup-script\n\n# Create new file (with prompt)\neditfile newfile.yaml\n```\n\n## Usage\n\n### Syntax\n\n```bash\neditfile [OPTIONS] filename\n```\n\n### Options\n\n| Option | Description |\n|--------|-------------|\n| `-n`, `--no-validate` | Skip syntax validation (faster for large files) |\n| `-l`, `--line LINE` | Jump to specified line number |\n| `-s`, `--shellcheck` | Run shellcheck on shell scripts (in addition to bash -n) |\n| `-V`, `--version` | Show version and exit |\n| `-h`, `--help` | Display help message |\n\n### Examples\n\n#### Basic Editing\n```bash\neditfile script.py              # Edit Python with validation\neditfile config.json            # Edit JSON with validation\neditfile data.yaml              # Edit YAML with validation\neditfile -n large_data.xml      # Skip validation for large files\n```\n\n#### Line Positioning\n```bash\neditfile -l 42 script.py        # Jump to line 42\neditfile -l 100 /etc/hosts      # Edit system file at line 100\n\n# Integration with grep\nline=$(grep -n \"TODO\" script.py | head -1 | cut -d: -f1)\neditfile -l \"$line\" script.py\n```\n\n#### Shell Script Development\n```bash\neditfile deploy.sh              # Edit with bash -n validation\neditfile -s deploy.sh           # Edit with bash -n + shellcheck\neditfile -s -l 50 install.sh    # Jump to line 50, run shellcheck\n```\n\n#### PATH Search\n```bash\neditfile myscript               # Searches PATH if not local\neditfile backup-script          # Edit from /usr/local/bin\neditfile cln                    # Edit custom command\n\n# When found in PATH, editfile prompts:\n# \"Edit executable '/usr/local/bin/backup-script'? y/n\"\n```\n\n#### Creating New Files\n```bash\neditfile newfile.py             # Prompts: \"Create 'newfile.py'? y/n\"\neditfile config/app.yaml        # Creates directory if needed\n```\n\n#### Configuration Files\n```bash\neditfile ~/.bashrc              # Shell configuration\neditfile /etc/nginx/nginx.conf  # System config (requires sudo)\neditfile docker-compose.yml     # Docker configuration\neditfile package.json           # npm configuration\n```\n\n#### Advanced Workflows\n```bash\n# Find error and edit at line\nerror_line=$(python script.py 2\u003e\u00261 | grep -oP 'line \\K\\d+' | head -1)\neditfile -l \"$error_line\" script.py\n\n# Edit and validate JSON from curl\ncurl https://api.example.com/config \u003e config.json\neditfile config.json\n\n# Batch edit with validation check\nfor file in *.json; do\n  editfile \"$file\" || echo \"Failed: $file\"\ndone\n```\n\n## Supported File Types\n\n### Validated File Types (with Syntax Checking)\n\n| Type | Extensions | Primary Validator | Fallback |\n|------|-----------|-------------------|----------|\n| JSON | .json, .jsonld, .jsonc | jq | python3 json.tool |\n| YAML | .yaml, .yml | yamllint | python3 PyYAML |\n| XML | .xml, .xsl, .xslt, .svg | xmllint | python3 xml.etree |\n| HTML | .html, .htm, .xhtml | tidy | (basic check) |\n| Python | .py, .pyw, .pyi | python3 -m py_compile | - |\n| Shell | .sh, .bash, .zsh, .ksh, shebang | bash -n | (+ optional shellcheck) |\n| PHP | .php, .phtml | php -l | - |\n| INI | .ini, .conf, .cfg | awk validation | - |\n| CSV | .csv, .tsv | awk column check | - |\n| TOML | .toml, .tml | python3 tomli/toml | - |\n\n### Syntax Highlighted Only (40+ additional types)\n\nAll files get syntax highlighting even without validators:\n\n**Programming Languages**: JavaScript, TypeScript, C, C++, Java, Go, Rust, Ruby, Perl, Lua, TCL, Erlang, Elixir, Haskell, Lisp, OCaml, Scala, Swift, R\n\n**Markup/Config**: Markdown, LaTeX, reStructuredText, AsciiDoc, SQL, Nginx config, Apache config, systemd units\n\n**Data/Build**: Dockerfile, Makefile, CMake, Gradle, Maven, Terraform, Ansible\n\n**Other**: Diff/Patch files, Git config, SSH config, and more\n\nSee the [filetype package](https://github.com/Open-Technology-Foundation/filetype) for the complete list of 46+ supported types.\n\n## Validation Workflow\n\n### When Validation Passes\n```\nEdit file → Make changes → Save → Validation passes → File saved ✓\n```\n\n### When Validation Fails\n```\nEdit file → Make changes → Save → Validation fails ✗\n↓\neditfile presents three options:\n  [e] Edit again   - Fix errors and retry (changes preserved in temp file)\n  [s] Save anyway  - Force save despite errors (not recommended)\n  [q] Quit         - Discard changes and exit\n```\n\n### Example Session\n\n```bash\n$ editfile config.json\n\neditfile: ◉ Launching editor with syntax highlighting\n# (you edit and save the file with a syntax error)\n\neditfile: ◉ Validating json file 'config.json'\nparse error: Expected separator between values at line 5, column 12\neditfile: ✗ Validation failed:\n\nOptions:\n  [e] - Edit again\n  [s] - Save anyway (not recommended)\n  [q] - Quit without saving\neditfile: What would you like to do? [e/s/q]: e\n\n# (editor reopens with your changes still there)\n# (you fix the error and save)\n\neditfile: ◉ Validating json file 'config.json'\neditfile: ✓ Validated\neditfile: ✓ 'config.json' saved\n```\n\n### Validator Priority\n\nEach file type uses the best available validator:\n\n1. **Specialized tools first** (jq, yamllint, xmllint, shellcheck)\n2. **Fallback to Python** (if specialized tool missing)\n3. **Warn if no validator** (but still allow editing)\n\n## Editor Configuration\n\n### Editor Selection Priority\n\n1. `$EDITOR` environment variable (if set)\n2. Auto-detection searches for: joe → nano → vim → vi → emacs\n3. Default fallback: vim\n\n### Set Your Preferred Editor\n\n```bash\n# In ~/.bashrc or ~/.bash_profile\nexport EDITOR=nano      # Use nano\nexport EDITOR=vim       # Use vim\nexport EDITOR=joe       # Use joe\nexport EDITOR=emacs     # Use emacs\nexport EDITOR=code      # Use VS Code (if installed)\n```\n\n### Supported Editors\n\n- **joe** - Joe's Own Editor\n- **nano** - GNU nano\n- **vim** - Vi IMproved\n- **vi** - Classic vi\n- **emacs** - GNU Emacs\n- **VS Code** - Visual Studio Code (via `code` command)\n\nAll editors receive proper syntax highlighting configuration via editcmd.\n\n## Dependencies\n\n### Required\n- **bash 4.4+** - Shell interpreter\n- **filetype package** - Provides filetype and editcmd\n  - Install: https://github.com/Open-Technology-Foundation/filetype\n- **Standard Unix tools** - grep, awk, file, od, cmp, readlink, mktemp\n- **Text editor** - At least one: vim, nano, joe, emacs, vi\n\n### Optional Validators\n\nInstall these for enhanced validation (any combination works):\n\n#### Package Managers\n```bash\n# Ubuntu/Debian\napt install jq yamllint libxml2-utils shellcheck php-cli tidy\n\n# macOS\nbrew install jq yamllint libxml2 shellcheck php tidy-html5\n\n# Fedora/RHEL\ndnf install jq yamllint libxml2 ShellCheck php-cli tidy\n\n# Arch Linux\npacman -S jq yamllint libxml2 shellcheck php tidy\n\n# Alpine Linux\napk add jq yamllint libxml2-utils shellcheck php tidy\n```\n\n#### Python Validators\n```bash\n# YAML support\npip install PyYAML\n\n# TOML support\npip install tomli          # Python 3.11+\npip install toml           # Older Python versions\n```\n\n#### Validator Check\n```bash\n# Check which validators are available\ncommand -v jq yamllint xmllint shellcheck php tidy python3\n```\n\n## Use Cases\n\n### 1. Configuration Management\nPrevent broken config files from being deployed:\n\n```bash\neditfile nginx.conf             # Catch nginx config errors\neditfile docker-compose.yml     # Validate Docker configs\neditfile .gitlab-ci.yml         # Check CI/CD syntax\neditfile terraform.tfvars       # Verify Terraform variables\n```\n\n### 2. Script Development\nCatch syntax errors immediately:\n\n```bash\neditfile -s deploy.sh           # Bash with shellcheck\neditfile backup.py              # Python syntax check\neditfile install.php            # PHP lint check\n```\n\n### 3. DevOps/SRE Workflows\nQuick editing of scripts in system paths:\n\n```bash\neditfile backup-script          # Edit from /usr/local/bin\neditfile cleanup                # Edit system maintenance scripts\neditfile -l 42 monitor          # Jump to specific line in monitoring script\n```\n\n### 4. Data File Editing\nEnsure data integrity:\n\n```bash\neditfile users.csv              # Column consistency check\neditfile api-response.json      # JSON structure validation\neditfile translations.yaml      # YAML format verification\neditfile config.toml            # TOML syntax check\n```\n\n### 5. API/Web Development\n```bash\neditfile api-spec.json          # OpenAPI/Swagger spec\neditfile schema.xml             # XML schema validation\neditfile index.html             # HTML validation\neditfile endpoints.yaml         # API endpoint config\n```\n\n## Security\n\neditfile implements multiple security measures:\n\n### Protection Mechanisms\n- **Command Injection Prevention** - All validators use safe argument passing (sys.argv[], not eval)\n- **Filename Sanitization** - Temporary filenames sanitized to prevent shell injection\n- **Binary File Protection** - Refuses to edit binary files (prevents corruption/exploitation)\n- **Path Resolution** - Uses canonical paths to prevent traversal attacks\n- **Self-Edit Protection** - Prevents editing the running script (avoids corruption during atomic replace)\n- **Null Byte Detection** - Multiple methods to detect binary content\n\n### Security Best Practices\n- Always validate configuration files before deployment\n- Use `-s` flag for shell scripts to catch common security issues via shellcheck\n- Review validation output carefully\n- Don't use `-n` (skip validation) for security-critical configs\n\nFor detailed security information and testing, see [SECURITY.md](SECURITY.md).\n\n## Troubleshooting\n\n### Common Issues\n\n#### 1. \"editcmd not found\" Error\n\n**Problem**: editfile can't find the filetype package\n\n**Solution**:\n```bash\n# Install filetype package\ngit clone https://github.com/Open-Technology-Foundation/filetype.git\ncd filetype\nsudo ./install.sh\n\n# Verify installation\ncommand -v editcmd\nls -l /usr/local/bin/editcmd\nls -l /usr/local/bin/filetype\n```\n\n#### 2. \"No validator available\" Warning\n\n**Problem**: Validation tool not installed\n\n**Solution**:\n```bash\n# Install the specific validator needed\nsudo apt install jq              # For JSON\nsudo apt install yamllint        # For YAML\nsudo apt install libxml2-utils   # For XML\npip install PyYAML               # Python YAML fallback\n\n# Or edit without validation\neditfile -n file.yaml\n```\n\n#### 3. Editor Not Opening / Wrong Editor\n\n**Problem**: editfile can't find your preferred editor\n\n**Solution**:\n```bash\n# Set EDITOR environment variable\nexport EDITOR=nano\neditfile file.txt\n\n# Or add to ~/.bashrc\necho 'export EDITOR=nano' \u003e\u003e ~/.bashrc\nsource ~/.bashrc\n```\n\n#### 4. Validation Fails but File Looks Correct\n\n**Problem**: Validator is too strict or has false positives\n\n**Options**:\n```bash\n# 1. Fix the actual issue (recommended)\neditfile file.json              # Choose [e] to edit again\n\n# 2. Save anyway (use with caution)\neditfile file.json              # Choose [s] to force save\n\n# 3. Skip validation entirely\neditfile -n file.json           # No validation\n```\n\n#### 5. Permission Denied\n\n**Problem**: No write access to file or directory\n\n**Solution**:\n```bash\n# For system files, use sudo\nsudo editfile /etc/hosts\n\n# For user files, check permissions\nls -la file.txt\nchmod u+w file.txt              # Add write permission\n```\n\n#### 6. Binary File Refusal\n\n**Problem**: editfile refuses to edit a text file it thinks is binary\n\n**Diagnosis**:\n```bash\n# Check file type\nfile filename\nod -An -tx1 filename | head    # Look for null bytes (00)\n\n# If truly text, it may have null bytes - handle carefully\n```\n\n#### 7. PATH Search Not Working\n\n**Problem**: Can't find executable in PATH\n\n**Debug**:\n```bash\n# Check if file exists in PATH\ncommand -v scriptname\nwhich scriptname\n\n# Check PATH variable\necho \"$PATH\"\n\n# Use absolute path instead\neditfile /usr/local/bin/scriptname\n```\n\n### Debug Mode\n\n```bash\n# Enable bash debug output\nbash -x editfile file.txt\n\n# Check validation manually\njq empty file.json              # Test JSON\nyamllint file.yaml              # Test YAML\nbash -n script.sh               # Test shell script\n```\n\n### Getting Help\n\n1. Check the help output: `editfile --help`\n2. Review validator output carefully (it usually shows the exact error)\n3. Test validators manually to isolate issues\n4. Check file permissions and ownership\n5. Verify filetype package installation\n6. Report issues: https://github.com/Open-Technology-Foundation/editfile/issues\n\n## Testing\n\n### Run Test Suite\n\n```bash\n# Basic validation tests\n./tests/test_validation.sh\n\n# Security tests\n./tests/test_security.sh\n```\n\n### Test Coverage\n\nThe validation test suite verifies:\n- ✓ JSON, YAML, Python, Shell script validation (valid \u0026 invalid files)\n- ✓ Editor detection and fallback\n- ✓ Command-line argument parsing\n- ✓ Temporary file naming and cleanup\n- ✓ Binary file detection\n- ✓ PATH search functionality\n\nThe security test suite verifies:\n- ✓ Command injection prevention\n- ✓ Filename sanitization\n- ✓ Unicode and special character handling\n- ✓ Path traversal prevention\n- ✓ Validator security\n\n### Manual Testing\n\n```bash\n# Test JSON validation\necho '{\"valid\": \"json\"}' \u003e test.json\neditfile test.json\n\necho '{invalid json}' \u003e bad.json\neditfile bad.json                # Should fail validation\n\n# Test shellcheck integration\necho '#!/bin/bash' \u003e test.sh\necho 'var=foo' \u003e\u003e test.sh\necho 'echo $var' \u003e\u003e test.sh\neditfile -s test.sh              # Should warn about quoting\n\n# Test PATH search\neditfile bash                    # Should find /bin/bash\n```\n\n## Contributing\n\nContributions welcome! Please ensure:\n\n1. **Code Quality**\n   - Follow the [Bash Coding Standard](https://github.com/Open-Technology-Foundation/bash-coding-standard)\n   - Pass shellcheck without errors: `shellcheck editfile`\n   - Use 2-space indentation (not tabs)\n   - Declare all variables with `declare` or `local`\n\n2. **Testing**\n   - Add tests for new validators\n   - Ensure existing tests pass: `./tests/test_validation.sh`\n   - Test security implications: `./tests/test_security.sh`\n\n3. **Documentation**\n   - Update README.md for new features\n   - Update help text in the script\n   - Add usage examples\n\n### Adding a New Validator\n\n1. Add file type detection in `detect_file_type()` function (or rely on sourced filetype library)\n2. Create `validate_\u003ctype\u003e()` function following existing patterns\n3. Add case in `validate_file()` dispatcher\n4. Update the validators table in README.md\n5. Add test case in `tests/test_validation.sh`\n\nExample:\n```bash\nvalidate_rust() {\n  local -- filepath=\"$1\"\n\n  if command -v rustc \u003e/dev/null 2\u003e\u00261; then\n    if ! rustc --crate-type lib --emit metadata \"$filepath\" 2\u003e\u00261; then\n      return 1\n    fi\n    return 0\n  fi\n\n  warn 'Rust compiler not available for validation'\n  return 0\n}\n```\n\n## License\n\nThis project is licensed under the GNU General Public License v3.0.\n\nSee the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.en.html) for full license text.\n\n### Why GPL v3?\n\n- Ensures the software remains free and open source\n- Requires derivative works to also be open source\n- Protects against patent claims\n- Promotes community collaboration\n\n---\n\n## Project Links\n\n- **Repository**: https://github.com/Open-Technology-Foundation/editfile\n- **Issues**: https://github.com/Open-Technology-Foundation/editfile/issues\n- **Security**: [SECURITY.md](SECURITY.md)\n- **Dependencies**: [filetype package](https://github.com/Open-Technology-Foundation/filetype)\n\n## Author\n\n**Open Technology Foundation**\n\nA community-driven organization focused on creating practical, well-documented open source tools for developers and system administrators.\n\n---\n\n**Note**: editfile is designed for developer workflows. It provides validation as a helpful safety net, but always review changes before committing to production systems.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-technology-foundation%2Feditfile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-technology-foundation%2Feditfile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-technology-foundation%2Feditfile/lists"}