@superglue/cli 1.1.21 → 1.1.23

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 (34) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +1 -7
  3. package/dist/cli.js +307 -77
  4. package/dist/skills/superglue/SKILL.md +315 -631
  5. package/dist/skills/superglue/references/file-handling.md +180 -96
  6. package/dist/skills/superglue/references/graphql.md +131 -0
  7. package/dist/skills/superglue/references/http.md +251 -0
  8. package/dist/skills/superglue/references/integration.md +4 -2
  9. package/dist/skills/superglue/references/mssql.md +207 -0
  10. package/dist/skills/superglue/references/odbc.md +162 -0
  11. package/dist/skills/superglue/references/postgres.md +154 -0
  12. package/dist/skills/superglue/references/redis.md +68 -118
  13. package/dist/skills/superglue/references/sftp-smb.md +161 -0
  14. package/dist/skills/superglue/references/superglue-info.md +91 -0
  15. package/package.json +1 -1
  16. package/skills/superglue/SKILL.md +315 -631
  17. package/skills/superglue/references/file-handling.md +180 -96
  18. package/skills/superglue/references/graphql.md +131 -0
  19. package/skills/superglue/references/http.md +251 -0
  20. package/skills/superglue/references/integration.md +4 -2
  21. package/skills/superglue/references/mssql.md +207 -0
  22. package/skills/superglue/references/odbc.md +162 -0
  23. package/skills/superglue/references/postgres.md +154 -0
  24. package/skills/superglue/references/redis.md +68 -118
  25. package/skills/superglue/references/sftp-smb.md +161 -0
  26. package/skills/superglue/references/superglue-info.md +91 -0
  27. package/dist/skills/superglue/references/data-handling.md +0 -303
  28. package/dist/skills/superglue/references/databases.md +0 -253
  29. package/dist/skills/superglue/references/file-servers.md +0 -112
  30. package/dist/skills/superglue/references/http-apis.md +0 -248
  31. package/skills/superglue/references/data-handling.md +0 -303
  32. package/skills/superglue/references/databases.md +0 -253
  33. package/skills/superglue/references/file-servers.md +0 -112
  34. package/skills/superglue/references/http-apis.md +0 -248
@@ -0,0 +1,154 @@
1
+ # PostgreSQL
2
+
3
+ ## Step Configuration
4
+
5
+ ```typescript
6
+ {
7
+ type: "request",
8
+ systemId: "my_postgres_db",
9
+ url: "postgres://<<my_postgres_db_user>>:<<my_postgres_db_password>>@<<my_postgres_db_host>>:<<my_postgres_db_port>>/<<my_postgres_db_database>>",
10
+ body: '{"query": "SELECT * FROM users WHERE id = $1", "params": [<<userId>>]}'
11
+ }
12
+ ```
13
+
14
+ Configure the connection URL based on which credentials are stored in the system — use `sg system find` to check `storedCredentials` and reference them accordingly.
15
+
16
+ `method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for database steps.
17
+
18
+ ### Fields
19
+
20
+ | Field | Required | Notes |
21
+ | ---------- | -------- | -------------------------------------------------------------- |
22
+ | `url` | yes | Connection string with `<<credential>>` placeholders |
23
+ | `body` | yes | JSON string with `query` and optional `params` |
24
+ | `systemId` | no | Links system credentials for `<<systemId_credKey>>` resolution |
25
+
26
+ ### URL Format
27
+
28
+ ```
29
+ postgres://user:password@host:port/database
30
+ postgresql://user:password@host:port/database
31
+ ```
32
+
33
+ Both `postgres://` and `postgresql://` are supported. Trailing slashes and extra slashes before query strings are cleaned automatically.
34
+
35
+ ### Body Format
36
+
37
+ JSON string with `query` and optional `params` (or `values`):
38
+
39
+ ```json
40
+ { "query": "SELECT * FROM users WHERE age > $1 AND status = $2", "params": [25, "active"] }
41
+ ```
42
+
43
+ ## Authentication
44
+
45
+ Credentials are embedded directly in the connection URL using `<<systemId_credentialKey>>` placeholders. Nothing is injected automatically.
46
+
47
+ ```
48
+ postgres://<<my_db_user>>:<<my_db_password>>@<<my_db_host>>:<<my_db_port>>/<<my_db_database>>
49
+ ```
50
+
51
+ Credential variables are resolved at runtime before connecting.
52
+
53
+ ## PostgreSQL Runtime Details
54
+
55
+ ### Schema Discovery
56
+
57
+ superglue does not auto-introspect Postgres schemas. Before building tools, always query the schema manually with `sg system call` to discover tables and columns:
58
+
59
+ ```json
60
+ {
61
+ "query": "SELECT table_name, column_name, data_type, is_nullable FROM information_schema.columns WHERE table_schema = 'public' ORDER BY table_name, ordinal_position"
62
+ }
63
+ ```
64
+
65
+ Always verify table and column names against the actual schema before building tools.
66
+
67
+ ### Parameterized Queries
68
+
69
+ Always use parameterized queries with `$1`, `$2`, etc. — prevents SQL injection.
70
+
71
+ ```json
72
+ { "query": "SELECT * FROM orders WHERE customer_id = $1", "params": ["<<customerId>>"] }
73
+ ```
74
+
75
+ With expressions:
76
+
77
+ ```json
78
+ {
79
+ "query": "INSERT INTO logs (message, level) VALUES ($1, $2)",
80
+ "params": ["<<(sourceData) => sourceData.message>>", "error"]
81
+ }
82
+ ```
83
+
84
+ With RETURNING:
85
+
86
+ ```json
87
+ {
88
+ "query": "INSERT INTO users (name, email) VALUES ($1, $2) RETURNING *",
89
+ "params": [
90
+ "<<(sourceData) => sourceData.currentItem.name>>",
91
+ "<<(sourceData) => sourceData.currentItem.email>>"
92
+ ]
93
+ }
94
+ ```
95
+
96
+ ### Return Value
97
+
98
+ Returns `result.rows` — array of row objects with column names as keys.
99
+
100
+ - `SELECT`: array of matching rows
101
+ - `INSERT/UPDATE/DELETE` with `RETURNING`: array of returned rows
102
+ - Mutations without `RETURNING`: empty array
103
+
104
+ ### Batch Operations
105
+
106
+ Use a data selector returning an array to execute a query per item:
107
+
108
+ ```javascript
109
+ // dataSelector: (sourceData) => sourceData.newUsers
110
+ // body: {"query": "INSERT INTO users (name) VALUES ($1)", "params": ["<<(sourceData) => sourceData.currentItem.name>>"]}
111
+ ```
112
+
113
+ ### Connection Pooling
114
+
115
+ - Pools cached by connection string, max 10 clients, 30s connection timeout
116
+ - Idle pools cleaned up automatically
117
+
118
+ ### SSL / TLS
119
+
120
+ SSL is auto-configured based on the connection URL — you do not need to set it manually in most cases.
121
+
122
+ **Default behavior (no `sslmode` in URL):**
123
+
124
+ - `localhost` / `127.0.0.1` → SSL disabled
125
+ - All other hosts → superglue probes the server to detect SSL support and enables it if the server accepts SSL handshakes. If the probe fails or times out, SSL is enabled as a safe default.
126
+
127
+ **Explicit `sslmode` in URL** (appended as `?sslmode=...`):
128
+
129
+ - `sslmode=disable` → SSL off
130
+ - `sslmode=require` → SSL on, enforced
131
+ - `sslmode=verify-ca` / `sslmode=verify-full` → SSL on, enforced; AWS RDS CA bundle loaded if present on disk
132
+ - Any other sslmode value → SSL on, not enforced
133
+
134
+ Server certificate chain validation is not performed by default; `verify-ca` / `verify-full` only flip the `enforce` flag and opportunistically load the RDS CA bundle. If strict chain validation matters for your deployment, terminate TLS at a trusted proxy.
135
+
136
+ ### Retry Behavior
137
+
138
+ Default retries from server config. On final failure, error includes query text and params.
139
+
140
+ ## Common Pitfalls
141
+
142
+ - Using string interpolation instead of parameterized queries — always use `$1`, `$2` with `params` array
143
+ - Forgetting `RETURNING *` on INSERT/UPDATE/DELETE when you need the result — without it the step returns an empty array
144
+ - Accessing step result directly instead of via `.data` — database results follow the same envelope as all steps: `sourceData.stepId.data`
145
+
146
+ ## Error Recovery
147
+
148
+ When a PostgreSQL step fails and the cause is not obvious:
149
+
150
+ 1. **Read the error message** — superglue includes the query text and params in the error. Check for syntax errors, missing columns, or type mismatches.
151
+ 2. **Verify connection credentials** — use `sg system find` to confirm `storedCredentials` keys match the placeholders in your URL. Test connectivity with a simple `SELECT 1` via `sg system call`.
152
+ 3. **Check database-side access** — connection refused or permission denied errors typically mean the database user lacks access to the database, schema, or table. Verify with the user that the credentials have the required grants.
153
+ 4. **Test the query directly** — use `sg system call` with a simplified version of the query to isolate whether the issue is the query itself, the parameters, or the connection.
154
+ 5. **Check for SSL/TLS issues** — if the error mentions SSL or handshake failure, check the SSL / TLS section above. For non-localhost servers that don't support SSL, add `?sslmode=disable` to the URL. For servers that require SSL, add `?sslmode=require`.
@@ -1,4 +1,4 @@
1
- # Redis Steps
1
+ # Redis
2
2
 
3
3
  ## Step Configuration
4
4
 
@@ -11,9 +11,19 @@
11
11
  }
12
12
  ```
13
13
 
14
- Configure the connection URL depending on which credentials are saved in the stored Redis system - reference them accordingly.
14
+ Configure the connection URL based on which credentials are stored in the system — use `sg system find` to check `storedCredentials` and reference them accordingly.
15
15
 
16
- ## URL Format
16
+ `method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for Redis steps.
17
+
18
+ ### Fields
19
+
20
+ | Field | Required | Notes |
21
+ | ---------- | -------- | -------------------------------------------------------------- |
22
+ | `url` | yes | Connection string with `<<credential>>` placeholders |
23
+ | `body` | yes | JSON: single command object or array for pipeline |
24
+ | `systemId` | no | Links system credentials for `<<systemId_credKey>>` resolution |
25
+
26
+ ### URL Format
17
27
 
18
28
  ```
19
29
  redis://user:password@host:port/database
@@ -21,20 +31,18 @@ rediss://user:password@host:port/database (TLS)
21
31
  ```
22
32
 
23
33
  - `redis://` for standard connections
24
- - `rediss://` for TLS-encrypted connections (e.g. Redis Cloud, AWS ElastiCache with encryption)
25
- - `/database` is the database number (defaults to 0 if omitted; max depends on the server's `databases` config, commonly 16)
26
-
27
- All credential variables are resolved before connecting. Trailing slashes are cleaned.
34
+ - `rediss://` for TLS-encrypted connections (Redis Cloud, AWS ElastiCache with encryption)
35
+ - `/database` is the database number (defaults to 0; max depends on server config, commonly 16)
28
36
 
29
- ## Body Format
37
+ ### Body Format
30
38
 
31
- JSON string with `command` (required) and optional `args` array. Body can be a single command object or an array of commands (pipelined in a single round-trip):
39
+ JSON string with `command` (required) and optional `args` array:
32
40
 
33
41
  ```json
34
42
  { "command": "GET", "args": ["mykey"] }
35
43
  ```
36
44
 
37
- Multiple commands:
45
+ For pipelines, pass an array of command objects (executed in a single round-trip):
38
46
 
39
47
  ```json
40
48
  [
@@ -43,115 +51,39 @@ Multiple commands:
43
51
  ]
44
52
  ```
45
53
 
46
- ### Common Commands
47
-
48
- **String operations:**
49
-
50
- ```json
51
- { "command": "GET", "args": ["user:123:name"] }
52
- { "command": "SET", "args": ["user:123:name", "Alice"] }
53
- { "command": "MGET", "args": ["key1", "key2", "key3"] }
54
- { "command": "INCR", "args": ["counter"] }
55
- ```
54
+ All args must be strings — numbers are auto-coerced.
56
55
 
57
- **Hash operations:**
56
+ Dynamic arguments with variables:
58
57
 
59
58
  ```json
60
- { "command": "HGETALL", "args": ["user:123"] }
61
- { "command": "HGET", "args": ["user:123", "email"] }
62
- { "command": "HSET", "args": ["user:123", "email", "alice@example.com"] }
63
- { "command": "HMGET", "args": ["user:123", "name", "email"] }
59
+ { "command": "GET", "args": ["<<(sourceData) => `user:${sourceData.userId}:profile`>>"] }
64
60
  ```
65
61
 
66
- **List operations:**
67
-
68
- ```json
69
- { "command": "LRANGE", "args": ["queue:tasks", "0", "-1"] }
70
- { "command": "LPUSH", "args": ["queue:tasks", "task1"] }
71
- { "command": "RPOP", "args": ["queue:tasks"] }
72
- { "command": "LLEN", "args": ["queue:tasks"] }
73
- ```
62
+ ## Authentication
74
63
 
75
- **Set operations:**
64
+ Credentials are embedded directly in the connection URL using `<<systemId_credentialKey>>` placeholders. Nothing is injected automatically.
76
65
 
77
- ```json
78
- { "command": "SMEMBERS", "args": ["tags:post:1"] }
79
- { "command": "SADD", "args": ["tags:post:1", "redis", "database"] }
80
- { "command": "SISMEMBER", "args": ["tags:post:1", "redis"] }
81
66
  ```
82
-
83
- **Sorted set operations:**
84
-
85
- ```json
86
- { "command": "ZRANGE", "args": ["leaderboard", "0", "-1", "WITHSCORES"] }
87
- { "command": "ZADD", "args": ["leaderboard", "100", "player1"] }
88
- { "command": "ZRANK", "args": ["leaderboard", "player1"] }
67
+ redis://<<my_redis_username>>:<<my_redis_password>>@<<my_redis_host>>:<<my_redis_port>>/<<my_redis_database>>
89
68
  ```
90
69
 
91
- **Key operations:**
70
+ ## Redis Runtime Details
92
71
 
93
- ```json
94
- { "command": "KEYS", "args": ["user:*"] }
95
- { "command": "EXISTS", "args": ["mykey"] }
96
- { "command": "TTL", "args": ["session:abc"] }
97
- { "command": "EXPIRE", "args": ["session:abc", "3600"] }
98
- { "command": "DEL", "args": ["mykey"] }
99
- { "command": "TYPE", "args": ["mykey"] }
100
- ```
72
+ ### Return Values
101
73
 
102
- **Scan (safe iteration):**
74
+ | Command type | Returns |
75
+ | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
76
+ | `GET`, `HGET` | string or null |
77
+ | `HGETALL` | flat array of alternating field-value pairs, e.g. `["name", "Alice", "email", "alice@example.com"]`. Empty array for non-existent keys |
78
+ | `LRANGE`, `SMEMBERS`, `KEYS` | array of strings |
79
+ | `SET`, `DEL`, `EXPIRE` | `"OK"` or integer |
80
+ | `INCR`, `LLEN`, `SADD` | integer |
81
+ | `MGET`, `HMGET` | array (nulls for missing keys) |
82
+ | `SCAN`, `HSCAN` | array of `[cursor, results]` |
103
83
 
104
- ```json
105
- { "command": "SCAN", "args": ["0", "MATCH", "user:*", "COUNT", "100"] }
106
- { "command": "HSCAN", "args": ["myhash", "0", "MATCH", "field*"] }
107
- ```
84
+ ### Pipeline Results
108
85
 
109
- ### Dynamic Arguments with Variables
110
-
111
- ```json
112
- { "command": "GET", "args": ["<<(sourceData) => `user:${sourceData.userId}:profile`>>"] }
113
- ```
114
-
115
- ```json
116
- { "command": "HSET", "args": ["<<userKey>>", "<<fieldName>>", "<<fieldValue>>"] }
117
- ```
118
-
119
- ## Connection Management
120
-
121
- - A fresh connection is created per execution and closed after completion
122
- - TLS auto-configured for `rediss://` URLs (currently uses `rejectUnauthorized: false`)
123
- - 5-second connection timeout, 30-second command timeout
124
- - Array commands (pipeline) run on a single connection for efficiency
125
-
126
- ## Retry Logic
127
-
128
- Default retries from server config. On final failure, error includes command and args.
129
-
130
- ## Return Value
131
-
132
- Returns the raw Redis response:
133
-
134
- - `GET` / `HGET`: string or null
135
- - `HGETALL`: flat array of alternating field-value pairs (e.g., `["name", "Alice", "email", "alice@example.com"]`)
136
- - `LRANGE` / `SMEMBERS` / `KEYS`: array of strings
137
- - `SET` / `DEL` / `EXPIRE`: "OK" or integer
138
- - `INCR` / `LLEN` / `SADD`: integer
139
- - `MGET` / `HMGET`: array (nulls for missing keys)
140
- - `SCAN` / `HSCAN`: array of [cursor, results]
141
-
142
- ## Multiple Commands (Pipeline)
143
-
144
- Pass an array of commands to execute them in a single round-trip (like FTP/SFTP batch operations):
145
-
146
- ```json
147
- [
148
- { "command": "GET", "args": ["user:1:name"] },
149
- { "command": "HGETALL", "args": ["user:1"] },
150
- { "command": "LRANGE", "args": ["tasks", "0", "-1"] }
151
- ]
152
- ```
153
-
154
- Returns an array of results, one per command:
86
+ A single command returns a single result. An array of commands returns an array of results:
155
87
 
156
88
  ```json
157
89
  [
@@ -161,18 +93,13 @@ Returns an array of results, one per command:
161
93
  ]
162
94
  ```
163
95
 
164
- If an individual command fails, that entry has `error` instead of `result`:
96
+ If an individual command in a pipeline fails, that entry has `error` instead of `result`:
165
97
 
166
98
  ```json
167
- [
168
- { "command": "GET", "result": "Alice" },
169
- { "command": "WRONGCMD", "error": "ERR unknown command 'WRONGCMD'" }
170
- ]
99
+ { "command": "WRONGCMD", "error": "ERR unknown command 'WRONGCMD'" }
171
100
  ```
172
101
 
173
- A single command returns a single result. Multiple commands return an array — same pattern as FTP/SFTP operations.
174
-
175
- ## Batch Operations via Loop
102
+ ### Batch Operations
176
103
 
177
104
  Use a data selector returning an array to execute a command per item:
178
105
 
@@ -181,9 +108,32 @@ Use a data selector returning an array to execute a command per item:
181
108
  // body: {"command": "HGETALL", "args": ["<<(sourceData) => `user:${sourceData.currentItem}`>>"]}
182
109
  ```
183
110
 
184
- ## Important Notes
111
+ Prefer array body pipelines over loop-based batch when commands are independent and don't depend on each other's results.
112
+
113
+ ### Connection Management
114
+
115
+ - Fresh connection created per execution, closed after completion
116
+ - TLS auto-configured for `rediss://` URLs (`rejectUnauthorized: false`)
117
+ - 5-second connection timeout, 30-second command timeout
118
+ - Pipeline commands run on a single connection
119
+
120
+ ### Retry Behavior
121
+
122
+ Default retries from server config. On final failure, error includes command and args.
123
+
124
+ ## Common Pitfalls
125
+
126
+ - Using `KEYS` in production on large keyspaces — use `SCAN` with `MATCH` pattern instead
127
+ - Expecting `HGETALL` to return an object — it returns a flat alternating array `[field, value, field, value, ...]`
128
+ - Accessing step result directly instead of via `.data` — Redis results follow the same envelope as all steps: `sourceData.stepId.data`
129
+ - Using separate steps for independent commands that could be pipelined in a single array body
130
+
131
+ ## Error Recovery
132
+
133
+ When a Redis step fails:
185
134
 
186
- - All args must be strings (Redis protocol is text-based) - numbers are auto-coerced
187
- - Use `SCAN` instead of `KEYS` in production for large keyspaces
188
- - `HGETALL` returns an empty array `[]` for non-existent keys
189
- - Use array body for multi-command pipelines instead of separate steps
135
+ 1. **Read the error message** — superglue includes the command and args in the error. Check for unknown commands, wrong argument counts, or type errors (e.g. running a list command on a string key).
136
+ 2. **Verify connection credentials** — use `sg system find` to confirm `storedCredentials` keys match the placeholders in your URL. Test with a simple `PING` command via `sg system call`.
137
+ 3. **Check connectivity and access** — connection refused errors typically mean the Redis server is unreachable or requires TLS (`rediss://`). AUTH errors mean the password is wrong or the user lacks access.
138
+ 4. **Check key types** — Redis commands are type-specific. Running `GET` on a hash key or `HGETALL` on a string key returns a `WRONGTYPE` error. Use `TYPE` command via `sg system call` to check a key's type before building.
139
+ 5. **Verify TLS requirements** — if the error mentions connection reset or handshake failure, try switching between `redis://` and `rediss://`.
@@ -0,0 +1,161 @@
1
+ # SFTP / FTP / SMB
2
+
3
+ FTP, SFTP, and SMB share an identical operation interface. Only the URL protocol and connection details differ.
4
+
5
+ ## Step Configuration
6
+
7
+ ```typescript
8
+ {
9
+ type: "request",
10
+ systemId: "my_sftp_server",
11
+ url: "sftp://<<my_sftp_server_username>>:<<my_sftp_server_password>>@<<my_sftp_server_host>>:<<my_sftp_server_port>>/basePath",
12
+ body: '{"operation": "get", "path": "data/report.csv"}'
13
+ }
14
+ ```
15
+
16
+ Configure the connection URL based on which credentials are stored in the system — use `sg system find` to check `storedCredentials` and reference them accordingly.
17
+
18
+ `method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for file server steps.
19
+
20
+ ### Fields
21
+
22
+ | Field | Required | Notes |
23
+ | ---------- | -------- | -------------------------------------------------------------- |
24
+ | `url` | yes | Connection string with `<<credential>>` placeholders |
25
+ | `body` | yes | JSON: single operation object or array for batch |
26
+ | `systemId` | no | Links system credentials for `<<systemId_credKey>>` resolution |
27
+
28
+ ### URL Formats
29
+
30
+ ```
31
+ ftp://user:password@host:port/basePath (port 21)
32
+ ftps://user:password@host:port/basePath (port 21, TLS)
33
+ sftp://user:password@host:port/basePath (port 22)
34
+ smb://user:password@host/sharename/basePath (port 445)
35
+ smb://domain\user:password@host/sharename/ (domain auth)
36
+ ```
37
+
38
+ SMB requires a share name as the first path segment. Additional segments become a base path prepended to all operation paths.
39
+
40
+ ### Body Format
41
+
42
+ JSON string — single operation or array of operations (batch, executed sequentially on a single connection):
43
+
44
+ ```json
45
+ { "operation": "get", "path": "data/report.csv" }
46
+ ```
47
+
48
+ ```json
49
+ [
50
+ { "operation": "mkdir", "path": "backup" },
51
+ { "operation": "get", "path": "data/report.csv" },
52
+ { "operation": "put", "path": "backup/report.csv", "content": "file::report.raw" }
53
+ ]
54
+ ```
55
+
56
+ ## Authentication
57
+
58
+ Credentials are embedded in the connection URL using `<<systemId_credentialKey>>` placeholders. Nothing is injected automatically.
59
+
60
+ ```
61
+ sftp://<<my_server_username>>:<<my_server_password>>@host/path
62
+ ```
63
+
64
+ **SFTP private key auth:** use `credentials.privateKey` and `credentials.passphrase` on the system instead of URL password placeholders. Store the private key as a credential on the system.
65
+
66
+ **SMB domain auth:** use `domain\user` format in the URL, or store `domain` as a system credential.
67
+
68
+ Only store connection credentials on the system: `host`, `port`, `username`, `password`, `privateKey`, `passphrase`, `domain` (SMB), `home_dir`. Paths and share names belong in the URL, not in credentials.
69
+
70
+ ## File Server Runtime Details
71
+
72
+ ### Path Handling
73
+
74
+ All operation paths are relative to the base path in the URL. Do not use absolute filesystem paths.
75
+
76
+ If the system URL is `sftp://user:pass@host/home/sftptest/uploads`:
77
+
78
+ - `report.csv` resolves to `/home/sftptest/uploads/report.csv`
79
+ - `subdir/data.csv` resolves to `/home/sftptest/uploads/subdir/data.csv`
80
+
81
+ Do not use `/home/sftptest/uploads/report.csv` — the base path is already set in the URL.
82
+
83
+ If the URL has no base path (e.g. `sftp://user:pass@host`), paths are used as-is from the server root.
84
+
85
+ SMB paths use forward slashes — the library handles Windows path conversion internally.
86
+
87
+ ### Operations
88
+
89
+ | Operation | Required fields | Returns |
90
+ | --------- | ----------------- | --------------------------------------------------------------- |
91
+ | `list` | `path` | Array of `{ name, path, size, type, modifyTime, ... }` |
92
+ | `get` | `path` | Auto-parsed file content (CSV to objects, JSON to parsed, etc.) |
93
+ | `put` | `path`, `content` | `{ success, message, size }` |
94
+ | `delete` | `path` | `{ success, message }` |
95
+ | `rename` | `path`, `newPath` | `{ success, message }` |
96
+ | `mkdir` | `path` | `{ success, message }` |
97
+ | `rmdir` | `path` | `{ success, message }` |
98
+ | `exists` | `path` | `{ exists: boolean, path }` |
99
+ | `stat` | `path` | File metadata or `{ exists: false }` |
100
+
101
+ ### `get` — File Handling
102
+
103
+ Downloaded files are added to the runtime file store. See `file-handling.md` for detection, parsing, aliasing rules, and the full `file::` reference syntax.
104
+
105
+ - `data` contains auto-parsed content (CSV to objects, JSON to parsed, PDF to structured, etc.)
106
+ - The step result exposes `stepFileKeys`
107
+ - Later steps reference downloaded files via `file::<stepId>.raw`, `file::<stepId>.base64`, or `file::<stepId>.extracted`
108
+ - Multi-file batch downloads use bracket notation: `file::<stepId>["report.csv"].raw`
109
+
110
+ ### `put` — Content Handling
111
+
112
+ Use `file::<key>.raw` to preserve original bytes when uploading files from previous steps. See `file-handling.md` for all suffix options.
113
+
114
+ | Content type | Behavior |
115
+ | -------------------------------- | ------------------------------------ |
116
+ | `file::<key>.raw` (RawFileBytes) | Written as exact original bytes |
117
+ | String | Written as-is |
118
+ | Buffer | Written directly |
119
+ | Object / Array | JSON-stringified with 2-space indent |
120
+
121
+ ### Return Values
122
+
123
+ Single operation returns the result directly. Array of operations returns an array of results (one per operation, in order).
124
+
125
+ ### Connection Details
126
+
127
+ **SFTP:** uses `ssh2-sftp-client`. Supports password and private key auth. Connection timeout configurable, default retries from server config.
128
+
129
+ **FTP/FTPS:** uses `basic-ftp`. FTPS uses TLS with `rejectUnauthorized: false`. Connection timeout configurable.
130
+
131
+ **SMB:** uses `@tryjsky/v9u-smb2`. Connection lifecycle: create client (with share, domain, credentials), execute operations, disconnect. Entire operation wrapped in a timeout race. For private systems via Secure Gateway, the host is `tunnelId.tunnel` (e.g. `my_tunnel.tunnel`).
132
+
133
+ ### Retry Behavior
134
+
135
+ Default retries from server config. On final failure, error includes the full operations list. Each retry creates a fresh connection.
136
+
137
+ ### File Output
138
+
139
+ When the user wants to **download** a file fetched via SFTP/SMB/FTP, set `outputFile: true` on the step. This stores the file in S3 and returns a download link in the API response. Without the flag, fetched files stay internal (only accessible to subsequent steps via `file::` references).
140
+
141
+ ## Common Pitfalls
142
+
143
+ - Using absolute filesystem paths instead of paths relative to the URL base path
144
+ - Forgetting `outputFile: true` on steps that download files the user wants — without it, the file is only available internally between steps
145
+ - Forgetting that SMB requires a share name as the first URL path segment
146
+ - Using `file::<key>` without a suffix in `put` content. Use `file::<key>.raw` to preserve original bytes
147
+ - Missing the double-data access pattern for `get` results: `sourceData.stepId.data` gives you the parsed file content (through the step envelope)
148
+ - Trying to `put` to a path where intermediate directories don't exist — use `mkdir` first or batch the operations
149
+
150
+ ## Error Recovery
151
+
152
+ When a file server step fails and the cause is not obvious:
153
+
154
+ 1. **Read the error message** — superglue includes the operations list in the error. Check for typos in paths, missing fields, or unsupported operations.
155
+ 2. **Verify connection credentials** — use `sg system find` to confirm `storedCredentials` keys match the placeholders in your URL. Test with a simple `list` operation on the base path via `sg system call`.
156
+ 3. **Check path resolution** — if you get "file not found", verify the path is relative to the URL base path, not an absolute filesystem path. Use `list` on the parent directory to see what files exist.
157
+ 4. **Check permissions** — permission denied errors mean the user account lacks read/write access to the target path. Verify with the user that the account has the required grants.
158
+ 5. **Check protocol-specific issues:**
159
+ - **SFTP**: if the error mentions authentication, verify whether the server expects password or private key auth. If using private key, ensure `privateKey` and `passphrase` are stored as system credentials.
160
+ - **FTP/FTPS**: if the connection fails, try switching between `ftp://` and `ftps://` — some servers require TLS, others don't support it.
161
+ - **SMB**: verify the share name is correct (first path segment). If using domain auth, ensure the domain is included in the URL or stored as a credential. Check that the SMB port (445) is accessible.
@@ -0,0 +1,91 @@
1
+ # superglue Info
2
+
3
+ ## Company
4
+
5
+ superglue is an open-source, AI-native integration platform that builds and runs deterministic multi-step workflows ("tools") connecting APIs, databases, and file servers. AI generates tool configurations during building — execution is 100% deterministic JavaScript with no LLMs involved.
6
+
7
+ Developed by superglue (Y Combinator W25), founded by Adina Görres and Stefan Faistenauer in 2025, based in Munich and San Francisco.
8
+
9
+ - Website: https://superglue.ai
10
+ - Documentation: https://docs.superglue.cloud
11
+ - GitHub: https://github.com/superglue-ai/superglue
12
+
13
+ If the user is asking general questions (not building):
14
+
15
+ - Company/team/pricing → https://superglue.ai/
16
+ - Product/features → https://docs.superglue.cloud/getting-started/introduction
17
+ - Open-source/code → https://github.com/superglue-ai/superglue
18
+
19
+ ## Authentication
20
+
21
+ All superglue interfaces (API, SDK, CLI, MCP) require only an **API key**. Self-hosted deployments also need the API endpoint URL. There are no workspace IDs, project IDs, or other identifiers — the API key is the only credential needed.
22
+
23
+ Users can generate and manage API keys in **Control Panel → API Keys**. The API endpoint is displayed on the same page.
24
+
25
+ ## Interfaces
26
+
27
+ - **Web app** — primary UI for building, testing, and managing tools and systems
28
+ - **TypeScript/Python SDK** — https://docs.superglue.cloud/sdk/overview
29
+ - **REST API** — https://docs.superglue.cloud/api-reference/
30
+ - **MCP Server** — https://docs.superglue.cloud/mcp/using-the-mcp
31
+ - **CLI** — `npm install -g @superglue/cli` — https://docs.superglue.cloud/getting-started/cli-skills
32
+
33
+ ### Webhook Triggers
34
+
35
+ Tools can be triggered via webhook: `POST {apiEndpoint}/v1/hooks/{toolId}?token={apiKey}`
36
+
37
+ On superglue Cloud, the API endpoint is `https://api.superglue.cloud`. Self-hosted and enterprise deployments use their own API endpoint — users can find theirs under Control Panel → API Keys.
38
+
39
+ ### OAuth Callback URL
40
+
41
+ OAuth flows require a callback URL: `{appEndpoint}/api/auth/callback`
42
+
43
+ On superglue Cloud, the app endpoint is `https://app.superglue.cloud`. Self-hosted and enterprise deployments use their own app URL. If a user doesn't know their endpoints, they can check the browser URL bar for the app endpoint, and Control Panel → API Keys for the API endpoint.
44
+
45
+ ## Web App UI Layout
46
+
47
+ Left sidebar navigation:
48
+
49
+ - **Agent** — AI chat assistant for building and debugging tools/systems
50
+ - **Landscape** — Visual graph showing all tools and their connected systems
51
+ - **Tools** — List of saved tools. Click a tool to open its playground for editing, testing, and running.
52
+ - **Systems** — List of connected external systems with credentials and documentation
53
+ - **Control Panel** (expandable):
54
+ - Overview: Dashboard summary
55
+ - Runs: Execution history for all tool runs with status, errors, and step results
56
+ - Schedules: Manage scheduled/recurring tool runs
57
+ - API Keys: View and manage superglue API keys
58
+ - Organization: Team members and org settings
59
+ - Notifications: Configure alerts for tool run failures
60
+ - **Docs** — Link to docs.superglue.cloud
61
+
62
+ ## Internals
63
+
64
+ ### Execution Pipeline
65
+
66
+ `ToolExecutor.execute({ payload, credentials, options })`:
67
+
68
+ 1. **Validate** tool structure (id, steps array, URLs on request steps)
69
+ 2. **For each step in order:**
70
+ a. Build aggregated data: `{ ...originalPayload, ...previousStepResults }`
71
+ b. Resolve system credentials (refresh OAuth if needed), namespace as `systemId_key`
72
+ c. Run `dataSelector` → object means single execution, array means loop
73
+ d. For each item: merge `currentItem` into input and execute
74
+ e. Wrap result: `{ currentItem, data, success }`
75
+ f. On failure: abort if `failureBehavior !== "continue"`
76
+ 3. **Output transform** (if present): run JS function, validate against outputSchema
77
+ 4. **Response filters** (if present): remove/mask/fail on pattern matches
78
+
79
+ ### Strategy Routing
80
+
81
+ Steps are routed to execution strategies by protocol (first match wins):
82
+
83
+ 1. Transform steps → if `config.type === "transform"`
84
+ 2. HTTP → URL starts with `http://` or `https://`
85
+ 3. PostgreSQL → URL starts with `postgres://` or `postgresql://`
86
+ 4. MSSQL/Azure SQL → URL starts with `mssql://` or `sqlserver://`
87
+ 5. Redis → URL starts with `redis://` or `rediss://`
88
+ 6. FTP/SFTP → URL starts with `ftp://`, `ftps://`, or `sftp://`
89
+ 7. SMB → URL starts with `smb://`
90
+
91
+ All user-provided JS (data selectors, transforms, stop conditions) runs in an isolated Deno sandbox.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superglue/cli",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "bin": {
5
5
  "sg": "./dist/cli.js"
6
6
  },