Skip to content

πŸ•‘ A personal git log and MacJournal aggregator, written in rust.

Notifications You must be signed in to change notification settings

StevenBlack/timesheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

86 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ•‘ A daily timesheet aggregator for git log and MacJournal

A personal project, written in rust.

This is an aggregator

The Aggregator is a special Filter that receives a stream of messages and identifies messages that are correlated. Once a complete set of messages has been received (more on how to decide when a set is 'complete' below), the Aggregator collects information from each correlated message and publishes a single, aggregated message to the output channel for further processing.

We aggregate records from different sources β€” git log and MacJournal β€” into one literate timesheet paragraph per day.

Background

I use git log and (the most excellent) MacJournal for journalling. I merge these two sources to create a one paragraph summary of my project day.

This is a tedious manual process. Automate it!

automate-all-the-things

Raw input from git log

My git log command is shaped like this:

git log --pretty="format:%cd %s" --since="60 days ago" --date="short" >> "gitoutput.txt"

... which produces a log that looks like this:

2021-12-01 0.13.6
2021-12-01 Issue #2971 and #2951: assessing the sorry-ass state of our data pipeline.
2021-12-01 Issue #3341: check the weekend schedule, why is there is no Saturday schedule this week.
2021-12-01 Issue #404: fix β€” promote the Job screen to the main menu, and rename it "Upcoming Jobs".
2021-12-01 Issue curation.
2021-12-01 Afternoon coordination meeting with QA.
2021-12-01 Issue 405: refactor β€” reorganise this long query to make it easier to deconstruct.
2021-12-01 After hours β€” update test/dev data.

Raw input from MacJournal export

Selecting a bunch of entries in MacJournal then right+click ➑️ Export gives me a bunch of dates, each day looks like this:

Date: 1 December 2021 at 12:15
Topic: Tasks today

Morning call with the Dev team.
Final testing of version 0.13.6.
Release version 0.13.6 to userland.
Issue #3138: adjust a part production report, and regenerate it.
Issue #3138: delete all the void entries from the production parts table.
Issue #3140: new issue about making reworked parts easy to move and merge.
Issue #3141: sales dept reports parts are missing in new estimates, so investigating that.
After hours β€” update test/dev data.

What I need

Those inputs are aggregated into one line of literate text, on one line per day, that looks like this:

2021-12-01 Afternoon coordination meeting with QA.  etc...

Details

The following apply:

Git tags (status: 🟒)

Input: Lines with raw git tags look like this: "0.13.6".

Output: They should become the sentence "Version 0.13.6 built, texted, and rolled out."

Remove trivial commits (status: 🟒)

Input: Commits that say trivial things like "Fix whitespace" or just "Whitespace", or "Fix typo" or just "Typo", or the latin "Ibid.", are dropped.

Output: nothing.

Repeated issue references (status: 🟒)

Input: Repeated commits referring to the same issue, originally this....

Issue #3138: fix β€” thing one.
Issue #3138: fix β€” thing two.
Issue #3138: fix β€” thing three.

Output: ... become (note the semicolon ; delimiter and the period . at the end.)

Issue #3138: fix β€” thing one; fix β€” thing two; fix β€” thing three.

Repeated version references (status: 🟒)

Input: Handwritten version number commits lke ...

2021-12-01 Something version 0.3.11
2021-12-01 Something version 0.3.12
2021-12-01 Something version 0.3.13

Output: ... become (note the semicolon , except with and as the last delimiter, and the period . at the end.)

Issue #3138: Something version 0.3.11, 0.3.12, and 0.3.13 built, tested, and rolled out.

Usage

$ timesheet -h

timesheet 0.3.0
Timesheet from git log output and MaJournal export data.

USAGE:
    timesheet [FLAGS] [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information
    -v, --verbose    Output process information

OPTIONS:
    -g <gitlogfile>            The git log input file [default: ./commits.txt]
    -m <macjournalfile>        The MacJournal input file [default: ./macjournal.txt]

For Example

Using this repository, for example:

$ git log --pretty="format:%cd %s" --since="60 days ago" --date="short" > "gitoutput.txt"
$ timesheet -g gitoutput.txt > clean.txt

Yields this in clean.txt:

(Updated: December 15, 2021)

2021-12-06 First commit. Incremental improvement with a Commuitstruc
2021-12-07 Add to readme. Create readme.md. Improve the joining of elements, and handling of semver tags. Improvements on the MacJournal side. Minor tidy. Start processing the Macjournal export file.
2021-12-08 "Work in progress" Add feature status icons. Add link to the definition of Ibid. Add structopt to dependencies. Better comment about these functions. Doesn't apply on the MacJournal side. More readme fixes. More readme refinements. More readme shenanegans. More readme tweaks. Remove commented code. Split everything into git and MacJournal modules. Test for the semver tag detector. Update the readme.
2021-12-09 Add another aspirational target feature to the readme. Add structop struct, and marshall the vecs from both git and macjournal modules. Cleanup in the macjournal module. Move git module functionality to main.rs. Refactor types and traits. Small reorg of the readme. Start roughing-in a basic config file named .timesheet.
2021-12-10 Don't need these tests. Fix test. New function commasand(), to be used for consolidated enumeration. Playing with structopt. Rename common.rs to utils.rs. Run everything through shared settings now.
2021-12-11 Better default file names. Dedup the git log and macjournal vecs as part of their processing. Implement structopt-toml to give us the ability to use a TOML config file anywhere up the parent folder tree. Improve help text. Introducing the .timesheet config file. Latest cargo.lock. Rename fn commasand to fn ommas_and(). Setting-up the dryrun option. Sort the vec. The config file is now named .timesheetrc and we have a .timesheetrc-sample file.
2021-12-12 Better comments for utils functions, now gradually moving to RustDoc compliance.
2021-12-13 Invoke commas_and() for semver commits.
2021-12-14 Add a test for semver commit processing. Better modularization for the semver consolidation test. Decent start on issue commit consolidation. Implement the parsing of issue commits. New trait on Commit: Isissueprefix. Optimize the semver regex definition so we don't build it with each function call. Remove test that doesn't belong here. Simplify naming to, simply, 'issue'.
2021-12-15 Better handling for dropping 'Ibid.' commits. Ensure the very last day iterated ends-up in datevecs. More readme elaboration. Only drop 'Ibid.' commits if the line starts with 'Ibid.'. Provide a coherent example, and update the peadme. This functionality does not apply. Update readme and demo input and output. Update readme. Update the readme.

About

πŸ•‘ A personal git log and MacJournal aggregator, written in rust.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages