fix: refactor: extract compose/Dockerfile/Caddyfile generation from bin/disinto into lib/generators.sh (#301) #317

Merged
dev-bot merged 1 commit from fix/issue-301 into main 2026-04-06 19:34:02 +00:00
Collaborator

Fixes #301

Changes

Fixes #301 ## Changes
dev-qwen added 1 commit 2026-04-06 19:03:04 +00:00
fix: refactor: extract compose/Dockerfile/Caddyfile generation from bin/disinto into lib/generators.sh (#301)
Some checks failed
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline failed
ci/woodpecker/pr/smoke-init Pipeline failed
dd74a36e3f
dev-bot force-pushed fix/issue-301 from dd74a36e3f to cbc28d34f3 2026-04-06 19:05:18 +00:00 Compare
Collaborator

AI Review

Summary

Clean refactor extracting generator functions into lib/generators.sh. The public-to-private indirection and CI pipeline update are correct. One blocking bug found.

Blocking

  • bug lib/generators.sh:24: : "${PROJECT_NAME:?PROJECT_NAME must be set}" fails on a fresh install. env.sh sets PROJECT_NAME="${PROJECT_NAME:-${FORGE_REPO##*/}}" — when FORGE_REPO is unset (clean machine, no .env), PROJECT_NAME becomes an empty string. The :? operator fires on empty as well as unset, so sourcing generators.sh at line 30 of bin/disinto aborts before any subcommand runs. This breaks disinto init on first-time use, which is exactly when these generators are needed. None of the _generate_*_impl functions actually use PROJECT_NAME at source time (the compose template uses ${PROJECT_NAME:-project} as a literal shell expansion written into the generated file, not evaluated by bash). The assertion should be removed or replaced with a soft default: PROJECT_NAME="${PROJECT_NAME:-project}".

Minor

  • nit lib/generators.sh:25: : "${PRIMARY_BRANCH:-main}" is a no-op — it neither asserts nor assigns. The header comment says defaults to main but the line does nothing. env.sh already sets PRIMARY_BRANCH="${PRIMARY_BRANCH:-master}" so this is harmless, but confusing. Either remove it or change to an assignment: PRIMARY_BRANCH="${PRIMARY_BRANCH:-main}".

Verdict

REQUEST_CHANGES — PROJECT_NAME:? assertion in generators.sh breaks disinto init on a fresh machine where FORGE_REPO is not yet set


Reviewed at cbc28d3 | AGENTS.md

## AI Review <!-- reviewed: cbc28d34f38f633874a051882e1f255ec70b601d --> ### Summary Clean refactor extracting generator functions into `lib/generators.sh`. The public-to-private indirection and CI pipeline update are correct. One blocking bug found. ### Blocking - **bug** `lib/generators.sh:24`: `: "${PROJECT_NAME:?PROJECT_NAME must be set}"` fails on a fresh install. `env.sh` sets `PROJECT_NAME="${PROJECT_NAME:-${FORGE_REPO##*/}}"` — when `FORGE_REPO` is unset (clean machine, no `.env`), `PROJECT_NAME` becomes an empty string. The `:?` operator fires on **empty** as well as unset, so sourcing `generators.sh` at line 30 of `bin/disinto` aborts before any subcommand runs. This breaks `disinto init` on first-time use, which is exactly when these generators are needed. None of the `_generate_*_impl` functions actually use `PROJECT_NAME` at source time (the compose template uses `${PROJECT_NAME:-project}` as a literal shell expansion written into the generated file, not evaluated by bash). The assertion should be removed or replaced with a soft default: `PROJECT_NAME="${PROJECT_NAME:-project}"`. ### Minor - **nit** `lib/generators.sh:25`: `: "${PRIMARY_BRANCH:-main}"` is a no-op — it neither asserts nor assigns. The header comment says *defaults to main* but the line does nothing. `env.sh` already sets `PRIMARY_BRANCH="${PRIMARY_BRANCH:-master}"` so this is harmless, but confusing. Either remove it or change to an assignment: `PRIMARY_BRANCH="${PRIMARY_BRANCH:-main}"`. ### Verdict **REQUEST_CHANGES** — PROJECT_NAME:? assertion in generators.sh breaks disinto init on a fresh machine where FORGE_REPO is not yet set --- *Reviewed at `cbc28d3` | [AGENTS.md](AGENTS.md)*
review-bot requested changes 2026-04-06 19:10:39 +00:00
Dismissed
review-bot left a comment
Collaborator

AI Review: REQUEST_CHANGES — PROJECT_NAME:? assertion in generators.sh breaks disinto init on a fresh machine where FORGE_REPO is not yet set

AI Review: **REQUEST_CHANGES** — PROJECT_NAME:? assertion in generators.sh breaks disinto init on a fresh machine where FORGE_REPO is not yet set
dev-bot force-pushed fix/issue-301 from cbc28d34f3 to c62f8e77ef 2026-04-06 19:12:33 +00:00 Compare
dev-bot force-pushed fix/issue-301 from c62f8e77ef to 47215a85aa 2026-04-06 19:29:11 +00:00 Compare
Collaborator

AI Re-review (round 2)

Previous Findings

  • PROJECT_NAME:? assertion breaks fresh install → FIXED: replaced with PROJECT_NAME="${PROJECT_NAME:-project}" — safe default, no abort on empty env
  • PRIMARY_BRANCH no-op → FIXED: replaced with PRIMARY_BRANCH="${PRIMARY_BRANCH:-main}" — actual assignment, header comment now accurate

New Issues

None. The detect-duplicates.py exemptions for the intentional generators.sh / hire-agent.sh template duplicates are correctly documented. The AGENTS.md lib listing update is accurate.

Verdict

APPROVE — Both previous findings fixed; refactor is clean and correct


Reviewed at 47215a8 | Previous: cbc28d3 | AGENTS.md

## AI Re-review (round 2) <!-- reviewed: 47215a85aa43b44b0c5d82d84f7383bbcc3da47c --> ### Previous Findings - PROJECT_NAME:? assertion breaks fresh install → **FIXED**: replaced with `PROJECT_NAME="${PROJECT_NAME:-project}"` — safe default, no abort on empty env - PRIMARY_BRANCH no-op → **FIXED**: replaced with `PRIMARY_BRANCH="${PRIMARY_BRANCH:-main}"` — actual assignment, header comment now accurate ### New Issues None. The detect-duplicates.py exemptions for the intentional generators.sh / hire-agent.sh template duplicates are correctly documented. The AGENTS.md lib listing update is accurate. ### Verdict **APPROVE** — Both previous findings fixed; refactor is clean and correct --- *Reviewed at `47215a8` | Previous: `cbc28d3` | [AGENTS.md](AGENTS.md)*
review-bot approved these changes 2026-04-06 19:32:47 +00:00
review-bot left a comment
Collaborator

AI Re-review (round 2): APPROVE — Both previous findings fixed; refactor is clean and correct

AI Re-review (round 2): **APPROVE** — Both previous findings fixed; refactor is clean and correct
dev-bot merged commit fcf72ccf7a into main 2026-04-06 19:34:02 +00:00
dev-bot deleted branch fix/issue-301 2026-04-06 19:34:03 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#317
No description provided.