gigaclaw 1.4.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.
- package/LICENSE +26 -0
- package/README.md +237 -0
- package/api/CLAUDE.md +19 -0
- package/api/index.js +265 -0
- package/bin/cli.js +823 -0
- package/bin/local.sh +85 -0
- package/bin/postinstall.js +63 -0
- package/config/index.js +26 -0
- package/config/instrumentation.js +62 -0
- package/drizzle/0000_initial.sql +52 -0
- package/drizzle/0001_nostalgic_sersi.sql +11 -0
- package/drizzle/0002_black_daimon_hellstrom.sql +19 -0
- package/drizzle/0003_rename_code_workspaces.sql +5 -0
- package/drizzle/meta/0000_snapshot.json +321 -0
- package/drizzle/meta/0001_snapshot.json +390 -0
- package/drizzle/meta/0002_snapshot.json +411 -0
- package/drizzle/meta/0003_snapshot.json +419 -0
- package/drizzle/meta/_journal.json +34 -0
- package/lib/actions.js +44 -0
- package/lib/ai/agent.js +86 -0
- package/lib/ai/index.js +342 -0
- package/lib/ai/model.js +180 -0
- package/lib/ai/tools.js +269 -0
- package/lib/ai/web-search.js +42 -0
- package/lib/auth/actions.js +28 -0
- package/lib/auth/config.js +27 -0
- package/lib/auth/edge-config.js +27 -0
- package/lib/auth/index.js +27 -0
- package/lib/auth/middleware.js +62 -0
- package/lib/channels/base.js +56 -0
- package/lib/channels/index.js +15 -0
- package/lib/channels/telegram.js +148 -0
- package/lib/chat/actions.js +579 -0
- package/lib/chat/api.js +140 -0
- package/lib/chat/components/app-sidebar.js +213 -0
- package/lib/chat/components/app-sidebar.jsx +279 -0
- package/lib/chat/components/chat-header.js +192 -0
- package/lib/chat/components/chat-header.jsx +223 -0
- package/lib/chat/components/chat-input.js +236 -0
- package/lib/chat/components/chat-input.jsx +249 -0
- package/lib/chat/components/chat-nav-context.js +11 -0
- package/lib/chat/components/chat-nav-context.jsx +11 -0
- package/lib/chat/components/chat-page.js +99 -0
- package/lib/chat/components/chat-page.jsx +121 -0
- package/lib/chat/components/chat.js +153 -0
- package/lib/chat/components/chat.jsx +199 -0
- package/lib/chat/components/chats-page.js +367 -0
- package/lib/chat/components/chats-page.jsx +394 -0
- package/lib/chat/components/code-mode-toggle.js +132 -0
- package/lib/chat/components/code-mode-toggle.jsx +163 -0
- package/lib/chat/components/crons-page.js +172 -0
- package/lib/chat/components/crons-page.jsx +244 -0
- package/lib/chat/components/greeting.js +11 -0
- package/lib/chat/components/greeting.jsx +16 -0
- package/lib/chat/components/icons.js +805 -0
- package/lib/chat/components/icons.jsx +751 -0
- package/lib/chat/components/index.js +20 -0
- package/lib/chat/components/message.js +363 -0
- package/lib/chat/components/message.jsx +422 -0
- package/lib/chat/components/messages.js +65 -0
- package/lib/chat/components/messages.jsx +74 -0
- package/lib/chat/components/notifications-page.js +56 -0
- package/lib/chat/components/notifications-page.jsx +87 -0
- package/lib/chat/components/page-layout.js +21 -0
- package/lib/chat/components/page-layout.jsx +28 -0
- package/lib/chat/components/pull-requests-page.js +103 -0
- package/lib/chat/components/pull-requests-page.jsx +113 -0
- package/lib/chat/components/settings-layout.js +39 -0
- package/lib/chat/components/settings-layout.jsx +53 -0
- package/lib/chat/components/settings-secrets-page.js +216 -0
- package/lib/chat/components/settings-secrets-page.jsx +264 -0
- package/lib/chat/components/sidebar-history-item.js +138 -0
- package/lib/chat/components/sidebar-history-item.jsx +119 -0
- package/lib/chat/components/sidebar-history.js +167 -0
- package/lib/chat/components/sidebar-history.jsx +220 -0
- package/lib/chat/components/sidebar-user-nav.js +61 -0
- package/lib/chat/components/sidebar-user-nav.jsx +77 -0
- package/lib/chat/components/swarm-page.js +157 -0
- package/lib/chat/components/swarm-page.jsx +210 -0
- package/lib/chat/components/tool-call.js +89 -0
- package/lib/chat/components/tool-call.jsx +107 -0
- package/lib/chat/components/triggers-page.js +153 -0
- package/lib/chat/components/triggers-page.jsx +221 -0
- package/lib/chat/components/ui/combobox.js +98 -0
- package/lib/chat/components/ui/combobox.jsx +114 -0
- package/lib/chat/components/ui/confirm-dialog.js +53 -0
- package/lib/chat/components/ui/confirm-dialog.jsx +57 -0
- package/lib/chat/components/ui/dropdown-menu.js +194 -0
- package/lib/chat/components/ui/dropdown-menu.jsx +215 -0
- package/lib/chat/components/ui/rename-dialog.js +78 -0
- package/lib/chat/components/ui/rename-dialog.jsx +74 -0
- package/lib/chat/components/ui/scroll-area.js +13 -0
- package/lib/chat/components/ui/scroll-area.jsx +17 -0
- package/lib/chat/components/ui/separator.js +21 -0
- package/lib/chat/components/ui/separator.jsx +18 -0
- package/lib/chat/components/ui/sheet.js +75 -0
- package/lib/chat/components/ui/sheet.jsx +95 -0
- package/lib/chat/components/ui/sidebar.js +228 -0
- package/lib/chat/components/ui/sidebar.jsx +246 -0
- package/lib/chat/components/ui/tooltip.js +56 -0
- package/lib/chat/components/ui/tooltip.jsx +66 -0
- package/lib/chat/components/upgrade-dialog.js +151 -0
- package/lib/chat/components/upgrade-dialog.jsx +170 -0
- package/lib/chat/utils.js +11 -0
- package/lib/code/actions.js +153 -0
- package/lib/code/code-page.js +22 -0
- package/lib/code/code-page.jsx +25 -0
- package/lib/code/index.js +1 -0
- package/lib/code/terminal-view.js +201 -0
- package/lib/code/terminal-view.jsx +224 -0
- package/lib/code/ws-proxy.js +80 -0
- package/lib/cron.js +246 -0
- package/lib/db/api-keys.js +163 -0
- package/lib/db/chats.js +168 -0
- package/lib/db/code-workspaces.js +110 -0
- package/lib/db/index.js +52 -0
- package/lib/db/notifications.js +99 -0
- package/lib/db/schema.js +66 -0
- package/lib/db/update-check.js +96 -0
- package/lib/db/users.js +89 -0
- package/lib/paths.js +42 -0
- package/lib/tools/create-job.js +97 -0
- package/lib/tools/docker.js +146 -0
- package/lib/tools/github.js +271 -0
- package/lib/tools/openai.js +35 -0
- package/lib/tools/telegram.js +292 -0
- package/lib/triggers.js +104 -0
- package/lib/utils/render-md.js +111 -0
- package/package.json +118 -0
- package/setup/lib/auth.mjs +81 -0
- package/setup/lib/env.mjs +21 -0
- package/setup/lib/fs-utils.mjs +20 -0
- package/setup/lib/github.mjs +149 -0
- package/setup/lib/prerequisites.mjs +155 -0
- package/setup/lib/prompts.mjs +267 -0
- package/setup/lib/providers.mjs +105 -0
- package/setup/lib/sync.mjs +125 -0
- package/setup/lib/targets.mjs +45 -0
- package/setup/lib/telegram-verify.mjs +63 -0
- package/setup/lib/telegram.mjs +76 -0
- package/setup/setup-cloud.mjs +833 -0
- package/setup/setup-local.mjs +377 -0
- package/setup/setup-telegram.mjs +265 -0
- package/setup/setup.mjs +87 -0
- package/templates/.dockerignore +5 -0
- package/templates/.env.example +104 -0
- package/templates/.github/workflows/auto-merge.yml +117 -0
- package/templates/.github/workflows/notify-job-failed.yml +64 -0
- package/templates/.github/workflows/notify-pr-complete.yml +119 -0
- package/templates/.github/workflows/rebuild-event-handler.yml +121 -0
- package/templates/.github/workflows/run-job.yml +89 -0
- package/templates/.github/workflows/upgrade-event-handler.yml +62 -0
- package/templates/.gitignore.template +45 -0
- package/templates/.pi/extensions/env-sanitizer/index.ts +48 -0
- package/templates/.pi/extensions/env-sanitizer/package.json +5 -0
- package/templates/CLAUDE.md +29 -0
- package/templates/CLAUDE.md.template +308 -0
- package/templates/app/api/[...gigaclaw]/route.js +1 -0
- package/templates/app/api/auth/[...nextauth]/route.js +1 -0
- package/templates/app/chat/[chatId]/page.js +9 -0
- package/templates/app/chats/page.js +7 -0
- package/templates/app/code/[codeWorkspaceId]/page.js +9 -0
- package/templates/app/components/ascii-logo.jsx +12 -0
- package/templates/app/components/login-form.jsx +92 -0
- package/templates/app/components/setup-form.jsx +82 -0
- package/templates/app/components/theme-provider.jsx +11 -0
- package/templates/app/components/theme-toggle.jsx +38 -0
- package/templates/app/components/ui/button.jsx +21 -0
- package/templates/app/components/ui/card.jsx +23 -0
- package/templates/app/components/ui/input.jsx +10 -0
- package/templates/app/components/ui/label.jsx +10 -0
- package/templates/app/crons/page.js +5 -0
- package/templates/app/globals.css +90 -0
- package/templates/app/layout.js +33 -0
- package/templates/app/login/page.js +15 -0
- package/templates/app/notifications/page.js +7 -0
- package/templates/app/page.js +7 -0
- package/templates/app/pull-requests/page.js +7 -0
- package/templates/app/settings/crons/page.js +5 -0
- package/templates/app/settings/layout.js +7 -0
- package/templates/app/settings/page.js +5 -0
- package/templates/app/settings/secrets/page.js +5 -0
- package/templates/app/settings/triggers/page.js +5 -0
- package/templates/app/stream/chat/route.js +1 -0
- package/templates/app/swarm/page.js +7 -0
- package/templates/app/triggers/page.js +5 -0
- package/templates/config/CODE_PLANNING.md +14 -0
- package/templates/config/CRONS.json +56 -0
- package/templates/config/HEARTBEAT.md +3 -0
- package/templates/config/JOB_AGENT.md +30 -0
- package/templates/config/JOB_PLANNING.md +240 -0
- package/templates/config/JOB_SUMMARY.md +130 -0
- package/templates/config/SKILL_BUILDING_GUIDE.md +96 -0
- package/templates/config/SOUL.md +48 -0
- package/templates/config/TRIGGERS.json +58 -0
- package/templates/config/WEB_SEARCH_AVAILABLE.md +5 -0
- package/templates/config/WEB_SEARCH_UNAVAILABLE.md +3 -0
- package/templates/docker/claude-code-job/Dockerfile +34 -0
- package/templates/docker/claude-code-job/entrypoint.sh +149 -0
- package/templates/docker/claude-code-workspace/.tmux.conf +5 -0
- package/templates/docker/claude-code-workspace/Dockerfile +61 -0
- package/templates/docker/claude-code-workspace/entrypoint.sh +51 -0
- package/templates/docker/event-handler/Dockerfile +20 -0
- package/templates/docker/event-handler/ecosystem.config.cjs +7 -0
- package/templates/docker/pi-coding-agent-job/Dockerfile +51 -0
- package/templates/docker/pi-coding-agent-job/entrypoint.sh +164 -0
- package/templates/docker-compose.local.yml +78 -0
- package/templates/docker-compose.yml +64 -0
- package/templates/instrumentation.js +6 -0
- package/templates/middleware.js +23 -0
- package/templates/next.config.mjs +3 -0
- package/templates/postcss.config.mjs +5 -0
- package/templates/public/favicon.ico +0 -0
- package/templates/server.js +25 -0
- package/templates/skills/LICENSE +21 -0
- package/templates/skills/README.md +119 -0
- package/templates/skills/brave-search/SKILL.md +79 -0
- package/templates/skills/brave-search/content.js +86 -0
- package/templates/skills/brave-search/package-lock.json +621 -0
- package/templates/skills/brave-search/package.json +14 -0
- package/templates/skills/brave-search/search.js +199 -0
- package/templates/skills/browser-tools/SKILL.md +196 -0
- package/templates/skills/browser-tools/browser-content.js +103 -0
- package/templates/skills/browser-tools/browser-cookies.js +35 -0
- package/templates/skills/browser-tools/browser-eval.js +53 -0
- package/templates/skills/browser-tools/browser-hn-scraper.js +108 -0
- package/templates/skills/browser-tools/browser-nav.js +44 -0
- package/templates/skills/browser-tools/browser-pick.js +162 -0
- package/templates/skills/browser-tools/browser-screenshot.js +34 -0
- package/templates/skills/browser-tools/browser-start.js +87 -0
- package/templates/skills/browser-tools/package-lock.json +2556 -0
- package/templates/skills/browser-tools/package.json +19 -0
- package/templates/skills/google-docs/SKILL.md +23 -0
- package/templates/skills/google-docs/create.sh +69 -0
- package/templates/skills/google-drive/SKILL.md +47 -0
- package/templates/skills/google-drive/delete.sh +47 -0
- package/templates/skills/google-drive/download.sh +50 -0
- package/templates/skills/google-drive/list.sh +41 -0
- package/templates/skills/google-drive/upload.sh +76 -0
- package/templates/skills/kie-ai/SKILL.md +38 -0
- package/templates/skills/kie-ai/generate-image.sh +77 -0
- package/templates/skills/kie-ai/generate-video.sh +69 -0
- package/templates/skills/llm-secrets/SKILL.md +34 -0
- package/templates/skills/llm-secrets/llm-secrets.js +33 -0
- package/templates/skills/modify-self/SKILL.md +12 -0
- package/templates/skills/youtube-transcript/SKILL.md +41 -0
- package/templates/skills/youtube-transcript/package-lock.json +24 -0
- package/templates/skills/youtube-transcript/package.json +8 -0
- package/templates/skills/youtube-transcript/transcript.js +84 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Giga Bot — Middleware
|
|
3
|
+
* Powered by Gignaati | https://gignaati.com
|
|
4
|
+
*
|
|
5
|
+
* Next.js requires the `config` export to be a static literal object defined
|
|
6
|
+
* directly in this file. It cannot be re-exported from another module because
|
|
7
|
+
* Turbopack/Webpack statically analyses it at compile time.
|
|
8
|
+
*
|
|
9
|
+
* The `middleware` function is imported from the gigaclaw package and handles:
|
|
10
|
+
* - Authentication checks (redirects unauthenticated users to /login)
|
|
11
|
+
* - Stale session cookie cleanup on AUTH_SECRET rotation
|
|
12
|
+
* - Skipping auth for /api routes, static assets, and the /login page itself
|
|
13
|
+
*/
|
|
14
|
+
export { middleware } from 'gigaclaw/middleware';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Route matcher config — must be a static literal object in this file.
|
|
18
|
+
* Excludes Next.js internals (_next/*), Turbopack HMR assets, and favicon.ico
|
|
19
|
+
* from middleware processing to avoid interfering with static asset delivery.
|
|
20
|
+
*/
|
|
21
|
+
export const config = {
|
|
22
|
+
matcher: ['/((?!_next|favicon.ico).*)'],
|
|
23
|
+
};
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createServer } from 'http';
|
|
2
|
+
import next from 'next';
|
|
3
|
+
import { attachCodeProxy } from 'gigaclaw/code/ws-proxy';
|
|
4
|
+
|
|
5
|
+
const app = next({ dev: false });
|
|
6
|
+
const handle = app.getRequestHandler();
|
|
7
|
+
|
|
8
|
+
// HACK: Prevent Next.js from registering its own WebSocket upgrade handler.
|
|
9
|
+
// Without this, Next.js lazily calls setupWebSocketHandler() which uses its
|
|
10
|
+
// bundled http-proxy to write "HTTP/1.1 502 Bad Gateway" on already-upgraded
|
|
11
|
+
// sockets. No official API exists for this — see docs/HACKS.md.
|
|
12
|
+
app.didWebSocketSetup = true;
|
|
13
|
+
|
|
14
|
+
app.prepare().then(() => {
|
|
15
|
+
const server = createServer((req, res) => {
|
|
16
|
+
handle(req, res);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
attachCodeProxy(server);
|
|
20
|
+
|
|
21
|
+
const port = process.env.PORT || 80;
|
|
22
|
+
server.listen(port, () => {
|
|
23
|
+
console.log(`> Ready on http://localhost:${port}`);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Mario Zechner
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# pi-skills
|
|
2
|
+
|
|
3
|
+
A collection of skills for [pi-coding-agent](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent), compatible with Claude Code, Codex CLI, Amp, and Droid.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### pi-coding-agent
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# User-level (available in all projects)
|
|
11
|
+
git clone https://github.com/badlogic/pi-skills ~/.pi/agent/skills/pi-skills
|
|
12
|
+
|
|
13
|
+
# Or project-level
|
|
14
|
+
git clone https://github.com/badlogic/pi-skills .pi/skills/pi-skills
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Codex CLI
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
git clone https://github.com/badlogic/pi-skills ~/.codex/skills/pi-skills
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Amp
|
|
24
|
+
|
|
25
|
+
Amp finds skills recursively in toolboxes:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/badlogic/pi-skills ~/.config/amp/tools/pi-skills
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Droid (Factory)
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# User-level
|
|
35
|
+
git clone https://github.com/badlogic/pi-skills ~/.factory/skills/pi-skills
|
|
36
|
+
|
|
37
|
+
# Or project-level
|
|
38
|
+
git clone https://github.com/badlogic/pi-skills .factory/skills/pi-skills
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Claude Code
|
|
42
|
+
|
|
43
|
+
Claude Code only looks one level deep for `SKILL.md` files, so each skill folder must be directly under the skills directory. Clone the repo somewhere, then symlink individual skills:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Clone to a convenient location
|
|
47
|
+
git clone https://github.com/badlogic/pi-skills ~/pi-skills
|
|
48
|
+
|
|
49
|
+
# Symlink individual skills (user-level)
|
|
50
|
+
mkdir -p ~/.claude/skills
|
|
51
|
+
ln -s ~/pi-skills/brave-search ~/.claude/skills/brave-search
|
|
52
|
+
ln -s ~/pi-skills/browser-tools ~/.claude/skills/browser-tools
|
|
53
|
+
ln -s ~/pi-skills/gccli ~/.claude/skills/gccli
|
|
54
|
+
ln -s ~/pi-skills/gdcli ~/.claude/skills/gdcli
|
|
55
|
+
ln -s ~/pi-skills/gmcli ~/.claude/skills/gmcli
|
|
56
|
+
ln -s ~/pi-skills/transcribe ~/.claude/skills/transcribe
|
|
57
|
+
ln -s ~/pi-skills/vscode ~/.claude/skills/vscode
|
|
58
|
+
ln -s ~/pi-skills/youtube-transcript ~/.claude/skills/youtube-transcript
|
|
59
|
+
|
|
60
|
+
# Or project-level
|
|
61
|
+
mkdir -p .claude/skills
|
|
62
|
+
ln -s ~/pi-skills/brave-search .claude/skills/brave-search
|
|
63
|
+
ln -s ~/pi-skills/browser-tools .claude/skills/browser-tools
|
|
64
|
+
ln -s ~/pi-skills/gccli .claude/skills/gccli
|
|
65
|
+
ln -s ~/pi-skills/gdcli .claude/skills/gdcli
|
|
66
|
+
ln -s ~/pi-skills/gmcli .claude/skills/gmcli
|
|
67
|
+
ln -s ~/pi-skills/transcribe .claude/skills/transcribe
|
|
68
|
+
ln -s ~/pi-skills/vscode .claude/skills/vscode
|
|
69
|
+
ln -s ~/pi-skills/youtube-transcript .claude/skills/youtube-transcript
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Available Skills
|
|
73
|
+
|
|
74
|
+
| Skill | Description |
|
|
75
|
+
|-------|-------------|
|
|
76
|
+
| [brave-search](brave-search/SKILL.md) | Web search and content extraction via Brave Search |
|
|
77
|
+
| [browser-tools](browser-tools/SKILL.md) | Interactive browser automation via Chrome DevTools Protocol |
|
|
78
|
+
| [gccli](gccli/SKILL.md) | Google Calendar CLI for events and availability |
|
|
79
|
+
| [gdcli](gdcli/SKILL.md) | Google Drive CLI for file management and sharing |
|
|
80
|
+
| [gmcli](gmcli/SKILL.md) | Gmail CLI for email, drafts, and labels |
|
|
81
|
+
| [transcribe](transcribe/SKILL.md) | Speech-to-text transcription via Groq Whisper API |
|
|
82
|
+
| [vscode](vscode/SKILL.md) | VS Code integration for diffs and file comparison |
|
|
83
|
+
| [youtube-transcript](youtube-transcript/SKILL.md) | Fetch YouTube video transcripts |
|
|
84
|
+
|
|
85
|
+
## Skill Format
|
|
86
|
+
|
|
87
|
+
Each skill follows the pi/Claude Code format:
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
---
|
|
91
|
+
name: skill-name
|
|
92
|
+
description: Short description shown to agent
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
# Instructions
|
|
96
|
+
|
|
97
|
+
Detailed instructions here...
|
|
98
|
+
Helper files available at: skills/skill-name/
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Skills use project-root-relative paths (e.g., `skills/brave-search/search.js`).
|
|
102
|
+
|
|
103
|
+
## Requirements
|
|
104
|
+
|
|
105
|
+
Some skills require additional setup. Generally, the agent will walk you through that. But if not, here you go:
|
|
106
|
+
|
|
107
|
+
- **brave-search**: Requires Node.js. Run `npm install` in the skill directory.
|
|
108
|
+
- **browser-tools**: Requires Chrome and Node.js. Run `npm install` in the skill directory.
|
|
109
|
+
- **gccli**: Requires Node.js. Install globally with `npm install -g @mariozechner/gccli`.
|
|
110
|
+
- **gdcli**: Requires Node.js. Install globally with `npm install -g @mariozechner/gdcli`.
|
|
111
|
+
- **gmcli**: Requires Node.js. Install globally with `npm install -g @mariozechner/gmcli`.
|
|
112
|
+
- **subagent**: Requires pi-coding-agent. Install globally with `npm install -g @mariozechner/pi-coding-agent`.
|
|
113
|
+
- **transcribe**: Requires curl and a Groq API key.
|
|
114
|
+
- **vscode**: Requires VS Code with `code` CLI in PATH.
|
|
115
|
+
- **youtube-transcript**: Requires Node.js. Run `npm install` in the skill directory.
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brave-search
|
|
3
|
+
description: Web search and content extraction via Brave Search API. Use for searching documentation, facts, or any web content. Lightweight, no browser required.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Brave Search
|
|
7
|
+
|
|
8
|
+
Web search and content extraction using the official Brave Search API. No browser required.
|
|
9
|
+
|
|
10
|
+
## Setup
|
|
11
|
+
|
|
12
|
+
Requires a Brave Search API account with a free subscription. A credit card is required to create the free subscription (you won't be charged).
|
|
13
|
+
|
|
14
|
+
1. Create an account at https://api-dashboard.search.brave.com/register
|
|
15
|
+
2. Create a "Free AI" subscription
|
|
16
|
+
3. Create an API key for the subscription
|
|
17
|
+
4. Add to your shell profile (`~/.profile` or `~/.zprofile` for zsh):
|
|
18
|
+
```bash
|
|
19
|
+
export BRAVE_API_KEY="your-api-key-here"
|
|
20
|
+
```
|
|
21
|
+
5. Install dependencies (run once):
|
|
22
|
+
```bash
|
|
23
|
+
cd skills/brave-search
|
|
24
|
+
npm install
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Search
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
skills/brave-search/search.js "query" # Basic search (5 results)
|
|
31
|
+
skills/brave-search/search.js "query" -n 10 # More results (max 20)
|
|
32
|
+
skills/brave-search/search.js "query" --content # Include page content as markdown
|
|
33
|
+
skills/brave-search/search.js "query" --freshness pw # Results from last week
|
|
34
|
+
skills/brave-search/search.js "query" --freshness 2024-01-01to2024-06-30 # Date range
|
|
35
|
+
skills/brave-search/search.js "query" --country DE # Results from Germany
|
|
36
|
+
skills/brave-search/search.js "query" -n 3 --content # Combined options
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Options
|
|
40
|
+
|
|
41
|
+
- `-n <num>` - Number of results (default: 5, max: 20)
|
|
42
|
+
- `--content` - Fetch and include page content as markdown
|
|
43
|
+
- `--country <code>` - Two-letter country code (default: US)
|
|
44
|
+
- `--freshness <period>` - Filter by time:
|
|
45
|
+
- `pd` - Past day (24 hours)
|
|
46
|
+
- `pw` - Past week
|
|
47
|
+
- `pm` - Past month
|
|
48
|
+
- `py` - Past year
|
|
49
|
+
- `YYYY-MM-DDtoYYYY-MM-DD` - Custom date range
|
|
50
|
+
|
|
51
|
+
## Extract Page Content
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
skills/brave-search/content.js https://example.com/article
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Fetches a URL and extracts readable content as markdown.
|
|
58
|
+
|
|
59
|
+
## Output Format
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
--- Result 1 ---
|
|
63
|
+
Title: Page Title
|
|
64
|
+
Link: https://example.com/page
|
|
65
|
+
Age: 2 days ago
|
|
66
|
+
Snippet: Description from search results
|
|
67
|
+
Content: (if --content flag used)
|
|
68
|
+
Markdown content extracted from the page...
|
|
69
|
+
|
|
70
|
+
--- Result 2 ---
|
|
71
|
+
...
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## When to Use
|
|
75
|
+
|
|
76
|
+
- Searching for documentation or API references
|
|
77
|
+
- Looking up facts or current information
|
|
78
|
+
- Fetching content from specific URLs
|
|
79
|
+
- Any task requiring web search without interactive browsing
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { Readability } from "@mozilla/readability";
|
|
4
|
+
import { JSDOM } from "jsdom";
|
|
5
|
+
import TurndownService from "turndown";
|
|
6
|
+
import { gfm } from "turndown-plugin-gfm";
|
|
7
|
+
|
|
8
|
+
const url = process.argv[2];
|
|
9
|
+
|
|
10
|
+
if (!url) {
|
|
11
|
+
console.log("Usage: content.js <url>");
|
|
12
|
+
console.log("\nExtracts readable content from a webpage as markdown.");
|
|
13
|
+
console.log("\nExamples:");
|
|
14
|
+
console.log(" content.js https://example.com/article");
|
|
15
|
+
console.log(" content.js https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html");
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function htmlToMarkdown(html) {
|
|
20
|
+
const turndown = new TurndownService({ headingStyle: "atx", codeBlockStyle: "fenced" });
|
|
21
|
+
turndown.use(gfm);
|
|
22
|
+
turndown.addRule("removeEmptyLinks", {
|
|
23
|
+
filter: (node) => node.nodeName === "A" && !node.textContent?.trim(),
|
|
24
|
+
replacement: () => "",
|
|
25
|
+
});
|
|
26
|
+
return turndown
|
|
27
|
+
.turndown(html)
|
|
28
|
+
.replace(/\[\\?\[\s*\\?\]\]\([^)]*\)/g, "")
|
|
29
|
+
.replace(/ +/g, " ")
|
|
30
|
+
.replace(/\s+,/g, ",")
|
|
31
|
+
.replace(/\s+\./g, ".")
|
|
32
|
+
.replace(/\n{3,}/g, "\n\n")
|
|
33
|
+
.trim();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const response = await fetch(url, {
|
|
38
|
+
headers: {
|
|
39
|
+
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
|
40
|
+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
41
|
+
"Accept-Language": "en-US,en;q=0.9",
|
|
42
|
+
},
|
|
43
|
+
signal: AbortSignal.timeout(15000),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (!response.ok) {
|
|
47
|
+
console.error(`HTTP ${response.status}: ${response.statusText}`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const html = await response.text();
|
|
52
|
+
const dom = new JSDOM(html, { url });
|
|
53
|
+
const reader = new Readability(dom.window.document);
|
|
54
|
+
const article = reader.parse();
|
|
55
|
+
|
|
56
|
+
if (article && article.content) {
|
|
57
|
+
if (article.title) {
|
|
58
|
+
console.log(`# ${article.title}\n`);
|
|
59
|
+
}
|
|
60
|
+
console.log(htmlToMarkdown(article.content));
|
|
61
|
+
process.exit(0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Fallback: try to extract main content
|
|
65
|
+
const fallbackDoc = new JSDOM(html, { url });
|
|
66
|
+
const body = fallbackDoc.window.document;
|
|
67
|
+
body.querySelectorAll("script, style, noscript, nav, header, footer, aside").forEach(el => el.remove());
|
|
68
|
+
|
|
69
|
+
const title = body.querySelector("title")?.textContent?.trim();
|
|
70
|
+
const main = body.querySelector("main, article, [role='main'], .content, #content") || body.body;
|
|
71
|
+
|
|
72
|
+
if (title) {
|
|
73
|
+
console.log(`# ${title}\n`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const text = main?.innerHTML || "";
|
|
77
|
+
if (text.trim().length > 100) {
|
|
78
|
+
console.log(htmlToMarkdown(text));
|
|
79
|
+
} else {
|
|
80
|
+
console.error("Could not extract readable content from this page.");
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
} catch (e) {
|
|
84
|
+
console.error(`Error: ${e.message}`);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|