Skip to content

BetterDecompiler v2: bring-your-own-key, multi-provider, cross-platform rewrite - #2

Merged
officialmelon merged 4 commits into
mainfrom
claude/intelligent-bardeen-p1ajr7
Oct 8, 2026
Merged

officialmelon merged 4 commits into
mainfrom
claude/intelligent-bardeen-p1ajr7

Conversation

@officialmelon

Copy link
Copy Markdown
Owner

Replaces the Python/Flask server and its g4f proxy with a single Go program for Windows, macOS and Linux. It has no third-party dependencies, and v2.0.0 is already published from this branch: https://github.com/officialmelon/BetterDecompiler/releases/tag/v2.0.0

What changes

  • Bring your own key. Anthropic, OpenAI, Gemini, OpenRouter, Groq, DeepSeek, Mistral, xAI, any OpenAI-, Anthropic- or Gemini-compatible endpoint, and local Ollama or LM Studio. Providers are tried in order if one fails. With no key, an offline renamer infers names from Roblox API usage.
  • Rename mode (default). The AI returns a small JSON map of names. A scope-resolving Luau parser (internal/luau) applies it and re-checks that every identifier still refers to the same variable, so behavior can't change. rewrite (full AI rewrite) and offline modes are also available.
  • Speed. Results are cached in memory and on disk, identical concurrent requests share one AI call, large scripts are split at top-level statements and processed in parallel, and connections are pooled. Retries use backoff and honor Retry-After.
  • Interfaces. A new executor client (client/betterdecompiler.lua) hooks decompile, so Dex picks it up automatically, and keeps the v1 decompile(script, bool, url) signature. There is also a built-in web UI, a CLI (clean for files, folders and stdin; setup; providers; models; config) and a JSON API. The v1 POST /fix_script endpoint is kept, so dex_betterdecompiler.lua works unchanged.
  • Security. The server listens only on loopback by default. It rejects cross-origin and non-JSON POSTs, checks the Host header against DNS rebinding, refuses to listen on other interfaces without a token, and writes the config file readable only by the owner.
  • Removed: flask_ai_server.py and main.lua (replaced by client/betterdecompiler.lua).
  • CI and releases. Tests run on all three OSes, plus a Lua/Luau/end-to-end job. The release workflow builds 7 targets and SHA-256 checksums. It runs on a v* tag, a commit titled Release vX.Y.Z, or a manual run.

Testing

None of these tests need an API key:

  • go test -race ./... passes on Ubuntu, macOS and Windows in CI.
  • internal/mockllm emulates the OpenAI, Anthropic and Gemini APIs, including bad keys, 429/5xx with retries, refusals, truncated output and Anthropic fallback blocks.
  • Renames are checked by executing programs under Lua 5.1 and the official Luau VM before and after randomized renaming.
  • lua5.1 client/tests/run.lua tests the client in a fake executor environment.
  • scripts/e2e.sh runs the real server, the mock provider and the Lua client together, plus a v1-style /fix_script request, a folder clean through the CLI, and an offline server with a token.
  • The web UI was checked in Chromium in light, dark and mobile layouts.
  • The published release was downloaded, its checksum verified, and the Linux binary run.

Not yet tested against real provider APIs (no keys were available). Some default model IDs come from web searches and may need adjusting; betterdecompiler models -p <provider> lists the valid ones.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RSCSfZjQxPkNn9HP29NmFV


Generated by Claude Code

claude added 4 commits October 8, 2026 04:16
Replace the Python/Flask + g4f proxy with a single dependency-free Go
binary for Windows, macOS and Linux:

- Bring your own key: Anthropic, OpenAI, Gemini, OpenRouter, Groq,
  DeepSeek, Mistral, xAI, any OpenAI/Anthropic/Gemini-compatible
  endpoint, plus local Ollama and LM Studio. Offline renamer when no
  key is configured.
- Rename mode (default): the AI returns a compact JSON name map that a
  scope-resolving Luau parser applies and verifies, so behavior cannot
  change. Rewrite and offline modes also available.
- Caching (memory + disk), request de-duplication, parallel chunking,
  retries with backoff and a provider fallback chain.
- Local HTTP server with web UI, JSON API and the v1 /fix_script
  endpoint; Origin/Content-Type/Host checks and optional token.
- CLI for files, folders and stdin; interactive setup.
- New executor client that hooks decompile and keeps the v1 signature.
- Tests need no API key: a mock provider emulates all three APIs, and
  renames are checked by executing code under Lua 5.1 and the Luau VM.
- CI on all three OSes and a tag-triggered release workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RSCSfZjQxPkNn9HP29NmFV
Go 1.22 (the go.mod minimum) links macOS test binaries without an
LC_UUID load command, which current macOS refuses to load, failing the
macOS job. Release binaries for macOS would hit the same problem, so CI
and the release workflow now use the latest stable Go. Also move to the
Node 24 versions of actions/checkout and actions/setup-go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RSCSfZjQxPkNn9HP29NmFV
A manual (workflow_dispatch) run now creates the version tag on the
commit it runs on, so a release can be cut without pushing a tag first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RSCSfZjQxPkNn9HP29NmFV
Publish BetterDecompiler v2.0.0. The release workflow now also runs
when a commit titled "Release vX.Y.Z" is pushed, so a version can be
published without pushing a tag; it creates the tag on that commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RSCSfZjQxPkNn9HP29NmFV
@officialmelon
officialmelon merged commit c71f728 into main Oct 8, 2026
9 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