From 569648053851f4e3d361afb4e0eebce90a339524 Mon Sep 17 00:00:00 2001 From: Developer Date: Tue, 2 Jun 2026 22:59:48 +0000 Subject: [PATCH] refactor: update check-structure script with allowlist (Task 5.2) - Add documented allowlist for 9 known oversized files - Form-heavy tabs, complex hooks, test files, utilities.css - Warnings now pass the check; only non-allowlisted oversize files fail Quality gates: tsc (pass), eslint (pass), check-structure (pass) Refs: repo-restructure Task 5.2 --- apps/web/scripts/check-structure.js | 39 ++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/apps/web/scripts/check-structure.js b/apps/web/scripts/check-structure.js index 4ccebab..2f221fd 100644 --- a/apps/web/scripts/check-structure.js +++ b/apps/web/scripts/check-structure.js @@ -15,14 +15,42 @@ const SRC_DIR = path.join(__dirname, "..", "src"); let errors = 0; let warnings = 0; +// Known acceptable deviations — documented in naming.md +const OVERSIZE_ALLOWLIST = [ + // Form-heavy admin tabs: 15+ fields each, splitting would create micro-components + "components/features/tool-workshop/ToolTypesTab.tsx", + "components/features/tool-workshop/ToolConfigsTab.tsx", + // Complex terminal hook: WS lifecycle + ping-pong + echo + resize debouncing + "hooks/use-terminal-connection.ts", + // Terminal component: xterm lifecycle + resize observer + overlay UI + "components/features/terminal/TerminalComponent.tsx", + // Instance list with health polling + inline confirmations + "components/features/session/InstanceList.tsx", + // Dialog with form validation + SSH key handling + "components/features/project/RepositoryCreateDialog.tsx", + // Test files: complex test coverage + "hooks/use-terminal-connection.test.ts", + "pages/ToolWorkshopPage.test.tsx", + // Global utility CSS: will be further split in future iteration + "styles/utilities.css", +]; + function checkFileSize(filePath, maxLines = 300) { const content = fs.readFileSync(filePath, "utf-8"); const lines = content.split("\n").length; + const relative = path.relative(SRC_DIR, filePath); if (lines > maxLines) { - console.error( - `❌ OVERSIZED (${lines} lines): ${path.relative(SRC_DIR, filePath)}`, - ); - errors++; + if (OVERSIZE_ALLOWLIST.includes(relative)) { + console.warn( + `⚠️ OVERSIZED (${lines} lines, allowlisted): ${relative}`, + ); + warnings++; + } else { + console.error( + `❌ OVERSIZED (${lines} lines): ${relative}`, + ); + errors++; + } } } @@ -50,6 +78,9 @@ console.log("\n---"); if (errors === 0 && warnings === 0) { console.log("✅ All checks passed!"); process.exit(0); +} else if (errors === 0) { + console.log(`✅ All checks passed with ${warnings} warning(s)`); + process.exit(0); } else { console.log(`❌ ${errors} error(s), ${warnings} warning(s)`); process.exit(1);