awc-zns-mtd 2.5.0 → 2.6.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Comando: new
3
- * Crea un nuevo proyecto con estructura completa AWC ZNS-MTD
3
+ * Crea un nuevo directorio de proyecto con configuración base AWC ZNS-MTD
4
4
  */
5
5
 
6
6
  const fs = require('fs-extra');
@@ -45,38 +45,23 @@ async function newProjectCommand(projectName, options = {}) {
45
45
  process.exit(1);
46
46
  }
47
47
 
48
- // Preguntas de configuración
49
- const answers = await inquirer.prompt([
48
+ // Preguntar responsable del proyecto
49
+ const { responsible, description, gitInit } = await inquirer.prompt([
50
50
  {
51
- type: 'list',
52
- name: 'projectType',
53
- message: '¿Qué tipo de proyecto es?',
54
- choices: [
55
- { name: 'Web Application (Frontend + Backend)', value: 'web' },
56
- { name: 'API/Microservices', value: 'api' },
57
- { name: 'Mobile Application', value: 'mobile' },
58
- { name: 'Enterprise System', value: 'enterprise' },
59
- { name: 'Otro', value: 'other' }
60
- ],
61
- default: options.type
51
+ type: 'input',
52
+ name: 'responsible',
53
+ message: '👤 Responsable del proyecto:',
54
+ validate: (input) => {
55
+ if (!input.trim()) return 'El responsable es requerido';
56
+ return true;
57
+ }
62
58
  },
63
59
  {
64
60
  type: 'input',
65
61
  name: 'description',
66
- message: '📝 Descripción breve del proyecto:',
62
+ message: '📝 Descripción breve (opcional):',
67
63
  default: `Proyecto ${projectName}`
68
64
  },
69
- {
70
- type: 'list',
71
- name: 'teamSize',
72
- message: '👥 Tamaño del equipo:',
73
- choices: [
74
- { name: 'Individual (1 persona)', value: 'solo' },
75
- { name: 'Pequeño (2-5 personas)', value: 'small' },
76
- { name: 'Mediano (6-15 personas)', value: 'medium' },
77
- { name: 'Grande (16+ personas)', value: 'large' }
78
- ]
79
- },
80
65
  {
81
66
  type: 'confirm',
82
67
  name: 'gitInit',
@@ -85,13 +70,231 @@ async function newProjectCommand(projectName, options = {}) {
85
70
  }
86
71
  ]);
87
72
 
88
- const spinner = ora('Creando estructura del proyecto...').start();
73
+ const spinner = ora('Creando estructura base del proyecto...').start();
89
74
 
90
75
  try {
91
76
  // 1. Crear directorio raíz del proyecto
92
77
  await fs.ensureDir(projectPath);
93
78
  spinner.text = `Directorio ${projectName} creado`;
94
79
 
80
+ // 2. Crear estructura base mínima
81
+ const baseDirectories = [
82
+ '.awc/agents',
83
+ '.awc/workflows',
84
+ '.awc/templates',
85
+ 'docs'
86
+ ];
87
+
88
+ for (const dir of baseDirectories) {
89
+ await fs.ensureDir(path.join(projectPath, dir));
90
+ }
91
+ spinner.text = 'Estructura base creada';
92
+
93
+ // 3. Copiar agentes base (4 agentes core)
94
+ const srcAgentsPath = path.join(__dirname, '../../../src/modules/awc-zns-mtd/agents');
95
+ const destAgentsPath = path.join(projectPath, '.awc/agents');
96
+
97
+ if (await fs.pathExists(srcAgentsPath)) {
98
+ await fs.copy(srcAgentsPath, destAgentsPath);
99
+ spinner.text = 'Agentes base copiados';
100
+ }
101
+
102
+ // 4. Copiar agentes especializados (22 agentes)
103
+ const srcCustomAgentsPath = path.join(__dirname, '../../../src/modules/custom-agents/cli/.awc-agents');
104
+ const destCustomAgentsPath = path.join(projectPath, '.awc/agents/specialized');
105
+
106
+ if (await fs.pathExists(srcCustomAgentsPath)) {
107
+ await fs.copy(srcCustomAgentsPath, destCustomAgentsPath);
108
+ spinner.text = 'Agentes especializados copiados';
109
+ }
110
+
111
+ // 5. Copiar workflows
112
+ const srcWorkflowsPath = path.join(__dirname, '../../../src/modules/awc-zns-mtd/workflows');
113
+ const destWorkflowsPath = path.join(projectPath, '.awc/workflows');
114
+
115
+ if (await fs.pathExists(srcWorkflowsPath)) {
116
+ await fs.copy(srcWorkflowsPath, destWorkflowsPath);
117
+ spinner.text = 'Workflows copiados';
118
+ }
119
+
120
+ // 6. Copiar templates
121
+ const srcTemplatesPath = path.join(__dirname, '../../../src/modules/awc-zns-mtd/templates');
122
+ const destTemplatesPath = path.join(projectPath, '.awc/templates');
123
+
124
+ if (await fs.pathExists(srcTemplatesPath)) {
125
+ await fs.copy(srcTemplatesPath, destTemplatesPath);
126
+ spinner.text = 'Templates copiados';
127
+ }
128
+
129
+ // 7. Crear archivo de configuración AWC
130
+ const awcConfig = {
131
+ version: getVersion(),
132
+ createdAt: new Date().toISOString(),
133
+ project: {
134
+ name: projectName,
135
+ description: description,
136
+ responsible: responsible
137
+ },
138
+ projectType: null, // Se definirá con awc init
139
+ initialized: false,
140
+ preferences: {
141
+ communication_language: 'Spanish',
142
+ document_output_language: 'Spanish',
143
+ code_language: 'English'
144
+ },
145
+ workflows: {
146
+ current_phase: null,
147
+ completed_phases: []
148
+ }
149
+ };
150
+
151
+ await fs.writeJson(
152
+ path.join(projectPath, '.awc/config.json'),
153
+ awcConfig,
154
+ { spaces: 2 }
155
+ );
156
+ spinner.text = 'Configuración AWC creada';
157
+
158
+ // 8. Crear README.md del proyecto
159
+ const readme = createReadmeContent(projectName, responsible, description);
160
+ await fs.writeFile(path.join(projectPath, 'README.md'), readme);
161
+ spinner.text = 'README.md creado';
162
+
163
+ // 9. Crear .gitignore
164
+ const gitignore = createGitignoreContent();
165
+ await fs.writeFile(path.join(projectPath, '.gitignore'), gitignore);
166
+ spinner.text = '.gitignore creado';
167
+
168
+ // 10. Crear configuración de VS Code
169
+ await createVSCodeConfig(projectPath, projectName);
170
+ spinner.text = 'Configuración VS Code creada';
171
+
172
+ // 11. Copiar copilot-instructions.md
173
+ const githubDir = path.join(projectPath, '.github');
174
+ await fs.ensureDir(githubDir);
175
+ const templateCopilotPath = path.join(__dirname, '../../../templates/.github/copilot-instructions.md');
176
+ if (await fs.pathExists(templateCopilotPath)) {
177
+ await fs.copy(templateCopilotPath, path.join(githubDir, 'copilot-instructions.md'));
178
+ spinner.text = 'GitHub Copilot instructions creadas';
179
+ }
180
+
181
+ // 12. Crear archivo NEXT_STEPS.md
182
+ const nextSteps = createNextStepsContent(projectName);
183
+ await fs.writeFile(path.join(projectPath, 'NEXT_STEPS.md'), nextSteps);
184
+ spinner.text = 'Guía de próximos pasos creada';
185
+
186
+ // 13. Inicializar Git si se solicitó
187
+ if (gitInit) {
188
+ const { execSync } = require('child_process');
189
+ try {
190
+ execSync('git init', { cwd: projectPath, stdio: 'ignore' });
191
+ execSync('git add .', { cwd: projectPath, stdio: 'ignore' });
192
+ execSync(`git commit -m "feat: Inicializar proyecto ${projectName} con AWC ZNS-MTD"`, {
193
+ cwd: projectPath,
194
+ stdio: 'ignore'
195
+ });
196
+ spinner.text = 'Repositorio Git inicializado';
197
+ } catch (error) {
198
+ // Git no está disponible o fallo, continuar sin git
199
+ }
200
+ }
201
+
202
+ spinner.succeed(chalk.green('✅ Proyecto creado exitosamente'));
203
+
204
+ // Mostrar resumen
205
+ console.log(chalk.cyan('\n' + '═'.repeat(60)));
206
+ console.log(chalk.cyan('📦 Proyecto Creado'));
207
+ console.log(chalk.cyan('═'.repeat(60) + '\n'));
208
+
209
+ console.log(`${chalk.gray('Nombre:')} ${chalk.green(projectName)}`);
210
+ console.log(`${chalk.gray('Responsable:')} ${chalk.yellow(responsible)}`);
211
+ console.log(`${chalk.gray('Ubicación:')} ${chalk.blue(projectPath)}`);
212
+ console.log(`${chalk.gray('AWC Versión:')} ${chalk.yellow(getVersion())}\n`);
213
+
214
+ // Próximos pasos
215
+ console.log(chalk.cyan('📚 Próximos Pasos:\n'));
216
+ console.log(` ${chalk.green('1.')} cd ${projectName}`);
217
+ console.log(` ${chalk.green('2.')} awc init ${chalk.gray('# Inicializar tipo de proyecto')}`);
218
+ console.log(` ${chalk.green('3.')} Leer ${chalk.yellow('NEXT_STEPS.md')} para más detalles\n`);
219
+
220
+ console.log(chalk.yellow('⚠️ La estructura de fases se creará al ejecutar') + chalk.green(' awc init\n'));
221
+
222
+ } catch (error) {
223
+ spinner.fail(chalk.red('❌ Error creando proyecto'));
224
+ throw error;
225
+ }
226
+ }
227
+
228
+ /**
229
+ * Crea el contenido del README.md
230
+ */
231
+ function createReadmeContent(projectName, responsible, description) {
232
+ return `# ${projectName}
233
+
234
+ > ${description}
235
+
236
+ ## 📋 Información del Proyecto
237
+
238
+ - **Responsable**: ${responsible}
239
+ - **Metodología**: AWC ZNS-MTD (Zen, Neutro, Sistemático)
240
+ - **Estado**: Pendiente de inicialización
241
+
242
+ ## 🚀 Próximos Pasos
243
+
244
+ Este proyecto ha sido creado con la estructura base de AWC ZNS-MTD.
245
+
246
+ ### 1. Inicializar Tipo de Proyecto
247
+
248
+ \`\`\`bash
249
+ awc init
250
+ \`\`\`
251
+
252
+ El comando \`awc init\` te preguntará:
253
+ - Tipo de proyecto (auditoría, desarrollo nuevo, migración, etc.)
254
+ - Tecnologías a utilizar
255
+ - Tipo de workflow (quick, standard, enterprise)
256
+
257
+ Basado en tus respuestas, creará automáticamente:
258
+ - ✅ Estructura de directorios por fase
259
+ - ✅ Directorios client-docs específicos
260
+ - ✅ Templates relevantes para tu proyecto
261
+ - ✅ Workflows configurados
262
+
263
+ ### 2. Comenzar a Trabajar
264
+
265
+ Una vez inicializado, seguir las guías en cada fase del proyecto.
266
+
267
+ ## 🔧 Configuración AWC
268
+
269
+ El directorio \`.awc/\` contiene:
270
+
271
+ - \`agents/\` - 4 agentes base + 22 agentes especializados
272
+ - \`workflows/\` - 8 workflows completos
273
+ - \`templates/\` - 7 templates profesionales
274
+ - \`config.json\` - Configuración del proyecto
275
+
276
+ ## 📝 Comandos Disponibles
277
+
278
+ \`\`\`bash
279
+ # Inicializar proyecto (siguiente paso)
280
+ awc init
281
+
282
+ # Ver estado del proyecto
283
+ awc status
284
+
285
+ # Validar estructura
286
+ awc validate
287
+
288
+ # Ver configuración
289
+ awc config
290
+ \`\`\`
291
+
292
+ ---
293
+
294
+ Generado con ❤️ usando AWC ZNS-MTD Method v${getVersion()}
295
+ `;
296
+ }
297
+
95
298
  // 2. Crear estructura estándar de directorios
96
299
  const directories = [
97
300
  // Fase 0: Comercial