workspace

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package workspace provides utilities for workspace management.

Index

Constants

View Source
const MaxBasenameTruncation = 10

MaxBasenameTruncation is the max number of alphanumeric chars kept from the basename.

MaxPrefixLength is the maximum total prefix length: basename + hyphen + hash suffix.

View Source
const PrefixHashSuffixLength = 4

PrefixHashSuffixLength is the number of base36 hash characters in the suffix.

Variables

This section is empty.

Functions

func Base36Encode

func Base36Encode(data []byte) string

Base36Encode converts bytes to a base36 string.

func GenerateIssueID

func GenerateIssueID(prefix, title string) string

GenerateIssueID creates an issue ID from content. Format: prefix.{6-char-base36-hash} Uses period separator to distinguish from workspace prefixes which use hyphens.

func GenerateName

func GenerateName(dirPath string) (string, error)

GenerateName creates a workspace name from a directory path. Format: {sanitized-basename}-{6-char-hex-hash} The hash is derived from the full absolute path, making it deterministic.

func GeneratePlanID added in v0.7.0

func GeneratePlanID(title string) string

GeneratePlanID creates a plan ID from content. Format: plan.{6-char-base36-hash} Uses "plan" prefix to identify shared plans.

func GeneratePrefix

func GeneratePrefix(dirPath string) (string, error)

GeneratePrefix creates an issue prefix from a directory path. Format: {alphanumeric-basename-truncated}-{4-char-base36-hash} The hash is derived from the full absolute path, making it deterministic. Example: /home/user/projects/my-api -> "myapi-a3f2"

func GeneratePrefixFromName

func GeneratePrefixFromName(name string) string

GeneratePrefixFromName creates an issue prefix from a workspace name (without path). Format: {alphanumeric-name-truncated}-{4-char-base36-hash} Used when creating a workspace without an associated directory path. Includes timestamp for uniqueness when same name is used multiple times.

func GeneratePrefixWithCustomName added in v0.10.0

func GeneratePrefixWithCustomName(dirPath, customName string) (string, error)

GeneratePrefixWithCustomName creates an issue prefix using a user-provided basename combined with a path-derived hash suffix for uniqueness. The custom name is normalized (lowercased, non-alphanumeric stripped) and truncated to MaxBasenameTruncation chars. Format: {normalized-custom-name}-{4-char-base36-hash}

func GenerateWorkspaceID

func GenerateWorkspaceID(prefix, name string) string

GenerateWorkspaceID creates a workspace ID from content. Format: prefix-{6-char-base36-hash} Uses hyphen separator consistent with workspace naming conventions.

func SanitizeBasename

func SanitizeBasename(name string) string

SanitizeBasename normalizes a directory name for use in workspace names.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL