railpack

Configure and troubleshoot Railpack builds, with emphasis on RAILPACK_* environment variables, railpack.json overlays, build-plan inspection, local CLI installation and usage, and local BuildKit containers. Use for Railpack provider configuration, custom install/build/start commands, Mise or Apt packages, build or runtime variables and secrets, generated-plan debugging, BUILDKIT_HOST errors, or running Railpack from a release or source checkout.

Install
npx skills add 'https://github.com/railwayapp/railpack/tree/main/.'
Incomplete bundle · no download
main · 21a254fScanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗

cli/plan.go

cli/plan.goBrowse 1970 files
View on GitHub
← Back to SKILL.md
package cli import (	"context"	"encoding/json"	"os"	"path/filepath" 	"github.com/charmbracelet/log"	"github.com/urfave/cli/v3") var PlanCommand = &cli.Command{	Name:                  "plan",	Aliases:               []string{"p"},	Usage:                 "generate a build plan for a directory",	ArgsUsage:             "DIRECTORY",	EnableShellCompletion: true,	Flags: append([]cli.Flag{		&cli.StringFlag{			Name:    "out",			Aliases: []string{"o"},			Usage:   "output file name",		},	}, commonPlanFlags()...),	Action: func(ctx context.Context, cmd *cli.Command) error {		buildResult, _, _, err := GenerateBuildResultForCommand(cmd)		if err != nil {			return cli.Exit(err, exitCodeForError(err))		} 		// Include $schema in the generated plan JSON for editor support		planMap, err := addSchemaToPlanMap(buildResult.Plan)		if err != nil {			return cli.Exit(err, ExitCodeFailure)		}		serializedPlan, err := json.MarshalIndent(planMap, "", "  ")		if err != nil {			return cli.Exit(err, ExitCodeFailure)		}		buildResultString := serializedPlan 		output := cmd.String("out")		if output == "" {			// Write to stdout if no output file specified			_, _ = os.Stdout.Write([]byte(buildResultString))			_, _ = os.Stdout.Write([]byte("\n"))			return nil		} else {			if err := os.MkdirAll(filepath.Dir(output), 0755); err != nil {				return cli.Exit(err, ExitCodeFailure)			} 			err = os.WriteFile(output, []byte(buildResultString), 0644)			if err != nil {				return cli.Exit(err, ExitCodeFailure)			} 			log.Infof("Plan written to %s", output)		} 		return nil	},}