fix(config): use ROUTER.md as scaffold completeness marker#25
fix(config): use ROUTER.md as scaffold completeness marker#25theDakshJaitly merged 2 commits intomainfrom
Conversation
… setup.sh setup.sh was never copied into the user's .mex/ directory during init, causing `mex check` to always fail with a misleading error. ROUTER.md is the correct marker since it's always created by the setup process. Also simplifies the "no scaffold found" error to point users to `npx mex init`. Closes #24
There was a problem hiding this comment.
Pull request overview
Updates mex check scaffold validation to use a file that’s actually created during setup, avoiding false “incomplete scaffold” failures on fresh installs.
Changes:
- Switches the scaffold “completeness marker” from
.mex/setup.shto.mex/ROUTER.md. - Simplifies the “no scaffold found” error message and updates related tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/config.ts |
Updates scaffold completeness check + user-facing error strings. |
test/config.test.ts |
Adjusts tests to reflect new completeness marker and error text. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const mexDir = resolve(projectRoot, ".mex"); | ||
| if (existsSync(mexDir) && !existsSync(resolve(mexDir, "setup.sh"))) { | ||
| throw new Error("Scaffold directory exists but looks incomplete. Run: bash .mex/setup.sh"); | ||
| if (existsSync(mexDir) && !existsSync(resolve(mexDir, "ROUTER.md"))) { | ||
| throw new Error("Scaffold directory exists but looks incomplete. Run: npx mex init"); | ||
| } |
There was a problem hiding this comment.
The suggested recovery command npx mex init is likely incorrect/misleading. In this repo, scaffold creation is done via the setup command (see src/cli.ts where setup is "First-time setup — create .mex/ scaffold"), while init requires an existing scaffold. Consider updating the message to point to mex setup (or npx promexeus setup for non-global installs) so users can actually recover from an incomplete scaffold.
| throw new Error( | ||
| "No .mex/ scaffold found. Run: git clone https://github.com/theDakshJaitly/mex.git .mex && bash .mex/setup.sh" | ||
| "No .mex/ scaffold found. Run: npx mex init" | ||
| ); |
There was a problem hiding this comment.
This error message also points to npx mex init, but init is a pre-scan command that expects a valid scaffold; the command that creates the .mex/ scaffold is setup (see src/cli.ts). Update this guidance to mex setup / npx promexeus setup so a first-time user can fix the missing scaffold.
| it("throws when no .mex/ scaffold found at all", () => { | ||
| mkdirSync(join(tmpDir, ".git")); | ||
| expect(() => findConfig(tmpDir)).toThrow("No .mex/ scaffold found. Run: git clone"); | ||
| expect(() => findConfig(tmpDir)).toThrow("No .mex/ scaffold found. Run: npx mex init"); | ||
| }); |
There was a problem hiding this comment.
Test expectation is aligned to the new string, but the string itself likely points to the wrong command: scaffold creation is setup, not init (and via npx the package name is promexeus). After fixing the error message in src/config.ts, update this assertion to match the corrected guidance.
…nit) Addresses Copilot review feedback — init is the pre-scan command, setup is what actually creates the .mex/ scaffold.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
mex checkwas checking for.mex/setup.shas a completeness marker, butsetup.shis never copied into the user's.mex/directory during init — causing every fresh setup to fail with a misleading errorROUTER.md, which is always created by the setup processnpx mex initCloses #24
Test plan
npx mex initin a fresh project, thennpx mex check— should no longer throw the setup.sh error