decoupled-cli 2.0.2 → 2.1.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.
@@ -5,7 +5,7 @@ This document provides Claude Code with comprehensive instructions for building
5
5
  ## Project Overview
6
6
 
7
7
  **Architecture**: Headless Drupal backend with Next.js frontend
8
- **Backend**: Drupal 11 with GraphQL Compose and DCloud Import API
8
+ **Backend**: Drupal 11 with GraphQL Compose and DC Import API
9
9
  **Frontend**: Next.js 15 with TypeScript, Tailwind CSS, and Apollo GraphQL
10
10
  **Environment**: DDEV local development
11
11
 
@@ -18,29 +18,29 @@ This document provides Claude Code with comprehensive instructions for building
18
18
  - `DRUPAL_REVALIDATE_SECRET` - Secret for on-demand revalidation
19
19
  - `NODE_TLS_REJECT_UNAUTHORIZED=0` - Allow self-signed certificates (development)
20
20
 
21
- ## DCloud CLI Setup
21
+ ## DC CLI Setup
22
22
 
23
23
  **First-time CLI setup:**
24
24
  ```bash
25
- # 1. Install dcloud-cli locally (if not already present in package.json)
26
- npm install --save-dev dcloud-cli
25
+ # 1. Install decoupled-cli locally (if not already present in package.json)
26
+ npm install --save-dev decoupled-cli
27
27
 
28
28
  # 2. Configure authentication - you have two options:
29
29
 
30
30
  # Option A: Use OAuth with your existing Drupal credentials (recommended for local development)
31
- npx dcloud-cli auth oauth
31
+ npx decoupled-cli auth oauth
32
32
 
33
33
  # Option B: Use personal access token (for production/remote deployments)
34
- npx dcloud-cli auth login
34
+ npx decoupled-cli auth login
35
35
 
36
36
  # 3. Set your default space for content imports (optional but recommended)
37
- npx dcloud-cli spaces use <space_id>
37
+ npx decoupled-cli spaces use <space_id>
38
38
 
39
39
  # 4. Verify authentication and space setup
40
- npx dcloud-cli spaces current
40
+ npx decoupled-cli spaces current
41
41
  ```
42
42
 
43
- **OAuth Prerequisites (for `dcloud auth oauth`):**
43
+ **OAuth Prerequisites (for `decoupled-cli auth oauth`):**
44
44
  Your `.env.local` must contain:
45
45
  - `NEXT_PUBLIC_DRUPAL_BASE_URL=https://your-space.decoupled.io`
46
46
  - `DRUPAL_CLIENT_ID=your_oauth_client_id`
@@ -48,12 +48,12 @@ Your `.env.local` must contain:
48
48
 
49
49
  **Authentication Method Differences:**
50
50
  - **OAuth** → Works with your Drupal site API (content import, Drupal operations)
51
- - **Personal Access Token** → Works with DrupalCloud platform API (spaces, users, organizations)
51
+ - **Personal Access Token** → Works with Decoupled Drupal platform API (spaces, users, organizations)
52
52
 
53
53
  **If CLI is not available locally:**
54
- - For projects with dcloud-cli in package.json: Run `npm install` then use `npx dcloud-cli`
55
- - For development: `cd cli && npm install && npm run build && npm link` then use `dcloud`
56
- - Always prefer using `npx dcloud-cli` for consistency and local package management
54
+ - For projects with decoupled-cli in package.json: Run `npm install` then use `npx decoupled-cli`
55
+ - For development: `cd cli && npm install && npm run build && npm link` then use `decoupled-cli`
56
+ - Always prefer using `npx decoupled-cli` for consistency and local package management
57
57
 
58
58
  ## End-to-End Development Workflow
59
59
 
@@ -73,9 +73,9 @@ Use OAuth authentication for direct Drupal content import, then frontend develop
73
73
 
74
74
  **Create a todo list for tracking progress:**
75
75
  ```markdown
76
- 1. Verify DCloud CLI authentication (npx dcloud-cli auth status)
77
- 2. Create DCloud Import JSON for [content_type]
78
- 3. Import content type and sample content to Drupal (npx dcloud-cli content import)
76
+ 1. Verify DC CLI authentication (npx decoupled-cli auth status)
77
+ 2. Create DC Import JSON for [content_type]
78
+ 3. Import content type and sample content to Drupal (npx decoupled-cli content import)
79
79
  4. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
80
80
  5. Create TypeScript types and GraphQL queries
81
81
  6. Build frontend components ([ContentCard], [ContentRenderer])
@@ -84,12 +84,12 @@ Use OAuth authentication for direct Drupal content import, then frontend develop
84
84
  9. Validate end-to-end functionality
85
85
  ```
86
86
 
87
- **Legacy Platform Workflow (PAT + DrupalCloud Platform):**
87
+ **Legacy Platform Workflow (PAT + Decoupled Drupal Platform):**
88
88
  ```markdown
89
- 1. Verify DCloud CLI authentication (npx dcloud-cli auth status)
90
- 2. Set default space if needed (npx dcloud-cli spaces use <id>)
91
- 3. Create DCloud Import JSON for [content_type]
92
- 4. Import content type and sample content via platform (npx dcloud-cli spaces content-import)
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
93
  5. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
94
94
  6. Create TypeScript types and GraphQL queries
95
95
  7. Build frontend components ([ContentCard], [ContentRenderer])
@@ -103,23 +103,23 @@ Use OAuth authentication for direct Drupal content import, then frontend develop
103
103
  **ALWAYS start by verifying CLI setup:**
104
104
  ```bash
105
105
  # Check if CLI is authenticated
106
- npx dcloud-cli auth status
106
+ npx decoupled-cli auth status
107
107
 
108
108
  # If not authenticated, choose authentication method:
109
109
  # For local development with Drupal OAuth:
110
- npx dcloud-cli auth oauth
110
+ npx decoupled-cli auth oauth
111
111
 
112
112
  # For production with personal access token:
113
- npx dcloud-cli auth login
113
+ npx decoupled-cli auth login
114
114
 
115
115
  # List available spaces and set default
116
- npx dcloud-cli spaces list
117
- npx dcloud-cli spaces use <space_id>
116
+ npx decoupled-cli spaces list
117
+ npx decoupled-cli spaces use <space_id>
118
118
  ```
119
119
 
120
120
  **If CLI authentication fails:**
121
121
  - For OAuth: Verify `.env.local` contains `NEXT_PUBLIC_DRUPAL_BASE_URL`, `DRUPAL_CLIENT_ID`, `DRUPAL_CLIENT_SECRET`
122
- - For personal tokens: Check that DCloud platform is accessible
122
+ - For personal tokens: Check that DC platform is accessible
123
123
  - Ensure user has proper permissions for the operations you're trying to perform
124
124
 
125
125
  **Important: Command Availability by Authentication Method**
@@ -127,11 +127,11 @@ npx dcloud-cli spaces use <space_id>
127
127
  - **PAT-only commands**: `spaces list`, `spaces use`, `usage`, `org info`
128
128
  - **Universal commands**: `auth login`, `auth oauth`, `auth test`
129
129
 
130
- ### 2. DCloud Import JSON Creation
130
+ ### 2. DC Import JSON Creation
131
131
 
132
132
  **Get example format with CLI:**
133
133
  ```bash
134
- npx dcloud-cli spaces content-import --example > my-content-type.json
134
+ npx decoupled-cli spaces content-import --example > my-content-type.json
135
135
  ```
136
136
 
137
137
  **Use this JSON structure:**
@@ -186,32 +186,32 @@ npx dcloud-cli spaces content-import --example > my-content-type.json
186
186
  - **For image fields**: Use full URLs with the Drupal domain from `.env.local`, not relative paths:
187
187
  ```json
188
188
  "featured_image": {
189
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dcloud_import/resources/placeholder.png",
189
+ "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
190
190
  "alt": "Description of the image",
191
191
  "title": "Image title"
192
192
  }
193
193
  ```
194
194
  Always read the `NEXT_PUBLIC_DRUPAL_BASE_URL` from `.env.local` and use that as the base for image URIs to ensure images load correctly from the Drupal backend.
195
195
 
196
- ### 3. Import via DCloud CLI
196
+ ### 3. Import via DC CLI
197
197
 
198
198
  **Import Content Type:**
199
199
  ```bash
200
200
  # NEW: Import content directly to your Drupal site (OAuth authentication)
201
- npx dcloud-cli content import --file content-type-import.json
201
+ npx decoupled-cli content import --file content-type-import.json
202
202
 
203
203
  # Or preview first to see what will be imported
204
- npx dcloud-cli content import --file content-type-import.json --preview
204
+ npx decoupled-cli content import --file content-type-import.json --preview
205
205
 
206
- # LEGACY: Import via DrupalCloud platform (requires PAT authentication and space setup)
207
- npx dcloud-cli spaces content-import --file content-type-import.json
208
- npx dcloud-cli spaces content-import <space_id> --file content-type-import.json
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
209
  ```
210
210
 
211
211
  **Generate example import file:**
212
212
  ```bash
213
213
  # Get example import JSON structure (works with both methods)
214
- npx dcloud-cli content import --example > content-type-import.json
214
+ npx decoupled-cli content import --example > content-type-import.json
215
215
  # Then edit the generated file with your content type definition
216
216
  ```
217
217
 
@@ -220,7 +220,7 @@ npx dcloud-cli content import --example > content-type-import.json
220
220
  - Field machine names (auto-generated)
221
221
  - Node IDs created
222
222
  - GraphQL schema updates
223
- - **Important**: GraphQL field names may differ from DCloud field IDs (check actual schema)
223
+ - **Important**: GraphQL field names may differ from DC field IDs (check actual schema)
224
224
 
225
225
  **CRITICAL: Immediately Update GraphQL Schema After Import:**
226
226
  ```bash
@@ -500,7 +500,7 @@ npm run dev
500
500
  ### 6. Testing Checklist
501
501
 
502
502
  **Verify each step:**
503
- - [ ] DCloud import successful with no errors
503
+ - [ ] DC import successful with no errors
504
504
  - [ ] GraphQL schema includes new content type
505
505
  - [ ] TypeScript types are properly defined
506
506
  - [ ] Build process completes without errors
@@ -540,7 +540,7 @@ npm run dev
540
540
  ```json
541
541
  "product_images": [
542
542
  {
543
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dcloud_import/resources/placeholder.png",
543
+ "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
544
544
  "alt": "Product showcase image",
545
545
  "title": "Product Image"
546
546
  }
@@ -588,7 +588,7 @@ npm run dev
588
588
  **Sample content with image URI:**
589
589
  ```json
590
590
  "profile_image": {
591
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dcloud_import/resources/placeholder.png",
591
+ "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
592
592
  "alt": "Team member headshot",
593
593
  "title": "Profile Photo"
594
594
  }
@@ -617,7 +617,7 @@ npm run dev
617
617
  ```json
618
618
  "project_images": [
619
619
  {
620
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dcloud_import/resources/placeholder.png",
620
+ "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
621
621
  "alt": "Project screenshot showing main interface",
622
622
  "title": "Project Interface"
623
623
  }
@@ -628,7 +628,7 @@ npm run dev
628
628
 
629
629
  ### Common Issues
630
630
 
631
- **1. DCloud Import Fails**
631
+ **1. DC Import Fails**
632
632
  - Check OAuth token expiration
633
633
  - Verify JSON structure matches `schema/sample.json` format
634
634
  - Ensure field IDs don't start with `field_`
@@ -645,15 +645,15 @@ npm run dev
645
645
  - Verify GraphQL query syntax
646
646
 
647
647
  **4. Content Not Displaying**
648
- - Check GraphQL query field names match Drupal fields (may not match DCloud field IDs)
648
+ - Check GraphQL query field names match Drupal fields (may not match DC field IDs)
649
649
  - Verify content was created and published
650
650
  - Check query variables and pagination
651
651
  - For HTML content showing raw tags, use `dangerouslySetInnerHTML={{ __html: field.processed }}`
652
652
 
653
- **5. GraphQL Schema Not Updated After DCloud Import**
654
- - **Critical Issue**: DCloud imports create content types successfully but GraphQL schema may not update immediately
653
+ **5. GraphQL Schema Not Updated After DC Import**
654
+ - **Critical Issue**: DC imports create content types successfully but GraphQL schema may not update immediately
655
655
  - Content exists in Drupal but `nodeProducts` query returns "field not found" errors
656
- - This is the most common issue with DCloud imports
656
+ - This is the most common issue with DC imports
657
657
 
658
658
  **Solution Process**:
659
659
  1. Clear Drupal caches (if you have admin access)
@@ -663,7 +663,7 @@ npm run dev
663
663
 
664
664
  ### Essential Schema Generation Workflow
665
665
 
666
- **CRITICAL**: Always run schema generation after DCloud imports to ensure GraphQL integration works properly.
666
+ **CRITICAL**: Always run schema generation after DC imports to ensure GraphQL integration works properly.
667
667
 
668
668
  ```bash
669
669
  # Generate updated GraphQL schema after content type imports
@@ -677,7 +677,7 @@ This command:
677
677
  - Validates that new content types are available in GraphQL
678
678
 
679
679
  **Add this to your workflow**:
680
- 1. Import content type via DCloud API
680
+ 1. Import content type via DC API
681
681
  2. **Immediately run**: `npm run generate-schema`
682
682
  3. Check generated schema includes your new content type
683
683
  4. Test GraphQL queries
@@ -687,37 +687,37 @@ This command:
687
687
 
688
688
  ```bash
689
689
  # Check CLI authentication status
690
- npx dcloud-cli auth status
690
+ npx decoupled-cli auth status
691
691
 
692
692
  # OAUTH/DRUPAL COMMANDS:
693
693
  # Check content import API status
694
- npx dcloud-cli content status
694
+ npx decoupled-cli content status
695
695
 
696
696
  # Preview content import without applying changes
697
- npx dcloud-cli content import --file your-import.json --preview
697
+ npx decoupled-cli content import --file your-import.json --preview
698
698
 
699
699
  # Import content to Drupal
700
- npx dcloud-cli content import --file your-import.json
700
+ npx decoupled-cli content import --file your-import.json
701
701
 
702
702
  # Generate fresh schema (most important after any import)
703
703
  npm run generate-schema
704
704
 
705
- # PAT/PLATFORM COMMANDS (require npx dcloud-cli auth login):
705
+ # PAT/PLATFORM COMMANDS (require npx decoupled-cli auth login):
706
706
  # List available spaces
707
- npx dcloud-cli spaces list
707
+ npx decoupled-cli spaces list
708
708
 
709
709
  # Check current default space
710
- npx dcloud-cli spaces current
710
+ npx decoupled-cli spaces current
711
711
 
712
- # Get health status of DCloud platform
713
- npx dcloud-cli health check
712
+ # Get health status of DC platform
713
+ npx decoupled-cli health check
714
714
 
715
715
  # Check organization info
716
- npx dcloud-cli org info
716
+ npx decoupled-cli org info
717
717
 
718
718
  # Legacy platform content import
719
- npx dcloud-cli spaces content-import --file your-import.json --preview
720
- npx dcloud-cli spaces content-import --file your-import.json --json
719
+ npx decoupled-cli spaces content-import --file your-import.json --preview
720
+ npx decoupled-cli spaces content-import --file your-import.json --json
721
721
  ```
722
722
 
723
723
  ## Content Import Command Reference
@@ -726,22 +726,22 @@ npx dcloud-cli spaces content-import --file your-import.json --json
726
726
 
727
727
  **Check content import API status:**
728
728
  ```bash
729
- npx dcloud-cli content status
729
+ npx decoupled-cli content status
730
730
  ```
731
731
 
732
732
  **Generate example import JSON:**
733
733
  ```bash
734
- npx dcloud-cli content import --example > my-content-type.json
734
+ npx decoupled-cli content import --example > my-content-type.json
735
735
  ```
736
736
 
737
737
  **Preview import (dry run):**
738
738
  ```bash
739
- npx dcloud-cli content import --file my-content-type.json --preview
739
+ npx decoupled-cli content import --file my-content-type.json --preview
740
740
  ```
741
741
 
742
742
  **Import content to Drupal:**
743
743
  ```bash
744
- npx dcloud-cli content import --file my-content-type.json
744
+ npx decoupled-cli content import --file my-content-type.json
745
745
  ```
746
746
 
747
747
  ### Authentication Setup for Content Import
@@ -750,13 +750,13 @@ npx dcloud-cli content import --file my-content-type.json
750
750
  ```bash
751
751
  # 1. Ensure .env.local has OAuth credentials
752
752
  # 2. Set up OAuth profile
753
- npx dcloud-cli auth oauth
753
+ npx decoupled-cli auth oauth
754
754
 
755
755
  # 3. Verify it's working
756
- npx dcloud-cli content status
756
+ npx decoupled-cli content status
757
757
 
758
758
  # 4. Import content
759
- npx dcloud-cli content import --file your-content.json
759
+ npx decoupled-cli content import --file your-content.json
760
760
  ```
761
761
 
762
762
  **When to use OAuth vs PAT:**
@@ -774,7 +774,7 @@ npx dcloud-cli content import --file your-content.json
774
774
  7. **Include proper TypeScript types** for all data structures
775
775
  8. **Test the full user journey** from listing to detail pages
776
776
  9. **Use `dangerouslySetInnerHTML`** for processed HTML content from Drupal to avoid raw tag display
777
- 10. **Verify GraphQL field names** match actual schema, not DCloud field IDs
777
+ 10. **Verify GraphQL field names** match actual schema, not DC field IDs
778
778
 
779
779
  ## Success Criteria
780
780
 
@@ -792,7 +792,7 @@ A successful end-to-end implementation should:
792
792
 
793
793
  Based on successful product catalog implementation, here are critical learnings to avoid common pitfalls:
794
794
 
795
- ### DCloud Import Format Issues
795
+ ### DC Import Format Issues
796
796
 
797
797
  **Problem**: Field values incorrectly formatted with "field_" prefix
798
798
  ```json
@@ -813,14 +813,14 @@ Based on successful product catalog implementation, here are critical learnings
813
813
 
814
814
  ### GraphQL Field Name Mapping
815
815
 
816
- **Problem**: Assuming GraphQL field names match DCloud field IDs
816
+ **Problem**: Assuming GraphQL field names match DC field IDs
817
817
  ```typescript
818
818
  // WRONG - Field names may be transformed
819
- price: string // DCloud field ID
819
+ price: string // DC field ID
820
820
  fieldPrice: string // What you might expect in GraphQL
821
821
 
822
822
  // CORRECT - Check actual schema
823
- price: string // Actual GraphQL field name (can match DCloud ID)
823
+ price: string // Actual GraphQL field name (can match DC ID)
824
824
  inStock: boolean // camelCase transformation
825
825
  productImages: object // snake_case to camelCase
826
826
  ```
@@ -829,7 +829,7 @@ productImages: object // snake_case to camelCase
829
829
 
830
830
  ### GraphQL Field Value Structure Discovery
831
831
 
832
- **Critical Learning**: GraphQL field values from DCloud imports return as simple types, not objects:
832
+ **Critical Learning**: GraphQL field values from DC imports return as simple types, not objects:
833
833
 
834
834
  ```typescript
835
835
  // WRONG - Assuming field values are objects with .processed
@@ -840,7 +840,7 @@ fieldFeatures?: Array<{
840
840
  processed: string
841
841
  }>
842
842
 
843
- // CORRECT - DCloud imports create simple value fields
843
+ // CORRECT - DC imports create simple value fields
844
844
  price?: string
845
845
  features?: string[]
846
846
  ```
@@ -953,29 +953,29 @@ npm run dev # Test in development mode
953
953
 
954
954
  The most important learning from the product catalog implementation is the **mandatory schema generation step**:
955
955
 
956
- **Problem**: DCloud imports successfully create content types and content, but GraphQL schema doesn't update automatically.
956
+ **Problem**: DC imports successfully create content types and content, but GraphQL schema doesn't update automatically.
957
957
  **Symptoms**:
958
958
  - `nodeProducts` query returns "field not found" errors
959
959
  - Content exists in Drupal but not accessible via GraphQL
960
960
  - Route queries work but content type queries fail
961
961
 
962
- **Solution**: **ALWAYS run schema generation immediately after DCloud imports**:
962
+ **Solution**: **ALWAYS run schema generation immediately after DC imports**:
963
963
 
964
964
  ```bash
965
- # After any DCloud import, immediately run:
965
+ # After any DC import, immediately run:
966
966
  npm run generate-schema
967
967
 
968
968
  # This step is MANDATORY for GraphQL integration to work
969
969
  ```
970
970
 
971
971
  **Why this is critical**:
972
- - DCloud API creates Drupal content types but doesn't trigger GraphQL schema rebuilds
972
+ - DC API creates Drupal content types but doesn't trigger GraphQL schema rebuilds
973
973
  - The `generate-schema` script performs fresh introspection and updates local schema files
974
974
  - Without this step, frontend development will fail with "type not found" errors
975
975
  - This step bridges the gap between Drupal content type creation and Next.js GraphQL integration
976
976
 
977
977
  **Workflow Integration**:
978
- 1. Import via DCloud API ✅
978
+ 1. Import via DC API ✅
979
979
  2. **Run `npm run generate-schema`** ✅ ← CRITICAL STEP
980
980
  3. Verify schema includes new content type ✅
981
981
  4. Proceed with frontend development ✅
@@ -984,7 +984,7 @@ This learning transforms the development workflow from "sometimes works" to "rel
984
984
 
985
985
  ### GraphQL Schema Field Name Discovery
986
986
 
987
- **Critical Process**: Always verify actual GraphQL field names after DCloud import - they may differ from field IDs used in import JSON.
987
+ **Critical Process**: Always verify actual GraphQL field names after DC import - they may differ from field IDs used in import JSON.
988
988
 
989
989
  **Discovery Method**:
990
990
  ```bash
@@ -994,7 +994,7 @@ grep -A 10 -B 5 nodeProducts schema/schema.graphql
994
994
  # This shows the actual field names and types available
995
995
  ```
996
996
 
997
- **Key Learning**: DCloud field IDs may transform in GraphQL schema:
997
+ **Key Learning**: DC field IDs may transform in GraphQL schema:
998
998
  - `in_stock` becomes `inStock` (camelCase)
999
999
  - `product_images` becomes `productImages` (camelCase)
1000
1000
  - Simple field types work reliably (string, boolean, string[])
@@ -1048,7 +1048,7 @@ Based on successful product catalog implementation:
1048
1048
 
1049
1049
  **Essential Commands Sequence**:
1050
1050
  ```bash
1051
- # After DCloud import, always run:
1051
+ # After DC import, always run:
1052
1052
  npm run generate-schema # Updates GraphQL schema
1053
1053
  npm run build # Validates TypeScript and builds
1054
1054
  npm run dev # Test in development
@@ -1062,9 +1062,9 @@ npm run dev # Test in development
1062
1062
 
1063
1063
  ### Deployment Field Mapping Reference
1064
1064
 
1065
- **DCloud Import → GraphQL Schema Mapping**:
1065
+ **DC Import → GraphQL Schema Mapping**:
1066
1066
  ```json
1067
- // DCloud import format:
1067
+ // DC import format:
1068
1068
  {
1069
1069
  "in_stock": true, // → GraphQL: inStock
1070
1070
  "product_images": [...], // → GraphQL: productImages