-
Notifications
You must be signed in to change notification settings - Fork 1
fix(repo-finder): notes-only preferences fall back to defaults; overrides read '## filters' #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
70109e4
fix(repo-finder): notes-only prefs fall back to defaults; overrides r…
gaurav0107 2978094
fix(repo-finder): address CodeRabbit review — validate inherited prof…
gaurav0107 a9b2e52
docs(changelog): polish wording in repo-finder preferences entries
gaurav0107 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| #!/usr/bin/env bash | ||
| # The /repo-finder override path (`--lang`/`--topic`/`--min-stars`) inherits the | ||
| # axes it does NOT name from the saved profile. It must read the saved | ||
| # `## Filters` block with the SAME detector scripts/lib/preferences.sh uses — | ||
| # case-insensitive, spacing-tolerant. A divergent 'exact ## Filters' matcher | ||
| # silently fails to inherit on a '## filters' (lowercase, hand-edited) file and | ||
| # searches with default axes instead: the silent-wrong-result this whole feature | ||
| # exists to prevent. Network-free, bash 3.2-clean. | ||
| set -euo pipefail | ||
|
|
||
| ROOT="${CLAUDE_PLUGIN_ROOT:-$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)}" | ||
| export CLAUDE_PLUGIN_ROOT="$ROOT" | ||
| CMD="$ROOT/commands/repo-finder.md" | ||
| TMP=$(mktemp -d); trap 'rm -rf "$TMP"' EXIT | ||
| HOME="$TMP/home"; export HOME | ||
| mkdir -p "$HOME/.superhuman" | ||
|
|
||
| fail() { echo "FAIL: $*"; exit 1; } | ||
|
|
||
| # A saved profile with a NON-canonical header. /preferences writes '## Filters', | ||
| # but preferences.sh accepts '## filters' too, so a hand-edited file can look | ||
| # like this — and the override path must read it the same way. | ||
| cat > "$HOME/.superhuman/preferences.md" <<'EOF' | ||
| ## filters | ||
| languages: go | ||
| topics: backend | ||
| stars: 3000 | ||
| EOF | ||
|
|
||
| # The override block is the 2nd ```bash fence. Drive it with a --topic override | ||
| # (TOPICS set, LANGS/MIN_STARS empty) so languages + stars MUST be inherited from | ||
| # the saved profile. Then print the throwaway file the block compiled. | ||
| extract_block2() { | ||
| awk '/^```bash$/{n++; if(n==2){inb=1; next}} /^```$/{inb=0} inb' "$CMD" | ||
| } | ||
| { | ||
| printf 'LANGS=""\nTOPICS="cli"\nMIN_STARS=""\n' | ||
| extract_block2 | ||
| printf 'echo "---OVERRIDE-FILE---"; cat "$OVERRIDE"\n' | ||
| } > "$TMP/block.sh" | ||
|
|
||
| OUT=$(bash "$TMP/block.sh" 2>&1) || fail "override block errored: $OUT" | ||
|
|
||
| case "$OUT" in | ||
| *"languages: go"*) ;; | ||
| *) fail "saved 'languages: go' not inherited from a '## filters' file: | ||
| $OUT" ;; | ||
| esac | ||
| case "$OUT" in | ||
| *"stars: 3000"*) ;; | ||
| *) fail "saved 'stars: 3000' not inherited (fell back to the 2000 default): | ||
| $OUT" ;; | ||
| esac | ||
| case "$OUT" in | ||
| *"topics: cli"*) ;; | ||
| *) fail "--topic override not applied: | ||
| $OUT" ;; | ||
| esac | ||
|
|
||
| echo "OK test_repo_finder_override_inherit.sh" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.