From eca728a93968a44d42909aab1b98d8e67dfcf50b Mon Sep 17 00:00:00 2001 From: Bobby Christopher Date: Tue, 27 May 2025 14:00:00 -0400 Subject: [PATCH 1/2] fix mono repos --- internal/bundler/bundler.go | 9 +++++++-- internal/bundler/upgrade.go | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/internal/bundler/bundler.go b/internal/bundler/bundler.go index 95e3c126..db54b7ec 100644 --- a/internal/bundler/bundler.go +++ b/internal/bundler/bundler.go @@ -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 } @@ -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 diff --git a/internal/bundler/upgrade.go b/internal/bundler/upgrade.go index 652828d8..7c6b5a7f 100644 --- a/internal/bundler/upgrade.go +++ b/internal/bundler/upgrade.go @@ -147,7 +147,12 @@ type UVLockfile struct { func getSDKVersionJavascript(ctx BundleContext) (*semver.Version, error) { var pkg packageJSON - pkgjson := filepath.Join(ctx.ProjectDir, "node_modules", "@agentuity", "sdk", "package.json") + resolved, err := resolveAgentuity(ctx.Logger, ctx.ProjectDir) + if err != nil { + return nil, err + } + pkgjson := filepath.Join(filepath.Dir(resolved), "package.json") + ctx.Logger.Debug("found @agentuity/sdk/package.json in %s", resolved) if !util.Exists(pkgjson) { return nil, fmt.Errorf("package.json not found: %s", pkgjson) } From 6444aacb6635ea03f8b5fa781ceae826df66d2aa Mon Sep 17 00:00:00 2001 From: Bobby Christopher Date: Tue, 27 May 2025 14:59:39 -0400 Subject: [PATCH 2/2] fix mono repos --- internal/bundler/upgrade.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/bundler/upgrade.go b/internal/bundler/upgrade.go index 7c6b5a7f..db0eecd6 100644 --- a/internal/bundler/upgrade.go +++ b/internal/bundler/upgrade.go @@ -147,12 +147,11 @@ type UVLockfile struct { func getSDKVersionJavascript(ctx BundleContext) (*semver.Version, error) { var pkg packageJSON - resolved, err := resolveAgentuity(ctx.Logger, ctx.ProjectDir) + pkgjson, err := resolveAgentuity(ctx.Logger, ctx.ProjectDir) if err != nil { return nil, err } - pkgjson := filepath.Join(filepath.Dir(resolved), "package.json") - ctx.Logger.Debug("found @agentuity/sdk/package.json in %s", resolved) + 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) }