Skip to content

Commit 25e2f69

Browse files
authored
Merge pull request #2616 from 16Miku/docs/fix-adapter-matches-api
docs: fix site adapter matcher API name
2 parents fee3546 + 4369061 commit 25e2f69

4 files changed

Lines changed: 23 additions & 23 deletions

File tree

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The shape is:
5757
{
5858
name: 'sahibinden',
5959
category: 'general',
60-
match: (url) => /^https?:\/\/(www\.)?sahibinden\.com\//.test(url),
60+
matches: (url) => /^https?:\/\/(www\.)?sahibinden\.com\//.test(url),
6161
notes: `
6262
- (one short bullet per non-obvious fact about the site, written in the
6363
imperative voice for an LLM that has never seen this page before.)
@@ -69,7 +69,7 @@ Each adapter needs four things:
6969

7070
1. **`name`** — short identifier, lowercase, no spaces. Used in logs and the settings UI.
7171
2. **`category`** — usually `'general'`. Reserved for future filtering.
72-
3. **`match(url)`** — regex against the current tab URL. Match the broadest
72+
3. **`matches(url)`** — regex against the current tab URL. Match the broadest
7373
form of the domain (`.com`, `.co.uk`, `.com.tr` country variants if applicable),
7474
but don't match unrelated subdomains.
7575
4. **`notes`** — the body the agent will see prepended to its first message

docs/fr/site-adapters.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ Les adaptateurs de site sont la **contribution la plus recherchée n°1** (voir
1212

1313
### Correspondance
1414

15-
`getActiveAdapter(url)` parcourt le tableau `ADAPTERS` et retourne le **premier** adaptateur dont `match(url)` retourne `true` :
15+
`getActiveAdapter(url)` parcourt le tableau `ADAPTERS` et retourne le **premier** adaptateur dont `matches(url)` retourne `true` :
1616

1717
```js
1818
export function getActiveAdapter(url) {
1919
if (!url) return null;
2020
for (const a of ADAPTERS) {
2121
try {
22-
if (a.match(url)) return a;
22+
if (a.matches(url)) return a;
2323
} catch (e) { /* ignorer les matchers mal formés */ }
2424
}
2525
return null;
@@ -52,7 +52,7 @@ d'injecter les conseils Mastodon plus largement.
5252
{
5353
name: 'my-site', // identifiant court unique
5454
category: 'general', // 'general' | 'finance'
55-
match: (url) => /^https?:\/\/(www\.)?example\.com\//.test(url),
55+
matches: (url) => /^https?:\/\/(www\.)?example\.com\//.test(url),
5656
notes: `
5757
- Point 1 : le conseil actionnable.
5858
- Point 2 : un autre conseil.
@@ -67,7 +67,7 @@ d'injecter les conseils Mastodon plus largement.
6767
|---|---|---|
6868
| `name` | string | Identifiant unique pour l'adaptateur. Utilisé dans les en-têtes d'invite système. |
6969
| `category` | `'general'` ou `'finance'` | `'finance'` ajoute une bannière `[FINANCE / ENJEUX ÉLEVÉS]` à l'en-tête et déclenche des consignes de sécurité supplémentaires dans l'invite système. |
70-
| `match` | `(url) => boolean` | Retourne `true` quand l'adaptateur doit se déclencher pour cette URL. L'expression régulière est préférée — gardez-la assez spécifique pour éviter les faux positifs. |
70+
| `matches` | `(url) => boolean` | Retourne `true` quand l'adaptateur doit se déclencher pour cette URL. L'expression régulière est préférée — gardez-la assez spécifique pour éviter les faux positifs. |
7171
| `notes` | string | Conseils sous forme de puces injectés dans le premier message utilisateur. **Maximum 4 à 8 lignes.** Voir les consignes de style ci-dessous. |
7272

7373
### Ordre
@@ -108,7 +108,7 @@ Les adaptateurs sont ordonnés par catégorie/site dans le tableau `ADAPTERS`. *
108108
{
109109
name: 'twitter',
110110
category: 'general',
111-
match: (url) => /^https?:\/\/(www\.)?(twitter\.com|x\.com)\//.test(url),
111+
matches: (url) => /^https?:\/\/(www\.)?(twitter\.com|x\.com)\//.test(url),
112112
notes: `
113113
- Le composeur est un contenteditable, pas un textarea. Le nombre de caractères est appliqué côté client.
114114
- La timeline est virtualisée — les tweets disparaissent du DOM. Utilisez la recherche, pas le défilement, pour trouver un tweet.
@@ -124,7 +124,7 @@ Les adaptateurs sont ordonnés par catégorie/site dans le tableau `ADAPTERS`. *
124124
{
125125
name: 'stripe',
126126
category: 'finance',
127-
match: (url) => /^https?:\/\/(dashboard\.)?stripe\.com\//.test(url),
127+
matches: (url) => /^https?:\/\/(dashboard\.)?stripe\.com\//.test(url),
128128
notes: `
129129
- Bascule LIVE vs TEST en haut à droite. Toujours confirmer le mode.
130130
- Les remboursements sont partiels par défaut — vérifier le montant attentivement.
@@ -161,7 +161,7 @@ Ouvrez chaque site adapté et vérifiez :
161161

162162
- [ ] Ajouter l'objet adaptateur au tableau `ADAPTERS` dans `src/chrome/src/agent/adapters.js`
163163
- [ ] Refléter exactement la même modification dans `src/firefox/src/agent/adapters.js`
164-
- [ ] S'assurer que la regex `match()` est spécifique et ne masque pas les adaptateurs voisins
164+
- [ ] S'assurer que la regex `matches()` est spécifique et ne masque pas les adaptateurs voisins
165165
- [ ] Si `category: 'finance'`, le placer AVANT `finance-generic` dans le tableau
166166
- [ ] Vérifier que les notes sont concises (4 à 8 puces)
167167
- [ ] Tester la correspondance avec `getActiveAdapter(url)`

docs/site-adapters.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ Site adapters are the **#1 most-wanted contribution** (see CONTRIBUTING.md). The
1212

1313
### Matching
1414

15-
`getActiveAdapter(url)` iterates the `ADAPTERS` array and returns the **first** adapter whose `match(url)` returns `true`:
15+
`getActiveAdapter(url)` iterates the `ADAPTERS` array and returns the **first** adapter whose `matches(url)` returns `true`:
1616

1717
```js
1818
export function getActiveAdapter(url) {
1919
if (!url) return null;
2020
for (const a of ADAPTERS) {
2121
try {
22-
if (a.match(url)) return a;
22+
if (a.matches(url)) return a;
2323
} catch (e) { /* skip malformed matchers */ }
2424
}
2525
return null;
@@ -52,7 +52,7 @@ injecting Mastodon guidance more broadly.
5252
{
5353
name: 'my-site', // unique short identifier
5454
category: 'general', // 'general' | 'finance'
55-
match: (url) => /^https?:\/\/(www\.)?example\.com\//.test(url),
55+
matches: (url) => /^https?:\/\/(www\.)?example\.com\//.test(url),
5656
notes: `
5757
- Bullet 1: the actionable tip.
5858
- Bullet 2: another tip.
@@ -67,7 +67,7 @@ injecting Mastodon guidance more broadly.
6767
|---|---|---|
6868
| `name` | string | Unique identifier for the adapter. Used in system-prompt headings. |
6969
| `category` | `'general'` or `'finance'` | `'finance'` adds a `[FINANCE / HIGH-STAKES]` banner to the heading and triggers extra safety guidance in the system prompt. |
70-
| `match` | `(url) => boolean` | Returns `true` when the adapter should fire for this URL. Regex is preferred — keep it specific enough to avoid false matches. |
70+
| `matches` | `(url) => boolean` | Returns `true` when the adapter should fire for this URL. Regex is preferred — keep it specific enough to avoid false matches. |
7171
| `notes` | string | Bulleted guidance injected into the first user message. **Keep 4–8 lines max.** See style guidance below. |
7272

7373
### Ordering
@@ -108,7 +108,7 @@ Adapters are ordered by category/site in the `ADAPTERS` array. **Finance adapter
108108
{
109109
name: 'twitter',
110110
category: 'general',
111-
match: (url) => /^https?:\/\/(www\.)?(twitter\.com|x\.com)\//.test(url),
111+
matches: (url) => /^https?:\/\/(www\.)?(twitter\.com|x\.com)\//.test(url),
112112
notes: `
113113
- The composer is a contenteditable, not a textarea. Character count is enforced client-side.
114114
- The timeline is virtualized — tweets scroll out of the DOM. Use search, not scroll, to find a tweet.
@@ -124,7 +124,7 @@ Adapters are ordered by category/site in the `ADAPTERS` array. **Finance adapter
124124
{
125125
name: 'stripe',
126126
category: 'finance',
127-
match: (url) => /^https?:\/\/(dashboard\.)?stripe\.com\//.test(url),
127+
matches: (url) => /^https?:\/\/(dashboard\.)?stripe\.com\//.test(url),
128128
notes: `
129129
- LIVE vs TEST mode toggle in the top-right. Always confirm which mode.
130130
- Refunds are partial-by-default — check the amount carefully.
@@ -161,7 +161,7 @@ Open each adapted site and verify:
161161

162162
- [ ] Add the adapter object to the `ADAPTERS` array in `src/chrome/src/agent/adapters.js`
163163
- [ ] Mirror the exact same change to `src/firefox/src/agent/adapters.js`
164-
- [ ] Ensure the `match()` regex is specific and doesn't shadow neighboring adapters
164+
- [ ] Ensure the `matches()` regex is specific and doesn't shadow neighboring adapters
165165
- [ ] If `category: 'finance'`, place it BEFORE `finance-generic` in the array
166166
- [ ] Verify the notes are 4–8 concise bullets
167167
- [ ] Test matching with `getActiveAdapter(url)`

docs/zh-CN/site-adapters.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212

1313
### 匹配
1414

15-
`getActiveAdapter(url)` 遍历 `ADAPTERS` 数组,返回第一个 `match(url)` 返回 `true` 的适配器:
15+
`getActiveAdapter(url)` 遍历 `ADAPTERS` 数组,返回第一个 `matches(url)` 返回 `true` 的适配器:
1616

1717
```js
1818
export function getActiveAdapter(url) {
1919
if (!url) return null;
2020
for (const a of ADAPTERS) {
2121
try {
22-
if (a.match(url)) return a;
22+
if (a.matches(url)) return a;
2323
} catch (e) { /* 跳过格式错误的匹配器 */ }
2424
}
2525
return null;
@@ -51,7 +51,7 @@ export function getActiveAdapter(url) {
5151
{
5252
name: 'my-site', // 唯一短标识符
5353
category: 'general', // 'general' | 'finance'
54-
match: (url) => /^https?:\/\/(www\.)?example\.com\//.test(url),
54+
matches: (url) => /^https?:\/\/(www\.)?example\.com\//.test(url),
5555
notes: `
5656
- 要点 1:可操作的建议。
5757
- 要点 2:另一个建议。
@@ -66,7 +66,7 @@ export function getActiveAdapter(url) {
6666
|---|---|---|
6767
| `name` | string | 适配器的唯一标识符。用于系统提示的标题。 |
6868
| `category` | `'general'``'finance'` | `'finance'` 会在标题中添加 `[FINANCE / HIGH-STAKES]` 横幅,并在系统提示中触发额外的安全指导。 |
69-
| `match` | `(url) => boolean` | 当适配器应为该 URL 触发时返回 `true`。推荐使用正则表达式——保持足够具体以避免错误匹配。 |
69+
| `matches` | `(url) => boolean` | 当适配器应为该 URL 触发时返回 `true`。推荐使用正则表达式——保持足够具体以避免错误匹配。 |
7070
| `notes` | string | 注入到第一条用户消息中的要点式指导。**最多保持 4–8 行。** 参见下面的风格指南。 |
7171

7272
### 排序
@@ -107,7 +107,7 @@ export function getActiveAdapter(url) {
107107
{
108108
name: 'twitter',
109109
category: 'general',
110-
match: (url) => /^https?:\/\/(www\.)?(twitter\.com|x\.com)\//.test(url),
110+
matches: (url) => /^https?:\/\/(www\.)?(twitter\.com|x\.com)\//.test(url),
111111
notes: `
112112
- 编辑器是一个 contenteditable,而不是 textarea。字符数由客户端强制限制。
113113
- 时间线是虚拟化的——推文会滚动出 DOM。使用搜索而不是滚动来查找推文。
@@ -123,7 +123,7 @@ export function getActiveAdapter(url) {
123123
{
124124
name: 'stripe',
125125
category: 'finance',
126-
match: (url) => /^https?:\/\/(dashboard\.)?stripe\.com\//.test(url),
126+
matches: (url) => /^https?:\/\/(dashboard\.)?stripe\.com\//.test(url),
127127
notes: `
128128
- LIVE 与 TEST 模式切换在右上角。始终确认当前模式。
129129
- 退款默认为部分退款——请仔细检查金额。
@@ -160,7 +160,7 @@ export function getActiveAdapter(url) {
160160

161161
- [ ] 将适配器对象添加到 `src/chrome/src/agent/adapters.js``ADAPTERS` 数组中
162162
- [ ] 将完全相同的更改同步到 `src/firefox/src/agent/adapters.js`
163-
- [ ] 确保 `match()` 正则表达式具体且不会遮蔽相邻的适配器
163+
- [ ] 确保 `matches()` 正则表达式具体且不会遮蔽相邻的适配器
164164
- [ ] 如果 `category: 'finance'`,将其放在数组中 `finance-generic` 之前
165165
- [ ] 验证 notes 是 4–8 条简洁的要点
166166
- [ ] 使用 `getActiveAdapter(url)` 测试匹配

0 commit comments

Comments
 (0)