diff --git a/CHANGELOG.md b/CHANGELOG.md index e6b3089dd..f48e8897e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## UNRELEASED - CLI 0.14.0 + +- fix: Lookup of 'latest' SDK when no Modus SDK is referenced [#625](https://github.com/hypermodeinc/modus/pull/625) + ## UNRELEASED - AssemblyScript SDK 0.14.2 - chore: Export base Message class in OpenAI chat SDK [#616](https://github.com/hypermodeinc/modus/pull/616) diff --git a/cli/src/util/appinfo.ts b/cli/src/util/appinfo.ts index e2e0c3238..5fa2a6c6c 100644 --- a/cli/src/util/appinfo.ts +++ b/cli/src/util/appinfo.ts @@ -12,6 +12,7 @@ import semver from "semver"; import * as fs from "./fs.js"; import * as vi from "./versioninfo.js"; import { SDK } from "../custom/globals.js"; +import { isOnline } from "./index.js"; export type ModusAppInfo = { name: string; @@ -20,6 +21,22 @@ export type ModusAppInfo = { }; export async function getAppInfo(appPath: string): Promise { + const appInfo = await getInfoFromApp(appPath); + + if (appInfo.sdkVersion == "latest") { + const online = await isOnline(); + const version = online ? await vi.getLatestSdkVersion(appInfo.sdk, false) : await vi.getLatestInstalledSdkVersion(appInfo.sdk, false); + if (version) { + appInfo.sdkVersion = version; + } else { + throw new Error(`Could not determine the latest version of the ${appInfo.sdk} SDK`); + } + } + + return appInfo; +} + +async function getInfoFromApp(appPath: string): Promise { if (await fs.exists(path.join(appPath, "package.json"))) { return await getAssemblyScriptAppInfo(appPath); } diff --git a/sdk/go/doc.go b/sdk/go/doc.go index 06a77aed1..483307373 100644 --- a/sdk/go/doc.go +++ b/sdk/go/doc.go @@ -7,4 +7,4 @@ * SPDX-License-Identifier: Apache-2.0 */ -package main +package modus diff --git a/sdk/go/templates/default/go.mod b/sdk/go/templates/default/go.mod index 81f6a0924..b968efaed 100644 --- a/sdk/go/templates/default/go.mod +++ b/sdk/go/templates/default/go.mod @@ -1,3 +1,5 @@ module my-modus-app go 1.23.0 + +require github.com/hypermodeinc/modus/sdk/go v0.14.2 diff --git a/sdk/go/templates/default/go.sum b/sdk/go/templates/default/go.sum new file mode 100644 index 000000000..6e634a5da --- /dev/null +++ b/sdk/go/templates/default/go.sum @@ -0,0 +1,2 @@ +github.com/hypermodeinc/modus/sdk/go v0.14.2 h1:u8apLIaxQlE9sGVmhWNwWQCuvFIctZyse83nJiGB1/A= +github.com/hypermodeinc/modus/sdk/go v0.14.2/go.mod h1:VDL2kAYHQtNEr7lxPynbchZ6HizLSSQ9cG4LrDnq3Vg= diff --git a/sdk/go/templates/default/main.go b/sdk/go/templates/default/main.go index cbb31ed4b..0575f4f68 100644 --- a/sdk/go/templates/default/main.go +++ b/sdk/go/templates/default/main.go @@ -1,6 +1,10 @@ package main -import "fmt" +import ( + "fmt" + + _ "github.com/hypermodeinc/modus/sdk/go" +) func SayHello(name *string) string {