Reference¶
API and internal module reference for Seev. This section will be populated with mkdocstrings in later phases.
Prompts¶
Server-side assistant prompts available via MCP (overview; detailed docs to be generated in a later phase).
- worklog_entry — generate a structured worklog for a date or range This section is generated via mkdocstrings for the core Python APIs. Use the page ToC to navigate types and functions. See also: MCP Tools and Prompts.
Configuration¶
Configuration management for Seev.
Phase 2 additions: read-only handling of DB/Markdown-related environment flags. - SEEV_DB_PATH: optional filesystem path to the SQLite database file. - SEEV_DB_AUTOWRITE: when truthy, certain integrations may persist data automatically. - SEEV_MD_PATH: optional filesystem path to the Markdown worklog file.
Also supports a lightweight seev.toml file with keys:
- track_emails = ["..."]
- track_repositories = ["..."]
- db_path = "..." # new: database path
- markdown_path = "..." # new: markdown file path
Backward compatibility: - Legacy glin.toml configuration files are still read if seev.toml is not present.
create_config_file(emails, config_path=None)
¶
Create a glin.toml configuration file with the specified emails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emails
|
list[str]
|
List of email addresses to track |
required |
config_path
|
Path | None
|
Optional path for config file. Defaults to ./glin.toml |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the created configuration file |
Source code in seev/config.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
get_db_autowrite()
¶
Return True if SEEV_DB_AUTOWRITE is a truthy value.
Accepted truthy values (case-insensitive): '1', 'true', 'yes', 'on'.
Source code in seev/config.py
196 197 198 199 200 201 202 203 204 | |
get_db_path()
¶
Return the DB path to use for SQLite storage.
Precedence:
1. SEEV_DB_PATH if set (respects exact value, including ":memory:")
2. seev.toml key db_path (with glin.toml fallback)
3. Sensible default: ~/.seev/db.sqlite3
This function is read-only; it does not create files or directories.
Source code in seev/config.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
get_markdown_path()
¶
Return the Markdown worklog path.
Precedence:
1. SEEV_MD_PATH if set
2. seev.toml key markdown_path (with glin.toml fallback)
3. Default: ./WORKLOG.md
Source code in seev/config.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
get_tracked_emails()
¶
Get the list of email addresses to track commits from.
Priority order: 1. SEEV_TRACK_EMAILS environment variable (comma-separated) 2. seev.toml configuration file (with glin.toml fallback) 3. Git user.email configuration 4. Git user.name configuration (as fallback)
Returns:
| Type | Description |
|---|---|
list[str]
|
List of email addresses/patterns to track. Empty list if none configured. |
Source code in seev/config.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
get_tracked_repositories()
¶
Return the list of repositories to include when building worklogs.
Accepted formats per entry: - Local filesystem path to a Git repo - GitHub shorthand "owner/repo" - Full Git remote URL (https or ssh)
Precedence: 1. SEEV_TRACK_REPOSITORIES (comma-separated) [fallback: SEEV_TRACK_REPOS] 2. seev.toml key track_repositories = ["..."] (with glin.toml fallback)
Source code in seev/config.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
set_tracked_emails_env(emails)
¶
Set the SEEV_TRACK_EMAILS environment variable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emails
|
list[str]
|
List of email addresses to track |
required |
Source code in seev/config.py
119 120 121 122 123 124 125 126 127 | |
set_tracked_repositories_env(repositories)
¶
Set SEEV_TRACK_REPOSITORIES environment variable to a comma-separated list.
Source code in seev/config.py
296 297 298 | |
Markdown Utilities¶
DateEntryResponse
¶
Bases: TypedDict
Response from reading a date entry.
Source code in seev/markdown_tools.py
49 50 51 52 53 54 55 56 | |
DateEntrySections
¶
Bases: TypedDict
Parsed sections from a date entry.
Source code in seev/markdown_tools.py
36 37 38 39 40 41 42 43 44 45 46 | |
MarkdownErrorResponse
¶
Bases: TypedDict
Error response from markdown operation.
Source code in seev/markdown_tools.py
30 31 32 33 | |
MarkdownSuccessResponse
¶
Bases: TypedDict
Successful markdown append operation response.
Source code in seev/markdown_tools.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
append_to_markdown(content, file_path=None, date_str=None, *, preserve_lines=False, update_mode=False)
¶
Append content under a date heading in a markdown file.
Behavior:
- Default (preserve_lines=False): Each non-empty input line becomes a markdown bullet
("- ...").
- Raw mode (preserve_lines=True): Lines are written as-is (no automatic bullet prefix).
Useful for writing headings like "### Goals".
- Update mode (update_mode=True): Read existing entry for the date and merge new content
with existing sections instead of appending.
- Ensures a heading for the specified date ("## YYYY-MM-DD"). If no date is provided, uses
the current local date. Creates it if missing.
- Appends content under the chosen date's heading, before the next heading or at the end.
- Path resolution: file_path argument > SEEV_MD_PATH env var > seev.toml markdown_path
(with glin.toml fallback) > ./WORKLOG.md.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
str
|
The text to append. Must be non-empty (after stripping). Newlines will be normalized. |
required |
file_path
|
str | None
|
Optional target file path. Can be absolute or relative to the repo root. |
None
|
date_str
|
str | None
|
Optional date string in ISO format (YYYY-MM-DD). When provided, content is added under this date's heading instead of today's. |
None
|
preserve_lines
|
bool
|
When True, write lines as-is; when False, prefix each non-empty line with "- ". |
False
|
update_mode
|
bool
|
When True, read existing entry for the date and merge new content with existing sections instead of appending. When False (default), append as before (backward compatible). |
False
|
Returns:
| Type | Description |
|---|---|
MarkdownSuccessResponse | MarkdownErrorResponse
|
A dict with operation details or an error message, including the exact content and |
MarkdownSuccessResponse | MarkdownErrorResponse
|
line numbers added. |
Source code in seev/markdown_tools.py
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 | |
merge_date_sections(existing, new_content, *, preserve_lines=False)
¶
Merge new content with existing date entry sections.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
existing
|
DateEntryResponse
|
Result from read_date_entry |
required |
new_content
|
str
|
New markdown content to merge (with ### sections) |
required |
preserve_lines
|
bool
|
Same semantics as append_to_markdown |
False
|
Returns:
| Type | Description |
|---|---|
tuple[str, int]
|
Tuple of (merged markdown content ready to write, deduplicated count) |
Source code in seev/markdown_tools.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | |
read_date_entry(date_str, file_path=None)
¶
Read and parse an existing date entry from the markdown file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date_str
|
str
|
Date in ISO format (YYYY-MM-DD) to search for. |
required |
file_path
|
str | None
|
Optional target file path. Uses same resolution as append_to_markdown. |
None
|
Returns:
| Type | Description |
|---|---|
DateEntryResponse
|
A dict with exists flag, date, heading line number, parsed sections, and raw content. |
DateEntryResponse
|
If the date entry doesn't exist, returns exists=False with empty sections. |
Source code in seev/markdown_tools.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
Git Tools¶
Branches¶
Commits¶
Files¶
Diffs¶
Remotes¶
determine_commit_url_prefix(remote_url)
¶
Given a Git remote URL, derive the HTTPS commit URL prefix for common hosts.
Supported providers and their commit URL patterns:
- GitHub: https://
Returns {"prefix": "..."} or {"error": "..."} when unknown or unparseable.
Source code in seev/git_tools/remotes.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
get_remote_origin(workdir=None)
¶
Return information about the remote named 'origin' for the current repository.
On success: {"name": "origin", "url": "..."} On failure: {"error": "..."}
Source code in seev/git_tools/remotes.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
Analysis¶
blame_file(path, start_line=1, end_line=None, rev='HEAD', workdir=None)
¶
Run git blame on a file or a line range.
Returns a structured list with commit, author, date and code for each line.
Source code in seev/git_tools/analysis.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
categorize_commit(message_or_hash, is_hash=False, workdir=None)
¶
Categorize a commit message using Conventional Commits.
If is_hash=True, the argument is treated as a commit hash and its subject is resolved first.
Source code in seev/git_tools/analysis.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
detect_merge_info(commit_hash, workdir=None)
¶
Detect whether a commit is a merge, and whether it's a PR merge.
Heuristics for PR merges:
- Subject contains "Merge pull request #git rev-list --parents -n 1
Source code in seev/git_tools/analysis.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
get_commit_statistics(commit_hash, workdir=None)
¶
Aggregate simple statistics for a commit, including language breakdown.
Uses git show --numstat and infers language from file extensions.
Source code in seev/git_tools/analysis.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |
Enrichment¶
get_enriched_commits(workdir, since, until='now')
¶
Return commits within a date range enriched with analysis metadata.
Adds per-commit statistics, conventional commit categorization, and merge/PR detection.
When the underlying commit query returns informational or error items (e.g., no configured emails, or no commits in range), forward that response directly for the caller to handle. Otherwise, return a structured object with commits and aggregated totals.
Source code in seev/git_tools/enrichment.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
Sessions¶
detect_work_sessions(commits, gap_threshold_minutes=30)
¶
Group commits into logical work sessions.
Heuristics:
- Time gaps greater than gap_threshold_minutes start a new session
- Primary type inferred from enriched category.type when present
- Simple theme inferred from most common non-trivial words in messages
The function is tolerant to mixed commit dict shapes. If commits are not
enriched, it still works using basic fields (date, message, etc.).
Source code in seev/git_tools/sessions.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
get_work_sessions(since, until='now', gap_threshold_minutes=30)
¶
High-level API to compute sessions for a date range.
Prefers enriched commits for better type detection; falls back to raw commits when enrichment returns an error/info payload.
Source code in seev/git_tools/sessions.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |