mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 02:29:33 +01:00
chore(web): remove frontend code and styles nothing reaches
The frontend JS is outside ESLint and knip, so this pass used an AST scan (every method, function and top-level constant in src/web/public, counted against identifiers, strings and index.html) plus a selector scan of both stylesheets. Each hit was confirmed by text search before it went. JavaScript - The ten run<Cli>() one-line wrappers and the quickStart() alias: run() has dispatched to _runCliMode(mode) since the launcher consolidation and nothing called the wrappers except tests, which now call the launcher. - The Agent Teams panel code that lost its event listeners in February: the team tasks panel, the teammate pane window, rebuildTeammateMap and the three maps that nothing filled any more. - Unreferenced methods: redockSession, refreshOrchestratorStatus, toggleSubagentPanel, minimizeSubagentWindow, openAllActiveSubagentWindows, pickBetterPath, getTodoIcon, deletePreset, closeRunSummary, saveSessionOptions, getAgentParentSessionId, _isUltracodeAgentMinimized. - Six unused constants and a few unused locals (an unused frame-time computation in the touch scroll loop among them). CSS - 62 classes and one id that no markup, script or test names: the old settings-item / settings-section layout, the pre-redesign respawn and context-settings rows, the existing-wizard card and others. 116 rules and about 770 lines. A dead class inside an :is() list only loses that alternative; the rule stays. Checked in a browser against an isolated instance: no console errors on desktop or phone, a shell session runs, and 96 screenshots (desktop, tablet and phone; settings, session options, add case, panels) are pixel-identical before and after, apart from clock times. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
f604deba3e
commit
6fb8b27768
17 files changed
+48
-1298
No files matched your search
@@ -10,7 +10,7 @@
|
||||
* reinitializes on a restart.
|
||||
*
|
||||
* Uses the same JSDOM + `runScripts: "dangerously"` approach as
|
||||
* test/custom-model-run-menu-ui.test.ts, extended with the DOM elements runCodex() (the
|
||||
* test/custom-model-run-menu-ui.test.ts, extended with the DOM elements the codex launch (the
|
||||
* CLI this was reported against) reads.
|
||||
*
|
||||
* Port: none.
|
||||
@@ -221,7 +221,7 @@ describe('_quickStartWithCustomModelConfirm', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('runCodex(): one-shot custom-model launch (the CLI this was reported against)', () => {
|
||||
describe('the codex launch: one-shot custom-model launch (the CLI this was reported against)', () => {
|
||||
it('folds _pendingCustomModelForLaunch into the quick-start body as customModel', async () => {
|
||||
const { win, app } = bootApp();
|
||||
(win as unknown as { fetch: typeof fetch }).fetch = (async (url: string, opts?: any) => {
|
||||
@@ -232,7 +232,7 @@ describe('runCodex(): one-shot custom-model launch (the CLI this was reported ag
|
||||
}) as unknown as typeof fetch;
|
||||
|
||||
app._pendingCustomModelForLaunch = { endpointId: 'llama-box', modelId: 'qwen3' };
|
||||
await app.runCodex();
|
||||
await app._runCliMode('codex');
|
||||
expect(app._lastReportedError).toBeUndefined();
|
||||
});
|
||||
|
||||
@@ -245,7 +245,7 @@ describe('runCodex(): one-shot custom-model launch (the CLI this was reported ag
|
||||
return { json: async () => ({ success: true, data: { sessionId: 's1' } }) };
|
||||
}) as unknown as typeof fetch;
|
||||
|
||||
await app.runCodex();
|
||||
await app._runCliMode('codex');
|
||||
expect(app._lastReportedError).toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -70,11 +70,9 @@ describe('OpenCode session initial resize', () => {
|
||||
// NOT pre-set activeSessionId before calling selectSession. If it did,
|
||||
// selectSession would early-return and skip sendResize.
|
||||
//
|
||||
// PR B2 consolidated runOpenCode() (and 7 siblings) into one shared
|
||||
// _runCliMode(mode) — runOpenCode is now a one-line wrapper
|
||||
// (`return this._runCliMode('opencode')`), so inspecting ITS source would
|
||||
// never see the real launch logic and this check would pass vacuously
|
||||
// regardless of what _runCliMode actually does. Inspect _runCliMode itself.
|
||||
// PR B2 consolidated the per-CLI launchers into one shared
|
||||
// _runCliMode(mode), so that is where the real launch logic lives and
|
||||
// what this check inspects.
|
||||
({ context, page } = await freshPage());
|
||||
await navigateAndWait(page);
|
||||
|
||||
@@ -151,7 +149,7 @@ describe('OpenCode session initial resize', () => {
|
||||
|
||||
expect(sessionId).toBeTruthy();
|
||||
|
||||
// Call selectSession (which is what runOpenCode does after fix)
|
||||
// Call selectSession (which is what the opencode launch does after fix)
|
||||
await page.evaluate(async (sid: string) => {
|
||||
const app = (window as unknown as { app: { selectSession: (id: string) => Promise<void> } }).app;
|
||||
await app.selectSession(sid);
|
||||
|
||||
+23
-33
@@ -160,7 +160,7 @@ describe('Run launch synchronization', () => {
|
||||
* is active wipes that session's terminal, and _cleanupPreviousSession()
|
||||
* then serializes the wiped view into its restore snapshot. Asserting on the
|
||||
* helpers alone cannot see that, so pin the call sites here. This also
|
||||
* covers run modes added later, which is how runAntigravity was caught.
|
||||
* covers run modes added later, which is how the antigravity launch was caught.
|
||||
*/
|
||||
it('routes every run mode through the ownership helpers, never the terminal directly', () => {
|
||||
const src = readFileSync(resolve(import.meta.dirname, '../src/web/public/session-ui.js'), 'utf8');
|
||||
@@ -168,15 +168,11 @@ describe('Run launch synchronization', () => {
|
||||
// Methods live in one Object.assign(prototype, {...}) block at a fixed
|
||||
// 2-space indent, so `\n },` reliably closes the one we are inside.
|
||||
//
|
||||
// `(\w*)` in the param list, not `()`, and the leading `_?`: PR B2
|
||||
// consolidated the eight run<Mode>() bodies into one shared
|
||||
// `_runCliMode(mode)`, and the ORIGINAL `\(\)`-only pattern matched every
|
||||
// one-line wrapper (`async runOpenCode() { return this._runCliMode(...) }`)
|
||||
// but not `_runCliMode` itself, where the real terminal-ownership logic
|
||||
// now lives — so this guard could see 8 clean one-liners and stay green
|
||||
// while the actual bug shipped unseen for all eight external CLIs at
|
||||
// once. Confirmed live: adding `this.terminal.clear()` to `_runCliMode`
|
||||
// left this test 32/32 green under the old pattern.
|
||||
// The leading `_?` matters: PR B2 consolidated the per-CLI run<Mode>()
|
||||
// bodies into one shared `_runCliMode(mode)`, where the real
|
||||
// terminal-ownership logic lives, and a `\(\)`-only pattern never matched
|
||||
// it. Confirmed live: adding `this.terminal.clear()` to `_runCliMode` left
|
||||
// this test 32/32 green under the old pattern.
|
||||
const bodies = new Map<string, string>();
|
||||
// Any parameter list (`(mode, options = {})` included), never `\(\w*\)`
|
||||
// alone, or a launcher that grew a second parameter silently drops out.
|
||||
@@ -195,12 +191,6 @@ describe('Run launch synchronization', () => {
|
||||
'runClaude',
|
||||
'runShell',
|
||||
'_runCliMode',
|
||||
'runOpenCode',
|
||||
'runCodex',
|
||||
'runGemini',
|
||||
'runAntigravity',
|
||||
'runPi',
|
||||
'runGrok',
|
||||
])
|
||||
);
|
||||
|
||||
@@ -773,7 +763,7 @@ describe('Codex quick start settings', () => {
|
||||
selected.push(id);
|
||||
};
|
||||
|
||||
await app.runCodex();
|
||||
await app._runCliMode('codex');
|
||||
|
||||
expect(requests.find((req) => req.url === '/api/quick-start')?.body).toMatchObject({
|
||||
caseName: 'codex-case',
|
||||
@@ -1167,12 +1157,12 @@ describe('toolbar instance count', () => {
|
||||
});
|
||||
|
||||
describe('Gemini quick start', () => {
|
||||
// Regression guard for the ApiResponse-envelope unwrap in runGemini(): the
|
||||
// Regression guard for the ApiResponse-envelope unwrap in the gemini launch: the
|
||||
// status check must read `.data.available` and the quick-start response must
|
||||
// read `.data.sessionId`. Reading the raw shape (pre-fix) silently bails on
|
||||
// the status check and never selects the new tab — exactly the two blockers
|
||||
// caught in PR #134 review.
|
||||
it('drives runGemini() through the {success,data} envelope and selects the new session', async () => {
|
||||
it('drives the gemini launch through the {success,data} envelope and selects the new session', async () => {
|
||||
const elements: Record<string, any> = {
|
||||
quickStartCase: { value: 'gemini-case' },
|
||||
tabCount: { value: '1' },
|
||||
@@ -1214,7 +1204,7 @@ describe('Gemini quick start', () => {
|
||||
selected.push(id);
|
||||
};
|
||||
|
||||
await app.runGemini();
|
||||
await app._runCliMode('gemini');
|
||||
|
||||
expect(requests.find((req) => req.url === '/api/quick-start')?.body).toMatchObject({
|
||||
caseName: 'gemini-case',
|
||||
@@ -1226,8 +1216,8 @@ describe('Gemini quick start', () => {
|
||||
});
|
||||
|
||||
describe('Antigravity quick start', () => {
|
||||
// Same envelope-unwrap regression guard as the Gemini block above, for runAntigravity().
|
||||
it('drives runAntigravity() through the {success,data} envelope and selects the new session', async () => {
|
||||
// Same envelope-unwrap regression guard as the Gemini block above, for antigravity.
|
||||
it('drives the antigravity launch through the {success,data} envelope and selects the new session', async () => {
|
||||
const elements: Record<string, any> = {
|
||||
quickStartCase: { value: 'ag-case' },
|
||||
tabCount: { value: '1' },
|
||||
@@ -1268,7 +1258,7 @@ describe('Antigravity quick start', () => {
|
||||
selected.push(id);
|
||||
};
|
||||
|
||||
await app.runAntigravity();
|
||||
await app._runCliMode('antigravity');
|
||||
|
||||
expect(requests.find((req) => req.url === '/api/quick-start')?.body).toMatchObject({
|
||||
caseName: 'ag-case',
|
||||
@@ -1280,11 +1270,11 @@ describe('Antigravity quick start', () => {
|
||||
});
|
||||
|
||||
describe('Pi quick start', () => {
|
||||
// Same envelope-unwrap regression guard as the blocks above, for runPi(), plus the
|
||||
// Same envelope-unwrap regression guard as the blocks above, for pi, plus the
|
||||
// rule that makes pi different: it must send NO piConfig. Pi has no permission
|
||||
// prompts, and `approveProjectTrust` would opt the session into EXECUTING
|
||||
// repo-supplied TypeScript — never something a Run button decides silently.
|
||||
it('drives runPi() through the {success,data} envelope and sends no piConfig', async () => {
|
||||
it('drives the pi launch through the {success,data} envelope and sends no piConfig', async () => {
|
||||
const elements: Record<string, any> = {
|
||||
quickStartCase: { value: 'pi-case' },
|
||||
tabCount: { value: '1' },
|
||||
@@ -1327,7 +1317,7 @@ describe('Pi quick start', () => {
|
||||
selected.push(id);
|
||||
};
|
||||
|
||||
await app.runPi();
|
||||
await app._runCliMode('pi');
|
||||
|
||||
const body = requests.find((req) => req.url === '/api/quick-start')?.body;
|
||||
expect(body).toMatchObject({ caseName: 'pi-case', mode: 'pi' });
|
||||
@@ -1359,7 +1349,7 @@ describe('Pi quick start', () => {
|
||||
const errors: string[] = [];
|
||||
app._reportSessionLaunchError = (_owns: boolean, msg: string) => errors.push(msg);
|
||||
|
||||
await app.runPi();
|
||||
await app._runCliMode('pi');
|
||||
|
||||
expect(requests).toEqual(['/api/pi/status']);
|
||||
expect(errors[0]).toContain('@earendil-works/pi-coding-agent');
|
||||
@@ -1367,13 +1357,13 @@ describe('Pi quick start', () => {
|
||||
});
|
||||
|
||||
describe('Grok quick start', () => {
|
||||
// Same envelope-unwrap regression guard as the blocks above, for runGrok(),
|
||||
// Same envelope-unwrap regression guard as the blocks above, for grok,
|
||||
// plus the rule that makes grok the OPPOSITE of pi: the Run button DOES send
|
||||
// `grokConfig: { alwaysApprove: true }` (grok's bypassPermissions mode), the
|
||||
// same product decision as runAntigravity's dangerouslySkipPermissions and
|
||||
// same product decision as antigravity's dangerouslySkipPermissions and
|
||||
// claude's --dangerously-skip-permissions. The multi-user clamp strips it
|
||||
// server-side for non-granted owners.
|
||||
it('drives runGrok() through the {success,data} envelope and sends alwaysApprove', async () => {
|
||||
it('drives the grok launch through the {success,data} envelope and sends alwaysApprove', async () => {
|
||||
const elements: Record<string, any> = {
|
||||
quickStartCase: { value: 'grok-case' },
|
||||
tabCount: { value: '1' },
|
||||
@@ -1419,7 +1409,7 @@ describe('Grok quick start', () => {
|
||||
selected.push(id);
|
||||
};
|
||||
|
||||
await app.runGrok();
|
||||
await app._runCliMode('grok');
|
||||
|
||||
const body = requests.find((req) => req.url === '/api/quick-start')?.body;
|
||||
expect(body).toMatchObject({
|
||||
@@ -1454,7 +1444,7 @@ describe('Grok quick start', () => {
|
||||
const errors: string[] = [];
|
||||
app._reportSessionLaunchError = (_owns: boolean, msg: string) => errors.push(msg);
|
||||
|
||||
await app.runGrok();
|
||||
await app._runCliMode('grok');
|
||||
|
||||
expect(requests).toEqual(['/api/grok/status']);
|
||||
expect(errors[0]).toContain('https://x.ai/cli/install.sh');
|
||||
@@ -1516,7 +1506,7 @@ describe('Grok quick start', () => {
|
||||
selected.push(id);
|
||||
};
|
||||
|
||||
await app.runGrok();
|
||||
await app._runCliMode('grok');
|
||||
|
||||
const names = requests.filter((r) => r.url === '/api/quick-start').map((r) => r.body.sessionName);
|
||||
expect(names).toEqual(['w1-grok-case', 'w2-grok-case', 'w3-grok-case']);
|
||||
|
||||
Reference in new issue
Block a user