mirror of
https://github.com/lukaszraczylo/git-velocity.git
synced 2026-06-16 03:22:47 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6fd9cbf452 | |||
| 83a9c7acdf | |||
| a351eb16f7 | |||
| 44db2be8cc |
@@ -73,17 +73,3 @@ dockers_v2:
|
||||
extra_files:
|
||||
- config.example.yaml
|
||||
|
||||
brews:
|
||||
- name: git-velocity
|
||||
repository:
|
||||
owner: lukaszraczylo
|
||||
name: homebrew-tap
|
||||
token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"
|
||||
directory: Formula
|
||||
homepage: https://github.com/lukaszraczylo/git-velocity
|
||||
description: "Developer velocity metrics analyzer with gamification dashboards"
|
||||
license: MIT
|
||||
install: |
|
||||
bin.install "git-velocity"
|
||||
test: |
|
||||
system "#{bin}/git-velocity", "version"
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Lukasz Raczylo
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -53,6 +53,7 @@ $ git-velocity serve --port 8080
|
||||
- **34 Achievements**: From "First Steps" to "Code Warrior"
|
||||
- **Leaderboards**: Compete with your team
|
||||
- **Tier Progression**: Bronze → Silver → Gold → Diamond
|
||||
- **General velocity chart**: Visualize your velocity over time
|
||||
|
||||
### 👥 Team Analytics
|
||||
- Configure teams and see aggregated metrics
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/lukaszraczylo/git-velocity/internal/app"
|
||||
"github.com/lukaszraczylo/git-velocity/internal/server"
|
||||
"github.com/lukaszraczylo/git-velocity/pkg/version"
|
||||
)
|
||||
|
||||
var (
|
||||
configPath string
|
||||
outputDir string
|
||||
verbose bool
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := newRootCmd().Execute(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func newRootCmd() *cobra.Command {
|
||||
rootCmd := &cobra.Command{
|
||||
Use: "git-velocity",
|
||||
Short: "Analyze Git repositories for developer velocity metrics",
|
||||
Long: `Git Velocity Analyser - Track developer activity,
|
||||
generate beautiful dashboards, and gamify contributions.
|
||||
|
||||
This tool analyzes GitHub repositories to generate velocity metrics,
|
||||
including commits, pull requests, code reviews, and more. It creates
|
||||
static HTML dashboards with charts and gamification features.`,
|
||||
}
|
||||
|
||||
// Global flags
|
||||
rootCmd.PersistentFlags().StringVarP(&configPath, "config", "c",
|
||||
"config.yaml", "Path to configuration file")
|
||||
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v",
|
||||
false, "Enable verbose output")
|
||||
|
||||
// Add subcommands
|
||||
rootCmd.AddCommand(newAnalyzeCmd())
|
||||
rootCmd.AddCommand(newServeCmd())
|
||||
rootCmd.AddCommand(newVersionCmd())
|
||||
|
||||
return rootCmd
|
||||
}
|
||||
|
||||
func newAnalyzeCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "analyze",
|
||||
Short: "Analyze repositories and generate dashboard",
|
||||
Long: `Analyze the configured repositories and generate a static HTML dashboard.
|
||||
|
||||
This command will:
|
||||
1. Fetch data from the configured GitHub repositories
|
||||
2. Calculate velocity metrics for each contributor
|
||||
3. Generate scores and achievements
|
||||
4. Create a static HTML site with charts and leaderboards`,
|
||||
RunE: runAnalyze,
|
||||
}
|
||||
|
||||
cmd.Flags().StringVarP(&outputDir, "output", "o",
|
||||
"./dist", "Output directory for generated site")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func newServeCmd() *cobra.Command {
|
||||
var port string
|
||||
var dir string
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "serve",
|
||||
Short: "Start local preview server",
|
||||
Long: `Start a local HTTP server to preview the generated dashboard.
|
||||
|
||||
This is useful for testing the generated site before deployment.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runServe(dir, port)
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().StringVarP(&dir, "directory", "d",
|
||||
"./dist", "Directory to serve")
|
||||
cmd.Flags().StringVarP(&port, "port", "p",
|
||||
"8080", "Port to listen on")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func newVersionCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print version information",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Printf("git-velocity %s\n", version.Version)
|
||||
fmt.Printf("commit: %s\n", version.Commit)
|
||||
fmt.Printf("built: %s\n", version.BuildDate)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func runAnalyze(cmd *cobra.Command, args []string) error {
|
||||
// Create and run the application
|
||||
application, err := app.New(configPath, outputDir, verbose)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to initialize application: %w", err)
|
||||
}
|
||||
|
||||
return application.Run(cmd.Context())
|
||||
}
|
||||
|
||||
func runServe(dir, port string) error {
|
||||
srv := server.New(dir, port)
|
||||
|
||||
fmt.Printf("Starting preview server at http://localhost:%s\n", port)
|
||||
fmt.Printf("Serving directory: %s\n", dir)
|
||||
fmt.Println("Press Ctrl+C to stop")
|
||||
|
||||
return srv.Start()
|
||||
}
|
||||
Reference in New Issue
Block a user