g360-cli 1.2.2 → 1.3.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/README.md CHANGED
@@ -1,13 +1,15 @@
1
1
  # g360-cli
2
2
 
3
- > CLI tool for bootstrapping G360 ecosystem projects with standardized structure, assets, and best practices.
3
+ > CLI tool for bootstrapping G360 projects with standardized structure, assets, and identity
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/g360-cli)](https://www.npmjs.com/package/g360-cli)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
8
  ## Tabla de Contenidos
9
9
 
10
+ - [Descripción](#descripción)
10
11
  - [Características](#características)
12
+ - [Tecnologías](#tecnologías)
11
13
  - [Instalación](#instalación)
12
14
  - [Inicio Rápido](#inicio-rápido)
13
15
  - [Comandos](#comandos)
@@ -16,8 +18,34 @@
16
18
  - [Skills](#skills)
17
19
  - [Configuración](#configuración)
18
20
  - [API](#api)
21
+ - [Estructura](#estructura)
22
+ - [Scripts](#scripts)
23
+ - [Testing](#testing)
19
24
  - [Contribución](#contribución)
20
25
  - [Licencia](#licencia)
26
+ - [Ecosistema G360](#ecosistema-g360)
27
+
28
+ ---
29
+
30
+ ## Descripción
31
+
32
+ CLI tool para el ecosistema G360 que permite inicializar proyectos con estructura estándar, gestionar assets embebidos, y asegurar compliance mediante auditoría automática. Forma parte del núcleo del ecosistema y está disponible como paquete global de npm.
33
+
34
+ **Tipo**: CLI Tool / Scaffolding / Generator
35
+ **Plataforma**: Node.js >= 18.0.0
36
+ **Distribución**: npm global (`npm install -g g360-cli`)
37
+
38
+ ---
39
+
40
+ ## Tecnologías
41
+
42
+ - **Runtime**: Node.js >= 18.0.0
43
+ - **Lenguaje**: JavaScript (ESModules)
44
+ - **CLI Framework**: Commander 11.1.0
45
+ - **UI**: Chalk 5.3.0 (colores), Ora 7.0.1 (spinners), Inquirer 9.2.15 (prompts)
46
+ - **Filesystem**: fs-extra 11.2.0
47
+ - **Build**: pkg 5.8.1 (portable .exe)
48
+ - **Distribución**: npm global
21
49
 
22
50
  ---
23
51
 
@@ -627,6 +655,48 @@ await g360.clean({ path: '.', force: true });
627
655
 
628
656
  ---
629
657
 
658
+ ## Estructura
659
+
660
+ ```
661
+ g360-cli/
662
+ ├── src/
663
+ │ ├── cli.js # Entrada principal CLI
664
+ │ ├── commands/ # Comandos (init, bring, audit, etc.)
665
+ │ ├── lib/ # Utilidades (assets, auditor, config)
666
+ │ └── assets/ # Assets embebidos
667
+ │ ├── templates/ # Plantillas de proyecto
668
+ │ ├── components/ # Componentes G360
669
+ │ ├── skills/ # Skills de identidad
670
+ │ ├── engine/ # G360 Engine
671
+ │ └── config/ # Configuraciones
672
+ ├── package.json
673
+ ├── README.md
674
+ └── LICENSE
675
+ ```
676
+
677
+ ---
678
+
679
+ ## Scripts
680
+
681
+ | Comando | Descripción |
682
+ |---------|-------------|
683
+ | `npm run build` | Build portable con pkg (g360.exe) |
684
+ | `npm run build:portable` | Especificar target node18-win-x64 |
685
+ | `npm test` | Ejecutar tests (actualmente placeholder) |
686
+ | `npm run prepublishOnly` | Validación antes de publicar en npm |
687
+
688
+ ---
689
+
690
+ ## Testing
691
+
692
+ ```bash
693
+ npm test
694
+ ```
695
+
696
+ Actualmente configurado con un placeholder. Próximamente se integrará con Vitest para testing de comandos y utilidades.
697
+
698
+ ---
699
+
630
700
  ## Contribución
631
701
 
632
702
  1. Fork el repositorio
@@ -643,9 +713,36 @@ MIT License - ver [LICENSE](LICENSE) para más detalles.
643
713
 
644
714
  ---
645
715
 
716
+ ## Ecosistema G360
717
+
718
+ Este proyecto forma parte de la familia de microherramientas **G360** para apoyo CRM y gestión de datos en escritorio, enfocadas en áreas como ventas, finanzas y logística.
719
+
720
+ ### Identidad Visual G360
721
+
722
+ - **Isotipo**: 3 puntos verticales paralelos (gris-verde-gris) + chevron `>`
723
+ - **Colores**: #00d084 (verde), #94a3b8 (gris)
724
+ - **Marca**: G360 - Microherramientas para apoyo CRM y datos en escritorio
725
+ - **Implementación**: Usar `g360-signature` para branding consistente
726
+
727
+ ### Herramientas Relacionadas
728
+
729
+ - **[g360-signature](https://github.com/carloscus/g360-signature)**: Web component de branding G360
730
+ - **[g360-order-xlsx](https://github.com/carloscus/g360-order-xlsx)**: Procesador de cotizaciones Excel
731
+ - **[g360-day-calculator](https://github.com/carloscus/g360-day-calculator)**: Calculadora de días laborables
732
+ - **[g360-master-data](https://github.com/carloscus/g360-master-data)**: Gestión de datos maestros
733
+
734
+ ---
735
+
646
736
  ## Enlaces
647
737
 
648
738
  - [npm](https://www.npmjs.com/package/g360-cli)
649
739
  - [GitHub](https://github.com/carloscus/g360-cli)
650
740
  - [Documentación](#)
651
741
  - [Reportar Issue](https://github.com/carloscus/g360-cli/issues)
742
+
743
+ ---
744
+ **Marca**: G360
745
+ **Isotipo**: 3 puntos verticales paralelos (gris-verde-gris) + chevron `>`
746
+ **Autor**: Carlos Cusi
747
+ **Desarrollo**: Con asistencia de herramientas de código IA (Vibe Code)
748
+ **Powered by**: [g360-signature](https://github.com/carloscus/g360-signature)
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "g360-cli",
3
- "version": "1.2.2",
4
- "description": "CLI tool for bootstrapping G360 ecosystem projects",
3
+ "version": "1.3.0",
4
+ "description": "CLI tool for bootstrapping G360 projects with standardized structure, assets, and identity",
5
5
  "type": "module",
6
6
  "main": "src/cli.js",
7
7
  "bin": {
8
- "g360": "./src/cli.js"
8
+ "g360": "src/cli.js"
9
9
  },
10
10
  "scripts": {
11
11
  "prepublishOnly": "node -e \"console.log('Use: npm install -g g360-cli')\"",
package/src/cli.js CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  import { Command } from 'commander';
4
4
  import chalk from 'chalk';
5
+ import fs from 'fs-extra';
6
+ import path from 'path';
7
+ import { fileURLToPath } from 'url';
5
8
  import { init } from './commands/init.js';
6
9
  import { setSkill } from './commands/set-skill.js';
7
10
  import { bring } from './commands/bring.js';
@@ -14,12 +17,15 @@ import { update } from './commands/update.js';
14
17
  import { convert } from './commands/convert.js';
15
18
  import { signature } from './commands/signature.js';
16
19
 
20
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
21
+ const pkg = fs.readJsonSync(path.join(__dirname, '../package.json'));
22
+
17
23
  const program = new Command();
18
24
 
19
25
  program
20
26
  .name('g360')
21
27
  .description('CLI tool for bootstrapping G360 ecosystem projects')
22
- .version('1.2.2');
28
+ .version(pkg.version);
23
29
 
24
30
  program
25
31
  .command('init')
@@ -55,9 +55,12 @@ export async function init(name, options) {
55
55
  await fs.copy(templateDir, targetDir);
56
56
  await manifest.init(targetDir, { name, template, version: '1.0.0' });
57
57
 
58
- // Aplicar el skill pasando el directorio destino explícitamente
58
+ // Aplicar el skill pasando el directorio destino explícitamente
59
59
  await setSkill(skill, { force: true, verbose: options.verbose, cwd: targetDir });
60
60
 
61
+ // Crear estructura estándar G360 para auditoría y desarrollo guiado
62
+ await createG360Structure(targetDir, templatesPath);
63
+
61
64
  progressBar.stop();
62
65
 
63
66
  console.log(chalk.green('\n✅ Project created successfully!\n'));
@@ -65,8 +68,37 @@ export async function init(name, options) {
65
68
  console.log(` ${chalk.cyan('cd')} ${name}`);
66
69
  console.log(` ${chalk.cyan('g360 bring')}`);
67
70
  console.log(` ${chalk.cyan('g360 present')}\n`);
68
- } catch (error) {
71
+ } catch (error) {
69
72
  progressBar.stop();
70
73
  console.error(chalk.red(`\n❌ Error: ${error.message}`));
71
74
  }
72
75
  }
76
+
77
+ async function createG360Structure(projectPath, assetsDir) {
78
+ try {
79
+ const g360Dir = path.join(projectPath, 'g360');
80
+ await fs.ensureDir(g360Dir);
81
+
82
+ const subdirs = ['skills', 'snippets', 'samples', 'config', 'engine'];
83
+ for (const dir of subdirs) {
84
+ await fs.ensureDir(path.join(g360Dir, dir));
85
+ }
86
+
87
+ const skillJsonPath = path.join(g360Dir, 'skill.json');
88
+ if (!fs.existsSync(skillJsonPath)) {
89
+ const exampleSkillPath = path.join(assetsDir, 'config/skills.json');
90
+ if (fs.existsSync(exampleSkillPath)) {
91
+ await fs.copy(exampleSkillPath, skillJsonPath);
92
+ }
93
+ }
94
+
95
+ const snippetsDir = path.join(g360Dir, 'snippets');
96
+ const exampleSnippetsPath = path.join(assetsDir, 'snippets/snippets.json');
97
+ if (fs.existsSync(exampleSnippetsPath) && !fs.existsSync(path.join(snippetsDir, 'snippets.json'))) {
98
+ await fs.copy(exampleSnippetsPath, path.join(snippetsDir, 'snippets.json'));
99
+ }
100
+
101
+ } catch (error) {
102
+ console.log(chalk.yellow(`Warning: Could not create G360 structure: ${error.message}`));
103
+ }
104
+ }
@@ -46,7 +46,25 @@ export const auditor = {
46
46
  if (fs.existsSync(manifestPath)) {
47
47
  return { status: 'pass', details: 'Manifest found' };
48
48
  }
49
- return { status: 'warn', issue: { file: 'g360-manifest.json', message: 'No manifest found' } };
49
+
50
+ const pkgPath = path.join(projectDir, 'package.json');
51
+ if (fs.existsSync(pkgPath)) {
52
+ try {
53
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
54
+ const isG360Tool =
55
+ pkg.name?.startsWith('g360-') ||
56
+ (pkg.keywords && pkg.keywords.some(k => k.includes('g360'))) ||
57
+ pkg.name === 'g360-cli';
58
+
59
+ if (isG360Tool) {
60
+ return { status: 'pass', details: 'G360 tool/package - manifest optional' };
61
+ }
62
+ } catch (e) {
63
+ // Continue to warning
64
+ }
65
+ }
66
+
67
+ return { status: 'warn', issue: { file: 'g360-manifest.json', message: 'No manifest found - run "g360 bring" to initialize' } };
50
68
  },
51
69
 
52
70
  checkStructure(projectDir) {
@@ -54,7 +72,26 @@ export const auditor = {
54
72
  if (fs.existsSync(g360Dir)) {
55
73
  return { status: 'pass', details: 'G360 assets directory found' };
56
74
  }
57
- return { status: 'warn', issue: { file: 'g360/', message: 'No G360 assets found' } };
75
+
76
+ // Check if this is a G360 tool/package - structure optional
77
+ const pkgPath = path.join(projectDir, 'package.json');
78
+ if (fs.existsSync(pkgPath)) {
79
+ try {
80
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
81
+ const isG360Tool =
82
+ pkg.name?.startsWith('g360-') ||
83
+ (pkg.keywords && pkg.keywords.some(k => k.includes('g360'))) ||
84
+ pkg.name === 'g360-cli';
85
+
86
+ if (isG360Tool) {
87
+ return { status: 'pass', details: 'G360 tool/package - G360 structure optional' };
88
+ }
89
+ } catch (e) {
90
+ // If package.json is invalid, continue to warning
91
+ }
92
+ }
93
+
94
+ return { status: 'warn', issue: { file: 'g360/', message: 'No G360 assets found - run "g360 bring" to initialize assets' } };
58
95
  },
59
96
 
60
97
  checkConfig(projectDir) {