OSS launch polish: fix hook paths, add OSS files, update README
- Fix slashes in agent identity causing invalid hook file paths (gt-vqhc) - Add Prerequisites section to README (gt-vzic) - Create CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md (gt-xbfw) - Update Install section for future package managers (gt-7wcf) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
package wisp
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -72,6 +73,25 @@ func NewSlungWork(beadID, createdBy string) *SlungWork {
|
||||
}
|
||||
|
||||
// HookFilename returns the filename for an agent's hook file.
|
||||
// Agent identities may contain slashes (e.g., "gastown/crew/max"),
|
||||
// which are replaced with underscores to create valid filenames.
|
||||
func HookFilename(agent string) string {
|
||||
return HookPrefix + agent + HookSuffix
|
||||
safe := strings.ReplaceAll(agent, "/", "_")
|
||||
return HookPrefix + safe + HookSuffix
|
||||
}
|
||||
|
||||
// AgentFromHookFilename extracts the agent identity from a hook filename.
|
||||
// Reverses the slash-to-underscore transformation done by HookFilename.
|
||||
func AgentFromHookFilename(filename string) string {
|
||||
if len(filename) <= len(HookPrefix)+len(HookSuffix) {
|
||||
return ""
|
||||
}
|
||||
if filename[:len(HookPrefix)] != HookPrefix {
|
||||
return ""
|
||||
}
|
||||
if filename[len(filename)-len(HookSuffix):] != HookSuffix {
|
||||
return ""
|
||||
}
|
||||
safe := filename[len(HookPrefix) : len(filename)-len(HookSuffix)]
|
||||
return strings.ReplaceAll(safe, "_", "/")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user