g360-cli 1.16.0 → 1.17.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,63 +1,8 @@
1
1
  /**
2
- * Tema G360paleta esmeralda, fuente Inter, fondo oscuro/claro.
3
- * Usa los colores definidos en skill.json del proyecto (fallback a valores G360).
2
+ * Tema basefabrica generica. Wrapper de compat sobre themes/index.js.
4
3
  */
5
- import PptxGenJS from 'pptxgenjs';
6
-
7
- export function createG360Theme() {
8
- const colors = {
9
- accent: '#10B981',
10
- accentDark: '#047857',
11
- success: '#34D399',
12
- warning: '#F59E0B',
13
- error: '#EF4444',
14
- text: '#0F172A',
15
- textLight: '#64748B',
16
- bg: '#FFFFFF',
17
- surface: '#F3F5F9',
18
- border: '#E3E8F0',
19
- darkBg: '#0A0F1E',
20
- darkText: '#F1F5FB',
21
- darkSurface: '#141D33',
22
- };
23
-
24
- // Definir layout A4 vertical para manual (portrait)
25
- const pptx = new PptxGenJS();
26
- pptx.defineLayout({ name: 'A4', width: 10, height: 14.28 }); // A4 portrait en pulgadas
27
- pptx.defineLayout({ name: 'LAYOUT_16x9', width: 10, height: 5.625 });
28
- pptx.defineLayout({ name: 'LAYOUT_4x3', width: 10, height: 7.5 });
29
-
30
- // Usar A4 como default (manual mode)
31
- pptx.layout = 'A4';
32
-
33
- // Theme global
34
- pptx.author = 'g360-cli';
35
- pptx.title = '';
36
- pptx.subject = 'Documentacion generada por g360-cli';
37
-
38
- return {
39
- pptx,
40
- colors,
41
- layout: 'A4',
42
- fonts: ['Inter', 'Arial'],
43
- /**
44
- * Agregar logo de marca a la presentacion
45
- */
46
- setLogo(pptxObj, brand, width = 1.2, height = 0.6) {
47
- const logoPath = brand === 'cipsa'
48
- ? path.join(__dirname, '..', 'brand', 'cipsa', 'logotypes', 'Logo_cipsa_solid.svg')
49
- : path.join(__dirname, '..', 'brand', 'g360', 'logotypes', 'logo-g360-light.svg');
50
- // Nota: SVG no soportado nativamente por PptxGenJS; fallback a PNG
51
- const pngPath = brand === 'cipsa'
52
- ? path.join(__dirname, '..', 'brand', 'cipsa', 'logotypes', 'Logo_cipsa_solid.png')
53
- : path.join(__dirname, '..', 'brand', 'g360', 'logotypes', 'logo-g360-dark.png');
54
- if (require('fs').existsSync(pngPath)) {
55
- return { path: pngPath, width, height };
56
- }
57
- return null;
58
- },
59
- };
60
- }
61
-
62
- import path from 'path';
63
- import fs from 'fs';
4
+ export {
5
+ createTheme,
6
+ createCorporateTheme,
7
+ registerLayouts,
8
+ } from './index.js';
@@ -1,46 +1,4 @@
1
1
  /**
2
- * Tema CIPSA — verde corporativo con logo CIPSA.
2
+ * Tema CIPSA — verde corporativo. Wrapper de compat sobre themes/index.js.
3
3
  */
4
- import PptxGenJS from 'pptxgenjs';
5
- import path from 'path';
6
- import fs from 'fs';
7
-
8
- export function createCipsaTheme() {
9
- const colors = {
10
- accent: '#00d084',
11
- accentDark: '#00796B',
12
- success: '#22c55e',
13
- warning: '#f59e0b',
14
- error: '#ef4444',
15
- text: '#0F172A',
16
- textLight: '#64748B',
17
- bg: '#FFFFFF',
18
- surface: '#F0F9F4',
19
- border: '#CCF0E0',
20
- darkBg: '#0d1117',
21
- darkText: '#f0f6fc',
22
- darkSurface: '#161b22',
23
- };
24
-
25
- const pptx = new PptxGenJS();
26
- pptx.defineLayout({ name: 'A4', width: 10, height: 14.28 });
27
- pptx.defineLayout({ name: 'LAYOUT_16x9', width: 10, height: 5.625 });
28
- pptx.layout = 'A4';
29
-
30
- pptx.author = 'g360-cli';
31
- pptx.title = '';
32
- pptx.subject = 'Documentacion CIPSA generada por g360-cli';
33
-
34
- const cipsaLogo = path.join(process.cwd(), 'assets', 'images', 'Logo_cipsa_solid.png');
35
- const fallbackLogo = fs.existsSync(cipsaLogo)
36
- ? cipsaLogo
37
- : path.join(__dirname, '..', '..', 'brand', 'cipsa', 'logotypes', 'Logo_cipsa_solid.png');
38
-
39
- return {
40
- pptx,
41
- colors,
42
- layout: 'A4',
43
- fonts: ['Inter', 'Arial'],
44
- logo: fs.existsSync(fallbackLogo) ? { path: fallbackLogo, width: 1.5, height: 0.5 } : null,
45
- };
46
- }
4
+ export { createCipsaTheme as default, createCipsaTheme } from './index.js';
@@ -1,32 +1,4 @@
1
1
  /**
2
- * Tema G360 — paleta esmeralda, fuente Inter.
2
+ * Tema G360 — paleta esmeralda. Wrapper de compat sobre themes/index.js.
3
3
  */
4
- import PptxGenJS from 'pptxgenjs';
5
-
6
- const colors = {
7
- accent: '#10B981',
8
- accentDark: '#047857',
9
- success: '#34D399',
10
- warning: '#F59E0B',
11
- error: '#EF4444',
12
- info: '#3B82F6',
13
- violet: '#8B5CF6',
14
- text: '#0F172A',
15
- textLight: '#64748B',
16
- bg: '#FFFFFF',
17
- surface: '#F3F5F9',
18
- border: '#E3E8F0',
19
- };
20
-
21
- export function createG360Theme() {
22
- const pptx = new PptxGenJS();
23
- pptx.defineLayout({ name: 'A4', width: 10, height: 14.28 });
24
- pptx.defineLayout({ name: 'LAYOUT_16x9', width: 10, height: 5.625 });
25
- pptx.layout = 'A4';
26
- pptx.author = 'g360-cli';
27
- pptx.subject = 'Documentacion generada por g360-cli';
28
-
29
- return { pptx, colors, layout: 'A4' };
30
- }
31
-
32
- export { colors };
4
+ export { createG360Theme as default, createG360Theme } from './index.js';
@@ -1,2 +1,87 @@
1
- export { createG360Theme } from './g360.js';
2
- export { createCipsaTheme } from './cipsa.js';
1
+ /**
2
+ * Fabrica de temas G360 para pptxgenjs.
3
+ * Consumen design-tokens.js (fuente unica de verdad de paletas/estilos).
4
+ */
5
+ import PptxGenJS from 'pptxgenjs';
6
+ import path from 'path';
7
+ import fs from 'fs';
8
+ import { fileURLToPath } from 'url';
9
+ import {
10
+ PALETTES,
11
+ TYPO,
12
+ SPACING,
13
+ DEFAULT_LAYOUT,
14
+ resolvePalette,
15
+ } from '../design-tokens.js';
16
+
17
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
18
+
19
+ /** Layout 16:9 registrado por las fabricas de tema */
20
+ export function registerLayouts(pptx) {
21
+ pptx.defineLayout({
22
+ name: DEFAULT_LAYOUT,
23
+ width: SPACING.page.width,
24
+ height: SPACING.page.height,
25
+ });
26
+ pptx.layout = DEFAULT_LAYOUT;
27
+ }
28
+
29
+ /**
30
+ * Crea un tema completo para pptxgenjs.
31
+ * @param {string} name — 'g360' | 'cipsa' | 'corporate'
32
+ */
33
+ export function createTheme(name = 'g360') {
34
+ const colors = resolvePalette(name);
35
+ const pptx = new PptxGenJS();
36
+ registerLayouts(pptx);
37
+
38
+ pptx.author = 'g360-cli';
39
+ pptx.company = name === 'cipsa' ? 'CIPSA' : 'G360';
40
+ pptx.subject = 'Manual de aplicacion generado por g360-cli';
41
+
42
+ return {
43
+ pptx,
44
+ colors,
45
+ typo: TYPO,
46
+ spacing: SPACING,
47
+ layout: DEFAULT_LAYOUT,
48
+ font: TYPO.font,
49
+ fallbackFont: TYPO.fallback,
50
+ name,
51
+ /**
52
+ * Logo de marca (PNG) si existe; null si no.
53
+ */
54
+ logo() {
55
+ const candidates = name === 'cipsa'
56
+ ? [
57
+ path.join(process.cwd(), 'assets', 'images', 'Logo_cipsa_solid.png'),
58
+ path.join(__dirname, '..', 'brand', 'cipsa', 'logotypes', 'Logo_cipsa_solid.png'),
59
+ ]
60
+ : [
61
+ path.join(process.cwd(), 'assets', 'images', 'logo-g360-dark.png'),
62
+ path.join(__dirname, '..', 'brand', 'g360', 'logotypes', 'logo-g360-dark.png'),
63
+ ];
64
+ for (const p of candidates) {
65
+ if (fs.existsSync(p)) return { path: p, w: 1.5, h: 0.5 };
66
+ }
67
+ return null;
68
+ },
69
+ };
70
+ }
71
+
72
+ /** Compat: tema G360 (esmeralda) */
73
+ export function createG360Theme() {
74
+ return createTheme('g360');
75
+ }
76
+
77
+ /** Compat: tema CIPSA (verde corporativo) */
78
+ export function createCipsaTheme() {
79
+ return createTheme('cipsa');
80
+ }
81
+
82
+ /** Compat: tema Corporate (azul marino) */
83
+ export function createCorporateTheme() {
84
+ return createTheme('corporate');
85
+ }
86
+
87
+ export { PALETTES };
@@ -22,7 +22,7 @@ export async function pptx(targetPath, options) {
22
22
  screenshots,
23
23
  } = options;
24
24
 
25
- const targetDir = path.join(process.cwd(), targetPath || '.');
25
+ const targetDir = path.resolve(process.cwd(), targetPath || '.');
26
26
 
27
27
  if (!await fs.pathExists(targetDir)) {
28
28
  console.error(chalk.red(`❌ Directorio no encontrado: ${targetDir}`));
@@ -50,15 +50,16 @@ export async function pptx(targetPath, options) {
50
50
  if (dryRun) {
51
51
  console.log(chalk.yellow('📋 DRY RUN — Outline generado:\n'));
52
52
  console.log(chalk.gray(' [1] Portada'));
53
- console.log(chalk.gray(' [2] Introducción'));
54
- console.log(chalk.gray(' [3] Instalación'));
55
- console.log(chalk.gray(' [4] Dashboard / Inicio'));
53
+ console.log(chalk.gray(' [2] Introducción (¿Qué es?)'));
54
+ console.log(chalk.gray(' [3] Módulos (tabla + capturas)'));
55
+ console.log(chalk.gray(' [4] Flujo de trabajo'));
56
56
  console.log(chalk.gray(' [5-N] Funcionalidades (una por módulo UI detectado)'));
57
57
  console.log(chalk.gray(' [N+1] Flujos de trabajo (modales)'));
58
58
  console.log(chalk.gray(' [N+2] Arquitectura'));
59
59
  console.log(chalk.gray(' [N+3] Buenas prácticas'));
60
- console.log(chalk.gray(' [N+4] Resumen'));
61
- console.log(chalk.gray(`\nTotal estimado: ~${12 + Math.min(6, 20)} slides A4`));
60
+ console.log(chalk.gray(' [N+4] Límites conocidos (si aplica)'));
61
+ console.log(chalk.gray(' [N+5] Resumen'));
62
+ console.log(chalk.gray(`\nFormato: 16:9 widescreen · Theme: ${themeName || detectedBrand}`));
62
63
  return;
63
64
  }
64
65
 
@@ -70,12 +71,13 @@ export async function pptx(targetPath, options) {
70
71
  const pptxPath = await generateManualPptx(appData, {
71
72
  mode,
72
73
  theme: themeName || detectedBrand,
74
+ targetDir: targetDir,
73
75
  outPath: out,
74
76
  });
75
77
 
76
78
  spinner.succeed(chalk.green(`✅ PPTX generado: ${pptxPath}`));
77
79
  console.log(chalk.gray(` Tamaño: ${Math.round((await fs.stat(pptxPath)).size / 1024)} KB`));
78
- console.log(chalk.gray(` Slides: ~12 A4 (modo manual)`));
80
+ console.log(chalk.gray(` Formato: 16:9 widescreen (modo ${mode})`));
79
81
  console.log('');
80
82
  console.log(chalk.cyan(' Siguiente paso:'));
81
83
  console.log(chalk.gray(' Revisar el archivo y reemplazar placeholders de screenshots'));