Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Commit 3222dd4

Browse files
fix: pass pre-release flags properly to subcommands (#847)
1 parent ecad7be commit 3222dd4

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
# Change Log
44

5+
## 2025-05-16 CLI 0.18.0
6+
7+
- fix: pass pre-release flags properly to subcommands [#847](https://github.com/hypermodeinc/modus/pull/847)
8+
59
## 2025-05-16 Runtime 0.18.0-alpha.2
610

711
- fix: reflection error in runtime when starting agent [#845](https://github.com/hypermodeinc/modus/pull/845)

cli/src/commands/dev/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export default class DevCommand extends BaseCommand {
8080

8181
const app = await getAppInfo(appPath);
8282
const { sdk, sdkVersion } = app;
83+
const prerelease = vi.isPrerelease(sdkVersion) || flags.prerelease;
8384

8485
if (!flags["no-logo"]) {
8586
this.log(getHeader(this.config.version));
@@ -109,7 +110,7 @@ export default class DevCommand extends BaseCommand {
109110
}
110111
}
111112
} else if (await isOnline()) {
112-
const version = await vi.findLatestCompatibleRuntimeVersion(sdk, sdkVersion, flags.prerelease);
113+
const version = await vi.findLatestCompatibleRuntimeVersion(sdk, sdkVersion, prerelease);
113114
if (version && !(await vi.runtimeVersionIsInstalled(version))) {
114115
const runtimeText = `Modus Runtime ${version}`;
115116
await withSpinner(chalk.dim("Downloading and installing " + runtimeText), async (spinner) => {
@@ -128,7 +129,7 @@ export default class DevCommand extends BaseCommand {
128129
}
129130
runtimeVersion = version;
130131
} else {
131-
const version = await vi.findCompatibleInstalledRuntimeVersion(sdk, sdkVersion, flags.prerelease);
132+
const version = await vi.findCompatibleInstalledRuntimeVersion(sdk, sdkVersion, prerelease);
132133
if (!version) {
133134
this.logError("Could not find a compatible Modus runtime version. Please try again when you have an internet connection.");
134135
return;

cli/src/commands/new/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,11 @@ export default class NewCommand extends BaseCommand {
305305
}
306306
}
307307
if (updateSDK) {
308-
await SDKInstallCommand.run([sdk, latestVersion!, "--no-logo"]);
308+
const sdkInstallArgs = [sdk, latestVersion!, "--no-logo"];
309+
if (prerelease) {
310+
sdkInstallArgs.push("--prerelease");
311+
}
312+
await SDKInstallCommand.run(sdkInstallArgs);
309313
installedSdkVersion = latestVersion;
310314
}
311315
}

cli/src/util/versioninfo.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,9 @@ export async function findLatestCompatibleRuntimeVersion(sdk: globals.SDK, sdkVe
311311
compatibleVersions = versions.filter((v) => semver.satisfies(v.slice(1), constraint, { includePrerelease: true }));
312312
}
313313
if (compatibleVersions.length > 0) {
314-
return compatibleVersions[0];
314+
// Sort in descending order and return the latest version
315+
compatibleVersions = semver.rsort(compatibleVersions.map((v) => v.slice(1)));
316+
return "v" + compatibleVersions[0];
315317
}
316318
}
317319
}

0 commit comments

Comments
 (0)