fix(index): lazy-import @skillkit/tui + document optional deps

Devin review caught a hard bug: apps/skillkit/src/index.ts had a
static re-export of startTUI from @skillkit/tui. Now that tui is an
optional dependency, importing the skillkit package would crash with
ERR_MODULE_NOT_FOUND whenever the optional dep was skipped
(--omit=optional). Convert the re-export to an async wrapper that
dynamically imports @skillkit/tui on call. The error is surfaced
naturally with a clear Cannot-find-package message.

Docs updates so users understand the new split:

- README.md: add "Install sizes" section with full vs slim table,
  cold-install measurements (475 pkgs / 18 s vs 118 / 9 s),
  per-feature package mapping, and how to add a single optional
  package later.
- apps/skillkit/README.md (npm landing): add "What's optional"
  table + install mode guidance.
- docs/fumadocs/content/docs/installation.mdx: add "Full vs slim
  install" section covering all four optional features.
- docs/skillkit/components/Documentation.tsx +
  docs/fumadocs/src/components/Documentation.tsx: add "Optional
  Features" block to the Quick Start step on the website.

Verified: after `npm install --omit=optional`, `import('skillkit')`
succeeds with 622 exports loaded, and `await startTUI()` fails with
a clean "Cannot find package '@skillkit/tui'" message instead of
crashing at module-load time.
This commit is contained in:
Rohit Ghumare
2026-04-20 22:04:08 +01:00
parent 97ee4b9a43
commit aea3b3ba32
6 changed files with 125 additions and 13 deletions
+39
View File
@@ -375,6 +375,45 @@ bun add -g skillkit # bun
npx skillkit <command> # no install
```
### Install sizes
Core commands — `install`, `list`, `find`, `translate`, `recommend`, `publish` —
ship in the default package. Four power features are shipped as **optional
dependencies** so a bare CLI install stays small:
| Feature | Package | Command |
| ------------------------ | -------------------- | --------------------------- |
| Interactive terminal UI | `@skillkit/tui` | `skillkit ui` / `skillkit tui` |
| REST/OpenAPI server | `@skillkit/api` | `skillkit serve` |
| Peer mesh networking | `@skillkit/mesh` | `skillkit mesh …` |
| Inter-agent messaging | `@skillkit/messaging`| `skillkit message …` |
```bash
# Full install — every feature, everything works out of the box (default):
npm install -g skillkit
# Slim install — core commands only, ~75% smaller, no native addons:
npm install -g skillkit --omit=optional
pnpm add -g skillkit --prod --no-optional
```
Cold `npm install` measurements on a fresh cache:
| Install mode | Packages | Time | Deprecations |
| --------------------- | -------- | ---- | ------------ |
| `skillkit` | 475 | 18 s | 3 |
| `skillkit --omit=optional` | 118 | 9 s | 0 |
If you skipped optional deps and later want the UI, server, mesh, or
messaging, add just the one you need:
```bash
npm install -g @skillkit/tui # skillkit ui
npm install -g @skillkit/api # skillkit serve
npm install -g @skillkit/mesh # skillkit mesh
npm install -g @skillkit/messaging # skillkit message
```
## License
Apache License 2.0 — see [LICENSE](LICENSE).
+19
View File
@@ -5,9 +5,28 @@ Universal skills manager for AI coding agents. Install, manage, and sync skills
## Installation
```bash
# Full install (default) — every feature, everything works:
npm install -g skillkit
# Slim install — core commands only, ~75% smaller, no native addons:
npm install -g skillkit --omit=optional
```
### What's optional
Four power features ship as **optional dependencies** so the core CLI
stays lean. They install automatically with `npm install -g skillkit`,
and are skipped with `--omit=optional`:
| Feature | Package | Command |
| ------------------------ | -------------------- | ------------------------------ |
| Interactive terminal UI | `@skillkit/tui` | `skillkit ui` / `skillkit tui` |
| REST/OpenAPI server | `@skillkit/api` | `skillkit serve` |
| Peer mesh networking | `@skillkit/mesh` | `skillkit mesh …` |
| Inter-agent messaging | `@skillkit/messaging`| `skillkit message …` |
Add one later with `npm install -g @skillkit/tui` (or `api` / `mesh` / `messaging`).
## Quick Start
```bash
+4 -3
View File
@@ -1,6 +1,7 @@
// Re-export all public APIs from packages
export * from '@skillkit/core';
export * from '@skillkit/agents';
// Re-export TUI entry point
export { startTUI } from '@skillkit/tui';
export async function startTUI(...args: unknown[]): Promise<unknown> {
const mod = await import('@skillkit/tui');
return mod.startTUI(...(args as Parameters<typeof mod.startTUI>));
}
@@ -33,6 +33,39 @@ bun add -g skillkit
Both `skillkit` and `sk` work as command aliases.
## Full vs slim install
SkillKit ships four power features as **optional dependencies** so the
core install stays small. The default `npm install -g skillkit` installs
every feature; `--omit=optional` installs only the core CLI.
| Feature | Package | Command |
| ------------------------ | -------------------- | ------------------------------ |
| Interactive terminal UI | `@skillkit/tui` | `skillkit ui` / `skillkit tui` |
| REST/OpenAPI server | `@skillkit/api` | `skillkit serve` |
| Peer mesh networking | `@skillkit/mesh` | `skillkit mesh …` |
| Inter-agent messaging | `@skillkit/messaging`| `skillkit message …` |
```bash
# Full (default) — every feature works out of the box:
npm install -g skillkit
# Slim — core commands only, ~75% smaller, no native addons, 0 deprecation warnings:
npm install -g skillkit --omit=optional
```
Add one later:
```bash
npm install -g @skillkit/tui # enables: skillkit ui
npm install -g @skillkit/api # enables: skillkit serve
npm install -g @skillkit/mesh # enables: skillkit mesh
npm install -g @skillkit/messaging # enables: skillkit message
```
The CLI catches a missing optional feature and prints a one-line hint,
so you'll never see an unhandled stack trace.
## Verify
```bash
+15 -5
View File
@@ -61,14 +61,24 @@ const sections: DocSection[] = [
content: (
<div className="space-y-4">
<h3 className="text-lg font-semibold text-white">Quick Start</h3>
<CodeBlock>{`# Install globally via npm
<CodeBlock>{`# Full install — every feature works out of the box (default):
npm install -g skillkit
# Or use npx directly
npx skillkit --help
# Slim install — core commands only, ~75% smaller, 0 deprecation warnings:
npm install -g skillkit --omit=optional
# Or install via pnpm
pnpm add -g skillkit`}</CodeBlock>
# Or use npx directly:
npx skillkit --help`}</CodeBlock>
<h3 className="text-lg font-semibold text-white mt-6">Optional Features</h3>
<p className="text-zinc-300 text-sm">
TUI, REST server, peer mesh, and inter-agent messaging ship as optional
dependencies. They install by default, or add later à la carte:
</p>
<CodeBlock>{`npm install -g @skillkit/tui # enables: skillkit ui
npm install -g @skillkit/api # enables: skillkit serve
npm install -g @skillkit/mesh # enables: skillkit mesh
npm install -g @skillkit/messaging # enables: skillkit message`}</CodeBlock>
<h3 className="text-lg font-semibold text-white mt-6">Verify Installation</h3>
<CodeBlock>{`skillkit --version
+15 -5
View File
@@ -60,14 +60,24 @@ const sections: DocSection[] = [
content: (
<div className="space-y-4">
<h3 className="text-lg font-semibold text-white">Quick Start</h3>
<CodeBlock>{`# Install globally via npm
<CodeBlock>{`# Full install — every feature works out of the box (default):
npm install -g skillkit
# Or use npx directly
npx skillkit --help
# Slim install — core commands only, ~75% smaller, 0 deprecation warnings:
npm install -g skillkit --omit=optional
# Or install via pnpm
pnpm add -g skillkit`}</CodeBlock>
# Or use npx directly:
npx skillkit --help`}</CodeBlock>
<h3 className="text-lg font-semibold text-white mt-6">Optional Features</h3>
<p className="text-zinc-300 text-sm">
TUI, REST server, peer mesh, and inter-agent messaging ship as optional
dependencies. They install by default, or add later à la carte:
</p>
<CodeBlock>{`npm install -g @skillkit/tui # enables: skillkit ui
npm install -g @skillkit/api # enables: skillkit serve
npm install -g @skillkit/mesh # enables: skillkit mesh
npm install -g @skillkit/messaging # enables: skillkit message`}</CodeBlock>
<h3 className="text-lg font-semibold text-white mt-6">Verify Installation</h3>
<CodeBlock>{`skillkit --version