Created
December 9, 2025 14:26
-
-
Save flavioespinoza/ad9b287fd14d06409de562d78e55b576 to your computer and use it in GitHub Desktop.
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
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" | |
| [ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" | |
| export PROMPT='%1~ %# ' | |
| # export GITHUB_TOKEN="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" | |
| export GITHUB_TOKEN="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" | |
| export BASE_DIR="bless" | |
| export NPM_TOKEN="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" | |
| export BITBUCKET_TOKEN="ATCTT3xFfGN0X0fJ2qob6f1xhdPvpg6DqhVBkIAC_PNqQMBd1GbNj7tjAPsQpHQt9SE4G_6hWhPQolnO2tZY4ikIA9vo8ok5OJZZFCTAyJ-rg4N9v-sNoEasza6euXzuvo6zol5q0WRICLatyzrBE0s9Atu237U2ka7dCHPfB5vcSTvPafNq3Zc=EAB214D2" | |
| # Added by Windsurf | |
| export PATH="/Users/flavio/.codeium/windsurf/bin:$PATH" | |
| gcb() { | |
| if [ $# -eq 0 ]; then | |
| echo "Usage: gcb <branch1> <branch2> ..." | |
| return 1 | |
| fi | |
| local exclude_pattern=$(printf "|%s" "$@" | cut -c 2-) | |
| echo "Branches to be deleted:" | |
| git branch | grep -vE "$exclude_pattern" | |
| echo "" | |
| read "answer?Do you want to proceed? (y/n) " | |
| if [[ $answer == "y" ]]; then | |
| git branch | grep -vE "$exclude_pattern" | xargs git branch -D | |
| echo "Branches deleted." | |
| else | |
| echo "Operation cancelled." | |
| fi | |
| } | |
| # tree_me function: Displays a directory tree, excluding 'node_modules' and hidden directories. | |
| tree_me() { | |
| tree --prune -I 'node_modules|.*' | |
| } | |
| # pr alias: Creates a Pull Request (PR) from your current branch into main | |
| alias pr="gh pr create --fill" | |
| # gda alias: Deletes remote branches except 'main'. | |
| alias gda="git branch -r | grep -v -E 'main' | sed 's/origin\///' | xargs -I {} git push origin --delete {}" | |
| # gdl alias: Force deletes all local branches except 'main'. | |
| alias gdl="git branch | grep -v 'main' | xargs git branch -D" | |
| # gclean alias: Cleans up by deleting remote branches and local branches except 'main'. | |
| alias gclean="gda && gdl" | |
| alias gprune="gda && gdl" | |
| # gfp alias: Fetches the latest changes from the remote and prunes stale remote-tracking branches. | |
| alias gfp="git fetch -p" | |
| # nz alias: Opens the .zshrc file in the Nano text editor. | |
| alias nz="nano ~/.zshrc" | |
| # cz alias: Opens the .zshrc file in Visual Studio Code. | |
| alias cz="code ~/.zshrc" | |
| # sz alias: Sources the .zshrc file to apply changes without restarting the terminal. | |
| alias sz="source ~/.zshrc" | |
| # hottie alias: Prints a fun message about Sydney Sweeney. | |
| alias hottie='echo "🔥 Sydney Sweeney Boobies!!!🔥"' | |
| # mycz alias: Opens the .zshrc_my_aliases file in Visual Studio Code. | |
| alias mycz="code ~/.zshrc_my_aliases" | |
| # Imports aliases from the .zshrc_my_aliases file. | |
| source ~/.zshrc_my_aliases | |
| # salsa alias: Installs the latest version of the Salsa UI library using Yarn. | |
| alias salsa="yarn add @flavioespinoza/salsa-ui@latest" | |
| # create-next alias: Creates a new Next.js app with specific configurations. | |
| alias create-next='function _create_next() { npx create-next-app@latest "$1" --use-yarn --typescript --tailwind --src-dir --app --turbopack --import-alias "@/*" --eslint "no"; }; _create_next' | |
| # repo alias: Runs the repomix command with the plain style. | |
| alias repo='repomix --style plain' | |
| # next_app function: Creates a new Next.js app with specific configurations. | |
| # Usage: next_app <project-name> | |
| next_app() { | |
| # Check if project name is provided | |
| if [ -z "$1" ]; then | |
| echo "Error: Please provide a project name" | |
| echo "Usage: next_app <project-name>" | |
| return 1 | |
| fi | |
| PROJECT_NAME="$1" | |
| cd ~/Documents/Portfolio || return 1 | |
| # Run the create-next-app command with the provided project name | |
| npx create-next-app@latest $PROJECT_NAME --use-yarn --skip-install --typescript --tailwind --src-dir --app --turbopack --import-alias "@/*" --eslint "no" | |
| # Cd into the project directory | |
| cd "$PROJECT_NAME" || return 1 | |
| rm -rf package.json | |
| # Use heredoc to write the package.json content | |
| cat >package.json <<EOL | |
| { | |
| "name": "$PROJECT_NAME", | |
| "version": "1.0.0", | |
| "private": false, | |
| "author": "Flavio Espinoza <flavioe.spinoza@gmail.com>", | |
| "scripts": { | |
| "dev": "next dev", | |
| "build": "next build", | |
| "start": "next start", | |
| "lint": "next lint", | |
| "format": "prettier --write .", | |
| "clean": "prettier --write .", | |
| "deploy": "vercel --prod" | |
| }, | |
| "dependencies": { | |
| "@flavioespinoza/salsa-ui": "^1.0.50", | |
| "@radix-ui/react-dialog": "^1.1.6", | |
| "@radix-ui/react-icons": "^1.3.0", | |
| "@radix-ui/react-select": "^2.1.6", | |
| "@radix-ui/react-tabs": "^1.1.3", | |
| "@radix-ui/react-tooltip": "^1.1.8", | |
| "ai": "^2.1.21", | |
| "chart.js": "^4.4.8", | |
| "clsx": "^2.1.1", | |
| "dayjs": "^1.11.13", | |
| "highlight.js": "^11.11.1", | |
| "lucide-react": "^0.485.0", | |
| "marked": "^15.0.7", | |
| "next": "15.2.3", | |
| "next-themes": "^0.4.6", | |
| "openai": "^4.24.1", | |
| "papaparse": "^5.5.2", | |
| "react": "19.0.0", | |
| "react-chartjs-2": "^5.3.0", | |
| "react-dom": "19.0.0", | |
| "react-markdown": "^10.1.0", | |
| "react-syntax-highlighter": "^15.6.1", | |
| "zustand": "^4.4.0" | |
| }, | |
| "devDependencies": { | |
| "@tailwindcss/container-queries": "^0.1.1", | |
| "@tailwindcss/postcss": "^4.0.15", | |
| "@tailwindcss/typography": "^0.5.16", | |
| "@trivago/prettier-plugin-sort-imports": "4.3.0", | |
| "@types/node": "20.11.24", | |
| "@types/papaparse": "^5.3.15", | |
| "@types/react": "18.2.49", | |
| "@types/react-dom": "18.2.17", | |
| "@types/react-syntax-highlighter": "^15.5.13", | |
| "autoprefixer": "10.4.17", | |
| "class-variance-authority": "^0.7.1", | |
| "fluid-tailwind": "^1.0.4", | |
| "postcss": "8.4.33", | |
| "prettier": "3.2.5", | |
| "prettier-plugin-tailwindcss": "0.5.10", | |
| "tailwind-merge": "^3.0.2", | |
| "tailwindcss": "^3.4.1", | |
| "tailwindcss-animate": "^1.0.7", | |
| "typescript": "5.4.2" | |
| } | |
| } | |
| EOL | |
| # Run yarn install | |
| yarn install | |
| # Add and replace files | |
| rm -rf .gitignore | |
| cp ~/Next/.gitignore ~/Documents/Portfolio/$PROJECT_NAME/ | |
| cp ~/Next/tailwind.config.ts ~/Documents/Portfolio/$PROJECT_NAME/ | |
| cp ~/Next/postcss.config.mjs ~/Documents/Portfolio/$PROJECT_NAME/ | |
| cp ~/Next/.prettierrc ~/Documents/Portfolio/$PROJECT_NAME/ | |
| rm -rf ~/Documents/Portfolio/$PROJECT_NAME/src/app/layout.tsx | |
| rm -rf ~/Documents/Portfolio/$PROJECT_NAME/src/app/page.tsx | |
| cp ~/Next/layout.tsx ~/Documents/Portfolio/$PROJECT_NAME/src/app/ | |
| cp ~/Next/page.tsx ~/Documents/Portfolio/$PROJECT_NAME/src/app/ | |
| rm -rf ~/Documents/Portfolio/$PROJECT_NAME/src/app/globals.css | |
| mkdir -p ~/Documents/Portfolio/$PROJECT_NAME/src/styles | |
| cp ~/Next/globals.css ~/Documents/Portfolio/$PROJECT_NAME/src/styles/ | |
| echo "Project $PROJECT_NAME has been created and configured successfully!" | |
| code ~/Documents/Portfolio/$PROJECT_NAME | |
| } | |
| # bun completions | |
| [ -s "/Users/flavio/.bun/_bun" ] && source "/Users/flavio/.bun/_bun" | |
| # bun | |
| export BUN_INSTALL="$HOME/.bun" | |
| export PATH="$BUN_INSTALL/bin:$PATH" | |
| # Screenshot Functions using full Unix timestamp | |
| scf() { screencapture ~/Screenshots/capture-$(date +%s).png; } | |
| sca() { screencapture -i ~/Screenshots/capture-$(date +%s).png; } | |
| # Claude Code Project Template Generator | |
| doodle() { | |
| if [ -z "$1" ]; then | |
| echo "Usage: doodle <project-name>" | |
| return 1 | |
| fi | |
| local prompt="Setup project: $1 using https://gist.github.com/flavioespinoza/48745ea94000255948bc6366c4ab0c40" | |
| echo "$prompt" | pbcopy | |
| echo "✓ Copied to clipboard:" | |
| echo "$prompt" | |
| echo "" | |
| echo "Paste into Claude Code to generate setup instructions" | |
| } | |
| # Creates and pushes local git project to new git repo. Usage _ghcreate <my-project-name> | |
| alias _ghcreate="gh repo create \$1 --public --source=. --push" | |
| # ============================================================ | |
| # _patch <filename> | |
| # | |
| # Searches for files matching the given filename and displays | |
| # their project root directory, golden.patch line count, and | |
| # full file path in groups of three lines. | |
| # | |
| # Usage: | |
| # _patch App.tsx | |
| # | |
| # Output format: | |
| # ./project-root-directory | |
| # {line-count} | |
| # ./project-root-directory/repo/path/to/file | |
| # | |
| # Example: | |
| # _patch App.tsx | |
| # | |
| # ./example-project-1 | |
| # 321 | |
| # ./example-project-1/repo/src/App.tsx | |
| # | |
| # ./example-project-2 | |
| # 145 | |
| # ./example-project-2/repo/components/App.tsx | |
| # ============================================================ | |
| alias _patch='function _patch_fn() { | |
| target="$1" | |
| find . -type f -name "$target" \ | |
| | sed "s|/repo/.*||" \ | |
| | sort -u \ | |
| | while read proj; do | |
| patch="$proj/golden.patch" | |
| if [ -f "$patch" ]; then | |
| lines=$(wc -l < "$patch") | |
| file_path=$(find "$proj" -type f -name "$target" | head -1) | |
| echo "---------------------" | |
| echo "$proj" | |
| echo "$lines" | |
| echo "$file_path" | |
| echo "---------------------" | |
| echo "" | |
| else | |
| echo "---------------------" | |
| echo "$proj" | |
| echo "0" | |
| echo "(no golden.patch)" | |
| echo "---------------------" | |
| echo "" | |
| fi | |
| done | |
| }; _patch_fn' | |
| # ============================================================================ | |
| # GitHub Sparse Checkout Alias: _ghparse | |
| # ============================================================================ | |
| # | |
| # DESCRIPTION: | |
| # This function helps you clone and manage sparse checkouts of specific | |
| # project directories from the Mercor-Intelligence/custom-rubrics-200 repository. | |
| # It allows you to download only the specific "tasks/project-*" directories you | |
| # need, saving bandwidth and disk space. | |
| # | |
| # HOW IT WORKS: | |
| # 1. First time: Clones the repo with --sparse flag (downloads structure, not files) | |
| # 2. Sets sparse checkout to only the specified project directory | |
| # 3. Subsequent calls: Adds additional project directories to the same local repo | |
| # | |
| # USAGE: | |
| # _ghparse <project-name> # Clone/add single project | |
| # _ghparse <proj1> <proj2>... # Clone/add multiple projects | |
| # _ghparse --list # List checked-out projects | |
| # _ghparse --available # Show available projects | |
| # _ghparse --reset # Remove local repo and start fresh | |
| # _ghparse --help # Show this help message | |
| # | |
| # EXAMPLES: | |
| # _ghparse project-1 # Clone only project-1 | |
| # _ghparse project-2 # Add project-2 to existing checkout | |
| # _ghparse --list # Show what's currently checked out | |
| # _ghparse --reset # Delete local copy and reset | |
| # ============================================================================ | |
| _ghparse() { | |
| if [ -z "$1" ]; then | |
| echo "Usage: _ghparse <project-name>" | |
| echo "Example: _ghparse project-1" | |
| echo "Use '_ghparse --help' for more options" | |
| return 1 | |
| fi | |
| local repo="Mercor-Intelligence/custom-rubrics-200" | |
| local repo_dir="custom-rubrics-200" | |
| if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then | |
| echo "GitHub Sparse Checkout Helper" | |
| echo "" | |
| echo "COMMANDS:" | |
| echo " _ghparse <project> Clone or add single project" | |
| echo " _ghparse p1 p2 p3 Clone or add multiple projects" | |
| echo " _ghparse --list List checked-out projects" | |
| echo " _ghparse --available Show available projects" | |
| echo " _ghparse --reset Remove local repo completely" | |
| echo " _ghparse --help Show this help message" | |
| echo "" | |
| echo "EXAMPLES:" | |
| echo " _ghparse project-1 # First project" | |
| echo " _ghparse project-2 # Add second project" | |
| echo " _ghparse --list # See what you have" | |
| return 0 | |
| fi | |
| if [ "$1" = "--list" ] || [ "$1" = "--ls" ]; then | |
| if [ -d "$repo_dir" ]; then | |
| cd "$repo_dir" | |
| git sparse-checkout list | |
| cd - > /dev/null | |
| else | |
| echo "Repository not cloned yet." | |
| fi | |
| return 0 | |
| fi | |
| if [ "$1" = "--available" ] || [ "$1" = "--avail" ]; then | |
| gh api "repos/$repo/contents/tasks" --jq '.[].name' | sort | |
| return 0 | |
| fi | |
| if [ "$1" = "--reset" ]; then | |
| if [ -d "$repo_dir" ]; then | |
| echo "Removing local repository..." | |
| rm -rf "$repo_dir" | |
| echo "Repository removed. Ready for fresh clone." | |
| else | |
| echo "Repository not found." | |
| fi | |
| return 0 | |
| fi | |
| local projects=() | |
| for arg in "$@"; do | |
| projects+=("tasks/$arg") | |
| done | |
| if [ -d "$repo_dir" ]; then | |
| echo "Adding projects to existing repository..." | |
| cd "$repo_dir" | |
| git sparse-checkout add "${projects[@]}" | |
| echo "Added: $@" | |
| echo "Current sparse checkout:" | |
| git sparse-checkout list | sed 's/^/ /' | |
| else | |
| echo "Cloning repository with sparse checkout..." | |
| gh repo clone "$repo" -- --filter=blob:none --sparse | |
| cd "$repo_dir" | |
| git sparse-checkout set "${projects[@]}" | |
| git checkout main | |
| echo "Cloned with: $@" | |
| echo "Current sparse checkout:" | |
| git sparse-checkout list | sed 's/^/ /' | |
| fi | |
| } | |
| # ============================================================================ | |
| # Get JS/TS Tasks: _jstasks | |
| # ============================================================================ | |
| # | |
| # DESCRIPTION: | |
| # Lists all tasks from Mercor-Intelligence/custom-rubrics-200 where | |
| # golden.patch contains ≥50% JavaScript/TypeScript files. | |
| # | |
| # USAGE: | |
| # _jstasks | |
| # | |
| # OUTPUT: | |
| # A clean list of task names that meet the 50% JS/TS threshold | |
| # ============================================================================ | |
| _jstasks() { | |
| echo "📋 Fetching tasks with ≥50% JS/TS files..." | |
| echo "" | |
| gh api repos/Mercor-Intelligence/custom-rubrics-200/contents/tasks --jq '.[].name' | sort | while read TASK; do | |
| # Get download URL | |
| URL=$(gh api repos/Mercor-Intelligence/custom-rubrics-200/contents/tasks/$TASK/golden.patch \ | |
| --jq '.download_url // empty' 2>/dev/null) | |
| # Skip if no patch | |
| [ -z "$URL" ] && continue | |
| # Download patch to temp file | |
| TEMP=$(mktemp) | |
| curl -s -f -L "$URL" > "$TEMP" 2>/dev/null | |
| # Skip if empty | |
| [ ! -s "$TEMP" ] && rm -f "$TEMP" && continue | |
| # Count total files and JS/TS files | |
| TOTAL=$(grep -E '^--- a/|^\+\+\+ b/' "$TEMP" | \ | |
| sed 's/^--- a\///; s/^\+\+\+ b\///' | \ | |
| sort -u | grep -v '^$' | wc -l) | |
| JS=$(grep -E '^--- a/|^\+\+\+ b/' "$TEMP" | \ | |
| sed 's/^--- a\///; s/^\+\+\+ b\///' | \ | |
| sort -u | grep -E '\.(js|ts|jsx|tsx|vue|svelte|mjs|cjs|mts|cts)$' | wc -l) | |
| # Check criteria | |
| if [ "$TOTAL" -gt 0 ]; then | |
| PERCENTAGE=$(( (JS * 100) / TOTAL )) | |
| if [ "$PERCENTAGE" -ge 50 ]; then | |
| echo "$TASK" | |
| fi | |
| fi | |
| # Cleanup | |
| rm -f "$TEMP" | |
| done | |
| } | |
| # ----------- | |
| # ----------- | |
| # ----------- | |
| alias _rubric='_rubric() { | |
| TIMESTAMP=$(date "+%b_%-d_%Y_%-I:%M%p") | |
| OUTFILE="rubric_context__${TIMESTAMP}__.txt" | |
| EXCLUDE_PATCHES=false | |
| if [[ "$1" == "-p" ]]; then | |
| EXCLUDE_PATCHES=true | |
| fi | |
| { | |
| echo "Project Name: $(basename "$PWD")" | |
| echo "" | |
| echo -e "\n===== prompt_statement.md =====" | |
| cat prompt_statement.md 2>/dev/null | |
| echo -e "\n===== problem_statement.md =====" | |
| echo -e "\n===== requirements.json =====" | |
| cat requirements.json 2>/dev/null | |
| echo -e "\n===== interface.md =====" | |
| cat interface.md 2>/dev/null | |
| if [[ "$EXCLUDE_PATCHES" == false ]]; then | |
| echo -e "\n===== golden.patch =====" | |
| cat golden.patch 2>/dev/null | |
| fi | |
| } > "__rubrics__/$OUTFILE" | |
| echo "Created $OUTFILE" | |
| }; _rubric' | |
| # Duplicates a file in the current directory, prefixing the copy with the parent directory name | |
| # Usage: dupp <filename> | |
| # Example: In /projects/my-app/, running "dupp config.json" creates "my-app__config.json" | |
| dupp() { | |
| if [ -z "$1" ]; then | |
| echo "Error: No filename provided" | |
| echo "Usage: dupp <filename>" | |
| return 1 | |
| fi | |
| if [ ! -f "$1" ]; then | |
| echo "Error: File '$1' does not exist" | |
| return 1 | |
| fi | |
| local parent_dir=$(basename "$PWD") | |
| local new_name="${parent_dir}__${1}" | |
| cp "$1" "$new_name" | |
| echo "Created: $new_name" | |
| } | |
| # Duplicates rubric project files, prefixing each with the parent directory name | |
| # Usage: dupprubric | |
| # Files duplicated: golden.patch, interface.md, requirements.json, problem_statement.md, prompt_statement.md | |
| # Example: In /projects/my-app/, creates my-app__golden.patch, my-app__interface.md, etc. | |
| dupprubric() { | |
| local parent_dir=$(basename "$PWD") | |
| local files=( | |
| "golden.patch" | |
| "test.patch" | |
| "interface.md" | |
| "requirements.json" | |
| "problem_statement.md" | |
| "prompt_statement.md" | |
| ) | |
| local copied=0 | |
| local skipped=0 | |
| for file in "${files[@]}"; do | |
| if [ -f "$file" ]; then | |
| local new_name="${parent_dir}__${file}" | |
| cp "$file" "$new_name" | |
| echo "✓ Created: $new_name" | |
| ((copied++)) | |
| else | |
| echo "✗ Skipped: $file (not found)" | |
| ((skipped++)) | |
| fi | |
| done | |
| echo "" | |
| echo "Summary: $copied copied, $skipped skipped" | |
| } | |
| # Deletes all GitHub gists with specific rubric project filenames | |
| # Usage: rmgistprubric | |
| # Deletes gists named: golden.patch, interface.md, requirements.json, problem_statement.md, prompt_statement.md | |
| # WARNING: This will delete ALL gists with these names, regardless of content | |
| rmgistprubric() { | |
| local files=( | |
| "golden.patch" | |
| "test.patch" | |
| "interface.md" | |
| "requirements.json" | |
| "problem_statement.md" | |
| "prompt_statement.md" | |
| ) | |
| echo "Fetching your gists..." | |
| local gist_list=$(gh gist list --limit 1000) | |
| local deleted=0 | |
| for file in "${files[@]}"; do | |
| echo "" | |
| echo "Searching for gists named: $file" | |
| local gist_ids=$(echo "$gist_list" | grep "$file" | awk '{print $1}') | |
| if [ -n "$gist_ids" ]; then | |
| while IFS= read -r gist_id; do | |
| gh gist delete "$gist_id" --yes | |
| echo "✓ Deleted gist: $gist_id ($file)" | |
| ((deleted++)) | |
| done <<< "$gist_ids" | |
| else | |
| echo "✗ No gists found for: $file" | |
| fi | |
| done | |
| echo "" | |
| echo "Summary: $deleted gists deleted" | |
| } | |
| # Deletes all GitHub gists containing unprefixed rubric project files | |
| # Usage: rmgistprubricunprefixed | |
| # Searches gist contents for: golden.patch, interface.md, requirements.json, problem_statement.md, prompt_statement.md | |
| # WARNING: This will delete ALL gists containing these exact filenames | |
| rmgistprubricunprefixed() { | |
| local files=( | |
| "golden.patch" | |
| "test.patch" | |
| "interface.md" | |
| "requirements.json" | |
| "problem_statement.md" | |
| "prompt_statement.md" | |
| ) | |
| echo "Fetching your gists..." | |
| local deleted=0 | |
| local checked=0 | |
| while IFS= read -r line; do | |
| local gist_id=$(echo "$line" | awk '{print $1}') | |
| if [ -z "$gist_id" ]; then | |
| continue | |
| fi | |
| ((checked++)) | |
| echo "Checking gist $checked: $gist_id" | |
| local gist_files=$(gh gist view "$gist_id" --files 2>/dev/null) | |
| for file in "${files[@]}"; do | |
| if echo "$gist_files" | grep -q "^$file$"; then | |
| echo "✓ Found $file in gist: $gist_id" | |
| gh gist delete "$gist_id" --yes | |
| echo " Deleted gist: $gist_id" | |
| ((deleted++)) | |
| break | |
| fi | |
| done | |
| done < <(gh gist list --limit 1000) | |
| echo "" | |
| echo "Summary: Checked $checked gists, deleted $deleted gists" | |
| } | |
| # Duplicates rubric project files with directory prefix and creates GitHub gists for each | |
| # Usage: __gist | |
| # Combines dupprubric and gistprubric into one command | |
| alias __gist='__gist() { | |
| dupprubric | |
| echo "" | |
| echo "Prefixed context files created" | |
| echo "" | |
| gistprubric | |
| echo "" | |
| echo "Context files now gists" | |
| }; __gist' | |
| alias __deleteGist='__deleteGist() { | |
| rmgistprubric | |
| echo "" | |
| echo "Prefixed gists deleted" | |
| echo "" | |
| rmgistprubricunprefixed | |
| echo "" | |
| echo "Unprefixed gists deleted" | |
| }; __deleteGist' | |
| # Duplicates rubric project files with directory prefix and creates GitHub gists for each | |
| # Usage: gistprubric | |
| # Finds all files matching pattern: <parent-dir>__<rubric-file> | |
| # Creates a public gist for each file and saves raw URLs to a markdown file | |
| gistprubric() { | |
| local parent_dir=$(basename "$PWD") | |
| local files=( | |
| "${parent_dir}__golden.patch" | |
| "${parent_dir}__test.patch" | |
| "${parent_dir}__interface.md" | |
| "${parent_dir}__requirements.json" | |
| "${parent_dir}__problem_statement.md" | |
| "${parent_dir}__prompt_statement.md" | |
| ) | |
| local created=0 | |
| local skipped=0 | |
| local md_file="${parent_dir}__context_file_links.md" | |
| echo "# Context File Gist Links" > "$md_file" | |
| echo "" >> "$md_file" | |
| echo "**Project:** $parent_dir" >> "$md_file" | |
| echo "" >> "$md_file" | |
| echo "Creating gists for project: $parent_dir" | |
| echo "" | |
| for file in "${files[@]}"; do | |
| if [ -f "$file" ]; then | |
| local url=$(gh gist create "$file" --public 2>&1 | grep -o 'https://gist.github.com/[^ ]*') | |
| if [ -n "$url" ]; then | |
| local gist_id=$(echo "$url" | grep -o '[^/]*$') | |
| local raw_url="https://gist.githubusercontent.com/flavioespinoza/${gist_id}/raw" | |
| echo "✓ $file" | |
| echo " $url" | |
| echo " Raw: $raw_url" | |
| echo "" | |
| echo "- $file : $raw_url" >> "$md_file" | |
| ((created++)) | |
| else | |
| echo "✗ Failed to create gist for $file" | |
| ((skipped++)) | |
| fi | |
| else | |
| echo "✗ Skipped: $file (not found)" | |
| ((skipped++)) | |
| fi | |
| done | |
| echo "Summary: $created gists created, $skipped skipped" | |
| echo "Links saved to: $md_file" | |
| } | |
| # Creates a GitHub gist from a single file and saves the raw URL to a markdown file | |
| # Usage: __agent <filename> | |
| # Example: __agent rubric.txt creates gist and saves URL to rubric__gist_link.md | |
| __agent() { | |
| if [ -z "$1" ]; then | |
| echo "Error: No filename provided" | |
| echo "Usage: __agent <filename>" | |
| return 1 | |
| fi | |
| if [ ! -f "$1" ]; then | |
| echo "Error: File '$1' does not exist" | |
| return 1 | |
| fi | |
| local parent_dir=$(basename "$PWD") | |
| local filename="$1" | |
| local base_name="${filename%.*}" | |
| local md_file="${base_name}__gist_link.md" | |
| echo "Creating gist for: $parent_dir__$filename" | |
| local url=$(gh gist create "${parent_dir}__${filename}" --public 2>&1 | grep -o 'https://gist.github.com/[^ ]*') | |
| if [ -n "$url" ]; then | |
| local gist_id=$(echo "$url" | grep -o '[^/]*$') | |
| local raw_url="https://gist.githubusercontent.com/flavioespinoza/${gist_id}/raw" | |
| echo "# Gist Link" > "$md_file" | |
| echo "" >> "$md_file" | |
| echo "**File:** $filename" >> "$md_file" | |
| echo "" >> "$md_file" | |
| echo "$raw_url" >> "$md_file" | |
| echo "✓ Gist created: $url" | |
| echo "✓ Raw URL: $raw_url" | |
| echo "✓ Saved to: $md_file" | |
| else | |
| echo "✗ Failed to create gist for $filename" | |
| return 1 | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment