@@ -28,6 +28,17 @@ usage() {
2828 exit 1
2929}
3030
31+ if [ " ${1:- } " = " --list-integrations" ] && [ " $# " -eq 1 ]; then
32+ printf " %s\n" " ${VALID_INTEGRATIONS[@]} "
33+ exit 0
34+ fi
35+
36+ VALIDATE_ONLY=false
37+ if [ " ${1:- } " = " --validate-only" ]; then
38+ VALIDATE_ONLY=true
39+ shift
40+ fi
41+
3142if [ -z " $1 " ] || [ -z " $2 " ]; then
3243 usage
3344fi
@@ -77,6 +88,23 @@ bump_version() {
7788 esac
7889}
7990
91+ validate_manifest_version_field () {
92+ local manifest=$1
93+ local matches
94+ if [[ " $manifest " == * /pyproject.toml ]]; then
95+ matches=$( grep -Ec ' ^version = "[^"]+"$' " $manifest " || true)
96+ elif [[ " $manifest " == * /package.json ]] || [[ " $manifest " == * /plugin.json ]] || [[ " $manifest " == * /settings.json ]]; then
97+ matches=$( grep -Ec ' "version": "[^"]+"' " $manifest " || true)
98+ else
99+ matches=0
100+ fi
101+
102+ if [ " $matches " -ne 1 ]; then
103+ print_error " Expected exactly one release version field in $manifest , found $matches "
104+ exit 1
105+ fi
106+ }
107+
80108# Resolve version: either an explicit semver or a bump keyword
81109if [[ " $VERSION_ARG " =~ ^(patch| minor| major)$ ]]; then
82110 CURRENT_VERSION=$( get_current_version)
95123
96124TAG=" integrations/$INTEGRATION /v$VERSION "
97125
126+ INTEGRATION_DIR=" hindsight-integrations/$INTEGRATION "
127+
128+ if [ ! -d " $INTEGRATION_DIR " ]; then
129+ print_error " Integration directory not found: $INTEGRATION_DIR "
130+ exit 1
131+ fi
132+
133+ if [ -f " $INTEGRATION_DIR /pyproject.toml" ]; then
134+ MANIFEST_PATH=" $INTEGRATION_DIR /pyproject.toml"
135+ elif [ -f " $INTEGRATION_DIR /package.json" ]; then
136+ MANIFEST_PATH=" $INTEGRATION_DIR /package.json"
137+ elif [ -f " $INTEGRATION_DIR /.claude-plugin/plugin.json" ]; then
138+ MANIFEST_PATH=" $INTEGRATION_DIR /.claude-plugin/plugin.json"
139+ elif [ -f " $INTEGRATION_DIR /settings.json" ] && grep -q ' "version"' " $INTEGRATION_DIR /settings.json" ; then
140+ MANIFEST_PATH=" $INTEGRATION_DIR /settings.json"
141+ else
142+ print_error " No pyproject.toml, package.json, plugin.json, or versioned settings.json found in $INTEGRATION_DIR "
143+ exit 1
144+ fi
145+
146+ validate_manifest_version_field " $MANIFEST_PATH "
147+
148+ if [ " $VALIDATE_ONLY " = true ]; then
149+ print_info " Validated $INTEGRATION release path via $MANIFEST_PATH "
150+ exit 0
151+ fi
152+
98153print_info " Releasing $INTEGRATION v$VERSION (tag: $TAG )"
99154
100155# Check if we're on main branch
@@ -135,14 +190,6 @@ if [ -z "$OPENAI_API_KEY" ]; then
135190 exit 1
136191fi
137192
138- # Determine integration type and update version
139- INTEGRATION_DIR=" hindsight-integrations/$INTEGRATION "
140-
141- if [ ! -d " $INTEGRATION_DIR " ]; then
142- print_error " Integration directory not found: $INTEGRATION_DIR "
143- exit 1
144- fi
145-
146193if [ -f " $INTEGRATION_DIR /pyproject.toml" ]; then
147194 print_info " Updating version in $INTEGRATION_DIR /pyproject.toml"
148195 sed -i.bak " s/^version = \" .*\" /version = \" $VERSION \" /" " $INTEGRATION_DIR /pyproject.toml"
@@ -159,9 +206,6 @@ elif [ -f "$INTEGRATION_DIR/settings.json" ] && grep -q '"version"' "$INTEGRATIO
159206 print_info " Updating version in $INTEGRATION_DIR /settings.json"
160207 sed -i.bak " s/\" version\" : \" .*\" /\" version\" : \" $VERSION \" /" " $INTEGRATION_DIR /settings.json"
161208 rm " $INTEGRATION_DIR /settings.json.bak"
162- else
163- print_error " No pyproject.toml, package.json, plugin.json, or versioned settings.json found in $INTEGRATION_DIR "
164- exit 1
165209fi
166210
167211# Generate changelog entry using LLM
0 commit comments