Skip to content
CatSuite

Language

Choose whether the site follows your browser or always uses Brazilian Portuguese or English.

Get it free

Extensions

Web extension IDE

How to use the CatSuite IDE in the browser to create extensions from scratch or from examples, validate, simulate, inspect and export .catplug packages.

6 min read

The extension IDE is a complete environment to write, test and package .catplug extensions right in the browser. Everything happens on your device: code is never sent to servers, the simulator makes no network connections and the project is saved only in this browser.

Starting a project #

Nothing is loaded automatically when the IDE opens. The start screen asks how you want to begin:

OptionWhat happens
Continue where I left offReopens the project saved in this browser, showing its name, ID, version, file count and last save time. It only appears when a saved project exists.
Start from scratchCreates a blank project with manifest.json and an empty main.js. You enter the name, the name in the other language, the ID and the author.
Start from an exampleOpens one of the ready-made templates, all tested in the simulator with fictional data.
Import .catplugOpens a package exported by the app or by the IDE itself.

The IDE toolbar New button returns to this screen at any time, with an option to go back to the open project.

Starting from scratch #

The ID is generated from the name: accents are removed, spaces become hyphens and the lab. prefix is added. You can edit the ID freely as long as it follows the manifest pattern: 3 to 64 characters, starting with a letter, using only lowercase letters, numbers, dots and hyphens.

The initial manifest already passes validation:

manifest.jsonJSON
{
  "formatVersion": 1,
  "apiVersion": 1,
  "id": "lab.my-extension",
  "version": "1.0.0",
  "author": "QA team",
  "entry": "main.js",
  "name": {
    "pt-BR": "Minha extensão",
    "en": "My extension"
  },
  "description": {
    "pt-BR": "Descreva aqui o que a extensão faz.",
    "en": "Describe what the extension does."
  },
  "permissions": [],
  "targets": [],
  "externalHosts": [],
  "settings": {},
  "hashes": {}
}

Available examples #

ExampleShowsPermissions
Basic templatecommand, native tab, field and storagecommands, ui.tab, storage
Request taggeronRequest and onResponse hooks in the laboratorytraffic.read, traffic.modify, ui.tab, storage, commands
Cache auditorsends, simulated external API, menu and a finding with evidencetraffic.read, http.send, external.call, findings, storage, ui.menu, ui.tab, commands
Workflow stepstep with checkpoints and a JSON parserpipeline.step, parsers, traffic.read
Components panelevery native interface componentui.tab, commands, storage

IDE areas #

AreaPurpose
Filespackage list, plus creating, renaming and deleting files
Permissionscheckboxes that update permissions in manifest.json
SDK referencecat APIs with a filter and snippets ready to insert
Templatesreplaces the current project with an example
Editorsyntax highlighting, line numbers and problem markers
Problemsvalidation errors, warnings and hints with a shortcut to the line
Consolecat.log entries, simulated sends and runtime failures
Laboratorycaptures fictional requests to test proxy hooks
Previewtabs registered by the extension, rendered like in the app
Inspectorhooks, commands, menus, steps, parsers and stored data
Findingsrecorded findings with severity, confidence, status and evidence

On small screens the areas are grouped into four tabs: Files, Code, Preview and Console.

Editor and shortcuts #

ShortcutAction
Tab and Shift + Tabindent and outdent
Enternew line keeping the indentation
Ctrl + Ssave in the browser
Ctrl + Entervalidate and run in the simulator
Esc then Tableave the editor with the keyboard

On macOS, use Cmd instead of Ctrl. The project is also saved automatically a moment after every change.

Validation #

Validation runs on every change and uses the same import rules as the app:

  • required manifest fields, pt-BR and en texts, version and ID;
  • targets and externalHosts destinations, including wildcards, ports and private addresses;
  • declared permissions compared with the APIs used in the code;
  • steps and parsers with http inputs require traffic.read;
  • APIs that do not exist in QuickJS, such as fetch, require and document;
  • import and export, which are not supported because the code runs as a script;
  • syntax errors in the entry file, checked without running the code.

Errors block running and exporting. Warnings and hints do not.

Simulator #

Run loads the entry file into an isolated Web Worker that reproduces SDK API v1. The simulator uses the language selected in the site language selector: in Portuguese, cat.i18n.text and bilingual texts show pt-BR; in English, en.

The simulator applies the same rules as the app:

  • every API requires its permission and answers E_PERMISSION when it is missing;
  • sends and external APIs respect targets and externalHosts;
  • change hooks must be synchronous and are stopped if they hang;
  • storage is limited to 128 KiB per value and 10 MiB per extension;
  • findings are consolidated by fingerprint.

CatBridge connectors are not available in the browser and answer E_CONNECTOR.

Fictional data with fixtures.json #

Sends, external APIs and the laboratory use the routes in fixtures.json. Missing routes answer with a simulated 404.

fixtures.jsonJSON
{
  "scenario": "fictional",
  "routes": [
    {
      "url": "https://api.aurora.test/api/perfil",
      "status": 200,
      "cacheControl": "public, max-age=600",
      "body": { "id": "cliente-ficticio-001", "scenario": "fictional" }
    },
    {
      "url": "https://api.aurora.test/timeout",
      "error": "E_TIMEOUT"
    }
  ]
}

To use cat.laboratory.capture, enable settings.laboratory in the manifest.

Exporting the package #

Export .catplug validates the project and builds the package:

  1. removes the previous signature, because the content was edited;
  2. recomputes the SHA-256 of every file in hashes;
  3. in format 2, creates a new revisionId and records parentHash when the project came from an import;
  4. compresses everything into an id-version.catplug file.

Then import the file in the app under Settings → Extensions. The app signs the package again and shows the permissions before enabling the extension.

IDE security #

  • The page blocks every network connection through its content security policy.
  • Extension code runs isolated, with no access to the page, cookies or browser storage.
  • fetch, XMLHttpRequest, WebSocket, importScripts, WebAssembly and the worker message channel are blocked for extension code.
  • Imported packages go through the format limits: up to 10 MiB compressed, 40 MiB expanded, 4 MiB per file and 500 files, with no absolute paths, .., symbolic links or encrypted entries.
  • Mismatched hashes produce a console warning and are recomputed on export.
  • Password-protected packages (CATSEAL2) do not open in the web IDE: open them in the app or inspect them in CatSuite Studio.

Prefer VS Code? #

The same experience exists as an installable extension: CatSuite Studio brings SDK suggestions, validation, a local preview with fixtures and signed .catplug package builds inside Visual Studio Code. Projects started in the web IDE can carry on in the editor.

Next steps #