Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(help): bug-report URL/env helpers
enes2d788e6ac2a0
diff --git a/src/renderer/lib/bugReport.test.ts b/src/renderer/lib/bugReport.test.tsnew file mode 100644index 000000000..37e5c4042--- /dev/null+++ b/src/renderer/lib/bugReport.test.ts@@ -0,0 +1,82 @@+import { describe, expect, it } from 'vitest'+import {+ BODY_BUDGET,+ buildBugReportUrl,+ describeOs,+ describeSurface,+ envBlock,+ REPO_URL+} from './bugReport'++const ELECTRON_UA =+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) nodeterm/0.2.7 Chrome/120.0.6099.291 Electron/28.2.6 Safari/537.36'+const LINUX_BROWSER_UA =+ 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'+const WINDOWS_BROWSER_UA =+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'++describe('describeSurface', () => {+ it('detects Electron as desktop', () => {+ expect(describeSurface(ELECTRON_UA)).toBe('desktop')+ })+ it('detects a plain browser as server', () => {+ expect(describeSurface(LINUX_BROWSER_UA)).toBe('server')+ })+})++describe('describeOs', () => {+ it('maps user agents to OS names', () => {+ expect(describeOs(ELECTRON_UA)).toBe('macOS')+ expect(describeOs(LINUX_BROWSER_UA)).toBe('Linux')+ expect(describeOs(WINDOWS_BROWSER_UA)).toBe('Windows')+ expect(describeOs('SomethingElse/1.0')).toBe('unknown')+ })+})++describe('envBlock', () => {+ it('includes version, surface, os and electron version on desktop', () => {+ const block = envBlock({ appVersion: '0.2.7', userAgent: ELECTRON_UA })+ expect(block).toContain('nodeterm: v0.2.7')+ expect(block).toContain('surface: desktop')+ expect(block).toContain('os: macOS')+ expect(block).toContain('electron: 28.2.6')+ })+ it('reports unknown version and omits electron on server', () => {+ const block = envBlock({ appVersion: null, userAgent: LINUX_BROWSER_UA })+ expect(block).toContain('nodeterm: unknown')+ expect(block).toContain('surface: server')+ expect(block).not.toContain('electron:')+ })+})++describe('buildBugReportUrl', () => {+ const env = { appVersion: '0.2.7', userAgent: ELECTRON_UA }++ it('builds an issues/new URL with title, body and bug label', () => {+ const { url, truncated } = buildBugReportUrl('Crash on resize', 'Steps here', env)+ expect(truncated).toBe(false)+ const u = new URL(url)+ expect(url.startsWith(`${REPO_URL}/issues/new?`)).toBe(true)+ expect(u.searchParams.get('title')).toBe('Crash on resize')+ expect(u.searchParams.get('labels')).toBe('bug')+ const body = u.searchParams.get('body')!+ expect(body).toContain('Steps here')+ expect(body).toContain('nodeterm: v0.2.7')+ })++ it('truncates an over-budget description with a marker', () => {+ const long = 'x'.repeat(BODY_BUDGET + 500)+ const { url, truncated } = buildBugReportUrl('t', long, env)+ expect(truncated).toBe(true)+ const body = new URL(url).searchParams.get('body')!+ expect(body).toContain('… (truncated)')+ expect(body.length).toBeLessThanOrEqual(BODY_BUDGET)+ // env block must survive truncation+ expect(body).toContain('nodeterm: v0.2.7')+ })++ it('does not mark a short description as truncated', () => {+ const { truncated } = buildBugReportUrl('t', 'short', env)+ expect(truncated).toBe(false)+ })+})diff --git a/src/renderer/lib/bugReport.ts b/src/renderer/lib/bugReport.tsnew file mode 100644index 000000000..66fd9f1b3--- /dev/null+++ b/src/renderer/lib/bugReport.ts@@ -0,0 +1,54 @@+/**+ * Pure helpers for the "Report a bug" flow: compose an environment block and a prefilled+ * GitHub issues/new URL. No backend, no token — the browser opens GitHub and the user+ * submits under their own account (see docs/superpowers/specs/2026-07-14-help-menu-bug-report-design.md).+ */++export const REPO_URL = 'https://github.com/eneskirca/nodeterm'++/** GitHub rejects URLs past ~8 KB; keep the pre-encoding body well under that. */+export const BODY_BUDGET = 6000++export interface BugReportEnv {+ /** null = unknown (the Server Edition bridge has no getVersion handler). */+ appVersion: string | null+ userAgent: string+}++export function describeSurface(userAgent: string): 'desktop' | 'server' {+ return /Electron\//.test(userAgent) ? 'desktop' : 'server'+}++export function describeOs(userAgent: string): string {+ if (/Mac OS X|Macintosh/.test(userAgent)) return 'macOS'+ if (/Windows/.test(userAgent)) return 'Windows'+ if (/Linux|X11/.test(userAgent)) return 'Linux'+ return 'unknown'+}++export function envBlock(env: BugReportEnv): string {+ const lines = [+ `nodeterm: ${env.appVersion ? `v${env.appVersion}` : 'unknown'}`,+ `surface: ${describeSurface(env.userAgent)}`,+ `os: ${describeOs(env.userAgent)}`+ ]+ const electron = env.userAgent.match(/Electron\/([\d.]+)/)+ if (electron) lines.push(`electron: ${electron[1]}`)+ return lines.join('\n')+}++const TRUNCATION_MARKER = '… (truncated)'++export function buildBugReportUrl(+ title: string,+ description: string,+ env: BugReportEnv+): { url: string; truncated: boolean } {+ const footer = `\n\n---\n\`\`\`\n${envBlock(env)}\n\`\`\``+ let desc = description.trim()+ const room = BODY_BUDGET - footer.length+ const truncated = desc.length > room+ if (truncated) desc = desc.slice(0, room - TRUNCATION_MARKER.length - 1) + '\n' + TRUNCATION_MARKER+ const params = new URLSearchParams({ title, body: desc + footer, labels: 'bug' })+ return { url: `${REPO_URL}/issues/new?${params.toString()}`, truncated }+}