Files
pack/core/providers/procfile/procfile.go
T
zeekay 7844a60aff refactor(pack): modernize to github.com/hanzoai/pack and remove upstream branding
- Migrate module path to github.com/hanzoai/pack across all Go packages
- Remove legacy upstream docs and competitor brand references
- Modernize LLM.md and mise.toml for pristine Hanzo Pack builder
2026-09-04 00:40:42 -07:00

43 lines
1.1 KiB
Go

// this provider is unique: it used solely to extract a start command
package procfile
import "github.com/hanzoai/pack/core/generate"
type ProcfileProvider struct{}
func (p *ProcfileProvider) Name() string {
return "procfile"
}
func (p *ProcfileProvider) Plan(ctx *generate.GenerateContext) (bool, error) {
if _, err := ctx.App.ReadFile("Procfile"); err != nil {
return false, nil
}
parsedProcfile := map[string]string{}
if err := ctx.App.ReadYAML("Procfile", &parsedProcfile); err != nil {
return false, err
}
webCommand := parsedProcfile["web"]
workerCommand := parsedProcfile["worker"]
if webCommand != "" {
ctx.Logger.LogInfo("Found web command in Procfile")
ctx.Deploy.StartCmd = webCommand
} else if workerCommand != "" {
ctx.Logger.LogInfo("Found worker command in Procfile")
ctx.Deploy.StartCmd = workerCommand
} else if len(parsedProcfile) > 0 {
for processType, command := range parsedProcfile {
if command != "" {
ctx.Logger.LogInfo("Found %s command in Procfile", processType)
ctx.Deploy.StartCmd = command
break
}
}
}
return false, nil
}