oh-pi 0.1.31 → 0.1.32
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/package.json +1 -1
- package/pi-package/skills/context7/SKILL.md +34 -0
- package/pi-package/skills/context7/docs.js +13 -0
- package/pi-package/skills/context7/search.js +13 -0
- package/pi-package/skills/web-fetch/SKILL.md +24 -0
- package/pi-package/skills/web-fetch/fetch.js +28 -0
- package/pi-package/skills/web-search/SKILL.md +18 -0
- package/pi-package/skills/web-search/search.js +29 -0
package/package.json
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context7
|
|
3
|
+
description: Search and query up-to-date documentation for any programming library via Context7 API. Use when you need current docs, code examples, or API references for libraries and frameworks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context7
|
|
7
|
+
|
|
8
|
+
Search for libraries and query their documentation via the Context7 API.
|
|
9
|
+
|
|
10
|
+
## Search Libraries
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
{baseDir}/search.js "library name" "what you need help with"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Example:
|
|
17
|
+
```bash
|
|
18
|
+
{baseDir}/search.js "react" "hooks for state management"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Returns matching libraries with Context7-compatible IDs for use with the docs tool.
|
|
22
|
+
|
|
23
|
+
## Query Documentation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
{baseDir}/docs.js "/org/project" "your question"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Example:
|
|
30
|
+
```bash
|
|
31
|
+
{baseDir}/docs.js "/websites/react_dev" "useEffect cleanup"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use the library ID from search results. Returns relevant documentation and code examples.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const [libraryId, query] = process.argv.slice(2);
|
|
4
|
+
if (!libraryId || !query) { console.error("Usage: docs.js <libraryId> <query>"); process.exit(1); }
|
|
5
|
+
|
|
6
|
+
const res = await fetch("https://mcp.context7.com/mcp", {
|
|
7
|
+
method: "POST",
|
|
8
|
+
headers: { "Content-Type": "application/json", "Accept": "application/json, text/event-stream" },
|
|
9
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/call", params: { name: "query-docs", arguments: { libraryId, query } } })
|
|
10
|
+
});
|
|
11
|
+
const data = await res.json();
|
|
12
|
+
if (data.error) { console.error("Error:", data.error.message); process.exit(1); }
|
|
13
|
+
console.log(data.result.content[0].text);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const [libraryName, query = libraryName] = process.argv.slice(2);
|
|
4
|
+
if (!libraryName) { console.error("Usage: search.js <libraryName> [query]"); process.exit(1); }
|
|
5
|
+
|
|
6
|
+
const res = await fetch("https://mcp.context7.com/mcp", {
|
|
7
|
+
method: "POST",
|
|
8
|
+
headers: { "Content-Type": "application/json", "Accept": "application/json, text/event-stream" },
|
|
9
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/call", params: { name: "resolve-library-id", arguments: { query, libraryName } } })
|
|
10
|
+
});
|
|
11
|
+
const data = await res.json();
|
|
12
|
+
if (data.error) { console.error("Error:", data.error.message); process.exit(1); }
|
|
13
|
+
console.log(data.result.content[0].text);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: web-fetch
|
|
3
|
+
description: Fetch a web page and extract readable text content. Use when user needs to retrieve or read a web page.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# web-fetch
|
|
7
|
+
|
|
8
|
+
Fetch a web page and extract readable text content.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
{baseDir}/fetch.js <url> [--raw]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- `<url>` — URL to fetch
|
|
17
|
+
- `--raw` — Output raw HTML instead of extracted text
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
{baseDir}/fetch.js https://example.com
|
|
23
|
+
{baseDir}/fetch.js https://example.com --raw
|
|
24
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
const raw = args.includes('--raw');
|
|
7
|
+
const url = args.find(a => !a.startsWith('--'));
|
|
8
|
+
|
|
9
|
+
if (!url) { console.error('Usage: fetch.js <url> [--raw]'); process.exit(1); }
|
|
10
|
+
|
|
11
|
+
const res = await fetch(url);
|
|
12
|
+
const html = await res.text();
|
|
13
|
+
|
|
14
|
+
if (raw) { console.log(html); } else {
|
|
15
|
+
const text = html
|
|
16
|
+
.replace(/<script[\s\S]*?<\/script>/gi, '')
|
|
17
|
+
.replace(/<style[\s\S]*?<\/style>/gi, '')
|
|
18
|
+
.replace(/<[^>]+>/g, ' ')
|
|
19
|
+
.replace(/ /g, ' ')
|
|
20
|
+
.replace(/&/g, '&')
|
|
21
|
+
.replace(/</g, '<')
|
|
22
|
+
.replace(/>/g, '>')
|
|
23
|
+
.replace(/&#(\d+);/g, (_, n) => String.fromCharCode(n))
|
|
24
|
+
.replace(/[ \t]+/g, ' ')
|
|
25
|
+
.replace(/\n\s*\n/g, '\n')
|
|
26
|
+
.trim();
|
|
27
|
+
console.log(text);
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: web-search
|
|
3
|
+
description: Web search via DuckDuckGo. Use when the user needs to look up current information online.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# web-search
|
|
7
|
+
|
|
8
|
+
Web search via DuckDuckGo. Use when the user needs to look up current information online.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
{baseDir}/search.js "query terms"
|
|
14
|
+
{baseDir}/search.js -n 10 "query terms"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- `-n <count>` — number of results to return (default: 5)
|
|
18
|
+
- Returns title, URL, and snippet for each result.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const args = process.argv.slice(2);
|
|
4
|
+
let n = 5, query;
|
|
5
|
+
|
|
6
|
+
for (let i = 0; i < args.length; i++) {
|
|
7
|
+
if (args[i] === '-n' && args[i + 1]) { n = parseInt(args[++i], 10); }
|
|
8
|
+
else { query = args[i]; }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (!query) { console.error('Usage: search.js [-n count] "query"'); process.exit(1); }
|
|
12
|
+
|
|
13
|
+
const res = await fetch(`https://html.duckduckgo.com/html/?q=${encodeURIComponent(query)}`, {
|
|
14
|
+
headers: { 'User-Agent': 'Mozilla/5.0' }
|
|
15
|
+
});
|
|
16
|
+
const html = await res.text();
|
|
17
|
+
|
|
18
|
+
const results = [];
|
|
19
|
+
const blockRe = /<a rel="nofollow" class="result__a" href="([^"]*)"[^>]*>([\s\S]*?)<\/a>[\s\S]*?<a class="result__snippet"[^>]*>([\s\S]*?)<\/a>/g;
|
|
20
|
+
let m;
|
|
21
|
+
while ((m = blockRe.exec(html)) && results.length < n) {
|
|
22
|
+
const url = decodeURIComponent(m[1].replace(/^\/\/duckduckgo\.com\/l\/\?uddg=/, '').replace(/&rut=.*$/, '').replace(/&rut=.*$/, ''));
|
|
23
|
+
const title = m[2].replace(/<[^>]*>/g, '').trim();
|
|
24
|
+
const snippet = m[3].replace(/<[^>]*>/g, '').trim();
|
|
25
|
+
results.push({ title, url, snippet });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!results.length) { console.log('No results found.'); }
|
|
29
|
+
else { results.forEach((r, i) => console.log(`${i + 1}. ${r.title}\n ${r.url}\n ${r.snippet}\n`)); }
|