skill-analyzer 0.1.0 → 0.1.1
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/budget.d.ts +1 -0
- package/dist/budget.js +11 -11
- package/dist/dead.js +3 -2
- package/dist/report.js +5 -5
- package/package.json +1 -1
package/dist/budget.d.ts
CHANGED
package/dist/budget.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { getSkillsDir, loadSkillRegistry } from "./registry.js";
|
|
3
3
|
import { sectionHeader, keyValue, budgetBar, makeTable } from "./formatter.js";
|
|
4
|
-
const OVERHEAD_PER_SKILL = 109;
|
|
4
|
+
export const OVERHEAD_PER_SKILL = 109;
|
|
5
5
|
const DEFAULT_BUDGET = 16_000;
|
|
6
6
|
export function budgetCommand(args) {
|
|
7
7
|
const skillsDir = getSkillsDir(args);
|
|
@@ -12,34 +12,34 @@ export function budgetCommand(args) {
|
|
|
12
12
|
.map((s) => ({
|
|
13
13
|
name: s.name,
|
|
14
14
|
descriptionLength: s.descriptionLength,
|
|
15
|
-
|
|
15
|
+
totalChars: s.descriptionLength + OVERHEAD_PER_SKILL,
|
|
16
16
|
}))
|
|
17
|
-
.sort((a, b) => b.
|
|
18
|
-
const
|
|
17
|
+
.sort((a, b) => b.totalChars - a.totalChars);
|
|
18
|
+
const totalUsed = entries.reduce((sum, e) => sum + e.totalChars, 0);
|
|
19
19
|
if (isJson) {
|
|
20
|
-
console.log(JSON.stringify({ budget,
|
|
20
|
+
console.log(JSON.stringify({ budget, totalUsed, entries }, null, 2));
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
const overBudget =
|
|
23
|
+
const overBudget = totalUsed > budget;
|
|
24
24
|
sectionHeader("Description Budget", overBudget ? "OVER BUDGET" : undefined);
|
|
25
25
|
keyValue([
|
|
26
|
-
["Budget:", budgetBar(
|
|
26
|
+
["Budget:", budgetBar(totalUsed, budget)],
|
|
27
27
|
[
|
|
28
28
|
"Used:",
|
|
29
|
-
`${
|
|
29
|
+
`${totalUsed.toLocaleString()} / ${budget.toLocaleString()} chars`,
|
|
30
30
|
],
|
|
31
31
|
[
|
|
32
32
|
"Remaining:",
|
|
33
33
|
overBudget
|
|
34
|
-
? chalk.red(`-${(
|
|
35
|
-
: chalk.green(`${(budget -
|
|
34
|
+
? chalk.red(`-${(totalUsed - budget).toLocaleString()} chars`)
|
|
35
|
+
: chalk.green(`${(budget - totalUsed).toLocaleString()} chars`),
|
|
36
36
|
],
|
|
37
37
|
["Skills:", `${entries.length} (${OVERHEAD_PER_SKILL} chars overhead each)`],
|
|
38
38
|
]);
|
|
39
39
|
makeTable({
|
|
40
40
|
head: ["#", "Skill", "Description Chars", "Total Chars"],
|
|
41
41
|
colAligns: ["right", "left", "right", "right"],
|
|
42
|
-
rows: entries.map((e, i) => [i + 1, e.name, e.descriptionLength, e.
|
|
42
|
+
rows: entries.map((e, i) => [i + 1, e.name, e.descriptionLength, e.totalChars]),
|
|
43
43
|
});
|
|
44
44
|
console.log();
|
|
45
45
|
}
|
package/dist/dead.js
CHANGED
|
@@ -2,6 +2,7 @@ import chalk from "chalk";
|
|
|
2
2
|
import { getSkillsDir, loadSkillRegistry } from "./registry.js";
|
|
3
3
|
import { getLogsDir, scanSessions, aggregateUsage } from "./scanner.js";
|
|
4
4
|
import { sectionHeader, keyValue, makeTable } from "./formatter.js";
|
|
5
|
+
import { OVERHEAD_PER_SKILL } from "./budget.js";
|
|
5
6
|
export function deadCommand(args) {
|
|
6
7
|
const skillsDir = getSkillsDir(args);
|
|
7
8
|
const logsDir = getLogsDir(args);
|
|
@@ -19,7 +20,7 @@ export function deadCommand(args) {
|
|
|
19
20
|
}
|
|
20
21
|
const period = days ? `last ${days} days` : "all time";
|
|
21
22
|
sectionHeader(`Dead Skills (${period})`);
|
|
22
|
-
const totalWaste = deadSkills.reduce((sum, s) => sum + s.descriptionLength +
|
|
23
|
+
const totalWaste = deadSkills.reduce((sum, s) => sum + s.descriptionLength + OVERHEAD_PER_SKILL, 0);
|
|
23
24
|
keyValue([
|
|
24
25
|
["Dead:", `${deadSkills.length} of ${registry.length} local skills`],
|
|
25
26
|
[
|
|
@@ -40,7 +41,7 @@ export function deadCommand(args) {
|
|
|
40
41
|
i + 1,
|
|
41
42
|
chalk.red(s.name),
|
|
42
43
|
s.descriptionLength,
|
|
43
|
-
s.descriptionLength +
|
|
44
|
+
s.descriptionLength + OVERHEAD_PER_SKILL,
|
|
44
45
|
]),
|
|
45
46
|
});
|
|
46
47
|
console.log();
|
package/dist/report.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSkillsDir, loadSkillRegistry } from "./registry.js";
|
|
2
2
|
import { getLogsDir, scanSessions, aggregateUsage } from "./scanner.js";
|
|
3
|
-
import { budgetCommand } from "./budget.js";
|
|
3
|
+
import { budgetCommand, OVERHEAD_PER_SKILL } from "./budget.js";
|
|
4
4
|
import { usageCommand } from "./usage.js";
|
|
5
5
|
import { deadCommand } from "./dead.js";
|
|
6
6
|
export function reportCommand(args) {
|
|
@@ -29,13 +29,13 @@ function reportJson(args) {
|
|
|
29
29
|
.map((s) => ({
|
|
30
30
|
name: s.name,
|
|
31
31
|
descriptionLength: s.descriptionLength,
|
|
32
|
-
|
|
32
|
+
totalChars: s.descriptionLength + OVERHEAD_PER_SKILL,
|
|
33
33
|
}))
|
|
34
|
-
.sort((a, b) => b.
|
|
35
|
-
const
|
|
34
|
+
.sort((a, b) => b.totalChars - a.totalChars);
|
|
35
|
+
const totalUsed = budgetEntries.reduce((sum, e) => sum + e.totalChars, 0);
|
|
36
36
|
console.log(JSON.stringify({
|
|
37
37
|
usage: { totalInvocations: invocations.length, skills: usage },
|
|
38
38
|
dead: { count: deadSkills.length, skills: deadSkills },
|
|
39
|
-
budget: { limit: budget,
|
|
39
|
+
budget: { limit: budget, totalUsed, entries: budgetEntries },
|
|
40
40
|
}, null, 2));
|
|
41
41
|
}
|