@eventpipe/cli 0.2.1 → 0.2.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.
Files changed (2) hide show
  1. package/README.md +208 -38
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,79 +1,249 @@
1
- # @eventpipe/cli
1
+ # Event Pipe CLI
2
2
 
3
- Build **Event Pipe** code-node bundles with [esbuild](https://esbuild.github.io/), publish with an **API key**, and use **login / create / listen** against the dashboard (Supabase session + relay WebSocket).
3
+ Official command-line tool for **[Event Pipe](https://eventpipe.app)** build code-node bundles, publish new versions of your flows, and manage webhooks from the terminal.
4
4
 
5
- ## Install
5
+ **Website:** [eventpipe.app](https://eventpipe.app)
6
+
7
+ Use this CLI when you want to work locally with TypeScript, automate publishes with an API key, stream incoming webhooks to your machine, or forward them to a dev server.
8
+
9
+ ---
10
+
11
+ ## What you can do
12
+
13
+ | Area | What the CLI does |
14
+ |------|-------------------|
15
+ | **Account** | Sign in with your browser (`login`) — same account as on the web app. |
16
+ | **Webhooks** | Create new webhook endpoints (`create`) and stream events in real time (`listen`). |
17
+ | **Code & deploy** | Bundle your handler with esbuild (`build`) and upload a new pipeline version (`push`). |
18
+ | **Tooling** | Check the installed version, update from npm, and opt out of update hints in CI. |
19
+
20
+ ---
21
+
22
+ ## Requirements
23
+
24
+ - **Node.js 20 or newer** ([nodejs.org](https://nodejs.org))
25
+ - An Event Pipe account (sign up at [eventpipe.app](https://eventpipe.app))
26
+
27
+ ---
28
+
29
+ ## Installation
30
+
31
+ ### Global (recommended)
32
+
33
+ Installs the `eventpipe` and `eventpipe-cli` commands on your PATH:
6
34
 
7
35
  ```bash
8
- pnpm add -D @eventpipe/cli
9
- # or: npm i -D @eventpipe/cli
36
+ npm install -g @eventpipe/cli
10
37
  ```
11
38
 
12
- Global install (provides `eventpipe` and `eventpipe-cli`):
39
+ ### Per project (dev dependency)
13
40
 
14
41
  ```bash
15
- npm install -g @eventpipe/cli
42
+ npm add -D @eventpipe/cli
43
+ # or: pnpm add -D @eventpipe/cli
16
44
  ```
17
45
 
18
- **macOS / Linux** from a clone of this repo, installs globally (requires Node 20+ and `npm` on `PATH`):
46
+ Run with `npx eventpipe …` or add an npm script.
47
+
48
+ ### Install scripts (from a clone of this repo)
49
+
50
+ If you cloned the repository, you can use the helper scripts (they check Node 20+ and run a global install):
51
+
52
+ **macOS / Linux**
19
53
 
20
54
  ```bash
21
55
  bash install/macos.sh
22
56
  ```
23
57
 
24
- **Windows** PowerShell:
58
+ **Windows (PowerShell)**
25
59
 
26
60
  ```powershell
27
61
  Set-ExecutionPolicy -Scope Process Bypass; .\install\windows.ps1
28
62
  ```
29
63
 
30
- From a git checkout:
64
+ ### Develop from source
31
65
 
32
66
  ```bash
33
- cd eventpipe-cli && pnpm install && pnpm run build
34
- # binaries: ./dist/cli.js
67
+ git clone <repo-url> && cd eventpipe-cli
68
+ pnpm install && pnpm run build
69
+ node dist/cli.js --help
35
70
  ```
36
71
 
37
- ## Project layout
72
+ ---
73
+
74
+ ## Quick start
75
+
76
+ 1. **Sign in** (opens the browser; credentials are saved under your home directory):
77
+
78
+ ```bash
79
+ eventpipe login
80
+ ```
38
81
 
39
- | File | Purpose |
40
- |------|---------|
41
- | `eventpipe.json` | `pipelineId`, optional `nodeId` / `entry`, and `settings` (must include `pipe` v3) |
42
- | `src/handler.ts` | Default entry — `export async function handler(event, context)` |
82
+ By default this uses **[https://eventpipe.app](https://eventpipe.app)**. Set `EVENTPIPE_BASE_URL` only if you use a self-hosted app.
43
83
 
44
- Runtime uses **`context.env`** for secrets (configure values in the app **Event** tab), not `process.env`.
84
+ 2. **Create a webhook endpoint** (optional slug for a readable URL):
85
+
86
+ ```bash
87
+ eventpipe create --name my-endpoint
88
+ ```
89
+
90
+ Note the **webhook id** from the output or from the [dashboard](https://eventpipe.app).
91
+
92
+ 3. **Listen for events** (replace with your webhook id):
93
+
94
+ ```bash
95
+ eventpipe listen <webhookId>
96
+ ```
97
+
98
+ 4. **In a project with `eventpipe.json`**, build and publish:
99
+
100
+ ```bash
101
+ eventpipe build
102
+ export EVENTPIPE_API_KEY=evp_your_key # from Account → API keys on the app
103
+ eventpipe push
104
+ ```
105
+
106
+ ---
45
107
 
46
108
  ## Commands
47
109
 
48
- ### Auth & endpoints
110
+ ### `eventpipe login`
111
+
112
+ Opens your browser to complete sign-in (session stored for the CLI). Credentials are written to **`~/.eventpipe/credentials.json`** (Unix) or the equivalent under your user profile on Windows.
113
+
114
+ - **Default app URL:** `https://eventpipe.app`
115
+ - **Override:** set `EVENTPIPE_BASE_URL` to your own deployment origin (no trailing slash), e.g. `https://app.example.com`.
116
+
117
+ ---
118
+
119
+ ### `eventpipe create [--name <slug>]`
120
+
121
+ Creates a new webhook endpoint using your logged-in session.
122
+
123
+ | Option | Meaning |
124
+ |--------|---------|
125
+ | `--name <slug>` | If the slug is free, your webhook URL can use that path; if it is taken, the CLI creates the endpoint with a random id and may warn you. |
126
+ | *(none)* | URL and label are generated for you. |
127
+
128
+ You’ll see the public webhook URL in the output. Manage endpoints in the [web app](https://eventpipe.app).
129
+
130
+ ---
131
+
132
+ ### `eventpipe listen <webhookId> [options]`
133
+
134
+ Connects to Event Pipe’s relay and prints **one line per incoming webhook** on stdout. Use this to debug integrations or pipe events into scripts.
135
+
136
+ | Option | Short | Description |
137
+ |--------|-------|-------------|
138
+ | `--verbose` | `-v` | Print the full event payload (method, headers, query, body) as formatted JSON after the summary line. |
139
+ | `--json` | | Print **one JSON object per line** (NDJSON) on stdout — good for tooling and `jq`. |
140
+ | `--forward-to <url>` | | Replay each event as an HTTP request to your URL (e.g. local server). Forward result messages go to **stderr** so stdout stays clean for `--json`. |
49
141
 
50
- - **`login`** — Opens the browser to complete Supabase login; saves `~/.eventpipe/credentials.json`. Uses `https://eventpipe.app` unless `EVENTPIPE_BASE_URL` is set.
51
- - **`create [--name <slug>]`** — `POST /api/account/endpoints` (session auth). `--name` sets the URL slug (`/api/webhook/your-slug`) if it’s free; otherwise a random id is used. With no `--name`, the URL and display label are random.
52
- - **`listen <webhookId> [options]`** — Connects to the relay; prints one line per webhook. **`--verbose` / `-v`** prints the full event JSON (method, headers, query, body). **`--json`** prints one JSON object per line (stdout) for scripts. **`--forward-to http://127.0.0.1:PORT/path`** replays each request to your local server (forward status on stderr).
142
+ **Examples**
53
143
 
54
- ### Bundles
144
+ ```bash
145
+ eventpipe listen abc123
146
+ eventpipe listen abc123 -v
147
+ eventpipe listen abc123 --json | jq .
148
+ eventpipe listen abc123 --forward-to http://127.0.0.1:3000/webhook
149
+ ```
150
+
151
+ **Requirements:** you must have run **`eventpipe login`** first. The hosted app must be configured with a compatible relay service (see your deployment docs / `.env.example` for relay-related variables).
152
+
153
+ ---
154
+
155
+ ### `eventpipe build [--dir <path>]`
156
+
157
+ Reads **`eventpipe.json`** in the project (or `--dir`), bundles your code nodes with [esbuild](https://esbuild.github.io/), and writes artifacts under **`.eventpipe/`** (sizes and hashes are printed). Each bundle must stay within the **200KB** limit (same as the server).
158
+
159
+ ---
160
+
161
+ ### `eventpipe push [--dir <path>]`
162
+
163
+ Runs **`build`**, then uploads a **new version** of your pipeline to Event Pipe using your **API key** (not the browser session).
164
+
165
+ | Need | Detail |
166
+ |------|--------|
167
+ | `EVENTPIPE_API_KEY` | **Required.** Create an API key in the app (format like `evp_…`). |
168
+ | `EVENTPIPE_BASE_URL` | Optional; defaults to `https://eventpipe.app`. |
169
+ | `--pipeline <uuid>` or `--flow <uuid>` | Optional; overrides `pipelineId` in `eventpipe.json` for this push only. |
170
+
171
+ Example:
172
+
173
+ ```bash
174
+ export EVENTPIPE_API_KEY=evp_xxxxxxxx
175
+ eventpipe push --dir ./my-flow
176
+ ```
177
+
178
+ ---
179
+
180
+ ### `eventpipe update`
181
+
182
+ Runs **`npm install -g @eventpipe/cli@latest`** so you get the newest published CLI (uses `npm` on your PATH; on Windows the CLI invokes `npm.cmd` as needed).
183
+
184
+ ---
185
+
186
+ ### `eventpipe --version` / `eventpipe -v`
187
+
188
+ Prints the installed package version.
189
+
190
+ ---
191
+
192
+ ### `eventpipe help` / `eventpipe --help`
193
+
194
+ Prints built-in usage.
195
+
196
+ ---
197
+
198
+ ## Project layout (for `build` / `push`)
199
+
200
+ | File / folder | Role |
201
+ |---------------|------|
202
+ | **`eventpipe.json`** | **`pipelineId`**, flow **`settings`** (must include `pipe` v3), and optional **`nodeId`**, **`entry`**, or **`codeNodes`** map. |
203
+ | **`src/handler.ts`** | Default entry if you don’t set `entry` — export `handler(event, context)`. |
204
+ | **`.eventpipe/`** | Generated bundles (created by `build` / `push`). |
205
+
206
+ **Secrets at runtime:** in the cloud, your flow uses **`context.env`** for configured secrets (set in the app’s **Event** / pipeline UI), not `process.env` in the bundle.
207
+
208
+ ---
209
+
210
+ ## Environment variables
211
+
212
+ | Variable | When it matters | Description |
213
+ |----------|-----------------|-------------|
214
+ | **`EVENTPIPE_BASE_URL`** | `login`, `push` | App origin, no trailing slash. **Default:** `https://eventpipe.app`. Use your own origin for self-hosted deployments. |
215
+ | **`EVENTPIPE_API_KEY`** | `push` | Account API key (`evp_…`). Required to publish versions from the CLI. |
216
+ | **`EVENTPIPE_SKIP_UPDATE_CHECK`** | any | Set to `1` to disable the occasional **“newer version on npm”** message on stderr (useful in CI). |
217
+
218
+ ---
219
+
220
+ ## Update hints
221
+
222
+ After most commands, the CLI may check npm for a **newer `@eventpipe/cli`** and print a short message on **stderr** suggesting:
223
+
224
+ ```bash
225
+ eventpipe update
226
+ ```
55
227
 
56
- - **`build`** Writes `.eventpipe/*.bundle.js` and prints size + sha256 (must be ≤ 200KB).
57
- - **`push`** — Runs `build`, then `POST /api/account/pipelines/:pipelineId/versions` with `codeBundles`.
228
+ To turn this off, set `EVENTPIPE_SKIP_UPDATE_CHECK=1`.
58
229
 
59
- ### Environment
230
+ ---
60
231
 
61
- | Variable | Used by | Description |
62
- |----------|---------|-------------|
63
- | `EVENTPIPE_BASE_URL` | login, push | Origin of the Next app (default `https://eventpipe.app`; no trailing slash) |
64
- | `EVENTPIPE_API_KEY` | push | Plaintext key from account API keys (`evp_...`) |
232
+ ## Example project
65
233
 
66
- Optional: `--pipeline <uuid>` (or `--flow`) overrides `pipelineId` in `eventpipe.json` for `push`.
234
+ See **`examples/stripe-webhook`** in this repository for a sample layout and Stripe-oriented flow.
67
235
 
68
- ### Server requirements for `listen`
236
+ ---
69
237
 
70
- The app needs a deployed **eventpipe-relay** (or compatible) service plus env vars documented in the app `.env.example`: `EVENTPIPE_RELAY_URL`, `EVENTPIPE_RELAY_WS_URL`, `EVENTPIPE_RELAY_INGEST_SECRET`, `EVENTPIPE_LISTEN_JWT_SECRET` (shared with the relay).
238
+ ## Limits (current CLI)
71
239
 
72
- ## Example
240
+ - **Single-code-node focus:** one primary code-node workflow per project is the happy path; multi-node flows may need publishing from the **[dashboard](https://eventpipe.app)** or extending the CLI.
241
+ - **Bundle size:** **200KB** UTF-8 per code-node bundle (enforced locally and on the server).
73
242
 
74
- See `examples/stripe-webhook` (Stripe Balance via REST to stay under the bundle size cap).
243
+ ---
75
244
 
76
- ## Limits
245
+ ## Getting help
77
246
 
78
- - One **code node** per project in this CLI version (multi-node flows: publish from the dashboard or extend the CLI).
79
- - Per-node bundle max **200KB** UTF-8 (same as the server).
247
+ - **Product & docs:** [eventpipe.app](https://eventpipe.app)
248
+ - **CLI usage:** `eventpipe help`
249
+ - **Issues:** use your repository’s issue tracker if you develop the CLI from source.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eventpipe/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Build and publish Event Pipe flow bundles (API key auth)",
5
5
  "type": "module",
6
6
  "bin": {