mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-12 18:50:56 +01:00
Two levels of pure taxonomy carrying no information, and a 2-directory
cap leaves no room for them. Categories now sit directly under
linux_configuration/: features, fixes, utils, misc, fresh-install,
installers, diagnostics, gaming, boot_recovery, periodic_background, lib,
meta, tests. A script's own lib/ and tests/ are exempt from the cap, so
those stay put.
Depth violations 248 -> 139; roughly 40 of the remainder are inside
digital_wellbeing and hosts, deferred until the guard-lib repoint.
The moves are the easy half. What breaks is every path that counted
levels, and three classes of it had to be found by resolving paths rather
than reading diffs:
- 52 relative `source` lines for lib/common.sh and lib/android.sh. The
correct prefix differs per file: 40 were ../../ and 12 were ../../../,
so a blanket replace would have fixed one set and broken the other.
- REPO_ROOT in 7 fixes/lib/tests harnesses and setup_syncyomi_guard.sh,
each walking up four levels from a directory now two levels shallower.
This caused a real regression -- the fixes suite went red with
"log_warn: command not found" -- caught by running it and comparing
against the pre-move baseline worktree.
- conftest.py's sys.path entries, which took the pytest gate down with
14 collection errors, and the `# shellcheck source=` directives, which
took shellcheck down with SC1091.
16 symlinks in $HOME broke, including the entire i3blocks bar. All
repointed, and cpu_monitor/memory/disk/time/volume were run to confirm
they emit real output rather than merely resolving.
Verified: 1798 tests pass at 100% coverage, 8 of 9 lib/tests suites pass
(the ninth needs the coverage jail, identically at baseline), pre-commit
is clean, and the two untracked secret configs are still ignored after
their gitignore paths changed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJrqKERAo5QUeEHWS5Asgp
80 lines
3.6 KiB
Bash
Executable File
80 lines
3.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# lib/study_gen_anki.sh — write anki_cards.txt, the tab-separated import file:
|
|
# one card per top keyword and one per top function call.
|
|
|
|
# Write the tab-separated Anki import file: one card per top keyword and
|
|
# one per top function call.
|
|
generate_anki_cards() {
|
|
#==============================================================================
|
|
# Generate Anki Cards (Tab-separated for import)
|
|
#==============================================================================
|
|
echo -e "${YELLOW}Generating Anki cards...${NC}"
|
|
|
|
cat >"$ANKI_FILE" <<'EOF'
|
|
# Anki Import File
|
|
# Format: Front<TAB>Back<TAB>Tags
|
|
# Import with: File -> Import, select "Fields separated by: Tab"
|
|
#
|
|
# Card Types:
|
|
# 1. "What does X do?" - For functions/methods
|
|
# 2. "When to use X?" - For keywords/patterns
|
|
# 3. "What is the syntax for X?" - For language constructs
|
|
#
|
|
EOF
|
|
|
|
# Generate cards for top keywords
|
|
if [ -f "$RESULTS_DIR/grep_keywords.txt" ]; then
|
|
echo "# Keywords" >>"$ANKI_FILE"
|
|
{ grep -v '^#' "$RESULTS_DIR/grep_keywords.txt" || true; } | head -n "$TOP_N" | while read -r count term; do
|
|
[ -z "$term" ] && continue
|
|
url=$(get_doc_url "$term" "$PRIMARY_LANG")
|
|
|
|
# Create different card types based on term type
|
|
case "$term" in
|
|
if | else | elif | elseif | switch | case | match)
|
|
echo -e "What is the purpose of \`$term\` in $PRIMARY_LANG?\tConditional control flow - executes code based on boolean conditions. See: $url\t${PRIMARY_LANG}::keywords::control-flow" >>"$ANKI_FILE"
|
|
;;
|
|
for | while | loop | do | until)
|
|
echo -e "What is the purpose of \`$term\` in $PRIMARY_LANG?\tLoop construct - repeats code execution. See: $url\t${PRIMARY_LANG}::keywords::loops" >>"$ANKI_FILE"
|
|
;;
|
|
try | except | catch | finally | raise | throw)
|
|
echo -e "What is the purpose of \`$term\` in $PRIMARY_LANG?\tException handling - manages errors and exceptional conditions. See: $url\t${PRIMARY_LANG}::keywords::exceptions" >>"$ANKI_FILE"
|
|
;;
|
|
class | struct | interface | trait | impl)
|
|
echo -e "What is the purpose of \`$term\` in $PRIMARY_LANG?\tType definition - defines custom data structures. See: $url\t${PRIMARY_LANG}::keywords::types" >>"$ANKI_FILE"
|
|
;;
|
|
def | fn | func | function)
|
|
echo -e "What is the purpose of \`$term\` in $PRIMARY_LANG?\tFunction definition - declares a reusable block of code. See: $url\t${PRIMARY_LANG}::keywords::functions" >>"$ANKI_FILE"
|
|
;;
|
|
import | from | use | require | include)
|
|
echo -e "What is the purpose of \`$term\` in $PRIMARY_LANG?\tModule import - brings external code into current scope. See: $url\t${PRIMARY_LANG}::keywords::modules" >>"$ANKI_FILE"
|
|
;;
|
|
async | await | yield)
|
|
echo -e "What is the purpose of \`$term\` in $PRIMARY_LANG?\tAsynchronous programming - handles concurrent operations. See: $url\t${PRIMARY_LANG}::keywords::async" >>"$ANKI_FILE"
|
|
;;
|
|
*)
|
|
echo -e "What does the keyword \`$term\` do in $PRIMARY_LANG?\t[FILL: Look up at $url]\t${PRIMARY_LANG}::keywords" >>"$ANKI_FILE"
|
|
;;
|
|
esac
|
|
done
|
|
fi
|
|
|
|
# Generate cards for top functions
|
|
if [ -f "$RESULTS_DIR/grep_function_calls.txt" ]; then
|
|
{
|
|
echo ""
|
|
echo "# Functions"
|
|
} >>"$ANKI_FILE"
|
|
{ grep -v '^#' "$RESULTS_DIR/grep_function_calls.txt" || true; } | head -n "$TOP_N" | while read -r count term; do
|
|
[ -z "$term" ] && continue
|
|
[[ $term =~ ^(if|for|while|switch|catch)$ ]] && continue
|
|
url=$(get_doc_url "$term" "$PRIMARY_LANG")
|
|
|
|
echo -e "What does \`$term()\` do in $PRIMARY_LANG? (Used $count times)\t[FILL: Look up at $url]\t${PRIMARY_LANG}::functions" >>"$ANKI_FILE"
|
|
done
|
|
fi
|
|
|
|
echo -e "${GREEN}Created: $ANKI_FILE${NC}"
|
|
|
|
}
|