v1.5.1 (2026-08-03)
Bug Fixes & Refactoring
- tests/: Extracted duplicated test helper functions (
pass,fail,assert_eq,assert_contains,assert_file_exists,extract_func,make_workspace,make_test_cheat) into a sharedtest_helpers.shfile, eliminating maintenance burden across 7 test files. - .github/workflows/ci.yml: Added
generate-tldr.shto the CI version-sync check so itsVERSIONvariable is validated againstversion.txt. - devtoolbox-cheats.30s.sh: Fixed viewer-selection loop to always
return 0after invokingcode --reuse-window, preventing silent fallthrough to other viewers when VS Code is installed but the command fails. - kde-widget-plasma6 main.qml: Increased
startupRetryTimerandretryBoundTimerintervals from 10s to 30s, preventing premature disconnection of the indexer for large cheats directories. - cheats-updater.sh: Fixed broken rollback mechanism in backup recovery ?
mktemp -dwas pre-creating the rollback destination, allowingmvto nestCHEATS_DIRinside it rather than performing a true rename, which broke the intended rollback path. Now uses a staging parent directory so bothmvoperations perform true renames, with proper cleanup on both success and failure paths. - kde-widget-plasma5 cheats.js: Fixed shell injection vulnerability in
getIndexCommand()?cheatsDiranddebugLogwere interpolated directly into double-quoted bash strings without escaping. AddedescapeBashDoubleQuoted()helper to properly escape",$,`, and\characters before interpolation. - kde-widget-plasma5 cheats.js: Added
mkdir -pfor the debug log parent directory in the indexer shell command, preventing silent failure when the cache directory doesn't exist yet. - kde-widget-plasma5 cheats.js: Added exit-status check and
/tmpfallback for themkdir -pingetIndexCommand()? if the debug log directory cannot be created, falls back to/tmp/devtoolbox-debug.log; if that also fails, emits an error and exits non-zero. - devtoolbox-cheats.30s.sh:
applyTocFormat()now waits formanage-tocs.pyto finish and propagates its exit status to callers ofsetTocFormatand the CLIapplyTocFormatcommand, instead of backgrounding and detaching the process. - devtoolbox-cheats.30s.sh: Added guard to EXIT trap for
_ARGOS_TMP_CACHE? skips cleanup when the variable is empty and always returns success, preventingrm -f ""from overriding the script's exit status. - devtoolbox-cheats.30s.sh:
_ARGOS_TMP_CACHEis now only cleared aftermv -f "$tmp_cache" "$cat_cache"succeeds, so failed moves still allow the temporary cache to be removed by the EXIT trap. - kde-widget-plasma5 cheats.js: Added write-verification for the initial
echo > "$debugLog"ingetIndexCommand()? if the log file is not writable, falls back to/tmp/devtoolbox-debug.logand retries; emits an error and exits non-zero if that also fails. - devtoolbox-cheats.30s.sh:
applyTocFormat()now returns exit code 1 whenmanage-tocs.pyis not found, matching the existing python3 availability check behavior. - devtoolbox-cheats.30s.sh: Fixed EXIT trap in
argos_show_categoryto use a scope-safe global path (_ARGOS_TMP_CACHE) so cleanup works after the function returns, and preserves any existing EXIT trap. - devtoolbox-cheats.30s.sh: Split 8
local var="$(cmd)"declarations into separate declaration and assignment to avoid masking subshell return values (SC2155). - devtoolbox-cheats.30s.sh: Replaced 3 redundant single-item
forloops with directcommand -vchecks (SC2043). - devtoolbox-cheats.30s.sh: Fixed
copy()to let clipboard errors propagate instead of silently masking them (SC2015). - kde-widget-plasma6/debug-widget.sh: Quoted unquoted variables in test expressions to prevent syntax errors on empty values (SC2086).
- bump-version.sh, devtoolbox-cheats.30s.sh: Replaced useless
catpipes with input redirection (SC2002). - cheats-updater.sh: Added exit-status checks to backup recovery block to prevent silent corruption on
rm/cpfailure. - cheats-updater.sh: Strengthened backup recovery to use transactional staging ? moves current dir to rollback location before copy, with automatic rollback on failure. Uses
--for safe path handling. - kde-widget-plasma6 indexer.sh: Added diagnostic when debug log directory creation fails instead of silently swallowing the error.
- tools/manage-tocs.py: Preserved original file permissions during atomic write ? temp file now inherits the original file's mode bits before replacement.
- tools/manage-tocs.py: Fixed tmp_fd double-close risk by transferring ownership to file object before write can fail.
- manage-tocs.py: Hardened file operations by explicitly catching
OSErrorand safely skipping files that fail to write. RemovedExceptionswallowing for better visibility. - manage-tocs.py: Added
in_fenceparsing state to skip markdown code blocks, preventing inline##comments from being accidentally parsed as TOC headers. - manage-tocs.py: Improved
sys.exitcode tracking when explicit--filesargs contain missing paths; valid files are still successfully processed, but the script accurately returns1at the end to fail CI/CD automation pipelines. - manage-tocs.py: Refactored
clean_header()to reliably slice using a regex stripping##whitespace tolerances, and restricted the removal of trailing translations strictly to Cyrillic payloads. - fix-toc-github.py: Strengthened Strategy 6 (fuzzy matching) heuristics, updated dry-run simulation to utilize in-memory mutated states correctly, resolved bug where duplicate headings incorrectly overwrite keys by dynamically appending GitHub-style suffixes (
-1,-2), and properly corrected TOC links using literal line numbers. - fix_tocs-obsidian.py: Scrapped the duplicated fallback payload script. It is now a highly-efficient Python shim wrapping native
--style obsidianoperations out tomanage-tocs.py. - docs/cheats-readme.sh: Added
set -euo pipefailfor strict bash error handling. Ripped out developer-hardcoded local path references (/home/sviatoslav/...), converting logic to dynamically evaluate the current repository path usingBASH_SOURCE[0], gracefully supportingCHEATS_DIRandREADME_FILEvariable overrides. - devtoolbox-cheats.30s.sh: Simplified the
argos_set_categoryinternal API directory initialization by applyingmkdir -p -m 0700directly. - KDE Plasma (5 & 6) Widgets: Restructured formatting implementation for UI
configGeneral.qmlfiles;applyTocFormatNow()logic now explicitly shell-escapescfg_cheatsDirto prevent shell injection via malicious directory names while safely allowing$HOMEexpansion, normalizescfg_tocFormatinjections defensively, and reliably queries.localor repo directories using chained evaluation if finding scripts.
Test Improvements:
- tests/test_uninstall.sh: Added user cheat sheet preservation assertion to
test_uninstall_removes_known_paths(). - tests/test_uninstall.sh: Updated
test_remove_file_readonlyto check output for failure indicators and verify file existence instead of exit status. - tests/test_uninstall.sh: Replaced inline
mktemp -dassignments with the sharedmake_workspace()helper, adding proper error handling. - tests/test_plasma5_cheats_js.mjs: Strengthened assertion in "uses default debug log when not provided" test to verify the exact default path
/tmp/devtoolbox-debug.loginstead of generic text. - tests/test_install.sh: Fixed
test_configure_toc_format_default_obsidianto stop mutating the real repository by removing themkdir -p "$REPO_ROOT/tools"command. - tests/test_install.sh: Fixed
test_install_cheats_copies_filesto assert the grep result instead of discarding it, ensuring the test validates the install pipeline output. - tests/test_install.sh: Fixed broken "Results" summary line by adding a
passedcounter and using it in the output. - tests/test_install_extended.sh: Replaced inline awk-based function extraction with the existing
extract_funchelper, eliminating code duplication. - tests/test_indexer.sh: Fixed
test_indexer_disables_debug_on_bad_dirto actually assert the indexer succeeds and produces output instead of masking the exit status with|| true. - tests/test_devtoolbox_cheats_ui.sh: Fixed
test_ensure_cache_rebuilds_on_rebuild_flagto use the realindex_cheatsfunction instead of a mocked version that was being overridden, ensuring the test actually validates rebuild behavior. - tests/test_devtoolbox_cheats_screen.sh: Fixed four test functions that always passed regardless of assertion results by conditionally calling
passonly when[[ -n "$out" ]]succeeds. - tests/test_helpers.sh: Created shared test helper file with common utilities (
pass,fail,assert_eq,assert_contains,assert_file_exists,extract_func,make_workspace,make_test_cheat) to eliminate duplication across test files. - tests/test_argos_renderers.sh: Updated to source shared test helpers instead of defining them locally.
- tests/test_cheats_updater_extended2.sh: Updated to source shared test helpers instead of defining them locally.
- tests/test_devtoolbox_cheats_screen.sh: Updated to source shared test helpers instead of defining them locally.
- tests/test_devtoolbox_cheats_ui.sh: Updated to source shared test helpers instead of defining them locally.
- tests/test_indexer.sh: Updated to source shared test helpers instead of defining them locally.
- tests/test_bump_version.sh: Updated to source shared test helpers instead of defining them locally.
- tests/test_cheats_readme.sh: Updated to source shared test helpers instead of defining them locally.
- tests/test_bump_version.sh: Fixed
test_no_version_txt_no_changesto copy the script into the workspace (which lacksversion.txt) instead of running from the repo root whereversion.txtalways exists. - tests/test_bump_version.sh: Replaced duplicated sed logic in
test_updates_version_in_bash_scripts,test_updates_version_in_metadata_json,test_preserves_readonly_prefix, andtest_version_with_special_charswith actualbump-version.shexecution, ensuring tests catch regressions in the real script. - tests/test_devtoolbox_cheats_core.sh: Replaced standalone function redefinitions in
test_compose_label_without_iconwithextract_functo use the real implementations, matching the pattern of adjacent tests.