mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
Add benchmark results and tests for LSP graph builder and staged search
- Introduced a new benchmark results file for performance comparison on 2026-02-09. - Added a test for LspGraphBuilder to ensure it does not expand nodes at maximum depth. - Created a test for the staged search pipeline to validate fallback behavior when stage 1 returns empty results.
This commit is contained in:
39
ccw/src/core/services/cli-session-audit.ts
Normal file
39
ccw/src/core/services/cli-session-audit.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { existsSync, mkdirSync, appendFileSync } from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
export type CliSessionAuditEventType =
|
||||
| 'session_created'
|
||||
| 'session_closed'
|
||||
| 'session_send'
|
||||
| 'session_execute'
|
||||
| 'session_resize'
|
||||
| 'session_share_created'
|
||||
| 'session_idle_reaped';
|
||||
|
||||
export interface CliSessionAuditEvent {
|
||||
type: CliSessionAuditEventType;
|
||||
timestamp: string;
|
||||
projectRoot: string;
|
||||
sessionKey?: string;
|
||||
tool?: string;
|
||||
resumeKey?: string;
|
||||
workingDir?: string;
|
||||
ip?: string;
|
||||
userAgent?: string;
|
||||
details?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
function auditFilePath(projectRoot: string): string {
|
||||
return path.join(projectRoot, '.workflow', 'audit', 'cli-sessions.jsonl');
|
||||
}
|
||||
|
||||
export function appendCliSessionAudit(event: CliSessionAuditEvent): void {
|
||||
try {
|
||||
const filePath = auditFilePath(event.projectRoot);
|
||||
const dir = path.dirname(filePath);
|
||||
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
||||
appendFileSync(filePath, JSON.stringify(event) + '\n', { encoding: 'utf8' });
|
||||
} catch {
|
||||
// Best-effort: never fail API requests due to audit write errors.
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user