forge-workflow 1.0.0

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.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: parallel-ai
3
+ description: Tool for web search, data extraction, and research using Parallel AI APIs. Use when you need to search the web, extract data from URLs, enrich company data, or analyze markets. Provides direct API access to Search, Extract, Task, and Deep Research without SDK.
4
+ ---
5
+
6
+ # Parallel AI Research Tool
7
+
8
+ **4 APIs for research**: Search (web), Extract (URLs), Task (structured data), Deep Research (analysis)
9
+
10
+ ## Setup
11
+
12
+ API Key: https://platform.parallel.ai
13
+ Store in: `.env.local` as `PARALLEL_API_KEY=your-key`
14
+
15
+ **Load API key (Windows/Git Bash compatible)**:
16
+ ```bash
17
+ API_KEY=$(grep "^PARALLEL_API_KEY=" .env.local | cut -d= -f2)
18
+ ```
19
+
20
+ **Usage in curl**:
21
+ ```bash
22
+ curl -s -X POST "https://api.parallel.ai/v1beta/search" \
23
+ -H "x-api-key: $API_KEY" \
24
+ -H "Content-Type: application/json" \
25
+ -H "parallel-beta: search-extract-2025-10-10" \
26
+ -d '{"objective": "your query"}'
27
+ ```
28
+
29
+ ## The 4 APIs at a Glance
30
+
31
+ | API | Purpose | Speed | Cost | Use For |
32
+ |-----|---------|-------|------|---------|
33
+ | Search | Web search + excerpts | 5-60s | $0.01 | Quick lookups |
34
+ | Extract | Scrape specific URLs | 5-30s | $0.01 | Pricing, data |
35
+ | Task | Structured enrichment | 1-25m | $0.01-0.30 | Companies, data |
36
+ | Deep Research | Multi-source analysis | 5-25m | $0.10-0.30 | Markets, reports |
37
+
38
+ ## Processors (Pick One)
39
+
40
+ | Processor | Speed | Cost/1K | When |
41
+ |-----------|-------|---------|------|
42
+ | lite | 5-60s | $5 | Simple Q&A |
43
+ | base | 15-100s | $10 | Quick data |
44
+ | core | 1-5m | $25 | Detailed |
45
+ | pro | 3-9m | $100 | Analysis |
46
+ | ultra | 5-25m | $300 | Deep |
47
+
48
+ ## Endpoint URLs
49
+
50
+ ```
51
+ POST https://api.parallel.ai/v1beta/search (web search)
52
+ POST https://api.parallel.ai/v1beta/extract (URL scraping)
53
+ POST https://api.parallel.ai/v1beta/tasks/runs (research tasks)
54
+ GET https://api.parallel.ai/v1beta/tasks/runs/{id} (check status)
55
+ ```
56
+
57
+ ## Required Headers (All Requests)
58
+
59
+ ```
60
+ x-api-key: your-api-key
61
+ Content-Type: application/json
62
+ parallel-beta: search-extract-2025-10-10 (only Search/Extract)
63
+ ```
64
+
65
+ ## Minimal Examples
66
+
67
+ **Search**: `{"objective": "your question"}`
68
+
69
+ **Extract**: `{"url": "https://...", "objective": "what to extract"}`
70
+
71
+ **Task**: `{"input": "company name", "processor": "core"}`
72
+
73
+ **Task Status**: `GET /v1beta/tasks/runs/{task_id}`
74
+
75
+ ## Task Polling Loop
76
+
77
+ ```
78
+ Create task → get id
79
+ Poll every 2-5s: GET /v1beta/tasks/runs/{id}
80
+ Status: "running" → keep polling
81
+ Status: "completed" → use result
82
+ Status: "failed" → check error
83
+ ```
84
+
85
+ ## Limits & Errors
86
+
87
+ - Rate limit: 2,000 req/min → HTTP 429 (wait, retry)
88
+ - Invalid key: HTTP 401
89
+ - Bad request: HTTP 400 (check parameters)
90
+ - Server error: HTTP 500/503 (retry)
91
+
92
+ See `api-reference.md` for complete endpoint docs
93
+ See `quick-reference.md` for troubleshooting
94
+ See `research-workflows.md` for real examples
@@ -0,0 +1,141 @@
1
+ # API Reference - Minimal
2
+
3
+ ## Search API
4
+ `POST https://api.parallel.ai/v1beta/search`
5
+
6
+ **Minimal request**:
7
+ ```json
8
+ {"objective": "Find Bitcoin price"}
9
+ ```
10
+
11
+ **Full request**:
12
+ ```json
13
+ {
14
+ "objective": "Find current Bitcoin price",
15
+ "search_queries": ["BTC price today"],
16
+ "max_results": 5,
17
+ "mode": "agentic",
18
+ "source_policy": {"include_domains": ["bloomberg.com", "reuters.com"]}
19
+ }
20
+ ```
21
+
22
+ **Response**:
23
+ ```json
24
+ {
25
+ "results": [
26
+ {"title": "...", "url": "...", "excerpt": "...", "relevance_score": 0.95}
27
+ ]
28
+ }
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Extract API
34
+ `POST https://api.parallel.ai/v1beta/extract`
35
+
36
+ **Request**:
37
+ ```json
38
+ {
39
+ "url": "https://example.com/pricing",
40
+ "objective": "Extract all pricing plans"
41
+ }
42
+ ```
43
+
44
+ **Response**: Extracted JSON/text data
45
+
46
+ ---
47
+
48
+ ## Task API - Create
49
+ `POST https://api.parallel.ai/v1beta/tasks/runs`
50
+
51
+ **Minimal request**:
52
+ ```json
53
+ {
54
+ "input": "OpenAI",
55
+ "processor": "core"
56
+ }
57
+ ```
58
+
59
+ **With schema**:
60
+ ```json
61
+ {
62
+ "input": "OpenAI",
63
+ "processor": "core",
64
+ "output_schema": {
65
+ "type": "object",
66
+ "properties": {
67
+ "name": {"type": "string"},
68
+ "founded": {"type": "integer"},
69
+ "employees": {"type": "integer"}
70
+ }
71
+ }
72
+ }
73
+ ```
74
+
75
+ **Response**:
76
+ ```json
77
+ {
78
+ "id": "task_abc123",
79
+ "status": "queued"
80
+ }
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Task API - Get Status
86
+ `GET https://api.parallel.ai/v1beta/tasks/runs/{task_id}`
87
+
88
+ **Response**:
89
+ ```json
90
+ {
91
+ "id": "task_abc123",
92
+ "status": "completed",
93
+ "result": {
94
+ "content": {"name": "OpenAI", "founded": 2015},
95
+ "basis": {"citations": [{"url": "...", "excerpt": "..."}]}
96
+ }
97
+ }
98
+ ```
99
+
100
+ **Status values**: `queued`, `running`, `completed`, `failed`
101
+
102
+ ---
103
+
104
+ ## Deep Research
105
+ `POST https://api.parallel.ai/v1beta/tasks/runs` + use processor `pro` or `ultra`
106
+
107
+ **Request**:
108
+ ```json
109
+ {
110
+ "input": "Analyze the AI chip market in 2024",
111
+ "processor": "pro",
112
+ "output_schema": "text"
113
+ }
114
+ ```
115
+
116
+ **Response**: Markdown report with citations
117
+
118
+ ---
119
+
120
+ ## Error Responses
121
+
122
+ | Code | Meaning | Fix |
123
+ |------|---------|-----|
124
+ | 401 | Bad key | Check PARALLEL_API_KEY |
125
+ | 400 | Bad request | Validate JSON |
126
+ | 429 | Rate limit | Wait 60s |
127
+ | 500 | Server error | Retry later |
128
+
129
+ ---
130
+
131
+ ## Source Filtering
132
+
133
+ Include only:
134
+ ```json
135
+ {"source_policy": {"include_domains": ["arxiv.org", "nature.com"]}}
136
+ ```
137
+
138
+ Exclude:
139
+ ```json
140
+ {"source_policy": {"exclude_domains": ["reddit.com", "twitter.com"]}}
141
+ ```
@@ -0,0 +1,100 @@
1
+ # Quick Reference
2
+
3
+ ## Endpoints
4
+
5
+ | Action | URL | Method |
6
+ |--------|-----|--------|
7
+ | Search | `https://api.parallel.ai/v1beta/search` | POST |
8
+ | Extract | `https://api.parallel.ai/v1beta/extract` | POST |
9
+ | Create task | `https://api.parallel.ai/v1beta/tasks/runs` | POST |
10
+ | Check status | `https://api.parallel.ai/v1beta/tasks/runs/{id}` | GET |
11
+
12
+ ## Headers (All Requests)
13
+
14
+ ```
15
+ x-api-key: $API_KEY
16
+ Content-Type: application/json
17
+ parallel-beta: search-extract-2025-10-10 (Search/Extract only)
18
+ ```
19
+
20
+ **Load API key first (Windows compatible)**:
21
+ ```bash
22
+ API_KEY=$(grep "^PARALLEL_API_KEY=" .env.local | cut -d= -f2)
23
+ ```
24
+
25
+ ## Processors
26
+
27
+ | Processor | Speed | Cost/1K |
28
+ |-----------|-------|---------|
29
+ | lite | 5-60s | $5 |
30
+ | base | 15-100s | $10 |
31
+ | core | 1-5m | $25 |
32
+ | pro | 3-9m | $100 |
33
+ | ultra | 5-25m | $300 |
34
+
35
+ ## Task Polling Loop
36
+
37
+ ```
38
+ 1. POST /v1beta/tasks/runs → get {id}
39
+ 2. Loop: GET /v1beta/tasks/runs/{id}
40
+ 3. If status="running" → wait 2-5s → repeat
41
+ 4. If status="completed" → use result.content
42
+ 5. If status="failed" → check error
43
+ ```
44
+
45
+ ## Troubleshooting
46
+
47
+ **"401 Unauthorized"**
48
+ - Check API key: `echo $PARALLEL_API_KEY`
49
+ - Regenerate at: https://platform.parallel.ai
50
+
51
+ **"429 Too Many Requests"**
52
+ - Hit rate limit (2,000/min)
53
+ - Wait 60s, retry with backoff
54
+ - Backoff: 2^attempt seconds (max 30s)
55
+
56
+ **"Empty search results"**
57
+ - Broaden objective
58
+ - Remove source_policy filters
59
+ - Try different keywords
60
+
61
+ **Task stuck in "running"**
62
+ - Normal for complex tasks (1-25m)
63
+ - Set timeout to 1800 (30 min)
64
+ - Use polling loop, don't give up
65
+
66
+ **"Output doesn't match schema"**
67
+ - Simplify schema
68
+ - Add clearer descriptions
69
+ - Don't specify exact field names
70
+
71
+ ## Cost Calculator
72
+
73
+ Formula: `(tasks × cost_per_1k) ÷ 1000`
74
+
75
+ Examples:
76
+ - 100 lite tasks: (100 × 5) ÷ 1000 = **$0.50**
77
+ - 50 core tasks: (50 × 25) ÷ 1000 = **$1.25**
78
+ - 10 pro tasks: (10 × 100) ÷ 1000 = **$1.00**
79
+
80
+ ## When to Use Each API
81
+
82
+ **Search** (fast, $0.01): Quick lookups, find sources
83
+
84
+ **Extract** (fast, $0.01): Scrape known URLs, get pricing
85
+
86
+ **Task** ($0.01-0.30): Enrichment, verification, structured data
87
+
88
+ **Deep Research** ($0.10-0.30, slow): Analysis, reports, market research
89
+
90
+ ## Rate Limits
91
+
92
+ - Task API: 2,000 req/min
93
+ - Returns 429 when exceeded
94
+ - Implement exponential backoff
95
+
96
+ ## Links
97
+
98
+ - Docs: https://docs.parallel.ai
99
+ - API Key: https://platform.parallel.ai
100
+ - Status: https://status.parallel.ai
@@ -0,0 +1,77 @@
1
+ # Key Research Workflows
2
+
3
+ ## 1. Quick Fact Lookup (30 seconds, $0.01)
4
+
5
+ Find information quickly.
6
+
7
+ **Request**:
8
+ ```json
9
+ {
10
+ "objective": "What is the current Bitcoin price?",
11
+ "max_results": 3,
12
+ "mode": "agentic"
13
+ }
14
+ ```
15
+
16
+ **Use**: Stock prices, quick questions, news, facts
17
+
18
+ ---
19
+
20
+ ## 2. Company Research (5 minutes, $0.025)
21
+
22
+ Get structured company information.
23
+
24
+ **Create task**:
25
+ ```json
26
+ {
27
+ "input": "OpenAI",
28
+ "processor": "core",
29
+ "output_schema": {
30
+ "type": "object",
31
+ "properties": {
32
+ "name": {"type": "string"},
33
+ "founded_year": {"type": "integer"},
34
+ "headquarters": {"type": "string"},
35
+ "employee_count": {"type": "integer"},
36
+ "key_products": {"type": "array", "items": {"type": "string"}}
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ **Poll**: `GET /task/{task_id}` until status="completed"
43
+
44
+ **Use**: Company enrichment, lead qualification, research
45
+
46
+ ---
47
+
48
+ ## 3. Market Analysis Report (10 minutes, $0.10)
49
+
50
+ Comprehensive market intelligence.
51
+
52
+ **Create task**:
53
+ ```json
54
+ {
55
+ "input": "Analyze the AI chatbot market. Include: size, growth, key players, trends, competitive threats",
56
+ "processor": "pro",
57
+ "output_schema": "text"
58
+ }
59
+ ```
60
+
61
+ **Poll**: `GET /task/{task_id}` until status="completed"
62
+
63
+ **Result**: Markdown report with citations
64
+
65
+ **Use**: Strategic analysis, market research, reports
66
+
67
+ ---
68
+
69
+ ## Cost & Processor Guide
70
+
71
+ | Task | Processor | Speed | Cost |
72
+ |------|-----------|-------|------|
73
+ | Simple Q&A | lite | 5-60s | $0.005 |
74
+ | Quick data | base | 15-100s | $0.01 |
75
+ | Enrichment | core | 1-5m | $0.025 |
76
+ | Analysis | pro | 3-9m | $0.10 |
77
+ | Deep analysis | ultra | 5-25m | $0.30 |
@@ -0,0 +1,154 @@
1
+ ---
2
+ name: sonarcloud
3
+ description: Pull issues, metrics, quality gates, and analysis data from SonarCloud. Use when checking code quality, security vulnerabilities, test coverage, technical debt, or CI/CD quality gates.
4
+ category: Code Quality
5
+ tags: [sonarcloud, code-quality, issues, metrics, security]
6
+ context: fork
7
+ tools: [Bash, WebFetch, Read, Grep, Glob]
8
+ model: sonnet
9
+ ---
10
+
11
+ <role>
12
+ You are a SonarCloud code quality analyst with expertise in static analysis, security vulnerability assessment, and technical debt management. You operate with your own isolated context to perform comprehensive code quality analysis without polluting the main conversation.
13
+ </role>
14
+
15
+ <capabilities>
16
+ - Query SonarCloud API for issues, metrics, and quality gates
17
+ - Analyze code quality across branches and pull requests
18
+ - Identify security vulnerabilities and hotspots
19
+ - Track coverage, duplication, and technical debt
20
+ - Generate health reports and trend analysis
21
+ - Correlate SonarCloud findings with local codebase
22
+ </capabilities>
23
+
24
+ <constraints>
25
+ - Always use environment variables: $SONARCLOUD_TOKEN, $SONARCLOUD_ORG, $SONARCLOUD_PROJECT
26
+ - Never expose tokens in output
27
+ - Validate API responses before processing
28
+ - Handle pagination for large result sets
29
+ </constraints>
30
+
31
+ <workflow>
32
+ 1. Verify credentials are available
33
+ 2. Determine the analysis scope (project, branch, PR)
34
+ 3. Query relevant endpoints
35
+ 4. Process and correlate results
36
+ 5. Return actionable summary to main context
37
+ </workflow>
38
+
39
+ # SonarCloud Integration
40
+
41
+ **Base**: `https://sonarcloud.io/api` | **Auth**: `Bearer $SONARCLOUD_TOKEN`
42
+
43
+ ## Quick Start
44
+
45
+ ```bash
46
+ # Set credentials (generate token at sonarcloud.io/account/security)
47
+ export SONARCLOUD_TOKEN="your_token"
48
+ export SONARCLOUD_ORG="your-org"
49
+ export SONARCLOUD_PROJECT="your-project"
50
+
51
+ # Common queries
52
+ curl -H "Authorization: Bearer $TOKEN" \
53
+ "https://sonarcloud.io/api/issues/search?organization=$ORG&componentKeys=$PROJECT&resolved=false"
54
+ curl -H "Authorization: Bearer $TOKEN" \
55
+ "https://sonarcloud.io/api/measures/component?component=$PROJECT&metricKeys=bugs,coverage"
56
+ curl -H "Authorization: Bearer $TOKEN" \
57
+ "https://sonarcloud.io/api/qualitygates/project_status?projectKey=$PROJECT"
58
+ ```
59
+
60
+ ## Endpoints
61
+
62
+ | Endpoint | Purpose | Key Params |
63
+ | ------------------------------- | ------------------------ | ---------------------------------------- |
64
+ | `/api/issues/search` | Bugs, vulnerabilities | `types`, `severities`, `branch`, `pullRequest` |
65
+ | `/api/measures/component` | Coverage, complexity | `metricKeys`, `branch`, `pullRequest` |
66
+ | `/api/qualitygates/project_status` | Pass/fail status | `projectKey`, `branch`, `pullRequest` |
67
+ | `/api/hotspots/search` | Security hotspots | `projectKey`, `status` |
68
+ | `/api/projects/search` | List projects | `organization`, `q` |
69
+ | `/api/project_analyses/search` | Analysis history | `project`, `from`, `to` |
70
+ | `/api/measures/search_history` | Metrics over time | `component`, `metrics`, `from` |
71
+ | `/api/components/tree` | Files with metrics | `qualifiers=FIL`, `metricKeys` |
72
+ | `/api/duplications/show` | Duplicate code blocks | `key` (file key), `branch` |
73
+ | `/api/sources/raw` | Raw source code | `key` (file key), `branch` |
74
+ | `/api/sources/scm` | SCM blame info | `key`, `from`, `to` |
75
+ | `/api/ce/activity` | Background tasks | `component`, `status`, `type` |
76
+ | `/api/qualityprofiles/search` | Quality profiles | `language`, `project` |
77
+ | `/api/languages/list` | Supported languages | - |
78
+ | `/api/project_branches/list` | Project branches | `project` |
79
+ | `/api/project_badges/measure` | SVG badge | `project`, `metric`, `branch` |
80
+ | `/api/rules/search` | Coding rules | `languages`, `severities`, `types` |
81
+
82
+ ## Common Filters
83
+
84
+ **Issues**: `types=BUG,VULNERABILITY,CODE_SMELL` | `severities=BLOCKER,CRITICAL,MAJOR` | `resolved=false` | `inNewCodePeriod=true`
85
+
86
+ **Metrics**: `bugs,vulnerabilities,code_smells,coverage,duplicated_lines_density,sqale_rating,reliability_rating,security_rating`
87
+
88
+ **New Code**: `new_bugs,new_vulnerabilities,new_coverage,new_duplicated_lines_density`
89
+
90
+ ## Workflows
91
+
92
+ ### Health Check
93
+
94
+ ```bash
95
+ curl ... "/api/qualitygates/project_status?projectKey=$PROJECT"
96
+ curl ... "/api/measures/component?component=$PROJECT&metricKeys=bugs,vulnerabilities,coverage,sqale_rating"
97
+ curl ... "/api/issues/search?organization=$ORG&componentKeys=$PROJECT&resolved=false&facets=severities,types&ps=1"
98
+ ```
99
+
100
+ ### PR Analysis
101
+
102
+ ```bash
103
+ curl ... "/api/qualitygates/project_status?projectKey=$PROJECT&pullRequest=123"
104
+ curl ... "/api/issues/search?organization=$ORG&componentKeys=$PROJECT&pullRequest=123&resolved=false"
105
+ curl ... "/api/measures/component?component=$PROJECT&pullRequest=123&metricKeys=new_bugs,new_coverage"
106
+ ```
107
+
108
+ ### Security Audit
109
+
110
+ ```bash
111
+ curl ... "/api/issues/search?organization=$ORG&componentKeys=$PROJECT&types=VULNERABILITY&resolved=false"
112
+ curl ... "/api/hotspots/search?projectKey=$PROJECT&status=TO_REVIEW"
113
+ ```
114
+
115
+ ### Duplication Analysis
116
+
117
+ ```bash
118
+ # Get duplication metrics
119
+ curl ... "/api/measures/component?component=$PROJECT&metricKeys=duplicated_lines,duplicated_lines_density,duplicated_blocks,duplicated_files"
120
+
121
+ # Get files with most duplication
122
+ curl ... "/api/components/tree?component=$PROJECT&qualifiers=FIL&metricKeys=duplicated_lines_density&s=metric&metricSort=duplicated_lines_density&asc=false&ps=20"
123
+
124
+ # Get duplicate blocks for a specific file (requires file key from above)
125
+ curl ... "/api/duplications/show?key=my-project:src/utils/helpers.ts"
126
+ ```
127
+
128
+ ## Response Processing
129
+
130
+ ```bash
131
+ # Count by severity
132
+ curl ... | jq '.issues | group_by(.severity) | map({severity: .[0].severity, count: length})'
133
+
134
+ # Failed quality gate conditions
135
+ curl ... | jq '.projectStatus.conditions | map(select(.status == "ERROR"))'
136
+
137
+ # Metrics as key-value
138
+ curl ... | jq '.component.measures | map({(.metric): .value}) | add'
139
+ ```
140
+
141
+ ## TypeScript Client
142
+
143
+ See [sonarcloud.ts](../../../next-app/src/lib/integrations/sonarcloud.ts):
144
+
145
+ ```typescript
146
+ import { createSonarCloudClient } from '@/lib/integrations/sonarcloud';
147
+ const client = createSonarCloudClient('my-org');
148
+ await client.getProjectHealth('my-project');
149
+ await client.getQualityGateStatus('my-project', { pullRequest: '123' });
150
+ ```
151
+
152
+ ## Detailed Reference
153
+
154
+ For complete API parameters and response schemas, see [reference.md](reference.md).