Changelog: see CHANGELOG.md. Release notes: docs/RELEASE_NOTES_1.3.0.md.
BF6Portal Tool is a standalone visual logic editor for Battlefield 6 Portal, built with Electron + Google Blockly. It aims to replicate the Portal Rules Editor workflow in a desktop app, with offline editing and quality-of-life tooling.
- Workspace editor (Blockly): build rule logic visually.
- Toolbox search (header): quickly filter blocks by name.
- Workspace controls (header): zoom in/out, reset zoom, zoom-to-fit, and trash/delete selected block.
- Presets (header dropdown):
- 3 built-in presets (locked)
- save your own presets, overwrite safely, delete user presets
- Import / Export:
- load
.json(Blockly workspace JSON) and legacy.xml - export Portal JSON (best-effort compatibility; imports into the official Portal editor for supported templates)
- TypeScript snapshot export + TypeScript import (round-trip the workspace state)
- load
- Variables: a dedicated VARIABLES toolbox category with:
- “New / Manage Variables”
- pre-filled GET/SET templates for existing variables
- Collections / Bookmarks: convert a selected stack into an offscreen definition and keep a compact call/bookmark block. Collections also appear in the COLLECTIONS toolbox category so you can drag them onto the canvas (similar to subroutine call blocks).
- Navigation (“teleport”): right-click jump helpers (MOD / owning rule / stack root / variables / subroutine call ⇄ definition).
- Help: Help modal (Block reference from
bf6portal_blocks.json, Guides for getting started, Portal concepts, rules editor, variables, official Portal, related tools, terminal, template updates) and right-click per-block help. - Terminal: Drawer with shell and Ask about the app (type a question, click Ask — uses Gemini or your configured assistant; no TTY required). Optional: run “get the templates” to fetch latest preset rules from bfportal.gg.
- Code Preview drawer: resizable bottom drawer that shows a TypeScript representation of the current workspace state.
The presets dropdown includes 3 locked built-ins plus a simple user preset system (save / overwrite / delete) so you can snapshot and re-use setups.
The VARIABLES toolbox category is designed to be “template-friendly”: it includes management buttons, quick GET/SET templates, and compatibility blocks used by community templates.
The bottom drawer shows a TypeScript representation of your current workspace state, and can be resized so it doesn’t fight for screen space.
Large workspaces can get noisy quickly — collapsing blocks helps keep “library” definitions (subroutines/collections) compact and lets you focus on the active rule chain.
- Node.js (v18+ recommended)
- Python 3.8+ (only needed for some helper scripts)
- Clone:
git clone https://github.com/neuro-1977/BF6Portal-Tool.git
cd BF6Portal-ToolAlternate mirror (GitLab):
git clone https://gitlab.com/Neuro1977/bf6-portal-tool.git
cd BF6Portal-Tool- Install dependencies:
npm install
cd web_ui
npm install
cd ..- Run the app:
npm startThe project has two main parts:
- Electron main process:
electron-main.js - Renderer (Blockly editor):
web_ui/(TypeScript + webpack)
cd web_ui
npm run buildnpm run distThe installer output is written to dist/.
Utilities live in tools/ (used to generate/inspect blocks/toolboxes from Portal data). For fast codebase/docs search (e.g. for agents or terminal), use fastgrep: npm run search -- "<pattern>" [directory] [--max N] — uses ripgrep when available, else a Node fallback. See docs/DESIGN.md (§5).
When andy6170 publishes new template packages (Rush, Conquest, Breakthrough) on bfportal.gg, the MEGA links can change. To update the built-in presets without manual URL copying:
-
Install megatools (e.g.
apt install megatoolsor use WSL on Windows). -
Run the sync script with
--allso it fetches the three bfportal.gg experience pages, parses the current “Spatial editor map file and package” MEGA link and version for each, then downloads each zip, extracts only the Portal rules JSON, and cleans up:npm run sync:andy-templates -- --all
If the MEGA links or versions change on bfportal.gg, the next
--allrun uses the new links and writes new filenames (e.g.custom_rush_V2.1.json). After that, updateweb_ui/src/presets.tsandweb_ui/webpack.config.jsif the version/filename changed, then rebuild.You can still sync a single template with an explicit URL and version:
npm run sync:andy-templates -- --template rush --url "https://mega.nz/file/..." --version V2.0
See docs/DESIGN.md for the full flow.
Blocks and toolbox are generated from portal-docs. To refresh them locally:
npm run update:blocksThis runs, in order: download_resources.py → extract_selection_lists.py → generate_full_blocks.py → update_blocks_db.py → fill_toolbox_gaps.py. In CI, a scheduled pipeline can run the same pipeline; if you set the BLOCK_UPDATE_GIT_PUSH_TOKEN CI variable (and create a schedule in GitLab), the job will commit and push changes when portal-docs has updates. See .gitlab-ci.yml (job block_updates) and docs/DESIGN.md.
Related tools and docs: In-app Help → Guides includes Related tools, Rules editor basics, Variables guide, Official Portal compatibility, Terminal & assistants, and Template updates. Use Ask about the app in the Terminal for quick answers about the UI and presets.
- Block help/tooltips and Portal data are derived from Portal Docs by the Battlefield Portal Community:
- The Battlefield Portal Community org hosts portal-docs (automated docs from portal.battlefield.com), PortalScriptingExamples, PortalSDK, and other tools. This editor uses portal-docs; new blocks added by the official Battlefield 6 Portal system are supported via placeholder block registration when importing templates—you can update
bf6portal_blocks.jsonand regenerate blocks/toolbox to add first-class support for new block types.
To make the repo easier to find on GitHub, add the recommended topics (e.g. battlefield-portal, blockly, electron) via Repo → About → Topics. See .github/TOPICS.md for the full list.
ISC




