Skip to content

refactor(cli): rename init command to auth and add new init orchestrator#157

Merged
AnnatarHe merged 1 commit intomainfrom
refactor/rename-init-to-auth-and-add-init-command
Dec 25, 2025
Merged

refactor(cli): rename init command to auth and add new init orchestrator#157
AnnatarHe merged 1 commit intomainfrom
refactor/rename-init-to-auth-and-add-init-command

Conversation

@AnnatarHe
Copy link
Copy Markdown
Contributor

Summary

  • Rename existing init command to auth for clearer naming
  • Add new init command that orchestrates full setup:
    1. Authenticates with shelltime.xyz
    2. Installs shell hooks (bash, zsh, fish)
    3. Installs daemon service

Test plan

  • Run shelltime auth --help to verify auth command works
  • Run shelltime init --help to verify init command works
  • Run shelltime init to test full initialization flow

🤖 Generated with Claude Code

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>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @AnnatarHe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the command-line interface for shelltime.xyz by clarifying command responsibilities. It renames the previous init command to auth for better semantic meaning, and introduces a new init command that serves as a comprehensive orchestrator for the entire shelltime setup, guiding users through authentication, shell hook installation, and daemon service setup in a single, streamlined flow.

Highlights

  • Command Renaming: The existing init command has been renamed to auth to more accurately reflect its purpose of handling authentication with shelltime.xyz.
  • New Initialization Orchestrator: A new init command has been introduced which orchestrates the complete setup process, including authentication, installation of shell hooks, and daemon service installation, providing a streamlined user experience.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@AnnatarHe AnnatarHe merged commit 5373104 into main Dec 25, 2025
2 checks passed
@AnnatarHe AnnatarHe deleted the refactor/rename-init-to-auth-and-add-init-command branch December 25, 2025 10:13
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 25, 2025

Codecov Report

❌ Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
commands/init.go 0.00% 10 Missing ⚠️
cmd/cli/main.go 0.00% 1 Missing ⚠️
Flag Coverage Δ
unittests 19.19% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
commands/auth.go 0.00% <ø> (ø)
cmd/cli/main.go 0.00% <0.00%> (ø)
commands/init.go 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the CLI commands by renaming the old init command to auth for clarity and introducing a new init command that serves as an orchestrator for the entire setup process. This is a great improvement for user experience, making the initial setup more straightforward. The changes are well-structured. My review includes suggestions to enhance the new init command by adding tracing for better observability and improving error handling to make debugging easier.

Comment thread commands/init.go
Comment on lines +22 to +42
func commandInit(c *cli.Context) error {
color.Yellow.Println("Initializing ShellTime...")

// Step 1: Authenticate
if err := commandAuth(c); err != nil {
return err
}

// Step 2: Install shell hooks
if err := commandHooksInstall(c); err != nil {
return err
}

// Step 3: Install daemon service
if err := commandDaemonInstall(c); err != nil {
return err
}

color.Green.Println("ShellTime is fully initialized and ready to use!")
return nil
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

For better observability and error diagnosis, I suggest two improvements to the commandInit function:

  1. Add Tracing: Introduce an OpenTelemetry trace span for the entire init command. This will group the authentication, hook installation, and daemon installation steps under a single trace, which is great for monitoring and debugging performance.

  2. Error Wrapping: Wrap the errors returned from each step with fmt.Errorf. This adds context to the error messages, making it much clearer which part of the initialization process failed. For example, instead of a generic error, you'd see authentication failed: <original error>.

func commandInit(c *cli.Context) error {
	ctx, span := commandTracer.Start(c.Context, "init")
	defer span.End()
	c.Context = ctx

	color.Yellow.Println("Initializing ShellTime...")

	// Step 1: Authenticate
	if err := commandAuth(c); err != nil {
		return fmt.Errorf("authentication failed: %w", err)
	}

	// Step 2: Install shell hooks
	if err := commandHooksInstall(c); err != nil {
		return fmt.Errorf("shell hooks installation failed: %w", err)
	}

	// Step 3: Install daemon service
	if err := commandDaemonInstall(c); err != nil {
		return fmt.Errorf("daemon service installation failed: %w", err)
	}

	color.Green.Println("ShellTime is fully initialized and ready to use!")
	return nil
}

Comment thread commands/init.go
Comment on lines +3 to +6
import (
"github.com/gookit/color"
"github.com/urfave/cli/v2"
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To support error wrapping in commandInit, the fmt package needs to be imported. This will be used to provide more descriptive error messages if any of the initialization steps fail.

Suggested change
import (
"github.com/gookit/color"
"github.com/urfave/cli/v2"
)
import (
"fmt"
"github.com/gookit/color"
"github.com/urfave/cli/v2"
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant