Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

fix: replace xargs with sed in check-config.sh to avoid unterminated quote crash (#545)

SAI MOHANEESH2cc88ecaf1f2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cfc598f2..e26bc3ca 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- YouTube transcript budget prioritises recent videos (by a combination of views and recency) instead of views alone, preventing transcript slots from being consumed by old high-view-count videos that would be discarded by strict_recent freshness pruning ([#531](https://github.com/mvanhorn/last30days-skill/issues/531))
- YouTube items with successfully extracted transcripts are no longer pruned by title-only relevance scoring; the transcript content proves substantive topical coverage even when the video title has low lexical overlap with the query ([#468](https://github.com/mvanhorn/last30days-skill/issues/468))
- First-run setup wizard in SKILL.md now references the existing Python setup wizard (`last30days.py setup`) instead of the missing `nux-wizard.md` file, so first-run setup actually runs on new installs. ([#574](https://github.com/mvanhorn/last30days-skill/issues/574))
+- `check-config.sh` no longer exits 1 when a `.env` value contains an unbalanced quote — replaced `xargs` (which interprets quotes) with `sed` for whitespace trimming in `load_env_vars` ([#506](https://github.com/mvanhorn/last30days-skill/issues/506))
- Entity-grounding rerank demotion now keys on the head token of the primary entity instead of requiring the full multi-word phrase as a contiguous substring. A high-engagement on-entity item (e.g. a 323-pt HN thread titled "Stripe is friendly to 'friendly fraud'") is no longer demoted to score 0 on a `Stripe payments` query just because it lacks the trailing search-hint word. The intended demotion still fires for items that never name the brand at all. The keyless Reddit comment-enrichment slot selection (`_slot_priority`), which mirrors this signal, was updated to the same head-token grounding so the two paths stay consistent.
- `--plan` / `--competitors-plan` file reads now specify `encoding="utf-8"` and catch `UnicodeDecodeError`, preventing crashes on non-ASCII content like accented entity names on Windows (cp1252). `check_perms()` in `check-config.sh` now skips the POSIX 600-permission check on MSYS/MinGW/Cygwin where `stat` runs in noacl mode. `skill_meta.py` `read_skill_version()` now passes `encoding="utf-8"` so SKILL.md emoji doesn't break version detection on Windows. ([#549](https://github.com/mvanhorn/last30days-skill/issues/549))
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 29e78f23..067af769 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -59,3 +59,4 @@ v3 has durable watchlist with multi-source storage and extended time windows.
- [@levineam](https://github.com/levineam) - Model fallback for unverified orgs ([#16](https://github.com/mvanhorn/last30days-skill/pull/16))
- [@jonthebeef](https://github.com/jonthebeef) - Early testing and feedback
- [@23241a6749](https://github.com/23241a6749) - Windows cp1252 fixes: utf-8 plan-file reads, skill_meta version-detection encoding, MSYS noacl permission check skip ([#549](https://github.com/mvanhorn/last30days-skill/pull/549)); first-run setup wizard fix: SKILL.md references existing Python setup wizard instead of missing nux-wizard.md ([#574](https://github.com/mvanhorn/last30days-skill/pull/574))
+- [@23241a6749](https://github.com/23241a6749) - check-config.sh xargs unterminated quote fix ([#506](https://github.com/mvanhorn/last30days-skill/issues/506))
diff --git a/hooks/scripts/check-config.sh b/hooks/scripts/check-config.sh
index 7a9dcc25..ec205972 100755
--- a/hooks/scripts/check-config.sh
+++ b/hooks/scripts/check-config.sh
@@ -36,8 +36,8 @@ load_env_vars() {
# Skip comments, empty lines
[[ "$key" =~ ^[[:space:]]*# ]] && continue
[[ -z "$key" ]] && continue
- key=$(echo "$key" | xargs)
- value=$(echo "$value" | xargs | sed 's/^["'\''"]//;s/["'\''"]$//')
+ key=$(echo "$key" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
+ value=$(echo "$value" | sed -e 's/^[[:space:]]*//;s/[[:space:]]*$//' -e 's/^["'\''"]//;s/["'\''"]$//')
# Strip inline comments (# preceded by whitespace) to prevent
# command substitution in backtick-containing comments
value="${value%%[[:space:]]#*}"
diff --git a/tests/test_last_run_state.py b/tests/test_last_run_state.py
index 33336a92..15ddd4d1 100644
--- a/tests/test_last_run_state.py
+++ b/tests/test_last_run_state.py
@@ -80,6 +80,33 @@ class LastRunStateTests(unittest.TestCase):
self.assertEqual(result.returncode, 0, result.stderr)
self.assertIn('Last run: "custom hook query"', result.stdout)
+ def test_hook_parses_dotenv_with_unbalanced_quote(self):
+ """Script exits 0 when .env contains an unbalanced quote in a value."""
+ with tempfile.TemporaryDirectory() as tmp:
+ home = Path(tmp) / "home"
+ config_dir = home / ".config" / "last30days"
+ config_dir.mkdir(parents=True)
+ env_file = config_dir / ".env"
+ env_file.write_text(
+ "SETUP_COMPLETE=true\n"
+ "XAI_API_KEY=xai-key-with-apostrophe's-ok\n"
+ "AUTH_TOKEN=test-auth\n"
+ "CT0=test-ct0\n"
+ )
+ env = os.environ.copy()
+ env["HOME"] = str(home)
+
+ result = subprocess.run(
+ ["bash", "hooks/scripts/check-config.sh"],
+ cwd=REPO_ROOT,
+ env=env,
+ capture_output=True,
+ text=True,
+ check=False,
+ )
+
+ self.assertEqual(result.returncode, 0, result.stderr)
+ self.assertIn("Ready —", result.stdout)
class TestSkillMdFirstRunReference(unittest.TestCase):
"""Verifies SKILL.md references that exist in the CLI."""