@l4yercak3/cli 1.0.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.
- package/.claude/settings.local.json +18 -0
- package/.cursor/rules.md +203 -0
- package/.eslintrc.js +31 -0
- package/README.md +227 -0
- package/bin/cli.js +61 -0
- package/docs/ADDING_NEW_PROJECT_TYPE.md +156 -0
- package/docs/ARCHITECTURE_RELATIONSHIPS.md +411 -0
- package/docs/CLI_AUTHENTICATION.md +214 -0
- package/docs/DETECTOR_ARCHITECTURE.md +326 -0
- package/docs/DEVELOPMENT.md +194 -0
- package/docs/IMPLEMENTATION_PHASES.md +468 -0
- package/docs/OAUTH_CLARIFICATION.md +258 -0
- package/docs/OAUTH_SETUP_GUIDE_TEMPLATE.md +211 -0
- package/docs/PHASE_0_PROGRESS.md +120 -0
- package/docs/PHASE_1_COMPLETE.md +366 -0
- package/docs/PHASE_SUMMARY.md +149 -0
- package/docs/PLAN.md +511 -0
- package/docs/README.md +56 -0
- package/docs/STRIPE_INTEGRATION.md +447 -0
- package/docs/SUMMARY.md +230 -0
- package/docs/UPDATED_PLAN.md +447 -0
- package/package.json +53 -0
- package/src/api/backend-client.js +148 -0
- package/src/commands/login.js +146 -0
- package/src/commands/logout.js +24 -0
- package/src/commands/spread.js +364 -0
- package/src/commands/status.js +62 -0
- package/src/config/config-manager.js +205 -0
- package/src/detectors/api-client-detector.js +85 -0
- package/src/detectors/base-detector.js +77 -0
- package/src/detectors/github-detector.js +74 -0
- package/src/detectors/index.js +80 -0
- package/src/detectors/nextjs-detector.js +139 -0
- package/src/detectors/oauth-detector.js +122 -0
- package/src/detectors/registry.js +97 -0
- package/src/generators/api-client-generator.js +197 -0
- package/src/generators/env-generator.js +162 -0
- package/src/generators/gitignore-generator.js +92 -0
- package/src/generators/index.js +50 -0
- package/src/generators/nextauth-generator.js +242 -0
- package/src/generators/oauth-guide-generator.js +277 -0
- package/src/logo.js +116 -0
- package/tests/api-client-detector.test.js +214 -0
- package/tests/api-client-generator.test.js +169 -0
- package/tests/backend-client.test.js +361 -0
- package/tests/base-detector.test.js +101 -0
- package/tests/commands/login.test.js +98 -0
- package/tests/commands/logout.test.js +70 -0
- package/tests/commands/status.test.js +167 -0
- package/tests/config-manager.test.js +313 -0
- package/tests/detector-index.test.js +209 -0
- package/tests/detector-registry.test.js +93 -0
- package/tests/env-generator.test.js +278 -0
- package/tests/generators-index.test.js +215 -0
- package/tests/github-detector.test.js +145 -0
- package/tests/gitignore-generator.test.js +109 -0
- package/tests/logo.test.js +96 -0
- package/tests/nextauth-generator.test.js +231 -0
- package/tests/nextjs-detector.test.js +235 -0
- package/tests/oauth-detector.test.js +264 -0
- package/tests/oauth-guide-generator.test.js +273 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(npm run lint:*)",
|
|
5
|
+
"Bash(npm test:*)",
|
|
6
|
+
"Bash(npm run verify:*)",
|
|
7
|
+
"Bash(find:*)",
|
|
8
|
+
"Bash(node bin/cli.js:*)",
|
|
9
|
+
"Bash(npm install:*)",
|
|
10
|
+
"Bash(npm run test:coverage:*)",
|
|
11
|
+
"Bash(git init:*)",
|
|
12
|
+
"Bash(git add:*)",
|
|
13
|
+
"Bash(git commit:*)",
|
|
14
|
+
"Bash(gh repo create:*)",
|
|
15
|
+
"Bash(npm whoami:*)"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
package/.cursor/rules.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# L4YERCAK3 CLI Tool - Development Rules
|
|
2
|
+
|
|
3
|
+
This document defines the coding standards, quality checks, and development practices for the L4YERCAK3 CLI tool.
|
|
4
|
+
|
|
5
|
+
## Quality Assurance Checklist
|
|
6
|
+
|
|
7
|
+
Every code change must pass these checks before being considered complete:
|
|
8
|
+
|
|
9
|
+
### 1. Type Checking ✅
|
|
10
|
+
- **Command**: `npm run type-check`
|
|
11
|
+
- **Requirement**: All TypeScript/JavaScript code must pass type checking
|
|
12
|
+
- **Action**: Fix all type errors before committing
|
|
13
|
+
|
|
14
|
+
### 2. Linting ✅
|
|
15
|
+
- **Command**: `npm run lint`
|
|
16
|
+
- **Requirement**: Code must pass ESLint without errors
|
|
17
|
+
- **Action**: Fix all linting errors or disable rules with justification
|
|
18
|
+
|
|
19
|
+
### 3. Production Build ✅
|
|
20
|
+
- **Command**: `npm run build`
|
|
21
|
+
- **Requirement**: Package must build successfully for production
|
|
22
|
+
- **Action**: Ensure all dependencies are properly declared
|
|
23
|
+
|
|
24
|
+
### 4. Testing ✅
|
|
25
|
+
- **Command**: `npm test`
|
|
26
|
+
- **Requirement**: All tests must pass
|
|
27
|
+
- **Action**: Add tests for new features, fix failing tests
|
|
28
|
+
|
|
29
|
+
## Development Workflow
|
|
30
|
+
|
|
31
|
+
### Before Committing
|
|
32
|
+
1. Run `npm run verify` (runs all checks)
|
|
33
|
+
2. Ensure all checks pass
|
|
34
|
+
3. Review changes
|
|
35
|
+
4. Commit with descriptive message
|
|
36
|
+
|
|
37
|
+
### After Major Changes
|
|
38
|
+
1. Run full verification suite
|
|
39
|
+
2. Test CLI locally with `npm link`
|
|
40
|
+
3. Test with example projects
|
|
41
|
+
4. Update documentation if needed
|
|
42
|
+
|
|
43
|
+
## Code Standards
|
|
44
|
+
|
|
45
|
+
### JavaScript/Node.js
|
|
46
|
+
- Use CommonJS (require/module.exports) for compatibility
|
|
47
|
+
- Follow Node.js best practices
|
|
48
|
+
- Use async/await for asynchronous operations
|
|
49
|
+
- Handle errors properly with try/catch
|
|
50
|
+
|
|
51
|
+
### File Structure
|
|
52
|
+
- Keep files modular and focused
|
|
53
|
+
- Use descriptive file names
|
|
54
|
+
- Group related functionality together
|
|
55
|
+
- Document complex logic
|
|
56
|
+
|
|
57
|
+
### Error Handling
|
|
58
|
+
- Always handle errors gracefully
|
|
59
|
+
- Provide helpful error messages
|
|
60
|
+
- Log errors appropriately
|
|
61
|
+
- Don't expose sensitive information
|
|
62
|
+
|
|
63
|
+
### Code Style
|
|
64
|
+
- Use consistent indentation (2 spaces)
|
|
65
|
+
- Use meaningful variable names
|
|
66
|
+
- Keep functions small and focused
|
|
67
|
+
- Add comments for complex logic
|
|
68
|
+
|
|
69
|
+
## Architecture Principles
|
|
70
|
+
|
|
71
|
+
### Modularity
|
|
72
|
+
- Keep commands separate from generators
|
|
73
|
+
- Separate concerns (detection, generation, configuration)
|
|
74
|
+
- Make code reusable across commands
|
|
75
|
+
|
|
76
|
+
### User Experience
|
|
77
|
+
- Provide clear, helpful error messages
|
|
78
|
+
- Show progress indicators for long operations
|
|
79
|
+
- Use colors and formatting for better readability
|
|
80
|
+
- Guide users through setup process
|
|
81
|
+
|
|
82
|
+
### Maintainability
|
|
83
|
+
- Write self-documenting code
|
|
84
|
+
- Add JSDoc comments for public APIs
|
|
85
|
+
- Keep dependencies minimal
|
|
86
|
+
- Update dependencies regularly
|
|
87
|
+
|
|
88
|
+
## Dependencies
|
|
89
|
+
|
|
90
|
+
### Current Dependencies
|
|
91
|
+
- `chalk@^4.1.2` - Terminal colors (v4 for CommonJS compatibility)
|
|
92
|
+
- `figlet@^1.7.0` - ASCII art generation
|
|
93
|
+
|
|
94
|
+
### Adding New Dependencies
|
|
95
|
+
- Prefer lightweight, well-maintained packages
|
|
96
|
+
- Check bundle size impact
|
|
97
|
+
- Ensure CommonJS compatibility
|
|
98
|
+
- Document why dependency is needed
|
|
99
|
+
|
|
100
|
+
## Testing Strategy
|
|
101
|
+
|
|
102
|
+
### Unit Tests
|
|
103
|
+
- Test individual functions
|
|
104
|
+
- Mock external dependencies
|
|
105
|
+
- Test error cases
|
|
106
|
+
- Test edge cases
|
|
107
|
+
|
|
108
|
+
### Integration Tests
|
|
109
|
+
- Test CLI commands end-to-end
|
|
110
|
+
- Test with real project structures
|
|
111
|
+
- Test error scenarios
|
|
112
|
+
- Test with different Node.js versions
|
|
113
|
+
|
|
114
|
+
## Documentation
|
|
115
|
+
|
|
116
|
+
### Code Documentation
|
|
117
|
+
- Add JSDoc comments for all public functions
|
|
118
|
+
- Document complex algorithms
|
|
119
|
+
- Explain non-obvious code
|
|
120
|
+
|
|
121
|
+
### User Documentation
|
|
122
|
+
- Keep README.md up to date
|
|
123
|
+
- Document all commands
|
|
124
|
+
- Provide examples
|
|
125
|
+
- Include troubleshooting section
|
|
126
|
+
|
|
127
|
+
## Version Management
|
|
128
|
+
|
|
129
|
+
### Semantic Versioning
|
|
130
|
+
- `MAJOR.MINOR.PATCH`
|
|
131
|
+
- Major: Breaking changes
|
|
132
|
+
- Minor: New features (backward compatible)
|
|
133
|
+
- Patch: Bug fixes
|
|
134
|
+
|
|
135
|
+
### Before Publishing
|
|
136
|
+
1. Update version in package.json
|
|
137
|
+
2. Update CHANGELOG.md
|
|
138
|
+
3. Run full test suite
|
|
139
|
+
4. Test installation via npm
|
|
140
|
+
|
|
141
|
+
## Security
|
|
142
|
+
|
|
143
|
+
### Sensitive Data
|
|
144
|
+
- Never commit API keys or secrets
|
|
145
|
+
- Use environment variables for configuration
|
|
146
|
+
- Validate user input
|
|
147
|
+
- Sanitize file paths
|
|
148
|
+
|
|
149
|
+
### Dependencies
|
|
150
|
+
- Keep dependencies up to date
|
|
151
|
+
- Check for security vulnerabilities: `npm audit`
|
|
152
|
+
- Review dependency changes
|
|
153
|
+
|
|
154
|
+
## Performance
|
|
155
|
+
|
|
156
|
+
### CLI Performance
|
|
157
|
+
- Minimize startup time
|
|
158
|
+
- Use lazy loading where appropriate
|
|
159
|
+
- Cache expensive operations
|
|
160
|
+
- Optimize file I/O
|
|
161
|
+
|
|
162
|
+
## Compatibility
|
|
163
|
+
|
|
164
|
+
### Node.js Versions
|
|
165
|
+
- Support Node.js 14+ (as specified in package.json)
|
|
166
|
+
- Test on multiple Node.js versions
|
|
167
|
+
- Use features available in minimum version
|
|
168
|
+
|
|
169
|
+
### Operating Systems
|
|
170
|
+
- Test on macOS, Linux, Windows
|
|
171
|
+
- Handle path differences
|
|
172
|
+
- Test file permissions
|
|
173
|
+
|
|
174
|
+
## Git Workflow
|
|
175
|
+
|
|
176
|
+
### Commit Messages
|
|
177
|
+
- Use descriptive commit messages
|
|
178
|
+
- Reference issues when applicable
|
|
179
|
+
- Keep commits focused and atomic
|
|
180
|
+
|
|
181
|
+
### Branching
|
|
182
|
+
- Use feature branches for new features
|
|
183
|
+
- Keep main branch stable
|
|
184
|
+
- Use descriptive branch names
|
|
185
|
+
|
|
186
|
+
## Continuous Improvement
|
|
187
|
+
|
|
188
|
+
### Code Review
|
|
189
|
+
- Review all changes before merging
|
|
190
|
+
- Look for potential bugs
|
|
191
|
+
- Suggest improvements
|
|
192
|
+
- Ensure standards are followed
|
|
193
|
+
|
|
194
|
+
### Refactoring
|
|
195
|
+
- Refactor when code becomes complex
|
|
196
|
+
- Improve based on usage patterns
|
|
197
|
+
- Keep code maintainable
|
|
198
|
+
- Don't refactor working code unnecessarily
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
**Remember**: Quality over speed. Take time to write clean, maintainable code that others (and future you) will appreciate.
|
|
203
|
+
|
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
node: true,
|
|
4
|
+
es2021: true,
|
|
5
|
+
},
|
|
6
|
+
extends: ['eslint:recommended'],
|
|
7
|
+
parserOptions: {
|
|
8
|
+
ecmaVersion: 2021,
|
|
9
|
+
sourceType: 'module',
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
'no-console': 'off', // CLI tools need console output
|
|
13
|
+
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
14
|
+
'no-undef': 'error',
|
|
15
|
+
'prefer-const': 'warn',
|
|
16
|
+
'no-var': 'warn',
|
|
17
|
+
'prefer-arrow-callback': 'warn',
|
|
18
|
+
'arrow-body-style': ['warn', 'as-needed'],
|
|
19
|
+
'object-shorthand': 'warn',
|
|
20
|
+
'prefer-template': 'warn',
|
|
21
|
+
},
|
|
22
|
+
overrides: [
|
|
23
|
+
{
|
|
24
|
+
files: ['tests/**/*.js'],
|
|
25
|
+
env: {
|
|
26
|
+
jest: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# 🍰 Icing on the L4yercak3
|
|
2
|
+
|
|
3
|
+
**The sweet finishing touch for your Layer Cake integration**
|
|
4
|
+
|
|
5
|
+
A beautiful CLI tool for setting up external projects that integrate with the Layer Cake platform.
|
|
6
|
+
|
|
7
|
+
## 🎨 Features
|
|
8
|
+
|
|
9
|
+
- ✨ Beautiful ASCII art logo with 3D font and rainbow gradient
|
|
10
|
+
- 🏗️ Visual building/plumbing metaphor
|
|
11
|
+
- 🎨 Colorful terminal output
|
|
12
|
+
- 🚀 Easy project setup
|
|
13
|
+
|
|
14
|
+
## 📦 Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g @l4yercak3/cli
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or use with npx:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx @l4yercak3/cli
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 🚀 Usage
|
|
27
|
+
|
|
28
|
+
### Quick Start
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Show logo and welcome message
|
|
32
|
+
npx @l4yercak3/cli
|
|
33
|
+
|
|
34
|
+
# Or if installed globally
|
|
35
|
+
l4yercak3
|
|
36
|
+
# or use the alias
|
|
37
|
+
icing
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Commands (Coming Soon)
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Initialize a new project
|
|
44
|
+
npx @l4yercak3/cli spread
|
|
45
|
+
|
|
46
|
+
# Show help
|
|
47
|
+
npx @l4yercak3/cli --help
|
|
48
|
+
|
|
49
|
+
# Show version
|
|
50
|
+
npx @l4yercak3/cli --version
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Bin Commands
|
|
54
|
+
|
|
55
|
+
The package exposes two bin commands (both point to the same CLI):
|
|
56
|
+
- `l4yercak3` - Main command name
|
|
57
|
+
- `icing` - Alias (short for "icing on the l4yercak3")
|
|
58
|
+
|
|
59
|
+
## 🏗️ The Metaphor
|
|
60
|
+
|
|
61
|
+
**l4yercak3 = The Plumbing/Foundation**
|
|
62
|
+
- Database, Auth, Payments, CRM, Workflows
|
|
63
|
+
- Lives in the basement/cellar
|
|
64
|
+
- One platform powering everything
|
|
65
|
+
|
|
66
|
+
**External Projects = The Floors**
|
|
67
|
+
- Landing pages, client portals, mobile apps
|
|
68
|
+
- Each floor built on the same foundation
|
|
69
|
+
- Connect via API layer (plumbing pipes)
|
|
70
|
+
|
|
71
|
+
**icing = The CLI Tool**
|
|
72
|
+
- Automates the connection
|
|
73
|
+
- "Spreads" the integration smoothly
|
|
74
|
+
- The sweet finishing touch!
|
|
75
|
+
|
|
76
|
+
## 🎨 Logo
|
|
77
|
+
|
|
78
|
+
The logo uses:
|
|
79
|
+
- **Font**: 3D-ASCII (from figlet)
|
|
80
|
+
- **Colors**: Rainbow gradient
|
|
81
|
+
- **Style**: Colorful, eye-catching, professional
|
|
82
|
+
|
|
83
|
+
## 📝 Development
|
|
84
|
+
|
|
85
|
+
### Package Location
|
|
86
|
+
The package is located at: `~/Development/l4yercak3-cli`
|
|
87
|
+
|
|
88
|
+
### Package Structure
|
|
89
|
+
```
|
|
90
|
+
l4yercak3-cli/
|
|
91
|
+
├── bin/
|
|
92
|
+
│ └── cli.js # CLI entry point (executable)
|
|
93
|
+
├── src/
|
|
94
|
+
│ └── logo.js # Logo display module (3D-ASCII font, rainbow gradient)
|
|
95
|
+
├── package.json # npm package config
|
|
96
|
+
├── README.md # This file
|
|
97
|
+
└── .gitignore # Git ignore file
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Local Development
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Navigate to package directory
|
|
104
|
+
cd ~/Development/l4yercak3-cli
|
|
105
|
+
|
|
106
|
+
# Install dependencies
|
|
107
|
+
npm install
|
|
108
|
+
|
|
109
|
+
# Run locally
|
|
110
|
+
npm start
|
|
111
|
+
# or
|
|
112
|
+
node bin/cli.js
|
|
113
|
+
|
|
114
|
+
# Test it locally (link globally for testing)
|
|
115
|
+
npm link
|
|
116
|
+
l4yercak3
|
|
117
|
+
# or use the alias
|
|
118
|
+
icing
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Logo Details
|
|
122
|
+
|
|
123
|
+
The logo uses **VERSION 6** from the demo files:
|
|
124
|
+
- **Font**: `3D-ASCII` (from figlet)
|
|
125
|
+
- **Colors**: Rainbow gradient (`#FF1493` → `#FF69B4` → `#FF00FF` → `#9F7AEA` → `#8B5CF6` → `#3B82F6` → `#00BFFF` → `#10B981` → `#F59E0B` → `#EF4444` → `#FF6B6B`)
|
|
126
|
+
- **Style**: Colorful, eye-catching, professional
|
|
127
|
+
- **Metaphor**: Includes building/plumbing visualization below the logo
|
|
128
|
+
|
|
129
|
+
### Publishing to npm
|
|
130
|
+
|
|
131
|
+
When ready to publish:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Navigate to package directory
|
|
135
|
+
cd ~/Development/l4yercak3-cli
|
|
136
|
+
|
|
137
|
+
# Login to npm (if not already logged in)
|
|
138
|
+
npm login
|
|
139
|
+
|
|
140
|
+
# Publish (make sure version is updated in package.json first)
|
|
141
|
+
npm publish --access public
|
|
142
|
+
|
|
143
|
+
# After publishing, users can install with:
|
|
144
|
+
npm install -g @l4yercak3/cli
|
|
145
|
+
|
|
146
|
+
# Or use with npx (no install needed):
|
|
147
|
+
npx @l4yercak3/cli
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Version Management
|
|
151
|
+
|
|
152
|
+
Before publishing, update the version in `package.json`:
|
|
153
|
+
- Patch: `npm version patch` (1.0.0 → 1.0.1)
|
|
154
|
+
- Minor: `npm version minor` (1.0.0 → 1.1.0)
|
|
155
|
+
- Major: `npm version major` (1.0.0 → 2.0.0)
|
|
156
|
+
|
|
157
|
+
### Next Steps / TODO
|
|
158
|
+
|
|
159
|
+
- [ ] Add CLI commands (spread, login, etc.)
|
|
160
|
+
- [ ] Add interactive questionnaire for project setup
|
|
161
|
+
- [ ] Add OAuth credential generation
|
|
162
|
+
- [ ] Add environment file generation
|
|
163
|
+
- [ ] Add API client template generation
|
|
164
|
+
- [ ] Add webhook handler templates
|
|
165
|
+
- [ ] Add Stripe integration setup
|
|
166
|
+
- [ ] Add School/CRM integration setup
|
|
167
|
+
- [ ] Add project templates (landing page, portal, app)
|
|
168
|
+
- [ ] Add help command with examples
|
|
169
|
+
- [ ] Add update checker
|
|
170
|
+
- [ ] Add telemetry (opt-in)
|
|
171
|
+
|
|
172
|
+
### Related Files
|
|
173
|
+
|
|
174
|
+
The logo demo files are located at:
|
|
175
|
+
- `vc83-com/.kiro/npm_l4yercak3_tool/demo-logo-figlet-building.js` - All font variations
|
|
176
|
+
- `vc83-com/.kiro/npm_l4yercak3_tool/demo-logo-plumbing-building.js` - Building metaphor versions
|
|
177
|
+
- `vc83-com/.kiro/npm_l4yercak3_tool/PROJECT_VISION.md` - Full project vision and roadmap
|
|
178
|
+
|
|
179
|
+
## 📄 License
|
|
180
|
+
|
|
181
|
+
MIT
|
|
182
|
+
|
|
183
|
+
## 🔧 Dependencies
|
|
184
|
+
|
|
185
|
+
- **chalk@^4.1.2** - Terminal colors (v4 for CommonJS compatibility)
|
|
186
|
+
- **figlet@^1.7.0** - ASCII art generation
|
|
187
|
+
|
|
188
|
+
**Note**: We use chalk v4 (not v5) because v5 is ESM-only and this package uses CommonJS.
|
|
189
|
+
|
|
190
|
+
## 🐛 Troubleshooting
|
|
191
|
+
|
|
192
|
+
### Command not found after npm link
|
|
193
|
+
|
|
194
|
+
If `l4yercak3` or `icing` commands aren't found after `npm link`:
|
|
195
|
+
1. Check that `bin/cli.js` has executable permissions: `chmod +x bin/cli.js`
|
|
196
|
+
2. Verify npm bin path: `npm bin -g`
|
|
197
|
+
3. Make sure npm bin is in your PATH
|
|
198
|
+
4. Try: `npm unlink` then `npm link` again
|
|
199
|
+
|
|
200
|
+
### Colors not showing
|
|
201
|
+
|
|
202
|
+
If colors don't appear in your terminal:
|
|
203
|
+
- Make sure your terminal supports ANSI colors
|
|
204
|
+
- Try setting `FORCE_COLOR=1` environment variable
|
|
205
|
+
- Check terminal color settings
|
|
206
|
+
|
|
207
|
+
### figlet font not found
|
|
208
|
+
|
|
209
|
+
If you get a font error:
|
|
210
|
+
- Make sure figlet is installed: `npm install figlet`
|
|
211
|
+
- The font `3D-ASCII` should be included with figlet
|
|
212
|
+
- Try listing available fonts: `figlet -l` (if figlet CLI is installed)
|
|
213
|
+
|
|
214
|
+
## 🙏 Credits
|
|
215
|
+
|
|
216
|
+
Built with:
|
|
217
|
+
- [figlet](https://github.com/patorjk/figlet.js) - ASCII art generation
|
|
218
|
+
- [chalk](https://github.com/chalk/chalk) - Terminal colors
|
|
219
|
+
|
|
220
|
+
## 📚 Related Documentation
|
|
221
|
+
|
|
222
|
+
- See `PROJECT_VISION.md` in `vc83-com/.kiro/npm_l4yercak3_tool/` for full project vision
|
|
223
|
+
- See demo files in `vc83-com/.kiro/npm_l4yercak3_tool/` for logo variations
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
**🍰 Icing on the L4yercak3 - Build your floors on our foundation! 🍰**
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CLI Entry Point
|
|
5
|
+
* Icing on the L4yercak3 - The sweet finishing touch for your Layer Cake integration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { Command } = require('commander');
|
|
9
|
+
const { showLogo } = require('../src/logo');
|
|
10
|
+
const chalk = require('chalk');
|
|
11
|
+
|
|
12
|
+
// Import commands
|
|
13
|
+
const loginCommand = require('../src/commands/login');
|
|
14
|
+
const logoutCommand = require('../src/commands/logout');
|
|
15
|
+
const statusCommand = require('../src/commands/status');
|
|
16
|
+
const spreadCommand = require('../src/commands/spread');
|
|
17
|
+
|
|
18
|
+
// Create CLI program
|
|
19
|
+
const program = new Command();
|
|
20
|
+
|
|
21
|
+
program
|
|
22
|
+
.name('l4yercak3')
|
|
23
|
+
.description('Icing on the L4yercak3 - The sweet finishing touch for your Layer Cake integration')
|
|
24
|
+
.version(require('../package.json').version);
|
|
25
|
+
|
|
26
|
+
// Register commands
|
|
27
|
+
program
|
|
28
|
+
.command(loginCommand.command)
|
|
29
|
+
.description(loginCommand.description)
|
|
30
|
+
.action(loginCommand.handler);
|
|
31
|
+
|
|
32
|
+
program
|
|
33
|
+
.command(logoutCommand.command)
|
|
34
|
+
.description(logoutCommand.description)
|
|
35
|
+
.action(logoutCommand.handler);
|
|
36
|
+
|
|
37
|
+
program
|
|
38
|
+
.command('auth')
|
|
39
|
+
.description('Authentication commands')
|
|
40
|
+
.addCommand(
|
|
41
|
+
new Command('status')
|
|
42
|
+
.description(statusCommand.description)
|
|
43
|
+
.action(statusCommand.handler)
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
program
|
|
47
|
+
.command(spreadCommand.command)
|
|
48
|
+
.description(spreadCommand.description)
|
|
49
|
+
.action(spreadCommand.handler);
|
|
50
|
+
|
|
51
|
+
// Show logo and welcome message if no command provided
|
|
52
|
+
if (process.argv.length === 2) {
|
|
53
|
+
console.log(''); // initial spacing
|
|
54
|
+
showLogo(true);
|
|
55
|
+
console.log(chalk.bold.hex('#9F7AEA')(' 🍰 Welcome to Icing on the L4yercak3! 🍰\n'));
|
|
56
|
+
console.log(chalk.gray(' The sweet finishing touch for your Layer Cake integration\n'));
|
|
57
|
+
program.help();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Parse arguments
|
|
61
|
+
program.parse(process.argv);
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Adding a New Project Type
|
|
2
|
+
|
|
3
|
+
Quick guide for adding support for new frameworks (React, Vue, Svelte, etc.)
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### 1. Create Detector File
|
|
8
|
+
|
|
9
|
+
Create `src/detectors/react-detector.js` (example for React):
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
const BaseDetector = require('./base-detector');
|
|
13
|
+
const fs = require('fs');
|
|
14
|
+
const path = require('path');
|
|
15
|
+
|
|
16
|
+
class ReactDetector extends BaseDetector {
|
|
17
|
+
get name() {
|
|
18
|
+
return 'react';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get priority() {
|
|
22
|
+
return 50; // Lower than Next.js (100)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
detect(projectPath = process.cwd()) {
|
|
26
|
+
// Check for React-specific files
|
|
27
|
+
const packageJsonPath = path.join(projectPath, 'package.json');
|
|
28
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
29
|
+
return { detected: false, confidence: 0, metadata: {} };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
34
|
+
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
35
|
+
|
|
36
|
+
const hasReact = !!deps.react;
|
|
37
|
+
const hasTypeScript = !!deps.typescript || fs.existsSync(path.join(projectPath, 'tsconfig.json'));
|
|
38
|
+
|
|
39
|
+
if (!hasReact) {
|
|
40
|
+
return { detected: false, confidence: 0, metadata: {} };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
detected: true,
|
|
45
|
+
confidence: 0.9,
|
|
46
|
+
metadata: {
|
|
47
|
+
version: deps.react,
|
|
48
|
+
hasTypeScript,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
} catch (error) {
|
|
52
|
+
return { detected: false, confidence: 0, metadata: {} };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
getSupportedFeatures() {
|
|
57
|
+
return {
|
|
58
|
+
oauth: 'manual', // No NextAuth, manual setup only
|
|
59
|
+
stripe: true,
|
|
60
|
+
crm: true,
|
|
61
|
+
projects: true,
|
|
62
|
+
invoices: true,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getAvailableGenerators() {
|
|
67
|
+
return [
|
|
68
|
+
'api-client', // Shared generator
|
|
69
|
+
'env', // Shared generator
|
|
70
|
+
// Add React-specific generators here if needed
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = new ReactDetector();
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 2. Register Detector
|
|
79
|
+
|
|
80
|
+
Add to `src/detectors/registry.js`:
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
const nextJsDetector = require('./nextjs-detector');
|
|
84
|
+
const reactDetector = require('./react-detector'); // Add this
|
|
85
|
+
|
|
86
|
+
const detectors = [
|
|
87
|
+
nextJsDetector,
|
|
88
|
+
reactDetector, // Add this
|
|
89
|
+
];
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 3. Test
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
cd /path/to/react/project
|
|
96
|
+
l4yercak3 spread
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
You should see:
|
|
100
|
+
```
|
|
101
|
+
✅ Detected react project
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## What Gets Generated?
|
|
107
|
+
|
|
108
|
+
### Shared Generators (Work for All Frameworks)
|
|
109
|
+
|
|
110
|
+
- **`api-client`** - Generates API client (framework-agnostic)
|
|
111
|
+
- **`env`** - Generates `.env.local.example` (framework-agnostic)
|
|
112
|
+
|
|
113
|
+
### Framework-Specific Generators
|
|
114
|
+
|
|
115
|
+
- **Next.js**: `nextauth` (NextAuth.js setup)
|
|
116
|
+
- **React**: (none yet, but can add `react-auth` generator)
|
|
117
|
+
- **Vue**: (none yet, but can add `vue-auth` generator)
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Feature Support Matrix
|
|
122
|
+
|
|
123
|
+
When implementing `getSupportedFeatures()`, use:
|
|
124
|
+
|
|
125
|
+
- `true` - Full support (e.g., Next.js OAuth with NextAuth.js)
|
|
126
|
+
- `'manual'` - Guide only (e.g., React OAuth setup guide)
|
|
127
|
+
- `false` - Not supported
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Priority Guidelines
|
|
132
|
+
|
|
133
|
+
Set detector priority based on specificity:
|
|
134
|
+
|
|
135
|
+
- **100**: Very specific (Next.js, Nuxt, SvelteKit)
|
|
136
|
+
- **75**: Framework + build tool (Vite + React, Webpack + Vue)
|
|
137
|
+
- **50**: Pure framework (React, Vue, Svelte)
|
|
138
|
+
- **25**: Generic (JavaScript/TypeScript)
|
|
139
|
+
|
|
140
|
+
Higher priority detectors run first. First match with confidence > 0.8 wins.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Example: Adding Vue Support
|
|
145
|
+
|
|
146
|
+
1. Create `src/detectors/vue-detector.js`
|
|
147
|
+
2. Register in `registry.js`
|
|
148
|
+
3. Test with a Vue project
|
|
149
|
+
4. Add Vue-specific generators if needed (e.g., `vue-auth-generator.js`)
|
|
150
|
+
|
|
151
|
+
That's it! The architecture handles the rest automatically.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
**See:** `DETECTOR_ARCHITECTURE.md` for full architecture details
|
|
156
|
+
|