Skip to content

Commit cdb6faf

Browse files
AnnatarHeclaude
andcommitted
refactor(cli): rename init command to auth and add new init orchestrator
Rename the existing `init` command to `auth` for clearer naming, and create a new `init` command that orchestrates full setup by calling auth, hooks install, and daemon install in sequence. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 592954d commit cdb6faf

3 files changed

Lines changed: 45 additions & 2 deletions

File tree

cmd/cli/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ func main() {
9393
}
9494

9595
app.Commands = []*cli.Command{
96+
commands.InitCommand,
9697
commands.AuthCommand,
9798
commands.TrackCommand,
9899
commands.GCCommand,

commands/auth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
)
1818

1919
var AuthCommand *cli.Command = &cli.Command{
20-
Name: "init",
21-
Usage: "init your shelltime.xyz config",
20+
Name: "auth",
21+
Usage: "Authenticate with shelltime.xyz",
2222
Flags: []cli.Flag{
2323
&cli.StringFlag{
2424
Name: "token",

commands/init.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package commands
2+
3+
import (
4+
"github.com/gookit/color"
5+
"github.com/urfave/cli/v2"
6+
)
7+
8+
var InitCommand *cli.Command = &cli.Command{
9+
Name: "init",
10+
Usage: "Initialize shelltime: authenticate, install hooks, and start daemon",
11+
Flags: []cli.Flag{
12+
&cli.StringFlag{
13+
Name: "token",
14+
Aliases: []string{"t"},
15+
Usage: "Authentication token",
16+
Required: false,
17+
},
18+
},
19+
Action: commandInit,
20+
}
21+
22+
func commandInit(c *cli.Context) error {
23+
color.Yellow.Println("Initializing ShellTime...")
24+
25+
// Step 1: Authenticate
26+
if err := commandAuth(c); err != nil {
27+
return err
28+
}
29+
30+
// Step 2: Install shell hooks
31+
if err := commandHooksInstall(c); err != nil {
32+
return err
33+
}
34+
35+
// Step 3: Install daemon service
36+
if err := commandDaemonInstall(c); err != nil {
37+
return err
38+
}
39+
40+
color.Green.Println("ShellTime is fully initialized and ready to use!")
41+
return nil
42+
}

0 commit comments

Comments
 (0)