فهرست منبع

Fix local CLI install to rebuild cleanly (#8653)

* Fix local CLI install to rebuild cleanly

* fix(install): copy package.json for standalone startup

Ensure the extension package.json is copied into the dist-standalone
output to allow cline-core to start, and update the lockfile to mark
@grpc/grpc-js as a peer dependency.
Robin Newhouse 4 روز پیش
والد
کامیت
8813f8252c
2فایلهای تغییر یافته به همراه21 افزوده شده و 4 حذف شده
  1. 20 4
      scripts/install-local.sh
  2. 1 0
      standalone/runtime-files/package-lock.json

+ 20 - 4
scripts/install-local.sh

@@ -22,19 +22,34 @@ echo ""
 # Always rebuild CLI to ensure latest changes
 echo -e "${CYAN}→${NC} ${DIM}Rebuilding CLI binaries...${NC}"
 cd "$PROJECT_ROOT"
-if npm run compile-cli 2>&1 | grep -E "(built|error|Error)" || true; then
+rm -rf "$PROJECT_ROOT/cli/bin"
+if command -v go >/dev/null 2>&1; then
+    GO_BIN_DIR="$(go env GOPATH 2>/dev/null)/bin"
+    if [ -d "$GO_BIN_DIR" ]; then
+        export PATH="$GO_BIN_DIR:$PATH"
+    fi
+fi
+if npm run compile-cli; then
     echo -e "${GREEN}✓${NC} CLI binaries rebuilt"
 else
-    echo -e "${YELLOW}⚠${NC}  CLI build may have issues - check output above"
+    echo -e "${YELLOW}⚠${NC}  CLI build failed - aborting install"
+    exit 1
 fi
 
 # Always rebuild standalone to ensure latest cline-core.js
 echo -e "${CYAN}→${NC} ${DIM}Rebuilding standalone package (this may take ~30 seconds)...${NC}"
-if npm run compile-standalone 2>&1 | tail -5; then
+rm -rf "$PROJECT_ROOT/dist-standalone"
+if npm run compile-standalone; then
     echo -e "${GREEN}✓${NC} Standalone package rebuilt"
 else
-    echo -e "${YELLOW}⚠${NC}  Standalone build may have issues - check output above"
+    echo -e "${YELLOW}⚠${NC}  Standalone build failed - aborting install"
+    exit 1
 fi
+
+# Ensure extension package.json is present for cline-core startup
+mkdir -p "$PROJECT_ROOT/dist-standalone/extension"
+cp "$PROJECT_ROOT/package.json" "$PROJECT_ROOT/dist-standalone/extension/package.json"
+
 echo ""
 
 echo -e "${CYAN}→${NC} ${DIM}Installing to $INSTALL_DIR${NC}"
@@ -57,6 +72,7 @@ rsync -a --exclude='bin' "$PROJECT_ROOT/dist-standalone/" "$INSTALL_DIR/"
 echo -e "${CYAN}→${NC} ${DIM}Installing runtime dependencies...${NC}"
 cd "$PROJECT_ROOT/standalone/runtime-files"
 npm install --silent 2>/dev/null || npm install
+rm -rf "$INSTALL_DIR/node_modules"
 cp -r node_modules "$INSTALL_DIR/"
 cp -r vscode "$INSTALL_DIR/node_modules/"
 cd "$PROJECT_ROOT"

+ 1 - 0
standalone/runtime-files/package-lock.json

@@ -21,6 +21,7 @@
 			"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.13.3.tgz",
 			"integrity": "sha512-FTXHdOoPbZrBjlVLHuKbDZnsTxXv2BlHF57xw6LuThXacXvtkahEPED0CKMk6obZDf65Hv4k3z62eyPNpvinIg==",
 			"license": "Apache-2.0",
+			"peer": true,
 			"dependencies": {
 				"@grpc/proto-loader": "^0.7.13",
 				"@js-sdsl/ordered-map": "^4.4.2"