aidevops 2.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/AGENTS.md +614 -0
- package/.agent/accounts.md +65 -0
- package/.agent/aidevops/add-new-mcp-to-aidevops.md +456 -0
- package/.agent/aidevops/api-integrations.md +335 -0
- package/.agent/aidevops/architecture.md +510 -0
- package/.agent/aidevops/configs.md +274 -0
- package/.agent/aidevops/docs.md +244 -0
- package/.agent/aidevops/extension.md +311 -0
- package/.agent/aidevops/mcp-integrations.md +340 -0
- package/.agent/aidevops/mcp-troubleshooting.md +162 -0
- package/.agent/aidevops/memory-patterns.md +172 -0
- package/.agent/aidevops/providers.md +217 -0
- package/.agent/aidevops/recommendations.md +321 -0
- package/.agent/aidevops/requirements.md +301 -0
- package/.agent/aidevops/resources.md +214 -0
- package/.agent/aidevops/security-requirements.md +174 -0
- package/.agent/aidevops/security.md +350 -0
- package/.agent/aidevops/service-links.md +400 -0
- package/.agent/aidevops/services.md +357 -0
- package/.agent/aidevops/setup.md +153 -0
- package/.agent/aidevops/troubleshooting.md +389 -0
- package/.agent/aidevops.md +124 -0
- package/.agent/build-plus.md +244 -0
- package/.agent/content/guidelines.md +109 -0
- package/.agent/content.md +87 -0
- package/.agent/health.md +59 -0
- package/.agent/legal.md +59 -0
- package/.agent/loop-state/full-loop.local.md +16 -0
- package/.agent/loop-state/ralph-loop.local.md +10 -0
- package/.agent/marketing.md +440 -0
- package/.agent/memory/README.md +260 -0
- package/.agent/onboarding.md +796 -0
- package/.agent/plan-plus.md +245 -0
- package/.agent/research.md +100 -0
- package/.agent/sales.md +333 -0
- package/.agent/scripts/101domains-helper.sh +701 -0
- package/.agent/scripts/add-missing-returns.sh +140 -0
- package/.agent/scripts/agent-browser-helper.sh +311 -0
- package/.agent/scripts/agno-setup.sh +712 -0
- package/.agent/scripts/ahrefs-mcp-wrapper.js +168 -0
- package/.agent/scripts/aidevops-update-check.sh +71 -0
- package/.agent/scripts/ampcode-cli.sh +522 -0
- package/.agent/scripts/auto-version-bump.sh +156 -0
- package/.agent/scripts/autogen-helper.sh +512 -0
- package/.agent/scripts/beads-sync-helper.sh +596 -0
- package/.agent/scripts/closte-helper.sh +5 -0
- package/.agent/scripts/cloudron-helper.sh +321 -0
- package/.agent/scripts/codacy-cli-chunked.sh +581 -0
- package/.agent/scripts/codacy-cli.sh +442 -0
- package/.agent/scripts/code-audit-helper.sh +5 -0
- package/.agent/scripts/coderabbit-cli.sh +417 -0
- package/.agent/scripts/coderabbit-pro-analysis.sh +238 -0
- package/.agent/scripts/commands/code-simplifier.md +86 -0
- package/.agent/scripts/commands/full-loop.md +246 -0
- package/.agent/scripts/commands/postflight-loop.md +103 -0
- package/.agent/scripts/commands/recall.md +182 -0
- package/.agent/scripts/commands/remember.md +132 -0
- package/.agent/scripts/commands/save-todo.md +175 -0
- package/.agent/scripts/commands/session-review.md +154 -0
- package/.agent/scripts/comprehensive-quality-fix.sh +106 -0
- package/.agent/scripts/context-builder-helper.sh +522 -0
- package/.agent/scripts/coolify-cli-helper.sh +674 -0
- package/.agent/scripts/coolify-helper.sh +380 -0
- package/.agent/scripts/crawl4ai-examples.sh +401 -0
- package/.agent/scripts/crawl4ai-helper.sh +1078 -0
- package/.agent/scripts/crewai-helper.sh +681 -0
- package/.agent/scripts/dev-browser-helper.sh +513 -0
- package/.agent/scripts/dns-helper.sh +396 -0
- package/.agent/scripts/domain-research-helper.sh +917 -0
- package/.agent/scripts/dspy-helper.sh +285 -0
- package/.agent/scripts/dspyground-helper.sh +291 -0
- package/.agent/scripts/eeat-score-helper.sh +1242 -0
- package/.agent/scripts/efficient-return-fix.sh +92 -0
- package/.agent/scripts/extract-opencode-prompts.sh +128 -0
- package/.agent/scripts/find-missing-returns.sh +113 -0
- package/.agent/scripts/fix-auth-headers.sh +104 -0
- package/.agent/scripts/fix-common-strings.sh +254 -0
- package/.agent/scripts/fix-content-type.sh +100 -0
- package/.agent/scripts/fix-error-messages.sh +130 -0
- package/.agent/scripts/fix-misplaced-returns.sh +74 -0
- package/.agent/scripts/fix-remaining-literals.sh +152 -0
- package/.agent/scripts/fix-return-statements.sh +41 -0
- package/.agent/scripts/fix-s131-default-cases.sh +249 -0
- package/.agent/scripts/fix-sc2155-simple.sh +102 -0
- package/.agent/scripts/fix-shellcheck-critical.sh +187 -0
- package/.agent/scripts/fix-string-literals.sh +273 -0
- package/.agent/scripts/full-loop-helper.sh +773 -0
- package/.agent/scripts/generate-opencode-agents.sh +497 -0
- package/.agent/scripts/generate-opencode-commands.sh +1629 -0
- package/.agent/scripts/generate-skills.sh +366 -0
- package/.agent/scripts/git-platforms-helper.sh +640 -0
- package/.agent/scripts/gitea-cli-helper.sh +743 -0
- package/.agent/scripts/github-cli-helper.sh +702 -0
- package/.agent/scripts/gitlab-cli-helper.sh +682 -0
- package/.agent/scripts/gsc-add-user-helper.sh +325 -0
- package/.agent/scripts/gsc-sitemap-helper.sh +678 -0
- package/.agent/scripts/hetzner-helper.sh +485 -0
- package/.agent/scripts/hostinger-helper.sh +229 -0
- package/.agent/scripts/keyword-research-helper.sh +1815 -0
- package/.agent/scripts/langflow-helper.sh +544 -0
- package/.agent/scripts/linkedin-automation.py +241 -0
- package/.agent/scripts/linter-manager.sh +599 -0
- package/.agent/scripts/linters-local.sh +434 -0
- package/.agent/scripts/list-keys-helper.sh +488 -0
- package/.agent/scripts/local-browser-automation.py +339 -0
- package/.agent/scripts/localhost-helper.sh +744 -0
- package/.agent/scripts/loop-common.sh +806 -0
- package/.agent/scripts/mainwp-helper.sh +728 -0
- package/.agent/scripts/markdown-formatter.sh +338 -0
- package/.agent/scripts/markdown-lint-fix.sh +311 -0
- package/.agent/scripts/mass-fix-returns.sh +58 -0
- package/.agent/scripts/mcp-diagnose.sh +167 -0
- package/.agent/scripts/mcp-inspector-helper.sh +449 -0
- package/.agent/scripts/memory-helper.sh +650 -0
- package/.agent/scripts/monitor-code-review.sh +255 -0
- package/.agent/scripts/onboarding-helper.sh +706 -0
- package/.agent/scripts/opencode-github-setup-helper.sh +797 -0
- package/.agent/scripts/opencode-test-helper.sh +213 -0
- package/.agent/scripts/pagespeed-helper.sh +464 -0
- package/.agent/scripts/pandoc-helper.sh +362 -0
- package/.agent/scripts/postflight-check.sh +555 -0
- package/.agent/scripts/pre-commit-hook.sh +259 -0
- package/.agent/scripts/pre-edit-check.sh +169 -0
- package/.agent/scripts/qlty-cli.sh +356 -0
- package/.agent/scripts/quality-cli-manager.sh +525 -0
- package/.agent/scripts/quality-feedback-helper.sh +462 -0
- package/.agent/scripts/quality-fix.sh +263 -0
- package/.agent/scripts/quality-loop-helper.sh +1108 -0
- package/.agent/scripts/ralph-loop-helper.sh +836 -0
- package/.agent/scripts/ralph-upstream-check.sh +341 -0
- package/.agent/scripts/secretlint-helper.sh +847 -0
- package/.agent/scripts/servers-helper.sh +241 -0
- package/.agent/scripts/ses-helper.sh +619 -0
- package/.agent/scripts/session-review-helper.sh +404 -0
- package/.agent/scripts/setup-linters-wizard.sh +379 -0
- package/.agent/scripts/setup-local-api-keys.sh +330 -0
- package/.agent/scripts/setup-mcp-integrations.sh +472 -0
- package/.agent/scripts/shared-constants.sh +246 -0
- package/.agent/scripts/site-crawler-helper.sh +1487 -0
- package/.agent/scripts/snyk-helper.sh +940 -0
- package/.agent/scripts/sonarcloud-autofix.sh +193 -0
- package/.agent/scripts/sonarcloud-cli.sh +191 -0
- package/.agent/scripts/sonarscanner-cli.sh +455 -0
- package/.agent/scripts/spaceship-helper.sh +747 -0
- package/.agent/scripts/stagehand-helper.sh +321 -0
- package/.agent/scripts/stagehand-python-helper.sh +321 -0
- package/.agent/scripts/stagehand-python-setup.sh +441 -0
- package/.agent/scripts/stagehand-setup.sh +439 -0
- package/.agent/scripts/system-cleanup.sh +340 -0
- package/.agent/scripts/terminal-title-helper.sh +388 -0
- package/.agent/scripts/terminal-title-setup.sh +549 -0
- package/.agent/scripts/test-stagehand-both-integration.sh +317 -0
- package/.agent/scripts/test-stagehand-integration.sh +309 -0
- package/.agent/scripts/test-stagehand-python-integration.sh +341 -0
- package/.agent/scripts/todo-ready.sh +263 -0
- package/.agent/scripts/tool-version-check.sh +362 -0
- package/.agent/scripts/toon-helper.sh +469 -0
- package/.agent/scripts/twilio-helper.sh +917 -0
- package/.agent/scripts/updown-helper.sh +279 -0
- package/.agent/scripts/validate-mcp-integrations.sh +250 -0
- package/.agent/scripts/validate-version-consistency.sh +131 -0
- package/.agent/scripts/vaultwarden-helper.sh +597 -0
- package/.agent/scripts/vercel-cli-helper.sh +816 -0
- package/.agent/scripts/verify-mirrors.sh +169 -0
- package/.agent/scripts/version-manager.sh +831 -0
- package/.agent/scripts/webhosting-helper.sh +471 -0
- package/.agent/scripts/webhosting-verify.sh +238 -0
- package/.agent/scripts/wordpress-mcp-helper.sh +508 -0
- package/.agent/scripts/worktree-helper.sh +595 -0
- package/.agent/scripts/worktree-sessions.sh +577 -0
- package/.agent/seo/dataforseo.md +215 -0
- package/.agent/seo/domain-research.md +532 -0
- package/.agent/seo/eeat-score.md +659 -0
- package/.agent/seo/google-search-console.md +366 -0
- package/.agent/seo/gsc-sitemaps.md +282 -0
- package/.agent/seo/keyword-research.md +521 -0
- package/.agent/seo/serper.md +278 -0
- package/.agent/seo/site-crawler.md +387 -0
- package/.agent/seo.md +236 -0
- package/.agent/services/accounting/quickfile.md +159 -0
- package/.agent/services/communications/telfon.md +470 -0
- package/.agent/services/communications/twilio.md +569 -0
- package/.agent/services/crm/fluentcrm.md +449 -0
- package/.agent/services/email/ses.md +399 -0
- package/.agent/services/hosting/101domains.md +378 -0
- package/.agent/services/hosting/closte.md +177 -0
- package/.agent/services/hosting/cloudflare.md +251 -0
- package/.agent/services/hosting/cloudron.md +478 -0
- package/.agent/services/hosting/dns-providers.md +335 -0
- package/.agent/services/hosting/domain-purchasing.md +344 -0
- package/.agent/services/hosting/hetzner.md +327 -0
- package/.agent/services/hosting/hostinger.md +287 -0
- package/.agent/services/hosting/localhost.md +419 -0
- package/.agent/services/hosting/spaceship.md +353 -0
- package/.agent/services/hosting/webhosting.md +330 -0
- package/.agent/social-media.md +69 -0
- package/.agent/templates/plans-template.md +114 -0
- package/.agent/templates/prd-template.md +129 -0
- package/.agent/templates/tasks-template.md +108 -0
- package/.agent/templates/todo-template.md +89 -0
- package/.agent/tools/ai-assistants/agno.md +471 -0
- package/.agent/tools/ai-assistants/capsolver.md +326 -0
- package/.agent/tools/ai-assistants/configuration.md +221 -0
- package/.agent/tools/ai-assistants/overview.md +209 -0
- package/.agent/tools/ai-assistants/status.md +171 -0
- package/.agent/tools/ai-assistants/windsurf.md +193 -0
- package/.agent/tools/ai-orchestration/autogen.md +406 -0
- package/.agent/tools/ai-orchestration/crewai.md +445 -0
- package/.agent/tools/ai-orchestration/langflow.md +405 -0
- package/.agent/tools/ai-orchestration/openprose.md +487 -0
- package/.agent/tools/ai-orchestration/overview.md +362 -0
- package/.agent/tools/ai-orchestration/packaging.md +647 -0
- package/.agent/tools/browser/agent-browser.md +464 -0
- package/.agent/tools/browser/browser-automation.md +400 -0
- package/.agent/tools/browser/chrome-devtools.md +282 -0
- package/.agent/tools/browser/crawl4ai-integration.md +422 -0
- package/.agent/tools/browser/crawl4ai-resources.md +277 -0
- package/.agent/tools/browser/crawl4ai-usage.md +416 -0
- package/.agent/tools/browser/crawl4ai.md +585 -0
- package/.agent/tools/browser/dev-browser.md +341 -0
- package/.agent/tools/browser/pagespeed.md +260 -0
- package/.agent/tools/browser/playwright.md +266 -0
- package/.agent/tools/browser/playwriter.md +310 -0
- package/.agent/tools/browser/stagehand-examples.md +456 -0
- package/.agent/tools/browser/stagehand-python.md +483 -0
- package/.agent/tools/browser/stagehand.md +421 -0
- package/.agent/tools/build-agent/agent-review.md +224 -0
- package/.agent/tools/build-agent/build-agent.md +784 -0
- package/.agent/tools/build-mcp/aidevops-plugin.md +476 -0
- package/.agent/tools/build-mcp/api-wrapper.md +445 -0
- package/.agent/tools/build-mcp/build-mcp.md +240 -0
- package/.agent/tools/build-mcp/deployment.md +401 -0
- package/.agent/tools/build-mcp/server-patterns.md +632 -0
- package/.agent/tools/build-mcp/transports.md +366 -0
- package/.agent/tools/code-review/auditing.md +383 -0
- package/.agent/tools/code-review/automation.md +219 -0
- package/.agent/tools/code-review/best-practices.md +203 -0
- package/.agent/tools/code-review/codacy.md +151 -0
- package/.agent/tools/code-review/code-simplifier.md +174 -0
- package/.agent/tools/code-review/code-standards.md +309 -0
- package/.agent/tools/code-review/coderabbit.md +101 -0
- package/.agent/tools/code-review/management.md +155 -0
- package/.agent/tools/code-review/qlty.md +248 -0
- package/.agent/tools/code-review/secretlint.md +565 -0
- package/.agent/tools/code-review/setup.md +250 -0
- package/.agent/tools/code-review/snyk.md +563 -0
- package/.agent/tools/code-review/tools.md +230 -0
- package/.agent/tools/content/summarize.md +353 -0
- package/.agent/tools/context/augment-context-engine.md +468 -0
- package/.agent/tools/context/context-builder-agent.md +76 -0
- package/.agent/tools/context/context-builder.md +375 -0
- package/.agent/tools/context/context7.md +371 -0
- package/.agent/tools/context/dspy.md +302 -0
- package/.agent/tools/context/dspyground.md +374 -0
- package/.agent/tools/context/llm-tldr.md +219 -0
- package/.agent/tools/context/osgrep.md +488 -0
- package/.agent/tools/context/prompt-optimization.md +338 -0
- package/.agent/tools/context/toon.md +292 -0
- package/.agent/tools/conversion/pandoc.md +304 -0
- package/.agent/tools/credentials/api-key-management.md +154 -0
- package/.agent/tools/credentials/api-key-setup.md +224 -0
- package/.agent/tools/credentials/environment-variables.md +180 -0
- package/.agent/tools/credentials/vaultwarden.md +382 -0
- package/.agent/tools/data-extraction/outscraper.md +974 -0
- package/.agent/tools/deployment/coolify-cli.md +388 -0
- package/.agent/tools/deployment/coolify-setup.md +353 -0
- package/.agent/tools/deployment/coolify.md +345 -0
- package/.agent/tools/deployment/vercel.md +390 -0
- package/.agent/tools/git/authentication.md +132 -0
- package/.agent/tools/git/gitea-cli.md +193 -0
- package/.agent/tools/git/github-actions.md +207 -0
- package/.agent/tools/git/github-cli.md +223 -0
- package/.agent/tools/git/gitlab-cli.md +190 -0
- package/.agent/tools/git/opencode-github-security.md +350 -0
- package/.agent/tools/git/opencode-github.md +328 -0
- package/.agent/tools/git/opencode-gitlab.md +252 -0
- package/.agent/tools/git/security.md +196 -0
- package/.agent/tools/git.md +207 -0
- package/.agent/tools/opencode/oh-my-opencode.md +375 -0
- package/.agent/tools/opencode/opencode-anthropic-auth.md +446 -0
- package/.agent/tools/opencode/opencode.md +651 -0
- package/.agent/tools/social-media/bird.md +437 -0
- package/.agent/tools/task-management/beads.md +336 -0
- package/.agent/tools/terminal/terminal-title.md +251 -0
- package/.agent/tools/ui/shadcn.md +196 -0
- package/.agent/tools/ui/ui-skills.md +115 -0
- package/.agent/tools/wordpress/localwp.md +311 -0
- package/.agent/tools/wordpress/mainwp.md +391 -0
- package/.agent/tools/wordpress/scf.md +527 -0
- package/.agent/tools/wordpress/wp-admin.md +729 -0
- package/.agent/tools/wordpress/wp-dev.md +940 -0
- package/.agent/tools/wordpress/wp-preferred.md +398 -0
- package/.agent/tools/wordpress.md +95 -0
- package/.agent/workflows/branch/bugfix.md +63 -0
- package/.agent/workflows/branch/chore.md +95 -0
- package/.agent/workflows/branch/experiment.md +115 -0
- package/.agent/workflows/branch/feature.md +59 -0
- package/.agent/workflows/branch/hotfix.md +98 -0
- package/.agent/workflows/branch/refactor.md +92 -0
- package/.agent/workflows/branch/release.md +96 -0
- package/.agent/workflows/branch.md +347 -0
- package/.agent/workflows/bug-fixing.md +267 -0
- package/.agent/workflows/changelog.md +129 -0
- package/.agent/workflows/code-audit-remote.md +279 -0
- package/.agent/workflows/conversation-starter.md +69 -0
- package/.agent/workflows/error-feedback.md +578 -0
- package/.agent/workflows/feature-development.md +355 -0
- package/.agent/workflows/git-workflow.md +702 -0
- package/.agent/workflows/multi-repo-workspace.md +268 -0
- package/.agent/workflows/plans.md +709 -0
- package/.agent/workflows/postflight.md +604 -0
- package/.agent/workflows/pr.md +571 -0
- package/.agent/workflows/preflight.md +278 -0
- package/.agent/workflows/ralph-loop.md +773 -0
- package/.agent/workflows/release.md +498 -0
- package/.agent/workflows/session-manager.md +254 -0
- package/.agent/workflows/session-review.md +311 -0
- package/.agent/workflows/sql-migrations.md +631 -0
- package/.agent/workflows/version-bump.md +283 -0
- package/.agent/workflows/wiki-update.md +333 -0
- package/.agent/workflows/worktree.md +477 -0
- package/LICENSE +21 -0
- package/README.md +1446 -0
- package/VERSION +1 -0
- package/aidevops.sh +1746 -0
- package/bin/aidevops +21 -0
- package/package.json +75 -0
- package/scripts/npm-postinstall.js +60 -0
- package/setup.sh +2366 -0
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# shellcheck disable=SC2034,SC2155,SC2317,SC2329,SC2016,SC2181,SC1091,SC2154,SC2015,SC2086,SC2129,SC2030,SC2031,SC2119,SC2120,SC2001,SC2162,SC2088,SC2089,SC2090,SC2029,SC2006,SC2153
|
|
3
|
+
|
|
4
|
+
# Stagehand Setup Script for AI DevOps Framework
|
|
5
|
+
# Comprehensive setup and configuration for Stagehand AI browser automation
|
|
6
|
+
|
|
7
|
+
# Source shared constants
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit
|
|
9
|
+
source "${SCRIPT_DIR}/../../.agent/scripts/shared-constants.sh"
|
|
10
|
+
|
|
11
|
+
# Colors for output
|
|
12
|
+
readonly BLUE='\033[0;34m'
|
|
13
|
+
readonly GREEN='\033[0;32m'
|
|
14
|
+
readonly YELLOW='\033[1;33m'
|
|
15
|
+
readonly RED='\033[0;31m'
|
|
16
|
+
readonly NC='\033[0m'
|
|
17
|
+
|
|
18
|
+
# Print functions
|
|
19
|
+
print_info() {
|
|
20
|
+
local msg="$1"
|
|
21
|
+
echo -e "${BLUE}[INFO]${NC} $msg"
|
|
22
|
+
return 0
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
print_success() {
|
|
26
|
+
local msg="$1"
|
|
27
|
+
echo -e "${GREEN}[SUCCESS]${NC} $msg"
|
|
28
|
+
return 0
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
print_warning() {
|
|
32
|
+
local msg="$1"
|
|
33
|
+
echo -e "${YELLOW}[WARNING]${NC} $msg"
|
|
34
|
+
return 0
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
print_error() {
|
|
38
|
+
local msg="$1"
|
|
39
|
+
echo -e "${RED}[ERROR]${NC} $msg" >&2
|
|
40
|
+
return 0
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# Stagehand configuration
|
|
44
|
+
readonly STAGEHAND_CONFIG_DIR="${HOME}/.aidevops/stagehand"
|
|
45
|
+
readonly STAGEHAND_EXAMPLES_DIR="${STAGEHAND_CONFIG_DIR}/examples"
|
|
46
|
+
readonly STAGEHAND_TEMPLATES_DIR="${STAGEHAND_CONFIG_DIR}/templates"
|
|
47
|
+
|
|
48
|
+
# Create advanced example scripts
|
|
49
|
+
create_advanced_examples() {
|
|
50
|
+
print_info "Creating advanced Stagehand example scripts..."
|
|
51
|
+
|
|
52
|
+
mkdir -p "$STAGEHAND_EXAMPLES_DIR"
|
|
53
|
+
mkdir -p "$STAGEHAND_TEMPLATES_DIR"
|
|
54
|
+
|
|
55
|
+
# E-commerce automation example
|
|
56
|
+
cat > "${STAGEHAND_EXAMPLES_DIR}/ecommerce-automation.js" << 'EOF'
|
|
57
|
+
// E-commerce Automation with Stagehand
|
|
58
|
+
// Product research and price comparison
|
|
59
|
+
|
|
60
|
+
import { Stagehand } from "@browserbasehq/stagehand";
|
|
61
|
+
import { z } from "zod";
|
|
62
|
+
import fs from 'fs';
|
|
63
|
+
|
|
64
|
+
const ProductSchema = z.object({
|
|
65
|
+
name: z.string().describe("Product name"),
|
|
66
|
+
price: z.number().describe("Price in USD"),
|
|
67
|
+
rating: z.number().describe("Star rating out of 5"),
|
|
68
|
+
reviewCount: z.number().describe("Number of reviews"),
|
|
69
|
+
availability: z.string().describe("Stock status"),
|
|
70
|
+
imageUrl: z.string().optional().describe("Product image URL")
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
async function searchProducts(query, maxResults = 5) {
|
|
74
|
+
const stagehand = new Stagehand({
|
|
75
|
+
env: "LOCAL",
|
|
76
|
+
verbose: 1,
|
|
77
|
+
headless: false
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
await stagehand.init();
|
|
82
|
+
|
|
83
|
+
// Navigate to Amazon (example)
|
|
84
|
+
await stagehand.page.goto("https://amazon.com");
|
|
85
|
+
|
|
86
|
+
// Search for products
|
|
87
|
+
await stagehand.act(`search for "${query}"`);
|
|
88
|
+
|
|
89
|
+
// Wait for results to load
|
|
90
|
+
await stagehand.page.waitForTimeout(2000);
|
|
91
|
+
|
|
92
|
+
// Extract product information
|
|
93
|
+
const products = await stagehand.extract(
|
|
94
|
+
`extract the first ${maxResults} products with their details`,
|
|
95
|
+
z.array(ProductSchema)
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
// Save results to file
|
|
99
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
100
|
+
const filename = `product-search-${query.replace(/\s+/g, '-')}-${timestamp}.json`;
|
|
101
|
+
const filepath = `${process.env.HOME}/.aidevops/stagehand/results/${filename}`;
|
|
102
|
+
|
|
103
|
+
// Ensure results directory exists
|
|
104
|
+
fs.mkdirSync(`${process.env.HOME}/.aidevops/stagehand/results`, { recursive: true });
|
|
105
|
+
fs.writeFileSync(filepath, JSON.stringify(products, null, 2));
|
|
106
|
+
|
|
107
|
+
console.log(`Found ${products.length} products:`);
|
|
108
|
+
products.forEach((product, index) => {
|
|
109
|
+
console.log(`${index + 1}. ${product.name} - $${product.price} (${product.rating}⭐)`);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
console.log(`Results saved to: ${filepath}`);
|
|
113
|
+
return products;
|
|
114
|
+
|
|
115
|
+
} catch (error) {
|
|
116
|
+
console.error("Error during product search:", error);
|
|
117
|
+
throw error;
|
|
118
|
+
} finally {
|
|
119
|
+
await stagehand.close();
|
|
120
|
+
}
|
|
121
|
+
return 0
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Example usage
|
|
125
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
126
|
+
const query = process.argv[2] || "wireless headphones";
|
|
127
|
+
const maxResults = parseInt(process.argv[3]) || 5;
|
|
128
|
+
|
|
129
|
+
searchProducts(query, maxResults)
|
|
130
|
+
.then(() => console.log("Product search completed"))
|
|
131
|
+
.catch(console.error);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export { searchProducts };
|
|
135
|
+
EOF
|
|
136
|
+
|
|
137
|
+
# Social media automation example
|
|
138
|
+
cat > "${STAGEHAND_EXAMPLES_DIR}/social-media-automation.js" << 'EOF'
|
|
139
|
+
// Social Media Automation with Stagehand
|
|
140
|
+
// Ethical LinkedIn engagement automation
|
|
141
|
+
|
|
142
|
+
import { Stagehand } from "@browserbasehq/stagehand";
|
|
143
|
+
import { z } from "zod";
|
|
144
|
+
|
|
145
|
+
const PostSchema = z.object({
|
|
146
|
+
author: z.string().describe("Post author name"),
|
|
147
|
+
content: z.string().describe("Post content preview"),
|
|
148
|
+
engagement: z.object({
|
|
149
|
+
likes: z.number().describe("Number of likes"),
|
|
150
|
+
comments: z.number().describe("Number of comments"),
|
|
151
|
+
shares: z.number().describe("Number of shares")
|
|
152
|
+
}).describe("Engagement metrics"),
|
|
153
|
+
timestamp: z.string().describe("When the post was published")
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
async function analyzeLinkedInFeed(maxPosts = 10) {
|
|
157
|
+
const stagehand = new Stagehand({
|
|
158
|
+
env: "LOCAL",
|
|
159
|
+
verbose: 1,
|
|
160
|
+
headless: false
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
try {
|
|
164
|
+
await stagehand.init();
|
|
165
|
+
|
|
166
|
+
// Navigate to LinkedIn feed
|
|
167
|
+
console.log("Navigating to LinkedIn feed...");
|
|
168
|
+
await stagehand.page.goto("https://linkedin.com/feed");
|
|
169
|
+
|
|
170
|
+
// Wait for login if needed
|
|
171
|
+
const currentUrl = stagehand.page.url();
|
|
172
|
+
if (currentUrl.includes('login') || currentUrl.includes('authwall')) {
|
|
173
|
+
console.log("Please log in to LinkedIn manually, then press Enter to continue...");
|
|
174
|
+
await new Promise(resolve => {
|
|
175
|
+
process.stdin.once('data', () => resolve());
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Scroll to load more posts
|
|
180
|
+
console.log("Loading posts...");
|
|
181
|
+
for (let i = 0; i < 3; i++) {
|
|
182
|
+
await stagehand.act("scroll down to load more posts");
|
|
183
|
+
await stagehand.page.waitForTimeout(2000);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Analyze posts
|
|
187
|
+
const posts = await stagehand.extract(
|
|
188
|
+
`analyze the first ${maxPosts} posts in the feed`,
|
|
189
|
+
z.array(PostSchema)
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
console.log(`Analyzed ${posts.length} posts:`);
|
|
193
|
+
posts.forEach((post, index) => {
|
|
194
|
+
console.log(`\n${index + 1}. ${post.author}`);
|
|
195
|
+
console.log(` Content: ${post.content.substring(0, 100)}...`);
|
|
196
|
+
console.log(` Engagement: ${post.engagement.likes} likes, ${post.engagement.comments} comments`);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// Find posts about AI/technology for engagement
|
|
200
|
+
const techPosts = posts.filter(post =>
|
|
201
|
+
post.content.toLowerCase().includes('ai') ||
|
|
202
|
+
post.content.toLowerCase().includes('technology') ||
|
|
203
|
+
post.content.toLowerCase().includes('software')
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
if (techPosts.length > 0) {
|
|
207
|
+
console.log(`\nFound ${techPosts.length} tech-related posts for potential engagement`);
|
|
208
|
+
|
|
209
|
+
// Ethical engagement - like one relevant post
|
|
210
|
+
await stagehand.act("like the first post about AI or technology");
|
|
211
|
+
console.log("Engaged with one relevant post");
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return posts;
|
|
215
|
+
|
|
216
|
+
} catch (error) {
|
|
217
|
+
console.error("Error during LinkedIn analysis:", error);
|
|
218
|
+
throw error;
|
|
219
|
+
} finally {
|
|
220
|
+
await stagehand.close();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Example usage
|
|
225
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
226
|
+
const maxPosts = parseInt(process.argv[2]) || 10;
|
|
227
|
+
|
|
228
|
+
analyzeLinkedInFeed(maxPosts)
|
|
229
|
+
.then(() => console.log("LinkedIn analysis completed"))
|
|
230
|
+
.catch(console.error);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export { analyzeLinkedInFeed };
|
|
234
|
+
EOF
|
|
235
|
+
|
|
236
|
+
# Web scraping template
|
|
237
|
+
cat > "${STAGEHAND_TEMPLATES_DIR}/web-scraping-template.js" << 'EOF'
|
|
238
|
+
// Web Scraping Template with Stagehand
|
|
239
|
+
// Adaptable template for various websites
|
|
240
|
+
|
|
241
|
+
import { Stagehand } from "@browserbasehq/stagehand";
|
|
242
|
+
import { z } from "zod";
|
|
243
|
+
|
|
244
|
+
// Define your data schema here
|
|
245
|
+
const DataSchema = z.object({
|
|
246
|
+
title: z.string().describe("Page or item title"),
|
|
247
|
+
description: z.string().describe("Description or content"),
|
|
248
|
+
url: z.string().describe("Source URL"),
|
|
249
|
+
metadata: z.object({
|
|
250
|
+
author: z.string().optional(),
|
|
251
|
+
date: z.string().optional(),
|
|
252
|
+
category: z.string().optional()
|
|
253
|
+
}).optional()
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
async function scrapeWebsite(url, extractionPrompt, maxItems = 10) {
|
|
257
|
+
const stagehand = new Stagehand({
|
|
258
|
+
env: "LOCAL",
|
|
259
|
+
verbose: 1,
|
|
260
|
+
headless: true // Set to false for debugging
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
try {
|
|
264
|
+
await stagehand.init();
|
|
265
|
+
|
|
266
|
+
console.log(`Navigating to: ${url}`);
|
|
267
|
+
await stagehand.page.goto(url);
|
|
268
|
+
|
|
269
|
+
// Wait for page to load
|
|
270
|
+
await stagehand.page.waitForTimeout(3000);
|
|
271
|
+
|
|
272
|
+
// Handle cookie banners or popups
|
|
273
|
+
try {
|
|
274
|
+
await stagehand.act("close any cookie banners or popups", { timeout: 5000 });
|
|
275
|
+
} catch (error) {
|
|
276
|
+
console.log("No popups to close");
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Extract data based on the prompt
|
|
280
|
+
const data = await stagehand.extract(
|
|
281
|
+
extractionPrompt,
|
|
282
|
+
z.array(DataSchema).max(maxItems)
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
console.log(`Extracted ${data.length} items:`);
|
|
286
|
+
data.forEach((item, index) => {
|
|
287
|
+
console.log(`${index + 1}. ${item.title}`);
|
|
288
|
+
console.log(` ${item.description.substring(0, 100)}...`);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
return data;
|
|
292
|
+
|
|
293
|
+
} catch (error) {
|
|
294
|
+
console.error("Error during web scraping:", error);
|
|
295
|
+
throw error;
|
|
296
|
+
} finally {
|
|
297
|
+
await stagehand.close();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Example usage
|
|
302
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
303
|
+
const url = process.argv[2] || "https://news.ycombinator.com";
|
|
304
|
+
const prompt = process.argv[3] || "extract the top stories with titles and descriptions";
|
|
305
|
+
const maxItems = parseInt(process.argv[4]) || 10;
|
|
306
|
+
|
|
307
|
+
scrapeWebsite(url, prompt, maxItems)
|
|
308
|
+
.then(() => console.log("Web scraping completed"))
|
|
309
|
+
.catch(console.error);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export { scrapeWebsite };
|
|
313
|
+
EOF
|
|
314
|
+
|
|
315
|
+
print_success "Created advanced Stagehand examples"
|
|
316
|
+
return 0
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
# Create package.json template
|
|
320
|
+
create_package_template() {
|
|
321
|
+
local package_file="${STAGEHAND_TEMPLATES_DIR}/package.json"
|
|
322
|
+
|
|
323
|
+
cat > "$package_file" << 'EOF'
|
|
324
|
+
{
|
|
325
|
+
"name": "stagehand-automation-project",
|
|
326
|
+
"version": "1.0.0",
|
|
327
|
+
"description": "AI-powered browser automation with Stagehand",
|
|
328
|
+
"type": "module",
|
|
329
|
+
"main": "index.js",
|
|
330
|
+
"scripts": {
|
|
331
|
+
"start": "node index.js",
|
|
332
|
+
"search-products": "node examples/ecommerce-automation.js",
|
|
333
|
+
"analyze-linkedin": "node examples/social-media-automation.js",
|
|
334
|
+
"scrape-website": "node templates/web-scraping-template.js",
|
|
335
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
336
|
+
},
|
|
337
|
+
"dependencies": {
|
|
338
|
+
"@browserbasehq/stagehand": "^3.0.0",
|
|
339
|
+
"zod": "^3.22.0",
|
|
340
|
+
"dotenv": "^16.3.0"
|
|
341
|
+
},
|
|
342
|
+
"devDependencies": {
|
|
343
|
+
"@types/node": "^20.0.0"
|
|
344
|
+
},
|
|
345
|
+
"keywords": [
|
|
346
|
+
"browser-automation",
|
|
347
|
+
"ai",
|
|
348
|
+
"web-scraping",
|
|
349
|
+
"stagehand"
|
|
350
|
+
],
|
|
351
|
+
"author": "AI DevOps Framework",
|
|
352
|
+
"license": "MIT"
|
|
353
|
+
return 0
|
|
354
|
+
}
|
|
355
|
+
EOF
|
|
356
|
+
|
|
357
|
+
print_success "Created package.json template"
|
|
358
|
+
return 0
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
# Setup MCP integration for Stagehand
|
|
362
|
+
setup_mcp_integration() {
|
|
363
|
+
print_info "Setting up Stagehand MCP integration..."
|
|
364
|
+
|
|
365
|
+
# Create MCP configuration for Stagehand
|
|
366
|
+
local mcp_config="${HOME}/.aidevops/mcp/stagehand-config.json"
|
|
367
|
+
mkdir -p "$(dirname "$mcp_config")"
|
|
368
|
+
|
|
369
|
+
cat > "$mcp_config" << 'EOF'
|
|
370
|
+
{
|
|
371
|
+
"mcpServers": {
|
|
372
|
+
"stagehand": {
|
|
373
|
+
"command": "node",
|
|
374
|
+
"args": [
|
|
375
|
+
"-e",
|
|
376
|
+
"const { Stagehand } = require('@browserbasehq/stagehand'); console.log('Stagehand MCP Server Ready');"
|
|
377
|
+
],
|
|
378
|
+
"env": {
|
|
379
|
+
"STAGEHAND_ENV": "LOCAL",
|
|
380
|
+
"STAGEHAND_VERBOSE": "1"
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return 0
|
|
385
|
+
}
|
|
386
|
+
EOF
|
|
387
|
+
|
|
388
|
+
print_success "Created Stagehand MCP configuration"
|
|
389
|
+
return 0
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
# Main setup function
|
|
393
|
+
main() {
|
|
394
|
+
local command="${1:-setup}"
|
|
395
|
+
|
|
396
|
+
case "$command" in
|
|
397
|
+
"setup")
|
|
398
|
+
print_info "Setting up Stagehand advanced configuration..."
|
|
399
|
+
create_advanced_examples
|
|
400
|
+
create_package_template
|
|
401
|
+
setup_mcp_integration
|
|
402
|
+
print_success "Stagehand advanced setup completed!"
|
|
403
|
+
print_info "Next steps:"
|
|
404
|
+
print_info "1. Run: bash .agent/scripts/stagehand-helper.sh install"
|
|
405
|
+
print_info "2. Configure API keys in ~/.aidevops/stagehand/.env"
|
|
406
|
+
print_info "3. Try examples: cd ~/.aidevops/stagehand && npm run search-products" || exit
|
|
407
|
+
;;
|
|
408
|
+
"examples")
|
|
409
|
+
create_advanced_examples
|
|
410
|
+
;;
|
|
411
|
+
"mcp")
|
|
412
|
+
setup_mcp_integration
|
|
413
|
+
;;
|
|
414
|
+
"help")
|
|
415
|
+
cat << EOF
|
|
416
|
+
Stagehand Setup Script
|
|
417
|
+
|
|
418
|
+
USAGE:
|
|
419
|
+
$0 [COMMAND]
|
|
420
|
+
|
|
421
|
+
COMMANDS:
|
|
422
|
+
setup Complete advanced setup (default)
|
|
423
|
+
examples Create example scripts only
|
|
424
|
+
mcp Setup MCP integration only
|
|
425
|
+
help Show this help
|
|
426
|
+
|
|
427
|
+
EOF
|
|
428
|
+
;;
|
|
429
|
+
*)
|
|
430
|
+
print_error "$ERROR_UNKNOWN_COMMAND $command"
|
|
431
|
+
return 1
|
|
432
|
+
;;
|
|
433
|
+
esac
|
|
434
|
+
|
|
435
|
+
return 0
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
# Execute main function
|
|
439
|
+
main "$@"
|