(bashTools: string[])
| 191 | }; |
| 192 | |
| 193 | function buildSystemPrompt(bashTools: string[]): string { |
| 194 | const toolList = bashTools |
| 195 | .map((t) => `- ${t}: ${TOOL_DESCRIPTIONS[t] || 'Unix command'}`) |
| 196 | .join('\n'); |
| 197 | |
| 198 | return `You are a data analyst assistant that explores GitHub event data. You have access to BOTH: |
| 199 | |
| 200 | 1. A FILESYSTEM with JSON files organized as: |
| 201 | - filesystem/repos/{owner}/{repo}/repo.json - Repository metadata |
| 202 | - filesystem/repos/{owner}/{repo}/issues/{number}.json - Issue data with title, body, state, labels, comments |
| 203 | - filesystem/repos/{owner}/{repo}/pulls/{number}.json - Pull request data with title, body, state, merged status, comments |
| 204 | - filesystem/users/{username}.json - User data with activity counts |
| 205 | |
| 206 | 2. A SQLITE DATABASE at database.sqlite with tables: |
| 207 | - repos (id, owner, name, full_name) |
| 208 | - users (id, login, issues_opened, prs_opened, comments_made) |
| 209 | - issues (id, repo_id, number, title, body, state, author, labels_json, created_at, updated_at, closed_at) |
| 210 | - pulls (id, repo_id, number, title, body, state, author, merged, merged_at, created_at, updated_at) |
| 211 | - comments (id, issue_id, pull_id, body, author, created_at) |
| 212 | - events (id, type, actor_login, repo_name, payload_json, created_at) |
| 213 | |
| 214 | IMPORTANT: You are already in the data directory. Do NOT use "cd" commands. |
| 215 | |
| 216 | You have access to these tools via bash: |
| 217 | ${toolList} |
| 218 | |
| 219 | TIPS: |
| 220 | - For aggregation queries (counts, grouping, statistics), use sqlite3: |
| 221 | sqlite3 database.sqlite "SELECT COUNT(*) FROM issues" |
| 222 | - For text search in issue/PR content, you can use either: |
| 223 | - SQL: sqlite3 database.sqlite "SELECT * FROM issues WHERE body LIKE '%pattern%'" |
| 224 | - Filesystem: grep -r "pattern" filesystem/repos/*/issues/ |
| 225 | - For complex JSON parsing, use jq on the filesystem |
| 226 | - The 'merged' column in pulls is 0/1 (use merged=1 for merged PRs) |
| 227 | - Use JOINs in SQL to connect tables (e.g., issues to repos via repo_id)`; |
| 228 | } |
| 229 | |
| 230 | export async function runBashSqliteAgent( |
| 231 | question: string, |
no outgoing calls
no test coverage detected