Welcome to DevHub CLI – a powerful command-line interface designed to help developers capture, organize, and retrieve their development insights effortlessly. Whether it's a tricky bug fix, a crucial architectural decision, a handy cheatsheet, or a brilliant new idea, DevHub CLI ensures your knowledge is always at your fingertips, stored locally and seamlessly synced with Notion.
DevHub CLI is built for a smooth developer experience, offering:
- Interactive Logging (
dh log): Guided prompts to quickly document various types of entries (BUG, DECISION, CHEATSHEET, IDEA, PROCESS). - Smart Search (
dh find): Search entries by keywords, tags, and types. Results are presented in an interactive list. - Interactive List (
dh list): View your most recent entries in an interactive list. - Seamless Actions: From the interactive search/list results, you can directly:
- View Content (
dh view): Render full entry content as formatted Markdown directly in your terminal. - Update Entries (
dh update): Edit existing entries with pre-filled prompts. - Delete Entries (
dh delete): Remove entries locally and archive them in Notion with a confirmation prompt. - Open in Notion (
dh open-notion): Instantly jump to the corresponding Notion page in your browser or desktop app.
- View Content (
- Local-First Storage: All entries are stored as JSON files locally, ensuring data ownership and offline access.
- Notion Integration: Automatically syncs your entries to a Notion database, providing a rich web interface and collaborative features.
- Markdown Support: Content fields support Markdown, which is rendered beautifully in the terminal and Notion.
Follow these steps to set up and start using DevHub CLI.
- Python 3.10+
- A Notion account
- A Notion Integration Token
- A Notion Database ID
git clone https://github.com/iamvusumzi/devhub.git
cd devhubIt's recommended to use a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: `venv\Scripts\activate`
pip install -r requirements.txtCreate a .env file in the root of your devhub-api directory with the following variables:
NOTION_TOKEN="secret_YOUR_NOTION_INTEGRATION_TOKEN"
NOTION_DATABASE_ID="YOUR_NOTION_DATABASE_ID"
Follow these steps to connect DevHub to your Notion workspace.
The integration token allows the DevHub API to communicate with your workspace.
- Go to the Notion My-Integrations page.
- Click the + New integration button.
- Name: Enter "DevHub".
- Workspace: Select the workspace where you want to store your notes.
- Type: Ensure it is set to Internal Integration.
- Click Submit.
- Under the Secrets tab, click Show and copy the Internal Integration Secret.
Note: This is your
NOTION_TOKEN. Keep it private and never commit it to version control.
By default, your new integration has zero permissions. You must explicitly invite it to your database.
- Open the specific Notion Database you created for DevHub.
- Click the three dots (...) in the top-right corner of the page.
- Scroll down to Connect to (or Add connections).
- Search for your integration name ("DevHub").
- Select it and click Confirm.
Every Notion database has a unique identifier hidden in its URL.
- Open your database in a web browser.
- Examine the URL. It will look similar to this:
https://www.notion.so/myworkspace/86433384f447ed84390e9e4239e050?v=... - The Database ID is the 32-character string between the last slash (
/) and the question mark (?).- In the example above, the ID is:
86433384f447ed84390e9e4239e050
- In the example above, the ID is:
- Copy this string and add it to your
.envfile.
Your Notion database needs specific properties for DevHub CLI to function correctly. Create a new database (or use an existing one) and add the following properties:
- Name:
Title(Type:Title) - This is usually the default title property. - Type:
Select(Options:BUG,DECISION,CHEATSHEET,IDEA,PROCESS) - Project:
Select - Tags:
Multi-select - DevHub ID:
Rich text- Crucial for syncing and updating!
The CLI communicates with a local FastAPI server. Start it in a dedicated terminal:
python api/main.pyYou should see output indicating the server is running on http://127.0.0.1:8000.
If you have existing Notion pages that you want to link to your local DevHub entries (or vice-versa), run the migration script. This will backfill the DevHub ID property in Notion pages based on their titles.
python scripts/migrate_notion_ids.pyAll commands are accessed via the dh executable.
dh logThis will start an interactive prompt to guide you through creating a new entry.
Search by keyword, tags, or type. The results are interactive.
dh find "API hang" --type BUG --tag python
# Or just a keyword:
dh find "recursion error"dh list
# List more entries:
dh list --limit 10View the full content of an entry by its ID. (Often used after dh find or dh list.)
dh view <entry_id>Edit an existing entry by its ID. Prompts will be pre-filled with current data.
dh update <entry_id>Permanently remove an entry from local storage and archive it in Notion. Requires confirmation.
dh delete <entry_id>Open the corresponding Notion page in your browser or desktop app.
dh open-notion <entry_id>Contributions are welcome! Feel free to open issues or pull requests.
Enjoy your enhanced development workflow with DevHub CLI!