A simple command-line tool for logging daily life events with cloud synchronization, interactive dashboard, and offline support.
- π Simple Logging: Quickly log your daily activities with a simple command
- π Cloud Sync: Synchronize your logs across devices using GitHub Gists
- π Interactive Dashboard: Visualize and manage your logs with a rich terminal UI
- π Offline Support: Work seamlessly without internet connection
- π Powerful Search: Find entries by date, content, or tags
- π οΈ Extensible: Easy to add new features and commands
# Clone the repository
git clone https://github.com/yourusername/lg.git
cd lg
# Install dependencies
npm install
# Build the project
npm run build
# Link the CLI globally
npm link
If you're developing the CLI, you can use the included update script to quickly rebuild and relink the tool:
# After making changes to the code
./update-cli.sh
This script will:
- Build the project with TypeScript
- Unlink any existing global installation
- Link the updated package globally
# Initialize the CLI and follow the setup prompts
lg setup
# When asked, enable GitHub Gist sync for cloud storage
# You'll need a GitHub Personal Access Token with 'gist' scope
# Interactive Mode (Recommended)
lg # Directly prompts for a log entry
# Log an entry directly
lg "Had a great day today!"
lg log "Learned something new"
# List all entries (uses local storage by default)
lg list
# Force a full sync with GitHub Gist before listing entries
lg list --sync
# Remove entries
lg remove
# View interactive dashboard
lg dash
# Enable debug logging
lg debug --enable
# Check sync status
lg list --sync
# On your first device
lg setup # Enable GitHub Gist sync during setup
# On additional devices
lg setup # Use the same GitHub token
lg list --sync # Pull all existing entries from the cloud
setup
: Initialize the CLI and configure GitHub Gist synclog
oradd
: Log a life entrylist
orls
: List all logged entriesremove
orrm
: Remove log entries
dashboard
ordash
: Display interactive dashboarddebug
ordbg
: Enable or disable debug logging
The CLI features an interactive mode that makes logging entries easier, especially when dealing with special characters:
$ lg
? Enter your log entry: Meeting with Tom at 9am (might be late) #work
This interactive mode automatically handles special characters without requiring quotes or escaping.
The CLI includes a rich interactive dashboard for visualizing and managing your log entries:
$ lg dash
- Calendar View: Shows days with entries highlighted
- Recent Entries: Lists your most recent log entries
- Tag Statistics: Shows most frequently used tags
- Entry Statistics: Displays metrics about your logging habits
- Quick Entry Form: Add new entries directly from the dashboard
- Use arrow keys to navigate between panels
- Press 'e' to focus on entries panel
- Press 'i' to focus on input panel
- Press ENTER when in input panel to start editing
- Press ESC to exit editing mode
- Press Ctrl+S to save a new entry
- Press q to quit the dashboard
- You'll need a GitHub Personal Access Token with the "gist" scope
- Create one at: https://github.com/settings/tokens
- When prompted during setup, choose "yes" to set up GitHub Gist synchronization
- Paste your GitHub Personal Access Token when prompted
- Every time you add or remove entries, they are automatically synced with your GitHub Gist in the background
- Sync happens without blocking your commands - you can continue using the CLI even without internet
- If you use Life Logger on multiple devices with the same GitHub account, your entries will be synchronized
- When setting up a new device, if the Gist already contains entries, they will be imported automatically
Life Logger works seamlessly offline:
- All operations work locally without requiring an internet connection
- When you're offline, changes are stored locally
- When internet becomes available, background sync will automatically update the remote storage
- Use
lg list --sync
to force a full sync with remote storage when you're back online
- Backup: Your entries are safely stored in your GitHub account
- Multi-device: Access and update your logs from any device
- Private: Gists are created as private by default
- Seamless: Sync happens automatically in the background
- Offline-first: Works without internet, syncs when connection is available
The debug command allows you to control the verbosity of the CLI's logging:
# Show current debug status
lg debug
# Enable debug logging
lg debug --enable
# Disable debug logging
lg debug --disable
# Show current debug status
lg debug --status
When debug logging is enabled, you'll see detailed information about operations like GitHub Gist synchronization, file operations, and more. This can be helpful for troubleshooting issues or understanding how the CLI works internally.
When logging entries directly (non-interactive mode) with special characters like #
, !
, &
, ()
, etc., you must use quotes:
lg "Meeting with Tom at 9am (might be late) #work"
This is because shell interpreters like bash and zsh process special characters before passing arguments to the CLI.
For the easiest experience with special characters, use the interactive mode by simply typing lg
without arguments.
lg/
βββ src/ # Source code
β βββ index.ts # Entry point
β βββ commands/ # Command implementations
β β βββ index.ts # Commands registry
β β βββ [command].ts # Individual command files
β βββ utils/ # Utility functions
β β βββ logger.ts # Logging utilities
β β βββ gistSync.ts # GitHub Gist synchronization
β β βββ ...
β βββ types/ # TypeScript type definitions
βββ dist/ # Compiled JavaScript (generated)
βββ update-cli.sh # Development utility script
βββ package.json # Project metadata and dependencies
βββ README.md # Project documentation
- Create a new file in
src/commands/
(e.g.,mycommand.ts
) - Implement the Command interface
- Register the command in
src/commands/index.ts
- Run
./update-cli.sh
to build and link the updated CLI
To package the CLI for distribution:
# Build the project
npm run build
# Create a tarball
npm pack
# The resulting .tgz file can be installed globally with:
npm install -g lg-0.1.0.tgz
For publishing to npm:
# Build the project
npm run build
# Publish to npm (requires npm account)
npm publish
MIT