Skip to content

YOU-43: Create and maintain the config file once per plugin version - #39

Merged
JtheGunner merged 2 commits into
mainfrom
feat/YOU-43-create-and-sync-config-file
Nov 22, 2026
Merged

JtheGunner merged 2 commits into
mainfrom
feat/YOU-43-create-and-sync-config-file

Conversation

@JtheGunner

Copy link
Copy Markdown
Owner

YouTrack: https://youtrack.xn--wrm-hoa.li/issue/YOU-43

A SessionStart hook now creates ~/.config/youtrack-task/config.toml from config.example.toml and keeps it in step with the plugin, once per plugin version.

  • Missing config: copied from the example.
  • Existing config: options added by an update are inserted commented out (with their comment) before the first active [table] header, so they still work when uncommented. Options the example no longer has are removed, judged against a snapshot of the previous example; the user's own keys, values and comments are never touched.
  • A config.toml.bak is written before any change, and one line tells the user what was created, added or removed.
  • An unchanged version exits immediately; read-config stays read-only. If the config directory is not writable, the hook warns and retries next session.

Commits:

  • feat: create and maintain config.toml once per plugin version (YOU-43)
  • fix: place synced options before the first config table (YOU-43)

Version bumped to 0.21.0 (changelog, spec, docs and manual test rows updated).

Test plan:

  • bash tests/sync-config.sh and the other tests/*.sh suites pass; shellcheck -S warning hooks/sync-config is clean.
  • Independent review: PASS on the exact head commit.
  • Manual: see tests/README.md rows 126-128 (fresh install, update with added and removed options, read-only config dir).

A SessionStart hook creates ~/.config/youtrack-task/config.toml from config.example.toml, appends options added by an update (commented out) and removes options the plugin dropped, judged against a snapshot of the previous example. The work runs once per plugin version, so normal sessions are unaffected.
read-config ignores everything from the first active table header on, so an option appended after it would stop working once uncommented. Top-level options are now inserted before that header.
@JtheGunner
JtheGunner merged commit 412684e into main Nov 22, 2026
2 checks passed
@JtheGunner
JtheGunner deleted the feat/YOU-43-create-and-sync-config-file branch November 22, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant