docs+skills: add main UI/UX visual-truth PRD and skill links

This commit is contained in:
ZenchantLive 2026-02-18 12:50:53 -08:00
parent 1c36223e7f
commit 14a50ad4ae
289 changed files with 54463 additions and 0 deletions

View file

@ -0,0 +1,138 @@
#!/bin/bash
# Template: Authenticated Session Workflow
# Purpose: Login once, perform actions, clean up
# Usage: ./authenticated-session.sh <login-url>
#
# Environment variables:
# APP_USERNAME - Login username/email
# APP_PASSWORD - Login password
#
# Two modes:
# 1. Discovery mode (default): Shows login form structure
# 2. Login mode: Performs actual login after you update refs
#
# Setup steps:
# 1. Run once to see form structure (discovery mode)
# 2. Update refs in LOGIN FLOW section below
# 3. Set APP_USERNAME and APP_PASSWORD
# 4. Comment out the DISCOVERY section
set -euo pipefail
LOGIN_URL="${1:?Usage: $0 <login-url>}"
echo "Authentication workflow: $LOGIN_URL"
# Cleanup handler
cleanup() {
if [ -n "${SESSION_ID:-}" ]; then
echo "Closing session..."
infsh app run agent-browser --function close --session $SESSION_ID --input '{}' 2>/dev/null || true
fi
}
trap cleanup EXIT
# ================================================================
# DISCOVERY MODE: Shows login form structure
# Delete this section after setup
# ================================================================
echo "Opening login page..."
RESULT=$(infsh app run agent-browser --function open --session new --input '{
"url": "'"$LOGIN_URL"'"
}')
SESSION_ID=$(echo $RESULT | jq -r '.session_id')
echo ""
echo "Login form structure:"
echo "---"
echo $RESULT | jq -r '.elements_text'
echo "---"
echo ""
echo "Discovery mode complete."
echo ""
echo "Next steps:"
echo " 1. Identify the refs: username=@e?, password=@e?, submit=@e?"
echo " 2. Update the LOGIN FLOW section below with your refs"
echo " 3. Set environment variables:"
echo " export APP_USERNAME='your-username'"
echo " export APP_PASSWORD='your-password'"
echo " 4. Comment out this DISCOVERY MODE section"
echo ""
exit 0
# ================================================================
# LOGIN FLOW: Uncomment and customize after discovery
# ================================================================
# : "${APP_USERNAME:?Set APP_USERNAME environment variable}"
# : "${APP_PASSWORD:?Set APP_PASSWORD environment variable}"
#
# echo "Opening login page..."
# RESULT=$(infsh app run agent-browser --function open --session new --input '{
# "url": "'"$LOGIN_URL"'",
# "record_video": false
# }')
# SESSION_ID=$(echo $RESULT | jq -r '.session_id')
#
# echo "Filling credentials..."
# # Update @e1, @e2, @e3 to match your form
# infsh app run agent-browser --function interact --session $SESSION_ID --input '{
# "action": "fill", "ref": "@e1", "text": "'"$APP_USERNAME"'"
# }'
#
# infsh app run agent-browser --function interact --session $SESSION_ID --input '{
# "action": "fill", "ref": "@e2", "text": "'"$APP_PASSWORD"'"
# }'
#
# echo "Submitting..."
# infsh app run agent-browser --function interact --session $SESSION_ID --input '{
# "action": "click", "ref": "@e3"
# }'
#
# # Wait for redirect
# infsh app run agent-browser --function interact --session $SESSION_ID --input '{
# "action": "wait", "wait_ms": 3000
# }'
#
# # Verify login succeeded
# RESULT=$(infsh app run agent-browser --function snapshot --session $SESSION_ID --input '{}')
# URL=$(echo $RESULT | jq -r '.url')
#
# if [[ "$URL" == *"/login"* ]] || [[ "$URL" == *"/signin"* ]]; then
# echo "ERROR: Login failed - still on login page"
# echo "URL: $URL"
# infsh app run agent-browser --function screenshot --session $SESSION_ID --input '{}' > login-failed.json
# exit 1
# fi
#
# echo "Login successful!"
# echo "Current URL: $URL"
# echo ""
#
# # ================================================================
# # AUTHENTICATED ACTIONS: Add your post-login automation here
# # ================================================================
# echo "Performing authenticated actions..."
#
# # Example: Navigate to dashboard
# # infsh app run agent-browser --function interact --session $SESSION_ID --input '{
# # "action": "goto", "url": "https://app.example.com/dashboard"
# # }'
#
# # Example: Click a menu item
# # infsh app run agent-browser --function interact --session $SESSION_ID --input '{
# # "action": "click", "ref": "@e5"
# # }'
#
# # Example: Extract data
# # RESULT=$(infsh app run agent-browser --function execute --session $SESSION_ID --input '{
# # "code": "document.querySelector(\".user-data\").textContent"
# # }')
# # echo "Data: $(echo $RESULT | jq -r '.result')"
#
# # Example: Take screenshot of authenticated page
# # infsh app run agent-browser --function screenshot --session $SESSION_ID --input '{
# # "full_page": true
# # }' > authenticated-page.json
#
# echo ""
# echo "Authenticated session complete"

View file

@ -0,0 +1,149 @@
#!/bin/bash
# Template: Content Capture Workflow
# Purpose: Extract content from web pages (text, screenshots, video)
# Usage: ./capture-workflow.sh <url> [output-dir]
#
# Outputs:
# - page-screenshot.json: Page screenshot data
# - page-full-screenshot.json: Full page screenshot data
# - page-elements.txt: Interactive elements with refs
# - page-text.txt: All text content
# - page-links.txt: All links on the page
# - session-video.json: Video recording (if enabled)
set -euo pipefail
TARGET_URL="${1:?Usage: $0 <url> [output-dir]}"
OUTPUT_DIR="${2:-.}"
echo "Content capture: $TARGET_URL"
echo "Output directory: $OUTPUT_DIR"
mkdir -p "$OUTPUT_DIR"
# Cleanup handler
cleanup() {
if [ -n "${SESSION_ID:-}" ]; then
echo "Closing session..."
CLOSE_RESULT=$(infsh app run agent-browser --function close --session $SESSION_ID --input '{}' 2>/dev/null || echo '{}')
# Save video if available
VIDEO=$(echo $CLOSE_RESULT | jq -r '.video // empty')
if [ -n "$VIDEO" ]; then
echo "$CLOSE_RESULT" > "$OUTPUT_DIR/session-video.json"
echo "Video saved to: $OUTPUT_DIR/session-video.json"
fi
fi
}
trap cleanup EXIT
# ================================================================
# CONFIGURATION
# ================================================================
RECORD_VIDEO=false # Set to true to record video
FULL_PAGE=true # Set to true for full page screenshots
EXTRACT_LINKS=true # Set to true to extract all links
SCROLL_PAGES=0 # Number of scroll actions for infinite scroll pages
# ================================================================
# CAPTURE WORKFLOW
# ================================================================
# Start session
echo "Opening page..."
RESULT=$(infsh app run agent-browser --function open --session new --input '{
"url": "'"$TARGET_URL"'",
"record_video": '$RECORD_VIDEO',
"width": 1920,
"height": 1080
}')
SESSION_ID=$(echo $RESULT | jq -r '.session_id')
# Get metadata
URL=$(echo $RESULT | jq -r '.url')
TITLE=$(echo $RESULT | jq -r '.title')
echo "Title: $TITLE"
echo "URL: $URL"
# Save elements
echo $RESULT | jq -r '.elements_text' > "$OUTPUT_DIR/page-elements.txt"
echo "Elements saved to: $OUTPUT_DIR/page-elements.txt"
# Handle infinite scroll (if configured)
if [ $SCROLL_PAGES -gt 0 ]; then
echo "Scrolling through $SCROLL_PAGES pages..."
for ((i=1; i<=SCROLL_PAGES; i++)); do
infsh app run agent-browser --function interact --session $SESSION_ID --input '{
"action": "scroll", "direction": "down", "scroll_amount": 800
}' > /dev/null
infsh app run agent-browser --function interact --session $SESSION_ID --input '{
"action": "wait", "wait_ms": 1000
}' > /dev/null
echo " Scrolled page $i/$SCROLL_PAGES"
done
# Re-snapshot after scrolling
RESULT=$(infsh app run agent-browser --function snapshot --session $SESSION_ID --input '{}')
fi
# Take viewport screenshot
echo "Taking viewport screenshot..."
infsh app run agent-browser --function screenshot --session $SESSION_ID --input '{}' > "$OUTPUT_DIR/page-screenshot.json"
echo "Screenshot saved to: $OUTPUT_DIR/page-screenshot.json"
# Take full page screenshot (if configured)
if [ "$FULL_PAGE" = true ]; then
echo "Taking full page screenshot..."
infsh app run agent-browser --function screenshot --session $SESSION_ID --input '{
"full_page": true
}' > "$OUTPUT_DIR/page-full-screenshot.json"
echo "Full screenshot saved to: $OUTPUT_DIR/page-full-screenshot.json"
fi
# Extract all text content
echo "Extracting text content..."
RESULT=$(infsh app run agent-browser --function execute --session $SESSION_ID --input '{
"code": "document.body.innerText"
}')
echo $RESULT | jq -r '.result' > "$OUTPUT_DIR/page-text.txt"
echo "Text saved to: $OUTPUT_DIR/page-text.txt"
# Extract all links (if configured)
if [ "$EXTRACT_LINKS" = true ]; then
echo "Extracting links..."
RESULT=$(infsh app run agent-browser --function execute --session $SESSION_ID --input '{
"code": "Array.from(document.querySelectorAll(\"a[href]\")).map(a => a.href + \" | \" + (a.textContent || \"\").trim().slice(0,50)).join(\"\\n\")"
}')
echo $RESULT | jq -r '.result' > "$OUTPUT_DIR/page-links.txt"
echo "Links saved to: $OUTPUT_DIR/page-links.txt"
fi
# ================================================================
# CUSTOM EXTRACTION: Add your specific extraction logic here
# ================================================================
# Example: Extract specific elements by selector
# RESULT=$(infsh app run agent-browser --function execute --session $SESSION_ID --input '{
# "code": "Array.from(document.querySelectorAll(\"h2\")).map(h => h.textContent).join(\"\\n\")"
# }')
# echo $RESULT | jq -r '.result' > "$OUTPUT_DIR/headings.txt"
# Example: Extract JSON data from script tag
# RESULT=$(infsh app run agent-browser --function execute --session $SESSION_ID --input '{
# "code": "JSON.parse(document.querySelector(\"script[type=application/json]\").textContent)"
# }')
# echo $RESULT | jq '.result' > "$OUTPUT_DIR/json-data.json"
# Example: Extract table data
# RESULT=$(infsh app run agent-browser --function execute --session $SESSION_ID --input '{
# "code": "Array.from(document.querySelectorAll(\"table tr\")).map(tr => Array.from(tr.cells).map(td => td.textContent.trim()).join(\",\")).join(\"\\n\")"
# }')
# echo $RESULT | jq -r '.result' > "$OUTPUT_DIR/table-data.csv"
# ================================================================
# SUMMARY
# ================================================================
echo ""
echo "Capture complete!"
echo "Files created:"
ls -la "$OUTPUT_DIR"/*.txt "$OUTPUT_DIR"/*.json 2>/dev/null || true

View file

@ -0,0 +1,126 @@
#!/bin/bash
# Template: Form Automation Workflow
# Purpose: Fill and submit web forms with validation
# Usage: ./form-automation.sh <form-url>
#
# This template demonstrates the snapshot-interact-verify pattern:
# 1. Navigate to form
# 2. Snapshot to get element refs
# 3. Fill fields using refs
# 4. Submit and verify result
#
# Customize: Update the refs (@e1, @e2, etc.) based on your form's snapshot output
set -euo pipefail
FORM_URL="${1:?Usage: $0 <form-url>}"
echo "Form automation: $FORM_URL"
# Cleanup handler
cleanup() {
if [ -n "${SESSION_ID:-}" ]; then
infsh app run agent-browser --function close --session $SESSION_ID --input '{}' 2>/dev/null || true
fi
}
trap cleanup EXIT
# Step 1: Navigate to form
echo "Opening form..."
RESULT=$(infsh app run agent-browser --function open --session new --input '{
"url": "'"$FORM_URL"'"
}')
SESSION_ID=$(echo $RESULT | jq -r '.session_id')
# Step 2: Display form structure
echo ""
echo "Form elements:"
echo "---"
echo $RESULT | jq -r '.elements_text'
echo "---"
echo ""
# ================================================================
# DISCOVERY MODE: Shows form structure
# After running once, update the FORM FILL section below with your refs
# then delete or comment out this section
# ================================================================
echo "Discovery mode: Form structure shown above"
echo ""
echo "Next steps:"
echo " 1. Note the refs for your form fields (e.g., @e1 for name, @e2 for email)"
echo " 2. Update the FORM FILL section below"
echo " 3. Set environment variables for form data"
echo " 4. Comment out this discovery section"
echo ""
exit 0
# ================================================================
# FORM FILL: Uncomment and customize after discovery
# ================================================================
# echo "Filling form..."
#
# # Text input
# infsh app run agent-browser --function interact --session $SESSION_ID --input '{
# "action": "fill", "ref": "@e1", "text": "'"${FORM_NAME:-John Doe}"'"
# }'
#
# # Email input
# infsh app run agent-browser --function interact --session $SESSION_ID --input '{
# "action": "fill", "ref": "@e2", "text": "'"${FORM_EMAIL:-john@example.com}"'"
# }'
#
# # Dropdown/select
# infsh app run agent-browser --function interact --session $SESSION_ID --input '{
# "action": "select", "ref": "@e3", "text": "Option 1"
# }'
#
# # Checkbox
# infsh app run agent-browser --function interact --session $SESSION_ID --input '{
# "action": "check", "ref": "@e4"
# }'
#
# # Textarea
# infsh app run agent-browser --function interact --session $SESSION_ID --input '{
# "action": "fill", "ref": "@e5", "text": "'"${FORM_MESSAGE:-Hello, this is a test message.}"'"
# }'
#
# # Submit button
# echo "Submitting form..."
# infsh app run agent-browser --function interact --session $SESSION_ID --input '{
# "action": "click", "ref": "@e6"
# }'
#
# # Wait for submission
# infsh app run agent-browser --function interact --session $SESSION_ID --input '{
# "action": "wait", "wait_ms": 2000
# }'
#
# # Step 3: Verify result
# echo ""
# echo "Verifying submission..."
# RESULT=$(infsh app run agent-browser --function snapshot --session $SESSION_ID --input '{}')
#
# URL=$(echo $RESULT | jq -r '.url')
# TITLE=$(echo $RESULT | jq -r '.title')
# echo "Final URL: $URL"
# echo "Page title: $TITLE"
#
# # Check for success indicators
# ELEMENTS=$(echo $RESULT | jq -r '.elements_text')
# if echo "$ELEMENTS" | grep -qi "thank you\|success\|submitted"; then
# echo "SUCCESS: Form submitted successfully"
# elif echo "$URL" | grep -qi "error\|fail"; then
# echo "ERROR: Form submission may have failed"
# exit 1
# else
# echo "UNKNOWN: Check the result manually"
# fi
#
# # Optional: Capture evidence
# infsh app run agent-browser --function screenshot --session $SESSION_ID --input '{
# "full_page": true
# }' > form-result-screenshot.json
# echo "Screenshot saved to form-result-screenshot.json"
echo "Done"