Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions features/ticket_creation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ Feature: Ticket Creation
Then the command should succeed
And the created ticket should have a valid created timestamp

Scenario: Ticket ID has no special characters from dot-prefixed directory
Given I am in subdirectory ".agents"
When I run "ticket create 'Dot prefix test'"
Then the command should succeed
And the output should match pattern "^[a-z0-9]+-[a-z0-9]{4}$"

Scenario: Tickets directory created on demand
Given the tickets directory does not exist
When I run "ticket create 'First ticket'"
Expand Down
4 changes: 4 additions & 0 deletions ticket
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ generate_id() {
local dir_name
dir_name=$(basename "$(pwd)")

# Sanitize: lowercase, strip non-alphanumeric (keep - and _), strip leading -/_
dir_name=$(echo "$dir_name" | tr '[:upper:]' '[:lower:]' | tr -cd 'a-z0-9_-' | sed 's/^[-_]*//')
[[ -z "$dir_name" ]] && dir_name="tk"

# Extract first letter of each hyphenated/underscored segment
local prefix
prefix=$(echo "$dir_name" | sed 's/[-_]/ /g' | awk '{for(i=1;i<=NF;i++) printf substr($i,1,1)}')
Expand Down