Skip to content

feat: copilot cli#167

Closed
ABIvan-Tech wants to merge 4 commits intovakovalskii:mainfrom
ABIvan-Tech:feat/copilot-cli-agent
Closed

feat: copilot cli#167
ABIvan-Tech wants to merge 4 commits intovakovalskii:mainfrom
ABIvan-Tech:feat/copilot-cli-agent

Conversation

@ABIvan-Tech
Copy link
Copy Markdown

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

ABIvan-Tech and others added 3 commits April 10, 2026 18:39
- 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>
Copilot AI review requested due to automatic review settings April 10, 2026 16:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/data.js
Comment on lines +1472 to +1475
if (fs.existsSync(COPILOT_SESSION_DIR)) {
const st = fs.statSync(COPILOT_SESSION_DIR);
if (st.mtimeMs !== _copilotDirMtime) return true;
}
Comment thread src/data.js
Comment on lines +564 to +570
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,
Comment thread src/frontend/detail.js
Comment on lines 69 to 72
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]) {
Comment thread src/data.js
Comment on lines 41 to 47
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');
Comment thread src/data.js
Comment on lines +2262 to +2280
// 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 {}
@ABIvan-Tech
Copy link
Copy Markdown
Author

ABIvan-Tech commented Apr 10, 2026

image

MaxRyabov pushed a commit to MaxRyabov/codedash that referenced this pull request Apr 10, 2026
…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.
@vakovalskii
Copy link
Copy Markdown
Owner

Conflicts with latest main. Please rebase. Note: #171 (Copilot Chat) may overlap — coordinate?

@vakovalskii
Copy link
Copy Markdown
Owner

Still conflicts. Please rebase on latest main.

@ABIvan-Tech
Copy link
Copy Markdown
Author

Sorry for a late response. I'll try to fix it today (late night)

MaxRyabov pushed a commit to MaxRyabov/codedash that referenced this pull request Apr 17, 2026
…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.
MaxRyabov pushed a commit to MaxRyabov/codedash that referenced this pull request Apr 17, 2026
…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.
Copy link
Copy Markdown
Collaborator

@NovakPAai NovakPAai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

🔴 Merge conflict — PR has conflicts with main and needs a rebase before it can be merged.

⚠️ Hand-rolled YAML parser is fragile (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.

⚠️ Broad silent error swallowingcatch {} 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 check is too looseuuid.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.

@vakovalskii
Copy link
Copy Markdown
Owner

Thanks for the contribution! Closing — GitHub Copilot coverage is being added via #171 (Copilot Chat / VS Code), which has the larger user base. This branch also has conflicts with main. If you'd like to add CLI-specific support on top after #171 lands, happy to look at a fresh PR.

MaxRyabov pushed a commit to MaxRyabov/codedash that referenced this pull request Apr 21, 2026
…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.
vakovalskii pushed a commit that referenced this pull request Apr 21, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants