vtex-init-helper 1.0.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 +86 -0
- package/dist/index.js +20 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# vtex-init-helper
|
|
2
|
+
|
|
3
|
+
CLI para automatizar el inicio de tareas VTEX desde tickets de Jira.
|
|
4
|
+
|
|
5
|
+
## ¿Qué hace?
|
|
6
|
+
|
|
7
|
+
1. **Obtiene datos del ticket** de Jira (ID y título).
|
|
8
|
+
2. **Sugiere un nombre de rama** basado en el ticket.
|
|
9
|
+
3. **Lista repositorios** de Bitbucket con búsqueda difusa.
|
|
10
|
+
4. **Crea la rama remota** en el repositorio seleccionado.
|
|
11
|
+
5. **Clona el repositorio** y hace checkout a la rama.
|
|
12
|
+
6. **Configura el entorno VTEX** (switch, workspace, link).
|
|
13
|
+
|
|
14
|
+
## Instalación
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g .
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
O para desarrollo:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm run build
|
|
24
|
+
npm link
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Uso
|
|
28
|
+
|
|
29
|
+
### 1. Configurar credenciales (una sola vez)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
vtex-init config
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Se solicitarán:
|
|
36
|
+
- Dominio de Jira, email y API Token
|
|
37
|
+
- Workspace de Bitbucket y API Token
|
|
38
|
+
|
|
39
|
+
### 2. Iniciar una tarea
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
vtex-init ONIL-558
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
El CLI te guiará paso a paso a través de todo el flujo.
|
|
46
|
+
|
|
47
|
+
## Estructura del Proyecto
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
src/
|
|
51
|
+
├── index.ts # Entry point (commander)
|
|
52
|
+
├── commands/
|
|
53
|
+
│ ├── config.ts # Comando de configuración
|
|
54
|
+
│ └── init.ts # Flujo principal
|
|
55
|
+
├── services/
|
|
56
|
+
│ ├── jira.ts # API de Jira
|
|
57
|
+
│ └── bitbucket.ts # API de Bitbucket
|
|
58
|
+
└── utils/
|
|
59
|
+
├── config.ts # Manejo de configuración (conf)
|
|
60
|
+
├── branch.ts # Generación de nombres de rama
|
|
61
|
+
└── shell.ts # Wrappers de execSync
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Configuración
|
|
65
|
+
|
|
66
|
+
Las credenciales se almacenan en `~/.config/vtex-init-helper/config.json`.
|
|
67
|
+
|
|
68
|
+
> ⚠️ **Nota de seguridad**: Actualmente las credenciales se almacenan en texto plano.
|
|
69
|
+
> En una versión futura se planea implementar cifrado de credenciales (ej. con `keytar`
|
|
70
|
+
> o cifrado AES con master password). Para el MVP esto es aceptable.
|
|
71
|
+
|
|
72
|
+
## Requisitos
|
|
73
|
+
|
|
74
|
+
- Node.js 18+
|
|
75
|
+
- VTEX Toolbelt instalado globalmente (`vtex`)
|
|
76
|
+
- Git
|
|
77
|
+
- Cuenta de Jira con API Token
|
|
78
|
+
- Cuenta de Bitbucket con API Token (con scope `repository:write`)
|
|
79
|
+
|
|
80
|
+
## Desarrollo
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm run dev # Compilación en modo watch
|
|
84
|
+
npm run build # Compilación de producción
|
|
85
|
+
npm start # Ejecutar dist/index.js
|
|
86
|
+
```
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { configCommand } from './commands/config.js';
|
|
4
|
+
import { initCommand } from './commands/init.js';
|
|
5
|
+
const program = new Command();
|
|
6
|
+
program
|
|
7
|
+
.name('vtex-init')
|
|
8
|
+
.description('CLI para automatizar el inicio de tareas VTEX desde tickets de Jira')
|
|
9
|
+
.version('1.0.0');
|
|
10
|
+
program
|
|
11
|
+
.command('config')
|
|
12
|
+
.description('Configurar credenciales de Jira y Bitbucket')
|
|
13
|
+
.action(configCommand);
|
|
14
|
+
program
|
|
15
|
+
.argument('<ticketId>', 'ID del ticket de Jira (ej. ONIL-558)')
|
|
16
|
+
.action(async (ticketId) => {
|
|
17
|
+
await initCommand(ticketId);
|
|
18
|
+
});
|
|
19
|
+
program.parse();
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vtex-init-helper",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI tool to automate VTEX task initialization from Jira tickets",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"vtex-init": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"dev": "tsc -w",
|
|
12
|
+
"start": "node dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/emanueleelias/vtex-init-helper.git"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [],
|
|
19
|
+
"author": "",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/emanueleelias/vtex-init-helper/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/emanueleelias/vtex-init-helper#readme",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"axios": "^1.13.6",
|
|
28
|
+
"chalk": "^5.6.2",
|
|
29
|
+
"commander": "^14.0.3",
|
|
30
|
+
"conf": "^15.1.0",
|
|
31
|
+
"inquirer": "^9.3.8",
|
|
32
|
+
"inquirer-autocomplete-prompt": "^3.0.1",
|
|
33
|
+
"ora": "^9.3.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/inquirer": "^9.0.9",
|
|
37
|
+
"@types/node": "^25.3.3",
|
|
38
|
+
"typescript": "^5.9.3"
|
|
39
|
+
},
|
|
40
|
+
"files": "[\"dist\", \"README.md\"]"
|
|
41
|
+
}
|