Documentation
¶
Overview ¶
Package launch implements `sf claude` — a thin, generic launcher that starts the `claude` CLI for a project. Binding to the project's instructions is implicit: claude runs with cwd set to the project dir, so it loads that project's own root AGENTS.md/CLAUDE.md natively — sf doesn't maintain a separate instruction tree or inject one. The launcher's job is just the mechanics: resolve the project dir, assemble claude's argv, and hand off to the process (interactive) or run it headlessly (--task), propagating its exit code.
Index ¶
- func ForkSlug(sel string) string
- func InteractiveArgs(t Target, o Options) []string
- func NewCommand() *cobra.Command
- func ResolveDir(dirFlag, project string) (string, error)
- func ResolveFork(projectDir, sel string, dryRun bool) (string, error)
- func Run(t Target, o Options, stdout io.Writer) (int, error)
- func TaskArgs(t Target, o Options) []string
- type Options
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForkSlug ¶
ForkSlug normalizes a fork selector for `sf claude <project> <sel>`: a bare number N becomes "sN" (the s1..sN convention); any other token is used verbatim.
func InteractiveArgs ¶
InteractiveArgs assembles the claude argv for an interactive session.
func NewCommand ¶
NewCommand returns the `claude` Cobra command (`sf claude`).
func ResolveDir ¶
ResolveDir resolves the project's working dir. Order: an explicit --dir override; else, given a bare project name, $SF_CLAUDE_DIR/<project> (error if $SF_CLAUDE_DIR is unset — there's no tree to search generically); else, with neither, the current directory. The result is validated to exist and be a directory, and returned absolute.
func ResolveFork ¶
ResolveFork redirects a launch into an isolated worktree copy of the project, via the project's own dev/worktree.sh (that script owns the fork scheme — paths, ports, stack; the launcher only orchestrates it). Errors clearly if the project doesn't ship one. dryRun only resolves the fork's dir without creating or starting anything.
Types ¶
type Options ¶
type Options struct {
Model string
Effort string
Permission string
Task string
Out string
JSON bool
Quiet bool
DryRun bool
Extra []string // passthrough args (after `--`)
}
Options carries everything resolved from flags before launch.
type Target ¶
Target is a resolved launch target: the project's working dir plus the name it's tagged with (passed to claude as `-n` and stamped into SOFIA_TAG). Name is fixed at resolution time and untouched by a fork selector, so `sf <proj> <tool>` calls made from inside a forked worktree still attribute to the main project.
func ResolveTarget ¶
ResolveTarget resolves the project dir (see ResolveDir) and names it after the resolved dir's basename.