@@ -5,18 +5,27 @@ import (
5
5
"os"
6
6
7
7
"github.com/charmbracelet/huh"
8
+ "github.com/posthog/posthog-go"
8
9
)
9
10
10
11
type model struct {
11
- language string
12
- projectName string
13
- currentDir string
14
- installDeps bool
15
- startRestack bool
16
- openUI bool
12
+ language string
13
+ applicationName string
14
+ currentDir string
15
+ installDeps bool
16
+ startRestack bool
17
+ openUI bool
17
18
}
18
19
19
20
func main () {
21
+ // Initialize PostHog client
22
+ client := posthog .NewWithConfig (
23
+ "phc_QAChHsfb5cq65wolzsxiJ6cZk1V9IcfGqCidBWhaLgK" ,
24
+ posthog.Config {
25
+ Endpoint : "https://us.i.posthog.com" ,
26
+ },
27
+ )
28
+ defer client .Close ()
20
29
21
30
language := validateLanguage ()
22
31
currentDir , err := os .Getwd ()
@@ -25,31 +34,39 @@ func main() {
25
34
}
26
35
27
36
m := model {
28
- currentDir : currentDir ,
29
- language : language ,
30
- projectName : "restack-your-project " ,
31
- startRestack : true ,
32
- openUI : true ,
37
+ currentDir : currentDir ,
38
+ language : language ,
39
+ applicationName : "restack-app " ,
40
+ startRestack : true ,
41
+ openUI : true ,
33
42
}
34
43
35
44
questions := []huh.Field {
36
45
huh .NewInput ().
37
46
Title ("Welcome to Restack. Let's get you started." ).
38
- Description ("Enter project name:" ).
39
- Placeholder ("restack-your-project " ).
47
+ Description ("Enter application name:" ).
48
+ Placeholder ("restack-app " ).
40
49
CharLimit (50 ).
41
- Value (& m .projectName ),
50
+ Value (& m .applicationName ),
42
51
huh .NewConfirm ().
43
- Title ("Start Restack Developer UI ? (recommended)" ).
52
+ Title ("Start Restack in Docker ? (recommended)" ).
44
53
Value (& m .startRestack ),
45
54
}
46
55
47
- // Ask the first question (project name)
56
+ // Ask the first question (application name)
48
57
err = huh .NewForm (huh .NewGroup (questions [0 ])).Run ()
49
58
if err != nil {
50
59
log .Fatal (err )
51
60
}
52
61
62
+ // Trigger an event after getting the project name
63
+ client .Enqueue (posthog.Capture {
64
+ Event : "get_started" ,
65
+ Properties : posthog .NewProperties ().
66
+ Set ("application_name" , m .applicationName ).
67
+ Set ("language" , m .language ),
68
+ })
69
+
53
70
// Copy files immediately after getting the project name
54
71
if err := m .cloneBoilerplates (); err != nil {
55
72
log .Fatal (err )
0 commit comments