@@ -25,6 +25,57 @@ func main() {
2525 Aliases : []string {"g" },
2626 Usage : "Generates various test templates" ,
2727 Subcommands : []* cli.Command {
28+ {
29+ Name : "env" ,
30+ Aliases : []string {"e" },
31+ Usage : "Generate a Chainlink Node developer environment" ,
32+ Description : `This utility generate a Chainlink Node Cluster (DON) environment.
33+ Default setup includes:
34+ - Anvil (EVM emulator from Foundry) or Geth blockchain nodes
35+ - Chainlink Nodes
36+ - Fake server (for 3rd party dependencies)
37+ - Test boilerplates, CI and documentation
38+
39+ Usage:
40+
41+ Generate a basic environment:
42+ ctf gen env --cli myenv --nodes 4
43+ ` ,
44+ ArgsUsage : "" ,
45+ Flags : []cli.Flag {
46+ & cli.StringFlag {
47+ Name : "cli" ,
48+ Aliases : []string {"c" },
49+ Usage : "Your devenv CLI binary name" ,
50+ },
51+ & cli.IntFlag {
52+ Name : "nodes" ,
53+ Aliases : []string {"n" },
54+ Value : 4 ,
55+ Usage : "Chainlink Nodes" ,
56+ },
57+ },
58+ Action : func (c * cli.Context ) error {
59+ nodes := c .Int ("nodes" )
60+ cliName := c .String ("cli" )
61+ if cliName == "" {
62+ return fmt .Errorf ("CLI name can't be empty, choose your CLI name" )
63+ }
64+ framework .L .Info ().
65+ Str ("Name" , cliName ).
66+ Int ("CLNodes" , nodes ).
67+ Msg ("Generating developer environment" )
68+
69+ cg , err := framework .NewEnvBuilder (cliName , nodes ).Build ()
70+ if err != nil {
71+ return fmt .Errorf ("failed to create codegen: %w" , err )
72+ }
73+ if err := cg .Write (); err != nil {
74+ return fmt .Errorf ("failed to generate module: %w" , err )
75+ }
76+ return nil
77+ },
78+ },
2879 {
2980 Name : "load" ,
3081 Aliases : []string {"l" },
0 commit comments