)]}'
{
  "commit": "a1762b94e6ddf5db0a0f6b7a5104fa236855320b",
  "tree": "7ec924eef43f400a9975e7ac1fb0b02fc7ae9de1",
  "parents": [
    "57d28bc892e9ec4d842593d6cdd944b6afba532e"
  ],
  "author": {
    "name": "Sean McCullough",
    "email": "banksean@gmail.com",
    "time": "Tue Jun 10 22:04:15 2025 +0000"
  },
  "committer": {
    "name": "Sean McCullough",
    "email": "banksean@gmail.com",
    "time": "Tue Jun 10 16:11:54 2025 -0700"
  },
  "message": "cmd/sketch: add -dump-dist internal flag to extract embedded filesystem\n\nAdd internal CLI flag to dump embedded /dist/ filesystem contents to\na specified directory for debugging and development purposes.\n\nProblem Analysis:\nDevelopers and debugging scenarios sometimes need access to the built\nembedded filesystem contents that are generated by webui.Build(). The\nembedded filesystem is created dynamically and cached, making it difficult\nto inspect or extract its contents for analysis, debugging, or external\nuse without complex workarounds.\n\nImplementation Changes:\n\n1. CLI Flag Addition:\n   - Added -dump-dist string flag as internal/debugging option\n   - Positioned in internal flags section alongside other developer tools\n   - Flag accepts filesystem path as parameter for output directory\n   - Implements early exit pattern after processing like -version and -list-models\n\n2. Filesystem Extraction Function:\n   - Created dumpDistFilesystem() function with comprehensive error handling\n   - Uses webui.Build() to generate the embedded filesystem\n   - Implements fs.WalkDir pattern for complete directory tree traversal\n   - Handles both files and directories with appropriate permissions (0o755 for dirs, default for files)\n\n3. File Copy Implementation:\n   - Uses io.Copy for efficient file content transfer\n   - Proper resource cleanup with defer statements for file handles\n   - Preserves directory structure and file hierarchy\n   - Creates output directory tree as needed with os.MkdirAll\n\n4. Error Handling and User Feedback:\n   - Comprehensive error messages for each failure point\n   - Clear success message showing output directory path\n   - Proper exit handling - program terminates after successful dump\n   - Validates output directory creation before proceeding\n\nTechnical Details:\n- Leverages existing webui.Build() infrastructure for filesystem generation\n- Added required imports: io, io/fs for filesystem operations\n- Uses filepath.Join for cross-platform path handling\n- Implements early exit pattern consistent with other informational flags\n- Positioned as internal flag visible only with -help-internal\n\nBenefits:\n- Enables inspection of generated webui assets for debugging\n- Supports development workflows requiring filesystem analysis\n- Provides clean extraction mechanism without modifying build process\n- Useful for troubleshooting webui bundle generation issues\n- Maintains separation as internal-only feature\n\nTesting:\n- Verified successful filesystem dump with proper directory structure\n- Tested error handling with invalid output paths\n- Confirmed program exits correctly after dump completion\n- Validated flag appears in -help-internal output\n- Tested with various output directory scenarios including existing/new paths\n\nThis addition provides essential debugging capability for webui filesystem\ninspection while maintaining clean separation as an internal development tool.\n\nCo-Authored-By: sketch \u003chello@sketch.dev\u003e\nChange-ID: s5fee523a25bc33dak\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2ec96995a5132c055bb0b4df144786294fbc9dff",
      "old_mode": 33188,
      "old_path": "cmd/sketch/main.go",
      "new_id": "4df1271c4966b49cce8edd7915f5fcb028a9d355",
      "new_mode": 33188,
      "new_path": "cmd/sketch/main.go"
    }
  ]
}
