{"id":43158121,"url":"https://github.com/aik2mlj/chuckfmt","last_synced_at":"2026-04-16T00:01:20.479Z","repository":{"id":333804638,"uuid":"1138750559","full_name":"aik2mlj/chuckfmt","owner":"aik2mlj","description":"A fast code formatter for ChucK programming language","archived":false,"fork":false,"pushed_at":"2026-01-31T23:16:56.000Z","size":32,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-01T10:49:41.250Z","etag":null,"topics":["chuck","clang-format","formatter","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aik2mlj.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2026-01-21T04:20:55.000Z","updated_at":"2026-01-31T23:10:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"af644a69-fa5d-48a2-8566-83638ce13846","html_url":"https://github.com/aik2mlj/chuckfmt","commit_stats":null,"previous_names":["aik2mlj/chuckfmt"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/aik2mlj/chuckfmt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aik2mlj%2Fchuckfmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aik2mlj%2Fchuckfmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aik2mlj%2Fchuckfmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aik2mlj%2Fchuckfmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aik2mlj","download_url":"https://codeload.github.com/aik2mlj/chuckfmt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aik2mlj%2Fchuckfmt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31865078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["chuck","clang-format","formatter","rust"],"created_at":"2026-02-01T01:10:29.583Z","updated_at":"2026-04-16T00:01:20.466Z","avatar_url":"https://github.com/aik2mlj.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎵 chuckfmt\n\nA fast code formatter for [ChucK](https://chuck.stanford.edu/) — the strongly-timed audio programming language.\n\n## ✨ What it does\n\nChucK's syntax includes unique operators like `=\u003e`, `@=\u003e`, `\u003c\u003c\u003c`/`\u003e\u003e\u003e`, and `--\u003e` that `clang-format` doesn't understand natively. **chuckfmt** wraps `clang-format` and applies ChucK-specific post-processing to fix these.\n\n| Operator            | clang-format output | chuckfmt output |\n| ------------------- | ------------------- | --------------- |\n| ChucK operator      | `= \u003e`               | `=\u003e`            |\n| UnChuck operator    | `= \u003c`               | `=\u003c`            |\n| At-chuck            | `@ =\u003e`              | `@=\u003e`           |\n| UpChucK operator    | `= ^ x`             | `=^ x`          |\n| Time literal        | `1 ::second`        | `1::second`     |\n| Debug print (open)  | `\u003c\u003c\u003cx`              | `\u003c\u003c\u003c x`         |\n| Debug print (close) | `x\u003e\u003e\u003e;`             | `x \u003e\u003e\u003e;`        |\n| Polar literal       | `% (`               | `%(`            |\n| Spork (function)    | `spork ~foo`        | `spork ~ foo`   |\n| Gruck operator      | `-- \u003e`              | `--\u003e`           |\n| Ungruck operator    | `-- \u003c`              | `--\u003c`           |\n| Multiplication      | `2 *b`              | `2 * b`         |\n| Leading sign        | `- 3.14`            | `-3.14`         |\n\n## 🚀 Installation\n\n### Homebrew (macOS)\n\n```bash\nbrew install aik2mlj/tap/chuckfmt\n```\n\n### Pre-built binaries\n\nDownload from [Releases](../../releases) for:\n\n- 🐧 Linux (x86_64, aarch64, musl)\n- 🍎 macOS (Intel, Apple Silicon)\n- 🪟 Windows (x86_64, aarch64)\n\n### From source (requires Rust)\n\n```bash\ncargo install --path .\n```\n\n### Requirements\n\n`clang-format` must be installed:\n\n```bash\n# Debian/Ubuntu\nsudo apt install clang-format\n\n# Fedora\nsudo dnf install clang-tools-extra\n\n# Arch\nsudo pacman -S clang\n\n# macOS\nbrew install clang-format\n\n# Windows (winget)\nwinget install LLVM.LLVM\n\n# Windows (choco)\nchoco install llvm\n```\n\nOr set `CLANG_FORMAT_BIN=/path/to/clang-format` to use a custom path.\n\n## 📖 Usage\n\n```bash\n# Format file to stdout\nchuckfmt foo.ck\n\n# Format multiple files to stdout\nchuckfmt foo.ck bar.ck\n\n# Format in-place\nchuckfmt -i foo.ck bar.ck\n\n# Pipe from stdin\ncat foo.ck | chuckfmt\n\n# Use a file list\nchuckfmt -i --files filelist.txt\n\n# Explicit file delimiter (useful for files starting with -)\nchuckfmt -i --style=LLVM -- foo.ck bar.ck\n```\n\nAll `clang-format` options are passed through. Run `clang-format --help` for details.\n\n## ⚙️ Configuration\n\nchuckfmt uses `clang-format`'s [configuration system](https://clang.llvm.org/docs/ClangFormatStyleOptions.html). This might be a good starting point (`.clang-format` file):\n\n```yaml\nBasedOnStyle: LLVM\nColumnLimit: 100\nIndentWidth: 4\nUseTab: Never\n```\n\nThe formatter automatically adds `--assume-filename=code.java` if not specified, which tells `clang-format` to use Java-like formatting rules (a reasonable approximation for ChucK syntax).\n\n## 💻 VS Code Integration\n\nTo auto-format ChucK files on save:\n\n1. Install the [Run on Save](https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave) extension\n\n2. Add to your `.vscode/settings.json`:\n\n```json\n{\n  \"emeraldwalk.runonsave\": {\n    \"commands\": [\n      {\n        \"match\": \"\\\\.ck$\",\n        \"cmd\": \"chuckfmt -i ${file}\"\n      }\n    ]\n  }\n}\n```\n\nNow every `.ck` file will be formatted automatically when you save.\n\n## 🐱 Neovim Integration\n\nUsing [conform.nvim](https://github.com/stevearc/conform.nvim):\n\n```lua\nrequire(\"conform\").setup({\n  formatters_by_ft = {\n    chuck = { \"chuckfmt\" },\n  },\n  formatters = {\n    chuckfmt = {\n      command = \"chuckfmt\",\n      stdin = true,\n    },\n  },\n})\n```\n\n## 🔧 How it works\n\n1. Reads ChucK source code (from file or stdin)\n2. Applies pre-processing (e.g., temporarily modifies `@import` for clang-format compatibility)\n3. Pipes it through `clang-format` with appropriate options\n4. Applies regex-based transforms to fix ChucK-specific operators (comments are preserved)\n5. Outputs the result (to stdout or overwrites the file with `-i`)\n\n## 🧪 Testing\n\nA test script is included to verify formatting doesn't break ChucK syntax:\n\n```bash\npython scripts/test_chuckfmt_syntax.py \\\n    --src /path/to/chuck/examples \\\n    --format-cmd \"chuckfmt -i {}\" \\\n    --chuck /path/to/chuck \\\n    --chuck-args=--silent \\\n    --timeout 0.5 \\\n    --jobs 12\n```\n\nThis runs syntax checks on all `.ck` files before and after formatting, reporting any regressions.\n\nI've run this against the [official ChucK examples](https://chuck.stanford.edu/doc/examples/) and it passes without issues.\n\n## 📜 License\n\n[MIT](LICENSE) © Lejun Min\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faik2mlj%2Fchuckfmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faik2mlj%2Fchuckfmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faik2mlj%2Fchuckfmt/lists"}