بنقرة واحدة
add-command
Scaffold a new CLI subcommand following lstk patterns. Use when adding a new command to the CLI.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Scaffold a new CLI subcommand following lstk patterns. Use when adding a new command to the CLI.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Create a GitHub pull request following lstk conventions with proper title, description, and ticket references.
Add a new output event type to the event/sink system. Use when adding a new kind of event for domain-to-UI communication.
Review a PR against lstk architectural patterns and coding conventions. Use when asked to review a pull request.
Scaffold a new Bubble Tea TUI component following lstk's UI patterns. Use when adding a new reusable UI element.
| name | add-command |
| description | Scaffold a new CLI subcommand following lstk patterns. Use when adding a new command to the CLI. |
| argument-hint | <command-name> |
| allowed-tools | Read, Write, Edit, Glob, Grep |
Scaffold a new CLI subcommand named $ARGUMENTS following lstk's architecture.
Before writing any code, understand what the command should do and whether the approach is sound. Ask the user these questions, plus any others that make sense given the specific command. Wait for answers before proceeding.
Core questions:
runtime.Runtime is a dependency)PreRunE: initConfig is needed)/add-event for each)Also ask context-specific questions that aren't in this list but would help clarify behavior — e.g., edge cases ("what happens if no emulators are running?"), flags/arguments the command should accept, expected output format, whether it should be idempotent, etc.
Challenge the architecture if something doesn't fit well:
Skip questions where the answer is obvious from context (e.g., if the user already explained the behavior in detail). Be direct — raise concerns early rather than building something that needs reworking.
Read these files before writing anything — they are the source of truth for patterns:
cmd/stop.go — simplest command pattern (cmd wiring + output mode selection)cmd/root.go — where commands are registered via AddCommand()internal/container/stop.go — simplest domain logic pattern (accepts output.Sink, emits events)cmd/Create cmd/$ARGUMENTS.go with:
new<Name>Cmd() factory function returning *cobra.CommandPreRunE: initConfig if the command needs configurationui.Run<Name>(...) or TUI pathoutput.NewPlainSink(os.Stdout)Short/Long help text: write each paragraph as one unbroken line (blank line between paragraphs); never hard-wrap a sentence across source lines. The help template (cmd/help.go) word-wraps to the terminal width at render time, and lstk docs reads the raw text — manual breaks fight both. Indent example/output blocks; the wrapper leaves indented lines untouched.Create internal/<package>/<name>.go (use an existing package if it fits, or create a new one) with:
ctx context.Context, rt runtime.Runtime, sink output.Sink, and any other dependenciesoutput.EmitXxx(sink, ...) — never fmt.Print or log.Printoutput.NewSilentError(err) only if the error was already displayed via EmitErrorinternal/ui or charmbracelet/bubbleteaIn cmd/root.go, add the new command to root.AddCommand(...).
If the command constructor needs dependencies (like *env.Env), add them as parameters matching the existing pattern.
If the command needs to communicate domain state that doesn't fit existing event types, use /add-event for each new event. Common cases:
ContainerStatusEvent.PhaseErrorEvent with appropriate ActionsPrefer reusing existing events before creating new ones.
If the command has interactive output beyond plain text:
Run<Name>() function in internal/ui/ following the pattern in internal/ui/run.gooutput.NewTUISink(programSender{p: p})If the command needs custom UI elements (progress bars, tables, etc.), use /add-component for each new component.
If the command is simple (just spinner + success/error messages), the existing App model handles those events already — you may not need a custom TUI path.
Create test/integration/<name>_test.go with:
exec.CommandContext(ctx, binaryPath(), "<name>") → cmd.CombinedOutput()pty.Start(cmd) from github.com/creack/ptyrequireDocker(t) if Docker is neededcleanup() and t.Cleanup(cleanup) for container statecontext.WithTimeout for all testslstk_command telemetry is emitted automatically for every command via instrumentCommands in cmd/root.go — no per-command wiring needed. Do NOT pass *telemetry.Client to a new command constructor unless the command emits additional lifecycle events (like lstk_lifecycle for start/stop/restart) or needs to update the auth token (like login).
In the corresponding integration test, add an assertion that the lstk_command event was emitted.
cmd/ — the command file should be thin wiring onlyoutput.Sink as a parameterfmt.Print/log.Print in domain code — use output.EmitXxx() helpersinternal/ui or Bubble Tea from domain packages