Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions internal/bundler/bundler.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ func bundleJavascript(ctx BundleContext, dir string, outdir string, theproject *
ctx.Logger.Debug("installed dependencies: %s", strings.TrimSpace(string(out)))
}

if err := checkForBreakingChanges(ctx, "javascript", theproject.Bundler.Runtime); err != nil {
return err
}

var entryPoints []string
entryPoints = append(entryPoints, filepath.Join(dir, "index.js"))
files, err := util.ListDir(filepath.Join(dir, theproject.Bundler.AgentConfig.Dir))
Expand Down Expand Up @@ -192,6 +196,10 @@ func bundlePython(ctx BundleContext, dir string, outdir string, theproject *proj
ctx.Logger.Debug("installed dependencies: %s", strings.TrimSpace(string(out)))
}

if err := checkForBreakingChanges(ctx, "python", theproject.Bundler.Runtime); err != nil {
return err
}

config := map[string]any{
"agents": getAgents(theproject, "agent.py"),
"cli_version": Version,
Expand Down
78 changes: 78 additions & 0 deletions internal/bundler/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package bundler

import (
"encoding/json"
"fmt"
"os"
"path/filepath"

"github.com/Masterminds/semver"
"github.com/agentuity/cli/internal/util"
"github.com/agentuity/go-common/tui"
)

var jsSDKVersion = ">=0.0.106"

type breakingChange struct {
Title string
Message string
Runtime string
Version string
}

var jsBreakingChanges = []breakingChange{
{
Runtime: "bunjs",
Version: "<0.0.106",
Title: "🚫 JS SDK Breaking Change 🚫",
Message: "The JS SDK type signatures for AgentRequest have changed to be async functions. Please see the v0.0.106 Changelog for how to update your code.\n\n" + tui.Link("https://agentuity.dev/Changelog/sdk-js#v00106") + "\n\nPlease bun upgrade @agentuity/sdk, fix your types and ensure your code passes type checking and then re-run this command again.",
},
{
Runtime: "nodejs",
Version: "<0.0.106",
Title: "🚫 JS SDK Breaking Change 🚫",
Message: "The JS SDK type signatures for AgentRequest have changed to be async functions. Please see the v0.0.106 Changelog for how to update your code.\n\n" + tui.Link("https://agentuity.dev/Changelog/sdk-js#v00106") + "\n\nPlease npm upgrade @agentuity/sdk, fix your types and ensure your code passes type checking and then re-run this command again.",
},
}

type packageJSON struct {
Version string `json:"version"`
}

func checkForBreakingChanges(ctx BundleContext, language string, runtime string) error {
switch language {
case "javascript":
pkgjson := filepath.Join(ctx.ProjectDir, "node_modules", "@agentuity", "sdk", "package.json")
if util.Exists(pkgjson) {
var pkg packageJSON
content, err := os.ReadFile(pkgjson)
if err != nil {
return err
}
if err := json.Unmarshal(content, &pkg); err != nil {
return err
}
currentVersion := semver.MustParse(pkg.Version)
for _, change := range jsBreakingChanges {
if change.Runtime != runtime {
continue
}
c, err := semver.NewConstraint(change.Version)
if err != nil {
return fmt.Errorf("error parsing semver constraint %s: %w", change.Version, err)
}
if c.Check(currentVersion) {
if tui.HasTTY {
tui.ShowBanner(change.Title, change.Message, true)
os.Exit(1)
} else {
ctx.Logger.Fatal(change.Message)
}
}
}
}
default:
return nil
}
return nil
}
Loading