Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
Address review feedback in manifest update changes
Co-authored-by: pelikhan <[email protected]>
  • Loading branch information
Copilot and pelikhan authored May 22, 2026
commit 741a9ee8607d341b992dcd9aba9814d1f33ab05d
6 changes: 3 additions & 3 deletions pkg/cli/add_package_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,13 @@ func validateUniqueManifestWorkflowFilenames(paths []string, manifestPath string
if !strings.HasSuffix(strings.ToLower(installPath), ".md") {
continue
}
base := strings.TrimSuffix(filepath.Base(installPath), filepath.Ext(installPath))
key := strings.ToLower(strings.TrimSpace(base))
filenameWithoutExt := strings.TrimSuffix(filepath.Base(installPath), filepath.Ext(installPath))
key := strings.ToLower(strings.TrimSpace(filenameWithoutExt))
if key == "" {
continue
}
if previous, exists := seen[key]; exists {
return fmt.Errorf("invalid Agentic Workflow manifest %q: duplicate workflow filename %q in files entries %q and %q (filenames must be unique across a package)", manifestPath, base, previous, installPath)
return fmt.Errorf("invalid Agentic Workflow manifest %q: duplicate workflow filename %q in files entries %q and %q (filenames must be unique across a package)", manifestPath, filenameWithoutExt, previous, installPath)
}
seen[key] = installPath
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/update_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func manifestWorkflowPathByName(paths []string) map[string]string {
if !strings.HasSuffix(strings.ToLower(p), ".md") {
continue
}
key := normalizeWorkflowID(filepath.Base(p))
byName[key] = p
workflowID := normalizeWorkflowID(filepath.Base(p))
byName[workflowID] = p
}
return byName
}
Expand Down
8 changes: 6 additions & 2 deletions pkg/cli/update_workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ func UpdateWorkflows(ctx context.Context, opts UpdateWorkflowsOptions) error {
manifestGroups := make(map[string][]*workflowWithSource)
var directWorkflows []*workflowWithSource
for _, wf := range workflows {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/zoom-out] Clean separation: manifest vs. direct workflows.

✅ Good design pattern

The separation logic here is clear and maintainable:

  1. Parse once, route correctly: parseManifestSourceSpec determines whether a workflow is manifest-backed
  2. Group for efficiency: Manifest workflows get batched by source for atomic updates
  3. Preserve existing behavior: Direct workflows continue through the original update path

This design avoids a common anti-pattern where manifest and direct workflows would be intermixed in a single update loop with complex conditionals.

Minor suggestion: Consider extracting the grouping logic into a helper function if this pattern repeats elsewhere:

func groupWorkflowsBySource(workflows []*workflowWithSource) (map[string][]*workflowWithSource, []*workflowWithSource, []updateFailure)

if _, ok, err := parseManifestSourceSpec(wf.SourceSpec); err != nil {
if repoSpec, ok, err := parseManifestSourceSpec(wf.SourceSpec); err != nil {
errMsg := err.Error()
if repoSpec != nil {
errMsg = fmt.Sprintf("%s (%s)", errMsg, repositoryPackageIdentifier(repoSpec.RepoSlug, repoSpec.PackagePath))
}
failedUpdates = append(failedUpdates, updateFailure{
Name: wf.Name,
Error: err.Error(),
Error: errMsg,
})
continue
} else if ok {
Expand Down