Skip to content

Commit a52e11e

Browse files
akoclaude
andcommitted
fix: mxcli new looks for correct MPR filename from create-project
mx create-project --app-name X produces X.mpr, not App.mpr. Look for <app-name>.mpr first, fall back to App.mpr, then glob for any .mpr file. Also fix the "Next steps" message to show the actual filename. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2db5a9d commit a52e11e

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

cmd/mxcli/cmd_new.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,23 @@ Examples:
8888
os.Exit(1)
8989
}
9090

91-
// Verify .mpr was created
92-
mprPath := filepath.Join(absDir, "App.mpr")
91+
// Verify .mpr was created — mx create-project names the file after --app-name
92+
mprPath := filepath.Join(absDir, appName+".mpr")
9393
if _, err := os.Stat(mprPath); os.IsNotExist(err) {
94-
fmt.Fprintf(os.Stderr, "Error: mx create-project did not produce App.mpr in %s\n", absDir)
95-
os.Exit(1)
94+
// Fallback: check for App.mpr (default when --app-name is not used)
95+
fallback := filepath.Join(absDir, "App.mpr")
96+
if _, err := os.Stat(fallback); err == nil {
97+
mprPath = fallback
98+
} else {
99+
// Last resort: find any .mpr file
100+
matches, _ := filepath.Glob(filepath.Join(absDir, "*.mpr"))
101+
if len(matches) > 0 {
102+
mprPath = matches[0]
103+
} else {
104+
fmt.Fprintf(os.Stderr, "Error: mx create-project did not produce an .mpr file in %s\n", absDir)
105+
os.Exit(1)
106+
}
107+
}
96108
}
97109
fmt.Printf(" Created %s\n", mprPath)
98110

@@ -137,7 +149,7 @@ Examples:
137149
fmt.Println("\nNext steps:")
138150
fmt.Println(" 1. Open the project folder in VS Code")
139151
fmt.Println(" 2. Reopen in Dev Container when prompted")
140-
fmt.Printf(" 3. Run './mxcli -p App.mpr' to start working\n")
152+
fmt.Printf(" 3. Run './mxcli -p %s' to start working\n", filepath.Base(mprPath))
141153
},
142154
}
143155

0 commit comments

Comments
 (0)