npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

weeklyreport-init

v1.0.0

Published

快速初始化周报系统的 Git Hook 配置文件

Downloads

8

Readme

weeklyreport-init

快速初始化周报系统的 Git Hook 配置文件

一个简单的 CLI 工具,用于在项目根目录快速创建 .weeklyreport 配置文件,用于 Git Hook 自动记录提交日志。

安装

全局安装(推荐)

npm install -g weeklyreport-init

或使用本地开发版本:

# 在 packages/weeklyreport-init 目录下
npm link

使用

在你的 Git 项目根目录下运行:

initwork

交互式配置

命令会引导你填写以下信息:

  1. 项目编号 (project_code) - 必填,必须在周报系统中已创建
  2. API 地址 (api_url) - 可选,默认 http://localhost:3000/api/plugins/weekly-report/git-commits
  3. 认证 Token (user_token) - 可选,如果后端启用了认证则需要填写

示例

$ initwork

=== 周报 Git Hook 配置初始化工具 ===

📝 请填写配置信息:

项目编号 (project_code,必填): TOOLBOX
API 地址 (默认: http://localhost:3000/api/plugins/weekly-report/git-commits): 
认证 Token (可选,直接回车跳过): 

✅ 配置文件已创建: /path/to/project/.weeklyreport

📋 配置内容:
{
  "project_code": "TOOLBOX",
  "api_url": "http://localhost:3000/api/plugins/weekly-report/git-commits",
  "user_token": "",
  "_comment": "项目编号必须在周报系统中已存在。user_token 可选,如果后端启用了认证则需要填写。"
}

🎉 初始化完成!

📌 后续步骤:
   1. 确保周报系统中已创建对应的项目(项目编号: TOOLBOX)
   2. 如果还未安装 Git Hook,请运行安装脚本
   3. 提交代码测试: git commit -m "test"

生成的配置文件

.weeklyreport 文件格式:

{
  "project_code": "YOUR_PROJECT_CODE",
  "api_url": "http://localhost:3000/api/plugins/weekly-report/git-commits",
  "user_token": "",
  "_comment": "项目编号必须在周报系统中已存在。user_token 可选,如果后端启用了认证则需要填写。"
}

字段说明

| 字段 | 必填 | 说明 | |------|------|------| | project_code | ✅ | 项目编号,必须在周报系统中已创建 | | api_url | ✅ | 周报系统 API 地址,本地开发通常是 http://localhost:3000/... | | user_token | ❌ | Bearer Token,如果后端启用了认证则需要填写 |

特性

  • 交互式配置 - 引导式填写配置信息
  • 防覆盖保护 - 检测已有配置文件,询问是否覆盖
  • Git 仓库检测 - 自动检测是否在 Git 仓库中
  • 彩色输出 - 友好的终端提示信息
  • 跨平台支持 - Windows、Linux、Mac 通用
  • 零依赖 - 仅使用 Node.js 内置模块

配合使用

此工具是周报 Git Hook 系统的一部分,完整流程:

  1. 安装全局 Git Hook(一次性)

    # Windows
    .\doc\weekly-report\git-hooks\install.ps1
       
    # Linux/Mac
    ./doc/weekly-report/git-hooks/install.sh
  2. 为每个项目初始化配置(每个项目一次)

    cd /path/to/your-project
    initwork
  3. 正常提交代码

    git add .
    git commit -m "feat: new feature"
    # ✅ Git 提交已记录到周报系统:YOUR_PROJECT @ abc123
  4. 在周报工具中查看

    • 打开工作日历
    • 选择日期
    • 查看当天的 Git 提交记录

卸载

npm uninstall -g weeklyreport-init

或取消本地链接:

npm unlink weeklyreport-init

故障排查

命令找不到

确保全局安装成功:

npm list -g weeklyreport-init

或检查全局 bin 目录是否在 PATH 中:

npm bin -g

权限错误

Windows 以管理员运行 PowerShell:

npm install -g weeklyreport-init

Linux/Mac 使用 sudo:

sudo npm install -g weeklyreport-init

配置文件位置错误

确保在项目根目录运行 initwork 命令,配置文件会创建在当前工作目录下。

许可

MIT

相关链接


开发者: GitHub Copilot
版本: 1.0.0
更新日期: 2025-11-04