@crafter/skillkit 0.1.2 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crafter/skillkit",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Local-first analytics for AI agent skills. Track usage, measure context budget, and prune what you don't use.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/bin.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
2
  import { bold, cyan, dim, yellow } from "./tui/colors";
3
3
 
4
- const VERSION = "0.1.2";
4
+ const VERSION = "0.1.3";
5
5
 
6
6
  function printHelp(): void {
7
7
  console.log(`
@@ -5,7 +5,6 @@ import { getTopSkills } from "../db/queries";
5
5
  import { getDb } from "../db/schema";
6
6
  import { scanInstalledSkills } from "../scanner/skills";
7
7
  import { bold, dim, green, red, yellow } from "../tui/colors";
8
- import { healthGauge } from "../tui/health";
9
8
 
10
9
  const METADATA_BUDGET = 16000;
11
10
  const BODY_LINE_LIMIT = 500;
@@ -31,7 +30,7 @@ function parseFrontmatter(content: string): {
31
30
  if (!match)
32
31
  return { name: "", description: "", bodyLines: content.split("\n").length };
33
32
 
34
- const yaml = match[1];
33
+ const yaml = match[1] ?? "";
35
34
  const body = content.slice(match[0].length);
36
35
  const bodyLines = body.trim() ? body.trim().split("\n").length : 0;
37
36
 
@@ -39,10 +38,11 @@ function parseFrontmatter(content: string): {
39
38
  let description = "";
40
39
 
41
40
  const nameMatch = yaml.match(/^name:\s*(.+)$/m);
42
- if (nameMatch) name = nameMatch[1].trim().replace(/^["']|["']$/g, "");
41
+ if (nameMatch?.[1]) name = nameMatch[1].trim().replace(/^["']|["']$/g, "");
43
42
 
44
43
  const descMatch = yaml.match(/^description:\s*(.+)$/m);
45
- if (descMatch) description = descMatch[1].trim().replace(/^["']|["']$/g, "");
44
+ if (descMatch?.[1])
45
+ description = descMatch[1].trim().replace(/^["']|["']$/g, "");
46
46
 
47
47
  return { name, description, bodyLines };
48
48
  }
@@ -138,28 +138,26 @@ export async function runHealth(): Promise<void> {
138
138
  }
139
139
 
140
140
  console.log();
141
- const gaugeStr = healthGauge(100 - metadataPct);
142
141
  const metaKb = (totalMetadataChars / 1000).toFixed(1);
143
142
  const budgetKb = (METADATA_BUDGET / 1000).toFixed(1);
144
143
 
145
- if (metadataPct >= 90) {
146
- console.log(
147
- ` ${red("●")} Metadata budget: ${metadataPct}% (${metaKb}K / ${budgetKb}K chars)`,
148
- );
149
- } else if (metadataPct >= 70) {
150
- console.log(
151
- ` ${yellow("●")} Metadata budget: ${metadataPct}% (${metaKb}K / ${budgetKb}K chars)`,
152
- );
153
- } else {
154
- console.log(
155
- info(
156
- `Metadata budget: ${metadataPct}% (${metaKb}K / ${budgetKb}K chars)`,
157
- ),
158
- );
159
- }
160
- console.log(` ${gaugeStr}`);
144
+ const filled = Math.round(Math.min(metadataPct, 100) / 10);
145
+ const empty = 10 - filled;
146
+ const barFill = "█".repeat(filled);
147
+ const barEmpty = "░".repeat(empty);
148
+ const colorBar =
149
+ metadataPct >= 90
150
+ ? red(barFill)
151
+ : metadataPct >= 70
152
+ ? yellow(barFill)
153
+ : green(barFill);
154
+ const bar = `[${colorBar}${dim(barEmpty)}]`;
155
+
156
+ console.log(
157
+ ` ${bar} ${bold(`${metadataPct}%`)} metadata budget ${dim(`(${metaKb}K / ${budgetKb}K)`)}`,
158
+ );
161
159
  console.log(
162
- ` ${dim(`Names + descriptions loaded at startup (2% of context window)`)}`,
160
+ ` ${dim("name + description of each skill, loaded at startup")}`,
163
161
  );
164
162
 
165
163
  const bodyKb = (totalBodyChars / 1000).toFixed(1);