Files
worldwideview/scripts/web-setup.sh
SilvertakanaandClaude 7cc3529ce3 Fix UTF-8 corruption in OSM search & add web setup script (#218)
* fix: decode Overpass response as UTF-8 to preserve Cyrillic names

Collect raw Buffer chunks from the OSM search proxy stream and decode the
full body as UTF-8 once, instead of concatenating Buffers into a string
per-chunk. The previous `data += chunk` pattern decoded each chunk
independently, corrupting any multi-byte UTF-8 character (Cyrillic place
names in Kazakhstan, Russia, Mongolia, etc.) that straddled a chunk
boundary on large Overpass responses.

https://claude.ai/code/session_01J9986diBmJ6oCu6dD5A8m9

* chore: add self-locating pnpm setup script for web sessions

Add scripts/web-setup.sh for Claude Code on the web (and fresh CI clones).
It resolves the repo root from its own location, activates the pinned pnpm
via corepack, runs pnpm install, and generates the Prisma client — fixing
the 'npm error path /home/user/package.json' setup failure caused by running
npm from the wrong directory in this pnpm monorepo. Point the environment's
setup script at: bash scripts/web-setup.sh

https://claude.ai/code/session_01J9986diBmJ6oCu6dD5A8m9

---------

Co-authored-by: Claude <[email protected]>
2026-06-03 13:02:47 +12:00

42 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Setup script for Claude Code on the web (and any fresh CI/container clone).
#
# Point your remote environment's "setup script" at this file, e.g.:
# bash scripts/web-setup.sh
#
# It is idempotent and safe to re-run. It resolves the repo root from its own
# location, so it works no matter which directory the environment invokes it
# from — fixing the `npm error path /home/user/package.json` failure caused by
# running a package manager from the wrong working directory.
set -euo pipefail
# Resolve the repo root relative to this script, not the caller's CWD.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$REPO_ROOT"
echo "[web-setup] Repo root: $REPO_ROOT"
# This is a pnpm monorepo (see pnpm-workspace.yaml). Never use npm/npm ci here.
# Corepack ships with Node 20+; activate the pinned pnpm from package.json's
# `packageManager` field if pnpm isn't already on PATH.
if ! command -v pnpm >/dev/null 2>&1; then
echo "[web-setup] pnpm not found on PATH; enabling via corepack"
corepack enable
corepack prepare [email protected] --activate
fi
echo "[web-setup] Using pnpm $(pnpm -v) / node $(node -v)"
# Install workspace dependencies. Use `install` (not `--frozen-lockfile`) so the
# container's dependency cache is reused across sessions for faster startup.
pnpm install
# Generate the Prisma client so TypeScript, ESLint and Vitest can resolve
# @prisma/client types. `prisma generate` reads prisma/schema.prisma only and
# does NOT require a live database connection.
pnpm exec prisma generate
echo "[web-setup] Setup complete — dependencies installed and Prisma client generated."