refactor: codebase audit cleanup — dead code, dedup, module splits

Multi-agent audit + aggressive cleanup across server/web/coder/booterm,
delivered behind a DEFER discipline so none of the in-flight files were
touched. Removes dead code/deps/columns, dedups server + coder helpers,
and splits the oversized modules (tools.ts, opencode-server.ts,
sentinel-summaries, turn.ts, TerminalPane.tsx) behind stable contracts.
Adds 78 parity/unit tests (server 587, coder 323); fixes two latent bugs
(ChatPane queue keys, FileViewerOverlay blank-line parity).

Intended tag: v2.7.12-audit-cleanup.
This commit is contained in:
2026-06-02 21:10:06 +00:00
parent 6560398285
commit abe1a311d0
143 changed files with 6729 additions and 6087 deletions

View File

@@ -0,0 +1,32 @@
import { describe, expect, it } from 'vitest';
import { stripQuotes } from '../string-utils.js';
describe('stripQuotes', () => {
it('strips matching double quotes', () => {
expect(stripQuotes('"hello"')).toBe('hello');
});
it('strips matching single quotes', () => {
expect(stripQuotes("'world'")).toBe('world');
});
it('leaves unquoted strings unchanged', () => {
expect(stripQuotes('no quotes')).toBe('no quotes');
});
it('leaves mismatched quotes unchanged', () => {
expect(stripQuotes('"mismatched\'')).toBe('"mismatched\'');
});
it('leaves a single-char string unchanged', () => {
expect(stripQuotes('"')).toBe('"');
});
it('handles empty string', () => {
expect(stripQuotes('')).toBe('');
});
it('strips quotes around a value with spaces', () => {
expect(stripQuotes('"a description with spaces"')).toBe('a description with spaces');
});
});

View File

@@ -0,0 +1,9 @@
// Strips a matching pair of leading/trailing single or double quotes from a
// YAML value string produced by the minimal frontmatter parsers in agents.ts
// and skills.ts. Returns the string unchanged when no matching pair is found.
export function stripQuotes(s: string): string {
if (s.length >= 2 && (s[0] === '"' || s[0] === "'") && s[0] === s[s.length - 1]) {
return s.slice(1, -1);
}
return s;
}