mycontext-cli 2.0.2 → 2.0.3
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/dist/agents/implementations/CodeGenSubAgent.d.ts.map +1 -1
- package/dist/agents/implementations/CodeGenSubAgent.js +69 -0
- package/dist/agents/implementations/CodeGenSubAgent.js.map +1 -1
- package/dist/agents/implementations/PromptConstructorAgent.d.ts.map +1 -1
- package/dist/agents/implementations/PromptConstructorAgent.js +23 -0
- package/dist/agents/implementations/PromptConstructorAgent.js.map +1 -1
- package/dist/cli.js +11 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/health-check.d.ts +28 -0
- package/dist/commands/health-check.d.ts.map +1 -0
- package/dist/commands/health-check.js +271 -0
- package/dist/commands/health-check.js.map +1 -0
- package/dist/package.json +1 -1
- package/dist/utils/NextJSProjectGenerator.d.ts +70 -0
- package/dist/utils/NextJSProjectGenerator.d.ts.map +1 -0
- package/dist/utils/NextJSProjectGenerator.js +811 -0
- package/dist/utils/NextJSProjectGenerator.js.map +1 -0
- package/dist/utils/NextJSProjectValidator.d.ts +103 -0
- package/dist/utils/NextJSProjectValidator.d.ts.map +1 -0
- package/dist/utils/NextJSProjectValidator.js +759 -0
- package/dist/utils/NextJSProjectValidator.js.map +1 -0
- package/dist/utils/PreCommandValidator.d.ts +77 -0
- package/dist/utils/PreCommandValidator.d.ts.map +1 -0
- package/dist/utils/PreCommandValidator.js +251 -0
- package/dist/utils/PreCommandValidator.js.map +1 -0
- package/dist/utils/ProjectHealthMonitor.d.ts +131 -0
- package/dist/utils/ProjectHealthMonitor.d.ts.map +1 -0
- package/dist/utils/ProjectHealthMonitor.js +454 -0
- package/dist/utils/ProjectHealthMonitor.js.map +1 -0
- package/dist/utils/ProjectInitializationSafeguards.d.ts +81 -0
- package/dist/utils/ProjectInitializationSafeguards.d.ts.map +1 -0
- package/dist/utils/ProjectInitializationSafeguards.js +620 -0
- package/dist/utils/ProjectInitializationSafeguards.js.map +1 -0
- package/dist/utils/ProjectStructureRepair.d.ts +110 -0
- package/dist/utils/ProjectStructureRepair.d.ts.map +1 -0
- package/dist/utils/ProjectStructureRepair.js +785 -0
- package/dist/utils/ProjectStructureRepair.js.map +1 -0
- package/dist/utils/ProjectStructureValidator.d.ts +128 -0
- package/dist/utils/ProjectStructureValidator.d.ts.map +1 -0
- package/dist/utils/ProjectStructureValidator.js +662 -0
- package/dist/utils/ProjectStructureValidator.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,454 @@
|
|
|
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.ProjectHealthMonitor = void 0;
|
|
40
|
+
const fs = __importStar(require("fs-extra"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
43
|
+
const ProjectStructureValidator_1 = require("./ProjectStructureValidator");
|
|
44
|
+
class ProjectHealthMonitor {
|
|
45
|
+
constructor(projectRoot = process.cwd()) {
|
|
46
|
+
this.healthHistory = [];
|
|
47
|
+
this.alerts = [];
|
|
48
|
+
this.monitoringEnabled = true;
|
|
49
|
+
this.alertThresholds = {
|
|
50
|
+
critical: 0.3, // Below 30% health
|
|
51
|
+
warning: 0.6, // Below 60% health
|
|
52
|
+
info: 0.8 // Below 80% health
|
|
53
|
+
};
|
|
54
|
+
this.projectRoot = projectRoot;
|
|
55
|
+
this.validator = new ProjectStructureValidator_1.ProjectStructureValidator(projectRoot);
|
|
56
|
+
this.loadHealthHistory();
|
|
57
|
+
this.loadAlerts();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Perform comprehensive health check
|
|
61
|
+
*/
|
|
62
|
+
async performHealthCheck() {
|
|
63
|
+
console.log(chalk_1.default.blue("🏥 Performing comprehensive health check..."));
|
|
64
|
+
const report = await this.validator.validate();
|
|
65
|
+
const metrics = await this.calculateHealthMetrics(report);
|
|
66
|
+
// Store metrics
|
|
67
|
+
this.healthHistory.push(metrics);
|
|
68
|
+
this.trimHealthHistory();
|
|
69
|
+
// Check for alerts
|
|
70
|
+
await this.checkForAlerts(metrics);
|
|
71
|
+
// Save data
|
|
72
|
+
await this.saveHealthHistory();
|
|
73
|
+
await this.saveAlerts();
|
|
74
|
+
return metrics;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Calculate health metrics from validation report
|
|
78
|
+
*/
|
|
79
|
+
async calculateHealthMetrics(report) {
|
|
80
|
+
const timestamp = new Date().toISOString();
|
|
81
|
+
// Calculate structure health (based on critical and high issues)
|
|
82
|
+
const structureIssues = report.issues.filter(issue => issue.severity === "critical" || issue.severity === "high");
|
|
83
|
+
const structureHealth = Math.max(0, 100 - (structureIssues.length * 20));
|
|
84
|
+
// Calculate dependency health
|
|
85
|
+
const dependencyIssues = report.issues.filter(issue => issue.message.includes("package.json") ||
|
|
86
|
+
issue.message.includes("node_modules") ||
|
|
87
|
+
issue.message.includes("lock file") ||
|
|
88
|
+
issue.message.includes("dependencies"));
|
|
89
|
+
const dependencyHealth = Math.max(0, 100 - (dependencyIssues.length * 15));
|
|
90
|
+
// Calculate configuration health
|
|
91
|
+
const configIssues = report.issues.filter(issue => issue.message.includes("configuration") ||
|
|
92
|
+
issue.message.includes("tsconfig") ||
|
|
93
|
+
issue.message.includes("build config"));
|
|
94
|
+
const configurationHealth = Math.max(0, 100 - (configIssues.length * 10));
|
|
95
|
+
// Calculate overall health
|
|
96
|
+
const overallHealth = Math.round((structureHealth + dependencyHealth + configurationHealth) / 3);
|
|
97
|
+
// Count issues by severity
|
|
98
|
+
const issues = {
|
|
99
|
+
critical: report.issues.filter(issue => issue.severity === "critical").length,
|
|
100
|
+
high: report.issues.filter(issue => issue.severity === "high").length,
|
|
101
|
+
medium: report.issues.filter(issue => issue.severity === "medium").length,
|
|
102
|
+
low: report.issues.filter(issue => issue.severity === "low").length
|
|
103
|
+
};
|
|
104
|
+
// Get trends from last 10 measurements
|
|
105
|
+
const trends = this.calculateTrends();
|
|
106
|
+
return {
|
|
107
|
+
timestamp,
|
|
108
|
+
projectPath: this.projectRoot,
|
|
109
|
+
structureHealth,
|
|
110
|
+
dependencyHealth,
|
|
111
|
+
configurationHealth,
|
|
112
|
+
overallHealth,
|
|
113
|
+
issues,
|
|
114
|
+
trends
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Calculate health trends
|
|
119
|
+
*/
|
|
120
|
+
calculateTrends() {
|
|
121
|
+
const recent = this.healthHistory.slice(-10);
|
|
122
|
+
return {
|
|
123
|
+
structureHealth: recent.map(m => m.structureHealth),
|
|
124
|
+
dependencyHealth: recent.map(m => m.dependencyHealth),
|
|
125
|
+
configurationHealth: recent.map(m => m.configurationHealth),
|
|
126
|
+
overallHealth: recent.map(m => m.overallHealth)
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Check for health alerts
|
|
131
|
+
*/
|
|
132
|
+
async checkForAlerts(metrics) {
|
|
133
|
+
const alerts = [];
|
|
134
|
+
// Check overall health
|
|
135
|
+
if (metrics.overallHealth < this.alertThresholds.critical * 100) {
|
|
136
|
+
alerts.push({
|
|
137
|
+
id: `critical-health-${Date.now()}`,
|
|
138
|
+
type: "critical",
|
|
139
|
+
message: `Critical health alert: Overall health is ${metrics.overallHealth}%`,
|
|
140
|
+
timestamp: metrics.timestamp,
|
|
141
|
+
resolved: false,
|
|
142
|
+
autoResolved: false
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
else if (metrics.overallHealth < this.alertThresholds.warning * 100) {
|
|
146
|
+
alerts.push({
|
|
147
|
+
id: `warning-health-${Date.now()}`,
|
|
148
|
+
type: "warning",
|
|
149
|
+
message: `Warning: Overall health is ${metrics.overallHealth}%`,
|
|
150
|
+
timestamp: metrics.timestamp,
|
|
151
|
+
resolved: false,
|
|
152
|
+
autoResolved: false
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
// Check structure health
|
|
156
|
+
if (metrics.structureHealth < this.alertThresholds.critical * 100) {
|
|
157
|
+
alerts.push({
|
|
158
|
+
id: `critical-structure-${Date.now()}`,
|
|
159
|
+
type: "critical",
|
|
160
|
+
message: `Critical structure alert: Structure health is ${metrics.structureHealth}%`,
|
|
161
|
+
timestamp: metrics.timestamp,
|
|
162
|
+
resolved: false,
|
|
163
|
+
autoResolved: false
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
// Check dependency health
|
|
167
|
+
if (metrics.dependencyHealth < this.alertThresholds.warning * 100) {
|
|
168
|
+
alerts.push({
|
|
169
|
+
id: `warning-dependency-${Date.now()}`,
|
|
170
|
+
type: "warning",
|
|
171
|
+
message: `Dependency warning: Dependency health is ${metrics.dependencyHealth}%`,
|
|
172
|
+
timestamp: metrics.timestamp,
|
|
173
|
+
resolved: false,
|
|
174
|
+
autoResolved: false
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
// Check for new critical issues
|
|
178
|
+
if (metrics.issues.critical > 0) {
|
|
179
|
+
alerts.push({
|
|
180
|
+
id: `critical-issues-${Date.now()}`,
|
|
181
|
+
type: "critical",
|
|
182
|
+
message: `${metrics.issues.critical} critical issues detected`,
|
|
183
|
+
timestamp: metrics.timestamp,
|
|
184
|
+
resolved: false,
|
|
185
|
+
autoResolved: false
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
// Add new alerts
|
|
189
|
+
this.alerts.push(...alerts);
|
|
190
|
+
// Auto-resolve old alerts if health improved
|
|
191
|
+
await this.autoResolveAlerts(metrics);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Auto-resolve alerts when health improves
|
|
195
|
+
*/
|
|
196
|
+
async autoResolveAlerts(metrics) {
|
|
197
|
+
const unresolvedAlerts = this.alerts.filter(alert => !alert.resolved);
|
|
198
|
+
for (const alert of unresolvedAlerts) {
|
|
199
|
+
let shouldResolve = false;
|
|
200
|
+
switch (alert.type) {
|
|
201
|
+
case "critical":
|
|
202
|
+
if (metrics.overallHealth >= this.alertThresholds.warning * 100) {
|
|
203
|
+
shouldResolve = true;
|
|
204
|
+
}
|
|
205
|
+
break;
|
|
206
|
+
case "warning":
|
|
207
|
+
if (metrics.overallHealth >= this.alertThresholds.info * 100) {
|
|
208
|
+
shouldResolve = true;
|
|
209
|
+
}
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
if (shouldResolve) {
|
|
213
|
+
alert.resolved = true;
|
|
214
|
+
alert.autoResolved = true;
|
|
215
|
+
console.log(chalk_1.default.green(`✅ Auto-resolved alert: ${alert.message}`));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Get health dashboard data
|
|
221
|
+
*/
|
|
222
|
+
async getHealthDashboard() {
|
|
223
|
+
const current = await this.performHealthCheck();
|
|
224
|
+
const trends = this.calculateTrends();
|
|
225
|
+
const activeAlerts = this.alerts.filter(alert => !alert.resolved);
|
|
226
|
+
const recommendations = this.generateRecommendations(current);
|
|
227
|
+
return {
|
|
228
|
+
current,
|
|
229
|
+
trends,
|
|
230
|
+
alerts: activeAlerts,
|
|
231
|
+
recommendations
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Generate health recommendations
|
|
236
|
+
*/
|
|
237
|
+
generateRecommendations(metrics) {
|
|
238
|
+
const recommendations = [];
|
|
239
|
+
if (metrics.structureHealth < 80) {
|
|
240
|
+
recommendations.push("Run 'mycontext health-check --fix' to resolve structure issues");
|
|
241
|
+
}
|
|
242
|
+
if (metrics.dependencyHealth < 80) {
|
|
243
|
+
recommendations.push("Check for dependency conflicts and run 'pnpm install'");
|
|
244
|
+
}
|
|
245
|
+
if (metrics.configurationHealth < 80) {
|
|
246
|
+
recommendations.push("Review and update project configuration files");
|
|
247
|
+
}
|
|
248
|
+
if (metrics.issues.critical > 0) {
|
|
249
|
+
recommendations.push("Address critical issues immediately");
|
|
250
|
+
}
|
|
251
|
+
if (metrics.issues.high > 0) {
|
|
252
|
+
recommendations.push("Plan to address high-priority issues soon");
|
|
253
|
+
}
|
|
254
|
+
if (metrics.overallHealth < 60) {
|
|
255
|
+
recommendations.push("Consider running 'mycontext health-check --fix' to auto-resolve issues");
|
|
256
|
+
}
|
|
257
|
+
return recommendations;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Display health dashboard
|
|
261
|
+
*/
|
|
262
|
+
async displayHealthDashboard() {
|
|
263
|
+
const dashboard = await this.getHealthDashboard();
|
|
264
|
+
console.log(chalk_1.default.blue.bold("🏥 MyContext Project Health Dashboard"));
|
|
265
|
+
console.log(chalk_1.default.blue("=====================================\n"));
|
|
266
|
+
// Current health status
|
|
267
|
+
console.log(chalk_1.default.blue("📊 Current Health Status:"));
|
|
268
|
+
console.log(` Overall Health: ${this.getHealthColor(dashboard.current.overallHealth)}${dashboard.current.overallHealth}%`);
|
|
269
|
+
console.log(` Structure Health: ${this.getHealthColor(dashboard.current.structureHealth)}${dashboard.current.structureHealth}%`);
|
|
270
|
+
console.log(` Dependency Health: ${this.getHealthColor(dashboard.current.dependencyHealth)}${dashboard.current.dependencyHealth}%`);
|
|
271
|
+
console.log(` Configuration Health: ${this.getHealthColor(dashboard.current.configurationHealth)}${dashboard.current.configurationHealth}%\n`);
|
|
272
|
+
// Issues breakdown
|
|
273
|
+
console.log(chalk_1.default.blue("🚨 Issues Breakdown:"));
|
|
274
|
+
console.log(` Critical: ${chalk_1.default.red(dashboard.current.issues.critical)}`);
|
|
275
|
+
console.log(` High: ${chalk_1.default.yellow(dashboard.current.issues.high)}`);
|
|
276
|
+
console.log(` Medium: ${chalk_1.default.blue(dashboard.current.issues.medium)}`);
|
|
277
|
+
console.log(` Low: ${chalk_1.default.gray(dashboard.current.issues.low)}\n`);
|
|
278
|
+
// Active alerts
|
|
279
|
+
if (dashboard.alerts.length > 0) {
|
|
280
|
+
console.log(chalk_1.default.red("🚨 Active Alerts:"));
|
|
281
|
+
dashboard.alerts.forEach(alert => {
|
|
282
|
+
const color = alert.type === "critical" ? chalk_1.default.red :
|
|
283
|
+
alert.type === "warning" ? chalk_1.default.yellow : chalk_1.default.blue;
|
|
284
|
+
console.log(` ${color(alert.type.toUpperCase())}: ${alert.message}`);
|
|
285
|
+
});
|
|
286
|
+
console.log();
|
|
287
|
+
}
|
|
288
|
+
// Trends
|
|
289
|
+
if (dashboard.trends.overallHealth.length > 1) {
|
|
290
|
+
console.log(chalk_1.default.blue("📈 Health Trends (Last 10 Checks):"));
|
|
291
|
+
const trend = this.calculateTrendDirection(dashboard.trends.overallHealth);
|
|
292
|
+
const trendColor = trend > 0 ? chalk_1.default.green : trend < 0 ? chalk_1.default.red : chalk_1.default.gray;
|
|
293
|
+
const trendSymbol = trend > 0 ? "📈" : trend < 0 ? "📉" : "➡️";
|
|
294
|
+
console.log(` Overall Health: ${trendColor(trendSymbol)} ${trend > 0 ? "+" : ""}${trend.toFixed(1)}%`);
|
|
295
|
+
console.log();
|
|
296
|
+
}
|
|
297
|
+
// Recommendations
|
|
298
|
+
if (dashboard.recommendations.length > 0) {
|
|
299
|
+
console.log(chalk_1.default.blue("💡 Recommendations:"));
|
|
300
|
+
dashboard.recommendations.forEach(rec => {
|
|
301
|
+
console.log(` • ${rec}`);
|
|
302
|
+
});
|
|
303
|
+
console.log();
|
|
304
|
+
}
|
|
305
|
+
// Health grade
|
|
306
|
+
const grade = this.calculateHealthGrade(dashboard.current.overallHealth);
|
|
307
|
+
console.log(chalk_1.default.blue(`🏆 Health Grade: ${this.getGradeColor(grade)}${grade}`));
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Get health color based on percentage
|
|
311
|
+
*/
|
|
312
|
+
getHealthColor(percentage) {
|
|
313
|
+
if (percentage >= 80)
|
|
314
|
+
return chalk_1.default.green(`${percentage}%`);
|
|
315
|
+
if (percentage >= 60)
|
|
316
|
+
return chalk_1.default.yellow(`${percentage}%`);
|
|
317
|
+
if (percentage >= 40)
|
|
318
|
+
return chalk_1.default.red(`${percentage}%`);
|
|
319
|
+
return chalk_1.default.red.bold(`${percentage}%`);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Get grade color
|
|
323
|
+
*/
|
|
324
|
+
getGradeColor(grade) {
|
|
325
|
+
switch (grade) {
|
|
326
|
+
case "A": return chalk_1.default.green("A");
|
|
327
|
+
case "B": return chalk_1.default.yellow("B");
|
|
328
|
+
case "C": return chalk_1.default.yellow("C");
|
|
329
|
+
case "D": return chalk_1.default.red("D");
|
|
330
|
+
case "F": return chalk_1.default.red.bold("F");
|
|
331
|
+
default: return chalk_1.default.gray("?");
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Calculate health grade
|
|
336
|
+
*/
|
|
337
|
+
calculateHealthGrade(percentage) {
|
|
338
|
+
if (percentage >= 90)
|
|
339
|
+
return "A";
|
|
340
|
+
if (percentage >= 80)
|
|
341
|
+
return "B";
|
|
342
|
+
if (percentage >= 70)
|
|
343
|
+
return "C";
|
|
344
|
+
if (percentage >= 60)
|
|
345
|
+
return "D";
|
|
346
|
+
return "F";
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Calculate trend direction
|
|
350
|
+
*/
|
|
351
|
+
calculateTrendDirection(values) {
|
|
352
|
+
if (values.length < 2)
|
|
353
|
+
return 0;
|
|
354
|
+
const first = values[0];
|
|
355
|
+
const last = values[values.length - 1];
|
|
356
|
+
return last - first;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Enable/disable monitoring
|
|
360
|
+
*/
|
|
361
|
+
setMonitoringEnabled(enabled) {
|
|
362
|
+
this.monitoringEnabled = enabled;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Set alert thresholds
|
|
366
|
+
*/
|
|
367
|
+
setAlertThresholds(thresholds) {
|
|
368
|
+
this.alertThresholds = { ...this.alertThresholds, ...thresholds };
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Get health history
|
|
372
|
+
*/
|
|
373
|
+
getHealthHistory() {
|
|
374
|
+
return [...this.healthHistory];
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Get alerts
|
|
378
|
+
*/
|
|
379
|
+
getAlerts() {
|
|
380
|
+
return [...this.alerts];
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Clear resolved alerts
|
|
384
|
+
*/
|
|
385
|
+
clearResolvedAlerts() {
|
|
386
|
+
this.alerts = this.alerts.filter(alert => !alert.resolved);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Load health history from file
|
|
390
|
+
*/
|
|
391
|
+
async loadHealthHistory() {
|
|
392
|
+
try {
|
|
393
|
+
const historyPath = path.join(this.projectRoot, ".mycontext", "health-history.json");
|
|
394
|
+
if (await fs.pathExists(historyPath)) {
|
|
395
|
+
const data = await fs.readJson(historyPath);
|
|
396
|
+
this.healthHistory = data.history || [];
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
catch (error) {
|
|
400
|
+
console.log(chalk_1.default.yellow("⚠️ Could not load health history"));
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Save health history to file
|
|
405
|
+
*/
|
|
406
|
+
async saveHealthHistory() {
|
|
407
|
+
try {
|
|
408
|
+
const historyPath = path.join(this.projectRoot, ".mycontext", "health-history.json");
|
|
409
|
+
await fs.ensureDir(path.dirname(historyPath));
|
|
410
|
+
await fs.writeJson(historyPath, { history: this.healthHistory }, { spaces: 2 });
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
console.log(chalk_1.default.yellow("⚠️ Could not save health history"));
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Load alerts from file
|
|
418
|
+
*/
|
|
419
|
+
async loadAlerts() {
|
|
420
|
+
try {
|
|
421
|
+
const alertsPath = path.join(this.projectRoot, ".mycontext", "health-alerts.json");
|
|
422
|
+
if (await fs.pathExists(alertsPath)) {
|
|
423
|
+
const data = await fs.readJson(alertsPath);
|
|
424
|
+
this.alerts = data.alerts || [];
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
catch (error) {
|
|
428
|
+
console.log(chalk_1.default.yellow("⚠️ Could not load health alerts"));
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Save alerts to file
|
|
433
|
+
*/
|
|
434
|
+
async saveAlerts() {
|
|
435
|
+
try {
|
|
436
|
+
const alertsPath = path.join(this.projectRoot, ".mycontext", "health-alerts.json");
|
|
437
|
+
await fs.ensureDir(path.dirname(alertsPath));
|
|
438
|
+
await fs.writeJson(alertsPath, { alerts: this.alerts }, { spaces: 2 });
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
console.log(chalk_1.default.yellow("⚠️ Could not save health alerts"));
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Trim health history to keep only last 100 entries
|
|
446
|
+
*/
|
|
447
|
+
trimHealthHistory() {
|
|
448
|
+
if (this.healthHistory.length > 100) {
|
|
449
|
+
this.healthHistory = this.healthHistory.slice(-100);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
exports.ProjectHealthMonitor = ProjectHealthMonitor;
|
|
454
|
+
//# sourceMappingURL=ProjectHealthMonitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectHealthMonitor.js","sourceRoot":"","sources":["../../src/utils/ProjectHealthMonitor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,2CAA6B;AAC7B,kDAA0B;AAC1B,2EAAgG;AAgChG,MAAa,oBAAoB;IAY/B,YAAY,cAAsB,OAAO,CAAC,GAAG,EAAE;QATvC,kBAAa,GAAoB,EAAE,CAAC;QACpC,WAAM,GAAkB,EAAE,CAAC;QAC3B,sBAAiB,GAAY,IAAI,CAAC;QAClC,oBAAe,GAAG;YACxB,QAAQ,EAAE,G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ACpC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;CACF;AArdD,oDAqdC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export interface ProjectInitializationOptions {
|
|
2
|
+
projectName: string;
|
|
3
|
+
projectPath: string;
|
|
4
|
+
framework: string;
|
|
5
|
+
withShadcn: boolean;
|
|
6
|
+
scaffoldNext: boolean;
|
|
7
|
+
skipShadcn: boolean;
|
|
8
|
+
force: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface InitializationResult {
|
|
11
|
+
success: boolean;
|
|
12
|
+
warnings: string[];
|
|
13
|
+
errors: string[];
|
|
14
|
+
projectPath: string;
|
|
15
|
+
structureValid: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare class ProjectInitializationSafeguards {
|
|
18
|
+
private validator;
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Comprehensive project initialization with safeguards
|
|
22
|
+
*/
|
|
23
|
+
initializeProject(options: ProjectInitializationOptions): Promise<InitializationResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Validate target location for project creation
|
|
26
|
+
*/
|
|
27
|
+
private validateTargetLocation;
|
|
28
|
+
/**
|
|
29
|
+
* Check for existing project conflicts
|
|
30
|
+
*/
|
|
31
|
+
private checkExistingProjectConflicts;
|
|
32
|
+
/**
|
|
33
|
+
* Create project structure safely
|
|
34
|
+
*/
|
|
35
|
+
private createProjectStructure;
|
|
36
|
+
/**
|
|
37
|
+
* Initialize package.json with safeguards
|
|
38
|
+
*/
|
|
39
|
+
private initializePackageJson;
|
|
40
|
+
/**
|
|
41
|
+
* Set up framework-specific configuration
|
|
42
|
+
*/
|
|
43
|
+
private setupFrameworkConfiguration;
|
|
44
|
+
/**
|
|
45
|
+
* Set up Next.js configuration
|
|
46
|
+
*/
|
|
47
|
+
private setupNextJSConfiguration;
|
|
48
|
+
/**
|
|
49
|
+
* Set up TypeScript configuration
|
|
50
|
+
*/
|
|
51
|
+
private setupTypeScriptConfiguration;
|
|
52
|
+
/**
|
|
53
|
+
* Set up Tailwind CSS configuration
|
|
54
|
+
*/
|
|
55
|
+
private setupTailwindConfiguration;
|
|
56
|
+
/**
|
|
57
|
+
* Initialize MyContext configuration
|
|
58
|
+
*/
|
|
59
|
+
private initializeMyContextConfig;
|
|
60
|
+
/**
|
|
61
|
+
* Perform final validation
|
|
62
|
+
*/
|
|
63
|
+
private performFinalValidation;
|
|
64
|
+
/**
|
|
65
|
+
* Generate package.json content
|
|
66
|
+
*/
|
|
67
|
+
private generatePackageJson;
|
|
68
|
+
/**
|
|
69
|
+
* Generate .gitignore content
|
|
70
|
+
*/
|
|
71
|
+
private generateGitignoreContent;
|
|
72
|
+
/**
|
|
73
|
+
* Check if a directory is safe to initialize a project in
|
|
74
|
+
*/
|
|
75
|
+
isSafeToInitialize(projectPath: string): Promise<{
|
|
76
|
+
safe: boolean;
|
|
77
|
+
warnings: string[];
|
|
78
|
+
errors: string[];
|
|
79
|
+
}>;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=ProjectInitializationSafeguards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectInitializationSafeguards.d.ts","sourceRoot":"","sources":["../../src/utils/ProjectInitializationSafeguards.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,4BAA4B;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,qBAAa,+BAA+B;IAC1C,OAAO,CAAC,SAAS,CAA4B;;IAM7C;;OAEG;IACG,iBAAiB,CACrB,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,oBAAoB,CAAC;IAqDhC;;OAEG;YACW,sBAAsB;IAiDpC;;OAEG;YACW,6BAA6B;IAsD3C;;OAEG;YACW,sBAAsB;IAuCpC;;OAEG;YACW,qBAAqB;IAyBnC;;OAEG;YACW,2BAA2B;IAyBzC;;OAEG;YACW,wBAAwB;IA+BtC;;OAEG;YACW,4BAA4B;IA0C1C;;OAEG;YACW,0BAA0B;IAiDxC;;OAEG;YACW,yBAAyB;IAkDvC;;OAEG;YACW,sBAAsB;IAiCpC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA4C3B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA2GhC;;OAEG;IACG,kBAAkB,CACtB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAsDpE"}
|