Harlowe doesn't have a documented JavaScript API and its engine has been deliberately designed to restrict what access an Author or Player has to its internals, it also doesn't have an equivalent of the SugarCube run-time (undocumented) "debug" JavaScript API.
This means that you would need to use JavaScript hacking techniques (like scope escalation) to be able to access those internals, and some of that hacking needs to be done within the contents of the project's Story JavaScript area so that you can use the results at run-time.
eg. before a story HTML file is created for the project.
... like adding a link that wasn't there, change the logic flow of the program removing some if or changing the condition inside it, etc...
These types of changes require modifying the contents of the Passage itself, and while it is possible to do that at run-time by using JavaScript to dynamically edit the contents of the <tw-passagedata> elements found within the story HTML file's <tw-storydata> element, it is far easier to first decompile the story HTML file back into your own Twine or TWEE project which you can then edit before compiling your own variation of the story HTML file.
How you do that decompiling depends on if you prefer to work with:
a. your own Text Editor
Use a TWEE command line utility like Tweego to generate a TWEE file from the story HTML, and to create a story HTML file once you've finished editing the TWEE file. This option works for both Twine 1.x and Twine 2.x based story HTML files.
b. with a Twine GUI based editor.
Harlowe is a Twine 2.x only story format so you would use the
Import From File option of the Twine 2.x application to create a new project based on the existing story HTML file. If the story HTML file was creates using any other story format then you would need to first determine with series of Twine (1.x or 2.x) was used to generate it, because you need to use the association Twine application to import the contained metadata into a new projects.
eg. If it is a Twine 1.x series story HTML file then you need to use the Twine 1.x application, and the Twine 2.x application if it is a Twine 2.x series story HTML file.
(the Twine 2.x application is NOT a later version of the Twine 1.x application, they are two different applications that can be used to edit Twine projects and to generate story HTML files.)