Add stage planning and placeholder runner

This commit is contained in:
2026-05-02 11:05:28 -05:00
parent fb659e0d3d
commit 78e7e4f41b
14 changed files with 598 additions and 68 deletions

View File

@@ -10,15 +10,17 @@ import (
"gitea.maximumdirect.net/eric/narratio/internal/config"
)
// Plan validates configuration inputs and prepares the local session workdir.
// Plan validates configuration, prepares the local workdir, and prints stage order.
func Plan(_ context.Context, args []string, out io.Writer) error {
fs := flag.NewFlagSet("plan", flag.ContinueOnError)
fs.SetOutput(io.Discard)
var pipelinePath string
var sessionPath string
var force bool
fs.StringVar(&pipelinePath, "config", "", "path to pipeline.yml")
fs.StringVar(&sessionPath, "session", "", "path to session.yml")
fs.BoolVar(&force, "force", false, "force stage execution (reserved for future behavior)")
if err := fs.Parse(args); err != nil {
return fmt.Errorf("plan: invalid flags: %w", err)
@@ -44,6 +46,17 @@ func Plan(_ context.Context, args []string, out io.Writer) error {
return fmt.Errorf("plan: prepare workdir: %w", err)
}
_, err = fmt.Fprintf(out, "narratio plan: configuration loaded and valid; workdir prepared at %s\n", paths.Root)
return err
_ = force // TODO: use --force in future skip/stale planning behavior.
stages := BuildFullPlan()
if _, err := fmt.Fprintf(out, "narratio plan: workdir prepared at %s\n", paths.Root); err != nil {
return err
}
for _, s := range stages {
if _, err := fmt.Fprintln(out, s.Name()); err != nil {
return err
}
}
return nil
}