$ show hellodigua/code996
This repository implements a CLI tool that analyzes Git commit timestamps to infer project work intensity and detect overtime patterns, computing a '996 index' and classifying project type (corporate vs open-source). The tool runs locally, collects git log data, and outputs terminal reports, web reports (Vue 3 + chart.xkcd), JSON, or Markdown. It supports single-repo, multi-repo, and team analysis, with timezone detection, Chinese holiday awareness, and anonymous benchmarking. The architecture is modular: a core algorithm layer (work time detection, overtime analysis, project classification) is separate from the CLI orchestration, git data collection, and output formatting. The codebase demonstrates strong engineering practices: TypeScript throughout, comprehensive unit/integration tests (Jest, Vitest), i18n with type safety, CI/CD via GitHub Actions, and a clean separation of concerns that allows individual algorithm modules to be extracted and reused. The web report generator produces self-contained static HTML, and the benchmark builder implements privacy-preserving data export. Overall, it is a well-crafted, production-quality tool with high reuse potential.
The LLM identified 6 files worth highlighting for reuse:
Detects work time windows from daily first-commit timestamps using a quantile-based approach (10%-20% percentile). This is a self-contained, non-trivial algorithm that can be reused in any time-based pattern detection system (e.g., analyzing employee working hours from system logs). It demonstrates skill in robust heuristic design with confidence scoring.
Centralized i18n module with locale resolution from OS, environment, CLI args, and fallback to 'en'. Provides type-safe message lookup (key->string) with compile-time checks via generated types. This pattern is cleanly extractable for any multi-locale application and demonstrates good separation of concerns.
Provides a pure function to compute percentiles from a sorted array of numbers. Implements the standard linear interpolation method. Simple, well-documented, and directly reusable in any data analysis project. Exemplifies clean utility extraction.
Parses `git log` output into structured commit objects (timestamp, timezone offset, etc.) using a carefully crafted format string and regex. Handles edge cases like timezone offsets. This module is isolated and can be reused in any Node.js tool that needs to extract commit metadata from git history.
Generates a self-contained web report by copying pre-built static assets (Vue app) and injecting report data into the HTML as a JSON script tag. Implements safe serialization with cross-origin removal and inlining of module scripts. This pattern is reusable for any CLI tool that wants to produce an interactive offline report.
Creates temporary Git repositories with controlled commit histories for integration testing. Supports customizable commit timestamps, authors, branches, and merge commits. This utility is directly reusable in any project that needs to test git-dependent functionality without relying on real repositories.