arisa 5.1.2 → 5.1.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arisa",
3
- "version": "5.1.2",
3
+ "version": "5.1.4",
4
4
  "description": "Telegram + Pi Agent modular assistant",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -1,10 +1,18 @@
1
- import { renderTextReport, reportRow } from "./report-format.js";
1
+ import { renderTextReport } from "./report-format.js";
2
2
 
3
3
  export function formatToolUsageReport(tools) {
4
4
  const lines = ["Arisa tools", "===========", "Usage count"];
5
5
  if (!tools.length) lines.push(" (none installed)");
6
- for (const tool of tools) {
7
- lines.push(...reportRow(tool.name, tool.count, { labelWidth: 24 }));
6
+
7
+ const sortedTools = [...tools].sort((left, right) =>
8
+ Number(right.count) - Number(left.count) || String(left.name).localeCompare(String(right.name))
9
+ );
10
+ const nameWidth = Math.max(0, ...sortedTools.map((tool) => String(tool.name).length));
11
+ const countWidth = Math.max(1, ...sortedTools.map((tool) => String(tool.count).length));
12
+ for (const tool of sortedTools) {
13
+ const name = String(tool.name).padEnd(nameWidth);
14
+ const count = String(tool.count).padStart(countWidth);
15
+ lines.push(`- ${name} ${count}`);
8
16
  }
9
17
  return renderTextReport(lines);
10
18
  }
@@ -26,12 +26,17 @@ test("counts concurrent tool uses per chat", async () => {
26
26
  }
27
27
  });
28
28
 
29
- test("formats narrow tool usage counts", () => {
29
+ test("formats narrow tool usage counts with bullets and right-aligned numbers", () => {
30
30
  const report = formatToolUsageReport([
31
- { name: "campaign-draft-runner", count: 12 },
32
- { name: "gmail-workspace", count: 3 }
31
+ { name: "gmail-workspace", count: 3 },
32
+ { name: "campaign-draft-runner", count: 12 }
33
33
  ]);
34
- assert.match(report, /campaign-draft-runner\s+12/);
35
- assert.match(report, /gmail-workspace\s+3/);
34
+ assert.match(report, /- campaign-draft-runner 12/);
35
+ assert.match(report, /- gmail-workspace\s+3/);
36
+ const rows = report.split("\n").filter((line) => line.startsWith("- "));
37
+ assert.match(rows[0], /campaign-draft-runner/);
38
+ assert.match(rows[1], /gmail-workspace/);
39
+ assert.deepEqual(rows.map((line) => line.match(/\d+$/).index + line.match(/\d+$/)[0].length), [27, 27]);
40
+ assert.deepEqual(rows.map((line) => line.length), [27, 27]);
36
41
  assert.ok(report.split("\n").every((line) => [...line].length <= 35));
37
42
  });