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

devlog-cli

v0.3.0

Published

A CLI tool to automatically log git commits to your draft log API

Readme

u# devlog CLI Tool

A command-line tool that automatically logs git commit messages to your Draft Log API. Perfect for tracking development progress and maintaining a detailed work log.

Features

  • 🔧 Easy Configuration: One-time setup with devlog config
  • 🔄 Git Integration: Works seamlessly with git hooks
  • 📝 Automatic Logging: Logs commit messages with optional commit hashes
  • 🎛️ Flexible Usage: Manual logging with custom messages and dates
  • 🏠 Local Config: Stores configuration securely in ~/.config/devlog.json

Installation

Option 1: Global Installation (Recommended)

# Install globally to use devlog from anywhere
npm install -g devlog-cli

Option 2: Local Installation

# Clone/download the files to a directory
# Navigate to the directory containing devlog.js and package.json
npm install
npm link  # Makes devlog available globally

Option 3: Direct Usage

# Make the script executable
chmod +x devlog.js

# Use directly (requires node-fetch)
npm install node-fetch
./devlog.js

Setup

1. Configure devlog

First, you need to configure your API key and preferences:

devlog config

This will prompt you for:

  • API Key: Your Draft Log API key (generate one by POST to /api/users/api-key)
  • API Base URL: The base URL for your API (default: http://localhost:3001)
  • Include Commit Hash: Whether to include short commit hashes in logs
  • Include Date: Whether to include dates in log entries

2. Set up Git Hook (Easy Way)

Use the built-in install command to automatically set up the post-commit hook:

# Navigate to your git repository
cd /path/to/your/repo

# Install the post-commit hook
devlog install

# If you already have a post-commit hook and want to replace it:
devlog install --force

2. Set up Git Hook (Manual Way)

Alternatively, you can manually set up the post-commit hook:

# Navigate to your git repository
cd /path/to/your/repo

# Copy the post-commit hook
cp post-commit .git/hooks/

# Make it executable
chmod +x .git/hooks/post-commit

Or create the hook manually:

# Create the hook file
cat > .git/hooks/post-commit << 'EOF'
#!/bin/bash
if command -v devlog &> /dev/null && [ -f "$HOME/.config/devlog.json" ]; then
    echo "📝 Logging commit to devlog..."
    devlog
fi
EOF

# Make it executable
chmod +x .git/hooks/post-commit

Usage

Basic Commands

# Log the last git commit message
devlog

# Configure or reconfigure settings
devlog config

# Install post-commit hook in current git repository
devlog install

# Install hook with force (backup existing hook)
devlog install --force

# Log a custom message
devlog log "Fixed critical bug in payment processing"

# Log a custom message with specific date
devlog log "Started new feature" 2025-06-24

# Show help
devlog help

Examples

# Set up devlog in a new project
cd my-project
devlog config
devlog install

# After making commits, they'll be logged automatically
git commit -m "Add user authentication"
# Output: 📝 Logging commit to devlog...
#         ✅ Successfully logged to devlog

# Log work that wasn't committed
devlog log "Researched new framework options"

# Log work from a previous date
devlog log "Attended team meeting" 2025-06-23

Configuration File

The configuration is stored in ~/.config/devlog.json:

{
  "apiKey": "your-api-key-here",
  "apiBaseUrl": "http://localhost:3001",
  "includeCommitHash": true,
  "includeDate": true
}

Configuration Options

  • apiKey: Your API key for authentication
  • apiBaseUrl: Base URL for the Draft Log API
  • includeCommitHash: Include short commit hash (8 chars) in log entries
  • includeDate: Include current date in API requests

Git Hook Integration

When the post-commit hook is installed, every git commit will automatically:

  1. Check if devlog is available
  2. Check if devlog is configured
  3. Get the commit message from the last commit
  4. Format it according to your preferences
  5. Send it to your Draft Log API

Sample Log Entries

With commit hash enabled:

[a1b2c3d4] Add user authentication feature
[e5f6g7h8] Fix memory leak in data processing

Without commit hash:

Add user authentication feature
Fix memory leak in data processing

API Integration

The tool integrates with your Draft Log API using these endpoints:

  • Generate API Key: POST /api/users/api-key
  • Append to Log: POST /api/logs/append

API Request Format

{
  "text": "Commit message or custom text",
  "date": "2025-06-24"  // optional, defaults to today
}

Troubleshooting

Common Issues

  1. "devlog command not found"

    • Make sure devlog is installed globally or linked
    • Try reinstalling: npm install -g devlog-cli
  2. "No API key found"

    • Run devlog config to set up your configuration
    • Check that ~/.config/devlog.json exists and contains your API key
  3. "Error getting last commit message"

    • Make sure you're in a git repository
    • Ensure you have at least one commit
    • Check git is working: git log -1 --oneline
  4. "API request failed"

    • Verify your API key is correct
    • Check that your API server is running
    • Verify the API base URL in your config

Debug Mode

For debugging, you can manually check your configuration:

cat ~/.config/devlog.json

And test your git integration:

git log -1 --pretty=%B  # Should show last commit message

Development

To contribute or modify the tool:

# Clone the repository
git clone <repository-url>
cd devlog-cli

# Install dependencies
npm install

# Test locally
./devlog.js help

# Install globally for testing
npm install -g .

License

MIT License - feel free to use and modify as needed.