refactor: reorganize codebase — move browse CLI to browse/ directory

Restructure project layout: src/ → browse/src/, test/ → browse/test/. Add snapshot testing. Update docs, package.json, and skills integration. Add setup script and TODO tracking.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-11 19:27:43 -07:00
parent bfa6102679
commit e9fbb664f8
29 changed files with 888 additions and 130 deletions

37
browse/src/buffers.ts Normal file
View File

@@ -0,0 +1,37 @@
/**
* Shared buffers and types — extracted to break circular dependency
* between server.ts and browser-manager.ts
*/
export interface LogEntry {
timestamp: number;
level: string;
text: string;
}
export interface NetworkEntry {
timestamp: number;
method: string;
url: string;
status?: number;
duration?: number;
size?: number;
}
export const consoleBuffer: LogEntry[] = [];
export const networkBuffer: NetworkEntry[] = [];
const HIGH_WATER_MARK = 50_000;
export function addConsoleEntry(entry: LogEntry) {
consoleBuffer.push(entry);
if (consoleBuffer.length === HIGH_WATER_MARK) {
console.warn(`[browse] Console buffer reached ${HIGH_WATER_MARK} entries`);
}
}
export function addNetworkEntry(entry: NetworkEntry) {
networkBuffer.push(entry);
if (networkBuffer.length === HIGH_WATER_MARK) {
console.warn(`[browse] Network buffer reached ${HIGH_WATER_MARK} entries`);
}
}