A thin VS Code layer over the dm CLI (@datamagik/cli) — author DataMagik
scripts, SQL queries, and SPA apps locally and act against the platform without
leaving the editor.
What it adds
A DataMagik panel in the activity bar, covering the whole loop: find it, get
it, change it, test it, ship it.
- Scripts and SQL trees listing everything in the active tenant, marking
what is already in your workspace.
✓ opens the file; ☁ downloads it and
opens it. Rows match on the platform id, so a file you renamed by hand is still
recognised. + creates a new one.
- Apps tree listing the tenant's applications. A
spa app downloads a
published version's source into a new folder, so an app built months ago
can be opened again on a machine that never had it. Two versions pull side by
side and diff.
- Account view showing the two facts that decide where a command lands — the
environment and the company — each one click from changing.
- Sign in with a browser (OAuth device flow): no key to paste, and it works
with SSO. Pasting an API key is still offered.
- Switch company without leaving the editor. Needs a browser sign-in; an API
key is fixed to one company for its life.
- SQL results as a grid in an editor tab — sticky headers, a filter box,
numbers aligned, NULL distinct from empty. Not a log: a log cannot scroll
sideways.
- Script results in a panel with Console and Return tabs. A failed
run still shows what it printed.
- F5 to debug an app — launch configurations are contributed per app, so
there is no
launch.json to write. Starts the dev server and binds
breakpoints in your .vue sources.
- CodeLens atop
@dm-script .js files (▶ Run, ⬆ Commit, ✎ Push meta,
≡ Status) and @dm-sql .sql files (▶ Run, ⬆ Push).
- Publish —
DataMagik: Publish a new version (goes live) builds and ships a
SPA app from the editor.
dm.config.json validation — schema-backed completion and inline errors,
so a typo surfaces before a publish rejects it.
@datamagik/ui components — 45 of them, browsable and insertable, read
from your workspace's own copy so the versions always match.
- An Output channel streaming
dm output, and the integrated terminal for
interactive commands.
SQL results
▶ Run on a @dm-sql file sends it to the engine's read-only test-run and
opens the result set as a grid in an editor tab beside the query:
✓ 6 rows in 2284ms
┌────────────────────────┬──────────┬──────────┬──────────────┐
│ Part_No │ Part_Key │ Revision │ Name │
├────────────────────────┼──────────┼──────────┼──────────────┤
│ MATL │ 0 │ 0 │ Raw Material │
│ 72963-TA0 │ 556851 │ │ Collar │
│ 84400SWA A014M1 NH661L │ 957057 │ │ Grey Shelf │
└────────────────────────┴──────────┴──────────┴──────────────┘
Numeric columns right-align. An empty string renders blank and a NULL renders as
NULL, so the two are never confused.
The grid has a filter box for narrowing rows without re-running the query. To get
them out of the editor, dm sql run in a terminal also takes --out results.csv
(or .json), --format csv for piping, and --max-rows <n> to cap a large
terminal grid. The CSV export neutralises spreadsheet
formula injection, so a cell beginning = or @ cannot execute when the file is
opened in Excel.
Needs @datamagik/cli 0.3.6 or newer; the default npx --yes @datamagik/cli
always fetches a current one.
How it works
Every action shells the dm CLI (@datamagik/cli), so behavior matches the
terminal exactly. Read-only/output actions (run, status, pull, typegen, push, commit)
stream to the Output channel; add and dev run in a terminal. Files are saved
before a run so the engine sees your latest edits.
Requirements
- Node 20+. The CLI is fetched on demand — nothing to install first.
- Log in once (status bar → log in) to store credentials for the tenant.
Settings
datamagik.cliCommand (default npx --yes @datamagik/cli) — how to invoke
the CLI. The default works whether or not @datamagik/cli is installed in the
workspace. Plain npx dm only resolves once the package is already installed,
because npx cannot find a scoped package by its bin name. Set this to dm if
you have it on your PATH, or to an absolute path.
It is machine-scoped: a workspace's .vscode/settings.json cannot override
it, so opening an untrusted repository cannot redirect the CLI at an arbitrary
binary.