Skip to content

feat: --reset-conf flag (build.sh) + --gen-conf --force (init.sh) (closes #124)#129

Merged
ycpss91255 merged 1 commit into
mainfrom
feat/reset-conf-flag
Apr 24, 2026
Merged

feat: --reset-conf flag (build.sh) + --gen-conf --force (init.sh) (closes #124)#129
ycpss91255 merged 1 commit into
mainfrom
feat/reset-conf-flag

Conversation

@ycpss91255
Copy link
Copy Markdown
Contributor

Summary

Closes #124. One-step path to restore the template's default setup.conf without the rm setup.conf && init.sh --gen-conf dance.

Changes

init.sh backend

_gen_setup_conf gains a force argument. Default behavior unchanged — refuses to overwrite. With --force, backs up the current setup.confsetup.conf.bak and .env.env.bak before overwriting. First-time provisioning (no pre-existing conf) skips the backup step.

build.sh frontend

./build.sh --reset-conf          # prompts y/N
./build.sh --reset-conf --yes    # no prompt
./build.sh --reset-conf --dry-run # prints init.sh call, no side effects

Delegates to ./template/init.sh --gen-conf --force and flips RUN_SETUP=true so setup.sh regenerates .env + compose.yaml from the fresh conf in the same invocation.

.gitignore (new-repo template)

Adds .env.bak and setup.conf.bak so reset backups stay local.

Usage help

English + zh-TW + zh-CN + ja — all document --reset-conf, -y, and the backup behavior.

Scope not in this PR

  • run.sh / setup.sh frontends for --reset-conf — lower priority since the build.sh entry point covers the common workflow. Can follow up later if demand surfaces.

Tests (+8 → 685 total)

init_spec.bats:

  • _gen_setup_conf default refuses to overwrite existing setup.conf
  • _gen_setup_conf --force overwrites and backs up existing setup.conf
  • _gen_setup_conf --force also backs up .env to .env.bak
  • _gen_setup_conf --force on clean repo does not create spurious .bak
  • _create_new_repo: .gitignore includes setup.conf.bak and .env.bak

build_sh_spec.bats:

  • build.sh --reset-conf --yes --dry-run prints init.sh --gen-conf --force cmd
  • build.sh --reset-conf is mentioned in usage help
  • build.sh --reset-conf with no existing setup.conf / .env skips prompt

Test plan

  • make -f Makefile.ci test local — 685/685 pass
  • CI template self-test green
  • Manual: cd app/ros1_bridge && ./build.sh --reset-conf --yes resets conf + runs setup.sh, producing fresh .env + compose.yaml; old conf lands at setup.conf.bak.

Closes #124. Adds a one-step path to restore the template's default
setup.conf without the current `rm setup.conf && init.sh --gen-conf`
dance, and wires backups so the reset is recoverable.

init.sh — new backend
  `_gen_setup_conf` gains a force argument. Default behavior
  unchanged: refuse to overwrite an existing setup.conf. With
  --force, back up the current setup.conf → setup.conf.bak and
  (if present) .env → .env.bak, then overwrite from
  template/setup.conf. First-time provisioning (no pre-existing
  setup.conf) takes the fast path and does not create spurious
  .bak files.

build.sh — new frontend
  --reset-conf flag prompts for confirmation (y/N), skippable with
  -y/--yes. Delegates to `./template/init.sh --gen-conf --force`
  and sets RUN_SETUP=true so the subsequent setup.sh pass
  regenerates .env + compose.yaml from the fresh conf. In
  --dry-run mode the init.sh call is printed instead of executed
  and the prompt is skipped (CI-safe).

.gitignore — new-repo template
  `.env.bak` and `setup.conf.bak` added so the reset backups stay
  local and never get committed.

Usage help (4 languages) documents --reset-conf, -y, and the
backup behavior.

Tests (+8): init_spec.bats exercises all four _gen_setup_conf
paths (refuse / force overwrite with backup / also backs up .env /
clean repo doesn't produce spurious .bak) plus a .gitignore
entry check; build_sh_spec.bats covers the frontend (dry-run
prints init.sh call / usage mentions --reset-conf / no prompt when
nothing to overwrite). 677 → 685.
@ycpss91255 ycpss91255 merged commit 92fa83c into main Apr 24, 2026
3 checks passed
@ycpss91255 ycpss91255 deleted the feat/reset-conf-flag branch April 24, 2026 11:32
@ycpss91255 ycpss91255 mentioned this pull request Apr 24, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: --reset-conf flag to restore setup.conf defaults in one step

1 participant