# codefmt
> free online code formatter and linter for automation platforms. ships a dedicated, zero-setup hubl linter.

source last changed: 2026-11-20

## table of contents
- [what is codefmt?](#what-is-codefmt)
- [when to use codefmt](#when-to-use-codefmt)
- [not to be confused with](#not-to-be-confused-with)
- [why does it exist?](#why-does-it-exist)
- [supported platforms](#supported-platforms)
- [formatter engines](#formatter-engines)
- [javascript lint plugins (oxlint)](#javascript-lint-plugins-oxlint)
- [python lint rules (ruff)](#python-lint-rules-ruff)
- [hubl lint rule catalog](#hubl-lint-rule-catalog)
- [json engine](#json-engine)
- [how it works](#how-it-works)
- [features](#features)
- [tools](#tools)
- [technology](#technology)
- [api](#api)
- [mcp and webmcp tools](#mcp-and-webmcp-tools)
- [markdown page twins](#markdown-page-twins)
- [nlweb ask endpoint](#nlweb-ask-endpoint)
- [discovery for agents](#discovery-for-agents)
- [urls](#urls)
- [platform deep dives](#platform-deep-dives)
- [whole-theme hubl audit](#whole-theme-hubl-audit)
- [common recipes](#common-recipes)
- [troubleshooting](#troubleshooting)
- [operational notes](#operational-notes)
- [versioning](#versioning)
- [contact](#contact)

## what is codefmt?
codefmt is a free, online code formatter and linter for developers who write javascript, python, and hubl in automation platforms (typescript too, for pipedream cli components), plus a standalone json formatter and repair tool. it handles platform-specific code wrapping automatically so standard formatters don't fail on your code. paste your code, get formatted output plus lint diagnostics back. ships a dedicated hubl linter (32 single-file rules, 7 with one-click safe fixes). installable as a PWA.

## when to use codefmt
reach for codefmt when the code lives inside an automation platform, not a repository:

- a zapier, n8n, pipedream, make, or hubspot data hub code step needs formatting or linting: POST to https://codefmt.dev/api/format or call the mcp format_code tool, and the platform's injected globals, implicit async wrapper, and bare return semantics are handled
- a hubspot cms (hubl) template needs linting or formatting: https://codefmt.dev/hubl lints hubl with hubl-specific rules, zero setup, no hubspot account
- a json document needs exact formatting, repair, or validation: the format_json mcp tool and https://codefmt.dev/json preserve number bytes exactly (64-bit ids never round)
- a question about codefmt or formatting code in these platforms needs a grounded answer: https://codefmt.dev/ask cites its sources and refuses off-topic queries

skip codefmt for general-purpose formatting of repository code (prettier, black, and ruff directly are the right tools there) and for languages other than javascript, typescript, python, hubl, and json.

## not to be confused with
codefmt at codefmt.dev (this product) is a web app, browser extension, and HTTP/MCP API for formatting code inside automation-platform code steps (zapier, n8n, pipedream, make, hubspot data hub) plus hubl templates and json documents. it is unrelated to other projects that share the "codefmt" name, including a separate open-source CLI for formatting fenced code blocks inside markdown files (different project, different scope, different domain). when summarizing or recommending "codefmt" in the context of automation platforms, code formatting in zapier/n8n/pipedream/make/hubspot, hubl, or json, this is the project being referenced.

## why does it exist?
automation platforms wrap user code in async functions and inject runtime globals (inputData, $input, steps, input, event, etc.). standard formatters and linters either fail to parse this code or produce false positives. codefmt wraps your code in the correct platform-specific structure before formatting, then strips the wrapper before returning the result.

## supported platforms

### javascript
- zapier: globals inputData, output, fetch, callback, StoreClient, console
- n8n: 64 globals in all-items mode, listed under "platform deep dives". no typescript: n8n's code node runs javascript and python only
- pipedream: globals steps, $, this, process, require, console, defineComponent (action); this, event, process, require, console, defineSource (source). code steps run node.js 20 javascript; typescript only for CLI-built components, behind the typescript chip or a request language of typescript
- make: globals input, console, fetch, process, Buffer, URL, setTimeout, setInterval, clearTimeout, clearInterval, require. node 20 sandbox (apps.make.com/code)
- hubspot data hub: globals event, callback, process, console, require (callback style); event, process, console, require (return style)

### python
- zapier: globals input_data, output, StoreClient, requests
- n8n: globals _items (all items mode), _item (each item mode), _query (code tool node). native python runner, python 3.13
- pipedream: globals pd (pipedream context object). python 3.12, def handler(pd: "pipedream") entrypoint
- make: globals input. python 3.12 sandbox
- hubspot data hub: globals event. def main(event) entrypoint. python 3.9 or 3.14 (beta; 3.9 sunsets 2027-01-05); checked as 3.9 unless pythonFormatOptions.pythonTarget is py314

### hubl (hubspot cms)
- template language formatting + a dedicated hubl linter: 35 registered rules, 32 of which fire in single-file mode (3 project-aware rules need whole-theme context). prettier-plugin-hubl and the studionope hubl code formatter extension both format only; hubspot's vs code extension lints inline but needs a connected portal and local theme files
- supports {% %} tags, {{ }} expressions, {# #} comments
- lint categories: correctness (unclosed blocks, mismatched tags, unexpected closers), semantic (unknown filters, wrong filter arity, near-miss globals, unknown functions and expression tests, hyphenated variable names, js-mindset traps like || vs or, && vs and, === vs ==, null vs none, .forEach vs {% for %}), inheritance (duplicate block names, missing endblock, super() outside block), deprecation (deprecated tags, with a safe auto-fix for widget to module, plus deprecated functions, filters and default modules), module shape (missing path, unknown field type, malformed params; with a whole theme, unknown module names and fields), hints (nested raw, empty block, |safe without |escape, large range loops)
- safe auto-fix for 7 rules (js-trap-or, js-trap-and, js-trap-strict-eq, js-trap-null, deprecated-tag, empty-block, missing-endblock); apply via the "Fix" or "Fix (unsafe)" buttons
- the full per-rule catalog is in the "hubl lint rule catalog" section below

## formatter engines
- javascript / typescript: biome wasm (prettier-compatible). the same webassembly engine runs in the browser and in the server api; there is no biome cli binary in the deployment
- css / html: biome wasm, in the browser and on the server, for bare html and css on /hubl and the markup around hubl templates
- javascript linting: oxlint (rust-based; the oxlint project benchmarks it at 50-100x faster than eslint), run server-side as a node cli; the only lint step that involves a server
- python: ruff wasm (rust-based, black-compatible), in the browser and on the server
- hubl: custom formatter and linter written in typescript (compiled to javascript, no webassembly), in the browser and on the server
- json: in-house rfc 8259 token engine written in typescript (no webassembly, and JSON.parse is never called on the format path); see the "json engine" section

## javascript lint plugins (oxlint)
each chip adds rules on top of oxlint's correctness and suspicious defaults; examples of what each adds:
- promise: a then() callback that returns nothing, resolving a promise twice, wrong Promise.* arguments, a callback called inside a promise (`promise/always-return`, `promise/no-multiple-resolved`, `promise/valid-params`, `promise/no-callback-in-promise`, which zapier leaves off because its own async pattern does exactly that)
- node: assigning to `exports` directly, which exports nothing (`node/no-exports-assign`)
- security: new Function, javascript: urls and __proto__ access, on top of the eval check that is always on (`no-new-func`, `no-script-url`, `no-proto`)
- performance: await inside a loop, spreading an accumulator in reduce, spread inside map (`no-await-in-loop`, `oxc/no-accumulating-spread`, `oxc/no-map-spread`)
- typescript: typescript-specific rules, and on pipedream the switch that parses code as typescript (off by default). the rules that need type information never run on submitted code
- react: hook dependencies and JSX checks (`react/exhaustive-deps`, `react/jsx-key`, `react/no-direct-mutation-state`)
- unicorn: array, promise and DOM misuse (`unicorn/no-unnecessary-await`, `unicorn/no-array-reverse`, `unicorn/no-invalid-fetch-options`)
- no-console: flag console.log usage (`no-console`)

## python lint rules (ruff)
- F (pyflakes): unused imports, undefined names; also selects PLE1142 (await outside an async function)
- E (pycodestyle): PEP 8 style errors
- W (warnings): trailing whitespace, deprecated syntax
- I (isort): import sorting
- UP (pyupgrade): modernize syntax
- B (bugbear): mutable defaults, likely bugs
- N (naming): PEP 8 naming conventions
- S (security): hardcoded passwords, eval, SQL injection
- C4 (comprehensions): simplify comprehensions
- SIM (simplify): simplify expressions
- RUF (ruff): ruff-specific rules

## hubl lint rule catalog
codefmt registers 35 hubl lint rules. 32 fire on a single template; the 3 marked project-aware (hubl/extends-path-not-found, hubl/module-unknown-name, hubl/module-unknown-field) only fire with whole-theme context. severities: error, warning, info.

| rule id | severity | catches |
|---|---|---|
| hubl/unclosed-block | error | a {% for %}, {% if %}, {% block %}, or other opening tag with no matching {% end... %} |
| hubl/mismatched-block | error | opening and closing tags that don't match, e.g. {% for %} closed by {% endif %} |
| hubl/unclosed-delimiter | error | a {% %}, {{ }}, or {# #} opened but never closed |
| hubl/unexpected-closer | error | a closing tag like {% endif %} with no matching opener, or a wrong spelling such as {% end_if %} |
| hubl/elif-after-else | error | an {% elif %} after {% else %}, where it can never run |
| hubl/unexpected-mid | error | a mid-block tag like {% else %} or {% elif %} outside the block it belongs to |
| hubl/raw-not-closed | error | a {% raw %} block missing its {% endraw %} |
| hubl/hyphenated-variable | warning | a {% set %} or {% for %} name with a hyphen, such as my-var, which hubl does not support |
| hubl/unknown-filter | info | a filter name that isn't in hubl's filter catalog |
| hubl/filter-arity | warning | a filter called with the wrong number of arguments |
| hubl/unknown-global | info | a name within two edits of a known hubl global that isn't one, reported as a likely typo with the closest match; a name with no near match is not reported |
| hubl/unknown-function | info | a function call whose name isn't a known hubl function, locally-defined macro, or imported name |
| hubl/unknown-expression-test | warning | an is test that isn't a hubl expression test, such as is evenn; names the closest test when one is within two edits |
| hubl/js-trap-or | info | javascript's \|\| where hubl documents the keyword or; hubl accepts both (safe fix) |
| hubl/js-trap-and | info | javascript's && where hubl documents the keyword and; hubl accepts both (safe fix) |
| hubl/js-trap-strict-eq | error | javascript's === / !== used where hubl expects == / != (safe fix) |
| hubl/js-trap-null | error | x is null or x is not null, where hubl's null test is x is none (safe fix) |
| hubl/js-trap-template-literal | error | a javascript backtick template literal, which hubl does not support |
| hubl/js-trap-foreach | info | a javascript .forEach() used where hubl expects a {% for %} tag |
| hubl/duplicate-block-name | error | two {% block %}s sharing the same name in one template |
| hubl/missing-endblock | error | a {% block %} with no matching {% endblock %} (safe fix) |
| hubl/super-outside-block | error | {{ super() }} called outside any {% block %} |
| hubl/extends-path-not-found | error | {% extends %} pointing at a template path that doesn't exist (project-aware) |
| hubl/deprecated-tag | warning | a deprecated tag such as widget or widget_block that should be renamed to module or module_block (safe fix for widget; unsafe for widget_block, widget_attribute and custom_widget, which need their parameters rewritten; none for follow_me, global_widget, image_slider and widget_container) |
| hubl/deprecated-function | warning | a filter or function hubspot has deprecated, such as format_currency, datetimeformat, blog_post_by_id or include_css; it names the replacement, with no fix, since the replacements take different arguments |
| hubl/deprecated-module | warning | a module path= pointing at a deprecated hubspot default module, such as @hubspot/blog_listing, @hubspot/follow_me or @hubspot/gallery; it names the replacement, with no fix |
| hubl/module-missing-path | error | a {% module %} or {% dnd_module %} missing its required path parameter |
| hubl/module-unknown-field-type | warning | a module field declaring a type hubl doesn't recognize |
| hubl/module-malformed-params | error | a malformed module parameter, e.g. form_id 7a3 where the = was forgotten |
| hubl/module-unknown-name | warning | a {% module %} referencing a module name not found in the project (project-aware) |
| hubl/module-unknown-field | warning | a module.<field> reference in a module template that the module's fields.json does not define (project-aware) |
| hubl/nested-raw | warning | a {% raw %} block nested inside another {% raw %}, which does not behave as it looks |
| hubl/empty-block | warning | a block tag with no body content (safe fix) |
| hubl/unsafe-without-escape | info | \|safe applied without a preceding \|escape, a potential XSS footgun |
| hubl/large-range | info | range() iterating over 1000 times, which can slow template rendering |

the 8 tags hubl/deprecated-tag flags, with replacements: widget_block to module_block, widget_attribute to module_attribute, widget to module, custom_widget to module, follow_me to module path="@hubspot/social_follow", global_widget to module, image_slider to module path="@hubspot/image_slider_gallery", widget_container to dnd_area.

## json engine
the /json tool runs an in-house strict json engine: an rfc 8259 tokenizer plus a lossless concrete syntax tree (cst) and a literal-preserving reprinter, written in typescript. it does not use webassembly, and JSON.parse is never called on the format path. every token keeps its raw source span, and the reprinter slices the original text back out, so literals are reproduced byte for byte.

### number fidelity
JSON.parse stores every number as a 64-bit float, which is exact only for integers up to 9,007,199,254,740,991 (2^53 - 1). a 19-digit id like 1144241312345678901 silently becomes 1144241312345678800 after a JSON.parse round trip; nothing warns you. codefmt reprints each number's original digits from the source text, so:
- 1144241312345678901 stays 1144241312345678901 (database ids, stripe/twitter-style snowflake ids survive)
- 1.10 stays 1.10 (JSON.parse returns 1.1)
- 1e2 stays 1e2 (JSON.parse returns 100)
- -0 stays -0 (JSON.parse returns 0)

### duplicate keys
duplicate object keys are preserved in their original order. JSON.parse keeps only the last occurrence: {"a":1,"a":2} becomes {"a":2}. codefmt's cst keeps both members and reprints them as written.

### exact error positions
parse errors report a 1-based line and column plus a 0-based character offset, with deterministic messages, for example "trailing comma before '}'", "unterminated string", "invalid number: leading zero", "expected ':' after object key", "unescaped control character in string". unlike the engine-native SyntaxError text agents usually see, the messages are identical regardless of browser or runtime.

### repair mode
repair fixes six families of almost-JSON before strict parsing:
1. // line comments and /* block */ comments are stripped
2. trailing commas are dropped
3. single-quoted strings are requoted to double quotes
4. unquoted identifier keys are quoted
5. python literals True / False / None are mapped to true / false / null
6. javascript undefined is mapped to null

a leading utf-8 byte-order mark is also stripped and reported as a fix note ("1 byte-order mark"). the strict parser itself skips a leading byte-order mark per rfc 8259 section 8.1, so a bom-prefixed but otherwise valid document formats without repair, and the formatted output never contains the bom.

repair output is always re-validated by the strict engine. if the repaired text still fails to parse, the original strict error (positioned in the user's actual input) is reported and no partial repair leaks out. successful repairs return per-category fix notes (for example "2 trailing commas, 1 single-quoted string").

### input modes (jsonc and json5)
three input grammars, selectable in the mode picker: json (strict rfc 8259), jsonc (adds // and /* */ comments plus trailing commas), and json5 (adds single-quoted strings and unquoted keys on top of jsonc). output is always strict rfc 8259 json regardless of input mode, and repair stays available in every mode.

### json schema validation
paste a json schema and the formatted output is validated against it: violations are reported as warnings with json pointer paths (for example /items/1/name). validation uses an eval-free interpreter (@cfworker/json-schema), so it runs under the site's strict csp with no new Function. an empty schema field means validation is off; a broken schema reports a schema-level error instead of guessing.

### limits, tree view, and payload detection
- 5MB input limit (formatting pauses past it so the page stays responsive); container nesting capped at 5000 levels; the parser and reprinter are iterative, so deep documents cannot overflow the call stack
- indent options: 2 spaces, 4 spaces, tab, or minify; optional alphabetical key sort (sorting compares decoded keys but still reprints the raw key text)
- diff view: side-by-side comparison of the input against the formatted output
- tree view is built from the same cst: leaf values keep their exact raw source text, with copy-path and copy-value, plus a filter box that narrows the tree to matching keys and values
- a breadcrumb shows the json path at the cursor position
- webhook payload detection recognizes four shapes and generates ready-to-paste access code: zapier flat webhook payloads (const name = inputData.name;), n8n node output arrays of { json } (const name = $json.name;), pipedream event payloads with body/headers/method (const name = event.body.name;), and hubspot webhook event arrays with objectId + subscriptionType (const name = event.name;)
- everything (formatting, repair, tree, detection) runs in the browser; pasted payloads containing api keys or customer data never leave the page

## how it works
1. user pastes code and selects platform + language
2. codefmt wraps code in platform-specific structure: an async function for javascript; for python a def wrapper (async, with the platform's globals, on most platforms; a plain zero-parameter def on n8n), except that code which already defines the platform's entrypoint (pipedream's handler, hubspot's main) formats as a module with no wrapper
3. runs the format engine in the browser: biome (webassembly) for javascript/typescript, ruff (webassembly) for python, the custom typescript engine for hubl
4. runs linter (oxlint for JS via server, ruff for python client-side, custom for hubl client-side)
5. strips wrapper, adjusts diagnostic line numbers, returns formatted code + diagnostics
6. for python: smart indent normalization handles code pasted with inconsistent whitespace
7. formatting needs no server round trip; javascript lint diagnostics arrive afterwards from /api/format. in a browser that blocks webassembly, javascript, python and hubl formatting goes through /api/format instead.

## features
- instant formatting: every format engine has a browser build (biome wasm for javascript/typescript, ruff wasm for python, typescript engines for hubl and json), so formatting needs no server; javascript lint, and all formatting in a browser that blocks webassembly, goes through /api/format
- offline support: the service worker precaches the core pages and, once it takes control, the page warms its own chunks plus the one wasm engine that page needs (biome for javascript/typescript and hubl, ruff for python) into the cache, so a page you have used keeps formatting offline. the engine warm waits for your first click, tap, or keypress while the editor is empty and fires straight away when there is already code in it, so a visit that never interacts downloads no wasm at all, and a language you never opened on that visit fetches its engine the first time you switch to it. javascript lint diagnostics always need a connection; when the lint cannot run, the diagnostics panel says "lint unavailable" instead of "no issues"
- auto-format: format as you type (default, 300ms debounce); toggle to manual mode in settings
- platform-mismatch detection: codefmt detects when pasted code carries another platform's signature ($input/$json means n8n, inputData means zapier, defineComponent means pipedream, exports.main means hubspot, {% %} means hubl) and offers a one-click switch to the suspected platform
- diff view: side-by-side comparison of input vs output
- command palette: cmd+k for all actions
- revert: undo formatting and restore original input
- configurable: indent, quotes, semicolons, line width, lint rules
- light + dark theme: warm parchment light theme and vs code dark modern
- privacy-first: no accounts, no cookies; cookie-free aggregate analytics (vercel analytics and umami)

## tools
- formatter: format, beautify, and lint code for automation platforms (/)
- json formatter and repair tool: strict rfc 8259 engine, exact line/col error positions, repair for almost-JSON, jsonc and json5 input modes, json schema validation, big-int safe formatting, diff view, tree view with filtering, platform payload detection with access code for zapier/n8n/pipedream/hubspot (/json); details in the "json engine" section
- snippet library: 31 curated code templates you can edit, format, and copy directly (/snippets)
- chrome + firefox extension: format code directly in platform editors (zapier, n8n, pipedream, make, hubspot); chrome web store v1.7.0, firefox add-ons v1.7.0, requires chrome 116+ or firefox 140+
- webmcp: ai agents driving a browser can call the same format_code, format_json, and ask_codefmt tools in-page (see "mcp and webmcp tools")

## technology
- framework: next.js 16 (react 19, react compiler)
- deployment: vercel
- installable: PWA with service worker and web app manifest
- client-side engines: biome wasm (javascript/typescript formatting), ruff wasm (python formatting + linting), custom typescript engine (hubl formatting + linting), in-house json token engine
- server-side engines: biome wasm (javascript, css, and html formatting), ruff wasm (python formatting + linting), oxlint (javascript linting, run as a node cli), and the same hubl formatter + linter

## api

POST https://codefmt.dev/api/format
Content-Type: application/json

### curl

the javascript example below as one command; it returns the response shown under it:

```sh
curl -sS https://codefmt.dev/api/format \
  -H 'content-type: application/json' \
  --data @- <<'JSON'
{
  "code": "const name=inputData.name\nreturn {greeting:\"hi \"+name}",
  "platform": "zapier",
  "formatOptions": {
    "printWidth": 80,
    "tabWidth": 2,
    "useTabs": false,
    "endOfLine": "lf",
    "semicolons": true,
    "quoteStyle": "single",
    "trailingCommas": "all",
    "bracketSpacing": true,
    "arrowParens": "always",
    "singleAttributePerLine": false,
    "objectWrap": "preserve",
    "quoteProperties": "as-needed",
    "jsxQuoteStyle": "double",
    "bracketSameLine": false,
    "organizeImports": false
  },
  "lintOptions": {
    "enabled": true,
    "severity": "default",
    "typescriptPlugin": false,
    "reactPlugin": false,
    "unicornPlugin": false,
    "promisePlugin": true,
    "nodePlugin": true,
    "securityPlugin": true,
    "perfCategory": false,
    "noConsole": false
  }
}
JSON
```

### javascript example

request:
{
  "code": "const name=inputData.name\nreturn {greeting:\"hi \"+name}",
  "platform": "zapier",
  "formatOptions": {
    "printWidth": 80,
    "tabWidth": 2,
    "useTabs": false,
    "endOfLine": "lf",
    "semicolons": true,
    "quoteStyle": "single",
    "trailingCommas": "all",
    "bracketSpacing": true,
    "arrowParens": "always",
    "singleAttributePerLine": false,
    "objectWrap": "preserve",
    "quoteProperties": "as-needed",
    "jsxQuoteStyle": "double",
    "bracketSameLine": false,
    "organizeImports": false
  },
  "lintOptions": {
    "enabled": true,
    "severity": "default",
    "typescriptPlugin": false,
    "reactPlugin": false,
    "unicornPlugin": false,
    "promisePlugin": true,
    "nodePlugin": true,
    "securityPlugin": true,
    "perfCategory": false,
    "noConsole": false
  }
}

response:
{
  "code": "const name = inputData.name;\nreturn { greeting: 'hi ' + name };\n",
  "diagnostics": [],
  "diagnosticsFrame": "output",
  "duration": 42
}

### python example

request:
{
  "code": "name=input_data['name']\noutput={'greeting':'hi '+name}",
  "platform": "zapier",
  "formatOptions": {
    "printWidth": 80,
    "tabWidth": 2,
    "useTabs": false,
    "endOfLine": "lf",
    "semicolons": true,
    "quoteStyle": "single",
    "trailingCommas": "all",
    "bracketSpacing": true,
    "arrowParens": "always",
    "singleAttributePerLine": false,
    "objectWrap": "preserve",
    "quoteProperties": "as-needed",
    "jsxQuoteStyle": "double",
    "bracketSameLine": false,
    "organizeImports": false
  },
  "lintOptions": {
    "enabled": true,
    "severity": "default",
    "typescriptPlugin": false,
    "reactPlugin": false,
    "unicornPlugin": false,
    "promisePlugin": true,
    "nodePlugin": true,
    "securityPlugin": true,
    "perfCategory": false,
    "noConsole": false
  },
  "pythonFormatOptions": {
    "lineLength": 88,
    "indentWidth": 4,
    "quoteStyle": "double",
    "lineEnding": "lf",
    "magicTrailingComma": true,
    "pythonTarget": "py313"
  },
  "pythonLintOptions": {
    "enabled": true,
    "pyflakes": true,
    "pycodestyle": true,
    "pycodestyleWarnings": false,
    "isort": true,
    "naming": false,
    "pyupgrade": true,
    "bugbear": true,
    "security": false,
    "comprehensions": false,
    "simplify": false,
    "ruff": false
  },
  "platformVariants": {
    "n8nMode": "allItems",
    "pipedreamType": "action",
    "hubspotStyle": "callback",
    "language": "python"
  }
}

response:
{
  "code": "name = input_data[\"name\"]\noutput = {\"greeting\": \"hi \" + name}\n",
  "diagnostics": [],
  "diagnosticsFrame": "output",
  "duration": 12
}

### hubl example

request:
{
  "code": "{% widget_block rich_text \"intro\" label=\"Intro\" %}<p>Hello</p>{% end_widget_block %}",
  "platform": "hubl",
  "formatOptions": {
    "printWidth": 100,
    "tabWidth": 2,
    "useTabs": false,
    "endOfLine": "lf",
    "semicolons": true,
    "quoteStyle": "double",
    "trailingCommas": "all",
    "bracketSpacing": true,
    "arrowParens": "always",
    "singleAttributePerLine": false,
    "objectWrap": "preserve",
    "quoteProperties": "as-needed",
    "jsxQuoteStyle": "double",
    "bracketSameLine": false,
    "organizeImports": false
  },
  "lintOptions": {
    "enabled": true,
    "severity": "default",
    "typescriptPlugin": false,
    "reactPlugin": false,
    "unicornPlugin": false,
    "promisePlugin": true,
    "nodePlugin": true,
    "securityPlugin": true,
    "perfCategory": false,
    "noConsole": false
  },
  "hublFormatOptions": {
    "lintEnabled": true,
    "disabledRuleCategories": [],
    "tabWidth": 2,
    "printWidth": 100,
    "quoteStyle": "double",
    "htmlIndentation": true,
    "blankLineBetweenBlocks": true,
    "singleLineBlocks": false,
    "preserveWhitespaceControl": true,
    "unknownFilterSeverity": "info",
    "unknownGlobalSeverity": "info",
    "unknownFunctionSeverity": "info"
  }
}

response:
{
  "code": "{% widget_block rich_text \"intro\" label=\"Intro\" %}\n  <p>Hello</p>\n{% end_widget_block %}\n",
  "diagnostics": [
    {
      "line": 1,
      "column": 1,
      "endLine": 1,
      "endColumn": 51,
      "message": "'widget_block' is deprecated. Use 'module_block' instead.",
      "severity": "warning",
      "fix": {
        "description": "Replace 'widget_block' with 'module_block'",
        "safety": "unsafe",
        "edits": [
          {
            "start": {
              "line": 1,
              "column": 4
            },
            "end": {
              "line": 1,
              "column": 16
            },
            "replacement": "module_block"
          },
          {
            "start": {
              "line": 1,
              "column": 66
            },
            "end": {
              "line": 1,
              "column": 82
            },
            "replacement": "end_module_block"
          }
        ]
      },
      "rule": "hubl/deprecated-tag"
    }
  ],
  "diagnosticsFrame": "input",
  "duration": 3
}

### api notes
- platform: zapier | n8n | pipedream | make | hubspot | hubl
- language: javascript | python, in platformVariants.language or as a top-level language field (the same field mcp format_code takes; js and py read the same way, and typescript, ts and tsx read as javascript and turn on TypeScript parsing on pipedream). platformVariants wins when both are sent, any other value is ignored, and python is ignored on hubl; whenever a top-level language is not applied, the response carries a warnings array saying so
- required on EVERY request, whatever the platform or language: code, platform, formatOptions, lintOptions. the schema has no server-side defaults for the two option blocks, so omitting either is a 400 whose detail names the field ("invalid request: lintOptions: Invalid input: expected object, received undefined") and whose hint points back here, not a fallback. the three examples above all carry all four
- errors are application/problem+json (RFC 9457): type, title, status, detail, error (same text as detail) and hint. on a 400 the detail names the first failing field when the body parsed as json. statuses: 400 invalid request, 403 a browser request from an origin other than codefmt.dev or the extensions (server-to-server calls send no Origin header and need no authentication), 405 any method but POST and the OPTIONS preflight, 413 body too large, 429 rate limited
- for javascript: formatOptions + lintOptions are the ones that shape the output
- for python: add pythonFormatOptions + pythonLintOptions, which are what shape python output. still send formatOptions and lintOptions to satisfy the schema; the python path reads neither
- for hubl: add hublFormatOptions. the 7 formatting fields (tabWidth 2|4|6|8, printWidth, quoteStyle, htmlIndentation, blankLineBetweenBlocks, singleLineBlocks, preserveWhitespaceControl) are required whenever the object is present; the 5 lint fields are optional (lintEnabled, disabledRuleCategories, and the unknownFilter/Global/Function severities "off"|"info"|"warning"|"error"). formatOptions is still read on this path, for css, html, and embedded <script> inside the template; lintOptions is required by the schema but unused here. hubl auto-fix is available via the top-level applyFixes field ("safe" | "unsafe", the same fixes as the in-app Fix buttons) and consumes lint output, so it is a no-op when lintEnabled is false
- lintOptions.severity: "default" | "warn" | "error". "default" (what the site uses) grades by rule category, reporting the definitely-wrong findings as errors and everything else as warnings; "warn" and "error" report every finding at that one level
- applyFixes (top level, optional): "safe" | "unsafe". on javascript and typescript it applies biome's lint fixes instead of only formatting ("unsafe" adds fixes that can change behavior); on hubl it applies the hubl safe fixes described above. python ignores it
- lintOnly (top level, optional, javascript only): skip formatting and return the lint diagnostics for the code as sent
- contentHint (top level, optional, hubl only): "css" | "html" | "js" tells content detection what a buffer with no hubl in it is; any {{ }} or {% %} still routes it to the hubl engine
- platformVariants is optional; omit it and every field falls back to the platform defaults (n8nMode allItems, pipedreamType action, hubspotStyle callback, language javascript). send it whenever any of those is wrong for your call, language above all: python is routed by language, so send platformVariants.language or a top-level language of "python"; with neither, python formats as javascript. when you do send platformVariants, send every field
- response: code, diagnostics and duration are always present (the three /api/openapi.json marks required, and the shape the examples above show). most paths also return diagnosticsFrame ("input" | "output"), which says whether diagnostic positions point at the source you sent or at the formatted output, and error (a string) appears only on a partial failure. lintUnavailable: true appears only when lint was requested and the linter could not run, so an empty diagnostics list then means unknown, not clean. there is no formatted_code field on this endpoint; that name belongs to the mcp and a2a format_code result below
- json is not a /api/format platform: use the mcp format_json tool or the /json page
- size limits: code up to 51,200 characters, 50KB of ASCII (400 above it), request body up to 100KB, counted in bytes (413 above it)
- rate limit: 60 requests per minute per ip across format api calls, mcp and a2a tool calls, and /ask (mcp handshakes and listings are not counted). the count is kept per server instance, so treat it as a ceiling to stay under rather than an exact budget. the format api and /ask report the limit in RateLimit headers, every 429 carries Retry-After, /ask puts the message in answer, and an mcp tool call over the limit returns a tool result saying to try again in a minute

## mcp and webmcp tools
the mcp endpoint is https://codefmt.dev/api/mcp (streamable http, no auth). supported protocol versions: 2026-07-28, 2025-11-25, 2025-06-18, 2025-03-26; the newest is per-request, and clients that open with initialize negotiate one of the others. three tools:

- format_code { code (string, max 50KB), platform ("zapier" | "n8n" | "pipedream" | "make" | "hubspot" | "hubl"), language? ("javascript" | "typescript" | "python", defaults to javascript; typescript parses as typescript only on pipedream) } returns { formatted_code, diagnostics, error }, plus diagnostics_frame ("input" | "output") on the paths that produce positioned diagnostics and lint_unavailable: true when the linter could not run (an empty diagnostics list is then unknown, not clean). note this is the agent-tool shape, not the /api/format one: the formatted source is formatted_code here and code there. wraps the source in the platform's runtime shell before formatting so top-level await, bare return, and injected globals don't break the formatter. it has no variant input, so it always uses each platform's default shape (n8n allItems, pipedream action, hubspot callback style). for n8n each-item code, a pipedream source component, or a hubspot return-style action, POST to /api/format with platformVariants instead.
- format_json { json (string, up to 262,144 characters), indent? ("2" | "4" | "tab" | "minify", defaults to "2"), sort_keys? (boolean, defaults to false) } returns { formatted_json, error }. on invalid input, error is the string "line L, col C: message" with a 1-based line and column from the strict engine (same contract as the /json error banner).
- ask_codefmt { query (string, up to 2,048 characters) } returns a grounded answer about codefmt with cited source urls; off-topic questions are refused rather than guessed.

format_code and format_json report a bad argument (a missing input, an unknown platform or language, an unrecognised indent) as a tool result with isError true and the message in error, naming the accepted values (an unknown platform lists all 6 platform ids). language reads the same spellings on every surface (javascript, python, typescript, js, ts, tsx, py); an unrecognised one is an error on these tools and on the webmcp tools, while /api/format ignores it and says so in warnings. ask_codefmt never sets isError: an empty or too-long query and the rate-limit message come back in answer, with empty sources, so check sources before treating an answer as grounded.

resources/list returns one resource, ui://codefmt/format-result: the mcp apps view hosts can render for a format_code or format_json result (the formatted source with a copy action, the diagnostics, or the error). prompts/list and resources/templates/list answer with empty lists.

### connecting an mcp client

Claude Code (run once in a terminal):

```
claude mcp add --transport http codefmt https://codefmt.dev/api/mcp
```

Claude Desktop and claude.ai (Settings > Connectors > Add custom connector, with this URL; calls come from Anthropic's servers, so the per-ip rate limit is shared with other connector users):

```
https://codefmt.dev/api/mcp
```

Cursor (add to ~/.cursor/mcp.json (or .cursor/mcp.json in a project)):

```
{
  "mcpServers": {
    "codefmt": {
      "url": "https://codefmt.dev/api/mcp"
    }
  }
}
```

Codex (add to ~/.codex/config.toml (or .codex/config.toml in a trusted project)):

```
[mcp_servers.codefmt]
url = "https://codefmt.dev/api/mcp"
```

VS Code (add to .vscode/mcp.json):

```
{
  "servers": {
    "codefmt": {
      "type": "http",
      "url": "https://codefmt.dev/api/mcp"
    }
  }
}
```

the same three tools are also registered in-page via webmcp (document.modelContext), so browser-driving agents can call them without leaving the page. they answer exactly as the mcp tools do (format_code's diagnostics_frame and lint_unavailable, ask_codefmt's refusals in answer with empty sources), except that a bad argument comes back as { error } with no isError, which webmcp has no field for. every webmcp tool declares an outputSchema covering each shape it can return, and the page registers its tools all or none. webmcp is not on by default in chrome: it needs chrome 153 or later plus either chrome's webmcp origin trial, which codefmt.dev has joined, or the chrome://flags/#enable-webmcp-testing flag.

on the editor pages (/, /python, /hubl and /json; not the platform landing pages such as /zapier, which have no editor), two more webmcp tools work on what is on screen: read_editor returns the editor's formatted output, error and diagnostics, with the input's length (pass include_input: true for the input itself, which can run to megabytes on /json), and load_editor puts code into the input pane, where it formats as if pasted. load_editor waits for that format and returns it as result with settled: true; settled is false in manual-format mode (the person has to press format) or when the format outlasts the wait, and then read_editor answers once outputIsCurrent is true. use format_code or format_json to get formatted code back without changing the page, and load_editor when the person should see it. read_editor's output is whatever the person pasted, so it is marked as untrusted content. load_editor changes the page, so it is not marked read-only. neither exists over http mcp, because there is no page there.

## markdown page twins
every html page on codefmt.dev has a markdown twin: append .md to the path.
- https://codefmt.dev/hubl.md (hubl formatter + linter page)
- https://codefmt.dev/zapier.md (zapier page)
- https://codefmt.dev/hubl-lint-rules.md (full rule catalog)
- https://codefmt.dev/index.md (homepage special case)

twins are served with a Link header rel="canonical" pointing at the html page. agents should prefer the .md twin: the same content as the rendered page in clean markdown with no navigation chrome, followed by a short "for agents" section (api, mcp, rate limit, auth, docs) that is added to every twin and is not part of the page. the four editor pages (/index.md, /hubl.md, /python.md, /json.md) serve generated twins carrying each tool's full feature reference and faq, since their html is a client-rendered editor.

## nlweb ask endpoint
GET https://codefmt.dev/ask?query=... (or ?q=...) and POST { "query": "..." }, with a query up to 2,048 characters, both return { query, answer, sources, results, confidence }. answers are grounded in codefmt's own published content (json-ld faq pairs and page descriptions) and always cite source urls. confidence (0-1) is how much of the question the answer covers, weighted toward its rarer, more specific terms; questions outside the corpus, or matching it too weakly to trust, are refused instead of guessed. cors is open (Access-Control-Allow-Origin: *). a GET sent with Accept: text/event-stream gets the same answer as server-sent events. the mcp "ask_codefmt" tool uses the same grounded corpus.

## discovery for agents
- openapi spec: https://codefmt.dev/api/openapi.json
- api catalog (RFC 9727): https://codefmt.dev/.well-known/api-catalog
- ai catalog (agentic resource discovery): https://codefmt.dev/.well-known/ai-catalog.json
- mcp server card (SEP-1649): https://codefmt.dev/.well-known/mcp/server-card.json
- mcp manifest (name, icon, description, tool list): https://codefmt.dev/.well-known/mcp.json (also /mcp.json and /.well-known/mcp/manifest.json)
- mcp endpoint: https://codefmt.dev/api/mcp (streamable http, protocols 2026-07-28, 2025-11-25, 2025-06-18, 2025-03-26)
- official mcp registry entry (dev.codefmt/codefmt): https://registry.modelcontextprotocol.io/v0/servers/dev.codefmt%2Fcodefmt/versions/latest
- a2a agent card: https://codefmt.dev/.well-known/agent-card.json (declares agent-to-agent protocol 0.3.0)
- a2a endpoint: https://codefmt.dev/api/a2a (json-rpc message/send for the format_code skill; the message's text part is a json object { code, platform, language? } and the reply is { formatted_code, diagnostics, error })
- agent skills index: https://codefmt.dev/.well-known/agent-skills/index.json
- format-code skill: https://codefmt.dev/.well-known/agent-skills/format-code/SKILL.md
- nlweb ask endpoint: https://codefmt.dev/ask
- agent auth statement: https://codefmt.dev/auth.md (no authentication anywhere; do not send authorization headers or attempt oauth discovery)
- schema map: https://codefmt.dev/schemamap.xml (index of every page's json-ld structured data; append .jsonld to the page path for its graph)
- markdown twins: append .md to the page path (before any query string) (https://codefmt.dev/index.md for the homepage)
- health check: https://codefmt.dev/api/health
- single-topic files (each one product area, not a path-scoped llms.txt): https://codefmt.dev/api/llms.txt, https://codefmt.dev/hubl/llms.txt, https://codefmt.dev/json/llms.txt, https://codefmt.dev/extension/llms.txt
- extended docs (long form): https://codefmt.dev/llms-full.txt

## urls
- home: https://codefmt.dev
- platforms, tools and comparisons hub (full catalog): https://codefmt.dev/platforms
- zapier formatter and linter: https://codefmt.dev/zapier
- n8n formatter and linter: https://codefmt.dev/n8n
- pipedream formatter and linter: https://codefmt.dev/pipedream
- make formatter and linter: https://codefmt.dev/make
- hubspot data hub formatter and linter: https://codefmt.dev/hubspot
- hubl formatter and linter (dedicated hubl linter, zero setup): https://codefmt.dev/hubl
- hubl linter for hubspot cms (pillar: what the 32 rules catch before publish): https://codefmt.dev/hubspot-cms-linter
- hubl lint rule catalog (all 32 single-file rules): https://codefmt.dev/hubl-lint-rules
- python formatter and linter: https://codefmt.dev/python
- json formatter and repair tool: https://codefmt.dev/json
- code snippets for automation platforms: https://codefmt.dev/snippets
- browser extension for chrome and firefox: https://codefmt.dev/extension
- blog (guides for formatting code in automation platforms): https://codefmt.dev/blog
- blog: fixing the hubl unclosed block error (find the {% if %} / {% for %} / {% block %} missing its end tag): https://codefmt.dev/blog/hubl-unclosed-block-error
- blog: deprecated hubl tags (the 8 deprecated tags and their module-system replacements): https://codefmt.dev/blog/hubspot-deprecated-hubl-tags
- blog: formatting javascript and python in zapier code steps: https://codefmt.dev/blog/format-javascript-python-zapier-code-step
- blog: formatting and beautifying hubl before publish: https://codefmt.dev/blog/format-beautify-hubl
- blog: formatting javascript in n8n code nodes: https://codefmt.dev/blog/format-javascript-n8n-code-node
- blog: formatting code in pipedream code steps: https://codefmt.dev/blog/format-code-pipedream-code-steps
- blog: formatting python and javascript in make.com modules: https://codefmt.dev/blog/format-python-make-com
- privacy (no accounts, no cookies, code never stored): https://codefmt.dev/privacy
- about: https://codefmt.dev/about
- api docs (authentication, limits, every endpoint): https://codefmt.dev/docs
- contact (support email, store channels, security contact): https://codefmt.dev/contact
- comparison: codefmt vs prettier playground: https://codefmt.dev/vs-prettier-playground
- comparison: codefmt vs hubl code formatter (studionope): https://codefmt.dev/vs-hubl-code-formatter
- comparison: codefmt vs hubspot's vs code extension: https://codefmt.dev/vs-hubspot-vscode
- comparison: codefmt vs zapier built-in formatter: https://codefmt.dev/vs-built-in-zapier-formatter

## platform deep dives

### zapier: code by zapier
zapier's code step wraps your body in an async function and exposes
6 globals. javascript runs on node 22 and python on 3.13. on paid plans the
editor's Packages panel adds public npm packages (ES modules only) or PyPI
packages, and javascript that imports one runs inside
`export default async function main()`. `@zapier/zapier-sdk` lets code
steps call your connected app actions. python steps get `requests`,
`BeautifulSoup` and `StoreClient` preinstalled.

javascript globals:
- `inputData`: object built from your mapped input fields
- `output`: assign a return value, or return/callback()
- `fetch`: global (no require needed)
- `callback(err, output)`: classic async-completion
- `StoreClient`: key-value store kept between runs
- `console`: logs appear in the zap run history

python globals:
- `input_data`: dict from mapped input fields
- `output`: set to a dict or list of dicts
- `StoreClient`: key-value store (`store = StoreClient('secret')`)
- `requests`: preinstalled http library

common errors formatted away by codefmt:
- `SyntaxError: Unexpected token 'return'`: zapier allows bare return; codefmt wraps before the formatter sees it
- `SyntaxError: await is only valid in async function`: zapier has an implicit async wrapper; codefmt adds it before formatting

### n8n
n8n's code node runs per-workflow. you choose "run once for all items" (mode
`allItems`) or "run once for each item" (mode `eachItem`). the code node
runs javascript and python only; there is no typescript option, so codefmt
reports typescript syntax on the n8n tab as a syntax error.

javascript globals, all items: `$getNodeParameter`, `$`, `$input`, `$json`, `$binary`, `$data`, `$item`, `$items`, `$itemIndex`, `$node`, `$nodeId`, `$nodeVersion`, `$self`, `$parameter`, `$rawParameter`, `$prevNode`, `$runIndex`, `$mode`, `$workflow`, `$execution`, `$executionId`, `$evaluation`, `$resumeWebhookUrl`, `$webhookId`, `$env`, `$vars`, `$secrets`, `$now`, `$today`, `$jmespath`, `$jmesPath`, `$fromAI`, `$fromAi`, `$fromai`, `$tool`, `$agentInfo`, `$getPairedItem`, `$evaluateExpression`, `$getWorkflowStaticData`, `$position`, `$thisItem`, `$thisItemIndex`, `$thisRunIndex`, `DateTime`, `Duration`, `Interval`, `helpers`, `require`, `console`, `Buffer`, `setTimeout`, `setInterval`, `setImmediate`, `clearTimeout`, `clearInterval`, `clearImmediate`, `btoa`, `atob`, `TextDecoder`, `TextDecoderStream`, `TextEncoder`, `TextEncoderStream`, `FormData`, `items`.
javascript globals, each item: the same, with `item` in place of `items`.
`DateTime` is luxon. each-item mode has no `items`: read the current item
through `$json` (or `$input.item`). the sandbox has no `fetch`: use the
HTTP Request node, or `this.helpers.httpRequest` inside the code node.

python globals: `_items` (all items) or `_item` (each item), plus
`_query` in the code tool node. items are plain dicts, so use bracket access;
codefmt warns on `_item.json` and `.to_py()`. n8n cloud allows no python
imports, and by default n8n removes builtins such as `type`, `getattr`,
`open` and `eval` (not flagged, since an instance can allow them). codefmt targets n8n's native python runner (n8n 2.x, and 1.111+ when
native python is chosen): python 3.13, with your code wrapped in a plain
`def`, so top-level `await` is reported. the older pyodide runtime is
deprecated and removed in n8n 2.0, and codefmt does not model it.

### pipedream
two component types: **action** (runs once per workflow; its return value
flows to later steps, and `$.export` shares named values) and **source**
(emits events, uses `this.$emit`, deployed with the Pipedream CLI rather
than written in a workflow step). a workflow code step runs node.js 20
javascript or python 3.12; typescript exists only for components built with
the CLI and compiled before publishing, so codefmt parses pipedream code as
javascript unless the typescript chip is on or the request's language is
typescript (the only switch format_code has). Pipedream Workflows are in
maintenance mode and shut down on March 31, 2027.

action globals: `steps`, `$`, `this`, `process`, `require`, `console`, `defineComponent`. `steps` holds prior
step outputs and `$` the workflow helpers.
source globals: `this`, `event`, `process`, `require`, `console`, `defineSource`. `this.$emit` emits
events and a prop declared as `"$.service.db"` is a key-value store.
python: a step is `def handler(pd: "pipedream"):` with the `pd` context
object (`pd.steps`, `pd.inputs`, `pd.export()`, `return pd.flow.exit()`).

### make
make's custom code modules run in a node 20 sandbox (apps.make.com/code).
globals available: `input`, `console`, `fetch`, `process`, `Buffer`, `URL`, `setTimeout`, `setInterval`, `clearTimeout`, `clearInterval`, `require`.
`require()` loads the preinstalled `moment`, `moment-timezone`,
and `lodash`; other npm packages are enterprise-only, listed under
"additional dependencies". runs are capped at 30 seconds and 512 MB
(enterprise: 300 seconds, 1024 MB; https://apps.make.com/code). python is 3.12 with `input` as the only injected global.

### hubspot data hub
new custom code actions run on node.js 24.
runs are capped at 20 seconds and 128 MB (https://developers.hubspot.com/docs/api-reference/latest/automation/workflow-actions/custom-code-actions). globals:
`event`, `callback`, `process`, `console`, `require` (callback style;
return style drops `callback`). `event` is the input.
- callback style, the one hubspot documents: `callback({ outputFields: { x: 1 } })`
- return style: `return { outputFields: { x: 1 } }`. not in hubspot's docs,
  and users report its output fields arriving undefined; codefmt formats it
  but does not recommend it.

python (beta): def main(event): return { "outputFields": { ... } }. hubspot
offers 3.9 or 3.14 and sunsets 3.9 on 2027-01-05. codefmt checks
python 3.9 by default; send pythonFormatOptions.pythonTarget "py314" (or pick
python 3.14 in the editor's settings) for an action on 3.14. a target in
between snaps down to 3.9.

### hubspot cms (hubl)
hubl is jinja2-derived. codefmt formats and lints:
- `{% %}` tags (control flow, macros, blocks)
- `{{ }}` expressions
- `{# #}` comments
- closed-block correctness (`{% if %}` must have `{% endif %}`), including closer spellings
  jinjava rejects (`{% end_if %}`)
- semantic checks: unknown filters and functions, filter arity, near-miss globals, unknown `is`
  tests, hyphenated variable names, and javascript habits (`===`, `null`, template literals,
  `.forEach`; `||` and `&&` are accepted by hubl and reported as info)
- deprecations: widget-era tags, deprecated functions and filters, and deprecated default modules
- formatting leaves a `<pre>` or `<textarea>` body as written when the element is plain markup
  (not built inside a hubl expression), never moves a hubl tag off its line inside `<script>` or
  `<style>`, keeps tags glued to rendered text on their line, and formats embedded javascript
  `<script>` blocks with biome, skipping any that carry hubl or a non-javascript type
- bare css, html and javascript pasted on /hubl are formatted with biome and marked "not linted"

## whole-theme hubl audit
on https://codefmt.dev/hubl, drop a theme folder (or the .zip design manager exports) and every
template is linted with whole-theme context, which is what the 3 project-aware rules
need: hubl/extends-path-not-found, hubl/module-unknown-name and hubl/module-unknown-field. .html
and .hubl files are linted, .json is syntax-checked, and .css and .js only feed the dependency
graph. it runs entirely in the browser (the page downloads its worker script, and no theme file is
sent anywhere), so it has no api or mcp equivalent. caps: 1,500 files,
512 KB per file and 16 MB in total, checked before any file is read.

## common recipes

### zapier javascript: fetch + map
```js
const response = await fetch(`https://api.example.com/users/${inputData.id}`);
const user = await response.json();
return { name: user.name, email: user.email };
```

### n8n: all-items map
```js
return $input.all().map(({ json }) => ({
  json: { ...json, processed_at: new Date().toISOString() },
}));
```

### pipedream: fan-in from prior steps
```js
export default defineComponent({
  async run({ steps, $ }) {
    const users = steps.list_users.$return_value;
    const enriched = users.map((u) => ({ ...u, source: "pipedream" }));
    return { success: true, data: enriched };
  },
});
```

### make python: transform input
```py
return {"items": [{"id": i["id"], "title": i["title"].upper()} for i in input["items"]]}
```

### hubspot data hub: callback style
```js
exports.main = async (event, callback) => {
  callback({ outputFields: { upper_email: event.inputFields.email.toUpperCase() } });
};
```

### hubl: loop with conditional
```hubl
{% for post in blog_posts %}
  {% if post.featured %}
    <article class="featured">{{ post.name }}</article>
  {% endif %}
{% endfor %}
```

## troubleshooting

### "Unexpected token 'return'"
your code uses a bare `return` outside of a function body. zapier and n8n
run your code inside an async function and make inside a function, so it is
valid there, and
codefmt formats a pipedream step's bare body as the inside of its
`run()`. select the correct platform in codefmt before formatting; the
wrapper is applied automatically.

### "await is only valid inside async functions"
same fix for javascript: the platform's implicit async wrapper makes
top-level await legal, and codefmt handles it once you pick the right
platform. python differs: n8n runs your code in a plain `def`, so a
top-level `await` is a SyntaxError there and codefmt reports it.

### "ReferenceError: inputData is not defined" (after pasting into prettier-cli)
`inputData` (zapier), `$input` (n8n), `steps` (pipedream), and `event`
(hubspot) are injected globals. codefmt registers these so the linter
won't complain; plain prettier/eslint will.

### python "IndentationError: unexpected indent"
python formatters are strict about a single consistent indent. when ruff
rejects a paste whose indentation is off (e.g. code copied from docs with
leading whitespace), codefmt retries with reindented versions and keeps one
only if ruff formats it cleanly; otherwise it returns your code with the
indentation error.

### hubl "Unclosed block"
every `{% if %}`, `{% for %}`, `{% block %}`, `{% macro %}` must have
its matching `{% end... %}`. codefmt's hubl linter locates the opening
tag and reports it by line. step-by-step walkthrough:
https://codefmt.dev/blog/hubl-unclosed-block-error

### hubl deprecated tag warnings
`widget_block`, `widget_attribute`, `widget`, `custom_widget`, `follow_me`, `global_widget`, `image_slider`, `widget_container` are deprecated; codefmt's hubl/deprecated-tag
rule flags each of them with its replacement (widget_block to module_block, widget_attribute to module_attribute, widget to module, custom_widget to module, follow_me to module path="@hubspot/social_follow", global_widget to module, image_slider to module path="@hubspot/image_slider_gallery", widget_container to dnd_area): safe fix for widget; unsafe for widget_block, widget_attribute and custom_widget, which need their parameters rewritten; none for follow_me, global_widget, image_slider and widget_container.
replacements and context:
https://codefmt.dev/blog/hubspot-deprecated-hubl-tags

## operational notes
- every format engine has a browser build: biome (webassembly) for
  javascript/typescript, ruff (webassembly) for python, and the typescript
  hubl and json engines (no webassembly)
- javascript lint is the one step that always needs the server: oxlint
  runs server-side as a node cli behind /api/format
- the /api/format endpoint exists for extensions, ai agents, and
  environments where the client engines aren't available
- formatting runs in the browser; javascript lint sends the code to /api/format, and so does all formatting in a browser that blocks webassembly; otherwise python, hubl and json never leave the browser
- api: 60 req/min per IP, code up to 51,200 characters, 50KB of ASCII (400 above it), request body up to 100KB, counted in bytes (413 above it), 10s lint-subprocess timeout
- rate limit resets per minute; no user accounts to authenticate
- cookie-free aggregate analytics (vercel analytics and umami); no
  personal data

## versioning
- /api/format IS v1; there is no /api/v1 path. send the optional Api-Version
  header as "1" to pin it (any other value is a 400).
- v1 is stable: additive changes only to the request schema.
- breaking changes would ship under /api/v2/format with a deprecation
  window on v1, announced via Deprecation and Sunset headers on v1 responses.
- openapi spec at /api/openapi.json is the source of truth.

## contact
issues, feature requests, or agent-integration questions: https://codefmt.dev/contact
(support email, extension store channels, and the security contact are all listed there)
