brito-cli 0.7.1 → 0.7.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/dist/graph/aliases.js +1 -1
- package/dist/graph/sfc.js +1 -1
- package/dist/graph/store.js +1 -1
- package/dist/skills/journal.js +7 -2
- package/dist/ui/banner.js +0 -1
- package/dist/ui/dock.js +30 -1
- package/package.json +2 -2
package/dist/graph/aliases.js
CHANGED
|
@@ -188,7 +188,7 @@ export function aliasCandidates(set, spec) {
|
|
|
188
188
|
for (const r of matches) {
|
|
189
189
|
const captured = r.wildcard ? spec.slice(r.prefix.length, spec.length - r.suffix.length) : "";
|
|
190
190
|
for (const t of r.targets)
|
|
191
|
-
out.push(clean(t.
|
|
191
|
+
out.push(clean(t.split("*").join(captured)));
|
|
192
192
|
}
|
|
193
193
|
if (set.baseUrl !== null && !spec.startsWith("."))
|
|
194
194
|
out.push(clean(px.join(set.baseUrl, spec)));
|
package/dist/graph/sfc.js
CHANGED
|
@@ -8,7 +8,7 @@ const JS_TYPES = /^(module|(text|application)\/(javascript|typescript|ecmascript
|
|
|
8
8
|
export function splitSfc(src, ext) {
|
|
9
9
|
const ranges = [];
|
|
10
10
|
let tsx = false;
|
|
11
|
-
for (const m of src.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script
|
|
11
|
+
for (const m of src.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script[^>]*>/gi)) {
|
|
12
12
|
const attrs = m[1] ?? "";
|
|
13
13
|
const type = /\btype\s*=\s*["']?([^"'\s>]+)/i.exec(attrs)?.[1]?.toLowerCase();
|
|
14
14
|
if (type && !JS_TYPES.test(type))
|
package/dist/graph/store.js
CHANGED
|
@@ -105,7 +105,7 @@ export class GraphStore {
|
|
|
105
105
|
catch { /* idem */ } }
|
|
106
106
|
/** Para tarefas longas (indexação): se outro processo está esperando o banco, solta e dá a vez a ele. Barato quando ninguém espera. */
|
|
107
107
|
async yieldIfWaited() {
|
|
108
|
-
let age
|
|
108
|
+
let age;
|
|
109
109
|
try {
|
|
110
110
|
age = Date.now() - fs.statSync(this.waitingFile).mtimeMs;
|
|
111
111
|
}
|
package/dist/skills/journal.js
CHANGED
|
@@ -17,8 +17,13 @@ export function entryFromTurn(turn, saved, date = new Date().toISOString().slice
|
|
|
17
17
|
/** Os arquivos locais do Brito não devem ir para o git por acidente. */
|
|
18
18
|
function ensureIgnore(root) {
|
|
19
19
|
const f = path.join(dirOf(root), ".gitignore");
|
|
20
|
-
|
|
21
|
-
fs.writeFileSync(f, ".journal.jsonl\n.pending/\n.trash/\n");
|
|
20
|
+
try {
|
|
21
|
+
fs.writeFileSync(f, ".journal.jsonl\n.pending/\n.trash/\n", { flag: "wx" });
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
if (e.code !== "EEXIST")
|
|
25
|
+
throw e;
|
|
26
|
+
}
|
|
22
27
|
}
|
|
23
28
|
export function readJournal(root) {
|
|
24
29
|
try {
|
package/dist/ui/banner.js
CHANGED
|
@@ -37,7 +37,6 @@ function listLine(label, items, width) {
|
|
|
37
37
|
}
|
|
38
38
|
/** Linhas livres embaixo da janela: moldura (2) + dock com status e prompt. */
|
|
39
39
|
const BELOW_BANNER = 7;
|
|
40
|
-
const clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
|
|
41
40
|
/** BRITO_BANNER=compact força o banner pequeno; =full força a tela cheia; sem nada, é tela cheia em janela grande. */
|
|
42
41
|
function wantsFull() {
|
|
43
42
|
const mode = process.env.BRITO_BANNER;
|
package/dist/ui/dock.js
CHANGED
|
@@ -23,6 +23,8 @@ export class Dock {
|
|
|
23
23
|
skipNL = false;
|
|
24
24
|
top = 1;
|
|
25
25
|
height = 0;
|
|
26
|
+
lastWidths = [];
|
|
27
|
+
lastCursor = { line: 0, col: 1 };
|
|
26
28
|
spinner = null;
|
|
27
29
|
busy = false;
|
|
28
30
|
promptOverride = null;
|
|
@@ -40,12 +42,36 @@ export class Dock {
|
|
|
40
42
|
dsr;
|
|
41
43
|
started = false;
|
|
42
44
|
onData = (d) => this.feed(d);
|
|
45
|
+
resizeTimer;
|
|
43
46
|
onResize = () => {
|
|
44
47
|
this.rows = process.stdout.rows || 24;
|
|
45
48
|
this.cols = process.stdout.columns || 80;
|
|
46
49
|
this.outRow = Math.min(this.outRow, this.rows);
|
|
47
|
-
|
|
50
|
+
clearTimeout(this.resizeTimer);
|
|
51
|
+
this.resizeTimer = setTimeout(() => void this.reflow(), 40);
|
|
48
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* O terminal re-quebra (reflow) o que já está na tela ao redimensionar: réguas largas viram 2 linhas
|
|
55
|
+
* e as posições guardadas ficam inválidas. Perguntamos onde o cursor foi parar, deduzimos onde o dock
|
|
56
|
+
* começa agora, apagamos dali para baixo e repintamos.
|
|
57
|
+
*/
|
|
58
|
+
async reflow() {
|
|
59
|
+
if (!this.started)
|
|
60
|
+
return;
|
|
61
|
+
const [r] = await this.getCursor();
|
|
62
|
+
if (!this.started)
|
|
63
|
+
return;
|
|
64
|
+
const wrap = (w) => Math.max(1, Math.ceil(w / this.cols));
|
|
65
|
+
const above = this.lastWidths.slice(0, this.lastCursor.line).reduce((n, w) => n + wrap(w), 0)
|
|
66
|
+
+ Math.floor(Math.max(0, this.lastCursor.col - 1) / this.cols);
|
|
67
|
+
const top = Math.max(1, Math.min(this.rows, r - above));
|
|
68
|
+
this.outRow = top;
|
|
69
|
+
this.outCol = 1;
|
|
70
|
+
this.skipNL = false;
|
|
71
|
+
this.top = top;
|
|
72
|
+
this.height = 0;
|
|
73
|
+
process.stdout.write(`\x1b[${top};1H\x1b[J` + this.paintSeq(true));
|
|
74
|
+
}
|
|
49
75
|
constructor(opts) {
|
|
50
76
|
this.opts = opts;
|
|
51
77
|
if (opts.historyFile) {
|
|
@@ -83,6 +109,7 @@ export class Dock {
|
|
|
83
109
|
this.restoreTerminal();
|
|
84
110
|
process.stdin.off("data", this.onData);
|
|
85
111
|
process.stdout.off("resize", this.onResize);
|
|
112
|
+
clearTimeout(this.resizeTimer);
|
|
86
113
|
process.stdin.pause();
|
|
87
114
|
}
|
|
88
115
|
restoreTerminal() {
|
|
@@ -316,6 +343,8 @@ export class Dock {
|
|
|
316
343
|
}
|
|
317
344
|
this.top = base;
|
|
318
345
|
this.height = h;
|
|
346
|
+
this.lastWidths = visibleLines.map((l) => Math.min(stringWidth(stripAnsi(l)), this.cols));
|
|
347
|
+
this.lastCursor = { line: Math.max(0, Math.min(h - 1, cursor.row - (out.length - h) - 1)), col: Math.min(cursor.col, this.cols) };
|
|
319
348
|
const row = base + cursor.row - (out.length - h);
|
|
320
349
|
s += `\x1b[${Math.min(row, this.rows)};${Math.min(cursor.col, this.cols)}H`;
|
|
321
350
|
return s;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brito-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Coding-agent CLI with a code knowledge graph, memory and reviewable skills / CLI de agente de código com grafo de conhecimento, memória e skills revisáveis",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"desktop:dmg": "npm run build && npm run bundle && npm --prefix desktop install --no-audit --no-fund && node desktop/package.mjs --dmg"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@anthropic-ai/sdk": "^0.
|
|
23
|
+
"@anthropic-ai/sdk": "^0.137.0",
|
|
24
24
|
"@ladybugdb/core": "0.21.2",
|
|
25
25
|
"@modelcontextprotocol/sdk": "^1.32.0",
|
|
26
26
|
"commander": "^14.0.3",
|