feat: copilot cli#167
Conversation
- Reads VS Code sessions from ~/.copilot/session-state/<uuid>/ - Reads JetBrains sessions from ~/.copilot/jb/<uuid>/partition-1.jsonl - Parses workspace.yaml (flat + block scalar) for metadata - Active detection via inuse.<pid>.lock files - Wires into loadSessions(), loadSessionDetail(), findSessionFile() - Cache invalidation via COPILOT_SESSION_DIR mtime tracking - Badge: .badge-copilot and .tool-copilot styles - Detail: 'Open in VS Code' button instead of Focus Terminal - Adds openInVSCode() frontend function + vscode IDE handler Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…assistant turns Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Добавляет поддержку GitHub Copilot CLI как нового источника сессий (сканирование/детали), а также UI-элементы для фильтрации и установки агента в веб-дашборде.
Changes:
- Добавлен сбор сессий Copilot CLI из файловых директорий и парсинг JSONL для детального просмотра.
- Расширен UI: новый фильтр “Copilot CLI”, стили для бейджей/инструмента, кнопка установки агента.
- Добавлена поддержка
ide=vscodeв/api/open-ideи функция открытия проекта в VS Code.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/server.js | Поддержка vscode как алиаса для открытия через code |
| src/data.js | Сканирование Copilot сессий (VS Code/JetBrains), загрузка деталей, подключение к общему реестру сессий |
| src/frontend/index.html | Новый пункт навигации “Copilot CLI” и пункт установки агента |
| src/frontend/calendar.js | Фильтр вида copilot-only |
| src/frontend/detail.js | Кнопка “Open in VS Code” для сессий Copilot |
| src/frontend/app.js | openInVSCode() и информация для установки Copilot CLI |
| src/frontend/styles.css | Стили для Copilot бейджей/инструмента |
| package.json | Bump версии |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (fs.existsSync(COPILOT_SESSION_DIR)) { | ||
| const st = fs.statSync(COPILOT_SESSION_DIR); | ||
| if (st.mtimeMs !== _copilotDirMtime) return true; | ||
| } |
| sessions.push({ | ||
| id: uuid, | ||
| tool: 'copilot', | ||
| project: cwd, | ||
| project_short: cwd.replace(homedir, '~'), | ||
| first_ts: yaml.created_at ? Date.parse(yaml.created_at) : stat.ctimeMs, | ||
| last_ts: yaml.updated_at ? Date.parse(yaml.updated_at) : stat.mtimeMs, |
| infoHtml += '<button class="launch-btn" style="background:#4a9eff" onclick="openInCursor(\'' + escHtml(s.project || '') + '\')">Open in Cursor</button>'; | ||
| } else if (s.tool === 'copilot') { | ||
| infoHtml += '<button class="launch-btn" style="background:#1f6feb" onclick="openInVSCode(\'' + escHtml(s.project || '') + '\')">Open in VS Code</button>'; | ||
| } else if (activeSessions[s.id]) { |
| const CLAUDE_DIR = path.join(ALL_HOMES[0], '.claude'); | ||
| const CODEX_DIR = path.join(ALL_HOMES[0], '.codex'); | ||
| const OPENCODE_DB = path.join(ALL_HOMES[0], '.local', 'share', 'opencode', 'opencode.db'); | ||
| const KIRO_DB = path.join(ALL_HOMES[0], 'Library', 'Application Support', 'kiro-cli', 'data.sqlite3'); | ||
| const COPILOT_SESSION_DIR = path.join(ALL_HOMES[0], '.copilot', 'session-state'); | ||
| const COPILOT_JB_DIR = path.join(ALL_HOMES[0], '.copilot', 'jb'); | ||
| const CURSOR_DIR = path.join(ALL_HOMES[0], '.cursor'); |
| // Try Copilot CLI (JetBrains) | ||
| try { | ||
| const jbUuids = fs.readdirSync(COPILOT_JB_DIR); | ||
| for (const uuid of jbUuids) { | ||
| const p = path.join(COPILOT_JB_DIR, uuid, 'partition-1.jsonl'); | ||
| if (fs.existsSync(p)) { | ||
| const text = fs.readFileSync(p, 'utf8'); | ||
| for (const line of text.split('\n')) { | ||
| if (!line.trim()) continue; | ||
| try { | ||
| const ev = JSON.parse(line); | ||
| if (ev.type === 'partition.created' && ev.data && ev.data.conversationId === sessionId) { | ||
| return { file: p, format: 'copilot', sessionId: sessionId }; | ||
| } | ||
| } catch {} | ||
| } | ||
| } | ||
| } | ||
| } catch {} |
…opilot CLI PR vakovalskii#167 adds Copilot CLI support with tool: 'copilot'. Our implementation covers Copilot Chat (VS Code extension) — a different agent with different storage format. Rename to 'copilot-chat' so both can coexist.
|
Conflicts with latest main. Please rebase. Note: #171 (Copilot Chat) may overlap — coordinate? |
|
Still conflicts. Please rebase on latest main. |
|
Sorry for a late response. I'll try to fix it today (late night) |
…opilot CLI PR vakovalskii#167 adds Copilot CLI support with tool: 'copilot'. Our implementation covers Copilot Chat (VS Code extension) — a different agent with different storage format. Rename to 'copilot-chat' so both can coexist.
…opilot CLI PR vakovalskii#167 adds Copilot CLI support with tool: 'copilot'. Our implementation covers Copilot Chat (VS Code extension) — a different agent with different storage format. Rename to 'copilot-chat' so both can coexist.
NovakPAai
left a comment
There was a problem hiding this comment.
Code Review
🔴 Merge conflict — PR has conflicts with main and needs a rebase before it can be merged.
parseWorkspaceYaml in src/data.js):
The custom YAML parser only handles simple key: value lines and basic block scalars (|-). It will silently produce wrong results for quoted strings, colons in values, multi-line arrays, or nested objects. Since this is used to read workspace.yaml (which contains user-controlled path strings), a path like cwd: /home/user/project: name would be parsed incorrectly.
Suggestion: either narrow the parser to only extract the specific fields you need via regex, or use a proper YAML library.
catch {} appears ~15 times with no logging. When something goes wrong during a Copilot session scan, there's no way to tell why sessions are missing. At minimum, add a debug-level log (e.g. check for DEBUG env var) so issues are diagnosable.
uuid.length !== 36 will pass for any 36-char string. Use a UUID regex: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.
ℹ️ Note: PR #171 also adds Copilot Chat support (VS Code extension, different storage path). Once conflicts are resolved, coordination with #171's author is needed to avoid duplicating the tool: 'copilot' identifier.
…opilot CLI PR vakovalskii#167 adds Copilot CLI support with tool: 'copilot'. Our implementation covers Copilot Chat (VS Code extension) — a different agent with different storage format. Rename to 'copilot-chat' so both can coexist.
* feat: add GitHub Copilot session discovery and detail loading Scan VS Code workspaceStorage for Copilot Chat sessions (JSON and JSONL mutation format). Includes workspace-to-project mapping with disk cache, targeted JSONL replay for request/response extraction, and integration into loadSessions/findSessionFile/loadSessionDetail/computeSessionCost. * feat: add Copilot to frontend — sidebar, filter, analytics, styles Add sidebar item with copilot-only filter, .tool-copilot CSS class, calendar filter toggle, analytics label, heatmap color, and AGENT_INSTALL entry for GitHub Copilot. * docs: add Copilot to supported agents documentation Update agent counts and tables in README.md, CLAUDE.md, ARCHITECTURE.md, README_RU.md, and README_ZH.md. Add Copilot storage section to ARCHITECTURE.md with session format details. * perf: optimize Copilot session scan and detail loading - Skip irrelevant JSONL lines (inputState, attachments) before JSON.parse - Add disk cache for parsed Copilot session metadata - Use peek-based extraction for large JSON files (>1MB) - Cold scan: 46s -> 5s, warm scan: 120ms, detail 232MB: 1.1s * fix: add Copilot format handling to daily stats breakdown _computeSessionDailyBreakdown now uses parseCopilotJsonl/parseCopilotJson for Copilot sessions instead of generic line-by-line JSONL scan that would read entire multi-hundred-MB files without extracting any data. Fixes leaderboard hanging on projects with large Copilot sessions. * refactor: rename tool copilot → copilot-chat to avoid conflict with Copilot CLI PR #167 adds Copilot CLI support with tool: 'copilot'. Our implementation covers Copilot Chat (VS Code extension) — a different agent with different storage format. Rename to 'copilot-chat' so both can coexist. * fix: address PR #171 review feedback - README.md: replace Linux-only Copilot Chat path with cross-platform notation - src/data.js: invalidate workspace map cache when VSCODE_WORKSPACE_STORAGE mtime changes, not just on 10-min TTL expiry — catches new workspaces created within TTL window - docs/ARCHITECTURE.md: update stale tool name "copilot" → "copilot-chat" --------- Co-authored-by: Максим Рябов <m.riabov@itexpert.ru>

Добавляет поддержку GitHub Copilot CLI как 6-го агента.