From f7130c34372d512d655e5080d367d7def4a1f893 Mon Sep 17 00:00:00 2001 From: iliya Date: Sat, 7 Mar 2026 19:37:59 +0200 Subject: [PATCH] chore: update package scripts and improve CI workflow - Enhanced package.json scripts by adding a new linting command for the MCP workspace and updating the check script to include MCP linting. - Modified CI workflow to replace individual typecheck and lint steps with a consolidated validation step for improved efficiency. - Introduced a new TypeScript configuration for testing in the MCP server, enhancing type checking capabilities. - Reorganized imports in several components for better clarity and maintainability. --- .github/workflows/ci.yml | 10 ++-------- mcp-server/package.json | 2 ++ mcp-server/tsconfig.test.json | 10 ++++++++++ package.json | 5 +++-- .../components/sidebar/GlobalTaskList.tsx | 2 +- .../components/team/activity/ActivityItem.tsx | 2 +- .../team/dialogs/AdvancedCliSection.tsx | 18 ++++++++++++------ 7 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 mcp-server/tsconfig.test.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ad0b160..9ba3cdbf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,14 +62,8 @@ jobs: restore-keys: | eslint-${{ runner.os }}- - - name: Typecheck - run: pnpm typecheck:workspace - - - name: Lint - run: pnpm lint - - - name: Build - run: pnpm build:workspace + - name: Validate workspace truth gate + run: pnpm check test: strategy: diff --git a/mcp-server/package.json b/mcp-server/package.json index bdd2482e..65912e27 100644 --- a/mcp-server/package.json +++ b/mcp-server/package.json @@ -27,9 +27,11 @@ "scripts": { "build": "tsup", "dev": "tsx src/index.ts", + "lint": "eslint \"src/**/*.ts\"", "test": "vitest run", "test:watch": "vitest", "typecheck": "tsc --noEmit", + "typecheck:test": "tsc --noEmit -p tsconfig.test.json", "prepublishOnly": "pnpm build" }, "dependencies": { diff --git a/mcp-server/tsconfig.test.json b/mcp-server/tsconfig.test.json new file mode 100644 index 00000000..4f6ab56b --- /dev/null +++ b/mcp-server/tsconfig.test.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": ".", + "noEmit": true, + "types": ["node", "vitest/globals"] + }, + "include": ["src/**/*.ts", "test/**/*.ts"], + "exclude": ["node_modules", "dist"] +} diff --git a/package.json b/package.json index bb71c7c3..220e89e0 100644 --- a/package.json +++ b/package.json @@ -30,15 +30,16 @@ "dist:linux": "electron-builder --linux", "preview": "electron-vite preview", "typecheck": "tsc --noEmit", - "typecheck:workspace": "pnpm typecheck && pnpm --filter agent-teams-mcp typecheck", + "typecheck:workspace": "pnpm typecheck && pnpm --filter agent-teams-mcp typecheck && pnpm --filter agent-teams-mcp typecheck:test", "lint": "eslint src/ --cache --cache-location .eslintcache --cache-strategy content", + "lint:mcp": "pnpm --filter agent-teams-mcp lint", "lint:fix": "eslint src/ --fix --cache --cache-location .eslintcache --cache-strategy content", "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css}\"", "format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css}\"", "build:workspace": "pnpm build && pnpm --filter agent-teams-controller build && pnpm --filter agent-teams-mcp build", "test:workspace": "pnpm test && pnpm --filter agent-teams-controller test && pnpm --filter agent-teams-mcp test", "check:workspace": "pnpm typecheck:workspace && pnpm test:workspace && pnpm build:workspace", - "check": "pnpm check:workspace && pnpm lint", + "check": "pnpm check:workspace && pnpm lint && pnpm lint:mcp", "fix": "pnpm lint:fix && pnpm format", "quality": "pnpm check && pnpm format:check && npx knip", "test:chunks": "tsx test/test-chunk-building.ts", diff --git a/src/renderer/components/sidebar/GlobalTaskList.tsx b/src/renderer/components/sidebar/GlobalTaskList.tsx index 1e9edc02..38404120 100644 --- a/src/renderer/components/sidebar/GlobalTaskList.tsx +++ b/src/renderer/components/sidebar/GlobalTaskList.tsx @@ -8,13 +8,13 @@ import { cn } from '@renderer/lib/utils'; import { useStore } from '@renderer/store'; import { normalizePath } from '@renderer/utils/pathNormalize'; import { projectColor } from '@renderer/utils/projectColor'; -import { deriveTaskDisplayId } from '@shared/utils/taskIdentity'; import { getNonEmptyTaskCategories, groupTasksByDate, groupTasksByProject, sortTasksByFreshness, } from '@renderer/utils/taskGrouping'; +import { deriveTaskDisplayId } from '@shared/utils/taskIdentity'; import { Archive, ArrowUpDown, diff --git a/src/renderer/components/team/activity/ActivityItem.tsx b/src/renderer/components/team/activity/ActivityItem.tsx index 698adf60..8cb0b0a3 100644 --- a/src/renderer/components/team/activity/ActivityItem.tsx +++ b/src/renderer/components/team/activity/ActivityItem.tsx @@ -23,9 +23,9 @@ import { } from '@renderer/utils/agentMessageFormatting'; import { formatAgentRole } from '@renderer/utils/formatAgentRole'; import { stripAgentBlocks } from '@shared/constants/agentBlocks'; -import { formatTaskDisplayLabel } from '@shared/utils/taskIdentity'; import { extractMarkdownPlainText } from '@shared/utils/markdownTextSearch'; import { isRateLimitMessage } from '@shared/utils/rateLimitDetector'; +import { formatTaskDisplayLabel } from '@shared/utils/taskIdentity'; import { AlertTriangle, ChevronRight, ListPlus, RefreshCw, Reply } from 'lucide-react'; import { isManagedCollapseState } from './collapseState'; diff --git a/src/renderer/components/team/dialogs/AdvancedCliSection.tsx b/src/renderer/components/team/dialogs/AdvancedCliSection.tsx index de04c5d4..ea42c15f 100644 --- a/src/renderer/components/team/dialogs/AdvancedCliSection.tsx +++ b/src/renderer/components/team/dialogs/AdvancedCliSection.tsx @@ -53,7 +53,13 @@ const TOKEN_COLOR_CLASS: Record = { function readWorktreeHistory(teamName: string): string[] { try { const raw = localStorage.getItem(`team:worktreeHistory:${teamName}`); - return raw ? JSON.parse(raw) : []; + if (!raw) { + return []; + } + const parsed: unknown = JSON.parse(raw); + return Array.isArray(parsed) + ? parsed.filter((item): item is string => typeof item === 'string') + : []; } catch { return []; } @@ -184,7 +190,7 @@ export const AdvancedCliSection: React.FC = ({ {/* Collapsible header */}