- Home
- Skills
- Agents Inc
- Skills
- Cli Framework Oclif Ink
cli-framework-oclif-ink_skill
0
GitHub Stars
5
Bundled Files
2 months ago
Catalog Refreshed
3 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill agents-inc/skills --skill cli-framework-oclif-ink- examples-advanced.md27.5 KB
- examples-testing.md24.3 KB
- examples.md24.9 KB
- metadata.yaml636 B
- SKILL.md8.4 KB
Overview
This skill teaches building modern CLIs by combining oclif's command framework with Ink's React-based terminal rendering. It focuses on patterns for routing, parsing, plugin architecture, and stateful interactive UIs so you can create multi-command tools with rich terminal experiences. Practical examples, anti-patterns, and decision guidance help choose the right approach for each part of your CLI.
How this skill works
The skill describes how to structure oclif commands (flags, args, lifecycle hooks) and how to author Ink functional components with hooks and useInput for interactive behavior. It shows how to invoke Ink from an oclif Command and wait for the UI to exit (waitUntilExit). The content also covers state management (Zustand), testing strategies, and common integration pitfalls to ensure reliable, non-blocking CLIs.
When to use it
- Building multi-command CLIs with subcommands and plugins
- Creating multi-step wizards or complex interactive flows in terminal
- Rendering live dashboards, progress displays, or real-time status screens
- Requiring auto-generated help, shell completion, and enterprise features
- When declarative React-like UI and component reuse are valuable
Best practices
- Always use async/await in oclif run() and await promises to avoid timeouts
- Call waitUntilExit() after render() so Ink components can unmount cleanly
- Use functional Ink components with hooks; return cleanup from useEffect for async work
- Avoid console.log in commands—use this.log(), this.warn(), this.error() for consistent output modes
- Keep heavy startup minimal; prefer lightweight prompts for simple cases to reduce overhead
Example use cases
- A git-style CLI with subcommands and a plugin system plus a config wizard implemented in Ink
- An interactive installer or project generator with multi-step UI and persisted choices
- A monitoring or CI dashboard that streams status and logs in real time
- A developer tool that runs tasks (execa) and shows progress and interactive action panels
- An enterprise CLI that needs shell completion, auto-update warnings, and extensible commands
FAQ
You can, but weigh the ~200ms overhead. For simple single-command tools, a lightweight runner or plain Node may be preferable.
How do I prevent the command from exiting before Ink finishes?
Call const { waitUntilExit } = render(<App/>); then await waitUntilExit() inside your oclif run() to let Ink unmount.