forgegit 1.2.2 → 1.3.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 CHANGED
@@ -1,26 +1,130 @@
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
-
1
+ # forgeGit
2
+
3
+ Universal Git bootstrap kit for Windows.
4
+
5
+ ## What it is
6
+
7
+ forgeGit is a small toolkit that eliminates the repetitive setup work
8
+ of starting a new Git project. Instead of manually copying `.gitignore`,
9
+ creating a README, making the first commit, and tagging a version,
10
+ you run one command and the project is ready.
11
+
12
+ Born from a real annoyance: copying the same 6 files into every new
13
+ project, over and over, for years.
14
+
15
+ ## What it does
16
+
17
+ Running `forge` in an empty folder:
18
+
19
+ - Initializes a Git repository
20
+ - Sets `main` as default branch
21
+ - Creates a universal `.gitignore` (covers Node, Python, Rust, Go)
22
+ - Generates an adaptive `README.md`
23
+ - Creates initial commit + tag `v1.0.0`
24
+ - Generates 7 helper commands in the project
25
+
26
+ ## The 7 helpers
27
+
28
+ | File | Purpose |
29
+ |------|---------|
30
+ | `guardar.cmd` | Commit changes locally |
31
+ | `subir.cmd` | Push to GitHub |
32
+ | `snapshots.cmd` | Create/restore full project snapshots |
33
+ | `historial.cmd` | View recent commits |
34
+ | `auditar.cmd` | Generate diff reports (for AI review) |
35
+ | `abrir.cmd` | Open project in VS Code |
36
+ | `init.cmd` | Re-bootstrap (idempotent) |
37
+
38
+ ## Install
39
+
40
+ ### Option A - npm (recommended)
41
+
42
+ ```cmd
43
+ npm install -g forgegit
44
+ ```
45
+
46
+ ### Option B - GitHub Release
47
+
48
+ Download the ZIP from:
49
+ https://github.com/vloitz/forgeGit/releases/latest
50
+
51
+ Extract anywhere. Run `tools\install.cmd` once.
52
+
53
+ ## Usage
54
+
55
+ ```cmd
56
+ cd any\project\folder
57
+ forge
58
+ ```
59
+
60
+ The folder becomes a fully configured Git repository with helpers.
61
+
62
+ ## Global commands
63
+
64
+ ```cmd
65
+ forge Bootstrap current directory
66
+ forge update Sync templates from kit
67
+ forge help Show help
68
+ ```
69
+
70
+ ## Philosophy
71
+
72
+ - **Idempotent**: safe to run multiple times, never overwrites user files
73
+ - **Modular**: templates live in .tpl files, separated from logic
74
+ - **Portable**: works in any Windows folder, any project type
75
+ - **Configurable**: edit `config.cmd`, not the logic
76
+ - **Self-documenting**: generates colored terminal output
77
+ - **Batteries included**: snapshots, audit reports, tests
78
+
79
+ ## Structure
80
+
81
+ ```
82
+ forgeGit/
83
+ ├── init.cmd Entry point (14 steps)
84
+ ├── config.cmd Configuration values
85
+ ├── MANUAL.md Full user manual
86
+ ├── FUTURE.md Roadmap / ideas
87
+ ├── lib/ Internal modules
88
+ │ ├── ui.cmd Terminal UI helpers
89
+ │ ├── git-ops.cmd Git operations
90
+ │ └── templates.cmd Template renderer
91
+ ├── templates/ Source templates (.tpl)
92
+ ├── tools/ Author tools
93
+ │ ├── install.cmd Install forge globally
94
+ │ ├── uninstall.cmd Uninstall forge
95
+ │ ├── restore.cmd Restore PATH from backup
96
+ │ ├── pack.cmd Build clean distribution
97
+ │ ├── release.cmd Build ZIP + open GitHub
98
+ │ └── bin/forge.cmd Global command
99
+ └── tests/ Automated tests (14/14)
100
+ ```
101
+
102
+ ## Requirements
103
+
104
+ - Windows 10 or 11
105
+ - Node.js 18+
106
+ - Git 2.30+
107
+ - VS Code CLI (optional, for `abrir.cmd`)
108
+
109
+ ## Status
110
+
111
+ - Version: 1.2.2
112
+ - Published: npm + GitHub Release
113
+ - Tests: 14/14 passing
114
+ - Platform: Windows only (Linux/Mac planned as Node.js CLI)
115
+
116
+ ## Roadmap
117
+
118
+ See [FUTURE.md](FUTURE.md) for the plan to convert this into a
119
+ cross-platform Node.js CLI (zero friction, no .cmd files in projects).
120
+
121
+ ## Links
122
+
123
+ - Repository: https://github.com/vloitz/forgeGit
124
+ - npm: https://www.npmjs.com/package/forgegit
125
+ - Releases: https://github.com/vloitz/forgeGit/releases
126
+ - Manual: [MANUAL.md](MANUAL.md)
127
+
128
+ ## License
129
+
130
+ MIT
package/config.cmd CHANGED
@@ -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.2.0"
7
+ set "FG_VERSION=1.3.0"
8
8
  set "TAG_INITIAL=v1.0.0"
9
9
  set "TAG_MESSAGE=Primera version estable"
10
10
  set "BRANCH_MAIN=main"
package/init.cmd CHANGED
@@ -6,9 +6,19 @@ cd /d "%~dp0"
6
6
  cls
7
7
 
8
8
  set "ROOT=%~dp0"
9
- set "LIB=%ROOT%lib"
10
9
 
11
- REM --- Force mode: init.cmd --force o init.cmd force ---
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 ---
12
22
  set "FORCE=0"
13
23
  if /i "%~1"=="--force" set "FORCE=1"
14
24
  if /i "%~1"=="force" set "FORCE=1"
@@ -20,158 +30,146 @@ for %%a in ("%CD%") do set "PROJECT_NAME=%%~nxa"
20
30
 
21
31
  call "%LIB%\ui.cmd" banner
22
32
 
23
- REM --- STEP 1/14: Node.js ---
33
+ REM --- STEP 1/16: Node.js ---
24
34
  where node >nul 2>nul
25
35
  if errorlevel 1 (
26
- echo [1/14] Node.js MISSING
36
+ echo [1/16] Node.js MISSING
27
37
  echo Descargalo desde: https://nodejs.org/
28
38
  goto :abort
29
39
  )
30
40
  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"
41
+ call "%LIB%\ui.cmd" step 1/16 "Node.js !NODE_VER!" "OK"
32
42
 
33
- REM --- STEP 2/14: Git ---
43
+ REM --- STEP 2/16: Git ---
34
44
  where git >nul 2>nul
35
45
  if errorlevel 1 (
36
- echo [2/14] Git MISSING
46
+ echo [2/16] Git MISSING
37
47
  echo Descargalo desde: https://git-scm.com/download/win
38
48
  goto :abort
39
49
  )
40
50
  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"
51
+ call "%LIB%\ui.cmd" step 2/16 "!GIT_VER!" "OK"
42
52
 
43
- REM --- STEP 3/14: Init repo ---
53
+ REM --- STEP 3/16: Init repo ---
44
54
  call "%LIB%\git-ops.cmd" init
45
55
 
46
- REM --- STEP 4/14: Branch main ---
56
+ REM --- STEP 4/16: Branch main ---
47
57
  call "%LIB%\git-ops.cmd" branch_main
48
58
 
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 ---
59
+ REM --- STEP 5/16: 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/16 "Estructura .forge/" "CREADO"
66
+ goto :step6
67
+ :step5_ok
68
+ call "%LIB%\ui.cmd" step 5/16 "Estructura .forge/" "YA EXISTE"
69
+
70
+ :step6
71
+ REM --- STEP 6/16: .gitignore ---
72
+ if exist ".gitignore" goto :step6_ok
73
+ call "%LIB%\templates.cmd" write_gitignore
74
+ call "%LIB%\ui.cmd" step 6/16 ".gitignore universal" "CREADO"
75
+ goto :step7
76
+ :step6_ok
77
+ call "%LIB%\ui.cmd" step 6/16 ".gitignore" "YA EXISTE"
78
+
79
+ :step7
80
+ REM --- STEP 7/16: README.md ---
81
+ if exist "README.md" goto :step7_ok
82
+ call "%LIB%\templates.cmd" write_readme
83
+ call "%LIB%\ui.cmd" step 7/16 "README.md adaptativo" "CREADO"
84
+ goto :step8
85
+ :step7_ok
86
+ call "%LIB%\ui.cmd" step 7/16 "README.md" "YA EXISTE"
87
+
88
+ :step8
89
+ REM --- STEP 8/16: forge.cmd ---
90
+ if exist "forge.cmd" goto :step8_ok
91
+ call "%LIB%\templates.cmd" write_forge
92
+ call "%LIB%\ui.cmd" step 8/16 "forge.cmd menu" "CREADO"
93
+ goto :step9
94
+ :step8_ok
95
+ call "%LIB%\ui.cmd" step 8/16 "forge.cmd" "YA EXISTE"
96
+
97
+ :step9
98
+ REM --- STEP 9/16: 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/16 "save.cmd" "CREADO"
102
+ goto :step10
103
+ :step9_ok
104
+ call "%LIB%\ui.cmd" step 9/16 "save.cmd" "YA EXISTE"
105
+
106
+ :step10
107
+ REM --- STEP 10/16: 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/16 "push.cmd" "CREADO"
111
+ goto :step11
112
+ :step10_ok
113
+ call "%LIB%\ui.cmd" step 10/16 "push.cmd" "YA EXISTE"
114
+
115
+ :step11
116
+ REM --- STEP 11/16: 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/16 "snapshots.cmd" "CREADO"
120
+ goto :step12
121
+ :step11_ok
122
+ call "%LIB%\ui.cmd" step 11/16 "snapshots.cmd" "YA EXISTE"
123
+
124
+ :step12
125
+ REM --- STEP 12/16: 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/16 "historial.cmd" "CREADO"
129
+ goto :step13
130
+ :step12_ok
131
+ call "%LIB%\ui.cmd" step 12/16 "historial.cmd" "YA EXISTE"
132
+
133
+ :step13
134
+ REM --- STEP 13/16: 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/16 "abrir.cmd" "CREADO"
138
+ goto :step14
139
+ :step13_ok
140
+ call "%LIB%\ui.cmd" step 13/16 "abrir.cmd" "YA EXISTE"
141
+
142
+ :step14
143
+ REM --- STEP 14/16: 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/16 "auditar.cmd" "CREADO"
147
+ goto :step15
148
+ :step14_ok
149
+ call "%LIB%\ui.cmd" step 14/16 "auditar.cmd" "YA EXISTE"
150
+
151
+ :step15
152
+ REM --- STEP 15/16: Commit ---
154
153
  call "%LIB%\git-ops.cmd" has_changes
155
154
  if errorlevel 1 (
156
155
  set "USER_MSG="
157
156
  set /p "USER_MSG= Mensaje del commit [Enter = default]: "
158
157
  if "!USER_MSG!"=="" set "USER_MSG=%COMMIT_MESSAGE%"
159
158
  call "%LIB%\git-ops.cmd" commit "!USER_MSG!"
160
- call "%LIB%\ui.cmd" step 13/14 "Commit: !USER_MSG!" "CREADO"
159
+ call "%LIB%\ui.cmd" step 15/16 "Commit: !USER_MSG!" "CREADO"
161
160
  ) else (
162
- call "%LIB%\ui.cmd" step 13/14 "Sin cambios para commit" "SKIP"
161
+ call "%LIB%\ui.cmd" step 15/16 "Sin cambios para commit" "SKIP"
163
162
  )
164
163
 
165
- REM --- STEP 14/14: Tag ---
164
+ REM --- STEP 16/16: Tag ---
166
165
  call "%LIB%\git-ops.cmd" tag
167
166
  if errorlevel 1 (
168
- call "%LIB%\ui.cmd" step 14/14 "Tag %TAG_INITIAL%" "CREADO"
167
+ call "%LIB%\ui.cmd" step 16/16 "Tag %TAG_INITIAL%" "CREADO"
169
168
  ) else (
170
- call "%LIB%\ui.cmd" step 14/14 "Tag %TAG_INITIAL%" "YA EXISTE"
169
+ call "%LIB%\ui.cmd" step 16/16 "Tag %TAG_INITIAL%" "YA EXISTE"
171
170
  )
172
171
 
173
172
  call "%LIB%\ui.cmd" done
174
-
175
173
  call :shell_if_double_click
176
174
  endlocal
177
175
  exit /b 0
package/lib/git-ops.cmd CHANGED
@@ -15,6 +15,18 @@ REM 0 = nothing to do (already exists / no changes)
15
15
  REM 1 = action performed
16
16
  REM ============================================================
17
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
+
18
30
  if "%~1"=="init" goto :init
19
31
  if "%~1"=="branch_main" goto :branch_main
20
32
  if "%~1"=="has_changes" goto :has_changes
@@ -23,47 +35,58 @@ if "%~1"=="tag" goto :tag
23
35
  goto :eof
24
36
 
25
37
  :init
38
+ pushd "%PROJECT_ROOT%"
26
39
  if exist ".git" (
27
- call "%~dp0ui.cmd" step 3/14 "Repositorio Git" "YA EXISTE"
40
+ popd
41
+ call "%~dp0ui.cmd" step 3/16 "Repositorio Git" "YA EXISTE"
28
42
  exit /b 0
29
43
  )
30
44
  git init -q
31
45
  if errorlevel 1 (
32
- call "%~dp0ui.cmd" step 3/14 "Repositorio Git" "ERROR"
46
+ popd
47
+ call "%~dp0ui.cmd" step 3/16 "Repositorio Git" "ERROR"
33
48
  exit /b 1
34
49
  )
35
- call "%~dp0ui.cmd" step 3/14 "Repositorio Git" "CREADO"
50
+ popd
51
+ call "%~dp0ui.cmd" step 3/16 "Repositorio Git" "CREADO"
36
52
  exit /b 1
37
53
 
38
54
  :branch_main
55
+ pushd "%PROJECT_ROOT%"
39
56
  git branch -M %BRANCH_MAIN% >nul 2>nul
40
- call "%~dp0ui.cmd" step 4/14 "Rama principal: %BRANCH_MAIN%" "OK"
57
+ popd
58
+ call "%~dp0ui.cmd" step 4/16 "Rama principal: %BRANCH_MAIN%" "OK"
41
59
  exit /b 0
42
60
 
43
61
  :has_changes
62
+ pushd "%PROJECT_ROOT%"
44
63
  git add -A >nul 2>nul
45
64
  git diff --cached --quiet
46
- if errorlevel 1 (
47
- exit /b 1
48
- ) else (
49
- exit /b 0
50
- )
65
+ set "RC=%ERRORLEVEL%"
66
+ popd
67
+ if %RC% NEQ 0 ( exit /b 1 ) else ( exit /b 0 )
51
68
 
52
69
  :commit
53
- REM %~2 = mensaje opcional
54
70
  set "MSG=%~2"
55
71
  if "!MSG!"=="" set "MSG=%COMMIT_MESSAGE%"
72
+ pushd "%PROJECT_ROOT%"
56
73
  git commit -q -m "!MSG!"
57
- exit /b 1
74
+ set "RC=%ERRORLEVEL%"
75
+ popd
76
+ if %RC% NEQ 0 ( exit /b 0 ) else ( exit /b 1 )
58
77
 
59
78
  :tag
79
+ pushd "%PROJECT_ROOT%"
60
80
  git rev-parse %TAG_INITIAL% >nul 2>nul
61
81
  if not errorlevel 1 (
82
+ popd
62
83
  exit /b 0
63
84
  )
64
85
  git rev-parse HEAD >nul 2>nul
65
86
  if errorlevel 1 (
87
+ popd
66
88
  exit /b 0
67
89
  )
68
90
  git tag -a %TAG_INITIAL% -m "%TAG_MESSAGE%" 2>nul
91
+ popd
69
92
  exit /b 1
package/lib/templates.cmd CHANGED
@@ -1,58 +1,77 @@
1
1
  @echo off
2
2
  REM ============================================================
3
3
  REM forge-git / lib/templates.cmd
4
- REM Copies templates from templates/ to project root
4
+ REM Copies templates from templates/ to destinations
5
5
  REM ============================================================
6
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
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
15
16
  goto :eof
16
17
 
18
+ REM --- Templates que van a la RAIZ ---
17
19
  :write_gitignore
18
- call :copy_template "gitignore.tpl" ".gitignore"
20
+ call :copy_root "gitignore.tpl" ".gitignore"
19
21
  goto :eof
20
22
 
21
- :write_guardar
22
- call :copy_template "guardar.cmd.tpl" "guardar.cmd"
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
+ REM --- Templates que van a .forge/commands/ ---
32
+ :write_save
33
+ call :copy_cmd "save.cmd.tpl" "save.cmd"
23
34
  goto :eof
24
35
 
25
- :write_subir
26
- call :copy_template "subir.cmd.tpl" "subir.cmd"
36
+ :write_push
37
+ call :copy_cmd "push.cmd.tpl" "push.cmd"
27
38
  goto :eof
28
39
 
29
40
  :write_snapshots
30
- call :copy_template "snapshots.cmd.tpl" "snapshots.cmd"
41
+ call :copy_cmd "snapshots.cmd.tpl" "snapshots.cmd"
31
42
  goto :eof
32
43
 
33
44
  :write_historial
34
- call :copy_template "historial.cmd.tpl" "historial.cmd"
45
+ call :copy_cmd "historial.cmd.tpl" "historial.cmd"
35
46
  goto :eof
36
47
 
37
48
  :write_abrir
38
- call :copy_template "abrir.cmd.tpl" "abrir.cmd"
49
+ call :copy_cmd "abrir.cmd.tpl" "abrir.cmd"
39
50
  goto :eof
40
51
 
41
52
  :write_auditar
42
- call :copy_template "auditar.cmd.tpl" "auditar.cmd"
53
+ call :copy_cmd "auditar.cmd.tpl" "auditar.cmd"
43
54
  goto :eof
44
55
 
45
- :write_readme
46
- call :apply_template "readme.md.tpl" "README.md"
47
- goto :eof
56
+ REM ============================================================
57
+ REM :copy_root - Copy to project root
58
+ REM ============================================================
59
+ :copy_root
60
+ set "SRC=%~dp0..\templates\%~1"
61
+ set "DST=%~dp0..\..\%~2"
62
+ if not exist "%SRC%" (
63
+ echo [X] Template no encontrado: %SRC%
64
+ exit /b 1
65
+ )
66
+ copy /Y "%SRC%" "%DST%" >nul
67
+ exit /b 0
48
68
 
49
69
  REM ============================================================
50
- REM :copy_template
51
- REM Copies templates/<file> to project root/<dest>
70
+ REM :copy_cmd - Copy to .forge/commands/
52
71
  REM ============================================================
53
- :copy_template
72
+ :copy_cmd
54
73
  set "SRC=%~dp0..\templates\%~1"
55
- set "DST=%~dp0..\%~2"
74
+ set "DST=%~dp0..\commands\%~2"
56
75
  if not exist "%SRC%" (
57
76
  echo [X] Template no encontrado: %SRC%
58
77
  exit /b 1
@@ -61,12 +80,11 @@ copy /Y "%SRC%" "%DST%" >nul
61
80
  exit /b 0
62
81
 
63
82
  REM ============================================================
64
- REM :apply_template
65
- REM Copies with {{PLACEHOLDER}} substitution
83
+ REM :apply_root - Copy with substitution to project root
66
84
  REM ============================================================
67
- :apply_template
85
+ :apply_root
68
86
  set "SRC=%~dp0..\templates\%~1"
69
- set "DST=%~dp0..\%~2"
87
+ set "DST=%~dp0..\..\%~2"
70
88
  if not exist "%SRC%" (
71
89
  echo [X] Template no encontrado: %SRC%
72
90
  exit /b 1
package/lib/ui.cmd CHANGED
@@ -1,13 +1,7 @@
1
1
  @echo off
2
2
  REM ============================================================
3
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
4
+ REM UI helpers
11
5
  REM ============================================================
12
6
 
13
7
  if "%~1"=="banner" goto :banner
@@ -29,7 +23,6 @@ echo.
29
23
  goto :eof
30
24
 
31
25
  :step
32
- REM %2 = step id (1/12), %3 = label, %4 = status
33
26
  echo [%~2] %~3 %~4
34
27
  goto :eof
35
28
 
@@ -43,16 +36,18 @@ echo Comandos disponibles:
43
36
  echo.
44
37
  echo Esenciales:
45
38
  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
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 help Ayuda completa
56
51
  echo.
57
52
  goto :eof
58
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forgegit",
3
- "version": "1.2.2",
3
+ "version": "1.3.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,110 @@
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 (forge save, forge push, etc) ---
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"=="help" goto :help
40
+ if /i "%~1"=="-h" goto :help
41
+ if /i "%~1"=="--help" goto :help
42
+ echo !C_RE![X]!C_RS! Comando desconocido: %~1
43
+ echo !C_GY!Usa: forge help!C_RS!
44
+ exit /b 1
45
+ )
46
+
47
+ REM ============================================================
48
+ REM MENU PRINCIPAL (doble clic sin argumentos)
49
+ REM ============================================================
50
+ :menu
51
+ cls
52
+ echo.
53
+ echo !C_CY!============================================!C_RS!
54
+ echo !C_BC! forgeGit!C_RS! !C_GY!- Menu!C_RS!
55
+ echo !C_CY!============================================!C_RS!
56
+ echo.
57
+ echo !C_BC!Trabajo diario:!C_RS!
58
+ echo !C_YE![1]!C_RS! Guardar cambios !C_GY!(commit)!C_RS!
59
+ echo !C_YE![2]!C_RS! Subir a GitHub !C_GY!(push)!C_RS!
60
+ echo !C_YE![3]!C_RS! Historial !C_GY!(ver commits)!C_RS!
61
+ echo.
62
+ echo !C_BC!Herramientas:!C_RS!
63
+ echo !C_YE![4]!C_RS! Snapshots !C_GY!(backup/restore)!C_RS!
64
+ echo !C_YE![5]!C_RS! Auditar cambios !C_GY!(diff report)!C_RS!
65
+ echo !C_YE![6]!C_RS! Abrir en VS Code
66
+ echo.
67
+ echo !C_BC!Sistema:!C_RS!
68
+ echo !C_YE![0]!C_RS! Salir
69
+ echo.
70
+ echo !C_CY!--------------------------------------------!C_RS!
71
+ echo.
72
+
73
+ set "OPT="
74
+ set /p "OPT= !C_BC!Opcion!C_RS!: "
75
+
76
+ if "!OPT!"=="1" ( call "%CMD_DIR%\save.cmd" & echo. & pause & goto :menu )
77
+ if "!OPT!"=="2" ( call "%CMD_DIR%\push.cmd" & echo. & pause & goto :menu )
78
+ if "!OPT!"=="3" ( call "%CMD_DIR%\historial.cmd" & echo. & pause & goto :menu )
79
+ if "!OPT!"=="4" ( call "%CMD_DIR%\snapshots.cmd" & echo. & pause & goto :menu )
80
+ if "!OPT!"=="5" ( call "%CMD_DIR%\auditar.cmd" & echo. & pause & goto :menu )
81
+ if "!OPT!"=="6" ( call "%CMD_DIR%\abrir.cmd" & echo. & pause & goto :menu )
82
+ if "!OPT!"=="0" goto :end
83
+ if /i "!OPT!"=="q" goto :end
84
+
85
+ goto :menu
86
+
87
+ REM ============================================================
88
+ REM HELP
89
+ REM ============================================================
90
+ :help
91
+ echo.
92
+ echo !C_CY!============================================!C_RS!
93
+ echo !C_BC! forgeGit!C_RS! !C_GY!- Ayuda!C_RS!
94
+ echo !C_CY!============================================!C_RS!
95
+ echo.
96
+ echo !C_BC!USO:!C_RS!
97
+ echo !C_WH!forge!C_RS! Menu interactivo
98
+ echo !C_WH!forge save!C_RS! Guardar cambios
99
+ echo !C_WH!forge push!C_RS! Subir a GitHub
100
+ echo !C_WH!forge snap!C_RS! Snapshots
101
+ echo !C_WH!forge log!C_RS! Historial
102
+ echo !C_WH!forge audit!C_RS! Auditar cambios
103
+ echo !C_WH!forge open!C_RS! Abrir en VS Code
104
+ echo !C_WH!forge help!C_RS! Esta ayuda
105
+ echo.
106
+ goto :end
107
+
108
+ :end
109
+ endlocal
110
+ 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!
@@ -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"