chore(repo): reinitialize repository
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package lane
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"inbox/internal/base/slug"
|
||||
)
|
||||
|
||||
func DefaultBranchName(workspaceSlug, topicID, laneSlug string) string {
|
||||
return "lane/" + runtimeWorkspaceSlug(workspaceSlug) + "/" + runtimeLaneSlug(laneSlug) + "-" + runtimeTopicSuffix(topicID)
|
||||
}
|
||||
|
||||
func DefaultWorktreePath(workspaceRoot, workspaceSlug, topicID, laneSlug string) string {
|
||||
return filepath.Join(filepath.Dir(workspaceRoot), runtimeWorkspaceSlug(workspaceSlug)+"--"+runtimeLaneSlug(laneSlug)+"--"+runtimeTopicSuffix(topicID))
|
||||
}
|
||||
|
||||
func DefaultContainerName(workspaceSlug, topicID, laneSlug string) string {
|
||||
return "lane-" + runtimeWorkspaceSlug(workspaceSlug) + "-" + runtimeLaneSlug(laneSlug) + "-" + runtimeTopicSuffix(topicID)
|
||||
}
|
||||
|
||||
func runtimeWorkspaceSlug(value string) string {
|
||||
if normalized := slug.Normalize(value); normalized != "" {
|
||||
return normalized
|
||||
}
|
||||
return "workspace"
|
||||
}
|
||||
|
||||
func runtimeLaneSlug(value string) string {
|
||||
if normalized := slug.Normalize(value); normalized != "" {
|
||||
return normalized
|
||||
}
|
||||
return "lane"
|
||||
}
|
||||
|
||||
func runtimeTopicSuffix(value string) string {
|
||||
normalized := slug.Normalize(strings.TrimPrefix(strings.TrimSpace(value), "topic-"))
|
||||
if normalized == "" {
|
||||
return "topic"
|
||||
}
|
||||
if len(normalized) > 12 {
|
||||
return normalized[len(normalized)-12:]
|
||||
}
|
||||
return normalized
|
||||
}
|
||||
Reference in New Issue
Block a user