forgegit 1.4.1 → 1.5.1

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/package.json CHANGED
@@ -1,19 +1,16 @@
1
1
  {
2
2
  "name": "forgegit",
3
- "version": "1.4.1",
3
+ "version": "1.5.1",
4
4
  "description": "Universal Git bootstrap kit for Windows",
5
5
  "bin": {
6
6
  "forge": "./tools/bin/forge.cmd"
7
7
  },
8
8
  "files": [
9
- "init.cmd",
10
- "config.cmd",
11
9
  "forge.cmd",
12
10
  "MANUAL.md",
13
11
  "README.md",
12
+ "WORKFLOW.md",
14
13
  ".forge/",
15
- "lib/",
16
- "templates/",
17
14
  "tests/test.cmd",
18
15
  "tools/install.cmd",
19
16
  "tools/uninstall.cmd",
@@ -35,4 +32,4 @@
35
32
  "type": "git",
36
33
  "url": "https://github.com/vloitz/forgeGit"
37
34
  }
38
- }
35
+ }
package/init.cmd DELETED
@@ -1,200 +0,0 @@
1
- @echo off
2
- setlocal EnableDelayedExpansion
3
- chcp 65001 >nul 2>nul
4
-
5
- cd /d "%~dp0"
6
- cls
7
-
8
- set "ROOT=%~dp0"
9
-
10
- REM --- Detectar donde esta lib/ y templates/ ---
11
- if exist ".forge\lib\ui.cmd" (
12
- set "LIB=%ROOT%.forge\lib"
13
- set "TPL=%ROOT%.forge\templates"
14
- set "CMDS=%ROOT%.forge\commands"
15
- ) else (
16
- set "LIB=%ROOT%lib"
17
- set "TPL=%ROOT%templates"
18
- set "CMDS=%ROOT%.forge\commands"
19
- )
20
-
21
- REM --- Force mode ---
22
- set "FORCE=0"
23
- if /i "%~1"=="--force" set "FORCE=1"
24
- if /i "%~1"=="force" set "FORCE=1"
25
- if /i "%~1"=="-f" set "FORCE=1"
26
-
27
- call "%ROOT%config.cmd"
28
-
29
- for %%a in ("%CD%") do set "PROJECT_NAME=%%~nxa"
30
-
31
- call "%LIB%\ui.cmd" banner
32
-
33
- REM --- STEP 1/17: Node.js ---
34
- where node >nul 2>nul
35
- if errorlevel 1 (
36
- echo [1/17] Node.js MISSING
37
- echo Descargalo desde: https://nodejs.org/
38
- goto :abort
39
- )
40
- for /f "tokens=*" %%v in ('node --version 2^>nul') do set "NODE_VER=%%v"
41
- call "%LIB%\ui.cmd" step 1/17 "Node.js !NODE_VER!" "OK"
42
-
43
- REM --- STEP 2/17: Git ---
44
- where git >nul 2>nul
45
- if errorlevel 1 (
46
- echo [2/17] Git MISSING
47
- echo Descargalo desde: https://git-scm.com/download/win
48
- goto :abort
49
- )
50
- for /f "tokens=*" %%v in ('git --version 2^>nul') do set "GIT_VER=%%v"
51
- call "%LIB%\ui.cmd" step 2/17 "!GIT_VER!" "OK"
52
-
53
- REM --- STEP 3/17: Init repo ---
54
- call "%LIB%\git-ops.cmd" init
55
-
56
- REM --- STEP 4/17: Branch main ---
57
- call "%LIB%\git-ops.cmd" branch_main
58
-
59
- REM --- STEP 5/17: Crear estructura .forge/ ---
60
- if exist ".forge\commands" goto :step5_ok
61
- mkdir ".forge" 2>nul
62
- mkdir ".forge\commands" 2>nul
63
- mkdir ".forge\lib" 2>nul
64
- mkdir ".forge\templates" 2>nul
65
- call "%LIB%\ui.cmd" step 5/17 "Estructura .forge/" "CREADO"
66
- goto :step6
67
- :step5_ok
68
- call "%LIB%\ui.cmd" step 5/17 "Estructura .forge/" "YA EXISTE"
69
-
70
- :step6
71
- REM --- STEP 6/17: .gitignore ---
72
- if exist ".gitignore" goto :step6_ok
73
- call "%LIB%\templates.cmd" write_gitignore
74
- call "%LIB%\ui.cmd" step 6/17 ".gitignore universal" "CREADO"
75
- goto :step7
76
- :step6_ok
77
- call "%LIB%\ui.cmd" step 6/17 ".gitignore" "YA EXISTE"
78
-
79
- :step7
80
- REM --- STEP 7/17: README.md ---
81
- if exist "README.md" goto :step7_ok
82
- call "%LIB%\templates.cmd" write_readme
83
- call "%LIB%\ui.cmd" step 7/17 "README.md adaptativo" "CREADO"
84
- goto :step8
85
- :step7_ok
86
- call "%LIB%\ui.cmd" step 7/17 "README.md" "YA EXISTE"
87
-
88
- :step8
89
- REM --- STEP 8/17: forge.cmd ---
90
- if exist "forge.cmd" goto :step8_ok
91
- call "%LIB%\templates.cmd" write_forge
92
- call "%LIB%\ui.cmd" step 8/17 "forge.cmd menu" "CREADO"
93
- goto :step9
94
- :step8_ok
95
- call "%LIB%\ui.cmd" step 8/17 "forge.cmd" "YA EXISTE"
96
-
97
- :step9
98
- REM --- STEP 9/17: save.cmd ---
99
- if exist ".forge\commands\save.cmd" goto :step9_ok
100
- call "%LIB%\templates.cmd" write_save
101
- call "%LIB%\ui.cmd" step 9/17 "save.cmd" "CREADO"
102
- goto :step10
103
- :step9_ok
104
- call "%LIB%\ui.cmd" step 9/17 "save.cmd" "YA EXISTE"
105
-
106
- :step10
107
- REM --- STEP 10/17: push.cmd ---
108
- if exist ".forge\commands\push.cmd" goto :step10_ok
109
- call "%LIB%\templates.cmd" write_push
110
- call "%LIB%\ui.cmd" step 10/17 "push.cmd" "CREADO"
111
- goto :step11
112
- :step10_ok
113
- call "%LIB%\ui.cmd" step 10/17 "push.cmd" "YA EXISTE"
114
-
115
- :step11
116
- REM --- STEP 11/17: snapshots.cmd ---
117
- if exist ".forge\commands\snapshots.cmd" goto :step11_ok
118
- call "%LIB%\templates.cmd" write_snapshots
119
- call "%LIB%\ui.cmd" step 11/17 "snapshots.cmd" "CREADO"
120
- goto :step12
121
- :step11_ok
122
- call "%LIB%\ui.cmd" step 11/17 "snapshots.cmd" "YA EXISTE"
123
-
124
- :step12
125
- REM --- STEP 12/17: historial.cmd ---
126
- if exist ".forge\commands\historial.cmd" goto :step12_ok
127
- call "%LIB%\templates.cmd" write_historial
128
- call "%LIB%\ui.cmd" step 12/17 "historial.cmd" "CREADO"
129
- goto :step13
130
- :step12_ok
131
- call "%LIB%\ui.cmd" step 12/17 "historial.cmd" "YA EXISTE"
132
-
133
- :step13
134
- REM --- STEP 13/17: abrir.cmd ---
135
- if exist ".forge\commands\abrir.cmd" goto :step13_ok
136
- call "%LIB%\templates.cmd" write_abrir
137
- call "%LIB%\ui.cmd" step 13/17 "abrir.cmd" "CREADO"
138
- goto :step14
139
- :step13_ok
140
- call "%LIB%\ui.cmd" step 13/17 "abrir.cmd" "YA EXISTE"
141
-
142
- :step14
143
- REM --- STEP 14/17: auditar.cmd ---
144
- if exist ".forge\commands\auditar.cmd" goto :step14_ok
145
- call "%LIB%\templates.cmd" write_auditar
146
- call "%LIB%\ui.cmd" step 14/17 "auditar.cmd" "CREADO"
147
- goto :step15
148
- :step14_ok
149
- call "%LIB%\ui.cmd" step 14/17 "auditar.cmd" "YA EXISTE"
150
-
151
- :step15
152
- REM --- STEP 15/17: serve.cmd ---
153
- if exist ".forge\commands\serve.cmd" goto :step15_ok
154
- call "%LIB%\templates.cmd" write_serve
155
- call "%LIB%\ui.cmd" step 15/17 "serve.cmd" "CREADO"
156
- goto :step16
157
- :step15_ok
158
- call "%LIB%\ui.cmd" step 15/17 "serve.cmd" "YA EXISTE"
159
-
160
- :step16
161
- REM --- STEP 16/17: Commit ---
162
- call "%LIB%\git-ops.cmd" has_changes
163
- if errorlevel 1 (
164
- set "USER_MSG="
165
- set /p "USER_MSG= Mensaje del commit [Enter = default]: "
166
- if "!USER_MSG!"=="" set "USER_MSG=%COMMIT_MESSAGE%"
167
- call "%LIB%\git-ops.cmd" commit "!USER_MSG!"
168
- call "%LIB%\ui.cmd" step 16/17 "Commit: !USER_MSG!" "CREADO"
169
- ) else (
170
- call "%LIB%\ui.cmd" step 16/17 "Sin cambios para commit" "SKIP"
171
- )
172
-
173
- REM --- STEP 17/17: Tag ---
174
- call "%LIB%\git-ops.cmd" tag
175
- if errorlevel 1 (
176
- call "%LIB%\ui.cmd" step 17/17 "Tag %TAG_INITIAL%" "CREADO"
177
- ) else (
178
- call "%LIB%\ui.cmd" step 17/17 "Tag %TAG_INITIAL%" "YA EXISTE"
179
- )
180
-
181
- call "%LIB%\ui.cmd" done
182
- call :shell_if_double_click
183
- endlocal
184
- exit /b 0
185
-
186
- :abort
187
- call "%LIB%\ui.cmd" abort
188
- call :shell_if_double_click
189
- endlocal
190
- exit /b 1
191
-
192
- :shell_if_double_click
193
- if "%NO_PAUSE%"=="1" goto :eof
194
- echo %cmdcmdline% | find /i "%~nx0" >nul
195
- if errorlevel 1 goto :eof
196
- echo.
197
- echo Sesion interactiva abierta. Escribe 'exit' para cerrar.
198
- echo.
199
- cmd /k
200
- goto :eof
package/lib/git-ops.cmd DELETED
@@ -1,92 +0,0 @@
1
- @echo off
2
- REM ============================================================
3
- REM forge-git / lib/git-ops.cmd
4
- REM Git operations
5
- REM
6
- REM Usage:
7
- REM call "git-ops.cmd" init - init repo
8
- REM call "git-ops.cmd" branch_main - rename branch to main
9
- REM call "git-ops.cmd" has_changes - check for pending changes
10
- REM call "git-ops.cmd" commit "msg" - commit with message
11
- REM call "git-ops.cmd" tag - create tag
12
- REM
13
- REM Return codes:
14
- REM 0 = nothing to do (already exists / no changes)
15
- REM 1 = action performed
16
- REM ============================================================
17
-
18
- REM --- Detectar PROJECT_ROOT ---
19
- REM Si git-ops.cmd esta en .forge/lib/ -> PROJECT_ROOT = ..\..
20
- REM Si git-ops.cmd esta en lib/ -> PROJECT_ROOT = ..
21
- set "ROOT=%~dp0"
22
- REM Detectar si estamos dentro de .forge
23
- echo "%ROOT%" | find /i ".forge" >nul
24
- if not errorlevel 1 (
25
- set "PROJECT_ROOT=%ROOT%..\.."
26
- ) else (
27
- set "PROJECT_ROOT=%ROOT%.."
28
- )
29
-
30
- if "%~1"=="init" goto :init
31
- if "%~1"=="branch_main" goto :branch_main
32
- if "%~1"=="has_changes" goto :has_changes
33
- if "%~1"=="commit" goto :commit
34
- if "%~1"=="tag" goto :tag
35
- goto :eof
36
-
37
- :init
38
- pushd "%PROJECT_ROOT%"
39
- if exist ".git" (
40
- popd
41
- call "%~dp0ui.cmd" step 3/17 "Repositorio Git" "YA EXISTE"
42
- exit /b 0
43
- )
44
- git init -q
45
- if errorlevel 1 (
46
- popd
47
- call "%~dp0ui.cmd" step 3/17 "Repositorio Git" "ERROR"
48
- exit /b 1
49
- )
50
- popd
51
- call "%~dp0ui.cmd" step 3/17 "Repositorio Git" "CREADO"
52
- exit /b 1
53
-
54
- :branch_main
55
- pushd "%PROJECT_ROOT%"
56
- git branch -M %BRANCH_MAIN% >nul 2>nul
57
- popd
58
- call "%~dp0ui.cmd" step 4/17 "Rama principal: %BRANCH_MAIN%" "OK"
59
- exit /b 0
60
-
61
- :has_changes
62
- pushd "%PROJECT_ROOT%"
63
- git add -A >nul 2>nul
64
- git diff --cached --quiet
65
- set "RC=%ERRORLEVEL%"
66
- popd
67
- if %RC% NEQ 0 ( exit /b 1 ) else ( exit /b 0 )
68
-
69
- :commit
70
- set "MSG=%~2"
71
- if "!MSG!"=="" set "MSG=%COMMIT_MESSAGE%"
72
- pushd "%PROJECT_ROOT%"
73
- git commit -q -m "!MSG!"
74
- set "RC=%ERRORLEVEL%"
75
- popd
76
- if %RC% NEQ 0 ( exit /b 0 ) else ( exit /b 1 )
77
-
78
- :tag
79
- pushd "%PROJECT_ROOT%"
80
- git rev-parse %TAG_INITIAL% >nul 2>nul
81
- if not errorlevel 1 (
82
- popd
83
- exit /b 0
84
- )
85
- git rev-parse HEAD >nul 2>nul
86
- if errorlevel 1 (
87
- popd
88
- exit /b 0
89
- )
90
- git tag -a %TAG_INITIAL% -m "%TAG_MESSAGE%" 2>nul
91
- popd
92
- exit /b 1
package/lib/templates.cmd DELETED
@@ -1,98 +0,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 DELETED
@@ -1,59 +0,0 @@
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
59
- goto :eof
@@ -1,51 +0,0 @@
1
- @echo off
2
- setlocal EnableDelayedExpansion
3
- chcp 65001 >nul 2>nul
4
-
5
- cd /d "%~dp0..\.."
6
-
7
- REM --- Colores ANSI (con fallback) ---
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
- where code >nul 2>nul
20
- if errorlevel 1 (
21
- echo.
22
- echo !C_RE![X]!C_RS! VS Code CLI no esta en el PATH.
23
- echo.
24
- echo !C_GY!Instala:!C_RS!
25
- echo !C_WH!1.!C_RS! Abre VS Code
26
- echo !C_WH!2.!C_RS! Ctrl+Shift+P
27
- echo !C_WH!3.!C_RS! "Shell Command: Install 'code' command in PATH"
28
- echo.
29
- call :shell_if_double_click
30
- exit /b 1
31
- )
32
-
33
- if "%~1"=="" (
34
- echo !C_GY!Abriendo proyecto en VS Code...!C_RS!
35
- code .
36
- ) else (
37
- echo !C_GY!Abriendo en VS Code:!C_RS! !C_WH!%*!C_RS!
38
- code %*
39
- )
40
-
41
- exit /b 0
42
-
43
- :shell_if_double_click
44
- if "%NO_PAUSE%"=="1" goto :eof
45
- echo %cmdcmdline% | find /i "%~nx0" >nul
46
- if errorlevel 1 goto :eof
47
- echo.
48
- echo !C_GY!Sesion interactiva. Escribe 'exit' para cerrar.!C_RS!
49
- echo.
50
- cmd /k
51
- goto :eof