g360-cli 1.2.2 → 1.4.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.
Files changed (30) hide show
  1. package/README.md +182 -3
  2. package/dist/g360.exe +0 -0
  3. package/package.json +8 -8
  4. package/src/assets/config/g360-skills.json +52 -0
  5. package/src/assets/config/project-types.json +16 -0
  6. package/src/assets/config/skills.json +12 -0
  7. package/src/assets/snippets/snippets.json +77 -0
  8. package/src/assets/templates/python-cli/build-portable.bat +33 -0
  9. package/src/assets/templates/python-cli/src/main.py +107 -3
  10. package/src/assets/templates/python-customtkinter/README.md +47 -0
  11. package/src/assets/templates/python-customtkinter/build-portable.bat +28 -0
  12. package/src/assets/templates/python-customtkinter/requirements.txt +1 -0
  13. package/src/assets/templates/python-customtkinter/run.bat +29 -0
  14. package/src/assets/templates/python-customtkinter/src/core/skill.json +22 -0
  15. package/src/assets/templates/python-customtkinter/src/main.py +123 -0
  16. package/src/assets/templates/python-flet/README.md +130 -0
  17. package/src/assets/templates/python-flet/build-portable.bat +42 -0
  18. package/src/assets/templates/python-flet/create_shortcut.vbs +35 -0
  19. package/src/assets/templates/python-flet/requirements.txt +3 -0
  20. package/src/assets/templates/python-flet/run.bat +81 -0
  21. package/src/assets/templates/python-flet/src/core/skill.json +21 -0
  22. package/src/assets/templates/python-flet/src/main.py +101 -0
  23. package/src/assets/templates/python-flet/src/test_app.py +103 -0
  24. package/src/assets/templates/python-flet-migrate/src/main.py +68 -0
  25. package/src/assets/templates/python-flet-migrate/src/migrate_tkinter.py +56 -0
  26. package/src/cli.js +12 -2
  27. package/src/commands/clean.js +51 -4
  28. package/src/commands/init.js +92 -8
  29. package/src/commands/signature.js +12 -8
  30. package/src/lib/auditor.js +39 -2
@@ -0,0 +1,28 @@
1
+ @echo off
2
+ chcp 65001 >nul
3
+ title G360 - Portable CustomTkinter
4
+
5
+ echo.
6
+ echo ==============================================
7
+ echo G360 CustomTkinter - Portable
8
+ echo (Requires Python installed)
9
+ echo ==============================================
10
+ echo.
11
+
12
+ python --version >nul 2>&1
13
+ if errorlevel 1 (
14
+ echo ERROR: Python no encontrado
15
+ pause
16
+ exit /b 1
17
+ )
18
+
19
+ pip show customtkinter >nul 2>&1
20
+ if errorlevel 1 (
21
+ pip install customtkinter
22
+ )
23
+
24
+ echo.
25
+ echo Ejecutando G360 App...
26
+ python src\main.py
27
+
28
+ pause
@@ -0,0 +1 @@
1
+ customtkinter>=5.2.0
@@ -0,0 +1,29 @@
1
+ @echo off
2
+ chcp 65001 >nul
3
+ title G360 - CustomTkinter App
4
+
5
+ echo.
6
+ echo ==============================================
7
+ echo G360 CustomTkinter Application
8
+ echo ==============================================
9
+ echo.
10
+
11
+ python --version >nul 2>&1
12
+ if errorlevel 1 (
13
+ echo ERROR: Python no encontrado
14
+ pause
15
+ exit /b 1
16
+ )
17
+
18
+ echo Verificando customtkinter...
19
+ pip show customtkinter >nul 2>&1
20
+ if errorlevel 1 (
21
+ echo Instalando customtkinter...
22
+ pip install customtkinter
23
+ )
24
+
25
+ echo.
26
+ echo Ejecutando aplicacion...
27
+ python src\main.py
28
+
29
+ pause
@@ -0,0 +1,22 @@
1
+ {
2
+ "skill": "moderno",
3
+ "device": "pc",
4
+ "version": "1.0.0",
5
+ "colors": {
6
+ "bg": "#0b1220",
7
+ "surface": "#1a2332",
8
+ "accent": "#00d084",
9
+ "text": "#f0f4f8",
10
+ "muted": "#94a3b8"
11
+ },
12
+ "effects": {
13
+ "glassmorphism": false,
14
+ "rounded": "12px"
15
+ },
16
+ "signature": {
17
+ "mode": "own",
18
+ "text": "G360 Desktop"
19
+ },
20
+ "framework": "customtkinter",
21
+ "portable": true
22
+ }
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ G360 CustomTkinter Desktop Application
4
+ Modern GUI with G360 theme
5
+ """
6
+
7
+ import customtkinter as ctk
8
+ from pathlib import Path
9
+ import json
10
+
11
+
12
+ VERSION = "1.0.0"
13
+ APP_NAME = "G360 Desktop"
14
+
15
+
16
+ def load_skill():
17
+ skill_path = Path(__file__).parent / "core" / "skill.json"
18
+ if skill_path.exists():
19
+ with open(skill_path) as f:
20
+ return json.load(f)
21
+ return {
22
+ "colors": {
23
+ "bg": "#0b1220",
24
+ "surface": "#1a2332",
25
+ "accent": "#00d084"
26
+ }
27
+ }
28
+
29
+
30
+ class G360App(ctk.CTk):
31
+ def __init__(self):
32
+ super().__init__()
33
+
34
+ skill = load_skill()
35
+ colors = skill.get("colors", {})
36
+
37
+ ctk.set_appearance_mode("dark")
38
+ ctk.set_default_color_theme("green")
39
+
40
+ self.title(APP_NAME)
41
+ self.geometry("800x600")
42
+ self.configure(fg_color=colors.get("bg", "#0b1220"))
43
+
44
+ self.grid_columnconfigure(0, weight=1)
45
+ self.grid_rowconfigure(0, weight=1)
46
+
47
+ self.create_header(colors)
48
+ self.create_content(colors)
49
+ self.create_footer()
50
+
51
+ def create_header(self, colors):
52
+ self.header = ctk.CTkFrame(self, fg_color=colors.get("surface", "#1a2332"))
53
+ self.header.grid(row=0, column=0, sticky="ew", padx=10, pady=10)
54
+
55
+ title = ctk.CTkLabel(
56
+ self.header,
57
+ text=f"{APP_NAME} v{VERSION}",
58
+ font=("Segoe UI", 20, "bold"),
59
+ text_color=colors.get("accent", "#00d084")
60
+ )
61
+ title.pack(side="left", padx=20, pady=10)
62
+
63
+ btn_settings = ctk.CTkButton(
64
+ self.header,
65
+ text="Settings",
66
+ fg_color="transparent",
67
+ border_width=1,
68
+ border_color=colors.get("accent", "#00d084"),
69
+ text_color=colors.get("accent", "#00d084")
70
+ )
71
+ btn_settings.pack(side="right", padx=20)
72
+
73
+ def create_content(self, colors):
74
+ self.content = ctk.CTkFrame(self, fg_color="transparent")
75
+ self.content.grid(row=1, column=0, sticky="nsew", padx=20, pady=10)
76
+
77
+ self.content.grid_columnconfigure(0, weight=1)
78
+ self.content.grid_rowconfigure(0, weight=1)
79
+
80
+ card = ctk.CTkFrame(
81
+ self.content,
82
+ fg_color=colors.get("surface", "#1a2332"),
83
+ corner_radius=12
84
+ )
85
+ card.grid(row=0, column=0, sticky="nsew", padx=10, pady=10)
86
+
87
+ label = ctk.CTkLabel(
88
+ card,
89
+ text="G360 Application\nReady to build",
90
+ font=("Segoe UI", 16),
91
+ text_color="#f0f4f8"
92
+ )
93
+ label.pack(pady=40)
94
+
95
+ btn_primary = ctk.CTkButton(
96
+ card,
97
+ text="Start",
98
+ fg_color=colors.get("accent", "#00d084"),
99
+ text_color="#0b1220",
100
+ hover_color="#00b070"
101
+ )
102
+ btn_primary.pack(pady=20)
103
+
104
+ def create_footer(self):
105
+ self.footer = ctk.CTkFrame(self, fg_color="transparent")
106
+ self.footer.grid(row=2, column=0, sticky="ew", padx=10, pady=(0, 10))
107
+
108
+ status = ctk.CTkLabel(
109
+ self.footer,
110
+ text="G360 Desktop App",
111
+ text_color="#94a3b8",
112
+ font=("Segoe UI", 12)
113
+ )
114
+ status.pack(side="left", padx=20)
115
+
116
+
117
+ def main():
118
+ app = G360App()
119
+ app.mainloop()
120
+
121
+
122
+ if __name__ == "__main__":
123
+ main()
@@ -0,0 +1,130 @@
1
+ # G360 Python Flet Desktop App
2
+
3
+ ## Estructura del Proyecto
4
+
5
+ ```
6
+ mi-proyecto/
7
+ ├── src/
8
+ │ ├── main.py # Punto de entrada
9
+ │ ├── test_app.py # Tests con pytest
10
+ │ └── core/
11
+ │ └── skill.json # Configuración del skill
12
+ ├── assets/
13
+ │ └── images/
14
+ │ └── app.ico # Icono de la app
15
+ ├── portable/
16
+ │ ├── build.bat # Build portable EXE (sin Python)
17
+ │ └── run.bat # Run con Python (del sistema o UV)
18
+ ├── g360-nc-sustentor-portable/ # Copia para distribución
19
+ ├── g360/
20
+ │ └── (estructura G360)
21
+ ├── requirements.txt
22
+ ├── create_shortcut.vbs # Crear acceso directo
23
+ └── README.md
24
+ ```
25
+
26
+ ## Instalación
27
+
28
+ ```bash
29
+ pip install -r requirements.txt
30
+ ```
31
+
32
+ ## Desarrollo
33
+
34
+ ```bash
35
+ python src/main.py
36
+ ```
37
+
38
+ ## Tests
39
+
40
+ ```bash
41
+ pytest src/test_app.py -v
42
+ pytest src/test_app.py --cov=src --cov-report=html
43
+ ```
44
+
45
+ ## Dos Modalidades de Portable
46
+
47
+ ### Modalidad 1: Con Python (run.bat)
48
+ Para PCs que tienen Python instalado o pueden instalarlo:
49
+
50
+ ```bash
51
+ run.bat
52
+ ```
53
+
54
+ Esto:
55
+ 1. Detecta si hay Python en el sistema
56
+ 2. Si no hay, instala UV (gestor rápido)
57
+ 3. UV instala Python 3.10
58
+ 4. Crea entorno virtual
59
+ 5. Instala dependencias
60
+ 6. Crea acceso directo en escritorio
61
+ 7. Ejecuta la app
62
+
63
+ ### Modalidad 2: Sin Python (build-portable.bat)
64
+ Para PCs que NO tienen Python - genera ejecutable standalone:
65
+
66
+ ```bash
67
+ cd portable
68
+ build.bat
69
+ ```
70
+
71
+ Esto genera: `dist/G360App-Portable.exe`
72
+
73
+ El EXE funciona en cualquier PC con Windows sin necesidad de Python.
74
+
75
+ ## Distribución a Clientes
76
+
77
+ 1. **Genera el portable EXE**:
78
+ ```bash
79
+ portable\build.bat
80
+ ```
81
+
82
+ 2. **Copia la estructura**:
83
+ - Copia todo el proyecto a una carpeta `g360-nc-sustentor-portable`
84
+ - O simplemente entrega el EXE de `dist/`
85
+
86
+ 3. **Entrega al cliente**:
87
+ - Solo necesita ejecutar `run.bat` (si tiene Python)
88
+ - O el `G360App-Portable.exe` (si no tiene Python)
89
+
90
+ ## Lineamientos para el Agente Python
91
+
92
+ ### Para resolver problemas:
93
+ 1. Primero ejecuta los tests: `pytest src/test_app.py -v`
94
+ 2. Identifica el test que falla
95
+ 3. Reproduce el problema en el código
96
+ 4. Implementa la solución
97
+ 5. Verifica con tests
98
+
99
+ ### Para cálculos y procesamiento:
100
+ 1. Usa la clase TestCalculations en test_app.py
101
+ 2. Agrega nuevos tests para funciones de cálculo
102
+ 3. Ejecuta: `pytest src/test_app.py::TestCalculations -v`
103
+
104
+ ### Antes de subir a GitHub:
105
+ ```bash
106
+ g360 clean . --github
107
+ ```
108
+ Esto actualiza el .gitignore y prepara el repo para remoto.
109
+
110
+ ## Skills Disponibles
111
+
112
+ - `flet-desktop` - Estilo G360 moderno para desktop
113
+ - `flet-desktop-corporativo` - Estilo corporativo
114
+
115
+ ## Snippets Flet
116
+
117
+ Usa los snippets de G360 para componentes rápidos:
118
+ - `flet-page` - Configuración de página
119
+ - `flet-card` - Tarjetas con estilo G360
120
+ - `flet-button` - Botones G360
121
+ - `flet-datatable` - Tablas de datos
122
+ - `flet-dialog` - Diálogos modales
123
+ - `flet-chart-bar` - Gráficos de barras
124
+
125
+ ## Notas del build portable
126
+
127
+ - El ejecutable incluye todo el runtime de Python
128
+ - Tamaño aproximado: 30-50 MB
129
+ - Funciona en Windows 10/11 sin dependencias
130
+ - El icono se puede personalizar en `assets/images/app.ico`
@@ -0,0 +1,42 @@
1
+ @echo off
2
+ chcp 65001 >nul
3
+ title G360 - Portable Flet App
4
+
5
+ echo.
6
+ echo ==============================================
7
+ echo G360 Flet - Portable Version
8
+ echo (Requires Python + flet installed)
9
+ echo ==============================================
10
+ echo.
11
+
12
+ python --version >nul 2>&1
13
+ if errorlevel 1 (
14
+ echo ERROR: Python no encontrado
15
+ echo Instala Python desde: https://python.org
16
+ pause
17
+ exit /b 1
18
+ )
19
+
20
+ echo Verificando flet...
21
+ pip show flet >nul 2>&1
22
+ if errorlevel 1 (
23
+ echo Flet no encontrado. Instalando...
24
+ pip install flet
25
+ if errorlevel 1 (
26
+ echo ERROR: No se pudo instalar flet
27
+ pause
28
+ exit /b 1
29
+ )
30
+ )
31
+
32
+ if not exist "src\main.py" (
33
+ echo ERROR: src\main.py no encontrado
34
+ pause
35
+ exit /b 1
36
+ )
37
+
38
+ echo.
39
+ echo Ejecutando G360 Flet App...
40
+ python src\main.py %*
41
+
42
+ pause
@@ -0,0 +1,35 @@
1
+ Set objShell = CreateObject("WScript.Shell")
2
+ Set objFSO = CreateObject("Scripting.FileSystemObject")
3
+
4
+ strCurrentPath = objFSO.GetParentFolderName(WScript.ScriptFullName)
5
+ strDesktop = objShell.SpecialFolders("Desktop")
6
+
7
+ strExePath = strCurrentPath & "\dist\G360App-Portable.exe"
8
+ strBatPath = strCurrentPath & "\run.bat"
9
+ strIconPath = strCurrentPath & "\assets\images\app.ico"
10
+
11
+ targetPath = strExePath
12
+ if not objFSO.FileExists(strExePath) Then
13
+ targetPath = strBatPath
14
+ End If
15
+
16
+ appName = "G360 App"
17
+
18
+ If objFSO.FileExists(strDesktop & "\" & appName & ".lnk") Then
19
+ objFSO.DeleteFile strDesktop & "\" & appName & ".lnk", True
20
+ End If
21
+
22
+ Set objShortcut = objShell.CreateShortcut(strDesktop & "\" & appName & ".lnk")
23
+ objShortcut.TargetPath = targetPath
24
+ objShortcut.WorkingDirectory = strCurrentPath
25
+ objShortcut.Description = "G360 Desktop Application"
26
+
27
+ If objFSO.FileExists(strIconPath) Then
28
+ objShortcut.IconLocation = strIconPath & ", 0"
29
+ Else
30
+ objShortcut.IconLocation = "%SystemRoot%\system32\shell32.dll, 15"
31
+ End If
32
+
33
+ objShortcut.Save
34
+
35
+ objShell.Run "ie4uinit.exe -show", 0, True
@@ -0,0 +1,3 @@
1
+ flet>=0.21.0
2
+ pytest>=7.0.0
3
+ pytest-cov>=4.0.0
@@ -0,0 +1,81 @@
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+ chcp 65001 >nul
4
+ title G360 App
5
+ cd /d "%~dp0"
6
+
7
+ echo.
8
+ echo ==============================================
9
+ echo G360 - Running Application
10
+ echo ==============================================
11
+ echo.
12
+
13
+ REM --------------------------
14
+ REM VERIFICAR PYTHON (usando UV)
15
+ REM --------------------------
16
+ echo [1/4] Verificando entorno...
17
+
18
+ where python >nul 2>&1
19
+ if not errorlevel 1 (
20
+ echo Python encontrado, usando instalacion del sistema
21
+ goto :run_app
22
+ )
23
+
24
+ where uv >nul 2>&1
25
+ if not errorlevel 1 (
26
+ echo UV encontrado, instalando Python...
27
+ uv python install 3.10
28
+ goto :run_app
29
+ )
30
+
31
+ echo UV no encontrado, instalando...
32
+ powershell -NoProfile -ExecutionPolicy Bypass -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; irm https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-pc-windows-msvc.zip -OutFile uv.zip"
33
+ tar -xf uv.zip >nul 2>&1
34
+ del uv.zip >nul 2>&1
35
+ set "PATH=%CD%;%PATH%"
36
+ uv python install 3.10
37
+
38
+ :run_app
39
+ REM --------------------------
40
+ REM CREAR ENTORNO VIRTUAL
41
+ REM --------------------------
42
+ echo [2/4] Preparando entorno virtual...
43
+
44
+ if not exist ".venv\Scripts\python.exe" (
45
+ uv venv .venv --python 3.10 --seed 2>nul
46
+ if not exist ".venv\Scripts\python.exe" (
47
+ echo ERROR: No se pudo crear el entorno virtual
48
+ pause
49
+ exit /b
50
+ )
51
+ )
52
+
53
+ REM --------------------------
54
+ REM INSTALAR DEPENDENCIAS
55
+ REM --------------------------
56
+ echo [3/4] Instalando dependencias...
57
+
58
+ call .venv\Scripts\activate.bat
59
+ uv pip install -r requirements.txt >nul 2>&1
60
+
61
+ REM --------------------------
62
+ REM CREAR ACCESO DIRECTO
63
+ REM --------------------------
64
+ echo [4/4] Verificando acceso directo...
65
+
66
+ if exist "%~dp0create_shortcut.vbs" (
67
+ cscript //nologo "%~dp0create_shortcut.vbs" >nul 2>&1
68
+ )
69
+
70
+ REM --------------------------
71
+ REM INICIAR APLICACION
72
+ REM --------------------------
73
+ echo.
74
+ echo ==============================================
75
+ echo Iniciando G360 App...
76
+ echo ==============================================
77
+ echo.
78
+
79
+ start /wait /min pythonw.exe src\main.py
80
+
81
+ exit
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "flet-desktop",
3
+ "description": "G360 Flet Desktop Application",
4
+ "framework": "flet",
5
+ "version": "1.0.0",
6
+ "portable": true,
7
+ "colors": {
8
+ "bg": "#0b1220",
9
+ "surface": "#151e2e",
10
+ "accent": "#00d084",
11
+ "text": "#f0f4f8",
12
+ "muted": "#94a3b8"
13
+ },
14
+ "build": {
15
+ "type": "portable",
16
+ "output": "dist"
17
+ },
18
+ "dependencies": {
19
+ "flet": ">=0.21.0"
20
+ }
21
+ }
@@ -0,0 +1,101 @@
1
+ import flet as ft
2
+ import sys
3
+
4
+
5
+ class G360App:
6
+ def __init__(self, page: ft.Page):
7
+ self.page = page
8
+ self.setup_theme()
9
+ self.create_ui()
10
+
11
+ def setup_theme(self):
12
+ self.page.title = "G360 Desktop App"
13
+ self.page.theme_mode = ft.ThemeMode.DARK
14
+ self.page.padding = 20
15
+ self.page.bgcolor = "#0b1220"
16
+ self.page.window_width = 1200
17
+ self.page.window_height = 800
18
+ self.page.window_resizable = True
19
+ self.page.window_center()
20
+
21
+ def create_ui(self):
22
+ self.page.add(
23
+ ft.Container(
24
+ content=ft.Column([
25
+ self.create_header(),
26
+ self.create_content(),
27
+ ]),
28
+ expand=True,
29
+ spacing=20
30
+ )
31
+ )
32
+
33
+ def create_header(self):
34
+ return ft.Container(
35
+ content=ft.Row([
36
+ ft.Text(
37
+ "G360",
38
+ size=32,
39
+ weight=ft.FontWeight.BOLD,
40
+ color="#00d084"
41
+ ),
42
+ ft.Text(
43
+ "Desktop App",
44
+ size=20,
45
+ color="#94a3b8"
46
+ ),
47
+ ft.Container(expand=True),
48
+ ft.IconButton(
49
+ icon=ft.icons.SETTINGS,
50
+ on_click=self.on_settings
51
+ ),
52
+ ], alignment=ft.MainAxisAlignment.START),
53
+ padding=20,
54
+ bgcolor="#151e2e",
55
+ border_radius=12
56
+ )
57
+
58
+ def create_content(self):
59
+ return ft.Container(
60
+ content=ft.Column([
61
+ ft.Text(
62
+ "Bienvenido a G360 Desktop",
63
+ size=24,
64
+ color="#f0f4f8"
65
+ ),
66
+ ft.Container(height=20),
67
+ ft.Row([
68
+ self.create_card("Usuarios", "Gestión de usuarios", ft.icons.PEOPLE),
69
+ self.create_card("Reportes", "Ver reportes", ft.icons.ANALYTICS),
70
+ self.create_card("Configuración", "Ajustes del sistema", ft.icons.SETTINGS),
71
+ ], spacing=20),
72
+ ], scroll=ft.ScrollMode.AUTO),
73
+ expand=True,
74
+ padding=20
75
+ )
76
+
77
+ def create_card(self, title, subtitle, icon):
78
+ return ft.Container(
79
+ content=ft.Column([
80
+ ft.Icon(icon, size=48, color="#00d084"),
81
+ ft.Text(title, size=18, weight=ft.FontWeight.BOLD, color="#f0f4f8"),
82
+ ft.Text(subtitle, size=14, color="#94a3b8"),
83
+ ], horizontal_alignment=ft.CrossAxisAlignment.CENTER, spacing=10),
84
+ width=200,
85
+ height=180,
86
+ bgcolor="#151e2e",
87
+ border_radius=12,
88
+ padding=20,
89
+ alignment=ft.alignment.center
90
+ )
91
+
92
+ def on_settings(self, e):
93
+ print("Settings clicked")
94
+
95
+
96
+ def main(page: ft.Page):
97
+ G360App(page)
98
+
99
+
100
+ if __name__ == "__main__":
101
+ ft.app(target=main)