some stuff

This commit is contained in:
Thomas G. Lopes
2026-02-25 15:36:29 +00:00
parent 6978c77066
commit ef00b8ef47
4 changed files with 46 additions and 31 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
{
"lastChangelogVersion": "0.54.2",
"defaultProvider": "openrouter",
"defaultModel": "z-ai/glm-5",
"defaultProvider": "anthropic",
"defaultModel": "claude-opus-4-5",
"defaultThinkingLevel": "medium",
"theme": "matugen",
"packages": [
@@ -88,3 +88,12 @@ gh repo view --web
- If `gh pr list --head` returns nothing, the PR may not exist yet, or the branch name differs.
- Use `git branch -r | rg <branch-name>` to confirm the remote branch name.
- Ensure you're in the correct repo (`git remote -v`).
## CRITICAL: Never Comment as the User
**NEVER post comments, replies, or reviews on PRs on behalf of the user.** This includes:
- `gh pr comment`
- `gh pr review`
- GraphQL mutations like `addPullRequestReviewThreadReply`, `addPullRequestReviewComment`, etc.
The agent must only read PR information and make code changes. The user will post their own comments.
@@ -16,6 +16,8 @@ cd {baseDir}/browser-tools
npm install
```
where baseDir is usually ~/.pi/agent/skills/pi-skills/browser-tools/
## Start Chrome
```bash
@@ -60,6 +62,7 @@ Capture current viewport and return temporary file path. Use this to visually in
**IMPORTANT**: Use this tool when the user wants to select specific DOM elements on the page. This launches an interactive picker that lets the user click elements to select them. The user can select multiple elements (Cmd/Ctrl+Click) and press Enter when done. The tool returns CSS selectors for the selected elements.
Common use cases:
- User says "I want to click that button" → Use this tool to let them select it
- User says "extract data from these items" → Use this tool to let them select the elements
- When you need specific selectors but the page structure is complex or ambiguous
@@ -98,14 +101,16 @@ Navigate to a URL and extract readable content as markdown. Uses Mozilla Readabi
```javascript
// Get page structure
document.body.innerHTML.slice(0, 5000)
document.body.innerHTML.slice(0, 5000);
// Find interactive elements
Array.from(document.querySelectorAll('button, input, [role="button"]')).map(e => ({
id: e.id,
text: e.textContent.trim(),
class: e.className
}))
Array.from(document.querySelectorAll('button, input, [role="button"]')).map(
(e) => ({
id: e.id,
text: e.textContent.trim(),
class: e.className,
}),
);
```
### Complex Scripts in Single Calls
@@ -113,17 +118,17 @@ Array.from(document.querySelectorAll('button, input, [role="button"]')).map(e =>
Wrap everything in an IIFE to run multi-statement code:
```javascript
(function() {
(function () {
// Multiple operations
const data = document.querySelector('#target').textContent;
const buttons = document.querySelectorAll('button');
const data = document.querySelector("#target").textContent;
const buttons = document.querySelectorAll("button");
// Interactions
buttons[0].click();
// Return results
return JSON.stringify({ data, buttonCount: buttons.length });
})()
})();
```
### Batch Interactions
@@ -131,24 +136,24 @@ Wrap everything in an IIFE to run multi-statement code:
**Don't** make separate calls for each click. **Do** batch them:
```javascript
(function() {
(function () {
const actions = ["btn1", "btn2", "btn3"];
actions.forEach(id => document.getElementById(id).click());
actions.forEach((id) => document.getElementById(id).click());
return "Done";
})()
})();
```
### Typing/Input Sequences
```javascript
(function() {
(function () {
const text = "HELLO";
for (const char of text) {
document.getElementById("key-" + char).click();
}
document.getElementById("submit").click();
return "Submitted: " + text;
})()
})();
```
### Reading App/Game State
@@ -156,17 +161,17 @@ Wrap everything in an IIFE to run multi-statement code:
Extract structured state in one call:
```javascript
(function() {
(function () {
const state = {
score: document.querySelector('.score')?.textContent,
status: document.querySelector('.status')?.className,
items: Array.from(document.querySelectorAll('.item')).map(el => ({
score: document.querySelector(".score")?.textContent,
status: document.querySelector(".status")?.className,
items: Array.from(document.querySelectorAll(".item")).map((el) => ({
text: el.textContent,
active: el.classList.contains('active')
}))
active: el.classList.contains("active"),
})),
};
return JSON.stringify(state, null, 2);
})()
})();
```
### Waiting for Updates
@@ -182,15 +187,15 @@ sleep 0.5 && {baseDir}/browser-eval.js '...'
Always start by understanding the page structure:
```javascript
(function() {
(function () {
return {
title: document.title,
forms: document.forms.length,
buttons: document.querySelectorAll('button').length,
inputs: document.querySelectorAll('input').length,
mainContent: document.body.innerHTML.slice(0, 3000)
buttons: document.querySelectorAll("button").length,
inputs: document.querySelectorAll("input").length,
mainContent: document.body.innerHTML.slice(0, 3000),
};
})()
})();
```
Then target specific elements based on what you find.