dev-log-cli 3.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Satyaa & Clawdy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: dev-log-cli
3
+ Version: 3.0.0
4
+ Summary: A minimalist developer journaling CLI.
5
+ Author-email: Satyaa <satyaa@openclaw.ai>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/CrimsonDevil333333/dev-log-cli
8
+ Project-URL: Bug Tracker, https://github.com/CrimsonDevil333333/dev-log-cli/issues
9
+ Keywords: journal,cli,developer,productivity,sqlite
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: typer
18
+ Requires-Dist: rich
19
+ Requires-Dist: sqlite-utils
20
+ Dynamic: license-file
21
+
22
+ # DevLog CLI 🦞 v3.0
23
+
24
+ ![License](https://img.shields.io/badge/license-MIT-blue.svg)
25
+ ![Python](https://img.shields.io/badge/python-3.8%2B-blue.svg)
26
+
27
+ **DevLog** is a minimalist developer journaling CLI tool designed to help you keep track of your daily work, bugs, and ideas without leaving your terminal. Built with ❤️ by **Satyaa & Clawdy**.
28
+
29
+ ## New in v3.0 🚀
30
+
31
+ * **Interactive Editing:** Use `devlog edit <id>` to update any field of a log entry.
32
+ * **Deletion:** Safely remove entries with `devlog delete <id>` (includes confirmation).
33
+ * **Detailed View:** Use `devlog view <id>` for a beautiful, full-width display of a single entry.
34
+ * **Enhanced Status System:**
35
+ * Standardized statuses: `pending`, `completed`, `in-progress`, `none`.
36
+ * Custom status support during `add` and `edit`.
37
+ * **Status Summary:** The `list` command now shows a breakdown of statuses for the logs in view.
38
+ * **Stats Filtering:** Filter your activity metrics by project using `devlog stats --project <name>`.
39
+ * **Improved Search UI:** Search results are now more readable and detailed.
40
+
41
+ ## Features 🌟
42
+
43
+ * **Fast Logging:** Add logs quickly with a single command.
44
+ * **Interactive Mode:** Don't like flags? Just run `devlog add` and type away.
45
+ * **Tagging:** Organize entries with tags (e.g., `bug`, `feature`, `meeting`).
46
+ * **Powerful Search:** Full-text search to find that one command you forgot.
47
+ * **Stats & Analytics:** View your logging habits, top tags, and activity heatmap.
48
+ * **Export:** Export your data to Markdown or JSON for backups or reports.
49
+ * **Beautiful TUI:** Powered by `rich` for a pleasant visual experience.
50
+
51
+ ## Installation 📦
52
+
53
+ It is recommended to use a virtual environment:
54
+
55
+ ```bash
56
+ git clone https://github.com/satyaa/dev-log-cli.git
57
+ cd dev-log-cli
58
+ python3 -m venv .venv
59
+ source .venv/bin/activate
60
+ pip install .
61
+ ```
62
+
63
+ Or for development:
64
+
65
+ ```bash
66
+ pip install -e .
67
+ ```
68
+
69
+ ## Usage 🛠️
70
+
71
+ ### 1. Add a Log
72
+ Quick one-liner:
73
+ ```bash
74
+ devlog add "Fixed the infinite loop" --tags bug,fix --project api-server --status completed
75
+ ```
76
+
77
+ Or interactive mode:
78
+ ```bash
79
+ devlog add
80
+ # Prompts you for content, tags, project, and status
81
+ ```
82
+
83
+ ### 2. List & View Logs
84
+ View recent entries:
85
+ ```bash
86
+ devlog list
87
+ ```
88
+
89
+ View a specific entry in detail:
90
+ ```bash
91
+ devlog view 42
92
+ ```
93
+
94
+ Filter by tag, project, or status:
95
+ ```bash
96
+ devlog list --tag bug
97
+ devlog list --project my-app
98
+ devlog list --status pending
99
+ ```
100
+
101
+ ### 3. Edit & Delete
102
+ Modify an existing entry:
103
+ ```bash
104
+ devlog edit 42
105
+ ```
106
+
107
+ Delete an entry:
108
+ ```bash
109
+ devlog delete 42
110
+ ```
111
+
112
+ ### 4. Search
113
+ Find something specific across content, tags, project, or status:
114
+ ```bash
115
+ devlog search "login"
116
+ ```
117
+
118
+ ### 5. Stats
119
+ See your productivity stats and activity heatmap:
120
+ ```bash
121
+ devlog stats
122
+ devlog stats --project api-server
123
+ ```
124
+
125
+ ### 6. Sync & Backup
126
+ Backup your logs to a local folder or a private git repository:
127
+ ```bash
128
+ devlog sync --path ~/backups/devlog
129
+ devlog sync --repo https://github.com/username/my-private-devlogs.git
130
+ ```
131
+
132
+ ### 7. Export
133
+ Export your data:
134
+ ```bash
135
+ devlog export --format markdown --output my_journal.md
136
+ ```
137
+
138
+ ## License 📄
139
+
140
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
141
+
142
+ ---
143
+ *Maintained by Satyaa & Clawdy*
@@ -0,0 +1,122 @@
1
+ # DevLog CLI 🦞 v3.0
2
+
3
+ ![License](https://img.shields.io/badge/license-MIT-blue.svg)
4
+ ![Python](https://img.shields.io/badge/python-3.8%2B-blue.svg)
5
+
6
+ **DevLog** is a minimalist developer journaling CLI tool designed to help you keep track of your daily work, bugs, and ideas without leaving your terminal. Built with ❤️ by **Satyaa & Clawdy**.
7
+
8
+ ## New in v3.0 🚀
9
+
10
+ * **Interactive Editing:** Use `devlog edit <id>` to update any field of a log entry.
11
+ * **Deletion:** Safely remove entries with `devlog delete <id>` (includes confirmation).
12
+ * **Detailed View:** Use `devlog view <id>` for a beautiful, full-width display of a single entry.
13
+ * **Enhanced Status System:**
14
+ * Standardized statuses: `pending`, `completed`, `in-progress`, `none`.
15
+ * Custom status support during `add` and `edit`.
16
+ * **Status Summary:** The `list` command now shows a breakdown of statuses for the logs in view.
17
+ * **Stats Filtering:** Filter your activity metrics by project using `devlog stats --project <name>`.
18
+ * **Improved Search UI:** Search results are now more readable and detailed.
19
+
20
+ ## Features 🌟
21
+
22
+ * **Fast Logging:** Add logs quickly with a single command.
23
+ * **Interactive Mode:** Don't like flags? Just run `devlog add` and type away.
24
+ * **Tagging:** Organize entries with tags (e.g., `bug`, `feature`, `meeting`).
25
+ * **Powerful Search:** Full-text search to find that one command you forgot.
26
+ * **Stats & Analytics:** View your logging habits, top tags, and activity heatmap.
27
+ * **Export:** Export your data to Markdown or JSON for backups or reports.
28
+ * **Beautiful TUI:** Powered by `rich` for a pleasant visual experience.
29
+
30
+ ## Installation 📦
31
+
32
+ It is recommended to use a virtual environment:
33
+
34
+ ```bash
35
+ git clone https://github.com/satyaa/dev-log-cli.git
36
+ cd dev-log-cli
37
+ python3 -m venv .venv
38
+ source .venv/bin/activate
39
+ pip install .
40
+ ```
41
+
42
+ Or for development:
43
+
44
+ ```bash
45
+ pip install -e .
46
+ ```
47
+
48
+ ## Usage 🛠️
49
+
50
+ ### 1. Add a Log
51
+ Quick one-liner:
52
+ ```bash
53
+ devlog add "Fixed the infinite loop" --tags bug,fix --project api-server --status completed
54
+ ```
55
+
56
+ Or interactive mode:
57
+ ```bash
58
+ devlog add
59
+ # Prompts you for content, tags, project, and status
60
+ ```
61
+
62
+ ### 2. List & View Logs
63
+ View recent entries:
64
+ ```bash
65
+ devlog list
66
+ ```
67
+
68
+ View a specific entry in detail:
69
+ ```bash
70
+ devlog view 42
71
+ ```
72
+
73
+ Filter by tag, project, or status:
74
+ ```bash
75
+ devlog list --tag bug
76
+ devlog list --project my-app
77
+ devlog list --status pending
78
+ ```
79
+
80
+ ### 3. Edit & Delete
81
+ Modify an existing entry:
82
+ ```bash
83
+ devlog edit 42
84
+ ```
85
+
86
+ Delete an entry:
87
+ ```bash
88
+ devlog delete 42
89
+ ```
90
+
91
+ ### 4. Search
92
+ Find something specific across content, tags, project, or status:
93
+ ```bash
94
+ devlog search "login"
95
+ ```
96
+
97
+ ### 5. Stats
98
+ See your productivity stats and activity heatmap:
99
+ ```bash
100
+ devlog stats
101
+ devlog stats --project api-server
102
+ ```
103
+
104
+ ### 6. Sync & Backup
105
+ Backup your logs to a local folder or a private git repository:
106
+ ```bash
107
+ devlog sync --path ~/backups/devlog
108
+ devlog sync --repo https://github.com/username/my-private-devlogs.git
109
+ ```
110
+
111
+ ### 7. Export
112
+ Export your data:
113
+ ```bash
114
+ devlog export --format markdown --output my_journal.md
115
+ ```
116
+
117
+ ## License 📄
118
+
119
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
120
+
121
+ ---
122
+ *Maintained by Satyaa & Clawdy*
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: dev-log-cli
3
+ Version: 3.0.0
4
+ Summary: A minimalist developer journaling CLI.
5
+ Author-email: Satyaa <satyaa@openclaw.ai>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/CrimsonDevil333333/dev-log-cli
8
+ Project-URL: Bug Tracker, https://github.com/CrimsonDevil333333/dev-log-cli/issues
9
+ Keywords: journal,cli,developer,productivity,sqlite
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: typer
18
+ Requires-Dist: rich
19
+ Requires-Dist: sqlite-utils
20
+ Dynamic: license-file
21
+
22
+ # DevLog CLI 🦞 v3.0
23
+
24
+ ![License](https://img.shields.io/badge/license-MIT-blue.svg)
25
+ ![Python](https://img.shields.io/badge/python-3.8%2B-blue.svg)
26
+
27
+ **DevLog** is a minimalist developer journaling CLI tool designed to help you keep track of your daily work, bugs, and ideas without leaving your terminal. Built with ❤️ by **Satyaa & Clawdy**.
28
+
29
+ ## New in v3.0 🚀
30
+
31
+ * **Interactive Editing:** Use `devlog edit <id>` to update any field of a log entry.
32
+ * **Deletion:** Safely remove entries with `devlog delete <id>` (includes confirmation).
33
+ * **Detailed View:** Use `devlog view <id>` for a beautiful, full-width display of a single entry.
34
+ * **Enhanced Status System:**
35
+ * Standardized statuses: `pending`, `completed`, `in-progress`, `none`.
36
+ * Custom status support during `add` and `edit`.
37
+ * **Status Summary:** The `list` command now shows a breakdown of statuses for the logs in view.
38
+ * **Stats Filtering:** Filter your activity metrics by project using `devlog stats --project <name>`.
39
+ * **Improved Search UI:** Search results are now more readable and detailed.
40
+
41
+ ## Features 🌟
42
+
43
+ * **Fast Logging:** Add logs quickly with a single command.
44
+ * **Interactive Mode:** Don't like flags? Just run `devlog add` and type away.
45
+ * **Tagging:** Organize entries with tags (e.g., `bug`, `feature`, `meeting`).
46
+ * **Powerful Search:** Full-text search to find that one command you forgot.
47
+ * **Stats & Analytics:** View your logging habits, top tags, and activity heatmap.
48
+ * **Export:** Export your data to Markdown or JSON for backups or reports.
49
+ * **Beautiful TUI:** Powered by `rich` for a pleasant visual experience.
50
+
51
+ ## Installation 📦
52
+
53
+ It is recommended to use a virtual environment:
54
+
55
+ ```bash
56
+ git clone https://github.com/satyaa/dev-log-cli.git
57
+ cd dev-log-cli
58
+ python3 -m venv .venv
59
+ source .venv/bin/activate
60
+ pip install .
61
+ ```
62
+
63
+ Or for development:
64
+
65
+ ```bash
66
+ pip install -e .
67
+ ```
68
+
69
+ ## Usage 🛠️
70
+
71
+ ### 1. Add a Log
72
+ Quick one-liner:
73
+ ```bash
74
+ devlog add "Fixed the infinite loop" --tags bug,fix --project api-server --status completed
75
+ ```
76
+
77
+ Or interactive mode:
78
+ ```bash
79
+ devlog add
80
+ # Prompts you for content, tags, project, and status
81
+ ```
82
+
83
+ ### 2. List & View Logs
84
+ View recent entries:
85
+ ```bash
86
+ devlog list
87
+ ```
88
+
89
+ View a specific entry in detail:
90
+ ```bash
91
+ devlog view 42
92
+ ```
93
+
94
+ Filter by tag, project, or status:
95
+ ```bash
96
+ devlog list --tag bug
97
+ devlog list --project my-app
98
+ devlog list --status pending
99
+ ```
100
+
101
+ ### 3. Edit & Delete
102
+ Modify an existing entry:
103
+ ```bash
104
+ devlog edit 42
105
+ ```
106
+
107
+ Delete an entry:
108
+ ```bash
109
+ devlog delete 42
110
+ ```
111
+
112
+ ### 4. Search
113
+ Find something specific across content, tags, project, or status:
114
+ ```bash
115
+ devlog search "login"
116
+ ```
117
+
118
+ ### 5. Stats
119
+ See your productivity stats and activity heatmap:
120
+ ```bash
121
+ devlog stats
122
+ devlog stats --project api-server
123
+ ```
124
+
125
+ ### 6. Sync & Backup
126
+ Backup your logs to a local folder or a private git repository:
127
+ ```bash
128
+ devlog sync --path ~/backups/devlog
129
+ devlog sync --repo https://github.com/username/my-private-devlogs.git
130
+ ```
131
+
132
+ ### 7. Export
133
+ Export your data:
134
+ ```bash
135
+ devlog export --format markdown --output my_journal.md
136
+ ```
137
+
138
+ ## License 📄
139
+
140
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
141
+
142
+ ---
143
+ *Maintained by Satyaa & Clawdy*
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ dev_log_cli.egg-info/PKG-INFO
5
+ dev_log_cli.egg-info/SOURCES.txt
6
+ dev_log_cli.egg-info/dependency_links.txt
7
+ dev_log_cli.egg-info/entry_points.txt
8
+ dev_log_cli.egg-info/requires.txt
9
+ dev_log_cli.egg-info/top_level.txt
10
+ devlog/__init__.py
11
+ devlog/cli.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ devlog = devlog.cli:app
@@ -0,0 +1,3 @@
1
+ typer
2
+ rich
3
+ sqlite-utils
@@ -0,0 +1 @@
1
+ devlog
File without changes
@@ -0,0 +1,464 @@
1
+ import typer
2
+ import os
3
+ import json
4
+ from datetime import datetime
5
+ from collections import Counter
6
+ from rich.console import Console
7
+ from rich.table import Table
8
+ from rich.markdown import Markdown
9
+ from rich.prompt import Prompt, Confirm, IntPrompt
10
+ from rich.panel import Panel
11
+ from rich.live import Live
12
+ from sqlite_utils import Database
13
+ import subprocess
14
+
15
+ app = typer.Typer(help="DevLog: A minimalist developer journaling CLI 🦞")
16
+ console = Console()
17
+
18
+ # Standard Statuses
19
+ STATUS_PENDING = "pending"
20
+ STATUS_COMPLETED = "completed"
21
+ STATUS_IN_PROGRESS = "in-progress"
22
+ STATUS_NONE = "none"
23
+ STANDARD_STATUSES = [STATUS_PENDING, STATUS_COMPLETED, STATUS_IN_PROGRESS, STATUS_NONE]
24
+
25
+ # Default DB path
26
+ DB_PATH = os.environ.get("DEVLOG_DB", os.path.expanduser("~/.devlog.db"))
27
+
28
+ def get_db():
29
+ db = Database(DB_PATH)
30
+ if "logs" not in db.table_names():
31
+ db["logs"].create({
32
+ "id": int,
33
+ "content": str,
34
+ "timestamp": str,
35
+ "tags": str,
36
+ "project": str,
37
+ "status": str
38
+ }, pk="id")
39
+ db["logs"].enable_fts(["content", "tags", "project", "status"], create_triggers=True)
40
+ else:
41
+ # Schema migration for existing table
42
+ columns = db["logs"].columns_dict
43
+ if "project" not in columns:
44
+ db["logs"].add_column("project", str)
45
+ if "status" not in columns:
46
+ db["logs"].add_column("status", str)
47
+
48
+ # Ensure FTS covers new columns (re-enable if needed or just assume it might need update)
49
+ # For sqlite-utils, we can just re-enable to update triggers
50
+ db["logs"].enable_fts(["content", "tags", "project", "status"], create_triggers=True, replace=True)
51
+
52
+ return db
53
+
54
+ @app.command()
55
+ def add(
56
+ content: str = typer.Argument(None, help="Log content (optional, triggers interactive mode if omitted)"),
57
+ tags: str = typer.Option("", help="Comma-separated tags"),
58
+ project: str = typer.Option("", help="Project name"),
59
+ status: str = typer.Option(None, help="Status (pending, completed, in-progress, none or custom)")
60
+ ):
61
+ """
62
+ Add a new log entry. Interactive mode if content is missing.
63
+ """
64
+ if content is None:
65
+ console.print("[bold cyan]Interactive Mode[/bold cyan]")
66
+ content = Prompt.ask("📝 Log entry")
67
+ if not tags:
68
+ tags = Prompt.ask("🏷️ Tags (comma separated)", default="")
69
+ if not project:
70
+ project = Prompt.ask("📂 Project", default="")
71
+ if status is None:
72
+ status = Prompt.ask("📊 Status", choices=STANDARD_STATUSES + ["custom"], default=STATUS_NONE)
73
+ if status == "custom":
74
+ status = Prompt.ask(" Enter custom status")
75
+
76
+ if status is None:
77
+ status = STATUS_NONE
78
+
79
+ db = get_db()
80
+ db["logs"].insert({
81
+ "content": content,
82
+ "timestamp": datetime.now().isoformat(),
83
+ "tags": tags,
84
+ "project": project,
85
+ "status": status
86
+ })
87
+ console.print(f"[bold green]✓ Log saved![/bold green] (Project: {project}, Status: {status})")
88
+
89
+ @app.command()
90
+ def view(id: int = typer.Argument(..., help="ID of the log entry to view")):
91
+ """
92
+ Display a single log entry in a beautiful, full-width view.
93
+ """
94
+ db = get_db()
95
+ try:
96
+ row = db["logs"].get(id)
97
+ except Exception:
98
+ console.print(f"[red]Log entry with ID {id} not found.[/red]")
99
+ return
100
+
101
+ dt = datetime.fromisoformat(row["timestamp"])
102
+
103
+ header = f"[bold cyan]ID:[/bold cyan] {row['id']} | [bold cyan]Time:[/bold cyan] {dt.strftime('%Y-%m-%d %H:%M:%S')}"
104
+ meta = f"[bold magenta]Project:[/bold magenta] {row.get('project') or 'N/A'} | [bold green]Status:[/bold green] {row.get('status') or 'N/A'} | [bold yellow]Tags:[/bold yellow] {row.get('tags') or 'N/A'}"
105
+
106
+ panel = Panel(
107
+ Markdown(row["content"]),
108
+ title=header,
109
+ subtitle=meta,
110
+ border_style="blue",
111
+ padding=(1, 2)
112
+ )
113
+ console.print(panel)
114
+
115
+ @app.command()
116
+ def edit(id: int = typer.Argument(..., help="ID of the log entry to edit")):
117
+ """
118
+ Interactively edit a log entry.
119
+ """
120
+ db = get_db()
121
+ try:
122
+ row = db["logs"].get(id)
123
+ except Exception:
124
+ console.print(f"[red]Log entry with ID {id} not found.[/red]")
125
+ return
126
+
127
+ console.print(f"[bold cyan]Editing Log Entry #{id}[/bold cyan]")
128
+
129
+ new_content = Prompt.ask("📝 Content", default=row["content"])
130
+ new_project = Prompt.ask("📂 Project", default=row.get("project", ""))
131
+
132
+ current_status = row.get("status", STATUS_NONE)
133
+ status_choices = STANDARD_STATUSES + ["custom"]
134
+ if current_status not in STANDARD_STATUSES:
135
+ status_choices.append(current_status)
136
+
137
+ new_status = Prompt.ask("📊 Status", choices=status_choices, default=current_status)
138
+ if new_status == "custom":
139
+ new_status = Prompt.ask(" Enter custom status")
140
+
141
+ new_tags = Prompt.ask("🏷️ Tags", default=row.get("tags", ""))
142
+
143
+ db["logs"].update(id, {
144
+ "content": new_content,
145
+ "project": new_project,
146
+ "status": new_status,
147
+ "tags": new_tags
148
+ })
149
+ console.print(f"[bold green]✓ Log #{id} updated![/bold green]")
150
+
151
+ @app.command()
152
+ def delete(id: int = typer.Argument(..., help="ID of the log entry to delete")):
153
+ """
154
+ Delete a log entry with confirmation.
155
+ """
156
+ db = get_db()
157
+ try:
158
+ row = db["logs"].get(id)
159
+ except Exception:
160
+ console.print(f"[red]Log entry with ID {id} not found.[/red]")
161
+ return
162
+
163
+ # Show entry before deleting
164
+ dt = datetime.fromisoformat(row["timestamp"])
165
+ console.print(f"[yellow]Are you sure you want to delete this log entry?[/yellow]")
166
+ console.print(f"ID: {row['id']} | Time: {dt.strftime('%Y-%m-%d %H:%M')} | Content: {row['content'][:50]}...")
167
+
168
+ if Confirm.ask("Delete?"):
169
+ db["logs"].delete(id)
170
+ console.print(f"[bold red]✓ Log #{id} deleted.[/bold red]")
171
+ else:
172
+ console.print("Deletion cancelled.")
173
+
174
+ @app.command(name="list")
175
+ def list_logs(
176
+ limit: int = typer.Option(10, help="Number of logs to show"),
177
+ tag: str = typer.Option(None, help="Filter by tag"),
178
+ grep: str = typer.Option(None, help="Filter by content (simple grep)"),
179
+ project: str = typer.Option(None, help="Filter by project"),
180
+ status: str = typer.Option(None, help="Filter by status")
181
+ ):
182
+ """
183
+ List recent logs.
184
+ """
185
+ db = get_db()
186
+
187
+ where_clauses = []
188
+ args = []
189
+
190
+ if tag:
191
+ where_clauses.append("tags LIKE ?")
192
+ args.append(f"%{tag}%")
193
+
194
+ if grep:
195
+ where_clauses.append("content LIKE ?")
196
+ args.append(f"%{grep}%")
197
+
198
+ if project:
199
+ where_clauses.append("project = ?")
200
+ args.append(project)
201
+
202
+ if status:
203
+ where_clauses.append("status = ?")
204
+ args.append(status)
205
+
206
+ where = " AND ".join(where_clauses) if where_clauses else None
207
+
208
+ try:
209
+ rows = list(db["logs"].rows_where(where, args, order_by="timestamp desc", limit=limit))
210
+ except Exception as e:
211
+ console.print(f"[red]Error fetching logs: {e}[/red]")
212
+ return
213
+
214
+ if not rows:
215
+ console.print("[yellow]No logs found.[/yellow]")
216
+ return
217
+
218
+ table = Table(title=f"Dev Logs (Last {len(rows)})", border_style="blue", expand=True)
219
+ table.add_column("ID", style="dim", no_wrap=True)
220
+ table.add_column("Time", style="cyan", no_wrap=True)
221
+ table.add_column("Project", style="magenta")
222
+ table.add_column("Status", style="green")
223
+ table.add_column("Content", style="white")
224
+ table.add_column("Tags", style="yellow")
225
+
226
+ status_counts = Counter()
227
+ for row in rows:
228
+ dt = datetime.fromisoformat(row["timestamp"])
229
+ status_counts[row.get("status") or "none"] += 1
230
+
231
+ # Truncate long content for list view
232
+ content_preview = row["content"].split('\n')[0]
233
+ if len(content_preview) > 50:
234
+ content_preview = content_preview[:47] + "..."
235
+
236
+ table.add_row(
237
+ str(row["id"]),
238
+ dt.strftime("%Y-%m-%d %H:%M"),
239
+ row.get("project", ""),
240
+ row.get("status", ""),
241
+ content_preview,
242
+ row.get("tags", "")
243
+ )
244
+
245
+ console.print(table)
246
+
247
+ # Status Summary
248
+ summary_parts = [f"[bold]{s}:[/bold] {c}" for s, c in status_counts.items()]
249
+ console.print(Panel(" | ".join(summary_parts), title="Status Summary", border_style="dim"))
250
+
251
+ @app.command(name="ls")
252
+ def ls_alias(
253
+ limit: int = typer.Option(10, help="Number of logs to show"),
254
+ tag: str = typer.Option(None, help="Filter by tag"),
255
+ grep: str = typer.Option(None, help="Filter by content (simple grep)"),
256
+ project: str = typer.Option(None, help="Filter by project"),
257
+ status: str = typer.Option(None, help="Filter by status")
258
+ ):
259
+ """Alias for list"""
260
+ list_logs(limit=limit, tag=tag, grep=grep, project=project, status=status)
261
+
262
+ @app.command()
263
+ def search(query: str):
264
+ """
265
+ Search logs using full-text search with a fallback to LIKE.
266
+ """
267
+ db = get_db()
268
+ results = []
269
+
270
+ # Try FTS first
271
+ try:
272
+ results = list(db["logs"].search(query))
273
+ except Exception:
274
+ pass
275
+
276
+ # If no FTS results, try case-insensitive LIKE
277
+ if not results:
278
+ results = list(db["logs"].rows_where(
279
+ "content LIKE ? OR tags LIKE ?",
280
+ [f"%{query}%", f"%{query}%"],
281
+ order_by="timestamp desc"
282
+ ))
283
+
284
+ if not results:
285
+ console.print("[red]No matches found.[/red]")
286
+ return
287
+
288
+ console.print(f"[bold green]Found {len(results)} matches for '[italic]{query}[/italic]':[/bold green]")
289
+ for row in results:
290
+ dt = datetime.fromisoformat(row["timestamp"])
291
+
292
+ # Enhanced result display
293
+ header = f"[bold cyan]ID:[/bold cyan] {row['id']} | [bold cyan]{dt.strftime('%Y-%m-%d %H:%M')}[/bold cyan]"
294
+ meta = f"[bold magenta]Project:[/bold magenta] {row.get('project') or 'N/A'} | [bold green]Status:[/bold green] {row.get('status') or 'N/A'} | [bold yellow]Tags:[/bold yellow] {row.get('tags') or 'N/A'}"
295
+
296
+ panel = Panel(
297
+ Markdown(row["content"]),
298
+ title=header,
299
+ subtitle=meta,
300
+ border_style="green",
301
+ padding=(0, 1)
302
+ )
303
+ console.print(panel)
304
+
305
+ @app.command()
306
+ def stats(
307
+ project: str = typer.Option(None, help="Filter stats by project")
308
+ ):
309
+ """
310
+ Show analytics and statistics.
311
+ """
312
+ db = get_db()
313
+
314
+ where = "project = ?" if project else None
315
+ args = [project] if project else []
316
+
317
+ all_logs = list(db["logs"].rows_where(where, args))
318
+ count = len(all_logs)
319
+
320
+ if count == 0:
321
+ console.print(f"No logs found{f' for project {project}' if project else ''}.")
322
+ return
323
+
324
+ title_suffix = f" (Project: {project})" if project else ""
325
+
326
+ # Activity Heatmap (Last 30 days)
327
+ from datetime import date, timedelta
328
+ today = date.today()
329
+ last_30_days = [today - timedelta(days=i) for i in range(30)]
330
+ last_30_days.reverse()
331
+
332
+ dates_in_logs = [datetime.fromisoformat(log["timestamp"]).date() for log in all_logs]
333
+ activity_counts = Counter(dates_in_logs)
334
+
335
+ heatmap_str = ""
336
+ for d in last_30_days:
337
+ c = activity_counts.get(d, 0)
338
+ if c == 0:
339
+ heatmap_str += "[grey37]□ [/grey37]"
340
+ elif c < 3:
341
+ heatmap_str += "[green]■ [/green]"
342
+ elif c < 6:
343
+ heatmap_str += "[bold green]■ [/bold green]"
344
+ else:
345
+ heatmap_str += "[bold bright_green]■ [/bold bright_green]"
346
+
347
+ console.print(Panel(heatmap_str, title=f"Activity (Last 30 Days){title_suffix}", subtitle="□:0 ■:1-2 ■:3-5 ■:6+"))
348
+
349
+ # Tag analysis
350
+ all_tags = []
351
+ for log in all_logs:
352
+ if log.get("tags"):
353
+ tags = [t.strip() for t in log["tags"].split(",") if t.strip()]
354
+ all_tags.extend(tags)
355
+
356
+ tag_counts = Counter(all_tags).most_common(5)
357
+
358
+ # Time analysis (logs per day)
359
+ date_counts = Counter(dates_in_logs).most_common(5)
360
+
361
+ console.print(Panel(f"[bold white]Total Entries:[/bold white] [bold green]{count}[/bold green]", title=f"General Stats{title_suffix}"))
362
+
363
+ tag_table = Table(title=f"Top Tags{title_suffix}", show_header=True)
364
+ tag_table.add_column("Tag", style="yellow")
365
+ tag_table.add_column("Count", style="white")
366
+ for tag, c in tag_counts:
367
+ tag_table.add_row(tag, str(c))
368
+
369
+ console.print(tag_table)
370
+
371
+ @app.command()
372
+ def sync(
373
+ repo: str = typer.Option(None, help="Git repo URL to sync with"),
374
+ path: str = typer.Option(None, help="Local backup path")
375
+ ):
376
+ """
377
+ Sync/Backup ~/.devlog.db to a private git repo or local path.
378
+ """
379
+ if not repo and not path:
380
+ action = Prompt.ask("Sync to", choices=["git", "local"], default="local")
381
+ if action == "git":
382
+ repo = Prompt.ask("Git Repo URL")
383
+ else:
384
+ path = Prompt.ask("Local Backup Path", default="~/devlog_backup")
385
+
386
+ import shutil
387
+ db_source = DB_PATH
388
+
389
+ if path:
390
+ path = os.path.expanduser(path)
391
+ os.makedirs(path, exist_ok=True)
392
+ dest = os.path.join(path, "devlog.db")
393
+ shutil.copy2(db_source, dest)
394
+ console.print(f"[bold green]✓ Backed up to {dest}[/bold green]")
395
+
396
+ if repo:
397
+ sync_dir = os.path.expanduser("~/.devlog_sync")
398
+ if not os.path.exists(sync_dir):
399
+ os.makedirs(sync_dir)
400
+ subprocess.run(["git", "init"], cwd=sync_dir)
401
+ if repo:
402
+ subprocess.run(["git", "remote", "add", "origin", repo], cwd=sync_dir)
403
+
404
+ shutil.copy2(db_source, os.path.join(sync_dir, "devlog.db"))
405
+ subprocess.run(["git", "add", "devlog.db"], cwd=sync_dir)
406
+ subprocess.run(["git", "commit", "-m", f"Sync: {datetime.now().isoformat()}"], cwd=sync_dir)
407
+
408
+ result = subprocess.run(["git", "push", "origin", "main"], cwd=sync_dir, capture_output=True, text=True)
409
+ if result.returncode == 0:
410
+ console.print("[bold green]✓ Synced to Git![/bold green]")
411
+ else:
412
+ console.print(f"[red]Git push failed: {result.stderr}[/red]")
413
+
414
+ @app.command()
415
+ def export(
416
+ format: str = typer.Option(None, help="Format: markdown or json"),
417
+ output: str = typer.Option(None, help="Output file path")
418
+ ):
419
+ """
420
+ Export logs to Markdown or JSON (Interactive).
421
+ """
422
+ # Interactive Format
423
+ if not format:
424
+ format = Prompt.ask("📂 Choose format", choices=["markdown", "json"], default="markdown")
425
+
426
+ # Interactive Output Filename
427
+ if not output:
428
+ now = datetime.now().strftime("%Y%m%d_%H%M%S")
429
+ ext = "md" if format == "markdown" else "json"
430
+ default_filename = f"devlog_export_{now}.{ext}"
431
+
432
+ output_name = Prompt.ask("📄 Filename", default=default_filename)
433
+ output_path = Prompt.ask("📍 Path (folder)", default=".")
434
+ output = os.path.join(output_path, output_name)
435
+
436
+ db = get_db()
437
+ logs = list(db["logs"].rows_where(order_by="timestamp desc"))
438
+
439
+ if not logs:
440
+ console.print("[yellow]Nothing to export.[/yellow]")
441
+ return
442
+
443
+ result = ""
444
+ if format.lower() == "json":
445
+ result = json.dumps(logs, indent=2)
446
+ else:
447
+ result += "# DevLog Export\n\n"
448
+ for log in logs:
449
+ dt = datetime.fromisoformat(log["timestamp"])
450
+ result += f"## {dt.strftime('%Y-%m-%d %H:%M:%S')}\n"
451
+ if log.get("tags"):
452
+ result += f"**Tags:** `{log['tags']}`\n\n"
453
+ result += f"{log['content']}\n\n"
454
+ result += "---\n\n"
455
+
456
+ try:
457
+ with open(output, "w") as f:
458
+ f.write(result)
459
+ console.print(f"[bold green]✓ Exported to {output}[/bold green]")
460
+ except Exception as e:
461
+ console.print(f"[red]Failed to export: {e}[/red]")
462
+
463
+ if __name__ == "__main__":
464
+ app()
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "dev-log-cli"
7
+ version = "3.0.0"
8
+ description = "A minimalist developer journaling CLI."
9
+ readme = "README.md"
10
+ authors = [{name = "Satyaa", email = "satyaa@openclaw.ai"}]
11
+ license = "MIT"
12
+ dependencies = [
13
+ "typer",
14
+ "rich",
15
+ "sqlite-utils"
16
+ ]
17
+ keywords = ["journal", "cli", "developer", "productivity", "sqlite"]
18
+ classifiers = [
19
+ "Programming Language :: Python :: 3",
20
+ "Operating System :: OS Independent",
21
+ "Development Status :: 4 - Beta",
22
+ "Environment :: Console",
23
+ "Intended Audience :: Developers",
24
+ ]
25
+
26
+ [project.urls]
27
+ "Homepage" = "https://github.com/CrimsonDevil333333/dev-log-cli"
28
+ "Bug Tracker" = "https://github.com/CrimsonDevil333333/dev-log-cli/issues"
29
+
30
+ [project.scripts]
31
+ devlog = "devlog.cli:app"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+