claude-slim 2.2.0

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.
@@ -0,0 +1,520 @@
1
+ import { readdir, readFile, readlink, stat, lstat, realpath } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { countTokensCached } from './tokenizer.js';
4
+ import { getClaudeDir, getSkillsDir, getPluginsDir, getProjectsDir } from './paths.js';
5
+ const STALE_DAYS = 90;
6
+ async function safeReadFile(p) {
7
+ try {
8
+ return await readFile(p, 'utf-8');
9
+ }
10
+ catch {
11
+ return null;
12
+ }
13
+ }
14
+ async function safeReaddir(p) {
15
+ try {
16
+ return await readdir(p);
17
+ }
18
+ catch {
19
+ return [];
20
+ }
21
+ }
22
+ async function isDirectory(p) {
23
+ try {
24
+ return (await stat(p)).isDirectory();
25
+ }
26
+ catch {
27
+ return false;
28
+ }
29
+ }
30
+ async function isBrokenSymlink(p) {
31
+ try {
32
+ const lstats = await lstat(p);
33
+ if (!lstats.isSymbolicLink())
34
+ return false;
35
+ await realpath(p);
36
+ return false;
37
+ }
38
+ catch {
39
+ try {
40
+ return (await lstat(p)).isSymbolicLink();
41
+ }
42
+ catch {
43
+ return false;
44
+ }
45
+ }
46
+ }
47
+ async function runCommand(cmd) {
48
+ try {
49
+ const { exec } = await import('node:child_process');
50
+ return new Promise((resolve) => {
51
+ exec(cmd, { timeout: 10000 }, (_err, stdout) => {
52
+ resolve(stdout || '');
53
+ });
54
+ });
55
+ }
56
+ catch {
57
+ return '';
58
+ }
59
+ }
60
+ async function getDirSize(dir) {
61
+ let total = 0;
62
+ const entries = await safeReaddir(dir);
63
+ for (const entry of entries) {
64
+ const p = join(dir, entry);
65
+ try {
66
+ const s = await stat(p);
67
+ if (s.isFile())
68
+ total += s.size;
69
+ else if (s.isDirectory())
70
+ total += await getDirSize(p);
71
+ }
72
+ catch { /* skip */ }
73
+ }
74
+ return total;
75
+ }
76
+ // Content cache: avoids re-reading files during classification
77
+ const contentCache = new Map();
78
+ async function resolveRealPath(p) {
79
+ try {
80
+ return await realpath(p);
81
+ }
82
+ catch {
83
+ return p;
84
+ }
85
+ }
86
+ export function dedupeBySymlink(candidates) {
87
+ const seen = new Map();
88
+ for (const { skill, realMdPath } of candidates) {
89
+ const existing = seen.get(realMdPath);
90
+ if (!existing) {
91
+ seen.set(realMdPath, skill);
92
+ continue;
93
+ }
94
+ // Prefer top-level name (no slash) over nested duplicate
95
+ const existingIsNested = existing.name.includes('/');
96
+ const currentIsNested = skill.name.includes('/');
97
+ if (existingIsNested && !currentIsNested) {
98
+ seen.set(realMdPath, skill);
99
+ }
100
+ }
101
+ return Array.from(seen.values());
102
+ }
103
+ async function scanLocalSkills() {
104
+ const skillsDir = getSkillsDir();
105
+ const candidates = [];
106
+ const brokenSymlinks = [];
107
+ const entries = await safeReaddir(skillsDir);
108
+ const scanPromises = entries.map(async (entry) => {
109
+ const dirPath = join(skillsDir, entry);
110
+ if (!(await isDirectory(dirPath)))
111
+ return;
112
+ const skillMd = join(dirPath, 'SKILL.md');
113
+ if (await isBrokenSymlink(skillMd)) {
114
+ let target = 'unknown';
115
+ try {
116
+ target = await readlink(skillMd);
117
+ }
118
+ catch { /* */ }
119
+ brokenSymlinks.push({ name: entry, path: skillMd, target });
120
+ return;
121
+ }
122
+ const content = await safeReadFile(skillMd);
123
+ if (content !== null) {
124
+ contentCache.set(skillMd, content);
125
+ const tokens = countTokensCached(content, skillMd);
126
+ const realMdPath = await resolveRealPath(skillMd);
127
+ candidates.push({
128
+ skill: {
129
+ name: entry,
130
+ path: dirPath,
131
+ sizeBytes: Buffer.byteLength(content),
132
+ tokens,
133
+ source: 'local',
134
+ },
135
+ realMdPath,
136
+ });
137
+ }
138
+ // Nested skills (e.g., @internal-sys/commit-guide)
139
+ const subEntries = await safeReaddir(dirPath);
140
+ for (const sub of subEntries) {
141
+ const subDir = join(dirPath, sub);
142
+ if (!(await isDirectory(subDir)))
143
+ continue;
144
+ const subSkillMd = join(subDir, 'SKILL.md');
145
+ if (await isBrokenSymlink(subSkillMd)) {
146
+ let target = 'unknown';
147
+ try {
148
+ target = await readlink(subSkillMd);
149
+ }
150
+ catch { /* */ }
151
+ brokenSymlinks.push({ name: `${entry}/${sub}`, path: subSkillMd, target });
152
+ continue;
153
+ }
154
+ const subContent = await safeReadFile(subSkillMd);
155
+ if (subContent !== null) {
156
+ const name = `${entry}/${sub}`;
157
+ contentCache.set(subSkillMd, subContent);
158
+ const tokens = countTokensCached(subContent, subSkillMd);
159
+ const realMdPath = await resolveRealPath(subSkillMd);
160
+ candidates.push({
161
+ skill: {
162
+ name,
163
+ path: subDir,
164
+ sizeBytes: Buffer.byteLength(subContent),
165
+ tokens,
166
+ source: 'local',
167
+ },
168
+ realMdPath,
169
+ });
170
+ }
171
+ }
172
+ });
173
+ await Promise.all(scanPromises);
174
+ const skills = dedupeBySymlink(candidates);
175
+ return { skills, brokenSymlinks };
176
+ }
177
+ async function scanPluginSkills() {
178
+ const skills = [];
179
+ const plugins = [];
180
+ const tempCaches = [];
181
+ const pluginsDir = getPluginsDir();
182
+ const pluginDirs = await safeReaddir(pluginsDir);
183
+ const scanPromises = pluginDirs.map(async (pluginName) => {
184
+ const pluginDir = join(pluginsDir, pluginName);
185
+ if (!(await isDirectory(pluginDir)))
186
+ return;
187
+ // Detect temp_local_* cache dirs (failed plugin installs)
188
+ if (pluginName.startsWith('temp_local_')) {
189
+ const size = await getDirSize(pluginDir);
190
+ tempCaches.push({ name: pluginName, path: pluginDir, sizeKB: Math.round(size / 1024) });
191
+ return;
192
+ }
193
+ const pluginSkillNames = [];
194
+ const walkDir = async (dir) => {
195
+ const entries = await safeReaddir(dir);
196
+ for (const entry of entries) {
197
+ const entryPath = join(dir, entry);
198
+ if (!(await isDirectory(entryPath)))
199
+ continue;
200
+ if (entry === 'skills') {
201
+ const skillDirs = await safeReaddir(entryPath);
202
+ for (const skillDir of skillDirs) {
203
+ const skillPath = join(entryPath, skillDir);
204
+ if (!(await isDirectory(skillPath)))
205
+ continue;
206
+ const skillMd = join(skillPath, 'SKILL.md');
207
+ const content = await safeReadFile(skillMd);
208
+ if (content !== null) {
209
+ pluginSkillNames.push(skillDir);
210
+ skills.push({
211
+ name: skillDir,
212
+ path: skillPath,
213
+ sizeBytes: Buffer.byteLength(content),
214
+ tokens: countTokensCached(content, skillMd),
215
+ source: 'plugin',
216
+ pluginName,
217
+ });
218
+ }
219
+ }
220
+ }
221
+ else {
222
+ await walkDir(entryPath);
223
+ }
224
+ }
225
+ };
226
+ await walkDir(pluginDir);
227
+ if (pluginSkillNames.length > 0) {
228
+ plugins.push({
229
+ name: pluginName,
230
+ skillCount: pluginSkillNames.length,
231
+ skills: pluginSkillNames,
232
+ });
233
+ }
234
+ });
235
+ await Promise.all(scanPromises);
236
+ return { skills, plugins, tempCaches };
237
+ }
238
+ async function scanMemoryFiles() {
239
+ const memoryFiles = [];
240
+ const staleProjects = [];
241
+ const projectsDir = getProjectsDir();
242
+ const projectDirs = await safeReaddir(projectsDir);
243
+ const now = Date.now();
244
+ const scanPromises = projectDirs.map(async (project) => {
245
+ const memDir = join(projectsDir, project, 'memory');
246
+ const files = await safeReaddir(memDir);
247
+ const mdFiles = files.filter((f) => f.endsWith('.md'));
248
+ let newestMtime = 0;
249
+ let totalBytes = 0;
250
+ for (const file of mdFiles) {
251
+ const filePath = join(memDir, file);
252
+ const content = await safeReadFile(filePath);
253
+ if (content !== null) {
254
+ const sizeBytes = Buffer.byteLength(content);
255
+ memoryFiles.push({
256
+ project,
257
+ name: file,
258
+ path: filePath,
259
+ sizeBytes,
260
+ tokens: countTokensCached(content, filePath),
261
+ });
262
+ totalBytes += sizeBytes;
263
+ try {
264
+ const s = await stat(filePath);
265
+ if (s.mtimeMs > newestMtime)
266
+ newestMtime = s.mtimeMs;
267
+ }
268
+ catch { /* skip */ }
269
+ }
270
+ }
271
+ // Check for stale project (no files modified in 90+ days)
272
+ if (mdFiles.length > 0 && newestMtime > 0) {
273
+ const ageDays = Math.floor((now - newestMtime) / (1000 * 60 * 60 * 24));
274
+ if (ageDays > STALE_DAYS) {
275
+ staleProjects.push({ project, path: memDir, ageDays, fileCount: mdFiles.length, totalBytes });
276
+ }
277
+ }
278
+ });
279
+ await Promise.all(scanPromises);
280
+ return { memoryFiles, staleProjects };
281
+ }
282
+ async function getDisabledPlugins() {
283
+ const output = await runCommand('claude plugin list');
284
+ if (!output)
285
+ return new Set();
286
+ const disabled = new Set();
287
+ let currentName = null;
288
+ for (const line of output.split('\n')) {
289
+ const trimmed = line.trim();
290
+ if (trimmed.startsWith('\u276f')) {
291
+ const full = trimmed.split('\u276f')[1]?.trim() || '';
292
+ // Format: sub-plugin@marketplace — extract marketplace name for cache dir matching
293
+ currentName = full.includes('@') ? full.split('@')[1] : full;
294
+ }
295
+ else if (trimmed.toLowerCase().includes('disabled') && currentName) {
296
+ disabled.add(currentName);
297
+ currentName = null;
298
+ }
299
+ else if (trimmed.toLowerCase().includes('enabled')) {
300
+ currentName = null;
301
+ }
302
+ }
303
+ return disabled;
304
+ }
305
+ export function parseClaudeMdSections(content) {
306
+ const sections = [];
307
+ const lines = content.split('\n');
308
+ let currentName = null;
309
+ let currentContent = '';
310
+ for (const line of lines) {
311
+ if (line.startsWith('# ')) {
312
+ if (currentName !== null) {
313
+ sections.push({
314
+ name: currentName,
315
+ sizeBytes: Buffer.byteLength(currentContent),
316
+ tokens: countTokensCached(currentContent, `claude-md-section:${currentName}`),
317
+ });
318
+ }
319
+ else if (currentContent.trim()) {
320
+ sections.push({
321
+ name: '(preamble)',
322
+ sizeBytes: Buffer.byteLength(currentContent),
323
+ tokens: countTokensCached(currentContent, 'claude-md-section:preamble'),
324
+ });
325
+ }
326
+ currentName = line.slice(2).trim().slice(0, 60);
327
+ currentContent = line + '\n';
328
+ }
329
+ else {
330
+ currentContent += line + '\n';
331
+ }
332
+ }
333
+ if (currentName !== null) {
334
+ sections.push({
335
+ name: currentName,
336
+ sizeBytes: Buffer.byteLength(currentContent),
337
+ tokens: countTokensCached(currentContent, `claude-md-section:${currentName}`),
338
+ });
339
+ }
340
+ else if (currentContent.trim()) {
341
+ sections.push({
342
+ name: '(preamble)',
343
+ sizeBytes: Buffer.byteLength(currentContent),
344
+ tokens: countTokensCached(currentContent, 'claude-md-section:preamble'),
345
+ });
346
+ }
347
+ return sections;
348
+ }
349
+ async function scanMcpServers() {
350
+ const content = await safeReadFile(join(getClaudeDir(), 'settings.json'));
351
+ if (!content)
352
+ return { count: 0, names: [] };
353
+ try {
354
+ const data = JSON.parse(content);
355
+ const servers = data.mcpServers || {};
356
+ const names = Object.keys(servers).sort();
357
+ return { count: names.length, names };
358
+ }
359
+ catch {
360
+ return { count: 0, names: [] };
361
+ }
362
+ }
363
+ function classifyIssues(localSkills, pluginSkills, brokenSymlinks, memoryFiles, tempCaches, staleProjects, disabledPlugins, plugins) {
364
+ const issues = [];
365
+ const pluginSkillNames = new Set(pluginSkills.map((s) => s.name));
366
+ // Tier 1: broken symlinks
367
+ for (const link of brokenSymlinks) {
368
+ issues.push({
369
+ type: 'broken_symlink',
370
+ tier: 1,
371
+ name: link.name,
372
+ detail: link.target,
373
+ tokens: 0,
374
+ path: link.path,
375
+ });
376
+ }
377
+ for (const skill of localSkills) {
378
+ const skillMdPath = join(skill.path, 'SKILL.md');
379
+ // Tier 1: template skills (use cached content instead of re-reading)
380
+ const content = contentCache.get(skillMdPath);
381
+ if (content && content.includes('Replace with description')) {
382
+ issues.push({
383
+ type: 'template',
384
+ tier: 1,
385
+ name: skill.name,
386
+ tokens: skill.tokens,
387
+ path: skill.path,
388
+ });
389
+ }
390
+ // Tier 2: duplicates (local + plugin) — check base name for nested skills
391
+ const baseName = skill.name.includes('/') ? skill.name.split('/').pop() : skill.name;
392
+ if (pluginSkillNames.has(baseName)) {
393
+ issues.push({
394
+ type: 'duplicate',
395
+ tier: 2,
396
+ name: skill.name,
397
+ detail: 'local+plugin',
398
+ tokens: skill.tokens,
399
+ path: skill.path,
400
+ });
401
+ }
402
+ // Tier 3: oversized skills (>10KB)
403
+ if (skill.sizeBytes > 10240) {
404
+ issues.push({
405
+ type: 'oversized_skill',
406
+ tier: 3,
407
+ name: skill.name,
408
+ detail: `${Math.round(skill.sizeBytes / 1024)}KB`,
409
+ tokens: skill.tokens,
410
+ path: skill.path,
411
+ });
412
+ }
413
+ }
414
+ // Tier 1: .skill/ duplicate directories
415
+ for (const skill of localSkills) {
416
+ const dotSkillDir = skill.path + '.skill';
417
+ if (localSkills.some((s) => s.path === dotSkillDir)) {
418
+ issues.push({
419
+ type: 'skill_dup',
420
+ tier: 1,
421
+ name: skill.name,
422
+ tokens: 0,
423
+ path: dotSkillDir,
424
+ });
425
+ }
426
+ }
427
+ // Tier 1: temp_local_* cache directories
428
+ for (const temp of tempCaches) {
429
+ issues.push({
430
+ type: 'temp_cache',
431
+ tier: 1,
432
+ name: temp.name,
433
+ detail: `${temp.sizeKB}KB`,
434
+ tokens: 0,
435
+ path: temp.path,
436
+ });
437
+ }
438
+ // Tier 2: oversized memory files (>5KB)
439
+ for (const mem of memoryFiles) {
440
+ if (mem.sizeBytes > 5120) {
441
+ issues.push({
442
+ type: 'oversized_memory',
443
+ tier: 2,
444
+ name: `${mem.project}/${mem.name}`,
445
+ detail: `${Math.round(mem.sizeBytes / 1024)}KB`,
446
+ tokens: mem.tokens,
447
+ path: mem.path,
448
+ });
449
+ }
450
+ }
451
+ // Tier 2: stale project memory (90+ days inactive)
452
+ for (const stale of staleProjects) {
453
+ const memTokens = memoryFiles
454
+ .filter((m) => m.project === stale.project)
455
+ .reduce((sum, m) => sum + m.tokens, 0);
456
+ issues.push({
457
+ type: 'stale_project',
458
+ tier: 2,
459
+ name: stale.project,
460
+ detail: `${stale.ageDays}d, ${stale.fileCount} files, ${Math.round(stale.totalBytes / 1024)}KB`,
461
+ tokens: memTokens,
462
+ path: stale.path,
463
+ });
464
+ }
465
+ // Tier 2: disabled plugins still occupying cache
466
+ for (const plugin of plugins) {
467
+ if (disabledPlugins.has(plugin.name)) {
468
+ issues.push({
469
+ type: 'disabled_plugin',
470
+ tier: 2,
471
+ name: plugin.name,
472
+ detail: `${plugin.skillCount} skills`,
473
+ tokens: plugin.skillCount * 30,
474
+ path: join(getPluginsDir(), plugin.name),
475
+ });
476
+ }
477
+ }
478
+ // Sort by tier
479
+ issues.sort((a, b) => a.tier - b.tier);
480
+ return issues;
481
+ }
482
+ export async function scan() {
483
+ const [{ skills: localSkills, brokenSymlinks }, { skills: pluginSkills, plugins, tempCaches }, { memoryFiles, staleProjects }, mcp, disabledPlugins,] = await Promise.all([
484
+ scanLocalSkills(),
485
+ scanPluginSkills(),
486
+ scanMemoryFiles(),
487
+ scanMcpServers(),
488
+ getDisabledPlugins(),
489
+ ]);
490
+ // Annotate plugin status
491
+ for (const plugin of plugins) {
492
+ plugin.status = disabledPlugins.has(plugin.name) ? 'disabled' : 'enabled';
493
+ }
494
+ // CLAUDE.md
495
+ const claudeMdContent = await safeReadFile(join(getClaudeDir(), 'CLAUDE.md'));
496
+ const claudeMdBytes = claudeMdContent ? Buffer.byteLength(claudeMdContent) : 0;
497
+ const claudeMdTokens = claudeMdContent
498
+ ? countTokensCached(claudeMdContent, join(getClaudeDir(), 'CLAUDE.md'))
499
+ : 0;
500
+ const claudeMdSections = claudeMdContent ? parseClaudeMdSections(claudeMdContent) : [];
501
+ const issues = classifyIssues(localSkills, pluginSkills, brokenSymlinks, memoryFiles, tempCaches, staleProjects, disabledPlugins, plugins);
502
+ // Estimate total tokens at startup
503
+ const skillListingTokens = (localSkills.length + pluginSkills.length) * 30;
504
+ const memoryTokens = memoryFiles.reduce((sum, m) => sum + m.tokens, 0);
505
+ const totalTokensBefore = skillListingTokens + claudeMdTokens + memoryTokens;
506
+ return {
507
+ localSkills,
508
+ pluginSkills,
509
+ plugins,
510
+ brokenSymlinks,
511
+ memoryFiles,
512
+ claudeMdBytes,
513
+ claudeMdTokens,
514
+ claudeMdSections,
515
+ mcpServers: mcp.count,
516
+ mcpServerNames: mcp.names,
517
+ issues,
518
+ totalTokensBefore,
519
+ };
520
+ }
@@ -0,0 +1,3 @@
1
+ import type { Issue } from './types.js';
2
+ export declare function resolveSelection(input: string, issues: Issue[]): Issue[];
3
+ export declare function resolveRestoreSelection(input: string, count: number): number[];
@@ -0,0 +1,38 @@
1
+ export function resolveSelection(input, issues) {
2
+ const trimmed = input.trim().toLowerCase();
3
+ if (trimmed === 'none' || trimmed === 'n')
4
+ return [];
5
+ if (trimmed === 'all' || trimmed === 'a')
6
+ return [...issues];
7
+ if (trimmed === '' || trimmed === 'enter') {
8
+ // Default: tier 1 only
9
+ return issues.filter((i) => i.tier === 1);
10
+ }
11
+ // Parse comma-separated numbers → select exactly those items
12
+ const result = [];
13
+ const seen = new Set();
14
+ for (const part of trimmed.split(',')) {
15
+ const num = parseInt(part.trim(), 10);
16
+ if (!isNaN(num) && num >= 1 && num <= issues.length && !seen.has(num)) {
17
+ seen.add(num);
18
+ result.push(issues[num - 1]);
19
+ }
20
+ }
21
+ return result;
22
+ }
23
+ export function resolveRestoreSelection(input, count) {
24
+ const trimmed = input.trim().toLowerCase();
25
+ if (trimmed === 'none' || trimmed === 'n' || trimmed === '')
26
+ return [];
27
+ if (trimmed === 'all' || trimmed === 'a') {
28
+ return Array.from({ length: count }, (_, i) => i);
29
+ }
30
+ const indices = [];
31
+ for (const part of trimmed.split(',')) {
32
+ const num = parseInt(part.trim(), 10);
33
+ if (!isNaN(num) && num >= 1 && num <= count) {
34
+ indices.push(num - 1);
35
+ }
36
+ }
37
+ return indices;
38
+ }
@@ -0,0 +1,5 @@
1
+ export declare function initTokenizer(): Promise<void>;
2
+ export declare function countTokens(text: string): number;
3
+ export declare function countTokensCached(text: string, filePath: string): number;
4
+ export declare function flushCache(): Promise<void>;
5
+ export declare function isUsingFallback(): boolean;
@@ -0,0 +1,60 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { readFile, writeFile, mkdir } from 'node:fs/promises';
3
+ import { dirname, join } from 'node:path';
4
+ import { homedir } from 'node:os';
5
+ let encoder = null;
6
+ let useFallback = false;
7
+ const CACHE_PATH = join(homedir(), '.claude', '.token-cache.json');
8
+ let cache = { version: 1, entries: {} };
9
+ let cacheDirty = false;
10
+ export async function initTokenizer() {
11
+ try {
12
+ // cl100k_base is closest to Claude's tokenizer (gpt-4o uses o200k_base which undercounts by ~15%)
13
+ const { getEncoding } = await import('js-tiktoken');
14
+ encoder = getEncoding('cl100k_base');
15
+ }
16
+ catch {
17
+ useFallback = true;
18
+ }
19
+ try {
20
+ const raw = await readFile(CACHE_PATH, 'utf-8');
21
+ cache = JSON.parse(raw);
22
+ }
23
+ catch {
24
+ // No cache yet
25
+ }
26
+ }
27
+ function hashContent(content) {
28
+ return createHash('md5').update(content).digest('hex');
29
+ }
30
+ export function countTokens(text) {
31
+ if (useFallback || !encoder) {
32
+ return Math.ceil(text.length / 4);
33
+ }
34
+ return encoder.encode(text).length;
35
+ }
36
+ export function countTokensCached(text, filePath) {
37
+ const hash = hashContent(text);
38
+ const cached = cache.entries[filePath];
39
+ if (cached && cached.hash === hash) {
40
+ return cached.tokens;
41
+ }
42
+ const tokens = countTokens(text);
43
+ cache.entries[filePath] = { hash, tokens };
44
+ cacheDirty = true;
45
+ return tokens;
46
+ }
47
+ export async function flushCache() {
48
+ if (!cacheDirty)
49
+ return;
50
+ try {
51
+ await mkdir(dirname(CACHE_PATH), { recursive: true });
52
+ await writeFile(CACHE_PATH, JSON.stringify(cache, null, 2));
53
+ }
54
+ catch {
55
+ // Non-critical
56
+ }
57
+ }
58
+ export function isUsingFallback() {
59
+ return useFallback;
60
+ }
@@ -0,0 +1,73 @@
1
+ export interface SkillInfo {
2
+ name: string;
3
+ path: string;
4
+ sizeBytes: number;
5
+ tokens: number;
6
+ source: 'local' | 'plugin';
7
+ pluginName?: string;
8
+ }
9
+ export interface BrokenSymlink {
10
+ name: string;
11
+ path: string;
12
+ target: string;
13
+ }
14
+ export interface MemoryFile {
15
+ project: string;
16
+ name: string;
17
+ path: string;
18
+ sizeBytes: number;
19
+ tokens: number;
20
+ }
21
+ export interface PluginInfo {
22
+ name: string;
23
+ skillCount: number;
24
+ skills: string[];
25
+ status?: 'enabled' | 'disabled';
26
+ }
27
+ export type IssueTier = 1 | 2 | 3;
28
+ export type IssueType = 'broken_symlink' | 'template' | 'skill_dup' | 'duplicate' | 'oversized_memory' | 'oversized_skill' | 'disabled_plugin' | 'stale_project' | 'temp_cache';
29
+ export interface Issue {
30
+ type: IssueType;
31
+ tier: IssueTier;
32
+ name: string;
33
+ detail?: string;
34
+ tokens: number;
35
+ path: string;
36
+ }
37
+ export interface ScanResult {
38
+ localSkills: SkillInfo[];
39
+ pluginSkills: SkillInfo[];
40
+ plugins: PluginInfo[];
41
+ brokenSymlinks: BrokenSymlink[];
42
+ memoryFiles: MemoryFile[];
43
+ claudeMdBytes: number;
44
+ claudeMdTokens: number;
45
+ claudeMdSections: Array<{
46
+ name: string;
47
+ sizeBytes: number;
48
+ tokens: number;
49
+ }>;
50
+ mcpServers: number;
51
+ mcpServerNames: string[];
52
+ issues: Issue[];
53
+ totalTokensBefore: number;
54
+ }
55
+ export interface ManifestEntry {
56
+ date: string;
57
+ name: string;
58
+ from: string;
59
+ type: IssueType;
60
+ tokenCount?: number;
61
+ tier?: IssueTier;
62
+ }
63
+ export interface Manifest {
64
+ version: 2;
65
+ entries: ManifestEntry[];
66
+ }
67
+ export interface TokenCache {
68
+ version: number;
69
+ entries: Record<string, {
70
+ hash: string;
71
+ tokens: number;
72
+ }>;
73
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};