Summary
app.js contains all application logic in a single 4,707-line file: encryption, API key management, 4 API clients, FlutterFlow API client class, pubspec/YAML handling, commit orchestration, 3 pipeline functions, markdown rendering, UI orchestration, initialization, and feedback.
Risk Assessment
- Risk Level: High
- Likelihood: Certain — impacts every development session
- Impact: Growing — each feature addition increases risk
- Timeline: Accumulating now, rewrite pressure within 12 months
Current State
A src/ directory exists with ffState/, fileUtils/, types/ subdirectories — suggesting a module split was started but never completed.
Impact Trajectory
- Today: Cognitive overload, long git diffs, merge conflicts
- 6 months: Fear of touching code — changes cascade unpredictably
- 12 months: Rewrite pressure because patching becomes too risky
Suggested Incremental Extraction
Start with pure-logic functions (no DOM dependencies):
| Module |
Lines |
Dependencies |
crypto.js |
218-362 |
None (Web Crypto API) |
pubspec.js |
~1700-2800 |
None (pure data) |
markdown-renderer.js |
3270-3450 |
highlight.js |
flutterflow-client.js |
1250-1459 |
None (fetch) |
api-clients.js |
992-1230 |
Global API keys |
pipeline.js |
2806-3260 |
API clients |
ui.js |
Remaining DOM code |
Everything above |
Each extraction should:
- Move the code to a new ES module file
- Export the public API
- Import in app.js (preserving behavior)
- Verify no regressions
Summary
app.jscontains all application logic in a single 4,707-line file: encryption, API key management, 4 API clients, FlutterFlow API client class, pubspec/YAML handling, commit orchestration, 3 pipeline functions, markdown rendering, UI orchestration, initialization, and feedback.Risk Assessment
Current State
A
src/directory exists withffState/,fileUtils/,types/subdirectories — suggesting a module split was started but never completed.Impact Trajectory
Suggested Incremental Extraction
Start with pure-logic functions (no DOM dependencies):
crypto.jspubspec.jsmarkdown-renderer.jsflutterflow-client.jsapi-clients.jspipeline.jsui.jsEach extraction should: