Skip to content
Merged
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: 5 additions & 1 deletion claude-notion/bin/task-work
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ fi
[[ ${#POSITIONAL[@]} -lt 1 ]] && usage

is_notion_url() {
[[ "$1" == *"notion.so"* || "$1" == *"notion.site"* ]]
# Anchored to the URL host so a free-form slug that merely contains the text
# (e.g. "my-notion.com-feature") is not misclassified as a URL. Allows any
# subdomain (www., app., or a published-site workspace) so the original
# *.notion.site behavior is preserved. (#158)
[[ "$1" =~ ^https?://([a-zA-Z0-9-]+\.)*notion\.(so|site|com)/ ]]
}

derive_slug_from_url() {
Expand Down
6 changes: 5 additions & 1 deletion kiro-notion/bin/task-work
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ done
[[ ${#POSITIONAL[@]} -lt 1 ]] && usage

is_notion_url() {
[[ "$1" == *"notion.so"* || "$1" == *"notion.site"* ]]
# Anchored to the URL host so a free-form slug that merely contains the text
# (e.g. "my-notion.com-feature") is not misclassified as a URL. Allows any
# subdomain (www., app., or a published-site workspace) so the original
# *.notion.site behavior is preserved. (#158)
[[ "$1" =~ ^https?://([a-zA-Z0-9-]+\.)*notion\.(so|site|com)/ ]]
}

derive_slug_from_url() {
Expand Down
30 changes: 30 additions & 0 deletions tests/claude_notion_task_work.bats
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,36 @@ teardown() {
assert [ -d "$WORKTREE_BASE/my-explicit-slug" ]
}

@test "app.notion.com single-arg: derives slug from title segment (#158)" {
run "$CLAUDE_NOTION_TASK_WORK" "https://app.notion.com/My-Feature-abc123def456abc123def456abc123de"
assert_success
assert [ -d "$WORKTREE_BASE/my-feature" ]
}

@test "app.notion.com <slug> <url>: records NOTION_URL in .info (#158)" {
local url="https://app.notion.com/My-Feature-abc123def456abc123def456abc123de"
run "$CLAUDE_NOTION_TASK_WORK" my-feature "$url"
assert_success
source "$WORKTREE_BASE/.my-feature.info"
assert_equal "$NOTION_URL" "$url"
}

@test "false-positive guard: slug containing 'notion.com' resolves URL, not slug (#158)" {
# A free-form slug that merely contains "notion.com" must NOT be treated as a
# URL — the real app.notion.com arg must win and land in NOTION_URL.
local url="https://app.notion.com/Real-Page-abc123def456abc123def456abc123de"
run "$CLAUDE_NOTION_TASK_WORK" "my-notion.com-feature" "$url"
assert_success
source "$WORKTREE_BASE/.my-notioncom-feature.info"
assert_equal "$NOTION_URL" "$url"
}

@test "notion.site subdomain URL still recognized (#158)" {
run "$CLAUDE_NOTION_TASK_WORK" "https://myworkspace.notion.site/My-Feature-abc123def456abc123def456abc123de"
assert_success
assert [ -d "$WORKTREE_BASE/my-feature" ]
}

# ---------------------------------------------------------------------------
# Worktree + branch creation
# ---------------------------------------------------------------------------
Expand Down
30 changes: 30 additions & 0 deletions tests/kiro_task_work.bats
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,36 @@ teardown() {
assert [ -d "$WORKTREE_BASE/my-explicit-slug" ]
}

@test "app.notion.com single-arg: derives slug from title segment (#158)" {
run "$KIRO_TASK_WORK" "https://app.notion.com/My-Feature-abc123def456abc123def456abc123de"
assert_success
assert [ -d "$WORKTREE_BASE/my-feature" ]
}

@test "app.notion.com <slug> <url>: records NOTION_URL in .info (#158)" {
local url="https://app.notion.com/My-Feature-abc123def456abc123def456abc123de"
run "$KIRO_TASK_WORK" my-feature "$url"
assert_success
source "$WORKTREE_BASE/.my-feature.info"
assert_equal "$NOTION_URL" "$url"
}

@test "false-positive guard: slug containing 'notion.com' resolves URL, not slug (#158)" {
# A free-form slug that merely contains "notion.com" must NOT be treated as a
# URL — the real app.notion.com arg must win and land in NOTION_URL.
local url="https://app.notion.com/Real-Page-abc123def456abc123def456abc123de"
run "$KIRO_TASK_WORK" "my-notion.com-feature" "$url"
assert_success
source "$WORKTREE_BASE/.my-notioncom-feature.info"
assert_equal "$NOTION_URL" "$url"
}

@test "notion.site subdomain URL still recognized (#158)" {
run "$KIRO_TASK_WORK" "https://myworkspace.notion.site/My-Feature-abc123def456abc123def456abc123de"
assert_success
assert [ -d "$WORKTREE_BASE/my-feature" ]
}

# ---------------------------------------------------------------------------
# Worktree + branch creation
# ---------------------------------------------------------------------------
Expand Down
Loading