Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.
Merged
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
30 changes: 30 additions & 0 deletions cmd/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ type agentListState struct {
Filename string `json:"filename"`
FoundLocal bool `json:"foundLocal"`
FoundRemote bool `json:"foundRemote"`
Rename bool `json:"rename"`
RenameFrom string `json:"renameFrom"`
}

func getAgentList(logger logger.Logger, apiUrl string, apikey string, project project.ProjectContext) ([]agent.Agent, error) {
Expand Down Expand Up @@ -381,8 +383,10 @@ func reconcileAgentList(logger logger.Logger, cmd *cobra.Command, apiUrl string,

// make a map of the agents in the agentuity config file
fileAgents := make(map[string]project.AgentConfig)
fileAgentsByID := make(map[string]project.AgentConfig)
for _, agent := range theproject.Project.Agents {
fileAgents[normalAgentName(agent.Name)] = agent
fileAgentsByID[agent.ID] = agent
}

agentFilename := rules.Filename
Expand All @@ -405,6 +409,29 @@ func reconcileAgentList(logger logger.Logger, cmd *cobra.Command, apiUrl string,
for _, filename := range localAgents {
agentName := filepath.Base(filepath.Dir(filename))
key := normalAgentName(agentName)
var found bool
for _, agent := range remoteAgents {
if localAgent, ok := fileAgentsByID[agent.ID]; ok {
if localAgent.Name == agentName {
oldkey := normalAgentName(agent.Name)
agent.Name = localAgent.Name
state[key] = agentListState{
Agent: &agent,
Filename: filename,
FoundLocal: true,
FoundRemote: true,
Rename: true,
RenameFrom: oldkey,
}
delete(state, oldkey)
found = true
break
}
}
}
if found {
continue
}
if filepath.Base(filename) == agentFilename {
if found, ok := state[key]; ok {
state[key] = agentListState{
Expand Down Expand Up @@ -474,6 +501,9 @@ func buildAgentTree(keys []string, state map[string]agentListState, project proj
desc = emptyProjectDescription
}
sublabels = append(sublabels, tui.Muted("Description: ")+tui.Secondary(desc))
if st.Rename {
label += " " + tui.Warning("⚠ Renaming from "+st.RenameFrom)
}
} else if st.FoundLocal {
sublabels = append(sublabels, tui.Warning("⚠ Agent found local but not remotely"))
localIssues++
Expand Down
Loading