🧹 Refactor duplicated visualization logic in CLI export#33
🧹 Refactor duplicated visualization logic in CLI export#33saurabhsharma2u wants to merge 2 commits into
Conversation
Consolidate visualization logic by replacing manual HTML generation in `plugins/cli/src/utils/exportRunner.ts` with `generateHtml` from `@crawlith/core`. This ensures consistent and secure (minified + escaped) JSON output for both `html` and `visualize` export formats. - Remove `SITEGRAPH_HTML` import in `exportRunner.ts` - Replace inline HTML generation with `generateHtml` call - Add `plugins/cli/tests/exportRunner.test.ts` to verify export functionality
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Make the file path assertion in `plugins/cli/tests/exportRunner.test.ts` cross-platform by normalizing path separators. This resolves an `AssertionError` on Windows where `mock.calls` contained backslashes. - Normalize backslashes to forward slashes in test assertion - Check for suffix `output/sitegraph.html` instead of exact path match
|
Closing as this refactoring was already completed and merged in PR 37. |
This PR addresses the "Duplicated Graph Visualization Code" issue by refactoring
plugins/cli/src/utils/exportRunner.ts.It replaces the duplicated inline logic for generating the
visualizeformat report with the sharedgenerateHtmlfunction from@crawlith/core.Key changes:
plugins/cli/src/utils/exportRunner.tsto usegenerateHtmlfor thevisualizeexport format.SITEGRAPH_HTMLimport inplugins/cli.plugins/cli/tests/exportRunner.test.tsto verify the export functionality.Verification:
plugins/cli/tests/exportRunner.test.tswhich confirms thatsitegraph.htmlis generated correctly withwindow.GRAPH_DATAinjected.plugins/cliandplugins/coreto ensure no regressions.generateHtmlcorrectly handles node sanitization (removinghtmlproperty) and JSON escaping viasafeJson.Result:
The codebase is now cleaner with less duplication, and the visualization report generation is centralized in
@crawlith/core.PR created automatically by Jules for task 8510790301748958396 started by @saurabhsharma2u