omp-worklog 0.14.4 → 0.14.6

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: cc7eb58427a4d399bbca72d279fb96448b356057f3dd00860cf74c1b36b5ccf9
4
- data.tar.gz: 8fcaa118dfcdf55dde097bfa8607bbb06ddbaa3f9f6bea1340082708087cd28f
3
+ metadata.gz: 0ee816df2ce095811beb7021f32892defbbf488840f02f0ff6e3019897f5298c
4
+ data.tar.gz: 443a96a73fa7bd0f4d4c37089712e1fe7126f5bc6d2800be843bf727b816667b
5
5
  SHA512:
6
- metadata.gz: cd8587f9774cbb4253aebb01d5d5b6d5ccdf9428f46d10c97d0ab381e6613a2ed0d81022c2347e85e180284471e64d7ec4621235a0e82e40c533c2d987acc972
7
- data.tar.gz: 22e1a457099d7997252b9437485279a6e2ceb08c39f93c7fa706211bada3541a5e09b867437b2fff8865c6df09fa10ccdc71b039fa7526c6b9707d9300eecaa5
6
+ metadata.gz: 2f54d4a599a17e35d500617c0aa7f44fa591f9167861343a414b3d650266b0c0e843dcdc4f84009f81c9939260b26bef867e00d43fd743418518895c7d7fd83c
7
+ data.tar.gz: 4a89084e3d29bc60fac8eaf06da3c409ec0b165fefc316f5d65777864f61cb2c0fbe55f33829589679d5a7608b74c087a27f89c56db39c725c0782569d4d1bc2
data/README.md CHANGED
@@ -81,7 +81,7 @@ Type `/worklog ` in OMP to discover `timesheet`; date aliases appear after selec
81
81
 
82
82
  ## OMP settings
83
83
 
84
- The manifest declares the following settings. **Persisted settings are currently inactive in the extension**: OMP does not expose resolved user-plus-project plugin settings at factory initialization. Explicit factory options work for programmatic callers and tests. [Issue #134](https://github.com/klondikemarlen/omp-worklog/issues/134) tracks the host dependency; do not assume a successful `omp plugin config set` changed runtime behavior.
84
+ Worklog resolves persisted user settings and project overrides through the supported `omp plugin config list omp-worklog --json` command at initialization, using the OMP project cwd. Project values override user values; explicit factory options override both for programmatic callers and tests. Resolution runs once before commands and tools register; restart or reload the extension after changing settings. A resolution failure reports a diagnostic instead of silently using the wrong destination.
85
85
 
86
86
  - `defaultHours`: hours per business day when a time-off tool call omits `hours`; defaults to `7`.
87
87
  - `holidayRegions`: comma-separated Holidays regions; defaults to `ca_yt`.
@@ -121,6 +121,16 @@ Version `0.14.0` is a clean identity cutover. Uninstall the retired `harvest-wor
121
121
 
122
122
  Version `0.14.3` renames the OMP slash command from `/omp-worklog` to `/worklog`; the `omp-worklog` package identity and CLI executable are unchanged.
123
123
 
124
+ ## Changes in 0.14.6
125
+
126
+ - Activate persisted settings through the supported host CLI before registering commands, completion, and tools.
127
+ - Honor project override precedence and retain explicit factory-option overrides without parsing host configuration files.
128
+
129
+ ## Changes in 0.14.5
130
+
131
+ - Preserve saved user settings across the required clean plugin reinstall, without copying project overrides or manifest defaults into user configuration.
132
+ - Retain an owner-only recovery snapshot and report its path; abort before uninstalling when settings cannot be exported.
133
+
124
134
  ## Changes in 0.14.4
125
135
 
126
136
  - Preserve short positive durations in mapped and review-required drafts.
@@ -148,4 +158,6 @@ omp-worklog --help
148
158
 
149
159
  `npm run release` owns the plugin uninstall/force-install mutation, including removal of the retired plugin when present. `npm run verify:release` never changes the installation: it checks the installed package version, resolved Git revision, and plugin path, then runs the installed JavaScript test suite. It exits after verification; tests alone do not exercise a fresh OMP host.
150
160
 
151
- After installation, start a new OMP process and exercise `/worklog` completion and a timesheet against synthetic local evidence. Verify that a newly committed SQLite project appears without restarting that process. Existing sessions retain startup-loaded extension code and cannot prove the released artifact. Use explicit factory options for a mapped smoke until #134 is resolved; do not claim persisted-setting activation from that smoke.
161
+ The release wrapper exports explicit user settings through OMP's configuration CLI from an isolated temporary directory before uninstalling. It saves `settings.json` in an owner-only recovery directory, prints that path without values, restores settings through the CLI, and verifies equality after installation. Project overrides remain project-scoped; unset defaults stay unset. Keep the reported backup until the release is confirmed. If installation or restoration fails, recover from that private snapshot after resolving the reported phase; do not paste its contents into an issue.
162
+
163
+ After installation, start a new OMP process and exercise `/worklog` completion and a timesheet against synthetic local evidence. Verify that a newly committed SQLite project appears without restarting that process. Existing sessions retain startup-loaded extension code and cannot prove the released artifact. Verify a persisted user mapping and then a different project override; an explicit factory-option smoke alone does not prove saved configuration activation.
data/bin/release-plugin CHANGED
@@ -1,19 +1,68 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- installed_plugin() {
5
- omp plugin list --json | node -e '
6
- const plugins = JSON.parse(require("fs").readFileSync(0, "utf8")).npm ?? []
7
- process.exit(plugins.some(plugin => plugin.name === process.argv[1]) ? 0 : 1)
8
- ' "$1"
1
+ #!/usr/bin/env node
2
+ import { execFileSync } from "node:child_process"
3
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs"
4
+ import { tmpdir } from "node:os"
5
+ import { join } from "node:path"
6
+ import { isDeepStrictEqual } from "node:util"
7
+
8
+ // The CLI resolves settings against cwd; an isolated directory excludes project overrides.
9
+ const directory = mkdtempSync(join(tmpdir(), "omp-worklog-release-"))
10
+ let phase = "listing installed plugins"
11
+ let snapshotPath
12
+
13
+ function run(description, args) {
14
+ phase = description
15
+ return execFileSync("omp", args, {
16
+ cwd: directory,
17
+ encoding: "utf8",
18
+ stdio: ["ignore", "pipe", "pipe"],
19
+ })
9
20
  }
10
21
 
11
- if installed_plugin omp-worklog; then
12
- omp plugin uninstall omp-worklog
13
- fi
22
+ function userSettings() {
23
+ const { settings } = JSON.parse(run("exporting user settings", ["plugin", "config", "list", "omp-worklog", "--json"]))
24
+ if (!settings || typeof settings !== "object" || Array.isArray(settings)) {
25
+ throw new Error("Invalid settings export")
26
+ }
27
+
28
+ return settings
29
+ }
14
30
 
15
- if installed_plugin harvest-worklog; then
16
- omp plugin uninstall harvest-worklog
17
- fi
31
+ try {
32
+ const plugins = JSON.parse(run("listing installed plugins", ["plugin", "list", "--json"])).npm ?? []
33
+ const installed = new Set(plugins.map(plugin => plugin.name))
34
+ let settings
35
+ if (installed.has("omp-worklog")) {
36
+ settings = userSettings()
37
+ const backupPath = join(directory, "settings.json")
38
+ phase = "saving the private settings snapshot"
39
+ writeFileSync(backupPath, JSON.stringify(settings), { mode: 0o600, flag: "wx" })
40
+ snapshotPath = backupPath
41
+ console.log(`Saved private Worklog settings backup: ${snapshotPath}`)
42
+ run("uninstalling omp-worklog", ["plugin", "uninstall", "omp-worklog"])
43
+ }
18
44
 
19
- omp plugin install --force github:klondikemarlen/omp-worklog
45
+ if (installed.has("harvest-worklog")) {
46
+ run("uninstalling harvest-worklog", ["plugin", "uninstall", "harvest-worklog"])
47
+ }
48
+
49
+ run("installing omp-worklog", ["plugin", "install", "--force", "github:klondikemarlen/omp-worklog"])
50
+ if (settings) {
51
+ for (const [key, value] of Object.entries(settings)) {
52
+ const argument = typeof value === "string" ? value : JSON.stringify(value)
53
+ run("restoring user settings", ["plugin", "config", "set", "omp-worklog", key, argument])
54
+ }
55
+ if (!isDeepStrictEqual(userSettings(), settings)) {
56
+ phase = "verifying restored user settings"
57
+ throw new Error("Settings changed")
58
+ }
59
+ }
60
+
61
+ console.log("Installed omp-worklog; user settings preserved.")
62
+ } catch {
63
+ console.error(`Worklog release failed while ${phase}.`)
64
+ if (snapshotPath) console.error(`Recover saved user settings from ${snapshotPath}.`)
65
+ process.exitCode = 1
66
+ } finally {
67
+ if (!snapshotPath) rmSync(directory, { recursive: true, force: true })
68
+ }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OmpWorklog
4
- VERSION = "0.14.4"
4
+ VERSION = "0.14.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omp-worklog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.4
4
+ version: 0.14.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marlen Brunner