Ran authenticated extract against coulomb.social; session metadata matched anonymous Bubble defaults, so treat docs/design-extract as a public shell baseline (PROVENANCE.md). Capture script now refuses to overwrite storage-state.json with thin anonymous sessions.
42 lines
1.5 KiB
Bash
Executable file
42 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Run designlang against coulomb.social using a captured Playwright storageState.
|
|
# Does not print secrets. Requires: ./scripts/capture-auth-state.mjs first.
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
AUTH_DIR="${COULOMB_SOCIAL_AUTH_DIR:-$HOME/.config/coulomb-social/auth}"
|
|
STATE_PATH="${COULOMB_SOCIAL_STORAGE_STATE:-$AUTH_DIR/storage-state.json}"
|
|
OUT_DIR="${COULOMB_SOCIAL_EXTRACT_OUT:-$ROOT/docs/design-extract}"
|
|
URL="${COULOMB_SOCIAL_URL:-https://coulomb.social}"
|
|
|
|
if [[ ! -f "$STATE_PATH" ]]; then
|
|
echo "ERROR: No auth session at $STATE_PATH" >&2
|
|
echo "Capture one first (interactive login as your user):" >&2
|
|
echo " $ROOT/scripts/capture-auth-state.sh" >&2
|
|
echo "Docs: $ROOT/docs/design-extract-auth.md" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mode="$(stat -c '%a' "$STATE_PATH" 2>/dev/null || stat -f '%Lp' "$STATE_PATH" 2>/dev/null || echo '?')"
|
|
if [[ "$mode" != "600" && "$mode" != "0600" ]]; then
|
|
echo "warning: $STATE_PATH mode is $mode (prefer 600)" >&2
|
|
fi
|
|
|
|
mkdir -p "$OUT_DIR"
|
|
|
|
echo "==> designlang extract"
|
|
echo " url: $URL"
|
|
echo " auth: $STATE_PATH (session file present; not printed)"
|
|
echo " out: $OUT_DIR"
|
|
echo " extra: $*"
|
|
|
|
# Global flags (auth, name) must precede the subcommand; pack only accepts -o/--with-clone/--open.
|
|
# --cookie-file accepts Playwright storageState JSON.
|
|
# Extra args after -- are appended to pack (e.g. --with-clone).
|
|
mkdir -p "$(dirname "$OUT_DIR")"
|
|
exec npx --yes designlang \
|
|
--cookie-file "$STATE_PATH" \
|
|
--name coulomb-social \
|
|
pack "$URL" \
|
|
-o "$OUT_DIR" \
|
|
"$@"
|