Skip to content

Commit 7ff8fb3

Browse files
Cache speckit version validation result
Co-authored-by: kimchanhyung98 <60088641+kimchanhyung98@users.noreply.github.com>
1 parent 8bc7db2 commit 7ff8fb3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ PIP := $(VENV)/bin/pip
44
SPECKIT_VERSION ?=
55
SPECKIT_BIN := $(VENV)/bin/speckit
66
SPECKIT_SPEC := speckit
7-
# Semver-like: major.minor.patch with optional dot-separated pre-release identifiers.
7+
# Semver-like: major.minor.patch with optional dot-separated pre-release identifiers (numeric identifiers are allowed).
88
SPECKIT_SEMVER_REGEX := ^[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9]+(\.[A-Za-z0-9]+)*)?$$
99
SPECKIT_VERSION_CLEAN := $(strip $(SPECKIT_VERSION))
10+
SPECKIT_VERSION_VALID := $(if $(SPECKIT_VERSION_CLEAN),$(shell echo "$(SPECKIT_VERSION_CLEAN)" | grep -E '$(SPECKIT_SEMVER_REGEX)' >/dev/null && echo valid),valid)
1011

1112
ifneq ($(SPECKIT_VERSION_CLEAN),)
1213
# Require a semver-like value; optional suffix is dot-separated alphanumeric identifiers.
1314
ifneq ($(findstring ..,$(SPECKIT_VERSION_CLEAN)),)
1415
$(error SPECKIT_VERSION cannot contain consecutive dots)
1516
endif
16-
ifneq ($(shell echo "$(SPECKIT_VERSION_CLEAN)" | grep -E '$(SPECKIT_SEMVER_REGEX)' >/dev/null && echo valid),valid)
17+
ifneq ($(SPECKIT_VERSION_VALID),valid)
1718
$(error SPECKIT_VERSION must be semver-like (e.g., 0.2.0 or 1.2.3-rc.1; suffix is dot-separated alphanumeric identifiers))
1819
endif
1920
SPECKIT_SPEC := speckit==$(SPECKIT_VERSION_CLEAN)

0 commit comments

Comments
 (0)