awc-zns-mtd 2.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/.editorconfig +21 -0
- package/CHANGELOG.md +210 -0
- package/LICENSE +21 -0
- package/README.md +439 -0
- package/docs/examples/example-feature.md +94 -0
- package/docs/getting-started/quick-start.md +85 -0
- package/docs/guides/agent-guide.md +56 -0
- package/docs/guides/workflow-guide.md +49 -0
- package/docs/reference/commands-reference.md +93 -0
- package/docs/reference/methodology-design.md +193 -0
- package/package.json +66 -0
- package/src/modules/awc-zns-mtd/agents/architect-senior.agent.yaml +159 -0
- package/src/modules/awc-zns-mtd/agents/developer-pro.agent.yaml +197 -0
- package/src/modules/awc-zns-mtd/agents/qa-specialist.agent.yaml +225 -0
- package/src/modules/awc-zns-mtd/agents/zen-master.agent.yaml +142 -0
- package/src/modules/awc-zns-mtd/config.yaml +412 -0
- package/src/modules/awc-zns-mtd/templates/PRD-template.md +490 -0
- package/src/modules/awc-zns-mtd/templates/arquitectura-conceptual.md +431 -0
- package/src/modules/awc-zns-mtd/templates/cotizacion.md +333 -0
- package/src/modules/awc-zns-mtd/templates/discovery-notes.md +205 -0
- package/src/modules/awc-zns-mtd/templates/kickoff-agenda.md +297 -0
- package/src/modules/awc-zns-mtd/templates/oferta-comercial.md +279 -0
- package/src/modules/awc-zns-mtd/templates/viabilidad.md +281 -0
- package/src/modules/awc-zns-mtd/workflows/analisis-flow/workflow.yaml +500 -0
- package/src/modules/awc-zns-mtd/workflows/comercial-flow/workflow.yaml +444 -0
- package/src/modules/awc-zns-mtd/workflows/deployment-flow/workflow.yaml +395 -0
- package/src/modules/awc-zns-mtd/workflows/development-flow/workflow.yaml +321 -0
- package/src/modules/awc-zns-mtd/workflows/enterprise-flow/workflow.yaml +276 -0
- package/src/modules/awc-zns-mtd/workflows/inception-flow/workflow.yaml +588 -0
- package/src/modules/awc-zns-mtd/workflows/planificacion-flow/workflow.yaml +526 -0
- package/src/modules/awc-zns-mtd/workflows/qa-flow/workflow.yaml +291 -0
- package/src/modules/awc-zns-mtd/workflows/quick-flow/workflow.yaml +121 -0
- package/src/modules/awc-zns-mtd/workflows/standard-flow/workflow.yaml +181 -0
- package/src/modules/awc-zns-mtd/workflows/support-flow/workflow.yaml +438 -0
- package/src/modules/custom-agents/ARCHITECTURE.md +566 -0
- package/src/modules/custom-agents/CONVERSION_SUMMARY.md +315 -0
- package/src/modules/custom-agents/FINAL_SUMMARY.md +296 -0
- package/src/modules/custom-agents/README.md +628 -0
- package/src/modules/custom-agents/USAGE_GUIDE.md +306 -0
- package/src/modules/custom-agents/agents/aspnet-core-architect-senior.agent.yaml +368 -0
- package/src/modules/custom-agents/agents/backend-audit-master.agent.yaml +376 -0
- package/src/modules/custom-agents/agents/backend-java-senior.agent.yaml +606 -0
- package/src/modules/custom-agents/agents/c4-diagram-specialist.agent.yaml +345 -0
- package/src/modules/custom-agents/agents/consolidation-context-master.agent.yaml +318 -0
- package/src/modules/custom-agents/agents/cost-estimator-senior.agent.yaml +369 -0
- package/src/modules/custom-agents/agents/database-engineer-senior.agent.yaml +331 -0
- package/src/modules/custom-agents/agents/devsecops-onpremise-senior.agent.yaml +370 -0
- package/src/modules/custom-agents/agents/document-export-specialist.agent.yaml +355 -0
- package/src/modules/custom-agents/agents/dotnet-core-senior.agent.yaml +258 -0
- package/src/modules/custom-agents/agents/frontend-audit-master.agent.yaml +356 -0
- package/src/modules/custom-agents/agents/frontend-react-senior.agent.yaml +470 -0
- package/src/modules/custom-agents/agents/obsolescence-analyst-senior.agent.yaml +339 -0
- package/src/modules/custom-agents/agents/php-senior.agent.yaml +277 -0
- package/src/modules/custom-agents/agents/product-owner-business-analyst.agent.yaml +315 -0
- package/src/modules/custom-agents/agents/prompt-architect-senior.agent.yaml +398 -0
- package/src/modules/custom-agents/agents/prompt-engineer-senior.agent.yaml +431 -0
- package/src/modules/custom-agents/agents/python-senior.agent.yaml +347 -0
- package/src/modules/custom-agents/agents/react-native-senior.agent.yaml +292 -0
- package/src/modules/custom-agents/agents/solution-architect-senior.agent.yaml +496 -0
- package/src/modules/custom-agents/agents/technical-stories-architect.agent.yaml +402 -0
- package/src/modules/custom-agents/agents/validation-quality-master.agent.yaml +377 -0
- package/src/modules/custom-agents/cli/.awc-agents/aspnet-core-architect-senior.agent.yaml +368 -0
- package/src/modules/custom-agents/cli/.awc-agents/backend-audit-master.agent.yaml +376 -0
- package/src/modules/custom-agents/cli/.awc-agents/backend-java-senior.agent.yaml +606 -0
- package/src/modules/custom-agents/cli/.awc-agents/c4-diagram-specialist.agent.yaml +345 -0
- package/src/modules/custom-agents/cli/.awc-agents/consolidation-context-master.agent.yaml +318 -0
- package/src/modules/custom-agents/cli/.awc-agents/cost-estimator-senior.agent.yaml +369 -0
- package/src/modules/custom-agents/cli/.awc-agents/database-engineer-senior.agent.yaml +331 -0
- package/src/modules/custom-agents/cli/.awc-agents/devsecops-onpremise-senior.agent.yaml +370 -0
- package/src/modules/custom-agents/cli/.awc-agents/document-export-specialist.agent.yaml +355 -0
- package/src/modules/custom-agents/cli/.awc-agents/dotnet-core-senior.agent.yaml +258 -0
- package/src/modules/custom-agents/cli/.awc-agents/frontend-audit-master.agent.yaml +356 -0
- package/src/modules/custom-agents/cli/.awc-agents/frontend-react-senior.agent.yaml +470 -0
- package/src/modules/custom-agents/cli/.awc-agents/obsolescence-analyst-senior.agent.yaml +339 -0
- package/src/modules/custom-agents/cli/.awc-agents/php-senior.agent.yaml +277 -0
- package/src/modules/custom-agents/cli/.awc-agents/product-owner-business-analyst.agent.yaml +315 -0
- package/src/modules/custom-agents/cli/.awc-agents/prompt-architect-senior.agent.yaml +398 -0
- package/src/modules/custom-agents/cli/.awc-agents/prompt-engineer-senior.agent.yaml +431 -0
- package/src/modules/custom-agents/cli/.awc-agents/python-senior.agent.yaml +347 -0
- package/src/modules/custom-agents/cli/.awc-agents/react-native-senior.agent.yaml +292 -0
- package/src/modules/custom-agents/cli/.awc-agents/solution-architect-senior.agent.yaml +496 -0
- package/src/modules/custom-agents/cli/.awc-agents/technical-stories-architect.agent.yaml +402 -0
- package/src/modules/custom-agents/cli/.awc-agents/validation-quality-master.agent.yaml +377 -0
- package/src/modules/custom-agents/cli/CHANGELOG.md +77 -0
- package/src/modules/custom-agents/cli/LICENSE +21 -0
- package/src/modules/custom-agents/cli/PUBLISH.md +292 -0
- package/src/modules/custom-agents/cli/README.md +333 -0
- package/src/modules/custom-agents/cli/agents-data/aspnet-core-architect-senior.agent.yaml +368 -0
- package/src/modules/custom-agents/cli/agents-data/backend-audit-master.agent.yaml +376 -0
- package/src/modules/custom-agents/cli/agents-data/backend-java-senior.agent.yaml +606 -0
- package/src/modules/custom-agents/cli/agents-data/c4-diagram-specialist.agent.yaml +345 -0
- package/src/modules/custom-agents/cli/agents-data/consolidation-context-master.agent.yaml +318 -0
- package/src/modules/custom-agents/cli/agents-data/cost-estimator-senior.agent.yaml +369 -0
- package/src/modules/custom-agents/cli/agents-data/database-engineer-senior.agent.yaml +331 -0
- package/src/modules/custom-agents/cli/agents-data/devsecops-onpremise-senior.agent.yaml +370 -0
- package/src/modules/custom-agents/cli/agents-data/document-export-specialist.agent.yaml +355 -0
- package/src/modules/custom-agents/cli/agents-data/dotnet-core-senior.agent.yaml +258 -0
- package/src/modules/custom-agents/cli/agents-data/frontend-audit-master.agent.yaml +356 -0
- package/src/modules/custom-agents/cli/agents-data/frontend-react-senior.agent.yaml +470 -0
- package/src/modules/custom-agents/cli/agents-data/obsolescence-analyst-senior.agent.yaml +339 -0
- package/src/modules/custom-agents/cli/agents-data/php-senior.agent.yaml +277 -0
- package/src/modules/custom-agents/cli/agents-data/product-owner-business-analyst.agent.yaml +315 -0
- package/src/modules/custom-agents/cli/agents-data/prompt-architect-senior.agent.yaml +398 -0
- package/src/modules/custom-agents/cli/agents-data/prompt-engineer-senior.agent.yaml +431 -0
- package/src/modules/custom-agents/cli/agents-data/python-senior.agent.yaml +347 -0
- package/src/modules/custom-agents/cli/agents-data/react-native-senior.agent.yaml +292 -0
- package/src/modules/custom-agents/cli/agents-data/solution-architect-senior.agent.yaml +496 -0
- package/src/modules/custom-agents/cli/agents-data/technical-stories-architect.agent.yaml +402 -0
- package/src/modules/custom-agents/cli/agents-data/validation-quality-master.agent.yaml +377 -0
- package/src/modules/custom-agents/cli/awc-agent.js +372 -0
- package/src/modules/custom-agents/cli/config.yaml +478 -0
- package/src/modules/custom-agents/cli/package.json +63 -0
- package/src/modules/custom-agents/config.yaml +478 -0
- package/templates/.github/copilot-instructions.md +120 -0
- package/tools/cli/awc-cli.js +137 -0
- package/tools/cli/commands/config.js +148 -0
- package/tools/cli/commands/init.js +147 -0
- package/tools/cli/commands/install.js +188 -0
- package/tools/cli/commands/status.js +128 -0
- package/tools/cli/commands/validate.js +147 -0
- package/tools/cli/commands/version.js +49 -0
- package/tools/cli/utils/console-logger.js +153 -0
- package/tools/cli/utils/file-utils.js +178 -0
- package/tools/cli/utils/project-analyzer.js +280 -0
- package/tools/cli/utils/version.js +126 -0
- package/tools/version/README.md +272 -0
- package/tools/version/changelog-manager.js +288 -0
- package/tools/version/update-checker.js +234 -0
- package/tools/version/version-bump.js +90 -0
- package/tools/version/version-manager.js +224 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Changelog Manager
|
|
3
|
+
* Gestor de changelog automático para AWC ZNS-MTD
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const fs = require('fs-extra');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
class ChangelogManager {
|
|
10
|
+
constructor(changelogPath = null) {
|
|
11
|
+
this.changelogPath = changelogPath || path.join(__dirname, '../../CHANGELOG.md');
|
|
12
|
+
this.changeTypes = {
|
|
13
|
+
'added': 'Añadido',
|
|
14
|
+
'changed': 'Cambiado',
|
|
15
|
+
'deprecated': 'Obsoleto',
|
|
16
|
+
'removed': 'Eliminado',
|
|
17
|
+
'fixed': 'Corregido',
|
|
18
|
+
'security': 'Seguridad'
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Lee el contenido del changelog
|
|
24
|
+
*/
|
|
25
|
+
async readChangelog() {
|
|
26
|
+
if (!(await fs.pathExists(this.changelogPath))) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
return await fs.readFile(this.changelogPath, 'utf8');
|
|
32
|
+
} catch (error) {
|
|
33
|
+
throw new Error(`Error al leer changelog: ${error.message}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Obtiene las notas de una versión específica
|
|
39
|
+
*/
|
|
40
|
+
async getVersionNotes(version) {
|
|
41
|
+
const content = await this.readChangelog();
|
|
42
|
+
|
|
43
|
+
if (!content) return null;
|
|
44
|
+
|
|
45
|
+
// Buscar sección de la versión
|
|
46
|
+
const versionRegex = new RegExp(`## \\[${version}\\]([\\s\\S]*?)(?=## \\[|$)`, 'i');
|
|
47
|
+
const match = content.match(versionRegex);
|
|
48
|
+
|
|
49
|
+
if (!match) return null;
|
|
50
|
+
|
|
51
|
+
return this.parseVersionSection(match[1]);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Parsea una sección de versión del changelog
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
parseVersionSection(section) {
|
|
59
|
+
const parsed = {
|
|
60
|
+
added: [],
|
|
61
|
+
changed: [],
|
|
62
|
+
deprecated: [],
|
|
63
|
+
removed: [],
|
|
64
|
+
fixed: [],
|
|
65
|
+
security: []
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Buscar cada tipo de cambio
|
|
69
|
+
Object.keys(this.changeTypes).forEach(type => {
|
|
70
|
+
const typeRegex = new RegExp(`### ${this.changeTypes[type]}([\\s\\S]*?)(?=###|$)`, 'i');
|
|
71
|
+
const match = section.match(typeRegex);
|
|
72
|
+
|
|
73
|
+
if (match) {
|
|
74
|
+
// Extraer items (líneas que empiezan con -)
|
|
75
|
+
const items = match[1].match(/^- (.+)$/gm) || [];
|
|
76
|
+
parsed[type] = items.map(item => item.replace(/^- /, '').trim());
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
return parsed;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Obtiene el último cambio registrado
|
|
85
|
+
*/
|
|
86
|
+
async getLatestRelease() {
|
|
87
|
+
const content = await this.readChangelog();
|
|
88
|
+
|
|
89
|
+
if (!content) return null;
|
|
90
|
+
|
|
91
|
+
// Buscar primera versión (ignorando Unreleased)
|
|
92
|
+
const versionRegex = /## \[(\d+\.\d+\.\d+)\] - (\d{4}-\d{2}-\d{2})/;
|
|
93
|
+
const match = content.match(versionRegex);
|
|
94
|
+
|
|
95
|
+
if (!match) return null;
|
|
96
|
+
|
|
97
|
+
const [, version, date] = match;
|
|
98
|
+
const notes = await this.getVersionNotes(version);
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
version,
|
|
102
|
+
date,
|
|
103
|
+
notes
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Agrega una nueva versión al changelog
|
|
109
|
+
*/
|
|
110
|
+
async addVersion(version, date, changes) {
|
|
111
|
+
const content = await this.readChangelog();
|
|
112
|
+
|
|
113
|
+
if (!content) {
|
|
114
|
+
throw new Error('Changelog no encontrado');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Generar sección de la nueva versión
|
|
118
|
+
const versionSection = this.generateVersionSection(version, date, changes);
|
|
119
|
+
|
|
120
|
+
// Insertar después de "## [Unreleased]"
|
|
121
|
+
const unreleasedRegex = /(## \[Unreleased\][\s\S]*?)(?=## \[|$)/;
|
|
122
|
+
const newContent = content.replace(unreleasedRegex, `$1\n${versionSection}\n`);
|
|
123
|
+
|
|
124
|
+
await fs.writeFile(this.changelogPath, newContent, 'utf8');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Genera sección de versión en formato markdown
|
|
129
|
+
* @private
|
|
130
|
+
*/
|
|
131
|
+
generateVersionSection(version, date, changes) {
|
|
132
|
+
let section = `## [${version}] - ${date}\n\n`;
|
|
133
|
+
|
|
134
|
+
// Agregar cada tipo de cambio si tiene items
|
|
135
|
+
Object.keys(this.changeTypes).forEach(type => {
|
|
136
|
+
if (changes[type] && changes[type].length > 0) {
|
|
137
|
+
section += `### ${this.changeTypes[type]}\n\n`;
|
|
138
|
+
changes[type].forEach(item => {
|
|
139
|
+
section += `- ${item}\n`;
|
|
140
|
+
});
|
|
141
|
+
section += '\n';
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
return section;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Obtiene todos los cambios no liberados (Unreleased)
|
|
150
|
+
*/
|
|
151
|
+
async getUnreleasedChanges() {
|
|
152
|
+
const content = await this.readChangelog();
|
|
153
|
+
|
|
154
|
+
if (!content) return null;
|
|
155
|
+
|
|
156
|
+
const unreleasedRegex = /## \[Unreleased\]([\s\S]*?)(?=## \[|$)/;
|
|
157
|
+
const match = content.match(unreleasedRegex);
|
|
158
|
+
|
|
159
|
+
if (!match) return null;
|
|
160
|
+
|
|
161
|
+
return this.parseVersionSection(match[1]);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Verifica si hay cambios breaking en una versión
|
|
166
|
+
*/
|
|
167
|
+
async hasBreakingChanges(version) {
|
|
168
|
+
const notes = await this.getVersionNotes(version);
|
|
169
|
+
|
|
170
|
+
if (!notes) return false;
|
|
171
|
+
|
|
172
|
+
// Buscar indicadores de breaking changes
|
|
173
|
+
const breakingIndicators = [
|
|
174
|
+
'BREAKING CHANGE',
|
|
175
|
+
'breaking change',
|
|
176
|
+
'incompatible',
|
|
177
|
+
'removed',
|
|
178
|
+
'deprecated'
|
|
179
|
+
];
|
|
180
|
+
|
|
181
|
+
const allChanges = Object.values(notes).flat().join(' ').toLowerCase();
|
|
182
|
+
|
|
183
|
+
return breakingIndicators.some(indicator =>
|
|
184
|
+
allChanges.includes(indicator.toLowerCase())
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Genera resumen de cambios entre dos versiones
|
|
190
|
+
*/
|
|
191
|
+
async getChangesSummary(fromVersion, toVersion) {
|
|
192
|
+
const content = await this.readChangelog();
|
|
193
|
+
|
|
194
|
+
if (!content) return null;
|
|
195
|
+
|
|
196
|
+
const summary = {
|
|
197
|
+
from: fromVersion,
|
|
198
|
+
to: toVersion,
|
|
199
|
+
changes: {
|
|
200
|
+
added: [],
|
|
201
|
+
changed: [],
|
|
202
|
+
deprecated: [],
|
|
203
|
+
removed: [],
|
|
204
|
+
fixed: [],
|
|
205
|
+
security: []
|
|
206
|
+
},
|
|
207
|
+
breakingChanges: false
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
// Parsear todas las versiones entre fromVersion y toVersion
|
|
211
|
+
const versionRegex = /## \[(\d+\.\d+\.\d+)\]/g;
|
|
212
|
+
const versions = [];
|
|
213
|
+
let match;
|
|
214
|
+
|
|
215
|
+
while ((match = versionRegex.exec(content)) !== null) {
|
|
216
|
+
versions.push(match[1]);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Filtrar versiones en el rango
|
|
220
|
+
const fromIndex = versions.indexOf(fromVersion);
|
|
221
|
+
const toIndex = versions.indexOf(toVersion);
|
|
222
|
+
|
|
223
|
+
if (fromIndex === -1 || toIndex === -1) {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const versionsInRange = versions.slice(toIndex, fromIndex);
|
|
228
|
+
|
|
229
|
+
// Agregar cambios de cada versión
|
|
230
|
+
for (const version of versionsInRange) {
|
|
231
|
+
const notes = await this.getVersionNotes(version);
|
|
232
|
+
|
|
233
|
+
if (notes) {
|
|
234
|
+
Object.keys(notes).forEach(type => {
|
|
235
|
+
summary.changes[type].push(...notes[type]);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
if (await this.hasBreakingChanges(version)) {
|
|
239
|
+
summary.breakingChanges = true;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return summary;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Valida formato del changelog
|
|
249
|
+
*/
|
|
250
|
+
async validateChangelog() {
|
|
251
|
+
const content = await this.readChangelog();
|
|
252
|
+
|
|
253
|
+
if (!content) {
|
|
254
|
+
return {
|
|
255
|
+
valid: false,
|
|
256
|
+
errors: ['Changelog no encontrado']
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const errors = [];
|
|
261
|
+
|
|
262
|
+
// Verificar formato de versiones
|
|
263
|
+
const versionRegex = /## \[\d+\.\d+\.\d+\] - \d{4}-\d{2}-\d{2}/g;
|
|
264
|
+
if (!versionRegex.test(content)) {
|
|
265
|
+
errors.push('Formato de versión inválido');
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Verificar sección Unreleased
|
|
269
|
+
if (!content.includes('## [Unreleased]')) {
|
|
270
|
+
errors.push('Falta sección [Unreleased]');
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Verificar tipos de cambio
|
|
274
|
+
const requiredSections = Object.values(this.changeTypes);
|
|
275
|
+
// No es obligatorio tener todas las secciones, solo verificar que las que existan sean válidas
|
|
276
|
+
|
|
277
|
+
return {
|
|
278
|
+
valid: errors.length === 0,
|
|
279
|
+
errors
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Singleton instance
|
|
285
|
+
const changelogManager = new ChangelogManager();
|
|
286
|
+
|
|
287
|
+
module.exports = changelogManager;
|
|
288
|
+
module.exports.ChangelogManager = ChangelogManager;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update Checker
|
|
3
|
+
* Verifica actualizaciones disponibles del método AWC ZNS-MTD
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const semver = require('semver');
|
|
7
|
+
const versionManager = require('./version-manager');
|
|
8
|
+
|
|
9
|
+
class UpdateChecker {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.currentVersion = versionManager.getCurrentVersion();
|
|
12
|
+
this.updateCheckInterval = 24 * 60 * 60 * 1000; // 24 horas
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Verifica si hay actualizaciones disponibles
|
|
17
|
+
* @param {object} options - Opciones de verificación
|
|
18
|
+
*/
|
|
19
|
+
async checkForUpdates(options = {}) {
|
|
20
|
+
const {
|
|
21
|
+
registry = 'https://registry.npmjs.org',
|
|
22
|
+
includePrerelease = false,
|
|
23
|
+
timeout = 5000
|
|
24
|
+
} = options;
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
// En producción, esto consultaría el registro de npm
|
|
28
|
+
// Por ahora, simulamos la verificación
|
|
29
|
+
const latestVersion = await this.fetchLatestVersion(registry, timeout);
|
|
30
|
+
|
|
31
|
+
if (!latestVersion) {
|
|
32
|
+
return {
|
|
33
|
+
hasUpdate: false,
|
|
34
|
+
currentVersion: this.currentVersion,
|
|
35
|
+
latestVersion: this.currentVersion,
|
|
36
|
+
updateAvailable: false,
|
|
37
|
+
error: 'No se pudo obtener información de versión'
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const hasUpdate = semver.gt(latestVersion, this.currentVersion);
|
|
42
|
+
const changeType = versionManager.getChangeType(this.currentVersion, latestVersion);
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
hasUpdate,
|
|
46
|
+
currentVersion: this.currentVersion,
|
|
47
|
+
latestVersion,
|
|
48
|
+
updateAvailable: hasUpdate,
|
|
49
|
+
changeType,
|
|
50
|
+
severity: this.getUpdateSeverity(changeType),
|
|
51
|
+
releaseNotes: await this.getReleaseNotes(latestVersion)
|
|
52
|
+
};
|
|
53
|
+
} catch (error) {
|
|
54
|
+
return {
|
|
55
|
+
hasUpdate: false,
|
|
56
|
+
currentVersion: this.currentVersion,
|
|
57
|
+
latestVersion: this.currentVersion,
|
|
58
|
+
updateAvailable: false,
|
|
59
|
+
error: error.message
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Obtiene la última versión disponible
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
async fetchLatestVersion(registry, timeout) {
|
|
69
|
+
// Simulación - en producción haría fetch real al registro
|
|
70
|
+
// const url = `${registry}/${versionManager.packageName}/latest`;
|
|
71
|
+
|
|
72
|
+
// Por ahora retornamos la versión actual
|
|
73
|
+
return this.currentVersion;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Obtiene las notas de lanzamiento de una versión
|
|
78
|
+
* @private
|
|
79
|
+
*/
|
|
80
|
+
async getReleaseNotes(version) {
|
|
81
|
+
// En producción, esto obtendría las notas reales del changelog o GitHub releases
|
|
82
|
+
return {
|
|
83
|
+
version,
|
|
84
|
+
date: new Date().toISOString(),
|
|
85
|
+
notes: 'Consulta CHANGELOG.md para detalles completos',
|
|
86
|
+
breaking: [],
|
|
87
|
+
features: [],
|
|
88
|
+
fixes: []
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Determina la severidad de la actualización
|
|
94
|
+
* @private
|
|
95
|
+
*/
|
|
96
|
+
getUpdateSeverity(changeType) {
|
|
97
|
+
const severities = {
|
|
98
|
+
'major': 'critical', // Breaking changes
|
|
99
|
+
'minor': 'important', // New features
|
|
100
|
+
'patch': 'low', // Bug fixes
|
|
101
|
+
'none': 'none'
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return severities[changeType] || 'none';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Verifica si debe realizar check de actualización
|
|
109
|
+
* @param {Date} lastCheck - Última vez que se verificó
|
|
110
|
+
*/
|
|
111
|
+
shouldCheckForUpdates(lastCheck) {
|
|
112
|
+
if (!lastCheck) return true;
|
|
113
|
+
|
|
114
|
+
const now = new Date();
|
|
115
|
+
const timeSinceLastCheck = now - new Date(lastCheck);
|
|
116
|
+
|
|
117
|
+
return timeSinceLastCheck >= this.updateCheckInterval;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Genera mensaje de actualización para el usuario
|
|
122
|
+
*/
|
|
123
|
+
async generateUpdateMessage() {
|
|
124
|
+
const updateInfo = await this.checkForUpdates();
|
|
125
|
+
|
|
126
|
+
if (!updateInfo.hasUpdate) {
|
|
127
|
+
return {
|
|
128
|
+
hasMessage: false,
|
|
129
|
+
message: '',
|
|
130
|
+
type: 'info'
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const messages = {
|
|
135
|
+
'critical': `🚨 ACTUALIZACIÓN CRÍTICA DISPONIBLE: v${updateInfo.latestVersion}\n` +
|
|
136
|
+
` Versión actual: v${updateInfo.currentVersion}\n` +
|
|
137
|
+
` Esta actualización incluye cambios importantes (breaking changes).\n` +
|
|
138
|
+
` Actualiza con: npm install -g awc-zns-mtd@latest`,
|
|
139
|
+
|
|
140
|
+
'important': `⚡ Nueva versión disponible: v${updateInfo.latestVersion}\n` +
|
|
141
|
+
` Versión actual: v${updateInfo.currentVersion}\n` +
|
|
142
|
+
` Incluye nuevas funcionalidades.\n` +
|
|
143
|
+
` Actualiza con: npm install -g awc-zns-mtd@latest`,
|
|
144
|
+
|
|
145
|
+
'low': `💡 Actualización disponible: v${updateInfo.latestVersion}\n` +
|
|
146
|
+
` Versión actual: v${updateInfo.currentVersion}\n` +
|
|
147
|
+
` Incluye correcciones de bugs.\n` +
|
|
148
|
+
` Actualiza con: npm install -g awc-zns-mtd@latest`
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
hasMessage: true,
|
|
153
|
+
message: messages[updateInfo.severity] || messages['low'],
|
|
154
|
+
type: updateInfo.severity,
|
|
155
|
+
updateInfo
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Verifica compatibilidad antes de actualizar
|
|
161
|
+
*/
|
|
162
|
+
async checkUpdateCompatibility(targetVersion) {
|
|
163
|
+
const changeType = versionManager.getChangeType(this.currentVersion, targetVersion);
|
|
164
|
+
|
|
165
|
+
const compatibility = {
|
|
166
|
+
canUpdate: true,
|
|
167
|
+
warnings: [],
|
|
168
|
+
breaking: [],
|
|
169
|
+
recommendations: []
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// Verificar breaking changes en actualizaciones major
|
|
173
|
+
if (changeType === 'major') {
|
|
174
|
+
compatibility.warnings.push(
|
|
175
|
+
'Esta es una actualización major que puede incluir breaking changes'
|
|
176
|
+
);
|
|
177
|
+
compatibility.recommendations.push(
|
|
178
|
+
'Revisa el CHANGELOG.md antes de actualizar',
|
|
179
|
+
'Considera hacer backup de tu configuración actual',
|
|
180
|
+
'Prueba en un entorno de desarrollo primero'
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Verificar compatibilidad de Node.js
|
|
185
|
+
const requiredNode = versionManager.getVersionInfo().compatibility?.minimumNodeVersion;
|
|
186
|
+
if (requiredNode) {
|
|
187
|
+
compatibility.recommendations.push(
|
|
188
|
+
`Asegúrate de tener Node.js ${requiredNode} o superior`
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return compatibility;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Obtiene historial de versiones
|
|
197
|
+
*/
|
|
198
|
+
async getVersionHistory(limit = 10) {
|
|
199
|
+
// En producción, esto consultaría el registro real
|
|
200
|
+
return {
|
|
201
|
+
current: this.currentVersion,
|
|
202
|
+
history: [
|
|
203
|
+
{
|
|
204
|
+
version: '1.0.0',
|
|
205
|
+
date: '2026-01-07',
|
|
206
|
+
type: 'major',
|
|
207
|
+
notes: 'Lanzamiento inicial'
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
total: 1
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Verifica si la versión actual está deprecada
|
|
216
|
+
*/
|
|
217
|
+
async isVersionDeprecated() {
|
|
218
|
+
const updateInfo = await this.checkForUpdates();
|
|
219
|
+
|
|
220
|
+
if (!updateInfo.hasUpdate) return false;
|
|
221
|
+
|
|
222
|
+
// Versión deprecada si hay 2+ major versions de diferencia
|
|
223
|
+
const majorDiff = semver.major(updateInfo.latestVersion) -
|
|
224
|
+
semver.major(this.currentVersion);
|
|
225
|
+
|
|
226
|
+
return majorDiff >= 2;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Singleton instance
|
|
231
|
+
const updateChecker = new UpdateChecker();
|
|
232
|
+
|
|
233
|
+
module.exports = updateChecker;
|
|
234
|
+
module.exports.UpdateChecker = UpdateChecker;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Version Bump Script
|
|
5
|
+
* Script para incrementar versión del proyecto AWC ZNS-MTD
|
|
6
|
+
*
|
|
7
|
+
* Uso:
|
|
8
|
+
* node version-bump.js <major|minor|patch> [--message "mensaje"]
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const fs = require('fs-extra');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const versionManager = require('./version-manager');
|
|
14
|
+
const changelogManager = require('./changelog-manager');
|
|
15
|
+
|
|
16
|
+
async function bumpVersion() {
|
|
17
|
+
// Parsear argumentos
|
|
18
|
+
const args = process.argv.slice(2);
|
|
19
|
+
|
|
20
|
+
if (args.length === 0) {
|
|
21
|
+
console.error('❌ Uso: node version-bump.js <major|minor|patch> [--message "mensaje"]');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const bumpType = args[0];
|
|
26
|
+
const validTypes = ['major', 'minor', 'patch'];
|
|
27
|
+
|
|
28
|
+
if (!validTypes.includes(bumpType)) {
|
|
29
|
+
console.error(`❌ Tipo inválido: ${bumpType}`);
|
|
30
|
+
console.error(` Tipos válidos: ${validTypes.join(', ')}`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Obtener mensaje personalizado si existe
|
|
35
|
+
const messageIndex = args.indexOf('--message');
|
|
36
|
+
const customMessage = messageIndex !== -1 ? args[messageIndex + 1] : null;
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
console.log('🚀 Incrementando versión...\n');
|
|
40
|
+
|
|
41
|
+
// Obtener versión actual
|
|
42
|
+
const currentVersion = versionManager.getCurrentVersion();
|
|
43
|
+
console.log(` Versión actual: ${currentVersion}`);
|
|
44
|
+
|
|
45
|
+
// Calcular nueva versión
|
|
46
|
+
const newVersion = versionManager.incrementVersion(bumpType);
|
|
47
|
+
console.log(` Nueva versión: ${newVersion}`);
|
|
48
|
+
console.log(` Tipo de cambio: ${bumpType}\n`);
|
|
49
|
+
|
|
50
|
+
// Actualizar package.json
|
|
51
|
+
const packageJsonPath = path.join(__dirname, '../../package.json');
|
|
52
|
+
const packageJson = await fs.readJSON(packageJsonPath);
|
|
53
|
+
packageJson.version = newVersion;
|
|
54
|
+
await fs.writeJSON(packageJsonPath, packageJson, { spaces: 2 });
|
|
55
|
+
console.log('✓ package.json actualizado');
|
|
56
|
+
|
|
57
|
+
// Generar entrada de changelog
|
|
58
|
+
const date = new Date().toISOString().split('T')[0];
|
|
59
|
+
const changes = {
|
|
60
|
+
added: [],
|
|
61
|
+
changed: [`Versión incrementada de ${currentVersion} a ${newVersion}`],
|
|
62
|
+
deprecated: [],
|
|
63
|
+
removed: [],
|
|
64
|
+
fixed: [],
|
|
65
|
+
security: []
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
if (customMessage) {
|
|
69
|
+
changes.added.push(customMessage);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
await changelogManager.addVersion(newVersion, date, changes);
|
|
73
|
+
console.log('✓ CHANGELOG.md actualizado');
|
|
74
|
+
|
|
75
|
+
// Resumen
|
|
76
|
+
console.log('\n✅ Versión incrementada exitosamente\n');
|
|
77
|
+
console.log('📋 Próximos pasos:');
|
|
78
|
+
console.log(' 1. Revisa los cambios en CHANGELOG.md');
|
|
79
|
+
console.log(' 2. Commit: git add . && git commit -m "chore: bump version to ' + newVersion + '"');
|
|
80
|
+
console.log(' 3. Tag: git tag -a v' + newVersion + ' -m "Release v' + newVersion + '"');
|
|
81
|
+
console.log(' 4. Push: git push && git push --tags\n');
|
|
82
|
+
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.error('❌ Error al incrementar versión:', error.message);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Ejecutar
|
|
90
|
+
bumpVersion();
|