xonecas.io
8356
Wx

www-xonecas-io / files

www-xonecas-io / tickets / 1012-rats-injection-script.md

3.5 KB
1---
2id: 1012
3title: rats injection script
4type: feature
5status: done
6priority: p2
7created: 2026-11-08T01:09:27Z
8updated: 2026-11-08T03:45:37Z
9source: human
10area: site
11moves: 2026-11-08T01:43:50Z inbox todo drag; 2026-11-08T02:43:19Z todo doing drag; 2026-11-08T02:45:41Z doing review agent; 2026-11-08T03:42:10Z review todo drag; 2026-11-08T03:42:40Z todo doing drag; 2026-11-08T03:44:31Z doing review agent; 2026-11-08T03:45:37Z review done drag
12---
13
14Rats provides a script, should be in your skill some where or on the cli. It's experimental so let's see if it works
15
16## Notes
17
18- 2026-11-08 01:09Z (agent): Triage: type feature (it was bug), area site, priority p2 kept. The ticket has only a title so far. I read 'rats injection script' as embedding the 'rat-king devnotes script' snippet in the site's dev builds, so you can Ctrl+click a page to file a ticket. That depends on 1002 (scaffold and dev server). Question: is that what you mean, or is it about something else?
19
20- 2026-11-08 02:45Z (agent): Done. The dev server ('make serve' / 'site serve') now inlines the Rats devnotes script before </body> in every HTML page it serves. 'site build' and public/ never carry it.
21  
22  - cmd/site/devnotes.js: the output of 'rat-king devnotes script', vendored as is.
23  - cmd/site/devnotes.go: wraps the file server, embeds the script and injects it into .html responses only.
24  
25  To use it: run 'rat-king devnotes' in this project's folder in a terminal tile, open the site on a loopback address, Ctrl+click anything.
26  
27  GOTCHA: the script only turns on for localhost/127.0.0.1. On http://192.168.122.10:8080 (the 1013 route) it stays off by design. From the host, use: ssh -L 8080:localhost:8080 -L 7287:localhost:7287 vm, then open http://localhost:8080.
28  
29  CHECKED (in the VM, headless agent-browser on 127.0.0.1:8080): script loaded, Ctrl+click on the homepage opened the form, Enter sent the request, and with no 'rat-king devnotes' running it replied 'Nothing answers on port 7287'. On 192.168.122.10 it stayed off. curl: /, /projects/ and other .html pages carry it, site.css is unchanged, 404 and ../ traversal still 404, public/ has no copy. go vet and go test pass.
30  
31  NOT CHECKED: a ticket actually filed through it. That needs 'rat-king devnotes' running and would put a test ticket on your board, so I left that first real one to you. The dev server is running with the change.
32
33- 2026-11-08 03:42Z (human): Rats was updated. this works different now. Check it out, set it up.
34
35- 2026-11-08 03:44Z (agent): Updated to the new Rats devnotes script. cmd/site/devnotes.js is the current 'rat-king devnotes script' output, vendored as is; devnotes.go is unchanged.
36  
37  What changed in Rats: the script now carries this project's id (prj_74ae87b16d2a) and posts it to the Rats app on the browser's machine (127.0.0.1:7287), which files it on the server. No 'rat-king devnotes' process, no loopback-only check, no SSH tunnel. So the 1013 route works: open http://192.168.122.10:8080 from the host with the Rats app open, Ctrl+click anything.
38  
39  CHECKED (in the VM): go vet and go test pass. Dev server restarted; / and /projects/ on 192.168.122.10:8080 carry the new script, public/index.html does not. agent-browser on http://192.168.122.10:8080: script active (it stayed off there before), Ctrl+click on the h1 opened the 'What should change?' form.
40  
41  NOT CHECKED: sending a ticket. The VM has no Rats app on 7287, so the send has to come from your host browser; that first real ticket is yours. The page has no Content-Security-Policy, so connect-src needs nothing.