huntban-cli 1.0.0 → 1.0.3
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 +213 -0
- package/bin/huntban.js +1 -1
- package/lib/api.js +9 -1
- package/lib/commands/config.js +2 -2
- package/lib/commands/init.js +5 -4
- package/lib/config.js +21 -1
- package/package.json +18 -3
- package/templates/SKILL.md +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# Huntban CLI
|
|
2
|
+
|
|
3
|
+
Herramienta de terminal oficial para automatizar tableros, tareas y flujos de trabajo en **Huntban**, diseñada tanto para desarrolladores como para agentes autónomos de IA como **Antigravity**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Instalación
|
|
8
|
+
|
|
9
|
+
### Opción A: Instalación Global vía npm
|
|
10
|
+
Para utilizar el comando `huntban` en cualquier terminal de tu sistema:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g huntban-cli
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Opción B: Instalación Local en Desarrollo (`npm link`)
|
|
17
|
+
Si estás trabajando sobre el código fuente del CLI en local:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
cd huntban-cli
|
|
21
|
+
npm link
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Opción C: Ejecución sin instalación con `npx`
|
|
25
|
+
Puedes ejecutar comandos directamente sin instalarlo globalmente:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx huntban-cli <comando> [argumentos]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Verifica la instalación:
|
|
32
|
+
```bash
|
|
33
|
+
huntban --version
|
|
34
|
+
huntban --help
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 2. Guía para Publicar el Paquete en npm
|
|
40
|
+
|
|
41
|
+
Si eres mantenedor del proyecto y deseas publicar una nueva versión en el registro de npm:
|
|
42
|
+
|
|
43
|
+
### Paso 2.1: Probar el empaquetado (Dry Run)
|
|
44
|
+
Verifica qué archivos serán incluidos en el paquete antes de subirlo:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm pack --dry-run
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Asegúrate de que solo se incluyan las carpetas `bin/`, `lib/`, `templates/` y la documentación `README.md`.
|
|
51
|
+
|
|
52
|
+
### Paso 2.2: Iniciar sesión en npm
|
|
53
|
+
Si no has iniciado sesión en tu máquina:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm login
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Paso 2.3: Incrementar la versión
|
|
60
|
+
Utiliza el estándar de versionado semántico (SemVer):
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Corrección de errores o parches (1.0.0 -> 1.0.1)
|
|
64
|
+
npm version patch
|
|
65
|
+
|
|
66
|
+
# Nuevas características compatibles (1.0.0 -> 1.1.0)
|
|
67
|
+
npm version minor
|
|
68
|
+
|
|
69
|
+
# Cambios mayores incompatibles (1.0.0 -> 2.0.0)
|
|
70
|
+
npm version major
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Paso 2.4: Publicar
|
|
74
|
+
Publica el paquete con visibilidad pública:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm publish --access public
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 3. Vincular un Repositorio a Huntban (`huntban attach`)
|
|
83
|
+
|
|
84
|
+
Puedes conectar cualquier repositorio de código a su tablero correspondiente en Huntban con un solo comando:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
huntban attach
|
|
88
|
+
# o también:
|
|
89
|
+
huntban init
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### ¿Qué realiza automáticamente?
|
|
93
|
+
1. **Instala el skill en el proyecto**: Crea `.agents/skills/huntban-connector/SKILL.md` para que Antigravity comprenda todos los flujos del tablero en este repositorio.
|
|
94
|
+
2. **Asistente de credenciales**: Te solicita interactivamente los datos de tu tablero y genera `.huntban.json`.
|
|
95
|
+
3. **Protección `.gitignore`**: Agrega `.huntban.json` al `.gitignore` para no exponer secretos en git.
|
|
96
|
+
4. **Prueba de conexión**: Valida la conexión y lista las columnas activas.
|
|
97
|
+
|
|
98
|
+
### Parámetros en una sola línea (para CI/CD o scripts):
|
|
99
|
+
```bash
|
|
100
|
+
huntban attach \
|
|
101
|
+
--url https://next.huntban.com/ \
|
|
102
|
+
--board <ID_DEL_TABLERO> \
|
|
103
|
+
--key <API_KEY> \
|
|
104
|
+
--secret <API_SECRET> \
|
|
105
|
+
--email tu-correo@empresa.com
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Instalación Global de la Habilidad para Antigravity:
|
|
109
|
+
Para habilitar el skill de Antigravity en **todos** los repositorios de tu máquina de forma permanente:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
huntban attach --global
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 4. Configuración y Credenciales
|
|
118
|
+
|
|
119
|
+
### Dónde obtener las credenciales en Huntban:
|
|
120
|
+
1. Abre tu tablero en la web de Huntban.
|
|
121
|
+
2. Haz clic en el ícono de **Configuración del Tablero (⚙️)** en la cabecera.
|
|
122
|
+
3. Ve a la pestaña **Conector / Webhooks**.
|
|
123
|
+
4. Copia:
|
|
124
|
+
- **URL de la API**: Por defecto `https://next.huntban.com/` (el CLI la completa automáticamente con `/api/v2`).
|
|
125
|
+
- **ID del Tablero**: Identificador de 24 caracteres.
|
|
126
|
+
- **API Key**: Comienza con `hb_pk_...`.
|
|
127
|
+
- **API Secret**: Comienza con `hb_sk_...`.
|
|
128
|
+
- **Tu Email**: Para atribución de autor en cambios y comentarios.
|
|
129
|
+
|
|
130
|
+
### Orden de Precedencia de Configuración:
|
|
131
|
+
1. **Variables de Entorno**: `HUNTBAN_API_URL`, `HUNTBAN_BOARD_ID`, `HUNTBAN_API_KEY`, `HUNTBAN_API_SECRET`, `HUNTBAN_USER_EMAIL`.
|
|
132
|
+
2. **Archivo local del proyecto**: `.huntban.json` en la raíz actual.
|
|
133
|
+
3. **Archivo global del usuario**: `~/.huntban/config.json`.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 5. Referencia de Comandos y Ejemplos
|
|
138
|
+
|
|
139
|
+
Todos los comandos soportan tanto el **código amigable de la tarea** (ej: `TSTT-28`, `BLBX-55`, `#28`) como el `ObjectId` hexadecimal.
|
|
140
|
+
|
|
141
|
+
### 5.1 Consultar columnas del tablero
|
|
142
|
+
```bash
|
|
143
|
+
huntban cols
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### 5.2 Listar tareas
|
|
147
|
+
```bash
|
|
148
|
+
huntban ls
|
|
149
|
+
huntban ls --limit 10
|
|
150
|
+
huntban ls --search "Auth"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 5.3 Ver detalle completo de una tarea
|
|
154
|
+
Muestra objetivo, especificaciones técnicas completas en Markdown, checklist con IDs, comentarios y URL directa:
|
|
155
|
+
```bash
|
|
156
|
+
huntban get TSTT-28
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 5.4 Mover a columna específica
|
|
160
|
+
Búsqueda inteligente por nombre de columna:
|
|
161
|
+
```bash
|
|
162
|
+
huntban to TSTT-28 "Haciendo"
|
|
163
|
+
huntban to TSTT-28 qa -m "Listo para pruebas"
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 5.5 Avanzar a la siguiente columna
|
|
167
|
+
Avanza automáticamente según el orden definido en el tablero:
|
|
168
|
+
```bash
|
|
169
|
+
huntban nx TSTT-28 -m "Avanzando de etapa"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 5.6 Marcar Criterios de Aceptación / Checklists
|
|
173
|
+
Marca subtareas completadas por su ID o por su texto:
|
|
174
|
+
```bash
|
|
175
|
+
huntban check TSTT-28 "Crear componente"
|
|
176
|
+
huntban check TSTT-28 6b073757fd4fc45094357faf
|
|
177
|
+
|
|
178
|
+
# Desmarcar criterio:
|
|
179
|
+
huntban check TSTT-28 "Crear componente" --undo
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 5.7 Enviar a Revisión / QA
|
|
183
|
+
Pasa la tarea a la etapa de revisión adjuntando informe para el revisor o Tech Lead:
|
|
184
|
+
```bash
|
|
185
|
+
huntban review TSTT-28 -m "Rama feature/login lista para revisión"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### 5.8 Cierre definitivo con Sinceramiento de Fecha
|
|
189
|
+
Cierra la tarea y registra la fecha real de ejecución para no descalibrar el diagrama de Gantt:
|
|
190
|
+
```bash
|
|
191
|
+
huntban cl TSTT-28 --date 2026-11-25 -m "Aprobado en producción"
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### 5.9 Agregar comentarios
|
|
195
|
+
Deja comentarios en el hilo de la tarea con atribución de autor:
|
|
196
|
+
```bash
|
|
197
|
+
huntban msg TSTT-28 -m "Progreso al 70%, auth terminada"
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 5.10 Abrir directamente en el navegador
|
|
201
|
+
Lanza la aplicación web con el modal de la tarea abierto en macOS, Linux o Windows:
|
|
202
|
+
```bash
|
|
203
|
+
huntban open TSTT-28
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### 5.11 Crear una nueva tarea
|
|
207
|
+
```bash
|
|
208
|
+
huntban create \
|
|
209
|
+
--name "Nueva Tarea" \
|
|
210
|
+
--desc "Objetivo breve" \
|
|
211
|
+
--content "## Requerimientos técnicos" \
|
|
212
|
+
--checklist "Paso 1, Paso 2, Paso 3"
|
|
213
|
+
```
|
package/bin/huntban.js
CHANGED
|
@@ -85,7 +85,7 @@ Comandos principales (admiten alias cortos):
|
|
|
85
85
|
Opciones y Flags globales:
|
|
86
86
|
--board <id> ID del tablero (Proxycard board)
|
|
87
87
|
--email <email> Email del usuario para atribución de autor (opcional)
|
|
88
|
-
--url <url> URL de la API (por defecto:
|
|
88
|
+
--url <url> URL de la API (por defecto: https://next.huntban.com/)
|
|
89
89
|
--key <key> API Key del conector (BoardWebhook)
|
|
90
90
|
--secret <secret> API Secret del conector (BoardWebhook)
|
|
91
91
|
-m, --comment <texto> Texto para comentarios o reportes de cierre
|
package/lib/api.js
CHANGED
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
function buildUrl(baseUrl, endpoint) {
|
|
6
|
-
let base = (baseUrl || '
|
|
6
|
+
let base = (baseUrl || 'https://next.huntban.com/').trim().replace(/\/+$/, '');
|
|
7
|
+
|
|
8
|
+
// Completar automáticamente el prefijo de API si solo se provee el dominio
|
|
9
|
+
if (base.includes('huntban.com') && !base.includes('/api/')) {
|
|
10
|
+
base = `${base}/api/v2`;
|
|
11
|
+
} else if (base.includes('localhost') && !base.includes('/api/')) {
|
|
12
|
+
base = `${base}/api/v1`;
|
|
13
|
+
}
|
|
14
|
+
|
|
7
15
|
let path = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;
|
|
8
16
|
|
|
9
17
|
// Si baseUrl ya incluye /api/v2 o /api/v1
|
package/lib/commands/config.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const { setGlobalConfig, setLocalConfig, getGlobalConfig, loadConfig, GLOBAL_CONFIG_FILE, LOCAL_CONFIG_FILE } = require('../config');
|
|
1
|
+
const { setGlobalConfig, setLocalConfig, getGlobalConfig, loadConfig, normalizeApiUrl, GLOBAL_CONFIG_FILE, LOCAL_CONFIG_FILE } = require('../config');
|
|
2
2
|
|
|
3
3
|
module.exports = async function configCommand(parsed) {
|
|
4
4
|
const subAction = parsed.positional[0] || 'show';
|
|
5
5
|
|
|
6
6
|
if (subAction === 'set') {
|
|
7
7
|
const updates = {};
|
|
8
|
-
if (parsed.flags.url) updates.apiUrl = parsed.flags.url;
|
|
8
|
+
if (parsed.flags.url) updates.apiUrl = normalizeApiUrl(parsed.flags.url);
|
|
9
9
|
if (parsed.flags.key) updates.apiKey = parsed.flags.key;
|
|
10
10
|
if (parsed.flags.secret) updates.apiSecret = parsed.flags.secret;
|
|
11
11
|
if (parsed.flags.board) updates.boardId = parsed.flags.board;
|
package/lib/commands/init.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const os = require('os');
|
|
4
|
-
const { setLocalConfig, loadConfig, LOCAL_CONFIG_FILE } = require('../config');
|
|
4
|
+
const { setLocalConfig, loadConfig, normalizeApiUrl, LOCAL_CONFIG_FILE } = require('../config');
|
|
5
5
|
const { isInteractive, askQuestion } = require('../interactive');
|
|
6
6
|
const { getPipelines } = require('../api');
|
|
7
7
|
|
|
@@ -49,7 +49,7 @@ module.exports = async function initCommand(parsed, config) {
|
|
|
49
49
|
|
|
50
50
|
// 2. Configurar .huntban.json en el repositorio
|
|
51
51
|
const updates = {};
|
|
52
|
-
if (parsed.flags.url) updates.apiUrl = parsed.flags.url;
|
|
52
|
+
if (parsed.flags.url) updates.apiUrl = normalizeApiUrl(parsed.flags.url);
|
|
53
53
|
if (parsed.flags.board) updates.boardId = parsed.flags.board;
|
|
54
54
|
if (parsed.flags.key) updates.apiKey = parsed.flags.key;
|
|
55
55
|
if (parsed.flags.secret) updates.apiSecret = parsed.flags.secret;
|
|
@@ -62,9 +62,10 @@ module.exports = async function initCommand(parsed, config) {
|
|
|
62
62
|
console.log('\n📋 Configuración del Tablero de Huntban:');
|
|
63
63
|
console.log(' (Puedes obtener estos datos en: Tablero > Configuración ⚙️ > Conector / Webhooks)\n');
|
|
64
64
|
|
|
65
|
-
const defaultUrl =
|
|
65
|
+
const defaultUrl = 'https://next.huntban.com/';
|
|
66
66
|
const inputUrl = await askQuestion(`URL de la API [${defaultUrl}]: `);
|
|
67
|
-
|
|
67
|
+
const chosenUrl = inputUrl.trim() || defaultUrl;
|
|
68
|
+
updates.apiUrl = normalizeApiUrl(chosenUrl);
|
|
68
69
|
|
|
69
70
|
const inputBoard = await askQuestion(`ID del Tablero (24 caracteres): `);
|
|
70
71
|
if (inputBoard.trim()) updates.boardId = inputBoard.trim();
|
package/lib/config.js
CHANGED
|
@@ -31,6 +31,23 @@ function writeJsonFile(filePath, data) {
|
|
|
31
31
|
fs.writeFileSync(filePath, JSON.stringify(data, null, 2), 'utf8');
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Normaliza la URL base de la API completando el prefijo si solo se pasa el dominio
|
|
36
|
+
* Ej: "https://next.huntban.com/" -> "https://next.huntban.com/api/v2"
|
|
37
|
+
* Ej: "http://localhost:3000/" -> "http://localhost:3000/api/v1"
|
|
38
|
+
*/
|
|
39
|
+
function normalizeApiUrl(rawUrl) {
|
|
40
|
+
let url = (rawUrl || 'https://next.huntban.com/').trim().replace(/\/+$/, '');
|
|
41
|
+
if (!url) url = 'https://next.huntban.com';
|
|
42
|
+
|
|
43
|
+
if (url.includes('huntban.com') && !url.includes('/api/')) {
|
|
44
|
+
url = `${url}/api/v2`;
|
|
45
|
+
} else if (url.includes('localhost') && !url.includes('/api/')) {
|
|
46
|
+
url = `${url}/api/v1`;
|
|
47
|
+
}
|
|
48
|
+
return url;
|
|
49
|
+
}
|
|
50
|
+
|
|
34
51
|
/**
|
|
35
52
|
* Carga la configuración combinada respetando el orden de precedencia:
|
|
36
53
|
* 1. Variables de Entorno (HUNTBAN_*)
|
|
@@ -55,8 +72,10 @@ function loadConfig() {
|
|
|
55
72
|
}
|
|
56
73
|
}
|
|
57
74
|
|
|
75
|
+
const rawApiUrl = process.env.HUNTBAN_API_URL || localConfig.apiUrl || globalConfig.apiUrl || 'https://next.huntban.com/';
|
|
76
|
+
|
|
58
77
|
const merged = {
|
|
59
|
-
apiUrl:
|
|
78
|
+
apiUrl: normalizeApiUrl(rawApiUrl),
|
|
60
79
|
apiKey: process.env.HUNTBAN_API_KEY || localConfig.apiKey || globalConfig.apiKey || '',
|
|
61
80
|
apiSecret: process.env.HUNTBAN_API_SECRET || localConfig.apiSecret || globalConfig.apiSecret || '',
|
|
62
81
|
boardId: process.env.HUNTBAN_BOARD_ID || localConfig.boardId || globalConfig.boardId || '',
|
|
@@ -98,6 +117,7 @@ function getGlobalConfig() {
|
|
|
98
117
|
module.exports = {
|
|
99
118
|
GLOBAL_CONFIG_FILE,
|
|
100
119
|
LOCAL_CONFIG_FILE,
|
|
120
|
+
normalizeApiUrl,
|
|
101
121
|
loadConfig,
|
|
102
122
|
setLocalConfig,
|
|
103
123
|
setGlobalConfig,
|
package/package.json
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huntban-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "CLI oficial y herramienta de automatización para Huntban y agentes Antigravity",
|
|
5
5
|
"main": "bin/huntban.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"huntban": "
|
|
7
|
+
"huntban": "bin/huntban.js"
|
|
8
|
+
},
|
|
9
|
+
"preferGlobal": true,
|
|
10
|
+
"files": [
|
|
11
|
+
"bin",
|
|
12
|
+
"lib",
|
|
13
|
+
"templates",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "node bin/huntban.js --help"
|
|
8
18
|
},
|
|
9
19
|
"keywords": [
|
|
10
20
|
"huntban",
|
|
@@ -12,11 +22,16 @@
|
|
|
12
22
|
"antigravity",
|
|
13
23
|
"kanban",
|
|
14
24
|
"connector",
|
|
15
|
-
"automation"
|
|
25
|
+
"automation",
|
|
26
|
+
"gantt",
|
|
27
|
+
"tasks"
|
|
16
28
|
],
|
|
17
29
|
"author": "Huntban Team",
|
|
18
30
|
"license": "MIT",
|
|
19
31
|
"engines": {
|
|
20
32
|
"node": ">=18.0.0"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
21
36
|
}
|
|
22
37
|
}
|
package/templates/SKILL.md
CHANGED
|
@@ -57,7 +57,7 @@ Entra a tu tablero en Huntban y abre el menú de configuración:
|
|
|
57
57
|
2. Haz clic en el ícono de **Configuración del Tablero (⚙️)** en la cabecera.
|
|
58
58
|
3. Ve a la pestaña **Conector / Webhooks**.
|
|
59
59
|
4. Copia los siguientes datos:
|
|
60
|
-
- **URL de la API**: Por defecto `https://next.huntban.com
|
|
60
|
+
- **URL de la API**: Por defecto `https://next.huntban.com/` (el CLI la completa automáticamente como corresponda a `/api/v2`).
|
|
61
61
|
- **ID del Tablero (`boardId`)**: El identificador de 24 caracteres de tu tablero.
|
|
62
62
|
- **API Key (`x-api-key`)**: Tu clave pública (comienza con `hb_pk_...`).
|
|
63
63
|
- **API Secret (`x-api-secret`)**: Tu clave privada (comienza con `hb_sk_...`).
|
|
@@ -71,7 +71,7 @@ Si prefieres pasar todos los datos en una sola línea o en un script automatizad
|
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
73
|
huntban attach \
|
|
74
|
-
--url https://next.huntban.com/
|
|
74
|
+
--url https://next.huntban.com/ \
|
|
75
75
|
--board <ID_DEL_TABLERO> \
|
|
76
76
|
--key <API_KEY> \
|
|
77
77
|
--secret <API_SECRET> \
|