@dbt-tools/web 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -34,13 +34,16 @@ Or without a global install:
34
34
  npx @dbt-tools/web --target /path/to/your/dbt/target
35
35
  ```
36
36
 
37
- `npx` invokes the package’s binary (`dbt-tools-web`). Useful flags:
37
+ `npx` invokes the package’s binary (`dbt-tools-web`). Run **`dbt-tools-web --help`** for the full list. Common flags:
38
38
 
39
- | Flag | Description |
40
- | ----------------------- | ---------------------------------------------------- |
41
- | `--target <dir>` / `-t` | dbt `target` directory (sets `DBT_TOOLS_TARGET_DIR`) |
42
- | `--port <n>` / `-p` | Listen port (default **3000**) |
43
- | `--help` / `-h` | Usage |
39
+ | Flag | Description |
40
+ | --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
41
+ | `--dbt-target <target>` | Artifact root: local path, `s3://`, or `gs://` (env: `DBT_TOOLS_DBT_TARGET`) |
42
+ | `--target <dir>` / `-t` | Alias for **local** `--dbt-target` (also sets `DBT_TOOLS_TARGET_DIR`) |
43
+ | `--gcs-impersonate-service-account`, `--gcs-project-id`, `--s3-region`, `--s3-endpoint` | Remote client settings (provider must match target URI) |
44
+ | `--port <n>` / `-p` | Listen port (default **3000**) |
45
+ | `--version` / `-V` | Print package version |
46
+ | `--help` / `-h` | Usage |
44
47
 
45
48
  The server listens on **127.0.0.1** and prints the URL (e.g. `http://127.0.0.1:3000`). Open that URL in your browser manually (`open`, `xdg-open`, or your desktop environment).
46
49
 
@@ -48,7 +51,7 @@ The server listens on **127.0.0.1** and prints the URL (e.g. `http://127.0.0.1:3
48
51
 
49
52
  For **supply-chain and capability** tooling (e.g. [Socket.dev alerts](https://socket.dev)):
50
53
 
51
- - **`networkAccess` — expected.** The published app is a **local HTTP server** (`node:http` on loopback), the UI uses **`fetch`** to same-origin `/api/...` routes, and **optional** remote artifact mode uses **AWS S3** and **Google Cloud Storage** client libraries when you configure `DBT_TOOLS_REMOTE_SOURCE` (see [ADR-0004](../../docs/adr/0004-remote-object-storage-artifact-sources-and-auto-reload.md)). There is no separate telemetry channel.
54
+ - **`networkAccess` — expected.** The published app is a **local HTTP server** (`node:http` on loopback), the UI uses **`fetch`** to same-origin `/api/...` routes, and **optional** remote artifact mode uses **AWS S3** and **Google Cloud Storage** client libraries via the **Load artifacts** UI (see [ADR-0004](../../docs/adr/0004-remote-object-storage-artifact-sources-and-auto-reload.md)). There is no separate telemetry channel.
52
55
  - **`shellAccess` (first-party) — none.** The CLI does **not** spawn a shell or external `open`/`xdg-open` helpers; it only starts the server and prints the URL.
53
56
  - **`usesEval` — not in our shipped `dist` / `dist-serve` bundles** from this repository’s build. If a scanner still flags `usesEval`, it is usually from **transitive dependencies** in the full npm graph rather than first-party TypeScript.
54
57
 
@@ -61,7 +64,7 @@ You can also set **`DBT_TOOLS_TARGET_DIR`** in the environment instead of `--tar
61
64
  - **Dependency graph** — interactive lineage and blast-radius style exploration
62
65
  - **Execution timeline** — Gantt-style `run_results` with critical path and bottleneck-oriented views
63
66
  - **Local artifacts** — read `manifest.json` / `run_results.json` from a target directory via server-side routes (local-first default)
64
- - **Remote sources (S3 / GCS)** — optional `DBT_TOOLS_REMOTE_SOURCE`; server-side credentials; UI prompts before switching runs ([ADR-0004](../../docs/adr/0004-remote-object-storage-artifact-sources-and-auto-reload.md))
67
+ - **Remote sources (S3 / GCS)** — **Load artifacts** in the UI; server-side credentials; UI prompts before switching runs ([ADR-0004](../../docs/adr/0004-remote-object-storage-artifact-sources-and-auto-reload.md))
65
68
  - **Large manifests** — web workers and virtualization for very large projects
66
69
 
67
70
  ---
@@ -94,13 +97,18 @@ Heavy analysis runs in a **web worker** (browser-safe shared library). The same
94
97
 
95
98
  ## Configuration (`dbt-tools-web` and production server)
96
99
 
100
+ **CLI flags** (see `dbt-tools-web --help`) mirror **`dbt-tools-mcp`** for artifact root and remote client settings: `--dbt-target`, `--gcs-project-id`, `--gcs-impersonate-service-account`, `--s3-region`, `--s3-endpoint`, plus `--port`, `-V` / `--version`. **`--target`** remains an alias for a **local** directory (sets `DBT_TOOLS_TARGET_DIR`). Flags override matching env vars when both are set.
101
+
97
102
  Set these in the environment for the **Node process** that runs `dbt-tools-web` (not in the browser):
98
103
 
99
- | Variable | Description |
100
- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
101
- | `DBT_TOOLS_TARGET_DIR` | Directory containing `manifest.json` and `run_results.json` (unless using remote source) |
102
- | `DBT_TOOLS_REMOTE_SOURCE` | JSON config for S3/GCS discovery (server-side only); semantics in [ADR-0004](../../docs/adr/0004-remote-object-storage-artifact-sources-and-auto-reload.md) (see also [Remote artifact sources](#remote-artifact-sources) below) |
103
- | `DBT_TOOLS_DEBUG` | Set to `1` for server-side debug logs |
104
+ | Variable | Description |
105
+ | ----------------------------------------------- | ---------------------------------------------------------------------------------- |
106
+ | `DBT_TOOLS_DBT_TARGET` | Artifact root at startup (local path, `s3://`, or `gs://`); same as `--dbt-target` |
107
+ | `DBT_TOOLS_TARGET_DIR` | Local directory alias (legacy; use `--target` or local `--dbt-target`) |
108
+ | `DBT_TOOLS_GCS_PROJECT_ID` | GCS client project (`gs://` targets) |
109
+ | `DBT_TOOLS_GCS_IMPERSONATE_SERVICE_ACCOUNT` | GCS impersonation principal (`gs://` targets) |
110
+ | `DBT_TOOLS_S3_REGION` / `DBT_TOOLS_S3_ENDPOINT` | S3 client settings (`s3://` targets) |
111
+ | `DBT_TOOLS_DEBUG` | Set to `1` for server-side debug logs |
104
112
 
105
113
  **Client:** add **`?debug=1`** to the URL for browser console debug logging.
106
114
 
@@ -108,26 +116,18 @@ Set these in the environment for the **Node process** that runs `dbt-tools-web`
108
116
 
109
117
  ### Remote artifact sources
110
118
 
111
- **Variable:** `DBT_TOOLS_REMOTE_SOURCE`. The dev server and **`dbt-tools-web`** can list keys under a bucket prefix that points at a **single run** (root-level `manifest.json` and `run_results.json`), **poll** for changes, and surface newer artifact versions in the UI **without switching your selected location automatically**. Credentials stay in the **Node process** (AWS default chain, GCS ADC / `GOOGLE_APPLICATION_CREDENTIALS`), not in the browser.
112
-
113
- Example (shape only — adjust bucket/prefix):
114
-
115
- ```bash
116
- export DBT_TOOLS_REMOTE_SOURCE='{"provider":"s3","bucket":"my-bucket","prefix":"dbt/runs","pollIntervalMs":30000}'
117
- pnpm dev
118
- ```
119
+ Use **`--dbt-target`** / **`DBT_TOOLS_DBT_TARGET`** at startup to preload local or remote (`s3://`, `gs://`) artifacts, or use the in-app **Load artifacts** panel to switch later. The dev server and **`dbt-tools-web`** list keys under remote prefixes, **poll** for changes, and surface newer artifact versions **without switching your selected location automatically**. Credentials stay in the **Node process** (AWS default chain, GCS ADC / `GOOGLE_APPLICATION_CREDENTIALS`), not in the browser.
119
120
 
120
121
  ### Vite dev environment reference (monorepo)
121
122
 
122
123
  When **`DBT_TOOLS_TARGET_DIR`** is set, Vite serves `/api/...` like the published server. Extra variables:
123
124
 
124
- | Variable | Default | Description |
125
- | ------------------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
126
- | `DBT_TOOLS_TARGET_DIR` | — | Enables serving artifacts via `/api/*` middleware |
127
- | `DBT_TOOLS_REMOTE_SOURCE` | — | JSON for S3/GCS bucket + prefix (server-side only); [ADR-0004](../../docs/adr/0004-remote-object-storage-artifact-sources-and-auto-reload.md) |
128
- | `DBT_TOOLS_DEBUG` | unset | `1` enables server-side debug logging |
129
- | `DBT_TOOLS_WATCH` | on | `0` disables file watching (Vite dev); see [Vite dev server](#vite-dev-server-monorepo) |
130
- | `DBT_TOOLS_RELOAD_DEBOUNCE_MS` | `300` | Reload debounce (Vite dev) |
125
+ | Variable | Default | Description |
126
+ | ------------------------------ | ------- | --------------------------------------------------------------------------------------- |
127
+ | `DBT_TOOLS_TARGET_DIR` | — | Enables serving local artifacts via `/api/*` middleware at startup |
128
+ | `DBT_TOOLS_DEBUG` | unset | `1` enables server-side debug logging |
129
+ | `DBT_TOOLS_WATCH` | on | `0` disables file watching (Vite dev); see [Vite dev server](#vite-dev-server-monorepo) |
130
+ | `DBT_TOOLS_RELOAD_DEBOUNCE_MS` | `300` | Reload debounce (Vite dev) |
131
131
 
132
132
  ---
133
133
 
@@ -135,7 +135,7 @@ When **`DBT_TOOLS_TARGET_DIR`** is set, Vite serves `/api/...` like the publishe
135
135
 
136
136
  ### Published server vs static Docker image
137
137
 
138
- - **`dbt-tools-web`** (npm): Node HTTP server + static `dist/` + artifact middleware. Honors **`DBT_TOOLS_TARGET_DIR`**, **`DBT_TOOLS_REMOTE_SOURCE`**, **`DBT_TOOLS_DEBUG`**. Does **not** use Vite file-watch env vars.
138
+ - **`dbt-tools-web`** (npm): Node HTTP server + static `dist/` + artifact middleware. Honors **`DBT_TOOLS_DBT_TARGET`** / **`DBT_TOOLS_TARGET_DIR`**, remote client env vars, and **`DBT_TOOLS_DEBUG`**. Does **not** use Vite file-watch env vars.
139
139
  - **Dockerfile (nginx):** builds static **`dist/`** and serves it with **nginx**. There is **no** Node artifact middleware in that image unless you change the deployment shape, so the same **`DBT_TOOLS_*`** server env vars **do not apply** to that container as shipped.
140
140
 
141
141
  ### Build static image (monorepo)
@@ -174,8 +174,8 @@ Set package visibility under the repository **Packages** settings if needed.
174
174
 
175
175
  | Symptom | What to check |
176
176
  | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
177
- | Blank UI / no artifacts | Pass **`--target`** or set **`DBT_TOOLS_TARGET_DIR`** to a folder that contains **`manifest.json`** (and ideally `run_results.json`). For remote mode, set **`DBT_TOOLS_REMOTE_SOURCE`**. |
178
- | Blank page / “No artifacts found” | Same as above: confirm **`DBT_TOOLS_TARGET_DIR`** or **`DBT_TOOLS_REMOTE_SOURCE`** resolves to a complete artifact pair. |
177
+ | Blank UI / no artifacts | Pass **`--target`** or set **`DBT_TOOLS_TARGET_DIR`** for local startup. For remote, use **Load artifacts** with a complete `manifest.json` + `run_results.json` pair. |
178
+ | Blank page / “No artifacts found” | Same as above: confirm local **`DBT_TOOLS_TARGET_DIR`** or remote discovery found a complete artifact pair. |
179
179
  | `GET /api/...` or `GET /api/manifest.json` 404 | **`DBT_TOOLS_TARGET_DIR`** unset, wrong path, or (remote) no complete pair discovered. |
180
180
  | Auto-reload not triggering (Vite) | Ensure **`DBT_TOOLS_WATCH`** is not `0`; confirm read access to the target directory. See [Vite dev server (monorepo)](#vite-dev-server-monorepo). |
181
181
  | Expected “hot reload” after `dbt run` | The **npm** server re-reads files when the app fetches them; refresh the browser. **File watch + auto-reload** is a **Vite dev** feature — see [Vite dev server (monorepo)](#vite-dev-server-monorepo). |
@@ -225,7 +225,7 @@ DBT_TOOLS_TARGET_DIR=./target pnpm dev
225
225
 
226
226
  When you run `pnpm dev` / `pnpm dev:web` from the repository, **Vite** serves the app with middleware that mirrors the same **`/api/...`** artifact routes as the published **`dbt-tools-web`** server. Additional **file watching** and auto-reload apply only here.
227
227
 
228
- Without env prefill, use the in-app **Load artifacts** panel: choose **local**, **S3**, or **GCS**, enter a **location** (directory path or `s3://` / `gs://` bucket prefix), run **Discover**, then **select a run** when more than one complete `manifest.json` + `run_results.json` pair exists. Cloud credentials never enter the browser—they stay in the Node server (same model as `DBT_TOOLS_REMOTE_SOURCE` in [ADR-0004](../../docs/adr/0004-remote-object-storage-artifact-sources-and-auto-reload.md)).
228
+ Use the in-app **Load artifacts** panel: choose **local**, **S3**, or **GCS**, enter a **location** (directory path or `s3://` / `gs://` bucket prefix), run **Discover**, then **select a run** when more than one complete `manifest.json` + `run_results.json` pair exists. Cloud credentials never enter the browser—they stay in the Node server ([ADR-0004](../../docs/adr/0004-remote-object-storage-artifact-sources-and-auto-reload.md)).
229
229
 
230
230
  #### Debug logging
231
231
 
@@ -254,34 +254,28 @@ DBT_TOOLS_WATCH=0 DBT_TOOLS_TARGET_DIR=./target pnpm dev
254
254
 
255
255
  To smoke-test the published **`dbt-tools-web`** entrypoint and tarball layout **without publishing to the public npm registry**:
256
256
 
257
- - **Recommended (matches CI):** from the **repository root** after `pnpm install`, run Verdaccio, publish `@dbt-tools/core` → `@dbt-tools/web`, pack, then `npx` with `NPM_CONFIG_REGISTRY` pointing at that registry. `dbt-artifacts-parser` is resolved from npm:
257
+ - **Recommended (matches CI):** from the **repository root** after `pnpm install`, run Verdaccio, publish **`@dbt-tools/core` first** (same semver as web), then `@dbt-tools/web`, pack, and smoke via `npm install` with `NPM_CONFIG_REGISTRY` pointing at that registry. `dbt-artifacts-parser` is resolved from npm:
258
258
 
259
259
  ```bash
260
260
  bash scripts/smoke-npx-with-verdaccio.sh
261
261
  ```
262
262
 
263
- This avoids **`No matching version found for @dbt-tools/core@…`** when those versions are not yet on npm (packed tarballs list concrete semver peers).
263
+ This avoids **`No matching version found for @dbt-tools/core@…`** and stale **npmjs** `core@0.6.1` without entrypoint exports when your branch adds new `@dbt-tools/core` APIs (packed web lists `"@dbt-tools/core": "0.6.2"`).
264
264
 
265
- - **Manual pack only** (only reliable if peer versions already exist on the registry `npx` uses, or you set `NPM_CONFIG_REGISTRY` accordingly):
265
+ - **Manual pack only** (only reliable if `@dbt-tools/core@<version>` exists on the registry you use, or set `NPM_CONFIG_REGISTRY` accordingly):
266
266
 
267
267
  ```bash
268
268
  pnpm --filter @dbt-tools/web pack
269
+ export NPM_CONFIG_REGISTRY=http://127.0.0.1:4873 # if using local Verdaccio
270
+ pnpm --filter @dbt-tools/web run smoke:npx-tgz
269
271
  ```
270
272
 
271
273
  `prepack` runs the full web build and writes **`dbt-tools-web-<version>.tgz` at the repo root** (the file is gitignored).
272
274
 
273
- - **Empty directory** so `npx` does not see the monorepo’s `node_modules`:
274
-
275
- ```bash
276
- cd "$(mktemp -d)"
277
- # After copying the .tgz into this directory (adjust version to match package.json):
278
- npx -y ./dbt-tools-web-0.4.1.tgz -- --help
279
- ```
280
-
281
- If you pass a **bare absolute path** to the tarball, some `npx` versions try to execute it as a shell script and fail (`Permission denied`). Prefer either a **relative** `./…tgz` path or an explicit package spec:
275
+ - **Empty directory** (smoke script uses `npm install` + `node_modules/.bin/dbt-tools-web`, not bare `npx` on the tarball path):
282
276
 
283
277
  ```bash
284
- npx -y --package=/absolute/path/to/dbt-tools-web-0.4.1.tgz -- dbt-tools-web --help
278
+ REPO_ROOT=/path/to/dbt-tools-ts bash packages/web/scripts/smoke-npx-packed-tarball.sh
285
279
  ```
286
280
 
287
281
  ### Project layout (abridged)