harvest-worklog 0.10.2 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f1908df098837d21f4966ce8f56800ecdece9226b78a7ce2739aa154a926a61
4
- data.tar.gz: '083aab29fd401584e987413bcfd9a08e3a25bf20a87e5c94fd6830f9ced89d7d'
3
+ metadata.gz: a02b45a165e90c981ab885d5982c4cd8b79554c63cce9b48fa7ce970db7200c9
4
+ data.tar.gz: 7ac70cf30b3ce14436c9ac79521befea6605bd1f7c1e6eb41155738c7b87ee4a
5
5
  SHA512:
6
- metadata.gz: 5b914fac7e561a5d6c08c3015d9fad0870b4e1b7bc71a709d014f07de4a1f2f271439c73cc26ccc3bf37868e8322c06329f5a36e88f3ca502276f57db73af921
7
- data.tar.gz: 76f3b76c1d27cde0dcc90f92f956f8e47c12f6788f08f9cf60c303543ebe08363f13d2197d5bbc9dddd4ffb53c36b04e36c5a5772660fdd72065fa3995ff311e
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
- ### Daily timesheets
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 instead reads local OMP Project Time and reports separate `Human active` and `Agent elapsed` totals. It does not call Harvest or require `projectTimeMappings`; mappings remain specific to previewing or recording Harvest entries.
74
- `/project-time history` reports all logged dates, so its totals can be larger than a single-day timesheet.
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`, then select `today`, `yesterday`, or an ISO date before the contextual `--project` option. The editable project name must exactly match the case-sensitive local Project Time name.
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
 
@@ -137,8 +137,9 @@ gem push "harvest-worklog-${VERSION}.gem"
137
137
  gem uninstall harvest-time-off --all --executables --ignore-dependencies
138
138
  gem install --clear-sources --source https://rubygems.org harvest-worklog --version "$VERSION" --no-document
139
139
  omp plugin uninstall harvest-time-off
140
+ npm run release
140
141
  npm run verify:release
141
142
  harvest-worklog --help
142
143
  ```
143
144
 
144
- OMP loads extensions at process startup; reinstalling a plugin does not update already-running sessions. Confirm `harvest-worklog@<VERSION>` in `omp plugin list`, then start a fresh OMP process for autocomplete and slash-command QA. Exit and restart every older OMP session before relying on the released behavior.
145
+ `npm run release` owns the uninstall/force-install mutation. `npm run verify:release` never changes the installation: it checks the exact installed version and runs a deterministic slash-command smoke test against the installed plugin. It exits after verification. Existing OMP sessions retain startup-loaded extension code; restart them before optional manual autocomplete and slash-command QA.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ omp plugin uninstall harvest-worklog
5
+ omp plugin install --force github:klondikemarlen/harvest-worklog
@@ -5,14 +5,11 @@ root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5
5
  cd "$root"
6
6
  version="$(node -p 'require("./package.json").version')"
7
7
 
8
- omp plugin uninstall harvest-worklog
9
- omp plugin install --force github:klondikemarlen/harvest-worklog
10
- plugins="$(omp plugin list)"
11
- if [[ "$plugins" != *"harvest-worklog@$version"* ]]; then
12
- printf 'Expected harvest-worklog@%s after install.\n%s\n' "$version" "$plugins" >&2
8
+ installed_version="$(node -p 'require(process.env.HOME + "/.omp/plugins/node_modules/harvest-worklog/package.json").version')"
9
+ if [[ "$installed_version" != "$version" ]]; then
10
+ printf 'Expected installed harvest-worklog@%s, found %s.\n' "$version" "$installed_version" >&2
13
11
  exit 1
14
12
  fi
15
-
16
- printf 'Verified harvest-worklog@%s. Starting fresh OMP for slash-command QA.\n' "$version"
17
- printf 'Existing OMP sessions must also be restarted.\n'
18
- exec omp --no-session --no-tools --cwd "$root"
13
+ node --test "$HOME/.omp/plugins/node_modules/harvest-worklog/test/"*.test.js
14
+ printf 'Verified harvest-worklog@%s.\n' "$version"
15
+ printf 'Existing OMP sessions must be restarted before manual QA.\n'
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HarvestWorklog
4
- VERSION = "0.10.2"
4
+ VERSION = "0.10.5"
5
5
  end
@@ -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 timesheet"
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.2
4
+ version: 0.10.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marlen Brunner
@@ -60,10 +60,12 @@ extra_rdoc_files: []
60
60
  files:
61
61
  - README.md
62
62
  - bin/harvest-worklog
63
+ - bin/release-plugin
63
64
  - bin/verify-plugin-release
64
65
  - harvest-worklog.rb
65
66
  - lib/harvest_worklog.rb
66
67
  - lib/harvest_worklog/aggregate_cli.rb
68
+ - lib/harvest_worklog/mapping_data_cli.rb
67
69
  - lib/harvest_worklog/timesheet_cli.rb
68
70
  - lib/harvest_worklog/version.rb
69
71
  - lib/harvest_worklog/work_entry_cli.rb