Compare commits

..

3 commits

Author SHA1 Message Date
25353f548d fix(dev-env): confirm before force-deleting an unmerged PR branch
git-pr-cleanup (prc) tried `branch -d` then fell back to `branch -D`
unconditionally, silently destroying an unmerged branch when prc was
run before the PR merged or against the wrong branch. Keep the safe
`-d` for the normal post-merge path, but prompt before forcing so
unmerged commits aren't lost without consent; decline keeps the branch.
2026-06-20 09:52:17 +02:00
cd95974e48 fix(dev-env): count deleted backups in the parent shell, not a subshell
cleanup_backups piped `git branch --list` into `while read`, so the
`deleted` counter incremented inside a pipeline subshell and never
propagated. The closing "Deleted N backup branch(es)" always reported 0,
however many were actually removed. Switch the inner loop to process
substitution (matching the outer find_forked_repos loop) so the count
survives.
2026-06-20 09:51:31 +02:00
11cf5aa0cf docs(claude): drop the deleted dev up CLI from seeded orientation files
The matured dev-env backport removed dev.sh (which provided
`dev up/down/logs/shell`) but the seeded CLAUDE.md files still told
users — and Claude sessions, since these symlink into ~/dev/ — to run
those commands. `dev` is now just a nav function (cd $DEV_ROOT), so
`dev up` silently cd'd and started nothing.

Rewrite both Quick-commands / Default-dev-workflow sections to the real
command set (lb/prb/dev-status/regtest-start/dev-deploy) and document
that FakeWallet startup is manual — there is no `dev up` wrapper.
2026-06-20 09:50:39 +02:00
4 changed files with 49 additions and 13 deletions

View file

@ -26,13 +26,30 @@ PR contract in `upstream-prs/`. See the lnbits-sensei README's
## Quick commands
- `dev up [--fakewallet|--regtest]` — start the lnbits dev server.
Default `--fakewallet` is instant, no docker, good for
extension/UI/API work.
- `dev down` / `dev logs` / `dev shell` — control / inspect.
- *(planned)* `prb <repo> <branch>` — create a PR worktree branched
from `upstream/main` under `~/dev/upstream-prs/`.
- *(planned)* `lb <worktree>` — cd shortcut into `~/dev/lnbits/<worktree>`.
Installed by lnbits-sensei's dev-env module — standalone binaries plus
shell functions sourced into interactive shells:
- `dev-env-bootstrap` — materialize bare repos + worktrees from your
declared `projects` (idempotent; `--dry-run` to preview).
- `lb <worktree>` — cd into `~/dev/lnbits/<worktree>` (e.g. `lb dev`).
`g <category> <repo>`, `ext <name>`, `prs`, `shared`, `repos` cover
the rest of the tree.
- `prb <repo> <branch>` — create a PR worktree branched from
`upstream/main` under `~/dev/upstream-prs/`; `prc` cleans up, `prl`
lists.
- `dev-status` — dirty + ahead/behind across every worktree. `wts` /
`wtu` sync worktrees / fetch upstream; `rebase status` shows which
forks need rebasing onto upstream.
- `regtest-start <worktree>` / `regtest-stop` — Bitcoin/Lightning
regtest stack (only when `devEnv.regtest.enable = true`; needs docker).
- `dev-deploy <host>``nixos-rebuild` against your deploy flake.
`dev-tm <session>` — launch a declarative tmux session.
**Starting lnbits for iteration:** there is no `dev up` wrapper.
FakeWallet (`LNBITS_BACKEND_WALLET_CLASS=FakeWallet`) is the default
path — no docker; run lnbits directly from the worktree (`lb dev`, then
lnbits's own run command). Use `regtest-start` only when you need real
channels/payments.
## Reference docs

View file

@ -70,9 +70,19 @@ Full reference: `docs/lnbits-upstream-flow.md`.
## Default dev workflow
There is no `dev up` wrapper. Start lnbits directly from a worktree:
```
dev up # FakeWallet, instant
dev up --regtest # multi-node regtest (slower boot, real channels)
lb dev # cd ~/dev/lnbits/dev
LNBITS_BACKEND_WALLET_CLASS=FakeWallet <lnbits run command> # instant, no docker
```
For real channels/payments, use the regtest stack (gated on
`devEnv.regtest.enable`; needs docker):
```
regtest-start dev # build lnbits from ~/dev/lnbits/dev, bring the stack up
regtest-stop
```
Use **FakeWallet** for extension CRUD / UI / API work. Spin up

View file

@ -113,8 +113,17 @@ git-pr-cleanup() {
git -C "$bare_repo" worktree remove "$pr_path"
echo "Deleting branch: $branch_name"
git -C "$bare_repo" branch -d "$branch_name" 2>/dev/null \
|| git -C "$bare_repo" branch -D "$branch_name"
if ! git -C "$bare_repo" branch -d "$branch_name" 2>/dev/null; then
echo " Branch '$branch_name' is not fully merged."
read -r -p " Force-delete it (unmerged commits will be lost)? [y/N] " -n 1 REPLY
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
git -C "$bare_repo" branch -D "$branch_name"
else
echo " Kept branch '$branch_name' (worktree already removed)."
return 1
fi
fi
echo "Done."
}

View file

@ -311,7 +311,7 @@ cleanup_backups() {
local deleted=0
while IFS=: read -r path _; do
cd "$path" || continue
git branch --list "backup/*" 2>/dev/null | while read -r branch; do
while read -r branch; do
branch="$(echo "$branch" | tr -d ' *')"
local bdate
bdate="$(echo "$branch" | grep -oE '[0-9]{8}' | head -1)"
@ -319,7 +319,7 @@ cleanup_backups() {
|| { [[ -n "$bdate" ]] && [[ "$bdate" < "$cutoff" ]]; }; then
git branch -D "$branch" 2>/dev/null && deleted=$((deleted + 1)) || true
fi
done
done < <(git branch --list "backup/*" 2>/dev/null)
done < <(find_forked_repos)
success "Deleted $deleted backup branch(es)."
}