mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-25 01:21:24 +01:00
Docs link check stops hiding sections after inline code, /learn prune checks every learning, /retro counts Godot test runners (#4677)
Four small fixes from outside reports: the docs link and prose checks no longer treat a line that starts with inline code as a code block, /learn prune reads every learning instead of the first 100, /retro counts a test runner in `tests/` and skips game-engine sidecar files, and five tests that cannot work as root now skip there. Why: each one was reproduced on main and gave a wrong answer (refused valid links, skipped stale learnings, a test total of 0, red tests as root). Nothing to do after merge. Co-authored-by: Davmunrey <108531295+Davmunrey@users.noreply.github.com> Co-authored-by: huongtran84 <4927097+huongtran84@users.noreply.github.com> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
12 files changed
+118
-13
No files matched your search
@@ -16,7 +16,7 @@ GSTACK_BUN_CONFIG=/dev/null; case "${OSTYPE:-}" in msys*|cygwin*) if command -v
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: gstack-learnings-search [--type TYPE] [--query WORDS] [--limit N=10] [--cross-project]
|
||||
Usage: gstack-learnings-search [--type TYPE] [--query WORDS] [--limit N=10 | --all] [--cross-project]
|
||||
gstack-learnings-search --stats
|
||||
gstack-learnings-search --help
|
||||
|
||||
@@ -24,6 +24,7 @@ Prints this project's learnings, latest entry per key+type, grouped by type.
|
||||
--type TYPE only one type: pattern pitfall preference architecture tool operational investigation
|
||||
--query WORDS entries matching any word in key, insight or files, best match first
|
||||
--limit N at most N entries (default 10)
|
||||
--all every entry, no limit (what /learn prune reads)
|
||||
--cross-project also read up to 5 other projects' user-stated learnings
|
||||
--stats counts for this project: TOTAL, UNIQUE, RAW_ENTRIES, BY_TYPE, BY_SOURCE,
|
||||
AVG_CONFIDENCE, or NO_LEARNINGS when nothing is recorded
|
||||
@@ -47,10 +48,11 @@ while [[ $# -gt 0 ]]; do
|
||||
--type) TYPE="$2"; shift 2 ;;
|
||||
--query) QUERY="$2"; shift 2 ;;
|
||||
--limit) [[ "$2" =~ ^[1-9][0-9]*$ ]] || usage_error "--limit needs a positive integer, got '$2'"; LIMIT="$2"; shift 2 ;;
|
||||
--all) LIMIT=0; shift ;;
|
||||
--cross-project) CROSS_PROJECT=true; shift ;;
|
||||
--stats) STATS=true; shift ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) usage_error "unknown argument '$1'; valid: --type --query --limit --cross-project --stats --help" ;;
|
||||
*) usage_error "unknown argument '$1'; valid: --type --query --limit --all --cross-project --stats --help" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -141,7 +143,7 @@ const now = Date.now();
|
||||
const type = process.env.GSTACK_SEARCH_TYPE || '';
|
||||
const queryRaw = (process.env.GSTACK_SEARCH_QUERY || '').toLowerCase();
|
||||
const queryTokens = queryRaw.split(/\s+/).filter(Boolean);
|
||||
const limit = parseInt(process.env.GSTACK_SEARCH_LIMIT || '10', 10);
|
||||
const limit = parseInt(process.env.GSTACK_SEARCH_LIMIT || '10', 10) || Infinity;
|
||||
|
||||
const entries = [];
|
||||
for (const taggedLine of lines) {
|
||||
|
||||
@@ -195,7 +195,8 @@ git log "$REF" "$_S" ${_U:+"$_U"} --date=format-local:'%Y-%m-%d %H:%M' \
|
||||
return (p ~ /\.(md|mdx|markdown|txt|rst|adoc)$/) || (p ~ /(^|\/)(docs?|documentation)\//)
|
||||
}
|
||||
function is_test(p) {
|
||||
if (is_prose(p)) return 0
|
||||
# engine sidecars (Godot .uid/.import, Unity .meta) sit beside test files but are metadata
|
||||
if (is_prose(p) || p ~ /\.(uid|import|meta)$/) return 0
|
||||
return (p ~ /(^|\/)([Tt]ests?|[Ss]pecs?|__tests__)\//) || (p ~ /(\.(test|spec)\.|_test\.|_spec\.)/) \
|
||||
|| (p ~ /[A-Za-z0-9]([Tt]ests?|[Ss]pecs?)\.[A-Za-z0-9]+$/) || (p ~ /(^|\/)test_[^\/]*\.(py|rb)$/) \
|
||||
|| (p ~ /(\.tftest\.hcl|\.bats)$/)
|
||||
@@ -397,6 +398,17 @@ _TF_TOTAL=$(git ls-files 2>/dev/null \
|
||||
| grep -vE '(^|/)(\.build|build|dist|out|target|vendor|node_modules|DerivedData|\.next|\.nuxt|__pycache__|coverage)/' \
|
||||
| grep -cE '(\.test\.|\.spec\.|_test\.|_spec\.|[A-Za-z0-9](Tests?|Specs?)\.[A-Za-z0-9]+$|(^|/)test_[^/]*\.(py|rb)$|\.tftest\.hcl$|\.bats$)' || true)
|
||||
case "$_TF_TOTAL" in ''|*[!0-9]*) _TF_TOTAL=0 ;; esac
|
||||
# A repo whose tests follow no filename convention (a Godot tests/run.gd) would
|
||||
# read 0: fall back to code files under a test dir, minus prose and engine
|
||||
# sidecars (.uid/.import/.meta).
|
||||
if [ "$_TF_TOTAL" = 0 ]; then
|
||||
_TF_TOTAL=$(git ls-files 2>/dev/null \
|
||||
| grep -vE '(^|/)(\.build|build|dist|out|target|vendor|node_modules|DerivedData|\.next|\.nuxt|__pycache__|coverage)/' \
|
||||
| grep -E '(^|/)([Tt]ests?|[Ss]pecs?|__tests__)/' \
|
||||
| grep -vE '(^|/)(docs?|documentation)/|\.(md|mdx|markdown|txt|rst|adoc|uid|import|meta)$' \
|
||||
| grep -c . || true)
|
||||
case "$_TF_TOTAL" in ''|*[!0-9]*) _TF_TOTAL=0 ;; esac
|
||||
fi
|
||||
echo "TEST_FILES_TOTAL: $_TF_TOTAL"
|
||||
_REG=$(git log "$REF" "$_S" ${_U:+"$_U"} --oneline --grep="test(qa):" --grep="test(design):" --grep="test: coverage" 2>/dev/null || true)
|
||||
if [ -n "$_REG" ]; then
|
||||
|
||||
Reference in new issue
Block a user