fix: improve rig name validation error message
- Use underscores instead of stripping invalid characters - Convert suggestion to lowercase for consistency - Explicitly state that underscores are allowed Before: "MyProject.jl" → "MyProjectjl" After: "MyProject.jl" → "myproject_jl" Closes #97 Co-Authored-By: Olivier Debeuf De Rijcker <markov-kernel@users.noreply.github.com> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -212,8 +212,9 @@ func (m *Manager) AddRig(opts AddRigOptions) (*Rig, error) {
|
||||
// Validate rig name: reject characters that break agent ID parsing
|
||||
// Agent IDs use format <prefix>-<rig>-<role>[-<name>] with hyphens as delimiters
|
||||
if strings.ContainsAny(opts.Name, "-. ") {
|
||||
sanitized := strings.NewReplacer("-", "", ".", "", " ", "").Replace(opts.Name)
|
||||
return nil, fmt.Errorf("rig name %q contains invalid characters (hyphens, dots, or spaces break agent ID parsing); use %q instead", opts.Name, sanitized)
|
||||
sanitized := strings.NewReplacer("-", "_", ".", "_", " ", "_").Replace(opts.Name)
|
||||
sanitized = strings.ToLower(sanitized)
|
||||
return nil, fmt.Errorf("rig name %q contains invalid characters; hyphens, dots, and spaces are reserved for agent ID parsing. Try %q instead (underscores are allowed)", opts.Name, sanitized)
|
||||
}
|
||||
|
||||
rigPath := filepath.Join(m.townRoot, opts.Name)
|
||||
|
||||
Reference in New Issue
Block a user