@agility/create-next-app 1.0.0-beta.2
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/.claude/settings.json +7 -0
- package/.claude/settings.local.json +24 -0
- package/FEATURE_ROADMAP.md +343 -0
- package/README.md +205 -0
- package/TESTING.md +131 -0
- package/bin/create-agility-app.js +48 -0
- package/dist/agility/api-keys/generateApiKeys.d.ts +9 -0
- package/dist/agility/api-keys/generateApiKeys.d.ts.map +1 -0
- package/dist/agility/api-keys/generateApiKeys.js +99 -0
- package/dist/agility/api-keys/generateApiKeys.js.map +1 -0
- package/dist/agility/api-keys/getApiKeys.d.ts +9 -0
- package/dist/agility/api-keys/getApiKeys.d.ts.map +1 -0
- package/dist/agility/api-keys/getApiKeys.js +14 -0
- package/dist/agility/api-keys/getApiKeys.js.map +1 -0
- package/dist/agility/index.d.ts +3 -0
- package/dist/agility/index.d.ts.map +1 -0
- package/dist/agility/index.js +8 -0
- package/dist/agility/index.js.map +1 -0
- package/dist/agility/instance/createNewInstance.d.ts +8 -0
- package/dist/agility/instance/createNewInstance.d.ts.map +1 -0
- package/dist/agility/instance/createNewInstance.js +65 -0
- package/dist/agility/instance/createNewInstance.js.map +1 -0
- package/dist/agility/instance/getAvailableInstances.d.ts +8 -0
- package/dist/agility/instance/getAvailableInstances.d.ts.map +1 -0
- package/dist/agility/instance/getAvailableInstances.js +43 -0
- package/dist/agility/instance/getAvailableInstances.js.map +1 -0
- package/dist/agility/instance/manageInstance.d.ts +9 -0
- package/dist/agility/instance/manageInstance.d.ts.map +1 -0
- package/dist/agility/instance/manageInstance.js +82 -0
- package/dist/agility/instance/manageInstance.js.map +1 -0
- package/dist/agility/utils/getMgmtAPIUrl.d.ts +20 -0
- package/dist/agility/utils/getMgmtAPIUrl.d.ts.map +1 -0
- package/dist/agility/utils/getMgmtAPIUrl.js +61 -0
- package/dist/agility/utils/getMgmtAPIUrl.js.map +1 -0
- package/dist/auth/api-key/authenticateWithApiKey.d.ts +6 -0
- package/dist/auth/api-key/authenticateWithApiKey.d.ts.map +1 -0
- package/dist/auth/api-key/authenticateWithApiKey.js +28 -0
- package/dist/auth/api-key/authenticateWithApiKey.js.map +1 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +8 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/oauth/authenticate.d.ts +6 -0
- package/dist/auth/oauth/authenticate.d.ts.map +1 -0
- package/dist/auth/oauth/authenticate.js +162 -0
- package/dist/auth/oauth/authenticate.js.map +1 -0
- package/dist/auth/oauth/constants.d.ts +5 -0
- package/dist/auth/oauth/constants.d.ts.map +1 -0
- package/dist/auth/oauth/constants.js +9 -0
- package/dist/auth/oauth/constants.js.map +1 -0
- package/dist/auth/oauth/exchangeCodeForToken.d.ts +7 -0
- package/dist/auth/oauth/exchangeCodeForToken.d.ts.map +1 -0
- package/dist/auth/oauth/exchangeCodeForToken.js +39 -0
- package/dist/auth/oauth/exchangeCodeForToken.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +290 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/promptForMissingOptions.d.ts +8 -0
- package/dist/cli/promptForMissingOptions.d.ts.map +1 -0
- package/dist/cli/promptForMissingOptions.js +92 -0
- package/dist/cli/promptForMissingOptions.js.map +1 -0
- package/dist/config/env/createEnvFile.d.ts +6 -0
- package/dist/config/env/createEnvFile.d.ts.map +1 -0
- package/dist/config/env/createEnvFile.js +31 -0
- package/dist/config/env/createEnvFile.js.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/mcp/createMcpConfig.d.ts +5 -0
- package/dist/config/mcp/createMcpConfig.d.ts.map +1 -0
- package/dist/config/mcp/createMcpConfig.js +32 -0
- package/dist/config/mcp/createMcpConfig.js.map +1 -0
- package/dist/config/packages/installAgilityPackages.d.ts +6 -0
- package/dist/config/packages/installAgilityPackages.d.ts.map +1 -0
- package/dist/config/packages/installAgilityPackages.js +61 -0
- package/dist/config/packages/installAgilityPackages.js.map +1 -0
- package/dist/config/setupProject.d.ts +8 -0
- package/dist/config/setupProject.d.ts.map +1 -0
- package/dist/config/setupProject.js +32 -0
- package/dist/config/setupProject.js.map +1 -0
- package/dist/create-next-app/createNextApp.d.ts +9 -0
- package/dist/create-next-app/createNextApp.d.ts.map +1 -0
- package/dist/create-next-app/createNextApp.js +83 -0
- package/dist/create-next-app/createNextApp.js.map +1 -0
- package/dist/create-next-app/index.d.ts +3 -0
- package/dist/create-next-app/index.d.ts.map +1 -0
- package/dist/create-next-app/index.js +8 -0
- package/dist/create-next-app/index.js.map +1 -0
- package/dist/scaffold/components/createPageComponents.d.ts +6 -0
- package/dist/scaffold/components/createPageComponents.d.ts.map +1 -0
- package/dist/scaffold/components/createPageComponents.js +62 -0
- package/dist/scaffold/components/createPageComponents.js.map +1 -0
- package/dist/scaffold/containers/createContainers.d.ts +6 -0
- package/dist/scaffold/containers/createContainers.d.ts.map +1 -0
- package/dist/scaffold/containers/createContainers.js +48 -0
- package/dist/scaffold/containers/createContainers.js.map +1 -0
- package/dist/scaffold/index.d.ts +2 -0
- package/dist/scaffold/index.d.ts.map +1 -0
- package/dist/scaffold/index.js +6 -0
- package/dist/scaffold/index.js.map +1 -0
- package/dist/scaffold/instance/createBlankInstance.d.ts +8 -0
- package/dist/scaffold/instance/createBlankInstance.d.ts.map +1 -0
- package/dist/scaffold/instance/createBlankInstance.js +51 -0
- package/dist/scaffold/instance/createBlankInstance.js.map +1 -0
- package/dist/scaffold/models/createContentModels.d.ts +6 -0
- package/dist/scaffold/models/createContentModels.d.ts.map +1 -0
- package/dist/scaffold/models/createContentModels.js +70 -0
- package/dist/scaffold/models/createContentModels.js.map +1 -0
- package/dist/templates/copyDirectory.d.ts +5 -0
- package/dist/templates/copyDirectory.d.ts.map +1 -0
- package/dist/templates/copyDirectory.js +28 -0
- package/dist/templates/copyDirectory.js.map +1 -0
- package/dist/templates/copyTemplates.d.ts +8 -0
- package/dist/templates/copyTemplates.d.ts.map +1 -0
- package/dist/templates/copyTemplates.js +58 -0
- package/dist/templates/copyTemplates.js.map +1 -0
- package/dist/templates/index.d.ts +2 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +6 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/types/index.d.ts +50 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/git.d.ts +9 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +71 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/validation.d.ts +45 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +180 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +45 -0
- package/src/agility/api-keys/generateApiKeys.ts +100 -0
- package/src/agility/api-keys/getApiKeys.ts +13 -0
- package/src/agility/index.ts +3 -0
- package/src/agility/instance/createNewInstance.ts +67 -0
- package/src/agility/instance/getAvailableInstances.ts +49 -0
- package/src/agility/instance/manageInstance.ts +90 -0
- package/src/agility/utils/getMgmtAPIUrl.ts +68 -0
- package/src/auth/api-key/authenticateWithApiKey.ts +24 -0
- package/src/auth/index.ts +3 -0
- package/src/auth/oauth/authenticate.ts +165 -0
- package/src/auth/oauth/constants.ts +6 -0
- package/src/auth/oauth/exchangeCodeForToken.ts +43 -0
- package/src/cli/index.ts +281 -0
- package/src/cli/promptForMissingOptions.ts +104 -0
- package/src/config/env/createEnvFile.ts +30 -0
- package/src/config/index.ts +2 -0
- package/src/config/mcp/createMcpConfig.ts +30 -0
- package/src/config/packages/installAgilityPackages.ts +63 -0
- package/src/config/setupProject.ts +31 -0
- package/src/create-next-app/createNextApp.ts +75 -0
- package/src/create-next-app/index.ts +3 -0
- package/src/scaffold/components/createPageComponents.ts +74 -0
- package/src/scaffold/containers/createContainers.ts +55 -0
- package/src/scaffold/index.ts +2 -0
- package/src/scaffold/instance/createBlankInstance.ts +55 -0
- package/src/scaffold/models/createContentModels.ts +83 -0
- package/src/templates/copyDirectory.ts +24 -0
- package/src/templates/copyTemplates.ts +57 -0
- package/src/templates/index.ts +2 -0
- package/src/types/index.ts +55 -0
- package/src/utils/git.ts +74 -0
- package/src/utils/validation.ts +184 -0
- package/templates/.claude/QUICK-START.md +230 -0
- package/templates/.claude/README.md +32 -0
- package/templates/.claude/settings.json +8 -0
- package/templates/BLANK-INSTANCE-SETUP.md +375 -0
- package/templates/DEVELOPMENT.md +160 -0
- package/templates/EXAMPLE-PROMPTS.md +643 -0
- package/templates/PROMPTS.md +410 -0
- package/templates/README.md +281 -0
- package/templates/agents.md +429 -0
- package/templates/app/[locale]/[...slug]/error.tsx +17 -0
- package/templates/app/[locale]/[...slug]/not-found.tsx +9 -0
- package/templates/app/[locale]/[...slug]/page.tsx +102 -0
- package/templates/app/[locale]/layout.tsx +22 -0
- package/templates/app/[locale]/page.tsx +12 -0
- package/templates/app/api/dynamic-redirect/route.ts +24 -0
- package/templates/app/api/preview/exit/route.ts +34 -0
- package/templates/app/api/preview/route.ts +63 -0
- package/templates/app/api/revalidate/route.ts +118 -0
- package/templates/components/agility-components/RichTextArea.tsx +66 -0
- package/templates/components/agility-components/index.ts +30 -0
- package/templates/components/agility-pages/MainTemplate.tsx +36 -0
- package/templates/components/agility-pages/index.ts +11 -0
- package/templates/docs/01-agility-cms-overview.md +139 -0
- package/templates/docs/02-page-routing.md +251 -0
- package/templates/docs/03-creating-components.md +462 -0
- package/templates/docs/04-data-fetching.md +484 -0
- package/templates/docs/05-containers-and-lists.md +596 -0
- package/templates/docs/06-localization.md +561 -0
- package/templates/docs/07-caching-strategies.md +410 -0
- package/templates/docs/08-common-components.md +756 -0
- package/templates/docs/09-whats-included.md +279 -0
- package/templates/docs/10-mcp-server-setup.md +153 -0
- package/templates/docs/11-linked-nested-content.md +611 -0
- package/templates/docs/README.md +164 -0
- package/templates/lib/cms/getAgilityContext.ts +28 -0
- package/templates/lib/cms/getAgilityPage.ts +51 -0
- package/templates/lib/cms/getAgilitySDK.ts +22 -0
- package/templates/lib/cms/getContentItem.ts +20 -0
- package/templates/lib/cms/getContentList.ts +19 -0
- package/templates/lib/cms/getRedirections.ts +85 -0
- package/templates/lib/cms/getSitemapFlat.ts +19 -0
- package/templates/lib/cms/getSitemapNested.ts +19 -0
- package/templates/lib/env.ts +99 -0
- package/templates/lib/i18n/config.ts +28 -0
- package/templates/proxy.ts +101 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(git log:*)",
|
|
5
|
+
"Bash(npm run build:*)",
|
|
6
|
+
"Bash(git clone:*)",
|
|
7
|
+
"Bash(npm view:*)",
|
|
8
|
+
"Bash(git mv:*)",
|
|
9
|
+
"Bash(grep:*)",
|
|
10
|
+
"Bash(tree:*)",
|
|
11
|
+
"Bash(git add:*)",
|
|
12
|
+
"Bash(npm install:*)",
|
|
13
|
+
"Bash(mkdir:*)",
|
|
14
|
+
"Bash(node -e:*)",
|
|
15
|
+
"Bash(ls:*)",
|
|
16
|
+
"Bash(comm -12:*)",
|
|
17
|
+
"Bash(for module in agility auth config templates)",
|
|
18
|
+
"Bash(do echo \"=== $module ===\" echo \"Barrel file exports:\" grep -E \"^\\(export|exports\\\\.\\)\" dist/$module.js)",
|
|
19
|
+
"Bash(done)"
|
|
20
|
+
],
|
|
21
|
+
"deny": [],
|
|
22
|
+
"ask": []
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
# Feature Roadmap
|
|
2
|
+
|
|
3
|
+
This document tracks planned enhancements for `create-next-agility-app`.
|
|
4
|
+
|
|
5
|
+
## ✅ Completed (v1.0)
|
|
6
|
+
|
|
7
|
+
- [x] Project name validation & directory checks
|
|
8
|
+
- [x] Git initialization after project creation
|
|
9
|
+
- [x] Enhanced error handling with recovery suggestions
|
|
10
|
+
- [x] Success summary box with next steps
|
|
11
|
+
- [x] Update notifier for CLI versions
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 📋 Should Have (v1.1)
|
|
16
|
+
|
|
17
|
+
### 1. Template Selection
|
|
18
|
+
**Priority:** High
|
|
19
|
+
**Labels:** enhancement, good first issue
|
|
20
|
+
|
|
21
|
+
Add the ability to choose from multiple starter templates during project creation.
|
|
22
|
+
|
|
23
|
+
**Proposed Templates:**
|
|
24
|
+
- **Basic** - Minimal setup (current default)
|
|
25
|
+
- **Blog** - Pre-configured with posts, categories, pagination
|
|
26
|
+
- **Marketing** - Hero sections, forms, CTAs
|
|
27
|
+
- **E-commerce** - Products, cart, checkout
|
|
28
|
+
|
|
29
|
+
**Implementation:**
|
|
30
|
+
```typescript
|
|
31
|
+
{
|
|
32
|
+
type: 'list',
|
|
33
|
+
name: 'template',
|
|
34
|
+
message: 'Choose a starter template:',
|
|
35
|
+
choices: [
|
|
36
|
+
{ name: 'Basic (minimal setup)', value: 'basic' },
|
|
37
|
+
{ name: 'Blog (posts, categories, authors)', value: 'blog' },
|
|
38
|
+
{ name: 'Marketing (landing pages, forms, CTAs)', value: 'marketing' },
|
|
39
|
+
{ name: 'E-commerce (products, cart, checkout)', value: 'ecommerce' }
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### 2. Better Progress Indicators
|
|
47
|
+
**Priority:** Medium
|
|
48
|
+
**Labels:** enhancement, good first issue
|
|
49
|
+
|
|
50
|
+
Improve visual feedback with ora spinners for all long-running operations.
|
|
51
|
+
|
|
52
|
+
**Operations to enhance:**
|
|
53
|
+
- Creating Next.js base project
|
|
54
|
+
- Installing Agility packages
|
|
55
|
+
- Copying template files
|
|
56
|
+
- Configuring environment
|
|
57
|
+
- OAuth authentication flow
|
|
58
|
+
- Fetching available instances
|
|
59
|
+
|
|
60
|
+
**Example:**
|
|
61
|
+
```typescript
|
|
62
|
+
const spinner = ora('Creating Next.js project...').start();
|
|
63
|
+
try {
|
|
64
|
+
await createNextApp(projectName, options);
|
|
65
|
+
spinner.succeed('Next.js project created');
|
|
66
|
+
} catch (error) {
|
|
67
|
+
spinner.fail('Failed to create Next.js project');
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### 3. Post-Install Verification
|
|
75
|
+
**Priority:** Medium
|
|
76
|
+
**Labels:** enhancement
|
|
77
|
+
|
|
78
|
+
Add verification checks after project creation to ensure everything is set up correctly.
|
|
79
|
+
|
|
80
|
+
**Proposed Checks:**
|
|
81
|
+
1. File structure validation
|
|
82
|
+
2. Environment configuration
|
|
83
|
+
3. Dependencies check
|
|
84
|
+
4. Optional build verification (`--verify-build`)
|
|
85
|
+
|
|
86
|
+
**Output:**
|
|
87
|
+
```
|
|
88
|
+
✓ Verifying project setup...
|
|
89
|
+
✓ File structure
|
|
90
|
+
✓ Environment configuration
|
|
91
|
+
✓ Dependencies
|
|
92
|
+
⚠ Build check skipped (use --verify-build)
|
|
93
|
+
|
|
94
|
+
All checks passed! Your project is ready.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### 4. VS Code Workspace Settings
|
|
100
|
+
**Priority:** Medium
|
|
101
|
+
**Labels:** enhancement, good first issue
|
|
102
|
+
|
|
103
|
+
Include `.vscode/` folder with recommended extensions and settings.
|
|
104
|
+
|
|
105
|
+
**Files:**
|
|
106
|
+
- `extensions.json` - Recommended extensions (ESLint, Prettier, Tailwind, Claude Code, etc.)
|
|
107
|
+
- `settings.json` - Workspace settings (format on save, etc.)
|
|
108
|
+
- `launch.json` - Debug configurations
|
|
109
|
+
|
|
110
|
+
**Benefits:**
|
|
111
|
+
- Better DX out of the box
|
|
112
|
+
- Consistent formatting
|
|
113
|
+
- AI tools work better
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### 5. --yes Flag for CI/CD
|
|
118
|
+
**Priority:** High
|
|
119
|
+
**Labels:** enhancement
|
|
120
|
+
|
|
121
|
+
Add a `--yes` (or `-y`) flag to skip all prompts for CI/CD use.
|
|
122
|
+
|
|
123
|
+
**Usage:**
|
|
124
|
+
```bash
|
|
125
|
+
npx create-next-agility-app my-app --yes
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Behavior:**
|
|
129
|
+
- Use all default options
|
|
130
|
+
- Skip Agility CMS connection
|
|
131
|
+
- No interactive prompts
|
|
132
|
+
- Perfect for CI/CD pipelines
|
|
133
|
+
|
|
134
|
+
**Use Cases:**
|
|
135
|
+
- Automated testing
|
|
136
|
+
- CI/CD pipelines
|
|
137
|
+
- Scripts & automation
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## 🎨 Nice to Have (v1.2+)
|
|
142
|
+
|
|
143
|
+
### 6. Example Content Seeding
|
|
144
|
+
**Priority:** Low
|
|
145
|
+
**Labels:** enhancement, nice-to-have
|
|
146
|
+
|
|
147
|
+
Option to seed Agility CMS instance with example content.
|
|
148
|
+
|
|
149
|
+
**Flow:**
|
|
150
|
+
```typescript
|
|
151
|
+
{
|
|
152
|
+
type: 'confirm',
|
|
153
|
+
name: 'seedContent',
|
|
154
|
+
message: 'Would you like to add example content to your Agility instance?',
|
|
155
|
+
default: true
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Content:**
|
|
160
|
+
- Sample pages (Home, About, Contact, Blog)
|
|
161
|
+
- Sample blog posts with categories
|
|
162
|
+
- Sample testimonials/team members
|
|
163
|
+
- Navigation structure
|
|
164
|
+
|
|
165
|
+
**Benefits:**
|
|
166
|
+
- Instant preview of working site
|
|
167
|
+
- Learn from examples
|
|
168
|
+
- Faster time-to-value
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
### 7. Monorepo Support (Turborepo)
|
|
173
|
+
**Priority:** Low
|
|
174
|
+
**Labels:** enhancement, nice-to-have, advanced
|
|
175
|
+
|
|
176
|
+
Add option to create project as a monorepo using Turborepo.
|
|
177
|
+
|
|
178
|
+
**Structure:**
|
|
179
|
+
```
|
|
180
|
+
my-workspace/
|
|
181
|
+
├── apps/
|
|
182
|
+
│ └── web/ # Next.js + Agility CMS
|
|
183
|
+
├── packages/
|
|
184
|
+
│ ├── ui/ # Shared components
|
|
185
|
+
│ ├── agility-config/ # Shared Agility config
|
|
186
|
+
│ └── typescript-config/ # Shared TS config
|
|
187
|
+
├── turbo.json
|
|
188
|
+
└── package.json
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Use Cases:**
|
|
192
|
+
- Multi-app projects
|
|
193
|
+
- Shared component libraries
|
|
194
|
+
- Multiple brands, same CMS
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### 8. 'doctor' Command
|
|
199
|
+
**Priority:** Low
|
|
200
|
+
**Labels:** enhancement, nice-to-have
|
|
201
|
+
|
|
202
|
+
Add health check command for existing projects.
|
|
203
|
+
|
|
204
|
+
**Usage:**
|
|
205
|
+
```bash
|
|
206
|
+
npx create-next-agility-app doctor
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Checks:**
|
|
210
|
+
- Environment variables validation
|
|
211
|
+
- API key validation
|
|
212
|
+
- File structure integrity
|
|
213
|
+
- Dependencies status
|
|
214
|
+
- Build health
|
|
215
|
+
- Agility CMS connection
|
|
216
|
+
|
|
217
|
+
**Output:**
|
|
218
|
+
```
|
|
219
|
+
🔍 Running diagnostics...
|
|
220
|
+
|
|
221
|
+
Environment Configuration
|
|
222
|
+
✓ .env.local exists
|
|
223
|
+
✓ Required variables set
|
|
224
|
+
|
|
225
|
+
Agility CMS Connection
|
|
226
|
+
✓ Successfully connected
|
|
227
|
+
✓ Instance: my-instance (prod-123)
|
|
228
|
+
|
|
229
|
+
Summary: 12 checks passed, 3 warnings, 0 errors
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
### 9. CI/CD Templates
|
|
235
|
+
**Priority:** Low
|
|
236
|
+
**Labels:** enhancement, nice-to-have, devops
|
|
237
|
+
|
|
238
|
+
Include CI/CD workflow templates in generated projects.
|
|
239
|
+
|
|
240
|
+
**Files:**
|
|
241
|
+
- `.github/workflows/ci.yml` - Run tests on PR
|
|
242
|
+
- `.github/workflows/deploy.yml` - Deploy to production
|
|
243
|
+
- `vercel.json` - Vercel configuration
|
|
244
|
+
|
|
245
|
+
**Platforms:**
|
|
246
|
+
- GitHub Actions
|
|
247
|
+
- Vercel
|
|
248
|
+
- Future: Netlify, AWS Amplify, Cloudflare Pages
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
### 10. --dry-run Mode
|
|
253
|
+
**Priority:** Low
|
|
254
|
+
**Labels:** enhancement, nice-to-have
|
|
255
|
+
|
|
256
|
+
Show what would be created without actually creating anything.
|
|
257
|
+
|
|
258
|
+
**Usage:**
|
|
259
|
+
```bash
|
|
260
|
+
npx create-next-agility-app my-app --dry-run
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Output:**
|
|
264
|
+
```
|
|
265
|
+
🔍 Dry run mode - no files will be created
|
|
266
|
+
|
|
267
|
+
Project Configuration:
|
|
268
|
+
Name: my-app
|
|
269
|
+
TypeScript: Yes
|
|
270
|
+
Tailwind CSS: Yes
|
|
271
|
+
...
|
|
272
|
+
|
|
273
|
+
Would create:
|
|
274
|
+
my-app/
|
|
275
|
+
├── .env.local
|
|
276
|
+
├── app/
|
|
277
|
+
└── ...
|
|
278
|
+
|
|
279
|
+
Estimated size: ~350 MB
|
|
280
|
+
Estimated time: 2-3 minutes
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
### 11. --verbose Flag
|
|
286
|
+
**Priority:** Low
|
|
287
|
+
**Labels:** enhancement, nice-to-have
|
|
288
|
+
|
|
289
|
+
Detailed logging of every operation.
|
|
290
|
+
|
|
291
|
+
**Usage:**
|
|
292
|
+
```bash
|
|
293
|
+
npx create-next-agility-app my-app --verbose
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
**Output:**
|
|
297
|
+
```
|
|
298
|
+
[DEBUG] Validating Node.js version: v20.11.0 ✓
|
|
299
|
+
[DEBUG] Checking if directory exists...
|
|
300
|
+
[INFO] Starting Agility CMS authentication...
|
|
301
|
+
[DEBUG] Opening browser for OAuth flow...
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Benefits:**
|
|
305
|
+
- Easier debugging
|
|
306
|
+
- Better issue reports
|
|
307
|
+
- Educational for developers
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 📊 Priority Summary
|
|
312
|
+
|
|
313
|
+
### Must Have (v1.0) - ✅ COMPLETED
|
|
314
|
+
All 5 features implemented and working.
|
|
315
|
+
|
|
316
|
+
### Should Have (v1.1)
|
|
317
|
+
1. ⭐ Template selection
|
|
318
|
+
2. ⭐ --yes flag (CI/CD critical)
|
|
319
|
+
3. Better progress indicators
|
|
320
|
+
4. Post-install verification
|
|
321
|
+
5. VS Code settings
|
|
322
|
+
|
|
323
|
+
### Nice to Have (v1.2+)
|
|
324
|
+
- Example content seeding
|
|
325
|
+
- Monorepo support
|
|
326
|
+
- `doctor` command
|
|
327
|
+
- CI/CD templates
|
|
328
|
+
- --dry-run mode
|
|
329
|
+
- --verbose flag
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## 🤝 Contributing
|
|
334
|
+
|
|
335
|
+
Want to work on any of these features? Check the labels:
|
|
336
|
+
- `good first issue` - Great for new contributors
|
|
337
|
+
- `enhancement` - New feature
|
|
338
|
+
- `nice-to-have` - Lower priority
|
|
339
|
+
- `advanced` - Requires deeper knowledge
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
**Last Updated:** 2026-01-06
|
package/README.md
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# @agility/create-next-app
|
|
2
|
+
|
|
3
|
+
> **⚠️ Beta**: This project is currently in beta. Features and APIs may change.
|
|
4
|
+
|
|
5
|
+
Create a new Next.js project with Agility CMS integration for routing and page management.
|
|
6
|
+
|
|
7
|
+
**✨ Built for AI-assisted development** - Includes comprehensive documentation optimized for Claude Code, Cursor, GitHub Copilot, and all AI coding tools.
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
You need an **Agility CMS instance** to use the generated project. Most users will already have an existing instance with content.
|
|
12
|
+
|
|
13
|
+
- **Have an existing instance?** You're ready to go! The CLI can connect to your instance during setup.
|
|
14
|
+
- **Need a blank instance?** Contact **support@agilitycms.com** to request one.
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx @agility/create-next-app my-app
|
|
20
|
+
cd my-app
|
|
21
|
+
npm run dev
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
That's it! The CLI will guide you through connecting to your Agility CMS instance.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
### Basic Usage
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx @agility/create-next-app my-app
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This will:
|
|
35
|
+
1. Create a new Next.js project with your specified options
|
|
36
|
+
2. Prompt you: "Do you want to connect to an Agility CMS instance to pull settings?"
|
|
37
|
+
- If **Yes**: Opens browser for OAuth authentication, then prompts you to select an instance
|
|
38
|
+
- If **No**: Skips connection (you can configure manually later)
|
|
39
|
+
3. Configure the project with Agility CMS integration
|
|
40
|
+
4. Copy template files for Agility CMS integration
|
|
41
|
+
5. Install Agility packages (`@agility/nextjs` and `@agility/content-fetch`)
|
|
42
|
+
|
|
43
|
+
### Options
|
|
44
|
+
|
|
45
|
+
All standard `create-next-app` options are supported:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Create a TypeScript project with Tailwind CSS
|
|
49
|
+
npx @agility/create-next-app my-app --typescript --tailwind
|
|
50
|
+
|
|
51
|
+
# Create a JavaScript project with App Router
|
|
52
|
+
npx @agility/create-next-app my-app --javascript --app
|
|
53
|
+
|
|
54
|
+
# Create a project and skip package installation
|
|
55
|
+
npx @agility/create-next-app my-app --skip-install
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### Available Flags
|
|
59
|
+
|
|
60
|
+
- `--typescript, --ts` - Initialize as a TypeScript project
|
|
61
|
+
- `--javascript, --js` - Initialize as a JavaScript project
|
|
62
|
+
- `--tailwind` - Initialize with Tailwind CSS
|
|
63
|
+
- `--no-tailwind` - Initialize without Tailwind CSS
|
|
64
|
+
- `--eslint` - Initialize with ESLint
|
|
65
|
+
- `--no-eslint` - Initialize without ESLint
|
|
66
|
+
- `--app` - Initialize with App Router
|
|
67
|
+
- `--src-dir` - Initialize with src/ directory
|
|
68
|
+
- `--import-alias <alias>` - Specify import alias (default: @/*)
|
|
69
|
+
- `--use-npm` - Use npm as package manager
|
|
70
|
+
- `--use-pnpm` - Use pnpm as package manager
|
|
71
|
+
- `--use-yarn` - Use yarn as package manager
|
|
72
|
+
- `--use-bun` - Use bun as package manager
|
|
73
|
+
- `--skip-install` - Skip package installation
|
|
74
|
+
|
|
75
|
+
## What You Get
|
|
76
|
+
|
|
77
|
+
The generated project includes:
|
|
78
|
+
|
|
79
|
+
### Project Structure
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
my-app/
|
|
83
|
+
├── src/
|
|
84
|
+
│ ├── app/
|
|
85
|
+
│ │ ├── api/ # API routes for Agility CMS
|
|
86
|
+
│ │ │ ├── preview/ # Preview mode endpoints
|
|
87
|
+
│ │ │ ├── revalidate/ # Webhook for cache revalidation
|
|
88
|
+
│ │ │ └── dynamic-redirect/ # Dynamic page redirects
|
|
89
|
+
│ │ └── [locale]/[...slug]/ # Dynamic page routing
|
|
90
|
+
│ ├── components/
|
|
91
|
+
│ │ ├── agility-components/ # Your CMS components go here
|
|
92
|
+
│ │ └── agility-pages/ # Page templates
|
|
93
|
+
│ └── lib/cms/ # CMS helper functions
|
|
94
|
+
├── .env.local # Your Agility credentials
|
|
95
|
+
└── package.json
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Features
|
|
99
|
+
|
|
100
|
+
- **Next.js 15** with App Router and Server Components
|
|
101
|
+
- **Agility CMS Integration** with type-safe helpers
|
|
102
|
+
- **Multi-locale Support** built-in internationalization
|
|
103
|
+
- **Preview Mode** for viewing draft content
|
|
104
|
+
- **Cache Revalidation** via webhooks
|
|
105
|
+
- **AI-Friendly Documentation** for Claude Code, Cursor, Copilot
|
|
106
|
+
|
|
107
|
+
### Environment Variables
|
|
108
|
+
|
|
109
|
+
The `.env.local` file is created with:
|
|
110
|
+
|
|
111
|
+
```env
|
|
112
|
+
AGILITY_GUID=your-instance-guid
|
|
113
|
+
AGILITY_API_FETCH_KEY=your-fetch-api-key
|
|
114
|
+
AGILITY_API_PREVIEW_KEY=your-preview-api-key
|
|
115
|
+
AGILITY_SECURITY_KEY=your-security-key
|
|
116
|
+
AGILITY_LOCALES=en-us
|
|
117
|
+
AGILITY_SITEMAP=website
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### API Routes
|
|
121
|
+
|
|
122
|
+
- **`/api/preview`** - Enables preview/draft mode
|
|
123
|
+
- **`/api/preview/exit`** - Exits preview mode
|
|
124
|
+
- **`/api/revalidate`** - Webhook for cache revalidation (configure in Agility CMS: Settings > Webhooks)
|
|
125
|
+
- **`/api/dynamic-redirect`** - Redirects dynamic pages by ContentID
|
|
126
|
+
|
|
127
|
+
## After Project Creation
|
|
128
|
+
|
|
129
|
+
1. **Start developing:**
|
|
130
|
+
```bash
|
|
131
|
+
cd my-app
|
|
132
|
+
npm run dev
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
2. **Configure Agility CMS** (if you skipped during setup):
|
|
136
|
+
- Get your instance GUID from Agility CMS
|
|
137
|
+
- Generate API keys: Settings > API Keys
|
|
138
|
+
- Add credentials to `.env.local`
|
|
139
|
+
|
|
140
|
+
3. **Build with AI assistance:**
|
|
141
|
+
The generated project includes documentation optimized for AI coding tools. Try prompts like:
|
|
142
|
+
- "Add a blog listing component with pagination"
|
|
143
|
+
- "Create a hero section with background image"
|
|
144
|
+
- "Add a contact form with validation"
|
|
145
|
+
|
|
146
|
+
4. **Set up webhooks** for cache revalidation:
|
|
147
|
+
- Agility CMS > Settings > Webhooks
|
|
148
|
+
- Add webhook pointing to `https://yourdomain.com/api/revalidate`
|
|
149
|
+
|
|
150
|
+
## Troubleshooting
|
|
151
|
+
|
|
152
|
+
### Authentication Issues
|
|
153
|
+
If OAuth authentication fails, choose "No" when prompted and manually configure `.env.local` with your Agility credentials.
|
|
154
|
+
|
|
155
|
+
### Package Installation Fails
|
|
156
|
+
Use `--skip-install` and install manually. Ensure Node.js >= 18.0.0.
|
|
157
|
+
|
|
158
|
+
### Missing Environment Variables
|
|
159
|
+
Check that `.env.local` exists and contains all required `AGILITY_*` variables.
|
|
160
|
+
|
|
161
|
+
## Support
|
|
162
|
+
|
|
163
|
+
- [Agility CMS Documentation](https://agilitycms.com/docs)
|
|
164
|
+
- [Next.js Documentation](https://nextjs.org/docs)
|
|
165
|
+
- [GitHub Issues](https://github.com/agility/create-next-agility-app/issues)
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Contributing / Development
|
|
170
|
+
|
|
171
|
+
The following sections are for contributors to this CLI tool, not for users of the generated projects.
|
|
172
|
+
|
|
173
|
+
### Local Development
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
git clone https://github.com/agility/create-next-agility-app.git
|
|
177
|
+
cd create-next-agility-app
|
|
178
|
+
npm install
|
|
179
|
+
npm run build # Compile TypeScript to JavaScript
|
|
180
|
+
npm run dev # Run with tsx (TypeScript execution)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The CLI is written in TypeScript and compiles to JavaScript in the `dist/` directory.
|
|
184
|
+
|
|
185
|
+
### Authentication Flow
|
|
186
|
+
|
|
187
|
+
The CLI uses OAuth 2.0 to authenticate with Agility CMS:
|
|
188
|
+
|
|
189
|
+
1. Opens a browser window for authentication
|
|
190
|
+
2. Uses these endpoints:
|
|
191
|
+
- Authorization URL: `https://mgmt.aglty.io/oauth/authorize`
|
|
192
|
+
- Token URL: `https://mgmt.aglty.io/oauth/token`
|
|
193
|
+
- Redirect URI: `http://localhost:3001/callback`
|
|
194
|
+
|
|
195
|
+
### Publishing
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
npm run build
|
|
199
|
+
npm publish --tag beta --access public # For beta releases
|
|
200
|
+
npm publish --access public # For stable releases
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## License
|
|
204
|
+
|
|
205
|
+
MIT
|
package/TESTING.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Testing Guide
|
|
2
|
+
|
|
3
|
+
## Quick Start
|
|
4
|
+
|
|
5
|
+
### 1. Install Dependencies
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### 2. Build TypeScript (Optional)
|
|
12
|
+
|
|
13
|
+
If you want to test the compiled version:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run build
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### 3. Test Locally
|
|
20
|
+
|
|
21
|
+
You have several options:
|
|
22
|
+
|
|
23
|
+
#### Option A: Use npm link (Recommended)
|
|
24
|
+
|
|
25
|
+
This creates a global symlink so you can use `create-next-agility-app` from anywhere:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# From the project root
|
|
29
|
+
npm link
|
|
30
|
+
|
|
31
|
+
# Now you can test it from any directory
|
|
32
|
+
cd /tmp
|
|
33
|
+
create-next-agility-app test-app --skip-agility-setup
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
#### Option B: Run directly with tsx
|
|
37
|
+
|
|
38
|
+
Run the TypeScript source directly without building:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm run dev my-test-app --skip-agility-setup
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or with tsx directly:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx tsx src/cli.ts my-test-app --skip-agility-setup
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### Option C: Use node with the bin script
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
node bin/create-next-agility-app.js my-test-app --skip-agility-setup
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Testing Scenarios
|
|
57
|
+
|
|
58
|
+
### Test 1: Basic Project Creation (Skip Agility Setup)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
create-next-agility-app test-basic --skip-agility-setup --typescript
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
This will:
|
|
65
|
+
- Create a Next.js project
|
|
66
|
+
- Skip all Agility CMS setup
|
|
67
|
+
- Use TypeScript
|
|
68
|
+
|
|
69
|
+
### Test 2: Full Flow (Without OAuth)
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
create-next-agility-app test-full --no-login
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
This will:
|
|
76
|
+
- Create a Next.js project
|
|
77
|
+
- Skip OAuth authentication
|
|
78
|
+
- Prompt for manual API key entry
|
|
79
|
+
- Set up Agility configuration
|
|
80
|
+
|
|
81
|
+
### Test 3: With Existing Instance GUID
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
create-next-agility-app test-instance --instance-guid your-guid-here --no-login
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Test 4: All Next.js Options
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
create-next-agility-app test-options \
|
|
91
|
+
--typescript \
|
|
92
|
+
--tailwind \
|
|
93
|
+
--eslint \
|
|
94
|
+
--app \
|
|
95
|
+
--src-dir \
|
|
96
|
+
--skip-agility-setup
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Testing OAuth (If Configured)
|
|
100
|
+
|
|
101
|
+
If you have OAuth credentials set up:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
export AGILITY_OAUTH_CLIENT_ID=your-client-id
|
|
105
|
+
export AGILITY_OAUTH_CLIENT_SECRET=your-client-secret
|
|
106
|
+
|
|
107
|
+
create-next-agility-app test-oauth
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Debugging
|
|
111
|
+
|
|
112
|
+
Run with debug output:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
DEBUG=1 create-next-agility-app test-app --skip-agility-setup
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Cleaning Up Test Projects
|
|
119
|
+
|
|
120
|
+
After testing, you can remove test projects:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
rm -rf test-*
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Unlinking (if you used npm link)
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
npm unlink -g create-next-agility-app
|
|
130
|
+
```
|
|
131
|
+
|