Astro provides hooks that integrations can implement to execute during certain parts of Astro’s lifecycle. In your case, you can use the astro:build:generated hook which is executed after a static production build has finished generating routes and assets. This hook allows you to access generated routes and assets before build artifacts are cleaned up.
Here is how you can define this hook in your integration:
'astro:build:generated'?: (options: { dir: URL }) => void | Promise<void>;
However, this is a very uncommon use case and Astro recommends using astro:build:done unless you really need to access the generated files before cleanup.
As for running the build process again programmatically with the same settings, Astro does not provide a built-in way to do this. You would need to manually trigger the build process again from your script.
Please note that the paths of the generated files change based on the OS where the code runs.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: