diff --git a/docs/todo/LAMBDA_REFACTOR_PROGRESS.md b/docs/todo/LAMBDA_REFACTOR_PROGRESS.md index 192fd1940..5ce39422e 100644 --- a/docs/todo/LAMBDA_REFACTOR_PROGRESS.md +++ b/docs/todo/LAMBDA_REFACTOR_PROGRESS.md @@ -1,11 +1,11 @@ # Lambda-per-File Refactoring Progress -**Generated:** 2025-12-29T19:12:28.334Z +**Generated:** 2025-12-29T21:09:00.273Z ## Summary -- **Total files > 150 lines:** 53 -- **Pending:** 43 +- **Total files > 150 lines:** 52 +- **Pending:** 42 - **In Progress:** 0 - **Completed:** 0 - **Skipped:** 10 @@ -16,7 +16,7 @@ - **test:** 10 - **library:** 4 - **tool:** 4 -- **other:** 3 +- **other:** 2 - **dbal:** 1 ## Refactoring Queue @@ -30,7 +30,7 @@ Library and tool files - easiest to refactor - [ ] `frontends/nextjs/src/lib/db/database-admin/seed-default-data/css/categories/base.ts` (278 lines) - [ ] `frontends/nextjs/src/lib/nerd-mode-ide/templates/configs/base.ts` (267 lines) - [ ] `frontends/nextjs/src/lib/schema/default/forms.ts` (244 lines) -- [ ] `frontends/nextjs/src/lib/db/core/operations.ts` (190 lines) +- [ ] `frontends/nextjs/src/lib/db/core/operations.ts` (191 lines) - [ ] `tools/refactoring/cli/orchestrate-refactor.ts` (213 lines) - [ ] `tools/refactoring/orchestrate-refactor/functions/main.ts` (186 lines) - [ ] `tools/refactoring/error-as-todo-refactor/index.ts` (163 lines) @@ -40,7 +40,7 @@ Library and tool files - easiest to refactor DBAL and component files - moderate complexity -- [ ] `frontends/nextjs/src/lib/dbal/core/client/dbal-integration/DbalIntegrationUtils.ts` (174 lines) +- [ ] `frontends/nextjs/src/lib/dbal/core/client/dbal-integration/DbalIntegrationUtils.ts` (169 lines) - [ ] `frontends/nextjs/src/components/misc/data/QuickGuide.tsx` (297 lines) - [ ] `frontends/nextjs/src/components/misc/data/GenericPage.tsx` (274 lines) - [ ] `frontends/nextjs/src/components/molecules/overlay/DropdownMenu.tsx` (268 lines) @@ -48,7 +48,6 @@ DBAL and component files - moderate complexity - [ ] `frontends/nextjs/src/components/examples/ContactForm.example.tsx` (258 lines) - [ ] `frontends/nextjs/src/components/managers/component/ComponentHierarchyEditor.tsx` (242 lines) - [ ] `frontends/nextjs/src/components/managers/component/ComponentConfigDialog/Fields.tsx` (238 lines) -- [ ] `frontends/nextjs/src/components/editors/lua/blocks/BlockItem.tsx` (218 lines) - [ ] `frontends/nextjs/src/components/rendering/FieldRenderer.tsx` (210 lines) - [ ] `frontends/nextjs/src/components/ui/organisms/data/Form.tsx` (210 lines) - [ ] `frontends/nextjs/src/components/level5/tabs/PowerTransferTab.tsx` (207 lines) @@ -60,13 +59,13 @@ DBAL and component files - moderate complexity - [ ] `frontends/nextjs/src/components/editors/JsonEditor.tsx` (191 lines) - [ ] `frontends/nextjs/src/components/rendering/components/RenderNode.tsx` (188 lines) - [ ] `frontends/nextjs/src/components/misc/viewers/AuditLogViewer.tsx` (188 lines) +- [ ] `frontends/nextjs/src/components/misc/viewers/audit-log/Filters.tsx` (188 lines) - ... and 12 more -### Low Priority (3 files) +### Low Priority (2 files) - [ ] `frontends/nextjs/src/components/nerd-mode-ide/core/NerdModeIDE/useNerdIdeState.ts` (274 lines) - [ ] `frontends/nextjs/src/components/editors/lua/hooks/useLuaBlocksState/actions.ts` (208 lines) -- [ ] `frontends/nextjs/src/components/misc/demos/IRCWebchatDeclarative/functions/i-r-c-webchat-declarative.ts` (158 lines) ### Skipped Files (10) diff --git a/tools/refactoring/cli/orchestrate-refactor.ts b/tools/refactoring/cli/orchestrate-refactor.ts index d637d1961..53a48246c 100644 --- a/tools/refactoring/cli/orchestrate-refactor.ts +++ b/tools/refactoring/cli/orchestrate-refactor.ts @@ -10,7 +10,7 @@ * 5. Updates progress report */ -import { ASTLambdaRefactor } from '../ast-lambda-refactor' +import { refactorFile } from '../ast-lambda-refactor/functions/refactor-file' import * as fs from 'fs/promises' import * as path from 'path' import { loadFilesFromReport } from './utils/load-files-from-report' @@ -83,31 +83,26 @@ async function main() { console.log('='.repeat(60) + '\n') // Refactor files - const refactor = new ASTLambdaRefactor({ dryRun, verbose: true }) + // Note: refactorFile has been refactored and needs context object + // For now, we'll skip actual refactoring and just report the issue + + console.log('\n⚠️ WARNING: The refactoring tools have been refactored themselves and') + console.log(' have broken imports/exports. The tools need to be fixed first.') + console.log('\n📋 Files that would be refactored:') for (let i = 0; i < files.length; i++) { const file = files[i] - console.log(`\n[${i + 1}/${files.length}] Processing: ${file.path}`) - - try { - await refactor.refactorFile(file.path) - file.status = 'completed' - } catch (error) { - const errorMsg = error instanceof Error ? error.message : String(error) - if (errorMsg.includes('skipping') || errorMsg.includes('No functions')) { - file.status = 'skipped' - file.error = errorMsg - } else { - file.status = 'failed' - file.error = errorMsg - console.error(` ❌ Error: ${errorMsg}`) - } - } - - // Small delay to avoid overwhelming system - await new Promise(resolve => setTimeout(resolve, 100)) + console.log(` ${i + 1}. ${file.path} (${file.lines} lines)`) + file.status = 'skipped' + file.error = 'Refactoring tool needs repair - functions use "this" without class context' } + console.log('\n💡 To refactor these files manually:') + console.log(' 1. Extract functions to separate files in a functions/ subdirectory') + console.log(' 2. Create an index.ts with re-exports') + console.log(' 3. Create a Utils class wrapper') + console.log(' 4. Replace original file with re-export statement') + // Summary const summary = { total: files.length,