feat(src): add if-viz CLI tool for local manifest visualisation#1166
feat(src): add if-viz CLI tool for local manifest visualisation#1166
Conversation
- New `if-viz` command serves output manifests locally and opens the GSF visualiser - Starts an Express static server with CORS headers on the manifest's directory - Opens the user's default browser via the `open` package (cross-platform) - Supports --port and --no-open flags - Add CLAUDE.md for Claude Code context - Add .scratch/ to .gitignore for local working files Co-Authored-By: Claude <noreply@anthropic.com>
jmcook1186
left a comment
There was a problem hiding this comment.
Hi @jawache - thanks for this cool feature, keen to merge it in.
Merging is currently blocked because we need signed commits.
Seems good, one thing that I noticed was the wildcard CORS - I'm not expert enough to judge whether this is a vector worth patching but the server serves the entire directory where the manifest is located with wildcard CORS meaning any malicious scripts in e.g. other open tabs in the user's browser could extract data in that directory. A problem if the user is serving manifests from ~/Documents or ~/home or even ~/if if they also have e.g. .env in there. A quick fix would be restricting the server to only serving yaml files.
Second thing is that we've encouraged use of our standard error classes and other helpers from @grnsft/if-core/utils to standardise the code, and discouraged use of the bare Error class used here. This code has some unique patterns compared to our other CLI commands, and it would be better if it was consistent.
Finally, we do request new features to be covered in unit tests.
I'm ambivalent to the Claude.md - we've got a pretty well-ossified, artisan, human-built project here. Folks using Claude can get their context from the docs and contribution guidelines, and typically have idiosyncratic preferences for the content of their project-level Claude.md files. But if there's enthusiasm for including this, I don't mind.
if-vizcommand serves output manifests locally and opens the GSF visualiseropenpackage (cross-platform)Types of changes
A description of the changes proposed in the Pull Request