You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the fastest way to iterate. The flag is repeatable and accepts both absolute and relative paths.
521
+
522
+
### Option 2: The config file (`plugins.local`)
523
+
524
+
For plugins you're actively developing, add the path to your tokentop config so it loads every time you start `ttop`:
525
+
526
+
```json
527
+
// ~/.config/tokentop/config.json
528
+
{
529
+
"plugins": {
530
+
"local": [
531
+
"~/development/my-tokentop-provider",
532
+
"~/development/my-tokentop-theme/src/index.ts"
533
+
]
534
+
}
535
+
}
536
+
```
537
+
538
+
Paths support tilde expansion (`~/...`) and can be absolute or relative to the config directory. Each entry can be a directory or a direct file path.
539
+
540
+
### Option 3: The plugins directory
541
+
542
+
Drop your plugin (file or directory) into the default plugins directory:
543
+
544
+
```
545
+
~/.config/tokentop/plugins/
546
+
├── my-theme.ts # Single-file plugin
547
+
└── my-provider/ # Directory-based plugin
548
+
├── package.json
549
+
└── src/
550
+
└── index.ts
551
+
```
552
+
553
+
tokentop auto-discovers everything in this directory on startup. Files must end in `.ts` or `.js`. Directories are resolved using the entry point rules below.
554
+
555
+
### Entry point resolution
556
+
557
+
When you point tokentop at a directory, it resolves the entry point in this order:
558
+
559
+
1.`package.json` — `main` field, then `exports["."]`
560
+
2.`src/index.ts`
561
+
3.`src/index.js`
562
+
4.`index.ts`
563
+
5.`index.js`
564
+
6.`dist/index.js`
565
+
566
+
For most plugins, having `"main": "src/index.ts"` in your `package.json` is all you need.
# 2. Write your plugin in src/index.ts (see examples above)
577
+
578
+
# 3. Run your tests with the SDK test harness
579
+
bun test
580
+
581
+
# 4. Load it in tokentop to verify end-to-end
582
+
ttop --plugin .
583
+
584
+
# 5. When it works, publish to npm
585
+
npm publish
586
+
```
587
+
588
+
### Tips
589
+
590
+
-**Validation errors appear in the console.** If your plugin fails to load, tokentop logs the specific validation error (missing fields, wrong `apiVersion`, etc.).
591
+
-**Disable a plugin without removing it.** Add its `id` to `config.plugins.disabled` to skip loading without deleting the path from `plugins.local`.
592
+
-**Combine methods freely.** Auto-discovered plugins, `plugins.local` paths, and `--plugin` flags all merge together. Duplicates are handled gracefully.
0 commit comments