@membranehq/cli 1.4.0 → 1.4.1

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 (3) hide show
  1. package/README.md +61 -39
  2. package/dist/index.js +41 -179
  3. package/package.json +19 -17
package/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # Membrane CLI
2
2
 
3
- A command-line interface for working with Membrane in your local development environment.
3
+ A command-line interface for working with Membrane in local development environment.
4
4
 
5
5
  ## Installation
6
+
6
7
  ```bash
7
8
  npm install -g @membranehq/cli
8
9
  # or
@@ -11,25 +12,43 @@ yarn global add @membranehq/cli
11
12
  bun install -g @membranehq/cli
12
13
  # or
13
14
  pnpm install -g @membranehq/cli
14
-
15
15
  ```
16
16
 
17
17
  ## Quick Start
18
18
 
19
- Run `membrane` in your project directory to go through the setup process and get started.
19
+ ```bash
20
+ # Initialize with your workspace credentials (interactive)
21
+ membrane init
22
+
23
+ # Or non-interactive
24
+ membrane init --key <key> --secret <secret>
25
+
26
+ # Pull workspace elements
27
+ membrane pull
20
28
 
21
- It will ask you to authenticate in the Membrane Console and select a remote workspace you want to work with.
29
+ # Make changes, then push back
30
+ membrane push
31
+ ```
22
32
 
23
- It will create the `membrane.config.yml` file that will contain your workspace credentials.
33
+ See the Configuration section below for alternative ways to configure credentials.
34
+
35
+ ## Commands
24
36
 
25
- ## Commands Reference
26
37
  ```bash
27
- # View membrane help
38
+ # Initialize workspace configuration
39
+ membrane init --key <key> --secret <secret>
40
+
41
+ # Pull workspace elements from remote
42
+ membrane pull [--force]
43
+
44
+ # Push workspace elements to remote
45
+ membrane push [--force]
46
+
47
+ # Get help
28
48
  membrane --help
29
- # View membrane <command> help
30
49
  membrane <command> --help
31
50
 
32
- # Check CLI version
51
+ # Check version
33
52
  membrane --version
34
53
  ```
35
54
 
@@ -42,8 +61,9 @@ The CLI can be configured using either environment variables or a configuration
42
61
  ```bash
43
62
  export MEMBRANE_WORKSPACE_KEY=<your-workspace-key>
44
63
  export MEMBRANE_WORKSPACE_SECRET=<your-workspace-secret>
45
- export MEMBRANE_API_URI=https://api.your-membrane-instance.com # Only needed when using a self-hosted version of Membrane. Set to the URL of your hosted membrane instance. Defaults to https://api.getmembrane.com
46
- export MEMBRANE_TEST_CUSTOMER_ID=<test-customer-id> # Optional: test customer ID for testing integrations
64
+ export MEMBRANE_API_URI=https://api.your-membrane-instance.com # Optional: for self-hosted instances (default: https://api.integration.app)
65
+ export MEMBRANE_CONSOLE_URI=https://console.your-membrane-instance.com # Optional: for self-hosted instances (default: https://console.integration.app)
66
+ export MEMBRANE_TEST_CUSTOMER_ID=<test-customer-id> # Optional: for testing integrations
47
67
  ```
48
68
 
49
69
  ### Configuration File
@@ -53,9 +73,11 @@ The CLI uses a configuration file at `membrane.config.yml`:
53
73
  ```yaml
54
74
  workspaceKey: <your-workspace-key>
55
75
  workspaceSecret: <your-workspace-secret>
76
+
56
77
  # Optional
57
- apiUri: https://api.your-membrane-instance.com # Only needed when using a self-hosted version of Membrane. Set to the URL of your hosted membrane instance. Defaults to https://api.getmembrane.com
58
- testCustomerId: test-customer # Internal id of the customer to be used for testing integrations.
78
+ apiUri: https://api.your-membrane-instance.com # For self-hosted instances (default: https://api.integration.app)
79
+ consoleUri: https://console.your-membrane-instance.com # For self-hosted instances (default: https://console.integration.app)
80
+ testCustomerId: test-customer # Internal ID of customer for testing integrations
59
81
  ```
60
82
 
61
83
  **Note:** When both environment variables and configuration file are present, environment variables take precedence.
@@ -68,46 +90,46 @@ testCustomerId: test-customer # Internal id of the customer to be used for testi
68
90
 
69
91
  `membrane` folder can and should be stored in version control to keep your integration configurations versioned.
70
92
 
71
- ## Syncing between workspaces with `pull` and `push`
93
+ ## Transferring elements between workspaces with `pull` and `push`
72
94
 
73
- The CLI provides a `pull` and `push` command to sync elements between your workspaces. You'd typically use this to sync elements between your development and production workspaces.
95
+ The CLI provides a `pull` and `push` command to transfer workspace elements between environments. You'd typically use this to move integrations, actions, flows, and other configurations from development to production.
74
96
 
75
- **Usage**
97
+ **How it works:**
76
98
 
77
- ```bash
78
- membrane pull
99
+ Workspace elements (integrations, actions, data sources, flows, field mappings, etc.) are stored as YAML files in the `./membrane` directory. Each element has a unique UUID that identifies it across workspaces.
79
100
 
80
- # Change workspace credentials in membrane.config.yml / environment variables
101
+ When you **pull**, the CLI:
81
102
 
82
- membrane push
83
- ```
103
+ - Exports all elements from the remote workspace as YAML
104
+ - Compares them with your local `./membrane` directory by UUID
105
+ - Identifies what's new, changed, or deleted in the remote workspace
106
+ - Downloads connector source code for custom connectors
107
+ - Updates your local files to match the remote state
84
108
 
85
- **Sample workspace sync script**
109
+ When you **push**, the CLI:
86
110
 
87
- ```bash
111
+ - Packages your local `./membrane` directory as an export
112
+ - Compares it with the current state of the remote workspace
113
+ - Identifies what's new, changed, or deleted locally
114
+ - Uploads connector source code for custom connectors
115
+ - Applies the changes to the remote workspace
88
116
 
89
- echo "🚀 Starting Membrane workspace sync workflow..."
117
+ Changes are applied in dependency order (integrations before integration-level elements, parents before children) to maintain referential integrity. Conflicts occur when an element exists in only one location; use `--force` to resolve by preferring the source.
90
118
 
91
- # Step 1: Set up environment variables for development workspace
92
- echo "📝 Setting up development workspace credentials..."
93
- export MEMBRANE_WORKSPACE_KEY="dev-workspace-key-123"
94
- export MEMBRANE_WORKSPACE_SECRET="dev-workspace-secret-456"
119
+ **Example:**
95
120
 
96
- # Step 2: Pull latest changes from development workspace
97
- echo "⬇️ Pulling latest changes from development workspace..."
121
+ ```bash
122
+ # Pull from development workspace
123
+ export MEMBRANE_WORKSPACE_KEY="dev-workspace-key"
124
+ export MEMBRANE_WORKSPACE_SECRET="dev-workspace-secret"
98
125
  membrane pull
99
126
 
100
- # Step 3: Switch to production workspace credentials
101
- echo "🔄 Switching to production workspace credentials..."
102
- export MEMBRANE_WORKSPACE_KEY="prod-workspace-key-789"
103
- export MEMBRANE_WORKSPACE_SECRET="prod-workspace-secret-012"
104
-
105
- # Step 4: Push changes to production workspace
106
- echo "⬆️ Pushing changes to production workspace..."
127
+ # Push to production workspace
128
+ export MEMBRANE_WORKSPACE_KEY="prod-workspace-key"
129
+ export MEMBRANE_WORKSPACE_SECRET="prod-workspace-secret"
107
130
  membrane push
108
131
  ```
109
132
 
110
-
111
133
  ## License
112
134
 
113
- MIT
135
+ MIT