OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated commits / 85082e1

tools/sync.sh + README — automate next-OTA refresh
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
85082e1d4bc5751ca7f117e71f4c69573e7b7528
by fleeky <fleeky@tabertron> · 2026-05-14T21:23:36.000Z

Changed files (2) +189 -0

README.md +51 -0
……@@ -0,0 +1,51 @@
1# keet-deobfuscated
2
3Tracked snapshots of the Keet AppImage's `@holepunchto/*` ecosystem,
4prettified for diffability. Each Keet OTA release lands as a commit
5+ tag; `git log` is the changelog.
6
7## Layout
8
9```
10@holepunchto/ prettified source of every shipped @holepunchto/* package
11keet-identity-key/ same, but it's not under the @holepunchto/ namespace
12MANIFEST.md package → version table for the tagged version
13tools/sync.sh refresh from the currently-running Keet AppImage
14```
15
16## Refresh after a Keet OTA
17
18With Keet running (it auto-updates via `pear-runtime`):
19
20```bash
21tools/sync.sh
22```
23
24Auto-detects the AppImage mount path from `pgrep`, reads the version
25from the app's `package.json`, runs the audit (`../keet-cli/tools/keet-audit.cjs`),
26replaces the tracked tree with the new `pretty/` snapshot, commits,
27and tags `vX.Y.Z`.
28
29To diff an OTA:
30
31```bash
32git diff v4.14.1 v4.15.0
33git diff v4.14.1 v4.15.0 -- @holepunchto/keet-core/schema/versions.js
34git log --stat v4.14.1..v4.15.0
35```
36
37## Origins
38
39Started from the 4.14.1 frozen snapshot at
40`../keet-audit-4.x/pretty/` (captured 2026-05-11). The 4.15.0 snapshot
41was the first tracked OTA.
42
43The underlying audit tool lives at `../keet-cli/tools/keet-audit.cjs`
44— it produces a frozen `raw/` (verbatim copy) and a `pretty/`
45(prettier-formatted, diffable) tree. This repo tracks the `pretty/`
46tree only; `raw/` is left in the per-version `keet-audit-<v>/` dirs
47for reference.
48
49This is not a fork of Keet and not source for redistribution. It's a
50read-only audit mirror for understanding Keet's protocol surface as
51new versions ship.
tools/sync.sh +138 -0
……@@ -0,0 +1,138 @@
1#!/usr/bin/env bash
2# Sync the currently-running Keet AppImage into this repo as a new commit.
3#
4# Default: auto-detects the running Keet's AppImage mount, infers version
5# from its package.json, runs the audit, replaces the tracked tree with
6# the new pretty/ snapshot, and commits + tags.
7#
8# Usage:
9# tools/sync.sh # auto-detect everything
10# tools/sync.sh --src <mount> # explicit mount path
11# tools/sync.sh --version <v> # override version tag
12# tools/sync.sh --no-tag # commit but don't tag
13# tools/sync.sh --dry-run # show what would happen, no writes
14#
15# Pre-reqs: a running Keet AppImage so we can find its mount, OR pass --src.
16
17set -euo pipefail
18
19REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
20AUDIT_TOOL="$REPO_ROOT/../keet-cli/tools/keet-audit.cjs"
21
22SRC=""
23VERSION=""
24TAG=1
25DRY_RUN=0
26
27while [ $# -gt 0 ]; do
28 case "$1" in
29 --src) SRC="$2"; shift 2 ;;
30 --version) VERSION="$2"; shift 2 ;;
31 --no-tag) TAG=0; shift ;;
32 --dry-run) DRY_RUN=1; shift ;;
33 -h|--help) sed -n '2,15p' "$0"; exit 0 ;;
34 *) echo "unknown arg: $1" >&2; exit 1 ;;
35 esac
36done
37
38# Auto-detect mount from running Keet if --src not given
39if [ -z "$SRC" ]; then
40 SRC=$(pgrep -af '/tmp/\.mount_Keet\..*/Keet' \
41 | grep -oE '/tmp/\.mount_Keet\.[^ /]+' \
42 | head -1)
43 if [ -z "$SRC" ]; then
44 echo "no running Keet AppImage found; pass --src <mount>" >&2
45 exit 1
46 fi
47 SRC="$SRC/resources/app/node_modules"
48fi
49
50if [ ! -d "$SRC/@holepunchto" ]; then
51 echo "src does not look like a Keet node_modules dir: $SRC" >&2
52 exit 1
53fi
54
55# Read version from app's own package.json
56PKG_JSON="$(dirname "$SRC")/package.json"
57if [ -z "$VERSION" ]; then
58 VERSION=$(grep -oE '"version"[[:space:]]*:[[:space:]]*"[^"]+"' "$PKG_JSON" \
59 | head -1 | grep -oE '"[^"]+"$' | tr -d '"')
60 [ -z "$VERSION" ] && { echo "could not infer version from $PKG_JSON" >&2; exit 1; }
61fi
62
63AUDIT_OUT="$REPO_ROOT/../keet-audit-$VERSION"
64
65echo "src: $SRC"
66echo "version: $VERSION"
67echo "audit out: $AUDIT_OUT"
68echo "tag: $([ $TAG -eq 1 ] && echo "v$VERSION" || echo "(skipped)")"
69echo "dry-run: $([ $DRY_RUN -eq 1 ] && echo yes || echo no)"
70echo
71
72# Refuse if tag already exists
73if [ $TAG -eq 1 ] && git -C "$REPO_ROOT" rev-parse "v$VERSION" >/dev/null 2>&1; then
74 echo "tag v$VERSION already exists in this repo — nothing to do." >&2
75 exit 0
76fi
77
78# Refuse if working tree dirty
79if [ -n "$(git -C "$REPO_ROOT" status --porcelain)" ]; then
80 echo "working tree is dirty; commit or stash first" >&2
81 exit 1
82fi
83
84if [ $DRY_RUN -eq 1 ]; then
85 echo "(dry-run) would run: node $AUDIT_TOOL --src $SRC --out $AUDIT_OUT"
86 echo "(dry-run) would replace tracked tree from $AUDIT_OUT/pretty/"
87 echo "(dry-run) would commit + tag v$VERSION"
88 exit 0
89fi
90
91# 1. Run audit (idempotent — overwrites OUT)
92if [ -d "$AUDIT_OUT" ]; then
93 echo "[1/4] audit dir already exists, reusing: $AUDIT_OUT"
94else
95 echo "[1/4] running audit…"
96 node "$AUDIT_TOOL" --src "$SRC" --out "$AUDIT_OUT" >/dev/null
97fi
98
99# 2. Wipe tracked content (keep .git, keep tools/, keep README files at root)
100echo "[2/4] wiping tracked tree…"
101cd "$REPO_ROOT"
102git ls-files -z \
103 | grep -zvE '^(tools/|README\.md$|\.gitignore$)' \
104 | xargs -0 -r rm -f
105find . -type d -empty -not -path './.git*' -not -path './tools*' -delete
106
107# 3. Copy fresh snapshot in
108echo "[3/4] copying $VERSION snapshot…"
109cp -a "$AUDIT_OUT/pretty/." ./
110cp "$AUDIT_OUT/MANIFEST.md" ./MANIFEST.md
111
112# 4. Commit + tag
113echo "[4/4] committing…"
114git add -A
115if git diff --cached --quiet; then
116 echo "no changes vs prior commit — nothing to do."
117 exit 0
118fi
119
120PREV_TAG=$(git tag --sort=-v:refname | head -1)
121git commit -q -m "keet $VERSION — OTA update from ${PREV_TAG:-initial}
122
123Captured: $(date -u +%Y-%m-%dT%H:%M:%SZ)
124Source: $SRC
125
126Run \`git diff $PREV_TAG v$VERSION\` for the full changelog.
127
128Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>"
129
130if [ $TAG -eq 1 ]; then
131 git tag "v$VERSION"
132fi
133
134echo
135echo "done. summary:"
136git log --oneline -3
137echo
138git diff --shortstat "${PREV_TAG:-$(git rev-list --max-parents=0 HEAD)}" HEAD