Skip to content
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
12 changes: 10 additions & 2 deletions cmd/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"sort"
"syscall"

"github.com/agentuity/cli/internal/deployer"
"github.com/agentuity/cli/internal/envutil"
"github.com/agentuity/cli/internal/errsystem"
"github.com/agentuity/cli/internal/mcp"
Expand Down Expand Up @@ -586,8 +587,15 @@ Examples:

})

// run the git flow
projectGitFlow(ctx, provider, tmplContext, githubAction)
gitInfo, err := deployer.GetGitInfoRecursive(logger, projectDir)
if err != nil {
logger.Info("failed to get git info: %s", err)
}
logger.Debug("git info: %+v", gitInfo)

if !gitInfo.IsRepo {
projectGitFlow(ctx, provider, tmplContext, githubAction)
}

if format == "json" {
json.NewEncoder(os.Stdout).Encode(projectData)
Expand Down
4 changes: 4 additions & 0 deletions internal/deployer/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func GetGitInfoRecursive(logger logger.Logger, startDir string) (*GitInfo, error
depth := 0
dir := startDir
for {
logger.Debug("Checking git repo at %s", dir)
if depth >= 100 {
logger.Warn("Max depth reached while trying to find git dir")
return &GitInfo{}, nil
Expand All @@ -117,12 +118,15 @@ func GetGitInfoRecursive(logger logger.Logger, startDir string) (*GitInfo, error
if err != nil {
return nil, err
}
logger.Debug("Git info: %+v", info)
if info != nil && info.IsRepo {
return info, nil
}

parent := parentDir(dir)

if parent == dir {
logger.Debug("No git repo found at %s", dir)
break
}
dir = parent
Expand Down
Loading