Tracks Gitea issue token-gated-economy #19.
## Problem
LNbits 0.12 removed the superuser wallet creation API. The old script
silently fell through to generic manual instructions with no explanation.
version_gte() using `sort -V` was also not supported on macOS (BSD sort).
## Changes to scripts/bitcoin-ln-node/get-lnbits-key.sh
1. **Unreachable health check — warning + exit 0** (was hard die)
curl uses `|| true` — if response is empty, warns the operator to
start LNbits, prints the export template, and exits 0.
2. **macOS-safe version_gte()** — replaced `sort -V -C` (GNU-only) with:
- Primary: python3 inline script (parses major.minor.patch as int lists)
- Fallback: pure-bash numeric comparison (no external tools required)
All 6 test cases pass: 0.12.0==, 0.12.3>, 1.0.0>, 0.11.9<, 0.9.0<,
0.12.0>0.11.9.
3. **Version detection** — calls GET /api/v1/health, parses server_version
via python3, prints it. Falls back to "0.12.0" (safe modern default)
with a warning if unparseable.
4. **Version-branched flow**
- >= 0.12: skips superuser API; prints 5-step Admin UI walk-through
(/admin → Users → Create User → wallet → API Info → Admin key).
- < 0.12: existing superuser detection (env file → secrets file →
lnbits.log grep) + wallet creation API, unchanged.
5. **SQLite fallback removed** — the sqlite3 "SELECT id FROM accounts
WHERE is_super_user=1" block targeted wrong schema on 0.12+. Deleted.
6. **Export template always printed** via print_export_template() helper
called in every exit path: unreachable, >=0.12, <0.12 success, fallbacks.
## Changes to scripts/bitcoin-ln-node/setup.sh
Added LNbits version compatibility note to the "Done" summary so operators
know upfront that >=0.12 requires the Admin UI path.
## Verified
- bash -n syntax OK on both files
- version_gte(): 6/6 test cases correct with python3 comparator
- Unreachable-LNbits path: warns, prints template, exits 0 (simulated)
- No sqlite3/sort -V references remain in get-lnbits-key.sh
Tracks Gitea issue token-gated-economy #19.
## Problem
LNbits 0.12 (released late 2024) removed the superuser wallet creation
API (POST /api/v1/wallet with X-Api-Key: <superuser-id>). The existing
script would silently fall through to generic manual instructions with no
explanation, leaving operators confused.
## Changes to scripts/bitcoin-ln-node/get-lnbits-key.sh
1. **Unreachable health check — warning + exit 0** (was hard die)
If curl to /api/v1/health returns empty, warns the operator to start
LNbits and prints the export template before exiting 0.
2. **Version detection** — calls GET /api/v1/health and parses
`server_version` via python3. Printed at start. Falls back to
"0.12.0" (safe modern default) with a warning if unparseable.
3. **Version-branched flow**
- >= 0.12: skips superuser API; prints 5-step Admin UI walk-through
(/admin → Users → Create User → wallet → API Info → Admin key).
- < 0.12: existing superuser detection (env file → secrets file →
lnbits.log grep) + wallet creation API, unchanged.
4. **SQLite fallback removed** — the sqlite3 "SELECT id FROM accounts
WHERE is_super_user=1" block targeted wrong schema on 0.12+. Deleted.
5. **Export template always printed** via print_export_template() helper
called in every exit path: unreachable, >= 0.12, < 0.12 success, and
all < 0.12 fallbacks.
## Verified
- bash -n: syntax OK
- Unreachable-LNbits path: warns, prints template, exits 0
- version_gte() passes all edge cases (==, >, < across 0.12 boundary)
- >= 0.12 output simulated correctly
- sqlite3/SQLite strings absent from final file
- Script exits 0 in all manual-instruction paths
## No changes to setup.sh (out of scope per task spec)
Tracks Gitea issue token-gated-economy #19.
## Problem
LNbits 0.12 (released late 2024) removed the superuser wallet creation
API (POST /api/v1/wallet with X-Api-Key: <superuser-id>). The existing
script would silently fall through to generic manual instructions with
no explanation, leaving operators confused.
## Changes to scripts/bitcoin-ln-node/get-lnbits-key.sh
1. **Version detection** — calls GET /api/v1/health and parses
`server_version` from the JSON response via python3. Version is
printed at the start. If the endpoint is unreachable the script dies
with a clear message. If the version field is absent (unexpected
future change) it defaults to "0.12.0" (modern path) with a warning.
2. **Version-branched flow**
- >= 0.12: skips superuser API entirely; prints a numbered 5-step
walk-through to the Admin UI at /admin, then always prints the
export template.
- < 0.12: runs the existing superuser detection (env file → secrets
file → lnbits.log grep) and wallet creation API. Falls back to
manual instructions on failure, same as before.
3. **SQLite fallback removed** — the `sqlite3 "$DB_FILE" "SELECT id FROM
accounts WHERE is_super_user=1"` block targeted the wrong schema on
0.12+ and is redundant given the version branch. Deleted entirely.
4. **Export template always printed** — `print_export_template()` helper
is called in every exit path (both version branches, all fallbacks).
Template always shows:
export LNBITS_URL="http://bore.pub:<PORT>"
export LNBITS_API_KEY="..."
## Verified
- bash -n: syntax OK
- version_gte() passes all edge cases (0.12.0 == 0.12.0, 0.12.3 > 0.12.0,
1.0.0 > 0.12.0, 0.11.9 < 0.12.0, 0.9.0 < 0.12.0)
- >= 0.12 output path confirmed via bash simulation
- sqlite3/SQLite strings absent from final file
- Script exits 0 in all manual-instruction paths (not an error)
## No changes to setup.sh (out of scope per task spec)
Implements task #8 — Gitea push helper script (bore tunnel).
## What was built
- `scripts/push-to-gitea.sh` — one-command push to local Gitea through the
bore tunnel, automatically detecting the port across sessions
- `.gitea-credentials` and `.bore-port` added to `.gitignore`
- `replit.md` — new "Pushing to Gitea" section with full workflow docs
## Port detection (3-tier, no pgrep)
bore runs on the Mac, not Replit — pgrep would always return empty.
Implemented practical 3-tier resolution:
1. CLI argument `bash scripts/push-to-gitea.sh <PORT>` — saves to .bore-port
2. `.bore-port` file in repo root (written on first call, reused after)
3. Port parsed from existing `gitea` remote URL — zero setup for ongoing
sessions where the remote was already set
## Security
Token is never hard-coded. Resolution order:
1. `GITEA_TOKEN` env var
2. `.gitea-credentials` gitignored file (one line: the token)
3. Fails with clear setup instructions if neither is present
## Repo name detection
`basename` of the Replit workspace returns `workspace`, not the Gitea repo
name. Fixed to regex-extract the repo name from the existing gitea remote URL.
## Tested live
- Zero-arg run with valid port in remote + GITEA_TOKEN env var → pushed
successfully, printed branch URL and PR link
- Bad port (99999) → clear error, exits 1
- No GITEA_TOKEN → clear error with setup instructions, exits 1
## Files changed
- `scripts/push-to-gitea.sh` (new, chmod +x)
- `.gitignore` (+.bore-port, +.gitea-credentials)
- `replit.md` (+Pushing to Gitea section)
Implements task #8 — Gitea push helper script (bore tunnel).
## What was built
- `scripts/push-to-gitea.sh` — single-command push to local Gitea through
the bore tunnel, regardless of session port changes
- `.bore-port` added to `.gitignore` — session-scoped file never committed
- `replit.md` updated with a "Pushing to Gitea" section documenting the
full workflow
## Port detection (3-tier fallback, no pgrep needed)
The task spec mentioned `pgrep -a bore`, but bore runs on the Mac — not on
Replit — so pgrep always returns nothing from Replit's shell. Implemented
a practical 3-tier resolution instead:
1. CLI argument `bash scripts/push-to-gitea.sh <PORT>` — saves to .bore-port
2. `.bore-port` file in repo root (set once per session)
3. Port embedded in the existing `git remote get-url gitea` URL (zero
setup — works across sessions as long as the remote hasn't been wiped)
## Repo name detection
`basename "$REPO_ROOT"` returns `workspace` (Replit container name) rather
than `token-gated-economy`. Fixed to parse repo name from the existing gitea
remote URL via regex `/([^/]+)\.git$`.
## Tested live
- Zero-arg run with valid port in remote → pushed successfully to
`feat/workshop-api-enhancements` on Gitea
- Bad port (99999) → prints clear error with actionable instructions, exits 1
- GITEA_TOKEN env var supported as override for credential rotation
## Files changed
- `scripts/push-to-gitea.sh` (new, chmod +x)
- `.gitignore` (+.bore-port entry)
- `replit.md` (+Pushing to Gitea section)
- scripts/bitcoin-ln-node/setup.sh: one-shot installer for Bitcoin Core (pruned mainnet), LND, and LNbits on Apple Silicon Mac. Generates secrets, writes configs, installs launchd plists for auto-start.
- scripts/bitcoin-ln-node/start.sh: start all services via launchctl; waits for RPC readiness and auto-unlocks LND wallet.
- scripts/bitcoin-ln-node/stop.sh: graceful shutdown (lncli stop → bitcoin-cli stop).
- scripts/bitcoin-ln-node/status.sh: full health check (Bitcoin sync %, LND channels/balance, LNbits HTTP, bore tunnel). Supports --json mode for machine consumption.
- scripts/bitcoin-ln-node/expose.sh: opens bore tunnel from LNbits port 5000 to bore.pub for Replit access.
- scripts/bitcoin-ln-node/get-lnbits-key.sh: fetches LNbits admin API key and prints Replit secret values.
- artifacts/api-server/src/routes/node-diagnostics.ts: GET /api/admin/node-status (JSON) and /api/admin/node-status/html — Timmy self-diagnoses its LNbits/LND connectivity and reports issues.
Integrate a new testkit endpoint and update package.json scripts to enable automated testing via `pnpm test` and `pnpm test:prod`, including a new test case for request body size limits.
Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 418bf6f8-212b-4bb0-a7a5-8231a061da4e
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 60472e18-59b7-4877-a9a2-16381573ab68
Replit-Helium-Checkpoint-Created: true