Skip to content

Commit b4b1eec

Browse files
committed
Restore defaults after rig manifest rebase
1 parent 3e58080 commit b4b1eec

3 files changed

Lines changed: 35 additions & 14 deletions

File tree

internal/config/types.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,11 @@ func defaultProcessNames(provider, command string) []string {
597597
if provider == "claude" {
598598
return []string{"node"}
599599
}
600+
if provider == "opencode" {
601+
// OpenCode runs as Node.js process, need both for IsAgentRunning detection.
602+
// tmux pane_current_command may show "node" or "opencode" depending on how invoked.
603+
return []string{"opencode", "node"}
604+
}
600605
if command != "" {
601606
return []string{filepath.Base(command)}
602607
}
@@ -605,7 +610,8 @@ func defaultProcessNames(provider, command string) []string {
605610

606611
func defaultReadyPromptPrefix(provider string) string {
607612
if provider == "claude" {
608-
return "> "
613+
// Claude Code uses ❯ (U+276F) as the prompt character
614+
return "❯ "
609615
}
610616
return ""
611617
}
@@ -617,6 +623,12 @@ func defaultReadyDelayMs(provider string) int {
617623
if provider == "codex" {
618624
return 3000
619625
}
626+
if provider == "opencode" {
627+
// OpenCode requires delay-based detection because its TUI uses
628+
// box-drawing characters (┃) that break prompt prefix matching.
629+
// 8000ms provides reliable startup detection across models.
630+
return 8000
631+
}
620632
return 0
621633
}
622634

@@ -632,9 +644,15 @@ func defaultInstructionsFile(provider string) string {
632644

633645
// quoteForShell quotes a string for safe shell usage.
634646
func quoteForShell(s string) string {
635-
// Simple quoting: wrap in double quotes, escape internal quotes
647+
// Wrap in double quotes, escaping characters that are special in double-quoted strings:
648+
// - backslash (escape character)
649+
// - double quote (string delimiter)
650+
// - backtick (command substitution)
651+
// - dollar sign (variable expansion)
636652
escaped := strings.ReplaceAll(s, `\`, `\\`)
637653
escaped = strings.ReplaceAll(escaped, `"`, `\"`)
654+
escaped = strings.ReplaceAll(escaped, "`", "\\`")
655+
escaped = strings.ReplaceAll(escaped, "$", `\$`)
638656
return `"` + escaped + `"`
639657
}
640658

internal/crew/manager.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -378,16 +378,13 @@ func (m *Manager) loadState(name string) (*CrewWorker, error) {
378378
return nil, fmt.Errorf("parsing state: %w", err)
379379
}
380380

381-
// Backfill essential fields if missing (handles empty or incomplete state.json)
382-
if crew.Name == "" {
383-
crew.Name = name
384-
}
381+
// Directory name is source of truth for Name and ClonePath.
382+
// state.json can become stale after directory rename, copy, or corruption.
383+
crew.Name = name
385384
if crew.Rig == "" {
386385
crew.Rig = m.rig.Name
387386
}
388-
if crew.ClonePath == "" {
389-
crew.ClonePath = m.crewDir(name)
390-
}
387+
crew.ClonePath = m.crewDir(name)
391388

392389
return &crew, nil
393390
}

internal/git/git.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,6 @@ func (g *Git) RemoteDefaultBranch() string {
482482
return "main" // final fallback
483483
}
484484

485-
// ConfigGet gets a git config value.
486-
func (g *Git) ConfigGet(key string) (string, error) {
487-
return g.run("config", "--get", key)
488-
}
489-
490485
// HasUncommittedChanges returns true if there are uncommitted changes.
491486
func (g *Git) HasUncommittedChanges() (bool, error) {
492487
status, err := g.Status()
@@ -513,6 +508,17 @@ func (g *Git) Remotes() ([]string, error) {
513508
return strings.Split(out, "\n"), nil
514509
}
515510

511+
// ConfigGet returns the value of a git config key.
512+
// Returns empty string if the key is not set.
513+
func (g *Git) ConfigGet(key string) (string, error) {
514+
out, err := g.run("config", "--get", key)
515+
if err != nil {
516+
// git config --get returns exit code 1 if key not found
517+
return "", nil
518+
}
519+
return out, nil
520+
}
521+
516522
// SetRemoteURL sets an existing remote URL or adds it if missing.
517523
func (g *Git) SetRemoteURL(remote, url string) error {
518524
if url == "" {

0 commit comments

Comments
 (0)