git-captains-log 0.2.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.
Files changed (31) hide show
  1. git_captains_log-0.2.0/.gitignore +158 -0
  2. git_captains_log-0.2.0/LICENSE +201 -0
  3. git_captains_log-0.2.0/PKG-INFO +304 -0
  4. git_captains_log-0.2.0/README.md +294 -0
  5. git_captains_log-0.2.0/commit-msg +31 -0
  6. git_captains_log-0.2.0/commit-msg-package +21 -0
  7. git_captains_log-0.2.0/pyproject.toml +137 -0
  8. git_captains_log-0.2.0/src/__init__.py +19 -0
  9. git_captains_log-0.2.0/src/_version.py +34 -0
  10. git_captains_log-0.2.0/src/btw.py +99 -0
  11. git_captains_log-0.2.0/src/cli.py +162 -0
  12. git_captains_log-0.2.0/src/config/__init__.py +6 -0
  13. git_captains_log-0.2.0/src/config/config_loader.py +55 -0
  14. git_captains_log-0.2.0/src/config/config_models.py +65 -0
  15. git_captains_log-0.2.0/src/entries/__init__.py +7 -0
  16. git_captains_log-0.2.0/src/entries/entry_formatter.py +56 -0
  17. git_captains_log-0.2.0/src/entries/entry_models.py +56 -0
  18. git_captains_log-0.2.0/src/entries/entry_processor.py +90 -0
  19. git_captains_log-0.2.0/src/git/__init__.py +6 -0
  20. git_captains_log-0.2.0/src/git/commit_parser.py +77 -0
  21. git_captains_log-0.2.0/src/git/git_operations.py +147 -0
  22. git_captains_log-0.2.0/src/logs/__init__.py +8 -0
  23. git_captains_log-0.2.0/src/logs/log_manager.py +93 -0
  24. git_captains_log-0.2.0/src/logs/log_models.py +66 -0
  25. git_captains_log-0.2.0/src/logs/log_parser.py +87 -0
  26. git_captains_log-0.2.0/src/logs/log_writer.py +101 -0
  27. git_captains_log-0.2.0/src/projects/__init__.py +6 -0
  28. git_captains_log-0.2.0/src/projects/project_finder.py +64 -0
  29. git_captains_log-0.2.0/src/projects/project_models.py +26 -0
  30. git_captains_log-0.2.0/src/update_log.py +179 -0
  31. git_captains_log-0.2.0/src/wtf.py +99 -0
@@ -0,0 +1,158 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ share/python-wheels/
20
+ *.egg-info/
21
+ .installed.cfg
22
+ *.egg
23
+ MANIFEST
24
+
25
+ # PyInstaller
26
+ *.manifest
27
+ *.spec
28
+
29
+ # Installer logs
30
+ pip-log.txt
31
+ pip-delete-this-directory.txt
32
+
33
+ # Unit test / coverage reports
34
+ htmlcov/
35
+ .tox/
36
+ .nox/
37
+ .coverage
38
+ .coverage.*
39
+ .cache
40
+ nosetests.xml
41
+ coverage.xml
42
+ *.cover
43
+ *.py,cover
44
+ .hypothesis/
45
+ .pytest_cache/
46
+ cover/
47
+
48
+ # Translations
49
+ *.mo
50
+ *.pot
51
+
52
+ # Django stuff:
53
+ *.log
54
+ local_settings.py
55
+ db.sqlite3
56
+ db.sqlite3-journal
57
+
58
+ # Flask stuff:
59
+ instance/
60
+ .webassets-cache
61
+
62
+ # Scrapy stuff:
63
+ .scrapy
64
+
65
+ # Sphinx documentation
66
+ docs/_build/
67
+
68
+ # PyBuilder
69
+ .pybuilder/
70
+ target/
71
+
72
+ # Jupyter Notebook
73
+ .ipynb_checkpoints
74
+
75
+ # IPython
76
+ profile_default/
77
+ ipython_config.py
78
+
79
+ # pyenv
80
+ .python-version
81
+
82
+ # pipenv
83
+ Pipfile.lock
84
+
85
+ # poetry
86
+ poetry.lock
87
+
88
+ # pdm
89
+ .pdm.toml
90
+
91
+ # PEP 582
92
+ __pypackages__/
93
+
94
+ # Celery stuff
95
+ celerybeat-schedule
96
+ celerybeat.pid
97
+
98
+ # SageMath parsed files
99
+ *.sage.py
100
+
101
+ # Environments
102
+ .env
103
+ .venv
104
+ env/
105
+ venv/
106
+ ENV/
107
+ env.bak/
108
+ venv.bak/
109
+
110
+ # Spyder project settings
111
+ .spyderproject
112
+ .spyproject
113
+
114
+ # Rope project settings
115
+ .ropeproject
116
+
117
+ # mkdocs documentation
118
+ /site
119
+
120
+ # mypy
121
+ .mypy_cache/
122
+ .dmypy.json
123
+ dmypy.json
124
+
125
+ # Pyre type checker
126
+ .pyre/
127
+
128
+ # pytype static type analyzer
129
+ .pytype/
130
+
131
+ # Cython debug symbols
132
+ cython_debug/
133
+
134
+ # UV
135
+ .uv/
136
+
137
+ # IDE
138
+ .vscode/
139
+ .idea/
140
+ *.swp
141
+ *.swo
142
+ *~
143
+
144
+ # OS
145
+ .DS_Store
146
+ .DS_Store?
147
+ ._*
148
+ .Spotlight-V100
149
+ .Trashes
150
+ ehthumbs.db
151
+ Thumbs.db
152
+
153
+ # Project specific
154
+ *.lock
155
+ .env.local
156
+ .env.development.local
157
+ .env.test.local
158
+ .env.production.local
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,304 @@
1
+ Metadata-Version: 2.4
2
+ Name: git-captains-log
3
+ Version: 0.2.0
4
+ Summary: Automatically aggregate git commit messages daily into markdown logs
5
+ Author: Captain's Log Team
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.8
8
+ Requires-Dist: pyyaml>=6.0
9
+ Description-Content-Type: text/markdown
10
+
11
+ # Captain's Log
12
+
13
+ Automatically aggregate your git commit messages daily into markdown logs, grouped by repository and project.
14
+
15
+ ---
16
+
17
+ ## Installation
18
+
19
+ ### From PyPI (Recommended for Users)
20
+
21
+ Install Captain's Log from PyPI:
22
+
23
+ ```bash
24
+ # Using pip
25
+ pip install git-captains-log
26
+
27
+ # Or using uv (recommended)
28
+ uv pip install git-captains-log
29
+ ```
30
+
31
+ Then run the setup command:
32
+
33
+ ```bash
34
+ captains-log setup
35
+ ```
36
+
37
+ This will configure Git hooks, create config files, and set everything up.
38
+
39
+ See [INSTALLATION.md](INSTALLATION.md) for detailed installation instructions.
40
+
41
+ ### From Source (For Development)
42
+
43
+ Use the automated installation script:
44
+
45
+ ```bash
46
+ git clone git@github.com:koradon/captains-log.git
47
+ cd to/cloned/repo
48
+ chmod +x install.sh
49
+ ./install.sh
50
+ ```
51
+
52
+ The `install.sh` script will:
53
+ - Create necessary directories (`~/.captains-log` and `~/.git-hooks`)
54
+ - Copy `update_log.py` and `commit-msg` hook to the right locations
55
+ - Install the `btw` and `wtf` commands globally (accessible from anywhere)
56
+ - Set proper executable permissions
57
+ - Create a default `config.yml` file
58
+ - Configure global git hooks path
59
+ - Check for Python 3 and install PyYAML if needed
60
+
61
+ ### Pre-commit Integration (Optional)
62
+ If you use [pre-commit](https://pre-commit.com/) in your repositories and want to keep both your global Captain's Log hooks and per-repo pre-commit hooks working together:
63
+
64
+ ```bash
65
+ # After running install.sh
66
+ chmod +x install-with-precommit.sh
67
+ ./install-with-precommit.sh
68
+ ```
69
+
70
+ This will:
71
+ - Install global hook wrappers that run pre-commit first (when `.pre-commit-config.yaml` exists)
72
+ - Then run Captain's Log afterwards
73
+ - Preserve your existing `core.hooksPath` configuration
74
+ - Work seamlessly with repos that don't use pre-commit
75
+
76
+ **Note:** With pre-commit integration, you don't need to run `pre-commit install` in individual repositories. The global hooks will automatically invoke pre-commit when a repo has `.pre-commit-config.yaml`.
77
+
78
+ ### Manual Installation
79
+ If you prefer to install manually:
80
+
81
+ 1. Clone or download Captain's Log:
82
+
83
+ ```bash
84
+ git clone git@github.com:koradon/captains-log.git ~/.captains-log
85
+ cd ~/.captains-log
86
+ ```
87
+
88
+ 2. Install dependencies
89
+
90
+ ```bash
91
+ pip install pyyaml
92
+ ```
93
+
94
+ 3. Configure your projects and global log repo in `~/.captains-log/config.yml`
95
+
96
+ ```yaml
97
+ global_log_repo: /path/to/global/log-repo
98
+
99
+ projects:
100
+ work-repos:
101
+ root: /path/to/work/repos/work-repos
102
+
103
+ private-tools:
104
+ root: /path/to/private/repos/tools
105
+ log_repo: /path/to/private-tools/log-repo
106
+ ```
107
+
108
+ 4. Setup Git hooks globally:
109
+
110
+ ```bash
111
+ mkdir -p ~/.git-hooks
112
+ cp ~/.captains-log/commit-msg ~/.git-hooks/
113
+ chmod +x ~/.git-hooks/commit-msg
114
+ git config --global core.hooksPath ~/.git-hooks
115
+ ```
116
+
117
+ 5. Make the Python script executable:
118
+
119
+ ```bash
120
+ chmod +x ~/.captains-log/update_log.py
121
+ ```
122
+
123
+ ## Development Setup
124
+
125
+ This project uses UV for dependency management and Just for command running. To set up the development environment:
126
+
127
+ 1. Install UV if you haven't already:
128
+ ```bash
129
+ curl -LsSf https://astral.sh/uv/install.sh | sh
130
+ ```
131
+
132
+ 2. Install Just if you haven't already:
133
+ ```bash
134
+ # macOS
135
+ brew install just
136
+
137
+ # Linux
138
+ curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash
139
+
140
+ # Or with cargo
141
+ cargo install just
142
+ ```
143
+
144
+ 3. Install development dependencies:
145
+ ```bash
146
+ just install-test
147
+ ```
148
+
149
+ 4. Run tests:
150
+ ```bash
151
+ just test
152
+ ```
153
+
154
+ 5. Run tests with coverage:
155
+ ```bash
156
+ just test-cov
157
+ ```
158
+
159
+ 6. Clean up generated files:
160
+ ```bash
161
+ just clean
162
+ ```
163
+
164
+ 7. Run specific tests:
165
+ ```bash
166
+ just test-file test_update_log.py
167
+ just test-pattern "load_config"
168
+ ```
169
+
170
+ ## Usage
171
+
172
+ ### Automatic Git Commit Logging
173
+ After setup, every git commit you make will update a daily markdown log file inside the configured log repository/directories.
174
+
175
+ Logs are grouped by repository name under each project, with a date-based file (e.g., 2025-08-11.md).
176
+
177
+ ### Manual Log Entries with `btw` and `wtf` Commands
178
+
179
+ #### `btw` Command - Log What You Did
180
+ The `btw` (By The Way) command allows you to add manual entries to your daily logs from anywhere on your system:
181
+
182
+ ```bash
183
+ btw "Reviewed the new API documentation"
184
+ btw "Had a productive meeting about the architecture"
185
+ btw "Fixed a bug that wasn't committed yet"
186
+ ```
187
+
188
+ #### `wtf` Command - Log Issues and Problems
189
+ The `wtf` (What The Fault) command allows you to log issues, bugs, and weird behavior in the "What Broke or Got Weird" section:
190
+
191
+ ```bash
192
+ wtf "API endpoint started returning 500 errors"
193
+ wtf "Database connection timeout after 10 minutes"
194
+ wtf "Tests failing intermittently on CI"
195
+ ```
196
+
197
+ #### How They Work:
198
+ - **Smart Project Detection**: Uses the same project detection logic as git commits
199
+ - If you're in a configured project directory → logs to that project
200
+ - If not configured → uses the current directory name as project
201
+ - **Different Sections**:
202
+ - `btw` entries appear in the "What I did" section under "## other"
203
+ - `wtf` entries appear in the "What Broke or Got Weird" section
204
+ - **Same Infrastructure**: Uses your existing Captain's Log configuration and repositories
205
+
206
+ #### Examples:
207
+
208
+ ```bash
209
+ # From within your configured project directory
210
+ cd ~/work/my-project
211
+ btw "Completed code review for new feature"
212
+ # → Adds to my-project's daily log under "What I did" → "## other"
213
+
214
+ wtf "Found memory leak in background worker"
215
+ # → Adds to my-project's daily log under "What Broke or Got Weird" → "## other"
216
+
217
+ # From any directory
218
+ cd ~/Downloads
219
+ btw "Downloaded and reviewed the client requirements"
220
+ # → Adds to Downloads project log under "What I did"
221
+ ```
222
+
223
+ #### Installation:
224
+ Both commands are automatically installed with the main Captain's Log installation:
225
+ - Accessible globally from any directory
226
+ - Installed to `~/.local/bin/btw` and `~/.local/bin/wtf` (ensure `~/.local/bin` is in your PATH)
227
+ - No additional setup required after running `install.sh`
228
+
229
+ #### Log Format:
230
+ Your daily logs will show git commits by repository in "What I did", followed by a flat list in "What Broke or Got Weird":
231
+
232
+ ```markdown
233
+ # What I did
234
+
235
+ ## repository-name
236
+ - (abc1234) Actual git commit message
237
+
238
+ ## other-repo
239
+ - (def5678) Another git commit
240
+
241
+ ## other
242
+ - Manual entry added with btw command
243
+ - Another manual note
244
+
245
+ # Whats next
246
+
247
+
248
+ # What Broke or Got Weird
249
+
250
+ - Issue logged with wtf command
251
+ - Another problem to investigate
252
+ ```
253
+
254
+ ## Testing
255
+ To test if your installation is working correctly:
256
+
257
+ ### Basic Captain's Log Test
258
+ ```bash
259
+ python3 test_hook.py
260
+ ```
261
+
262
+ This will simulate a commit and show you if the log update is working properly.
263
+
264
+ ### Pre-commit Integration Test
265
+ If you installed pre-commit integration, test the dispatcher:
266
+
267
+ ```bash
268
+ python3 test_hook_precommit.py
269
+ ```
270
+
271
+ This will test that the hook dispatcher correctly runs pre-commit (if configured) followed by Captain's Log.
272
+
273
+ ## Troubleshooting
274
+
275
+ ### Hook not running
276
+ - Make sure you've run `install.sh` and it completed successfully
277
+ - Check that `git config --global core.hooksPath` points to `~/.git-hooks`
278
+ - Verify the `commit-msg` file exists in `~/.git-hooks/` and is executable
279
+
280
+ ### Pre-commit integration issues
281
+ - Ensure you ran `install.sh` before `install-with-precommit.sh`
282
+ - Check that both `commit-msg` and `commit-msg-precommit` exist in `~/.git-hooks/`
283
+ - If pre-commit errors occur, verify you have pre-commit installed: `pip install pre-commit`
284
+ - The integration only runs pre-commit in repos with `.pre-commit-config.yaml`
285
+
286
+ ### Script not found errors
287
+ - Ensure `update_log.py` was copied to `~/.captains-log/`
288
+ - Check that the script has execute permissions: `chmod +x ~/.captains-log/update_log.py`
289
+
290
+ ### Permission errors
291
+ - Make sure both the hook and script are executable
292
+ - Check that your user has write access to the log directories
293
+
294
+ ### Conflicting with existing pre-commit setup
295
+ If you previously used `pre-commit install` in repositories:
296
+ - You can safely leave existing `.git/hooks/` as they won't be used (global `core.hooksPath` takes precedence)
297
+ - Or clean them up with `pre-commit uninstall` in each repo if you prefer
298
+
299
+ ### `btw` or `wtf` command not found
300
+ If the `btw` or `wtf` commands are not accessible:
301
+ - Ensure `~/.local/bin` is in your PATH: `echo $PATH | grep ~/.local/bin`
302
+ - Add to your shell profile if missing: `echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc`
303
+ - Verify the symlinks exist: `ls -la ~/.local/bin/btw ~/.local/bin/wtf`
304
+ - Re-run the installation if needed: `./install.sh`