@rglabs/butterfly 1.0.0 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +226 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,226 @@
1
+ # Butterfly CLI
2
+
3
+ CLI tool for downloading and synchronizing resources from the Butterfly platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Global installation
9
+ npm install -g @rglabs/butterfly
10
+
11
+ # Or use with npx (no installation required)
12
+ npx @rglabs/butterfly <command>
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```bash
18
+ # 1. Configure authentication
19
+ butterfly setup
20
+
21
+ # 2. Download all resources
22
+ butterfly download
23
+
24
+ # 3. Start watching for changes
25
+ butterfly start
26
+ ```
27
+
28
+ ## Commands
29
+
30
+ ### `butterfly setup`
31
+
32
+ Configure authentication for the Butterfly platform.
33
+
34
+ ```bash
35
+ butterfly setup
36
+ ```
37
+
38
+ You'll be prompted to enter:
39
+ - **Endpoint**: Your Butterfly platform URL (e.g., `https://app.example.com`)
40
+ - **Email**: Your login email
41
+ - **Password**: Your password
42
+
43
+ Configuration is saved to `.butterfly/config.json`.
44
+
45
+ ---
46
+
47
+ ### `butterfly download`
48
+
49
+ Download resources from the Butterfly platform.
50
+
51
+ ```bash
52
+ # Download all resource types
53
+ butterfly download
54
+
55
+ # Download specific resource type
56
+ butterfly download -t objects
57
+ butterfly download -t reports
58
+ butterfly download -t bfy_workflows
59
+ butterfly download -t bfy_ai_tasks
60
+ butterfly download -t bfy_state_machines
61
+ butterfly download -t pages
62
+ butterfly download -t bfy_cronjobs
63
+ butterfly download -t cms_email_templates
64
+ butterfly download -t cms_email_layouts
65
+
66
+ # Download specific resource by name
67
+ butterfly download -t objects -n users
68
+
69
+ # Custom output directory
70
+ butterfly download -o ./my-resources
71
+
72
+ # Clean existing files before downloading
73
+ butterfly download --cleanup
74
+ ```
75
+
76
+ **Options:**
77
+ | Option | Description |
78
+ |--------|-------------|
79
+ | `-t, --type <type>` | Resource type to download |
80
+ | `-n, --name <name>` | Specific resource name |
81
+ | `-o, --output <path>` | Output directory (default: `./butterfly-resources`) |
82
+ | `--cleanup` | Clean existing contents before downloading |
83
+
84
+ ---
85
+
86
+ ### `butterfly start`
87
+
88
+ Watch for local file changes and sync them to the Butterfly platform in real-time.
89
+
90
+ ```bash
91
+ butterfly start
92
+
93
+ # Custom directory
94
+ butterfly start -o ./my-resources
95
+ ```
96
+
97
+ Supported file types for sync:
98
+ - Object specs (`spec.json`, `code.js`, `style.css`, `*.bfy`, `*.yaml`)
99
+ - Reports (`report.json`, `query.json`, `*.bfy`, `*.js`)
100
+ - Workflows (`workflow.json`, `version.json`, `node.json`, `code.bfy`, `params.yaml`, `connections.json`)
101
+ - AI Tasks (`task.json`, `prompt.twig`, `*.twig`)
102
+ - And more...
103
+
104
+ ---
105
+
106
+ ### `butterfly upload`
107
+
108
+ Upload specific files or folders to the platform.
109
+
110
+ ```bash
111
+ # Upload a single file
112
+ butterfly upload butterfly-resources/objects/app/users/name/spec.json
113
+
114
+ # Upload a folder
115
+ butterfly upload butterfly-resources/objects/app/users
116
+
117
+ # Upload multiple targets
118
+ butterfly upload file1.json folder1 file2.json
119
+ ```
120
+
121
+ ---
122
+
123
+ ### `butterfly add`
124
+
125
+ Create new resources via API and download them locally.
126
+
127
+ ```bash
128
+ # Create a new workflow
129
+ butterfly add -t workflow --title "My Workflow" --system-name my_workflow
130
+
131
+ # Add a node to a workflow
132
+ butterfly add -t workflow-node -w my_workflow --title "Process Data" --node-type CustomScript --node-group Code
133
+
134
+ # Add a node and connect it to an existing node
135
+ butterfly add -t workflow-node -w my_workflow --title "Send Email" --node-type Email --node-group Output --connect-from 123
136
+
137
+ # Create a connection between nodes
138
+ butterfly add -t workflow-connection -w my_workflow --from 123 --to 456
139
+ ```
140
+
141
+ **Options:**
142
+ | Option | Description |
143
+ |--------|-------------|
144
+ | `-t, --type <type>` | Resource type (`workflow`, `workflow-node`, `workflow-connection`) |
145
+ | `-w, --workflow <name>` | Workflow name or ID |
146
+ | `-v, --version <number>` | Version number (defaults to latest) |
147
+ | `--title <title>` | Title/name of the resource |
148
+ | `--node-type <type>` | Node identifier (e.g., `CustomScript`, `WebHook`, `RESTAPI`) |
149
+ | `--node-group <group>` | Node group (e.g., `Code`, `Trigger`, `Connector`, `Output`) |
150
+ | `--connect-from <spec>` | Connect from existing node to new node |
151
+ | `--connect-to <spec>` | Connect from new node to existing node |
152
+
153
+ ---
154
+
155
+ ### `butterfly workflow-info`
156
+
157
+ Get information about available workflow node types.
158
+
159
+ ```bash
160
+ # List all node groups
161
+ butterfly workflow-info --groups
162
+
163
+ # List nodes in a specific group
164
+ butterfly workflow-info --nodes Database
165
+
166
+ # Get details for a specific node
167
+ butterfly workflow-info --details RESTAPI --group Connector
168
+ ```
169
+
170
+ ## Directory Structure
171
+
172
+ After downloading, resources are organized as follows:
173
+
174
+ ```
175
+ butterfly-resources/
176
+ ├── objects/
177
+ │ ├── butterfly/ # Core CMS objects
178
+ │ └── app/ # Application objects
179
+ │ └── [table_name]/
180
+ │ ├── object.json
181
+ │ ├── listing_query.bfy
182
+ │ └── [field_name]/
183
+ │ ├── spec.json
184
+ │ └── [code_files]
185
+ ├── reports/
186
+ │ └── [report-alias]/
187
+ │ ├── report.json
188
+ │ ├── main_query.bfy
189
+ │ ├── queries/
190
+ │ └── specs/
191
+ ├── bfy_workflows/
192
+ │ └── [workflow_name]/
193
+ │ ├── workflow.json
194
+ │ └── v1/
195
+ │ ├── version.json
196
+ │ ├── connections.json
197
+ │ └── nodes/
198
+ ├── bfy_ai_tasks/
199
+ ├── bfy_state_machines/
200
+ ├── pages/
201
+ ├── bfy_cronjobs/
202
+ ├── cms_email_templates/
203
+ └── cms_email_layouts/
204
+ ```
205
+
206
+ ## Field Type Code Files
207
+
208
+ The CLI automatically extracts code from field specs:
209
+
210
+ | Field Type | Parameter | Output File |
211
+ |------------|-----------|-------------|
212
+ | `calculated` | `val_1` | `code.bfy` |
213
+ | `custom` | `val_1` | `template_code.bfy` |
214
+ | `custom` | `val_2` | `processing_code.bfy` |
215
+ | `filter` | `val_3` | `filter_code.bfy` |
216
+ | `nested` | `val_1` | `configuration.yaml` |
217
+ | `js_code` | - | `code.js` |
218
+ | `css_code` | - | `style.css` |
219
+
220
+ ## Requirements
221
+
222
+ - Node.js >= 16.0.0
223
+
224
+ ## License
225
+
226
+ ISC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rglabs/butterfly",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "CLI tool to download resources from the Butterfly platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",