start-it-cli 1.0.1 → 1.0.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/README.md +42 -4
- package/dist/ai/generator.js +222 -0
- package/dist/ai/provider.js +519 -0
- package/dist/ai/types.js +3 -0
- package/dist/cli.js +78 -5
- package/package.json +1 -1
- package/CHECKLIST.md +0 -197
- package/PROJECT_SUMMARY.md +0 -279
package/README.md
CHANGED
|
@@ -5,6 +5,8 @@ A prompt-based CLI tool to scaffold projects for various frameworks and language
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- Interactive prompt-based project setup
|
|
8
|
+
- **AI-Powered project generation** with intelligent code generation
|
|
9
|
+
- Traditional template-based scaffolding
|
|
8
10
|
- Support for multiple frameworks:
|
|
9
11
|
- Go
|
|
10
12
|
- Flutter
|
|
@@ -14,6 +16,8 @@ A prompt-based CLI tool to scaffold projects for various frameworks and language
|
|
|
14
16
|
- Python
|
|
15
17
|
- Beautiful CLI interface with colors and spinners
|
|
16
18
|
- Fast project scaffolding
|
|
19
|
+
- Context-aware code generation based on project description
|
|
20
|
+
- Feature-based file creation (authentication, database, API, etc.)
|
|
17
21
|
|
|
18
22
|
## Installation
|
|
19
23
|
|
|
@@ -37,10 +41,44 @@ start-it-cli
|
|
|
37
41
|
|
|
38
42
|
Then follow the interactive prompts to:
|
|
39
43
|
|
|
40
|
-
1.
|
|
41
|
-
2.
|
|
42
|
-
3.
|
|
43
|
-
4.
|
|
44
|
+
1. **Choose generation method**: Traditional (Template-based) or AI-Powered (Smart recommendations)
|
|
45
|
+
2. **For Traditional**: Select your project type (Go, Flutter, React Native, Spring Boot, etc.)
|
|
46
|
+
3. **For AI-Powered**: Describe your project in natural language
|
|
47
|
+
4. Enter your project name
|
|
48
|
+
5. Choose additional options based on your framework or AI recommendations
|
|
49
|
+
6. Watch as your project is scaffolded automatically
|
|
50
|
+
|
|
51
|
+
### AI-Powered Generation
|
|
52
|
+
|
|
53
|
+
The AI feature analyzes your project description and generates:
|
|
54
|
+
|
|
55
|
+
- **Smart framework recommendations** based on your requirements
|
|
56
|
+
- **Contextual code** tailored to your specific use case
|
|
57
|
+
- **Feature-based architecture** (authentication, database, API routes, etc.)
|
|
58
|
+
- **Production-ready file structure** with actual working code
|
|
59
|
+
- **Domain-specific models** (e.g., Patient/Doctor models for hospital systems)
|
|
60
|
+
|
|
61
|
+
Example AI workflow:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
$ start-it-cli
|
|
65
|
+
? Choose project generation method: AI-Powered (Smart recommendations)
|
|
66
|
+
? Project name: hospital-management
|
|
67
|
+
? Describe your project: A comprehensive hospital management system with patient records
|
|
68
|
+
? Project scale: large
|
|
69
|
+
? Select features you need: authentication, database, api, frontend, backend, testing
|
|
70
|
+
|
|
71
|
+
AI Recommendations:
|
|
72
|
+
Framework: Node.js
|
|
73
|
+
Template: TypeScript Project
|
|
74
|
+
Reasoning: Based on your requirements, I recommend Node.js with TypeScript for scalability
|
|
75
|
+
|
|
76
|
+
Generated Files:
|
|
77
|
+
- package.json: Complete with dependencies for auth, database, testing
|
|
78
|
+
- src/index.ts: Express server with middleware setup
|
|
79
|
+
- src/routes/index.ts: API endpoints for hospital operations
|
|
80
|
+
- src/models/index.ts: Patient, Doctor, and User interfaces
|
|
81
|
+
```
|
|
44
82
|
|
|
45
83
|
## Example
|
|
46
84
|
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.AIProjectGenerator = void 0;
|
|
40
|
+
const provider_1 = require("./provider");
|
|
41
|
+
const templates_1 = require("../templates");
|
|
42
|
+
const fs = __importStar(require("fs-extra"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
45
|
+
const ora_1 = __importDefault(require("ora"));
|
|
46
|
+
class AIProjectGenerator {
|
|
47
|
+
constructor(apiKey) {
|
|
48
|
+
this.aiProvider = new provider_1.SmartAIProvider(apiKey);
|
|
49
|
+
}
|
|
50
|
+
async generate(request) {
|
|
51
|
+
const spinner = (0, ora_1.default)("Analyzing project requirements...").start();
|
|
52
|
+
try {
|
|
53
|
+
// Get AI recommendations with generated code
|
|
54
|
+
const recommendation = await this.aiProvider.generateProject(request);
|
|
55
|
+
spinner.text = "Generating project structure...";
|
|
56
|
+
// Create project directory
|
|
57
|
+
const projectDir = path.join(request.projectPath, request.projectName);
|
|
58
|
+
await fs.ensureDir(projectDir);
|
|
59
|
+
// Generate files from AI-generated content
|
|
60
|
+
for (const file of recommendation.structure) {
|
|
61
|
+
const filePath = path.join(projectDir, file.path);
|
|
62
|
+
await fs.ensureDir(path.dirname(filePath));
|
|
63
|
+
await fs.writeFile(filePath, file.content);
|
|
64
|
+
// Make executable files executable
|
|
65
|
+
if (file.isExecutable) {
|
|
66
|
+
await fs.chmod(filePath, 0o755);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
spinner.succeed("Project created successfully!");
|
|
70
|
+
console.log(chalk_1.default.cyan("\nAI Recommendations:"));
|
|
71
|
+
console.log(chalk_1.default.gray(`Framework: ${recommendation.framework}`));
|
|
72
|
+
console.log(chalk_1.default.gray(`Template: ${recommendation.template}`));
|
|
73
|
+
console.log(chalk_1.default.gray(`Reasoning: ${recommendation.reasoning}`));
|
|
74
|
+
if (recommendation.dependencies.length > 0) {
|
|
75
|
+
console.log(chalk_1.default.cyan("\nSuggested Dependencies:"));
|
|
76
|
+
recommendation.dependencies.forEach((dep) => {
|
|
77
|
+
console.log(chalk_1.default.gray(`- ${dep.name}@${dep.version || "latest"}: ${dep.purpose}`));
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
console.log(chalk_1.default.cyan("\nGenerated Files:"));
|
|
81
|
+
recommendation.structure.forEach((file) => {
|
|
82
|
+
console.log(chalk_1.default.gray(`- ${file.path}: ${file.description}`));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
spinner.fail("Failed to generate project");
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async generateIntelligentProject(description) {
|
|
91
|
+
// Analyze the project description
|
|
92
|
+
const features = await this.aiProvider.analyzeRequirements(description);
|
|
93
|
+
// Create AI request
|
|
94
|
+
const request = {
|
|
95
|
+
description,
|
|
96
|
+
features,
|
|
97
|
+
scale: this.determineScale(description),
|
|
98
|
+
deployment: this.determineDeployment(description),
|
|
99
|
+
};
|
|
100
|
+
// Get AI recommendations
|
|
101
|
+
const recommendation = await this.aiProvider.generateProject(request);
|
|
102
|
+
// Get the actual template
|
|
103
|
+
const template = (0, templates_1.getTemplate)(recommendation.framework, recommendation.template);
|
|
104
|
+
// Get smart dependencies
|
|
105
|
+
const dependencies = await this.aiProvider.suggestDependencies(recommendation.framework, features);
|
|
106
|
+
const { template: _, ...recommendationWithoutTemplate } = recommendation;
|
|
107
|
+
return {
|
|
108
|
+
...recommendationWithoutTemplate,
|
|
109
|
+
dependencies,
|
|
110
|
+
template,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
async enhanceTemplate(template, features) {
|
|
114
|
+
const enhancedFiles = await Promise.all(template.files.map(async (file) => {
|
|
115
|
+
return {
|
|
116
|
+
...file,
|
|
117
|
+
content: await this.enhanceFileContent(file.content, features),
|
|
118
|
+
};
|
|
119
|
+
}));
|
|
120
|
+
return {
|
|
121
|
+
...template,
|
|
122
|
+
files: enhancedFiles,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
determineScale(description) {
|
|
126
|
+
const lowerDesc = description.toLowerCase();
|
|
127
|
+
if (lowerDesc.includes("enterprise") ||
|
|
128
|
+
lowerDesc.includes("large") ||
|
|
129
|
+
lowerDesc.includes("microservice") ||
|
|
130
|
+
lowerDesc.includes("distributed")) {
|
|
131
|
+
return "large";
|
|
132
|
+
}
|
|
133
|
+
if (lowerDesc.includes("prototype") ||
|
|
134
|
+
lowerDesc.includes("small") ||
|
|
135
|
+
lowerDesc.includes("simple") ||
|
|
136
|
+
lowerDesc.includes("basic")) {
|
|
137
|
+
return "small";
|
|
138
|
+
}
|
|
139
|
+
return "medium";
|
|
140
|
+
}
|
|
141
|
+
determineDeployment(description) {
|
|
142
|
+
const lowerDesc = description.toLowerCase();
|
|
143
|
+
if (lowerDesc.includes("cloud") ||
|
|
144
|
+
lowerDesc.includes("aws") ||
|
|
145
|
+
lowerDesc.includes("azure") ||
|
|
146
|
+
lowerDesc.includes("gcp")) {
|
|
147
|
+
return "cloud";
|
|
148
|
+
}
|
|
149
|
+
if (lowerDesc.includes("local") ||
|
|
150
|
+
lowerDesc.includes("desktop") ||
|
|
151
|
+
lowerDesc.includes("offline")) {
|
|
152
|
+
return "local";
|
|
153
|
+
}
|
|
154
|
+
return "hybrid";
|
|
155
|
+
}
|
|
156
|
+
async enhanceFileContent(content, features) {
|
|
157
|
+
let enhanced = content;
|
|
158
|
+
// Add authentication setup
|
|
159
|
+
if (features.includes("authentication")) {
|
|
160
|
+
enhanced = this.addAuthenticationBoilerplate(enhanced);
|
|
161
|
+
}
|
|
162
|
+
// Add database configuration
|
|
163
|
+
if (features.includes("database")) {
|
|
164
|
+
enhanced = this.addDatabaseConfig(enhanced);
|
|
165
|
+
}
|
|
166
|
+
// Add API documentation
|
|
167
|
+
if (features.includes("api")) {
|
|
168
|
+
enhanced = this.addAPIDocumentation(enhanced);
|
|
169
|
+
}
|
|
170
|
+
// Add testing setup
|
|
171
|
+
if (features.includes("testing")) {
|
|
172
|
+
enhanced = this.addTestingSetup(enhanced);
|
|
173
|
+
}
|
|
174
|
+
// Add logging
|
|
175
|
+
if (features.includes("logging")) {
|
|
176
|
+
enhanced = this.addLoggingSetup(enhanced);
|
|
177
|
+
}
|
|
178
|
+
return enhanced;
|
|
179
|
+
}
|
|
180
|
+
addAuthenticationBoilerplate(content) {
|
|
181
|
+
// Add authentication imports and setup based on file type
|
|
182
|
+
if (content.includes("package.json")) {
|
|
183
|
+
return content.replace(/"dependencies": {/, '"dependencies": {\n "passport": "^0.6.0",\n "passport-local": "^1.0.0",\n "bcryptjs": "^2.4.3",\n "jsonwebtoken": "^9.0.0",');
|
|
184
|
+
}
|
|
185
|
+
if (content.includes("import") && content.includes("express")) {
|
|
186
|
+
return content.replace(/import.*express.*/, `$&\nimport passport from 'passport';\nimport { Strategy as LocalStrategy } from 'passport-local';\nimport jwt from 'jsonwebtoken';`);
|
|
187
|
+
}
|
|
188
|
+
return content;
|
|
189
|
+
}
|
|
190
|
+
addDatabaseConfig(content) {
|
|
191
|
+
if (content.includes("package.json")) {
|
|
192
|
+
return content.replace(/"dependencies": {/, '"dependencies": {\n "mongoose": "^7.5.0",\n "@types/mongoose": "^5.11.97",');
|
|
193
|
+
}
|
|
194
|
+
if (content.includes("import") && content.includes("express")) {
|
|
195
|
+
return content.replace(/import.*express.*/, `$&\nimport mongoose from 'mongoose';`);
|
|
196
|
+
}
|
|
197
|
+
return content;
|
|
198
|
+
}
|
|
199
|
+
addAPIDocumentation(content) {
|
|
200
|
+
if (content.includes("package.json")) {
|
|
201
|
+
return content.replace(/"dependencies": {/, '"dependencies": {\n "swagger-ui-express": "^5.0.0",\n "swagger-jsdoc": "^6.2.8",');
|
|
202
|
+
}
|
|
203
|
+
return content;
|
|
204
|
+
}
|
|
205
|
+
addTestingSetup(content) {
|
|
206
|
+
if (content.includes("package.json")) {
|
|
207
|
+
return content.replace(/"devDependencies": {/, '"devDependencies": {\n "jest": "^29.7.0",\n "supertest": "^6.3.3",\n "@types/jest": "^29.5.5",');
|
|
208
|
+
}
|
|
209
|
+
return content;
|
|
210
|
+
}
|
|
211
|
+
addLoggingSetup(content) {
|
|
212
|
+
if (content.includes("package.json")) {
|
|
213
|
+
return content.replace(/"dependencies": {/, '"dependencies": {\n "winston": "^3.10.0",');
|
|
214
|
+
}
|
|
215
|
+
if (content.includes("import") && content.includes("express")) {
|
|
216
|
+
return content.replace(/import.*express.*/, `$&\nimport winston from 'winston';`);
|
|
217
|
+
}
|
|
218
|
+
return content;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
exports.AIProjectGenerator = AIProjectGenerator;
|
|
222
|
+
//# sourceMappingURL=generator.js.map
|