forgegit 1.2.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 ADDED
@@ -0,0 +1,26 @@
1
+ # forgeGit
2
+
3
+ Proyecto inicializado con `init.cmd`.
4
+
5
+ ## Comandos
6
+
7
+ ### Esenciales
8
+ - `init.cmd` — Bootstrap (una vez por proyecto)
9
+ - `abrir.cmd` — Abrir en VS Code
10
+
11
+ ### Trabajo diario
12
+ - `guardar.cmd` — Commit de cambios
13
+ - `subir.cmd` — Push a GitHub
14
+ - `historial.cmd` — Ver commits recientes
15
+
16
+ ### Ocasionales
17
+ - `snapshots.cmd` — Crear/restaurar copias
18
+ - `auditar.cmd` — Generar reporte diff
19
+
20
+ ### Internos (no ejecutar)
21
+ - `config.cmd`, `lib/`, `templates/`
22
+
23
+ ---
24
+
25
+ Generado por forge-git v1.2.0
26
+
package/config.cmd ADDED
@@ -0,0 +1,15 @@
1
+ REM ============================================================
2
+ REM forge-git / config.cmd
3
+ REM Configuration - edit these values to customize
4
+ REM Called from init.cmd via: call config.cmd
5
+ REM ============================================================
6
+
7
+ set "FG_VERSION=1.2.0"
8
+ set "TAG_INITIAL=v1.0.0"
9
+ set "TAG_MESSAGE=Primera version estable"
10
+ set "BRANCH_MAIN=main"
11
+ set "COMMIT_MESSAGE=chore: initial commit"
12
+
13
+ REM --- Exclusions for subir.cmd (robocopy) ---
14
+ set "EXCLUDE_DIRS=.git versiones old_versions backup backups node_modules __pycache__ venv .venv env dist build out cache .cache .parcel-cache .vite .vscode .idea"
15
+ set "EXCLUDE_FILES=*.log *.tmp *.bak *.orig Thumbs.db .DS_Store"
package/init.cmd ADDED
@@ -0,0 +1,193 @@
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
+ set "LIB=%ROOT%lib"
10
+
11
+ REM --- Force mode: init.cmd --force o init.cmd force ---
12
+ set "FORCE=0"
13
+ if /i "%~1"=="--force" set "FORCE=1"
14
+ if /i "%~1"=="force" set "FORCE=1"
15
+ if /i "%~1"=="-f" set "FORCE=1"
16
+
17
+ call "%ROOT%config.cmd"
18
+
19
+ for %%a in ("%CD%") do set "PROJECT_NAME=%%~nxa"
20
+
21
+ call "%LIB%\ui.cmd" banner
22
+
23
+ REM --- STEP 1/14: Node.js ---
24
+ where node >nul 2>nul
25
+ if errorlevel 1 (
26
+ echo [1/14] Node.js MISSING
27
+ echo Descargalo desde: https://nodejs.org/
28
+ goto :abort
29
+ )
30
+ for /f "tokens=*" %%v in ('node --version 2^>nul') do set "NODE_VER=%%v"
31
+ call "%LIB%\ui.cmd" step 1/14 "Node.js !NODE_VER!" "OK"
32
+
33
+ REM --- STEP 2/14: Git ---
34
+ where git >nul 2>nul
35
+ if errorlevel 1 (
36
+ echo [2/14] Git MISSING
37
+ echo Descargalo desde: https://git-scm.com/download/win
38
+ goto :abort
39
+ )
40
+ for /f "tokens=*" %%v in ('git --version 2^>nul') do set "GIT_VER=%%v"
41
+ call "%LIB%\ui.cmd" step 2/14 "!GIT_VER!" "OK"
42
+
43
+ REM --- STEP 3/14: Init repo ---
44
+ call "%LIB%\git-ops.cmd" init
45
+
46
+ REM --- STEP 4/14: Branch main ---
47
+ call "%LIB%\git-ops.cmd" branch_main
48
+
49
+ REM --- STEP 5/14: .gitignore ---
50
+ if exist ".gitignore" (
51
+ if "%FORCE%"=="1" (
52
+ call "%LIB%\templates.cmd" write_gitignore
53
+ call "%LIB%\ui.cmd" step 5/14 ".gitignore universal" "FORZADO"
54
+ ) else (
55
+ call "%LIB%\ui.cmd" step 5/14 ".gitignore" "YA EXISTE"
56
+ )
57
+ ) else (
58
+ call "%LIB%\templates.cmd" write_gitignore
59
+ call "%LIB%\ui.cmd" step 5/14 ".gitignore universal" "CREADO"
60
+ )
61
+
62
+ REM --- STEP 6/14: README.md ---
63
+ if exist "README.md" (
64
+ if "%FORCE%"=="1" (
65
+ call "%LIB%\templates.cmd" write_readme
66
+ call "%LIB%\ui.cmd" step 6/14 "README.md adaptativo" "FORZADO"
67
+ ) else (
68
+ call "%LIB%\ui.cmd" step 6/14 "README.md" "YA EXISTE"
69
+ )
70
+ ) else (
71
+ call "%LIB%\templates.cmd" write_readme
72
+ call "%LIB%\ui.cmd" step 6/14 "README.md adaptativo" "CREADO"
73
+ )
74
+
75
+ REM --- STEP 7/14: guardar.cmd ---
76
+ if exist "guardar.cmd" (
77
+ if "%FORCE%"=="1" (
78
+ call "%LIB%\templates.cmd" write_guardar
79
+ call "%LIB%\ui.cmd" step 7/14 "guardar.cmd" "FORZADO"
80
+ ) else (
81
+ call "%LIB%\ui.cmd" step 7/14 "guardar.cmd" "YA EXISTE"
82
+ )
83
+ ) else (
84
+ call "%LIB%\templates.cmd" write_guardar
85
+ call "%LIB%\ui.cmd" step 7/14 "guardar.cmd" "CREADO"
86
+ )
87
+
88
+ REM --- STEP 8/14: subir.cmd ---
89
+ if exist "subir.cmd" (
90
+ if "%FORCE%"=="1" (
91
+ call "%LIB%\templates.cmd" write_subir
92
+ call "%LIB%\ui.cmd" step 8/14 "subir.cmd" "FORZADO"
93
+ ) else (
94
+ call "%LIB%\ui.cmd" step 8/14 "subir.cmd" "YA EXISTE"
95
+ )
96
+ ) else (
97
+ call "%LIB%\templates.cmd" write_subir
98
+ call "%LIB%\ui.cmd" step 8/14 "subir.cmd" "CREADO"
99
+ )
100
+
101
+ REM --- STEP 9/14: snapshots.cmd ---
102
+ if exist "snapshots.cmd" (
103
+ if "%FORCE%"=="1" (
104
+ call "%LIB%\templates.cmd" write_snapshots
105
+ call "%LIB%\ui.cmd" step 9/14 "snapshots.cmd" "FORZADO"
106
+ ) else (
107
+ call "%LIB%\ui.cmd" step 9/14 "snapshots.cmd" "YA EXISTE"
108
+ )
109
+ ) else (
110
+ call "%LIB%\templates.cmd" write_snapshots
111
+ call "%LIB%\ui.cmd" step 9/14 "snapshots.cmd" "CREADO"
112
+ )
113
+
114
+ REM --- STEP 10/14: historial.cmd ---
115
+ if exist "historial.cmd" (
116
+ if "%FORCE%"=="1" (
117
+ call "%LIB%\templates.cmd" write_historial
118
+ call "%LIB%\ui.cmd" step 10/14 "historial.cmd" "FORZADO"
119
+ ) else (
120
+ call "%LIB%\ui.cmd" step 10/14 "historial.cmd" "YA EXISTE"
121
+ )
122
+ ) else (
123
+ call "%LIB%\templates.cmd" write_historial
124
+ call "%LIB%\ui.cmd" step 10/14 "historial.cmd" "CREADO"
125
+ )
126
+
127
+ REM --- STEP 11/14: abrir.cmd ---
128
+ if exist "abrir.cmd" (
129
+ if "%FORCE%"=="1" (
130
+ call "%LIB%\templates.cmd" write_abrir
131
+ call "%LIB%\ui.cmd" step 11/14 "abrir.cmd" "FORZADO"
132
+ ) else (
133
+ call "%LIB%\ui.cmd" step 11/14 "abrir.cmd" "YA EXISTE"
134
+ )
135
+ ) else (
136
+ call "%LIB%\templates.cmd" write_abrir
137
+ call "%LIB%\ui.cmd" step 11/14 "abrir.cmd" "CREADO"
138
+ )
139
+
140
+ REM --- STEP 12/14: auditar.cmd ---
141
+ if exist "auditar.cmd" (
142
+ if "%FORCE%"=="1" (
143
+ call "%LIB%\templates.cmd" write_auditar
144
+ call "%LIB%\ui.cmd" step 12/14 "auditar.cmd" "FORZADO"
145
+ ) else (
146
+ call "%LIB%\ui.cmd" step 12/14 "auditar.cmd" "YA EXISTE"
147
+ )
148
+ ) else (
149
+ call "%LIB%\templates.cmd" write_auditar
150
+ call "%LIB%\ui.cmd" step 12/14 "auditar.cmd" "CREADO"
151
+ )
152
+
153
+ REM --- STEP 13/14: Commit ---
154
+ call "%LIB%\git-ops.cmd" has_changes
155
+ if errorlevel 1 (
156
+ set "USER_MSG="
157
+ set /p "USER_MSG= Mensaje del commit [Enter = default]: "
158
+ if "!USER_MSG!"=="" set "USER_MSG=%COMMIT_MESSAGE%"
159
+ call "%LIB%\git-ops.cmd" commit "!USER_MSG!"
160
+ call "%LIB%\ui.cmd" step 13/14 "Commit: !USER_MSG!" "CREADO"
161
+ ) else (
162
+ call "%LIB%\ui.cmd" step 13/14 "Sin cambios para commit" "SKIP"
163
+ )
164
+
165
+ REM --- STEP 14/14: Tag ---
166
+ call "%LIB%\git-ops.cmd" tag
167
+ if errorlevel 1 (
168
+ call "%LIB%\ui.cmd" step 14/14 "Tag %TAG_INITIAL%" "CREADO"
169
+ ) else (
170
+ call "%LIB%\ui.cmd" step 14/14 "Tag %TAG_INITIAL%" "YA EXISTE"
171
+ )
172
+
173
+ call "%LIB%\ui.cmd" done
174
+
175
+ call :shell_if_double_click
176
+ endlocal
177
+ exit /b 0
178
+
179
+ :abort
180
+ call "%LIB%\ui.cmd" abort
181
+ call :shell_if_double_click
182
+ endlocal
183
+ exit /b 1
184
+
185
+ :shell_if_double_click
186
+ if "%NO_PAUSE%"=="1" goto :eof
187
+ echo %cmdcmdline% | find /i "%~nx0" >nul
188
+ if errorlevel 1 goto :eof
189
+ echo.
190
+ echo Sesion interactiva abierta. Escribe 'exit' para cerrar.
191
+ echo.
192
+ cmd /k
193
+ goto :eof
@@ -0,0 +1,69 @@
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
+ if "%~1"=="init" goto :init
19
+ if "%~1"=="branch_main" goto :branch_main
20
+ if "%~1"=="has_changes" goto :has_changes
21
+ if "%~1"=="commit" goto :commit
22
+ if "%~1"=="tag" goto :tag
23
+ goto :eof
24
+
25
+ :init
26
+ if exist ".git" (
27
+ call "%~dp0ui.cmd" step 3/14 "Repositorio Git" "YA EXISTE"
28
+ exit /b 0
29
+ )
30
+ git init -q
31
+ if errorlevel 1 (
32
+ call "%~dp0ui.cmd" step 3/14 "Repositorio Git" "ERROR"
33
+ exit /b 1
34
+ )
35
+ call "%~dp0ui.cmd" step 3/14 "Repositorio Git" "CREADO"
36
+ exit /b 1
37
+
38
+ :branch_main
39
+ git branch -M %BRANCH_MAIN% >nul 2>nul
40
+ call "%~dp0ui.cmd" step 4/14 "Rama principal: %BRANCH_MAIN%" "OK"
41
+ exit /b 0
42
+
43
+ :has_changes
44
+ git add -A >nul 2>nul
45
+ git diff --cached --quiet
46
+ if errorlevel 1 (
47
+ exit /b 1
48
+ ) else (
49
+ exit /b 0
50
+ )
51
+
52
+ :commit
53
+ REM %~2 = mensaje opcional
54
+ set "MSG=%~2"
55
+ if "!MSG!"=="" set "MSG=%COMMIT_MESSAGE%"
56
+ git commit -q -m "!MSG!"
57
+ exit /b 1
58
+
59
+ :tag
60
+ git rev-parse %TAG_INITIAL% >nul 2>nul
61
+ if not errorlevel 1 (
62
+ exit /b 0
63
+ )
64
+ git rev-parse HEAD >nul 2>nul
65
+ if errorlevel 1 (
66
+ exit /b 0
67
+ )
68
+ git tag -a %TAG_INITIAL% -m "%TAG_MESSAGE%" 2>nul
69
+ exit /b 1
@@ -0,0 +1,79 @@
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
package/lib/ui.cmd ADDED
@@ -0,0 +1,63 @@
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
63
+ goto :eof
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "forgegit",
3
+ "version": "1.2.0",
4
+ "description": "Universal Git bootstrap kit for Windows",
5
+ "bin": {
6
+ "forge": "./tools/bin/forge.cmd"
7
+ },
8
+ "files": [
9
+ "init.cmd",
10
+ "config.cmd",
11
+ "README.md",
12
+ "lib/",
13
+ "templates/",
14
+ "tests/test.cmd",
15
+ "tools/install.cmd",
16
+ "tools/uninstall.cmd",
17
+ "tools/restore.cmd",
18
+ "tools/pack.cmd",
19
+ "tools/release.cmd",
20
+ "tools/bin/forge.cmd",
21
+ "tools/bin/forge-update.cmd"
22
+ ],
23
+ "keywords": [
24
+ "git",
25
+ "bootstrap",
26
+ "windows",
27
+ "cli"
28
+ ],
29
+ "author": "vloitz",
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/vloitz/forgeGit"
34
+ }
35
+ }
@@ -0,0 +1,51 @@
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