Skip to content

Commit d39fc7f

Browse files
Copilotrajbos
andcommitted
Add quick reference README for load-cache-data skill
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
1 parent eb5d100 commit d39fc7f

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Load Cache Data Skill - Quick Reference
2+
3+
This skill provides tools and documentation for accessing the GitHub Copilot Token Tracker's local session file cache.
4+
5+
## Quick Start
6+
7+
```bash
8+
# Show last 10 cache entries (default)
9+
node .github/skills/load-cache-data/load-cache-data.js
10+
11+
# Show last 5 entries
12+
node .github/skills/load-cache-data/load-cache-data.js --last 5
13+
14+
# Output as JSON
15+
node .github/skills/load-cache-data/load-cache-data.js --json
16+
17+
# Show help
18+
node .github/skills/load-cache-data/load-cache-data.js --help
19+
```
20+
21+
## What This Skill Does
22+
23+
1. **Demonstrates cache structure** - Shows the format and content of cached session data
24+
2. **Provides access patterns** - Example code for reading cache from VS Code globalState
25+
3. **Helps debugging** - Understand what's being cached and when
26+
4. **Supports development** - Iterate with real data structures when building features
27+
28+
## Important Note
29+
30+
The cache is stored in VS Code's internal database (`state.vscdb`) and is only directly accessible through the extension's API at runtime. This script generates example data that matches the real cache structure.
31+
32+
To access real cache data, use the extension's API:
33+
34+
```typescript
35+
// In extension.ts or any file with access to ExtensionContext
36+
const cacheData = context.globalState.get<Record<string, SessionFileCache>>('sessionFileCache');
37+
const entries = Object.entries(cacheData || {});
38+
39+
// Sort by most recent
40+
entries.sort((a, b) => (b[1].mtime || 0) - (a[1].mtime || 0));
41+
42+
// Get last 10
43+
const last10 = entries.slice(0, 10);
44+
```
45+
46+
## Full Documentation
47+
48+
See [SKILL.md](./SKILL.md) for complete documentation including:
49+
- Cache structure details
50+
- Integration with extension code
51+
- Cache management methods
52+
- Troubleshooting guide
53+
- Example use cases

0 commit comments

Comments
 (0)