clockwork-cli 0.1.0__tar.gz → 0.1.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clockwork-cli
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Mine your Claude Code and Codex session logs to estimate active time
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/danielsich/clockwork
@@ -18,6 +18,10 @@ Dynamic: license-file
18
18
 
19
19
  # clockwork
20
20
 
21
+ [![PyPI](https://img.shields.io/pypi/v/clockwork-cli)](https://pypi.org/project/clockwork-cli/)
22
+ [![License](https://img.shields.io/badge/License-MIT-green)](LICENSE)
23
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/danielsich/clockwork)
24
+
21
25
  A tiny, dependency-free CLI that mines your **Claude Code** and **Codex**
22
26
  session logs to estimate how much *active* time you've actually spent — per
23
27
  project, per day — and renders it as ASCII bar charts in your terminal.
@@ -78,11 +82,19 @@ midnight is credited to each day it spans.
78
82
 
79
83
  ## Requirements
80
84
 
81
- - Python 3.7+ (standard library only — no `pip install` needed)
85
+ - Python 3.7+ (standard library only — no dependencies)
82
86
 
83
87
  ## Install
84
88
 
85
- **macOS / Linux**
89
+ **pip (recommended — works on macOS, Linux, and Windows)**
90
+
91
+ ```bash
92
+ pip install clockwork-cli
93
+ ```
94
+
95
+ This puts `clockwork` on your PATH. Done.
96
+
97
+ **From source — macOS / Linux**
86
98
 
87
99
  ```bash
88
100
  git clone https://github.com/danielsich/clockwork.git
@@ -96,7 +108,7 @@ ln -s "$PWD/clockwork" ~/.local/bin/clockwork
96
108
  ./clockwork claude all
97
109
  ```
98
110
 
99
- **Windows**
111
+ **From source — Windows**
100
112
 
101
113
  ```powershell
102
114
  git clone https://github.com/danielsich/clockwork.git
@@ -104,14 +116,10 @@ cd clockwork
104
116
 
105
117
  # Run directly with Python (the shebang line is ignored on Windows)
106
118
  python clockwork claude all
107
-
108
- # Or add the directory to your PATH and invoke as:
109
- python -m clockwork claude all # not needed — just call the script
110
119
  ```
111
120
 
112
- > clockwork looks for Claude logs in `%APPDATA%\Claude\projects` first, then
113
- > `~\.claude\projects`. One of those will already exist if you have Claude Code
114
- > installed.
121
+ > On Windows, clockwork looks for Claude logs in `%APPDATA%\Claude\projects`
122
+ > first, then `~\.claude\projects`.
115
123
 
116
124
  ## Usage
117
125
 
@@ -1,5 +1,9 @@
1
1
  # clockwork
2
2
 
3
+ [![PyPI](https://img.shields.io/pypi/v/clockwork-cli)](https://pypi.org/project/clockwork-cli/)
4
+ [![License](https://img.shields.io/badge/License-MIT-green)](LICENSE)
5
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/danielsich/clockwork)
6
+
3
7
  A tiny, dependency-free CLI that mines your **Claude Code** and **Codex**
4
8
  session logs to estimate how much *active* time you've actually spent — per
5
9
  project, per day — and renders it as ASCII bar charts in your terminal.
@@ -60,11 +64,19 @@ midnight is credited to each day it spans.
60
64
 
61
65
  ## Requirements
62
66
 
63
- - Python 3.7+ (standard library only — no `pip install` needed)
67
+ - Python 3.7+ (standard library only — no dependencies)
64
68
 
65
69
  ## Install
66
70
 
67
- **macOS / Linux**
71
+ **pip (recommended — works on macOS, Linux, and Windows)**
72
+
73
+ ```bash
74
+ pip install clockwork-cli
75
+ ```
76
+
77
+ This puts `clockwork` on your PATH. Done.
78
+
79
+ **From source — macOS / Linux**
68
80
 
69
81
  ```bash
70
82
  git clone https://github.com/danielsich/clockwork.git
@@ -78,7 +90,7 @@ ln -s "$PWD/clockwork" ~/.local/bin/clockwork
78
90
  ./clockwork claude all
79
91
  ```
80
92
 
81
- **Windows**
93
+ **From source — Windows**
82
94
 
83
95
  ```powershell
84
96
  git clone https://github.com/danielsich/clockwork.git
@@ -86,14 +98,10 @@ cd clockwork
86
98
 
87
99
  # Run directly with Python (the shebang line is ignored on Windows)
88
100
  python clockwork claude all
89
-
90
- # Or add the directory to your PATH and invoke as:
91
- python -m clockwork claude all # not needed — just call the script
92
101
  ```
93
102
 
94
- > clockwork looks for Claude logs in `%APPDATA%\Claude\projects` first, then
95
- > `~\.claude\projects`. One of those will already exist if you have Claude Code
96
- > installed.
103
+ > On Windows, clockwork looks for Claude logs in `%APPDATA%\Claude\projects`
104
+ > first, then `~\.claude\projects`.
97
105
 
98
106
  ## Usage
99
107
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "clockwork-cli"
7
- version = "0.1.0"
7
+ version = "0.1.2"
8
8
  description = "Mine your Claude Code and Codex session logs to estimate active time"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -55,7 +55,7 @@ import hashlib
55
55
  from datetime import datetime, timedelta, timezone
56
56
  from collections import defaultdict
57
57
 
58
- __version__ = "0.1.0"
58
+ __version__ = "0.1.2"
59
59
 
60
60
 
61
61
  def _resolve_claude_dir():
@@ -200,6 +200,34 @@ def _print_json(obj):
200
200
  print(json.dumps(obj, indent=2))
201
201
 
202
202
 
203
+ def _stdout_target():
204
+ """Best-effort name of where stdout is going, for status messages.
205
+
206
+ Returns the basename of the file when stdout is redirected to a regular
207
+ file (`> out.json`), or None for a terminal or a pipe. Purely cosmetic;
208
+ any failure degrades to None so it never affects the export itself.
209
+ """
210
+ try:
211
+ if os.isatty(1):
212
+ return None
213
+ except Exception:
214
+ return None
215
+ path = None
216
+ try: # macOS / BSD: ask the kernel for fd 1's path
217
+ import fcntl
218
+ f_getpath = getattr(fcntl, "F_GETPATH", 50)
219
+ raw = fcntl.fcntl(1, f_getpath, b"\0" * 1024)
220
+ path = raw.split(b"\0", 1)[0].decode() or None
221
+ except Exception:
222
+ try: # Linux: /proc symlink
223
+ path = os.readlink("/proc/self/fd/1")
224
+ except Exception:
225
+ path = None
226
+ if path and os.path.isfile(path):
227
+ return os.path.basename(path)
228
+ return None
229
+
230
+
203
231
  def _project_id(path):
204
232
  """Stable short id for a project path (survives anonymization)."""
205
233
  return hashlib.sha1(path.encode("utf-8")).hexdigest()[:8]
@@ -838,6 +866,18 @@ def export_data(provider, idle_threshold, since, until, detail, anonymize):
838
866
  },
839
867
  })
840
868
 
869
+ # A friendly receipt on stderr — keeps stdout pure JSON for redirection.
870
+ dest = _stdout_target()
871
+ where = dest if dest else "stdout"
872
+ tags = [provider, f"detail={detail}"]
873
+ if anonymize:
874
+ tags.append("anonymized")
875
+ print(f"\n ✓ export complete → {where}", file=sys.stderr)
876
+ print(f" {' · '.join(tags)}", file=sys.stderr)
877
+ print(f" {len(out_projects)} projects · {grand_prompts:,} prompts "
878
+ f"· {grand_sessions:,} sessions · {grand_minutes / 60:.1f}h active",
879
+ file=sys.stderr)
880
+
841
881
 
842
882
  def list_projects(provider, as_json):
843
883
  projects = PROVIDERS[provider]["list"]()
@@ -894,7 +934,11 @@ def _parse_args(argv):
894
934
 
895
935
 
896
936
  def main():
897
- positionals, opts = _parse_args(sys.argv[1:])
937
+ argv = sys.argv[1:]
938
+ if "-h" in argv or "--help" in argv:
939
+ print(__doc__.strip())
940
+ sys.exit(0)
941
+ positionals, opts = _parse_args(argv)
898
942
  if len(positionals) < 2:
899
943
  print(__doc__.strip())
900
944
  sys.exit(1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clockwork-cli
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Mine your Claude Code and Codex session logs to estimate active time
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/danielsich/clockwork
@@ -18,6 +18,10 @@ Dynamic: license-file
18
18
 
19
19
  # clockwork
20
20
 
21
+ [![PyPI](https://img.shields.io/pypi/v/clockwork-cli)](https://pypi.org/project/clockwork-cli/)
22
+ [![License](https://img.shields.io/badge/License-MIT-green)](LICENSE)
23
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/danielsich/clockwork)
24
+
21
25
  A tiny, dependency-free CLI that mines your **Claude Code** and **Codex**
22
26
  session logs to estimate how much *active* time you've actually spent — per
23
27
  project, per day — and renders it as ASCII bar charts in your terminal.
@@ -78,11 +82,19 @@ midnight is credited to each day it spans.
78
82
 
79
83
  ## Requirements
80
84
 
81
- - Python 3.7+ (standard library only — no `pip install` needed)
85
+ - Python 3.7+ (standard library only — no dependencies)
82
86
 
83
87
  ## Install
84
88
 
85
- **macOS / Linux**
89
+ **pip (recommended — works on macOS, Linux, and Windows)**
90
+
91
+ ```bash
92
+ pip install clockwork-cli
93
+ ```
94
+
95
+ This puts `clockwork` on your PATH. Done.
96
+
97
+ **From source — macOS / Linux**
86
98
 
87
99
  ```bash
88
100
  git clone https://github.com/danielsich/clockwork.git
@@ -96,7 +108,7 @@ ln -s "$PWD/clockwork" ~/.local/bin/clockwork
96
108
  ./clockwork claude all
97
109
  ```
98
110
 
99
- **Windows**
111
+ **From source — Windows**
100
112
 
101
113
  ```powershell
102
114
  git clone https://github.com/danielsich/clockwork.git
@@ -104,14 +116,10 @@ cd clockwork
104
116
 
105
117
  # Run directly with Python (the shebang line is ignored on Windows)
106
118
  python clockwork claude all
107
-
108
- # Or add the directory to your PATH and invoke as:
109
- python -m clockwork claude all # not needed — just call the script
110
119
  ```
111
120
 
112
- > clockwork looks for Claude logs in `%APPDATA%\Claude\projects` first, then
113
- > `~\.claude\projects`. One of those will already exist if you have Claude Code
114
- > installed.
121
+ > On Windows, clockwork looks for Claude logs in `%APPDATA%\Claude\projects`
122
+ > first, then `~\.claude\projects`.
115
123
 
116
124
  ## Usage
117
125
 
File without changes
File without changes