harvest-worklog 0.10.3 → 0.10.5
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.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/harvest_worklog/mapping_data_cli.rb +37 -0
- data/lib/harvest_worklog/version.rb +1 -1
- data/lib/harvest_worklog.rb +7 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a02b45a165e90c981ab885d5982c4cd8b79554c63cce9b48fa7ce970db7200c9
|
|
4
|
+
data.tar.gz: 7ac70cf30b3ce14436c9ac79521befea6605bd1f7c1e6eb41155738c7b87ee4a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 416fdb9c4b3d57f180c606d64777126378e817dff7694ef24eefb7a351c8840a67e58cb17b7853668e930b3659ab1fdced6cd0049cb97abb83b036ca6e1aac35
|
|
7
|
+
data.tar.gz: abfe455ea35843188b3399ca568b7095051f994733e4a2626397ed5424c0dc6e56b463843bf6670183db27c83b15eb06285203a237ff89e9b6744c732b1181f0
|
data/README.md
CHANGED
|
@@ -62,7 +62,7 @@ harvest-worklog aggregate 2026-07-17 2026-07-19 \
|
|
|
62
62
|
|
|
63
63
|
The `harvest_time_aggregates` OMP tool exposes the same optional filters and is approval-gated as a read.
|
|
64
64
|
|
|
65
|
-
###
|
|
65
|
+
### Timesheets
|
|
66
66
|
|
|
67
67
|
The CLI `timesheet` command and `harvest_time_sheet` OMP tool read the authenticated user's compact daily Harvest view. They show task totals, entry durations, and notes already recorded in Harvest.
|
|
68
68
|
|
|
@@ -70,10 +70,10 @@ The CLI `timesheet` command and `harvest_time_sheet` OMP tool read the authentic
|
|
|
70
70
|
harvest-worklog timesheet today --project WRAP
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
The `/harvest-worklog timesheet today --project wrap` slash command
|
|
74
|
-
`/project-time history` reports all logged dates, so its totals can be larger than
|
|
73
|
+
The `/harvest-worklog timesheet today --project wrap` slash command reads only the requested local OMP Project Time day. Its output explicitly says `Source: local OMP Project Time (not Harvest)`, shows up to five duration-ranked activity labels and an honest total for any other activity labels, then asks the active OMP model for a clearly labelled best-effort worklog draft from those same local records. If no model is available or generation fails, the local totals still render. When `projectTimeMappings` contains `wrap`, it separately shows the prospective `Harvest destination`; it does not present that destination as recorded Harvest data. It never calls Harvest or uploads entries.
|
|
74
|
+
`/project-time history` reports all logged dates, so its totals can be larger than the selected day.
|
|
75
75
|
|
|
76
|
-
Type `/harvest-worklog ` in OMP to discover `timesheet
|
|
76
|
+
Type `/harvest-worklog ` in OMP to discover `timesheet`; date aliases appear only after selecting `timesheet `. After `--project`, Tab lists local human-active Project Time project names; a prefix filters them case-insensitively. Completion preserves the case-sensitive name required by the command.
|
|
77
77
|
|
|
78
78
|
## OMP settings
|
|
79
79
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module HarvestWorklog
|
|
6
|
+
class MappingDataCLI
|
|
7
|
+
def self.run(arguments, output: $stdout, error: $stderr, client: nil)
|
|
8
|
+
from, to = arguments
|
|
9
|
+
raise Error, "FROM and TO are required" unless arguments.length == 2
|
|
10
|
+
|
|
11
|
+
from = Date.iso8601(from)
|
|
12
|
+
to = Date.iso8601(to)
|
|
13
|
+
raise Error, "end date must not be before start date" if to < from
|
|
14
|
+
|
|
15
|
+
client ||= Marlens::HarvestApiV2::Client.from_environment
|
|
16
|
+
assignments = client.active_personal_task_assignments.filter_map do |assignment|
|
|
17
|
+
project = assignment["project"]
|
|
18
|
+
task = assignment["task"]
|
|
19
|
+
next unless project&.fetch("id", nil) && project&.fetch("name", nil) && task&.fetch("id", nil) && task&.fetch("name", nil)
|
|
20
|
+
|
|
21
|
+
{ "project" => { "id" => project.fetch("id"), "name" => project.fetch("name") }, "task" => { "id" => task.fetch("id"), "name" => task.fetch("name") } }
|
|
22
|
+
end
|
|
23
|
+
entries = AggregateCLI.fetch_entries(client, from:, to:).filter_map do |entry|
|
|
24
|
+
project = entry["project"]
|
|
25
|
+
task = entry["task"]
|
|
26
|
+
next unless project&.fetch("id", nil) && project&.fetch("name", nil) && task&.fetch("id", nil) && task&.fetch("name", nil) && Float(entry.fetch("hours"))
|
|
27
|
+
|
|
28
|
+
{ "project" => { "id" => project.fetch("id"), "name" => project.fetch("name") }, "task" => { "id" => task.fetch("id"), "name" => task.fetch("name") }, "hours" => entry.fetch("hours") }
|
|
29
|
+
end
|
|
30
|
+
output.puts JSON.generate(assignments:, entries:)
|
|
31
|
+
0
|
|
32
|
+
rescue Error, Marlens::HarvestApiV2::Error, Date::Error => e
|
|
33
|
+
error.puts "Error: #{e.message}"
|
|
34
|
+
1
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/lib/harvest_worklog.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require "harvest_worklog/version"
|
|
4
4
|
require "business_time"
|
|
5
5
|
require "date"
|
|
6
|
+
require "json"
|
|
6
7
|
require "holidays"
|
|
7
8
|
require "optparse"
|
|
8
9
|
require "marlens/harvest_api_v2"
|
|
@@ -38,11 +39,13 @@ module HarvestWorklog
|
|
|
38
39
|
AggregateCLI.run(command_arguments, output:, error:, client:)
|
|
39
40
|
when "timesheet"
|
|
40
41
|
TimesheetCLI.run(command_arguments, output:, error:, client:)
|
|
42
|
+
when "mapping-data"
|
|
43
|
+
MappingDataCLI.run(command_arguments, output:, error:, client:)
|
|
41
44
|
when "-h", "--help"
|
|
42
45
|
output.puts usage
|
|
43
46
|
0
|
|
44
47
|
else
|
|
45
|
-
error.puts "Error: choose time-off, work-entry, aggregate, or
|
|
48
|
+
error.puts "Error: choose time-off, work-entry, aggregate, timesheet, or mapping-data"
|
|
46
49
|
error.puts usage
|
|
47
50
|
1
|
|
48
51
|
end
|
|
@@ -57,12 +60,14 @@ module HarvestWorklog
|
|
|
57
60
|
harvest-worklog work-entry DATE --project-id ID --task-id ID --hours HOURS --notes NOTES [options]
|
|
58
61
|
harvest-worklog aggregate FROM TO [--project NAME] [--task NAME]
|
|
59
62
|
harvest-worklog timesheet DATE --project NAME [--task NAME]
|
|
63
|
+
harvest-worklog mapping-data FROM TO
|
|
60
64
|
|
|
61
65
|
Commands:
|
|
62
66
|
time-off Create one entry per local business day in a date range.
|
|
63
67
|
work-entry Create one reviewed ordinary-work entry.
|
|
64
68
|
aggregate Read time-entry totals without writing Harvest records.
|
|
65
69
|
timesheet Read a compact daily project timesheet without writing Harvest records.
|
|
70
|
+
mapping-data Read assigned Harvest destinations and historical entries without writing.
|
|
66
71
|
USAGE
|
|
67
72
|
end
|
|
68
73
|
end
|
|
@@ -186,3 +191,4 @@ end
|
|
|
186
191
|
require "harvest_worklog/work_entry_cli"
|
|
187
192
|
require "harvest_worklog/aggregate_cli"
|
|
188
193
|
require "harvest_worklog/timesheet_cli"
|
|
194
|
+
require "harvest_worklog/mapping_data_cli"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: harvest-worklog
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.10.
|
|
4
|
+
version: 0.10.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marlen Brunner
|
|
@@ -65,6 +65,7 @@ files:
|
|
|
65
65
|
- harvest-worklog.rb
|
|
66
66
|
- lib/harvest_worklog.rb
|
|
67
67
|
- lib/harvest_worklog/aggregate_cli.rb
|
|
68
|
+
- lib/harvest_worklog/mapping_data_cli.rb
|
|
68
69
|
- lib/harvest_worklog/timesheet_cli.rb
|
|
69
70
|
- lib/harvest_worklog/version.rb
|
|
70
71
|
- lib/harvest_worklog/work_entry_cli.rb
|