@atybdot/chronicle 1.0.0

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.
Files changed (3) hide show
  1. package/README.md +233 -0
  2. package/dist/index.js +48187 -0
  3. package/package.json +68 -0
package/README.md ADDED
@@ -0,0 +1,233 @@
1
+ # Chronicle CLI
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@atybdot/chronicle)](https://www.npmjs.com/package/@atybdot/chronicle)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ AI-powered CLI that transforms uncommitted changes into a realistic git commit history.
7
+
8
+ ## Features
9
+
10
+ - **AI-Powered Analysis**: Uses LLM to analyze your codebase and intelligently split changes into logical, atomic commits
11
+ - **Smart Commit Ordering**: AI determines the optimal commit order based on file dependencies
12
+ - **Realistic Distribution**: Spreads commits across a date range with realistic work patterns (weekday bias, work hours, session clustering)
13
+ - **Natural Language Dates**: Specify date ranges naturally like "last 30 days" or "spread over 2 weeks"
14
+ - **Visual Previews**: ASCII commit graph and GitHub contribution graph preview
15
+ - **Multi-Provider Support**: Works with OpenAI, Anthropic Claude, Google Gemini, OpenRouter, or local Ollama models
16
+ - **Dry-Run Mode**: Preview the commit plan before executing
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ # Install globally with Bun
22
+ bun add -g @atybdot/chronicle
23
+
24
+ # Or run directly with bunx
25
+ bunx chronicle
26
+ ```
27
+
28
+ ## Quick Start
29
+
30
+ 1. **Configure your LLM provider** (interactive setup):
31
+ ```bash
32
+ chronicle config init
33
+ ```
34
+
35
+ **Or configure manually**:
36
+ ```bash
37
+ # Set your API key (works with any provider)
38
+ export CHRONICLE_AI_KEY=your-api-key
39
+
40
+ # Optionally set a different provider (default is openai)
41
+ chronicle config set llm.provider anthropic # or gemini, openrouter, ollama
42
+ ```
43
+
44
+ 2. **Analyze your changes**:
45
+ ```bash
46
+ chronicle analyze
47
+ ```
48
+
49
+ 3. **Backfill your commit history**:
50
+ ```bash
51
+ # Dry run (preview only)
52
+ chronicle backfill --date-range "last 2 weeks"
53
+
54
+ # Execute for real
55
+ chronicle backfill --date-range "last 2 weeks" --no-dry-run
56
+ ```
57
+
58
+ ## Commands
59
+
60
+ ### `chronicle analyze`
61
+
62
+ Analyze uncommitted changes and see how they would be split into commits.
63
+
64
+ ```bash
65
+ chronicle analyze [options]
66
+
67
+ Options:
68
+ --path <path> Path to git repository (default: current directory)
69
+ --include-staged Include staged changes (default: true)
70
+ --include-unstaged Include unstaged changes (default: true)
71
+ --include-untracked Include untracked files (default: true)
72
+ ```
73
+
74
+ ### `chronicle backfill`
75
+
76
+ Generate and execute a commit plan.
77
+
78
+ ```bash
79
+ chronicle backfill [options]
80
+
81
+ Options:
82
+ --path <path> Path to git repository
83
+ --date-range <range> Natural language date range (e.g., "last 30 days")
84
+ --start-date <date> Explicit start date (ISO format)
85
+ --end-date <date> Explicit end date (ISO format)
86
+ --dry-run Preview without making changes (default: true)
87
+ --no-dry-run Execute the commit plan
88
+ --interactive Interactive mode with prompts (default: true)
89
+ --output <format> Output format: visual, json, minimal (default: visual)
90
+ ```
91
+
92
+ ### `chronicle status`
93
+
94
+ Show the current status of uncommitted changes.
95
+
96
+ ```bash
97
+ chronicle status [--path <path>]
98
+ ```
99
+
100
+ ### `chronicle config`
101
+
102
+ Manage configuration.
103
+
104
+ ```bash
105
+ # Interactive setup wizard (recommended for first-time setup)
106
+ chronicle config init
107
+
108
+ # Show current config
109
+ chronicle config show
110
+
111
+ # Get a value
112
+ chronicle config get llm.provider
113
+
114
+ # Set a value
115
+ chronicle config set llm.apiKey sk-xxx
116
+ chronicle config set defaults.workHoursStart 10
117
+ chronicle config set defaults.excludeWeekends true
118
+ ```
119
+
120
+ #### `chronicle config init`
121
+
122
+ The interactive setup wizard guides you through:
123
+ 1. **Provider selection** - Choose from OpenAI, Anthropic, Google Gemini, OpenRouter, or Ollama
124
+ 2. **Model selection** - Pick from recommended models or enter a custom model name
125
+ 3. **API key configuration** - Three options:
126
+ - Use environment variable (recommended for security)
127
+ - Store in config file (convenient but less secure)
128
+ - Skip and configure later
129
+
130
+ Your API key is stored locally only and is never sent to any remote server except the LLM provider you choose.
131
+
132
+ ## Configuration
133
+
134
+ Configuration is stored in `~/.config/chronicle/config.json`.
135
+
136
+ ```json
137
+ {
138
+ "llm": {
139
+ "provider": "openai",
140
+ "model": "gpt-4o",
141
+ "apiKey": "sk-xxx",
142
+ "baseUrl": null
143
+ },
144
+ "git": {
145
+ "authorName": null,
146
+ "authorEmail": null
147
+ },
148
+ "defaults": {
149
+ "distribution": "realistic",
150
+ "dryRun": true,
151
+ "workHoursStart": 9,
152
+ "workHoursEnd": 18,
153
+ "excludeWeekends": false
154
+ }
155
+ }
156
+ ```
157
+
158
+ ## Environment Variables
159
+
160
+ Set your API key via environment variable (recommended):
161
+ ```bash
162
+ export CHRONICLE_AI_KEY=your-api-key
163
+ ```
164
+
165
+ This single environment variable works with all providers (OpenAI, Anthropic, Gemini, OpenRouter). Ollama runs locally and doesn't require an API key.
166
+
167
+ ## Example Output
168
+
169
+ ```
170
+ 📋 Commit Plan Summary
171
+
172
+ Total commits: 8
173
+ Total files: 15
174
+ Date range: 1/10/2024 - 1/20/2024
175
+ Days: 10
176
+ Avg commits/day: 0.8
177
+ Strategy: realistic
178
+
179
+ By category:
180
+ 🎉 setup: 1
181
+ ✨ feature: 4
182
+ 🐛 fix: 2
183
+ 📚 docs: 1
184
+
185
+ 📊 Commit Graph Preview
186
+
187
+ Mon Jan 15
188
+ ├─ 09:23 AM 🎉 chore: initial project setup
189
+ └─ 10:45 AM ✨ feat: add user authentication
190
+
191
+ Tue Jan 16
192
+ └─ 02:30 PM ✨ feat: implement dashboard
193
+
194
+ 📅 GitHub Contribution Preview
195
+
196
+ Sun Mon Tue Wed Thu Fri Sat
197
+ Jan 14 ░ ▒ ░ ░ ░ ░ ░
198
+ Jan 21 ░ ░ ▓ ░ █ ░ ░
199
+ ```
200
+
201
+ ## Development
202
+
203
+ ```bash
204
+ # Install dependencies
205
+ bun install
206
+
207
+ # Build the CLI
208
+ bun run build
209
+
210
+ # Run tests
211
+ bun test
212
+
213
+ # Type check
214
+ bun run typecheck
215
+ ```
216
+
217
+ ## Release
218
+
219
+ To publish a new version to npm:
220
+
221
+ ```bash
222
+ # Create release (bumps version and git tag)
223
+ bun run release # patch (0.1.0 → 0.1.1)
224
+ bun run release -- --release-as minor # minor (0.1.0 → 0.2.0)
225
+ bun run release -- --release-as major # major (0.1.0 → 1.0.0)
226
+ bun run release -- --release-as 1.2.3 # specific version
227
+ ```
228
+
229
+ Then manually trigger the publish workflow in GitHub Actions with the version number.
230
+
231
+ ## License
232
+
233
+ MIT