forgegit 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.
package/lib/templates.cmd CHANGED
@@ -1,79 +1,98 @@
1
- @echo off
2
- REM ============================================================
3
- REM forge-git / lib/templates.cmd
4
- REM Copies templates from templates/ to project root
5
- REM ============================================================
6
-
7
- if "%~1"=="write_gitignore" goto :write_gitignore
8
- if "%~1"=="write_readme" goto :write_readme
9
- if "%~1"=="write_guardar" goto :write_guardar
10
- if "%~1"=="write_subir" goto :write_subir
11
- if "%~1"=="write_snapshots" goto :write_snapshots
12
- if "%~1"=="write_historial" goto :write_historial
13
- if "%~1"=="write_abrir" goto :write_abrir
14
- if "%~1"=="write_auditar" goto :write_auditar
15
- goto :eof
16
-
17
- :write_gitignore
18
- call :copy_template "gitignore.tpl" ".gitignore"
19
- goto :eof
20
-
21
- :write_guardar
22
- call :copy_template "guardar.cmd.tpl" "guardar.cmd"
23
- goto :eof
24
-
25
- :write_subir
26
- call :copy_template "subir.cmd.tpl" "subir.cmd"
27
- goto :eof
28
-
29
- :write_snapshots
30
- call :copy_template "snapshots.cmd.tpl" "snapshots.cmd"
31
- goto :eof
32
-
33
- :write_historial
34
- call :copy_template "historial.cmd.tpl" "historial.cmd"
35
- goto :eof
36
-
37
- :write_abrir
38
- call :copy_template "abrir.cmd.tpl" "abrir.cmd"
39
- goto :eof
40
-
41
- :write_auditar
42
- call :copy_template "auditar.cmd.tpl" "auditar.cmd"
43
- goto :eof
44
-
45
- :write_readme
46
- call :apply_template "readme.md.tpl" "README.md"
47
- goto :eof
48
-
49
- REM ============================================================
50
- REM :copy_template
51
- REM Copies templates/<file> to project root/<dest>
52
- REM ============================================================
53
- :copy_template
54
- set "SRC=%~dp0..\templates\%~1"
55
- set "DST=%~dp0..\%~2"
56
- if not exist "%SRC%" (
57
- echo [X] Template no encontrado: %SRC%
58
- exit /b 1
59
- )
60
- copy /Y "%SRC%" "%DST%" >nul
61
- exit /b 0
62
-
63
- REM ============================================================
64
- REM :apply_template
65
- REM Copies with {{PLACEHOLDER}} substitution
66
- REM ============================================================
67
- :apply_template
68
- set "SRC=%~dp0..\templates\%~1"
69
- set "DST=%~dp0..\%~2"
70
- if not exist "%SRC%" (
71
- echo [X] Template no encontrado: %SRC%
72
- exit /b 1
73
- )
74
- powershell -NoProfile -ExecutionPolicy Bypass -Command ^
75
- "$c = Get-Content -Raw -LiteralPath '%SRC%';" ^
76
- "$c = $c.Replace('{{PROJECT_NAME}}', '%PROJECT_NAME%');" ^
77
- "$c = $c.Replace('{{FG_VERSION}}', '%FG_VERSION%');" ^
78
- "[System.IO.File]::WriteAllText('%DST%', $c, [System.Text.UTF8Encoding]::new($false))"
79
- exit /b 0
1
+ @echo off
2
+ REM ============================================================
3
+ REM forge-git / lib/templates.cmd
4
+ REM Copies templates from templates/ to destinations
5
+ REM ============================================================
6
+
7
+ if "%~1"=="write_gitignore" goto :write_gitignore
8
+ if "%~1"=="write_readme" goto :write_readme
9
+ if "%~1"=="write_forge" goto :write_forge
10
+ if "%~1"=="write_save" goto :write_save
11
+ if "%~1"=="write_push" goto :write_push
12
+ if "%~1"=="write_snapshots" goto :write_snapshots
13
+ if "%~1"=="write_historial" goto :write_historial
14
+ if "%~1"=="write_abrir" goto :write_abrir
15
+ if "%~1"=="write_auditar" goto :write_auditar
16
+ if "%~1"=="write_serve" goto :write_serve
17
+ goto :eof
18
+
19
+ :write_gitignore
20
+ call :copy_root "gitignore.tpl" ".gitignore"
21
+ goto :eof
22
+
23
+ :write_readme
24
+ call :apply_root "readme.md.tpl" "README.md"
25
+ goto :eof
26
+
27
+ :write_forge
28
+ call :copy_root "forge.cmd.tpl" "forge.cmd"
29
+ goto :eof
30
+
31
+ :write_save
32
+ call :copy_cmd "save.cmd.tpl" "save.cmd"
33
+ goto :eof
34
+
35
+ :write_push
36
+ call :copy_cmd "push.cmd.tpl" "push.cmd"
37
+ goto :eof
38
+
39
+ :write_snapshots
40
+ call :copy_cmd "snapshots.cmd.tpl" "snapshots.cmd"
41
+ goto :eof
42
+
43
+ :write_historial
44
+ call :copy_cmd "historial.cmd.tpl" "historial.cmd"
45
+ goto :eof
46
+
47
+ :write_abrir
48
+ call :copy_cmd "abrir.cmd.tpl" "abrir.cmd"
49
+ goto :eof
50
+
51
+ :write_auditar
52
+ call :copy_cmd "auditar.cmd.tpl" "auditar.cmd"
53
+ goto :eof
54
+
55
+ :write_serve
56
+ call :copy_cmd "serve.cmd.tpl" "serve.cmd"
57
+ call :copy_forge_root "serve-static.js" "serve-static.js"
58
+ goto :eof
59
+
60
+ :copy_root
61
+ set "SRC=%~dp0..\templates\%~1"
62
+ set "DST=%~dp0..\..\%~2"
63
+ if not exist "%SRC%" (
64
+ echo [X] Template no encontrado: %SRC%
65
+ exit /b 1
66
+ )
67
+ copy /Y "%SRC%" "%DST%" >nul
68
+ exit /b 0
69
+
70
+ :copy_cmd
71
+ set "SRC=%~dp0..\templates\%~1"
72
+ set "DST=%~dp0..\commands\%~2"
73
+ if not exist "%SRC%" (
74
+ echo [X] Template no encontrado: %SRC%
75
+ exit /b 1
76
+ )
77
+ copy /Y "%SRC%" "%DST%" >nul
78
+ exit /b 0
79
+
80
+ :copy_forge_root
81
+ set "SRC=%~dp0..\templates\%~1"
82
+ set "DST=%~dp0..\%~2"
83
+ if not exist "%SRC%" (
84
+ echo [X] Template no encontrado: %SRC%
85
+ exit /b 1
86
+ )
87
+ copy /Y "%SRC%" "%DST%" >nul
88
+ exit /b 0
89
+
90
+ :apply_root
91
+ set "SRC=%~dp0..\templates\%~1"
92
+ set "DST=%~dp0..\..\%~2"
93
+ if not exist "%SRC%" (
94
+ echo [X] Template no encontrado: %SRC%
95
+ exit /b 1
96
+ )
97
+ powershell -NoProfile -ExecutionPolicy Bypass -Command "$c = Get-Content -Raw -LiteralPath '%SRC%'; $c = $c.Replace('{{PROJECT_NAME}}', '%PROJECT_NAME%'); $c = $c.Replace('{{FG_VERSION}}', '%FG_VERSION%'); [System.IO.File]::WriteAllText('%DST%', $c, [System.Text.UTF8Encoding]::new($false))"
98
+ exit /b 0
package/lib/ui.cmd CHANGED
@@ -1,63 +1,59 @@
1
- @echo off
2
- REM ============================================================
3
- REM forge-git / lib/ui.cmd
4
- REM UI helpers - banner and status messages
5
- REM
6
- REM Usage:
7
- REM call "ui.cmd" banner
8
- REM call "ui.cmd" step 1/12 "Node.js v20" "OK"
9
- REM call "ui.cmd" done
10
- REM call "ui.cmd" abort
11
- REM ============================================================
12
-
13
- if "%~1"=="banner" goto :banner
14
- if "%~1"=="step" goto :step
15
- if "%~1"=="done" goto :done
16
- if "%~1"=="abort" goto :abort
17
- goto :eof
18
-
19
- :banner
20
- echo.
21
- echo ############################################
22
- echo # forge-git v%FG_VERSION% #
23
- echo # Bootstrap universal de proyecto #
24
- echo ############################################
25
- echo.
26
- echo Proyecto: %PROJECT_NAME%
27
- echo Ruta: %CD%
28
- echo.
29
- goto :eof
30
-
31
- :step
32
- REM %2 = step id (1/12), %3 = label, %4 = status
33
- echo [%~2] %~3 %~4
34
- goto :eof
35
-
36
- :done
37
- echo.
38
- echo ############################################
39
- echo # Bootstrap completado #
40
- echo ############################################
41
- echo.
42
- echo Comandos disponibles:
43
- echo.
44
- echo Esenciales:
45
- echo init.cmd Bootstrap
46
- echo abrir.cmd Abrir en VS Code
47
- echo.
48
- echo Trabajo diario:
49
- echo guardar.cmd Commit de cambios
50
- echo subir.cmd Push a GitHub
51
- echo historial.cmd Ver commits recientes
52
- echo.
53
- echo Ocasionales:
54
- echo snapshots.cmd Crear/restaurar copias
55
- echo auditar.cmd Generar reporte diff
56
- echo.
57
- goto :eof
58
-
59
- :abort
60
- echo.
61
- echo Bootstrap abortado. Instala los requisitos y vuelve a intentar.
62
- pause
1
+ @echo off
2
+ REM ============================================================
3
+ REM forge-git / lib/ui.cmd
4
+ REM UI helpers
5
+ REM ============================================================
6
+
7
+ if "%~1"=="banner" goto :banner
8
+ if "%~1"=="step" goto :step
9
+ if "%~1"=="done" goto :done
10
+ if "%~1"=="abort" goto :abort
11
+ goto :eof
12
+
13
+ :banner
14
+ echo.
15
+ echo ############################################
16
+ echo # forge-git v%FG_VERSION% #
17
+ echo # Bootstrap universal de proyecto #
18
+ echo ############################################
19
+ echo.
20
+ echo Proyecto: %PROJECT_NAME%
21
+ echo Ruta: %CD%
22
+ echo.
23
+ goto :eof
24
+
25
+ :step
26
+ echo [%~2] %~3 %~4
27
+ goto :eof
28
+
29
+ :done
30
+ echo.
31
+ echo ############################################
32
+ echo # Bootstrap completado #
33
+ echo ############################################
34
+ echo.
35
+ echo Comandos disponibles:
36
+ echo.
37
+ echo Esenciales:
38
+ echo init.cmd Bootstrap
39
+ echo forge.cmd Menu interactivo
40
+ echo.
41
+ echo Uso CLI directo:
42
+ echo forge save Commit de cambios
43
+ echo forge push Push a GitHub
44
+ echo forge log Ver commits
45
+ echo.
46
+ echo Otros:
47
+ echo forge snap Snapshots
48
+ echo forge audit Reporte diff
49
+ echo forge open Abrir en VS Code
50
+ echo forge serve Servidor de desarrollo
51
+ echo forge help Ayuda completa
52
+ echo.
53
+ goto :eof
54
+
55
+ :abort
56
+ echo.
57
+ echo Bootstrap abortado. Instala los requisitos y vuelve a intentar.
58
+ pause
63
59
  goto :eof
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forgegit",
3
- "version": "1.2.2",
3
+ "version": "1.4.0",
4
4
  "description": "Universal Git bootstrap kit for Windows",
5
5
  "bin": {
6
6
  "forge": "./tools/bin/forge.cmd"
@@ -2,7 +2,7 @@
2
2
  setlocal EnableDelayedExpansion
3
3
  chcp 65001 >nul 2>nul
4
4
 
5
- cd /d "%~dp0"
5
+ cd /d "%~dp0..\.."
6
6
 
7
7
  REM --- Colores ANSI (con fallback) ---
8
8
  for /F %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a"
@@ -2,7 +2,7 @@
2
2
  setlocal EnableDelayedExpansion
3
3
  chcp 65001 >nul 2>nul
4
4
 
5
- cd /d "%~dp0"
5
+ cd /d "%~dp0..\.."
6
6
 
7
7
  REM --- Detectar soporte ANSI (Windows 10+ / Windows Terminal) ---
8
8
  set "ANSI=1"
@@ -56,16 +56,16 @@ echo.
56
56
  REM --- 1. Estado actual ---
57
57
  for /f "tokens=*" %%b in ('git branch --show-current 2^>nul') do set "BRANCH=%%b"
58
58
 
59
- echo !C_CYAN!●!C_RESET! !C_GRAY!Branch:!C_RESET! !C_WHITE!!BRANCH!!C_RESET!
59
+ echo !C_CYAN!●!C_RESET! !C_GRAY!Branch:!C_RESET! !C_WHITE!!BRANCH!!C_RESET!
60
60
 
61
61
  git add -A >nul 2>nul
62
62
  git diff --cached --quiet
63
63
  if errorlevel 1 (
64
64
  set "NCH=0"
65
65
  for /f %%c in ('git diff --cached --name-only ^| find /c /v ""') do set "NCH=%%c"
66
- echo !C_CYAN!●!C_RESET! !C_GRAY!Cambios:!C_RESET! !C_YELLOW!!NCH! archivos sin commitear!C_RESET!
66
+ echo !C_CYAN!●!C_RESET! !C_GRAY!Cambios:!C_RESET! !C_YELLOW!!NCH! archivos sin commitear!C_RESET!
67
67
  ) else (
68
- echo !C_CYAN!●!C_RESET! !C_GRAY!Cambios:!C_RESET! !C_GREEN!limpio!C_RESET!
68
+ echo !C_CYAN!●!C_RESET! !C_GRAY!Cambios:!C_RESET! !C_GREEN!limpio!C_RESET!
69
69
  )
70
70
  echo.
71
71
 
@@ -199,7 +199,7 @@ if "!IS_WORK!"=="1" (
199
199
  )
200
200
 
201
201
  echo.
202
- echo !C_CYAN!●!C_RESET! !C_GRAY!Comparando:!C_RESET!
202
+ echo !C_CYAN!●!C_RESET! !C_GRAY!Comparando:!C_RESET!
203
203
  echo !C_GRAY![antiguo]!C_RESET! !C_YELLOW!!H_OLD!!C_RESET! !C_GRAY!^(idx !OLD_IDX!^)!C_RESET!
204
204
  if "!IS_WORK!"=="1" (
205
205
  echo !C_GRAY![reciente]!C_RESET! !C_GREEN!working tree!C_RESET!
@@ -0,0 +1,114 @@
1
+ @echo off
2
+ setlocal EnableDelayedExpansion
3
+ chcp 65001 >nul 2>nul
4
+
5
+ cd /d "%~dp0"
6
+
7
+ REM --- Colores ANSI ---
8
+ for /F %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a"
9
+ if "!ESC!"=="" (
10
+ set "C_CY=" & set "C_BC=" & set "C_GR=" & set "C_YE="
11
+ set "C_RE=" & set "C_GY=" & set "C_WH=" & set "C_RS="
12
+ ) else (
13
+ set "C_CY=!ESC![36m" & set "C_BC=!ESC![96m"
14
+ set "C_GR=!ESC![32m" & set "C_YE=!ESC![33m"
15
+ set "C_RE=!ESC![31m" & set "C_GY=!ESC![90m"
16
+ set "C_WH=!ESC![97m" & set "C_RS=!ESC![0m"
17
+ )
18
+
19
+ set "CMD_DIR=.forge\commands"
20
+
21
+ REM --- Verificar instalacion ---
22
+ if not exist "%CMD_DIR%\save.cmd" (
23
+ echo.
24
+ echo !C_RE![X]!C_RS! forgeGit no esta instalado aqui.
25
+ echo !C_GY!Ejecuta desde un proyecto nuevo:!C_RS! forge
26
+ echo.
27
+ pause
28
+ exit /b 1
29
+ )
30
+
31
+ REM --- Modo CLI directo ---
32
+ if not "%~1"=="" (
33
+ if /i "%~1"=="save" ( call "%CMD_DIR%\save.cmd" & exit /b 0 )
34
+ if /i "%~1"=="push" ( call "%CMD_DIR%\push.cmd" & exit /b 0 )
35
+ if /i "%~1"=="snap" ( call "%CMD_DIR%\snapshots.cmd" & exit /b 0 )
36
+ if /i "%~1"=="log" ( call "%CMD_DIR%\historial.cmd" & exit /b 0 )
37
+ if /i "%~1"=="audit" ( call "%CMD_DIR%\auditar.cmd" & exit /b 0 )
38
+ if /i "%~1"=="open" ( call "%CMD_DIR%\abrir.cmd" & exit /b 0 )
39
+ if /i "%~1"=="serve" ( call "%CMD_DIR%\serve.cmd" & exit /b 0 )
40
+ if /i "%~1"=="help" goto :help
41
+ if /i "%~1"=="-h" goto :help
42
+ if /i "%~1"=="--help" goto :help
43
+ echo !C_RE![X]!C_RS! Comando desconocido: %~1
44
+ echo !C_GY!Usa: forge help!C_RS!
45
+ exit /b 1
46
+ )
47
+
48
+ REM ============================================================
49
+ REM MENU PRINCIPAL
50
+ REM ============================================================
51
+ :menu
52
+ cls
53
+ echo.
54
+ echo !C_CY!============================================!C_RS!
55
+ echo !C_BC! forgeGit!C_RS! !C_GY!- Menu!C_RS!
56
+ echo !C_CY!============================================!C_RS!
57
+ echo.
58
+ echo !C_BC!Trabajo diario:!C_RS!
59
+ echo !C_YE![1]!C_RS! Guardar cambios !C_GY!(commit)!C_RS!
60
+ echo !C_YE![2]!C_RS! Subir a GitHub !C_GY!(push)!C_RS!
61
+ echo !C_YE![3]!C_RS! Historial !C_GY!(ver commits)!C_RS!
62
+ echo.
63
+ echo !C_BC!Herramientas:!C_RS!
64
+ echo !C_YE![4]!C_RS! Snapshots !C_GY!(backup/restore)!C_RS!
65
+ echo !C_YE![5]!C_RS! Auditar cambios !C_GY!(diff report)!C_RS!
66
+ echo !C_YE![6]!C_RS! Abrir en VS Code
67
+ echo !C_YE![7]!C_RS! Servidor dev !C_GY!(auto-detect)!C_RS!
68
+ echo.
69
+ echo !C_BC!Sistema:!C_RS!
70
+ echo !C_YE![0]!C_RS! Salir
71
+ echo.
72
+ echo !C_CY!--------------------------------------------!C_RS!
73
+ echo.
74
+
75
+ set "OPT="
76
+ set /p "OPT= !C_BC!Opcion!C_RS!: "
77
+
78
+ if "!OPT!"=="1" ( call "%CMD_DIR%\save.cmd" & echo. & pause & goto :menu )
79
+ if "!OPT!"=="2" ( call "%CMD_DIR%\push.cmd" & echo. & pause & goto :menu )
80
+ if "!OPT!"=="3" ( call "%CMD_DIR%\historial.cmd" & echo. & pause & goto :menu )
81
+ if "!OPT!"=="4" ( call "%CMD_DIR%\snapshots.cmd" & echo. & pause & goto :menu )
82
+ if "!OPT!"=="5" ( call "%CMD_DIR%\auditar.cmd" & echo. & pause & goto :menu )
83
+ if "!OPT!"=="6" ( call "%CMD_DIR%\abrir.cmd" & echo. & pause & goto :menu )
84
+ if "!OPT!"=="7" ( call "%CMD_DIR%\serve.cmd" & echo. & pause & goto :menu )
85
+ if "!OPT!"=="0" goto :end
86
+ if /i "!OPT!"=="q" goto :end
87
+
88
+ goto :menu
89
+
90
+ REM ============================================================
91
+ REM HELP
92
+ REM ============================================================
93
+ :help
94
+ echo.
95
+ echo !C_CY!============================================!C_RS!
96
+ echo !C_BC! forgeGit!C_RS! !C_GY!- Ayuda!C_RS!
97
+ echo !C_CY!============================================!C_RS!
98
+ echo.
99
+ echo !C_BC!USO:!C_RS!
100
+ echo !C_WH!forge!C_RS! Menu interactivo
101
+ echo !C_WH!forge save!C_RS! Guardar cambios
102
+ echo !C_WH!forge push!C_RS! Subir a GitHub
103
+ echo !C_WH!forge snap!C_RS! Snapshots
104
+ echo !C_WH!forge log!C_RS! Historial
105
+ echo !C_WH!forge audit!C_RS! Auditar cambios
106
+ echo !C_WH!forge open!C_RS! Abrir en VS Code
107
+ echo !C_WH!forge serve!C_RS! Servidor de desarrollo
108
+ echo !C_WH!forge help!C_RS! Esta ayuda
109
+ echo.
110
+ goto :end
111
+
112
+ :end
113
+ endlocal
114
+ exit /b 0
@@ -2,7 +2,7 @@
2
2
  setlocal EnableDelayedExpansion
3
3
  chcp 65001 >nul 2>nul
4
4
 
5
- cd /d "%~dp0"
5
+ cd /d "%~dp0..\.."
6
6
 
7
7
  REM --- Colores ANSI ---
8
8
  for /F %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a"
@@ -2,7 +2,7 @@
2
2
  setlocal EnableDelayedExpansion
3
3
  chcp 65001 >nul 2>nul
4
4
 
5
- cd /d "%~dp0"
5
+ cd /d "%~dp0..\.."
6
6
 
7
7
  REM --- Colores ANSI (con fallback) ---
8
8
  for /F %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a"
@@ -18,7 +18,7 @@ if "!ESC!"=="" (
18
18
 
19
19
  echo.
20
20
  echo !C_CY!============================================!C_RS!
21
- echo !C_BC! SUBIR!C_RS! !C_GY!- Push a GitHub!C_RS!
21
+ echo !C_BC! PUSH!C_RS! !C_GY!- Push a GitHub!C_RS!
22
22
  echo !C_CY!============================================!C_RS!
23
23
  echo.
24
24
 
@@ -1,24 +1,33 @@
1
1
  # {{PROJECT_NAME}}
2
2
 
3
- Proyecto inicializado con `init.cmd`.
3
+ Proyecto inicializado con `forge.cmd`.
4
4
 
5
- ## Comandos
6
-
7
- ### Esenciales
8
- - `init.cmd` — Bootstrap (una vez por proyecto)
9
- - `abrir.cmd` — Abrir en VS Code
5
+ ## Estructura
10
6
 
11
- ### Trabajo diario
12
- - `guardar.cmd` Commit de cambios
13
- - `subir.cmd` — Push a GitHub
14
- - `historial.cmd` — Ver commits recientes
7
+ - `forge.cmd` - Menu interactivo + CLI
8
+ - `.forge/` - Infraestructura (helpers, templates, lib)
15
9
 
16
- ### Ocasionales
17
- - `snapshots.cmd` — Crear/restaurar copias
18
- - `auditar.cmd` — Generar reporte diff
10
+ ## Comandos
19
11
 
20
- ### Internos (no ejecutar)
21
- - `config.cmd`, `lib/`, `templates/`
12
+ ### CLI directo
13
+
14
+ forge Menu interactivo
15
+ forge save Commit de cambios
16
+ forge push Push a GitHub
17
+ forge log Ver commits recientes
18
+ forge snap Crear/restaurar snapshots
19
+ forge audit Generar reporte diff
20
+ forge open Abrir en VS Code
21
+ forge help Ayuda completa
22
+
23
+ ### Helper scripts en .forge/commands/
24
+
25
+ - save.cmd - Commit
26
+ - push.cmd - Push a GitHub
27
+ - snapshots.cmd - Backups
28
+ - historial.cmd - Log
29
+ - auditar.cmd - Reportes
30
+ - abrir.cmd - VS Code
22
31
 
23
32
  ---
24
33
 
@@ -2,7 +2,7 @@
2
2
  setlocal EnableDelayedExpansion
3
3
  chcp 65001 >nul 2>nul
4
4
 
5
- cd /d "%~dp0"
5
+ cd /d "%~dp0..\.."
6
6
 
7
7
  for /F %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a"
8
8
  if "!ESC!"=="" (
@@ -23,16 +23,16 @@ if not exist ".git" (
23
23
  git add -A >nul 2>nul
24
24
  git diff --cached --quiet
25
25
  if not errorlevel 1 (
26
- echo !C_GY!Sin cambios para guardar.!C_RS!
26
+ echo !C_GY!Sin cambios para SAVE.!C_RS!
27
27
  exit /b 0
28
28
  )
29
29
 
30
30
  echo.
31
31
  echo !C_CY!------------------------------------------------------------!C_RS!
32
- echo !C_BC! GUARDAR!C_RS! !C_GY!- Commit local!C_RS!
32
+ echo !C_BC! SAVE!C_RS! !C_GY!- Commit local!C_RS!
33
33
  echo !C_CY!------------------------------------------------------------!C_RS!
34
34
  echo.
35
- echo !C_GY!Archivos a guardar:!C_RS!
35
+ echo !C_GY!Archivos a SAVE:!C_RS!
36
36
  git diff --cached --name-only | findstr /n "^"
37
37
  echo.
38
38
  echo !C_GY!Evita usar: " # : + / , en el mensaje!C_RS!
@@ -0,0 +1,86 @@
1
+ // serve-static.js - Minimal static file server (no dependencies)
2
+ // Usage: node serve-static.js [port] [root]
3
+
4
+ const http = require('http');
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+
8
+ const PORT = parseInt(process.argv[2] || '8080', 10);
9
+ const ROOT = path.resolve(process.argv[3] || process.cwd());
10
+
11
+ const MIME = {
12
+ '.html': 'text/html; charset=utf-8',
13
+ '.htm': 'text/html; charset=utf-8',
14
+ '.js': 'application/javascript; charset=utf-8',
15
+ '.mjs': 'application/javascript; charset=utf-8',
16
+ '.css': 'text/css; charset=utf-8',
17
+ '.json': 'application/json; charset=utf-8',
18
+ '.xml': 'application/xml; charset=utf-8',
19
+ '.txt': 'text/plain; charset=utf-8',
20
+ '.md': 'text/markdown; charset=utf-8',
21
+ '.png': 'image/png',
22
+ '.jpg': 'image/jpeg',
23
+ '.jpeg': 'image/jpeg',
24
+ '.gif': 'image/gif',
25
+ '.svg': 'image/svg+xml',
26
+ '.webp': 'image/webp',
27
+ '.ico': 'image/x-icon',
28
+ '.wasm': 'application/wasm',
29
+ '.woff': 'font/woff',
30
+ '.woff2': 'font/woff2',
31
+ '.ttf': 'font/ttf',
32
+ '.mp4': 'video/mp4',
33
+ '.webm': 'video/webm',
34
+ '.mp3': 'audio/mpeg',
35
+ '.wav': 'audio/wav'
36
+ };
37
+
38
+ const server = http.createServer((req, res) => {
39
+ let urlPath;
40
+ try {
41
+ urlPath = decodeURIComponent(req.url.split('?')[0]);
42
+ } catch (e) {
43
+ res.writeHead(400); res.end('400 Bad Request'); return;
44
+ }
45
+
46
+ if (urlPath === '/') urlPath = '/index.html';
47
+
48
+ const filePath = path.resolve(path.join(ROOT, urlPath));
49
+
50
+ // Bloqueo de path traversal
51
+ if (!filePath.startsWith(ROOT)) {
52
+ res.writeHead(403); res.end('403 Forbidden'); return;
53
+ }
54
+
55
+ fs.readFile(filePath, (err, data) => {
56
+ if (err) {
57
+ res.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });
58
+ res.end('404 Not Found: ' + urlPath);
59
+ return;
60
+ }
61
+ const ext = path.extname(filePath).toLowerCase();
62
+ res.writeHead(200, {
63
+ 'Content-Type': MIME[ext] || 'application/octet-stream',
64
+ 'Cache-Control': 'no-cache'
65
+ });
66
+ res.end(data);
67
+ });
68
+ });
69
+
70
+ server.on('error', (err) => {
71
+ if (err.code === 'EADDRINUSE') {
72
+ console.error('[ERROR] Port ' + PORT + ' is already in use.');
73
+ process.exit(1);
74
+ }
75
+ console.error('[ERROR] ' + err.message);
76
+ process.exit(1);
77
+ });
78
+
79
+ server.listen(PORT, '127.0.0.1', () => {
80
+ console.log('');
81
+ console.log(' Serving ' + ROOT);
82
+ console.log(' -> http://localhost:' + PORT + '/');
83
+ console.log('');
84
+ console.log(' Press Ctrl+C to stop');
85
+ console.log('');
86
+ });