Skip to content

feat(cli): add config view command with JSON output support#192

Merged
AnnatarHe merged 4 commits intomainfrom
feat/config-view-command
Jan 4, 2026
Merged

feat(cli): add config view command with JSON output support#192
AnnatarHe merged 4 commits intomainfrom
feat/config-view-command

Conversation

@AnnatarHe
Copy link
Copy Markdown
Contributor

Summary

  • Add new shelltime config view command to display current configuration
  • Support table (default) and JSON output formats via --format/-f flag
  • Table format masks sensitive token fields for security, JSON provides full values for machine processing

Test plan

  • Build passes: go build ./...
  • Tested shelltime config view (table output with masked tokens)
  • Tested shelltime config view -f json (JSON output)
  • Verified --help displays correctly

🤖 Generated with Claude Code

Add a new `config view` subcommand to display the current configuration.
Supports both table (default) and JSON output formats via --format/-f flag.
Table format masks sensitive token fields for security.

🤖 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 enhances the CLI by adding a new config view command, allowing users to inspect the current configuration. It provides two distinct output options: a human-readable table that intelligently masks sensitive information, and a machine-readable JSON output for integration with other tools. This feature significantly improves transparency and manageability of the application's settings.

Highlights

  • New config view command: Introduced a new shelltime config view command to display the current application configuration.
  • Flexible Output Formats: The command supports both table (default) and json output formats, controlled via the --format or -f flag.
  • Sensitive Data Handling: The table output format automatically masks sensitive token fields for security, while the json format provides full values for machine processing.
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.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 4, 2026

Codecov Report

❌ Patch coverage is 2.22222% with 88 lines in your changes missing coverage. Please review.

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

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% <ø> (ø)
commands/dotfiles.go 0.00% <ø> (ø)
commands/grep.go 0.00% <ø> (ø)
commands/query.go 86.53% <ø> (ø)
daemon/socket.go 64.28% <100.00%> (+48.06%) ⬆️
cmd/cli/main.go 0.00% <0.00%> (ø)
commands/config_view.go 0.00% <0.00%> (ø)

... and 20 files with indirect coverage changes

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

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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 introduces a new shelltime config view command, which is a great addition for inspecting the current configuration. The implementation supports both table and JSON output, with token masking in the table view for security. The code is well-structured. I've found a couple of areas for improvement: one related to platform-independent path construction, and a minor simplification in the logic for identifying sensitive fields. Overall, this is a solid feature addition.

Comment thread commands/config_view.go
ctx, span := commandTracer.Start(c.Context, "config.view", trace.WithSpanKind(trace.SpanKindClient))
defer span.End()

SetupLogger(os.ExpandEnv("$HOME/" + model.COMMAND_BASE_STORAGE_FOLDER))
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

Hardcoding the path separator / and using os.ExpandEnv("$HOME") is not platform-independent. According to the repository's general rules, you should use os.UserHomeDir() to get the user's home directory and filepath.Join to construct paths. This will ensure your code works correctly across different operating systems like Windows.

Here's a suggested implementation:

homeDir, err := os.UserHomeDir()
if err != nil {
	return fmt.Errorf("could not determine home directory: %w", err)
}
logPath := filepath.Join(homeDir, model.COMMAND_BASE_STORAGE_FOLDER)
SetupLogger(logPath)

You'll need to import the path/filepath package.

References
  1. For platform-independent paths, use filepath.Join to combine segments and os.UserHomeDir() to get the home directory, rather than hardcoding path separators or environment variables like $HOME.

Comment thread commands/config_view.go
value := field.String()
if value == "" {
value = "<empty>"
} else if strings.Contains(fullKey, "token") || strings.Contains(strings.ToLower(fullKey), "token") {
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

The first condition strings.Contains(fullKey, "token") is redundant. The second condition strings.Contains(strings.ToLower(fullKey), "token") already performs a case-insensitive check for "token", which covers the first case as well. You can simplify this line by removing the redundant check.

Suggested change
} else if strings.Contains(fullKey, "token") || strings.Contains(strings.ToLower(fullKey), "token") {
} else if strings.Contains(strings.ToLower(fullKey), "token") {

AnnatarHe and others added 2 commits January 4, 2026 14:11
Swap GetCachedCost() and NotifyActivity() call order to ensure
activeRanges is populated before the timer goroutine runs
fetchActiveRanges(). Also add debug log for cc_info socket events.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Release-As: 0.1.53
@AnnatarHe AnnatarHe merged commit f403167 into main Jan 4, 2026
2 of 3 checks passed
@AnnatarHe AnnatarHe deleted the feat/config-view-command branch January 4, 2026 06:15
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