|
| 1 | +# Claude Code Configuration |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +**claude-dashboard** is a Claude Code plugin that provides a comprehensive status line showing context usage, API rate limits, and cost tracking. |
| 6 | + |
| 7 | +## Tech Stack |
| 8 | + |
| 9 | +- **Runtime**: Node.js 18+ |
| 10 | +- **Language**: TypeScript 5.0+ |
| 11 | +- **Build**: esbuild |
| 12 | +- **Target**: Claude Code Plugin |
| 13 | + |
| 14 | +## Project Structure |
| 15 | + |
| 16 | +``` |
| 17 | +claude-dashboard/ |
| 18 | +├── .claude-plugin/ |
| 19 | +│ ├── plugin.json # Plugin manifest |
| 20 | +│ └── marketplace.json # Marketplace metadata |
| 21 | +├── commands/ |
| 22 | +│ └── setup.md # /claude-dashboard:setup command |
| 23 | +├── scripts/ |
| 24 | +│ ├── statusline.ts # Main entry point |
| 25 | +│ ├── types.ts # TypeScript interfaces |
| 26 | +│ └── utils/ |
| 27 | +│ ├── api-client.ts # OAuth API client with caching |
| 28 | +│ ├── colors.ts # ANSI color codes |
| 29 | +│ ├── credentials.ts # Keychain/credentials extraction |
| 30 | +│ ├── formatters.ts # Token/cost/time formatting |
| 31 | +│ ├── i18n.ts # Internationalization |
| 32 | +│ └── progress-bar.ts # Progress bar rendering |
| 33 | +├── locales/ |
| 34 | +│ ├── en.json # English translations |
| 35 | +│ └── ko.json # Korean translations |
| 36 | +├── dist/ |
| 37 | +│ └── index.js # Built output (committed) |
| 38 | +└── package.json |
| 39 | +``` |
| 40 | + |
| 41 | +## Development Workflow |
| 42 | + |
| 43 | +```bash |
| 44 | +# Install dependencies |
| 45 | +npm install |
| 46 | + |
| 47 | +# Build |
| 48 | +npm run build |
| 49 | + |
| 50 | +# Test locally |
| 51 | +echo '{"model":{"display_name":"Opus"},...}' | node dist/index.js |
| 52 | +``` |
| 53 | + |
| 54 | +## Code Style |
| 55 | + |
| 56 | +- Use TypeScript strict mode |
| 57 | +- ESM modules (import/export) |
| 58 | +- Functional style preferred |
| 59 | +- No external runtime dependencies (Node.js built-ins only) |
| 60 | + |
| 61 | +## Key Conventions |
| 62 | + |
| 63 | +1. **dist/index.js is committed** - Plugin users don't need to build |
| 64 | +2. **60-second API cache** - Avoid rate limiting |
| 65 | +3. **Graceful degradation** - Show ⚠️ on API errors, not crash |
| 66 | +4. **i18n** - All user-facing strings in locales/*.json |
| 67 | + |
| 68 | +## Testing Checklist |
| 69 | + |
| 70 | +Before committing: |
| 71 | +- [ ] `npm run build` succeeds |
| 72 | +- [ ] Max plan output format correct |
| 73 | +- [ ] Pro plan output format correct |
| 74 | +- [ ] Korean/English switching works |
| 75 | +- [ ] API error shows ⚠️ instead of crash |
| 76 | + |
| 77 | +## Common Tasks |
| 78 | + |
| 79 | +### Adding a new locale |
| 80 | + |
| 81 | +1. Create `locales/{lang}.json` copying from `en.json` |
| 82 | +2. Update `scripts/utils/i18n.ts` to import new locale |
| 83 | +3. Test with `/claude-dashboard:setup {lang}` |
| 84 | + |
| 85 | +### Modifying status line format |
| 86 | + |
| 87 | +1. Edit `scripts/statusline.ts` `formatOutput()` function |
| 88 | +2. Update `README.md` examples |
| 89 | +3. Update `commands/setup.md` examples |
| 90 | +4. Rebuild and test |
| 91 | + |
| 92 | +### Updating API client |
| 93 | + |
| 94 | +1. Edit `scripts/utils/api-client.ts` |
| 95 | +2. Check cache invalidation logic |
| 96 | +3. Test with expired cache (`rm /tmp/claude-dashboard-cache.json`) |
0 commit comments