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
9 changes: 7 additions & 2 deletions internal/bundler/bundler.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ func bundleJavascript(ctx BundleContext, dir string, outdir string, theproject *
if err != nil {
return fmt.Errorf("failed to load %s: %w", pkgjson, err)
}
agentuitypkg, err := resolveAgentuity(dir)
ctx.Logger.Debug("resolving agentuity sdk")
agentuitypkg, err := resolveAgentuity(ctx.Logger, dir)
if err != nil {
return err
}
Expand Down Expand Up @@ -381,15 +382,19 @@ func Bundle(ctx BundleContext) error {
}

// resolveAgentuity walks up from startDir looking for node_modules/@agentuity/sdk/package.json
func resolveAgentuity(startDir string) (string, error) {
func resolveAgentuity(logger logger.Logger, startDir string) (string, error) {
dir := startDir
for {
candidate := filepath.Join(dir, "node_modules", "@agentuity", "sdk", "package.json")
if util.Exists(candidate) {
logger.Debug("found @agentuity/sdk/package.json in %s", candidate)
return candidate, nil
}
logger.Debug("did not find @agentuity/sdk/package.json in %s", dir)
parent := filepath.Dir(dir)
logger.Debug("checking parent directory: %s", parent)
if parent == dir {
logger.Debug("reached root directory, stopping search")
break
}
dir = parent
Expand Down
6 changes: 5 additions & 1 deletion internal/bundler/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ type UVLockfile struct {

func getSDKVersionJavascript(ctx BundleContext) (*semver.Version, error) {
var pkg packageJSON
pkgjson := filepath.Join(ctx.ProjectDir, "node_modules", "@agentuity", "sdk", "package.json")
pkgjson, err := resolveAgentuity(ctx.Logger, ctx.ProjectDir)
if err != nil {
return nil, err
}
ctx.Logger.Debug("found @agentuity/sdk/package.json in %s", pkgjson)
if !util.Exists(pkgjson) {
return nil, fmt.Errorf("package.json not found: %s", pkgjson)
}
Expand Down
Loading