Skip to main content

add-agent-source

Use when adding support for a new coding agent/CLI as a Fleetlens session source (e.g. OpenCode) — the parser adapter, source registry, display metadata, tests, and optional usage poller. This is the canonical community extension task.

跳到安装

来源信息

仓库
cowcow02/fleetlens
最近来源活动
2026年7月15日 04:51
检测到的 SKILL.md 语言
英语
星标
4
分支
1

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
add-agent-source
description
Use when adding support for a new coding agent/CLI as a Fleetlens session source (e.g. OpenCode) — the parser adapter, source registry, display metadata, tests, and optional usage poller. This is the canonical community extension task.
# Add a new agent source ## Shape of the task A source is (1) a pure parser adapter that turns one line/record of the agent's on-disk transcript format into a `SessionEvent`, (2) a registry entry telling the filesystem scanner where transcripts live, and (3) a metadata entry for how the agent is displayed. Everything downstream (sessions list, analytics, concurrency, projects, dashboard) works automatically once events are normalized. ## Steps 1. **Study the nearest existing adapter** in `packages/parser/src/`: `codex.ts` (rollout-file style), `gemini.ts` (chat-file style), `grok.ts`, `antigravity.ts`, `cowork.ts`. Pick whichever on-disk format is closest to the new agent's. `claude-code.ts` is the richest reference for what a fully-populated `SessionEvent` looks like (`types.ts` has the type). 2. **Write `packages/parser/src/<agent>.ts`** — pure TypeScript, no `fs`, no network (the parser package is browser-safe; all filesystem access lives in `fs.ts`). Map timestamps, roles, tool calls, token usage, model names, and `cwd` faithfully; `cwd` drives project identity. If the agent spawns subagents, emit `session_kind: "subagent"` so those sessions attach under their parent instead of flooding the sessions list. 3. **Register the source** in `packages/parser/src/fs.ts` — add to the `agentSources` array (transcript root, e.g. `~/.<agent>/sessions`, plus discovery/parse hooks following the existing entries). 4. **Add display metadata** in `packages/parser/src/agent-metadata.ts` (id, display name, badge mark, color) — this is what the dashboard, filters, and usage badges render. 5. **Tests** in `packages/parser/test/` mirroring the existing per-source suites. Fixtures MUST be fictional — invent paths, project names, and prompts (`orbit-shop` house style). Never paste real transcript lines containing employer/customer names; a privacy scrub of leaked fixture data cost this repo a full audit round. 6. **Verify end-to-end**: `pnpm -F @claude-lens/parser test`, then the `dev-loop` skill — confirm the source appears in `/sessions?agent=<id>`, overview counts, and a session detail page renders from a real local transcript if you have one. 7. **Docs**: add the source to the "Supported local sources" table in `site/reference.html` and a CHANGELOG entry (release gate requires it). ## Usage polling is separate Plan-utilization polling (the `/usage` page, menu bar) is not part of the parser. Only add it if the provider exposes a quota API: poller in `packages/cli/src/usage/` (see `codex.ts`, `grok.ts`, `zai.ts` there), wired into the daemon. A transcript source without usage polling is a complete, shippable contribution.
在 GitHub 查看