omp-worklog 0.14.4 → 0.14.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: cc7eb58427a4d399bbca72d279fb96448b356057f3dd00860cf74c1b36b5ccf9
4
- data.tar.gz: 8fcaa118dfcdf55dde097bfa8607bbb06ddbaa3f9f6bea1340082708087cd28f
3
+ metadata.gz: e13d4863a853283acc2fbefdd433c6fa6dd38e5180f483fe647a29067621dfab
4
+ data.tar.gz: bdb0edda46245581f6ee7e68c71f3bac263eb6f78996f8dd3ccca7d135985f2a
5
5
  SHA512:
6
- metadata.gz: cd8587f9774cbb4253aebb01d5d5b6d5ccdf9428f46d10c97d0ab381e6613a2ed0d81022c2347e85e180284471e64d7ec4621235a0e82e40c533c2d987acc972
7
- data.tar.gz: 22e1a457099d7997252b9437485279a6e2ceb08c39f93c7fa706211bada3541a5e09b867437b2fff8865c6df09fa10ccdc71b039fa7526c6b9707d9300eecaa5
6
+ metadata.gz: e74327cb9ef7e26c41f34bbc4ffa59d6727373694885a527202d87b0bb2ed2bb36b09767f19d1069856a64770508d91d0430239a9fd9d3568e0ad2f875bdd62c
7
+ data.tar.gz: f1b50e45029fc37e59801742120a24608f413c2f78f7ae63a6526774692a6038f4479a05be2514a09165444e480bea34a1d31aa5e1e4f189b10ebab0faade03b
data/README.md CHANGED
@@ -121,6 +121,11 @@ 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.5
125
+
126
+ - Preserve saved user settings across the required clean plugin reinstall, without copying project overrides or manifest defaults into user configuration.
127
+ - Retain an owner-only recovery snapshot and report its path; abort before uninstalling when settings cannot be exported.
128
+
124
129
  ## Changes in 0.14.4
125
130
 
126
131
  - Preserve short positive durations in mapped and review-required drafts.
@@ -148,4 +153,6 @@ omp-worklog --help
148
153
 
149
154
  `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
155
 
156
+ 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.
157
+
151
158
  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.
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.5"
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.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marlen Brunner