Skip to content

Commit e6fca8e

Browse files
author
iammm0
committed
fix(ci): Vitest 用例、passWithNoTests 与 ESLint 清零警告
Made-with: Cursor
1 parent e4722e4 commit e6fca8e

12 files changed

Lines changed: 53 additions & 12 deletions

File tree

eslint.config.mjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import tsparser from '@typescript-eslint/parser';
44
export default [
55
{
66
files: ['server/src/**/*.ts'],
7+
ignores: ['server/src/**/*.spec.ts', 'server/src/**/*.test.ts'],
78
languageOptions: {
89
parser: tsparser,
910
parserOptions: {
@@ -23,6 +24,26 @@ export default [
2324
'no-console': 'off',
2425
},
2526
},
27+
{
28+
files: ['server/src/**/*.spec.ts', 'server/src/**/*.test.ts'],
29+
languageOptions: {
30+
parser: tsparser,
31+
parserOptions: {
32+
sourceType: 'module',
33+
},
34+
},
35+
plugins: {
36+
'@typescript-eslint': tseslint,
37+
},
38+
rules: {
39+
...tseslint.configs.recommended.rules,
40+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
41+
'@typescript-eslint/no-explicit-any': 'warn',
42+
'@typescript-eslint/explicit-function-return-type': 'off',
43+
'@typescript-eslint/no-floating-promises': 'off',
44+
'no-console': 'off',
45+
},
46+
},
2647
{
2748
ignores: [
2849
'node_modules/',

server/src/main.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ async function bootstrap() {
2626

2727
const port = process.env.PORT ? Number(process.env.PORT) : 8000;
2828
await app.listen(port);
29-
// eslint-disable-next-line no-console
3029
console.log(`Secbot backend listening on http://localhost:${port}`);
3130
}
3231

3332
bootstrap().catch((error) => {
34-
// eslint-disable-next-line no-console
3533
console.error('Failed to bootstrap NestJS application', error);
3634
process.exit(1);
3735
});

server/src/modules/agents/core/planner-agent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class PlannerAgent extends BaseAgent {
7272
while (remaining.size > 0) {
7373
const currentLayer: TodoItem[] = [];
7474

75-
for (const [id, todo] of remaining) {
75+
for (const [, todo] of remaining) {
7676
const depsResolved = todo.dependsOn.every(
7777
(dep) => completed.has(dep) || !remaining.has(dep),
7878
);

server/src/modules/agents/core/security-react-agent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { BaseAgent, AgentMessage } from './base-agent';
22
import { BaseTool, ToolResult } from '../../tools/core/base-tool';
3-
import { EventBus, EventType, BusEvent } from '../../../common/event-bus';
3+
import { EventType, BusEvent } from '../../../common/event-bus';
44
import { ChatMessage } from '../../../common/types';
5-
import { LLMProvider, createLLM, LLMConfig } from '../../../common/llm';
5+
import { LLMProvider, createLLM } from '../../../common/llm';
66
import { TodoItem } from '../../../common/types';
77
import { validateToolInvocation } from './tool-action-validate';
88
import { formatExecuteCommandObservation } from './observation-format';

server/src/modules/agents/core/task-executor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { PlannerAgent } from './planner-agent';
33
import { EventBus, EventType, BusEvent } from '../../../common/event-bus';
44
import {
55
PlanResult,
6-
TodoItem,
76
TodoStatus,
87
markTodoInProgress,
98
markTodoCompleted,

server/src/modules/chat/chat.service.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import {
55
RouteType,
66
Session,
77
createSession,
8-
addSessionMessage,
9-
MessageRole,
108
TodoItem,
119
InteractionSummary,
1210
} from '../../common/types';

server/src/modules/crawler/dto/crawler.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IsBoolean, IsInt, IsOptional, IsString, Max, Min } from 'class-validator';
1+
import { IsInt, IsOptional, IsString, Max, Min } from 'class-validator';
22

33
export class CreateCrawlTaskRequestDto {
44
@IsString()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { describe, expect, it } from 'vitest';
2+
import { shellProfile, validateCommandAgainstShell } from './shell-command-guard';
3+
4+
describe('validateCommandAgainstShell', () => {
5+
it('flags cmdlet-style command in cmd profile', () => {
6+
const profile = shellProfile('cmd', 'cmd.exe');
7+
expect(validateCommandAgainstShell('Get-ChildItem', profile)).toContain('PowerShell');
8+
});
9+
10+
it('allows plain cmd usage', () => {
11+
const profile = shellProfile('cmd', 'cmd.exe');
12+
expect(validateCommandAgainstShell('dir /b', profile)).toBeNull();
13+
});
14+
15+
it('flags findstr in posix profile', () => {
16+
const profile = shellProfile('posix', 'bash');
17+
expect(validateCommandAgainstShell('findstr /i foo bar.txt', profile)).toContain('cmd');
18+
});
19+
20+
it('allows posix commands', () => {
21+
const profile = shellProfile('posix', 'bash');
22+
expect(validateCommandAgainstShell('grep -R pattern .', profile)).toBeNull();
23+
});
24+
});

server/src/modules/tools/security/exploit.tool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { spawn } from 'node:child_process';
2-
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
2+
import { mkdtemp, rm, writeFile } from 'node:fs/promises';
33
import { tmpdir } from 'node:os';
44
import { join } from 'node:path';
55
import { BaseTool, ToolResult } from '../core/base-tool';

server/src/modules/tools/web-research/smart-search.tool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createLLM } from '../../../common/llm';
22
import { BaseTool, ToolResult } from '../core/base-tool';
3-
import { cleanHtmlToText, extractLinks, extractTitle } from './html-utils';
3+
import { cleanHtmlToText } from './html-utils';
44

55
type SearchResult = {
66
title: string;

0 commit comments

Comments
 (0)