@superglue/cli 1.1.18 → 1.1.20

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 (30) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dist/cli.js +832 -23922
  3. package/dist/skills/superglue/SKILL.md +240 -27
  4. package/dist/skills/superglue/references/access-rules.md +137 -0
  5. package/dist/skills/superglue/references/data-handling.md +303 -0
  6. package/dist/skills/superglue/references/databases.md +7 -3
  7. package/dist/skills/superglue/references/file-handling.md +160 -0
  8. package/dist/skills/superglue/references/file-servers.md +13 -37
  9. package/dist/skills/superglue/references/http-apis.md +248 -0
  10. package/dist/skills/superglue/references/redis.md +4 -5
  11. package/package.json +2 -1
  12. package/skills/superglue/SKILL.md +240 -27
  13. package/skills/superglue/references/access-rules.md +137 -0
  14. package/skills/superglue/references/data-handling.md +303 -0
  15. package/skills/superglue/references/databases.md +7 -3
  16. package/skills/superglue/references/file-handling.md +160 -0
  17. package/skills/superglue/references/file-servers.md +13 -37
  18. package/skills/superglue/references/http-apis.md +248 -0
  19. package/skills/superglue/references/redis.md +4 -5
  20. package/dist/dist/cli.js +0 -24370
  21. package/dist/dist/skills/superglue/SKILL.md +0 -678
  22. package/dist/dist/skills/superglue/agents/openai.yaml +0 -7
  23. package/dist/dist/skills/superglue/assets/superglue.png +0 -0
  24. package/dist/dist/skills/superglue/references/databases.md +0 -249
  25. package/dist/dist/skills/superglue/references/file-servers.md +0 -136
  26. package/dist/dist/skills/superglue/references/integration.md +0 -279
  27. package/dist/dist/skills/superglue/references/redis.md +0 -190
  28. package/dist/dist/skills/superglue/references/transforms-and-output.md +0 -92
  29. package/dist/skills/superglue/references/transforms-and-output.md +0 -92
  30. package/skills/superglue/references/transforms-and-output.md +0 -92
@@ -1,678 +0,0 @@
1
- ---
2
- name: superglue
3
- description: "Build, test, deploy and integrate superglue tools via the sg CLI and superglue SDKs. IMPORTANT — you MUST invoke this skill and read the full reference BEFORE running ANY sg command or writing ANY superglue SDK/REST/webhook integration code. Before using the sg CLI, first check that it is installed (run sg --version; if not found, install with npm install -g @superglue/cli), then verify it is configured (check that sg init has been run or that SUPERGLUE_API_KEY and SUPERGLUE_API_ENDPOINT environment variables are set). If not, guide the user through setup first. After reading the SKILL.md file, also read the relevant references/ files for the specific topic (databases, file servers, transforms, integration/SDK)."
4
- ---
5
-
6
- # superglue CLI (`sg`) — Agent Reference
7
-
8
- ## CRITICAL RULES — READ FIRST
9
-
10
- **Pre-requisites for using the CLI**
11
-
12
- 1. **Check CLI exists**: Run `sg --version`. If it fails with `command not found`, install it: `npm install -g @superglue/cli`
13
- 2. **Check superglue CLI config exists**: Run `sg system list`. If it fails with `fetch failed` or auth errors, the CLI needs configuration via `sg init` (see below).
14
-
15
- **Calling systems and running tools**
16
-
17
- 1. ALWAYS make sure you pull the relevant system context using `sg system find` before calling system endpoints and running inline JSON tools or building new tools.
18
- 2. Use `sg system search-docs` to do a targeted keyword search of system docs if you're unsure about how a system works.
19
-
20
- **Authentication & Credentials:**
21
-
22
- - **Auth headers MUST be set explicitly** — credentials are NEVER auto-injected into requests or tool steps
23
- - Every request step (in tools AND `sg system call`) must include the appropriate auth header using `<<systemId_credentialKey>>` syntax
24
- - OAuth systems also require explicit headers — only token refresh is automatic
25
-
26
- **Saving Tools:**
27
-
28
- - **Don't save a tool without explicit user confirmation** — always ask "Should I save this tool?" first
29
- - After `sg tool build` + `sg tool run`, present results to the user and wait for approval
30
- - Only run `sg tool save --draft <id>` after the user explicitly confirms
31
-
32
- **Credentials in Non-Interactive Environments (AI Agents, CI):**
33
-
34
- - **Pass ALL credentials (including secrets) directly via `--credentials` JSON** — do NOT use `--sensitive-credentials` (it requires an interactive TTY which agents don't have)
35
- - Ask the user to provide secret values, then pass them in `--credentials '{"api_key":"sk-xxx"}'`
36
-
37
- ---
38
-
39
- ## Installation & Setup
40
-
41
- ### Installing the CLI
42
-
43
- ```bash
44
- npm install -g @superglue/cli
45
- ```
46
-
47
- After installation, the `sg` command is available globally.
48
-
49
- ### Initialization (REQUIRED before first use)
50
-
51
- The CLI **will not work** until configured with an API key. The endpoint defaults to `https://api.superglue.cloud` if not specified.
52
-
53
- **Option A: Interactive setup (recommended for humans)**
54
-
55
- ```bash
56
- sg init
57
- ```
58
-
59
- This prompts for:
60
-
61
- 1. **API Key** (required) — get one at https://app.superglue.cloud/admin?view=api-keys
62
- 2. **API Endpoint** — defaults to `https://api.superglue.cloud`
63
- 3. **Web Endpoint** — for OAuth callbacks, auto-derived from API endpoint
64
- 4. **Output mode** — `stdout` (default) or `stdout+file`
65
- 5. **Config location** — project-local (`.superglue/config.json`) or global (`~/.superglue/config.json`)
66
-
67
- It verifies the connection before saving. On success it creates the config file, a `drafts/` directory, and updates `.gitignore` if using local config.
68
-
69
- **Option B: Non-interactive init (recommended for CI and AI agents)**
70
-
71
- Pass the global `--api-key` flag to skip interactive prompts and save a config file:
72
-
73
- ```bash
74
- sg init --api-key "your-api-key" --global
75
- sg init --api-key "your-api-key" --endpoint "https://custom.endpoint.com" --global
76
- ```
77
-
78
- > **Note:** `--api-key` and `--endpoint` are global flags (not shown in `sg init --help`). They work on all subcommands including `init`.
79
-
80
- **Option C: Environment variables (no config file)**
81
-
82
- If you don't need a persistent config file, set these env vars instead:
83
-
84
- ```bash
85
- export SUPERGLUE_API_KEY="your-api-key"
86
- export SUPERGLUE_API_ENDPOINT="https://api.superglue.cloud" # optional, this is the default
87
- ```
88
-
89
- With these set, all `sg` commands work without a config file.
90
-
91
- **Option C: CLI flags (per-command override)**
92
-
93
- ```bash
94
- sg system list --api-key "your-key" --endpoint "https://api.superglue.cloud"
95
- ```
96
-
97
- ### Config Resolution Order
98
-
99
- CLI flags > environment variables > config file (local `.superglue/config.json` > global `~/.superglue/config.json`).
100
-
101
- ### Verifying Setup
102
-
103
- After configuring, verify the connection works:
104
-
105
- ```bash
106
- sg system list # should return a list (possibly empty) without errors
107
- ```
108
-
109
- ---
110
-
111
- ## Quick Start
112
-
113
- ```bash
114
- sg system list
115
- sg tool build --config '{"id":"...","instruction":"...","steps":[...]}'
116
- sg tool run --draft <draftId>
117
- sg tool save --draft <draftId>
118
- ```
119
-
120
- ## Global Flags
121
-
122
- | Flag | Description |
123
- | ------------------ | ------------------------------------------- |
124
- | `--json` | Force JSON output (auto-enabled in non-TTY) |
125
- | `--api-key <key>` | Override API key |
126
- | `--endpoint <url>` | Override API endpoint |
127
-
128
- ## Command Reference
129
-
130
- ### `sg init`
131
-
132
- Interactive setup — API key, endpoint, output mode. Creates `.superglue/`.
133
-
134
- ### Tool Commands
135
-
136
- **`sg tool build`** — Register a tool config. Returns a `draftId`. Not AI-powered — you provide the full config.
137
-
138
- ```bash
139
- sg tool build --config '{"id":"...","steps":[...]}' # inline JSON
140
- sg tool build --id my-tool --instruction "..." --steps steps.json --payload '{"key":"val"}'
141
- sg tool build --config tool.json # from file
142
- ```
143
-
144
- | `--config <file-or-json>` | Full JSON config (file path or inline JSON string) |
145
- | `--id <id>` | Tool ID (kebab-case) |
146
- | `--instruction <text>` | Human-readable description |
147
- | `--steps <file>` | JSON file with steps array |
148
- | `--payload <json>` | Sample payload |
149
- | `--file <key=path>` | Attach file reference |
150
-
151
- **`sg tool run`** — Execute a draft or saved tool. Streams live execution logs to the terminal.
152
-
153
- ```bash
154
- sg tool run --draft <draftId> --payload '{"userId":"123"}'
155
- sg tool run --tool my-tool --payload-file payload.json
156
- ```
157
-
158
- | `--draft <id>` / `--tool <id>` | Draft ID or saved tool ID |
159
- | `--payload <json>` / `--payload-file <path>` | Payload |
160
- | `--include-step-results` | Include raw step results |
161
- | `--include-config` | Include full tool config |
162
-
163
- **`sg tool edit`** — Apply JSON Patch (RFC 6902) operations.
164
-
165
- ```bash
166
- sg tool edit --draft <draftId> --patches '[{"op":"replace","path":"/steps/0/config/url","value":"..."}]'
167
- sg tool edit --tool my-tool --patches patches.json
168
- ```
169
-
170
- | `--patches <json-or-file>` | JSON Patch array (inline or file) |
171
-
172
- **`sg tool save`** — Persist draft to database. Deletes draft file on success.
173
-
174
- ```bash
175
- sg tool save --draft <draftId>
176
- ```
177
-
178
- **`sg tool list` / `sg tool find`**
179
-
180
- ```bash
181
- sg tool list # all non-archived tools
182
- sg tool find "shopify orders" # search (compact results)
183
- sg tool find --id my-tool # exact ID lookup (full config)
184
- ```
185
-
186
- ### System Commands
187
-
188
- **`sg system create`**
189
-
190
- **Required flags:**
191
-
192
- - `--name <name>` — Human-readable display name
193
- - `--url <url>` — API base URL (auto-filled when using `--template`)
194
-
195
- **Optional:**
196
-
197
- - `--id <id>` — System ID (lowercase, underscores only, no hyphens). Derived from `--name` if omitted.
198
- - `--template <id>` — Pre-configured template (auto-fills name and url if not provided)
199
-
200
- **Example with credentials (non-interactive — use this in AI agent / CI contexts):**
201
-
202
- ```bash
203
- sg system create --name "My API" --url https://api.example.com \
204
- --credentials '{"api_key":"sk-xxx"}'
205
- ```
206
-
207
- **With template:**
208
-
209
- ```bash
210
- sg system create --name "Slack" --template slack
211
- ```
212
-
213
- **Full flag reference:**
214
-
215
- | Flag | Description |
216
- | ---------------------------------- | ---------------------------------------------------------------------------- |
217
- | `--name <name>` | Human-readable name — **REQUIRED** |
218
- | `--id <id>` | System ID (lowercase, underscores only) — derived from name if omitted |
219
- | `--url <url>` | API base URL — **REQUIRED** (auto-filled by `--template`) |
220
- | `--template <id>` | Template ID (stripe, shopify, slack, etc.) |
221
- | `--credentials <json>` | Credentials JSON (use for ALL creds in non-interactive mode) |
222
- | `--sensitive-credentials <fields>` | Comma-separated fields for masked input (TTY only — do NOT use in AI agents) |
223
- | `--docs-url <url>` | Documentation URL to scrape |
224
- | `--openapi-url <url>` | OpenAPI spec URL |
225
- | `--env <environment>` | Environment: `dev` or `prod` (default: prod) |
226
-
227
- **`sg system edit`** — Update system config or credentials. Supports `--env dev|prod`.
228
- **`sg system list` / `sg system find`** — List or search systems. `find` supports `--env dev|prod`.
229
-
230
- **`sg system call`** — **CRITICAL for tool building.** Make authenticated calls to APIs, databases, and file servers. Use this to:
231
-
232
- - Explore API endpoints and response structures
233
- - Verify field names and data shapes BEFORE building tools
234
-
235
- ```bash
236
-
237
- # POST request with auth and body
238
- sg system call --url https://api.example.com/users \
239
- --system-id my_api \
240
- --method POST \
241
- --headers '{"Authorization":"Bearer <<my_api_access_token>>"}' \
242
- --body '{"name":"test"}'
243
-
244
- # Database query (Postgres)
245
- sg system call --url "postgres://<<my_db_host>>:5432/mydb" \
246
- --system-id my_db \
247
- --body '{"query":"SELECT * FROM users LIMIT 5"}'
248
-
249
- # Redis command
250
- sg system call --url "redis://<<my_redis_host>>:6379/0" \
251
- --system-id my_redis \
252
- --body '{"command":"HGETALL","args":["user:123"]}'
253
-
254
- # File server (SFTP)
255
- sg system call --url "sftp://<<my_sftp_host>>:22/data" \
256
- --system-id my_sftp \
257
- --body '{"operation":"list","path":"/"}'
258
- ```
259
-
260
- | Flag | Description |
261
- | ------------------- | ------------------------------------------------------------------------------------------------- |
262
- | `--url <url>` | Full URL with protocol (http/https/postgres/postgresql/mssql/sqlserver/redis/rediss/sftp/ftp/smb) |
263
- | `--system-id <id>` | System ID for credential injection |
264
- | `--method <method>` | HTTP method (GET, POST, PUT, DELETE, PATCH) |
265
- | `--headers <json>` | HTTP headers JSON with credential placeholders |
266
- | `--body <string>` | Request body (JSON string) |
267
- | `--env <env>` | Environment: `dev` or `prod` |
268
- | `--file <key=path>` | File references (repeatable) |
269
-
270
- **`sg system search-docs`** — Search system documentation.
271
-
272
- ```bash
273
- sg system search-docs --system-id slack -k "send message channels"
274
- ```
275
-
276
- **`sg system oauth`** — Authenticate via OAuth.
277
-
278
- ```bash
279
- sg system oauth --system-id gmail --scopes "https://www.googleapis.com/auth/gmail.readonly"
280
- sg system oauth --system-id my_api --grant-type client_credentials --scopes "read write"
281
- ```
282
-
283
- | `--system-id <id>` | Required |
284
- | `--scopes <scopes>` | Space-separated OAuth scopes (required) |
285
- | `--grant-type <type>` | `authorization_code` (default) or `client_credentials` |
286
-
287
- ### Run Commands
288
-
289
- **`sg run list`** — List execution runs. Filter by `--tool`, `--status`, `--source`, `--limit`.
290
- **`sg run get <runId>`** — Get run details. `--fetch-results` to include data.
291
-
292
- ---
293
-
294
- ## Tool Configuration — Full Schema
295
-
296
- ```json
297
- {
298
- "id": "kebab-case-tool-name",
299
- "instruction": "Brief human-readable description of what this tool does",
300
- "steps": [
301
- {
302
- "id": "unique-step-id",
303
- "config": {
304
- "systemId": "example_system",
305
- "url": "https://api.example.com/endpoint?param=<<payload_field>>",
306
- "method": "GET",
307
- "headers": {
308
- "Authorization": "Bearer <<example_system_access_token>>"
309
- },
310
- "queryParams": { "limit": "10" },
311
- "body": "{ \"key\": \"<<payload_field>>\" }"
312
- },
313
- "dataSelector": "(sourceData) => sourceData.previousStep.data.items",
314
- "failureBehavior": "fail"
315
- }
316
- ],
317
- "outputTransform": "(sourceData) => sourceData.stepId.data",
318
- "outputSchema": { "type": "object", "properties": {} },
319
- "inputSchema": { "type": "object", "properties": {} }
320
- }
321
- ```
322
-
323
- ### Step Config Fields (Request Steps)
324
-
325
- | Field | Type | Description |
326
- | ------------- | ------ | -------------------------------------------- |
327
- | `type` | string | `"request"` (default, can be omitted) |
328
- | `systemId` | string | System whose credentials to use |
329
- | `url` | string | Full URL with `<<variable>>` placeholders |
330
- | `method` | string | HTTP method |
331
- | `headers` | object | HTTP headers with credential placeholders |
332
- | `queryParams` | object | URL query parameters |
333
- | `body` | string | Request body (JSON string with placeholders) |
334
- | `pagination` | object | Auto-pagination config (see below) |
335
-
336
- ### Step Config Fields (Transform Steps)
337
-
338
- | Field | Type | Description |
339
- | --------------- | ------ | ------------------------------------------------ |
340
- | `type` | string | `"transform"` — **REQUIRED** for transform steps |
341
- | `transformCode` | string | JS function: `(sourceData) => transformedData` |
342
-
343
- ### Step Behavior Fields
344
-
345
- | Field | Type | Description |
346
- | ----------------- | ------ | ------------------------------------------------ |
347
- | `dataSelector` | string | JS function controlling step input and loop mode |
348
- | `failureBehavior` | string | `fail` (default) or `continue` |
349
-
350
- ---
351
-
352
- ## Credential Placeholders
353
-
354
- System credentials are namespaced as `<<systemId_credentialKey>>` and resolved server-side at execution time. **You MUST explicitly reference them in headers.**
355
-
356
- ### Auth Header Patterns
357
-
358
- ```json
359
- {"Authorization": "Bearer <<stripe_api_key>>"}
360
- {"Authorization": "Bearer <<gmail_access_token>>"}
361
- {"X-API-Key": "<<my_api_api_key>>"}
362
- {"Authorization": "Basic <<my_api_username>>:<<my_api_password>>"}
363
- ```
364
-
365
- Basic auth is auto-encoded: if the value after `Basic ` isn't already base64, the engine encodes it automatically.
366
-
367
- ### Credential Lifecycle
368
-
369
- - Non-sensitive creds (`client_id`, `auth_url`, etc.) are stored via `--credentials`
370
- - Sensitive creds (`api_key`, `client_secret`) — in non-interactive mode (AI agents, CI), pass via `--credentials` JSON. In interactive TTY, use `--sensitive-credentials` for masked input, or set `SUPERGLUE_CRED_<FIELD>` env vars.
371
- - OAuth tokens (`access_token`, `refresh_token`) are auto-refreshed before each step execution
372
-
373
- ---
374
-
375
- ## Variables and Data Flow
376
-
377
- ### Variable Syntax
378
-
379
- All step config fields support `<<variable>>` placeholders:
380
-
381
- | Syntax | Resolves to |
382
- | -------------------------- | --------------------------- |
383
- | `<<fieldName>>` | Payload field or credential |
384
- | `<<systemId_credKey>>` | System credential |
385
- | `<<sg_auth_email>>` | Email of authenticated user |
386
- | `<<(sourceData) => expr>>` | JavaScript expression |
387
-
388
- **CRITICAL**: Simple `<<varName>>` only works for **top-level keys**. No dots, no nesting.
389
-
390
- - VALID: `<<userId>>`, `<<currentItem>>`, `<<stripe_api_key>>`, `<<sg_auth_email>>`
391
- - INVALID: `<<currentItem.id>>`, `<<sourceData.userId>>` — these FAIL at runtime
392
-
393
- For nested access, use arrow functions: `<<(sourceData) => sourceData.currentItem.id>>`
394
-
395
- ### Context Variables
396
-
397
- Context variables provide information about the execution environment:
398
-
399
- - `<<sg_auth_email>>` — Email of the authenticated user who triggered the tool
400
-
401
- **Use case**: Personalize tool outputs based on who runs the tool (e.g., user-specific permissions, account lookups, audit logging).
402
-
403
- **Important**: `sg_auth_email` is NOT available in scheduled executions. Tools using `<<sg_auth_email>>` will fail if run via scheduler.
404
-
405
- ### sourceData Object
406
-
407
- `sourceData` is the cumulative state available to all JS expressions (data selectors, transforms, variable expressions):
408
-
409
- ```javascript
410
- sourceData = {
411
- // Payload fields at ROOT level (NEVER use sourceData.payload.*)
412
- userId: "123",
413
- date: "2024-01-15",
414
-
415
- // Previous step results, keyed by step ID
416
- // Object-selector step:
417
- getUsers: { currentItem: {}, data: { users: [...] }, success: true },
418
- // Array-selector (loop) step:
419
- fetchDetails: [
420
- { currentItem: "id1", data: { name: "Alice" }, success: true },
421
- { currentItem: "id2", data: { name: "Bob" }, success: true },
422
- ],
423
-
424
- // Current loop item (only set inside a looping step's config)
425
- currentItem: { id: 1 },
426
-
427
- // Credentials (flattened, namespaced)
428
- systemId_access_token: "...",
429
- systemId_api_key: "..."
430
- }
431
- ```
432
-
433
- ### Step Result Envelope
434
-
435
- **Every** step result is wrapped in an envelope — you MUST account for this.
436
-
437
- **Object selector (or no selector)** — step runs once:
438
-
439
- ```javascript
440
- sourceData.stepId = { currentItem: <selectorOutput>, data: <apiResponse>, success: true }
441
- // Access the API response:
442
- sourceData.stepId.data
443
- sourceData.stepId.data.users
444
- ```
445
-
446
- **Array selector** — step loops, result is an array of envelopes:
447
-
448
- ```javascript
449
- sourceData.stepId = [
450
- { currentItem: <item1>, data: <response1>, success: true },
451
- { currentItem: <item2>, data: <response2>, success: true },
452
- ...
453
- ]
454
- ```
455
-
456
- ### Data Selectors
457
-
458
- Control what a step receives as input and whether it loops:
459
-
460
- | Return type | Behavior |
461
- | ------------------ | ----------------------------------- |
462
- | Single object | Step runs once with that object |
463
- | Array | Step runs once per item (loop mode) |
464
- | `undefined`/`null` | Step receives full sourceData |
465
-
466
- In loop mode, `sourceData.currentItem` is set to the current array element.
467
-
468
- Empty arrays are valid — the step simply skips execution.
469
-
470
- ### Two Step Types
471
-
472
- **Request step** (HTTP, PostgreSQL, MSSQL, Redis, FTP/SFTP/SMB) — makes an API call:
473
-
474
- ```json
475
- {
476
- "id": "get-users",
477
- "config": {
478
- "type": "request",
479
- "systemId": "my_api",
480
- "url": "https://api.example.com/users",
481
- "method": "GET",
482
- "headers": { "Authorization": "Bearer <<my_api_access_token>>" }
483
- }
484
- }
485
- ```
486
-
487
- **Transform step** — pure JavaScript, no API call. Use when a subsequent request step needs reshaped data:
488
-
489
- ```json
490
- {
491
- "id": "format-data",
492
- "config": {
493
- "type": "transform",
494
- "transformCode": "(sourceData) => sourceData.getUsers.data.map(u => ({ id: u.id, name: u.fullName }))"
495
- }
496
- }
497
- ```
498
-
499
- Transform steps do NOT have: `systemId`, `url`, `method`, `headers`, `body`, `queryParams`, or `pagination`. The `transformCode` function receives `sourceData` (same object available everywhere) and its return value becomes `.data` in the step envelope.
500
-
501
- **When to use each:**
502
-
503
- | Need | Use |
504
- | ------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
505
- | Filter/reshape data for a SUBSEQUENT request step | Transform step (`config.type: "transform"`) |
506
- | Shape the final tool output | `outputTransform` (runs after all steps, has a slightly different schema than transform only steps) |
507
- | Select input / control looping for a step | `dataSelector` on the step |
508
- | Inline data computation in URL/body/headers | `<<(sourceData) => ...>>` expressions |
509
-
510
- ### Execution Pipeline
511
-
512
- For each step in order:
513
-
514
- 1. Build `sourceData`: `{ ...originalPayload, ...previousStepResults, ...credentials }`
515
- 2. Run `dataSelector(sourceData)` → determines single vs loop execution
516
- 3. For each item: merge `currentItem` into `sourceData`, resolve `<<>>` variables, execute step
517
- - **Request step**: makes the HTTP/DB/FTP call, raw response becomes `.data`
518
- - **Transform step**: runs `transformCode(sourceData)`, return value becomes `.data`
519
- 4. Wrap result: `{ currentItem, data, success }` and store in `sourceData[stepId]`
520
- 5. After all steps: run `outputTransform(sourceData)` to shape final output
521
-
522
- ---
523
-
524
- ## HTTP API Patterns
525
-
526
- ### Pagination
527
-
528
- ```json
529
- {
530
- "pagination": {
531
- "type": "offset|cursor|page",
532
- "pageSize": 100,
533
- "cursorPath": "$.nextPageToken",
534
- "stopCondition": "(response) => !response.hasMore"
535
- }
536
- }
537
- ```
538
-
539
- | Type | How it works |
540
- | -------- | ------------------------------------------------------------ |
541
- | `offset` | Increments `offset` param by `pageSize` each page |
542
- | `cursor` | Extracts next cursor from `cursorPath`, sends as query param |
543
- | `page` | Increments `page` query param |
544
-
545
- All types stop when `stopCondition` returns true, response is empty, or max pages reached.
546
-
547
- ## Systems
548
-
549
- ### Credential Model
550
-
551
- - `credentials` — all credentials passed as JSON via `--credentials`
552
- - `sensitiveCredentials` — interactive masked prompt for secrets (TTY only, NOT for AI agents or CI)
553
- - **For AI agents / non-interactive use:** pass ALL credentials (including secrets like api_key, client_secret) directly via `--credentials '{"api_key":"..."}'`. Ask the user to provide the secret values, then include them in the JSON.
554
- - **For human interactive use:** use `--sensitive-credentials` for masked input of secrets
555
-
556
- ### Templates
557
-
558
- Templates auto-populate endpoints and OAuth config. Use `sg system find` to discover available templates.
559
-
560
- **Preconfigured OAuth** (no user client_id/secret needed): slack, salesforce, asana, notion, airtable, jira, confluence
561
-
562
- ### OAuth Flow
563
-
564
- **IMPORTANT:** For OAuth systems, prefer `--template` when available because it auto-configures OAuth URLs and defaults. OAuth also works without a template if you provide required credentials (for example `client_id`, `auth_url`, and `token_url`) manually.
565
-
566
- If you don't know the template ID, the CLI auto-detects it from the URL — but using `--template` explicitly is more reliable.
567
-
568
- **Step 1: Create the system with template and credentials**
569
-
570
- ```bash
571
- # Best: explicit template (auto-fills URL and OAuth config)
572
- sg system create --name "Gmail" --template gmail \
573
- --credentials '{"client_id":"...","client_secret":"..."}'
574
-
575
- # Also works: URL-based auto-detection (template inferred from googleapis.com)
576
- sg system create --name "Gmail" --url https://gmail.googleapis.com \
577
- --credentials '{"client_id":"...","client_secret":"..."}'
578
- ```
579
-
580
- **Step 2: Authenticate via OAuth**
581
-
582
- ```bash
583
- sg system oauth --system-id gmail --scopes "https://www.googleapis.com/auth/gmail.readonly"
584
- ```
585
-
586
- **Step 3:** User authenticates in browser → tokens saved automatically
587
-
588
- **Common OAuth templates:** gmail, googleDrive, googleCalendar, googleSheets, slack, salesforce, github, jira, confluence, notion, airtable, hubspot, shopify, dropbox, zoom, microsoft
589
-
590
- ### System IDs
591
-
592
- - Lowercase letters, numbers, underscores only — **no hyphens**
593
- - Used for credential namespacing: `<<systemId_credKey>>`
594
-
595
- ---
596
-
597
- ## Debugging Failed Tools
598
-
599
- ### Debug Workflow
600
-
601
- 1. Run with `--include-step-results` to see raw step responses
602
- 2. Check each step's `data` field — is the API returning what you expect?
603
- 3. Verify credential placeholders match `sg system find --id <systemId>` placeholder list
604
- 4. **Test API calls directly with `sg system call`** — isolate whether the issue is auth, endpoint, or transform
605
-
606
- ---
607
-
608
- ## Deploying Tools to Production
609
-
610
- After building and saving a tool, integrate it into your application:
611
-
612
- ### REST API (Any Language)
613
-
614
- ```bash
615
- # Run a tool
616
- curl -X POST "https://api.superglue.cloud/v1/tools/{toolId}/run" \
617
- -H "Authorization: Bearer $SUPERGLUE_API_KEY" \
618
- -H "Content-Type: application/json" \
619
- -d '{"inputs": {"userId": "123"}}'
620
-
621
- # Webhook trigger (async, fire-and-forget)
622
- curl -X POST "https://api.superglue.cloud/v1/hooks/{toolId}?token=$SUPERGLUE_API_KEY" \
623
- -H "Content-Type: application/json" \
624
- -d '{"userId": "123"}'
625
- ```
626
-
627
- ### TypeScript SDK
628
-
629
- ```typescript
630
- import { configure, runTool } from "@superglue/client";
631
- configure({ apiKey: process.env.SUPERGLUE_API_KEY!, baseUrl: "https://api.superglue.cloud/v1" });
632
- const response = await runTool("my-tool-id", { inputs: { userId: "123" } });
633
- // response.data is a Run object: { runId, toolId, status, data, error, metadata }
634
- ```
635
-
636
- ### Python SDK
637
-
638
- ```python
639
- import os
640
- from superglue_client import AuthenticatedClient
641
- from superglue_client.api.tools import run_tool
642
- from superglue_client.models.run_request import RunRequest
643
- from superglue_client.models.run_request_inputs import RunRequestInputs
644
-
645
- client = AuthenticatedClient(base_url="https://api.superglue.cloud/v1", token=os.environ["SUPERGLUE_API_KEY"])
646
- with client as c:
647
- result = run_tool.sync("my-tool-id", client=c, body=RunRequest(inputs=RunRequestInputs.from_dict({"userId": "123"})))
648
- ```
649
-
650
- ---
651
-
652
- ## Reference Files
653
-
654
- For detailed documentation on specific topics, read these files in the `references/` directory:
655
-
656
- | File | When to read |
657
- | ------------------------------------- | ------------------------------------------------------------------------------------------------ |
658
- | `references/integration.md` | **READ THIS** when deploying tools to production - SDK usage, REST API, webhooks, error handling |
659
- | `references/databases.md` | Building tools that query PostgreSQL or Microsoft SQL Server (Azure SQL) databases |
660
- | `references/redis.md` | Building tools that interact with Redis (commands, pipelines, data types) |
661
- | `references/file-servers.md` | Building tools that interact with FTP/SFTP/SMB file servers |
662
- | `references/transforms-and-output.md` | Complex data transformations, output shaping, JS sandbox constraints |
663
-
664
- **Important:** When the user asks about integrating superglue into their codebase, deploying tools, using the SDK, or calling tools from code, you MUST read `references/integration.md` for complete examples.
665
-
666
- ---
667
-
668
- ## Draft Management
669
-
670
- Drafts live in `.superglue/drafts/<draftId>.json`. Created by `build`, updated by `edit`, deleted by `save`. Ephemeral — not persisted across sessions.
671
-
672
- ## File References
673
-
674
- Attach files with `--file key=path`. Reference in payloads with `file::<key>`. Auto-parsed to JSON.
675
-
676
- ```bash
677
- sg tool run --draft <id> --payload '{"data": "file::mysheet"}' --file mysheet=data.xlsx
678
- ```
@@ -1,7 +0,0 @@
1
- interface:
2
- display_name: "superglue"
3
- short_description: "Build, test, deploy, and integrate superglue API tools via the sg CLI and SDK"
4
- icon_small: "./assets/superglue.png"
5
- icon_large: "./assets/superglue.png"
6
- brand_color: "#FFA500"
7
- default_prompt: "I need help building a superglue integration tool"