cli
Skill3 starsChanged 3 months agoMITView on GitHub
The okapicli package adds typed flags, env-variable binding, subcommands, and lifecycle hooks to an Okapi app. Flag types: String, Int, Bool, Float, Duration. Each accepts (name, shortName, default, description). Tag your config struct and let okapicli register flags + bind env vars in one call. cli.WithConfig(cfg) is an equivalent of FromStruct with the same tag set. Supported field types: string, int*, bool, float*. Lowest → highest priority: Command methods:
25 other projects use a version of this.
Adopted by
Most recently taken up by
- BrightGold70/skillstheir own version, first seen Nov 8, 2026
- yuri-xyz/skillstheir own version, first seen Nov 8, 2026
- lobehub/lobehubtheir own version, first seen Nov 5, 2026
- jinhuang712/qq-music-clitheir own version, first seen Oct 25, 2026
- deepgram/skillstheir own version, first seen Oct 25, 2026
- bendrucker/claudetheir own version, first seen Oct 19, 2026
Used with
Projects with it also use desktop, api and 1 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
zjl4616Skilldesktop
桌面操控。让 CC 看屏幕、动鼠标、点按钮、输文字。基于 macOS 原生 OCR 触觉反馈,不截全屏传 AI,极致省 token。触发词:"/desktop"、"帮我操作桌面"、"点一下那个按钮"、"看看屏幕上有什么
Also in 4 projects that use this
VercelSkillapi
Publish HTTP handlers for external webhooks and callbacks on this agent's subdomain.
Also in 5 projects that use this
VercelSkillmcp
MCP Apps integration for json-render. Use when building MCP servers that render interactive UIs in Claude, ChatGPT, Cursor, or VS Code, or when integrating json-render with the Model Context Protocol.
Also in 5 projects that use this
Other versions25 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 25
- lobehub/lobe-chat★ 84ksame name
- lobehub/lobehub★ 84ksame name
- clockworklabs/SpacetimeDB★ 26ksame name
- saifyxpro/HeadlessX★ 2.4ksame name
- Goldziher/html-to-markdown★ 888same name
- kreuzberg-dev/html-to-markdown★ 881same name
- kreuzberg-dev/tree-sitter-language-pack★ 483same name
- kreuzberg-dev/liter-llm★ 264same name
- AterDev/Perigon.CLI★ 54same name
- tiero/claw-cash★ 36same name
15 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository20 other files it gives its agents.
- authenticationSkill
- contextSkill
- dynamic_routesSkill
- error_handlingSkill
- http_clientSkill
- middlewareSkill
- openapiSkill
- overviewSkill
- request_bindingSkill
- responseSkill
- route_definitionSkill
- routingSkill
- sse_streamSkill
- std_compatSkill
- templatingSkill
- testingSkill
- tls_httpsSkill
- validationSkill
- websocketSkill
- web_spaSkill
The file
Files
Okapi CLI Integration (okapicli package)
The okapicli package adds typed flags, env-variable binding, subcommands, and lifecycle hooks to an Okapi app.
Constructors
cli := okapicli.New(app *okapi.Okapi, name ...string) *CLI // wrap an existing app
cli := okapicli.Default() *CLI // new CLI with a default Okapi instance
app := cli.Okapi() // the underlying *okapi.OkapiBasic Usage
import "github.com/jkaninda/okapi/okapicli"
cli := okapicli.New(app, "myapp").
String("config", "c", "config.yaml", "Path to configuration file").
Int("port", "p", 8080, "HTTP server port").
Bool("debug", "d", false, "Enable debug mode").
Float("rate", "r", 1.0, "Rate limit").
Duration("timeout", "t", 30*time.Second, "Request timeout")
if err := cli.Parse(); err != nil { panic(err) }
app.WithPort(cli.GetInt("port")).WithDebug(cli.GetBool("debug"))
cli.Run()Flag types: String, Int, Bool, Float, Duration. Each accepts (name, shortName, default, description).
Struct-Based Configuration
Tag your config struct and let okapicli register flags + bind env vars in one call.
| Tag | Description |
cli | Flag name (required) |
short | Short flag name (optional) |
desc | --help description |
default | Default value (string, parsed to field type) |
env | Environment variable name |
type Config struct {
Port int `cli:"port" short:"p" desc:"Server port" env:"APP_PORT" default:"8080"`
Host string `cli:"host" short:"h" desc:"Hostname" env:"APP_HOST" default:"localhost"`
Debug bool `cli:"debug" short:"d" desc:"Debug mode" env:"APP_DEBUG"`
Config string `cli:"config" short:"c" desc:"Config file" env:"APP_CONFIG" default:"config.yaml"`
Timeout time.Duration `cli:"timeout" short:"t" desc:"Request timeout" env:"APP_TIMEOUT" default:"30s"`
}
cfg := &Config{Port: 8000} // struct defaults still win over the zero value but lose to all tags
cli := okapicli.New(app, "myapp").FromStruct(cfg)
if err := cli.Parse(); err != nil { panic(err) }
// cfg fields are populated with resolved valuescli.WithConfig(cfg) is an equivalent of FromStruct with the same tag set. Supported field types: string, int*, bool, float*.
Value Resolution Order
Lowest → highest priority:
- Struct field's initial value
defaulttag- Environment variable (
env) - CLI flag
One-Liner Parsing (Fail Fast)
cli := okapicli.New(app, "myapp").FromStruct(cfg).MustParse() // panics on errorSubcommands
cli.Command("serve", "Start the HTTP server", func(cmd *okapicli.Command) error {
cmd.Okapi().WithPort(cmd.GetInt("port"))
return cmd.CLI().Run()
}).Int("port", "p", 8080, "HTTP server port")
cli.Command("migrate", "Run database migrations", func(cmd *okapicli.Command) error {
return runMigrations(cmd.GetString("dsn"))
}).String("dsn", "", "", "Database connection string")
cli.DefaultCommand("serve") // run "serve" when no subcommand specified
cli.Execute()Command methods:
cmd.Name() string // Command name
cmd.CLI() *CLI // Parent CLI instance
cmd.Okapi() *okapi.Okapi // Okapi instance from parent CLI
cmd.Args() []string // Non-flag arguments
cmd.GetString(name) string
cmd.GetInt(name) int
cmd.GetBool(name) bool
cmd.GetFloat(name) float64
cmd.GetDuration(name) time.Duration
cmd.FromStruct(v) // Register flags from struct tagsServer Lifecycle Hooks
cli.RunServer(&okapicli.RunOptions{
ShutdownTimeout: 30 * time.Second,
Signals: []os.Signal{okapicli.SIGINT, okapicli.SIGTERM},
OnStart: func() { slog.Info("Preparing resources before startup") },
OnStarted: func() { slog.Info("Server started") },
OnShutdown: func() { slog.Info("Cleaning up before shutdown") },
})
// Or simple defaults — shorthand for RunServer(nil): 30s shutdown timeout, SIGINT/SIGTERM
cli.Run()RunOptions field | Default |
ShutdownTimeout | 30s |
Signals | okapicli.SIGINT, okapicli.SIGTERM |
OnStart | called just before the server starts |
OnStarted | called shortly after a successful start |
OnShutdown | called before graceful shutdown begins |
RunServer starts the server in a goroutine, blocks on the signal channel, and shuts down gracefully — no manual signal.Notify needed.
Configuration File Loading
var cfg AppConfig
if err := cli.LoadConfig("config.yaml", &cfg); err != nil { panic(err) }
// supports .json / .yaml / .ymlFlag Retrieval
cli.GetString(name) string
cli.GetInt(name) int
cli.GetBool(name) bool
cli.GetFloat(name) float64
cli.GetDuration(name) time.Duration
cli.Get(name) any
cli.MustParse() *CLI // Parse or panic
cli.Okapi() *okapi.Okapi // Underlying Okapi instance
cli.MatchedCommand() *Command // Matched subcommand after Execute()Combining CLI With a Config File
Common pattern — CLI overrides go on top of a YAML config:
./myapp --config=config.prod.yaml --port=9000 --debugDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

