@flowengine.cloud/flowengine-cli 3.0.0
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/LICENSE +21 -0
- package/README.md +290 -0
- package/build/cli/api.d.ts +19 -0
- package/build/cli/api.d.ts.map +1 -0
- package/build/cli/api.js +62 -0
- package/build/cli/api.js.map +1 -0
- package/build/cli/commands/delete.d.ts +4 -0
- package/build/cli/commands/delete.d.ts.map +1 -0
- package/build/cli/commands/delete.js +16 -0
- package/build/cli/commands/delete.js.map +1 -0
- package/build/cli/commands/deploy.d.ts +24 -0
- package/build/cli/commands/deploy.d.ts.map +1 -0
- package/build/cli/commands/deploy.js +103 -0
- package/build/cli/commands/deploy.js.map +1 -0
- package/build/cli/commands/domain.d.ts +9 -0
- package/build/cli/commands/domain.d.ts.map +1 -0
- package/build/cli/commands/domain.js +27 -0
- package/build/cli/commands/domain.js.map +1 -0
- package/build/cli/commands/env.d.ts +13 -0
- package/build/cli/commands/env.d.ts.map +1 -0
- package/build/cli/commands/env.js +53 -0
- package/build/cli/commands/env.js.map +1 -0
- package/build/cli/commands/list.d.ts +4 -0
- package/build/cli/commands/list.d.ts.map +1 -0
- package/build/cli/commands/list.js +25 -0
- package/build/cli/commands/list.js.map +1 -0
- package/build/cli/commands/login.d.ts +4 -0
- package/build/cli/commands/login.d.ts.map +1 -0
- package/build/cli/commands/login.js +37 -0
- package/build/cli/commands/login.js.map +1 -0
- package/build/cli/commands/logout.d.ts +2 -0
- package/build/cli/commands/logout.d.ts.map +1 -0
- package/build/cli/commands/logout.js +8 -0
- package/build/cli/commands/logout.js.map +1 -0
- package/build/cli/commands/logs.d.ts +4 -0
- package/build/cli/commands/logs.d.ts.map +1 -0
- package/build/cli/commands/logs.js +40 -0
- package/build/cli/commands/logs.js.map +1 -0
- package/build/cli/commands/show.d.ts +4 -0
- package/build/cli/commands/show.d.ts.map +1 -0
- package/build/cli/commands/show.js +13 -0
- package/build/cli/commands/show.js.map +1 -0
- package/build/cli/commands/usage.d.ts +7 -0
- package/build/cli/commands/usage.d.ts.map +1 -0
- package/build/cli/commands/usage.js +16 -0
- package/build/cli/commands/usage.js.map +1 -0
- package/build/cli/config.d.ts +17 -0
- package/build/cli/config.d.ts.map +1 -0
- package/build/cli/config.js +42 -0
- package/build/cli/config.js.map +1 -0
- package/build/cli/pack.d.ts +25 -0
- package/build/cli/pack.d.ts.map +1 -0
- package/build/cli/pack.js +111 -0
- package/build/cli/pack.js.map +1 -0
- package/build/cli/ui.d.ts +23 -0
- package/build/cli/ui.d.ts.map +1 -0
- package/build/cli/ui.js +105 -0
- package/build/cli/ui.js.map +1 -0
- package/build/cli.d.ts +10 -0
- package/build/cli.d.ts.map +1 -0
- package/build/cli.js +251 -0
- package/build/cli.js.map +1 -0
- package/build/client.d.ts +94 -0
- package/build/client.d.ts.map +1 -0
- package/build/client.js +311 -0
- package/build/client.js.map +1 -0
- package/build/index.d.ts +12 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +970 -0
- package/build/index.js.map +1 -0
- package/build/tools/functions.d.ts +14 -0
- package/build/tools/functions.d.ts.map +1 -0
- package/build/tools/functions.js +241 -0
- package/build/tools/functions.js.map +1 -0
- package/build/types.d.ts +155 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +5 -0
- package/build/types.js.map +1 -0
- package/build/ui/base.d.ts +8 -0
- package/build/ui/base.d.ts.map +1 -0
- package/build/ui/base.js +425 -0
- package/build/ui/base.js.map +1 -0
- package/build/ui/component-viewer.d.ts +14 -0
- package/build/ui/component-viewer.d.ts.map +1 -0
- package/build/ui/component-viewer.js +678 -0
- package/build/ui/component-viewer.js.map +1 -0
- package/build/ui/dashboard.d.ts +21 -0
- package/build/ui/dashboard.d.ts.map +1 -0
- package/build/ui/dashboard.js +252 -0
- package/build/ui/dashboard.js.map +1 -0
- package/build/ui/demo.d.ts +14 -0
- package/build/ui/demo.d.ts.map +1 -0
- package/build/ui/demo.js +222 -0
- package/build/ui/demo.js.map +1 -0
- package/build/ui/instances.d.ts +17 -0
- package/build/ui/instances.d.ts.map +1 -0
- package/build/ui/instances.js +233 -0
- package/build/ui/instances.js.map +1 -0
- package/build/ui/n8n-viewer.d.ts +12 -0
- package/build/ui/n8n-viewer.d.ts.map +1 -0
- package/build/ui/n8n-viewer.js +371 -0
- package/build/ui/n8n-viewer.js.map +1 -0
- package/build/ui/portals.d.ts +14 -0
- package/build/ui/portals.d.ts.map +1 -0
- package/build/ui/portals.js +184 -0
- package/build/ui/portals.js.map +1 -0
- package/build/ui/ui/components.html +312 -0
- package/build/ui/ui/n8n.html +124 -0
- package/build/ui/ui/portals.html +211 -0
- package/build/ui/widgets.d.ts +17 -0
- package/build/ui/widgets.d.ts.map +1 -0
- package/build/ui/widgets.js +200 -0
- package/build/ui/widgets.js.map +1 -0
- package/build/ui/workflows.d.ts +17 -0
- package/build/ui/workflows.d.ts.map +1 -0
- package/build/ui/workflows.js +217 -0
- package/build/ui/workflows.js.map +1 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 FlowEngine
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
# FlowEngine MCP Server
|
|
2
|
+
|
|
3
|
+
**Control your white-label automation platform directly from Claude**
|
|
4
|
+
|
|
5
|
+
The official Model Context Protocol (MCP) server for FlowEngine. Manage instances, client portals, and build UI components using AI - all from Claude Desktop, VSCode, or Claude Code CLI.
|
|
6
|
+
|
|
7
|
+
## What is FlowEngine?
|
|
8
|
+
|
|
9
|
+
FlowEngine is a white-label n8n automation platform that lets you build and deploy workflow automations for your clients. This MCP server brings FlowEngine's core capabilities into Claude for seamless management.
|
|
10
|
+
|
|
11
|
+
## Core Features
|
|
12
|
+
|
|
13
|
+
### Instance Management
|
|
14
|
+
Provision and manage FlowEngine instances for your clients:
|
|
15
|
+
- List all instances with details
|
|
16
|
+
- Monitor health and performance
|
|
17
|
+
- Create new instances
|
|
18
|
+
- Update configurations
|
|
19
|
+
- Delete instances
|
|
20
|
+
|
|
21
|
+
### Client Portals
|
|
22
|
+
Access and monitor your client portals:
|
|
23
|
+
- View all client portal URLs and access details
|
|
24
|
+
- Monitor workflows and components per portal
|
|
25
|
+
|
|
26
|
+
### AI FlowBuilder
|
|
27
|
+
Create and manage UI components with AI:
|
|
28
|
+
- Build forms, chatbots, and widgets
|
|
29
|
+
- List all components across instances
|
|
30
|
+
- Update component configurations
|
|
31
|
+
- Delete components
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
### Prerequisites
|
|
36
|
+
- Node.js 18 or higher
|
|
37
|
+
- FlowEngine account with API key ([Get one here](https://flowengine.cloud))
|
|
38
|
+
- Claude Desktop, VSCode, or Claude Code CLI
|
|
39
|
+
|
|
40
|
+
### Get Your API Key
|
|
41
|
+
|
|
42
|
+
1. Log in to [FlowEngine](https://flowengine.cloud)
|
|
43
|
+
2. Go to Settings → API Access
|
|
44
|
+
3. Click "Generate API Key"
|
|
45
|
+
4. Copy your key (shown only once)
|
|
46
|
+
|
|
47
|
+
### Quick Setup
|
|
48
|
+
|
|
49
|
+
#### Claude Desktop
|
|
50
|
+
|
|
51
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"flowengine": {
|
|
57
|
+
"command": "npx",
|
|
58
|
+
"args": ["-y", "flowengine-mcp-app"],
|
|
59
|
+
"env": {
|
|
60
|
+
"FLOWENGINE_API_KEY": "your-api-key-here"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
#### Claude Code CLI
|
|
68
|
+
|
|
69
|
+
Edit `~/.claude/claude_code_config.json`:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"flowengine": {
|
|
75
|
+
"command": "npx",
|
|
76
|
+
"args": ["-y", "flowengine-mcp-app"],
|
|
77
|
+
"env": {
|
|
78
|
+
"FLOWENGINE_API_KEY": "your-api-key-here"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### VSCode (Claude Extension)
|
|
86
|
+
|
|
87
|
+
Add to your VSCode settings:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"mcp.servers": {
|
|
92
|
+
"flowengine": {
|
|
93
|
+
"command": "npx",
|
|
94
|
+
"args": ["-y", "flowengine-mcp-app"],
|
|
95
|
+
"env": {
|
|
96
|
+
"FLOWENGINE_API_KEY": "your-api-key-here"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Then restart** Claude Desktop, start a new Claude Code session, or reload VSCode.
|
|
104
|
+
|
|
105
|
+
## Usage
|
|
106
|
+
|
|
107
|
+
### 🎨 Interactive Dashboards (MCP Apps)
|
|
108
|
+
|
|
109
|
+
**NEW!** Visual dashboards with interactive HTML interfaces. Ask Claude:
|
|
110
|
+
|
|
111
|
+
| Command | What You Get |
|
|
112
|
+
|---------|--------------|
|
|
113
|
+
| **"Show me the FlowEngine client portals dashboard"** | Interactive dashboard with all your client portals, URLs, and storage details |
|
|
114
|
+
| **"Show me the AI FlowBuilder"** | Visual dashboard for managing forms, chatbots, and widgets across all instances |
|
|
115
|
+
| **"Show me my FlowEngine instances"** | Instance manager dashboard with resource details and quick actions |
|
|
116
|
+
|
|
117
|
+
**How it works:**
|
|
118
|
+
1. Ask Claude using the exact commands above
|
|
119
|
+
2. Claude will display a rich HTML dashboard
|
|
120
|
+
3. View all your data in a visual, organized format
|
|
121
|
+
|
|
122
|
+
**Fallback:** If dashboards don't appear, use text-based tools:
|
|
123
|
+
```
|
|
124
|
+
"Use flowengine_list_portals to show my portals"
|
|
125
|
+
"Use flowengine_list_instances"
|
|
126
|
+
"Use flowengine_list_components"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 💬 Natural Language Commands
|
|
130
|
+
|
|
131
|
+
Manage your platform through conversation:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
"List all my FlowEngine instances"
|
|
135
|
+
"What's the status of instance abc123?"
|
|
136
|
+
"Create a new contact form widget"
|
|
137
|
+
"Show me all UI components"
|
|
138
|
+
"Provision a new instance for Acme Corp"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Available Tools
|
|
142
|
+
|
|
143
|
+
### Instance Management (5 tools)
|
|
144
|
+
- `flowengine_list_instances` - List all instances
|
|
145
|
+
- `flowengine_get_instance_status` - Get instance health
|
|
146
|
+
- `flowengine_create_instance` - Provision new instance
|
|
147
|
+
- `flowengine_update_instance` - Update settings
|
|
148
|
+
- `flowengine_delete_instance` - Delete instance
|
|
149
|
+
|
|
150
|
+
### Client Portals (1 tool)
|
|
151
|
+
- `flowengine_list_portals` - List all portals
|
|
152
|
+
|
|
153
|
+
### AI FlowBuilder (5 tools)
|
|
154
|
+
- `flowengine_list_components` - List UI components
|
|
155
|
+
- `flowengine_get_component` - Get component details
|
|
156
|
+
- `flowengine_create_component` - Create form/chatbot/widget
|
|
157
|
+
- `flowengine_update_component` - Update component
|
|
158
|
+
- `flowengine_delete_component` - Delete component
|
|
159
|
+
|
|
160
|
+
**Total: 11 tools** (optimized to prevent API concurrency issues)
|
|
161
|
+
|
|
162
|
+
## Resources
|
|
163
|
+
|
|
164
|
+
Interactive UI dashboards available via MCP Apps (MCP v1.1+):
|
|
165
|
+
|
|
166
|
+
- `ui://flowengine/portals` - Client Portals Dashboard
|
|
167
|
+
- `ui://flowengine/ui-builder` - AI FlowBuilder
|
|
168
|
+
- `ui://flowengine/instances` - Instance Manager
|
|
169
|
+
|
|
170
|
+
**Note**: MCP Apps is a new feature announced January 26, 2026. Support may vary by client:
|
|
171
|
+
- ✅ Claude Desktop: Coming soon
|
|
172
|
+
- ✅ Claude Code: Check version compatibility
|
|
173
|
+
- ✅ VSCode: Depends on extension version
|
|
174
|
+
|
|
175
|
+
## Configuration
|
|
176
|
+
|
|
177
|
+
### Environment Variables
|
|
178
|
+
|
|
179
|
+
- `FLOWENGINE_API_KEY` (required) - Your FlowEngine API key
|
|
180
|
+
- `FLOWENGINE_BASE_URL` (optional) - Custom base URL (defaults to https://flowengine.cloud)
|
|
181
|
+
|
|
182
|
+
### Custom Base URL
|
|
183
|
+
|
|
184
|
+
For self-hosted or custom deployments:
|
|
185
|
+
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
"env": {
|
|
189
|
+
"FLOWENGINE_API_KEY": "your-key",
|
|
190
|
+
"FLOWENGINE_BASE_URL": "https://your-domain.com"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Development
|
|
196
|
+
|
|
197
|
+
### Local Development
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Clone and install
|
|
201
|
+
git clone https://github.com/FlowEngine-cloud/flowengine.git
|
|
202
|
+
cd flowengine/flowengine-mcp
|
|
203
|
+
npm install
|
|
204
|
+
|
|
205
|
+
# Build
|
|
206
|
+
npm run build
|
|
207
|
+
|
|
208
|
+
# Test locally
|
|
209
|
+
node build/index.js
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Project Structure
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
flowengine-mcp/
|
|
216
|
+
├── src/
|
|
217
|
+
│ ├── index.ts # MCP server
|
|
218
|
+
│ ├── client.ts # FlowEngine API client
|
|
219
|
+
│ └── ui/ # Dashboard renderers
|
|
220
|
+
│ ├── base.ts
|
|
221
|
+
│ ├── portals.ts
|
|
222
|
+
│ ├── widgets.ts
|
|
223
|
+
│ └── instances.ts
|
|
224
|
+
├── package.json
|
|
225
|
+
├── tsconfig.json
|
|
226
|
+
└── README.md
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Using Local Build
|
|
230
|
+
|
|
231
|
+
Point your MCP config to local build:
|
|
232
|
+
|
|
233
|
+
```json
|
|
234
|
+
{
|
|
235
|
+
"mcpServers": {
|
|
236
|
+
"flowengine": {
|
|
237
|
+
"command": "node",
|
|
238
|
+
"args": ["/path/to/flowengine-mcp/build/index.js"],
|
|
239
|
+
"env": {
|
|
240
|
+
"FLOWENGINE_API_KEY": "your-key"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Troubleshooting
|
|
248
|
+
|
|
249
|
+
### API Key Issues
|
|
250
|
+
|
|
251
|
+
**Error: "FlowEngine API key not configured"**
|
|
252
|
+
|
|
253
|
+
Solution: Verify `FLOWENGINE_API_KEY` is set in your MCP config
|
|
254
|
+
|
|
255
|
+
### Connection Issues
|
|
256
|
+
|
|
257
|
+
**Error: "Failed to connect to FlowEngine API"**
|
|
258
|
+
|
|
259
|
+
Solutions:
|
|
260
|
+
- Check your internet connection
|
|
261
|
+
- Verify API key is valid
|
|
262
|
+
- Ensure `FLOWENGINE_BASE_URL` is correct (if using custom)
|
|
263
|
+
|
|
264
|
+
### MCP Server Not Starting
|
|
265
|
+
|
|
266
|
+
**Server doesn't appear in Claude**
|
|
267
|
+
|
|
268
|
+
Solutions:
|
|
269
|
+
- Restart Claude Desktop / reload VSCode / start new Claude Code session
|
|
270
|
+
- Check MCP config JSON syntax is valid
|
|
271
|
+
- View logs: `~/.claude/debug/latest` (Claude Code)
|
|
272
|
+
|
|
273
|
+
## Support
|
|
274
|
+
|
|
275
|
+
- **FlowEngine Support**: [flowengine.cloud/support](https://flowengine.cloud/support)
|
|
276
|
+
- **Documentation**: [docs.flowengine.cloud](https://docs.flowengine.cloud)
|
|
277
|
+
- **GitHub Issues**: [github.com/FlowEngine-cloud/flowengine/issues](https://github.com/FlowEngine-cloud/flowengine/issues)
|
|
278
|
+
- **MCP Protocol**: [modelcontextprotocol.io](https://modelcontextprotocol.io)
|
|
279
|
+
|
|
280
|
+
## License
|
|
281
|
+
|
|
282
|
+
MIT License - See LICENSE file for details
|
|
283
|
+
|
|
284
|
+
## Contributing
|
|
285
|
+
|
|
286
|
+
Contributions welcome! Please read our contributing guidelines before submitting PRs.
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
Built by the FlowEngine team
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal fetch wrapper for the CLI. Uses Node 18+ native fetch / FormData.
|
|
3
|
+
*
|
|
4
|
+
* Separate from `src/client.ts` (which is the MCP server's class-based client)
|
|
5
|
+
* because the CLI surface is just /api/v1/functions/* and we want crisp error
|
|
6
|
+
* messages tuned for the terminal.
|
|
7
|
+
*/
|
|
8
|
+
export interface ApiContext {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function getApiContext(): Promise<ApiContext>;
|
|
13
|
+
export declare class ApiError extends Error {
|
|
14
|
+
status: number;
|
|
15
|
+
body?: unknown;
|
|
16
|
+
constructor(message: string, status: number, body?: unknown);
|
|
17
|
+
}
|
|
18
|
+
export declare function apiRequest<T>(ctx: ApiContext, path: string, init?: RequestInit): Promise<T>;
|
|
19
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/cli/api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC,CAUzD;AAED,qBAAa,QAAS,SAAQ,KAAK;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;gBACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;CAK5D;AAmBD,wBAAsB,UAAU,CAAC,CAAC,EAChC,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,WAAgB,GACrB,OAAO,CAAC,CAAC,CAAC,CAgBZ"}
|
package/build/cli/api.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal fetch wrapper for the CLI. Uses Node 18+ native fetch / FormData.
|
|
3
|
+
*
|
|
4
|
+
* Separate from `src/client.ts` (which is the MCP server's class-based client)
|
|
5
|
+
* because the CLI surface is just /api/v1/functions/* and we want crisp error
|
|
6
|
+
* messages tuned for the terminal.
|
|
7
|
+
*/
|
|
8
|
+
import { loadConfig, resolveApiKey, resolveBaseUrl } from './config.js';
|
|
9
|
+
export async function getApiContext() {
|
|
10
|
+
const stored = await loadConfig();
|
|
11
|
+
const apiKey = resolveApiKey(stored);
|
|
12
|
+
if (!apiKey) {
|
|
13
|
+
throw new ApiError('Not logged in. Run `fe login` first, or set FLOWENGINE_API_KEY.', 401);
|
|
14
|
+
}
|
|
15
|
+
return { apiKey, baseUrl: resolveBaseUrl(stored) };
|
|
16
|
+
}
|
|
17
|
+
export class ApiError extends Error {
|
|
18
|
+
status;
|
|
19
|
+
body;
|
|
20
|
+
constructor(message, status, body) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.status = status;
|
|
23
|
+
this.body = body;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function parseError(res) {
|
|
27
|
+
const ct = res.headers.get('content-type') || '';
|
|
28
|
+
if (ct.includes('application/json')) {
|
|
29
|
+
try {
|
|
30
|
+
const j = (await res.json());
|
|
31
|
+
return j.error || j.message || `HTTP ${res.status}`;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return `HTTP ${res.status}`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const text = await res.text();
|
|
38
|
+
if (text.includes('<!DOCTYPE') || text.includes('<html')) {
|
|
39
|
+
return `HTTP ${res.status} (server returned HTML)`;
|
|
40
|
+
}
|
|
41
|
+
return text.length > 300 ? `${text.slice(0, 300)}...` : text || `HTTP ${res.status}`;
|
|
42
|
+
}
|
|
43
|
+
export async function apiRequest(ctx, path, init = {}) {
|
|
44
|
+
const url = `${ctx.baseUrl}${path}`;
|
|
45
|
+
const headers = new Headers(init.headers);
|
|
46
|
+
headers.set('Authorization', `Bearer ${ctx.apiKey}`);
|
|
47
|
+
if (init.body && !(init.body instanceof FormData) && !headers.has('Content-Type')) {
|
|
48
|
+
headers.set('Content-Type', 'application/json');
|
|
49
|
+
}
|
|
50
|
+
const res = await fetch(url, { ...init, headers });
|
|
51
|
+
if (!res.ok) {
|
|
52
|
+
const msg = await parseError(res);
|
|
53
|
+
throw new ApiError(msg, res.status);
|
|
54
|
+
}
|
|
55
|
+
if (res.status === 204)
|
|
56
|
+
return undefined;
|
|
57
|
+
const ct = res.headers.get('content-type') || '';
|
|
58
|
+
if (ct.includes('application/json'))
|
|
59
|
+
return (await res.json());
|
|
60
|
+
return (await res.text());
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/cli/api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAOxE,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,QAAQ,CAChB,iEAAiE,EACjE,GAAG,CACJ,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;AACrD,CAAC;AAED,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,MAAM,CAAS;IACf,IAAI,CAAW;IACf,YAAY,OAAe,EAAE,MAAc,EAAE,IAAc;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,KAAK,UAAU,UAAU,CAAC,GAAa;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I,CAAC,IAAI,YAAY,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;QAClF,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;IAClD,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACnD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,IAAI,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO,SAAc,CAAC;IAC9C,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IACjD,IAAI,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAAE,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAM,CAAC;IACpE,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAiB,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/delete.ts"],"names":[],"mappings":"AAGA,wBAAsB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAYpF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { apiRequest, getApiContext } from '../api.js';
|
|
2
|
+
import { ok, prompt, info } from '../ui.js';
|
|
3
|
+
export async function cmdDelete(id, opts) {
|
|
4
|
+
if (!opts.yes) {
|
|
5
|
+
const answer = (await prompt(` Delete function ${id}? Type "yes" to confirm: `)).trim();
|
|
6
|
+
if (answer !== 'yes') {
|
|
7
|
+
info('Cancelled.');
|
|
8
|
+
return 1;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const ctx = await getApiContext();
|
|
12
|
+
await apiRequest(ctx, `/api/v1/functions/${encodeURIComponent(id)}`, { method: 'DELETE' });
|
|
13
|
+
ok(`Deleted ${id}`);
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/cli/commands/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,EAAU,EAAE,IAAuB;IACjE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACd,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,qBAAqB,EAAE,2BAA2B,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACzF,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YACrB,IAAI,CAAC,YAAY,CAAC,CAAC;YACnB,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,UAAU,CAAC,GAAG,EAAE,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC3F,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACpB,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fe deploy [path] [options]
|
|
3
|
+
*
|
|
4
|
+
* Walks the target folder, packs each file into a multipart form using the
|
|
5
|
+
* file's relative path as the field name, and POSTs to
|
|
6
|
+
* /api/v1/functions/upload. The server builds the tarball + runs the deploy.
|
|
7
|
+
*
|
|
8
|
+
* If --name matches an existing function, the server treats it as a new
|
|
9
|
+
* revision of that function; otherwise it creates one.
|
|
10
|
+
*/
|
|
11
|
+
export interface DeployOptions {
|
|
12
|
+
name?: string;
|
|
13
|
+
runtime?: string;
|
|
14
|
+
memory?: string;
|
|
15
|
+
cpu?: string;
|
|
16
|
+
maxInstances?: string;
|
|
17
|
+
minInstances?: string;
|
|
18
|
+
timeout?: string;
|
|
19
|
+
region?: string;
|
|
20
|
+
concurrency?: string;
|
|
21
|
+
cpuThrottling?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function cmdDeploy(path: string | undefined, opts: DeployOptions): Promise<number>;
|
|
24
|
+
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAmBH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAgF9F"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fe deploy [path] [options]
|
|
3
|
+
*
|
|
4
|
+
* Walks the target folder, packs each file into a multipart form using the
|
|
5
|
+
* file's relative path as the field name, and POSTs to
|
|
6
|
+
* /api/v1/functions/upload. The server builds the tarball + runs the deploy.
|
|
7
|
+
*
|
|
8
|
+
* If --name matches an existing function, the server treats it as a new
|
|
9
|
+
* revision of that function; otherwise it creates one.
|
|
10
|
+
*/
|
|
11
|
+
import { resolve } from 'node:path';
|
|
12
|
+
import { apiRequest, getApiContext, ApiError } from '../api.js';
|
|
13
|
+
import { packFolder, buildUploadForm } from '../pack.js';
|
|
14
|
+
import { c, info, ok, err, bytes, warn } from '../ui.js';
|
|
15
|
+
const MAX_TOTAL_BYTES = 100 * 1024 * 1024;
|
|
16
|
+
const MAX_FILE_BYTES = 25 * 1024 * 1024;
|
|
17
|
+
export async function cmdDeploy(path, opts) {
|
|
18
|
+
const root = resolve(path || '.');
|
|
19
|
+
info(`Packing ${c.bold(root)}`);
|
|
20
|
+
const packed = await packFolder(root);
|
|
21
|
+
if (packed.files.length === 0) {
|
|
22
|
+
err('No files found in folder (after .feignore + skip rules).');
|
|
23
|
+
return 1;
|
|
24
|
+
}
|
|
25
|
+
if (packed.totalBytes > MAX_TOTAL_BYTES) {
|
|
26
|
+
err(`Folder is ${bytes(packed.totalBytes)} - exceeds 100 MB upload cap.`);
|
|
27
|
+
err('Add patterns to .feignore (e.g. data/, *.zip) and retry.');
|
|
28
|
+
return 1;
|
|
29
|
+
}
|
|
30
|
+
for (const f of packed.files) {
|
|
31
|
+
if (f.size > MAX_FILE_BYTES) {
|
|
32
|
+
err(`File ${f.path} is ${bytes(f.size)} - exceeds 25 MB per-file cap.`);
|
|
33
|
+
return 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
info(`${packed.files.length} files, ${bytes(packed.totalBytes)} total`);
|
|
37
|
+
if (packed.files.length <= 8) {
|
|
38
|
+
for (const f of packed.files) {
|
|
39
|
+
console.log(` ${c.dim(f.path.padEnd(40))} ${c.dim(bytes(f.size))}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const compute = {};
|
|
43
|
+
if (opts.memory)
|
|
44
|
+
compute.memory = opts.memory;
|
|
45
|
+
if (opts.cpu)
|
|
46
|
+
compute.cpu = Number(opts.cpu);
|
|
47
|
+
if (opts.maxInstances)
|
|
48
|
+
compute.max_instances = Number(opts.maxInstances);
|
|
49
|
+
if (opts.minInstances)
|
|
50
|
+
compute.min_instances = Number(opts.minInstances);
|
|
51
|
+
if (opts.timeout)
|
|
52
|
+
compute.timeout_seconds = Number(opts.timeout);
|
|
53
|
+
if (opts.region)
|
|
54
|
+
compute.region = opts.region;
|
|
55
|
+
if (opts.concurrency)
|
|
56
|
+
compute.concurrency = Number(opts.concurrency);
|
|
57
|
+
if (opts.cpuThrottling !== undefined)
|
|
58
|
+
compute.cpu_throttling = opts.cpuThrottling;
|
|
59
|
+
const form = buildUploadForm(packed, {
|
|
60
|
+
name: opts.name,
|
|
61
|
+
runtime: opts.runtime,
|
|
62
|
+
compute,
|
|
63
|
+
});
|
|
64
|
+
info(`Uploading to FlowEngine...`);
|
|
65
|
+
const ctx = await getApiContext();
|
|
66
|
+
let result;
|
|
67
|
+
try {
|
|
68
|
+
result = await apiRequest(ctx, '/api/v1/functions/upload', {
|
|
69
|
+
method: 'POST',
|
|
70
|
+
body: form,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
if (e instanceof ApiError) {
|
|
75
|
+
err(`Deploy failed (${e.status}): ${e.message}`);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
err(`Deploy failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
79
|
+
}
|
|
80
|
+
return 1;
|
|
81
|
+
}
|
|
82
|
+
if (!result.success) {
|
|
83
|
+
err(`Deploy rejected: ${result.error || 'unknown reason'}`);
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
ok(`Deployed function ${c.bold(result.id || '')}`);
|
|
87
|
+
if (result.revision)
|
|
88
|
+
info(`Revision: ${result.revision}`);
|
|
89
|
+
// deploy field can be either an object or a string ("already deploying", etc)
|
|
90
|
+
if (typeof result.deploy === 'object' && result.deploy) {
|
|
91
|
+
if (result.deploy.url)
|
|
92
|
+
info(`URL: ${c.cyan(result.deploy.url)}`);
|
|
93
|
+
if (result.deploy.status)
|
|
94
|
+
info(`Status: ${result.deploy.status}`);
|
|
95
|
+
}
|
|
96
|
+
else if (typeof result.deploy === 'string') {
|
|
97
|
+
info(result.deploy);
|
|
98
|
+
}
|
|
99
|
+
if (result.reason)
|
|
100
|
+
warn(result.reason);
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/cli/commands/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEzD,MAAM,eAAe,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAC1C,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAwBxC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAwB,EAAE,IAAmB;IAC3E,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,WA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,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEvC,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fe domain add <id> <domain>
|
|
3
|
+
* fe domain status <id>
|
|
4
|
+
* fe domain rm <id>
|
|
5
|
+
*/
|
|
6
|
+
export declare function cmdDomainAdd(id: string, domain: string): Promise<number>;
|
|
7
|
+
export declare function cmdDomainStatus(id: string): Promise<number>;
|
|
8
|
+
export declare function cmdDomainRm(id: string): Promise<number>;
|
|
9
|
+
//# sourceMappingURL=domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/domain.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,wBAAsB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAU9E;AAED,wBAAsB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQjE;AAED,wBAAsB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAK7D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fe domain add <id> <domain>
|
|
3
|
+
* fe domain status <id>
|
|
4
|
+
* fe domain rm <id>
|
|
5
|
+
*/
|
|
6
|
+
import { apiRequest, getApiContext } from '../api.js';
|
|
7
|
+
import { ok } from '../ui.js';
|
|
8
|
+
export async function cmdDomainAdd(id, domain) {
|
|
9
|
+
const ctx = await getApiContext();
|
|
10
|
+
const data = await apiRequest(ctx, `/api/v1/functions/${encodeURIComponent(id)}/domain`, { method: 'POST', body: JSON.stringify({ domain }) });
|
|
11
|
+
ok(`Mapping requested for ${domain}`);
|
|
12
|
+
console.log(JSON.stringify(data, null, 2));
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
export async function cmdDomainStatus(id) {
|
|
16
|
+
const ctx = await getApiContext();
|
|
17
|
+
const data = await apiRequest(ctx, `/api/v1/functions/${encodeURIComponent(id)}/domain`);
|
|
18
|
+
console.log(JSON.stringify(data, null, 2));
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
export async function cmdDomainRm(id) {
|
|
22
|
+
const ctx = await getApiContext();
|
|
23
|
+
await apiRequest(ctx, `/api/v1/functions/${encodeURIComponent(id)}/domain`, { method: 'DELETE' });
|
|
24
|
+
ok(`Domain mapping removed from ${id}`);
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=domain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../src/cli/commands/domain.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAU,EAAE,MAAc;IAC3D,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,UAAU,CAC3B,GAAG,EACH,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,SAAS,EACpD,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CACrD,CAAC;IACF,EAAE,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EAAU;IAC9C,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,UAAU,CAC3B,GAAG,EACH,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,SAAS,CACrD,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAAU;IAC1C,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,UAAU,CAAC,GAAG,EAAE,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClG,EAAE,CAAC,+BAA+B,EAAE,EAAE,CAAC,CAAC;IACxC,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function-scoped env vars (a.k.a. secret bindings).
|
|
3
|
+
*
|
|
4
|
+
* fe env list <id>
|
|
5
|
+
* fe env set <id> KEY=VALUE
|
|
6
|
+
* fe env unset <id> KEY
|
|
7
|
+
*/
|
|
8
|
+
export declare function cmdEnvList(id: string, opts: {
|
|
9
|
+
json?: boolean;
|
|
10
|
+
}): Promise<number>;
|
|
11
|
+
export declare function cmdEnvSet(id: string, kv: string): Promise<number>;
|
|
12
|
+
export declare function cmdEnvUnset(id: string, name: string): Promise<number>;
|
|
13
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/env.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,wBAAsB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBtF;AAED,wBAAsB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBvE;AAED,wBAAsB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM3E"}
|