fix: --var flag now allows commas in values (#786)

Changed all --var flags from StringSlice to StringArray.
StringSlice splits on commas, breaking values like 'desc=A, B, C'.
StringArray only splits on separate --var flags.

Affected commands: pour, cook, wisp, mol distill, mol bond, template instantiate

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-29 16:17:51 -08:00
parent a08dd63079
commit 0521910503
6 changed files with 13 additions and 13 deletions

View File

@@ -118,7 +118,7 @@ func parseCookFlags(cmd *cobra.Command, args []string) (*cookFlags, error) {
force, _ := cmd.Flags().GetBool("force")
searchPaths, _ := cmd.Flags().GetStringSlice("search-path")
prefix, _ := cmd.Flags().GetString("prefix")
varFlags, _ := cmd.Flags().GetStringSlice("var")
varFlags, _ := cmd.Flags().GetStringArray("var")
mode, _ := cmd.Flags().GetString("mode")
// Parse variables
@@ -917,7 +917,7 @@ func init() {
cookCmd.Flags().Bool("force", false, "Replace existing proto if it exists (requires --persist)")
cookCmd.Flags().StringSlice("search-path", []string{}, "Additional paths to search for formula inheritance")
cookCmd.Flags().String("prefix", "", "Prefix to prepend to proto ID (e.g., 'gt-' creates 'gt-mol-feature')")
cookCmd.Flags().StringSlice("var", []string{}, "Variable substitution (key=value), enables runtime mode")
cookCmd.Flags().StringArray("var", []string{}, "Variable substitution (key=value), enables runtime mode")
cookCmd.Flags().String("mode", "", "Cooking mode: compile (keep placeholders) or runtime (substitute vars)")
rootCmd.AddCommand(cookCmd)

View File

@@ -101,7 +101,7 @@ func runMolBond(cmd *cobra.Command, args []string) {
bondType, _ := cmd.Flags().GetString("type")
customTitle, _ := cmd.Flags().GetString("as")
dryRun, _ := cmd.Flags().GetBool("dry-run")
varFlags, _ := cmd.Flags().GetStringSlice("var")
varFlags, _ := cmd.Flags().GetStringArray("var")
ephemeral, _ := cmd.Flags().GetBool("ephemeral")
pour, _ := cmd.Flags().GetBool("pour")
childRef, _ := cmd.Flags().GetString("ref")
@@ -629,7 +629,7 @@ func init() {
molBondCmd.Flags().String("type", types.BondTypeSequential, "Bond type: sequential, parallel, or conditional")
molBondCmd.Flags().String("as", "", "Custom title for compound proto (proto+proto only)")
molBondCmd.Flags().Bool("dry-run", false, "Preview what would be created")
molBondCmd.Flags().StringSlice("var", []string{}, "Variable substitution for spawned protos (key=value)")
molBondCmd.Flags().StringArray("var", []string{}, "Variable substitution for spawned protos (key=value)")
molBondCmd.Flags().Bool("ephemeral", false, "Force spawn as vapor (ephemeral, Ephemeral=true)")
molBondCmd.Flags().Bool("pour", false, "Force spawn as liquid (persistent, Ephemeral=false)")
molBondCmd.Flags().String("ref", "", "Custom child reference with {{var}} substitution (e.g., arm-{{polecat_name}})")

View File

@@ -113,7 +113,7 @@ func runMolDistill(cmd *cobra.Command, args []string) {
os.Exit(1)
}
varFlags, _ := cmd.Flags().GetStringSlice("var")
varFlags, _ := cmd.Flags().GetStringArray("var")
dryRun, _ := cmd.Flags().GetBool("dry-run")
outputDir, _ := cmd.Flags().GetString("output")
@@ -363,7 +363,7 @@ func subgraphToFormula(subgraph *TemplateSubgraph, name string, replacements map
}
func init() {
molDistillCmd.Flags().StringSlice("var", []string{}, "Replace value with {{variable}} placeholder (variable=value)")
molDistillCmd.Flags().StringArray("var", []string{}, "Replace value with {{variable}} placeholder (variable=value)")
molDistillCmd.Flags().Bool("dry-run", false, "Preview what would be created")
molDistillCmd.Flags().String("output", "", "Output directory for formula file")

View File

@@ -65,7 +65,7 @@ func runPour(cmd *cobra.Command, args []string) {
}
dryRun, _ := cmd.Flags().GetBool("dry-run")
varFlags, _ := cmd.Flags().GetStringSlice("var")
varFlags, _ := cmd.Flags().GetStringArray("var")
assignee, _ := cmd.Flags().GetString("assignee")
attachFlags, _ := cmd.Flags().GetStringSlice("attach")
attachType, _ := cmd.Flags().GetString("attach-type")
@@ -275,7 +275,7 @@ func runPour(cmd *cobra.Command, args []string) {
func init() {
// Pour command flags
pourCmd.Flags().StringSlice("var", []string{}, "Variable substitution (key=value)")
pourCmd.Flags().StringArray("var", []string{}, "Variable substitution (key=value)")
pourCmd.Flags().Bool("dry-run", false, "Preview what would be created")
pourCmd.Flags().String("assignee", "", "Assign the root issue to this agent/user")
pourCmd.Flags().StringSlice("attach", []string{}, "Proto to attach after spawning (repeatable)")

View File

@@ -237,7 +237,7 @@ Example:
ctx := rootCtx
dryRun, _ := cmd.Flags().GetBool("dry-run")
varFlags, _ := cmd.Flags().GetStringSlice("var")
varFlags, _ := cmd.Flags().GetStringArray("var")
assignee, _ := cmd.Flags().GetString("assignee")
// Parse variables
@@ -355,7 +355,7 @@ Example:
}
func init() {
templateInstantiateCmd.Flags().StringSlice("var", []string{}, "Variable substitution (key=value)")
templateInstantiateCmd.Flags().StringArray("var", []string{}, "Variable substitution (key=value)")
templateInstantiateCmd.Flags().Bool("dry-run", false, "Preview what would be created")
templateInstantiateCmd.Flags().String("assignee", "", "Assign the root epic to this agent/user")

View File

@@ -147,7 +147,7 @@ func runWispCreate(cmd *cobra.Command, args []string) {
}
dryRun, _ := cmd.Flags().GetBool("dry-run")
varFlags, _ := cmd.Flags().GetStringSlice("var")
varFlags, _ := cmd.Flags().GetStringArray("var")
// Parse variables
vars := make(map[string]string)
@@ -663,11 +663,11 @@ func runWispGC(cmd *cobra.Command, args []string) {
func init() {
// Wisp command flags (for direct create: bd mol wisp <proto>)
wispCmd.Flags().StringSlice("var", []string{}, "Variable substitution (key=value)")
wispCmd.Flags().StringArray("var", []string{}, "Variable substitution (key=value)")
wispCmd.Flags().Bool("dry-run", false, "Preview what would be created")
// Wisp create command flags (kept for backwards compat: bd mol wisp create <proto>)
wispCreateCmd.Flags().StringSlice("var", []string{}, "Variable substitution (key=value)")
wispCreateCmd.Flags().StringArray("var", []string{}, "Variable substitution (key=value)")
wispCreateCmd.Flags().Bool("dry-run", false, "Preview what would be created")
wispListCmd.Flags().Bool("all", false, "Include closed wisps")