trackfw 2.7.0 → 2.8.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/package.json +1 -1
- package/src/commands/discover.js +46 -1
- package/src/serve/static/app.js +3 -3
package/package.json
CHANGED
package/src/commands/discover.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const { Command } = require('commander');
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
6
7
|
|
|
7
8
|
function scan(rootDir) {
|
|
8
9
|
const r = {
|
|
@@ -205,7 +206,51 @@ function installHook(framework, rootDir) {
|
|
|
205
206
|
const huskyHook = path.join(rootDir, '.husky', 'pre-commit');
|
|
206
207
|
fs.appendFileSync(huskyHook, huskyEntry, 'utf8');
|
|
207
208
|
} else {
|
|
208
|
-
|
|
209
|
+
const pkgJson = path.join(rootDir, 'package.json');
|
|
210
|
+
if (fs.existsSync(pkgJson)) {
|
|
211
|
+
installHusky(rootDir);
|
|
212
|
+
} else {
|
|
213
|
+
installLefthook(rootDir);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function installHusky(rootDir) {
|
|
219
|
+
try {
|
|
220
|
+
execSync('npm install --save-dev husky', { cwd: rootDir, stdio: 'inherit' });
|
|
221
|
+
} catch (e) {
|
|
222
|
+
console.warn('⚠ trackfw: falha ao instalar husky:', e.message);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
try {
|
|
226
|
+
execSync('npx husky init', { cwd: rootDir, stdio: 'inherit' });
|
|
227
|
+
} catch (e) {
|
|
228
|
+
console.warn('⚠ trackfw: falha ao inicializar husky:', e.message);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
try {
|
|
232
|
+
const huskyDir = path.join(rootDir, '.husky');
|
|
233
|
+
if (!isDir(huskyDir)) fs.mkdirSync(huskyDir, { recursive: true });
|
|
234
|
+
fs.appendFileSync(path.join(huskyDir, 'pre-commit'), '\nscripts/trackfw-validate.sh\n', 'utf8');
|
|
235
|
+
} catch (e) {
|
|
236
|
+
console.warn('⚠ trackfw: falha ao configurar hook pre-commit do husky:', e.message);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function installLefthook(rootDir) {
|
|
241
|
+
const lefthookPath = path.join(rootDir, 'lefthook.yml');
|
|
242
|
+
if (isFile(lefthookPath)) {
|
|
243
|
+
const existing = fs.readFileSync(lefthookPath, 'utf8');
|
|
244
|
+
if (existing.includes('trackfw')) return; // idempotente
|
|
245
|
+
fs.appendFileSync(lefthookPath, '\npre-commit:\n commands:\n trackfw-validate:\n run: scripts/trackfw-validate.sh\n', 'utf8');
|
|
246
|
+
} else {
|
|
247
|
+
const content = 'pre-commit:\n commands:\n trackfw-validate:\n run: scripts/trackfw-validate.sh\n';
|
|
248
|
+
fs.writeFileSync(lefthookPath, content, 'utf8');
|
|
249
|
+
}
|
|
250
|
+
try {
|
|
251
|
+
execSync('lefthook install', { cwd: rootDir, stdio: 'inherit' });
|
|
252
|
+
} catch (e) {
|
|
253
|
+
console.warn('⚠ trackfw: lefthook não encontrado no PATH — hook registrado em lefthook.yml mas não instalado:', e.message);
|
|
209
254
|
}
|
|
210
255
|
}
|
|
211
256
|
|
package/src/serve/static/app.js
CHANGED
|
@@ -93,7 +93,7 @@ function switchView(view) {
|
|
|
93
93
|
|
|
94
94
|
// ─── View: Board / Kanban ─────────────────────────────────────────────────────
|
|
95
95
|
|
|
96
|
-
const COLUMNS_ORDER = ['
|
|
96
|
+
const COLUMNS_ORDER = ['backlog', 'wip', 'blocked', 'done', 'abandoned'];
|
|
97
97
|
const COLUMNS_LABEL = {
|
|
98
98
|
wip: 'WIP', backlog: 'Backlog', blocked: 'Blocked', done: 'Done', abandoned: 'Abandoned',
|
|
99
99
|
};
|
|
@@ -296,8 +296,8 @@ function renderChain(data) {
|
|
|
296
296
|
nodes.forEach(n => { nodeById[n.id] = n; });
|
|
297
297
|
|
|
298
298
|
const links = edges.map(e => ({
|
|
299
|
-
source: nodeById[e.from]
|
|
300
|
-
target: nodeById[e.to]
|
|
299
|
+
source: nodeById[e.from],
|
|
300
|
+
target: nodeById[e.to],
|
|
301
301
|
})).filter(l => l.source && l.target);
|
|
302
302
|
|
|
303
303
|
// Simulação
|