Skip to content

Commit 028bb5f

Browse files
committed
fix: preserve hyphens in script command hints
1 parent e7418f9 commit 028bb5f

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

scripts/bash/common.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ format_speckit_command() {
380380
command_name="${command_name#speckit.}"
381381
command_name="${command_name#speckit-}"
382382
command_name="${command_name//./$separator}"
383-
command_name="${command_name//-/$separator}"
384383

385384
printf '/speckit%s%s\n' "$separator" "$command_name"
386385
}

scripts/powershell/common.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ function Format-SpecKitCommand {
402402
} elseif ($name.StartsWith('speckit-')) {
403403
$name = $name.Substring(8)
404404
}
405-
$name = $name -replace '[.-]', $separator
405+
$name = $name -replace '\.', $separator
406406

407407
return "/speckit$separator$name"
408408
}
@@ -692,4 +692,4 @@ except Exception:
692692
}
693693

694694
return $content
695-
}
695+
}

tests/test_setup_tasks.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,16 @@ def test_bash_command_hint_normalizes_mixed_separators(tasks_repo: Path) -> None
445445
assert result.stdout.strip() == "/speckit-git-commit"
446446

447447

448+
@requires_bash
449+
def test_bash_command_hint_preserves_hyphens_inside_segments(tasks_repo: Path) -> None:
450+
_write_integration_state(tasks_repo, "copilot", ".")
451+
452+
result = _run_bash_format_command(tasks_repo, "speckit.jira.sync-status")
453+
454+
assert result.returncode == 0, result.stderr
455+
assert result.stdout.strip() == "/speckit.jira.sync-status"
456+
457+
448458
@requires_bash
449459
def test_bash_command_hint_caches_invoke_separator_per_process(tasks_repo: Path) -> None:
450460
_write_integration_state(tasks_repo, "claude", "-")
@@ -703,6 +713,18 @@ def test_powershell_command_hint_normalizes_mixed_separators(
703713
assert result.stdout.strip() == "/speckit-git-commit"
704714

705715

716+
@pytest.mark.skipif(not (HAS_PWSH or _POWERSHELL), reason="no PowerShell available")
717+
def test_powershell_command_hint_preserves_hyphens_inside_segments(
718+
tasks_repo: Path,
719+
) -> None:
720+
_write_integration_state(tasks_repo, "copilot", ".")
721+
722+
result = _run_powershell_format_command(tasks_repo, "speckit.jira.sync-status")
723+
724+
assert result.returncode == 0, result.stderr
725+
assert result.stdout.strip() == "/speckit.jira.sync-status"
726+
727+
706728
@pytest.mark.skipif(not (HAS_PWSH or _POWERSHELL), reason="no PowerShell available")
707729
def test_setup_tasks_ps_uses_invoke_separator_in_plan_hint(tasks_repo: Path) -> None:
708730
_write_integration_state(tasks_repo, "claude", "-")

0 commit comments

Comments
 (0)