Skip to content

Commit 892ddcb

Browse files
authored
docs: fix stale .ts adapter references in skills and guides (#954)
* docs: fix stale .ts adapter references in skills and guides All adapters are now .js files. Update references in: - opencli-oneshot SKILL.md (7 instances) - opencli-autofix SKILL.md (1 instance) - opencli-explorer references (15 instances) - electron-app-cli guide (5 instances) * docs: fix stale YAML/TS references in READMEs and zh docs - Plugin type column: YAML/TS → JS (all 4 plugins have JS conversion PRs) - synthesize command: "YAML adapters" / "TS adapters" → "JS adapters" - zh index: remove "YAML 声明式" reference - zh README: add missing vk plugin entry * docs: fix remaining .ts references found in review - electron-app-cli.md: "TypeScript desktop adapter" → "desktop adapter", file layout .ts → .js - adapter-templates.md: section title "提取 utils.ts" → "提取 utils.js" - opencli-explorer SKILL.md: "写 following.ts" → "写 following.js"
1 parent ee8d7cc commit 892ddcb

10 files changed

Lines changed: 53 additions & 52 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Use site-specific commands such as `opencli hackernews top` or `opencli reddit h
120120
Use these commands when the site you need is not covered yet:
121121

122122
- `explore` inspects the page, network activity, and capability surface.
123-
- `synthesize` turns exploration artifacts into evaluate-based YAML adapters.
123+
- `synthesize` turns exploration artifacts into evaluate-based JS adapters.
124124
- `generate` runs the verified generation path and returns either a usable command or a structured explanation of why completion was blocked or needs human review.
125125

126126
### `cascade`: auth strategy discovery
@@ -320,10 +320,10 @@ opencli plugin uninstall my-tool
320320

321321
| Plugin | Type | Description |
322322
|--------|------|-------------|
323-
| [opencli-plugin-github-trending](https://github.com/ByteYue/opencli-plugin-github-trending) | TS | GitHub Trending repositories |
324-
| [opencli-plugin-hot-digest](https://github.com/ByteYue/opencli-plugin-hot-digest) | TS | Multi-platform trending aggregator |
325-
| [opencli-plugin-juejin](https://github.com/Astro-Han/opencli-plugin-juejin) | TS | 稀土掘金 (Juejin) hot articles |
326-
| [opencli-plugin-vk](https://github.com/flobo3/opencli-plugin-vk) | TS | VK (VKontakte) wall, feed, and search |
323+
| [opencli-plugin-github-trending](https://github.com/ByteYue/opencli-plugin-github-trending) | JS | GitHub Trending repositories |
324+
| [opencli-plugin-hot-digest](https://github.com/ByteYue/opencli-plugin-hot-digest) | JS | Multi-platform trending aggregator |
325+
| [opencli-plugin-juejin](https://github.com/Astro-Han/opencli-plugin-juejin) | JS | 稀土掘金 (Juejin) hot articles |
326+
| [opencli-plugin-vk](https://github.com/flobo3/opencli-plugin-vk) | JS | VK (VKontakte) wall, feed, and search |
327327

328328
See [Plugins Guide](./docs/guide/plugins.md) for creating your own plugin.
329329

@@ -335,7 +335,7 @@ See [Plugins Guide](./docs/guide/plugins.md) for creating your own plugin.
335335
336336
```bash
337337
opencli explore https://example.com --site mysite # Discover APIs + capabilities
338-
opencli synthesize mysite # Generate TS adapters
338+
opencli synthesize mysite # Generate JS adapters
339339
opencli generate https://example.com --goal "hot" # One-shot: explore → synthesize → register
340340
opencli cascade https://api.example.com/data # Auto-probe: PUBLIC → COOKIE → HEADER
341341
```

README.zh-CN.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ esac
407407

408408
## 插件
409409

410-
通过社区贡献的插件扩展 OpenCLI。插件使用与内置命令相同的 YAML/TS 格式,启动时自动发现。
410+
通过社区贡献的插件扩展 OpenCLI。插件使用与内置命令相同的 JS 格式,启动时自动发现。
411411

412412
```bash
413413
opencli plugin install github:user/opencli-plugin-my-tool # 安装
@@ -421,9 +421,10 @@ opencli plugin uninstall my-tool # 卸载
421421

422422
| 插件 | 类型 | 描述 |
423423
|------|------|------|
424-
| [opencli-plugin-github-trending](https://github.com/ByteYue/opencli-plugin-github-trending) | YAML | GitHub Trending 仓库 |
425-
| [opencli-plugin-hot-digest](https://github.com/ByteYue/opencli-plugin-hot-digest) | TS | 多平台热榜聚合 |
426-
| [opencli-plugin-juejin](https://github.com/Astro-Han/opencli-plugin-juejin) | YAML | 稀土掘金热门文章 |
424+
| [opencli-plugin-github-trending](https://github.com/ByteYue/opencli-plugin-github-trending) | JS | GitHub Trending 仓库 |
425+
| [opencli-plugin-hot-digest](https://github.com/ByteYue/opencli-plugin-hot-digest) | JS | 多平台热榜聚合 |
426+
| [opencli-plugin-juejin](https://github.com/Astro-Han/opencli-plugin-juejin) | JS | 稀土掘金热门文章 |
427+
| [opencli-plugin-vk](https://github.com/flobo3/opencli-plugin-vk) | JS | VK (VKontakte) 动态、信息流和搜索 |
427428

428429
详见 [插件指南](./docs/zh/guide/plugins.md) 了解如何创建自己的插件。
429430

docs/guide/electron-app-cli.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ export OPENCLI_CDP_ENDPOINT="http://127.0.0.1:9222"
4848

4949
For a new Electron adapter, implement these commands first in `clis/<app>/`:
5050

51-
- `status.ts` — verify the app is reachable through CDP
52-
- `dump.ts` — inspect DOM and snapshot structure before guessing selectors
53-
- `read.ts` — extract the visible context you actually need
54-
- `send.ts` — inject text and submit through the real editor
55-
- `new.ts` — create a new session, tab, thread, or document
51+
- `status.js` — verify the app is reachable through CDP
52+
- `dump.js` — inspect DOM and snapshot structure before guessing selectors
53+
- `read.js` — extract the visible context you actually need
54+
- `send.js` — inject text and submit through the real editor
55+
- `new.js` — create a new session, tab, thread, or document
5656

5757
This is the standard baseline because it gives you:
5858
- a connection check
@@ -122,15 +122,15 @@ await page.wait(1);
122122

123123
## Where to put files
124124

125-
For a TypeScript desktop adapter, the usual layout is:
125+
For a desktop adapter, the usual layout is:
126126

127127
```text
128-
clis/<app>/status.ts
129-
clis/<app>/dump.ts
130-
clis/<app>/read.ts
131-
clis/<app>/send.ts
132-
clis/<app>/new.ts
133-
clis/<app>/utils.ts
128+
clis/<app>/status.js
129+
clis/<app>/dump.js
130+
clis/<app>/read.js
131+
clis/<app>/send.js
132+
clis/<app>/new.js
133+
clis/<app>/utils.js
134134
```
135135

136136
If the app grows beyond the baseline, add higher-level commands such as:

docs/zh/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ features:
2525
details: explore 发现 API,synthesize 生成适配器,cascade 查找认证策略。为 AI 优先工作流而生。
2626
- icon:
2727
title: 双引擎架构
28-
details: 同时支持 YAML 声明式数据管道和强大的浏览器运行时 TypeScript 注入。
28+
details: 同时支持声明式数据管道和强大的浏览器运行时 JavaScript 注入。
2929
---

skills/opencli-autofix/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ This outputs a `RepairContext` JSON between `___OPENCLI_DIAGNOSTIC___` markers i
6969
"adapter": {
7070
"site": "example",
7171
"command": "example/search",
72-
"sourcePath": "/path/to/clis/example/search.ts",
72+
"sourcePath": "/path/to/clis/example/search.js",
7373
"source": "// full adapter source code"
7474
},
7575
"page": {

skills/opencli-explorer/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ opencli browser network
6969
opencli browser network --detail 0
7070
# 确认数据结构:{ code: 0, data: { total: 1342, list: [{mid, uname, ...}] } }
7171
opencli browser eval "fetch('/x/relation/followings?vmid=137702077&pn=1&ps=5', {credentials:'include'}).then(r=>r.json())"
72-
# → 有数据,结论:Tier 2 Cookie,写 following.ts
72+
# → 有数据,结论:Tier 2 Cookie,写 following.js
7373
```
7474

7575
---

skills/opencli-explorer/references/adapter-templates.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ localStorage 有 token + Bearer header 能拿到? → Tier 2.5: localStorage
2020
## Tier 1 — 公开 API
2121

2222
```typescript
23-
// clis/v2ex/hot.ts
23+
// clis/v2ex/hot.js
2424
import { cli, Strategy } from '@jackwener/opencli/registry';
2525

2626
cli({
@@ -51,7 +51,7 @@ cli({
5151
## Tier 2 — Cookie 认证(最常用)
5252

5353
```typescript
54-
// clis/zhihu/hot.ts
54+
// clis/zhihu/hot.js
5555
import { cli, Strategy } from '@jackwener/opencli/registry';
5656

5757
cli({
@@ -100,7 +100,7 @@ cli({
100100
适用于 JWT 存 `localStorage`、API 在独立 domain(如 `api.xxx.com`)的 SaaS:
101101

102102
```typescript
103-
// clis/slock/channels.ts
103+
// clis/slock/channels.js
104104
import { cli, Strategy } from '@jackwener/opencli/registry';
105105
import { AuthRequiredError } from '@jackwener/opencli/errors';
106106

@@ -155,7 +155,7 @@ cli({
155155
## Tier 3 — Header 认证(Twitter GraphQL)
156156

157157
```typescript
158-
// clis/twitter/lists.ts
158+
// clis/twitter/lists.js
159159
import { cli, Strategy } from '@jackwener/opencli/registry';
160160
import { AuthRequiredError } from '@jackwener/opencli/errors';
161161

@@ -207,7 +207,7 @@ cli({
207207
## Tier 4 — Intercept(Pinia Store 触发)
208208

209209
```typescript
210-
// clis/xiaohongshu/notifications.ts
210+
// clis/xiaohongshu/notifications.js
211211
import { cli, Strategy } from '@jackwener/opencli/registry';
212212

213213
cli({
@@ -262,7 +262,7 @@ cli({
262262
不依赖 Pinia,通用于任何请求有签名的场景:
263263

264264
```typescript
265-
// clis/xiaohongshu/user.ts
265+
// clis/xiaohongshu/user.js
266266
import { cli, Strategy } from '@jackwener/opencli/registry';
267267

268268
cli({
@@ -331,9 +331,9 @@ func: async (page, kwargs) => {
331331
332332
---
333333

334-
## 同站点多 adapter:提取 utils.ts
334+
## 同站点多 adapter:提取 utils.js
335335

336-
同一站点写第二个 adapter 时,如果发现要复制 auth context 解析逻辑,就应该提取 `clis/<site>/utils.ts`
336+
同一站点写第二个 adapter 时,如果发现要复制 auth context 解析逻辑,就应该提取 `clis/<site>/utils.js`
337337

338338
**判断标准**:两个 adapter 里出现了几乎相同的这几行:
339339

@@ -348,7 +348,7 @@ const server = servers.find(s => s.slug === slug) || servers[0];
348348
**正确做法**:提取成 helper,所有 adapter import 复用:
349349

350350
```typescript
351-
// clis/mysite/utils.ts
351+
// clis/mysite/utils.js
352352
export async function getServerContext(slug: string | null): Promise<{ token: string; server: any }> {
353353
const token = localStorage.getItem('mysite_access_token');
354354
if (!token) return { error: 'Not logged in' };
@@ -361,7 +361,7 @@ export async function getServerContext(slug: string | null): Promise<{ token: st
361361
```
362362

363363
```typescript
364-
// clis/mysite/channels.ts — import 复用
364+
// clis/mysite/channels.js — import 复用
365365
import { getServerContext } from './utils.js';
366366

367367
func: async (page, kwargs) => {
@@ -376,7 +376,7 @@ func: async (page, kwargs) => {
376376
}
377377
```
378378

379-
> **现有参考**`clis/bilibili/utils.ts` 里的 `fetchJson` / `apiGet` / `getSelfUid` 是同类实践。
379+
> **现有参考**`clis/bilibili/utils.js` 里的 `fetchJson` / `apiGet` / `getSelfUid` 是同类实践。
380380
> `clis/slock/` 三个 adapter(tasks / members / send)都有重复的 server 解析逻辑,是反例。
381381
382382
---

skills/opencli-explorer/references/advanced-patterns.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ opencli mysite hot -f csv > data.csv # 确认 CSV 可导入
133133

134134
**问题**:Twitter/X 每次部署都会更新 GraphQL queryId,硬编码很快失效。
135135

136-
**方案**:优先从 JS bundle 动态扫描,用 `operationName`(稳定)查 `queryId`(易变)。参考 `clis/twitter/shared.ts`
136+
**方案**:优先从 JS bundle 动态扫描,用 `operationName`(稳定)查 `queryId`(易变)。参考 `clis/twitter/shared.js`
137137

138138
```typescript
139139
const resolved = await page.evaluate(`async () => {
@@ -165,7 +165,7 @@ const resolved = await page.evaluate(`async () => {
165165

166166
**问题**:CSS class 随前端重构随时变化。
167167

168-
**方案**:按语义元素优先级逐级降级,只在最后才用 class hint。参考 `clis/web/read.ts`
168+
**方案**:按语义元素优先级逐级降级,只在最后才用 class hint。参考 `clis/web/read.js`
169169

170170
```typescript
171171
// 优先级 1: <article>(标准语义)
@@ -198,7 +198,7 @@ if (!contentEl) {
198198

199199
**问题**:UI 迭代频繁,同一个输入框的选择器在新版本可能完全不同。
200200

201-
**方案**:把选择器按优先级列成有序数组,注释变更日期和观察依据。参考 `clis/xiaohongshu/publish.ts`
201+
**方案**:把选择器按优先级列成有序数组,注释变更日期和观察依据。参考 `clis/xiaohongshu/publish.js`
202202

203203
```typescript
204204
// New creator center (2026-03) uses contenteditable for the title field.
@@ -222,7 +222,7 @@ for (const sel of TITLE_SELECTORS) {
222222

223223
**问题**:后端 API 经常在驼峰/蛇形之间切换,或加入新字段名兼容旧客户端。
224224

225-
**方案**:用 nullish coalescing 链覆盖所有可能字段名。参考 `clis/xiaohongshu/user-helpers.ts`
225+
**方案**:用 nullish coalescing 链覆盖所有可能字段名。参考 `clis/xiaohongshu/user-helpers.js`
226226

227227
```typescript
228228
// noteId 可能是 noteId / note_id / id,都要覆盖

skills/opencli-explorer/references/record-workflow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ ls .opencli/record/<site>/candidates/ # 候选 TS
7676
// })()
7777
```
7878

79-
**转换为 TS CLI**(参考 `clis/tae/add-expense.ts` 风格):
79+
**转换为 JS CLI**(参考 `clis/tae/add-expense.js` 风格):
8080

8181
```typescript
8282
import { cli, Strategy } from '@jackwener/opencli/registry';

skills/opencli-oneshot/SKILL.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ localStorage 有 token + Bearer header 能拿到? → Tier 2.5: localStorage
119119

120120
## 模板
121121

122-
### TS — Cookie/Public(最简,`func()` 模式)
122+
### JS — Cookie/Public(最简,`func()` 模式)
123123

124-
```typescript
125-
// clis/<site>/<name>.ts
124+
```javascript
125+
// clis/<site>/<name>.js
126126
import { cli, Strategy } from '@jackwener/opencli/registry';
127127

128128
cli({
@@ -155,10 +155,10 @@ cli({
155155
});
156156
```
157157

158-
### TS — localStorage Bearer(现代 SaaS)
158+
### JS — localStorage Bearer(现代 SaaS)
159159

160-
```typescript
161-
// clis/<site>/<name>.ts
160+
```javascript
161+
// clis/<site>/<name>.js
162162
import { cli, Strategy } from '@jackwener/opencli/registry';
163163

164164
cli({
@@ -195,10 +195,10 @@ cli({
195195
});
196196
```
197197

198-
### TS — Intercept(抓包模式)
198+
### JS — Intercept(抓包模式)
199199

200-
```typescript
201-
// clis/<site>/<name>.ts
200+
```javascript
201+
// clis/<site>/<name>.js
202202
import { cli, Strategy } from '@jackwener/opencli/registry';
203203

204204
cli({
@@ -288,8 +288,8 @@ cli({
288288
289289
<!-- keep in sync with explorer SKILL.md §Step4 -->
290290
> **两种开发场景**:
291-
> - **Repo 贡献**:文件放 `clis/<site>/<name>.ts``npm run build` 后自动注册
292-
> - **私人 adapter**(本地使用,无需提 PR):文件放 `~/.opencli/clis/<site>/<name>.ts`,无需 build
291+
> - **Repo 贡献**:文件放 `clis/<site>/<name>.js``npm run build` 后自动注册
292+
> - **私人 adapter**(本地使用,无需提 PR):文件放 `~/.opencli/clis/<site>/<name>.js`,无需 build
293293
294294
```bash
295295
# Repo 贡献:build 后直接运行

0 commit comments

Comments
 (0)