skill-analyzer 0.1.1 → 0.1.2
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 +10 -3
- package/dist/report.js +5 -3
- package/package.json +1 -1
package/dist/budget.d.ts
CHANGED
package/dist/budget.js
CHANGED
|
@@ -2,11 +2,13 @@ import chalk from "chalk";
|
|
|
2
2
|
import { getSkillsDir, loadSkillRegistry } from "./registry.js";
|
|
3
3
|
import { sectionHeader, keyValue, budgetBar, makeTable } from "./formatter.js";
|
|
4
4
|
export const OVERHEAD_PER_SKILL = 109;
|
|
5
|
-
const
|
|
5
|
+
export const FALLBACK_BUDGET = 16_000;
|
|
6
6
|
export function budgetCommand(args) {
|
|
7
7
|
const skillsDir = getSkillsDir(args);
|
|
8
8
|
const skills = loadSkillRegistry(skillsDir);
|
|
9
|
-
const
|
|
9
|
+
const envBudget = process.env["SLASH_COMMAND_TOOL_CHAR_BUDGET"];
|
|
10
|
+
const budget = parseInt(envBudget ?? String(FALLBACK_BUDGET), 10);
|
|
11
|
+
const isFallback = !envBudget;
|
|
10
12
|
const isJson = args.includes("--json");
|
|
11
13
|
const entries = skills
|
|
12
14
|
.map((s) => ({
|
|
@@ -17,7 +19,7 @@ export function budgetCommand(args) {
|
|
|
17
19
|
.sort((a, b) => b.totalChars - a.totalChars);
|
|
18
20
|
const totalUsed = entries.reduce((sum, e) => sum + e.totalChars, 0);
|
|
19
21
|
if (isJson) {
|
|
20
|
-
console.log(JSON.stringify({ budget, totalUsed, entries }, null, 2));
|
|
22
|
+
console.log(JSON.stringify({ budget, isFallback, totalUsed, entries }, null, 2));
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
23
25
|
const overBudget = totalUsed > budget;
|
|
@@ -41,5 +43,10 @@ export function budgetCommand(args) {
|
|
|
41
43
|
colAligns: ["right", "left", "right", "right"],
|
|
42
44
|
rows: entries.map((e, i) => [i + 1, e.name, e.descriptionLength, e.totalChars]),
|
|
43
45
|
});
|
|
46
|
+
if (isFallback) {
|
|
47
|
+
console.log();
|
|
48
|
+
console.log(chalk.dim(` ${budget.toLocaleString()} is a static fallback. The actual budget is determined dynamically by Claude Code.`));
|
|
49
|
+
console.log(chalk.dim(" See: https://code.claude.com/docs/en/skills#claude-doesnt-see-all-my-skills"));
|
|
50
|
+
}
|
|
44
51
|
console.log();
|
|
45
52
|
}
|
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, OVERHEAD_PER_SKILL } from "./budget.js";
|
|
3
|
+
import { budgetCommand, OVERHEAD_PER_SKILL, FALLBACK_BUDGET } from "./budget.js";
|
|
4
4
|
import { usageCommand } from "./usage.js";
|
|
5
5
|
import { deadCommand } from "./dead.js";
|
|
6
6
|
export function reportCommand(args) {
|
|
@@ -24,7 +24,9 @@ function reportJson(args) {
|
|
|
24
24
|
const usage = aggregateUsage(invocations);
|
|
25
25
|
const usedSkills = new Set(usage.map((u) => u.skill));
|
|
26
26
|
const deadSkills = registry.filter((s) => !usedSkills.has(s.name)).map((s) => s.name);
|
|
27
|
-
const
|
|
27
|
+
const envBudget = process.env["SLASH_COMMAND_TOOL_CHAR_BUDGET"];
|
|
28
|
+
const budget = parseInt(envBudget ?? String(FALLBACK_BUDGET), 10);
|
|
29
|
+
const isFallback = !envBudget;
|
|
28
30
|
const budgetEntries = registry
|
|
29
31
|
.map((s) => ({
|
|
30
32
|
name: s.name,
|
|
@@ -36,6 +38,6 @@ function reportJson(args) {
|
|
|
36
38
|
console.log(JSON.stringify({
|
|
37
39
|
usage: { totalInvocations: invocations.length, skills: usage },
|
|
38
40
|
dead: { count: deadSkills.length, skills: deadSkills },
|
|
39
|
-
budget: { limit: budget, totalUsed, entries: budgetEntries },
|
|
41
|
+
budget: { limit: budget, isFallback, totalUsed, entries: budgetEntries },
|
|
40
42
|
}, null, 2));
|
|
41
43
|
}
|