decoupled-cli 2.1.7 → 2.1.9

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/README.md CHANGED
@@ -61,9 +61,10 @@ When this environment variable is set, the CLI will automatically use it for aut
61
61
 
62
62
  **Priority order for authentication:**
63
63
  1. `DECOUPLED_CLI_TOKEN` environment variable (highest priority)
64
- 2. OAuth credentials from `.env.local` (for Drupal content operations)
65
- 3. Stored token in system keychain
66
- 4. Stored token in config file
64
+ 2. Stored token in system keychain
65
+ 3. Stored token in config file
66
+
67
+ **Note:** Content import operations use the same PAT token - no separate OAuth configuration needed!
67
68
 
68
69
  #### Proxy Support
69
70
 
@@ -40,6 +40,65 @@ npx decoupled-cli spaces use <space_id>
40
40
  npx decoupled-cli spaces current
41
41
  ```
42
42
 
43
+ ## Space Management
44
+
45
+ **Creating a new space:**
46
+ ```bash
47
+ # Create a space with default type (starter)
48
+ npx decoupled-cli spaces create "My New Space"
49
+
50
+ # Create a space with specific type
51
+ npx decoupled-cli spaces create "Production Site" --type pro
52
+ npx decoupled-cli spaces create "Enterprise App" --type premium
53
+
54
+ # Available types: starter, pro, premium
55
+
56
+ # Create with description
57
+ npx decoupled-cli spaces create "E-commerce Platform" \
58
+ --type premium \
59
+ --description "Main production e-commerce site"
60
+ ```
61
+
62
+ **Listing and managing spaces:**
63
+ ```bash
64
+ # List all spaces
65
+ npx decoupled-cli spaces list
66
+
67
+ # List with detailed information
68
+ npx decoupled-cli spaces list --detailed
69
+
70
+ # Get space details by ID or name
71
+ npx decoupled-cli spaces get 123
72
+ npx decoupled-cli spaces get my-space-name
73
+
74
+ # Check space status
75
+ npx decoupled-cli spaces status 123
76
+
77
+ # Set default space for operations
78
+ npx decoupled-cli spaces use 123
79
+ npx decoupled-cli spaces current
80
+ ```
81
+
82
+ **Other space operations:**
83
+ ```bash
84
+ # Clone an existing space
85
+ npx decoupled-cli spaces clone 123 --name "Development Copy"
86
+
87
+ # Update space name or type
88
+ npx decoupled-cli spaces update 123 --name "Updated Name"
89
+ npx decoupled-cli spaces update 123 --type premium
90
+
91
+ # Get Drupal admin login link
92
+ npx decoupled-cli spaces login 123
93
+
94
+ # Archive/unarchive spaces
95
+ npx decoupled-cli spaces archive 123
96
+ npx decoupled-cli spaces unarchive 123
97
+
98
+ # Delete space (with confirmation)
99
+ npx decoupled-cli spaces delete 123
100
+ ```
101
+
43
102
  **OAuth Prerequisites (for `decoupled-cli auth oauth`):**
44
103
  Your `.env.local` must contain:
45
104
  - `NEXT_PUBLIC_DRUPAL_BASE_URL=https://your-space.decoupled.io`
@@ -47,8 +106,8 @@ Your `.env.local` must contain:
47
106
  - `DRUPAL_CLIENT_SECRET=your_oauth_client_secret`
48
107
 
49
108
  **Authentication Method Differences:**
50
- - **OAuth** → Works with your Drupal site API (content import, Drupal operations)
51
- - **Personal Access Token** → Works with Decoupled Drupal platform API (spaces, users, organizations)
109
+ - **Personal Access Token (PAT)** → Works with Decoupled Drupal platform API (spaces, users, organizations, **content import via platform proxy**)
110
+ - **OAuth** → Direct Drupal site API access (alternative method for content import, local development)
52
111
 
53
112
  **If CLI is not available locally:**
54
113
  - For projects with decoupled-cli in package.json: Run `npm install` then use `npx decoupled-cli`
@@ -59,8 +118,8 @@ Your `.env.local` must contain:
59
118
 
60
119
  When asked to create a new content type (e.g., "create a product page"), follow these steps:
61
120
 
62
- **Recommended Workflow (OAuth + Drupal API):**
63
- Use OAuth authentication for direct Drupal content import, then frontend development.
121
+ **Recommended Workflow (PAT + Platform Proxy - Contentful-like simplicity):**
122
+ Use a single PAT token for all operations including content import via the platform proxy.
64
123
 
65
124
  ### 1. Content Analysis & Planning
66
125
 
@@ -75,7 +134,7 @@ Use OAuth authentication for direct Drupal content import, then frontend develop
75
134
  ```markdown
76
135
  1. Verify DC CLI authentication (npx decoupled-cli auth status)
77
136
  2. Create DC Import JSON for [content_type]
78
- 3. Import content type and sample content to Drupal (npx decoupled-cli content import)
137
+ 3. Import content type and sample content via platform (npx decoupled-cli spaces content-import <space_id> --file import.json)
79
138
  4. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
80
139
  5. Create TypeScript types and GraphQL queries
81
140
  6. Build frontend components ([ContentCard], [ContentRenderer])
@@ -84,18 +143,17 @@ Use OAuth authentication for direct Drupal content import, then frontend develop
84
143
  9. Validate end-to-end functionality
85
144
  ```
86
145
 
87
- **Legacy Platform Workflow (PAT + Decoupled Drupal Platform):**
146
+ **Alternative Workflow (OAuth + Direct Drupal API):**
88
147
  ```markdown
89
- 1. Verify DC CLI authentication (npx decoupled-cli auth status)
90
- 2. Set default space if needed (npx decoupled-cli spaces use <id>)
91
- 3. Create DC Import JSON for [content_type]
92
- 4. Import content type and sample content via platform (npx decoupled-cli spaces content-import)
93
- 5. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
94
- 6. Create TypeScript types and GraphQL queries
95
- 7. Build frontend components ([ContentCard], [ContentRenderer])
96
- 8. Create listing and detail pages
97
- 9. Test build process and fix errors
98
- 10. Validate end-to-end functionality
148
+ 1. Set up OAuth authentication (npx decoupled-cli auth oauth)
149
+ 2. Create DC Import JSON for [content_type]
150
+ 3. Import content type and sample content to Drupal directly (npx decoupled-cli content import --file import.json)
151
+ 4. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
152
+ 5. Create TypeScript types and GraphQL queries
153
+ 6. Build frontend components ([ContentCard], [ContentRenderer])
154
+ 7. Create listing and detail pages
155
+ 8. Test build process and fix errors
156
+ 9. Validate end-to-end functionality
99
157
  ```
100
158
 
101
159
  ### 0. CLI Authentication Check
@@ -195,17 +253,23 @@ npx decoupled-cli spaces content-import --example > my-content-type.json
195
253
 
196
254
  ### 3. Import via DC CLI
197
255
 
198
- **Import Content Type:**
256
+ **Import Content Type (Recommended - PAT Only):**
257
+ ```bash
258
+ # Import via platform proxy using PAT token (Contentful-like simplicity)
259
+ # No OAuth credentials needed - just your PAT token!
260
+ npx decoupled-cli spaces content-import <space_id> --file content-type-import.json
261
+
262
+ # Or let the CLI use your default space
263
+ npx decoupled-cli spaces content-import --file content-type-import.json
264
+ ```
265
+
266
+ **Alternative: Direct Drupal Import (OAuth Required):**
199
267
  ```bash
200
- # NEW: Import content directly to your Drupal site (OAuth authentication)
268
+ # Import directly to your Drupal site (requires OAuth authentication)
201
269
  npx decoupled-cli content import --file content-type-import.json
202
270
 
203
271
  # Or preview first to see what will be imported
204
272
  npx decoupled-cli content import --file content-type-import.json --preview
205
-
206
- # LEGACY: Import via Decoupled Drupal platform (requires PAT authentication and space setup)
207
- npx decoupled-cli spaces content-import --file content-type-import.json
208
- npx decoupled-cli spaces content-import <space_id> --file content-type-import.json
209
273
  ```
210
274
 
211
275
  **Generate example import file:**
@@ -759,9 +823,9 @@ npx decoupled-cli content status
759
823
  npx decoupled-cli content import --file your-content.json
760
824
  ```
761
825
 
762
- **When to use OAuth vs PAT:**
763
- - **OAuth**: Local development, direct Drupal operations, content import
764
- - **PAT**: Production deployments, platform management, space operations
826
+ **When to use PAT vs OAuth:**
827
+ - **PAT (Recommended)**: All operations including content import, space management, production deployments - **just like Contentful's CMA token**
828
+ - **OAuth**: Alternative method for direct Drupal API access, local development with existing Drupal credentials
765
829
 
766
830
  ## Best Practices
767
831
 
@@ -40,6 +40,65 @@ npx decoupled-cli spaces use <space_id>
40
40
  npx decoupled-cli spaces current
41
41
  ```
42
42
 
43
+ ## Space Management
44
+
45
+ **Creating a new space:**
46
+ ```bash
47
+ # Create a space with default type (starter)
48
+ npx decoupled-cli spaces create "My New Space"
49
+
50
+ # Create a space with specific type
51
+ npx decoupled-cli spaces create "Production Site" --type pro
52
+ npx decoupled-cli spaces create "Enterprise App" --type premium
53
+
54
+ # Available types: starter, pro, premium
55
+
56
+ # Create with description
57
+ npx decoupled-cli spaces create "E-commerce Platform" \
58
+ --type premium \
59
+ --description "Main production e-commerce site"
60
+ ```
61
+
62
+ **Listing and managing spaces:**
63
+ ```bash
64
+ # List all spaces
65
+ npx decoupled-cli spaces list
66
+
67
+ # List with detailed information
68
+ npx decoupled-cli spaces list --detailed
69
+
70
+ # Get space details by ID or name
71
+ npx decoupled-cli spaces get 123
72
+ npx decoupled-cli spaces get my-space-name
73
+
74
+ # Check space status
75
+ npx decoupled-cli spaces status 123
76
+
77
+ # Set default space for operations
78
+ npx decoupled-cli spaces use 123
79
+ npx decoupled-cli spaces current
80
+ ```
81
+
82
+ **Other space operations:**
83
+ ```bash
84
+ # Clone an existing space
85
+ npx decoupled-cli spaces clone 123 --name "Development Copy"
86
+
87
+ # Update space name or type
88
+ npx decoupled-cli spaces update 123 --name "Updated Name"
89
+ npx decoupled-cli spaces update 123 --type premium
90
+
91
+ # Get Drupal admin login link
92
+ npx decoupled-cli spaces login 123
93
+
94
+ # Archive/unarchive spaces
95
+ npx decoupled-cli spaces archive 123
96
+ npx decoupled-cli spaces unarchive 123
97
+
98
+ # Delete space (with confirmation)
99
+ npx decoupled-cli spaces delete 123
100
+ ```
101
+
43
102
  **OAuth Prerequisites (for `decoupled-cli auth oauth`):**
44
103
  Your `.env.local` must contain:
45
104
  - `NEXT_PUBLIC_DRUPAL_BASE_URL=https://your-space.decoupled.io`
@@ -47,8 +106,8 @@ Your `.env.local` must contain:
47
106
  - `DRUPAL_CLIENT_SECRET=your_oauth_client_secret`
48
107
 
49
108
  **Authentication Method Differences:**
50
- - **OAuth** → Works with your Drupal site API (content import, Drupal operations)
51
- - **Personal Access Token** → Works with Decoupled Drupal platform API (spaces, users, organizations)
109
+ - **Personal Access Token (PAT)** → Works with Decoupled Drupal platform API (spaces, users, organizations, **content import via platform proxy**)
110
+ - **OAuth** → Direct Drupal site API access (alternative method for content import, local development)
52
111
 
53
112
  **If CLI is not available locally:**
54
113
  - For projects with decoupled-cli in package.json: Run `npm install` then use `npx decoupled-cli`
@@ -59,8 +118,8 @@ Your `.env.local` must contain:
59
118
 
60
119
  When asked to create a new content type (e.g., "create a product page"), follow these steps:
61
120
 
62
- **Recommended Workflow (OAuth + Drupal API):**
63
- Use OAuth authentication for direct Drupal content import, then frontend development.
121
+ **Recommended Workflow (PAT + Platform Proxy - Contentful-like simplicity):**
122
+ Use a single PAT token for all operations including content import via the platform proxy.
64
123
 
65
124
  ### 1. Content Analysis & Planning
66
125
 
@@ -75,7 +134,7 @@ Use OAuth authentication for direct Drupal content import, then frontend develop
75
134
  ```markdown
76
135
  1. Verify DC CLI authentication (npx decoupled-cli auth status)
77
136
  2. Create DC Import JSON for [content_type]
78
- 3. Import content type and sample content to Drupal (npx decoupled-cli content import)
137
+ 3. Import content type and sample content via platform (npx decoupled-cli spaces content-import <space_id> --file import.json)
79
138
  4. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
80
139
  5. Create TypeScript types and GraphQL queries
81
140
  6. Build frontend components ([ContentCard], [ContentRenderer])
@@ -84,18 +143,17 @@ Use OAuth authentication for direct Drupal content import, then frontend develop
84
143
  9. Validate end-to-end functionality
85
144
  ```
86
145
 
87
- **Legacy Platform Workflow (PAT + Decoupled Drupal Platform):**
146
+ **Alternative Workflow (OAuth + Direct Drupal API):**
88
147
  ```markdown
89
- 1. Verify DC CLI authentication (npx decoupled-cli auth status)
90
- 2. Set default space if needed (npx decoupled-cli spaces use <id>)
91
- 3. Create DC Import JSON for [content_type]
92
- 4. Import content type and sample content via platform (npx decoupled-cli spaces content-import)
93
- 5. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
94
- 6. Create TypeScript types and GraphQL queries
95
- 7. Build frontend components ([ContentCard], [ContentRenderer])
96
- 8. Create listing and detail pages
97
- 9. Test build process and fix errors
98
- 10. Validate end-to-end functionality
148
+ 1. Set up OAuth authentication (npx decoupled-cli auth oauth)
149
+ 2. Create DC Import JSON for [content_type]
150
+ 3. Import content type and sample content to Drupal directly (npx decoupled-cli content import --file import.json)
151
+ 4. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
152
+ 5. Create TypeScript types and GraphQL queries
153
+ 6. Build frontend components ([ContentCard], [ContentRenderer])
154
+ 7. Create listing and detail pages
155
+ 8. Test build process and fix errors
156
+ 9. Validate end-to-end functionality
99
157
  ```
100
158
 
101
159
  ### 0. CLI Authentication Check
@@ -195,17 +253,23 @@ npx decoupled-cli spaces content-import --example > my-content-type.json
195
253
 
196
254
  ### 3. Import via DC CLI
197
255
 
198
- **Import Content Type:**
256
+ **Import Content Type (Recommended - PAT Only):**
257
+ ```bash
258
+ # Import via platform proxy using PAT token (Contentful-like simplicity)
259
+ # No OAuth credentials needed - just your PAT token!
260
+ npx decoupled-cli spaces content-import <space_id> --file content-type-import.json
261
+
262
+ # Or let the CLI use your default space
263
+ npx decoupled-cli spaces content-import --file content-type-import.json
264
+ ```
265
+
266
+ **Alternative: Direct Drupal Import (OAuth Required):**
199
267
  ```bash
200
- # NEW: Import content directly to your Drupal site (OAuth authentication)
268
+ # Import directly to your Drupal site (requires OAuth authentication)
201
269
  npx decoupled-cli content import --file content-type-import.json
202
270
 
203
271
  # Or preview first to see what will be imported
204
272
  npx decoupled-cli content import --file content-type-import.json --preview
205
-
206
- # LEGACY: Import via Decoupled Drupal platform (requires PAT authentication and space setup)
207
- npx decoupled-cli spaces content-import --file content-type-import.json
208
- npx decoupled-cli spaces content-import <space_id> --file content-type-import.json
209
273
  ```
210
274
 
211
275
  **Generate example import file:**
@@ -763,9 +827,9 @@ npx decoupled-cli content status
763
827
  npx decoupled-cli content import --file your-content.json
764
828
  ```
765
829
 
766
- **When to use OAuth vs PAT:**
767
- - **OAuth**: Local development, direct Drupal operations, content import
768
- - **PAT**: Production deployments, platform management, space operations
830
+ **When to use PAT vs OAuth:**
831
+ - **PAT (Recommended)**: All operations including content import, space management, production deployments - **just like Contentful's CMA token**
832
+ - **OAuth**: Alternative method for direct Drupal API access, local development with existing Drupal credentials
769
833
 
770
834
  ## Best Practices
771
835
 
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "model": [
3
3
  {
4
- "bundle": "article",
4
+ "bundle": "news_article",
5
5
  "description": "Blog articles and news posts with rich media and categorization",
6
- "label": "Article",
6
+ "label": "News Article",
7
7
  "body": true,
8
8
  "fields": [
9
9
  {
10
10
  "id": "summary",
11
11
  "label": "Summary",
12
12
  "type": "string",
13
- "description": "Short text field (max 255 chars) for article preview"
13
+ "description": "Short text field (max 255 chars) for news_article preview"
14
14
  },
15
15
  {
16
16
  "id": "featured_image",
17
17
  "label": "Featured Image",
18
18
  "type": "image",
19
- "description": "Single image upload for article hero"
19
+ "description": "Single image upload for news_article hero"
20
20
  },
21
21
  {
22
22
  "id": "published_date",
@@ -126,11 +126,6 @@
126
126
  "label": "Specifications",
127
127
  "type": "string[]",
128
128
  "description": "Technical specifications"
129
- },
130
- {
131
- "id": "category",
132
- "label": "Product Category",
133
- "type": "term(product_category)[]"
134
129
  }
135
130
  ]
136
131
  }
@@ -141,17 +136,12 @@
141
136
  "type": "paragraph.content_block",
142
137
  "values": {
143
138
  "block_title": "Introduction",
144
- "block_content": "<p>This is an <strong>example content block</strong> with formatted text.</p>",
145
- "block_image": {
146
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
147
- "alt": "Content block illustration",
148
- "title": "Block Image"
149
- }
139
+ "block_content": "<p>This is an <strong>example content block</strong> with formatted text.</p>"
150
140
  }
151
141
  },
152
142
  {
153
143
  "id": "article1",
154
- "type": "node.article",
144
+ "type": "node.news_article",
155
145
  "path": "/articles/getting-started-with-drupal",
156
146
  "values": {
157
147
  "title": "Getting Started with Decoupled Drupal",
@@ -166,23 +156,6 @@
166
156
  "Connect via GraphQL or REST API",
167
157
  "Deploy frontend and backend independently"
168
158
  ],
169
- "featured_image": {
170
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
171
- "alt": "Decoupled Drupal architecture diagram",
172
- "title": "Architecture Overview"
173
- },
174
- "gallery": [
175
- {
176
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
177
- "alt": "Screenshot of content management interface",
178
- "title": "CMS Interface"
179
- },
180
- {
181
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
182
- "alt": "Frontend application example",
183
- "title": "Frontend App"
184
- }
185
- ],
186
159
  "tags": [
187
160
  "drupal",
188
161
  "headless-cms",
@@ -216,22 +189,6 @@
216
189
  "Size: 4 x 4 x 0.5 inches",
217
190
  "Weight: 3.2 oz",
218
191
  "Color: Matte Black"
219
- ],
220
- "product_images": [
221
- {
222
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
223
- "alt": "Wireless Charger Pro front view",
224
- "title": "Product Front"
225
- },
226
- {
227
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
228
- "alt": "Wireless Charger Pro with phone charging",
229
- "title": "In Use"
230
- }
231
- ],
232
- "category": [
233
- "electronics",
234
- "accessories"
235
192
  ]
236
193
  }
237
194
  }
@@ -253,11 +210,11 @@
253
210
  "image_format": {
254
211
  "description": "Images require full URLs with Drupal domain, not relative paths",
255
212
  "example": {
256
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
213
+ "uri": "https://example.com/path/to/image.png",
257
214
  "alt": "Descriptive alt text for accessibility",
258
215
  "title": "Image title"
259
216
  },
260
- "note": "Replace ${DRUPAL_BASE_URL} with actual Drupal URL from .env.local"
217
+ "note": "Use full URLs to publicly accessible images"
261
218
  },
262
219
  "content_references": {
263
220
  "description": "Reference other content items using @id syntax",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "decoupled-cli",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "description": "Command-line interface for Decoupled Drupal API management",
5
5
  "main": "dist/index.js",
6
6
  "bin": {