sequant 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sequant",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Quantize your development workflow - Sequential AI phases with quality gates",
5
5
  "type": "module",
6
6
  "bin": {
@@ -162,8 +162,46 @@ fi
162
162
 
163
163
  # Install dependencies if needed
164
164
  if [ ! -d "node_modules" ]; then
165
- echo -e "${BLUE}📦 Installing dependencies...${NC}"
166
- npm install --silent
165
+ # Check for npm install cache optimization (opt-in via SEQUANT_NPM_CACHE=true)
166
+ if [ "${SEQUANT_NPM_CACHE:-false}" = "true" ]; then
167
+ CACHE_DIR="../worktrees/.npm-cache"
168
+ HASH_FILE="${CACHE_DIR}/.package-lock-hash"
169
+
170
+ # Calculate current package-lock hash (cross-platform)
171
+ if command -v md5sum &> /dev/null; then
172
+ CURRENT_HASH=$(md5sum "${MAIN_REPO_DIR}/package-lock.json" | cut -d' ' -f1)
173
+ elif command -v md5 &> /dev/null; then
174
+ CURRENT_HASH=$(md5 -q "${MAIN_REPO_DIR}/package-lock.json")
175
+ else
176
+ CURRENT_HASH=""
177
+ fi
178
+
179
+ # Check if cache is valid
180
+ if [ -n "$CURRENT_HASH" ] && [ -f "$HASH_FILE" ] && [ -d "${MAIN_REPO_DIR}/node_modules" ]; then
181
+ CACHED_HASH=$(cat "$HASH_FILE" 2>/dev/null || echo "")
182
+ if [ "$CURRENT_HASH" = "$CACHED_HASH" ]; then
183
+ echo -e "${GREEN}⚡ Using cached node_modules (package-lock unchanged)${NC}"
184
+ cp -r "${MAIN_REPO_DIR}/node_modules" ./node_modules
185
+ else
186
+ echo -e "${BLUE}📦 Installing dependencies (package-lock changed)...${NC}"
187
+ npm install --silent
188
+ # Update cache hash
189
+ mkdir -p "$CACHE_DIR"
190
+ echo "$CURRENT_HASH" > "$HASH_FILE"
191
+ fi
192
+ else
193
+ echo -e "${BLUE}📦 Installing dependencies (initializing cache)...${NC}"
194
+ npm install --silent
195
+ # Initialize cache hash
196
+ if [ -n "$CURRENT_HASH" ]; then
197
+ mkdir -p "$CACHE_DIR"
198
+ echo "$CURRENT_HASH" > "$HASH_FILE"
199
+ fi
200
+ fi
201
+ else
202
+ echo -e "${BLUE}📦 Installing dependencies...${NC}"
203
+ npm install --silent
204
+ fi
167
205
  fi
168
206
 
169
207
  echo ""