feat: save raw scraper JSON alongside .cook file on import
Build and Deploy / build-and-deploy (push) Successful in 1m18s

When importing a recipe, the raw JSON output from scrape-recipe is now
saved as <recipe-name>.json in the recipe directory alongside the .cook
file. This lets users inspect the intermediate schema.org representation
to debug step breakdown or ingredient parsing issues.
This commit is contained in:
2026-05-20 15:50:17 -04:00
parent d77f4eb59f
commit 6081534c10
+8 -2
View File
@@ -39,7 +39,7 @@ import System.FSNotify (
watchDir,
withManagerConf,
)
import System.FilePath (makeRelative, (</>))
import System.FilePath (makeRelative, takeBaseName, (</>))
import qualified Data.Aeson as A
import qualified Data.ByteString as BS
@@ -324,7 +324,13 @@ runImportPipeline recipeDir url = do
let cookText = CooklangPrint.renderRecipe recipe
filename = CooklangPrint.filenameFromTitle (soName schema)
filepath = recipeDir </> filename
-- Step 4: write the .cook file
-- Save raw JSON alongside the .cook for debugging
jsonFilename = takeBaseName filename <> ".json"
jsonFilepath = recipeDir </> jsonFilename
-- Step 4: write raw JSON from scraper
putStrLn $ "[roux] writing raw scraper JSON to " <> jsonFilepath
LB.writeFile jsonFilepath stdoutBytes
-- Step 5: write the .cook file
putStrLn $ "[roux] writing imported recipe to " <> filepath
BS.writeFile filepath (TE.encodeUtf8 cookText)
putStrLn $ "[roux] successfully imported " <> T.unpack url <> " as " <> filename