feat(setup): one-command developer setup via npm run setup#158
Merged
Conversation
Adds an additive setup orchestrator that installs deps, builds the wizard, bootstraps .env, starts backend + frontend, completes the installation wizard headlessly, creates a default admin account, and opens the login page — all from a single command. Non-technical contributors can go from `git clone` to a working login screen with no manual steps. New - scripts/dev.js — orchestrator with HTTP-based wizard auto-completion, MongoDB probe with retry, defensive .env patching, credentials banner. - nodemon.json — explicit watch list (server-side dirs / .js only) so wizard writes to installationSteps.json no longer restart the backend mid-request (root cause of the "wizard reloads on MongoDB step" bug). - package.json — `setup`, `dev`, `setup:reset` scripts + nodemon devDep. Wizard improvements (back-compat preserving) - Modules/CheckInstallStep/controller.js: `isDoItLater` support added for Firebase (step 4) and SMTP (step 6), mirroring the existing AI (step 5) skip pattern. Both steps remain mandatory unless the caller opts in. - Defensive APIURL fallback at module-load (was crashing the backend on fresh clones if .env hadn't loaded yet — TypeError on .substring of undefined). .env.example - SERVICE_FILE corrected from "../firebase-adminsdk.json" to "./firebase-adminsdk.json" (the prior default tripped the BUG-036 path-traversal guard and blocked the Firebase wizard step). - Quick-start comment block at the top. Nothing existing changes - `npm start`, `npm run nodemon`, `npm run basic-install`, the interactive wizard, and the documented manual setup paths are all untouched. - New scripts never run automatically; users must invoke them explicitly. - Fallback chain at every failure point (MongoDB unreachable / auto-setup error / --manual flag) opens the interactive wizard UI so the user is never left in an unrecoverable state. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
npm run setup— an additive one-command developer setup that goes from a freshgit cloneto a working login screen with zero manual steps. Non-technical contributors can now contribute without learning the 9-step installation wizard.The orchestrator (
scripts/dev.js) installs deps, builds the wizard UI, bootstraps.env, starts the backend + frontend, completes the installation wizard headlessly via the existing API, creates a default admin account, and opens the login page.What's new
scripts/dev.js— orchestrator (~540 lines, no extra runtime deps). HTTP-based wizard auto-completion, MongoDB probe with retry, defensive.envpatching, credentials banner, graceful fallback chain.nodemon.json— explicit watch list (server-side dirs /.jsonly). Fixes the root cause of the "wizard reloads on MongoDB step" bug:installationSteps.jsonwrites were triggering full backend restarts mid-request.package.json— three new scripts (setup,dev,setup:reset) andnodemonadded todevDependencies.Wizard fixes (back-compat preserving)
Modules/CheckInstallStep/controller.js:isDoItLater: truesupport added for step 4 (Firebase) and step 6 (SMTP), mirroring the existing AI (step 5) skip pattern. Both steps remain mandatory unless the caller opts in.APIURLfallback at module load — was crashing the backend on a fresh clone withTypeError: Cannot read properties of undefined (reading 'substring')when.envhadn't been populated yet..env.example—SERVICE_FILEcorrected from../firebase-adminsdk.json(which tripped the BUG-036 path-traversal guard and blocked the Firebase wizard step) to./firebase-adminsdk.json. Added Quick Start comment block at the top.Nothing existing changes
npm start,npm run nodemon,npm run basic-install, the interactive wizard, and the documented manual setup paths are all untouched.--manualflag) opens the interactive wizard UI so the user is never left in an unrecoverable state.Test plan
npm run setup→ login page in ~2 min (with local MongoDB)step 7 + step 8 done, opens login page without re-init--manualflag → skips auto-setup, opens wizard UI--no-openflag → completes setup without launching a browserjestsuite still passes (19/20 — the failingimageGuard.test.js > getLimits respects env overrideswas already failing onstagingbefore this change; tracked separately)dev.jsandcontroller.jsWEBURLfallback,readEnvValueregex, MongoDB URL regex,isInstallationCompletedetectionCustom admin credentials (optional)
Other overrides:
SETUP_ADMIN_FIRST,SETUP_ADMIN_LAST,SETUP_COMPANY,SETUP_PHONE,SETUP_COUNTRY,SETUP_CITY,SETUP_STATE.🤖 Generated with Claude Code