@m8i-51/shoal 0.1.1 → 0.1.3
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/.env.example +76 -0
- package/README.md +10 -5
- package/bin/init.js +106 -0
- package/bin/shoal.js +49 -36
- package/package.json +9 -3
package/.env.example
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# ================================================================
|
|
2
|
+
# LLM Provider
|
|
3
|
+
# ================================================================
|
|
4
|
+
# LLM_PROVIDER に使いたいプロバイダ名を設定してください。
|
|
5
|
+
# LLM_BASE_URL / LLM_MODEL は省略時にプロバイダのデフォルト値が使われます。
|
|
6
|
+
|
|
7
|
+
# --- Anthropic (default) ---
|
|
8
|
+
# LLM_PROVIDER=anthropic
|
|
9
|
+
# ANTHROPIC_API_KEY=sk-ant-...
|
|
10
|
+
# LLM_MODEL=claude-haiku-4-5-20251001 # 省略可
|
|
11
|
+
|
|
12
|
+
# --- OpenAI ---
|
|
13
|
+
# LLM_PROVIDER=openai
|
|
14
|
+
# LLM_API_KEY=sk-...
|
|
15
|
+
# LLM_MODEL=gpt-4o-mini # 省略可(デフォルト: gpt-4o-mini)
|
|
16
|
+
|
|
17
|
+
# --- OpenAI Codex (ChatGPT サブスク OAuth) ---
|
|
18
|
+
# 事前に認証が必要: npm run auth:codex
|
|
19
|
+
# LLM_PROVIDER=codex
|
|
20
|
+
# LLM_MODEL=gpt-5.1-codex-mini # 省略可
|
|
21
|
+
|
|
22
|
+
# --- Groq (無料枠あり・高速) ---
|
|
23
|
+
# https://console.groq.com でキー取得
|
|
24
|
+
# LLM_PROVIDER=groq
|
|
25
|
+
# LLM_API_KEY=gsk_...
|
|
26
|
+
# LLM_MODEL=llama-3.3-70b-versatile # 省略可
|
|
27
|
+
|
|
28
|
+
# --- Google Gemini (無料枠あり) ---
|
|
29
|
+
# https://aistudio.google.com でキー取得
|
|
30
|
+
# LLM_PROVIDER=gemini
|
|
31
|
+
# LLM_API_KEY=AIzaSy...
|
|
32
|
+
# LLM_MODEL=gemini-2.0-flash # 省略可
|
|
33
|
+
|
|
34
|
+
# --- Ollama (ローカル / クラウド) ---
|
|
35
|
+
# LLM_PROVIDER=ollama
|
|
36
|
+
# LLM_MODEL=llama3.2 # 省略可
|
|
37
|
+
# LLM_API_KEY= # クラウドモデルの場合は API キーを設定
|
|
38
|
+
# LLM_BASE_URL=http://localhost:11434/v1 # 省略可(ローカルのデフォルト値)
|
|
39
|
+
|
|
40
|
+
# --- LM Studio (ローカル) ---
|
|
41
|
+
# LLM_PROVIDER=lm-studio
|
|
42
|
+
# LLM_MODEL=<LM Studio に表示されるモデル名>
|
|
43
|
+
# LLM_BASE_URL=http://localhost:1234/v1 # 省略可(デフォルト値)
|
|
44
|
+
|
|
45
|
+
# --- OpenRouter (多数のモデルにアクセス可) ---
|
|
46
|
+
# https://openrouter.ai でキー取得
|
|
47
|
+
# LLM_PROVIDER=openrouter
|
|
48
|
+
# LLM_API_KEY=sk-or-...
|
|
49
|
+
# LLM_MODEL=google/gemini-flash-1.5 # 省略可 / モデル一覧: openrouter.ai/models
|
|
50
|
+
|
|
51
|
+
# --- その他 OpenAI 互換エンドポイント ---
|
|
52
|
+
# LLM_PROVIDER=openai
|
|
53
|
+
# LLM_BASE_URL=https://your-endpoint/v1
|
|
54
|
+
# LLM_API_KEY=your-key
|
|
55
|
+
# LLM_MODEL=your-model
|
|
56
|
+
|
|
57
|
+
# ================================================================
|
|
58
|
+
# Target app
|
|
59
|
+
# ================================================================
|
|
60
|
+
|
|
61
|
+
TARGET=none # example | none | カスタムターゲット名
|
|
62
|
+
BASE_URL=http://localhost:3000
|
|
63
|
+
|
|
64
|
+
# ================================================================
|
|
65
|
+
# GitHub Issues (optional)
|
|
66
|
+
# ================================================================
|
|
67
|
+
|
|
68
|
+
GITHUB_TOKEN=
|
|
69
|
+
GITHUB_REPO=owner/repo
|
|
70
|
+
|
|
71
|
+
# ================================================================
|
|
72
|
+
# Run config
|
|
73
|
+
# ================================================================
|
|
74
|
+
|
|
75
|
+
MAX_EXPLORERS=4
|
|
76
|
+
MAX_BROWSERS=2
|
package/README.md
CHANGED
|
@@ -52,20 +52,25 @@ npm install -g @m8i-51/shoal
|
|
|
52
52
|
npx playwright install chromium
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
Move to the project you want to test, then run:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
cd your-project
|
|
59
|
+
shoal init # creates .env with all available options
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Open `.env` and set at minimum:
|
|
56
63
|
|
|
57
64
|
```env
|
|
58
65
|
ANTHROPIC_API_KEY=sk-ant-...
|
|
59
|
-
BASE_URL=http://localhost:3000
|
|
60
|
-
# GITHUB_TOKEN=... # optional: enables Issue creation
|
|
61
|
-
# GITHUB_REPO=owner/repo
|
|
66
|
+
BASE_URL=http://localhost:3000 # URL of the app to test
|
|
62
67
|
```
|
|
63
68
|
|
|
64
69
|
Then run:
|
|
65
70
|
|
|
66
71
|
```bash
|
|
67
|
-
shoal # run agents against BASE_URL
|
|
68
72
|
shoal serve # open web dashboard at http://localhost:4000
|
|
73
|
+
shoal # or run agents directly from the terminal
|
|
69
74
|
```
|
|
70
75
|
|
|
71
76
|
**Or clone and develop locally:**
|
package/bin/init.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { intro, outro, select, text, isCancel, cancel } from "@clack/prompts";
|
|
2
|
+
import { writeFileSync, existsSync } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
|
|
5
|
+
const PROVIDERS = [
|
|
6
|
+
{ value: "anthropic", label: "Anthropic (Claude)", hint: "recommended", defaultModel: "claude-haiku-4-5-20251001" },
|
|
7
|
+
{ value: "openai", label: "OpenAI", defaultModel: "gpt-4o-mini" },
|
|
8
|
+
{ value: "groq", label: "Groq", hint: "free tier available", defaultModel: "llama-3.3-70b-versatile" },
|
|
9
|
+
{ value: "gemini", label: "Gemini", hint: "free tier available", defaultModel: "gemini-2.0-flash" },
|
|
10
|
+
{ value: "ollama", label: "Ollama", hint: "local", defaultModel: null },
|
|
11
|
+
{ value: "lm-studio", label: "LM Studio", hint: "local", defaultModel: null },
|
|
12
|
+
{ value: "openrouter", label: "OpenRouter", defaultModel: "google/gemini-flash-1.5" },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
function guard(value) {
|
|
16
|
+
if (isCancel(value)) {
|
|
17
|
+
cancel("Setup cancelled.");
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export async function runInit(cwd) {
|
|
24
|
+
const envPath = join(cwd, ".env");
|
|
25
|
+
|
|
26
|
+
if (existsSync(envPath)) {
|
|
27
|
+
console.log(".env already exists. Delete it and run shoal init again.");
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
intro("shoal init");
|
|
32
|
+
|
|
33
|
+
// ── Provider ──────────────────────────────────────────────────────
|
|
34
|
+
const provider = guard(await select({
|
|
35
|
+
message: "LLM provider",
|
|
36
|
+
options: PROVIDERS,
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
const env = {};
|
|
40
|
+
|
|
41
|
+
const providerDef = PROVIDERS.find((p) => p.value === provider);
|
|
42
|
+
|
|
43
|
+
// ── Provider-specific questions ───────────────────────────────────
|
|
44
|
+
if (provider === "anthropic") {
|
|
45
|
+
env.ANTHROPIC_API_KEY = guard(await text({
|
|
46
|
+
message: "ANTHROPIC_API_KEY",
|
|
47
|
+
placeholder: "sk-ant-...",
|
|
48
|
+
validate: (v) => v?.trim() ? undefined : "Required",
|
|
49
|
+
}));
|
|
50
|
+
} else if (provider === "ollama") {
|
|
51
|
+
env.LLM_PROVIDER = "ollama";
|
|
52
|
+
const baseUrl = guard(await text({
|
|
53
|
+
message: "Ollama base URL",
|
|
54
|
+
defaultValue: "http://localhost:11434/v1",
|
|
55
|
+
}));
|
|
56
|
+
if (baseUrl !== "http://localhost:11434/v1") env.LLM_BASE_URL = baseUrl;
|
|
57
|
+
} else if (provider === "lm-studio") {
|
|
58
|
+
env.LLM_PROVIDER = "lm-studio";
|
|
59
|
+
const baseUrl = guard(await text({
|
|
60
|
+
message: "LM Studio base URL",
|
|
61
|
+
defaultValue: "http://localhost:1234/v1",
|
|
62
|
+
}));
|
|
63
|
+
if (baseUrl !== "http://localhost:1234/v1") env.LLM_BASE_URL = baseUrl;
|
|
64
|
+
} else {
|
|
65
|
+
env.LLM_PROVIDER = provider;
|
|
66
|
+
env.LLM_API_KEY = guard(await text({
|
|
67
|
+
message: "API key",
|
|
68
|
+
placeholder: "sk-...",
|
|
69
|
+
validate: (v) => v?.trim() ? undefined : "Required",
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const defaultModel = providerDef?.defaultModel;
|
|
74
|
+
const model = guard(await text({
|
|
75
|
+
message: "Model name",
|
|
76
|
+
placeholder: defaultModel ? `leave blank to use ${defaultModel}` : "required",
|
|
77
|
+
validate: !defaultModel ? (v) => v?.trim() ? undefined : "Required" : undefined,
|
|
78
|
+
}));
|
|
79
|
+
if (model.trim()) env.LLM_MODEL = model.trim();
|
|
80
|
+
|
|
81
|
+
// ── Target app ────────────────────────────────────────────────────
|
|
82
|
+
env.BASE_URL = guard(await text({
|
|
83
|
+
message: "URL of the app to test",
|
|
84
|
+
defaultValue: "http://localhost:3000",
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
// ── GitHub (optional) ─────────────────────────────────────────────
|
|
88
|
+
const githubToken = guard(await text({
|
|
89
|
+
message: "GitHub token (optional — for Issue creation)",
|
|
90
|
+
placeholder: "ghp_... leave blank to skip",
|
|
91
|
+
}));
|
|
92
|
+
if (githubToken.trim()) {
|
|
93
|
+
env.GITHUB_TOKEN = githubToken.trim();
|
|
94
|
+
const githubRepo = guard(await text({
|
|
95
|
+
message: "GitHub repo",
|
|
96
|
+
placeholder: "owner/repo",
|
|
97
|
+
}));
|
|
98
|
+
if (githubRepo.trim()) env.GITHUB_REPO = githubRepo.trim();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ── Write .env ────────────────────────────────────────────────────
|
|
102
|
+
const lines = Object.entries(env).map(([k, v]) => `${k}=${v}`);
|
|
103
|
+
writeFileSync(envPath, lines.join("\n") + "\n", "utf-8");
|
|
104
|
+
|
|
105
|
+
outro("Created .env\n\n shoal serve — open the dashboard at http://localhost:4000\n shoal — run agents from the terminal");
|
|
106
|
+
}
|
package/bin/shoal.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* shoal CLI entry point
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* shoal init # interactive setup — creates .env in current directory
|
|
7
|
+
* shoal serve # web dashboard at http://localhost:4000
|
|
8
|
+
* shoal # run agents from the terminal
|
|
9
|
+
* shoal triage # triage-only mode
|
|
9
10
|
*/
|
|
10
11
|
import { spawn, spawnSync } from "child_process";
|
|
11
12
|
import { fileURLToPath } from "url";
|
|
@@ -14,43 +15,55 @@ import { existsSync } from "fs";
|
|
|
14
15
|
|
|
15
16
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
17
|
const packageRoot = join(__dirname, "..");
|
|
17
|
-
|
|
18
18
|
const subcommand = process.argv[2];
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (
|
|
33
|
-
console.
|
|
34
|
-
|
|
20
|
+
async function main() {
|
|
21
|
+
// init — 対話形式で .env をカレントディレクトリに生成する
|
|
22
|
+
if (subcommand === "init") {
|
|
23
|
+
const { runInit } = await import("./init.js");
|
|
24
|
+
await runInit(process.cwd());
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// serve の場合、web/dist が存在しなければ自動ビルドする
|
|
29
|
+
if (subcommand === "serve") {
|
|
30
|
+
const distIndex = join(packageRoot, "web", "dist", "index.html");
|
|
31
|
+
const webSrc = join(packageRoot, "web", "src");
|
|
32
|
+
if (!existsSync(distIndex) && existsSync(webSrc)) {
|
|
33
|
+
console.log("[shoal] web/dist not found — building frontend...");
|
|
34
|
+
const viteBin = join(packageRoot, "node_modules", ".bin", "vite");
|
|
35
|
+
const buildBin = existsSync(viteBin) ? viteBin : "vite";
|
|
36
|
+
const result = spawnSync(buildBin, ["build", "web"], {
|
|
37
|
+
stdio: "inherit",
|
|
38
|
+
cwd: packageRoot,
|
|
39
|
+
});
|
|
40
|
+
if (result.status !== 0) {
|
|
41
|
+
console.error("[shoal] Frontend build failed. Run: npm run build:web");
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
35
44
|
}
|
|
36
45
|
}
|
|
46
|
+
|
|
47
|
+
const scriptMap = {
|
|
48
|
+
serve: "server/index.ts",
|
|
49
|
+
triage: "triage-only.ts",
|
|
50
|
+
};
|
|
51
|
+
const script = scriptMap[subcommand] ?? "run.ts";
|
|
52
|
+
|
|
53
|
+
const tsxBin = join(packageRoot, "node_modules", ".bin", "tsx");
|
|
54
|
+
const bin = existsSync(tsxBin) ? tsxBin : "tsx";
|
|
55
|
+
const scriptPath = join(packageRoot, script);
|
|
56
|
+
|
|
57
|
+
const child = spawn(bin, [scriptPath, ...process.argv.slice(subcommand ? 3 : 2)], {
|
|
58
|
+
stdio: "inherit",
|
|
59
|
+
env: process.env,
|
|
60
|
+
cwd: process.cwd(),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
child.on("exit", (code) => process.exit(code ?? 0));
|
|
37
64
|
}
|
|
38
65
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
43
|
-
const script = scriptMap[subcommand] ?? "run.ts";
|
|
44
|
-
|
|
45
|
-
// tsx の bin を package 内から解決し、なければ PATH にフォールバック
|
|
46
|
-
const tsxBin = join(packageRoot, "node_modules", ".bin", "tsx");
|
|
47
|
-
const bin = existsSync(tsxBin) ? tsxBin : "tsx";
|
|
48
|
-
const scriptPath = join(packageRoot, script);
|
|
49
|
-
|
|
50
|
-
const child = spawn(bin, [scriptPath, ...process.argv.slice(subcommand ? 3 : 2)], {
|
|
51
|
-
stdio: "inherit",
|
|
52
|
-
env: process.env,
|
|
53
|
-
cwd: process.cwd(),
|
|
66
|
+
main().catch((e) => {
|
|
67
|
+
console.error(e);
|
|
68
|
+
process.exit(1);
|
|
54
69
|
});
|
|
55
|
-
|
|
56
|
-
child.on("exit", (code) => process.exit(code ?? 0));
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m8i-51/shoal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Multi-agent web exploration framework — finds bugs, UX issues, and missing features by running AI agents against your app",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/m8i-51/shoal"
|
|
9
|
+
},
|
|
6
10
|
"bin": {
|
|
7
11
|
"shoal": "./bin/shoal.js"
|
|
8
12
|
},
|
|
@@ -13,7 +17,8 @@
|
|
|
13
17
|
"server/",
|
|
14
18
|
"web/dist/",
|
|
15
19
|
"run.ts",
|
|
16
|
-
"triage-only.ts"
|
|
20
|
+
"triage-only.ts",
|
|
21
|
+
".env.example"
|
|
17
22
|
],
|
|
18
23
|
"scripts": {
|
|
19
24
|
"prepublishOnly": "npm run build:web",
|
|
@@ -29,7 +34,8 @@
|
|
|
29
34
|
"test:watch": "vitest"
|
|
30
35
|
},
|
|
31
36
|
"dependencies": {
|
|
32
|
-
"@anthropic-ai/sdk": "^0.
|
|
37
|
+
"@anthropic-ai/sdk": "^0.91.1",
|
|
38
|
+
"@clack/prompts": "^1.3.0",
|
|
33
39
|
"dotenv": "^17.3.1",
|
|
34
40
|
"express": "^5.2.1",
|
|
35
41
|
"openai": "^6.33.0",
|