Skip to content

fix(config): use ROUTER.md as scaffold completeness marker#25

Merged
theDakshJaitly merged 2 commits intomainfrom
fix/24-scaffold-completeness-check
Apr 10, 2026
Merged

fix(config): use ROUTER.md as scaffold completeness marker#25
theDakshJaitly merged 2 commits intomainfrom
fix/24-scaffold-completeness-check

Conversation

@theDakshJaitly
Copy link
Copy Markdown
Owner

Summary

  • mex check was checking for .mex/setup.sh as a completeness marker, but setup.sh is never copied into the user's .mex/ directory during init — causing every fresh setup to fail with a misleading error
  • Changed the marker to ROUTER.md, which is always created by the setup process
  • Simplified the "no scaffold found" error message to point to npx mex init

Closes #24

Test plan

  • All 85 existing tests pass
  • Run npx mex init in a fresh project, then npx mex check — should no longer throw the setup.sh error

… 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
Copilot AI review requested due to automatic review settings April 10, 2026 15:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sh to .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.

Comment on lines 22 to 25
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");
}
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 33 to 35
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"
);
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 34 to 37
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");
});
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
…nit)

Addresses Copilot review feedback — init is the pre-scan command,
setup is what actually creates the .mex/ scaffold.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@theDakshJaitly theDakshJaitly merged commit f74a3a1 into main Apr 10, 2026
7 checks passed
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.

Scaffold directory exists but looks incomplete. Run: bash .mex/setup.sh

2 participants