| 265 | } |
| 266 | |
| 267 | func appendRepositoryPackageWorkflowSpecs(parsedSpecs []*WorkflowSpec, repoSpec *RepoSpec, pkg *resolvedRepositoryPackage) []*WorkflowSpec { |
| 268 | if pkg == nil { |
| 269 | return parsedSpecs |
| 270 | } |
| 271 | host := explicitHostForRepo(repoSpec.RepoSlug) |
| 272 | effectiveVersion := repositoryPackageEffectiveRef(repoSpec, pkg) |
| 273 | for _, installationSource := range pkg.InstallationSource { |
| 274 | // installationSource is guaranteed by isSupportedPackageInstallablePath to be |
| 275 | // either a .md agentic workflow or a .yml action workflow file; no other |
| 276 | // extensions can reach this point. |
| 277 | base := filepath.Base(installationSource) |
| 278 | // Use filepath.Ext for case-insensitive extension removal (e.g. ".YML" or ".MD"). |
| 279 | workflowName := strings.TrimSuffix(base, filepath.Ext(base)) |
| 280 | parsedSpecs = append(parsedSpecs, &WorkflowSpec{ |
| 281 | RepoSpec: RepoSpec{ |
| 282 | RepoSlug: repoSpec.RepoSlug, |
| 283 | Version: effectiveVersion, |
| 284 | PackagePath: repoSpec.PackagePath, |
| 285 | }, |
| 286 | WorkflowPath: installationSource, |
| 287 | WorkflowName: workflowName, |
| 288 | Host: host, |
| 289 | FromRepositoryManifest: true, |
| 290 | }) |
| 291 | } |
| 292 | |
| 293 | // Append skill file specs. Each spec carries IsPackageSkillFile=true and the SkillName |
| 294 | // so that the installation step can route the file to the correct skill directory. |
| 295 | for _, skillFile := range pkg.SkillFiles { |
| 296 | base := filepath.Base(skillFile.SourcePath) |
| 297 | // WorkflowName is unused for skill files but set to a stable value for logging. |
| 298 | workflowName := skillFile.SkillName + "/" + strings.TrimSuffix(base, filepath.Ext(base)) |
| 299 | parsedSpecs = append(parsedSpecs, &WorkflowSpec{ |
| 300 | RepoSpec: RepoSpec{ |
| 301 | RepoSlug: repoSpec.RepoSlug, |
| 302 | Version: effectiveVersion, |
| 303 | PackagePath: repoSpec.PackagePath, |
| 304 | }, |
| 305 | WorkflowPath: skillFile.SourcePath, |
| 306 | WorkflowName: workflowName, |
| 307 | Host: host, |
| 308 | IsPackageSkillFile: true, |
| 309 | SkillName: skillFile.SkillName, |
| 310 | }) |
| 311 | } |
| 312 | |
| 313 | // Append agent file specs. Each spec carries IsPackageAgentFile=true so the installation |
| 314 | // step routes the file to the correct agents directory. |
| 315 | for _, agentFile := range pkg.AgentFiles { |
| 316 | base := filepath.Base(agentFile) |
| 317 | workflowName := strings.TrimSuffix(base, filepath.Ext(base)) |
| 318 | parsedSpecs = append(parsedSpecs, &WorkflowSpec{ |
| 319 | RepoSpec: RepoSpec{ |
| 320 | RepoSlug: repoSpec.RepoSlug, |
| 321 | Version: effectiveVersion, |
| 322 | PackagePath: repoSpec.PackagePath, |
| 323 | }, |
| 324 | WorkflowPath: agentFile, |