forgegit 1.4.1 → 1.5.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.
@@ -4,7 +4,7 @@ REM Configuration - edit these values to customize
4
4
  REM Called from init.cmd via: call config.cmd
5
5
  REM ============================================================
6
6
 
7
- set "FG_VERSION=1.4.1"
7
+ set "FG_VERSION=1.5.0"
8
8
  set "TAG_INITIAL=v1.0.0"
9
9
  set "TAG_MESSAGE=Primera version estable"
10
10
  set "BRANCH_MAIN=main"
package/.forge/init.cmd CHANGED
@@ -2,163 +2,137 @@
2
2
  setlocal EnableDelayedExpansion
3
3
  chcp 65001 >nul 2>nul
4
4
 
5
- cd /d "%~dp0"
6
- cls
5
+ REM ============================================================
6
+ REM forge-git / .forge/init.cmd
7
+ REM init.cmd SIEMPRE vive en .forge/
8
+ REM PROJECT_ROOT es el padre (../)
9
+ REM ============================================================
7
10
 
8
- set "ROOT=%~dp0"
11
+ pushd "%~dp0.."
12
+ set "PROJECT_ROOT=%CD%"
13
+ popd
9
14
 
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
- )
15
+ set "FORGE_DIR=%~dp0"
16
+ set "LIB=%FORGE_DIR%lib"
17
+ set "TPL=%FORGE_DIR%templates"
18
+ set "CMDS=%FORGE_DIR%commands"
20
19
 
21
- REM --- Force mode ---
22
20
  set "FORCE=0"
23
21
  if /i "%~1"=="--force" set "FORCE=1"
24
22
  if /i "%~1"=="force" set "FORCE=1"
25
23
  if /i "%~1"=="-f" set "FORCE=1"
26
24
 
27
- call "%ROOT%config.cmd"
25
+ call "%FORGE_DIR%config.cmd"
28
26
 
27
+ pushd "%PROJECT_ROOT%"
29
28
  for %%a in ("%CD%") do set "PROJECT_NAME=%%~nxa"
29
+ popd
30
30
 
31
31
  call "%LIB%\ui.cmd" banner
32
32
 
33
- REM --- STEP 1/17: Node.js ---
33
+ cd /d "%PROJECT_ROOT%"
34
+
34
35
  where node >nul 2>nul
35
36
  if errorlevel 1 (
36
- echo [1/17] Node.js MISSING
37
+ echo [1/17] Node.js MISSING
37
38
  echo Descargalo desde: https://nodejs.org/
38
39
  goto :abort
39
40
  )
40
41
  for /f "tokens=*" %%v in ('node --version 2^>nul') do set "NODE_VER=%%v"
41
42
  call "%LIB%\ui.cmd" step 1/17 "Node.js !NODE_VER!" "OK"
42
43
 
43
- REM --- STEP 2/17: Git ---
44
44
  where git >nul 2>nul
45
45
  if errorlevel 1 (
46
- echo [2/17] Git MISSING
46
+ echo [2/17] Git MISSING
47
47
  echo Descargalo desde: https://git-scm.com/download/win
48
48
  goto :abort
49
49
  )
50
50
  for /f "tokens=*" %%v in ('git --version 2^>nul') do set "GIT_VER=%%v"
51
51
  call "%LIB%\ui.cmd" step 2/17 "!GIT_VER!" "OK"
52
52
 
53
- REM --- STEP 3/17: Init repo ---
54
53
  call "%LIB%\git-ops.cmd" init
55
-
56
- REM --- STEP 4/17: Branch main ---
57
54
  call "%LIB%\git-ops.cmd" branch_main
58
55
 
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 ---
56
+ if exist ".forge\commands" (
57
+ call "%LIB%\ui.cmd" step 5/17 "Estructura .forge/" "YA EXISTE"
58
+ ) else (
59
+ mkdir ".forge" 2>nul
60
+ mkdir ".forge\commands" 2>nul
61
+ mkdir ".forge\lib" 2>nul
62
+ mkdir ".forge\templates" 2>nul
63
+ call "%LIB%\ui.cmd" step 5/17 "Estructura .forge/" "CREADO"
64
+ )
65
+
66
+ if exist ".gitignore" (
67
+ call "%LIB%\ui.cmd" step 6/17 ".gitignore" "YA EXISTE"
68
+ ) else (
69
+ call "%LIB%\templates.cmd" write_gitignore
70
+ call "%LIB%\ui.cmd" step 6/17 ".gitignore universal" "CREADO"
71
+ )
72
+
73
+ if exist "README.md" (
74
+ call "%LIB%\ui.cmd" step 7/17 "README.md" "YA EXISTE"
75
+ ) else (
76
+ call "%LIB%\templates.cmd" write_readme
77
+ call "%LIB%\ui.cmd" step 7/17 "README.md adaptativo" "CREADO"
78
+ )
79
+
80
+ if exist "forge.cmd" (
81
+ call "%LIB%\ui.cmd" step 8/17 "forge.cmd" "YA EXISTE"
82
+ ) else (
83
+ call "%LIB%\templates.cmd" write_forge
84
+ call "%LIB%\ui.cmd" step 8/17 "forge.cmd menu" "CREADO"
85
+ )
86
+
87
+ if exist ".forge\commands\save.cmd" (
88
+ call "%LIB%\ui.cmd" step 9/17 "save.cmd" "YA EXISTE"
89
+ ) else (
90
+ call "%LIB%\templates.cmd" write_save
91
+ call "%LIB%\ui.cmd" step 9/17 "save.cmd" "CREADO"
92
+ )
93
+
94
+ if exist ".forge\commands\push.cmd" (
95
+ call "%LIB%\ui.cmd" step 10/17 "push.cmd" "YA EXISTE"
96
+ ) else (
97
+ call "%LIB%\templates.cmd" write_push
98
+ call "%LIB%\ui.cmd" step 10/17 "push.cmd" "CREADO"
99
+ )
100
+
101
+ if exist ".forge\commands\snapshots.cmd" (
102
+ call "%LIB%\ui.cmd" step 11/17 "snapshots.cmd" "YA EXISTE"
103
+ ) else (
104
+ call "%LIB%\templates.cmd" write_snapshots
105
+ call "%LIB%\ui.cmd" step 11/17 "snapshots.cmd" "CREADO"
106
+ )
107
+
108
+ if exist ".forge\commands\historial.cmd" (
109
+ call "%LIB%\ui.cmd" step 12/17 "historial.cmd" "YA EXISTE"
110
+ ) else (
111
+ call "%LIB%\templates.cmd" write_historial
112
+ call "%LIB%\ui.cmd" step 12/17 "historial.cmd" "CREADO"
113
+ )
114
+
115
+ if exist ".forge\commands\abrir.cmd" (
116
+ call "%LIB%\ui.cmd" step 13/17 "abrir.cmd" "YA EXISTE"
117
+ ) else (
118
+ call "%LIB%\templates.cmd" write_abrir
119
+ call "%LIB%\ui.cmd" step 13/17 "abrir.cmd" "CREADO"
120
+ )
121
+
122
+ if exist ".forge\commands\auditar.cmd" (
123
+ call "%LIB%\ui.cmd" step 14/17 "auditar.cmd" "YA EXISTE"
124
+ ) else (
125
+ call "%LIB%\templates.cmd" write_auditar
126
+ call "%LIB%\ui.cmd" step 14/17 "auditar.cmd" "CREADO"
127
+ )
128
+
129
+ if exist ".forge\commands\serve.cmd" (
130
+ call "%LIB%\ui.cmd" step 15/17 "serve.cmd" "YA EXISTE"
131
+ ) else (
132
+ call "%LIB%\templates.cmd" write_serve
133
+ call "%LIB%\ui.cmd" step 15/17 "serve.cmd" "CREADO"
134
+ )
135
+
162
136
  call "%LIB%\git-ops.cmd" has_changes
163
137
  if errorlevel 1 (
164
138
  set "USER_MSG="
@@ -170,7 +144,6 @@ if errorlevel 1 (
170
144
  call "%LIB%\ui.cmd" step 16/17 "Sin cambios para commit" "SKIP"
171
145
  )
172
146
 
173
- REM --- STEP 17/17: Tag ---
174
147
  call "%LIB%\git-ops.cmd" tag
175
148
  if errorlevel 1 (
176
149
  call "%LIB%\ui.cmd" step 17/17 "Tag %TAG_INITIAL%" "CREADO"
package/forge.cmd CHANGED
@@ -17,12 +17,13 @@ if "!ESC!"=="" (
17
17
  )
18
18
 
19
19
  set "CMD_DIR=.forge\commands"
20
+ set "INIT_CMD=.forge\init.cmd"
20
21
 
21
22
  REM --- Verificar instalacion ---
22
- if not exist "%CMD_DIR%\save.cmd" (
23
+ if not exist "%INIT_CMD%" (
23
24
  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
25
+ echo !C_RE![X]!C_RS! forgeGit no esta instalado correctamente.
26
+ echo !C_GY!Falta .forge\init.cmd!C_RS!
26
27
  echo.
27
28
  pause
28
29
  exit /b 1
@@ -30,6 +31,7 @@ if not exist "%CMD_DIR%\save.cmd" (
30
31
 
31
32
  REM --- Modo CLI directo ---
32
33
  if not "%~1"=="" (
34
+ if /i "%~1"=="init" ( call "%INIT_CMD%" %2 %3 & exit /b 0 )
33
35
  if /i "%~1"=="save" ( call "%CMD_DIR%\save.cmd" & exit /b 0 )
34
36
  if /i "%~1"=="push" ( call "%CMD_DIR%\push.cmd" & exit /b 0 )
35
37
  if /i "%~1"=="snap" ( call "%CMD_DIR%\snapshots.cmd" & exit /b 0 )
@@ -67,6 +69,7 @@ echo !C_YE![6]!C_RS! Abrir en VS Code
67
69
  echo !C_YE![7]!C_RS! Servidor dev !C_GY!(auto-detect)!C_RS!
68
70
  echo.
69
71
  echo !C_BC!Sistema:!C_RS!
72
+ echo !C_YE![r]!C_RS! Re-bootstrap !C_GY!(init --force)!C_RS!
70
73
  echo !C_YE![0]!C_RS! Salir
71
74
  echo.
72
75
  echo !C_CY!--------------------------------------------!C_RS!
@@ -82,6 +85,7 @@ if "!OPT!"=="4" ( call "%CMD_DIR%\snapshots.cmd" & echo. & pause & goto :menu )
82
85
  if "!OPT!"=="5" ( call "%CMD_DIR%\auditar.cmd" & echo. & pause & goto :menu )
83
86
  if "!OPT!"=="6" ( call "%CMD_DIR%\abrir.cmd" & echo. & pause & goto :menu )
84
87
  if "!OPT!"=="7" ( call "%CMD_DIR%\serve.cmd" & echo. & pause & goto :menu )
88
+ if /i "!OPT!"=="r" ( call "%INIT_CMD%" --force & echo. & pause & goto :menu )
85
89
  if "!OPT!"=="0" goto :end
86
90
  if /i "!OPT!"=="q" goto :end
87
91
 
@@ -98,6 +102,8 @@ echo !C_CY!============================================!C_RS!
98
102
  echo.
99
103
  echo !C_BC!USO:!C_RS!
100
104
  echo !C_WH!forge!C_RS! Menu interactivo
105
+ echo !C_WH!forge init!C_RS! Bootstrap (re-instalar)
106
+ echo !C_WH!forge init --force!C_RS! Regenerar todo
101
107
  echo !C_WH!forge save!C_RS! Guardar cambios
102
108
  echo !C_WH!forge push!C_RS! Subir a GitHub
103
109
  echo !C_WH!forge snap!C_RS! Snapshots
package/package.json CHANGED
@@ -1,19 +1,15 @@
1
1
  {
2
2
  "name": "forgegit",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
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",
14
12
  ".forge/",
15
- "lib/",
16
- "templates/",
17
13
  "tests/test.cmd",
18
14
  "tools/install.cmd",
19
15
  "tools/uninstall.cmd",
@@ -23,12 +19,7 @@
23
19
  "tools/bin/forge.cmd",
24
20
  "tools/bin/forge-update.cmd"
25
21
  ],
26
- "keywords": [
27
- "git",
28
- "bootstrap",
29
- "windows",
30
- "cli"
31
- ],
22
+ "keywords": ["git", "bootstrap", "windows", "cli"],
32
23
  "author": "vloitz",
33
24
  "license": "MIT",
34
25
  "repository": {
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